shieldcortex 3.4.24 → 3.4.26

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.
Files changed (37) hide show
  1. package/dashboard/.next/standalone/dashboard/.next/BUILD_ID +1 -1
  2. package/dashboard/.next/standalone/dashboard/.next/build-manifest.json +2 -2
  3. package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.html +2 -2
  4. package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.rsc +1 -1
  5. package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  6. package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  7. package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  8. package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  9. package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  10. package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.html +1 -1
  11. package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.rsc +1 -1
  12. package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
  13. package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  14. package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
  15. package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  16. package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  17. package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  18. package/dashboard/.next/standalone/dashboard/.next/server/app/index.html +1 -1
  19. package/dashboard/.next/standalone/dashboard/.next/server/app/index.rsc +2 -2
  20. package/dashboard/.next/standalone/dashboard/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  21. package/dashboard/.next/standalone/dashboard/.next/server/app/index.segments/_full.segment.rsc +2 -2
  22. package/dashboard/.next/standalone/dashboard/.next/server/app/index.segments/_head.segment.rsc +1 -1
  23. package/dashboard/.next/standalone/dashboard/.next/server/app/index.segments/_index.segment.rsc +1 -1
  24. package/dashboard/.next/standalone/dashboard/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  25. package/dashboard/.next/standalone/dashboard/.next/server/app/page_client-reference-manifest.js +1 -1
  26. package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_3051539d._.js +1 -1
  27. package/dashboard/.next/standalone/dashboard/.next/server/pages/404.html +1 -1
  28. package/dashboard/.next/standalone/dashboard/.next/server/pages/500.html +2 -2
  29. package/dashboard/.next/standalone/dashboard/.next/static/chunks/c95cfef94573d615.js +9 -0
  30. package/dist/api/visualization-server.js +24 -1
  31. package/dist/defence/iron-dome/index.d.ts +4 -0
  32. package/dist/defence/iron-dome/index.js +21 -0
  33. package/package.json +1 -1
  34. package/dashboard/.next/standalone/dashboard/.next/static/chunks/7eae8665a0fe51b7.js +0 -9
  35. /package/dashboard/.next/standalone/dashboard/.next/static/{tgpyN2TlgxxQBaXJDJfBL → Z6RWGYPe0sDAmBNZV4HnL}/_buildManifest.js +0 -0
  36. /package/dashboard/.next/standalone/dashboard/.next/static/{tgpyN2TlgxxQBaXJDJfBL → Z6RWGYPe0sDAmBNZV4HnL}/_clientMiddlewareManifest.json +0 -0
  37. /package/dashboard/.next/standalone/dashboard/.next/static/{tgpyN2TlgxxQBaXJDJfBL → Z6RWGYPe0sDAmBNZV4HnL}/_ssgManifest.js +0 -0
@@ -1,9 +0,0 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,16813,(e,t,r)=>{"use strict";Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),r.isUnsafeProperty=function(e){return"__proto__"===e}},76906,(e,t,r)=>{"use strict";Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),r.isDeepKey=function(e){switch(typeof e){case"number":case"symbol":return!1;case"string":return e.includes(".")||e.includes("[")||e.includes("]")}}},25483,(e,t,r)=>{"use strict";Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),r.toKey=function(e){return"string"==typeof e||"symbol"==typeof e?e:Object.is(e?.valueOf?.(),-0)?"-0":String(e)}},41181,(e,t,r)=>{"use strict";Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),r.toString=function e(t){if(null==t)return"";if("string"==typeof t)return t;if(Array.isArray(t))return t.map(e).join(",");let r=String(t);return"0"===r&&Object.is(Number(t),-0)?"-0":r}},2209,(e,t,r)=>{"use strict";Object.defineProperty(r,Symbol.toStringTag,{value:"Module"});let n=e.r(41181),i=e.r(25483);r.toPath=function(e){if(Array.isArray(e))return e.map(i.toKey);if("symbol"==typeof e)return[e];e=n.toString(e);let t=[],r=e.length;if(0===r)return t;let a=0,s="",l="",o=!1;for(46===e.charCodeAt(0)&&(t.push(""),a++);a<r;){let n=e[a];l?"\\"===n&&a+1<r?s+=e[++a]:n===l?l="":s+=n:o?'"'===n||"'"===n?l=n:"]"===n?(o=!1,t.push(s),s=""):s+=n:"["===n?(o=!0,s&&(t.push(s),s="")):"."===n?s&&(t.push(s),s=""):s+=n,a++}return s&&t.push(s),t}},350,(e,t,r)=>{"use strict";Object.defineProperty(r,Symbol.toStringTag,{value:"Module"});let n=e.r(16813),i=e.r(76906),a=e.r(25483),s=e.r(2209);r.get=function e(t,r,l){if(null==t)return l;switch(typeof r){case"string":{if(n.isUnsafeProperty(r))return l;let a=t[r];if(void 0===a)if(i.isDeepKey(r))return e(t,s.toPath(r),l);else return l;return a}case"number":case"symbol":{"number"==typeof r&&(r=a.toKey(r));let e=t[r];if(void 0===e)return l;return e}default:{if(Array.isArray(r)){var o=t,c=r,d=l;if(0===c.length)return d;let e=o;for(let t=0;t<c.length;t++){if(null==e||n.isUnsafeProperty(c[t]))return d;e=e[c[t]]}return void 0===e?d:e}if(r=Object.is(r?.valueOf(),-0)?"-0":String(r),n.isUnsafeProperty(r))return l;let e=t[r];if(void 0===e)return l;return e}}}},78712,(e,t,r)=>{t.exports=e.r(350).get},72735,(e,t,r)=>{"use strict";var n=e.r(4),i="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},a=n.useSyncExternalStore,s=n.useRef,l=n.useEffect,o=n.useMemo,c=n.useDebugValue;r.useSyncExternalStoreWithSelector=function(e,t,r,n,d){var u=s(null);if(null===u.current){var h={hasValue:!1,value:null};u.current=h}else h=u.current;var p=a(e,(u=o(function(){function e(e){if(!l){if(l=!0,a=e,e=n(e),void 0!==d&&h.hasValue){var t=h.value;if(d(t,e))return s=t}return s=e}if(t=s,i(a,e))return t;var r=n(e);return void 0!==d&&d(t,r)?(a=e,t):(a=e,s=r)}var a,s,l=!1,o=void 0===r?null:r;return[function(){return e(t())},null===o?void 0:function(){return e(o())}]},[t,r,n,d]))[0],u[1]);return l(function(){h.hasValue=!0,h.value=p},[p]),c(p),p}},8710,(e,t,r)=>{"use strict";t.exports=e.r(72735)},39413,(e,t,r)=>{"use strict";function n(e){return"symbol"==typeof e?1:null===e?2:void 0===e?3:4*(e!=e)}Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),r.compareValues=(e,t,r)=>{if(e!==t){let i=n(e),a=n(t);if(i===a&&0===i){if(e<t)return"desc"===r?1:-1;if(e>t)return"desc"===r?-1:1}return"desc"===r?a-i:i-a}return 0}},34649,(e,t,r)=>{"use strict";Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),r.isSymbol=function(e){return"symbol"==typeof e||e instanceof Symbol}},35462,(e,t,r)=>{"use strict";Object.defineProperty(r,Symbol.toStringTag,{value:"Module"});let n=e.r(34649),i=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a=/^\w*$/;r.isKey=function(e,t){return!Array.isArray(e)&&(!!("number"==typeof e||"boolean"==typeof e||null==e||n.isSymbol(e))||"string"==typeof e&&(a.test(e)||!i.test(e))||null!=t&&Object.hasOwn(t,e))}},83230,(e,t,r)=>{"use strict";Object.defineProperty(r,Symbol.toStringTag,{value:"Module"});let n=e.r(39413),i=e.r(35462),a=e.r(2209);r.orderBy=function(e,t,r,s){if(null==e)return[];r=s?void 0:r,Array.isArray(e)||(e=Object.values(e)),Array.isArray(t)||(t=null==t?[null]:[t]),0===t.length&&(t=[null]),Array.isArray(r)||(r=null==r?[]:[r]),r=r.map(e=>String(e));let l=(e,t)=>{let r=e;for(let e=0;e<t.length&&null!=r;++e)r=r[t[e]];return r},o=t.map(e=>(Array.isArray(e)&&1===e.length&&(e=e[0]),null==e||"function"==typeof e||Array.isArray(e)||i.isKey(e))?e:{key:e,path:a.toPath(e)});return e.map(e=>({original:e,criteria:o.map(t=>{var r,n;return r=t,null==(n=e)||null==r?n:"object"==typeof r&&"key"in r?Object.hasOwn(n,r.key)?n[r.key]:l(n,r.path):"function"==typeof r?r(n):Array.isArray(r)?l(n,r):"object"==typeof n?n[r]:n})})).slice().sort((e,t)=>{for(let i=0;i<o.length;i++){let a=n.compareValues(e.criteria[i],t.criteria[i],r[i]);if(0!==a)return a}return 0}).map(e=>e.original)}},9728,(e,t,r)=>{"use strict";Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),r.flatten=function(e,t=1){let r=[],n=Math.floor(t),i=(e,t)=>{for(let a=0;a<e.length;a++){let s=e[a];Array.isArray(s)&&t<n?i(s,t+1):r.push(s)}};return i(e,0),r}},20272,(e,t,r)=>{"use strict";Object.defineProperty(r,Symbol.toStringTag,{value:"Module"});let n=/^(?:0|[1-9]\d*)$/;r.isIndex=function(e,t=Number.MAX_SAFE_INTEGER){switch(typeof e){case"number":return Number.isInteger(e)&&e>=0&&e<t;case"symbol":return!1;case"string":return n.test(e)}}},38308,(e,t,r)=>{"use strict";Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),r.isLength=function(e){return Number.isSafeInteger(e)&&e>=0}},79087,(e,t,r)=>{"use strict";Object.defineProperty(r,Symbol.toStringTag,{value:"Module"});let n=e.r(38308);r.isArrayLike=function(e){return null!=e&&"function"!=typeof e&&n.isLength(e.length)}},38180,(e,t,r)=>{"use strict";Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),r.isObject=function(e){return null!==e&&("object"==typeof e||"function"==typeof e)}},66480,(e,t,r)=>{"use strict";Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),r.isEqualsSameValueZero=function(e,t){return e===t||Number.isNaN(e)&&Number.isNaN(t)}},80682,(e,t,r)=>{"use strict";Object.defineProperty(r,Symbol.toStringTag,{value:"Module"});let n=e.r(20272),i=e.r(79087),a=e.r(38180),s=e.r(66480);r.isIterateeCall=function(e,t,r){return!!a.isObject(r)&&(!!("number"==typeof t&&i.isArrayLike(r)&&n.isIndex(t))&&t<r.length||"string"==typeof t&&t in r)&&s.isEqualsSameValueZero(r[t],e)}},33145,(e,t,r)=>{"use strict";Object.defineProperty(r,Symbol.toStringTag,{value:"Module"});let n=e.r(83230),i=e.r(9728),a=e.r(80682);r.sortBy=function(e,...t){let r=t.length;return r>1&&a.isIterateeCall(e,t[0],t[1])?t=[]:r>2&&a.isIterateeCall(t[0],t[1],t[2])&&(t=[t[0]]),n.orderBy(e,i.flatten(t),["asc"])}},28914,(e,t,r)=>{t.exports=e.r(33145).sortBy},50314,(e,t,r)=>{"use strict";Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),r.debounce=function(e,t,{signal:r,edges:n}={}){let i,a=null,s=null!=n&&n.includes("leading"),l=null==n||n.includes("trailing"),o=()=>{null!==a&&(e.apply(i,a),i=void 0,a=null)},c=null,d=()=>{null!=c&&clearTimeout(c),c=setTimeout(()=>{c=null,l&&o(),u()},t)},u=()=>{null!==c&&(clearTimeout(c),c=null),i=void 0,a=null},h=function(...e){if(r?.aborted)return;i=this,a=e;let t=null==c;d(),s&&t&&o()};return h.schedule=d,h.cancel=u,h.flush=()=>{o()},r?.addEventListener("abort",u,{once:!0}),h}},71501,(e,t,r)=>{"use strict";Object.defineProperty(r,Symbol.toStringTag,{value:"Module"});let n=e.r(50314);r.debounce=function(e,t=0,r={}){let i;"object"!=typeof r&&(r={});let{leading:a=!1,trailing:s=!0,maxWait:l}=r,o=[,,];a&&(o[0]="leading"),s&&(o[1]="trailing");let c=null,d=n.debounce(function(...t){i=e.apply(this,t),c=null},t,{edges:o}),u=function(...t){return null!=l&&(null===c&&(c=Date.now()),Date.now()-c>=l)?(i=e.apply(this,t),c=Date.now(),d.cancel(),d.schedule(),i):(d.apply(this,t),i)};return u.cancel=d.cancel,u.flush=()=>(d.flush(),i),u}},57443,(e,t,r)=>{"use strict";Object.defineProperty(r,Symbol.toStringTag,{value:"Module"});let n=e.r(71501);r.throttle=function(e,t=0,r={}){let{leading:i=!0,trailing:a=!0}=r;return n.debounce(e,t,{leading:i,maxWait:t,trailing:a})}},15325,(e,t,r)=>{t.exports=e.r(57443).throttle},82249,(e,t,r)=>{"use strict";Object.defineProperty(r,Symbol.toStringTag,{value:"Module"});let n=e.r(34649);r.toNumber=function(e){return n.isSymbol(e)?NaN:Number(e)}},94881,(e,t,r)=>{"use strict";Object.defineProperty(r,Symbol.toStringTag,{value:"Module"});let n=e.r(82249);r.toFinite=function(e){return e?(e=n.toNumber(e))===1/0||e===-1/0?(e<0?-1:1)*Number.MAX_VALUE:e==e?e:0:0===e?e:0}},63243,(e,t,r)=>{"use strict";Object.defineProperty(r,Symbol.toStringTag,{value:"Module"});let n=e.r(80682),i=e.r(94881);r.range=function(e,t,r){r&&"number"!=typeof r&&n.isIterateeCall(e,t,r)&&(t=r=void 0),e=i.toFinite(e),void 0===t?(t=e,e=0):t=i.toFinite(t),r=void 0===r?e<t?1:-1:i.toFinite(r);let a=Math.max(Math.ceil((t-e)/(r||1)),0),s=Array(a);for(let t=0;t<a;t++)s[t]=e,e+=r;return s}},56558,(e,t,r)=>{t.exports=e.r(63243).range},73335,(e,t,r)=>{!function(r){"use strict";var n,i={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},a=!0,s="[DecimalError] ",l=s+"Invalid argument: ",o=s+"Exponent out of range: ",c=Math.floor,d=Math.pow,u=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,h=c(1286742750677284.5),p={};function m(e,t){var r,n,i,s,l,o,c,d,u=e.constructor,h=u.precision;if(!e.s||!t.s)return t.s||(t=new u(e)),a?k(t,h):t;if(c=e.d,d=t.d,l=e.e,i=t.e,c=c.slice(),s=l-i){for(s<0?(n=c,s=-s,o=d.length):(n=d,i=l,o=c.length),s>(o=(l=Math.ceil(h/7))>o?l+1:o+1)&&(s=o,n.length=1),n.reverse();s--;)n.push(0);n.reverse()}for((o=c.length)-(s=d.length)<0&&(s=o,n=d,d=c,c=n),r=0;s;)r=(c[--s]=c[s]+d[s]+r)/1e7|0,c[s]%=1e7;for(r&&(c.unshift(r),++i),o=c.length;0==c[--o];)c.pop();return t.d=c,t.e=i,a?k(t,h):t}function f(e,t,r){if(e!==~~e||e<t||e>r)throw Error(l+e)}function x(e){var t,r,n,i=e.length-1,a="",s=e[0];if(i>0){for(a+=s,t=1;t<i;t++)(r=7-(n=e[t]+"").length)&&(a+=j(r)),a+=n;(r=7-(n=(s=e[t])+"").length)&&(a+=j(r))}else if(0===s)return"0";for(;s%10==0;)s/=10;return a+s}p.absoluteValue=p.abs=function(){var e=new this.constructor(this);return e.s&&(e.s=1),e},p.comparedTo=p.cmp=function(e){var t,r,n,i;if(e=new this.constructor(e),this.s!==e.s)return this.s||-e.s;if(this.e!==e.e)return this.e>e.e^this.s<0?1:-1;for(t=0,r=(n=this.d.length)<(i=e.d.length)?n:i;t<r;++t)if(this.d[t]!==e.d[t])return this.d[t]>e.d[t]^this.s<0?1:-1;return n===i?0:n>i^this.s<0?1:-1},p.decimalPlaces=p.dp=function(){var e=this.d.length-1,t=(e-this.e)*7;if(e=this.d[e])for(;e%10==0;e/=10)t--;return t<0?0:t},p.dividedBy=p.div=function(e){return y(this,new this.constructor(e))},p.dividedToIntegerBy=p.idiv=function(e){var t=this.constructor;return k(y(this,new t(e),0,1),t.precision)},p.equals=p.eq=function(e){return!this.cmp(e)},p.exponent=function(){return v(this)},p.greaterThan=p.gt=function(e){return this.cmp(e)>0},p.greaterThanOrEqualTo=p.gte=function(e){return this.cmp(e)>=0},p.isInteger=p.isint=function(){return this.e>this.d.length-2},p.isNegative=p.isneg=function(){return this.s<0},p.isPositive=p.ispos=function(){return this.s>0},p.isZero=function(){return 0===this.s},p.lessThan=p.lt=function(e){return 0>this.cmp(e)},p.lessThanOrEqualTo=p.lte=function(e){return 1>this.cmp(e)},p.logarithm=p.log=function(e){var t,r=this.constructor,i=r.precision,l=i+5;if(void 0===e)e=new r(10);else if((e=new r(e)).s<1||e.eq(n))throw Error(s+"NaN");if(this.s<1)throw Error(s+(this.s?"NaN":"-Infinity"));return this.eq(n)?new r(0):(a=!1,t=y(w(this,l),w(e,l),l),a=!0,k(t,i))},p.minus=p.sub=function(e){return e=new this.constructor(e),this.s==e.s?S(this,e):m(this,(e.s=-e.s,e))},p.modulo=p.mod=function(e){var t,r=this.constructor,n=r.precision;if(!(e=new r(e)).s)throw Error(s+"NaN");return this.s?(a=!1,t=y(this,e,0,1).times(e),a=!0,this.minus(t)):k(new r(this),n)},p.naturalExponential=p.exp=function(){return g(this)},p.naturalLogarithm=p.ln=function(){return w(this)},p.negated=p.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e},p.plus=p.add=function(e){return e=new this.constructor(e),this.s==e.s?m(this,e):S(this,(e.s=-e.s,e))},p.precision=p.sd=function(e){var t,r,n;if(void 0!==e&&!!e!==e&&1!==e&&0!==e)throw Error(l+e);if(t=v(this)+1,r=7*(n=this.d.length-1)+1,n=this.d[n]){for(;n%10==0;n/=10)r--;for(n=this.d[0];n>=10;n/=10)r++}return e&&t>r?t:r},p.squareRoot=p.sqrt=function(){var e,t,r,n,i,l,o,d=this.constructor;if(this.s<1){if(!this.s)return new d(0);throw Error(s+"NaN")}for(e=v(this),a=!1,0==(i=Math.sqrt(+this))||i==1/0?(((t=x(this.d)).length+e)%2==0&&(t+="0"),i=Math.sqrt(t),e=c((e+1)/2)-(e<0||e%2),n=new d(t=i==1/0?"5e"+e:(t=i.toExponential()).slice(0,t.indexOf("e")+1)+e)):n=new d(i.toString()),i=o=(r=d.precision)+3;;)if(n=(l=n).plus(y(this,l,o+2)).times(.5),x(l.d).slice(0,o)===(t=x(n.d)).slice(0,o)){if(t=t.slice(o-3,o+1),i==o&&"4999"==t){if(k(l,r+1,0),l.times(l).eq(this)){n=l;break}}else if("9999"!=t)break;o+=4}return a=!0,k(n,r)},p.times=p.mul=function(e){var t,r,n,i,s,l,o,c,d,u=this.constructor,h=this.d,p=(e=new u(e)).d;if(!this.s||!e.s)return new u(0);for(e.s*=this.s,r=this.e+e.e,(c=h.length)<(d=p.length)&&(s=h,h=p,p=s,l=c,c=d,d=l),s=[],n=l=c+d;n--;)s.push(0);for(n=d;--n>=0;){for(t=0,i=c+n;i>n;)o=s[i]+p[n]*h[i-n-1]+t,s[i--]=o%1e7|0,t=o/1e7|0;s[i]=(s[i]+t)%1e7|0}for(;!s[--l];)s.pop();return t?++r:s.shift(),e.d=s,e.e=r,a?k(e,u.precision):e},p.toDecimalPlaces=p.todp=function(e,t){var r=this,n=r.constructor;return(r=new n(r),void 0===e)?r:(f(e,0,1e9),void 0===t?t=n.rounding:f(t,0,8),k(r,e+v(r)+1,t))},p.toExponential=function(e,t){var r,n=this,i=n.constructor;return void 0===e?r=O(n,!0):(f(e,0,1e9),void 0===t?t=i.rounding:f(t,0,8),r=O(n=k(new i(n),e+1,t),!0,e+1)),r},p.toFixed=function(e,t){var r,n,i=this.constructor;return void 0===e?O(this):(f(e,0,1e9),void 0===t?t=i.rounding:f(t,0,8),r=O((n=k(new i(this),e+v(this)+1,t)).abs(),!1,e+v(n)+1),this.isneg()&&!this.isZero()?"-"+r:r)},p.toInteger=p.toint=function(){var e=this.constructor;return k(new e(this),v(this)+1,e.rounding)},p.toNumber=function(){return+this},p.toPower=p.pow=function(e){var t,r,i,l,o,d,u=this,h=u.constructor,p=+(e=new h(e));if(!e.s)return new h(n);if(!(u=new h(u)).s){if(e.s<1)throw Error(s+"Infinity");return u}if(u.eq(n))return u;if(i=h.precision,e.eq(n))return k(u,i);if(d=(t=e.e)>=(r=e.d.length-1),o=u.s,d){if((r=p<0?-p:p)<=0x1fffffffffffff){for(l=new h(n),t=Math.ceil(i/7+4),a=!1;r%2&&P((l=l.times(u)).d,t),0!==(r=c(r/2));)P((u=u.times(u)).d,t);return a=!0,e.s<0?new h(n).div(l):k(l,i)}}else if(o<0)throw Error(s+"NaN");return o=o<0&&1&e.d[Math.max(t,r)]?-1:1,u.s=1,a=!1,l=e.times(w(u,i+12)),a=!0,(l=g(l)).s=o,l},p.toPrecision=function(e,t){var r,n,i=this,a=i.constructor;return void 0===e?(r=v(i),n=O(i,r<=a.toExpNeg||r>=a.toExpPos)):(f(e,1,1e9),void 0===t?t=a.rounding:f(t,0,8),r=v(i=k(new a(i),e,t)),n=O(i,e<=r||r<=a.toExpNeg,e)),n},p.toSignificantDigits=p.tosd=function(e,t){var r=this.constructor;return void 0===e?(e=r.precision,t=r.rounding):(f(e,1,1e9),void 0===t?t=r.rounding:f(t,0,8)),k(new r(this),e,t)},p.toString=p.valueOf=p.val=p.toJSON=function(){var e=v(this),t=this.constructor;return O(this,e<=t.toExpNeg||e>=t.toExpPos)};var y=function(){function e(e,t){var r,n=0,i=e.length;for(e=e.slice();i--;)r=e[i]*t+n,e[i]=r%1e7|0,n=r/1e7|0;return n&&e.unshift(n),e}function t(e,t,r,n){var i,a;if(r!=n)a=r>n?1:-1;else for(i=a=0;i<r;i++)if(e[i]!=t[i]){a=e[i]>t[i]?1:-1;break}return a}function r(e,t,r){for(var n=0;r--;)e[r]-=n,n=+(e[r]<t[r]),e[r]=1e7*n+e[r]-t[r];for(;!e[0]&&e.length>1;)e.shift()}return function(n,i,a,l){var o,c,d,u,h,p,m,f,x,y,g,b,j,w,N,S,O,P,C=n.constructor,A=n.s==i.s?1:-1,E=n.d,M=i.d;if(!n.s)return new C(n);if(!i.s)throw Error(s+"Division by zero");for(d=0,c=n.e-i.e,O=M.length,N=E.length,f=(m=new C(A)).d=[];M[d]==(E[d]||0);)++d;if(M[d]>(E[d]||0)&&--c,(b=null==a?a=C.precision:l?a+(v(n)-v(i))+1:a)<0)return new C(0);if(b=b/7+2|0,d=0,1==O)for(u=0,M=M[0],b++;(d<N||u)&&b--;d++)j=1e7*u+(E[d]||0),f[d]=j/M|0,u=j%M|0;else{for((u=1e7/(M[0]+1)|0)>1&&(M=e(M,u),E=e(E,u),O=M.length,N=E.length),w=O,y=(x=E.slice(0,O)).length;y<O;)x[y++]=0;(P=M.slice()).unshift(0),S=M[0],M[1]>=1e7/2&&++S;do u=0,(o=t(M,x,O,y))<0?(g=x[0],O!=y&&(g=1e7*g+(x[1]||0)),(u=g/S|0)>1?(u>=1e7&&(u=1e7-1),p=(h=e(M,u)).length,y=x.length,1==(o=t(h,x,p,y))&&(u--,r(h,O<p?P:M,p))):(0==u&&(o=u=1),h=M.slice()),(p=h.length)<y&&h.unshift(0),r(x,h,y),-1==o&&(y=x.length,(o=t(M,x,O,y))<1&&(u++,r(x,O<y?P:M,y))),y=x.length):0===o&&(u++,x=[0]),f[d++]=u,o&&x[0]?x[y++]=E[w]||0:(x=[E[w]],y=1);while((w++<N||void 0!==x[0])&&b--)}return f[0]||f.shift(),m.e=c,k(m,l?a+v(m)+1:a)}}();function g(e,t){var r,i,s,l,c,u=0,h=0,p=e.constructor,m=p.precision;if(v(e)>16)throw Error(o+v(e));if(!e.s)return new p(n);for(null==t?(a=!1,c=m):c=t,l=new p(.03125);e.abs().gte(.1);)e=e.times(l),h+=5;for(c+=Math.log(d(2,h))/Math.LN10*2+5|0,r=i=s=new p(n),p.precision=c;;){if(i=k(i.times(e),c),r=r.times(++u),x((l=s.plus(y(i,r,c))).d).slice(0,c)===x(s.d).slice(0,c)){for(;h--;)s=k(s.times(s),c);return p.precision=m,null==t?(a=!0,k(s,m)):s}s=l}}function v(e){for(var t=7*e.e,r=e.d[0];r>=10;r/=10)t++;return t}function b(e,t,r){if(t>e.LN10.sd())throw a=!0,r&&(e.precision=r),Error(s+"LN10 precision limit exceeded");return k(new e(e.LN10),t)}function j(e){for(var t="";e--;)t+="0";return t}function w(e,t){var r,i,l,o,c,d,u,h,p,m=1,f=e,g=f.d,j=f.constructor,N=j.precision;if(f.s<1)throw Error(s+(f.s?"NaN":"-Infinity"));if(f.eq(n))return new j(0);if(null==t?(a=!1,h=N):h=t,f.eq(10))return null==t&&(a=!0),b(j,h);if(j.precision=h+=10,i=(r=x(g)).charAt(0),!(15e14>Math.abs(o=v(f))))return u=b(j,h+2,N).times(o+""),f=w(new j(i+"."+r.slice(1)),h-10).plus(u),j.precision=N,null==t?(a=!0,k(f,N)):f;for(;i<7&&1!=i||1==i&&r.charAt(1)>3;)i=(r=x((f=f.times(e)).d)).charAt(0),m++;for(o=v(f),i>1?(f=new j("0."+r),o++):f=new j(i+"."+r.slice(1)),d=c=f=y(f.minus(n),f.plus(n),h),p=k(f.times(f),h),l=3;;){if(c=k(c.times(p),h),x((u=d.plus(y(c,new j(l),h))).d).slice(0,h)===x(d.d).slice(0,h))return d=d.times(2),0!==o&&(d=d.plus(b(j,h+2,N).times(o+""))),d=y(d,new j(m),h),j.precision=N,null==t?(a=!0,k(d,N)):d;d=u,l+=2}}function N(e,t){var r,n,i;for((r=t.indexOf("."))>-1&&(t=t.replace(".","")),(n=t.search(/e/i))>0?(r<0&&(r=n),r+=+t.slice(n+1),t=t.substring(0,n)):r<0&&(r=t.length),n=0;48===t.charCodeAt(n);)++n;for(i=t.length;48===t.charCodeAt(i-1);)--i;if(t=t.slice(n,i)){if(i-=n,e.e=c((r=r-n-1)/7),e.d=[],n=(r+1)%7,r<0&&(n+=7),n<i){for(n&&e.d.push(+t.slice(0,n)),i-=7;n<i;)e.d.push(+t.slice(n,n+=7));n=7-(t=t.slice(n)).length}else n-=i;for(;n--;)t+="0";if(e.d.push(+t),a&&(e.e>h||e.e<-h))throw Error(o+r)}else e.s=0,e.e=0,e.d=[0];return e}function k(e,t,r){var n,i,s,l,u,p,m,f,x=e.d;for(l=1,s=x[0];s>=10;s/=10)l++;if((n=t-l)<0)n+=7,i=t,m=x[f=0];else{if((f=Math.ceil((n+1)/7))>=(s=x.length))return e;for(l=1,m=s=x[f];s>=10;s/=10)l++;n%=7,i=n-7+l}if(void 0!==r&&(u=m/(s=d(10,l-i-1))%10|0,p=t<0||void 0!==x[f+1]||m%s,p=r<4?(u||p)&&(0==r||r==(e.s<0?3:2)):u>5||5==u&&(4==r||p||6==r&&(n>0?i>0?m/d(10,l-i):0:x[f-1])%10&1||r==(e.s<0?8:7))),t<1||!x[0])return p?(s=v(e),x.length=1,t=t-s-1,x[0]=d(10,(7-t%7)%7),e.e=c(-t/7)||0):(x.length=1,x[0]=e.e=e.s=0),e;if(0==n?(x.length=f,s=1,f--):(x.length=f+1,s=d(10,7-n),x[f]=i>0?(m/d(10,l-i)%d(10,i)|0)*s:0),p)for(;;)if(0==f){1e7==(x[0]+=s)&&(x[0]=1,++e.e);break}else{if(x[f]+=s,1e7!=x[f])break;x[f--]=0,s=1}for(n=x.length;0===x[--n];)x.pop();if(a&&(e.e>h||e.e<-h))throw Error(o+v(e));return e}function S(e,t){var r,n,i,s,l,o,c,d,u,h,p=e.constructor,m=p.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new p(e),a?k(t,m):t;if(c=e.d,h=t.d,n=t.e,d=e.e,c=c.slice(),l=d-n){for((u=l<0)?(r=c,l=-l,o=h.length):(r=h,n=d,o=c.length),l>(i=Math.max(Math.ceil(m/7),o)+2)&&(l=i,r.length=1),r.reverse(),i=l;i--;)r.push(0);r.reverse()}else{for((u=(i=c.length)<(o=h.length))&&(o=i),i=0;i<o;i++)if(c[i]!=h[i]){u=c[i]<h[i];break}l=0}for(u&&(r=c,c=h,h=r,t.s=-t.s),o=c.length,i=h.length-o;i>0;--i)c[o++]=0;for(i=h.length;i>l;){if(c[--i]<h[i]){for(s=i;s&&0===c[--s];)c[s]=1e7-1;--c[s],c[i]+=1e7}c[i]-=h[i]}for(;0===c[--o];)c.pop();for(;0===c[0];c.shift())--n;return c[0]?(t.d=c,t.e=n,a?k(t,m):t):new p(0)}function O(e,t,r){var n,i=v(e),a=x(e.d),s=a.length;return t?(r&&(n=r-s)>0?a=a.charAt(0)+"."+a.slice(1)+j(n):s>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(i<0?"e":"e+")+i):i<0?(a="0."+j(-i-1)+a,r&&(n=r-s)>0&&(a+=j(n))):i>=s?(a+=j(i+1-s),r&&(n=r-i-1)>0&&(a=a+"."+j(n))):((n=i+1)<s&&(a=a.slice(0,n)+"."+a.slice(n)),r&&(n=r-s)>0&&(i+1===s&&(a+="."),a+=j(n))),e.s<0?"-"+a:a}function P(e,t){if(e.length>t)return e.length=t,!0}function C(e){if(!e||"object"!=typeof e)throw Error(s+"Object expected");var t,r,n,i=["precision",1,1e9,"rounding",0,8,"toExpNeg",-1/0,0,"toExpPos",0,1/0];for(t=0;t<i.length;t+=3)if(void 0!==(n=e[r=i[t]]))if(c(n)===n&&n>=i[t+1]&&n<=i[t+2])this[r]=n;else throw Error(l+r+": "+n);if(void 0!==(n=e[r="LN10"]))if(n==Math.LN10)this[r]=new this(n);else throw Error(l+r+": "+n);return this}if((i=function e(t){var r,n,i;function a(e){if(!(this instanceof a))return new a(e);if(this.constructor=a,e instanceof a){this.s=e.s,this.e=e.e,this.d=(e=e.d)?e.slice():e;return}if("number"==typeof e){if(0*e!=0)throw Error(l+e);if(e>0)this.s=1;else if(e<0)e=-e,this.s=-1;else{this.s=0,this.e=0,this.d=[0];return}if(e===~~e&&e<1e7){this.e=0,this.d=[e];return}return N(this,e.toString())}if("string"!=typeof e)throw Error(l+e);if(45===e.charCodeAt(0)?(e=e.slice(1),this.s=-1):this.s=1,u.test(e))N(this,e);else throw Error(l+e)}if(a.prototype=p,a.ROUND_UP=0,a.ROUND_DOWN=1,a.ROUND_CEIL=2,a.ROUND_FLOOR=3,a.ROUND_HALF_UP=4,a.ROUND_HALF_DOWN=5,a.ROUND_HALF_EVEN=6,a.ROUND_HALF_CEIL=7,a.ROUND_HALF_FLOOR=8,a.clone=e,a.config=a.set=C,void 0===t&&(t={}),t)for(r=0,i=["precision","rounding","toExpNeg","toExpPos","LN10"];r<i.length;)t.hasOwnProperty(n=i[r++])||(t[n]=this[n]);return a.config(t),a}(i)).default=i.Decimal=i,n=new i(1),"function"==typeof define&&define.amd){let t;e.r,void 0!==(t=i)&&e.v(t)}else t.exports?t.exports=i:(r||(r="u">typeof self&&self&&self.self==self?self:Function("return this")()),r.Decimal=i)}(e.e)},236,(e,t,r)=>{"use strict";var n=Object.prototype.hasOwnProperty,i="~";function a(){}function s(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function l(e,t,r,n,a){if("function"!=typeof r)throw TypeError("The listener must be a function");var l=new s(r,n||e,a),o=i?i+t:t;return e._events[o]?e._events[o].fn?e._events[o]=[e._events[o],l]:e._events[o].push(l):(e._events[o]=l,e._eventsCount++),e}function o(e,t){0==--e._eventsCount?e._events=new a:delete e._events[t]}function c(){this._events=new a,this._eventsCount=0}Object.create&&(a.prototype=Object.create(null),new a().__proto__||(i=!1)),c.prototype.eventNames=function(){var e,t,r=[];if(0===this._eventsCount)return r;for(t in e=this._events)n.call(e,t)&&r.push(i?t.slice(1):t);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(e)):r},c.prototype.listeners=function(e){var t=i?i+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var n=0,a=r.length,s=Array(a);n<a;n++)s[n]=r[n].fn;return s},c.prototype.listenerCount=function(e){var t=i?i+e:e,r=this._events[t];return r?r.fn?1:r.length:0},c.prototype.emit=function(e,t,r,n,a,s){var l=i?i+e:e;if(!this._events[l])return!1;var o,c,d=this._events[l],u=arguments.length;if(d.fn){switch(d.once&&this.removeListener(e,d.fn,void 0,!0),u){case 1:return d.fn.call(d.context),!0;case 2:return d.fn.call(d.context,t),!0;case 3:return d.fn.call(d.context,t,r),!0;case 4:return d.fn.call(d.context,t,r,n),!0;case 5:return d.fn.call(d.context,t,r,n,a),!0;case 6:return d.fn.call(d.context,t,r,n,a,s),!0}for(c=1,o=Array(u-1);c<u;c++)o[c-1]=arguments[c];d.fn.apply(d.context,o)}else{var h,p=d.length;for(c=0;c<p;c++)switch(d[c].once&&this.removeListener(e,d[c].fn,void 0,!0),u){case 1:d[c].fn.call(d[c].context);break;case 2:d[c].fn.call(d[c].context,t);break;case 3:d[c].fn.call(d[c].context,t,r);break;case 4:d[c].fn.call(d[c].context,t,r,n);break;default:if(!o)for(h=1,o=Array(u-1);h<u;h++)o[h-1]=arguments[h];d[c].fn.apply(d[c].context,o)}}return!0},c.prototype.on=function(e,t,r){return l(this,e,t,r,!1)},c.prototype.once=function(e,t,r){return l(this,e,t,r,!0)},c.prototype.removeListener=function(e,t,r,n){var a=i?i+e:e;if(!this._events[a])return this;if(!t)return o(this,a),this;var s=this._events[a];if(s.fn)s.fn!==t||n&&!s.once||r&&s.context!==r||o(this,a);else{for(var l=0,c=[],d=s.length;l<d;l++)(s[l].fn!==t||n&&!s[l].once||r&&s[l].context!==r)&&c.push(s[l]);c.length?this._events[a]=1===c.length?c[0]:c:o(this,a)}return this},c.prototype.removeAllListeners=function(e){var t;return e?(t=i?i+e:e,this._events[t]&&o(this,t)):(this._events=new a,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=i,c.EventEmitter=c,t.exports=c},5006,(e,t,r)=>{"use strict";Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),r.last=function(e){return e[e.length-1]}},1743,(e,t,r)=>{"use strict";Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),r.toArray=function(e){return Array.isArray(e)?e:Array.from(e)}},15967,(e,t,r)=>{"use strict";Object.defineProperty(r,Symbol.toStringTag,{value:"Module"});let n=e.r(5006),i=e.r(1743),a=e.r(79087);r.last=function(e){if(a.isArrayLike(e))return n.last(i.toArray(e))}},9944,(e,t,r)=>{t.exports=e.r(15967).last},53919,(e,t,r)=>{"use strict";var n="function"==typeof Symbol&&Symbol.for,i=n?Symbol.for("react.element"):60103,a=n?Symbol.for("react.portal"):60106,s=n?Symbol.for("react.fragment"):60107,l=n?Symbol.for("react.strict_mode"):60108,o=n?Symbol.for("react.profiler"):60114,c=n?Symbol.for("react.provider"):60109,d=n?Symbol.for("react.context"):60110,u=n?Symbol.for("react.async_mode"):60111,h=n?Symbol.for("react.concurrent_mode"):60111,p=n?Symbol.for("react.forward_ref"):60112,m=n?Symbol.for("react.suspense"):60113,f=n?Symbol.for("react.suspense_list"):60120,x=n?Symbol.for("react.memo"):60115,y=n?Symbol.for("react.lazy"):60116,g=n?Symbol.for("react.block"):60121,v=n?Symbol.for("react.fundamental"):60117,b=n?Symbol.for("react.responder"):60118,j=n?Symbol.for("react.scope"):60119;function w(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case i:switch(e=e.type){case u:case h:case s:case o:case l:case m:return e;default:switch(e=e&&e.$$typeof){case d:case p:case y:case x:case c:return e;default:return t}}case a:return t}}}function N(e){return w(e)===h}r.AsyncMode=u,r.ConcurrentMode=h,r.ContextConsumer=d,r.ContextProvider=c,r.Element=i,r.ForwardRef=p,r.Fragment=s,r.Lazy=y,r.Memo=x,r.Portal=a,r.Profiler=o,r.StrictMode=l,r.Suspense=m,r.isAsyncMode=function(e){return N(e)||w(e)===u},r.isConcurrentMode=N,r.isContextConsumer=function(e){return w(e)===d},r.isContextProvider=function(e){return w(e)===c},r.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===i},r.isForwardRef=function(e){return w(e)===p},r.isFragment=function(e){return w(e)===s},r.isLazy=function(e){return w(e)===y},r.isMemo=function(e){return w(e)===x},r.isPortal=function(e){return w(e)===a},r.isProfiler=function(e){return w(e)===o},r.isStrictMode=function(e){return w(e)===l},r.isSuspense=function(e){return w(e)===m},r.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===s||e===h||e===o||e===l||e===m||e===f||"object"==typeof e&&null!==e&&(e.$$typeof===y||e.$$typeof===x||e.$$typeof===c||e.$$typeof===d||e.$$typeof===p||e.$$typeof===v||e.$$typeof===b||e.$$typeof===j||e.$$typeof===g)},r.typeOf=w},29095,(e,t,r)=>{"use strict";t.exports=e.r(53919)},8284,(e,t,r)=>{"use strict";Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),r.isPlainObject=function(e){if("object"!=typeof e||null==e)return!1;if(null===Object.getPrototypeOf(e))return!0;if("[object Object]"!==Object.prototype.toString.call(e)){let t=e[Symbol.toStringTag];return null!=t&&!!Object.getOwnPropertyDescriptor(e,Symbol.toStringTag)?.writable&&e.toString()===`[object ${t}]`}let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}},91804,(e,t,r)=>{t.exports=e.r(8284).isPlainObject},96249,(e,t,r)=>{"use strict";Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),r.uniqBy=function(e,t){let r=new Map;for(let n=0;n<e.length;n++){let i=e[n],a=t(i,n,e);r.has(a)||r.set(a,i)}return Array.from(r.values())}},82503,(e,t,r)=>{"use strict";Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),r.ary=function(e,t){return function(...r){return e.apply(this,r.slice(0,t))}}},48571,(e,t,r)=>{"use strict";Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),r.identity=function(e){return e}},97977,(e,t,r)=>{"use strict";Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),r.isObjectLike=function(e){return"object"==typeof e&&null!==e}},64812,(e,t,r)=>{"use strict";Object.defineProperty(r,Symbol.toStringTag,{value:"Module"});let n=e.r(79087),i=e.r(97977);r.isArrayLikeObject=function(e){return i.isObjectLike(e)&&n.isArrayLike(e)}},91418,(e,t,r)=>{"use strict";Object.defineProperty(r,Symbol.toStringTag,{value:"Module"});let n=e.r(350);r.property=function(e){return function(t){return n.get(t,e)}}},38193,(e,t,r)=>{"use strict";Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),r.isPrimitive=function(e){return null==e||"object"!=typeof e&&"function"!=typeof e}},27583,(e,t,r)=>{"use strict";Object.defineProperty(r,Symbol.toStringTag,{value:"Module"});let n=e.r(38180),i=e.r(38193),a=e.r(66480);function s(e,t,r,c){if(t===e)return!0;switch(typeof t){case"object":return function(e,t,r,n){if(null==t)return!0;if(Array.isArray(t))return l(e,t,r,n);if(t instanceof Map){var a=e,s=t,c=r,d=n;if(0===s.size)return!0;if(!(a instanceof Map))return!1;for(let[e,t]of s.entries())if(!1===c(a.get(e),t,e,a,s,d))return!1;return!0}if(t instanceof Set)return o(e,t,r,n);let u=Object.keys(t);if(null==e||i.isPrimitive(e))return 0===u.length;if(0===u.length)return!0;if(n?.has(t))return n.get(t)===e;n?.set(t,e);try{for(let a=0;a<u.length;a++){let s=u[a];if(!i.isPrimitive(e)&&!(s in e)||void 0===t[s]&&void 0!==e[s]||null===t[s]&&null!==e[s]||!r(e[s],t[s],s,e,t,n))return!1}return!0}finally{n?.delete(t)}}(e,t,r,c);case"function":if(Object.keys(t).length>0)return s(e,{...t},r,c);return a.isEqualsSameValueZero(e,t);default:if(!n.isObject(e))return a.isEqualsSameValueZero(e,t);if("string"==typeof t)return""===t;return!0}}function l(e,t,r,n){if(0===t.length)return!0;if(!Array.isArray(e))return!1;let i=new Set;for(let a=0;a<t.length;a++){let s=t[a],l=!1;for(let o=0;o<e.length;o++){if(i.has(o))continue;let c=e[o],d=!1;if(r(c,s,a,e,t,n)&&(d=!0),d){i.add(o),l=!0;break}}if(!l)return!1}return!0}function o(e,t,r,n){return 0===t.size||e instanceof Set&&l([...e],[...t],r,n)}r.isMatchWith=function e(t,r,n){return"function"!=typeof n?e(t,r,()=>void 0):s(t,r,function e(t,r,i,a,l,o){let c=n(t,r,i,a,l,o);return void 0!==c?!!c:s(t,r,e,o)},new Map)},r.isSetMatch=o},90943,(e,t,r)=>{"use strict";Object.defineProperty(r,Symbol.toStringTag,{value:"Module"});let n=e.r(27583);r.isMatch=function(e,t){return n.isMatchWith(e,t,()=>void 0)}},62005,(e,t,r)=>{var n={675:function(e,t){"use strict";t.byteLength=function(e){var t=o(e),r=t[0],n=t[1];return(r+n)*3/4-n},t.toByteArray=function(e){var t,r,a=o(e),s=a[0],l=a[1],c=new i((s+l)*3/4-l),d=0,u=l>0?s-4:s;for(r=0;r<u;r+=4)t=n[e.charCodeAt(r)]<<18|n[e.charCodeAt(r+1)]<<12|n[e.charCodeAt(r+2)]<<6|n[e.charCodeAt(r+3)],c[d++]=t>>16&255,c[d++]=t>>8&255,c[d++]=255&t;return 2===l&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,c[d++]=255&t),1===l&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,c[d++]=t>>8&255,c[d++]=255&t),c},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,a=[],s=0,l=n-i;s<l;s+=16383)a.push(function(e,t,n){for(var i,a=[],s=t;s<n;s+=3)i=(e[s]<<16&0xff0000)+(e[s+1]<<8&65280)+(255&e[s+2]),a.push(r[i>>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return a.join("")}(e,s,s+16383>l?l:s+16383));return 1===i?a.push(r[(t=e[n-1])>>2]+r[t<<4&63]+"=="):2===i&&a.push(r[(t=(e[n-2]<<8)+e[n-1])>>10]+r[t>>4&63]+r[t<<2&63]+"="),a.join("")};for(var r=[],n=[],i="u">typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,l=a.length;s<l;++s)r[s]=a[s],n[a.charCodeAt(s)]=s;function o(e){var t=e.length;if(t%4>0)throw Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");-1===r&&(r=t);var n=r===t?0:4-r%4;return[r,n]}n[45]=62,n[95]=63},72:function(e,t,r){"use strict";var n=r(675),i=r(783),a="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;function s(e){if(e>0x7fffffff)throw RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,l.prototype),t}function l(e,t,r){if("number"==typeof e){if("string"==typeof t)throw TypeError('The "string" argument must be of type string. Received type number');return d(e)}return o(e,t,r)}function o(e,t,r){if("string"==typeof e){var n=e,i=t;if(("string"!=typeof i||""===i)&&(i="utf8"),!l.isEncoding(i))throw TypeError("Unknown encoding: "+i);var a=0|p(n,i),o=s(a),c=o.write(n,i);return c!==a&&(o=o.slice(0,c)),o}if(ArrayBuffer.isView(e))return u(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(A(e,ArrayBuffer)||e&&A(e.buffer,ArrayBuffer)||"u">typeof SharedArrayBuffer&&(A(e,SharedArrayBuffer)||e&&A(e.buffer,SharedArrayBuffer)))return function(e,t,r){var n;if(t<0||e.byteLength<t)throw RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw RangeError('"length" is outside of buffer bounds');return Object.setPrototypeOf(n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),l.prototype),n}(e,t,r);if("number"==typeof e)throw TypeError('The "value" argument must not be of type number. Received type number');var d=e.valueOf&&e.valueOf();if(null!=d&&d!==e)return l.from(d,t,r);var m=function(e){if(l.isBuffer(e)){var t=0|h(e.length),r=s(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||function(e){return e!=e}(e.length)?s(0):u(e):"Buffer"===e.type&&Array.isArray(e.data)?u(e.data):void 0}(e);if(m)return m;if("u">typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return l.from(e[Symbol.toPrimitive]("string"),t,r);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function c(e){if("number"!=typeof e)throw TypeError('"size" argument must be of type number');if(e<0)throw RangeError('The value "'+e+'" is invalid for option "size"')}function d(e){return c(e),s(e<0?0:0|h(e))}function u(e){for(var t=e.length<0?0:0|h(e.length),r=s(t),n=0;n<t;n+=1)r[n]=255&e[n];return r}t.Buffer=l,t.SlowBuffer=function(e){return+e!=e&&(e=0),l.alloc(+e)},t.INSPECT_MAX_BYTES=50,t.kMaxLength=0x7fffffff,l.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),!l.TYPED_ARRAY_SUPPORT&&"u">typeof console&&"function"==typeof console.error&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(l.prototype,"parent",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.buffer}}),Object.defineProperty(l.prototype,"offset",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.byteOffset}}),l.poolSize=8192,l.from=function(e,t,r){return o(e,t,r)},Object.setPrototypeOf(l.prototype,Uint8Array.prototype),Object.setPrototypeOf(l,Uint8Array),l.alloc=function(e,t,r){return(c(e),e<=0)?s(e):void 0!==t?"string"==typeof r?s(e).fill(t,r):s(e).fill(t):s(e)},l.allocUnsafe=function(e){return d(e)},l.allocUnsafeSlow=function(e){return d(e)};function h(e){if(e>=0x7fffffff)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|e}function p(e,t){if(l.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||A(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return S(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return P(e).length;default:if(i)return n?-1:S(e).length;t=(""+t).toLowerCase(),i=!0}}function m(e,t,r){var i,a,s,l=!1;if((void 0===t||t<0)&&(t=0),t>this.length||((void 0===r||r>this.length)&&(r=this.length),r<=0||(r>>>=0)<=(t>>>=0)))return"";for(e||(e="utf8");;)switch(e){case"hex":return function(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var i="",a=t;a<r;++a)i+=E[e[a]];return i}(this,t,r);case"utf8":case"utf-8":return g(this,t,r);case"ascii":return function(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}(this,t,r);case"latin1":case"binary":return function(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}(this,t,r);case"base64":return i=this,a=t,s=r,0===a&&s===i.length?n.fromByteArray(i):n.fromByteArray(i.slice(a,s));case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return function(e,t,r){for(var n=e.slice(t,r),i="",a=0;a<n.length;a+=2)i+=String.fromCharCode(n[a]+256*n[a+1]);return i}(this,t,r);default:if(l)throw TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),l=!0}}function f(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function x(e,t,r,n,i){var a;if(0===e.length)return -1;if("string"==typeof r?(n=r,r=0):r>0x7fffffff?r=0x7fffffff:r<-0x80000000&&(r=-0x80000000),(a=r*=1)!=a&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length)if(i)return -1;else r=e.length-1;else if(r<0)if(!i)return -1;else r=0;if("string"==typeof t&&(t=l.from(t,n)),l.isBuffer(t))return 0===t.length?-1:y(e,t,r,n,i);if("number"==typeof t){if(t&=255,"function"==typeof Uint8Array.prototype.indexOf)if(i)return Uint8Array.prototype.indexOf.call(e,t,r);else return Uint8Array.prototype.lastIndexOf.call(e,t,r);return y(e,[t],r,n,i)}throw TypeError("val must be string, number or Buffer")}function y(e,t,r,n,i){var a,s=1,l=e.length,o=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return -1;s=2,l/=2,o/=2,r/=2}function c(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var d=-1;for(a=r;a<l;a++)if(c(e,a)===c(t,-1===d?0:a-d)){if(-1===d&&(d=a),a-d+1===o)return d*s}else -1!==d&&(a-=a-d),d=-1}else for(r+o>l&&(r=l-o),a=r;a>=0;a--){for(var u=!0,h=0;h<o;h++)if(c(e,a+h)!==c(t,h)){u=!1;break}if(u)return a}return -1}l.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==l.prototype},l.compare=function(e,t){if(A(e,Uint8Array)&&(e=l.from(e,e.offset,e.byteLength)),A(t,Uint8Array)&&(t=l.from(t,t.offset,t.byteLength)),!l.isBuffer(e)||!l.isBuffer(t))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var r=e.length,n=t.length,i=0,a=Math.min(r,n);i<a;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:+(n<r)},l.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},l.concat=function(e,t){if(!Array.isArray(e))throw TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return l.alloc(0);if(void 0===t)for(r=0,t=0;r<e.length;++r)t+=e[r].length;var r,n=l.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var a=e[r];if(A(a,Uint8Array)&&(a=l.from(a)),!l.isBuffer(a))throw TypeError('"list" argument must be an Array of Buffers');a.copy(n,i),i+=a.length}return n},l.byteLength=p,l.prototype._isBuffer=!0,l.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)f(this,t,t+1);return this},l.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)f(this,t,t+3),f(this,t+1,t+2);return this},l.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)f(this,t,t+7),f(this,t+1,t+6),f(this,t+2,t+5),f(this,t+3,t+4);return this},l.prototype.toString=function(){var e=this.length;return 0===e?"":0==arguments.length?g(this,0,e):m.apply(this,arguments)},l.prototype.toLocaleString=l.prototype.toString,l.prototype.equals=function(e){if(!l.isBuffer(e))throw TypeError("Argument must be a Buffer");return this===e||0===l.compare(this,e)},l.prototype.inspect=function(){var e="",r=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},a&&(l.prototype[a]=l.prototype.inspect),l.prototype.compare=function(e,t,r,n,i){if(A(e,Uint8Array)&&(e=l.from(e,e.offset,e.byteLength)),!l.isBuffer(e))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return -1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,i>>>=0,this===e)return 0;for(var a=i-n,s=r-t,o=Math.min(a,s),c=this.slice(n,i),d=e.slice(t,r),u=0;u<o;++u)if(c[u]!==d[u]){a=c[u],s=d[u];break}return a<s?-1:+(s<a)},l.prototype.includes=function(e,t,r){return -1!==this.indexOf(e,t,r)},l.prototype.indexOf=function(e,t,r){return x(this,e,t,r,!0)},l.prototype.lastIndexOf=function(e,t,r){return x(this,e,t,r,!1)};function g(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i<r;){var a,s,l,o,c=e[i],d=null,u=c>239?4:c>223?3:c>191?2:1;if(i+u<=r)switch(u){case 1:c<128&&(d=c);break;case 2:(192&(a=e[i+1]))==128&&(o=(31&c)<<6|63&a)>127&&(d=o);break;case 3:a=e[i+1],s=e[i+2],(192&a)==128&&(192&s)==128&&(o=(15&c)<<12|(63&a)<<6|63&s)>2047&&(o<55296||o>57343)&&(d=o);break;case 4:a=e[i+1],s=e[i+2],l=e[i+3],(192&a)==128&&(192&s)==128&&(192&l)==128&&(o=(15&c)<<18|(63&a)<<12|(63&s)<<6|63&l)>65535&&o<1114112&&(d=o)}null===d?(d=65533,u=1):d>65535&&(d-=65536,n.push(d>>>10&1023|55296),d=56320|1023&d),n.push(d),i+=u}var h=n,p=h.length;if(p<=4096)return String.fromCharCode.apply(String,h);for(var m="",f=0;f<p;)m+=String.fromCharCode.apply(String,h.slice(f,f+=4096));return m}function v(e,t,r){if(e%1!=0||e<0)throw RangeError("offset is not uint");if(e+t>r)throw RangeError("Trying to access beyond buffer length")}function b(e,t,r,n,i,a){if(!l.isBuffer(e))throw TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<a)throw RangeError('"value" argument is out of bounds');if(r+n>e.length)throw RangeError("Index out of range")}function j(e,t,r,n,i,a){if(r+n>e.length||r<0)throw RangeError("Index out of range")}function w(e,t,r,n,a){return t*=1,r>>>=0,a||j(e,t,r,4,34028234663852886e22,-34028234663852886e22),i.write(e,t,r,n,23,4),r+4}function N(e,t,r,n,a){return t*=1,r>>>=0,a||j(e,t,r,8,17976931348623157e292,-17976931348623157e292),i.write(e,t,r,n,52,8),r+8}l.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var i,a,s,l,o,c,d,u,h=this.length-t;if((void 0===r||r>h)&&(r=h),e.length>0&&(r<0||t<0)||t>this.length)throw RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var p=!1;;)switch(n){case"hex":return function(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;var a=t.length;n>a/2&&(n=a/2);for(var s=0;s<n;++s){var l,o=parseInt(t.substr(2*s,2),16);if((l=o)!=l)break;e[r+s]=o}return s}(this,e,t,r);case"utf8":case"utf-8":return i=t,a=r,C(S(e,this.length-i),this,i,a);case"ascii":return s=t,l=r,C(O(e),this,s,l);case"latin1":case"binary":return function(e,t,r,n){return C(O(t),e,r,n)}(this,e,t,r);case"base64":return o=t,c=r,C(P(e),this,o,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return d=t,u=r,C(function(e,t){for(var r,n,i=[],a=0;a<e.length&&!((t-=2)<0);++a)n=(r=e.charCodeAt(a))>>8,i.push(r%256),i.push(n);return i}(e,this.length-d),this,d,u);default:if(p)throw TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),p=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},l.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);var n=this.subarray(e,t);return Object.setPrototypeOf(n,l.prototype),n},l.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||v(e,t,this.length);for(var n=this[e],i=1,a=0;++a<t&&(i*=256);)n+=this[e+a]*i;return n},l.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||v(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},l.prototype.readUInt8=function(e,t){return e>>>=0,t||v(e,1,this.length),this[e]},l.prototype.readUInt16LE=function(e,t){return e>>>=0,t||v(e,2,this.length),this[e]|this[e+1]<<8},l.prototype.readUInt16BE=function(e,t){return e>>>=0,t||v(e,2,this.length),this[e]<<8|this[e+1]},l.prototype.readUInt32LE=function(e,t){return e>>>=0,t||v(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+0x1000000*this[e+3]},l.prototype.readUInt32BE=function(e,t){return e>>>=0,t||v(e,4,this.length),0x1000000*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},l.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||v(e,t,this.length);for(var n=this[e],i=1,a=0;++a<t&&(i*=256);)n+=this[e+a]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*t)),n},l.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||v(e,t,this.length);for(var n=t,i=1,a=this[e+--n];n>0&&(i*=256);)a+=this[e+--n]*i;return a>=(i*=128)&&(a-=Math.pow(2,8*t)),a},l.prototype.readInt8=function(e,t){return(e>>>=0,t||v(e,1,this.length),128&this[e])?-((255-this[e]+1)*1):this[e]},l.prototype.readInt16LE=function(e,t){e>>>=0,t||v(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?0xffff0000|r:r},l.prototype.readInt16BE=function(e,t){e>>>=0,t||v(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?0xffff0000|r:r},l.prototype.readInt32LE=function(e,t){return e>>>=0,t||v(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},l.prototype.readInt32BE=function(e,t){return e>>>=0,t||v(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},l.prototype.readFloatLE=function(e,t){return e>>>=0,t||v(e,4,this.length),i.read(this,e,!0,23,4)},l.prototype.readFloatBE=function(e,t){return e>>>=0,t||v(e,4,this.length),i.read(this,e,!1,23,4)},l.prototype.readDoubleLE=function(e,t){return e>>>=0,t||v(e,8,this.length),i.read(this,e,!0,52,8)},l.prototype.readDoubleBE=function(e,t){return e>>>=0,t||v(e,8,this.length),i.read(this,e,!1,52,8)},l.prototype.writeUIntLE=function(e,t,r,n){if(e*=1,t>>>=0,r>>>=0,!n){var i=Math.pow(2,8*r)-1;b(this,e,t,r,i,0)}var a=1,s=0;for(this[t]=255&e;++s<r&&(a*=256);)this[t+s]=e/a&255;return t+r},l.prototype.writeUIntBE=function(e,t,r,n){if(e*=1,t>>>=0,r>>>=0,!n){var i=Math.pow(2,8*r)-1;b(this,e,t,r,i,0)}var a=r-1,s=1;for(this[t+a]=255&e;--a>=0&&(s*=256);)this[t+a]=e/s&255;return t+r},l.prototype.writeUInt8=function(e,t,r){return e*=1,t>>>=0,r||b(this,e,t,1,255,0),this[t]=255&e,t+1},l.prototype.writeUInt16LE=function(e,t,r){return e*=1,t>>>=0,r||b(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},l.prototype.writeUInt16BE=function(e,t,r){return e*=1,t>>>=0,r||b(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},l.prototype.writeUInt32LE=function(e,t,r){return e*=1,t>>>=0,r||b(this,e,t,4,0xffffffff,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},l.prototype.writeUInt32BE=function(e,t,r){return e*=1,t>>>=0,r||b(this,e,t,4,0xffffffff,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},l.prototype.writeIntLE=function(e,t,r,n){if(e*=1,t>>>=0,!n){var i=Math.pow(2,8*r-1);b(this,e,t,r,i-1,-i)}var a=0,s=1,l=0;for(this[t]=255&e;++a<r&&(s*=256);)e<0&&0===l&&0!==this[t+a-1]&&(l=1),this[t+a]=(e/s|0)-l&255;return t+r},l.prototype.writeIntBE=function(e,t,r,n){if(e*=1,t>>>=0,!n){var i=Math.pow(2,8*r-1);b(this,e,t,r,i-1,-i)}var a=r-1,s=1,l=0;for(this[t+a]=255&e;--a>=0&&(s*=256);)e<0&&0===l&&0!==this[t+a+1]&&(l=1),this[t+a]=(e/s|0)-l&255;return t+r},l.prototype.writeInt8=function(e,t,r){return e*=1,t>>>=0,r||b(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},l.prototype.writeInt16LE=function(e,t,r){return e*=1,t>>>=0,r||b(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},l.prototype.writeInt16BE=function(e,t,r){return e*=1,t>>>=0,r||b(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},l.prototype.writeInt32LE=function(e,t,r){return e*=1,t>>>=0,r||b(this,e,t,4,0x7fffffff,-0x80000000),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},l.prototype.writeInt32BE=function(e,t,r){return e*=1,t>>>=0,r||b(this,e,t,4,0x7fffffff,-0x80000000),e<0&&(e=0xffffffff+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},l.prototype.writeFloatLE=function(e,t,r){return w(this,e,t,!0,r)},l.prototype.writeFloatBE=function(e,t,r){return w(this,e,t,!1,r)},l.prototype.writeDoubleLE=function(e,t,r){return N(this,e,t,!0,r)},l.prototype.writeDoubleBE=function(e,t,r){return N(this,e,t,!1,r)},l.prototype.copy=function(e,t,r,n){if(!l.isBuffer(e))throw TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r||0===e.length||0===this.length)return 0;if(t<0)throw RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw RangeError("Index out of range");if(n<0)throw RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var i=n-r;if(this===e&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(t,r,n);else if(this===e&&r<t&&t<n)for(var a=i-1;a>=0;--a)e[a+t]=this[a+r];else Uint8Array.prototype.set.call(e,this.subarray(r,n),t);return i},l.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw TypeError("encoding must be a string");if("string"==typeof n&&!l.isEncoding(n))throw TypeError("Unknown encoding: "+n);if(1===e.length){var i,a=e.charCodeAt(0);("utf8"===n&&a<128||"latin1"===n)&&(e=a)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw RangeError("Out of range index");if(r<=t)return this;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i<r;++i)this[i]=e;else{var s=l.isBuffer(e)?e:l.from(e,n),o=s.length;if(0===o)throw TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<r-t;++i)this[i+t]=s[i%o]}return this};var k=/[^+/0-9A-Za-z-_]/g;function S(e,t){t=t||1/0;for(var r,n=e.length,i=null,a=[],s=0;s<n;++s){if((r=e.charCodeAt(s))>55295&&r<57344){if(!i){if(r>56319||s+1===n){(t-=3)>-1&&a.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&a.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;a.push(r)}else if(r<2048){if((t-=2)<0)break;a.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;a.push(r>>12|224,r>>6&63|128,63&r|128)}else if(r<1114112){if((t-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}else throw Error("Invalid code point")}return a}function O(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}function P(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(k,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function C(e,t,r,n){for(var i=0;i<n&&!(i+r>=t.length)&&!(i>=e.length);++i)t[i+r]=e[i];return i}function A(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}var E=function(){for(var e="0123456789abcdef",t=Array(256),r=0;r<16;++r)for(var n=16*r,i=0;i<16;++i)t[n+i]=e[r]+e[i];return t}()},783:function(e,t){t.read=function(e,t,r,n,i){var a,s,l=8*i-n-1,o=(1<<l)-1,c=o>>1,d=-7,u=r?i-1:0,h=r?-1:1,p=e[t+u];for(u+=h,a=p&(1<<-d)-1,p>>=-d,d+=l;d>0;a=256*a+e[t+u],u+=h,d-=8);for(s=a&(1<<-d)-1,a>>=-d,d+=n;d>0;s=256*s+e[t+u],u+=h,d-=8);if(0===a)a=1-c;else{if(a===o)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,n),a-=c}return(p?-1:1)*s*Math.pow(2,a-n)},t.write=function(e,t,r,n,i,a){var s,l,o,c=8*a-i-1,d=(1<<c)-1,u=d>>1,h=5960464477539062e-23*(23===i),p=n?0:a-1,m=n?1:-1,f=+(t<0||0===t&&1/t<0);for(isNaN(t=Math.abs(t))||t===1/0?(l=+!!isNaN(t),s=d):(s=Math.floor(Math.log(t)/Math.LN2),t*(o=Math.pow(2,-s))<1&&(s--,o*=2),s+u>=1?t+=h/o:t+=h*Math.pow(2,1-u),t*o>=2&&(s++,o/=2),s+u>=d?(l=0,s=d):s+u>=1?(l=(t*o-1)*Math.pow(2,i),s+=u):(l=t*Math.pow(2,u-1)*Math.pow(2,i),s=0));i>=8;e[r+p]=255&l,p+=m,l/=256,i-=8);for(s=s<<i|l,c+=i;c>0;e[r+p]=255&s,p+=m,s/=256,c-=8);e[r+p-m]|=128*f}}},i={};function a(e){var t=i[e];if(void 0!==t)return t.exports;var r=i[e]={exports:{}},s=!0;try{n[e](r,r.exports,a),s=!1}finally{s&&delete i[e]}return r.exports}a.ab="/ROOT/dashboard/node_modules/next/dist/compiled/buffer/",t.exports=a(72)},17464,(e,t,r)=>{"use strict";Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),r.getSymbols=function(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}},3377,(e,t,r)=>{"use strict";Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),r.getTag=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}},75430,(e,t,r)=>{"use strict";Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),r.argumentsTag="[object Arguments]",r.arrayBufferTag="[object ArrayBuffer]",r.arrayTag="[object Array]",r.bigInt64ArrayTag="[object BigInt64Array]",r.bigUint64ArrayTag="[object BigUint64Array]",r.booleanTag="[object Boolean]",r.dataViewTag="[object DataView]",r.dateTag="[object Date]",r.errorTag="[object Error]",r.float32ArrayTag="[object Float32Array]",r.float64ArrayTag="[object Float64Array]",r.functionTag="[object Function]",r.int16ArrayTag="[object Int16Array]",r.int32ArrayTag="[object Int32Array]",r.int8ArrayTag="[object Int8Array]",r.mapTag="[object Map]",r.numberTag="[object Number]",r.objectTag="[object Object]",r.regexpTag="[object RegExp]",r.setTag="[object Set]",r.stringTag="[object String]",r.symbolTag="[object Symbol]",r.uint16ArrayTag="[object Uint16Array]",r.uint32ArrayTag="[object Uint32Array]",r.uint8ArrayTag="[object Uint8Array]",r.uint8ClampedArrayTag="[object Uint8ClampedArray]"},74513,(e,t,r)=>{"use strict";Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),r.isTypedArray=function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}},83673,(e,t,r)=>{"use strict";var n=e.i(62005);Object.defineProperty(r,Symbol.toStringTag,{value:"Module"});let i=e.r(17464),a=e.r(3377),s=e.r(75430),l=e.r(38193),o=e.r(74513);function c(e,t,r,i=new Map,u){let h=u?.(e,t,r,i);if(void 0!==h)return h;if(l.isPrimitive(e))return e;if(i.has(e))return i.get(e);if(Array.isArray(e)){let t=Array(e.length);i.set(e,t);for(let n=0;n<e.length;n++)t[n]=c(e[n],n,r,i,u);return Object.hasOwn(e,"index")&&(t.index=e.index),Object.hasOwn(e,"input")&&(t.input=e.input),t}if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp){let t=new RegExp(e.source,e.flags);return t.lastIndex=e.lastIndex,t}if(e instanceof Map){let t=new Map;for(let[n,a]of(i.set(e,t),e))t.set(n,c(a,n,r,i,u));return t}if(e instanceof Set){let t=new Set;for(let n of(i.set(e,t),e))t.add(c(n,void 0,r,i,u));return t}if(void 0!==n.Buffer&&n.Buffer.isBuffer(e))return e.subarray();if(o.isTypedArray(e)){let t=new(Object.getPrototypeOf(e)).constructor(e.length);i.set(e,t);for(let n=0;n<e.length;n++)t[n]=c(e[n],n,r,i,u);return t}if(e instanceof ArrayBuffer||"u">typeof SharedArrayBuffer&&e instanceof SharedArrayBuffer)return e.slice(0);if(e instanceof DataView){let t=new DataView(e.buffer.slice(0),e.byteOffset,e.byteLength);return i.set(e,t),d(t,e,r,i,u),t}if("u">typeof File&&e instanceof File){let t=new File([e],e.name,{type:e.type});return i.set(e,t),d(t,e,r,i,u),t}if("u">typeof Blob&&e instanceof Blob){let t=new Blob([e],{type:e.type});return i.set(e,t),d(t,e,r,i,u),t}if(e instanceof Error){let t=new e.constructor;return i.set(e,t),t.message=e.message,t.name=e.name,t.stack=e.stack,t.cause=e.cause,d(t,e,r,i,u),t}if(e instanceof Boolean){let t=new Boolean(e.valueOf());return i.set(e,t),d(t,e,r,i,u),t}if(e instanceof Number){let t=new Number(e.valueOf());return i.set(e,t),d(t,e,r,i,u),t}if(e instanceof String){let t=new String(e.valueOf());return i.set(e,t),d(t,e,r,i,u),t}if("object"==typeof e&&function(e){switch(a.getTag(e)){case s.argumentsTag:case s.arrayTag:case s.arrayBufferTag:case s.dataViewTag:case s.booleanTag:case s.dateTag:case s.float32ArrayTag:case s.float64ArrayTag:case s.int8ArrayTag:case s.int16ArrayTag:case s.int32ArrayTag:case s.mapTag:case s.numberTag:case s.objectTag:case s.regexpTag:case s.setTag:case s.stringTag:case s.symbolTag:case s.uint8ArrayTag:case s.uint8ClampedArrayTag:case s.uint16ArrayTag:case s.uint32ArrayTag:return!0;default:return!1}}(e)){let t=Object.create(Object.getPrototypeOf(e));return i.set(e,t),d(t,e,r,i,u),t}return e}function d(e,t,r=e,n,a){let s=[...Object.keys(t),...i.getSymbols(t)];for(let i=0;i<s.length;i++){let l=s[i],o=Object.getOwnPropertyDescriptor(e,l);(null==o||o.writable)&&(e[l]=c(t[l],l,r,n,a))}}r.cloneDeepWith=function(e,t){return c(e,void 0,e,new Map,t)},r.cloneDeepWithImpl=c,r.copyProperties=d},48384,(e,t,r)=>{"use strict";Object.defineProperty(r,Symbol.toStringTag,{value:"Module"});let n=e.r(83673);r.cloneDeep=function(e){return n.cloneDeepWithImpl(e,void 0,e,new Map,void 0)}},80955,(e,t,r)=>{"use strict";Object.defineProperty(r,Symbol.toStringTag,{value:"Module"});let n=e.r(90943),i=e.r(48384);r.matches=function(e){return e=i.cloneDeep(e),t=>n.isMatch(t,e)}},47115,(e,t,r)=>{"use strict";Object.defineProperty(r,Symbol.toStringTag,{value:"Module"});let n=e.r(83673),i=e.r(3377),a=e.r(75430);r.cloneDeepWith=function(e,t){return n.cloneDeepWith(e,(r,s,l,o)=>{let c=t?.(r,s,l,o);if(void 0!==c)return c;if("object"==typeof e){if(i.getTag(e)===a.objectTag&&"function"!=typeof e.constructor){let t={};return o.set(e,t),n.copyProperties(t,e,l,o),t}switch(Object.prototype.toString.call(e)){case a.numberTag:case a.stringTag:case a.booleanTag:{let t=new e.constructor(e?.valueOf());return n.copyProperties(t,e),t}case a.argumentsTag:{let t={};return n.copyProperties(t,e),t.length=e.length,t[Symbol.iterator]=e[Symbol.iterator],t}default:return}}})}},85610,(e,t,r)=>{"use strict";Object.defineProperty(r,Symbol.toStringTag,{value:"Module"});let n=e.r(47115);r.cloneDeep=function(e){return n.cloneDeepWith(e)}},59235,(e,t,r)=>{"use strict";Object.defineProperty(r,Symbol.toStringTag,{value:"Module"});let n=e.r(3377);r.isArguments=function(e){return null!==e&&"object"==typeof e&&"[object Arguments]"===n.getTag(e)}},39635,(e,t,r)=>{"use strict";Object.defineProperty(r,Symbol.toStringTag,{value:"Module"});let n=e.r(76906),i=e.r(20272),a=e.r(59235),s=e.r(2209);r.has=function(e,t){let r;if(0===(r=Array.isArray(t)?t:"string"==typeof t&&n.isDeepKey(t)&&e?.[t]==null?s.toPath(t):[t]).length)return!1;let l=e;for(let e=0;e<r.length;e++){let t=r[e];if((null==l||!Object.hasOwn(l,t))&&!((Array.isArray(l)||a.isArguments(l))&&i.isIndex(t)&&t<l.length))return!1;l=l[t]}return!0}},93660,(e,t,r)=>{"use strict";Object.defineProperty(r,Symbol.toStringTag,{value:"Module"});let n=e.r(90943),i=e.r(25483),a=e.r(85610),s=e.r(350),l=e.r(39635);r.matchesProperty=function(e,t){switch(typeof e){case"object":Object.is(e?.valueOf(),-0)&&(e="-0");break;case"number":e=i.toKey(e)}return t=a.cloneDeep(t),function(r){let i=s.get(r,e);return void 0===i?l.has(r,e):void 0===t?void 0===i:n.isMatch(i,t)}}},68077,(e,t,r)=>{"use strict";Object.defineProperty(r,Symbol.toStringTag,{value:"Module"});let n=e.r(48571),i=e.r(91418),a=e.r(80955),s=e.r(93660);r.iteratee=function(e){if(null==e)return n.identity;switch(typeof e){case"function":return e;case"object":if(Array.isArray(e)&&2===e.length)return s.matchesProperty(e[0],e[1]);return a.matches(e);case"string":case"symbol":case"number":return i.property(e)}}},38953,(e,t,r)=>{"use strict";Object.defineProperty(r,Symbol.toStringTag,{value:"Module"});let n=e.r(96249),i=e.r(82503),a=e.r(48571),s=e.r(64812),l=e.r(68077);r.uniqBy=function(e,t=a.identity){return s.isArrayLikeObject(e)?n.uniqBy(Array.from(e),i.ary(l.iteratee(t),1)):[]}},40559,(e,t,r)=>{t.exports=e.r(38953).uniqBy},23733,e=>{"use strict";let t,r,n,i,a,s,l,o;var c,d,u,h,p,m,f,x,y,g,v,b,j,w,N,k,S,O,P,C,A,E,M,T,_,D,I,z,L,R,F,$,B,U,q,V,K,W=e.i(27493),H=e.i(4),Q=e.i(22534);let Y=(0,H.createContext)({});function X(e){let t=(0,H.useRef)(null);return null===t.current&&(t.current=e()),t.current}let G="u">typeof window,Z=G?H.useLayoutEffect:H.useEffect,J=(0,H.createContext)(null);function ee(e){return"object"==typeof e&&null!==e}function et(e){return ee(e)&&"offsetHeight"in e}var er=H;let en=(0,H.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function ei(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}class ea extends er.Component{getSnapshotBeforeUpdate(e){let t=this.props.childRef.current;if(t&&e.isPresent&&!this.props.isPresent){let e=t.offsetParent,r=et(e)&&e.offsetWidth||0,n=et(e)&&e.offsetHeight||0,i=this.props.sizeRef.current;i.height=t.offsetHeight||0,i.width=t.offsetWidth||0,i.top=t.offsetTop,i.left=t.offsetLeft,i.right=r-i.width-i.left,i.bottom=n-i.height-i.top}return null}componentDidUpdate(){}render(){return this.props.children}}function es({children:e,isPresent:t,anchorX:r,anchorY:n,root:i}){let a=(0,er.useId)(),s=(0,er.useRef)(null),l=(0,er.useRef)({width:0,height:0,top:0,left:0,right:0,bottom:0}),{nonce:o}=(0,er.useContext)(en),c=function(...e){return H.useCallback(function(...e){return t=>{let r=!1,n=e.map(e=>{let n=ei(e,t);return r||"function"!=typeof n||(r=!0),n});if(r)return()=>{for(let t=0;t<n.length;t++){let r=n[t];"function"==typeof r?r():ei(e[t],null)}}}}(...e),e)}(s,e.props?.ref??e?.ref);return(0,er.useInsertionEffect)(()=>{let{width:e,height:c,top:d,left:u,right:h,bottom:p}=l.current;if(t||!s.current||!e||!c)return;let m="left"===r?`left: ${u}`:`right: ${h}`,f="bottom"===n?`bottom: ${p}`:`top: ${d}`;s.current.dataset.motionPopId=a;let x=document.createElement("style");o&&(x.nonce=o);let y=i??document.head;return y.appendChild(x),x.sheet&&x.sheet.insertRule(`
2
- [data-motion-pop-id="${a}"] {
3
- position: absolute !important;
4
- width: ${e}px !important;
5
- height: ${c}px !important;
6
- ${m}px !important;
7
- ${f}px !important;
8
- }
9
- `),()=>{y.contains(x)&&y.removeChild(x)}},[t]),(0,W.jsx)(ea,{isPresent:t,childRef:s,sizeRef:l,children:er.cloneElement(e,{ref:c})})}let el=({children:e,initial:t,isPresent:r,onExitComplete:n,custom:i,presenceAffectsLayout:a,mode:s,anchorX:l,anchorY:o,root:c})=>{let d=X(eo),u=(0,H.useId)(),h=!0,p=(0,H.useMemo)(()=>(h=!1,{id:u,initial:t,isPresent:r,custom:i,onExitComplete:e=>{for(let t of(d.set(e,!0),d.values()))if(!t)return;n&&n()},register:e=>(d.set(e,!1),()=>d.delete(e))}),[r,d,n]);return a&&h&&(p={...p}),(0,H.useMemo)(()=>{d.forEach((e,t)=>d.set(t,!1))},[r]),H.useEffect(()=>{r||d.size||!n||n()},[r]),"popLayout"===s&&(e=(0,W.jsx)(es,{isPresent:r,anchorX:l,anchorY:o,root:c,children:e})),(0,W.jsx)(J.Provider,{value:p,children:e})};function eo(){return new Map}function ec(e=!0){let t=(0,H.useContext)(J);if(null===t)return[!0,null];let{isPresent:r,onExitComplete:n,register:i}=t,a=(0,H.useId)();(0,H.useEffect)(()=>{if(e)return i(a)},[e]);let s=(0,H.useCallback)(()=>e&&n&&n(a),[a,n,e]);return!r&&n?[!1,s]:[!0]}let ed=e=>e.key||"";function eu(e){let t=[];return H.Children.forEach(e,e=>{(0,H.isValidElement)(e)&&t.push(e)}),t}let eh=({children:e,custom:t,initial:r=!0,onExitComplete:n,presenceAffectsLayout:i=!0,mode:a="sync",propagate:s=!1,anchorX:l="left",anchorY:o="top",root:c})=>{let[d,u]=ec(s),h=(0,H.useMemo)(()=>eu(e),[e]),p=s&&!d?[]:h.map(ed),m=(0,H.useRef)(!0),f=(0,H.useRef)(h),x=X(()=>new Map),y=(0,H.useRef)(new Set),[g,v]=(0,H.useState)(h),[b,j]=(0,H.useState)(h);Z(()=>{m.current=!1,f.current=h;for(let e=0;e<b.length;e++){let t=ed(b[e]);p.includes(t)?(x.delete(t),y.current.delete(t)):!0!==x.get(t)&&x.set(t,!1)}},[b,p.length,p.join("-")]);let w=[];if(h!==g){let e=[...h];for(let t=0;t<b.length;t++){let r=b[t],n=ed(r);p.includes(n)||(e.splice(t,0,r),w.push(r))}return"wait"===a&&w.length&&(e=w),j(eu(e)),v(h),null}let{forceRender:N}=(0,H.useContext)(Y);return(0,W.jsx)(W.Fragment,{children:b.map(e=>{let g=ed(e),v=(!s||!!d)&&(h===b||p.includes(g));return(0,W.jsx)(el,{isPresent:v,initial:(!m.current||!!r)&&void 0,custom:t,presenceAffectsLayout:i,mode:a,root:c,onExitComplete:v?void 0:()=>{if(y.current.has(g)||(y.current.add(g),!x.has(g)))return;x.set(g,!0);let e=!0;x.forEach(t=>{t||(e=!1)}),e&&(N?.(),j(f.current),s&&u?.(),n&&n())},anchorX:l,anchorY:o,children:e},g)})})},ep=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],em=new Set(ep),ef=(e,t,r)=>r>t?t:r<e?e:r,ex={test:e=>"number"==typeof e,parse:parseFloat,transform:e=>e},ey={...ex,transform:e=>ef(0,1,e)},eg={...ex,default:1},ev=e=>Math.round(1e5*e)/1e5,eb=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu,ej=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,ew=(e,t)=>r=>!!("string"==typeof r&&ej.test(r)&&r.startsWith(e)||t&&null!=r&&Object.prototype.hasOwnProperty.call(r,t)),eN=(e,t,r)=>n=>{if("string"!=typeof n)return n;let[i,a,s,l]=n.match(eb);return{[e]:parseFloat(i),[t]:parseFloat(a),[r]:parseFloat(s),alpha:void 0!==l?parseFloat(l):1}},ek={...ex,transform:e=>Math.round(ef(0,255,e))},eS={test:ew("rgb","red"),parse:eN("red","green","blue"),transform:({red:e,green:t,blue:r,alpha:n=1})=>"rgba("+ek.transform(e)+", "+ek.transform(t)+", "+ek.transform(r)+", "+ev(ey.transform(n))+")"},eO={test:ew("#"),parse:function(e){let t="",r="",n="",i="";return e.length>5?(t=e.substring(1,3),r=e.substring(3,5),n=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),r=e.substring(2,3),n=e.substring(3,4),i=e.substring(4,5),t+=t,r+=r,n+=n,i+=i),{red:parseInt(t,16),green:parseInt(r,16),blue:parseInt(n,16),alpha:i?parseInt(i,16)/255:1}},transform:eS.transform},eP=e=>({test:t=>"string"==typeof t&&t.endsWith(e)&&1===t.split(" ").length,parse:parseFloat,transform:t=>`${t}${e}`}),eC=eP("deg"),eA=eP("%"),eE=eP("px"),eM=eP("vh"),eT=eP("vw"),e_={...eA,parse:e=>eA.parse(e)/100,transform:e=>eA.transform(100*e)},eD={test:ew("hsl","hue"),parse:eN("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:r,alpha:n=1})=>"hsla("+Math.round(e)+", "+eA.transform(ev(t))+", "+eA.transform(ev(r))+", "+ev(ey.transform(n))+")"},eI={test:e=>eS.test(e)||eO.test(e)||eD.test(e),parse:e=>eS.test(e)?eS.parse(e):eD.test(e)?eD.parse(e):eO.parse(e),transform:e=>"string"==typeof e?e:e.hasOwnProperty("red")?eS.transform(e):eD.transform(e),getAnimatableNone:e=>{let t=eI.parse(e);return t.alpha=0,eI.transform(t)}},ez=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,eL="number",eR="color",eF=/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 e$(e){let t=e.toString(),r=[],n={color:[],number:[],var:[]},i=[],a=0,s=t.replace(eF,e=>(eI.test(e)?(n.color.push(a),i.push(eR),r.push(eI.parse(e))):e.startsWith("var(")?(n.var.push(a),i.push("var"),r.push(e)):(n.number.push(a),i.push(eL),r.push(parseFloat(e))),++a,"${}")).split("${}");return{values:r,split:s,indexes:n,types:i}}function eB(e){return e$(e).values}function eU(e){let{split:t,types:r}=e$(e),n=t.length;return e=>{let i="";for(let a=0;a<n;a++)if(i+=t[a],void 0!==e[a]){let t=r[a];t===eL?i+=ev(e[a]):t===eR?i+=eI.transform(e[a]):i+=e[a]}return i}}let eq=e=>"number"==typeof e?0:eI.test(e)?eI.getAnimatableNone(e):e,eV={test:function(e){return isNaN(e)&&"string"==typeof e&&(e.match(eb)?.length||0)+(e.match(ez)?.length||0)>0},parse:eB,createTransformer:eU,getAnimatableNone:function(e){let t=eB(e);return eU(e)(t.map(eq))}},eK=new Set(["brightness","contrast","saturate","opacity"]);function eW(e){let[t,r]=e.slice(0,-1).split("(");if("drop-shadow"===t)return e;let[n]=r.match(eb)||[];if(!n)return e;let i=r.replace(n,""),a=+!!eK.has(t);return n!==r&&(a*=100),t+"("+a+i+")"}let eH=/\b([a-z-]*)\(.*?\)/gu,eQ={...eV,getAnimatableNone:e=>{let t=e.match(eH);return t?t.map(eW).join(" "):e}},eY={...ex,transform:Math.round},eX={borderWidth:eE,borderTopWidth:eE,borderRightWidth:eE,borderBottomWidth:eE,borderLeftWidth:eE,borderRadius:eE,borderTopLeftRadius:eE,borderTopRightRadius:eE,borderBottomRightRadius:eE,borderBottomLeftRadius:eE,width:eE,maxWidth:eE,height:eE,maxHeight:eE,top:eE,right:eE,bottom:eE,left:eE,inset:eE,insetBlock:eE,insetBlockStart:eE,insetBlockEnd:eE,insetInline:eE,insetInlineStart:eE,insetInlineEnd:eE,padding:eE,paddingTop:eE,paddingRight:eE,paddingBottom:eE,paddingLeft:eE,paddingBlock:eE,paddingBlockStart:eE,paddingBlockEnd:eE,paddingInline:eE,paddingInlineStart:eE,paddingInlineEnd:eE,margin:eE,marginTop:eE,marginRight:eE,marginBottom:eE,marginLeft:eE,marginBlock:eE,marginBlockStart:eE,marginBlockEnd:eE,marginInline:eE,marginInlineStart:eE,marginInlineEnd:eE,fontSize:eE,backgroundPositionX:eE,backgroundPositionY:eE,rotate:eC,rotateX:eC,rotateY:eC,rotateZ:eC,scale:eg,scaleX:eg,scaleY:eg,scaleZ:eg,skew:eC,skewX:eC,skewY:eC,distance:eE,translateX:eE,translateY:eE,translateZ:eE,x:eE,y:eE,z:eE,perspective:eE,transformPerspective:eE,opacity:ey,originX:e_,originY:e_,originZ:eE,zIndex:eY,fillOpacity:ey,strokeOpacity:ey,numOctaves:eY},eG={...eX,color:eI,backgroundColor:eI,outlineColor:eI,fill:eI,stroke:eI,borderColor:eI,borderTopColor:eI,borderRightColor:eI,borderBottomColor:eI,borderLeftColor:eI,filter:eQ,WebkitFilter:eQ},eZ=e=>eG[e],eJ=()=>({translate:0,scale:1,origin:0,originPoint:0}),e0=()=>({x:eJ(),y:eJ()}),e1=()=>({min:0,max:0}),e2=()=>({x:e1(),y:e1()}),e5=e=>!!(e&&e.getVelocity),e4=new Set(["width","height","top","left","right","bottom",...ep]),e3=e=>t=>t.test(e),e6=[ex,eE,eA,eC,eT,eM,{test:e=>"auto"===e,parse:e=>e}],e8=e=>e6.find(e3(e)),e7=()=>{},e9=()=>{};Q.default;let te=e=>t=>"string"==typeof t&&t.startsWith(e),tt=te("--"),tr=te("var(--"),tn=e=>!!tr(e)&&ti.test(e.split("/*")[0].trim()),ti=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function ta(e){return"string"==typeof e&&e.split("/*")[0].includes("var(--")}let ts=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u,tl=e=>180*e/Math.PI,to=e=>td(tl(Math.atan2(e[1],e[0]))),tc={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:to,rotateZ:to,skewX:e=>tl(Math.atan(e[1])),skewY:e=>tl(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},td=e=>((e%=360)<0&&(e+=360),e),tu=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),th=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),tp={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:tu,scaleY:th,scale:e=>(tu(e)+th(e))/2,rotateX:e=>td(tl(Math.atan2(e[6],e[5]))),rotateY:e=>td(tl(Math.atan2(-e[2],e[0]))),rotateZ:to,rotate:to,skewX:e=>tl(Math.atan(e[4])),skewY:e=>tl(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function tm(e){return+!!e.includes("scale")}function tf(e,t){let r,n;if(!e||"none"===e)return tm(t);let i=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);if(i)r=tp,n=i;else{let t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=tc,n=t}if(!n)return tm(t);let a=r[t],s=n[1].split(",").map(tx);return"function"==typeof a?a(s):s[a]}function tx(e){return parseFloat(e.trim())}let ty=e=>e===ex||e===eE,tg=new Set(["x","y","z"]),tv=ep.filter(e=>!tg.has(e)),tb={width:({x:e},{paddingLeft:t="0",paddingRight:r="0"})=>e.max-e.min-parseFloat(t)-parseFloat(r),height:({y:e},{paddingTop:t="0",paddingBottom:r="0"})=>e.max-e.min-parseFloat(t)-parseFloat(r),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>tf(t,"x"),y:(e,{transform:t})=>tf(t,"y")};tb.translateX=tb.x,tb.translateY=tb.y;let tj=e=>e,tw={},tN=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function tk(e,t){let r=!1,n=!0,i={delta:0,timestamp:0,isProcessing:!1},a=()=>r=!0,s=tN.reduce((e,r)=>(e[r]=function(e,t){let r=new Set,n=new Set,i=!1,a=!1,s=new WeakSet,l={delta:0,timestamp:0,isProcessing:!1},o=0;function c(t){s.has(t)&&(d.schedule(t),e()),o++,t(l)}let d={schedule:(e,t=!1,a=!1)=>{let l=a&&i?r:n;return t&&s.add(e),l.has(e)||l.add(e),e},cancel:e=>{n.delete(e),s.delete(e)},process:e=>{if(l=e,i){a=!0;return}i=!0,[r,n]=[n,r],r.forEach(c),t,o=0,r.clear(),i=!1,a&&(a=!1,d.process(e))}};return d}(a,t?r:void 0),e),{}),{setup:l,read:o,resolveKeyframes:c,preUpdate:d,update:u,preRender:h,render:p,postRender:m}=s,f=()=>{let a=tw.useManualTiming?i.timestamp:performance.now();r=!1,tw.useManualTiming||(i.delta=n?1e3/60:Math.max(Math.min(a-i.timestamp,40),1)),i.timestamp=a,i.isProcessing=!0,l.process(i),o.process(i),c.process(i),d.process(i),u.process(i),h.process(i),p.process(i),m.process(i),i.isProcessing=!1,r&&t&&(n=!1,e(f))};return{schedule:tN.reduce((t,a)=>{let l=s[a];return t[a]=(t,a=!1,s=!1)=>(!r&&(r=!0,n=!0,i.isProcessing||e(f)),l.schedule(t,a,s)),t},{}),cancel:e=>{for(let t=0;t<tN.length;t++)s[tN[t]].cancel(e)},state:i,steps:s}}let{schedule:tS,cancel:tO,state:tP,steps:tC}=tk("u">typeof requestAnimationFrame?requestAnimationFrame:tj,!0),tA=new Set,tE=!1,tM=!1,tT=!1;function t_(){if(tM){let e=Array.from(tA).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),r=new Map;t.forEach(e=>{let t,n=(t=[],tv.forEach(r=>{let n=e.getValue(r);void 0!==n&&(t.push([r,n.get()]),n.set(+!!r.startsWith("scale")))}),t);n.length&&(r.set(e,n),e.render())}),e.forEach(e=>e.measureInitialState()),t.forEach(e=>{e.render();let t=r.get(e);t&&t.forEach(([t,r])=>{e.getValue(t)?.set(r)})}),e.forEach(e=>e.measureEndState()),e.forEach(e=>{void 0!==e.suspendedScrollY&&window.scrollTo(0,e.suspendedScrollY)})}tM=!1,tE=!1,tA.forEach(e=>e.complete(tT)),tA.clear()}function tD(){tA.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(tM=!0)})}class tI{constructor(e,t,r,n,i,a=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=r,this.motionValue=n,this.element=i,this.isAsync=a}scheduleResolve(){this.state="scheduled",this.isAsync?(tA.add(this),tE||(tE=!0,tS.read(tD),tS.resolveKeyframes(t_))):(this.readKeyframes(),this.complete())}readKeyframes(){let{unresolvedKeyframes:e,name:t,element:r,motionValue:n}=this;if(null===e[0]){let i=n?.get(),a=e[e.length-1];if(void 0!==i)e[0]=i;else if(r&&t){let n=r.readValue(t,a);null!=n&&(e[0]=n)}void 0===e[0]&&(e[0]=a),n&&void 0===i&&n.set(e[0])}for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),tA.delete(this)}cancel(){"scheduled"===this.state&&(tA.delete(this),this.state="pending")}resume(){"pending"===this.state&&this.scheduleResolve()}}function tz(e,t){let r=eZ(e);return r!==eQ&&(r=eV),r.getAnimatableNone?r.getAnimatableNone(t):void 0}let tL=new Set(["auto","none","0"]);class tR extends tI{constructor(e,t,r,n,i){super(e,t,r,n,i,!0)}readKeyframes(){let{unresolvedKeyframes:e,element:t,name:r}=this;if(!t||!t.current)return;super.readKeyframes();for(let r=0;r<e.length;r++){let n=e[r];if("string"==typeof n&&tn(n=n.trim())){let i=function e(t,r,n=1){e9(n<=4,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`,"max-css-var-depth");let[i,a]=function(e){let t=ts.exec(e);if(!t)return[,];let[,r,n,i]=t;return[`--${r??n}`,i]}(t);if(!i)return;let s=window.getComputedStyle(r).getPropertyValue(i);if(s){let e=s.trim();return/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e)?parseFloat(e):e}return tn(a)?e(a,r,n+1):a}(n,t.current);void 0!==i&&(e[r]=i),r===e.length-1&&(this.finalKeyframe=n)}}if(this.resolveNoneKeyframes(),!e4.has(r)||2!==e.length)return;let[n,i]=e,a=e8(n),s=e8(i);if(ta(n)!==ta(i)&&tb[r]){this.needsMeasurement=!0;return}if(a!==s)if(ty(a)&&ty(s))for(let t=0;t<e.length;t++){let r=e[t];"string"==typeof r&&(e[t]=parseFloat(r))}else tb[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){let{unresolvedKeyframes:e,name:t}=this,r=[];for(let t=0;t<e.length;t++)(null===e[t]||function(e){if("number"==typeof e)return 0===e;if(null===e)return!0;return"none"===e||"0"===e||/^0[^.\s]+$/u.test(e)}(e[t]))&&r.push(t);r.length&&function(e,t,r){let n,i=0;for(;i<e.length&&!n;){let t=e[i];"string"==typeof t&&!tL.has(t)&&e$(t).values.length&&(n=e[i]),i++}if(n&&r)for(let i of t)e[i]=tz(r,n)}(e,r,t)}measureInitialState(){let{element:e,unresolvedKeyframes:t,name:r}=this;if(!e||!e.current)return;"height"===r&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=tb[r](e.measureViewportBox(),window.getComputedStyle(e.current)),t[0]=this.measuredOrigin;let n=t[t.length-1];void 0!==n&&e.getValue(r,n).jump(n,!1)}measureEndState(){let{element:e,name:t,unresolvedKeyframes:r}=this;if(!e||!e.current)return;let n=e.getValue(t);n&&n.jump(this.measuredOrigin,!1);let i=r.length-1,a=r[i];r[i]=tb[t](e.measureViewportBox(),window.getComputedStyle(e.current)),null!==a&&void 0===this.finalKeyframe&&(this.finalKeyframe=a),this.removedTransforms?.length&&this.removedTransforms.forEach(([t,r])=>{e.getValue(t).set(r)}),this.resolveNoneKeyframes()}}function tF(e,t){-1===e.indexOf(t)&&e.push(t)}function t$(e,t){let r=e.indexOf(t);r>-1&&e.splice(r,1)}class tB{constructor(){this.subscriptions=[]}add(e){return tF(this.subscriptions,e),()=>t$(this.subscriptions,e)}notify(e,t,r){let n=this.subscriptions.length;if(n)if(1===n)this.subscriptions[0](e,t,r);else for(let i=0;i<n;i++){let n=this.subscriptions[i];n&&n(e,t,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}let{schedule:tU}=tk(queueMicrotask,!1);function tq(){t=void 0}let tV={now:()=>(void 0===t&&tV.set(tP.isProcessing||tw.useManualTiming?tP.timestamp:performance.now()),t),set:e=>{t=e,queueMicrotask(tq)}};class tK{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{let t=tV.now();if(this.updatedAt!==t&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(e),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(let e of this.dependents)e.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=tV.now(),null===this.canTrackVelocity&&void 0!==e&&(this.canTrackVelocity=!isNaN(parseFloat(this.current)))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,t){this.events[e]||(this.events[e]=new tB);let r=this.events[e].add(t);return"change"===e?()=>{r(),tS.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(let e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,r){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-r}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return l&&l.push(this),this.current}getPrevious(){return this.prev}getVelocity(){var e;let t=tV.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||t-this.updatedAt>30)return 0;let r=Math.min(this.updatedAt-this.prevUpdatedAt,30);return e=parseFloat(this.current)-parseFloat(this.prevFrameValue),r?1e3/r*e:0}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),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 tW(e,t){return new tK(e,t)}let tH=[...e6,eI,eV],tQ={current:null},tY={current:!1},tX="u">typeof window,tG=new WeakMap;function tZ(e){return null!==e&&"object"==typeof e&&"function"==typeof e.start}function tJ(e){return"string"==typeof e||Array.isArray(e)}let t0=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],t1=["initial",...t0];function t2(e){return tZ(e.animate)||t1.some(t=>tJ(e[t]))}function t5(e){return!!(t2(e)||e.variants)}function t4(e){let t=[{},{}];return e?.values.forEach((e,r)=>{t[0][r]=e.get(),t[1][r]=e.getVelocity()}),t}function t3(e,t,r,n){if("function"==typeof t){let[i,a]=t4(n);t=t(void 0!==r?r:e.custom,i,a)}if("string"==typeof t&&(t=e.variants&&e.variants[t]),"function"==typeof t){let[i,a]=t4(n);t=t(void 0!==r?r:e.custom,i,a)}return t}let t6=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],t8={};class t7{scrapeMotionValuesFromProps(e,t,r){return{}}constructor({parent:e,props:t,presenceContext:r,reducedMotionConfig:n,blockInitialAnimation:i,visualState:a},s={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=tI,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 e=tV.now();this.renderScheduledAt<e&&(this.renderScheduledAt=e,tS.render(this.render,!1,!0))};const{latestValues:l,renderState:o}=a;this.latestValues=l,this.baseTarget={...l},this.initialValues=t.initial?{...l}:{},this.renderState=o,this.parent=e,this.props=t,this.presenceContext=r,this.depth=e?e.depth+1:0,this.reducedMotionConfig=n,this.options=s,this.blockInitialAnimation=!!i,this.isControllingVariants=t2(t),this.isVariantNode=t5(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:c,...d}=this.scrapeMotionValuesFromProps(t,{},this);for(const e in d){const t=d[e];void 0!==l[e]&&e5(t)&&t.set(l[e])}}mount(e){this.current=e,tG.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((e,t)=>this.bindToMotionValue(t,e)),"never"===this.reducedMotionConfig?this.shouldReduceMotion=!1:"always"===this.reducedMotionConfig?this.shouldReduceMotion=!0:(tY.current||function(){if(tY.current=!0,tX)if(window.matchMedia){let e=window.matchMedia("(prefers-reduced-motion)"),t=()=>tQ.current=e.matches;e.addEventListener("change",t),t()}else tQ.current=!1}(),this.shouldReduceMotion=tQ.current),this.parent?.addChild(this),this.update(this.props,this.presenceContext)}unmount(){for(let e in this.projection&&this.projection.unmount(),tO(this.notifyUpdate),tO(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this),this.events)this.events[e].clear();for(let e in this.features){let t=this.features[e];t&&(t.unmount(),t.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,t){let r;this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();let n=em.has(e);n&&this.onBindTransform&&this.onBindTransform();let i=t.on("change",t=>{this.latestValues[e]=t,this.props.onUpdate&&tS.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});"u">typeof window&&window.MotionCheckAppearSync&&(r=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{i(),r&&r(),t.owner&&t.stop()})}sortNodePosition(e){return this.current&&this.sortInstanceNodePosition&&this.type===e.type?this.sortInstanceNodePosition(this.current,e.current):0}updateFeatures(){let e="animation";for(e in t8){let t=t8[e];if(!t)continue;let{isEnabled:r,Feature:n}=t;if(!this.features[e]&&n&&r(this.props)&&(this.features[e]=new n(this)),this.features[e]){let t=this.features[e];t.isMounted?t.update():(t.mount(),t.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):e2()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let t=0;t<t6.length;t++){let r=t6[t];this.propEventSubscriptions[r]&&(this.propEventSubscriptions[r](),delete this.propEventSubscriptions[r]);let n=e["on"+r];n&&(this.propEventSubscriptions[r]=this.on(r,n))}this.prevMotionValues=function(e,t,r){for(let n in t){let i=t[n],a=r[n];if(e5(i))e.addValue(n,i);else if(e5(a))e.addValue(n,tW(i,{owner:e}));else if(a!==i)if(e.hasValue(n)){let t=e.getValue(n);!0===t.liveStyle?t.jump(i):t.hasAnimated||t.set(i)}else{let t=e.getStaticValue(n);e.addValue(n,tW(void 0!==t?t:i,{owner:e}))}}for(let n in r)void 0===t[n]&&e.removeValue(n);return t}(this,this.scrapeMotionValuesFromProps(e,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]: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(e){let t=this.getClosestVariantNode();if(t)return t.variantChildren&&t.variantChildren.add(e),()=>t.variantChildren.delete(e)}addValue(e,t){let r=this.values.get(e);t!==r&&(r&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t),this.latestValues[e]=t.get())}removeValue(e){this.values.delete(e);let t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let r=this.values.get(e);return void 0===r&&void 0!==t&&(r=tW(null===t?void 0:t,{owner:this}),this.addValue(e,r)),r}readValue(e,t){let r=void 0===this.latestValues[e]&&this.current?this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options):this.latestValues[e];if(null!=r){let n,i;if("string"==typeof r&&(n=r,/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(n)||(i=r,/^0[^.\s]+$/u.test(i))))r=parseFloat(r);else{let n;n=r,!tH.find(e3(n))&&eV.test(t)&&(r=tz(e,t))}this.setBaseTarget(e,e5(r)?r.get():r)}return e5(r)?r.get():r}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){let t,{initial:r}=this.props;if("string"==typeof r||"object"==typeof r){let n=t3(this.props,r,this.presenceContext?.custom);n&&(t=n[e])}if(r&&void 0!==t)return t;let n=this.getBaseTargetFromProps(this.props,e);return void 0===n||e5(n)?void 0!==this.initialValues[e]&&void 0===t?void 0:this.baseTarget[e]:n}on(e,t){return this.events[e]||(this.events[e]=new tB),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){tU.render(this.render)}}class t9 extends t7{constructor(){super(...arguments),this.KeyframeResolver=tR}sortInstanceNodePosition(e,t){return 2&e.compareDocumentPosition(t)?1:-1}getBaseTargetFromProps(e,t){let r=e.style;return r?r[t]:void 0}removeValueFromRenderState(e,{vars:t,style:r}){delete t[e],delete r[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);let{children:e}=this.props;e5(e)&&(this.childSubscription=e.on("change",e=>{this.current&&(this.current.textContent=`${e}`)}))}}function re(e){return e.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}let rt=(e,t)=>t&&"number"==typeof e?t.transform(e):e,rr={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},rn=ep.length;function ri(e,t,r){let{style:n,vars:i,transformOrigin:a}=e,s=!1,l=!1;for(let e in t){let r=t[e];if(em.has(e)){s=!0;continue}if(tt(e)){i[e]=r;continue}{let t=rt(r,eX[e]);e.startsWith("origin")?(l=!0,a[e]=t):n[e]=t}}if(!t.transform&&(s||r?n.transform=function(e,t,r){let n="",i=!0;for(let a=0;a<rn;a++){let s=ep[a],l=e[s];if(void 0===l)continue;let o=!0;if("number"==typeof l)o=l===+!!s.startsWith("scale");else{let e=parseFloat(l);o=s.startsWith("scale")?1===e:0===e}if(!o||r){let e=rt(l,eX[s]);if(!o){i=!1;let t=rr[s]||s;n+=`${t}(${e}) `}r&&(t[s]=e)}}return n=n.trim(),r?n=r(t,i?"":n):i&&(n="none"),n}(t,e.transform,r):n.transform&&(n.transform="none")),l){let{originX:e="50%",originY:t="50%",originZ:r=0}=a;n.transformOrigin=`${e} ${t} ${r}`}}let ra={offset:"stroke-dashoffset",array:"stroke-dasharray"},rs={offset:"strokeDashoffset",array:"strokeDasharray"},rl=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function ro(e,{attrX:t,attrY:r,attrScale:n,pathLength:i,pathSpacing:a=1,pathOffset:s=0,...l},o,c,d){if(ri(e,l,c),o){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};let{attrs:u,style:h}=e;for(let e of(u.transform&&(h.transform=u.transform,delete u.transform),(h.transform||u.transformOrigin)&&(h.transformOrigin=u.transformOrigin??"50% 50%",delete u.transformOrigin),h.transform&&(h.transformBox=d?.transformBox??"fill-box",delete u.transformBox),rl))void 0!==u[e]&&(h[e]=u[e],delete u[e]);void 0!==t&&(u.x=t),void 0!==r&&(u.y=r),void 0!==n&&(u.scale=n),void 0!==i&&function(e,t,r=1,n=0,i=!0){e.pathLength=1;let a=i?ra:rs;e[a.offset]=`${-n}`,e[a.array]=`${t} ${r}`}(u,i,a,s,!1)}let rc=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"]),rd=e=>"string"==typeof e&&"svg"===e.toLowerCase();function ru(e,{style:t,vars:r},n,i){let a,s=e.style;for(a in t)s[a]=t[a];for(a in i?.applyProjectionStyles(s,n),r)s.setProperty(a,r[a])}function rh(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}let rp={correct:(e,t)=>{if(!t.target)return e;if("string"==typeof e)if(!eE.test(e))return e;else e=parseFloat(e);let r=rh(e,t.target.x),n=rh(e,t.target.y);return`${r}% ${n}%`}},rm=(e,t,r)=>e+(t-e)*r,rf={borderRadius:{...rp,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:rp,borderTopRightRadius:rp,borderBottomLeftRadius:rp,borderBottomRightRadius:rp,boxShadow:{correct:(e,{treeScale:t,projectionDelta:r})=>{let n=eV.parse(e);if(n.length>5)return e;let i=eV.createTransformer(e),a=+("number"!=typeof n[0]),s=r.x.scale*t.x,l=r.y.scale*t.y;n[0+a]/=s,n[1+a]/=l;let o=rm(s,l,.5);return"number"==typeof n[2+a]&&(n[2+a]/=o),"number"==typeof n[3+a]&&(n[3+a]/=o),i(n)}}};function rx(e,{layout:t,layoutId:r}){return em.has(e)||e.startsWith("origin")||(t||void 0!==r)&&(!!rf[e]||"opacity"===e)}function ry(e,t,r){let n=e.style,i=t?.style,a={};if(!n)return a;for(let t in n)(e5(n[t])||i&&e5(i[t])||rx(t,e)||r?.getValue(t)?.liveStyle!==void 0)&&(a[t]=n[t]);return a}function rg(e,t,r){let n=ry(e,t,r);for(let r in e)(e5(e[r])||e5(t[r]))&&(n[-1!==ep.indexOf(r)?"attr"+r.charAt(0).toUpperCase()+r.substring(1):r]=e[r]);return n}class rv extends t9{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=e2}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(em.has(t)){let e=eZ(t);return e&&e.default||0}return t=rc.has(t)?t:re(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,r){return rg(e,t,r)}build(e,t,r){ro(e,t,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(e,t,r,n){for(let r in ru(e,t,void 0,n),t.attrs)e.setAttribute(rc.has(r)?r:re(r),t.attrs[r])}mount(e){this.isSVGTag=rd(e.tagName),super.mount(e)}}function rb({top:e,left:t,right:r,bottom:n}){return{x:{min:t,max:r},y:{min:e,max:n}}}function rj(e){return void 0===e||1===e}function rw({scale:e,scaleX:t,scaleY:r}){return!rj(e)||!rj(t)||!rj(r)}function rN(e){return rw(e)||rk(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function rk(e){var t,r;return(t=e.x)&&"0%"!==t||(r=e.y)&&"0%"!==r}function rS(e,t,r,n,i){return void 0!==i&&(e=n+i*(e-n)),n+r*(e-n)+t}function rO(e,t=0,r=1,n,i){e.min=rS(e.min,t,r,n,i),e.max=rS(e.max,t,r,n,i)}function rP(e,{x:t,y:r}){rO(e.x,t.translate,t.scale,t.originPoint),rO(e.y,r.translate,r.scale,r.originPoint)}function rC(e,t){e.min=e.min+t,e.max=e.max+t}function rA(e,t,r,n,i=.5){let a=rm(e.min,e.max,i);rO(e,t,r,a,n)}function rE(e,t){rA(e.x,t.x,t.scaleX,t.scale,t.originX),rA(e.y,t.y,t.scaleY,t.scale,t.originY)}function rM(e,t){return rb(function(e,t){if(!t)return e;let r=t({x:e.left,y:e.top}),n=t({x:e.right,y:e.bottom});return{top:r.y,left:r.x,bottom:n.y,right:n.x}}(e.getBoundingClientRect(),t))}class rT extends t9{constructor(){super(...arguments),this.type="html",this.renderInstance=ru}readValueFromInstance(e,t){if(em.has(t))return this.projection?.isProjecting?tm(t):((e,t)=>{let{transform:r="none"}=getComputedStyle(e);return tf(r,t)})(e,t);{let r=window.getComputedStyle(e),n=(tt(t)?r.getPropertyValue(t):r[t])||0;return"string"==typeof n?n.trim():n}}measureInstanceViewportBox(e,{transformPagePoint:t}){return rM(e,t)}build(e,t,r){ri(e,t,r.transformTemplate)}scrapeMotionValuesFromProps(e,t,r){return ry(e,t,r)}}let r_=["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 rD(e){if("string"!=typeof e||e.includes("-"));else if(r_.indexOf(e)>-1||/[A-Z]/u.test(e))return!0;return!1}let rI=(0,H.createContext)({strict:!1}),rz=(0,H.createContext)({});function rL(e){return Array.isArray(e)?e.join(" "):e}let rR=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function rF(e,t,r){for(let n in t)e5(t[n])||rx(n,r)||(e[n]=t[n])}let r$=()=>({...rR(),attrs:{}}),rB=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 rU(e){return e.startsWith("while")||e.startsWith("drag")&&"draggable"!==e||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||rB.has(e)}let rq=e=>!rU(e);try{d=(()=>{let e=Error("Cannot find module '@emotion/is-prop-valid'");throw e.code="MODULE_NOT_FOUND",e})().default,"function"==typeof d&&(rq=e=>e.startsWith("on")?!rU(e):d(e))}catch{}function rV(e){return e5(e)?e.get():e}let rK=e=>(t,r)=>{let n=(0,H.useContext)(rz),i=(0,H.useContext)(J),a=()=>(function({scrapeMotionValuesFromProps:e,createRenderState:t},r,n,i){return{latestValues:function(e,t,r,n){let i={},a=n(e,{});for(let e in a)i[e]=rV(a[e]);let{initial:s,animate:l}=e,o=t2(e),c=t5(e);t&&c&&!o&&!1!==e.inherit&&(void 0===s&&(s=t.initial),void 0===l&&(l=t.animate));let d=!!r&&!1===r.initial,u=(d=d||!1===s)?l:s;if(u&&"boolean"!=typeof u&&!tZ(u)){let t=Array.isArray(u)?u:[u];for(let r=0;r<t.length;r++){let n=t3(e,t[r]);if(n){let{transitionEnd:e,transition:t,...r}=n;for(let e in r){let t=r[e];if(Array.isArray(t)){let e=d?t.length-1:0;t=t[e]}null!==t&&(i[e]=t)}for(let t in e)i[t]=e[t]}}}return i}(r,n,i,e),renderState:t()}})(e,t,n,i);return r?a():X(a)},rW=rK({scrapeMotionValuesFromProps:ry,createRenderState:rR}),rH=rK({scrapeMotionValuesFromProps:rg,createRenderState:r$}),rQ={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"]},rY=!1;function rX(){return!function(){if(rY)return;let e={};for(let t in rQ)e[t]={isEnabled:e=>rQ[t].some(t=>!!e[t])};t8=e,rY=!0}(),t8}let rG=Symbol.for("motionComponentSymbol"),rZ="data-"+re("framerAppearId"),rJ=(0,H.createContext)({});function r0(e){return e&&"object"==typeof e&&Object.prototype.hasOwnProperty.call(e,"current")}function r1(e,{forwardMotionProps:t=!1,type:r}={},n,i){n&&function(e){let t=rX();for(let r in e)t[r]={...t[r],...e[r]};t8=t}(n);let a=r?"svg"===r:rD(e),s=a?rH:rW;function l(r,n){var l;let o,c,d,u={...(0,H.useContext)(en),...r,layoutId:function({layoutId:e}){let t=(0,H.useContext)(Y).id;return t&&void 0!==e?t+"-"+e:e}(r)},{isStatic:h}=u,p=function(e){let{initial:t,animate:r}=function(e,t){if(t2(e)){let{initial:t,animate:r}=e;return{initial:!1===t||tJ(t)?t:void 0,animate:tJ(r)?r:void 0}}return!1!==e.inherit?t:{}}(e,(0,H.useContext)(rz));return(0,H.useMemo)(()=>({initial:t,animate:r}),[rL(t),rL(r)])}(r),m=s(r,h);if(!h&&G){(0,H.useContext)(rI).strict;let t=function(e){let{drag:t,layout:r}=rX();if(!t&&!r)return{};let n={...t,...r};return{MeasureLayout:t?.isEnabled(e)||r?.isEnabled(e)?n.MeasureLayout:void 0,ProjectionNode:n.ProjectionNode}}(u);o=t.MeasureLayout,p.visualElement=function(e,t,r,n,i,a){let{visualElement:s}=(0,H.useContext)(rz),l=(0,H.useContext)(rI),o=(0,H.useContext)(J),c=(0,H.useContext)(en).reducedMotion,d=(0,H.useRef)(null),u=(0,H.useRef)(!1);n=n||l.renderer,!d.current&&n&&(d.current=n(e,{visualState:t,parent:s,props:r,presenceContext:o,blockInitialAnimation:!!o&&!1===o.initial,reducedMotionConfig:c,isSVG:a}),u.current&&d.current&&(d.current.manuallyAnimateOnMount=!0));let h=d.current,p=(0,H.useContext)(rJ);h&&!h.projection&&i&&("html"===h.type||"svg"===h.type)&&function(e,t,r,n){let{layoutId:i,layout:a,drag:s,dragConstraints:l,layoutScroll:o,layoutRoot:c,layoutCrossfade:d}=t;e.projection=new r(e.latestValues,t["data-framer-portal-id"]?void 0:function e(t){if(t)return!1!==t.options.allowProjection?t.projection:e(t.parent)}(e.parent)),e.projection.setOptions({layoutId:i,layout:a,alwaysMeasureLayout:!!s||l&&r0(l),visualElement:e,animationType:"string"==typeof a?a:"both",initialPromotionConfig:n,crossfade:d,layoutScroll:o,layoutRoot:c})}(d.current,r,i,p);let m=(0,H.useRef)(!1);(0,H.useInsertionEffect)(()=>{h&&m.current&&h.update(r,o)});let f=r[rZ],x=(0,H.useRef)(!!f&&!window.MotionHandoffIsComplete?.(f)&&window.MotionHasOptimisedAnimation?.(f));return Z(()=>{u.current=!0,h&&(m.current=!0,window.MotionIsMounted=!0,h.updateFeatures(),h.scheduleRenderMicrotask(),x.current&&h.animationState&&h.animationState.animateChanges())}),(0,H.useEffect)(()=>{h&&(!x.current&&h.animationState&&h.animationState.animateChanges(),x.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(f)}),x.current=!1),h.enteringChildren=void 0)}),h}(e,m,u,i,t.ProjectionNode,a)}return(0,W.jsxs)(rz.Provider,{value:p,children:[o&&p.visualElement?(0,W.jsx)(o,{visualElement:p.visualElement,...u}):null,function(e,t,r,{latestValues:n},i,a=!1,s){let l=(s??rD(e)?function(e,t,r,n){let i=(0,H.useMemo)(()=>{let r=r$();return ro(r,t,rd(n),e.transformTemplate,e.style),{...r.attrs,style:{...r.style}}},[t]);if(e.style){let t={};rF(t,e.style,e),i.style={...t,...i.style}}return i}:function(e,t){let r,n,i={},a=(r=e.style||{},rF(n={},r,e),Object.assign(n,function({transformTemplate:e},t){return(0,H.useMemo)(()=>{let r=rR();return ri(r,t,e),Object.assign({},r.vars,r.style)},[t])}(e,t)),n);return e.drag&&!1!==e.dragListener&&(i.draggable=!1,a.userSelect=a.WebkitUserSelect=a.WebkitTouchCallout="none",a.touchAction=!0===e.drag?"none":`pan-${"x"===e.drag?"y":"x"}`),void 0===e.tabIndex&&(e.onTap||e.onTapStart||e.whileTap)&&(i.tabIndex=0),i.style=a,i})(t,n,i,e),o=function(e,t,r){let n={};for(let i in e)("values"!==i||"object"!=typeof e.values)&&(rq(i)||!0===r&&rU(i)||!t&&!rU(i)||e.draggable&&i.startsWith("onDrag"))&&(n[i]=e[i]);return n}(t,"string"==typeof e,a),c=e!==H.Fragment?{...o,...l,ref:r}:{},{children:d}=t,u=(0,H.useMemo)(()=>e5(d)?d.get():d,[d]);return(0,H.createElement)(e,{...c,children:u})}(e,r,(l=p.visualElement,c=(0,H.useRef)(n),(0,H.useInsertionEffect)(()=>{c.current=n}),d=(0,H.useRef)(null),(0,H.useCallback)(e=>{e&&m.onMount?.(e),l&&(e?l.mount(e):l.unmount());let t=c.current;if("function"==typeof t)if(e){let r=t(e);"function"==typeof r&&(d.current=r)}else d.current?(d.current(),d.current=null):t(e);else t&&(t.current=e)},[l])),m,h,t,a)]})}l.displayName=`motion.${"string"==typeof e?e:`create(${e.displayName??e.name??""})`}`;let o=(0,H.forwardRef)(l);return o[rG]=e,o}class r2{constructor(e){this.isMounted=!1,this.node=e}update(){}}function r5(e,t,r){let n=e.getProps();return t3(n,t,void 0!==r?r:n.custom,e)}function r4(e,t){return e?.[t]??e?.default??e}let r3=e=>Array.isArray(e);function r6(e,t){let r=e.getValue("willChange");if(e5(r)&&r.add)return r.add(t);if(!r&&tw.WillChange){let r=new tw.WillChange("auto");e.addValue("willChange",r),r.add(t)}}let r8=e=>1e3*e,r7=(e,t)=>r=>t(e(r)),r9=(...e)=>e.reduce(r7),ne={layout:0,mainThread:0,waapi:0};function nt(e,t,r){return(r<0&&(r+=1),r>1&&(r-=1),r<1/6)?e+(t-e)*6*r:r<.5?t:r<2/3?e+(t-e)*(2/3-r)*6:e}function nr(e,t){return r=>r>0?t:e}let nn=(e,t,r)=>{let n=e*e,i=r*(t*t-n)+n;return i<0?0:Math.sqrt(i)},ni=[eO,eS,eD];function na(e){let t=ni.find(t=>t.test(e));if(e7(!!t,`'${e}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!t)return!1;let r=t.parse(e);return t===eD&&(r=function({hue:e,saturation:t,lightness:r,alpha:n}){e/=360,r/=100;let i=0,a=0,s=0;if(t/=100){let n=r<.5?r*(1+t):r+t-r*t,l=2*r-n;i=nt(l,n,e+1/3),a=nt(l,n,e),s=nt(l,n,e-1/3)}else i=a=s=r;return{red:Math.round(255*i),green:Math.round(255*a),blue:Math.round(255*s),alpha:n}}(r)),r}let ns=(e,t)=>{let r=na(e),n=na(t);if(!r||!n)return nr(e,t);let i={...r};return e=>(i.red=nn(r.red,n.red,e),i.green=nn(r.green,n.green,e),i.blue=nn(r.blue,n.blue,e),i.alpha=rm(r.alpha,n.alpha,e),eS.transform(i))},nl=new Set(["none","hidden"]);function no(e,t){return r=>rm(e,t,r)}function nc(e){return"number"==typeof e?no:"string"==typeof e?tn(e)?nr:eI.test(e)?ns:nh:Array.isArray(e)?nd:"object"==typeof e?eI.test(e)?ns:nu:nr}function nd(e,t){let r=[...e],n=r.length,i=e.map((e,r)=>nc(e)(e,t[r]));return e=>{for(let t=0;t<n;t++)r[t]=i[t](e);return r}}function nu(e,t){let r={...e,...t},n={};for(let i in r)void 0!==e[i]&&void 0!==t[i]&&(n[i]=nc(e[i])(e[i],t[i]));return e=>{for(let t in n)r[t]=n[t](e);return r}}let nh=(e,t)=>{let r=eV.createTransformer(t),n=e$(e),i=e$(t);if(!(n.indexes.var.length===i.indexes.var.length&&n.indexes.color.length===i.indexes.color.length&&n.indexes.number.length>=i.indexes.number.length))return e7(!0,`Complex values '${e}' and '${t}' 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"),nr(e,t);if(nl.has(e)&&!i.values.length||nl.has(t)&&!n.values.length)return nl.has(e)?r=>r<=0?e:t:r=>r>=1?t:e;return r9(nd(function(e,t){let r=[],n={color:0,var:0,number:0};for(let i=0;i<t.values.length;i++){let a=t.types[i],s=e.indexes[a][n[a]],l=e.values[s]??0;r[i]=l,n[a]++}return r}(n,i),i.values),r)};function np(e,t,r){return"number"==typeof e&&"number"==typeof t&&"number"==typeof r?rm(e,t,r):nc(e)(e,t)}let nm=e=>{let t=({timestamp:t})=>e(t);return{start:(e=!0)=>tS.update(t,e),stop:()=>tO(t),now:()=>tP.isProcessing?tP.timestamp:tV.now()}},nf=(e,t,r=10)=>{let n="",i=Math.max(Math.round(t/r),2);for(let t=0;t<i;t++)n+=Math.round(1e4*e(t/(i-1)))/1e4+", ";return`linear(${n.substring(0,n.length-2)})`};function nx(e){let t=0,r=e.next(t);for(;!r.done&&t<2e4;)t+=50,r=e.next(t);return t>=2e4?1/0:t}function ny(e,t,r){var n,i;let a=Math.max(t-5,0);return n=r-e(a),(i=t-a)?1e3/i*n:0}let ng=.01,nv=2,nb=.005,nj=.5;function nw(e,t){return e*Math.sqrt(1-t*t)}let nN=["duration","bounce"],nk=["stiffness","damping","mass"];function nS(e,t){return t.some(t=>void 0!==e[t])}function nO(e=.3,t=.3){let r,n="object"!=typeof e?{visualDuration:e,keyframes:[0,1],bounce:t}:e,{restSpeed:i,restDelta:a}=n,s=n.keyframes[0],l=n.keyframes[n.keyframes.length-1],o={done:!1,value:s},{stiffness:c,damping:d,mass:u,duration:h,velocity:p,isResolvedFromDuration:m}=function(e){let t={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...e};if(!nS(e,nk)&&nS(e,nN))if(e.visualDuration){let r=2*Math.PI/(1.2*e.visualDuration),n=r*r,i=2*ef(.05,1,1-(e.bounce||0))*Math.sqrt(n);t={...t,mass:1,stiffness:n,damping:i}}else{let r=function({duration:e=800,bounce:t=.3,velocity:r=0,mass:n=1}){let i,a;e7(e<=r8(10),"Spring duration must be 10 seconds or less","spring-duration-limit");let s=1-t;s=ef(.05,1,s),e=ef(.01,10,e/1e3),s<1?(i=t=>{let n=t*s,i=n*e;return .001-(n-r)/nw(t,s)*Math.exp(-i)},a=t=>{let n=t*s*e,a=Math.pow(s,2)*Math.pow(t,2)*e,l=Math.exp(-n),o=nw(Math.pow(t,2),s);return(n*r+r-a)*l*(-i(t)+.001>0?-1:1)/o}):(i=t=>-.001+Math.exp(-t*e)*((t-r)*e+1),a=t=>e*e*(r-t)*Math.exp(-t*e));let l=function(e,t,r){let n=r;for(let r=1;r<12;r++)n-=e(n)/t(n);return n}(i,a,5/e);if(e=r8(e),isNaN(l))return{stiffness:100,damping:10,duration:e};{let t=Math.pow(l,2)*n;return{stiffness:t,damping:2*s*Math.sqrt(n*t),duration:e}}}(e);(t={...t,...r,mass:1}).isResolvedFromDuration=!0}return t}({...n,velocity:-((n.velocity||0)/1e3)}),f=p||0,x=d/(2*Math.sqrt(c*u)),y=l-s,g=Math.sqrt(c/u)/1e3,v=5>Math.abs(y);if(i||(i=v?ng:nv),a||(a=v?nb:nj),x<1){let e=nw(g,x);r=t=>l-Math.exp(-x*g*t)*((f+x*g*y)/e*Math.sin(e*t)+y*Math.cos(e*t))}else if(1===x)r=e=>l-Math.exp(-g*e)*(y+(f+g*y)*e);else{let e=g*Math.sqrt(x*x-1);r=t=>{let r=Math.exp(-x*g*t),n=Math.min(e*t,300);return l-r*((f+x*g*y)*Math.sinh(n)+e*y*Math.cosh(n))/e}}let b={calculatedDuration:m&&h||null,next:e=>{let t=r(e);if(m)o.done=e>=h;else{let n=0===e?f:0;x<1&&(n=0===e?r8(f):ny(r,e,t));let s=Math.abs(l-t)<=a;o.done=Math.abs(n)<=i&&s}return o.value=o.done?l:t,o},toString:()=>{let e=Math.min(nx(b),2e4),t=nf(t=>b.next(e*t).value,e,30);return e+"ms "+t},toTransition:()=>{}};return b}function nP({keyframes:e,velocity:t=0,power:r=.8,timeConstant:n=325,bounceDamping:i=10,bounceStiffness:a=500,modifyTarget:s,min:l,max:o,restDelta:c=.5,restSpeed:d}){let u,h,p=e[0],m={done:!1,value:p},f=r*t,x=p+f,y=void 0===s?x:s(x);y!==x&&(f=y-p);let g=e=>-f*Math.exp(-e/n),v=e=>y+g(e),b=e=>{let t=g(e),r=v(e);m.done=Math.abs(t)<=c,m.value=m.done?y:r},j=e=>{let t;if(t=m.value,void 0!==l&&t<l||void 0!==o&&t>o){var r;u=e,h=nO({keyframes:[m.value,(r=m.value,void 0===l?o:void 0===o||Math.abs(l-r)<Math.abs(o-r)?l:o)],velocity:ny(v,e,m.value),damping:i,stiffness:a,restDelta:c,restSpeed:d})}};return j(0),{calculatedDuration:null,next:e=>{let t=!1;return(h||void 0!==u||(t=!0,b(e),j(e)),void 0!==u&&e>=u)?h.next(e-u):(t||b(e),m)}}}nO.applyToOptions=e=>{let t=function(e,t=100,r){let n=r({...e,keyframes:[0,t]}),i=Math.min(nx(n),2e4);return{type:"keyframes",ease:e=>n.next(i*e).value/t,duration:i/1e3}}(e,100,nO);return e.ease=t.ease,e.duration=r8(t.duration),e.type="keyframes",e};let nC=(e,t,r)=>(((1-3*r+3*t)*e+(3*r-6*t))*e+3*t)*e;function nA(e,t,r,n){return e===t&&r===n?tj:i=>0===i||1===i?i:nC(function(e,t,r,n,i){let a,s,l=0;do(a=nC(s=t+(r-t)/2,n,i)-e)>0?r=s:t=s;while(Math.abs(a)>1e-7&&++l<12)return s}(i,0,1,e,r),t,n)}let nE=nA(.42,0,1,1),nM=nA(0,0,.58,1),nT=nA(.42,0,.58,1),n_=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,nD=e=>t=>1-e(1-t),nI=nA(.33,1.53,.69,.99),nz=nD(nI),nL=n_(nz),nR=e=>(e*=2)<1?.5*nz(e):.5*(2-Math.pow(2,-10*(e-1))),nF=e=>1-Math.sin(Math.acos(e)),n$=nD(nF),nB=n_(nF),nU=e=>Array.isArray(e)&&"number"==typeof e[0],nq={linear:tj,easeIn:nE,easeInOut:nT,easeOut:nM,circIn:nF,circInOut:nB,circOut:n$,backIn:nz,backInOut:nL,backOut:nI,anticipate:nR},nV=e=>{if(nU(e)){e9(4===e.length,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");let[t,r,n,i]=e;return nA(t,r,n,i)}return"string"==typeof e?(e9(void 0!==nq[e],`Invalid easing type '${e}'`,"invalid-easing-type"),nq[e]):e},nK=(e,t,r)=>{let n=t-e;return 0===n?1:(r-e)/n};function nW({duration:e=300,keyframes:t,times:r,ease:n="easeInOut"}){var i;let a,s=Array.isArray(n)&&"number"!=typeof n[0]?n.map(nV):nV(n),l={done:!1,value:t[0]},o=function(e,t,{clamp:r=!0,ease:n,mixer:i}={}){let a=e.length;if(e9(a===t.length,"Both input and output ranges must be the same length","range-length"),1===a)return()=>t[0];if(2===a&&t[0]===t[1])return()=>t[1];let s=e[0]===e[1];e[0]>e[a-1]&&(e=[...e].reverse(),t=[...t].reverse());let l=function(e,t,r){let n=[],i=r||tw.mix||np,a=e.length-1;for(let r=0;r<a;r++){let a=i(e[r],e[r+1]);t&&(a=r9(Array.isArray(t)?t[r]||tj:t,a)),n.push(a)}return n}(t,n,i),o=l.length,c=r=>{if(s&&r<e[0])return t[0];let n=0;if(o>1)for(;n<e.length-2&&!(r<e[n+1]);n++);let i=nK(e[n],e[n+1],r);return l[n](i)};return r?t=>c(ef(e[0],e[a-1],t)):c}((i=r&&r.length===t.length?r:(!function(e,t){let r=e[e.length-1];for(let n=1;n<=t;n++){let i=nK(0,t,n);e.push(rm(r,1,i))}}(a=[0],t.length-1),a),i.map(t=>t*e)),t,{ease:Array.isArray(s)?s:t.map(()=>s||nT).splice(0,t.length-1)});return{calculatedDuration:e,next:t=>(l.value=o(t),l.done=t>=e,l)}}let nH=e=>null!==e;function nQ(e,{repeat:t,repeatType:r="loop"},n,i=1){let a=e.filter(nH),s=i<0||t&&"loop"!==r&&t%2==1?0:a.length-1;return s&&void 0!==n?n:a[s]}let nY={decay:nP,inertia:nP,tween:nW,keyframes:nW,spring:nO};function nX(e){"string"==typeof e.type&&(e.type=nY[e.type])}class nG{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,t){return this.finished.then(e,t)}}let nZ=e=>e/100;class nJ extends nG{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{let{motionValue:e}=this.options;e&&e.updatedAt!==tV.now()&&this.tick(tV.now()),this.isStopped=!0,"idle"!==this.state&&(this.teardown(),this.options.onStop?.())},ne.mainThread++,this.options=e,this.initAnimation(),this.play(),!1===e.autoplay&&this.pause()}initAnimation(){let{options:e}=this;nX(e);let{type:t=nW,repeat:r=0,repeatDelay:n=0,repeatType:i,velocity:a=0}=e,{keyframes:s}=e,l=t||nW;l!==nW&&"number"!=typeof s[0]&&(this.mixKeyframes=r9(nZ,np(s[0],s[1])),s=[0,100]);let o=l({...e,keyframes:s});"mirror"===i&&(this.mirroredGenerator=l({...e,keyframes:[...s].reverse(),velocity:-a})),null===o.calculatedDuration&&(o.calculatedDuration=nx(o));let{calculatedDuration:c}=o;this.calculatedDuration=c,this.resolvedDuration=c+n,this.totalDuration=this.resolvedDuration*(r+1)-n,this.generator=o}updateTime(e){let t=Math.round(e-this.startTime)*this.playbackSpeed;null!==this.holdTime?this.currentTime=this.holdTime:this.currentTime=t}tick(e,t=!1){let{generator:r,totalDuration:n,mixKeyframes:i,mirroredGenerator:a,resolvedDuration:s,calculatedDuration:l}=this;if(null===this.startTime)return r.next(0);let{delay:o=0,keyframes:c,repeat:d,repeatType:u,repeatDelay:h,type:p,onUpdate:m,finalKeyframe:f}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-n/this.speed,this.startTime)),t?this.currentTime=e:this.updateTime(e);let x=this.currentTime-o*(this.playbackSpeed>=0?1:-1),y=this.playbackSpeed>=0?x<0:x>n;this.currentTime=Math.max(x,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=n);let g=this.currentTime,v=r;if(d){let e=Math.min(this.currentTime,n)/s,t=Math.floor(e),r=e%1;!r&&e>=1&&(r=1),1===r&&t--,(t=Math.min(t,d+1))%2&&("reverse"===u?(r=1-r,h&&(r-=h/s)):"mirror"===u&&(v=a)),g=ef(0,1,r)*s}let b=y?{done:!1,value:c[0]}:v.next(g);i&&(b.value=i(b.value));let{done:j}=b;y||null===l||(j=this.playbackSpeed>=0?this.currentTime>=n:this.currentTime<=0);let w=null===this.holdTime&&("finished"===this.state||"running"===this.state&&j);return w&&p!==nP&&(b.value=nQ(c,this.options,f,this.speed)),m&&m(b.value),w&&this.finish(),b}then(e,t){return this.finished.then(e,t)}get duration(){return this.calculatedDuration/1e3}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+e/1e3}get time(){return this.currentTime/1e3}set time(e){e=r8(e),this.currentTime=e,null===this.startTime||null!==this.holdTime||0===this.playbackSpeed?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?.start(!1)}get speed(){return this.playbackSpeed}set speed(e){this.updateTime(tV.now());let t=this.playbackSpeed!==e;this.playbackSpeed=e,t&&(this.time=this.currentTime/1e3)}play(){if(this.isStopped)return;let{driver:e=nm,startTime:t}=this.options;this.driver||(this.driver=e(e=>this.tick(e))),this.options.onPlay?.();let r=this.driver.now();"finished"===this.state?(this.updateFinished(),this.startTime=r):null!==this.holdTime?this.startTime=r-this.holdTime:this.startTime||(this.startTime=t??r),"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(tV.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,ne.mainThread--}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),e.observe(this)}}function n0(e){let t;return()=>(void 0===t&&(t=e()),t)}let n1=n0(()=>void 0!==window.ScrollTimeline),n2={},n5=(r=n0(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(e){return!1}return!0}),()=>n2.linearEasing??r()),n4=([e,t,r,n])=>`cubic-bezier(${e}, ${t}, ${r}, ${n})`,n3={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:n4([0,.65,.55,1]),circOut:n4([.55,0,1,.45]),backIn:n4([.31,.01,.66,-.59]),backOut:n4([.33,1.53,.69,.99])};function n6(e){return"function"==typeof e&&"applyToOptions"in e}class n8 extends nG{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;const{element:t,name:r,keyframes:n,pseudoElement:i,allowFlatten:a=!1,finalKeyframe:s,onComplete:l}=e;this.isPseudoElement=!!i,this.allowFlatten=a,this.options=e,e9("string"!=typeof e.type,'Mini animate() doesn\'t support "type" as a string.',"mini-spring");const o=function({type:e,...t}){return n6(e)&&n5()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}(e);this.animation=function(e,t,r,{delay:n=0,duration:i=300,repeat:a=0,repeatType:s="loop",ease:l="easeOut",times:o}={},c){let d={[t]:r};o&&(d.offset=o);let u=function e(t,r){if(t)return"function"==typeof t?n5()?nf(t,r):"ease-out":nU(t)?n4(t):Array.isArray(t)?t.map(t=>e(t,r)||n3.easeOut):n3[t]}(l,i);Array.isArray(u)&&(d.easing=u);let h={delay:n,duration:i,easing:Array.isArray(u)?"linear":u,fill:"both",iterations:a+1,direction:"reverse"===s?"alternate":"normal"};c&&(h.pseudoElement=c);let p=e.animate(d,h);return p}(t,r,n,o,i),!1===o.autoplay&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){let e=nQ(n,this.options,s,this.speed);this.updateMotionValue?this.updateMotionValue(e):r.startsWith("--")?t.style.setProperty(r,e):t.style[r]=e,this.animation.cancel()}l?.(),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(e){}}stop(){if(this.isStopped)return;this.isStopped=!0;let{state:e}=this;"idle"!==e&&"finished"!==e&&(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:e=0}=this.options||{};return this.duration+e/1e3}get time(){return(Number(this.animation.currentTime)||0)/1e3}set time(e){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=r8(e)}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return null!==this.finishedTime?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,observe:t}){return(this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,e&&n1())?(this.animation.timeline=e,tj):t(this)}}let n7={anticipate:nR,backInOut:nL,circInOut:nB};class n9 extends n8{constructor(e){!function(e){"string"==typeof e.ease&&e.ease in n7&&(e.ease=n7[e.ease])}(e),nX(e),super(e),void 0!==e.startTime&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){let{motionValue:t,onUpdate:r,onComplete:n,element:i,...a}=this.options;if(!t)return;if(void 0!==e)return void t.set(e);let s=new nJ({...a,autoplay:!1}),l=Math.max(10,tV.now()-this.startTime),o=ef(0,10,l-10);t.setWithVelocity(s.sample(Math.max(0,l-o)).value,s.sample(l).value,o),s.stop()}}let ie=(e,t)=>"zIndex"!==t&&!!("number"==typeof e||Array.isArray(e)||"string"==typeof e&&(eV.test(e)||"0"===e)&&!e.startsWith("url("));function it(e){e.duration=0,e.type="keyframes"}let ir=new Set(["opacity","clipPath","filter","transform"]),ii=n0(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));class ia extends nG{constructor({autoplay:e=!0,delay:t=0,type:r="keyframes",repeat:n=0,repeatDelay:i=0,repeatType:a="loop",keyframes:s,name:l,motionValue:o,element:c,...d}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=tV.now();const u={autoplay:e,delay:t,type:r,repeat:n,repeatDelay:i,repeatType:a,name:l,motionValue:o,element:c,...d},h=c?.KeyframeResolver||tI;this.keyframeResolver=new h(s,(e,t,r)=>this.onKeyframesResolved(e,t,u,!r),l,o,c),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,t,r,n){this.keyframeResolver=void 0;let{name:i,type:a,velocity:s,delay:l,isHandoff:o,onUpdate:c}=r;this.resolvedAt=tV.now(),!function(e,t,r,n){let i=e[0];if(null===i)return!1;if("display"===t||"visibility"===t)return!0;let a=e[e.length-1],s=ie(i,t),l=ie(a,t);return e7(s===l,`You are trying to animate ${t} from "${i}" to "${a}". "${s?a:i}" is not an animatable value.`,"value-not-animatable"),!!s&&!!l&&(function(e){let t=e[0];if(1===e.length)return!0;for(let r=0;r<e.length;r++)if(e[r]!==t)return!0}(e)||("spring"===r||n6(r))&&n)}(e,i,a,s)&&((tw.instantAnimations||!l)&&c?.(nQ(e,r,t)),e[0]=e[e.length-1],it(r),r.repeat=0);let d={startTime:n?this.resolvedAt&&this.resolvedAt-this.createdAt>40?this.resolvedAt:this.createdAt:void 0,finalKeyframe:t,...r,keyframes:e},u=!o&&function(e){let{motionValue:t,name:r,repeatDelay:n,repeatType:i,damping:a,type:s}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;let{onUpdate:l,transformTemplate:o}=t.owner.getProps();return ii()&&r&&ir.has(r)&&("transform"!==r||!o)&&!l&&!n&&"mirror"!==i&&0!==a&&"inertia"!==s}(d),h=d.motionValue?.owner?.current,p=u?new n9({...d,element:h}):new nJ(d);p.finished.then(()=>{this.notifyFinished()}).catch(tj),this.pendingTimeline&&(this.stopTimeline=p.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=p}get finished(){return this._animation?this.animation.finished:this._finished}then(e,t){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),tT=!0,tD(),t_(),tT=!1),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}let is={type:"spring",stiffness:500,damping:25,restSpeed:10},il={type:"keyframes",duration:.8},io={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},ic=e=>null!==e,id=(e,t,r,n={},i,a)=>s=>{let l=r4(n,e)||{},o=l.delay||n.delay||0,{elapsed:c=0}=n;c-=r8(o);let d={keyframes:Array.isArray(r)?r:[null,r],ease:"easeOut",velocity:t.getVelocity(),...l,delay:-c,onUpdate:e=>{t.set(e),l.onUpdate&&l.onUpdate(e)},onComplete:()=>{s(),l.onComplete&&l.onComplete()},name:e,motionValue:t,element:a?void 0:i};!function({when:e,delay:t,delayChildren:r,staggerChildren:n,staggerDirection:i,repeat:a,repeatType:s,repeatDelay:l,from:o,elapsed:c,...d}){return!!Object.keys(d).length}(l)&&Object.assign(d,((e,{keyframes:t})=>t.length>2?il:em.has(e)?e.startsWith("scale")?{type:"spring",stiffness:550,damping:0===t[1]?2*Math.sqrt(550):30,restSpeed:10}:is:io)(e,d)),d.duration&&(d.duration=r8(d.duration)),d.repeatDelay&&(d.repeatDelay=r8(d.repeatDelay)),void 0!==d.from&&(d.keyframes[0]=d.from);let u=!1;if(!1!==d.type&&(0!==d.duration||d.repeatDelay)||(it(d),0===d.delay&&(u=!0)),(tw.instantAnimations||tw.skipAnimations)&&(u=!0,it(d),d.delay=0),d.allowFlatten=!l.type&&!l.ease,u&&!a&&void 0!==t.get()){let e=function(e,{repeat:t,repeatType:r="loop"},n){let i=e.filter(ic),a=t&&"loop"!==r&&t%2==1?0:i.length-1;return i[a]}(d.keyframes,l);if(void 0!==e)return void tS.update(()=>{d.onUpdate(e),d.onComplete()})}return l.isSync?new nJ(d):new ia(d)};function iu(e,t,{delay:r=0,transitionOverride:n,type:i}={}){let{transition:a=e.getDefaultTransition(),transitionEnd:s,...l}=t;n&&(a=n);let o=[],c=i&&e.animationState&&e.animationState.getState()[i];for(let t in l){let n=e.getValue(t,e.latestValues[t]??null),i=l[t];if(void 0===i||c&&function({protectedKeys:e,needsAnimating:t},r){let n=e.hasOwnProperty(r)&&!0!==t[r];return t[r]=!1,n}(c,t))continue;let s={delay:r,...r4(a||{},t)},d=n.get();if(void 0!==d&&!n.isAnimating&&!Array.isArray(i)&&i===d&&!s.velocity)continue;let u=!1;if(window.MotionHandoffAnimation){let r=e.props[rZ];if(r){let e=window.MotionHandoffAnimation(r,t,tS);null!==e&&(s.startTime=e,u=!0)}}r6(e,t),n.start(id(t,n,i,e.shouldReduceMotion&&e4.has(t)?{type:!1}:s,e,u));let h=n.animation;h&&o.push(h)}return s&&Promise.all(o).then(()=>{tS.update(()=>{s&&function(e,t){let{transitionEnd:r={},transition:n={},...i}=r5(e,t)||{};for(let t in i={...i,...r}){var a;let r=r3(a=i[t])?a[a.length-1]||0:a;e.hasValue(t)?e.getValue(t).set(r):e.addValue(t,tW(r))}}(e,s)})}),o}function ih(e,t,r,n=0,i=1){let a=Array.from(e).sort((e,t)=>e.sortNodePosition(t)).indexOf(t),s=e.size,l=(s-1)*n;return"function"==typeof r?r(a,s):1===i?a*n:l-a*n}function ip(e,t,r={}){let n=r5(e,t,"exit"===r.type?e.presenceContext?.custom:void 0),{transition:i=e.getDefaultTransition()||{}}=n||{};r.transitionOverride&&(i=r.transitionOverride);let a=n?()=>Promise.all(iu(e,n,r)):()=>Promise.resolve(),s=e.variantChildren&&e.variantChildren.size?(n=0)=>{let{delayChildren:a=0,staggerChildren:s,staggerDirection:l}=i;return function(e,t,r=0,n=0,i=0,a=1,s){let l=[];for(let o of e.variantChildren)o.notify("AnimationStart",t),l.push(ip(o,t,{...s,delay:r+("function"==typeof n?0:n)+ih(e.variantChildren,o,n,i,a)}).then(()=>o.notify("AnimationComplete",t)));return Promise.all(l)}(e,t,n,a,s,l,r)}:()=>Promise.resolve(),{when:l}=i;if(!l)return Promise.all([a(),s(r.delay)]);{let[e,t]="beforeChildren"===l?[a,s]:[s,a];return e().then(()=>t())}}let im=t1.length;function ix(e,t){if(!Array.isArray(t))return!1;let r=t.length;if(r!==e.length)return!1;for(let n=0;n<r;n++)if(t[n]!==e[n])return!1;return!0}let iy=[...t0].reverse(),ig=t0.length;function iv(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function ib(){return{animate:iv(!0),whileInView:iv(),whileHover:iv(),whileTap:iv(),whileDrag:iv(),whileFocus:iv(),exit:iv()}}let ij=0;function iw(e){return[e("x"),e("y")]}let iN=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function ik(e){return iN.has(e.tagName)||!0===e.isContentEditable}function iS(e,t,r,n={passive:!0}){return e.addEventListener(t,r,n),()=>e.removeEventListener(t,r)}let iO={x:!1,y:!1};function iP(e){return e.max-e.min}function iC(e,t,r,n=.5){e.origin=n,e.originPoint=rm(t.min,t.max,e.origin),e.scale=iP(r)/iP(t),e.translate=rm(r.min,r.max,e.origin)-e.originPoint,(e.scale>=.9999&&e.scale<=1.0001||isNaN(e.scale))&&(e.scale=1),(e.translate>=-.01&&e.translate<=.01||isNaN(e.translate))&&(e.translate=0)}function iA(e,t,r,n){iC(e.x,t.x,r.x,n?n.originX:void 0),iC(e.y,t.y,r.y,n?n.originY:void 0)}function iE(e,t,r){e.min=r.min+t.min,e.max=e.min+iP(t)}function iM(e,t,r){e.min=t.min-r.min,e.max=e.min+iP(t)}function iT(e,t,r){iM(e.x,t.x,r.x),iM(e.y,t.y,r.y)}let i_=e=>"mouse"===e.pointerType?"number"!=typeof e.button||e.button<=0:!1!==e.isPrimary;function iD(e){return{point:{x:e.pageX,y:e.pageY}}}function iI(e,t,r,n){return iS(e,t,e=>i_(e)&&r(e,iD(e)),n)}let iz=({current:e})=>e?e.ownerDocument.defaultView:null,iL=(e,t)=>Math.abs(e-t),iR=new Set(["auto","scroll"]);class iF{constructor(e,t,{transformPagePoint:r,contextWindow:n=window,dragSnapToOrigin:i=!1,distanceThreshold:a=3,element:s}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=e=>{this.handleScroll(e.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{var e,t;if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let r=iU(this.lastMoveEventInfo,this.history),n=null!==this.startEvent,i=(e=r.offset,t={x:0,y:0},Math.sqrt(iL(e.x,t.x)**2+iL(e.y,t.y)**2)>=this.distanceThreshold);if(!n&&!i)return;let{point:a}=r,{timestamp:s}=tP;this.history.push({...a,timestamp:s});let{onStart:l,onMove:o}=this.handlers;n||(l&&l(this.lastMoveEvent,r),this.startEvent=this.lastMoveEvent),o&&o(this.lastMoveEvent,r)},this.handlePointerMove=(e,t)=>{this.lastMoveEvent=e,this.lastMoveEventInfo=i$(t,this.transformPagePoint),tS.update(this.updatePoint,!0)},this.handlePointerUp=(e,t)=>{this.end();let{onEnd:r,onSessionEnd:n,resumeAnimation:i}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&i&&i(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let a=iU("pointercancel"===e.type?this.lastMoveEventInfo:i$(t,this.transformPagePoint),this.history);this.startEvent&&r&&r(e,a),n&&n(e,a)},!i_(e))return;this.dragSnapToOrigin=i,this.handlers=t,this.transformPagePoint=r,this.distanceThreshold=a,this.contextWindow=n||window;const l=i$(iD(e),this.transformPagePoint),{point:o}=l,{timestamp:c}=tP;this.history=[{...o,timestamp:c}];const{onSessionStart:d}=t;d&&d(e,iU(l,this.history)),this.removeListeners=r9(iI(this.contextWindow,"pointermove",this.handlePointerMove),iI(this.contextWindow,"pointerup",this.handlePointerUp),iI(this.contextWindow,"pointercancel",this.handlePointerUp)),s&&this.startScrollTracking(s)}startScrollTracking(e){let t=e.parentElement;for(;t;){let e=getComputedStyle(t);(iR.has(e.overflowX)||iR.has(e.overflowY))&&this.scrollPositions.set(t,{x:t.scrollLeft,y:t.scrollTop}),t=t.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(e){let t=this.scrollPositions.get(e);if(!t)return;let r=e===window,n=r?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},i={x:n.x-t.x,y:n.y-t.y};(0!==i.x||0!==i.y)&&(r?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=i.x,this.lastMoveEventInfo.point.y+=i.y):this.history.length>0&&(this.history[0].x-=i.x,this.history[0].y-=i.y),this.scrollPositions.set(e,n),tS.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),tO(this.updatePoint)}}function i$(e,t){return t?{point:t(e.point)}:e}function iB(e,t){return{x:e.x-t.x,y:e.y-t.y}}function iU({point:e},t){return{point:e,delta:iB(e,iq(t)),offset:iB(e,t[0]),velocity:function(e,t){if(e.length<2)return{x:0,y:0};let r=e.length-1,n=null,i=iq(e);for(;r>=0&&(n=e[r],!(i.timestamp-n.timestamp>r8(.1)));)r--;if(!n)return{x:0,y:0};let a=(i.timestamp-n.timestamp)/1e3;if(0===a)return{x:0,y:0};let s={x:(i.x-n.x)/a,y:(i.y-n.y)/a};return s.x===1/0&&(s.x=0),s.y===1/0&&(s.y=0),s}(t,.1)}}function iq(e){return e[e.length-1]}function iV(e,t,r){return{min:void 0!==t?e.min+t:void 0,max:void 0!==r?e.max+r-(e.max-e.min):void 0}}function iK(e,t){let r=t.min-e.min,n=t.max-e.max;return t.max-t.min<e.max-e.min&&([r,n]=[n,r]),{min:r,max:n}}function iW(e,t,r){return{min:iH(e,t),max:iH(e,r)}}function iH(e,t){return"number"==typeof e?e:e[t]||0}let iQ=new WeakMap;class iY{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=e2(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:t=!1,distanceThreshold:r}={}){let{presenceContext:n}=this.visualElement;if(n&&!1===n.isPresent)return;let i=e=>{t?(this.stopAnimation(),this.snapToCursor(iD(e).point)):this.pauseAnimation()},a=(e,t)=>{this.stopAnimation();let{drag:r,dragPropagation:n,onDragStart:i}=this.getProps();if(r&&!n&&(this.openDragLock&&this.openDragLock(),this.openDragLock=function(e){if("x"===e||"y"===e)if(iO[e])return null;else return iO[e]=!0,()=>{iO[e]=!1};return iO.x||iO.y?null:(iO.x=iO.y=!0,()=>{iO.x=iO.y=!1})}(r),!this.openDragLock))return;this.latestPointerEvent=e,this.latestPanInfo=t,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),iw(e=>{let t=this.getAxisMotionValue(e).get()||0;if(eA.test(t)){let{projection:r}=this.visualElement;if(r&&r.layout){let n=r.layout.layoutBox[e];n&&(t=iP(n)*(parseFloat(t)/100))}}this.originPoint[e]=t}),i&&tS.postRender(()=>i(e,t)),r6(this.visualElement,"transform");let{animationState:a}=this.visualElement;a&&a.setActive("whileDrag",!0)},s=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t;let{dragPropagation:r,dragDirectionLock:n,onDirectionLock:i,onDrag:a}=this.getProps();if(!r&&!this.openDragLock)return;let{offset:s}=t;if(n&&null===this.currentDirection){this.currentDirection=function(e,t=10){let r=null;return Math.abs(e.y)>t?r="y":Math.abs(e.x)>t&&(r="x"),r}(s),null!==this.currentDirection&&i&&i(this.currentDirection);return}this.updateAxis("x",t.point,s),this.updateAxis("y",t.point,s),this.visualElement.render(),a&&a(e,t)},l=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t,this.stop(e,t),this.latestPointerEvent=null,this.latestPanInfo=null},o=()=>iw(e=>"paused"===this.getAnimationState(e)&&this.getAxisMotionValue(e).animation?.play()),{dragSnapToOrigin:c}=this.getProps();this.panSession=new iF(e,{onSessionStart:i,onStart:a,onMove:s,onSessionEnd:l,resumeAnimation:o},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:c,distanceThreshold:r,contextWindow:iz(this.visualElement),element:this.visualElement.current})}stop(e,t){let r=e||this.latestPointerEvent,n=t||this.latestPanInfo,i=this.isDragging;if(this.cancel(),!i||!n||!r)return;let{velocity:a}=n;this.startAnimation(a);let{onDragEnd:s}=this.getProps();s&&tS.postRender(()=>s(r,n))}cancel(){this.isDragging=!1;let{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();let{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),t&&t.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,t,r){let{drag:n}=this.getProps();if(!r||!iX(e,n,this.currentDirection))return;let i=this.getAxisMotionValue(e),a=this.originPoint[e]+r[e];this.constraints&&this.constraints[e]&&(a=function(e,{min:t,max:r},n){return void 0!==t&&e<t?e=n?rm(t,e,n.min):Math.max(e,t):void 0!==r&&e>r&&(e=n?rm(r,e,n.max):Math.min(e,r)),e}(a,this.constraints[e],this.elastic[e])),i.set(a)}resolveConstraints(){let{dragConstraints:e,dragElastic:t}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,n=this.constraints;e&&r0(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&r?this.constraints=function(e,{top:t,left:r,bottom:n,right:i}){return{x:iV(e.x,r,i),y:iV(e.y,t,n)}}(r.layoutBox,e):this.constraints=!1,this.elastic=function(e=.35){return!1===e?e=0:!0===e&&(e=.35),{x:iW(e,"left","right"),y:iW(e,"top","bottom")}}(t),n!==this.constraints&&r&&this.constraints&&!this.hasMutatedConstraints&&iw(e=>{var t,n;let i;!1!==this.constraints&&this.getAxisMotionValue(e)&&(this.constraints[e]=(t=r.layoutBox[e],n=this.constraints[e],i={},void 0!==n.min&&(i.min=n.min-t.min),void 0!==n.max&&(i.max=n.max-t.min),i))})}resolveRefConstraints(){var e;let{dragConstraints:t,onMeasureDragConstraints:r}=this.getProps();if(!t||!r0(t))return!1;let n=t.current;e9(null!==n,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.","drag-constraints-ref");let{projection:i}=this.visualElement;if(!i||!i.layout)return!1;let a=function(e,t,r){let n=rM(e,r),{scroll:i}=t;return i&&(rC(n.x,i.offset.x),rC(n.y,i.offset.y)),n}(n,i.root,this.visualElement.getTransformPagePoint()),s=(e=i.layout.layoutBox,{x:iK(e.x,a.x),y:iK(e.y,a.y)});if(r){let e=r(function({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}(s));this.hasMutatedConstraints=!!e,e&&(s=rb(e))}return s}startAnimation(e){let{drag:t,dragMomentum:r,dragElastic:n,dragTransition:i,dragSnapToOrigin:a,onDragTransitionEnd:s}=this.getProps(),l=this.constraints||{};return Promise.all(iw(s=>{if(!iX(s,t,this.currentDirection))return;let o=l&&l[s]||{};a&&(o={min:0,max:0});let c={type:"inertia",velocity:r?e[s]:0,bounceStiffness:n?200:1e6,bounceDamping:n?40:1e7,timeConstant:750,restDelta:1,restSpeed:10,...i,...o};return this.startAxisValueAnimation(s,c)})).then(s)}startAxisValueAnimation(e,t){let r=this.getAxisMotionValue(e);return r6(this.visualElement,e),r.start(id(e,r,0,t,this.visualElement,!1))}stopAnimation(){iw(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){iw(e=>this.getAxisMotionValue(e).animation?.pause())}getAnimationState(e){return this.getAxisMotionValue(e).animation?.state}getAxisMotionValue(e){let t=`_drag${e.toUpperCase()}`,r=this.visualElement.getProps();return r[t]||this.visualElement.getValue(e,(r.initial?r.initial[e]:void 0)||0)}snapToCursor(e){iw(t=>{let{drag:r}=this.getProps();if(!iX(t,r,this.currentDirection))return;let{projection:n}=this.visualElement,i=this.getAxisMotionValue(t);if(n&&n.layout){let{min:r,max:a}=n.layout.layoutBox[t],s=i.get()||0;i.set(e[t]-rm(r,a,.5)+s)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;let{drag:e,dragConstraints:t}=this.getProps(),{projection:r}=this.visualElement;if(!r0(t)||!r||!this.constraints)return;this.stopAnimation();let n={x:0,y:0};iw(e=>{let t=this.getAxisMotionValue(e);if(t&&!1!==this.constraints){var r,i;let a,s,l,o=t.get();n[e]=(r={min:o,max:o},i=this.constraints[e],a=.5,s=iP(r),(l=iP(i))>s?a=nK(i.min,i.max-s,r.min):s>l&&(a=nK(r.min,r.max-l,i.min)),ef(0,1,a))}});let{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),iw(t=>{if(!iX(t,e,null))return;let r=this.getAxisMotionValue(t),{min:i,max:a}=this.constraints[t];r.set(rm(i,a,n[t]))})}addListeners(){if(!this.visualElement.current)return;iQ.set(this.visualElement,this);let e=this.visualElement.current,t=iI(e,"pointerdown",t=>{let{drag:r,dragListener:n=!0}=this.getProps(),i=t.target,a=i!==e&&ik(i);r&&n&&!a&&this.start(t)}),r=()=>{let{dragConstraints:e}=this.getProps();r0(e)&&e.current&&(this.constraints=this.resolveRefConstraints())},{projection:n}=this.visualElement,i=n.addEventListener("measure",r);n&&!n.layout&&(n.root&&n.root.updateScroll(),n.updateLayout()),tS.read(r);let a=iS(window,"resize",()=>this.scalePositionWithinConstraints()),s=n.addEventListener("didUpdate",({delta:e,hasLayoutChanged:t})=>{this.isDragging&&t&&(iw(t=>{let r=this.getAxisMotionValue(t);r&&(this.originPoint[t]+=e[t].translate,r.set(r.get()+e[t].translate))}),this.visualElement.render())});return()=>{a(),t(),i(),s&&s()}}getProps(){let e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:r=!1,dragPropagation:n=!1,dragConstraints:i=!1,dragElastic:a=.35,dragMomentum:s=!0}=e;return{...e,drag:t,dragDirectionLock:r,dragPropagation:n,dragConstraints:i,dragElastic:a,dragMomentum:s}}}function iX(e,t,r){return(!0===t||t===e)&&(null===r||r===e)}let iG=e=>(t,r)=>{e&&tS.postRender(()=>e(t,r))},iZ={hasAnimatedSinceResize:!0,hasEverUpdated:!1};var iJ=H;let i0=!1;class i1 extends iJ.Component{componentDidMount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:r,layoutId:n}=this.props,{projection:i}=e;i&&(t.group&&t.group.add(i),r&&r.register&&n&&r.register(i),i0&&i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),iZ.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){let{layoutDependency:t,visualElement:r,drag:n,isPresent:i}=this.props,{projection:a}=r;return a&&(a.isPresent=i,e.layoutDependency!==t&&a.setOptions({...a.options,layoutDependency:t}),i0=!0,n||e.layoutDependency!==t||void 0===t||e.isPresent!==i?a.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?a.promote():a.relegate()||tS.postRender(()=>{let e=a.getStack();e&&e.members.length||this.safeToRemove()}))),null}componentDidUpdate(){let{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),tU.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:r}=this.props,{projection:n}=e;i0=!0,n&&(n.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(n),r&&r.deregister&&r.deregister(n))}safeToRemove(){let{safeToRemove:e}=this.props;e&&e()}render(){return null}}function i2(e){let[t,r]=ec(),n=(0,iJ.useContext)(Y);return(0,W.jsx)(i1,{...e,layoutGroup:n,switchLayoutGroup:(0,iJ.useContext)(rJ),isPresent:t,safeToRemove:r})}function i5(e,t,r,n,i){return e-=t,e=n+1/r*(e-n),void 0!==i&&(e=n+1/i*(e-n)),e}function i4(e,t,[r,n,i],a,s){!function(e,t=0,r=1,n=.5,i,a=e,s=e){if(eA.test(t)&&(t=parseFloat(t),t=rm(s.min,s.max,t/100)-s.min),"number"!=typeof t)return;let l=rm(a.min,a.max,n);e===a&&(l-=t),e.min=i5(e.min,t,r,l,i),e.max=i5(e.max,t,r,l,i)}(e,t[r],t[n],t[i],t.scale,a,s)}let i3=["x","scaleX","originX"],i6=["y","scaleY","originY"];function i8(e,t,r,n){i4(e.x,t,i3,r?r.x:void 0,n?n.x:void 0),i4(e.y,t,i6,r?r.y:void 0,n?n.y:void 0)}function i7(e,t){e.min=t.min,e.max=t.max}function i9(e,t){i7(e.x,t.x),i7(e.y,t.y)}function ae(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function at(e){return 0===e.translate&&1===e.scale}function ar(e){return at(e.x)&&at(e.y)}function an(e,t){return e.min===t.min&&e.max===t.max}function ai(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function aa(e,t){return ai(e.x,t.x)&&ai(e.y,t.y)}function as(e){return iP(e.x)/iP(e.y)}function al(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}let ao=["TopLeft","TopRight","BottomLeft","BottomRight"],ac=ao.length,ad=e=>"string"==typeof e?parseFloat(e):e,au=e=>"number"==typeof e||eE.test(e);function ah(e,t){return void 0!==e[t]?e[t]:e.borderRadius}let ap=af(0,.5,n$),am=af(.5,.95,tj);function af(e,t,r){return n=>n<e?0:n>t?1:r(nK(e,t,n))}function ax(e){return ee(e)&&"ownerSVGElement"in e}let ay=(e,t)=>e.depth-t.depth;class ag{constructor(){this.children=[],this.isDirty=!1}add(e){tF(this.children,e),this.isDirty=!0}remove(e){t$(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(ay),this.isDirty=!1,this.children.forEach(e)}}class av{constructor(){this.members=[]}add(e){tF(this.members,e),e.scheduleRender()}remove(e){if(t$(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){let e=this.members[this.members.length-1];e&&this.promote(e)}}relegate(e){let t,r=this.members.findIndex(t=>e===t);if(0===r)return!1;for(let e=r;e>=0;e--){let r=this.members[e];if(!1!==r.isPresent){t=r;break}}return!!t&&(this.promote(t),!0)}promote(e,t){let r=this.lead;if(e!==r&&(this.prevLead=r,this.lead=e,e.show(),r)){r.instance&&r.scheduleRender(),e.scheduleRender();let n=r.options.layoutDependency,i=e.options.layoutDependency;(void 0===n||void 0===i||n!==i)&&(e.resumeFrom=r,t&&(e.resumeFrom.preserveOpacity=!0),r.snapshot&&(e.snapshot=r.snapshot,e.snapshot.latestValues=r.animationValues||r.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0));let{crossfade:a}=e.options;!1===a&&r.hide()}}exitAnimationComplete(){this.members.forEach(e=>{let{options:t,resumingFrom:r}=e;t.onExitComplete&&t.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}let ab=["","X","Y","Z"],aj=0;function aw(e,t,r,n){let{latestValues:i}=t;i[e]&&(r[e]=i[e],t.setStaticValue(e,0),n&&(n[e]=0))}function aN({attachResizeListener:e,defaultParent:t,measureScroll:r,checkIsScrollRoot:n,resetTransform:i}){return class{constructor(e={},r=t?.()){this.id=aj++,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(aO),this.nodes.forEach(a_),this.nodes.forEach(aD),this.nodes.forEach(aP)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=e,this.root=r?r.root||r:this,this.path=r?[...r.path,r]:[],this.parent=r,this.depth=r?r.depth+1:0;for(let e=0;e<this.path.length;e++)this.path[e].shouldResetTransform=!0;this.root===this&&(this.nodes=new ag)}addEventListener(e,t){return this.eventHandlers.has(e)||this.eventHandlers.set(e,new tB),this.eventHandlers.get(e).add(t)}notifyListeners(e,...t){let r=this.eventHandlers.get(e);r&&r.notify(...t)}hasListeners(e){return this.eventHandlers.has(e)}mount(t){if(this.instance)return;this.isSVG=ax(t)&&!(ax(t)&&"svg"===t.tagName),this.instance=t;let{layoutId:r,layout:n,visualElement:i}=this.options;if(i&&!i.current&&i.mount(t),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(n||r)&&(this.isLayoutDirty=!0),e){let r,n=0,i=()=>this.root.updateBlockedByResize=!1;tS.read(()=>{n=window.innerWidth}),e(t,()=>{let e=window.innerWidth;if(e!==n){let t,a;n=e,this.root.updateBlockedByResize=!0,r&&r(),t=tV.now(),a=({timestamp:e})=>{let r=e-t;r>=250&&(tO(a),i(r-250))},tS.setup(a,!0),r=()=>tO(a),iZ.hasAnimatedSinceResize&&(iZ.hasAnimatedSinceResize=!1,this.nodes.forEach(aT))}})}r&&this.root.registerSharedNode(r,this),!1!==this.options.animate&&i&&(r||n)&&this.addEventListener("didUpdate",({delta:e,hasLayoutChanged:t,hasRelativeLayoutChanged:r,layout:n})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}let a=this.options.transition||i.getDefaultTransition()||a$,{onLayoutAnimationStart:s,onLayoutAnimationComplete:l}=i.getProps(),o=!this.targetLayout||!aa(this.targetLayout,n),c=!t&&r;if(this.options.layoutRoot||this.resumeFrom||c||t&&(o||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);let t={...r4(a,"layout"),onPlay:s,onComplete:l};(i.shouldReduceMotion||this.options.layoutRoot)&&(t.delay=0,t.type=!1),this.startAnimation(t),this.setAnimationOrigin(e,c)}else t||aT(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=n})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);let e=this.getStack();e&&e.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),tO(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(aI),this.animationId++)}getTransformTemplate(){let{visualElement:e}=this.options;return e&&e.getProps().transformTemplate}willUpdate(e=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&function e(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;let{visualElement:r}=t.options;if(!r)return;let n=r.props[rZ];if(window.MotionHasOptimisedAnimation(n,"transform")){let{layout:e,layoutId:r}=t.options;window.MotionCancelOptimisedAnimation(n,"transform",tS,!(e||r))}let{parent:i}=t;i&&!i.hasCheckedOptimisedAppear&&e(i)}(this),this.root.isUpdating||this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let e=0;e<this.path.length;e++){let t=this.path[e];t.shouldResetTransform=!0,t.updateScroll("snapshot"),t.options.layoutRoot&&t.willUpdate(!1)}let{layoutId:t,layout:r}=this.options;if(void 0===t&&!r)return;let n=this.getTransformTemplate();this.prevTransformTemplateValue=n?n(this.latestValues,""):void 0,this.updateSnapshot(),e&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(aA);return}if(this.animationId<=this.animationCommitId)return void this.nodes.forEach(aE);this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(aM),this.nodes.forEach(ak),this.nodes.forEach(aS)):this.nodes.forEach(aE),this.clearAllSnapshots();let e=tV.now();tP.delta=ef(0,1e3/60,e-tP.timestamp),tP.timestamp=e,tP.isProcessing=!0,tC.update.process(tP),tC.preRender.process(tP),tC.render.process(tP),tP.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,tU.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(aC),this.sharedNodes.forEach(az)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,tS.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){tS.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){!this.snapshot&&this.instance&&(this.snapshot=this.measure(),!this.snapshot||iP(this.snapshot.measuredBox.x)||iP(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 e=0;e<this.path.length;e++)this.path[e].updateScroll();let e=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected=e2(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);let{visualElement:t}=this.options;t&&t.notify("LayoutMeasure",this.layout.layoutBox,e?e.layoutBox:void 0)}updateScroll(e="measure"){let t=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===e&&(t=!1),t&&this.instance){let t=n(this.instance);this.scroll={animationId:this.root.animationId,phase:e,isRoot:t,offset:r(this.instance),wasRoot:this.scroll?this.scroll.isRoot:t}}}resetTransform(){if(!i)return;let e=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,t=this.projectionDelta&&!ar(this.projectionDelta),r=this.getTransformTemplate(),n=r?r(this.latestValues,""):void 0,a=n!==this.prevTransformTemplateValue;e&&this.instance&&(t||rN(this.latestValues)||a)&&(i(this.instance,n),this.shouldResetTransform=!1,this.scheduleRender())}measure(e=!0){var t;let r=this.measurePageBox(),n=this.removeElementScroll(r);return e&&(n=this.removeTransform(n)),aq((t=n).x),aq(t.y),{animationId:this.root.animationId,measuredBox:r,layoutBox:n,latestValues:{},source:this.id}}measurePageBox(){let{visualElement:e}=this.options;if(!e)return e2();let t=e.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(aK))){let{scroll:e}=this.root;e&&(rC(t.x,e.offset.x),rC(t.y,e.offset.y))}return t}removeElementScroll(e){let t=e2();if(i9(t,e),this.scroll?.wasRoot)return t;for(let r=0;r<this.path.length;r++){let n=this.path[r],{scroll:i,options:a}=n;n!==this.root&&i&&a.layoutScroll&&(i.wasRoot&&i9(t,e),rC(t.x,i.offset.x),rC(t.y,i.offset.y))}return t}applyTransform(e,t=!1){let r=e2();i9(r,e);for(let e=0;e<this.path.length;e++){let n=this.path[e];!t&&n.options.layoutScroll&&n.scroll&&n!==n.root&&rE(r,{x:-n.scroll.offset.x,y:-n.scroll.offset.y}),rN(n.latestValues)&&rE(r,n.latestValues)}return rN(this.latestValues)&&rE(r,this.latestValues),r}removeTransform(e){let t=e2();i9(t,e);for(let e=0;e<this.path.length;e++){let r=this.path[e];if(!r.instance||!rN(r.latestValues))continue;rw(r.latestValues)&&r.updateSnapshot();let n=e2();i9(n,r.measurePageBox()),i8(t,r.latestValues,r.snapshot?r.snapshot.layoutBox:void 0,n)}return rN(this.latestValues)&&i8(t,this.latestValues),t}setTargetDelta(e){this.targetDelta=e,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(e){this.options={...this.options,...e,crossfade:void 0===e.crossfade||e.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!==tP.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(e=!1){let t=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=t.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=t.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=t.isSharedProjectionDirty);let r=!!this.resumingFrom||this!==t;if(!(e||r&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;let{layout:n,layoutId:i}=this.options;if(!this.layout||!(n||i))return;this.resolvedRelativeTargetAt=tP.timestamp;let a=this.getClosestProjectingParent();if(a&&this.linkedParentVersion!==a.layoutVersion&&!a.options.layoutRoot&&this.removeRelativeTarget(),this.targetDelta||this.relativeTarget||(a&&a.layout?this.createRelativeTarget(a,this.layout.layoutBox,a.layout.layoutBox):this.removeRelativeTarget()),this.relativeTarget||this.targetDelta){if(this.target||(this.target=e2(),this.targetWithTransforms=e2()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target){var s,l,o;this.forceRelativeParentToResolveTarget(),s=this.target,l=this.relativeTarget,o=this.relativeParent.target,iE(s.x,l.x,o.x),iE(s.y,l.y,o.y)}else this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):i9(this.target,this.layout.layoutBox),rP(this.target,this.targetDelta)):i9(this.target,this.layout.layoutBox);this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,a&&!!a.resumingFrom==!!this.resumingFrom&&!a.options.layoutScroll&&a.target&&1!==this.animationProgress?this.createRelativeTarget(a,this.target,a.target):this.relativeParent=this.relativeTarget=void 0)}}getClosestProjectingParent(){if(!(!this.parent||rw(this.parent.latestValues)||rk(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(e,t,r){this.relativeParent=e,this.linkedParentVersion=e.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=e2(),this.relativeTargetOrigin=e2(),iT(this.relativeTargetOrigin,t,r),i9(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){let e=this.getLead(),t=!!this.resumingFrom||this!==e,r=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(r=!1),t&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(r=!1),this.resolvedRelativeTargetAt===tP.timestamp&&(r=!1),r)return;let{layout:n,layoutId:i}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(n||i))return;i9(this.layoutCorrected,this.layout.layoutBox);let a=this.treeScale.x,s=this.treeScale.y;!function(e,t,r,n=!1){let i,a,s=r.length;if(s){t.x=t.y=1;for(let l=0;l<s;l++){a=(i=r[l]).projectionDelta;let{visualElement:s}=i.options;(!s||!s.props.style||"contents"!==s.props.style.display)&&(n&&i.options.layoutScroll&&i.scroll&&i!==i.root&&rE(e,{x:-i.scroll.offset.x,y:-i.scroll.offset.y}),a&&(t.x*=a.x.scale,t.y*=a.y.scale,rP(e,a)),n&&rN(i.latestValues)&&rE(e,i.latestValues))}t.x<1.0000000000001&&t.x>.999999999999&&(t.x=1),t.y<1.0000000000001&&t.y>.999999999999&&(t.y=1)}}(this.layoutCorrected,this.treeScale,this.path,t),e.layout&&!e.target&&(1!==this.treeScale.x||1!==this.treeScale.y)&&(e.target=e.layout.layoutBox,e.targetWithTransforms=e2());let{target:l}=e;if(!l){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}this.projectionDelta&&this.prevProjectionDelta?(ae(this.prevProjectionDelta.x,this.projectionDelta.x),ae(this.prevProjectionDelta.y,this.projectionDelta.y)):this.createProjectionDeltas(),iA(this.projectionDelta,this.layoutCorrected,l,this.latestValues),this.treeScale.x===a&&this.treeScale.y===s&&al(this.projectionDelta.x,this.prevProjectionDelta.x)&&al(this.projectionDelta.y,this.prevProjectionDelta.y)||(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",l))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(e=!0){if(this.options.visualElement?.scheduleRender(),e){let e=this.getStack();e&&e.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=e0(),this.projectionDelta=e0(),this.projectionDeltaWithTransform=e0()}setAnimationOrigin(e,t=!1){let r,n=this.snapshot,i=n?n.latestValues:{},a={...this.latestValues},s=e0();this.relativeParent&&this.relativeParent.options.layoutRoot||(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!t;let l=e2(),o=(n?n.source:void 0)!==(this.layout?this.layout.source:void 0),c=this.getStack(),d=!c||c.members.length<=1,u=!!(o&&!d&&!0===this.options.crossfade&&!this.path.some(aF));this.animationProgress=0,this.mixTargetDelta=t=>{let n=t/1e3;if(aL(s.x,e.x,n),aL(s.y,e.y,n),this.setTargetDelta(s),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout){var c,h,p,m,f,x;iT(l,this.layout.layoutBox,this.relativeParent.layout.layoutBox),p=this.relativeTarget,m=this.relativeTargetOrigin,f=l,x=n,aR(p.x,m.x,f.x,x),aR(p.y,m.y,f.y,x),r&&(c=this.relativeTarget,h=r,an(c.x,h.x)&&an(c.y,h.y))&&(this.isProjectionDirty=!1),r||(r=e2()),i9(r,this.relativeTarget)}o&&(this.animationValues=a,function(e,t,r,n,i,a){i?(e.opacity=rm(0,r.opacity??1,ap(n)),e.opacityExit=rm(t.opacity??1,0,am(n))):a&&(e.opacity=rm(t.opacity??1,r.opacity??1,n));for(let i=0;i<ac;i++){let a=`border${ao[i]}Radius`,s=ah(t,a),l=ah(r,a);(void 0!==s||void 0!==l)&&(s||(s=0),l||(l=0),0===s||0===l||au(s)===au(l)?(e[a]=Math.max(rm(ad(s),ad(l),n),0),(eA.test(l)||eA.test(s))&&(e[a]+="%")):e[a]=l)}(t.rotate||r.rotate)&&(e.rotate=rm(t.rotate||0,r.rotate||0,n))}(a,i,this.latestValues,n,u,d)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=n},this.mixTargetDelta(1e3*!!this.options.layoutRoot)}startAnimation(e){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(tO(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=tS.update(()=>{var t,r,n;let i;iZ.hasAnimatedSinceResize=!0,ne.layout++,this.motionValue||(this.motionValue=tW(0)),this.currentAnimation=(t=this.motionValue,r=[0,1e3],n={...e,velocity:0,isSync:!0,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onStop:()=>{ne.layout--},onComplete:()=>{ne.layout--,e.onComplete&&e.onComplete(),this.completeAnimation()}},(i=e5(t)?t:tW(t)).start(id("",i,r,n)),i.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 e=this.getStack();e&&e.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 e=this.getLead(),{targetWithTransforms:t,target:r,layout:n,latestValues:i}=e;if(t&&r&&n){if(this!==e&&this.layout&&n&&aV(this.options.animationType,this.layout.layoutBox,n.layoutBox)){r=this.target||e2();let t=iP(this.layout.layoutBox.x);r.x.min=e.target.x.min,r.x.max=r.x.min+t;let n=iP(this.layout.layoutBox.y);r.y.min=e.target.y.min,r.y.max=r.y.min+n}i9(t,r),rE(t,i),iA(this.projectionDeltaWithTransform,this.layoutCorrected,t,i)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new av),this.sharedNodes.get(e).add(t);let r=t.options.initialPromotionConfig;t.promote({transition:r?r.transition:void 0,preserveFollowOpacity:r&&r.shouldPreserveFollowOpacity?r.shouldPreserveFollowOpacity(t):void 0})}isLead(){let e=this.getStack();return!e||e.lead===this}getLead(){let{layoutId:e}=this.options;return e&&this.getStack()?.lead||this}getPrevLead(){let{layoutId:e}=this.options;return e?this.getStack()?.prevLead:void 0}getStack(){let{layoutId:e}=this.options;if(e)return this.root.sharedNodes.get(e)}promote({needsReset:e,transition:t,preserveFollowOpacity:r}={}){let n=this.getStack();n&&n.promote(this,r),e&&(this.projectionDelta=void 0,this.needsReset=!0),t&&this.setOptions({transition:t})}relegate(){let e=this.getStack();return!!e&&e.relegate(this)}resetSkewAndRotation(){let{visualElement:e}=this.options;if(!e)return;let t=!1,{latestValues:r}=e;if((r.z||r.rotate||r.rotateX||r.rotateY||r.rotateZ||r.skewX||r.skewY)&&(t=!0),!t)return;let n={};r.z&&aw("z",e,n,this.animationValues);for(let t=0;t<ab.length;t++)aw(`rotate${ab[t]}`,e,n,this.animationValues),aw(`skew${ab[t]}`,e,n,this.animationValues);for(let t in e.render(),n)e.setStaticValue(t,n[t]),this.animationValues&&(this.animationValues[t]=n[t]);e.scheduleRender()}applyProjectionStyles(e,t){if(!this.instance||this.isSVG)return;if(!this.isVisible){e.visibility="hidden";return}let r=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,e.visibility="",e.opacity="",e.pointerEvents=rV(t?.pointerEvents)||"",e.transform=r?r(this.latestValues,""):"none";return}let n=this.getLead();if(!this.projectionDelta||!this.layout||!n.target){this.options.layoutId&&(e.opacity=void 0!==this.latestValues.opacity?this.latestValues.opacity:1,e.pointerEvents=rV(t?.pointerEvents)||""),this.hasProjected&&!rN(this.latestValues)&&(e.transform=r?r({},""):"none",this.hasProjected=!1);return}e.visibility="";let i=n.animationValues||n.latestValues;this.applyTransformsToTarget();let a=function(e,t,r){let n="",i=e.x.translate/t.x,a=e.y.translate/t.y,s=r?.z||0;if((i||a||s)&&(n=`translate3d(${i}px, ${a}px, ${s}px) `),(1!==t.x||1!==t.y)&&(n+=`scale(${1/t.x}, ${1/t.y}) `),r){let{transformPerspective:e,rotate:t,rotateX:i,rotateY:a,skewX:s,skewY:l}=r;e&&(n=`perspective(${e}px) ${n}`),t&&(n+=`rotate(${t}deg) `),i&&(n+=`rotateX(${i}deg) `),a&&(n+=`rotateY(${a}deg) `),s&&(n+=`skewX(${s}deg) `),l&&(n+=`skewY(${l}deg) `)}let l=e.x.scale*t.x,o=e.y.scale*t.y;return(1!==l||1!==o)&&(n+=`scale(${l}, ${o})`),n||"none"}(this.projectionDeltaWithTransform,this.treeScale,i);r&&(a=r(i,a)),e.transform=a;let{x:s,y:l}=this.projectionDelta;for(let t in e.transformOrigin=`${100*s.origin}% ${100*l.origin}% 0`,n.animationValues?e.opacity=n===this?i.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:i.opacityExit:e.opacity=n===this?void 0!==i.opacity?i.opacity:"":void 0!==i.opacityExit?i.opacityExit:0,rf){if(void 0===i[t])continue;let{correct:r,applyTo:s,isCSSVariable:l}=rf[t],o="none"===a?i[t]:r(i[t],n);if(s){let t=s.length;for(let r=0;r<t;r++)e[s[r]]=o}else l?this.options.visualElement.renderState.vars[t]=o:e[t]=o}this.options.layoutId&&(e.pointerEvents=n===this?rV(t?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(e=>e.currentAnimation?.stop()),this.root.nodes.forEach(aA),this.root.sharedNodes.clear()}}}function ak(e){e.updateLayout()}function aS(e){let t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){let{layoutBox:r,measuredBox:n}=e.layout,{animationType:i}=e.options,a=t.source!==e.layout.source;"size"===i?iw(e=>{let n=a?t.measuredBox[e]:t.layoutBox[e],i=iP(n);n.min=r[e].min,n.max=n.min+i}):aV(i,t.layoutBox,r)&&iw(n=>{let i=a?t.measuredBox[n]:t.layoutBox[n],s=iP(r[n]);i.max=i.min+s,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[n].max=e.relativeTarget[n].min+s)});let s=e0();iA(s,r,t.layoutBox);let l=e0();a?iA(l,e.applyTransform(n,!0),t.measuredBox):iA(l,r,t.layoutBox);let o=!ar(s),c=!1;if(!e.resumeFrom){let n=e.getClosestProjectingParent();if(n&&!n.resumeFrom){let{snapshot:i,layout:a}=n;if(i&&a){let s=e2();iT(s,t.layoutBox,i.layoutBox);let l=e2();iT(l,r,a.layoutBox),aa(s,l)||(c=!0),n.options.layoutRoot&&(e.relativeTarget=l,e.relativeTargetOrigin=s,e.relativeParent=n)}}}e.notifyListeners("didUpdate",{layout:r,snapshot:t,delta:l,layoutDelta:s,hasLayoutChanged:o,hasRelativeLayoutChanged:c})}else if(e.isLead()){let{onExitComplete:t}=e.options;t&&t()}e.options.transition=void 0}function aO(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function aP(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function aC(e){e.clearSnapshot()}function aA(e){e.clearMeasurements()}function aE(e){e.isLayoutDirty=!1}function aM(e){let{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function aT(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function a_(e){e.resolveTargetDelta()}function aD(e){e.calcProjection()}function aI(e){e.resetSkewAndRotation()}function az(e){e.removeLeadSnapshot()}function aL(e,t,r){e.translate=rm(t.translate,0,r),e.scale=rm(t.scale,1,r),e.origin=t.origin,e.originPoint=t.originPoint}function aR(e,t,r,n){e.min=rm(t.min,r.min,n),e.max=rm(t.max,r.max,n)}function aF(e){return e.animationValues&&void 0!==e.animationValues.opacityExit}let a$={duration:.45,ease:[.4,0,.1,1]},aB=e=>"u">typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),aU=aB("applewebkit/")&&!aB("chrome/")?Math.round:tj;function aq(e){e.min=aU(e.min),e.max=aU(e.max)}function aV(e,t,r){return"position"===e||"preserve-aspect"===e&&!(.2>=Math.abs(as(t)-as(r)))}function aK(e){return e!==e.root&&e.scroll?.wasRoot}let aW=aN({attachResizeListener:(e,t)=>iS(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),aH={current:void 0},aQ=aN({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!aH.current){let e=new aW({});e.mount(window),e.setOptions({layoutScroll:!0}),aH.current=e}return aH.current},resetTransform:(e,t)=>{e.style.transform=void 0!==t?t:"none"},checkIsScrollRoot:e=>"fixed"===window.getComputedStyle(e).position});function aY(e,t){let r=function(e,t,r){if(null==e)return[];if(e instanceof EventTarget)return[e];if("string"==typeof e){let t=document,r=(void 0)??t.querySelectorAll(e);return r?Array.from(r):[]}return Array.from(e).filter(e=>null!=e)}(e),n=new AbortController;return[r,{passive:!0,...t,signal:n.signal},()=>n.abort()]}function aX(e){return!("touch"===e.pointerType||iO.x||iO.y)}function aG(e,t,r){let{props:n}=e;e.animationState&&n.whileHover&&e.animationState.setActive("whileHover","Start"===r);let i=n["onHover"+r];i&&tS.postRender(()=>i(t,iD(t)))}let aZ=(e,t)=>!!t&&(e===t||aZ(e,t.parentElement)),aJ=new WeakSet;function a0(e){return t=>{"Enter"===t.key&&e(t)}}function a1(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}function a2(e){return i_(e)&&!(iO.x||iO.y)}function a5(e,t,r){let{props:n}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&n.whileTap&&e.animationState.setActive("whileTap","Start"===r);let i=n["onTap"+("End"===r?"":r)];i&&tS.postRender(()=>i(t,iD(t)))}let a4=new WeakMap,a3=new WeakMap,a6=e=>{let t=a4.get(e.target);t&&t(e)},a8=e=>{e.forEach(a6)},a7={some:0,all:1},a9=function(e,t){if("u"<typeof Proxy)return r1;let r=new Map,n=(r,n)=>r1(r,n,e,t);return new Proxy((e,t)=>n(e,t),{get:(i,a)=>"create"===a?n:(r.has(a)||r.set(a,r1(a,void 0,e,t)),r.get(a))})}({animation:{Feature:class extends r2{constructor(e){super(e),e.animationState||(e.animationState=function(e){let t=t=>Promise.all(t.map(({animation:t,options:r})=>(function(e,t,r={}){let n;if(e.notify("AnimationStart",t),Array.isArray(t))n=Promise.all(t.map(t=>ip(e,t,r)));else if("string"==typeof t)n=ip(e,t,r);else{let i="function"==typeof t?r5(e,t,r.custom):t;n=Promise.all(iu(e,i,r))}return n.then(()=>{e.notify("AnimationComplete",t)})})(e,t,r))),r=ib(),n=!0,i=t=>(r,n)=>{let i=r5(e,n,"exit"===t?e.presenceContext?.custom:void 0);if(i){let{transition:e,transitionEnd:t,...n}=i;r={...r,...n,...t}}return r};function a(a){let{props:s}=e,l=function e(t){if(!t)return;if(!t.isControllingVariants){let r=t.parent&&e(t.parent)||{};return void 0!==t.props.initial&&(r.initial=t.props.initial),r}let r={};for(let e=0;e<im;e++){let n=t1[e],i=t.props[n];(tJ(i)||!1===i)&&(r[n]=i)}return r}(e.parent)||{},o=[],c=new Set,d={},u=1/0;for(let t=0;t<ig;t++){var h,p;let m=iy[t],f=r[m],x=void 0!==s[m]?s[m]:l[m],y=tJ(x),g=m===a?f.isActive:null;!1===g&&(u=t);let v=x===l[m]&&x!==s[m]&&y;if(v&&n&&e.manuallyAnimateOnMount&&(v=!1),f.protectedKeys={...d},!f.isActive&&null===g||!x&&!f.prevProp||tZ(x)||"boolean"==typeof x)continue;let b=(h=f.prevProp,"string"==typeof(p=x)?p!==h:!!Array.isArray(p)&&!ix(p,h)),j=b||m===a&&f.isActive&&!v&&y||t>u&&y,w=!1,N=Array.isArray(x)?x:[x],k=N.reduce(i(m),{});!1===g&&(k={});let{prevResolvedValues:S={}}=f,O={...S,...k},P=t=>{j=!0,c.has(t)&&(w=!0,c.delete(t)),f.needsAnimating[t]=!0;let r=e.getValue(t);r&&(r.liveStyle=!1)};for(let e in O){let t=k[e],r=S[e];if(!d.hasOwnProperty(e))(r3(t)&&r3(r)?ix(t,r):t===r)?void 0!==t&&c.has(e)?P(e):f.protectedKeys[e]=!0:null!=t?P(e):c.add(e)}f.prevProp=x,f.prevResolvedValues=k,f.isActive&&(d={...d,...k}),n&&e.blockInitialAnimation&&(j=!1);let C=v&&b,A=!C||w;j&&A&&o.push(...N.map(t=>{let r={type:m};if("string"==typeof t&&n&&!C&&e.manuallyAnimateOnMount&&e.parent){let{parent:n}=e,i=r5(n,t);if(n.enteringChildren&&i){let{delayChildren:t}=i.transition||{};r.delay=ih(n.enteringChildren,e,t)}}return{animation:t,options:r}}))}if(c.size){let t={};if("boolean"!=typeof s.initial){let r=r5(e,Array.isArray(s.initial)?s.initial[0]:s.initial);r&&r.transition&&(t.transition=r.transition)}c.forEach(r=>{let n=e.getBaseTarget(r),i=e.getValue(r);i&&(i.liveStyle=!0),t[r]=n??null}),o.push({animation:t})}let m=!!o.length;return n&&(!1===s.initial||s.initial===s.animate)&&!e.manuallyAnimateOnMount&&(m=!1),n=!1,m?t(o):Promise.resolve()}return{animateChanges:a,setActive:function(t,n){if(r[t].isActive===n)return Promise.resolve();e.variantChildren?.forEach(e=>e.animationState?.setActive(t,n)),r[t].isActive=n;let i=a(t);for(let e in r)r[e].protectedKeys={};return i},setAnimateFunction:function(r){t=r(e)},getState:()=>r,reset:()=>{r=ib()}}}(e))}updateAnimationControlsSubscription(){let{animate:e}=this.node.getProps();tZ(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){let{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}},exit:{Feature:class extends r2{constructor(){super(...arguments),this.id=ij++}update(){if(!this.node.presenceContext)return;let{isPresent:e,onExitComplete:t}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===r)return;let n=this.node.animationState.setActive("exit",!e);t&&!e&&n.then(()=>{t(this.id)})}mount(){let{register:e,onExitComplete:t}=this.node.presenceContext||{};t&&t(this.id),e&&(this.unmount=e(this.id))}unmount(){}}},inView:{Feature:class extends r2{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){var e;let t;this.unmount();let{viewport:r={}}=this.node.getProps(),{root:n,margin:i,amount:a="some",once:s}=r,l={root:n?n.current:void 0,rootMargin:i,threshold:"number"==typeof a?a:a7[a]},o=e=>{let{isIntersecting:t}=e;if(this.isInView===t||(this.isInView=t,s&&!t&&this.hasEnteredView))return;t&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",t);let{onViewportEnter:r,onViewportLeave:n}=this.node.getProps(),i=t?r:n;i&&i(e)};return e=this.node.current,t=function({root:e,...t}){let r=e||document;a3.has(r)||a3.set(r,{});let n=a3.get(r),i=JSON.stringify(t);return n[i]||(n[i]=new IntersectionObserver(a8,{root:e,...t})),n[i]}(l),a4.set(e,o),t.observe(e),()=>{a4.delete(e),t.unobserve(e)}}mount(){this.startObserver()}update(){if("u"<typeof IntersectionObserver)return;let{props:e,prevProps:t}=this.node;["amount","margin","root"].some(function({viewport:e={}},{viewport:t={}}={}){return r=>e[r]!==t[r]}(e,t))&&this.startObserver()}unmount(){}}},tap:{Feature:class extends r2{mount(){let{current:e}=this.node;e&&(this.unmount=function(e,t,r={}){let[n,i,a]=aY(e,r),s=e=>{let n=e.currentTarget;if(!a2(e))return;aJ.add(n);let a=t(n,e),s=(e,t)=>{window.removeEventListener("pointerup",l),window.removeEventListener("pointercancel",o),aJ.has(n)&&aJ.delete(n),a2(e)&&"function"==typeof a&&a(e,{success:t})},l=e=>{s(e,n===window||n===document||r.useGlobalTarget||aZ(n,e.target))},o=e=>{s(e,!1)};window.addEventListener("pointerup",l,i),window.addEventListener("pointercancel",o,i)};return n.forEach(e=>{(r.useGlobalTarget?window:e).addEventListener("pointerdown",s,i),et(e)&&(e.addEventListener("focus",e=>((e,t)=>{let r=e.currentTarget;if(!r)return;let n=a0(()=>{if(aJ.has(r))return;a1(r,"down");let e=a0(()=>{a1(r,"up")});r.addEventListener("keyup",e,t),r.addEventListener("blur",()=>a1(r,"cancel"),t)});r.addEventListener("keydown",n,t),r.addEventListener("blur",()=>r.removeEventListener("keydown",n),t)})(e,i)),ik(e)||e.hasAttribute("tabindex")||(e.tabIndex=0))}),a}(e,(e,t)=>(a5(this.node,t,"Start"),(e,{success:t})=>a5(this.node,e,t?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}},focus:{Feature:class extends r2{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch(t){e=!0}e&&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=r9(iS(this.node.current,"focus",()=>this.onFocus()),iS(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}},hover:{Feature:class extends r2{mount(){let{current:e}=this.node;e&&(this.unmount=function(e,t,r={}){let[n,i,a]=aY(e,r),s=e=>{if(!aX(e))return;let{target:r}=e,n=t(r,e);if("function"!=typeof n||!r)return;let a=e=>{aX(e)&&(n(e),r.removeEventListener("pointerleave",a))};r.addEventListener("pointerleave",a,i)};return n.forEach(e=>{e.addEventListener("pointerenter",s,i)}),a}(e,(e,t)=>(aG(this.node,t,"Start"),e=>aG(this.node,e,"End"))))}unmount(){}}},pan:{Feature:class extends r2{constructor(){super(...arguments),this.removePointerDownListener=tj}onPointerDown(e){this.session=new iF(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:iz(this.node)})}createPanHandlers(){let{onPanSessionStart:e,onPanStart:t,onPan:r,onPanEnd:n}=this.node.getProps();return{onSessionStart:iG(e),onStart:iG(t),onMove:r,onEnd:(e,t)=>{delete this.session,n&&tS.postRender(()=>n(e,t))}}}mount(){this.removePointerDownListener=iI(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}},drag:{Feature:class extends r2{constructor(e){super(e),this.removeGroupControls=tj,this.removeListeners=tj,this.controls=new iY(e)}mount(){let{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||tj}update(){let{dragControls:e}=this.node.getProps(),{dragControls:t}=this.node.prevProps||{};e!==t&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}},ProjectionNode:aQ,MeasureLayout:i2},layout:{ProjectionNode:aQ,MeasureLayout:i2}},(e,t)=>t.isSVG??rD(e)?new rv(t):new rT(t,{allowProjection:e!==H.Fragment}));var se=e.i(13132),st=e.i(88069),sr=e.i(42098);function sn(e,t=300){let[r,n]=(0,H.useState)(e);return(0,H.useEffect)(()=>{let r=setTimeout(()=>{n(e)},t);return()=>{clearTimeout(r)}},[e,t]),r}var si=e.i(45688),sa=e.i(88969);let ss=Q.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";async function sl(e){if(!e||e.length<2)return[];let t=await (0,sa.authFetch)(`${ss}/api/suggestions?q=${encodeURIComponent(e)}&limit=8`);if(!t.ok)throw Error("Failed to fetch suggestions");return(await t.json()).suggestions}var so=e.i(1235),sc=e.i(71921);let sd=Q.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";function su(e){return(e.status??"active")!=="archived"&&(e.status??"active")!=="suppressed"}function sh(e,t){if(!e)return e;let r=(e,r)=>e.map(e=>e.id===t.id?t:e).filter(r),n=e.sections.contradictions.map(e=>({...e,memoryA:e.memoryA.id===t.id?t:e.memoryA,memoryB:e.memoryB.id===t.id?t:e.memoryB})).filter(e=>su(e.memoryA)&&su(e.memoryB)),i=e.sections.duplicates.map(e=>({...e,memoryA:e.memoryA.id===t.id?t:e.memoryA,memoryB:e.memoryB.id===t.id?t:e.memoryB})).filter(e=>su(e.memoryA)&&su(e.memoryB)),a={stale:r(e.sections.stale,e=>su(e)&&(e.decayedScore??1)<.3),neverUsed:r(e.sections.neverUsed,e=>{var t;return su(e)&&0===e.accessCount&&!!(t=e.createdAt)&&Date.now()-new Date(t).getTime()>=864e5}),lowTrust:r(e.sections.lowTrust,e=>su(e)&&(e.trustScore??1)<.7),noisyAutoExtracted:r(e.sections.noisyAutoExtracted,e=>su(e)&&("auto"===e.captureMethod||e.tags.includes("auto-extracted"))),projectless:r(e.sections.projectless,e=>su(e)&&!(e.project&&e.project.trim())&&"global"!==e.scope),duplicates:i,contradictions:n};return{...e,summary:{stale:a.stale.length,neverUsed:a.neverUsed.length,lowTrust:a.lowTrust.length,noisyAutoExtracted:a.noisyAutoExtracted.length,projectless:a.projectless.length,duplicates:a.duplicates.length,contradictions:a.contradictions.length},openClaw:e.openClaw,sections:a}}async function sp(e){let t=e?`?project=${encodeURIComponent(e)}`:"",r=await (0,sa.authFetch)(`${sd}/api/review/queue${t}`);if(!r.ok)throw Error(await (0,sa.readApiError)(r,"Failed to fetch review queue"));return r.json()}async function sm(e){let t=await (0,sa.authFetch)(`${sd}/api/memories/${e.id}/review`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw Error(await (0,sa.readApiError)(t,"Failed to update review state"));return t.json()}async function sf(e){let t=await (0,sa.authFetch)(`${sd}/api/memories/merge`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw Error(await (0,sa.readApiError)(t,"Failed to merge memories"));return t.json()}function sx(){let e=(0,so.useQueryClient)();return(0,sc.useMutation)({mutationFn:sm,onSuccess:t=>{e.setQueriesData({queryKey:["review-queue"]},e=>sh(e,t)),e.setQueriesData({queryKey:["memories"]},e=>e?{...e,memories:e.memories.map(e=>e.id===t.id?t:e)}:e),e.invalidateQueries({queryKey:["review-queue"]}),e.invalidateQueries({queryKey:["memories"]}),e.invalidateQueries({queryKey:["quality"]}),e.invalidateQueries({queryKey:["contradictions"]}),e.invalidateQueries({queryKey:["stats"]})}})}var sy=e.i(97358);function sg(e){let t=Math.floor((Date.now()-new Date(e).getTime())/6e4);if(t<1)return"now";if(t<60)return`${t}m ago`;let r=Math.floor(t/60);if(r<24)return`${r}h ago`;let n=Math.floor(r/24);if(n<7)return`${n}d ago`;let i=Math.floor(n/7);return`${i}w ago`}function sv({memory:e,isSelected:t,onSelect:r,isChecked:n,onCheck:i}){let a=(0,sy.getCategoryColor)(e.category),s=(0,sy.getTypeColor)(e.type);return(0,W.jsxs)("div",{onClick:()=>r(e),className:`bg-slate-900 border rounded-lg p-3 hover:border-slate-600 cursor-pointer transition-colors relative ${t?"border-cyan-500":"border-slate-800"}`,children:[(0,W.jsx)("div",{className:"h-0.5 rounded-full bg-slate-800 mb-2 overflow-hidden",children:(0,W.jsx)("div",{className:"h-full rounded-full",style:{width:`${100*e.salience}%`,backgroundColor:a}})}),i&&(0,W.jsx)("input",{type:"checkbox",checked:n??!1,onChange:t=>{t.stopPropagation(),i(e.id,t.target.checked)},onClick:e=>e.stopPropagation(),className:"absolute top-3 right-3 w-4 h-4 accent-blue-500"}),(0,W.jsx)("h3",{className:"text-sm font-semibold text-white truncate pr-6",children:e.title}),(0,W.jsxs)("div",{className:"flex items-center gap-1.5 mt-1",children:[(0,W.jsx)("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full font-medium",style:{backgroundColor:a+"22",color:a},children:e.category}),(0,W.jsx)("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full font-medium",style:{backgroundColor:s+"22",color:s},children:e.type.replace("_","-")}),e.status&&"active"!==e.status&&(0,W.jsx)("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full font-medium bg-amber-500/15 text-amber-300",children:e.status}),e.pinned&&(0,W.jsx)("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full font-medium bg-emerald-500/15 text-emerald-300",children:"pinned"})]}),(0,W.jsxs)("div",{className:"flex items-center gap-1.5 mt-2 flex-wrap",children:[e.sourceKind&&(0,W.jsx)("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-slate-800 text-slate-300",children:e.sourceKind}),e.captureMethod&&(0,W.jsx)("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-slate-800 text-slate-300",children:e.captureMethod}),"number"==typeof e.trustScore&&(0,W.jsxs)("span",{className:`text-[10px] px-1.5 py-0.5 rounded ${e.trustScore<.7?"bg-red-500/15 text-red-300":"bg-emerald-500/15 text-emerald-300"}`,children:["trust ",e.trustScore.toFixed(2)]}),e.cloudExcluded&&(0,W.jsx)("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-amber-500/15 text-amber-300",children:"cloud excluded"})]}),(0,W.jsx)("p",{className:"text-[13px] text-slate-400 mt-1.5 line-clamp-3 leading-snug",children:e.content}),e.tags.length>0&&(0,W.jsxs)("div",{className:"flex items-center gap-1 mt-2 flex-wrap",children:[e.tags.slice(0,3).map(e=>(0,W.jsx)("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-slate-800 text-slate-400",children:e},e)),e.tags.length>3&&(0,W.jsxs)("span",{className:"text-[10px] text-slate-500",children:["+",e.tags.length-3," more"]})]}),(0,W.jsxs)("div",{className:"flex items-center justify-between mt-2 text-[11px] text-slate-500",children:[(0,W.jsxs)("span",{children:["Created ",sg(e.createdAt)]}),(0,W.jsxs)("span",{children:["Accessed ",sg(e.lastAccessed)]})]})]})}function sb(){for(var e,t,r=0,n="",i=arguments.length;r<i;r++)(e=arguments[r])&&(t=function e(t){var r,n,i="";if("string"==typeof t||"number"==typeof t)i+=t;else if("object"==typeof t)if(Array.isArray(t)){var a=t.length;for(r=0;r<a;r++)t[r]&&(n=e(t[r]))&&(i&&(i+=" "),i+=n)}else for(n in t)t[n]&&(i&&(i+=" "),i+=n);return i}(e))&&(n&&(n+=" "),n+=t);return n}let sj=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),sw=[],sN=(e,t,r)=>{if(0==e.length-t)return r.classGroupId;let n=e[t],i=r.nextPart.get(n);if(i){let r=sN(e,t+1,i);if(r)return r}let a=r.validators;if(null===a)return;let s=0===t?e.join("-"):e.slice(t).join("-"),l=a.length;for(let e=0;e<l;e++){let t=a[e];if(t.validator(s))return t.classGroupId}},sk=(e,t)=>{let r=sj();for(let n in e)sS(e[n],r,n,t);return r},sS=(e,t,r,n)=>{let i=e.length;for(let a=0;a<i;a++)sO(e[a],t,r,n)},sO=(e,t,r,n)=>{"string"==typeof e?sP(e,t,r):"function"==typeof e?sC(e,t,r,n):sA(e,t,r,n)},sP=(e,t,r)=>{(""===e?t:sE(t,e)).classGroupId=r},sC=(e,t,r,n)=>{sM(e)?sS(e(n),t,r,n):(null===t.validators&&(t.validators=[]),t.validators.push({classGroupId:r,validator:e}))},sA=(e,t,r,n)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,s]=i[e];sS(s,sE(t,a),r,n)}},sE=(e,t)=>{let r=e,n=t.split("-"),i=n.length;for(let e=0;e<i;e++){let t=n[e],i=r.nextPart.get(t);i||(i=sj(),r.nextPart.set(t,i)),r=i}return r},sM=e=>"isThemeGetter"in e&&!0===e.isThemeGetter,sT=[],s_=(e,t,r,n,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:n,isExternal:i}),sD=/\s+/,sI=e=>{let t;if("string"==typeof e)return e;let r="";for(let n=0;n<e.length;n++)e[n]&&(t=sI(e[n]))&&(r&&(r+=" "),r+=t);return r},sz=[],sL=e=>{let t=t=>t[e]||sz;return t.isThemeGetter=!0,t},sR=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,sF=/^\((?:(\w[\w-]*):)?(.+)\)$/i,s$=/^\d+\/\d+$/,sB=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,sU=/\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$/,sq=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,sV=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,sK=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,sW=e=>s$.test(e),sH=e=>!!e&&!Number.isNaN(Number(e)),sQ=e=>!!e&&Number.isInteger(Number(e)),sY=e=>e.endsWith("%")&&sH(e.slice(0,-1)),sX=e=>sB.test(e),sG=()=>!0,sZ=e=>sU.test(e)&&!sq.test(e),sJ=()=>!1,s0=e=>sV.test(e),s1=e=>sK.test(e),s2=e=>!s4(e)&&!le(e),s5=e=>ll(e,lu,sJ),s4=e=>sR.test(e),s3=e=>ll(e,lh,sZ),s6=e=>ll(e,lp,sH),s8=e=>ll(e,lc,sJ),s7=e=>ll(e,ld,s1),s9=e=>ll(e,lf,s0),le=e=>sF.test(e),lt=e=>lo(e,lh),lr=e=>lo(e,lm),ln=e=>lo(e,lc),li=e=>lo(e,lu),la=e=>lo(e,ld),ls=e=>lo(e,lf,!0),ll=(e,t,r)=>{let n=sR.exec(e);return!!n&&(n[1]?t(n[1]):r(n[2]))},lo=(e,t,r=!1)=>{let n=sF.exec(e);return!!n&&(n[1]?t(n[1]):r)},lc=e=>"position"===e||"percentage"===e,ld=e=>"image"===e||"url"===e,lu=e=>"length"===e||"size"===e||"bg-size"===e,lh=e=>"length"===e,lp=e=>"number"===e,lm=e=>"family-name"===e,lf=e=>"shadow"===e,lx=((e,...t)=>{let r,n,i,a,s=e=>{let t=n(e);if(t)return t;let a=((e,t)=>{let{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:i,sortModifiers:a}=t,s=[],l=e.trim().split(sD),o="";for(let e=l.length-1;e>=0;e-=1){let t=l[e],{isExternal:c,modifiers:d,hasImportantModifier:u,baseClassName:h,maybePostfixModifierPosition:p}=r(t);if(c){o=t+(o.length>0?" "+o:o);continue}let m=!!p,f=n(m?h.substring(0,p):h);if(!f){if(!m||!(f=n(h))){o=t+(o.length>0?" "+o:o);continue}m=!1}let x=0===d.length?"":1===d.length?d[0]:a(d).join(":"),y=u?x+"!":x,g=y+f;if(s.indexOf(g)>-1)continue;s.push(g);let v=i(f,m);for(let e=0;e<v.length;++e){let t=v[e];s.push(y+t)}o=t+(o.length>0?" "+o:o)}return o})(e,r);return i(e,a),a};return a=l=>{var o;let c;return n=(r={cache:(e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,r=Object.create(null),n=Object.create(null),i=(i,a)=>{r[i]=a,++t>e&&(t=0,n=r,r=Object.create(null))};return{get(e){let t=r[e];return void 0!==t?t:void 0!==(t=n[e])?(i(e,t),t):void 0},set(e,t){e in r?r[e]=t:i(e,t)}}})((o=t.reduce((e,t)=>t(e),e())).cacheSize),parseClassName:(e=>{let{prefix:t,experimentalParseClassName:r}=e,n=e=>{let t,r=[],n=0,i=0,a=0,s=e.length;for(let l=0;l<s;l++){let s=e[l];if(0===n&&0===i){if(":"===s){r.push(e.slice(a,l)),a=l+1;continue}if("/"===s){t=l;continue}}"["===s?n++:"]"===s?n--:"("===s?i++:")"===s&&i--}let l=0===r.length?e:e.slice(a),o=l,c=!1;return l.endsWith("!")?(o=l.slice(0,-1),c=!0):l.startsWith("!")&&(o=l.slice(1),c=!0),s_(r,c,o,t&&t>a?t-a:void 0)};if(t){let e=t+":",r=n;n=t=>t.startsWith(e)?r(t.slice(e.length)):s_(sT,!1,t,void 0,!0)}if(r){let e=n;n=t=>r({className:t,parseClassName:e})}return n})(o),sortModifiers:(c=new Map,o.orderSensitiveModifiers.forEach((e,t)=>{c.set(e,1e6+t)}),e=>{let t=[],r=[];for(let n=0;n<e.length;n++){let i=e[n],a="["===i[0],s=c.has(i);a||s?(r.length>0&&(r.sort(),t.push(...r),r=[]),t.push(i)):r.push(i)}return r.length>0&&(r.sort(),t.push(...r)),t}),...(e=>{let t=(e=>{let{theme:t,classGroups:r}=e;return sk(r,t)})(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:e=>{if(e.startsWith("[")&&e.endsWith("]")){var r;let t,n,i;return -1===(r=e).slice(1,-1).indexOf(":")?void 0:(n=(t=r.slice(1,-1)).indexOf(":"),(i=t.slice(0,n))?"arbitrary.."+i:void 0)}let n=e.split("-"),i=+(""===n[0]&&n.length>1);return sN(n,i,t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=n[e],i=r[e];if(t){if(i){let e=Array(i.length+t.length);for(let t=0;t<i.length;t++)e[t]=i[t];for(let r=0;r<t.length;r++)e[i.length+r]=t[r];return e}return t}return i||sw}return r[e]||sw}}})(o)}).cache.get,i=r.cache.set,a=s,s(l)},(...e)=>a(((...e)=>{let t,r,n=0,i="";for(;n<e.length;)(t=e[n++])&&(r=sI(t))&&(i&&(i+=" "),i+=r);return i})(...e))})(()=>{let e=sL("color"),t=sL("font"),r=sL("text"),n=sL("font-weight"),i=sL("tracking"),a=sL("leading"),s=sL("breakpoint"),l=sL("container"),o=sL("spacing"),c=sL("radius"),d=sL("shadow"),u=sL("inset-shadow"),h=sL("text-shadow"),p=sL("drop-shadow"),m=sL("blur"),f=sL("perspective"),x=sL("aspect"),y=sL("ease"),g=sL("animate"),v=()=>["auto","avoid","all","avoid-page","page","left","right","column"],b=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],j=()=>[...b(),le,s4],w=()=>["auto","hidden","clip","visible","scroll"],N=()=>["auto","contain","none"],k=()=>[le,s4,o],S=()=>[sW,"full","auto",...k()],O=()=>[sQ,"none","subgrid",le,s4],P=()=>["auto",{span:["full",sQ,le,s4]},sQ,le,s4],C=()=>[sQ,"auto",le,s4],A=()=>["auto","min","max","fr",le,s4],E=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],M=()=>["start","end","center","stretch","center-safe","end-safe"],T=()=>["auto",...k()],_=()=>[sW,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...k()],D=()=>[e,le,s4],I=()=>[...b(),ln,s8,{position:[le,s4]}],z=()=>["no-repeat",{repeat:["","x","y","space","round"]}],L=()=>["auto","cover","contain",li,s5,{size:[le,s4]}],R=()=>[sY,lt,s3],F=()=>["","none","full",c,le,s4],$=()=>["",sH,lt,s3],B=()=>["solid","dashed","dotted","double"],U=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],q=()=>[sH,sY,ln,s8],V=()=>["","none",m,le,s4],K=()=>["none",sH,le,s4],W=()=>["none",sH,le,s4],H=()=>[sH,le,s4],Q=()=>[sW,"full",...k()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[sX],breakpoint:[sX],color:[sG],container:[sX],"drop-shadow":[sX],ease:["in","out","in-out"],font:[s2],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[sX],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[sX],shadow:[sX],spacing:["px",sH],text:[sX],"text-shadow":[sX],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",sW,s4,le,x]}],container:["container"],columns:[{columns:[sH,s4,le,l]}],"break-after":[{"break-after":v()}],"break-before":[{"break-before":v()}],"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:j()}],overflow:[{overflow:w()}],"overflow-x":[{"overflow-x":w()}],"overflow-y":[{"overflow-y":w()}],overscroll:[{overscroll:N()}],"overscroll-x":[{"overscroll-x":N()}],"overscroll-y":[{"overscroll-y":N()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:S()}],"inset-x":[{"inset-x":S()}],"inset-y":[{"inset-y":S()}],start:[{start:S()}],end:[{end:S()}],top:[{top:S()}],right:[{right:S()}],bottom:[{bottom:S()}],left:[{left:S()}],visibility:["visible","invisible","collapse"],z:[{z:[sQ,"auto",le,s4]}],basis:[{basis:[sW,"full","auto",l,...k()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[sH,sW,"auto","initial","none",s4]}],grow:[{grow:["",sH,le,s4]}],shrink:[{shrink:["",sH,le,s4]}],order:[{order:[sQ,"first","last","none",le,s4]}],"grid-cols":[{"grid-cols":O()}],"col-start-end":[{col:P()}],"col-start":[{"col-start":C()}],"col-end":[{"col-end":C()}],"grid-rows":[{"grid-rows":O()}],"row-start-end":[{row:P()}],"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":A()}],"auto-rows":[{"auto-rows":A()}],gap:[{gap:k()}],"gap-x":[{"gap-x":k()}],"gap-y":[{"gap-y":k()}],"justify-content":[{justify:[...E(),"normal"]}],"justify-items":[{"justify-items":[...M(),"normal"]}],"justify-self":[{"justify-self":["auto",...M()]}],"align-content":[{content:["normal",...E()]}],"align-items":[{items:[...M(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...M(),{baseline:["","last"]}]}],"place-content":[{"place-content":E()}],"place-items":[{"place-items":[...M(),"baseline"]}],"place-self":[{"place-self":["auto",...M()]}],p:[{p:k()}],px:[{px:k()}],py:[{py:k()}],ps:[{ps:k()}],pe:[{pe:k()}],pt:[{pt:k()}],pr:[{pr:k()}],pb:[{pb:k()}],pl:[{pl:k()}],m:[{m:T()}],mx:[{mx:T()}],my:[{my:T()}],ms:[{ms:T()}],me:[{me:T()}],mt:[{mt:T()}],mr:[{mr:T()}],mb:[{mb:T()}],ml:[{ml:T()}],"space-x":[{"space-x":k()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":k()}],"space-y-reverse":["space-y-reverse"],size:[{size:_()}],w:[{w:[l,"screen",..._()]}],"min-w":[{"min-w":[l,"screen","none",..._()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[s]},..._()]}],h:[{h:["screen","lh",..._()]}],"min-h":[{"min-h":["screen","lh","none",..._()]}],"max-h":[{"max-h":["screen","lh",..._()]}],"font-size":[{text:["base",r,lt,s3]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,le,s6]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",sY,s4]}],"font-family":[{font:[lr,s4,t]}],"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:[i,le,s4]}],"line-clamp":[{"line-clamp":[sH,"none",le,s6]}],leading:[{leading:[a,...k()]}],"list-image":[{"list-image":["none",le,s4]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",le,s4]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:D()}],"text-color":[{text:D()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...B(),"wavy"]}],"text-decoration-thickness":[{decoration:[sH,"from-font","auto",le,s3]}],"text-decoration-color":[{decoration:D()}],"underline-offset":[{"underline-offset":[sH,"auto",le,s4]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:k()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",le,s4]}],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",le,s4]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:I()}],"bg-repeat":[{bg:z()}],"bg-size":[{bg:L()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},sQ,le,s4],radial:["",le,s4],conic:[sQ,le,s4]},la,s7]}],"bg-color":[{bg:D()}],"gradient-from-pos":[{from:R()}],"gradient-via-pos":[{via:R()}],"gradient-to-pos":[{to:R()}],"gradient-from":[{from:D()}],"gradient-via":[{via:D()}],"gradient-to":[{to:D()}],rounded:[{rounded:F()}],"rounded-s":[{"rounded-s":F()}],"rounded-e":[{"rounded-e":F()}],"rounded-t":[{"rounded-t":F()}],"rounded-r":[{"rounded-r":F()}],"rounded-b":[{"rounded-b":F()}],"rounded-l":[{"rounded-l":F()}],"rounded-ss":[{"rounded-ss":F()}],"rounded-se":[{"rounded-se":F()}],"rounded-ee":[{"rounded-ee":F()}],"rounded-es":[{"rounded-es":F()}],"rounded-tl":[{"rounded-tl":F()}],"rounded-tr":[{"rounded-tr":F()}],"rounded-br":[{"rounded-br":F()}],"rounded-bl":[{"rounded-bl":F()}],"border-w":[{border:$()}],"border-w-x":[{"border-x":$()}],"border-w-y":[{"border-y":$()}],"border-w-s":[{"border-s":$()}],"border-w-e":[{"border-e":$()}],"border-w-t":[{"border-t":$()}],"border-w-r":[{"border-r":$()}],"border-w-b":[{"border-b":$()}],"border-w-l":[{"border-l":$()}],"divide-x":[{"divide-x":$()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":$()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...B(),"hidden","none"]}],"divide-style":[{divide:[...B(),"hidden","none"]}],"border-color":[{border:D()}],"border-color-x":[{"border-x":D()}],"border-color-y":[{"border-y":D()}],"border-color-s":[{"border-s":D()}],"border-color-e":[{"border-e":D()}],"border-color-t":[{"border-t":D()}],"border-color-r":[{"border-r":D()}],"border-color-b":[{"border-b":D()}],"border-color-l":[{"border-l":D()}],"divide-color":[{divide:D()}],"outline-style":[{outline:[...B(),"none","hidden"]}],"outline-offset":[{"outline-offset":[sH,le,s4]}],"outline-w":[{outline:["",sH,lt,s3]}],"outline-color":[{outline:D()}],shadow:[{shadow:["","none",d,ls,s9]}],"shadow-color":[{shadow:D()}],"inset-shadow":[{"inset-shadow":["none",u,ls,s9]}],"inset-shadow-color":[{"inset-shadow":D()}],"ring-w":[{ring:$()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:D()}],"ring-offset-w":[{"ring-offset":[sH,s3]}],"ring-offset-color":[{"ring-offset":D()}],"inset-ring-w":[{"inset-ring":$()}],"inset-ring-color":[{"inset-ring":D()}],"text-shadow":[{"text-shadow":["none",h,ls,s9]}],"text-shadow-color":[{"text-shadow":D()}],opacity:[{opacity:[sH,le,s4]}],"mix-blend":[{"mix-blend":[...U(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":U()}],"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":[sH]}],"mask-image-linear-from-pos":[{"mask-linear-from":q()}],"mask-image-linear-to-pos":[{"mask-linear-to":q()}],"mask-image-linear-from-color":[{"mask-linear-from":D()}],"mask-image-linear-to-color":[{"mask-linear-to":D()}],"mask-image-t-from-pos":[{"mask-t-from":q()}],"mask-image-t-to-pos":[{"mask-t-to":q()}],"mask-image-t-from-color":[{"mask-t-from":D()}],"mask-image-t-to-color":[{"mask-t-to":D()}],"mask-image-r-from-pos":[{"mask-r-from":q()}],"mask-image-r-to-pos":[{"mask-r-to":q()}],"mask-image-r-from-color":[{"mask-r-from":D()}],"mask-image-r-to-color":[{"mask-r-to":D()}],"mask-image-b-from-pos":[{"mask-b-from":q()}],"mask-image-b-to-pos":[{"mask-b-to":q()}],"mask-image-b-from-color":[{"mask-b-from":D()}],"mask-image-b-to-color":[{"mask-b-to":D()}],"mask-image-l-from-pos":[{"mask-l-from":q()}],"mask-image-l-to-pos":[{"mask-l-to":q()}],"mask-image-l-from-color":[{"mask-l-from":D()}],"mask-image-l-to-color":[{"mask-l-to":D()}],"mask-image-x-from-pos":[{"mask-x-from":q()}],"mask-image-x-to-pos":[{"mask-x-to":q()}],"mask-image-x-from-color":[{"mask-x-from":D()}],"mask-image-x-to-color":[{"mask-x-to":D()}],"mask-image-y-from-pos":[{"mask-y-from":q()}],"mask-image-y-to-pos":[{"mask-y-to":q()}],"mask-image-y-from-color":[{"mask-y-from":D()}],"mask-image-y-to-color":[{"mask-y-to":D()}],"mask-image-radial":[{"mask-radial":[le,s4]}],"mask-image-radial-from-pos":[{"mask-radial-from":q()}],"mask-image-radial-to-pos":[{"mask-radial-to":q()}],"mask-image-radial-from-color":[{"mask-radial-from":D()}],"mask-image-radial-to-color":[{"mask-radial-to":D()}],"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":b()}],"mask-image-conic-pos":[{"mask-conic":[sH]}],"mask-image-conic-from-pos":[{"mask-conic-from":q()}],"mask-image-conic-to-pos":[{"mask-conic-to":q()}],"mask-image-conic-from-color":[{"mask-conic-from":D()}],"mask-image-conic-to-color":[{"mask-conic-to":D()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:I()}],"mask-repeat":[{mask:z()}],"mask-size":[{mask:L()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",le,s4]}],filter:[{filter:["","none",le,s4]}],blur:[{blur:V()}],brightness:[{brightness:[sH,le,s4]}],contrast:[{contrast:[sH,le,s4]}],"drop-shadow":[{"drop-shadow":["","none",p,ls,s9]}],"drop-shadow-color":[{"drop-shadow":D()}],grayscale:[{grayscale:["",sH,le,s4]}],"hue-rotate":[{"hue-rotate":[sH,le,s4]}],invert:[{invert:["",sH,le,s4]}],saturate:[{saturate:[sH,le,s4]}],sepia:[{sepia:["",sH,le,s4]}],"backdrop-filter":[{"backdrop-filter":["","none",le,s4]}],"backdrop-blur":[{"backdrop-blur":V()}],"backdrop-brightness":[{"backdrop-brightness":[sH,le,s4]}],"backdrop-contrast":[{"backdrop-contrast":[sH,le,s4]}],"backdrop-grayscale":[{"backdrop-grayscale":["",sH,le,s4]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[sH,le,s4]}],"backdrop-invert":[{"backdrop-invert":["",sH,le,s4]}],"backdrop-opacity":[{"backdrop-opacity":[sH,le,s4]}],"backdrop-saturate":[{"backdrop-saturate":[sH,le,s4]}],"backdrop-sepia":[{"backdrop-sepia":["",sH,le,s4]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":k()}],"border-spacing-x":[{"border-spacing-x":k()}],"border-spacing-y":[{"border-spacing-y":k()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",le,s4]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[sH,"initial",le,s4]}],ease:[{ease:["linear","initial",y,le,s4]}],delay:[{delay:[sH,le,s4]}],animate:[{animate:["none",g,le,s4]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[f,le,s4]}],"perspective-origin":[{"perspective-origin":j()}],rotate:[{rotate:K()}],"rotate-x":[{"rotate-x":K()}],"rotate-y":[{"rotate-y":K()}],"rotate-z":[{"rotate-z":K()}],scale:[{scale:W()}],"scale-x":[{"scale-x":W()}],"scale-y":[{"scale-y":W()}],"scale-z":[{"scale-z":W()}],"scale-3d":["scale-3d"],skew:[{skew:H()}],"skew-x":[{"skew-x":H()}],"skew-y":[{"skew-y":H()}],transform:[{transform:[le,s4,"","none","gpu","cpu"]}],"transform-origin":[{origin:j()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Q()}],"translate-x":[{"translate-x":Q()}],"translate-y":[{"translate-y":Q()}],"translate-z":[{"translate-z":Q()}],"translate-none":["translate-none"],accent:[{accent:D()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:D()}],"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",le,s4]}],"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":k()}],"scroll-mx":[{"scroll-mx":k()}],"scroll-my":[{"scroll-my":k()}],"scroll-ms":[{"scroll-ms":k()}],"scroll-me":[{"scroll-me":k()}],"scroll-mt":[{"scroll-mt":k()}],"scroll-mr":[{"scroll-mr":k()}],"scroll-mb":[{"scroll-mb":k()}],"scroll-ml":[{"scroll-ml":k()}],"scroll-p":[{"scroll-p":k()}],"scroll-px":[{"scroll-px":k()}],"scroll-py":[{"scroll-py":k()}],"scroll-ps":[{"scroll-ps":k()}],"scroll-pe":[{"scroll-pe":k()}],"scroll-pt":[{"scroll-pt":k()}],"scroll-pr":[{"scroll-pr":k()}],"scroll-pb":[{"scroll-pb":k()}],"scroll-pl":[{"scroll-pl":k()}],"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",le,s4]}],fill:[{fill:["none",...D()]}],"stroke-w":[{stroke:[sH,lt,s3,s6]}],stroke:[{stroke:["none",...D()]}],"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 ly(...e){return lx(sb(e))}function lg({className:e,...t}){return(0,W.jsx)("div",{"data-slot":"card",className:ly("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...t})}function lv({className:e,...t}){return(0,W.jsx)("div",{"data-slot":"card-header",className:ly("@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",e),...t})}function lb({className:e,...t}){return(0,W.jsx)("div",{"data-slot":"card-title",className:ly("leading-none font-semibold",e),...t})}function lj({className:e,...t}){return(0,W.jsx)("div",{"data-slot":"card-content",className:ly("px-6",e),...t})}function lw(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}var lN=Symbol.for("react.lazy"),lk=H[" use ".trim().toString()];function lS(e){var t;return null!=e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===lN&&"_payload"in e&&"object"==typeof(t=e._payload)&&null!==t&&"then"in t}var lO=((o=H.forwardRef((e,t)=>{let{children:r,...n}=e;if(lS(r)&&"function"==typeof lk&&(r=lk(r._payload)),H.isValidElement(r)){var i;let e,a,s=(i=r,(a=(e=Object.getOwnPropertyDescriptor(i.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.ref:(a=(e=Object.getOwnPropertyDescriptor(i,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.props.ref:i.props.ref||i.ref),l=function(e,t){let r={...t};for(let n in t){let i=e[n],a=t[n];/^on[A-Z]/.test(n)?i&&a?r[n]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(r[n]=i):"style"===n?r[n]={...i,...a}:"className"===n&&(r[n]=[i,a].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==H.Fragment&&(l.ref=t?function(...e){return t=>{let r=!1,n=e.map(e=>{let n=lw(e,t);return r||"function"!=typeof n||(r=!0),n});if(r)return()=>{for(let t=0;t<n.length;t++){let r=n[t];"function"==typeof r?r():lw(e[t],null)}}}}(t,s):s),H.cloneElement(r,l)}return H.Children.count(r)>1?H.Children.only(null):null})).displayName="Slot.SlotClone",n=o,(i=H.forwardRef((e,t)=>{let{children:r,...i}=e;lS(r)&&"function"==typeof lk&&(r=lk(r._payload));let a=H.Children.toArray(r),s=a.find(lC);if(s){let e=s.props.children,r=a.map(t=>t!==s?t:H.Children.count(e)>1?H.Children.only(null):H.isValidElement(e)?e.props.children:null);return(0,W.jsx)(n,{...i,ref:t,children:H.isValidElement(e)?H.cloneElement(e,void 0,r):null})}return(0,W.jsx)(n,{...i,ref:t,children:r})})).displayName="Slot.Slot",i),lP=Symbol("radix.slottable");function lC(e){return H.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===lP}let lA=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,lE=(a="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",s={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"}},e=>{var t;if((null==s?void 0:s.variants)==null)return sb(a,null==e?void 0:e.class,null==e?void 0:e.className);let{variants:r,defaultVariants:n}=s,i=Object.keys(r).map(t=>{let i=null==e?void 0:e[t],a=null==n?void 0:n[t];if(null===i)return null;let s=lA(i)||lA(a);return r[t][s]}),l=e&&Object.entries(e).reduce((e,t)=>{let[r,n]=t;return void 0===n||(e[r]=n),e},{});return sb(a,i,null==s||null==(t=s.compoundVariants)?void 0:t.reduce((e,t)=>{let{class:r,className:i,...a}=t;return Object.entries(a).every(e=>{let[t,r]=e;return Array.isArray(r)?r.includes({...n,...l}[t]):({...n,...l})[t]===r})?[...e,r,i]:e},[]),null==e?void 0:e.class,null==e?void 0:e.className)});function lM({className:e,variant:t="default",size:r="default",asChild:n=!1,...i}){return(0,W.jsx)(n?lO:"button",{"data-slot":"button","data-variant":t,"data-size":r,className:ly(lE({variant:t,size:r,className:e})),...i})}function lT({className:e,type:t,...r}){return(0,W.jsx)("input",{type:t,"data-slot":"input",className:ly("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",e),...r})}var l_=e.i(33368),lD=e.i(24929);let lI=(0,lD.default)("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]),lz=(0,lD.default)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]),lL={references:{color:"#60a5fa",label:"References",icon:"→"},extends:{color:"#34d399",label:"Extends",icon:"⊃"},contradicts:{color:"#f87171",label:"Contradicts",icon:"⊗"},related:{color:"#a78bfa",label:"Related",icon:"~"}},lR=["architecture","pattern","preference","error","context","learning","todo","note","relationship","custom"];function lF({memory:e,links:t=[],memories:r=[],onClose:n,onReinforce:i,onSelectMemory:a,isReinforcing:s=!1,reinforceSuccess:l=!1}){let[o,c]=(0,H.useState)(!1),[d,u]=(0,H.useState)(!1),[h,p]=(0,H.useState)(null),[m,f]=(0,H.useState)(!1),[x,y]=(0,H.useState)(e.title),[g,v]=(0,H.useState)(e.content),[b,j]=(0,H.useState)(e.category),[w,N]=(0,H.useState)((e.tags||[]).join(", ")),[k,S]=(0,H.useState)(!1),O=(0,st.useEditMemory)(),P=(0,st.useDeleteMemory)(),[C,A]=(0,H.useState)(e.id);C!==e.id&&(A(e.id),f(!1),S(!1),y(e.title),v(e.content),j(e.category),N((e.tags||[]).join(", "))),(0,H.useEffect)(()=>{if(l&&h===e.id){let e=setTimeout(()=>c(!0),0),t=setTimeout(()=>c(!1),1500);return()=>{clearTimeout(e),clearTimeout(t)}}},[l,h,e.id]);let E=(0,l_.calculateDecayFactor)(e),M=(0,sy.getCategoryColor)(e.category),T=(0,sy.getTypeColor)(e.type),_=E>.7?{label:"Healthy",color:"#22C55E",bgColor:"rgba(34, 197, 94, 0.15)"}:E>.4?{label:"Fading",color:"#EAB308",bgColor:"rgba(234, 179, 8, 0.15)"}:{label:"Critical",color:"#EF4444",bgColor:"rgba(239, 68, 68, 0.15)"},D=(0,H.useMemo)(()=>{let n=[];for(let i of t)if(i.source_id===e.id){let e=r.find(e=>e.id===i.target_id);e&&n.push({memory:e,relationship:i.relationship,strength:i.strength,direction:"to"})}else if(i.target_id===e.id){let e=r.find(e=>e.id===i.source_id);e&&n.push({memory:e,relationship:i.relationship,strength:i.strength,direction:"from"})}return n.sort((e,t)=>t.strength-e.strength)},[e.id,t,r]),I=e=>{let t=new Date(e),r=Math.floor((new Date().getTime()-t.getTime())/36e5);if(r<1)return"Just now";if(r<24)return`${r}h ago`;let n=Math.floor(r/24);return n<7?`${n}d ago`:`${Math.floor(n/7)}w ago`},z="canonical"===e.status?"Canonical":"archived"===e.status?"Archived":"suppressed"===e.status?"Suppressed":e.pinned?"Pinned and active":"Active";return(0,W.jsxs)(lg,{className:`bg-slate-900 border-slate-700 overflow-auto transition-all duration-300 ${o?"ring-2 ring-green-500 ring-opacity-75":""} ${d?"ring-2 ring-emerald-500 ring-opacity-75":""}`,children:[(0,W.jsxs)(lv,{className:"border-b border-slate-700 pb-3",children:[(0,W.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[m?(0,W.jsx)(lT,{value:x,onChange:e=>y(e.target.value),className:"bg-slate-800 border-slate-600 text-white text-lg font-semibold"}):(0,W.jsxs)(lb,{className:"text-lg font-semibold text-white leading-tight flex items-center gap-2",children:[d&&(0,W.jsx)(lz,{className:"w-4 h-4 text-emerald-400 shrink-0"}),e.title]}),(0,W.jsxs)("div",{className:"flex items-center gap-1 shrink-0 -mt-1",children:[!m&&(0,W.jsx)(lM,{variant:"ghost",size:"sm",onClick:()=>f(!0),className:"text-slate-400 hover:text-white",title:"Edit memory",children:(0,W.jsx)(lI,{className:"w-4 h-4"})}),(0,W.jsx)(lM,{variant:"ghost",size:"sm",onClick:n,className:"text-slate-400 hover:text-white",children:"✕"})]})]}),(0,W.jsxs)("div",{className:"flex items-center gap-2 mt-2",children:[m?(0,W.jsx)("select",{value:b,onChange:e=>j(e.target.value),className:"bg-slate-800 border border-slate-600 text-white text-xs rounded-lg px-2 py-1",children:lR.map(e=>(0,W.jsx)("option",{value:e,children:e},e))}):(0,W.jsx)("span",{className:"px-2 py-0.5 rounded text-xs font-medium",style:{backgroundColor:M+"20",color:M},children:e.category}),(0,W.jsx)("span",{className:"px-2 py-0.5 rounded text-xs font-medium",style:{backgroundColor:T+"20",color:T},children:e.type.replace("_","-")})]})]}),(0,W.jsxs)(lj,{className:"p-4 space-y-4",children:[(0,W.jsxs)("div",{children:[(0,W.jsx)("h4",{className:"text-xs font-medium text-slate-400 mb-1",children:"Content"}),m?(0,W.jsx)("textarea",{value:g,onChange:e=>v(e.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,W.jsx)("p",{className:"text-sm text-slate-200 whitespace-pre-wrap leading-relaxed",children:e.content})]}),m&&(0,W.jsxs)("div",{children:[(0,W.jsx)("h4",{className:"text-xs font-medium text-slate-400 mb-1",children:"Tags (comma-separated)"}),(0,W.jsx)(lT,{value:w,onChange:e=>N(e.target.value),placeholder:"tag1, tag2, tag3",className:"bg-slate-800 border-slate-600 text-white text-sm"})]}),m?(0,W.jsxs)("div",{className:"flex gap-2",children:[(0,W.jsx)(lM,{variant:"default",size:"sm",onClick:()=>{let t=w.split(",").map(e=>e.trim()).filter(Boolean),r={};(x!==e.title&&(r.title=x),g!==e.content&&(r.content=g),b!==e.category&&(r.category=b),w!==(e.tags||[]).join(", ")&&(r.tags=t),0===Object.keys(r).length)?f(!1):O.mutate({id:e.id,updates:r},{onSuccess:()=>{f(!1),u(!0),setTimeout(()=>u(!1),1500)}})},disabled:O.isPending,className:"flex-1 bg-emerald-600 hover:bg-emerald-700",children:O.isPending?"Saving...":"Save Changes"}),(0,W.jsx)(lM,{variant:"outline",size:"sm",onClick:()=>{f(!1),y(e.title),v(e.content),j(e.category),N((e.tags||[]).join(", "))},className:"flex-1 border-slate-600 text-slate-300 hover:text-white",children:"Cancel"})]}):null,!m&&(0,W.jsxs)("div",{className:"rounded-lg p-3 flex items-center gap-3",style:{backgroundColor:_.bgColor},children:[(0,W.jsx)("div",{className:"w-3 h-3 rounded-full animate-pulse",style:{backgroundColor:_.color}}),(0,W.jsxs)("div",{children:[(0,W.jsx)("div",{className:"text-sm font-medium",style:{color:_.color},children:_.label}),(0,W.jsx)("div",{className:"text-xs text-slate-400",children:E>.7?"Memory is strong and stable":E>.4?"Memory is fading - reinforce to preserve":"Memory at risk of deletion - reinforce now"})]})]}),!m&&(0,W.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,W.jsxs)("div",{className:"bg-slate-800 rounded-lg p-3",children:[(0,W.jsx)("div",{className:"text-xs text-slate-400",children:"Salience"}),(0,W.jsxs)("div",{className:"text-lg font-bold text-white",children:[(100*e.salience).toFixed(0),"%"]}),(0,W.jsx)("div",{className:"mt-1 h-1.5 bg-slate-700 rounded-full overflow-hidden",children:(0,W.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*e.salience}%`}})})]}),(0,W.jsxs)("div",{className:"bg-slate-800 rounded-lg p-3",children:[(0,W.jsx)("div",{className:"text-xs text-slate-400",children:"Decay Factor"}),(0,W.jsxs)("div",{className:"text-lg font-bold text-white",children:[(100*E).toFixed(0),"%"]}),(0,W.jsx)("div",{className:"mt-1 h-1.5 bg-slate-700 rounded-full overflow-hidden",children:(0,W.jsx)("div",{className:"h-full rounded-full transition-all",style:{width:`${100*E}%`,backgroundColor:_.color}})})]})]}),!m&&(0,W.jsxs)("div",{className:`bg-slate-800 rounded-lg p-3 space-y-2 transition-all duration-300 ${o?"ring-1 ring-green-500/50":""}`,children:[(0,W.jsxs)("div",{className:"flex justify-between items-center",children:[(0,W.jsx)("span",{className:"text-xs text-slate-400",children:"Access Count"}),(0,W.jsxs)("span",{className:`text-sm font-medium transition-all duration-300 ${o?"text-green-400 scale-110":"text-white"}`,children:[e.accessCount," times"]})]}),(0,W.jsxs)("div",{className:"flex justify-between items-center",children:[(0,W.jsx)("span",{className:"text-xs text-slate-400",children:"Last Accessed"}),(0,W.jsx)("span",{className:`text-sm transition-all duration-300 ${o?"text-green-400":"text-white"}`,children:o?"Just now":I(e.lastAccessed)})]}),(0,W.jsxs)("div",{className:"flex justify-between items-center",children:[(0,W.jsx)("span",{className:"text-xs text-slate-400",children:"Created"}),(0,W.jsx)("span",{className:"text-sm text-white",children:new Date(e.createdAt).toLocaleString()})]})]}),!m&&(0,W.jsxs)("div",{className:"grid gap-3 md:grid-cols-1",children:[(0,W.jsxs)("div",{className:"rounded-lg bg-slate-800 p-3 space-y-2",children:[(0,W.jsx)("h4",{className:"text-xs font-medium uppercase tracking-[0.18em] text-slate-500",children:"Provenance"}),(0,W.jsxs)("div",{className:"flex justify-between gap-3 text-sm",children:[(0,W.jsx)("span",{className:"text-slate-400",children:"Source kind"}),(0,W.jsx)("span",{className:"text-white",children:e.sourceKind||"user"})]}),(0,W.jsxs)("div",{className:"flex justify-between gap-3 text-sm",children:[(0,W.jsx)("span",{className:"text-slate-400",children:"Capture"}),(0,W.jsx)("span",{className:"text-white",children:e.captureMethod||"manual"})]}),(0,W.jsxs)("div",{className:"flex justify-between gap-3 text-sm",children:[(0,W.jsx)("span",{className:"text-slate-400",children:"Trust"}),(0,W.jsx)("span",{className:"text-white",children:(e.trustScore??1).toFixed(2)})]}),(0,W.jsxs)("div",{className:"flex justify-between gap-3 text-sm",children:[(0,W.jsx)("span",{className:"text-slate-400",children:"Origin"}),(0,W.jsx)("span",{className:"truncate text-right text-slate-300",children:e.source||"user:direct"})]})]}),(0,W.jsxs)("div",{className:"rounded-lg bg-slate-800 p-3 space-y-2",children:[(0,W.jsx)("h4",{className:"text-xs font-medium uppercase tracking-[0.18em] text-slate-500",children:"Review state"}),(0,W.jsxs)("div",{className:"flex justify-between gap-3 text-sm",children:[(0,W.jsx)("span",{className:"text-slate-400",children:"Status"}),(0,W.jsx)("span",{className:"text-white",children:z})]}),(0,W.jsxs)("div",{className:"flex justify-between gap-3 text-sm",children:[(0,W.jsx)("span",{className:"text-slate-400",children:"Pinned"}),(0,W.jsx)("span",{className:"text-white",children:e.pinned?"Yes":"No"})]}),(0,W.jsxs)("div",{className:"flex justify-between gap-3 text-sm",children:[(0,W.jsx)("span",{className:"text-slate-400",children:"Reviewed"}),(0,W.jsx)("span",{className:"text-white",children:e.reviewedAt?`${I(e.reviewedAt)} by ${e.reviewedBy||"operator"}`:"Not reviewed"})]})]}),(0,W.jsxs)("div",{className:"rounded-lg bg-slate-800 p-3 space-y-2",children:[(0,W.jsx)("h4",{className:"text-xs font-medium uppercase tracking-[0.18em] text-slate-500",children:"Sync state"}),(0,W.jsxs)("div",{className:"flex justify-between gap-3 text-sm",children:[(0,W.jsx)("span",{className:"text-slate-400",children:"Scope"}),(0,W.jsx)("span",{className:"text-white",children:e.scope||"project"})]}),(0,W.jsxs)("div",{className:"flex justify-between gap-3 text-sm",children:[(0,W.jsx)("span",{className:"text-slate-400",children:"Cloud"}),(0,W.jsx)("span",{className:"text-white",children:e.cloudExcluded?"Excluded":"Eligible"})]}),(0,W.jsxs)("div",{className:"flex justify-between gap-3 text-sm",children:[(0,W.jsx)("span",{className:"text-slate-400",children:"Sensitivity"}),(0,W.jsx)("span",{className:"text-white",children:e.sensitivityLevel||"INTERNAL"})]})]})]}),!m&&D.length>0&&(0,W.jsxs)("div",{children:[(0,W.jsxs)("h4",{className:"text-xs font-medium text-slate-400 mb-2 flex items-center gap-2",children:[(0,W.jsx)("span",{className:"inline-block w-4 h-4",children:"🔗"}),"Related Memories (",D.length,")"]}),(0,W.jsx)("div",{className:"space-y-2 max-h-48 overflow-y-auto",children:D.map(({memory:e,relationship:t,strength:r,direction:n})=>{let i=lL[t]||lL.related,s=(0,sy.getCategoryColor)(e.category);return(0,W.jsxs)("button",{onClick:()=>a?.(e.id),className:"w-full text-left p-2 bg-slate-800 hover:bg-slate-750 rounded-lg transition-colors group",children:[(0,W.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,W.jsx)("span",{className:"w-1.5 h-1.5 rounded-full",style:{backgroundColor:i.color}}),(0,W.jsx)("span",{className:"text-[10px] font-medium",style:{color:i.color},children:"to"===n?`${i.icon} ${i.label}`:`${i.label} ${i.icon}`}),(0,W.jsxs)("span",{className:"text-[10px] text-slate-500 ml-auto",children:[(100*r).toFixed(0),"%"]})]}),(0,W.jsx)("div",{className:"text-sm text-white truncate group-hover:text-blue-400 transition-colors",children:e.title}),(0,W.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,W.jsx)("span",{className:"px-1.5 py-0.5 rounded text-[10px]",style:{backgroundColor:s+"20",color:s},children:e.category}),(0,W.jsxs)("span",{className:"text-[10px] text-slate-500",children:[(100*e.salience).toFixed(0),"% salience"]})]})]},`${e.id}-${n}`)})})]}),!m&&e.tags&&e.tags.length>0&&(0,W.jsxs)("div",{children:[(0,W.jsx)("h4",{className:"text-xs font-medium text-slate-400 mb-2",children:"Tags"}),(0,W.jsx)("div",{className:"flex flex-wrap gap-1",children:e.tags.map((e,t)=>(0,W.jsx)("span",{className:"px-2 py-0.5 bg-slate-700 text-slate-300 rounded text-xs",children:e},t))})]}),!m&&(0,W.jsxs)("div",{className:"space-y-2 pt-2",children:[i&&(0,W.jsx)(lM,{variant:"default",size:"sm",onClick:()=>{p(e.id),i?.(e.id)},disabled:s,className:`w-full transition-all duration-300 ${o?"bg-green-600 hover:bg-green-600":"bg-blue-600 hover:bg-blue-700"}`,children:s?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)("span",{className:"animate-spin mr-2",children:"⟳"}),"Reinforcing..."]}):o?(0,W.jsx)(W.Fragment,{children:"✓ Reinforced!"}):(0,W.jsx)(W.Fragment,{children:"⚡ Reinforce"})}),k?(0,W.jsxs)("div",{className:"bg-red-500/10 border border-red-500/30 rounded-lg p-3",children:[(0,W.jsx)("p",{className:"text-xs text-red-400 mb-2",children:"Delete this memory permanently?"}),(0,W.jsxs)("div",{className:"flex gap-2",children:[(0,W.jsx)(lM,{variant:"default",size:"sm",onClick:()=>{P.mutate(e.id,{onSuccess:()=>{n()}})},disabled:P.isPending,className:"flex-1 bg-red-600 hover:bg-red-700",children:P.isPending?"Deleting...":"Confirm Delete"}),(0,W.jsx)(lM,{variant:"outline",size:"sm",onClick:()=>S(!1),className:"flex-1 border-slate-600 text-slate-300 hover:text-white",children:"Cancel"})]})]}):(0,W.jsx)(lM,{variant:"ghost",size:"sm",onClick:()=>S(!0),className:"w-full text-slate-500 hover:text-red-400 hover:bg-red-500/10",children:"Delete Memory"})]})]})]})}let l$=Q.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";function lB(e){return new Date(e).toLocaleString()}function lU({memories:e,selectedMemory:t,onSelectMemory:r,links:n=[],onReinforce:i,onSelectMemoryById:a,isReinforcing:s=!1,reinforceSuccess:l=!1}){let[o,c]=(0,H.useState)("salience"),[d,u]=(0,H.useState)("grid"),[h,p]=(0,H.useState)(!1),[m,f]=(0,H.useState)(new Set),[x,y]=(0,H.useState)(!1),[g,v]=(0,H.useState)(null),b=(0,so.useQueryClient)(),{data:j}=(0,st.useOpenClawSessions)(),w=sx(),N=(0,H.useMemo)(()=>j?.sessions??[],[j?.sessions]);(0,H.useEffect)(()=>{N.length?g&&N.some(e=>e.sessionId===g)||v(N[0].sessionId):v(null)},[N,g]);let k=(0,H.useMemo)(()=>N.find(e=>e.sessionId===g)??N[0]??null,[N,g]),S=(0,H.useMemo)(()=>{let t=[...e];return t.sort((e,t)=>{switch(o){case"salience":return t.salience-e.salience;case"createdAt":return new Date(t.createdAt).getTime()-new Date(e.createdAt).getTime();case"lastAccessed":return new Date(t.lastAccessed).getTime()-new Date(e.lastAccessed).getTime();case"decayedScore":return(t.decayedScore??t.salience)-(e.decayedScore??e.salience);default:return 0}}),t},[e,o]),O=(0,H.useCallback)((e,t)=>{f(r=>{let n=new Set(r);return t?n.add(e):n.delete(e),n})},[]),P=async()=>{if(0!==m.size){y(!0);try{await Promise.all(Array.from(m).map(e=>(0,sa.authFetch)(`${l$}/api/memories/${e}`,{method:"DELETE"}))),f(new Set),b.invalidateQueries({queryKey:["memories"]})}finally{y(!1)}}},C=(0,H.useCallback)((e,n)=>{w.mutate({id:e.id,action:n,reviewedBy:"capture-session",project:e.project??null,scope:e.scope},{onSuccess:async n=>{t?.id===e.id&&r(n),await Promise.all([b.invalidateQueries({queryKey:["memories"]}),b.invalidateQueries({queryKey:["openclaw-sessions"]}),b.invalidateQueries({queryKey:["review-queue"]})])}})},[r,b,w,t]);return(0,W.jsxs)("div",{className:"h-full overflow-y-auto bg-slate-950 pb-6",children:[(0,W.jsxs)("div",{className:"flex items-center gap-3 border-b border-slate-800 px-4 py-2",children:[(0,W.jsxs)("span",{className:"text-xs text-slate-400",children:[e.length," memories"]}),(0,W.jsx)("div",{className:"w-px h-5 bg-slate-700"}),(0,W.jsxs)("select",{value:o,onChange:e=>c(e.target.value),className:"bg-slate-800 border border-slate-700 text-white text-xs rounded px-2 py-1",children:[(0,W.jsx)("option",{value:"salience",children:"Salience"}),(0,W.jsx)("option",{value:"createdAt",children:"Created"}),(0,W.jsx)("option",{value:"lastAccessed",children:"Last Accessed"}),(0,W.jsx)("option",{value:"decayedScore",children:"Decay Score"})]}),(0,W.jsxs)("div",{className:"flex items-center border border-slate-700 rounded overflow-hidden",children:[(0,W.jsx)("button",{onClick:()=>u("grid"),className:`px-2 py-1 text-xs ${"grid"===d?"bg-slate-700 text-white":"text-slate-400 hover:text-white"}`,children:"Grid"}),(0,W.jsx)("button",{onClick:()=>u("list"),className:`px-2 py-1 text-xs ${"list"===d?"bg-slate-700 text-white":"text-slate-400 hover:text-white"}`,children:"List"})]}),(0,W.jsx)("div",{className:"w-px h-5 bg-slate-700"}),(0,W.jsx)("button",{onClick:()=>{p(!h),f(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,W.jsxs)(W.Fragment,{children:[(0,W.jsx)("button",{onClick:()=>f(new Set(S.map(e=>e.id))),className:"px-2 py-1 text-xs text-slate-400 hover:text-white",children:"Select all"}),(0,W.jsx)("button",{onClick:P,disabled:0===m.size||x,className:"px-2 py-1 text-xs rounded bg-red-600/20 text-red-400 hover:bg-red-600/40 disabled:opacity-40",children:x?"Deleting...":`Delete (${m.size})`})]})]}),(0,W.jsx)("div",{className:"px-4 pt-4",children:(0,W.jsxs)("div",{className:"rounded-2xl border border-slate-800 bg-slate-900/60 p-5",children:[(0,W.jsxs)("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-end lg:justify-between",children:[(0,W.jsxs)("div",{children:[(0,W.jsx)("div",{className:"inline-flex items-center gap-2 rounded-full border border-cyan-500/20 bg-cyan-500/10 px-3 py-1 text-xs uppercase tracking-[0.18em] text-cyan-300",children:"Capture Workflow"}),(0,W.jsx)("h2",{className:"mt-3 text-2xl font-semibold text-white",children:"See what was captured, from where, and how risky it looks."}),(0,W.jsx)("p",{className:"mt-2 max-w-2xl text-sm text-slate-400",children:"Capture is where stored memories, OpenClaw sessions, and source trust come together. Use it to inspect what got saved before it quietly shapes recall."})]}),(0,W.jsxs)("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[(0,W.jsxs)("div",{className:"rounded-xl border border-slate-800 bg-slate-950/70 p-4",children:[(0,W.jsx)("div",{className:"text-xs uppercase tracking-[0.18em] text-slate-500",children:"Memories"}),(0,W.jsx)("div",{className:"mt-2 text-2xl font-semibold text-white",children:e.length})]}),(0,W.jsxs)("div",{className:"rounded-xl border border-slate-800 bg-slate-950/70 p-4",children:[(0,W.jsx)("div",{className:"text-xs uppercase tracking-[0.18em] text-slate-500",children:"OpenClaw sessions"}),(0,W.jsx)("div",{className:"mt-2 text-2xl font-semibold text-white",children:j?.summary.sessions??0})]}),(0,W.jsxs)("div",{className:"rounded-xl border border-slate-800 bg-slate-950/70 p-4",children:[(0,W.jsx)("div",{className:"text-xs uppercase tracking-[0.18em] text-slate-500",children:"Auto-saved"}),(0,W.jsx)("div",{className:"mt-2 text-2xl font-semibold text-white",children:j?.summary.saved??0})]}),(0,W.jsxs)("div",{className:"rounded-xl border border-slate-800 bg-slate-950/70 p-4",children:[(0,W.jsx)("div",{className:"text-xs uppercase tracking-[0.18em] text-slate-500",children:"Threats"}),(0,W.jsx)("div",{className:"mt-2 text-2xl font-semibold text-white",children:j?.summary.threats??0})]})]})]}),(0,W.jsxs)("div",{className:"mt-6 grid gap-4 xl:grid-cols-[minmax(340px,0.8fr)_minmax(0,1.2fr)]",children:[(0,W.jsxs)("div",{className:"rounded-xl border border-slate-800 bg-slate-950/60 p-4",children:[(0,W.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,W.jsx)("div",{className:"text-xs uppercase tracking-[0.18em] text-slate-500",children:"OpenClaw sessions"}),(0,W.jsxs)("div",{className:"text-xs text-slate-500",children:[N.length," recent"]})]}),(0,W.jsxs)("div",{className:"mt-4 space-y-3",children:[N.slice(0,8).map(e=>(0,W.jsxs)("button",{onClick:()=>v(e.sessionId),className:`block w-full rounded-xl border p-4 text-left transition-colors ${k?.sessionId===e.sessionId?"border-cyan-400/40 bg-cyan-500/10":"border-slate-800 bg-slate-900/70 hover:border-slate-700"}`,children:[(0,W.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,W.jsxs)("div",{children:[(0,W.jsx)("div",{className:"text-sm font-medium text-white",children:e.sessionId}),(0,W.jsxs)("div",{className:"mt-1 text-xs text-slate-500",children:[e.models[0]||"model unknown"," · ",function(e){let t=Math.floor((Date.now()-new Date(e).getTime())/6e4);if(t<1)return"just now";if(t<60)return`${t}m ago`;let r=Math.floor(t/60);if(r<24)return`${r}h ago`;let n=Math.floor(r/24);return`${n}d ago`}(e.lastSeenAt)]})]}),(0,W.jsxs)("div",{className:"rounded-lg bg-slate-800 px-3 py-2 text-right",children:[(0,W.jsx)("div",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:"Saved"}),(0,W.jsx)("div",{className:"text-base font-semibold text-white",children:e.saved})]})]}),(0,W.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2 text-xs",children:[(0,W.jsxs)("span",{className:"rounded-full border border-slate-700 px-2 py-1 text-slate-300",children:[e.skipped," skipped"]}),(0,W.jsxs)("span",{className:`rounded-full border px-2 py-1 ${e.threats>0?"border-red-500/40 text-red-300":"border-emerald-500/40 text-emerald-300"}`,children:[e.threats," threat",1===e.threats?"":"s"]}),e.quarantined>0&&(0,W.jsxs)("span",{className:"rounded-full border border-amber-500/40 px-2 py-1 text-amber-300",children:[e.quarantined," quarantined"]}),e.hooks.map(e=>(0,W.jsx)("span",{className:"rounded-full border border-slate-700 px-2 py-1 text-slate-300",children:e},e))]})]},e.sessionId)),!j?.sessions?.length&&(0,W.jsx)("div",{className:"text-sm text-slate-400",children:"No recent OpenClaw session evidence found."})]})]}),(0,W.jsxs)("div",{className:"rounded-xl border border-slate-800 bg-slate-950/60 p-4",children:[(0,W.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,W.jsxs)("div",{children:[(0,W.jsx)("div",{className:"text-xs uppercase tracking-[0.18em] text-slate-500",children:"Session View"}),(0,W.jsx)("div",{className:"mt-1 text-lg font-semibold text-white",children:k?`OpenClaw session ${k.sessionId}`:"Select a session"})]}),k&&(0,W.jsxs)("div",{className:"text-right text-xs text-slate-500",children:[(0,W.jsxs)("div",{children:["First seen ",lB(k.firstSeenAt)]}),(0,W.jsxs)("div",{children:["Last seen ",lB(k.lastSeenAt)]})]})]}),k?(0,W.jsxs)("div",{className:"mt-4 space-y-4",children:[(0,W.jsxs)("div",{className:"grid gap-3 md:grid-cols-3 xl:grid-cols-6",children:[(0,W.jsxs)("div",{className:"rounded-xl border border-slate-800 bg-slate-900/70 p-4",children:[(0,W.jsx)("div",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:"Saved"}),(0,W.jsx)("div",{className:"mt-2 text-xl font-semibold text-white",children:k.saved})]}),(0,W.jsxs)("div",{className:"rounded-xl border border-slate-800 bg-slate-900/70 p-4",children:[(0,W.jsx)("div",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:"Skipped"}),(0,W.jsx)("div",{className:"mt-2 text-xl font-semibold text-white",children:k.skipped})]}),(0,W.jsxs)("div",{className:"rounded-xl border border-slate-800 bg-slate-900/70 p-4",children:[(0,W.jsx)("div",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:"Threats"}),(0,W.jsx)("div",{className:"mt-2 text-xl font-semibold text-white",children:k.threats})]}),(0,W.jsxs)("div",{className:"rounded-xl border border-slate-800 bg-slate-900/70 p-4",children:[(0,W.jsx)("div",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:"Auto"}),(0,W.jsx)("div",{className:"mt-2 text-xl font-semibold text-white",children:k.autoExtracted})]}),(0,W.jsxs)("div",{className:"rounded-xl border border-slate-800 bg-slate-900/70 p-4",children:[(0,W.jsx)("div",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:"Keyword"}),(0,W.jsx)("div",{className:"mt-2 text-xl font-semibold text-white",children:k.keywordTriggered})]}),(0,W.jsxs)("div",{className:"rounded-xl border border-slate-800 bg-slate-900/70 p-4",children:[(0,W.jsx)("div",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:"Suppressed"}),(0,W.jsx)("div",{className:"mt-2 text-xl font-semibold text-white",children:k.suppressed})]})]}),(0,W.jsxs)("div",{className:"grid gap-4 xl:grid-cols-[minmax(0,1.1fr)_minmax(320px,0.9fr)]",children:[(0,W.jsxs)("div",{className:"rounded-xl border border-slate-800 bg-slate-900/70 p-4",children:[(0,W.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,W.jsxs)("div",{children:[(0,W.jsx)("div",{className:"text-xs uppercase tracking-[0.18em] text-slate-500",children:"Session recap"}),(0,W.jsx)("div",{className:"mt-1 text-sm text-slate-300",children:"Review the exact memories this session created and decide what should stay hot."})]}),(0,W.jsxs)("div",{className:"text-right text-xs text-slate-500",children:[(0,W.jsx)("div",{children:k.models.join(", ")||"model unknown"}),(0,W.jsx)("div",{children:k.agentIds.join(", ")||"agent unknown"})]})]}),(0,W.jsx)("div",{className:"mt-4 space-y-3",children:k.memories.length>0?k.memories.map(e=>{let t;return(0,W.jsxs)("div",{className:"rounded-xl border border-slate-800 bg-slate-950/60 p-4",children:[(0,W.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,W.jsxs)("div",{className:"min-w-0",children:[(0,W.jsx)("button",{onClick:()=>r(e),className:"text-left text-base font-medium text-white hover:text-cyan-300",children:e.title}),(0,W.jsxs)("div",{className:"mt-1 text-xs text-slate-500",children:[e.category," · ",e.captureMethod||"manual"," · trust ",(e.trustScore??1).toFixed(2)]}),(0,W.jsx)("div",{className:"mt-2 flex flex-wrap gap-2",children:((t=[e.pinned?{label:"Pinned",tone:"emerald"}:null,"canonical"===e.status?{label:"Canonical",tone:"emerald"}:null,"suppressed"===e.status?{label:"Suppressed",tone:"amber"}:null,"archived"===e.status?{label:"Archived",tone:"slate"}:null,e.cloudExcluded?{label:"Cloud excluded",tone:"cyan"}:null,"global"===e.scope?{label:"Global",tone:"violet"}:null].filter(Boolean)).length>0?t:[{label:"Ready for recall",tone:"slate"}]).map(e=>(0,W.jsx)("span",{className:`rounded-full border px-2.5 py-1 text-[11px] ${{emerald:"border-emerald-500/30 bg-emerald-500/10 text-emerald-200",amber:"border-amber-500/30 bg-amber-500/10 text-amber-200",slate:"border-slate-700 bg-slate-800/80 text-slate-300",cyan:"border-cyan-500/30 bg-cyan-500/10 text-cyan-200",violet:"border-violet-500/30 bg-violet-500/10 text-violet-200"}[e.tone]}`,children:e.label},e.label))}),(0,W.jsx)("div",{className:"mt-2 line-clamp-2 text-sm text-slate-400",children:e.content})]}),(0,W.jsxs)("div",{className:"rounded-lg bg-slate-800 px-3 py-2 text-right",children:[(0,W.jsx)("div",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:"Next move"}),(0,W.jsx)("div",{className:"text-sm text-slate-100",children:"canonical"===e.status?"Keep hot":"suppressed"===e.status?"Restore or leave suppressed":"archived"===e.status?"Restore or leave archived":"Review or keep"})]})]}),(0,W.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2",children:[(0,W.jsx)("button",{onClick:()=>r(e),className:"rounded-lg border border-slate-700 px-3 py-1 text-xs text-slate-300 hover:border-slate-500",children:"Inspect"}),(0,W.jsx)("button",{disabled:w.isPending,onClick:()=>C(e,e.pinned?"unpin":"pin"),className:"rounded-lg border border-slate-700 px-3 py-1 text-xs text-slate-300 hover:border-slate-500 disabled:opacity-50",children:e.pinned?"Unpin":"Pin"}),(0,W.jsx)("button",{disabled:w.isPending,onClick:()=>C(e,"suppressed"===e.status?"restore":"suppress"),className:"rounded-lg border border-amber-500/40 px-3 py-1 text-xs text-amber-300 hover:bg-amber-500/10 disabled:opacity-50",children:"suppressed"===e.status?"Restore":"Discard"}),(0,W.jsx)("button",{disabled:w.isPending,onClick:()=>C(e,"archived"===e.status?"restore":"archive"),className:"rounded-lg border border-slate-700 px-3 py-1 text-xs text-slate-300 hover:border-slate-500 disabled:opacity-50",children:"archived"===e.status?"Restore":"Archive"}),(0,W.jsx)("button",{disabled:w.isPending,onClick:()=>C(e,"canonicalize"),className:"rounded-lg border border-emerald-500/40 px-3 py-1 text-xs text-emerald-300 hover:bg-emerald-500/10 disabled:opacity-50",children:"Keep as canonical"})]})]},e.id)}):(0,W.jsx)("div",{className:"text-sm text-slate-400",children:"No stored memories were linked back to this session."})})]}),(0,W.jsxs)("div",{className:"space-y-4",children:[(0,W.jsxs)("div",{className:"rounded-xl border border-slate-800 bg-slate-900/70 p-4",children:[(0,W.jsx)("div",{className:"text-xs uppercase tracking-[0.18em] text-slate-500",children:"Security cues"}),(0,W.jsxs)("div",{className:"mt-4 space-y-3 text-sm text-slate-400",children:[(0,W.jsxs)("div",{className:"rounded-xl border border-slate-800 bg-slate-950/60 p-4",children:["Threats: ",k.threats," · blocked hints: ",k.blocked," · quarantine hints: ",k.quarantined]}),(0,W.jsx)("div",{className:"rounded-xl border border-slate-800 bg-slate-950/60 p-4",children:"Low-trust or noisy auto-extracted memories belong in Review before they influence recall too much."}),(0,W.jsx)("div",{className:"rounded-xl border border-slate-800 bg-slate-950/60 p-4",children:"Shield remains the place to inspect blocked/quarantined operations and policy pressure across sources."})]})]}),(0,W.jsxs)("div",{className:"rounded-xl border border-slate-800 bg-slate-900/70 p-4",children:[(0,W.jsx)("div",{className:"text-xs uppercase tracking-[0.18em] text-slate-500",children:"Event trail"}),(0,W.jsxs)("div",{className:"mt-4 space-y-3",children:[k.events.slice(0,8).map((e,t)=>(0,W.jsxs)("div",{className:"rounded-xl border border-slate-800 bg-slate-950/60 p-3",children:[(0,W.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,W.jsx)("div",{className:"text-sm font-medium text-white",children:"memory"===e.type?"Memory capture":"quarantine"===e.type?"Quarantine pressure":"blocked"===e.type?"Blocked signal":"Threat signal"}),(0,W.jsx)("div",{className:"text-xs text-slate-500",children:lB(e.ts)})]}),(0,W.jsx)("div",{className:"mt-1 text-xs text-slate-500",children:[e.hook,e.model].filter(Boolean).join(" · ")||"OpenClaw event"}),"number"==typeof e.count&&(0,W.jsxs)("div",{className:"mt-2 text-xs text-slate-400",children:["saved ",e.count,"number"==typeof e.skipped?` \xb7 skipped ${e.skipped}`:""]}),e.preview&&(0,W.jsx)("div",{className:"mt-2 line-clamp-3 text-xs text-slate-400",children:e.preview})]},`${e.ts}-${e.type}-${t}`)),!k.events.length&&(0,W.jsx)("div",{className:"text-sm text-slate-400",children:"No event trail was found for this session."})]})]})]})]})]}):(0,W.jsx)("div",{className:"mt-6 text-sm text-slate-400",children:"Choose a session to inspect what OpenClaw learned, skipped, or tripped over."})]})]})]})}),(0,W.jsxs)("div",{className:"p-4",children:[(0,W.jsxs)("div",{className:"mb-3 flex items-center justify-between gap-3",children:[(0,W.jsxs)("div",{children:[(0,W.jsx)("div",{className:"text-xs uppercase tracking-[0.18em] text-slate-500",children:"Captured memories"}),(0,W.jsx)("div",{className:"mt-1 text-sm text-slate-400",children:"Inspect the actual memory records that came out of capture, not just the session summary."})]}),(0,W.jsxs)("div",{className:"text-xs text-slate-500",children:[S.length," record",1===S.length?"":"s"]})]}),(0,W.jsxs)("div",{className:t?"grid gap-4 xl:grid-cols-[minmax(0,1fr)_420px] xl:items-start":"",children:[(0,W.jsx)("div",{className:"grid"===d?"grid grid-cols-1 gap-3 md:grid-cols-2 2xl:grid-cols-3":"flex max-w-2xl flex-col gap-3",children:S.map(e=>(0,W.jsx)(sv,{memory:e,isSelected:t?.id===e.id,onSelect:r,isChecked:h?m.has(e.id):void 0,onCheck:h?O:void 0},e.id))}),t&&(0,W.jsx)("div",{className:"xl:sticky xl:top-4 xl:self-start",children:(0,W.jsxs)("div",{className:"rounded-xl border border-cyan-500/20 bg-slate-900/50",children:[(0,W.jsxs)("div",{className:"border-b border-slate-800 px-4 py-3",children:[(0,W.jsx)("div",{className:"text-[10px] uppercase tracking-[0.18em] text-cyan-300",children:"Selected memory"}),(0,W.jsx)("div",{className:"mt-1 text-sm text-slate-400",children:"Inspect the selected memory while you move through captured records. Clicking another card updates this panel in place."})]}),(0,W.jsx)("div",{className:"xl:max-h-[calc(100vh-8rem)] xl:overflow-y-auto",children:(0,W.jsx)(lF,{memory:t,links:n,memories:e,onClose:()=>r(null),onReinforce:i,onSelectMemory:a,isReinforcing:s,reinforceSuccess:l})})]})})]})]})]})}var lq=e.i(87353);let lV=Q.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";async function lK(){let e=await (0,sa.authFetch)(`${lV}/api/license/status`);if(!e.ok)throw Error("Failed to fetch license status");return e.json()}async function lW(e){let t=await (0,sa.authFetch)(`${lV}/api/license/activate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:e})});if(!t.ok)throw Error((await t.json().catch(()=>({error:"Activation failed"}))).error||"Activation failed");return t.json()}async function lH(){let e=await (0,sa.authFetch)(`${lV}/api/license/deactivate`,{method:"POST"});if(!e.ok)throw Error("Failed to deactivate license");return e.json()}function lQ(){return(0,si.useQuery)({queryKey:["license-status"],queryFn:lK,refetchInterval:6e4,retry:2})}let lY=Q.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";function lX({data:e,color:t="#22d3ee",width:r=24,height:n=10}){if(!e||0===e.length)return null;if(1===e.length)return(0,W.jsx)("svg",{width:r,height:n,viewBox:`0 0 ${r} ${n}`,children:(0,W.jsx)("circle",{cx:r/2,cy:n/2,r:1,fill:t,opacity:.6})});let i=Math.max(...e,1),a=r-2,s=n-2,l=e.map((t,r)=>{let n=1+r/(e.length-1)*a;return`${n.toFixed(1)},${(1+s-t/i*s).toFixed(1)}`}).join(" ");return(0,W.jsx)("svg",{width:r,height:n,viewBox:`0 0 ${r} ${n}`,className:"shrink-0",children:(0,W.jsx)("polyline",{points:l,fill:"none",stroke:t,strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",opacity:.6})})}let lG=(0,lD.default)("layout-dashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]),lZ=(0,lD.default)("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"}]]),lJ=(0,lD.default)("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"}]]),l0=(0,lD.default)("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"}]]),l1=(0,lD.default)("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"}]]);var l2=e.i(61737);let l5=(0,lD.default)("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"}]]),l4=(0,lD.default)("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"}]]),l3=(0,lD.default)("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"}]]),l6=(0,lD.default)("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"}]]),l8=(0,lD.default)("clock",[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);var l7=e.i(6847);let l9=(0,lD.default)("inbox",[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]]),oe=(0,lD.default)("cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]),ot=[{id:"overview",label:"Home",icon:lG},{id:"recall",label:"Recall",icon:l7.Search},{id:"review",label:"Review",icon:l9},{id:"shield",label:"Shield",icon:lZ},{id:"graph",label:"Graph",icon:l5},{id:"cloud",label:"Cloud",icon:oe},{id:"audit",label:"Audit",icon:lJ},{id:"memories",label:"Capture",icon:l1},{id:"quarantine",label:"Queue",icon:l0},{id:"agents",label:"Agents",icon:l4},{id:"skills",label:"Skills",icon:l3},{id:"dome",label:"Dome",icon:l6},{id:"timeline",label:"Timeline",icon:l8},{id:"brain",label:"Brain",icon:l2.Brain}],or=new Set(["shield","audit","skills","dome"]);function on(){let{viewMode:e,setViewMode:t}=(0,sr.useDashboardStore)(),{data:r}=(0,st.useStats)(),{data:n}=(0,lq.useAuditStats)("24h"),{data:i}=(0,st.useVersion)(),{data:a}=lQ(),{memoryTrend:s,threatTrend:l}=function(){let{data:e}=(0,si.useQuery)({queryKey:["activity-trend"],queryFn:async()=>{let e=await (0,sa.authFetch)(`${lY}/api/memories/activity`);if(!e.ok)throw Error("Failed to fetch activity");return e.json()},staleTime:3e5,refetchInterval:3e5}),t=new Date;t.setDate(t.getDate()-7);let r=t.toISOString(),{data:n}=(0,si.useQuery)({queryKey:["threat-trend"],queryFn:async()=>{let e=new URLSearchParams({firewallResult:"BLOCK",startTime:r,limit:"500"}),t=await (0,sa.authFetch)(`${lY}/api/v1/audit?${e}`);if(!t.ok)throw Error("Failed to fetch audit logs");return t.json()},staleTime:3e5,refetchInterval:3e5}),i=[];for(let e=6;e>=0;e--){let t=new Date;t.setDate(t.getDate()-e),i.push(t.toISOString().slice(0,10))}let a=new Map;if(e?.activity)for(let t of e.activity)a.set(t.date,t.count);let s=i.map(e=>a.get(e)??0),l=new Map;if(n?.logs)for(let e of n.logs){let t=e.timestamp.slice(0,10);l.set(t,(l.get(t)??0)+1)}return{memoryTrend:s,threatTrend:i.map(e=>l.get(e)??0)}}(),o=!a||"free"===a.tier,c=r?.decayDistribution?Math.round(r.decayDistribution.healthy/Math.max(1,r.total)*100):null,d=n?.blockedCount??0;return(0,W.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,W.jsx)("div",{className:"flex-1 flex flex-col items-center gap-1",children:ot.map(({id:r,label:n,icon:i})=>{let a="memories"===r?s:"shield"===r?l:null,c="shield"===r?"#f87171":"#22d3ee",u=a&&a.some(e=>e>0);return(0,W.jsxs)("button",{onClick:()=>t(r),className:`relative w-10 rounded-lg flex flex-col items-center justify-center gap-0.5 transition-colors ${u?"h-12":"h-10"} ${e===r?"dome"===r?"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:n,children:[(0,W.jsx)(i,{size:18}),u&&(0,W.jsx)(lX,{data:a,color:c,width:24,height:10}),(0,W.jsx)("span",{className:"text-[9px] leading-none",children:n}),"shield"===r&&d>0&&(0,W.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:d>99?"99+":d}),o&&or.has(r)&&(0,W.jsx)("span",{className:"absolute -bottom-0.5 -left-0.5 px-1 h-[12px] rounded-full bg-cyan-600/80 text-white text-[7px] font-bold flex items-center justify-center leading-none",children:"PRO"})]},r)})}),(0,W.jsxs)("div",{className:"flex flex-col items-center gap-1 text-[10px] text-slate-500",children:[r&&(0,W.jsx)("span",{children:r.total}),null!==c&&(0,W.jsxs)("span",{children:[c,"%"]}),i?.version&&(0,W.jsxs)("span",{children:["v",i.version]})]})]})}var oi=e.i(51069);let oa=(0,lD.default)("sliders-horizontal",[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]]),os=(0,lD.default)("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"}]]),ol=(0,lD.default)("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"}]]),oo=(0,lD.default)("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"}]]),oc=(0,lD.default)("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),od=[{key:"trust",label:"Trust",icon:lZ,color:"text-blue-400",bg:"bg-blue-400/10"},{key:"firewall",label:"Firewall",icon:os,color:"text-orange-400",bg:"bg-orange-400/10"},{key:"sensitivity",label:"Sensitivity",icon:ol,color:"text-purple-400",bg:"bg-purple-400/10"},{key:"fragmentation",label:"Fragment",icon:oo,color:"text-cyan-400",bg:"bg-cyan-400/10"},{key:"audit",label:"Audit",icon:lJ,color:"text-green-400",bg:"bg-green-400/10"}],ou={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 oh({timeRange:e}){let{projectFilter:t}=(0,sr.useDashboardStore)(),{data:r,isLoading:n,isError:i}=(0,lq.useAuditStats)(e,t||void 0),{data:a}=(0,lq.useDefenceConfig)(),s=(0,lq.useSetDefenceMode)(),[l,o]=(0,H.useState)(!1),c=(0,H.useRef)(null),d=a?.mode??"balanced",u=ou[d];return(0,H.useEffect)(()=>{function e(e){c.current&&!c.current.contains(e.target)&&o(!1)}return l&&document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[l]),(0,W.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[a?.tampered&&(0,W.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,W.jsx)(l0,{size:14,className:"text-red-400 shrink-0"}),(0,W.jsx)("span",{className:"text-xs text-red-400",children:"Config integrity check failed — running in strict mode"})]}),(0,W.jsx)("h3",{className:"text-sm font-medium text-slate-300 mb-4",children:"Defence Pipeline"}),(0,W.jsx)("div",{className:"flex items-center gap-1 mb-4",children:od.map(({key:e,label:t,icon:r,color:n,bg:i},a)=>(0,W.jsxs)("div",{className:"flex items-center",children:[(0,W.jsxs)("div",{className:`flex items-center gap-1.5 px-3 py-2 rounded-lg ${i}`,children:[(0,W.jsx)(r,{size:14,className:n}),(0,W.jsx)("span",{className:`text-xs font-medium ${n}`,children:t})]}),a<od.length-1&&(0,W.jsx)("div",{className:"w-4 h-px bg-slate-700 mx-0.5"})]},e))}),n?(0,W.jsx)("div",{className:"text-xs text-slate-500 animate-pulse",children:"Loading stats..."}):i?(0,W.jsx)("div",{className:"text-xs text-red-400",children:"Failed to load stats"}):r?(0,W.jsxs)("div",{className:"grid grid-cols-3 gap-3",children:[(0,W.jsxs)("div",{className:"text-center",children:[(0,W.jsx)("div",{className:"text-2xl font-bold text-green-400",children:r.allowedCount}),(0,W.jsx)("div",{className:"text-[10px] text-slate-500 uppercase",children:"Allowed"})]}),(0,W.jsxs)("div",{className:"text-center",children:[(0,W.jsx)("div",{className:"text-2xl font-bold text-red-400",children:r.blockedCount}),(0,W.jsx)("div",{className:"text-[10px] text-slate-500 uppercase",children:"Blocked"})]}),(0,W.jsxs)("div",{className:"text-center",children:[(0,W.jsx)("div",{className:"text-2xl font-bold text-yellow-400",children:r.quarantinedCount}),(0,W.jsx)("div",{className:"text-[10px] text-slate-500 uppercase",children:"Quarantined"})]})]}):(0,W.jsx)("div",{className:"text-xs text-slate-500",children:"No data"}),(0,W.jsx)("button",{onClick:()=>sr.useDashboardStore.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,W.jsxs)("div",{className:"mt-2 pt-3 border-t border-slate-800 flex items-center justify-between",children:[(0,W.jsx)("span",{className:"text-xs text-slate-500",children:"Firewall Mode"}),(0,W.jsxs)("div",{className:"relative",ref:c,children:[(0,W.jsxs)("button",{onClick:()=>o(!l),className:`text-xs font-medium ${u.color} ${u.bg} px-2 py-0.5 rounded flex items-center gap-1 hover:opacity-80 transition-opacity`,children:[d,(0,W.jsx)(oc,{size:10})]}),l&&(0,W.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(e=>{let t=ou[e];return(0,W.jsxs)("button",{onClick:()=>{s.mutate(e),o(!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 ${e===d?t.color+" font-medium":"text-slate-400"}`,children:[e,e===d&&(0,W.jsx)("span",{className:"text-[10px]",children:"✓"})]},e)})})]})]})]})}function op(){let{setViewMode:e,projectFilter:t}=(0,sr.useDashboardStore)(),{data:r,isLoading:n,isError:i}=(0,lq.useQuarantine)("pending",3,t||void 0),a=r?.total??0,s=r?.items??[];return(0,W.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,W.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,W.jsx)("h3",{className:"text-sm font-medium text-slate-300",children:"Quarantine Queue"}),a>0&&(0,W.jsxs)("span",{className:"text-xs font-medium text-yellow-400 bg-yellow-400/10 px-2 py-0.5 rounded-full",children:[a," pending"]})]}),n?(0,W.jsx)("div",{className:"text-xs text-slate-500 animate-pulse",children:"Loading..."}):i?(0,W.jsx)("div",{className:"text-xs text-red-400",children:"Failed to load quarantine"}):0===s.length?(0,W.jsxs)("div",{className:"flex flex-col items-center py-6 text-slate-500",children:[(0,W.jsx)(l0,{size:24,className:"mb-2 text-slate-600"}),(0,W.jsx)("span",{className:"text-xs",children:"No items in quarantine"})]}):(0,W.jsx)("div",{className:"space-y-2",children:s.map(e=>{let t=(()=>{try{return JSON.parse(e.threat_indicators)}catch{return[]}})();return(0,W.jsxs)("div",{className:"bg-slate-800/50 border border-slate-700 rounded-lg p-3",children:[(0,W.jsxs)("div",{className:"flex items-start justify-between",children:[(0,W.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,W.jsx)("div",{className:"text-xs font-medium text-white truncate",children:e.title||"Untitled"}),(0,W.jsxs)("div",{className:"text-[10px] text-slate-500 mt-0.5",children:[e.source_type," · ",new Date(e.created_at).toLocaleTimeString()]})]}),(0,W.jsx)("span",{className:"text-[10px] text-red-400 bg-red-400/10 px-1.5 py-0.5 rounded shrink-0 ml-2",children:e.reason?.slice(0,30)||"Threat detected"})]}),t.length>0&&(0,W.jsx)("div",{className:"flex gap-1 mt-1.5 flex-wrap",children:t.slice(0,3).map((e,t)=>(0,W.jsx)("span",{className:"text-[9px] text-yellow-400 bg-yellow-400/10 px-1 py-0.5 rounded",children:e},t))})]},e.id)})}),a>0&&(0,W.jsxs)("button",{onClick:()=>e("quarantine"),className:"w-full mt-3 text-xs text-cyan-400 hover:text-cyan-300 transition-colors",children:["Review all ",a," items →"]})]})}function om({timeRange:e}){let{projectFilter:t}=(0,sr.useDashboardStore)(),r={"24h":24,"7d":168,"30d":720},[n,i]=(0,H.useState)(()=>Date.now());(0,H.useEffect)(()=>{i(Date.now())},[e]);let a=(0,H.useMemo)(()=>new Date(6e4*Math.floor((n-36e5*r[e])/6e4)).toISOString(),[n,e]),{data:s,isLoading:l,isError:o}=(0,lq.useAuditLogs)({startTime:a,project:t||void 0,limit:500}),c=(0,H.useMemo)(()=>{if(!s?.logs.length)return[];let t="24h"===e?36e5:"7d"===e?216e5:864e5,r="24h"===e?24:"7d"===e?28:30,i=Array.from({length:r},(e,i)=>({time:n-(r-1-i)*t,allowed:0,blocked:0,quarantined:0}));for(let e of s.logs){let a=Math.floor((new Date(e.timestamp).getTime()-(n-r*t))/t),s=Math.min(Math.max(a,0),r-1);a>=0&&a<=r&&("ALLOW"===e.firewall_result?i[s].allowed++:"BLOCK"===e.firewall_result?i[s].blocked++:"QUARANTINE"===e.firewall_result&&i[s].quarantined++)}return i},[s,e,n]),d=Math.max(1,...c.map(e=>e.allowed+e.blocked+e.quarantined));return(0,W.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,W.jsx)("h3",{className:"text-sm font-medium text-slate-300 mb-4",children:"Threat Timeline"}),l?(0,W.jsx)("div",{className:"h-32 flex items-center justify-center",children:(0,W.jsx)("div",{className:"text-xs text-slate-500 animate-pulse",children:"Loading timeline..."})}):o?(0,W.jsx)("div",{className:"h-32 flex items-center justify-center",children:(0,W.jsx)("div",{className:"text-xs text-red-400",children:"Failed to load timeline"})}):0===c.length?(0,W.jsx)("div",{className:"h-32 flex items-center justify-center",children:(0,W.jsx)("div",{className:"text-xs text-slate-500",children:"No audit data"})}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)("div",{className:"flex gap-px h-32",children:c.map((e,t)=>{let r=e.allowed+e.blocked+e.quarantined,n=r>0?e.blocked/r*100:0,i=r>0?e.quarantined/r*100:0;return(0,W.jsx)("div",{className:"flex-1 flex flex-col justify-end",title:`${new Date(e.time).toLocaleString()}: ${e.allowed} allowed, ${e.blocked} blocked, ${e.quarantined} quarantined`,children:(0,W.jsx)("div",{className:"w-full rounded-t-sm overflow-hidden",style:{height:`${Math.max(r/d*100,2*(r>0))}%`},children:(0,W.jsxs)("div",{className:"w-full h-full flex flex-col-reverse",children:[e.blocked>0&&(0,W.jsx)("div",{className:"bg-red-500",style:{height:`${n}%`}}),e.quarantined>0&&(0,W.jsx)("div",{className:"bg-yellow-500",style:{height:`${i}%`}}),(0,W.jsx)("div",{className:"bg-emerald-500/60 flex-1"})]})})},t)})}),(0,W.jsxs)("div",{className:"flex gap-4 mt-3 justify-center",children:[(0,W.jsxs)("div",{className:"flex items-center gap-1",children:[(0,W.jsx)("div",{className:"w-2 h-2 rounded-full bg-emerald-500/60"}),(0,W.jsx)("span",{className:"text-[10px] text-slate-500",children:"Allowed"})]}),(0,W.jsxs)("div",{className:"flex items-center gap-1",children:[(0,W.jsx)("div",{className:"w-2 h-2 rounded-full bg-red-500"}),(0,W.jsx)("span",{className:"text-[10px] text-slate-500",children:"Blocked"})]}),(0,W.jsxs)("div",{className:"flex items-center gap-1",children:[(0,W.jsx)("div",{className:"w-2 h-2 rounded-full bg-yellow-500"}),(0,W.jsx)("span",{className:"text-[10px] text-slate-500",children:"Quarantined"})]})]}),(0,W.jsx)("button",{onClick:()=>sr.useDashboardStore.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 of({timeRange:e}){let{projectFilter:t}=(0,sr.useDashboardStore)(),{data:r,isLoading:n,isError:i}=(0,lq.useAuditStats)(e,t||void 0);if(n)return(0,W.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,W.jsx)("h3",{className:"text-sm font-medium text-slate-300 mb-4",children:"Stats Summary"}),(0,W.jsx)("div",{className:"text-xs text-slate-500 animate-pulse",children:"Loading..."})]});if(i)return(0,W.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,W.jsx)("h3",{className:"text-sm font-medium text-slate-300 mb-4",children:"Stats Summary"}),(0,W.jsx)("div",{className:"text-xs text-red-400",children:"Failed to load stats"})]});if(!r)return(0,W.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,W.jsx)("h3",{className:"text-sm font-medium text-slate-300 mb-4",children:"Stats Summary"}),(0,W.jsx)("div",{className:"text-xs text-slate-500",children:"No data"})]});let a=r.totalOperations||1,s=(r.blockedCount/a*100).toFixed(1),l=Object.entries(r.threatBreakdown||{}).sort((e,t)=>t[1]-e[1]).slice(0,5);return(0,W.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,W.jsx)("h3",{className:"text-sm font-medium text-slate-300 mb-4",children:"Stats Summary"}),(0,W.jsxs)("div",{className:"grid grid-cols-2 gap-3 mb-4",children:[(0,W.jsxs)("div",{className:"bg-slate-800/50 rounded-lg p-3 text-center",children:[(0,W.jsx)("div",{className:"text-2xl font-bold text-white",children:r.totalOperations}),(0,W.jsx)("div",{className:"text-[10px] text-slate-500 uppercase",children:"Total Scans"})]}),(0,W.jsxs)("div",{className:"bg-slate-800/50 rounded-lg p-3 text-center",children:[(0,W.jsxs)("div",{className:`text-2xl font-bold ${parseFloat(s)>10?"text-red-400":"text-green-400"}`,children:[s,"%"]}),(0,W.jsx)("div",{className:"text-[10px] text-slate-500 uppercase",children:"Block Rate"})]})]}),r.topSources.length>0&&(0,W.jsxs)("div",{className:"mb-4",children:[(0,W.jsx)("div",{className:"text-[10px] text-slate-500 uppercase mb-2",children:"Top Sources"}),(0,W.jsx)("div",{className:"space-y-1",children:r.topSources.slice(0,3).map(e=>(0,W.jsxs)("div",{className:"flex items-center justify-between",children:[(0,W.jsx)("span",{className:"text-xs text-slate-400",children:e.source}),(0,W.jsx)("span",{className:"text-xs text-slate-500",children:e.count})]},e.source))})]}),l.length>0&&(0,W.jsxs)("div",{children:[(0,W.jsx)("div",{className:"text-[10px] text-slate-500 uppercase mb-2",children:"Threat Types"}),(0,W.jsx)("div",{className:"space-y-1",children:l.map(([e,t])=>(0,W.jsxs)("div",{className:"flex items-center justify-between",children:[(0,W.jsx)("span",{className:"text-xs text-slate-400",children:e}),(0,W.jsx)("span",{className:"text-xs font-medium text-red-400",children:t})]},e))})]}),(0,W.jsx)("button",{onClick:()=>sr.useDashboardStore.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 ox=Q.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";function oy(e){return e>70?"#22c55e":e>=40?"#eab308":"#ef4444"}function og({score:e,size:t=120,strokeWidth:r=8}){let n=(t-r)/2,i=2*Math.PI*n,a=i-e/100*i,s=oy(e);return(0,W.jsxs)("svg",{width:t,height:t,className:"transform -rotate-90",children:[(0,W.jsx)("circle",{cx:t/2,cy:t/2,r:n,fill:"none",stroke:"rgba(255,255,255,0.06)",strokeWidth:r}),(0,W.jsx)("circle",{cx:t/2,cy:t/2,r:n,fill:"none",stroke:s,strokeWidth:r,strokeLinecap:"round",strokeDasharray:i,strokeDashoffset:a,style:{transition:"stroke-dashoffset 0.6s ease"}})]})}function ov({component:e}){var t,r;return(0,W.jsxs)("div",{className:"group relative",children:[(0,W.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,W.jsx)("span",{className:"text-xs text-slate-400",children:e.label}),(0,W.jsx)("span",{className:"text-xs font-medium text-slate-300",children:e.score})]}),(0,W.jsx)("div",{className:`h-1.5 rounded-full ${(t=e.score)>70?"bg-green-500/20":t>=40?"bg-yellow-500/20":"bg-red-500/20"}`,children:(0,W.jsx)("div",{className:`h-full rounded-full ${(r=e.score)>70?"bg-green-500":r>=40?"bg-yellow-500":"bg-red-500"}`,style:{width:`${e.score}%`,transition:"width 0.6s ease"}})}),(0,W.jsx)("div",{className:"absolute bottom-full left-1/2 -translate-x-1/2 mb-2 px-2 py-1 rounded bg-slate-800 text-[10px] text-slate-300 whitespace-nowrap opacity-0 group-hover:opacity-100 pointer-events-none transition-opacity z-10 border border-white/10",children:e.detail})]})}function ob(){let[e,t]=(0,H.useState)(null),[r,n]=(0,H.useState)(!0),[i,a]=(0,H.useState)(!1),s=(0,H.useCallback)(async()=>{try{let e=await (0,sa.authFetch)(`${ox}/api/health-score`);if(!e.ok)throw Error("Failed to fetch health score");let r=await e.json();t(r),a(!1)}catch{a(!0)}finally{n(!1)}},[]);if((0,H.useEffect)(()=>{s();let e=setInterval(s,6e4);return()=>clearInterval(e)},[s]),r)return(0,W.jsxs)("div",{className:"bg-[#12121a] border border-white/10 rounded-xl p-5 w-[300px]",children:[(0,W.jsx)("h3",{className:"text-sm font-medium text-slate-300 mb-4",children:"Memory Health"}),(0,W.jsx)("div",{className:"text-xs text-slate-500 animate-pulse",children:"Loading..."})]});if(i||!e)return(0,W.jsxs)("div",{className:"bg-[#12121a] border border-white/10 rounded-xl p-5 w-[300px]",children:[(0,W.jsx)("h3",{className:"text-sm font-medium text-slate-300 mb-4",children:"Memory Health"}),(0,W.jsx)("div",{className:"text-xs text-red-400",children:"Failed to load health score"})]});let{overall:l,components:o}=e;return(0,W.jsxs)("div",{className:"bg-[#12121a] border border-white/10 rounded-xl p-5 w-[300px]",children:[(0,W.jsx)("h3",{className:"text-sm font-medium text-slate-300 mb-4",children:"Memory Health"}),(0,W.jsx)("div",{className:"flex justify-center mb-5",children:(0,W.jsxs)("div",{className:"relative",children:[(0,W.jsx)(og,{score:l}),(0,W.jsx)("div",{className:"absolute inset-0 flex items-center justify-center",children:(0,W.jsx)("span",{className:"text-3xl font-bold",style:{color:oy(l)},children:l})})]})}),(0,W.jsxs)("div",{className:"space-y-3",children:[(0,W.jsx)(ov,{component:o.freshness}),(0,W.jsx)(ov,{component:o.coverage}),(0,W.jsx)(ov,{component:o.consistency}),(0,W.jsx)(ov,{component:o.consolidation})]})]})}let oj=(0,lD.default)("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),ow=(0,lD.default)("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),oN=(0,lD.default)("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);var ok=e.i(17278);let oS=(0,lD.default)("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);function oO(){let{projectFilter:e}=(0,sr.useDashboardStore)(),{data:t}=(0,lq.useAuditStats)("30d",e||void 0),{data:r}=lQ(),[n,i]=(0,H.useState)("upsell"),[a,s]=(0,H.useState)(""),[l,o]=(0,H.useState)(null),[c,d]=(0,H.useState)(""),[u,h]=(0,H.useState)(!1);(0,H.useEffect)(()=>{let e=localStorage.getItem("shieldcortex_cloud_dismissed");if(e){let t=new Date(e);(Date.now()-t.getTime())/864e5<30&&i("hidden")}},[]),(0,H.useEffect)(()=>{(0,sa.authFetch)("http://localhost:3001/api/cloud/config").then(e=>e.json()).then(e=>{e.enabled&&e.apiKeySet&&i("hidden")}).catch(()=>{})},[]),(0,H.useEffect)(()=>{if("polling"!==n||!l)return;let e=setInterval(async()=>{try{let t=await fetch(`https://api.shieldcortex.ai/v1/auth/setup-status/${l}`),r=await t.json();"complete"===r.status&&r.api_key?(await (0,sa.authFetch)("http://localhost:3001/api/cloud/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cloudApiKey:r.api_key,cloudEnabled:!0,cloudBaseUrl:"https://api.shieldcortex.ai"})}),i("success"),clearInterval(e),setTimeout(()=>i("hidden"),5e3)):"expired"===r.status&&(d("Setup expired. Please try again."),i("upsell"),clearInterval(e))}catch{}},3e3);return()=>clearInterval(e)},[n,l]);let p=async e=>{if(e.preventDefault(),a&&!u){d(""),h(!0);try{let e=await fetch("https://api.shieldcortex.ai/v1/auth/cloud-setup",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:a})}),t=await e.json();t.setup_id?(o(t.setup_id),i("polling")):d(t.error||"Failed to start setup")}catch{d("Could not reach ShieldCortex Cloud. Check your connection.")}finally{h(!1)}}},m=()=>{localStorage.setItem("shieldcortex_cloud_dismissed",new Date().toISOString()),i("hidden")};if("hidden"===n)return null;let f=t?.blockedCount??0,x=t?.totalOperations??0,y=r?.tier??"free";return"team"!==y&&"enterprise"!==y&&"upsell"===n?(0,W.jsxs)("div",{className:"mt-4 bg-gradient-to-br from-slate-900 via-slate-900 to-violet-950/20 border border-violet-800/30 rounded-xl p-5 relative",children:[(0,W.jsx)("button",{onClick:m,className:"absolute top-3 right-3 text-slate-500 hover:text-slate-300 transition-colors",title:"Dismiss for 30 days",children:(0,W.jsx)(ok.X,{size:16})}),(0,W.jsxs)("div",{className:"space-y-3",children:[(0,W.jsxs)("div",{className:"flex items-center gap-2",children:[(0,W.jsx)(oe,{size:20,className:"text-violet-400"}),(0,W.jsx)("h3",{className:"text-sm font-semibold text-white",children:"Cloud Sync"}),(0,W.jsx)("span",{className:"text-[10px] font-semibold px-1.5 py-0.5 rounded text-violet-400 bg-violet-400/10",children:"Team"})]}),(0,W.jsx)("p",{className:"text-sm text-slate-300",children:f>0?`You've blocked ${f} threats locally. Upgrade to Team to sync across devices and give your team visibility.`:"Sync defence data across devices, share audit logs with your team, and get centralised alerts."}),(0,W.jsxs)("a",{href:"https://shieldcortex.ai/pricing",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 px-4 py-2 bg-violet-600 hover:bg-violet-500 rounded-lg text-sm font-medium text-white transition-colors",children:["Upgrade to Team",(0,W.jsx)(oS,{size:12})]})]})]}):(0,W.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"===n&&(0,W.jsx)("button",{onClick:m,className:"absolute top-3 right-3 text-slate-500 hover:text-slate-300 transition-colors",title:"Dismiss for 30 days",children:(0,W.jsx)(ok.X,{size:16})}),"upsell"===n&&(0,W.jsxs)("div",{className:"space-y-4",children:[(0,W.jsxs)("div",{className:"flex items-center gap-2",children:[(0,W.jsx)(oe,{size:20,className:"text-cyan-400"}),(0,W.jsx)("h3",{className:"text-sm font-semibold text-white",children:"ShieldCortex Cloud"})]}),(0,W.jsx)("p",{className:"text-sm text-slate-300",children:f>0?`You've blocked ${f} threats across ${x} scans — your team can't see them yet.`:"Sync your defence data to the cloud for team visibility, audit logs, and alerts."}),(0,W.jsxs)("form",{onSubmit:p,className:"flex gap-2",children:[(0,W.jsx)("input",{type:"email",placeholder:"Enter your email",value:a,onChange:e=>s(e.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,W.jsxs)("button",{type:"submit",disabled:u,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:[u?(0,W.jsx)(ow,{size:14,className:"animate-spin"}):(0,W.jsx)(oj,{size:14}),"Get Started"]})]}),c&&(0,W.jsx)("p",{className:"text-xs text-red-400",children:c}),(0,W.jsx)("p",{className:"text-[10px] text-slate-500",children:"Your Team licence includes cloud sync. Enter your email to connect."})]}),"polling"===n&&(0,W.jsxs)("div",{className:"flex items-center gap-3 py-2",children:[(0,W.jsx)(ow,{size:20,className:"text-cyan-400 animate-spin"}),(0,W.jsxs)("div",{children:[(0,W.jsx)("p",{className:"text-sm text-white font-medium",children:"Check your email"}),(0,W.jsx)("p",{className:"text-xs text-slate-400",children:"Click the link in your inbox to complete setup. We'll auto-configure everything."})]})]}),"success"===n&&(0,W.jsxs)("div",{className:"flex items-center gap-3 py-2",children:[(0,W.jsx)(oN,{size:20,className:"text-emerald-400"}),(0,W.jsxs)("div",{children:[(0,W.jsx)("p",{className:"text-sm text-white font-medium",children:"Connected to ShieldCortex Cloud"}),(0,W.jsx)("p",{className:"text-xs text-slate-400",children:"Your defence data will now sync automatically."})]})]})]})}let oP=(0,lD.default)("clock-3",[["path",{d:"M12 6v6h4",key:"135r8i"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]),oC=(0,lD.default)("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]),oA=(0,lD.default)("server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]),oE=[];function oM(){return(0,si.useQuery)({queryKey:["cloud-sync-status"],queryFn:async()=>{var e;let t,r,n,i,a=await (0,sa.authFetch)("http://localhost:3001/api/cloud/sync-status");if(!a.ok)throw Error(await (0,sa.readApiError)(a,"Failed to fetch sync status"));return t=(e=await a.json()).controls&&"object"==typeof e.controls?e.controls:{},n="byKind"in(r=e.queue&&"object"==typeof e.queue?e.queue:{})&&r.byKind&&"object"==typeof r.byKind?r.byKind:{},i=e=>({pending:Number(n[e]?.pending??0),failed:Number(n[e]?.failed??0),synced:Number(n[e]?.synced??0)}),{enabled:!!e.enabled,apiKeySet:!!e.apiKeySet,baseUrl:"string"==typeof e.baseUrl?e.baseUrl:"https://api.shieldcortex.ai",featureEnabled:!!e.featureEnabled,requiredTier:"pro"===e.requiredTier||"team"===e.requiredTier||"enterprise"===e.requiredTier?e.requiredTier:"free",controls:{projectMode:"projectMode"in t&&("include"===t.projectMode||"exclude"===t.projectMode)?t.projectMode:"all",projects:Array.isArray(t.projects)?t.projects.filter(e=>"string"==typeof e):oE,contentMode:"contentMode"in t&&"metadata"===t.contentMode?"metadata":"full",excludeSensitive:"excludeSensitive"in t&&!!t.excludeSensitive},lastSyncAt:"string"==typeof e.lastSyncAt||null===e.lastSyncAt?e.lastSyncAt??null:null,device:{id:e.device&&"object"==typeof e.device&&"id"in e.device&&"string"==typeof e.device.id?e.device.id:"unknown",name:e.device&&"object"==typeof e.device&&"name"in e.device&&"string"==typeof e.device.name?e.device.name:"Unknown device",platform:e.device&&"object"==typeof e.device&&"platform"in e.device&&"string"==typeof e.device.platform?e.device.platform:"unknown"},queue:{pending:Number(r.pending??0),failed:Number(r.failed??0),synced:Number(r.synced??0),byKind:{audit:i("audit"),quarantine:i("quarantine"),memory:i("memory"),graph:i("graph"),unknown:i("unknown")},oldestPendingAt:"string"==typeof r.oldestPendingAt||null===r.oldestPendingAt?r.oldestPendingAt??null:null,nextRetryAt:"string"==typeof r.nextRetryAt||null===r.nextRetryAt?r.nextRetryAt??null:null,lastError:"string"==typeof r.lastError||null===r.lastError?r.lastError??null:null,lastErrorKind:"audit"===r.lastErrorKind||"quarantine"===r.lastErrorKind||"memory"===r.lastErrorKind||"graph"===r.lastErrorKind||"unknown"===r.lastErrorKind?r.lastErrorKind:null,latestFailureAt:"string"==typeof r.latestFailureAt||null===r.latestFailureAt?r.latestFailureAt??null:null}}},refetchInterval:1e4})}function oT(e){let t=Math.max(0,Math.floor((Date.now()-new Date(e).getTime())/1e3));if(t<60)return`${t}s ago`;let r=Math.floor(t/60);if(r<60)return`${r}m ago`;let n=Math.floor(r/60);if(n<24)return`${n}h ago`;let i=Math.floor(n/24);return`${i}d ago`}function o_(e){let t=Math.max(0,Math.floor((new Date(e).getTime()-Date.now())/1e3));if(t<60)return`in ${t}s`;let r=Math.floor(t/60);if(r<60)return`in ${r}m`;let n=Math.floor(r/60);if(n<24)return`in ${n}h`;let i=Math.floor(n/24);return`in ${i}d`}function oD(){let{data:e,isLoading:t}=oM(),r=(0,sr.useDashboardStore)(e=>e.setViewMode);if(t||!e)return null;let{enabled:n,apiKeySet:i,lastSyncAt:a,queue:s,device:l}=e,o=s.byKind.memory,c=s.byKind.graph,d=o.pending+c.pending,u=o.failed+c.failed,h=s.byKind.audit.failed+s.byKind.quarantine.failed+s.byKind.unknown.failed,p="disabled",m="Cloud sync disabled",f="Enable cloud sync with a Team+ key to replicate memories.";if(n&&i){let e=!!a&&Date.now()-new Date(a).getTime()>864e5;d>0&&u>0?(p="warning",m="Cloud sync needs attention",f=s.lastError??"One or more sync jobs failed and need retry."):u>0?(p=e?"warning":"queued",m=e?"Cloud sync has unresolved failures":"Cloud sync healthy, with failed history",f=s.lastError?`${s.lastError}${s.latestFailureAt?` • last failure ${oT(s.latestFailureAt)}`:""}`:`${u} failed replication job${1===u?"":"s"} remain in history.`):d>0?(p="queued",m="Cloud sync queued",f=s.nextRetryAt?`Next retry ${o_(s.nextRetryAt)}`:"Waiting to flush queued sync jobs."):e?(p="warning",m="Cloud sync stale",f=a?`Last successful sync ${oT(a)}`:"No successful sync recorded yet."):(p="healthy",m="Cloud sync healthy",f=a?`Last successful sync ${oT(a)}`:"Connected and ready to sync.",h>0&&(f+=` Auxiliary audit/quarantine history: ${h} failed job${1===h?"":"s"}.`))}let x=function(e){switch(e){case"healthy":return{border:"border-emerald-500/20",bg:"bg-emerald-500/10",text:"text-emerald-300",icon:oN};case"queued":return{border:"border-amber-500/20",bg:"bg-amber-500/10",text:"text-amber-300",icon:oC};case"warning":return{border:"border-red-500/20",bg:"bg-red-500/10",text:"text-red-300",icon:l0};default:return{border:"border-slate-700",bg:"bg-slate-800/80",text:"text-slate-300",icon:oA}}}(p),y=x.icon;return(0,W.jsxs)("div",{className:`mb-4 rounded-xl border ${x.border} ${x.bg} p-4`,children:[(0,W.jsxs)("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between",children:[(0,W.jsxs)("div",{className:"min-w-0",children:[(0,W.jsxs)("div",{className:"flex items-center gap-2",children:[(0,W.jsx)(y,{size:16,className:x.text}),(0,W.jsx)("span",{className:`text-sm font-medium ${x.text}`,children:m})]}),(0,W.jsx)("p",{className:"mt-1 text-xs text-slate-400",children:f}),(0,W.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-2 text-[11px] text-slate-500",children:[(0,W.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full bg-slate-900/70 px-2 py-1",children:[(0,W.jsx)(oA,{size:11}),l.name]}),a&&(0,W.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full bg-slate-900/70 px-2 py-1",children:[(0,W.jsx)(oP,{size:11}),"Synced ",oT(a)]}),s.oldestPendingAt&&(0,W.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full bg-slate-900/70 px-2 py-1",children:["Oldest queued ",oT(s.oldestPendingAt)]})]})]}),(0,W.jsxs)("div",{className:"grid grid-cols-2 gap-2 text-xs sm:min-w-[260px]",children:[(0,W.jsxs)("div",{className:"rounded-lg border border-slate-800 bg-slate-950/70 p-3",children:[(0,W.jsx)("div",{className:"text-slate-500",children:"Memory queue"}),(0,W.jsx)("div",{className:"mt-1 text-lg font-semibold text-white",children:o.pending}),(0,W.jsx)("div",{className:"text-[11px] text-slate-500",children:"pending writes"})]}),(0,W.jsxs)("div",{className:"rounded-lg border border-slate-800 bg-slate-950/70 p-3",children:[(0,W.jsx)("div",{className:"text-slate-500",children:"Replication failures"}),(0,W.jsx)("div",{className:`mt-1 text-lg font-semibold ${u>0?"text-red-300":"text-white"}`,children:u}),(0,W.jsx)("div",{className:"text-[11px] text-slate-500",children:"memory + graph only"})]}),(0,W.jsxs)("div",{className:"rounded-lg border border-slate-800 bg-slate-950/70 p-3",children:[(0,W.jsx)("div",{className:"text-slate-500",children:"Replicated"}),(0,W.jsx)("div",{className:"mt-1 text-lg font-semibold text-white",children:o.synced}),(0,W.jsx)("div",{className:"text-[11px] text-slate-500",children:"memory sync jobs"})]}),(0,W.jsxs)("div",{className:"rounded-lg border border-slate-800 bg-slate-950/70 p-3",children:[(0,W.jsx)("div",{className:"text-slate-500",children:"Retrying next"}),(0,W.jsx)("div",{className:"mt-1 text-sm font-semibold text-white",children:s.nextRetryAt?o_(s.nextRetryAt):"Idle"}),(0,W.jsx)("div",{className:"text-[11px] text-slate-500",children:s.lastErrorKind?`${s.lastErrorKind} queue`:"no pending retry"})]})]})]}),(0,W.jsx)("div",{className:"mt-4 flex justify-end",children:(0,W.jsx)("button",{onClick:()=>r("cloud"),className:"rounded-lg border border-slate-700 bg-slate-950/70 px-3 py-2 text-xs font-medium text-slate-300 transition-colors hover:border-cyan-500/40 hover:text-white",children:"Open cloud diagnostics"})})]})}let oI=(0,lD.default)("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"}]]),oz=Q.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";async function oL(e){let t=await (0,sa.authFetch)(`${oz}/api/skills/scan-all`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({dir:e})});if(!t.ok)throw Error("Failed to scan skills");return t.json()}async function oR(e){let t=await (0,sa.authFetch)(`${oz}/api/skills/scan`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw Error("Failed to scan skill content");return t.json()}function oF(){return(0,sc.useMutation)({mutationFn:e=>oL(e)})}async function o$(e){let t=await (0,sa.authFetch)(`${oz}/api/skills/trust`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e})});if(!t.ok)throw Error("Failed to trust skill");return t.json()}async function oB(e){let t=await (0,sa.authFetch)(`${oz}/api/skills/trust`,{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e})});if(!t.ok)throw Error("Failed to untrust skill");return t.json()}async function oU(e){let t=await (0,sa.authFetch)(`${oz}/api/skills/file`,{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e})});if(!t.ok)throw Error((await t.json().catch(()=>({}))).error||"Failed to delete skill file");return t.json()}function oq(){let e=oF(),{setViewMode:t}=(0,sr.useDashboardStore)(),[r,n]=(0,H.useState)(null),i=r?r.files.filter(e=>e.safe).length:0,a=r?.threatCount??0;return(0,W.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,W.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,W.jsx)("h3",{className:"text-sm font-medium text-slate-300",children:"Skill Scanner"}),(0,W.jsxs)("button",{onClick:()=>{e.mutate(void 0,{onSuccess:e=>n(e)})},disabled:e.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:[e.isPending?(0,W.jsx)(ow,{size:12,className:"animate-spin"}):(0,W.jsx)(l3,{size:12}),"Scan All"]})]}),r?(0,W.jsxs)("div",{children:[(0,W.jsxs)("div",{className:"flex items-center gap-4 mb-3",children:[(0,W.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,W.jsx)(oN,{size:14,className:"text-green-400"}),(0,W.jsx)("span",{className:"text-sm font-medium text-green-400",children:i}),(0,W.jsx)("span",{className:"text-[10px] text-slate-500",children:"safe"})]}),a>0&&(0,W.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,W.jsx)(oI,{size:14,className:"text-red-400"}),(0,W.jsx)("span",{className:"text-sm font-medium text-red-400",children:a}),(0,W.jsx)("span",{className:"text-[10px] text-slate-500",children:"threats"})]}),(0,W.jsx)("span",{className:"text-[10px] text-slate-600",children:new Date(r.scannedAt).toLocaleTimeString()})]}),(0,W.jsxs)("button",{onClick:()=>t("skills"),className:"flex items-center gap-1 text-xs text-cyan-400 hover:text-cyan-300 transition-colors",children:["View all results",(0,W.jsx)(oj,{size:12})]})]}):e.isPending?(0,W.jsx)("div",{className:"flex items-center justify-center py-4",children:(0,W.jsx)(ow,{size:16,className:"text-cyan-400 animate-spin"})}):(0,W.jsxs)("div",{className:"text-center py-3",children:[(0,W.jsx)(l3,{size:20,className:"text-slate-600 mx-auto mb-1.5"}),(0,W.jsx)("p",{className:"text-[10px] text-slate-500",children:"Scan agent instruction files for threats"})]})]})}let oV=Q.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";async function oK(){let e=await (0,sa.authFetch)(`${oV}/api/iron-dome/status`);if(!e.ok)throw Error(await (0,sa.readApiError)(e,"Failed to fetch Iron Dome status"));return e.json()}async function oW(e){let t=await (0,sa.authFetch)(`${oV}/api/iron-dome/activate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({profile:e})});if(!t.ok)throw Error(await (0,sa.readApiError)(t,"Failed to activate Iron Dome"));return t.json()}async function oH(){let e=await (0,sa.authFetch)(`${oV}/api/iron-dome/deactivate`,{method:"POST"});if(!e.ok)throw Error(await (0,sa.readApiError)(e,"Failed to deactivate Iron Dome"));return e.json()}async function oQ(e){let t=await (0,sa.authFetch)(`${oV}/api/iron-dome/scan`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:e})});if(!t.ok)throw Error(await (0,sa.readApiError)(t,"Failed to scan text"));return t.json()}async function oY(){let e=await (0,sa.authFetch)(`${oV}/api/iron-dome/emergency-stop`,{method:"POST"});if(!e.ok)throw Error(await (0,sa.readApiError)(e,"Failed to trigger emergency stop"));return e.json()}async function oX(e){let t=await (0,sa.authFetch)(`${oV}/api/iron-dome/resume`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:e||"Resumed via dashboard"})});if(!t.ok)throw Error(await (0,sa.readApiError)(t,"Failed to resume operations"));return t.json()}async function oG(){let e=await (0,sa.authFetch)(`${oV}/api/control/status`);if(!e.ok)throw Error(await (0,sa.readApiError)(e,"Failed to fetch control status"));return e.json()}async function oZ(e){let t=new URLSearchParams;e&&t.set("limit",e.toString());let r=await (0,sa.authFetch)(`${oV}/api/iron-dome/audit?${t}`);if(!r.ok)throw Error(await (0,sa.readApiError)(r,"Failed to fetch Iron Dome audit"));return r.json()}function oJ(){return(0,si.useQuery)({queryKey:["iron-dome-status"],queryFn:oK,refetchInterval:3e4,retry:2})}function o0(e){return(0,si.useQuery)({queryKey:["iron-dome-audit",e],queryFn:()=>oZ(e),refetchInterval:3e4,retry:2})}function o1(){let e=(0,so.useQueryClient)();return(0,sc.useMutation)({mutationFn:oY,onSuccess:()=>{e.invalidateQueries({queryKey:["iron-dome-status"]}),e.invalidateQueries({queryKey:["iron-dome-audit"]}),e.invalidateQueries({queryKey:["control-status"]})}})}function o2(){let{data:e,isLoading:t}=oJ(),{data:r}=o0(100),n=e?.enabled??!1,i=e?.profile??"custom",a=r?.logs??[],s=a.filter(e=>e.reason?.includes("[iron-dome:")&&"BLOCK"===e.firewall_result).length,l=a.length;return(0,W.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,W.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,W.jsx)("h3",{className:"text-sm font-medium text-slate-300",children:"Iron Dome"}),(0,W.jsx)("span",{className:`text-[10px] font-medium px-2 py-0.5 rounded-full ${n?"bg-red-500/20 text-red-400 border border-red-500/30":"bg-slate-700/50 text-slate-500"}`,children:n?"ACTIVE":"INACTIVE"})]}),t?(0,W.jsx)("div",{className:"text-xs text-slate-500 animate-pulse",children:"Loading..."}):n?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)("div",{className:"text-xs text-slate-500 mb-3",children:["Profile: ",(0,W.jsx)("span",{className:"text-red-400 font-medium",children:i})]}),(0,W.jsxs)("div",{className:"grid grid-cols-2 gap-3 mb-3",children:[(0,W.jsxs)("div",{className:"bg-slate-800/50 rounded-lg p-2 text-center",children:[(0,W.jsx)("div",{className:"text-lg font-bold text-red-400",children:s}),(0,W.jsx)("div",{className:"text-[10px] text-slate-500 uppercase",children:"Blocks"})]}),(0,W.jsxs)("div",{className:"bg-slate-800/50 rounded-lg p-2 text-center",children:[(0,W.jsx)("div",{className:"text-lg font-bold text-slate-300",children:l}),(0,W.jsx)("div",{className:"text-[10px] text-slate-500 uppercase",children:"Events"})]})]})]}):(0,W.jsxs)("div",{className:"text-center py-3",children:[(0,W.jsx)(lZ,{size:20,className:"text-slate-600 mx-auto mb-1.5"}),(0,W.jsx)("p",{className:"text-[10px] text-slate-500",children:"Behaviour protection layer — not active"})]}),(0,W.jsx)("button",{onClick:()=>sr.useDashboardStore.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 o5=[],o4="http://localhost:3001";function o3(){return(0,si.useQuery)({queryKey:["cloud-config"],queryFn:async()=>{var e;let t,r,n=await (0,sa.authFetch)(`${o4}/api/cloud/config`);if(!n.ok)throw Error(await (0,sa.readApiError)(n,"Failed to fetch cloud config"));return t=(e=await n.json()).syncControls&&"object"==typeof e.syncControls?e.syncControls:{},r=e.openclawMemory&&"object"==typeof e.openclawMemory?e.openclawMemory:{},{enabled:!!e.enabled,apiKeySet:!!e.apiKeySet,baseUrl:"string"==typeof e.baseUrl?e.baseUrl:"https://api.shieldcortex.ai",syncControls:{projectMode:"projectMode"in t&&("include"===t.projectMode||"exclude"===t.projectMode)?t.projectMode:"all",projects:Array.isArray(t.projects)?t.projects.filter(e=>"string"==typeof e):o5,contentMode:"contentMode"in t&&"metadata"===t.contentMode?"metadata":"full",excludeSensitive:"excludeSensitive"in t&&!!t.excludeSensitive},openclawMemory:{autoMemory:"autoMemory"in r&&!!r.autoMemory,dedupe:"dedupe"in r&&!!r.dedupe,noveltyThreshold:"noveltyThreshold"in r&&"number"==typeof r.noveltyThreshold?r.noveltyThreshold:.88,maxRecent:"maxRecent"in r&&"number"==typeof r.maxRecent?r.maxRecent:300}}},refetchInterval:3e4})}function o6(){let e=(0,so.useQueryClient)();return(0,sc.useMutation)({mutationFn:async e=>{let t=await (0,sa.authFetch)(`${o4}/api/cloud/config`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw Error(await (0,sa.readApiError)(t,"Failed to update cloud config"));return t.json()},onSuccess:()=>{e.invalidateQueries({queryKey:["cloud-config"]}),e.invalidateQueries({queryKey:["cloud-sync-status"]})}})}function o8(e,t,r){return Math.max(t,Math.min(r,e))}function o7({initialAutoMemory:e,initialDedupe:t,initialNoveltyThreshold:r,initialMaxRecent:n}){let i=o6(),[a,s]=(0,H.useState)(e),[l,o]=(0,H.useState)(t),[c,d]=(0,H.useState)(String(r)),[u,h]=(0,H.useState)(String(n)),p=i.isPending;return(0,W.jsxs)("div",{className:"mt-4 space-y-3",children:[(0,W.jsxs)("div",{className:"flex items-center justify-between",children:[(0,W.jsx)("span",{className:"text-xs text-slate-400",children:"Auto-memory extraction"}),(0,W.jsx)("button",{type:"button",onClick:()=>s(!a),className:`h-6 w-11 rounded-full transition-colors ${a?"bg-cyan-500":"bg-slate-700"}`,children:(0,W.jsx)("span",{className:`block h-5 w-5 rounded-full bg-white transition-transform ${a?"translate-x-5":"translate-x-0.5"}`})})]}),(0,W.jsxs)("div",{className:"flex items-center justify-between",children:[(0,W.jsx)("span",{className:"text-xs text-slate-400",children:"Novelty dedupe"}),(0,W.jsx)("button",{type:"button",onClick:()=>o(!l),disabled:!a,className:`h-6 w-11 rounded-full transition-colors ${l&&a?"bg-emerald-500":"bg-slate-700"} ${!a?"opacity-50 cursor-not-allowed":""}`,children:(0,W.jsx)("span",{className:`block h-5 w-5 rounded-full bg-white transition-transform ${l&&a?"translate-x-5":"translate-x-0.5"}`})})]}),(0,W.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,W.jsxs)("div",{children:[(0,W.jsx)("label",{className:"block text-[11px] text-slate-500 mb-1",children:"Novelty threshold"}),(0,W.jsx)(lT,{type:"number",step:"0.01",min:.6,max:.99,value:c,disabled:!a||!l,onChange:e=>d(e.target.value),className:"h-8 text-xs bg-slate-800 border-slate-700"})]}),(0,W.jsxs)("div",{children:[(0,W.jsx)("label",{className:"block text-[11px] text-slate-500 mb-1",children:"Max recent records"}),(0,W.jsx)(lT,{type:"number",step:"1",min:50,max:1e3,value:u,disabled:!a||!l,onChange:e=>h(e.target.value),className:"h-8 text-xs bg-slate-800 border-slate-700"})]})]}),(0,W.jsxs)("div",{className:"flex items-center justify-between pt-1",children:[(0,W.jsx)("span",{className:"text-[11px] text-slate-500",children:"Default: dedupe on, threshold 0.88, max 300"}),(0,W.jsxs)(lM,{size:"sm",onClick:()=>{let e=o8(Number.parseFloat(c),.6,.99),t=Math.floor(o8(Number.parseInt(u,10),50,1e3));i.mutate({openclawAutoMemory:a,openclawAutoMemoryDedupe:l,openclawAutoMemoryNoveltyThreshold:Number.isFinite(e)?e:.88,openclawAutoMemoryMaxRecent:Number.isFinite(t)?t:300})},disabled:p,className:"h-8 text-xs bg-cyan-600 hover:bg-cyan-500 text-white",children:[p?(0,W.jsx)(ow,{size:12,className:"animate-spin"}):null,"Save"]})]})]})}function o9(){let{data:e,isLoading:t}=o3(),r=e?.openclawMemory,n=r?`${r.autoMemory}-${r.dedupe}-${r.noveltyThreshold}-${r.maxRecent}`:"default";return(0,W.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,W.jsx)("h3",{className:"text-sm font-medium text-slate-300",children:"OpenClaw Memory"}),(0,W.jsx)("p",{className:"text-xs text-slate-500 mt-1",children:"Configure how ShieldCortex complements native OpenClaw memory."}),(0,W.jsx)("p",{className:"text-[11px] text-slate-600 mt-1",children:"Changes apply on next OpenClaw gateway restart."}),t?(0,W.jsx)("div",{className:"text-xs text-slate-500 mt-4 animate-pulse",children:"Loading settings..."}):(0,W.jsx)(o7,{initialAutoMemory:r?.autoMemory??!1,initialDedupe:r?.dedupe??!0,initialNoveltyThreshold:r?.noveltyThreshold??.88,initialMaxRecent:r?.maxRecent??300},n)]})}let ce=(0,lD.default)("key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]);var ct=e.i(13808);let cr=(0,lD.default)("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"}]]),cn=(0,lD.default)("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]),ci="https://api.shieldcortex.ai",ca=Q.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001",cs={free:"Free",pro:"Pro",team:"Team",enterprise:"Enterprise"},cl={free:"text-slate-400",pro:"text-cyan-400",team:"text-violet-400",enterprise:"text-amber-400"},co={free:"bg-slate-400/10",pro:"bg-cyan-400/10",team:"bg-violet-400/10",enterprise:"bg-amber-400/10"},cc={pro:{label:"Pro",price:"£29/mo"},team:{label:"Team",price:"£99/mo"}},cd=["Custom injection patterns","Custom Iron Dome policies","Custom firewall rules","Audit export (JSON/CSV)","Skill scanner deep mode"];function cu(){let e,t,{data:r,isLoading:n}=lQ(),i=(e=(0,so.useQueryClient)(),(0,sc.useMutation)({mutationFn:e=>lW(e),onSuccess:()=>{e.invalidateQueries({queryKey:["license-status"]})}})),a=(t=(0,so.useQueryClient)(),(0,sc.useMutation)({mutationFn:lH,onSuccess:()=>{t.invalidateQueries({queryKey:["license-status"]})}})),s=function(){let e=(0,so.useQueryClient)(),[t,r]=(0,H.useState)("idle"),[n,i]=(0,H.useState)(null),[a,s]=(0,H.useState)(null),l=(0,H.useCallback)(async(e,t)=>{r("submitting"),i(null);try{let n=await fetch(`${ci}/v1/billing/quick-checkout`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:e,plan:t})}),i=await n.json();if(!n.ok||!i.checkout_url||!i.setup_id)throw Error(i.error||"Failed to create checkout session");s(i.setup_id),window.open(i.checkout_url,"_blank"),r("polling")}catch(e){i(e instanceof Error?e.message:"Checkout failed"),r("error")}},[]);return(0,H.useEffect)(()=>{if("polling"!==t||!a)return;let n=setInterval(async()=>{try{let t=await fetch(`${ci}/v1/billing/setup-status/${a}`),s=await t.json();if("complete"===s.status&&s.license_key){clearInterval(n),r("activating");try{if(!(await (0,sa.authFetch)(`${ca}/api/license/activate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:s.license_key})})).ok)throw Error("Local activation failed");e.invalidateQueries({queryKey:["license-status"]}),r("complete")}catch{i('Payment succeeded but local activation failed. Use "I Have a Key" to activate manually.'),r("error")}}else"expired"===s.status?(clearInterval(n),i("Setup expired. Please try again."),r("error")):"complete"!==s.status||s.license_key||(clearInterval(n),i("Licence key was already retrieved. Check your dashboard or try again."),r("error"))}catch{}},3e3),s=setTimeout(()=>{clearInterval(n),i('Checkout timed out. If you completed payment, use "I Have a Key" or contact support.'),r("error")},9e5);return()=>{clearInterval(n),clearTimeout(s)}},[t,a,e]),{state:t,error:n,startCheckout:l,reset:(0,H.useCallback)(()=>{r("idle"),i(null),s(null)},[])}}(),[l,o]=(0,H.useState)(""),[c,d]=(0,H.useState)("default"),[u,h]=(0,H.useState)(""),[p,m]=(0,H.useState)("pro"),[f,x]=(0,H.useState)(!1);if(n||!r)return(0,W.jsx)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4 mb-4",children:(0,W.jsxs)("div",{className:"flex items-center gap-2",children:[(0,W.jsx)(lZ,{size:16,className:"text-slate-500"}),(0,W.jsx)("span",{className:"text-xs text-slate-500 animate-pulse",children:"Loading licence..."})]})});let y=r.tier;if("free"===y)return(0,W.jsxs)("div",{className:"relative overflow-hidden rounded-xl mb-4 bg-gradient-to-br from-slate-900 via-slate-900 to-cyan-950/30 border border-cyan-700/30",children:[(0,W.jsx)("div",{className:"absolute top-0 right-0 w-32 h-32 bg-cyan-500/5 rounded-full blur-2xl -translate-y-1/2 translate-x-1/2"}),(0,W.jsxs)("div",{className:"relative p-5",children:[(0,W.jsxs)("div",{className:"flex items-start justify-between mb-4",children:[(0,W.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,W.jsx)("div",{className:"flex items-center justify-center w-8 h-8 rounded-lg bg-cyan-500/10 border border-cyan-500/20",children:(0,W.jsx)(ct.Sparkles,{size:16,className:"text-cyan-400"})}),(0,W.jsxs)("div",{children:[(0,W.jsx)("h3",{className:"text-sm font-semibold text-white",children:"Unlock Pro Features"}),(0,W.jsx)("p",{className:"text-[11px] text-slate-400 mt-0.5",children:"Your defence pipeline is fully active. Upgrade for advanced controls."})]})]}),(0,W.jsx)("span",{className:"text-[10px] font-medium px-2 py-0.5 rounded-full bg-slate-800 text-slate-400 border border-slate-700",children:"Free"})]}),(0,W.jsx)("div",{className:"grid grid-cols-2 gap-x-4 gap-y-1.5 mb-4",children:cd.map(e=>(0,W.jsxs)("div",{className:"flex items-center gap-1.5 text-xs",children:[(0,W.jsx)(cr,{size:10,className:"text-cyan-500/60 shrink-0"}),(0,W.jsx)("span",{className:"text-slate-400",children:e})]},e))}),"complete"===s.state?(0,W.jsxs)("div",{className:"flex items-center gap-2 p-3 bg-emerald-500/10 border border-emerald-500/20 rounded-lg",children:[(0,W.jsx)(oN,{size:16,className:"text-emerald-400 shrink-0"}),(0,W.jsx)("span",{className:"text-xs text-emerald-300",children:"Pro activated! Your dashboard is refreshing..."})]}):"polling"===s.state||"activating"===s.state?(0,W.jsxs)("div",{className:"space-y-3",children:[(0,W.jsxs)("div",{className:"flex items-center gap-2 p-3 bg-cyan-500/10 border border-cyan-500/20 rounded-lg",children:[(0,W.jsx)(ow,{size:14,className:"text-cyan-400 animate-spin shrink-0"}),(0,W.jsx)("span",{className:"text-xs text-cyan-300",children:"activating"===s.state?"Activating licence...":"Complete payment in the Stripe tab..."})]}),(0,W.jsx)("button",{onClick:()=>{s.reset(),d("default")},className:"text-[10px] text-slate-500 hover:text-slate-300 transition-colors",children:"Cancel"})]}):"checkout"===c?(0,W.jsxs)("div",{className:"space-y-3",children:[(0,W.jsxs)("div",{children:[(0,W.jsx)("label",{className:"text-[10px] text-slate-500 mb-1 block",children:"Email"}),(0,W.jsx)("input",{type:"email",placeholder:"you@company.com",value:u,onChange:e=>h(e.target.value),className:"w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white placeholder:text-slate-600 focus:outline-none focus:ring-1 focus:ring-cyan-500",autoFocus:!0})]}),(0,W.jsx)("div",{className:"flex gap-2",children:["pro","team"].map(e=>(0,W.jsxs)("button",{type:"button",onClick:()=>m(e),className:`flex-1 px-3 py-2 text-xs font-medium rounded-lg border transition-colors ${p===e?"bg-cyan-600/20 border-cyan-500/50 text-cyan-300":"bg-slate-800 border-slate-700 text-slate-400 hover:border-slate-600"}`,children:[cc[e].label," — ",cc[e].price]},e))}),(0,W.jsxs)("div",{className:"flex items-center gap-2",children:[(0,W.jsx)("button",{onClick:()=>s.startCheckout(u,p),disabled:"submitting"===s.state||!u.trim(),className:"flex-1 inline-flex items-center justify-center gap-1.5 px-4 py-2 text-xs font-medium bg-cyan-600 hover:bg-cyan-500 disabled:opacity-50 text-white rounded-lg transition-colors",children:"submitting"===s.state?(0,W.jsx)(ow,{size:12,className:"animate-spin"}):"Continue to Checkout"}),(0,W.jsx)("button",{onClick:()=>{d("default"),s.reset()},className:"px-3 py-2 text-xs text-slate-500 hover:text-slate-300 transition-colors",children:"Back"})]}),s.error&&(0,W.jsx)("p",{className:"text-xs text-red-400",children:s.error})]}):"activate"===c?(0,W.jsxs)("div",{className:"space-y-2",children:[(0,W.jsxs)("form",{onSubmit:e=>{e.preventDefault(),l.trim()&&i.mutate(l.trim(),{onSuccess:()=>{o(""),d("default")}})},className:"flex gap-2",children:[(0,W.jsx)("input",{type:"text",placeholder:"sc_pro_...",value:l,onChange:e=>o(e.target.value),className:"flex-1 bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white placeholder:text-slate-600 focus:outline-none focus:ring-1 focus:ring-cyan-500",autoFocus:!0}),(0,W.jsx)("button",{type:"submit",disabled:i.isPending||!l.trim(),className:"px-4 py-2 text-xs font-medium bg-cyan-600 hover:bg-cyan-500 disabled:opacity-50 text-white rounded-lg transition-colors",children:i.isPending?(0,W.jsx)(ow,{size:12,className:"animate-spin"}):"Activate"}),(0,W.jsx)("button",{type:"button",onClick:()=>{d("default"),o(""),i.reset()},className:"px-3 py-2 text-xs text-slate-500 hover:text-slate-300 transition-colors",children:"Back"})]}),i.isError&&(0,W.jsx)("p",{className:"text-xs text-red-400",children:i.error instanceof Error?i.error.message:"Activation failed"})]}):(0,W.jsxs)("div",{className:"space-y-3",children:[(0,W.jsxs)("div",{className:"flex items-center gap-3",children:[(0,W.jsx)("button",{onClick:()=>d("checkout"),className:"inline-flex items-center gap-1.5 px-4 py-2 text-xs font-medium bg-cyan-600 hover:bg-cyan-500 text-white rounded-lg transition-colors",children:"Upgrade to Pro"}),(0,W.jsxs)("button",{onClick:()=>d("activate"),className:"inline-flex items-center gap-1.5 px-4 py-2 text-xs font-medium bg-slate-800 hover:bg-slate-700 text-slate-300 rounded-lg transition-colors border border-slate-700",children:[(0,W.jsx)(ce,{size:12}),"I Have a Key"]})]}),s.error&&(0,W.jsxs)("div",{className:"space-y-2",children:[(0,W.jsx)("p",{className:"text-xs text-red-400",children:s.error}),(0,W.jsxs)("div",{className:"flex items-center gap-2",children:[(0,W.jsx)("button",{onClick:()=>{s.reset(),d("checkout")},className:"text-[10px] text-cyan-400 hover:text-cyan-300 transition-colors",children:"Try Again"}),(0,W.jsx)("span",{className:"text-[10px] text-slate-600",children:"·"}),(0,W.jsx)("button",{onClick:()=>{s.reset(),d("activate")},className:"text-[10px] text-slate-400 hover:text-slate-300 transition-colors",children:"I Have a Key"})]})]})]})]})]});let g=r.features.filter(e=>e.enabled).length,v=r.features.length;return(0,W.jsxs)("div",{className:"bg-slate-900 border border-cyan-800/40 rounded-xl p-4 mb-4",children:[(0,W.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,W.jsxs)("div",{className:"flex items-center gap-2",children:[(0,W.jsx)(lZ,{size:16,className:cl[y]}),(0,W.jsx)("h3",{className:"text-sm font-medium text-slate-300",children:"Licence"}),(0,W.jsx)("span",{className:`text-[10px] font-semibold px-1.5 py-0.5 rounded ${cl[y]} ${co[y]}`,children:cs[y]})]}),(0,W.jsxs)("span",{className:"text-[10px] text-slate-500",children:[g,"/",v," features"]})]}),(0,W.jsxs)("div",{className:"space-y-2 mb-3",children:[r.email&&(0,W.jsxs)("div",{className:"flex items-center justify-between text-xs",children:[(0,W.jsx)("span",{className:"text-slate-500",children:"Email"}),(0,W.jsx)("span",{className:"text-slate-300",children:r.email})]}),null!==r.daysUntilExpiry&&(0,W.jsxs)("div",{className:"flex items-center justify-between text-xs",children:[(0,W.jsx)("span",{className:"text-slate-500",children:"Expires"}),(0,W.jsx)("span",{className:r.daysUntilExpiry<=7?"text-yellow-400":"text-slate-300",children:r.daysUntilExpiry<=0?"Expired (grace period)":`${r.daysUntilExpiry} days`})]})]}),(0,W.jsxs)("button",{onClick:()=>x(!f),className:"flex items-center gap-1 text-[10px] text-slate-500 hover:text-slate-300 transition-colors mb-2",children:[f?(0,W.jsx)(cn,{size:12}):(0,W.jsx)(oc,{size:12}),f?"Hide features":"Show features"]}),f&&(0,W.jsx)("div",{className:"space-y-1.5 mb-3",children:r.features.map(e=>(0,W.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[e.enabled?(0,W.jsx)(oN,{size:12,className:"text-emerald-400 shrink-0"}):(0,W.jsx)(oI,{size:12,className:"text-slate-600 shrink-0"}),(0,W.jsx)("span",{className:e.enabled?"text-slate-300":"text-slate-600",children:e.description.split(".")[0]}),!e.enabled&&(0,W.jsx)("span",{className:`text-[9px] px-1 py-0.5 rounded ${cl[e.requiredTier]} ${co[e.requiredTier]}`,children:cs[e.requiredTier]})]},e.feature))}),(0,W.jsx)("button",{onClick:()=>{confirm(`Remove your ${cs[y]} licence key? You will lose access to paid features.`)&&a.mutate()},disabled:a.isPending,className:"text-[10px] text-slate-600 hover:text-red-400 transition-colors",children:"Deactivate"})]})}let ch=(0,lD.default)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),cp=(0,lD.default)("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"}]]),cm=(0,lD.default)("toggle-left",[["circle",{cx:"9",cy:"12",r:"3",key:"u3jwor"}],["rect",{width:"20",height:"14",x:"2",y:"5",rx:"7",key:"g7kal2"}]]),cf=(0,lD.default)("toggle-right",[["circle",{cx:"15",cy:"12",r:"3",key:"1afu0r"}],["rect",{width:"20",height:"14",x:"2",y:"5",rx:"7",key:"g7kal2"}]]);function cx({feature:e,children:t,label:r}){let{data:n}=lQ();if(!n)return(0,W.jsx)(W.Fragment,{children:t});let i=n.features.find(t=>t.feature===e);if(!i||i.enabled)return(0,W.jsx)(W.Fragment,{children:t});let a=i.requiredTier;return(0,W.jsxs)("div",{className:"relative",children:[(0,W.jsx)("div",{className:"pointer-events-none select-none opacity-30 blur-[2px]",children:t}),(0,W.jsxs)("div",{className:"absolute inset-0 flex flex-col items-center justify-center bg-slate-900/60 rounded-xl backdrop-blur-sm",children:[(0,W.jsx)(cr,{size:24,className:"text-slate-500 mb-2"}),(0,W.jsxs)("p",{className:"text-sm font-medium text-slate-300 mb-1",children:[cs[a]," Feature"]}),r&&(0,W.jsx)("p",{className:"text-xs text-slate-500 mb-3 text-center max-w-xs",children:r}),(0,W.jsxs)("a",{href:"https://shieldcortex.ai/pricing",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 px-4 py-2 text-xs bg-cyan-600 hover:bg-cyan-500 text-white rounded-lg transition-colors",children:["Upgrade to ",cs[a],(0,W.jsx)(oS,{size:10})]})]})]})}let cy=Q.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001",cg=[{id:1,name:"Block API key patterns",priority:1,condition_type:"regex",condition_value:"sk-[a-zA-Z0-9]{32,}",action:"block",enabled:!0},{id:2,name:"Quarantine code injection",priority:2,condition_type:"regex",condition_value:"eval\\(|Function\\(",action:"quarantine",enabled:!0},{id:3,name:"Allow internal docs",priority:10,condition_type:"source",condition_value:"agent:docs-helper",action:"allow",enabled:!1}],cv=[{id:1,name:"Internal tool abuse",category:"tool_misuse",severity:"high",regex:"execute_tool\\(.*?delete|drop|truncate",description:"Detects attempts to use internal tools for destructive operations.",enabled:!0},{id:2,name:"PII exfiltration",category:"data_leak",severity:"critical",regex:"(SSN|social.security|\\d{3}-\\d{2}-\\d{4})",description:"Catches social security number patterns in agent memory writes.",enabled:!0},{id:3,name:"Prompt override attempt",category:"injection",severity:"medium",regex:"ignore.*(previous|above|prior).*instructions",description:"Detects common prompt injection override phrases.",enabled:!0}],cb=[{id:1,name:"Strict Healthcare",description:"Blocks all PII patterns, requires approval for external actions, whitelists only HIPAA-compliant channels.",is_active:!0},{id:2,name:"Dev Sandbox",description:"Permissive mode for development. Allows all channels, logs but does not block. Ideal for testing.",is_active:!1}],cj=[{files:["SKILL.md","handler.js"],finding:"Skill declares read-only but handler writes to filesystem",severity:"high"},{files:["SKILL.md","config.json"],finding:"Config enables network access not mentioned in skill manifest",severity:"medium"},{files:["handler.js","utils.js"],finding:"Dynamic eval() used in utility imported by main handler",severity:"critical"}],cw={"File access":45,"Network calls":30,"Process exec":15,"Memory write":10},cN=["Restrict filesystem writes to a sandboxed directory","Add explicit network permission declarations to SKILL.md"];function ck(){let e,t,r,n,{data:i,isLoading:a,isLocked:s}={...e=(0,si.useQuery)({queryKey:["firewall-rules"],queryFn:()=>(0,sa.gatedFetch)(`${cy}/api/firewall-rules`).then(e=>{if(!e.ok)throw Error("Failed to fetch firewall rules");return e.json()}),retry:(e,t)=>!(t instanceof sa.FeatureLockedError)&&e<2,refetchInterval:3e4}),isLocked:e.error instanceof sa.FeatureLockedError},l=(t=(0,so.useQueryClient)(),(0,sc.useMutation)({mutationFn:e=>(0,sa.gatedFetch)(`${cy}/api/firewall-rules`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}).then(e=>e.ok?e.json():e.json().then(e=>{throw Error(e.error)})),onSuccess:()=>{t.invalidateQueries({queryKey:["firewall-rules"]})}})),o=(r=(0,so.useQueryClient)(),(0,sc.useMutation)({mutationFn:({id:e,...t})=>(0,sa.gatedFetch)(`${cy}/api/firewall-rules/${e}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}).then(e=>e.ok?e.json():e.json().then(e=>{throw Error(e.error)})),onSuccess:()=>{r.invalidateQueries({queryKey:["firewall-rules"]})}})),c=(n=(0,so.useQueryClient)(),(0,sc.useMutation)({mutationFn:e=>(0,sa.gatedFetch)(`${cy}/api/firewall-rules/${e}`,{method:"DELETE"}).then(e=>e.ok?e.json():e.json().then(e=>{throw Error(e.error)})),onSuccess:()=>{n.invalidateQueries({queryKey:["firewall-rules"]})}})),[d,u]=(0,H.useState)(!1),[h,p]=(0,H.useState)({name:"",priority:100,condition_type:"regex",condition_value:"",action:"block"}),m=i?.rules??[];return s?(0,W.jsx)(cS,{}):(0,W.jsxs)("div",{className:"space-y-3",children:[(0,W.jsxs)("div",{className:"flex items-center justify-between",children:[(0,W.jsxs)("div",{className:"flex items-center gap-2",children:[(0,W.jsx)(lZ,{size:16,className:"text-cyan-400"}),(0,W.jsx)("h3",{className:"text-sm font-medium text-slate-200",children:"Custom Firewall Rules"}),(0,W.jsxs)("span",{className:"text-xs text-slate-500",children:[m.length,"/25"]})]}),(0,W.jsxs)("button",{onClick:()=>u(!d),className:"flex items-center gap-1 px-2 py-1 text-xs bg-cyan-600/20 text-cyan-400 rounded hover:bg-cyan-600/30 transition-colors",children:[(0,W.jsx)(ch,{size:12})," Add Rule"]})]}),d&&(0,W.jsxs)("form",{onSubmit:e=>{e.preventDefault(),l.mutate(h,{onSuccess:()=>{u(!1),p({name:"",priority:100,condition_type:"regex",condition_value:"",action:"block"})}})},className:"p-3 bg-slate-800/50 rounded-lg space-y-2",children:[(0,W.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,W.jsx)("input",{value:h.name,onChange:e=>p(t=>({...t,name:e.target.value})),placeholder:"Rule name",required:!0,className:"px-2 py-1.5 text-xs bg-slate-900 border border-slate-700 rounded text-slate-200 placeholder:text-slate-600"}),(0,W.jsx)("input",{value:h.priority,onChange:e=>p(t=>({...t,priority:Number(e.target.value)})),type:"number",placeholder:"Priority",className:"px-2 py-1.5 text-xs bg-slate-900 border border-slate-700 rounded text-slate-200"})]}),(0,W.jsxs)("div",{className:"grid grid-cols-3 gap-2",children:[(0,W.jsxs)("select",{value:h.condition_type,onChange:e=>p(t=>({...t,condition_type:e.target.value})),className:"px-2 py-1.5 text-xs bg-slate-900 border border-slate-700 rounded text-slate-200",children:[(0,W.jsx)("option",{value:"regex",children:"Regex"}),(0,W.jsx)("option",{value:"source",children:"Source"}),(0,W.jsx)("option",{value:"keyword",children:"Keyword"})]}),(0,W.jsx)("input",{value:h.condition_value,onChange:e=>p(t=>({...t,condition_value:e.target.value})),placeholder:"Condition value",required:!0,className:"px-2 py-1.5 text-xs bg-slate-900 border border-slate-700 rounded text-slate-200 placeholder:text-slate-600"}),(0,W.jsxs)("select",{value:h.action,onChange:e=>p(t=>({...t,action:e.target.value})),className:"px-2 py-1.5 text-xs bg-slate-900 border border-slate-700 rounded text-slate-200",children:[(0,W.jsx)("option",{value:"block",children:"Block"}),(0,W.jsx)("option",{value:"quarantine",children:"Quarantine"}),(0,W.jsx)("option",{value:"allow",children:"Allow"})]})]}),(0,W.jsxs)("div",{className:"flex gap-2",children:[(0,W.jsx)("button",{type:"submit",disabled:l.isPending,className:"px-3 py-1 text-xs bg-cyan-600 text-white rounded hover:bg-cyan-500 disabled:opacity-50",children:l.isPending?"Creating...":"Create"}),(0,W.jsx)("button",{type:"button",onClick:()=>u(!1),className:"px-3 py-1 text-xs text-slate-400 hover:text-slate-200",children:"Cancel"})]}),l.error&&(0,W.jsx)("p",{className:"text-xs text-red-400",children:l.error.message})]}),a?(0,W.jsx)("div",{className:"text-xs text-slate-500 py-4 text-center",children:"Loading rules..."}):0===m.length?(0,W.jsx)("div",{className:"text-xs text-slate-500 py-4 text-center",children:'No custom rules yet. Click "Add Rule" to create one.'}):(0,W.jsx)("div",{className:"space-y-1",children:m.map(e=>(0,W.jsxs)("div",{className:"flex items-center gap-3 px-3 py-2 bg-slate-800/30 rounded text-xs",children:[(0,W.jsx)("span",{className:"text-slate-400 w-6 text-right",children:e.priority}),(0,W.jsx)("span",{className:"text-slate-200 flex-1",children:e.name}),(0,W.jsx)("code",{className:"text-slate-500 text-[10px] max-w-[120px] truncate",children:e.condition_value}),(0,W.jsx)("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-medium ${"block"===e.action?"bg-red-500/20 text-red-400":"quarantine"===e.action?"bg-yellow-500/20 text-yellow-400":"bg-green-500/20 text-green-400"}`,children:e.action}),(0,W.jsx)("button",{onClick:()=>o.mutate({id:e.id,enabled:+!e.enabled}),className:"text-slate-500 hover:text-slate-300",title:e.enabled?"Disable":"Enable",children:e.enabled?(0,W.jsx)(cf,{size:14,className:"text-cyan-400"}):(0,W.jsx)(cm,{size:14})}),(0,W.jsx)("button",{onClick:()=>c.mutate(e.id),className:"text-slate-500 hover:text-red-400",children:(0,W.jsx)(cp,{size:12})})]},e.id))})]})}function cS(){return(0,W.jsxs)("div",{className:"space-y-3",children:[(0,W.jsxs)("div",{className:"flex items-center gap-2",children:[(0,W.jsx)(lZ,{size:16,className:"text-cyan-400"}),(0,W.jsx)("h3",{className:"text-sm font-medium text-slate-200",children:"Custom Firewall Rules"}),(0,W.jsx)("span",{className:"text-xs text-slate-500",children:"0/25"})]}),(0,W.jsx)("div",{className:"space-y-1",children:cg.map(e=>(0,W.jsxs)("div",{className:"flex items-center gap-3 px-3 py-2 bg-slate-800/30 rounded text-xs",children:[(0,W.jsx)("span",{className:"text-slate-400 w-6 text-right",children:e.priority}),(0,W.jsx)("span",{className:"text-slate-200 flex-1",children:e.name}),(0,W.jsx)("code",{className:"text-slate-500 text-[10px] max-w-[120px] truncate",children:e.condition_value}),(0,W.jsx)("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-medium ${"block"===e.action?"bg-red-500/20 text-red-400":"quarantine"===e.action?"bg-yellow-500/20 text-yellow-400":"bg-green-500/20 text-green-400"}`,children:e.action})]},e.id))})]})}function cO(){return(0,W.jsx)("div",{className:"bg-slate-900/50 border border-slate-800 rounded-xl p-4",children:(0,W.jsx)(cx,{feature:"custom_firewall_rules",label:"Add custom rules to control what gets blocked, allowed, or quarantined.",children:(0,W.jsx)(ck,{})})})}function cP(){let[e,t]=(0,H.useState)("24h"),r=(0,sr.useDashboardStore)(e=>e.setViewMode);return(0,W.jsx)("div",{className:"h-full overflow-y-auto p-6",children:(0,W.jsxs)("div",{className:"mx-auto max-w-7xl space-y-6",children:[(0,W.jsx)("section",{className:"rounded-2xl border border-slate-800 bg-gradient-to-br from-slate-950 via-slate-900 to-cyan-950/15 p-6",children:(0,W.jsxs)("div",{className:"flex flex-col gap-5 lg:flex-row lg:items-end lg:justify-between",children:[(0,W.jsxs)("div",{className:"max-w-3xl",children:[(0,W.jsxs)("div",{className:"inline-flex items-center gap-2 rounded-full border border-cyan-500/20 bg-cyan-500/10 px-3 py-1 text-xs uppercase tracking-[0.18em] text-cyan-300",children:[(0,W.jsx)(oi.ShieldAlert,{size:12}),"Defence workspace"]}),(0,W.jsx)("h2",{className:"mt-4 text-3xl font-semibold text-white",children:"See what is being blocked, what needs review, and what needs tuning."}),(0,W.jsx)("p",{className:"mt-2 text-sm leading-6 text-slate-400",children:"Shield should help you answer three questions quickly: what is happening now, what needs a decision, and where should policy change next."})]}),(0,W.jsx)("div",{className:"flex gap-1 self-start rounded-lg bg-slate-800 p-0.5",children:["24h","7d","30d"].map(r=>(0,W.jsx)("button",{onClick:()=>t(r),className:`px-3 py-1 text-xs rounded-md transition-colors ${e===r?"bg-cyan-600 text-white":"text-slate-400 hover:text-white"}`,children:r},r))})]})}),(0,W.jsxs)("section",{className:"grid grid-cols-1 gap-6 xl:grid-cols-[1.05fr_0.95fr]",children:[(0,W.jsxs)("div",{className:"space-y-4",children:[(0,W.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,W.jsxs)("div",{className:"flex items-center gap-2 text-xs uppercase tracking-[0.18em] text-slate-500",children:[(0,W.jsx)(oi.ShieldAlert,{size:12}),"Act Now"]}),(0,W.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,W.jsx)("button",{onClick:()=>r("quarantine"),className:"rounded-full border border-amber-500/20 bg-amber-500/10 px-3 py-1 text-xs font-medium text-amber-200 transition-colors hover:bg-amber-500/15",children:"Review quarantine"}),(0,W.jsx)("button",{onClick:()=>r("audit"),className:"rounded-full border border-slate-700 bg-slate-900/70 px-3 py-1 text-xs font-medium text-slate-300 transition-colors hover:border-cyan-500/30 hover:text-white",children:"Open audit"})]})]}),(0,W.jsxs)("div",{className:"grid grid-cols-1 gap-4",children:[(0,W.jsx)(op,{}),(0,W.jsx)(om,{timeRange:e})]})]}),(0,W.jsxs)("div",{className:"space-y-4",children:[(0,W.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,W.jsxs)("div",{className:"flex items-center gap-2 text-xs uppercase tracking-[0.18em] text-slate-500",children:[(0,W.jsx)(oe,{size:12}),"System Status"]}),(0,W.jsx)("button",{onClick:()=>r("cloud"),className:"rounded-full border border-slate-700 bg-slate-900/70 px-3 py-1 text-xs font-medium text-slate-300 transition-colors hover:border-cyan-500/30 hover:text-white",children:"Open cloud"})]}),(0,W.jsxs)("div",{className:"grid grid-cols-1 gap-4",children:[(0,W.jsx)(oD,{}),(0,W.jsx)(cu,{})]})]})]}),(0,W.jsxs)("section",{className:"grid grid-cols-1 gap-6 xl:grid-cols-[1.05fr_0.95fr]",children:[(0,W.jsxs)("div",{className:"space-y-4",children:[(0,W.jsxs)("div",{className:"flex items-center gap-2 text-xs uppercase tracking-[0.18em] text-slate-500",children:[(0,W.jsx)(oa,{size:12}),"Tune Defence"]}),(0,W.jsxs)("div",{className:"grid grid-cols-1 gap-4",children:[(0,W.jsx)(oh,{timeRange:e}),(0,W.jsx)(of,{timeRange:e})]})]}),(0,W.jsxs)("div",{className:"space-y-4",children:[(0,W.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,W.jsxs)("div",{className:"flex items-center gap-2 text-xs uppercase tracking-[0.18em] text-slate-500",children:[(0,W.jsx)(l2.Brain,{size:12}),"Memory Pressure"]}),(0,W.jsx)("button",{onClick:()=>r("brain"),className:"rounded-full border border-slate-700 bg-slate-900/70 px-3 py-1 text-xs font-medium text-slate-300 transition-colors hover:border-cyan-500/30 hover:text-white",children:"Open brain"})]}),(0,W.jsxs)("div",{className:"space-y-4",children:[(0,W.jsx)(ob,{}),(0,W.jsx)(o9,{})]})]})]}),(0,W.jsxs)("section",{className:"grid grid-cols-1 gap-6 xl:grid-cols-[1fr_1fr]",children:[(0,W.jsxs)("details",{className:"group rounded-2xl border border-slate-800 bg-slate-900/60 p-5",children:[(0,W.jsxs)("summary",{className:"flex cursor-pointer list-none items-center justify-between",children:[(0,W.jsxs)("div",{children:[(0,W.jsx)("h3",{className:"text-lg font-semibold text-white",children:"Advanced review"}),(0,W.jsx)("p",{className:"mt-1 text-sm text-slate-400",children:"Use these when you are inspecting instructions, hardening policies, or debugging low-level behaviour."})]}),(0,W.jsx)("span",{className:"text-xs text-slate-400 group-open:text-cyan-300",children:"Expand"})]}),(0,W.jsxs)("div",{className:"mt-4 space-y-4",children:[(0,W.jsx)(oq,{}),(0,W.jsx)(o2,{})]})]}),(0,W.jsxs)("details",{className:"group rounded-2xl border border-slate-800 bg-slate-900/60 p-5",children:[(0,W.jsxs)("summary",{className:"flex cursor-pointer list-none items-center justify-between",children:[(0,W.jsxs)("div",{children:[(0,W.jsx)("h3",{className:"text-lg font-semibold text-white",children:"Policy controls"}),(0,W.jsx)("p",{className:"mt-1 text-sm text-slate-400",children:"Custom firewall rules are powerful, but they are not the first thing most operators need every day."})]}),(0,W.jsx)("span",{className:"text-xs text-slate-400 group-open:text-cyan-300",children:"Expand"})]}),(0,W.jsx)("div",{className:"mt-4",children:(0,W.jsx)(cO,{})})]})]}),(0,W.jsx)("div",{children:(0,W.jsx)(oO,{})})]})})}let cC=(0,lD.default)("key-round",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]);function cA(e){let t=Math.max(0,Math.floor((Date.now()-new Date(e).getTime())/1e3));if(t<60)return`${t}s ago`;let r=Math.floor(t/60);if(r<60)return`${r}m ago`;let n=Math.floor(r/60);if(n<24)return`${n}h ago`;let i=Math.floor(n/24);return`${i}d ago`}function cE(e){let t=Math.max(0,Math.floor((new Date(e).getTime()-Date.now())/1e3));if(t<60)return`in ${t}s`;let r=Math.floor(t/60);if(r<60)return`in ${r}m`;let n=Math.floor(r/60);if(n<24)return`in ${n}h`;let i=Math.floor(n/24);return`in ${i}d`}function cM(){var e;let{data:t,isLoading:r}=oM(),{data:n}=lQ();if(r||!t)return null;let i="border-slate-700 bg-slate-900/70 text-slate-200",a="Cloud sync disabled",s="Enable cloud sync and activate a Team licence to start replicating local data.",l=oe,o=!!(e=t.lastSyncAt)&&Date.now()-new Date(e).getTime()>864e5,c=t.queue.byKind.memory.pending+t.queue.byKind.graph.pending,d=t.queue.byKind.memory.failed+t.queue.byKind.graph.failed,u=t.queue.byKind.audit.failed+t.queue.byKind.quarantine.failed+t.queue.byKind.unknown.failed;return t.enabled&&t.apiKeySet&&!t.featureEnabled?(i="border-amber-500/30 bg-amber-500/10 text-amber-200",a="Cloud configured but licence locked",s=`Cloud sync requires the ${cs[t.requiredTier]} tier. Current tier: ${cs[n?.tier??"free"]}.`,l=cC):t.enabled&&t.apiKeySet&&c>0&&d>0?(i="border-red-500/30 bg-red-500/10 text-red-200",a="Cloud sync needs attention",s=t.queue.lastError??"One or more queued sync jobs are failing.",l=oi.ShieldAlert):t.enabled&&t.apiKeySet&&d>0?(i=o?"border-red-500/30 bg-red-500/10 text-red-200":"border-amber-500/30 bg-amber-500/10 text-amber-200",a=o?"Cloud sync has unresolved failures":"Cloud sync healthy, with failed history",s=t.queue.lastError?`${t.queue.lastError}${t.queue.latestFailureAt?` Last failure ${cA(t.queue.latestFailureAt)}.`:""}`:`${d} failed replication job${1===d?"":"s"} remain in queue history.`,l=o?oi.ShieldAlert:l0):t.enabled&&t.apiKeySet&&c>0?(i="border-amber-500/30 bg-amber-500/10 text-amber-200",a="Cloud sync is catching up",s=t.queue.nextRetryAt?`Next retry ${cE(t.queue.nextRetryAt)}.`:"Queued jobs are waiting to flush.",l=oC):t.enabled&&t.apiKeySet&&(i="border-emerald-500/30 bg-emerald-500/10 text-emerald-200",a="Cloud sync healthy",s=t.lastSyncAt?`Last successful sync ${cA(t.lastSyncAt)}.`:"Connected and ready to sync.",u>0&&(s+=` Auxiliary audit/quarantine history: ${u} failed job${1===u?"":"s"}.`),l=oN),(0,W.jsx)("div",{className:`rounded-2xl border p-4 ${i}`,children:(0,W.jsxs)("div",{className:"flex items-start gap-3",children:[(0,W.jsx)(l,{size:18,className:"mt-0.5 shrink-0"}),(0,W.jsxs)("div",{children:[(0,W.jsx)("h2",{className:"text-sm font-semibold",children:a}),(0,W.jsx)("p",{className:"mt-1 text-sm opacity-90",children:s})]})]})})}function cT({label:e,value:t,detail:r,icon:n}){return(0,W.jsxs)("div",{className:"rounded-2xl border border-slate-800 bg-slate-900/60 p-4",children:[(0,W.jsxs)("div",{className:"flex items-center justify-between",children:[(0,W.jsx)("span",{className:"text-xs uppercase tracking-[0.2em] text-slate-500",children:e}),(0,W.jsx)(n,{size:15,className:"text-slate-500"})]}),(0,W.jsx)("div",{className:"mt-2 text-2xl font-semibold text-white",children:t}),(0,W.jsx)("div",{className:"mt-1 text-xs text-slate-400",children:r})]})}function c_({label:e,pending:t,failed:r,synced:n}){return(0,W.jsxs)("div",{className:"rounded-xl border border-slate-800 bg-slate-950/60 p-3",children:[(0,W.jsx)("div",{className:"text-sm font-medium text-white",children:e}),(0,W.jsxs)("div",{className:"mt-3 grid grid-cols-3 gap-2 text-xs",children:[(0,W.jsxs)("div",{children:[(0,W.jsx)("div",{className:"text-slate-500",children:"Pending"}),(0,W.jsx)("div",{className:"mt-1 font-semibold text-amber-300",children:t})]}),(0,W.jsxs)("div",{children:[(0,W.jsx)("div",{className:"text-slate-500",children:"Failed"}),(0,W.jsx)("div",{className:"mt-1 font-semibold text-red-300",children:r})]}),(0,W.jsxs)("div",{children:[(0,W.jsx)("div",{className:"text-slate-500",children:"Synced"}),(0,W.jsx)("div",{className:"mt-1 font-semibold text-emerald-300",children:n})]})]})]})}function cD(){let{data:e}=o3(),{data:t}=(0,si.useQuery)({queryKey:["cloud-projects"],queryFn:async()=>{let e=await (0,sa.authFetch)(`${o4}/api/cloud/projects`);if(!e.ok)throw Error(await (0,sa.readApiError)(e,"Failed to fetch cloud projects"));return e.json()},staleTime:3e4}),r=o6(),[n,i]=(0,H.useState)(null),a=t?.projects??[],s=n??e?.syncControls??{projectMode:"all",projects:[],contentMode:"full",excludeSensitive:!1},l="all"!==s.projectMode;async function o(){await r.mutateAsync({cloudSyncProjectMode:s.projectMode,cloudSyncProjects:s.projects,cloudSyncContentMode:s.contentMode,cloudSyncExcludeSensitive:s.excludeSensitive}),i(null)}return(0,W.jsxs)("section",{className:"rounded-2xl border border-slate-800 bg-slate-900/60 p-5",children:[(0,W.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,W.jsxs)("div",{children:[(0,W.jsx)("h2",{className:"text-lg font-semibold text-white",children:"Sync Controls"}),(0,W.jsx)("p",{className:"mt-1 text-sm text-slate-400",children:"Decide what leaves this device before it hits the cloud replica."})]}),(0,W.jsx)("button",{type:"button",onClick:()=>void o(),disabled:r.isPending,className:"rounded-lg border border-cyan-500/30 bg-cyan-500/10 px-3 py-2 text-sm font-medium text-cyan-200 transition hover:bg-cyan-500/20 disabled:cursor-not-allowed disabled:opacity-50",children:r.isPending?"Saving...":"Save controls"})]}),(0,W.jsxs)("div",{className:"mt-5 grid gap-4",children:[(0,W.jsxs)("div",{className:"rounded-xl border border-slate-800 bg-slate-950/60 p-4",children:[(0,W.jsx)("div",{className:"text-xs uppercase tracking-[0.2em] text-slate-500",children:"Content mode"}),(0,W.jsxs)("div",{className:"mt-2 flex flex-wrap gap-2 text-[11px] text-slate-400",children:[(0,W.jsx)("span",{className:"rounded-full border border-slate-800 bg-slate-900/60 px-2.5 py-1",children:"metadata"===s.contentMode?"Metadata only":"Full content"}),(0,W.jsxs)("span",{className:"rounded-full border border-slate-800 bg-slate-900/60 px-2.5 py-1",children:["Sensitive filter ",s.excludeSensitive?"on":"off"]})]}),(0,W.jsxs)("div",{className:"mt-3 grid gap-2 md:grid-cols-2",children:[(0,W.jsxs)("label",{className:`rounded-lg border p-3 text-sm ${"full"===s.contentMode?"border-cyan-500/40 bg-cyan-500/10 text-cyan-100":"border-slate-800 text-slate-300"}`,children:[(0,W.jsx)("input",{type:"radio",className:"mr-2",checked:"full"===s.contentMode,onChange:()=>i(e=>({...e??s,contentMode:"full"}))}),"Full content",(0,W.jsx)("div",{className:"mt-1 text-xs text-slate-400",children:"Titles and memory bodies replicate to cloud."})]}),(0,W.jsxs)("label",{className:`rounded-lg border p-3 text-sm ${"metadata"===s.contentMode?"border-cyan-500/40 bg-cyan-500/10 text-cyan-100":"border-slate-800 text-slate-300"}`,children:[(0,W.jsx)("input",{type:"radio",className:"mr-2",checked:"metadata"===s.contentMode,onChange:()=>i(e=>({...e??s,contentMode:"metadata"}))}),"Metadata only",(0,W.jsx)("div",{className:"mt-1 text-xs text-slate-400",children:"Projects, tags, salience, and graph remain; body content is redacted."})]})]})]}),(0,W.jsxs)("div",{className:"rounded-xl border border-slate-800 bg-slate-950/60 p-4",children:[(0,W.jsx)("div",{className:"text-xs uppercase tracking-[0.2em] text-slate-500",children:"Project scope"}),(0,W.jsx)("div",{className:"mt-3 flex flex-wrap gap-2",children:["all","include","exclude"].map(e=>(0,W.jsx)("button",{type:"button",onClick:()=>i(t=>({...t??s,projectMode:e})),className:`rounded-full border px-3 py-1.5 text-xs font-medium uppercase tracking-wide ${s.projectMode===e?"border-cyan-500/40 bg-cyan-500/10 text-cyan-100":"border-slate-700 bg-slate-900/60 text-slate-300"}`,children:e},e))}),(0,W.jsx)("p",{className:"mt-3 text-xs text-slate-400",children:"all"===s.projectMode?"All local projects are eligible for sync.":"include"===s.projectMode?"Only the selected projects will sync.":"Selected projects stay local-only."}),l&&(0,W.jsxs)("details",{className:"mt-3 rounded-lg border border-slate-800 bg-slate-900/40 p-3",children:[(0,W.jsxs)("summary",{className:"cursor-pointer list-none text-sm font-medium text-slate-200",children:["Choose projects ",s.projects.length>0?`(${s.projects.length} selected)`:""]}),(0,W.jsx)("div",{className:"mt-3 max-h-48 overflow-y-auto",children:0===a.length?(0,W.jsx)("div",{className:"text-xs text-slate-500",children:"No named projects found in local memory yet."}):(0,W.jsx)("div",{className:"flex flex-wrap gap-2",children:a.map(e=>{let t=s.projects.includes(e.project);return(0,W.jsxs)("button",{type:"button",onClick:()=>{var t;return t=e.project,void i(e=>{let r=e??s,n=r.projects.includes(t)?r.projects.filter(e=>e!==t):[...r.projects,t].sort((e,t)=>e.localeCompare(t));return{...r,projects:n}})},className:`rounded-full border px-3 py-1.5 text-xs ${t?"border-cyan-500/40 bg-cyan-500/10 text-cyan-100":"border-slate-700 bg-slate-950/60 text-slate-300"}`,children:[e.project," ",(0,W.jsxs)("span",{className:"text-slate-500",children:["(",e.count,")"]})]},e.project)})})})]})]}),(0,W.jsxs)("label",{className:"flex items-start gap-3 rounded-xl border border-slate-800 bg-slate-950/60 p-4 text-sm text-slate-200",children:[(0,W.jsx)("input",{type:"checkbox",className:"mt-0.5",checked:s.excludeSensitive,onChange:e=>i(t=>({...t??s,excludeSensitive:e.target.checked}))}),(0,W.jsxs)("div",{children:[(0,W.jsx)("div",{className:"font-medium text-white",children:"Exclude sensitive memories"}),(0,W.jsx)("div",{className:"mt-1 text-xs text-slate-400",children:"Skip memories whose sensitivity level is higher than INTERNAL when syncing to cloud."})]})]}),r.isError&&(0,W.jsx)("div",{className:"rounded-xl border border-red-500/30 bg-red-500/10 p-3 text-sm text-red-200",children:r.error.message})]})]})}function cI({sync:e,cloudConfig:t}){return(0,W.jsxs)("section",{className:"rounded-2xl border border-slate-800 bg-slate-900/60 p-5",children:[(0,W.jsx)("h2",{className:"text-lg font-semibold text-white",children:"Current policy"}),(0,W.jsx)("p",{className:"mt-1 text-sm text-slate-400",children:"The snapshot below is the current cloud posture. Edit it in Sync Controls when you need to change what leaves this device."}),(0,W.jsxs)("div",{className:"mt-4 grid gap-3 md:grid-cols-2",children:[(0,W.jsxs)("div",{className:"rounded-xl border border-slate-800 bg-slate-950/60 p-4",children:[(0,W.jsx)("div",{className:"text-xs uppercase tracking-[0.2em] text-slate-500",children:"Sync scope"}),(0,W.jsx)("div",{className:"mt-2 text-sm font-medium text-white",children:e.controls.projectMode}),(0,W.jsxs)("div",{className:"mt-1 text-xs text-slate-400",children:[e.controls.projects.length," selected project",1===e.controls.projects.length?"":"s"]})]}),(0,W.jsxs)("div",{className:"rounded-xl border border-slate-800 bg-slate-950/60 p-4",children:[(0,W.jsx)("div",{className:"text-xs uppercase tracking-[0.2em] text-slate-500",children:"Content mode"}),(0,W.jsx)("div",{className:"mt-2 text-sm font-medium text-white",children:"metadata"===e.controls.contentMode?"Metadata only":"Full content"}),(0,W.jsxs)("div",{className:"mt-1 text-xs text-slate-400",children:["Sensitive filter ",e.controls.excludeSensitive?"enabled":"off"]})]}),(0,W.jsxs)("div",{className:"rounded-xl border border-slate-800 bg-slate-950/60 p-4",children:[(0,W.jsx)("div",{className:"text-xs uppercase tracking-[0.2em] text-slate-500",children:"Cloud endpoint"}),(0,W.jsx)("div",{className:"mt-2 text-sm font-medium text-white",children:e.baseUrl})]}),(0,W.jsxs)("div",{className:"rounded-xl border border-slate-800 bg-slate-950/60 p-4",children:[(0,W.jsx)("div",{className:"text-xs uppercase tracking-[0.2em] text-slate-500",children:"OpenClaw complement"}),(0,W.jsxs)("div",{className:"mt-2 grid grid-cols-2 gap-2 text-xs text-slate-300",children:[(0,W.jsxs)("span",{children:["Auto-memory: ",t.openclawMemory.autoMemory?"On":"Off"]}),(0,W.jsxs)("span",{children:["Dedupe: ",t.openclawMemory.dedupe?"On":"Off"]}),(0,W.jsxs)("span",{children:["Novelty: ",t.openclawMemory.noveltyThreshold]}),(0,W.jsxs)("span",{children:["Recent window: ",t.openclawMemory.maxRecent]})]})]})]})]})}function cz(){let{data:e,isLoading:t}=oM(),{data:r,isLoading:n}=o3(),{data:i,isLoading:a}=lQ();if(t||n||a||!e||!r||!i)return(0,W.jsx)("div",{className:"h-full overflow-y-auto p-6",children:(0,W.jsx)("div",{className:"rounded-2xl border border-slate-800 bg-slate-900/60 p-6 text-sm text-slate-400",children:"Loading cloud diagnostics..."})});let s=i.tier,l=e.queue.byKind.memory,o=e.queue.byKind.graph,c=l.failed+o.failed,d=e.queue.byKind.audit.failed+e.queue.byKind.quarantine.failed+e.queue.byKind.unknown.failed,u=e.lastSyncAt?cA(e.lastSyncAt):"Never",h=c>0?"Needs review":l.pending+o.pending>0?"Catching up":"Healthy";return(0,W.jsx)("div",{className:"h-full overflow-y-auto bg-slate-950",children:(0,W.jsxs)("div",{className:"mx-auto flex max-w-7xl flex-col gap-6 p-6",children:[(0,W.jsxs)("div",{className:"flex flex-col gap-2 md:flex-row md:items-end md:justify-between",children:[(0,W.jsxs)("div",{children:[(0,W.jsx)("h1",{className:"text-2xl font-semibold text-white",children:"Cloud Diagnostics"}),(0,W.jsx)("p",{className:"mt-1 text-sm text-slate-400",children:"See whether replication is healthy first. Then tune policy and inspect the deeper transport details only when you actually need them."})]}),(0,W.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:[(0,W.jsx)("span",{className:`rounded-full px-2.5 py-1 font-medium ${co[s]} ${cl[s]}`,children:cs[s]}),(0,W.jsxs)("span",{className:"rounded-full border border-slate-700 bg-slate-900/70 px-2.5 py-1 text-slate-300",children:["Last sync: ",u]})]})]}),(0,W.jsx)(cM,{}),(0,W.jsxs)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-5",children:[(0,W.jsx)(cT,{label:"Replication",value:h,detail:`${c} failed \xb7 ${l.pending+o.pending} pending`,icon:oC}),(0,W.jsx)(cT,{label:"Device",value:e.device.name,detail:`${e.device.platform} \xb7 ${e.device.id.slice(0,12)}`,icon:oA}),(0,W.jsx)(cT,{label:"Cloud Target",value:new URL(e.baseUrl).host,detail:e.enabled?"Configured target":"Disabled in config",icon:oe}),(0,W.jsx)(cT,{label:"Memory Queue",value:l.pending,detail:`${l.failed} failed \xb7 ${l.synced} synced`,icon:l1}),(0,W.jsx)(cT,{label:"Graph Queue",value:o.pending,detail:`${o.failed} failed \xb7 ${o.synced} synced`,icon:l5})]}),(0,W.jsxs)("div",{className:"grid grid-cols-1 gap-6 xl:grid-cols-[1.35fr_0.95fr]",children:[(0,W.jsxs)("section",{className:"rounded-2xl border border-slate-800 bg-slate-900/60 p-5",children:[(0,W.jsx)("div",{className:"flex items-center justify-between gap-3",children:(0,W.jsxs)("div",{children:[(0,W.jsx)("h2",{className:"text-lg font-semibold text-white",children:"Replication"}),(0,W.jsx)("p",{className:"mt-1 text-sm text-slate-400",children:"Focus on memory and graph first. Audit and quarantine transport history is still available, but it should not dominate the page when replication itself is healthy."})]})}),(0,W.jsxs)("div",{className:"mt-5 grid grid-cols-1 gap-3 md:grid-cols-2",children:[(0,W.jsx)(c_,{label:"Memory",...l}),(0,W.jsx)(c_,{label:"Graph",...o})]}),(0,W.jsxs)("details",{className:"mt-5 rounded-xl border border-slate-800 bg-slate-950/30 p-4",children:[(0,W.jsx)("summary",{className:"cursor-pointer list-none text-sm font-medium text-slate-200",children:"Advanced transport signals"}),(0,W.jsxs)("div",{className:"mt-4 grid grid-cols-1 gap-3 md:grid-cols-2",children:[(0,W.jsx)(c_,{label:"Audit",...e.queue.byKind.audit}),(0,W.jsx)(c_,{label:"Quarantine",...e.queue.byKind.quarantine})]}),(0,W.jsx)("div",{className:"mt-4 overflow-hidden rounded-xl border border-slate-800",children:(0,W.jsxs)("table",{className:"min-w-full divide-y divide-slate-800 text-sm",children:[(0,W.jsx)("thead",{className:"bg-slate-950/70 text-slate-400",children:(0,W.jsxs)("tr",{children:[(0,W.jsx)("th",{className:"px-4 py-3 text-left font-medium",children:"Signal"}),(0,W.jsx)("th",{className:"px-4 py-3 text-left font-medium",children:"Current value"}),(0,W.jsx)("th",{className:"px-4 py-3 text-left font-medium",children:"Why it matters"})]})}),(0,W.jsxs)("tbody",{className:"divide-y divide-slate-800 bg-slate-900/40 text-slate-200",children:[(0,W.jsxs)("tr",{children:[(0,W.jsx)("td",{className:"px-4 py-3",children:"Oldest queued job"}),(0,W.jsx)("td",{className:"px-4 py-3",children:e.queue.oldestPendingAt?cA(e.queue.oldestPendingAt):"None queued"}),(0,W.jsx)("td",{className:"px-4 py-3 text-slate-400",children:"If this stays old while pending grows, the local worker is falling behind."})]}),(0,W.jsxs)("tr",{children:[(0,W.jsx)("td",{className:"px-4 py-3",children:"Next retry"}),(0,W.jsx)("td",{className:"px-4 py-3",children:e.queue.nextRetryAt?cE(e.queue.nextRetryAt):"Idle"}),(0,W.jsx)("td",{className:"px-4 py-3 text-slate-400",children:"Confirms whether failures are retrying normally or the queue is stuck."})]}),(0,W.jsxs)("tr",{children:[(0,W.jsx)("td",{className:"px-4 py-3",children:"Failed jobs in history"}),(0,W.jsx)("td",{className:"px-4 py-3",children:c}),(0,W.jsx)("td",{className:"px-4 py-3 text-slate-400",children:"These are retained replication dead-letter records for memory and graph sync."})]}),(0,W.jsxs)("tr",{children:[(0,W.jsx)("td",{className:"px-4 py-3",children:"Auxiliary failed history"}),(0,W.jsx)("td",{className:"px-4 py-3",children:d}),(0,W.jsx)("td",{className:"px-4 py-3 text-slate-400",children:"Audit and quarantine retry history is shown here for debugging, but it does not mean memory replication is currently blocked."})]}),(0,W.jsxs)("tr",{children:[(0,W.jsx)("td",{className:"px-4 py-3",children:"Latest memory sync"}),(0,W.jsx)("td",{className:"px-4 py-3",children:e.lastSyncAt?cA(e.lastSyncAt):"Not recorded"}),(0,W.jsx)("td",{className:"px-4 py-3 text-slate-400",children:"This is the best quick indicator for whether cloud replication is actually current."})]})]})]})})]})]}),(0,W.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,W.jsx)(cD,{}),(0,W.jsx)(cI,{sync:e,cloudConfig:r}),(0,W.jsxs)("section",{className:"rounded-2xl border border-slate-800 bg-slate-900/60 p-5",children:[(0,W.jsx)("h2",{className:"text-lg font-semibold text-white",children:"Last actionable error"}),(0,W.jsx)("div",{className:"mt-4 rounded-xl border border-slate-800 bg-slate-950/60 p-4",children:e.queue.lastError?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)("div",{className:`flex items-center gap-2 text-sm font-medium ${e.queue.pending>0?"text-red-300":"text-amber-300"}`,children:[(0,W.jsx)(l0,{size:16}),e.queue.lastErrorKind?`${e.queue.lastErrorKind} queue`:"Unknown queue"]}),(0,W.jsx)("p",{className:"mt-2 text-sm text-slate-300",children:e.queue.lastError}),e.queue.latestFailureAt&&(0,W.jsxs)("div",{className:"mt-2 text-xs text-slate-500",children:["Recorded ",cA(e.queue.latestFailureAt)]}),e.queue.nextRetryAt&&(0,W.jsxs)("div",{className:"mt-3 inline-flex items-center gap-1 rounded-full bg-slate-900 px-2 py-1 text-xs text-slate-400",children:[(0,W.jsx)(oP,{size:12}),"Retry ",cE(e.queue.nextRetryAt)]})]}):(0,W.jsxs)("div",{className:"flex items-center gap-2 text-sm text-emerald-300",children:[(0,W.jsx)(oN,{size:16}),"No recent sync errors recorded."]})})]})]})]})]})})}let cL=(0,lD.default)("waypoints",[["circle",{cx:"12",cy:"4.5",r:"2.5",key:"r5ysbb"}],["path",{d:"m10.2 6.3-3.9 3.9",key:"1nzqf6"}],["circle",{cx:"4.5",cy:"12",r:"2.5",key:"jydg6v"}],["path",{d:"M7 12h10",key:"b7w52i"}],["circle",{cx:"19.5",cy:"12",r:"2.5",key:"1piiel"}],["path",{d:"m13.8 17.7 3.9-3.9",key:"1wyg1y"}],["circle",{cx:"12",cy:"19.5",r:"2.5",key:"13o1pw"}]]),cR=Q.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";async function cF(e){let t=new URLSearchParams;t.set("query",e.query),e.project&&t.set("project",e.project),e.expectedId&&t.set("expectedId",String(e.expectedId));let r=await (0,sa.authFetch)(`${cR}/api/recall/explain?${t.toString()}`);if(!r.ok)throw Error("Failed to explain recall");return r.json()}async function c$(e,t){let r=new URLSearchParams({mode:"search",query:e,limit:"8"});t&&r.set("project",t);let n=await (0,sa.authFetch)(`${cR}/api/memories?${r.toString()}`);if(!n.ok)throw Error("Failed to fetch memory candidates");return(await n.json()).memories}function cB(){var e;let{projectFilter:t,setSelectedMemory:r,setViewMode:n}=(0,sr.useDashboardStore)(),[i,a]=(0,H.useState)(""),[s,l]=(0,H.useState)(""),[o,c]=(0,H.useState)(""),[d,u]=(0,H.useState)(null),[h,p]=(0,H.useState)(null),[m,f]=(0,H.useState)(()=>JSON.parse(window.localStorage.getItem("shieldcortex:recall-history")??"[]")),x=(0,sc.useMutation)({mutationFn:async e=>{let t="shieldcortex:recall-history",r=[e,...JSON.parse(window.localStorage.getItem(t)??"[]").filter(t=>t!==e)].slice(0,8);return window.localStorage.setItem(t,JSON.stringify(r)),r}}),{data:y,isLoading:g}=(e=(0,H.useMemo)(()=>s.trim()?{query:s.trim(),project:t,expectedId:d}:null,[s,t,d]),(0,si.useQuery)({queryKey:["recall-explain",e],queryFn:()=>cF(e),enabled:!!e?.query?.trim(),staleTime:3e4})),{data:v=[]}=(0,si.useQuery)({queryKey:["memory-candidates",o,t],queryFn:()=>c$(o,t),enabled:o.trim().length>=2,staleTime:3e4});return(0,W.jsx)("div",{className:"h-full overflow-y-auto bg-slate-950",children:(0,W.jsxs)("div",{className:"mx-auto max-w-6xl px-6 py-6 space-y-6",children:[(0,W.jsxs)("section",{className:"rounded-2xl border border-slate-800 bg-slate-900/70 p-6",children:[(0,W.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,W.jsxs)("div",{children:[(0,W.jsxs)("div",{className:"inline-flex items-center gap-2 rounded-full border border-cyan-500/20 bg-cyan-500/10 px-3 py-1 text-xs uppercase tracking-[0.18em] text-cyan-300",children:[(0,W.jsx)(ct.Sparkles,{size:12}),"Recall Workspace"]}),(0,W.jsx)("h2",{className:"mt-4 text-3xl font-semibold text-white",children:"Debug what the agent would remember."}),(0,W.jsx)("p",{className:"mt-2 max-w-2xl text-sm text-slate-400",children:"Run a recall query, inspect ranking factors, see contradiction pressure, and compare an expected memory against the returned set."})]}),(0,W.jsxs)("div",{className:"hidden min-w-[220px] rounded-xl border border-slate-800 bg-slate-950/60 p-4 lg:block",children:[(0,W.jsx)("div",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:"Current run"}),(0,W.jsx)("div",{className:"mt-2 text-sm text-white",children:s||"No query yet"}),(0,W.jsx)("div",{className:"mt-2 text-xs text-slate-400",children:y?`${y.total} recalled \xb7 ${y.misses?.length??0} likely misses`:"Run a recall query first, then inspect the ranked set before opening the deeper debugger sections."})]})]}),(0,W.jsxs)("div",{className:"mt-6 grid gap-4 lg:grid-cols-[minmax(0,2fr)_minmax(280px,1fr)]",children:[(0,W.jsxs)("form",{className:"space-y-3",onSubmit:e=>{e.preventDefault(),i.trim()&&(l(i.trim()),x.mutate(i.trim(),{onSuccess:e=>f(e)}))},children:[(0,W.jsxs)("div",{className:"flex gap-3",children:[(0,W.jsxs)("div",{className:"relative flex-1",children:[(0,W.jsx)(l7.Search,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-slate-500"}),(0,W.jsx)(lT,{value:i,onChange:e=>a(e.target.value),placeholder:"Why did we choose PostgreSQL over SQLite?",className:"h-11 border-slate-700 bg-slate-950 pl-10 text-white"})]}),(0,W.jsx)(lM,{type:"submit",className:"h-11 bg-cyan-600 hover:bg-cyan-500",children:"Explain recall"})]}),m.length>0&&(0,W.jsx)("div",{className:"flex flex-wrap gap-2",children:m.map(e=>(0,W.jsx)("button",{type:"button",onClick:()=>{a(e),l(e)},className:"rounded-full border border-slate-700 bg-slate-900 px-3 py-1 text-xs text-slate-300 hover:border-slate-500 hover:text-white",children:e},e))})]}),(0,W.jsxs)("details",{className:"rounded-xl border border-slate-800 bg-slate-950/60 p-4",open:!!d,children:[(0,W.jsx)("summary",{className:"cursor-pointer list-none text-xs uppercase tracking-[0.18em] text-slate-500",children:"Expected memory debugger"}),(0,W.jsx)(lT,{value:o,onChange:e=>c(e.target.value),placeholder:"Search a memory to compare...",className:"mt-3 border-slate-700 bg-slate-950 text-white"}),(0,W.jsx)("div",{className:"mt-3 space-y-2",children:v.map(e=>(0,W.jsxs)("button",{onClick:()=>{u(e.id),c(e.title)},className:`block w-full rounded-lg border px-3 py-2 text-left text-sm ${d===e.id?"border-cyan-500/50 bg-cyan-500/10 text-white":"border-slate-800 bg-slate-900 text-slate-300 hover:border-slate-600"}`,children:[(0,W.jsx)("div",{className:"font-medium",children:e.title}),(0,W.jsxs)("div",{className:"text-xs text-slate-500",children:[e.category," · ",e.project||"workspace"]})]},e.id))})]})]})]}),(0,W.jsxs)("div",{className:`grid gap-6 ${h?"2xl:grid-cols-[minmax(0,1.2fr)_minmax(320px,0.8fr)_420px]":"xl:grid-cols-[minmax(0,1.5fr)_minmax(320px,0.9fr)]"}`,children:[(0,W.jsxs)("section",{className:"rounded-2xl border border-slate-800 bg-slate-900/70 p-5",children:[(0,W.jsxs)("div",{className:"flex items-center justify-between",children:[(0,W.jsxs)("div",{children:[(0,W.jsx)("div",{className:"text-xs uppercase tracking-[0.18em] text-slate-500",children:"Ranked recall set"}),(0,W.jsxs)("div",{className:"mt-1 text-sm text-slate-400",children:[y?.total??0," results"]})]}),g&&(0,W.jsx)("div",{className:"text-sm text-slate-400",children:"Explaining…"})]}),(0,W.jsxs)("div",{className:"mt-4 space-y-3",children:[y?.results.map((e,t)=>(0,W.jsxs)("div",{className:`rounded-xl border bg-slate-950/70 p-4 text-left ${h?.id===e.memory.id?"border-cyan-500/40":"border-slate-800"}`,children:[(0,W.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,W.jsxs)("div",{children:[(0,W.jsxs)("div",{className:"text-xs uppercase tracking-[0.18em] text-slate-500",children:["Rank #",t+1]}),(0,W.jsx)("div",{className:"mt-1 text-lg font-medium text-white",children:e.memory.title}),(0,W.jsxs)("div",{className:"mt-1 text-xs text-slate-400",children:[e.memory.category," · ",e.memory.captureMethod||"manual"," · trust ",(e.memory.trustScore??1).toFixed(2)]})]}),(0,W.jsxs)("div",{className:"rounded-lg bg-cyan-500/10 px-3 py-2 text-right",children:[(0,W.jsx)("div",{className:"text-[10px] uppercase tracking-[0.18em] text-cyan-300",children:"Score"}),(0,W.jsx)("div",{className:"text-base font-semibold text-cyan-100",children:e.relevanceScore.toFixed(2)})]})]}),(0,W.jsx)("div",{className:"mt-3 flex flex-wrap gap-2 text-xs text-slate-300",children:(e.explanation?.reasons??[]).slice(0,4).map(e=>(0,W.jsx)("span",{className:"rounded-full border border-slate-700 px-2 py-1",children:e},e))}),e.contradictions&&e.contradictions.length>0&&(0,W.jsxs)("div",{className:"mt-3 inline-flex items-center gap-2 rounded-full bg-amber-500/10 px-3 py-1 text-xs text-amber-300",children:[(0,W.jsx)(oi.ShieldAlert,{size:12}),e.contradictions.length," contradiction link",1===e.contradictions.length?"":"s"]}),(0,W.jsxs)("div",{className:"mt-4 flex flex-wrap gap-2",children:[(0,W.jsx)("button",{onClick:()=>p(e.memory),className:"rounded-lg border border-slate-700 px-3 py-1 text-xs text-slate-300 hover:border-slate-500",children:"Inspect in panel"}),(0,W.jsx)("button",{onClick:()=>{r(e.memory),n("memories")},className:"rounded-lg border border-cyan-500/30 bg-cyan-500/10 px-3 py-1 text-xs text-cyan-200 hover:bg-cyan-500/20",children:"Open in memories"})]})]},e.memory.id)),!g&&!y?.results.length&&s&&(0,W.jsx)("div",{className:"rounded-xl border border-slate-800 bg-slate-950/60 p-6 text-sm text-slate-400",children:"No recalled memories for this query."})]})]}),(0,W.jsxs)("section",{className:"space-y-6",children:[(0,W.jsxs)("div",{className:"rounded-2xl border border-slate-800 bg-slate-900/70 p-5",children:[(0,W.jsxs)("div",{className:"flex items-center gap-2 text-xs uppercase tracking-[0.18em] text-slate-500",children:[(0,W.jsx)(cL,{size:13}),"Comparison summary"]}),y?.expectedMemory?(0,W.jsxs)("div",{className:"mt-4 space-y-3 text-sm text-slate-300",children:[(0,W.jsx)("div",{className:"text-lg font-medium text-white",children:y.expectedMemory.title}),(0,W.jsxs)("div",{className:"rounded-xl border border-slate-800 bg-slate-950/60 p-3",children:[(0,W.jsxs)("div",{children:["Rank: ",y.expectedMemory.rank??"not returned"]}),(0,W.jsxs)("div",{children:["Status: ",y.expectedMemory.status]}),(0,W.jsxs)("div",{children:["Capture: ",y.expectedMemory.captureMethod," · ",y.expectedMemory.sourceKind]})]}),(0,W.jsx)("div",{className:"space-y-2",children:y.expectedMemory.reasons.map(e=>(0,W.jsx)("div",{className:"rounded-lg border border-slate-800 bg-slate-950/60 px-3 py-2 text-xs text-slate-400",children:e},e))})]}):(0,W.jsx)("div",{className:"mt-4 text-sm text-slate-400",children:"Pick an expected memory only when you need to debug why something obvious did not rank where you expected."})]}),(0,W.jsxs)("details",{className:"rounded-2xl border border-slate-800 bg-slate-900/70 p-5",children:[(0,W.jsxs)("summary",{className:"cursor-pointer list-none text-xs uppercase tracking-[0.18em] text-slate-500",children:["Likely misses ",y?.misses?.length?`(${y.misses.length})`:""]}),(0,W.jsxs)("div",{className:"mt-4 space-y-3",children:[(y?.misses??[]).map(e=>(0,W.jsxs)("div",{className:"rounded-xl border border-slate-800 bg-slate-950/60 p-3",children:[(0,W.jsx)("div",{className:"text-sm font-medium text-white",children:e.title}),(0,W.jsxs)("div",{className:"mt-1 text-xs text-slate-500",children:[e.captureMethod," · salience ",e.salience.toFixed(2)]}),(0,W.jsx)("ul",{className:"mt-2 space-y-1 text-xs text-slate-400",children:e.whyNotRecalled.map(e=>(0,W.jsxs)("li",{children:["• ",e]},e))})]},e.id)),!y?.misses?.length&&(0,W.jsx)("div",{className:"text-sm text-slate-400",children:"No notable misses for this query."})]})]})]}),h&&(0,W.jsx)("aside",{className:"2xl:sticky 2xl:top-6 2xl:self-start",children:(0,W.jsxs)("div",{className:"rounded-2xl border border-cyan-500/20 bg-slate-900/70",children:[(0,W.jsxs)("div",{className:"border-b border-slate-800 px-4 py-3",children:[(0,W.jsx)("div",{className:"text-[10px] uppercase tracking-[0.18em] text-cyan-300",children:"Selected recall memory"}),(0,W.jsx)("div",{className:"mt-1 text-sm text-slate-400",children:"Inspect the selected result here while you keep comparing ranks, misses, and contradictions."})]}),(0,W.jsx)("div",{className:"2xl:max-h-[calc(100vh-8rem)] 2xl:overflow-y-auto",children:(0,W.jsx)(lF,{memory:h,onClose:()=>p(null)})}),(0,W.jsx)("div",{className:"border-t border-slate-800 px-4 py-3",children:(0,W.jsx)("button",{onClick:()=>p(null),className:"rounded-lg border border-slate-700 px-3 py-1 text-xs text-slate-300 hover:border-slate-500",children:"Close panel"})})]})})]})]})})}let cU=(0,lD.default)("archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]),cq=(0,lD.default)("cloud-off",[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5.782 5.782A7 7 0 0 0 9 19h8.5a4.5 4.5 0 0 0 1.307-.193",key:"yfwify"}],["path",{d:"M21.532 16.5A4.5 4.5 0 0 0 17.5 10h-1.79A7.008 7.008 0 0 0 10 5.07",key:"jlfiyv"}]]),cV=(0,lD.default)("pin",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]]),cK=(0,lD.default)("layers",[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]]);function cW({memory:e}){let t=e.status??"active",r=function(e){if(!e)return null;let t=Math.floor((Date.now()-new Date(e).getTime())/36e5);if(t<1)return"just now";if(t<24)return`${t}h ago`;let r=Math.floor(t/24);return r<7?`${r}d ago`:`${Math.floor(r/7)}w ago`}(e.reviewedAt),n=[e.pinned?{label:"Pinned",tone:"emerald"}:null,"canonical"===t?{label:"Canonical",tone:"emerald"}:null,"suppressed"===t?{label:"Suppressed",tone:"amber"}:null,"archived"===t?{label:"Archived",tone:"slate"}:null,e.cloudExcluded?{label:"Cloud excluded",tone:"cyan"}:null,"global"===e.scope?{label:"Global",tone:"violet"}:null,r?{label:`Reviewed ${r}`,tone:"slate"}:null].filter(Boolean),i={emerald:"border-emerald-500/30 bg-emerald-500/10 text-emerald-200",amber:"border-amber-500/30 bg-amber-500/10 text-amber-200",slate:"border-slate-700 bg-slate-800/80 text-slate-300",cyan:"border-cyan-500/30 bg-cyan-500/10 text-cyan-200",violet:"border-violet-500/30 bg-violet-500/10 text-violet-200"};return(0,W.jsx)("div",{className:"mt-3 flex flex-wrap gap-2",children:n.length>0?n.map(e=>(0,W.jsx)("span",{className:`rounded-full border px-2.5 py-1 text-[11px] ${i[e.tone]}`,children:e.label},e.label)):(0,W.jsx)("span",{className:"rounded-full border border-slate-700 bg-slate-800/80 px-2.5 py-1 text-[11px] text-slate-300",children:"Ready for recall"})})}function cH({memory:e,onOpen:t,onAct:r,busy:n}){return(0,W.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2",children:[(0,W.jsx)("button",{onClick:()=>t(e),className:"rounded-lg border border-slate-700 px-3 py-1 text-xs text-slate-300 hover:border-slate-500",children:"Inspect in panel"}),(0,W.jsxs)("button",{disabled:n,onClick:()=>r(e,e.pinned?"unpin":"pin"),className:"rounded-lg border border-slate-700 px-3 py-1 text-xs text-slate-300 hover:border-slate-500 disabled:opacity-50",children:[(0,W.jsx)(cV,{className:"mr-1 inline h-3 w-3"}),e.pinned?"Unpin":"Pin"]}),(0,W.jsx)("button",{disabled:n,onClick:()=>r(e,"suppress"),className:"rounded-lg border border-amber-500/40 px-3 py-1 text-xs text-amber-300 hover:bg-amber-500/10 disabled:opacity-50",children:"Suppress"}),(0,W.jsxs)("button",{disabled:n,onClick:()=>r(e,"archived"===e.status||"suppressed"===e.status?"restore":"archive"),className:"rounded-lg border border-slate-700 px-3 py-1 text-xs text-slate-300 hover:border-slate-500 disabled:opacity-50",children:[(0,W.jsx)(cU,{className:"mr-1 inline h-3 w-3"}),"archived"===e.status||"suppressed"===e.status?"Restore":"Archive"]}),(0,W.jsxs)("button",{disabled:n,onClick:()=>r(e,e.cloudExcluded?"includeCloud":"excludeCloud"),className:"rounded-lg border border-slate-700 px-3 py-1 text-xs text-slate-300 hover:border-slate-500 disabled:opacity-50",children:[(0,W.jsx)(cq,{className:"mr-1 inline h-3 w-3"}),e.cloudExcluded?"Include cloud":"Exclude cloud"]}),(0,W.jsx)("button",{disabled:n,onClick:()=>r(e,"global"===e.scope?"rescopeProject":"rescopeGlobal"),className:"rounded-lg border border-slate-700 px-3 py-1 text-xs text-slate-300 hover:border-slate-500 disabled:opacity-50",children:"global"===e.scope?"Project scope":"Make global"}),(0,W.jsx)("button",{disabled:n,onClick:()=>r(e,"canonicalize"),className:"rounded-lg border border-emerald-500/40 px-3 py-1 text-xs text-emerald-300 hover:bg-emerald-500/10 disabled:opacity-50",children:"Canonical"})]})}function cQ({title:e,detail:t,items:r,onOpen:n,onAct:i,busy:a}){return(0,W.jsxs)("section",{className:"rounded-2xl border border-slate-800 bg-slate-900/70 p-5",children:[(0,W.jsxs)("div",{className:"flex items-center justify-between",children:[(0,W.jsxs)("div",{children:[(0,W.jsx)("h3",{className:"text-lg font-semibold text-white",children:e}),(0,W.jsx)("p",{className:"mt-1 text-sm text-slate-400",children:t})]}),(0,W.jsx)("div",{className:"rounded-full bg-slate-800 px-3 py-1 text-xs text-slate-300",children:r.length})]}),(0,W.jsxs)("div",{className:"mt-4 space-y-3",children:[r.slice(0,8).map(e=>(0,W.jsxs)("div",{className:"rounded-xl border border-slate-800 bg-slate-950/60 p-4",children:[(0,W.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,W.jsxs)("div",{children:[(0,W.jsx)("div",{className:"text-base font-medium text-white",children:e.title}),(0,W.jsxs)("div",{className:"mt-1 text-xs text-slate-500",children:[e.category," · ",e.captureMethod||"manual"," · trust ",(e.trustScore??1).toFixed(2)]}),(0,W.jsx)(cW,{memory:e})]}),(0,W.jsxs)("div",{className:"rounded-lg bg-slate-800 px-3 py-2 text-right",children:[(0,W.jsx)("div",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:"Next move"}),(0,W.jsx)("div",{className:"text-sm text-slate-100",children:"canonical"===e.status?"Keep hot":"archived"===e.status?"Restore or leave archived":"suppressed"===e.status?"Restore or leave suppressed":"Review or keep"})]})]}),(0,W.jsx)(cH,{memory:e,onOpen:n,onAct:i,busy:a})]},e.id)),!r.length&&(0,W.jsx)("div",{className:"text-sm text-slate-400",children:"Nothing to review here."})]})]})}function cY(){let e,{projectFilter:t,reviewFocus:r,setReviewFocus:n,selectedMemory:i,setSelectedMemory:a}=(0,sr.useDashboardStore)(),{data:s,isLoading:l}=(0,si.useQuery)({queryKey:["review-queue",t],queryFn:()=>sp(t),staleTime:3e4}),o=(e=(0,so.useQueryClient)(),(0,sc.useMutation)({mutationFn:sf,onSuccess:(t,r)=>{e.setQueriesData({queryKey:["review-queue"]},e=>{var n,i;return n=r.keptId,i=r.removedId,e?sh({...e,sections:{...e.sections,stale:e.sections.stale.filter(e=>e.id!==i),neverUsed:e.sections.neverUsed.filter(e=>e.id!==i),lowTrust:e.sections.lowTrust.filter(e=>e.id!==i),noisyAutoExtracted:e.sections.noisyAutoExtracted.filter(e=>e.id!==i),projectless:e.sections.projectless.filter(e=>e.id!==i),duplicates:e.sections.duplicates.filter(e=>e.memoryA.id!==i&&e.memoryB.id!==i),contradictions:e.sections.contradictions.filter(e=>e.memoryA.id!==i&&e.memoryB.id!==i)}},{...t,id:n}):e}),e.setQueriesData({queryKey:["memories"]},e=>e?{...e,memories:e.memories.filter(e=>e.id!==r.removedId).map(e=>e.id===r.keptId?t:e)}:e),e.invalidateQueries({queryKey:["review-queue"]}),e.invalidateQueries({queryKey:["memories"]}),e.invalidateQueries({queryKey:["quality"]}),e.invalidateQueries({queryKey:["contradictions"]}),e.invalidateQueries({queryKey:["stats"]}),e.invalidateQueries({queryKey:["graph"]})}})),c=sx(),[d,u]=(0,H.useState)(null),h={lowTrust:(0,H.useRef)(null),noisyAutoExtracted:(0,H.useRef)(null),stale:(0,H.useRef)(null),neverUsed:(0,H.useRef)(null),projectless:(0,H.useRef)(null),duplicates:(0,H.useRef)(null),contradictions:(0,H.useRef)(null)},p=e=>{a(e)};(0,H.useEffect)(()=>{if(!r)return;let e=h[r].current;e&&e.scrollIntoView({behavior:"smooth",block:"start"})},[r]);let m=async(e,t)=>{try{u(null);let r=await c.mutateAsync({id:e.id,action:t,reviewedBy:"dashboard-review",project:e.project??null,scope:e.scope});(i?.id===r.id||i?.id===e.id)&&a(r),u({kind:"success",message:`${{pin:"Pinned",unpin:"Unpinned",suppress:"Suppressed",archive:"Archived",includeCloud:"Included in cloud sync",excludeCloud:"Excluded from cloud sync",rescopeProject:"Moved to project scope",rescopeGlobal:"Moved to global scope",canonicalize:"Marked canonical"}[t]??"Updated"}: ${r.title}`})}catch(t){u({kind:"error",message:t instanceof Error?t.message:`Failed to update ${e.title}`})}},f=async(e,t)=>{try{u(null),await o.mutateAsync({keptId:e.id,removedId:t.id,reviewedBy:"dashboard-merge"}),a(e),u({kind:"success",message:`Merged duplicate into "${e.title}"`})}catch(e){u({kind:"error",message:e instanceof Error?e.message:"Failed to merge duplicate memories"})}},x=async(e,t)=>{try{u(null),await c.mutateAsync({id:e.id,action:"canonicalize",reviewedBy:"dashboard-review"}),await c.mutateAsync({id:t.id,action:"suppress",reviewedBy:"dashboard-review"}),a(e),u({kind:"success",message:`Kept "${e.title}" and suppressed "${t.title}"`})}catch(e){u({kind:"error",message:e instanceof Error?e.message:"Failed to resolve contradiction"})}},y=(0,H.useMemo)(()=>{let e=["lowTrust","noisyAutoExtracted","stale","neverUsed","projectless","duplicates","contradictions"];return r?[r,...e.filter(e=>e!==r)]:e},[r]),g={lowTrust:s?.sections.lowTrust.length??0,noisyAutoExtracted:s?.sections.noisyAutoExtracted.length??0,stale:s?.sections.stale.length??0,neverUsed:s?.sections.neverUsed.length??0,projectless:s?.sections.projectless.length??0,duplicates:s?.sections.duplicates.length??0,contradictions:s?.sections.contradictions.length??0},v={lowTrust:(0,W.jsx)("section",{ref:e=>{h.lowTrust.current=e},className:"scroll-mt-6",children:(0,W.jsx)(cQ,{title:"Low trust",detail:"These memories came from weaker or noisier sources.",items:s?.sections.lowTrust??[],onOpen:p,onAct:m,busy:c.isPending||o.isPending})}),noisyAutoExtracted:(0,W.jsx)("section",{ref:e=>{h.noisyAutoExtracted.current=e},className:"scroll-mt-6",children:(0,W.jsx)(cQ,{title:"Noisy auto-extracted",detail:"Auto capture is useful, but not every extraction deserves to stay hot.",items:s?.sections.noisyAutoExtracted??[],onOpen:p,onAct:m,busy:c.isPending||o.isPending})}),stale:(0,W.jsx)("section",{ref:e=>{h.stale.current=e},className:"scroll-mt-6",children:(0,W.jsx)(cQ,{title:"Stale",detail:"Useful once, maybe. Worth archiving or refreshing now.",items:s?.sections.stale??[],onOpen:p,onAct:m,busy:c.isPending||o.isPending})}),neverUsed:(0,W.jsx)("section",{ref:e=>{h.neverUsed.current=e},className:"scroll-mt-6",children:(0,W.jsx)(cQ,{title:"Never used",detail:"Stored but never recalled. High count usually means capture is too noisy.",items:s?.sections.neverUsed??[],onOpen:p,onAct:m,busy:c.isPending||o.isPending})}),projectless:(0,W.jsx)("section",{ref:e=>{h.projectless.current=e},className:"scroll-mt-6",children:(0,W.jsx)(cQ,{title:"Projectless",detail:"These memories have no useful project scope and are likely to leak into the wrong context.",items:s?.sections.projectless??[],onOpen:p,onAct:m,busy:c.isPending||o.isPending})}),duplicates:(0,W.jsxs)("section",{ref:e=>{h.duplicates.current=e},className:"scroll-mt-6 rounded-2xl border border-slate-800 bg-slate-900/70 p-5",children:[(0,W.jsxs)("div",{className:"flex items-center gap-2",children:[(0,W.jsx)(cK,{size:16,className:"text-cyan-300"}),(0,W.jsx)("h3",{className:"text-lg font-semibold text-white",children:"Duplicate candidates"})]}),(0,W.jsx)("p",{className:"mt-1 text-sm text-slate-400",children:"One click keeps the recommended memory, merges unique content, and removes the duplicate."}),(0,W.jsxs)("div",{className:"mt-4 space-y-3",children:[(s?.sections.duplicates??[]).slice(0,8).map(e=>{let t=e.recommendedKeepId===e.memoryA.id?e.memoryA:e.memoryB,r=e.recommendedKeepId===e.memoryA.id?e.memoryB:e.memoryA;return(0,W.jsxs)("div",{className:"rounded-xl border border-slate-800 bg-slate-950/60 p-4",children:[(0,W.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,W.jsxs)("div",{children:[(0,W.jsx)("div",{className:"text-sm font-medium text-white",children:e.memoryA.title}),(0,W.jsxs)("div",{className:"mt-1 text-xs text-slate-500",children:["paired with ",e.memoryB.title]}),(0,W.jsxs)("div",{className:"mt-2 text-xs text-slate-400",children:[e.similarity," · shared title words ",e.sharedWords]})]}),(0,W.jsxs)("div",{className:"rounded-lg bg-emerald-500/10 px-3 py-2 text-xs text-emerald-300",children:["Keep ",t.id]})]}),(0,W.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2",children:[(0,W.jsx)("button",{onClick:()=>p(e.memoryA),className:"rounded-lg border border-slate-700 px-3 py-1 text-xs text-slate-300 hover:border-slate-500",children:"Inspect A"}),(0,W.jsx)("button",{onClick:()=>p(e.memoryB),className:"rounded-lg border border-slate-700 px-3 py-1 text-xs text-slate-300 hover:border-slate-500",children:"Inspect B"}),(0,W.jsx)("button",{onClick:()=>f(t,r),disabled:c.isPending||o.isPending,className:"rounded-lg border border-emerald-500/40 px-3 py-1 text-xs text-emerald-300 hover:bg-emerald-500/10 disabled:opacity-50",children:"Merge into recommended"}),(0,W.jsx)("button",{onClick:()=>f(r,t),disabled:c.isPending||o.isPending,className:"rounded-lg border border-slate-700 px-3 py-1 text-xs text-slate-300 hover:border-slate-500 disabled:opacity-50",children:"Keep other instead"})]})]},`${e.memoryA.id}-${e.memoryB.id}`)}),!s?.sections.duplicates?.length&&(0,W.jsx)("div",{className:"text-sm text-slate-400",children:"No duplicate candidates detected."})]})]}),contradictions:(0,W.jsxs)("section",{ref:e=>{h.contradictions.current=e},className:"scroll-mt-6 rounded-2xl border border-slate-800 bg-slate-900/70 p-5",children:[(0,W.jsxs)("div",{className:"flex items-center gap-2",children:[(0,W.jsx)(oi.ShieldAlert,{size:16,className:"text-amber-300"}),(0,W.jsx)("h3",{className:"text-lg font-semibold text-white",children:"Contradiction clusters"})]}),(0,W.jsx)("p",{className:"mt-1 text-sm text-slate-400",children:"Compare both sides, keep the stronger memory hot, and suppress the one you no longer want shaping recall."}),(0,W.jsxs)("div",{className:"mt-4 space-y-4",children:[(s?.sections.contradictions??[]).slice(0,8).map(e=>(0,W.jsxs)("div",{className:"rounded-xl border border-amber-500/20 bg-slate-950/60 p-4",children:[(0,W.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,W.jsxs)("div",{children:[(0,W.jsx)("div",{className:"text-xs uppercase tracking-[0.18em] text-slate-500",children:"Contradiction score"}),(0,W.jsxs)("div",{className:"mt-1 text-lg font-semibold text-white",children:[Math.round(100*e.score),"%"]})]}),(0,W.jsxs)("div",{className:"text-right",children:[(0,W.jsx)("div",{className:"text-xs uppercase tracking-[0.18em] text-slate-500",children:"Shared topics"}),(0,W.jsx)("div",{className:"mt-1 text-sm text-slate-300",children:e.sharedTopics.length?e.sharedTopics.join(" · "):"No obvious shared topic"})]})]}),(0,W.jsx)("div",{className:"mt-3 rounded-xl border border-slate-800 bg-slate-900/60 p-3 text-sm text-slate-300",children:e.reason}),(0,W.jsx)("div",{className:"mt-4 grid gap-4 xl:grid-cols-2",children:[e.memoryA,e.memoryB].map((t,r)=>{let n=0===r?e.memoryB:e.memoryA;return(0,W.jsxs)("div",{className:"rounded-xl border border-slate-800 bg-slate-900/70 p-4",children:[(0,W.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,W.jsxs)("div",{children:[(0,W.jsx)("div",{className:"text-xs uppercase tracking-[0.18em] text-slate-500",children:0===r?"Option A":"Option B"}),(0,W.jsx)("div",{className:"mt-1 text-base font-medium text-white",children:t.title}),(0,W.jsxs)("div",{className:"mt-1 text-xs text-slate-500",children:[t.category," · ",t.captureMethod||"manual"," · trust ",(t.trustScore??1).toFixed(2)]})]}),(0,W.jsxs)("div",{className:"rounded-lg bg-slate-800 px-3 py-2 text-right text-sm text-slate-100",children:[(t.trustScore??1).toFixed(2)," trust"]})]}),(0,W.jsx)(cW,{memory:t}),(0,W.jsx)("div",{className:"mt-3 line-clamp-4 text-sm text-slate-400",children:t.content}),(0,W.jsxs)("div",{className:"mt-4 flex flex-wrap gap-2",children:[(0,W.jsx)("button",{onClick:()=>p(t),className:"rounded-lg border border-slate-700 px-3 py-1 text-xs text-slate-300 hover:border-slate-500",children:"Inspect"}),(0,W.jsx)("button",{disabled:c.isPending||o.isPending,onClick:()=>m(t,t.pinned?"unpin":"pin"),className:"rounded-lg border border-slate-700 px-3 py-1 text-xs text-slate-300 hover:border-slate-500 disabled:opacity-50",children:t.pinned?"Unpin":"Pin"}),(0,W.jsx)("button",{disabled:c.isPending||o.isPending,onClick:()=>x(t,n),className:"rounded-lg border border-emerald-500/40 px-3 py-1 text-xs text-emerald-300 hover:bg-emerald-500/10 disabled:opacity-50",children:"Keep this, suppress other"}),(0,W.jsx)("button",{disabled:c.isPending||o.isPending,onClick:()=>m(t,"suppress"),className:"rounded-lg border border-amber-500/40 px-3 py-1 text-xs text-amber-300 hover:bg-amber-500/10 disabled:opacity-50",children:"Suppress this one"})]})]},t.id)})})]},`${e.memoryA.id}-${e.memoryB.id}`)),!s?.sections.contradictions?.length&&(0,W.jsx)("div",{className:"text-sm text-slate-400",children:"No contradiction clusters detected."})]})]})};return(0,W.jsx)("div",{className:"h-full overflow-y-auto bg-slate-950",children:(0,W.jsxs)("div",{className:"mx-auto max-w-[1440px] px-6 py-6 space-y-6",children:[(0,W.jsxs)("section",{className:"rounded-2xl border border-slate-800 bg-slate-900/70 p-6",children:[(0,W.jsxs)("div",{className:"inline-flex items-center gap-2 rounded-full border border-amber-500/20 bg-amber-500/10 px-3 py-1 text-xs uppercase tracking-[0.18em] text-amber-300",children:[(0,W.jsx)(cK,{size:12}),"Review Queue"]}),(0,W.jsx)("h2",{className:"mt-4 text-3xl font-semibold text-white",children:"Fix memory quality before it turns into recall debt."}),(0,W.jsx)("p",{className:"mt-2 max-w-2xl text-sm text-slate-400",children:"Review stale, contradictory, low-trust, and noisy auto-extracted memories. Pin the good ones, suppress the noisy ones, and keep cloud sync intentional."}),(0,W.jsx)("div",{className:"mt-6 grid gap-4 md:grid-cols-3 xl:grid-cols-6",children:Object.entries(s?.summary??{}).map(([e,t])=>(0,W.jsxs)("div",{className:"rounded-xl border border-slate-800 bg-slate-950/70 p-4",children:[(0,W.jsx)("div",{className:"text-xs uppercase tracking-[0.18em] text-slate-500",children:e}),(0,W.jsx)("div",{className:"mt-2 text-2xl font-semibold text-white",children:t})]},e))}),(0,W.jsxs)("div",{className:"mt-6 rounded-2xl border border-slate-800 bg-slate-950/60 p-4",children:[(0,W.jsxs)("div",{className:"flex items-center gap-2 text-xs uppercase tracking-[0.18em] text-slate-500",children:[(0,W.jsx)(ct.Sparkles,{size:12}),"OpenClaw capture"]}),(0,W.jsxs)("div",{className:"mt-4 grid gap-4 md:grid-cols-5",children:[(0,W.jsxs)("div",{children:[(0,W.jsx)("div",{className:"text-xs text-slate-500",children:"Total"}),(0,W.jsx)("div",{className:"text-xl font-semibold text-white",children:s?.openClaw.total??0})]}),(0,W.jsxs)("div",{children:[(0,W.jsx)("div",{className:"text-xs text-slate-500",children:"Auto-extracted"}),(0,W.jsx)("div",{className:"text-xl font-semibold text-white",children:s?.openClaw.autoExtracted??0})]}),(0,W.jsxs)("div",{children:[(0,W.jsx)("div",{className:"text-xs text-slate-500",children:"Keyword-triggered"}),(0,W.jsx)("div",{className:"text-xl font-semibold text-white",children:s?.openClaw.keywordTriggered??0})]}),(0,W.jsxs)("div",{children:[(0,W.jsx)("div",{className:"text-xs text-slate-500",children:"Suppressed"}),(0,W.jsx)("div",{className:"text-xl font-semibold text-white",children:s?.openClaw.suppressed??0})]}),(0,W.jsxs)("div",{children:[(0,W.jsx)("div",{className:"text-xs text-slate-500",children:"Pinned"}),(0,W.jsx)("div",{className:"text-xl font-semibold text-white",children:s?.openClaw.pinned??0})]})]})]}),(0,W.jsxs)("div",{className:"mt-6 flex flex-wrap gap-2",children:[[["contradictions","Contradictions"],["duplicates","Duplicates"],["stale","Stale"],["neverUsed","Never used"],["lowTrust","Low trust"],["noisyAutoExtracted","Noisy auto"],["projectless","Projectless"]].map(([e,t])=>(0,W.jsxs)("button",{onClick:()=>n(e),className:`rounded-full border px-3 py-1 text-xs transition-colors ${r===e?"border-cyan-400/50 bg-cyan-500/10 text-cyan-200":"border-slate-700 bg-slate-950/60 text-slate-300 hover:border-slate-500"}`,children:[t," (",g[e],")"]},e)),r&&(0,W.jsx)("button",{onClick:()=>n(null),className:"rounded-full border border-slate-700 px-3 py-1 text-xs text-slate-300 hover:border-slate-500",children:"Clear focus"})]})]}),l&&(0,W.jsx)("div",{className:"text-sm text-slate-400",children:"Loading review queue…"}),d&&(0,W.jsx)("div",{className:`rounded-2xl border px-4 py-3 text-sm ${"error"===d.kind?"border-red-500/30 bg-red-500/10 text-red-200":"border-emerald-500/30 bg-emerald-500/10 text-emerald-200"}`,children:(0,W.jsxs)("div",{className:"flex items-start gap-2",children:["success"===d.kind&&(0,W.jsx)(oN,{className:"mt-0.5 h-4 w-4 shrink-0"}),(0,W.jsx)("span",{children:d.message})]})}),(0,W.jsxs)("div",{className:i?"grid gap-6 xl:grid-cols-[minmax(0,1fr)_420px] xl:items-start":"",children:[(0,W.jsx)("div",{className:"grid gap-6 xl:grid-cols-2",children:y.map(e=>(0,W.jsx)("div",{className:r===e?"ring-1 ring-cyan-400/40 rounded-2xl":"",children:v[e]},e))}),i&&(0,W.jsx)("aside",{className:"xl:sticky xl:top-6 xl:self-start",children:(0,W.jsxs)("div",{className:"rounded-2xl border border-cyan-500/20 bg-slate-900/70",children:[(0,W.jsxs)("div",{className:"border-b border-slate-800 px-4 py-3",children:[(0,W.jsx)("div",{className:"text-[10px] uppercase tracking-[0.18em] text-cyan-300",children:"Selected memory"}),(0,W.jsx)("div",{className:"mt-1 text-sm text-slate-400",children:"Inspect the memory here while you keep resolving duplicates and contradictions in the review queue."})]}),(0,W.jsx)("div",{className:"xl:max-h-[calc(100vh-8rem)] xl:overflow-y-auto",children:(0,W.jsx)(lF,{memory:i,onClose:()=>a(null)})}),(0,W.jsx)("div",{className:"border-t border-slate-800 px-4 py-3",children:(0,W.jsx)("button",{onClick:()=>a(null),className:"rounded-lg border border-slate-700 px-3 py-1 text-xs text-slate-300 hover:border-slate-500",children:"Close panel"})})]})})]})]})})}let cX=(0,lD.default)("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]),cG=(0,lD.default)("file-braces",[["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 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1",key:"1oajmo"}],["path",{d:"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1",key:"mpwhp6"}]]),cZ=Q.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";function cJ(){let e=(0,sc.useMutation)({mutationFn:async({format:e,startTime:t,endTime:r})=>{let n=new URLSearchParams({format:e});t&&n.set("startTime",t),r&&n.set("endTime",r);let i=await (0,sa.gatedFetch)(`${cZ}/api/audit/export?${n}`);if(!i.ok)throw Error((await i.json().catch(()=>({}))).error||"Export failed");let a=await i.blob(),s=URL.createObjectURL(a),l=document.createElement("a");return l.href=s,l.download=`shieldcortex-audit-${Date.now()}.${"csv"===e?"csv":"json"}`,document.body.appendChild(l),l.click(),document.body.removeChild(l),URL.revokeObjectURL(s),{success:!0}}}),[t,r]=(0,H.useState)("json");return(0,W.jsxs)("div",{className:"space-y-3",children:[(0,W.jsxs)("div",{className:"flex items-center gap-2",children:[(0,W.jsx)(cX,{size:16,className:"text-cyan-400"}),(0,W.jsx)("h3",{className:"text-sm font-medium text-slate-200",children:"Export Audit Logs"})]}),(0,W.jsxs)("div",{className:"flex items-center gap-3",children:[(0,W.jsxs)("div",{className:"flex rounded-lg overflow-hidden border border-slate-700",children:[(0,W.jsxs)("button",{onClick:()=>r("json"),className:`flex items-center gap-1.5 px-3 py-1.5 text-xs transition-colors ${"json"===t?"bg-cyan-600/20 text-cyan-400":"bg-slate-800 text-slate-400 hover:text-slate-200"}`,children:[(0,W.jsx)(cG,{size:12})," JSON"]}),(0,W.jsxs)("button",{onClick:()=>r("csv"),className:`flex items-center gap-1.5 px-3 py-1.5 text-xs transition-colors ${"csv"===t?"bg-cyan-600/20 text-cyan-400":"bg-slate-800 text-slate-400 hover:text-slate-200"}`,children:[(0,W.jsx)(lJ,{size:12})," CSV"]})]}),(0,W.jsxs)("button",{onClick:()=>e.mutate({format:t}),disabled:e.isPending,className:"flex items-center gap-1.5 px-4 py-1.5 text-xs bg-cyan-600 text-white rounded-lg hover:bg-cyan-500 disabled:opacity-50 transition-colors",children:[(0,W.jsx)(cX,{size:12}),e.isPending?"Exporting...":"Export"]})]}),e.error&&(0,W.jsx)("p",{className:"text-xs text-red-400",children:e.error.message}),e.isSuccess&&(0,W.jsx)("p",{className:"text-xs text-green-400",children:"Export downloaded successfully."})]})}function c0(){return(0,W.jsx)("div",{className:"bg-slate-900/50 border border-slate-800 rounded-xl p-4",children:(0,W.jsx)(cx,{feature:"audit_export",label:"Export your full audit trail as JSON or CSV for compliance reporting.",children:(0,W.jsx)(cJ,{})})})}let c1={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"}},c2={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)"}},c5={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 c4(e){return e>=.7?"#22C55E":e>=.4?"#EAB308":"#EF4444"}function c3(e){return e>.5?"#EF4444":e>.2?"#EAB308":"#94a3b8"}function c6({entry:e,onClose:t,onViewMemory:r}){let[n,i]=(0,H.useState)(!1),a=c1[e.firewall_result]||c1.ALLOW,s=c2[e.sensitivity_level]||c2.PUBLIC,l=function(e){try{let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}(e.threat_indicators),o=function(e){try{let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}(e.blocked_patterns),c=(0,H.useCallback)(()=>{let t=JSON.stringify(e,null,2);navigator.clipboard.writeText(t).then(()=>{i(!0),setTimeout(()=>i(!1),1500)})},[e]);return(0,W.jsxs)(lg,{className:"bg-slate-900 border-slate-700 overflow-hidden",children:[(0,W.jsxs)(lv,{className:"border-b border-slate-700 pb-3",children:[(0,W.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,W.jsxs)("div",{className:"flex items-center gap-3",children:[(0,W.jsx)("span",{className:"px-2.5 py-1 rounded-md text-xs font-bold",style:{backgroundColor:a.bg,color:a.color},children:a.label}),(0,W.jsx)("span",{className:"px-2 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:s.bg,color:s.color},children:e.sensitivity_level})]}),(0,W.jsx)(lM,{variant:"ghost",size:"sm",onClick:t,className:"text-slate-400 hover:text-white -mt-1",children:"✕"})]}),(0,W.jsx)("div",{className:"text-xs text-slate-400 mt-2",children:new Date(e.timestamp).toLocaleString()}),e.project&&(0,W.jsxs)("div",{className:"text-[10px] text-slate-500 mt-1",children:["Project: ",e.project]})]}),(0,W.jsxs)(lj,{className:"p-4 space-y-4",children:[(0,W.jsxs)("div",{children:[(0,W.jsx)("h4",{className:"text-xs font-medium text-slate-400 mb-2",children:"Source"}),(0,W.jsxs)("div",{className:"bg-slate-800 rounded-lg p-3",children:[(0,W.jsx)("div",{className:"flex items-center gap-2 mb-1",children:(0,W.jsx)("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium bg-cyan-500/10 text-cyan-400",children:e.source_type})}),e.source_identifier&&(0,W.jsx)("div",{className:"text-xs text-slate-300 mt-1 font-mono break-all",children:e.source_identifier})]})]}),(0,W.jsxs)("div",{children:[(0,W.jsx)("h4",{className:"text-xs font-medium text-slate-400 mb-2",children:"Scores"}),(0,W.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,W.jsxs)("div",{className:"bg-slate-800 rounded-lg p-3",children:[(0,W.jsx)("div",{className:"text-[10px] text-slate-500",children:"Trust"}),(0,W.jsxs)("div",{className:"text-lg font-bold",style:{color:c4(e.trust_score)},children:[(100*e.trust_score).toFixed(0),"%"]}),(0,W.jsx)("div",{className:"mt-1 h-1.5 bg-slate-700 rounded-full overflow-hidden",children:(0,W.jsx)("div",{className:"h-full rounded-full transition-all",style:{width:`${100*e.trust_score}%`,backgroundColor:c4(e.trust_score)}})})]}),(0,W.jsxs)("div",{className:"bg-slate-800 rounded-lg p-3",children:[(0,W.jsx)("div",{className:"text-[10px] text-slate-500",children:"Anomaly"}),(0,W.jsxs)("div",{className:"text-lg font-bold",style:{color:c3(e.anomaly_score)},children:[(100*e.anomaly_score).toFixed(0),"%"]}),(0,W.jsx)("div",{className:"mt-1 h-1.5 bg-slate-700 rounded-full overflow-hidden",children:(0,W.jsx)("div",{className:"h-full rounded-full transition-all",style:{width:`${100*e.anomaly_score}%`,backgroundColor:c3(e.anomaly_score)}})})]}),null!==e.fragmentation_score&&(0,W.jsxs)("div",{className:"bg-slate-800 rounded-lg p-3",children:[(0,W.jsx)("div",{className:"text-[10px] text-slate-500",children:"Fragmentation"}),(0,W.jsxs)("div",{className:"text-lg font-bold text-slate-300",children:[(100*e.fragmentation_score).toFixed(0),"%"]}),(0,W.jsx)("div",{className:"mt-1 h-1.5 bg-slate-700 rounded-full overflow-hidden",children:(0,W.jsx)("div",{className:"h-full rounded-full bg-purple-500 transition-all",style:{width:`${100*e.fragmentation_score}%`}})})]}),null!==e.pipeline_duration_ms&&(0,W.jsxs)("div",{className:"bg-slate-800 rounded-lg p-3",children:[(0,W.jsx)("div",{className:"text-[10px] text-slate-500",children:"Pipeline"}),(0,W.jsxs)("div",{className:"text-lg font-bold text-slate-300",children:[e.pipeline_duration_ms,"ms"]})]})]})]}),(0,W.jsxs)("div",{children:[(0,W.jsx)("h4",{className:"text-xs font-medium text-slate-400 mb-2",children:"Threat Indicators"}),l.length>0?(0,W.jsx)("div",{className:"flex flex-wrap gap-1.5",children:l.map((e,t)=>{let r=c5[e]||{color:"#94a3b8",bg:"rgba(148, 163, 184, 0.15)"};return(0,W.jsx)("span",{className:"px-2 py-1 rounded text-[11px] font-medium",style:{backgroundColor:r.bg,color:r.color},children:e.replace(/_/g," ")},t)})}):(0,W.jsx)("div",{className:"text-xs text-slate-600",children:"No threats detected"})]}),o.length>0&&(0,W.jsxs)("div",{children:[(0,W.jsx)("h4",{className:"text-xs font-medium text-slate-400 mb-2",children:"Blocked Patterns"}),(0,W.jsx)("div",{className:"bg-slate-800 rounded-lg p-3 max-h-32 overflow-y-auto",children:o.map((e,t)=>(0,W.jsx)("div",{className:"text-[11px] text-slate-300 font-mono break-all mb-1 last:mb-0",children:e},t))})]}),e.reason&&(0,W.jsxs)("div",{children:[(0,W.jsx)("h4",{className:"text-xs font-medium text-slate-400 mb-2",children:"Reason"}),(0,W.jsx)("div",{className:"bg-slate-800 rounded-lg p-3",children:(0,W.jsx)("p",{className:"text-xs text-slate-300 whitespace-pre-wrap leading-relaxed",children:e.reason})})]}),(0,W.jsxs)("div",{className:"flex gap-2 pt-2",children:[e.memory_id&&r&&(0,W.jsx)(lM,{variant:"default",size:"sm",onClick:()=>r(e.memory_id),className:"flex-1 bg-blue-600 hover:bg-blue-700",children:"View Memory"}),(0,W.jsx)(lM,{variant:"outline",size:"sm",onClick:c,className:`flex-1 border-slate-700 transition-all ${n?"bg-green-600/20 text-green-400 border-green-600/50":"text-slate-300 hover:text-white"}`,children:n?"Copied":"Copy JSON"})]})]})]})}let c8={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 c7(){let{projectFilter:e,selectedAuditEntry:t,setSelectedAuditEntry:r}=(0,sr.useDashboardStore)(),[n,i]=(0,H.useState)("24h"),[a,s]=(0,H.useState)(void 0),[l,o]=(0,H.useState)(void 0),c={"24h":24,"7d":168,"30d":720},[d,u]=(0,H.useState)(()=>Date.now());(0,H.useEffect)(()=>{u(Date.now())},[n]);let h=(0,H.useMemo)(()=>new Date(6e4*Math.floor((d-36e5*c[n])/6e4)).toISOString(),[d,n]),{data:p,isLoading:m}=(0,lq.useAuditLogs)({startTime:h,source:a,firewallResult:l,project:e||void 0,limit:200}),f=(0,H.useMemo)(()=>p?.logs??[],[p?.logs]),x=f.filter(e=>"BLOCK"===e.firewall_result).length,y=f.filter(e=>"QUARANTINE"===e.firewall_result).length,g=f.filter(e=>"ALLOW"===e.firewall_result).length,v=(0,H.useCallback)(e=>{if(!t||0===f.length)return;let n=f.findIndex(e=>e.id===t.id);"Escape"===e.key?r(null):"ArrowDown"===e.key&&n<f.length-1?(e.preventDefault(),r(f[n+1])):"ArrowUp"===e.key&&n>0&&(e.preventDefault(),r(f[n-1]))},[t,f,r]);return(0,H.useEffect)(()=>(window.addEventListener("keydown",v),()=>window.removeEventListener("keydown",v)),[v]),(0,W.jsx)("div",{className:"h-full overflow-y-auto bg-slate-950",children:(0,W.jsxs)("div",{className:"mx-auto max-w-7xl space-y-6 p-6",children:[(0,W.jsxs)("section",{className:"rounded-2xl border border-slate-800 bg-slate-900/70 p-5",children:[(0,W.jsxs)("div",{className:"flex flex-col gap-4 xl:flex-row xl:items-start xl:justify-between mb-3",children:[(0,W.jsxs)("div",{children:[(0,W.jsx)("h2",{className:"text-lg font-semibold text-white",children:"Audit Log"}),(0,W.jsx)("p",{className:"mt-1 text-sm text-slate-400",children:"Start with the result counts and pick a row only when you need the deeper payload. Export stays available, but it should not dominate the first screen."})]}),(0,W.jsx)("div",{className:"flex gap-1 bg-slate-800 rounded-lg p-0.5",children:["24h","7d","30d"].map(e=>(0,W.jsx)("button",{onClick:()=>i(e),className:`px-3 py-1 text-xs rounded-md transition-colors ${n===e?"bg-cyan-600 text-white":"text-slate-400 hover:text-white"}`,children:e},e))})]}),(0,W.jsxs)("div",{className:"mb-4 grid gap-3 md:grid-cols-4",children:[(0,W.jsxs)("div",{className:"rounded-xl border border-slate-800 bg-slate-950/60 p-3",children:[(0,W.jsx)("div",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:"Entries"}),(0,W.jsx)("div",{className:"mt-1 text-xl font-semibold text-white",children:f.length})]}),(0,W.jsxs)("div",{className:"rounded-xl border border-slate-800 bg-slate-950/60 p-3",children:[(0,W.jsx)("div",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:"Allowed"}),(0,W.jsx)("div",{className:"mt-1 text-xl font-semibold text-emerald-300",children:g})]}),(0,W.jsxs)("div",{className:"rounded-xl border border-slate-800 bg-slate-950/60 p-3",children:[(0,W.jsx)("div",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:"Blocked"}),(0,W.jsx)("div",{className:"mt-1 text-xl font-semibold text-red-300",children:x})]}),(0,W.jsxs)("div",{className:"rounded-xl border border-slate-800 bg-slate-950/60 p-3",children:[(0,W.jsx)("div",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:"Quarantined"}),(0,W.jsx)("div",{className:"mt-1 text-xl font-semibold text-amber-300",children:y})]})]}),(0,W.jsxs)("div",{className:"flex gap-2 flex-wrap",children:[(0,W.jsxs)("select",{value:l||"",onChange:e=>o(e.target.value||void 0),className:"bg-slate-800 border border-slate-700 text-white text-xs rounded-lg px-2 py-1",children:[(0,W.jsx)("option",{value:"",children:"All Results"}),(0,W.jsx)("option",{value:"ALLOW",children:"Allowed"}),(0,W.jsx)("option",{value:"BLOCK",children:"Blocked"}),(0,W.jsx)("option",{value:"QUARANTINE",children:"Quarantined"})]}),(0,W.jsxs)("select",{value:a||"",onChange:e=>s(e.target.value||void 0),className:"bg-slate-800 border border-slate-700 text-white text-xs rounded-lg px-2 py-1",children:[(0,W.jsx)("option",{value:"",children:"All Sources"}),(0,W.jsx)("option",{value:"hook",children:"Hook"}),(0,W.jsx)("option",{value:"api",children:"API"}),(0,W.jsx)("option",{value:"agent",children:"Agent"}),(0,W.jsx)("option",{value:"user",children:"User"}),(0,W.jsx)("option",{value:"cli",children:"CLI"})]}),(0,W.jsx)("button",{onClick:()=>r(null),className:"ml-auto rounded-full border border-slate-700 bg-slate-900/70 px-3 py-1 text-xs text-slate-300 transition-colors hover:border-slate-500 hover:text-white",children:"Clear selection"})]})]}),(0,W.jsxs)("div",{className:`grid gap-6 ${t?"xl:grid-cols-[minmax(0,1.35fr)_360px]":""}`,children:[(0,W.jsx)("section",{className:"rounded-2xl border border-slate-800 bg-slate-900/70 overflow-hidden",children:m?(0,W.jsx)("div",{className:"flex items-center justify-center h-32",children:(0,W.jsx)("div",{className:"text-xs text-slate-500 animate-pulse",children:"Loading audit logs..."})}):0===f.length?(0,W.jsx)("div",{className:"flex items-center justify-center h-32",children:(0,W.jsx)("div",{className:"text-xs text-slate-500",children:"No audit entries for this period"})}):(0,W.jsx)("div",{className:"overflow-x-auto",children:(0,W.jsxs)("table",{className:"w-full text-xs",children:[(0,W.jsx)("thead",{className:"bg-slate-950/80",children:(0,W.jsxs)("tr",{className:"border-b border-slate-800",children:[(0,W.jsx)("th",{className:"text-left text-slate-500 font-medium px-4 py-2",children:"Time"}),(0,W.jsx)("th",{className:"text-left text-slate-500 font-medium px-4 py-2",children:"Source"}),(0,W.jsx)("th",{className:"text-left text-slate-500 font-medium px-4 py-2",children:"Result"}),(0,W.jsx)("th",{className:"text-left text-slate-500 font-medium px-4 py-2",children:"Trust"}),(0,W.jsx)("th",{className:"text-left text-slate-500 font-medium px-4 py-2",children:"Anomaly"}),(0,W.jsx)("th",{className:"text-left text-slate-500 font-medium px-4 py-2",children:"Reason"})]})}),(0,W.jsx)("tbody",{children:f.map(e=>(0,W.jsxs)("tr",{onClick:()=>{r(t?.id===e.id?null:e)},className:`border-b border-slate-800/50 cursor-pointer transition-colors ${t?.id===e.id?"bg-cyan-500/10 hover:bg-cyan-500/15":"hover:bg-slate-800/30"}`,children:[(0,W.jsx)("td",{className:"px-4 py-2 text-slate-400 whitespace-nowrap",children:new Date(e.timestamp).toLocaleString()}),(0,W.jsx)("td",{className:"px-4 py-2 text-slate-300",children:e.source_type}),(0,W.jsx)("td",{className:"px-4 py-2",children:(0,W.jsx)("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-medium ${c8[e.firewall_result]||"text-slate-400"}`,children:e.firewall_result})}),(0,W.jsx)("td",{className:"px-4 py-2 text-slate-400",children:e.trust_score.toFixed(1)}),(0,W.jsx)("td",{className:"px-4 py-2",children:(0,W.jsx)("span",{className:e.anomaly_score>.5?"text-red-400":e.anomaly_score>.2?"text-yellow-400":"text-slate-400",children:e.anomaly_score.toFixed(2)})}),(0,W.jsx)("td",{className:"px-4 py-2 text-slate-400 max-w-xs truncate",children:e.reason||"—"})]},e.id))})]})})}),t&&(0,W.jsx)("div",{className:"xl:sticky xl:top-6 self-start",children:(0,W.jsx)(c6,{entry:t,onClose:()=>r(null)})})]}),(0,W.jsxs)("details",{className:"rounded-2xl border border-slate-800 bg-slate-900/50 p-4",children:[(0,W.jsx)("summary",{className:"cursor-pointer list-none text-sm font-medium text-slate-200",children:"Export audit trail"}),(0,W.jsx)("div",{className:"mt-4",children:(0,W.jsx)(c0,{})})]})]})})}let c9=(0,lD.default)("square-check-big",[["path",{d:"M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344",key:"2acyp4"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]),de=(0,lD.default)("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]),dt=(0,lD.default)("square-minus",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 12h8",key:"1wcyev"}]]);function dr({action:e,item:t,onConfirm:r,onCancel:n}){let[i,a]=(0,H.useState)(""),s="yes"===i.trim().toLowerCase();return(0,W.jsx)("div",{className:"fixed inset-0 bg-black/60 flex items-center justify-center z-50",children:(0,W.jsxs)("div",{className:"bg-slate-900 border border-slate-700 rounded-xl p-6 max-w-md w-full mx-4",children:[(0,W.jsxs)("h3",{className:"text-sm font-semibold text-white mb-2",children:["approve"===e?"Approve":"Reject"," quarantined item?"]}),(0,W.jsx)("p",{className:"text-xs text-slate-400 mb-1",children:(0,W.jsx)("strong",{children:t.title||"Untitled"})}),(0,W.jsx)("p",{className:"text-xs text-slate-500 mb-4",children:"approve"===e?"This will approve the item and promote it into memory.":"This will permanently discard the memory."}),(0,W.jsxs)("div",{className:"mb-4",children:[(0,W.jsxs)("label",{className:"text-xs text-slate-400 block mb-1",children:["Type ",(0,W.jsx)("strong",{className:"text-white",children:"YES"})," to confirm:"]}),(0,W.jsx)("input",{type:"text",value:i,onChange:e=>a(e.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:e=>{"Enter"===e.key&&s&&r(),"Escape"===e.key&&n()}})]}),(0,W.jsxs)("div",{className:"flex gap-2 justify-end",children:[(0,W.jsx)("button",{onClick:n,className:"px-3 py-1.5 text-xs text-slate-400 hover:text-white transition-colors",children:"Cancel"}),(0,W.jsx)("button",{onClick:r,disabled:!s,className:`px-3 py-1.5 text-xs rounded-lg transition-colors ${s?"approve"===e?"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"===e?"Approve":"Reject"})]})]})})}function dn(){let{projectFilter:e}=(0,sr.useDashboardStore)(),[t,r]=(0,H.useState)("pending"),{data:n,isLoading:i}=(0,lq.useQuarantine)(t,100,e||void 0),a=(0,lq.useApproveQuarantine)(),s=(0,lq.useRejectQuarantine)(),l=(0,lq.useBulkApproveQuarantine)(),o=(0,lq.useBulkRejectQuarantine)(),[c,d]=(0,H.useState)(null),[u,h]=(0,H.useState)(new Set),[p,m]=(0,H.useState)(null),f=a.error?.message||s.error?.message||l.error?.message||o.error?.message||null,x=n?.items??[],y=x.filter(e=>"pending"===e.status),g=y.length>0&&y.every(e=>u.has(e.id)),v=y.some(e=>u.has(e.id)),b=(0,H.useCallback)(e=>{h(t=>{let r=new Set(t);return r.has(e)?r.delete(e):r.add(e),r})},[]),j=(0,H.useCallback)(()=>{g?h(new Set):h(new Set(y.map(e=>e.id)))},[g,y]);return(0,W.jsxs)("div",{className:"h-full overflow-y-auto bg-slate-950",children:[c&&(0,W.jsx)(dr,{action:c.action,item:c.item,onConfirm:()=>{c&&("approve"===c.action?a.mutate(c.item.id):s.mutate({id:c.item.id}),d(null))},onCancel:()=>d(null)}),p&&(0,W.jsx)("div",{className:"fixed inset-0 bg-black/60 flex items-center justify-center z-50",children:(0,W.jsxs)("div",{className:"bg-slate-900 border border-slate-700 rounded-xl p-6 max-w-md w-full mx-4",children:[(0,W.jsxs)("h3",{className:"text-sm font-semibold text-white mb-2",children:["approve"===p?"Approve":"Reject"," ",u.size," item",1!==u.size?"s":"","?"]}),(0,W.jsx)("p",{className:"text-xs text-slate-400 mb-4",children:"approve"===p?"This will approve all selected items and promote them into memory.":"This will permanently discard all selected memories."}),(0,W.jsxs)("div",{className:"flex gap-2 justify-end",children:[(0,W.jsx)("button",{onClick:()=>m(null),className:"px-3 py-1.5 text-xs text-slate-400 hover:text-white transition-colors",children:"Cancel"}),(0,W.jsxs)("button",{onClick:()=>{if(!p||0===u.size)return;let e=Array.from(u);"approve"===p?l.mutate(e):o.mutate(e),h(new Set),m(null)},className:`px-3 py-1.5 text-xs rounded-lg transition-colors ${"approve"===p?"bg-green-600 text-white hover:bg-green-500":"bg-red-600 text-white hover:bg-red-500"}`,children:["approve"===p?"Approve":"Reject"," ",u.size," item",1!==u.size?"s":""]})]})]})}),(0,W.jsxs)("div",{className:"mx-auto max-w-6xl space-y-6 p-6",children:[(0,W.jsxs)("div",{className:"rounded-2xl border border-slate-800 bg-slate-900/70 p-5",children:[(0,W.jsxs)("div",{className:"flex items-center justify-between",children:[(0,W.jsx)("h2",{className:"text-lg font-semibold text-white",children:"Quarantine Review"}),(0,W.jsx)("div",{className:"flex gap-1 bg-slate-800 rounded-lg p-0.5",children:["pending","approved","rejected"].map(e=>(0,W.jsx)("button",{onClick:()=>{r(e),h(new Set)},className:`px-3 py-1 text-xs rounded-md transition-colors capitalize ${t===e?"bg-cyan-600 text-white":"text-slate-400 hover:text-white"}`,children:e},e))})]}),"pending"===t&&y.length>0&&(0,W.jsxs)("div",{className:"flex items-center gap-3 mt-3",children:[(0,W.jsxs)("button",{onClick:j,className:"flex items-center gap-1.5 text-xs text-slate-400 hover:text-white transition-colors",children:[g?(0,W.jsx)(c9,{size:14,className:"text-cyan-400"}):v?(0,W.jsx)(dt,{size:14,className:"text-cyan-400"}):(0,W.jsx)(de,{size:14}),g?"Deselect all":"Select all"]}),v&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)("span",{className:"text-xs text-slate-500",children:[u.size," selected"]}),(0,W.jsxs)("button",{onClick:()=>m("approve"),className:"flex items-center gap-1 px-2.5 py-1 text-xs bg-green-600/10 text-green-400 rounded-lg hover:bg-green-600/20 transition-colors",children:[(0,W.jsx)(lz,{size:12})," Approve"]}),(0,W.jsxs)("button",{onClick:()=>m("reject"),className:"flex items-center gap-1 px-2.5 py-1 text-xs bg-red-600/10 text-red-400 rounded-lg hover:bg-red-600/20 transition-colors",children:[(0,W.jsx)(ok.X,{size:12})," Reject"]})]})]})]}),f&&(0,W.jsx)("div",{className:"rounded-2xl border border-red-500/30 bg-red-500/10 p-4 text-sm text-red-200",children:f}),(0,W.jsx)("div",{children:i?(0,W.jsx)("div",{className:"flex items-center justify-center rounded-2xl border border-slate-800 bg-slate-900/70 h-32",children:(0,W.jsx)("div",{className:"text-xs text-slate-500 animate-pulse",children:"Loading quarantine items..."})}):0===x.length?(0,W.jsxs)("div",{className:"flex flex-col items-center justify-center rounded-2xl border border-slate-800 bg-slate-900/70 h-32 text-slate-500",children:[(0,W.jsx)(l0,{size:24,className:"mb-2 text-slate-600"}),(0,W.jsxs)("span",{className:"text-xs",children:["No ",t," items"]})]}):(0,W.jsx)("div",{className:"space-y-3",children:x.map(e=>{let t=(()=>{try{return JSON.parse(e.threat_indicators)}catch{return[]}})();return(0,W.jsxs)("div",{className:`bg-slate-900 border rounded-xl p-4 ${u.has(e.id)?"border-cyan-600/50":"border-slate-800"}`,children:[(0,W.jsxs)("div",{className:"flex items-start justify-between mb-2",children:[(0,W.jsxs)("div",{className:"flex items-start gap-2.5",children:["pending"===e.status&&(0,W.jsx)("button",{onClick:()=>b(e.id),className:"mt-0.5 text-slate-500 hover:text-cyan-400 transition-colors shrink-0",children:u.has(e.id)?(0,W.jsx)(c9,{size:14,className:"text-cyan-400"}):(0,W.jsx)(de,{size:14})}),(0,W.jsxs)("div",{children:[(0,W.jsx)("h4",{className:"text-sm font-medium text-white",children:e.title||"Untitled"}),(0,W.jsxs)("div",{className:"text-[10px] text-slate-500 mt-0.5",children:[e.source_type," · ",new Date(e.created_at).toLocaleString(),e.anomaly_score>0&&(0,W.jsxs)("span",{className:`ml-2 ${e.anomaly_score>.5?"text-red-400":"text-yellow-400"}`,children:["Anomaly: ",e.anomaly_score.toFixed(2)]})]})]})]}),(0,W.jsx)("span",{className:"text-[10px] text-red-400 bg-red-400/10 px-2 py-0.5 rounded",children:e.reason?.slice(0,50)||"Threat detected"})]}),(0,W.jsx)("div",{className:"bg-slate-800/50 rounded-lg p-3 mb-3 text-xs text-slate-300 whitespace-pre-wrap break-words",children:e.content?.slice(0,500)||"No content"}),t.length>0&&(0,W.jsx)("div",{className:"flex gap-1 mb-3 flex-wrap",children:t.map((e,t)=>(0,W.jsx)("span",{className:"text-[9px] text-yellow-400 bg-yellow-400/10 px-1.5 py-0.5 rounded",children:e},t))}),"pending"===e.status&&(0,W.jsxs)("div",{className:"flex gap-2",children:[(0,W.jsxs)("button",{onClick:()=>d({action:"approve",item:e}),disabled:a.isPending||l.isPending,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,W.jsx)(lz,{size:12})," Approve"]}),(0,W.jsxs)("button",{onClick:()=>d({action:"reject",item:e}),disabled:s.isPending||o.isPending,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,W.jsx)(ok.X,{size:12})," Reject"]})]}),e.reviewed_at&&(0,W.jsxs)("div",{className:"text-[10px] text-slate-500",children:["approved"===e.status?"Approved":"Rejected"," by ",e.reviewed_by," at ",new Date(e.reviewed_at).toLocaleString()]})]},e.id)})})})]})]})}let di=(0,lD.default)("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"}]]),da=(0,lD.default)("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"}]]);var ds=e.i(22934);let dl=Q.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";async function dc(e,t){let r=new URLSearchParams({timeRange:e});t&&r.set("project",t);let n=await (0,sa.authFetch)(`${dl}/api/v1/agents?${r}`);if(!n.ok)throw Error("Failed to fetch agent registry");return n.json()}async function dd(e,t,r){let n=encodeURIComponent(e),i=new URLSearchParams({timeRange:t});r&&i.set("project",r);let a=await (0,sa.authFetch)(`${dl}/api/v1/agents/${n}/timeline?${i}`);if(!a.ok)throw Error("Failed to fetch agent timeline");return a.json()}async function du(e,t){let r=encodeURIComponent(e),n=new URLSearchParams;t?.limit&&n.set("limit",t.limit.toString()),t?.offset&&n.set("offset",t.offset.toString()),t?.firewallResult&&n.set("firewallResult",t.firewallResult),t?.project&&n.set("project",t.project);let i=await (0,sa.authFetch)(`${dl}/api/v1/agents/${r}/operations?${n}`);if(!i.ok)throw Error("Failed to fetch agent operations");return i.json()}function dh(e,t){return(0,si.useQuery)({queryKey:["agent-operations",e,t],queryFn:()=>du(e,t),enabled:!!e,refetchInterval:3e4,retry:2})}function dp(e){return e>=.7?"full":e>=.5?"limited":"restricted"}let dm={full:"text-green-400",limited:"text-yellow-400",restricted:"text-red-400"},df={full:"bg-green-500/10",limited:"bg-yellow-500/10",restricted:"bg-red-500/10"},dx={full:"Full Access",limited:"Limited",restricted:"Restricted"},dy=460,dg=90;function dv({identifier:e,timeRange:t}){let{data:r,isLoading:n}=function(e,t="24h",r){return(0,si.useQuery)({queryKey:["agent-timeline",e,t,void 0],queryFn:()=>dd(e,t,void 0),enabled:!!e,refetchInterval:3e4,retry:2})}(e,t),i=(0,H.useMemo)(()=>r?.points??[],[r?.points]),{linePath:a,dots:s,xLabels:l}=(0,H.useMemo)(()=>{if(0===i.length)return{linePath:"",dots:[],xLabels:[]};let e=i.map(e=>new Date(e.timestamp).getTime()),r=Math.min(...e),n=Math.max(...e)-r||1,a=e=>30+(e-r)/n*dy,s=e=>10+(1-e)*dg,l=i.map((t,r)=>{let n=a(e[r]),i=s(t.trust_score);return`${0===r?"M":"L"} ${n} ${i}`}),o=i.map((t,r)=>({x:a(e[r]),y:s(t.trust_score),result:t.firewall_result,score:t.trust_score,time:t.timestamp})).filter(e=>"ALLOW"!==e.result),c=Math.min(5,i.length),d=[];for(let e=0;e<c;e++){let i=r+n*e/(c-1||1),s=new Date(i);d.push({x:a(i),label:"24h"===t?s.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):s.toLocaleDateString([],{month:"short",day:"numeric"})})}return{linePath:l.join(" "),dots:o,xLabels:d}},[i,t]);return n?(0,W.jsx)("div",{className:"h-[120px] flex items-center justify-center text-slate-500 text-xs",children:"Loading timeline..."}):0===i.length?(0,W.jsx)("div",{className:"h-[120px] flex items-center justify-center text-slate-500 text-xs",children:"No data for this time range."}):(0,W.jsxs)("svg",{viewBox:"0 0 500 120",className:"w-full",preserveAspectRatio:"xMidYMid meet",children:[(0,W.jsx)("line",{x1:30,y1:10+(1-.7)*dg,x2:30+dy,y2:10+(1-.7)*dg,stroke:"#22c55e",strokeWidth:"0.5",strokeDasharray:"4 2",opacity:"0.3"}),(0,W.jsx)("line",{x1:30,y1:10+.5*dg,x2:30+dy,y2:10+.5*dg,stroke:"#eab308",strokeWidth:"0.5",strokeDasharray:"4 2",opacity:"0.3"}),(0,W.jsx)("text",{x:26,y:10+(1-.7)*dg+3,fill:"#64748b",fontSize:"8",textAnchor:"end",children:"0.7"}),(0,W.jsx)("text",{x:26,y:10+.5*dg+3,fill:"#64748b",fontSize:"8",textAnchor:"end",children:"0.5"}),(0,W.jsx)("text",{x:26,y:13,fill:"#64748b",fontSize:"8",textAnchor:"end",children:"1.0"}),(0,W.jsx)("text",{x:26,y:10+dg+3,fill:"#64748b",fontSize:"8",textAnchor:"end",children:"0.0"}),(0,W.jsx)("path",{d:a,fill:"none",stroke:"#06b6d4",strokeWidth:"1.5"}),s.map((e,t)=>(0,W.jsx)("circle",{cx:e.x,cy:e.y,r:"3",fill:"BLOCK"===e.result?"#ef4444":"#eab308",stroke:"#0f172a",strokeWidth:"1",children:(0,W.jsx)("title",{children:`${e.result} — trust: ${e.score.toFixed(2)} — ${new Date(e.time).toLocaleString()}`})},t)),l.map((e,t)=>(0,W.jsx)("text",{x:e.x,y:116,fill:"#64748b",fontSize:"8",textAnchor:"middle",children:e.label},t))]})}let db={BLOCK:"text-red-400 bg-red-500/10",QUARANTINE:"text-yellow-400 bg-yellow-500/10"};function dj({identifier:e}){let{data:t,isLoading:r}=dh(e,{firewallResult:"BLOCK",limit:20}),{data:n}=dh(e,{firewallResult:"QUARANTINE",limit:20}),i=[...t?.entries??[],...n?.entries??[]].sort((e,t)=>new Date(t.timestamp).getTime()-new Date(e.timestamp).getTime());return r?(0,W.jsx)("div",{className:"text-slate-500 text-xs",children:"Loading..."}):0===i.length?(0,W.jsx)("div",{className:"text-slate-500 text-xs",children:"No flagged operations."}):(0,W.jsx)("div",{className:"space-y-1 max-h-60 overflow-y-auto",children:i.map(e=>{let t=[];try{t=JSON.parse(e.threat_indicators)}catch{}return(0,W.jsxs)("div",{className:"px-2 py-1.5 rounded bg-slate-800/50 border border-slate-800",children:[(0,W.jsxs)("div",{className:"flex items-center justify-between",children:[(0,W.jsx)("span",{className:`px-1 py-0.5 rounded text-[10px] font-medium ${db[e.firewall_result]??"text-slate-400"}`,children:e.firewall_result}),(0,W.jsx)("span",{className:"text-[10px] text-slate-500",children:new Date(e.timestamp).toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})})]}),e.reason&&(0,W.jsx)("p",{className:"text-[11px] text-slate-400 mt-0.5 truncate",children:e.reason}),t.length>0&&(0,W.jsx)("div",{className:"flex gap-1 mt-1 flex-wrap",children:t.map((e,t)=>(0,W.jsx)("span",{className:"px-1 py-0.5 rounded text-[9px] bg-red-500/10 text-red-400",children:e},t))}),(0,W.jsxs)("div",{className:"flex gap-3 mt-1 text-[10px] text-slate-500",children:[(0,W.jsxs)("span",{children:["Trust: ",e.trust_score.toFixed(2)]}),(0,W.jsxs)("span",{children:["Anomaly: ",e.anomaly_score.toFixed(2)]}),null!==e.pipeline_duration_ms&&(0,W.jsxs)("span",{children:[e.pipeline_duration_ms,"ms"]})]})]},e.id)})})}let dw=(0,lD.default)("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"}]]),dN=Q.default.env.NEXT_PUBLIC_WS_URL||"ws://localhost:3001/ws/events";function dk({agentFilter:e}){let[t,r]=(0,H.useState)([]),n=(0,H.useRef)(0),i=(0,H.useRef)(null),a=(0,H.useCallback)(t=>{try{let i=JSON.parse(t.data);if("defence_event"!==i.type)return;let a=i.data;if(e&&a.source_identifier!==e)return;r(e=>[{...a,id:++n.current},...e].slice(0,50))}catch{}},[e]);return((0,H.useEffect)(()=>{try{let e=new WebSocket(dN);return i.current=e,e.onmessage=a,e.onerror=()=>{},()=>{e.close(),i.current=null}}catch{return}},[a]),0===t.length)?(0,W.jsxs)("div",{className:"flex items-center gap-2 text-slate-500 text-xs py-2",children:[(0,W.jsx)(dw,{size:12}),(0,W.jsx)("span",{children:"Listening for defence events..."})]}):(0,W.jsx)("div",{className:"space-y-1 max-h-48 overflow-y-auto",children:(0,W.jsx)(eh,{initial:!1,children:t.map(e=>(0,W.jsxs)(a9.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"===e.firewall_result?"bg-red-500/5 border-red-500/20":"bg-yellow-500/5 border-yellow-500/20"}`,children:[(0,W.jsxs)("div",{className:"flex items-center justify-between",children:[(0,W.jsx)("span",{className:`font-medium ${"BLOCK"===e.firewall_result?"text-red-400":"text-yellow-400"}`,children:e.firewall_result}),(0,W.jsx)("span",{className:"text-[10px] text-slate-500",children:new Date(e.timestamp).toLocaleTimeString()})]}),(0,W.jsxs)("p",{className:"text-slate-400 text-[11px] truncate mt-0.5",children:[e.source_identifier," — ",e.reason??"No reason"]})]},e.id))})})}function dS({identifier:e,compact:t}){let r=e.split(">").map(e=>e.trim());return 1===r.length?(0,W.jsx)("span",{className:"font-mono text-sm text-white",children:e}):t?(0,W.jsxs)("span",{className:"font-mono text-sm",children:[(0,W.jsxs)("span",{className:"text-slate-500",children:[r.slice(0,-1).join(" › ")," › "]}),(0,W.jsx)("span",{className:"text-white",children:r[r.length-1]})]}):(0,W.jsx)("div",{className:"font-mono text-sm",children:r.map((e,t)=>(0,W.jsxs)("span",{children:[t>0&&(0,W.jsx)(ds.ChevronRight,{size:12,className:"inline text-slate-600 mx-0.5"}),(0,W.jsx)("span",{className:t===r.length-1?"text-white":"text-slate-500",children:e})]},t))})}function dO({score:e}){let t=dp(e);return(0,W.jsxs)("span",{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-medium ${dm[t]} ${df[t]}`,children:[e.toFixed(2)," · ",dx[t]]})}function dP({type:e}){let t={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"}[e]??"text-slate-400 bg-slate-500/10";return(0,W.jsx)("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-medium ${t}`,children:e})}function dC(){let{projectFilter:e}=(0,sr.useDashboardStore)(),[t,r]=(0,H.useState)("24h"),[n,i]=(0,H.useState)(null),[a,s]=(0,H.useState)("operation_count"),[l,o]=(0,H.useState)(!1),[c,d]=(0,H.useState)(null),[u,h]=(0,H.useState)(null),[p,m]=(0,H.useState)(!1),[f]=(0,H.useState)(()=>Date.now()),{data:x,isLoading:y}=function(e="24h",t){return(0,si.useQuery)({queryKey:["agents",e,t],queryFn:()=>dc(e,t),refetchInterval:3e4,retry:2})}(t,e??void 0),g=(0,H.useMemo)(()=>x?.agents??[],[x?.agents]),v=(0,H.useMemo)(()=>{let e=g;return c&&(e=e.filter(e=>e.source_type===c)),u&&(e=e.filter(e=>dp(e.avg_trust_score)===u)),p&&(e=e.filter(e=>e.flagged_count>0)),e},[g,c,u,p]),b=(0,H.useMemo)(()=>{let e=[...v];return e.sort((e,t)=>{let r=e[a],n=t[a];return"string"==typeof r&&"string"==typeof n?l?r.localeCompare(n):n.localeCompare(r):l?r-n:n-r}),e},[v,a,l]),j=(0,H.useMemo)(()=>[...new Set(g.map(e=>e.source_type))],[g]),w=e=>{a===e?o(!l):(s(e),o(!1))};return(0,W.jsxs)("div",{className:"flex h-full",children:[(0,W.jsxs)("div",{className:`${n?"w-1/2":"w-full"} border-r border-slate-800 flex flex-col`,children:[(0,W.jsxs)("div",{className:"p-3 border-b border-slate-800 flex items-center justify-between",children:[(0,W.jsxs)("div",{className:"flex items-center gap-2",children:[(0,W.jsx)(l4,{size:16,className:"text-cyan-400"}),(0,W.jsx)("h2",{className:"text-sm font-medium text-white",children:"Agent Registry"}),(0,W.jsxs)("span",{className:"text-xs text-slate-500",children:[b.length," agents"]})]}),(0,W.jsx)("div",{className:"flex gap-1",children:["24h","7d","30d"].map(e=>(0,W.jsx)("button",{onClick:()=>r(e),className:`px-2 py-0.5 text-[10px] rounded transition-colors ${t===e?"bg-cyan-600 text-white":"text-slate-400 hover:text-white"}`,children:e},e))})]}),(0,W.jsxs)("div",{className:"px-3 py-2 border-b border-slate-800 flex items-center gap-2 flex-wrap",children:[(0,W.jsx)(di,{size:12,className:"text-slate-500"}),j.map(e=>(0,W.jsx)("button",{onClick:()=>d(c===e?null:e),className:`px-1.5 py-0.5 text-[10px] rounded transition-colors ${c===e?"bg-cyan-600/20 text-cyan-400":"text-slate-500 hover:text-slate-300"}`,children:e},e)),(0,W.jsx)("span",{className:"text-slate-700",children:"|"}),["full","limited","restricted"].map(e=>(0,W.jsx)("button",{onClick:()=>h(u===e?null:e),className:`px-1.5 py-0.5 text-[10px] rounded transition-colors ${u===e?"bg-cyan-600/20 text-cyan-400":"text-slate-500 hover:text-slate-300"}`,children:e},e)),(0,W.jsx)("span",{className:"text-slate-700",children:"|"}),(0,W.jsxs)("button",{onClick:()=>m(!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,W.jsx)(l0,{size:10})," flagged"]})]}),(0,W.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,W.jsx)("span",{children:"Agent"}),(0,W.jsxs)("button",{onClick:()=>w("avg_trust_score"),className:"flex items-center gap-0.5 hover:text-slate-300",children:["Trust ",(0,W.jsx)(da,{size:8})]}),(0,W.jsxs)("button",{onClick:()=>w("operation_count"),className:"flex items-center gap-0.5 hover:text-slate-300",children:["Ops ",(0,W.jsx)(da,{size:8})]}),(0,W.jsxs)("button",{onClick:()=>w("flagged_count"),className:"flex items-center gap-0.5 hover:text-slate-300",children:["Flagged ",(0,W.jsx)(da,{size:8})]}),(0,W.jsxs)("button",{onClick:()=>w("last_seen"),className:"flex items-center gap-0.5 hover:text-slate-300",children:["Last seen ",(0,W.jsx)(da,{size:8})]})]}),(0,W.jsxs)("div",{className:"flex-1 overflow-y-auto",children:[y&&(0,W.jsx)("div",{className:"p-4 text-center text-slate-500 text-xs",children:"Loading agents..."}),!y&&0===b.length&&(0,W.jsx)("div",{className:"p-4 text-center text-slate-500 text-xs",children:"No agents found in this time range."}),b.map(e=>{let t,r=n?.source_identifier===e.source_identifier&&n?.source_type===e.source_type;return(0,W.jsxs)("button",{onClick:()=>i(r?null:e),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 ${r?"bg-cyan-600/10":"hover:bg-slate-800/50"}`,children:[(0,W.jsxs)("div",{className:"min-w-0",children:[(0,W.jsx)(dS,{identifier:e.source_identifier,compact:!0}),(0,W.jsx)("div",{className:"mt-0.5",children:(0,W.jsx)(dP,{type:e.source_type})})]}),(0,W.jsx)(dO,{score:e.avg_trust_score}),(0,W.jsx)("span",{className:"text-xs text-slate-300 tabular-nums",children:e.operation_count}),(0,W.jsx)("span",{className:`text-xs tabular-nums ${e.flagged_count>0?"text-red-400":"text-slate-500"}`,children:e.flagged_count}),(0,W.jsx)("span",{className:"text-[10px] text-slate-500",children:(t=f-new Date(e.last_seen).getTime())<6e4?"just now":t<36e5?`${Math.floor(t/6e4)}m ago`:t<864e5?`${Math.floor(t/36e5)}h ago`:`${Math.floor(t/864e5)}d ago`})]},`${e.source_type}:${e.source_identifier}`)})]})]}),(0,W.jsx)(eh,{children:n&&(0,W.jsxs)(a9.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,W.jsxs)("div",{className:"p-3 border-b border-slate-800",children:[(0,W.jsxs)("div",{className:"flex items-center justify-between",children:[(0,W.jsx)(dS,{identifier:n.source_identifier}),(0,W.jsx)("button",{onClick:()=>i(null),className:"text-slate-500 hover:text-white text-xs",children:"Close"})]}),(0,W.jsxs)("div",{className:"flex items-center gap-2 mt-1.5",children:[(0,W.jsx)(dP,{type:n.source_type}),(0,W.jsx)(dO,{score:n.avg_trust_score}),(0,W.jsxs)("span",{className:"text-[10px] text-slate-500",children:[n.operation_count," ops · ",n.flagged_count," flagged"]})]})]}),(0,W.jsxs)("div",{className:"p-3 border-b border-slate-800",children:[(0,W.jsx)("h3",{className:"text-xs font-medium text-slate-400 mb-2",children:"Trust Score Timeline"}),(0,W.jsx)(dv,{identifier:n.source_identifier,timeRange:t})]}),(0,W.jsxs)("div",{className:"p-3 border-b border-slate-800",children:[(0,W.jsxs)("h3",{className:"text-xs font-medium text-slate-400 mb-2",children:["Flagged Operations",n.flagged_count>0&&(0,W.jsxs)("span",{className:"ml-1 text-red-400",children:["(",n.flagged_count,")"]})]}),(0,W.jsx)(dj,{identifier:n.source_identifier})]}),(0,W.jsxs)("div",{className:"p-3",children:[(0,W.jsx)("h3",{className:"text-xs font-medium text-slate-400 mb-2",children:"Live Alerts"}),(0,W.jsx)(dk,{agentFilter:n.source_identifier})]})]})})]})}let dA=(0,lD.default)("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"}]]),dE={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 dM({level:e}){let t=dE[e]??dE.low;return(0,W.jsx)("span",{className:`text-[10px] font-medium px-1.5 py-0.5 rounded ${t}`,children:e.toUpperCase()})}function dT({findings:e}){return 0===e.length?null:(0,W.jsx)("div",{className:"mt-2 space-y-1.5 pl-6",children:e.map((e,t)=>(0,W.jsxs)("div",{className:"flex items-start gap-2",children:[(0,W.jsx)(dM,{level:e.severity}),(0,W.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,W.jsx)("span",{className:"text-xs text-slate-300",children:e.description}),e.matchedText&&(0,W.jsxs)("div",{className:"mt-0.5 text-[10px] text-slate-500 font-mono truncate",children:['Match: "',e.matchedText,'"']})]})]},`${e.pattern}-${t}`))})}function d_(e){let t=e.split(/[/\\]/);return t[t.length-1]||e}function dD({file:e,cloudConnected:t,onTrust:r,onUntrust:n,onRemove:i,onCloudUpsell:a}){let[s,l]=(0,H.useState)(!e.safe),[o,c]=(0,H.useState)(!1);return(0,W.jsxs)("div",{className:"bg-slate-800/50 border border-slate-700 rounded-lg overflow-hidden",children:[(0,W.jsxs)("div",{className:"flex items-center",children:[(0,W.jsxs)("button",{onClick:()=>l(!s),className:"flex-1 px-3 py-2.5 flex items-center gap-3 hover:bg-slate-800/80 transition-colors min-w-0",children:[e.trusted?(0,W.jsx)(dA,{size:16,className:"text-cyan-400 shrink-0"}):e.safe?(0,W.jsx)(oN,{size:16,className:"text-green-400 shrink-0"}):(0,W.jsx)(oI,{size:16,className:"text-red-400 shrink-0"}),(0,W.jsxs)("div",{className:"flex-1 min-w-0 text-left",children:[(0,W.jsx)("span",{className:"text-xs font-medium text-white truncate block",children:e.skillName||d_(e.path)}),(0,W.jsx)("span",{className:"text-[10px] text-slate-500 truncate block",children:e.path.replace(/^\/Users\/[^/]+/,"~")})]}),(0,W.jsx)("span",{className:"text-[10px] text-slate-500 shrink-0",children:e.format}),e.trusted?(0,W.jsx)("span",{className:"text-[10px] px-1.5 py-0.5 rounded font-medium bg-cyan-400/10 text-cyan-400",children:"TRUSTED"}):(0,W.jsx)(dM,{level:e.riskLevel}),(0,W.jsxs)("span",{className:"text-[10px] text-slate-600 shrink-0",children:[e.scanDurationMs,"ms"]}),e.findings.length>0?s?(0,W.jsx)(oc,{size:14,className:"text-slate-500 shrink-0"}):(0,W.jsx)(ds.ChevronRight,{size:14,className:"text-slate-500 shrink-0"}):(0,W.jsx)("div",{className:"w-[14px] shrink-0"})]}),(0,W.jsxs)("div",{className:"flex items-center gap-0.5 pr-2 shrink-0",children:[e.trusted?(0,W.jsx)("button",{onClick:()=>n(e.path),title:"Remove trust",className:"p-1.5 rounded hover:bg-slate-700 transition-colors text-cyan-400 hover:text-cyan-300",children:(0,W.jsx)(dA,{size:14})}):(0,W.jsx)("button",{onClick:()=>r(e.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,W.jsx)(lZ,{size:14})}),!e.safe&&!e.trusted&&(0,W.jsx)("button",{onClick:()=>t?c(!0):a(),title:t?"Remove skill file":"Connect to Cloud to remove",className:`p-1.5 rounded transition-colors ${t?"hover:bg-red-500/10 text-slate-500 hover:text-red-400":"text-slate-600 hover:text-slate-400 cursor-not-allowed"}`,children:(0,W.jsx)(cp,{size:14})})]})]}),o&&(0,W.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,W.jsxs)("span",{className:"text-xs text-red-300 flex-1",children:["Remove ",(0,W.jsx)("span",{className:"font-medium",children:e.skillName||d_(e.path)}),"? This will delete the file from disk."]}),(0,W.jsx)("button",{onClick:()=>{i(e.path),c(!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,W.jsx)("button",{onClick:()=>c(!1),className:"px-3 py-1 text-xs text-slate-400 hover:text-white transition-colors",children:"Cancel"})]}),s&&e.findings.length>0&&(0,W.jsx)("div",{className:"border-t border-slate-700/50 px-3 py-2 bg-slate-900/50",children:(0,W.jsx)(dT,{findings:e.findings})})]})}function dI({files:e,cloudConnected:t,onTrust:r,onUntrust:n,onRemove:i,onCloudUpsell:a}){return 0===e.length?null:(0,W.jsx)("div",{className:"space-y-1.5",children:e.map(e=>(0,W.jsx)(dD,{file:e,cloudConnected:t,onTrust:r,onUntrust:n,onRemove:i,onCloudUpsell:a},e.path))})}let dz=Q.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";function dL(){let[e,t]=(0,H.useState)(null),[r,n]=(0,H.useState)(!1),[i,a]=(0,H.useState)(null),[s,l]=(0,H.useState)(!1),o=async()=>{n(!0),a(null);try{let e=await (0,sa.gatedFetch)(`${dz}/api/skills/deep-scan`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:[]})});if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t.error||"Deep scan failed")}t(await e.json())}catch(e){e instanceof sa.FeatureLockedError?l(!0):a(e.message)}finally{n(!1)}};return s?(0,W.jsx)(dR,{}):(0,W.jsxs)("div",{className:"space-y-3",children:[(0,W.jsxs)("div",{className:"flex items-center justify-between",children:[(0,W.jsxs)("div",{className:"flex items-center gap-2",children:[(0,W.jsx)(l3,{size:16,className:"text-cyan-400"}),(0,W.jsx)("h3",{className:"text-sm font-medium text-slate-200",children:"Deep Skill Scanner"})]}),(0,W.jsxs)("button",{onClick:o,disabled:r,className:"flex items-center gap-1.5 px-3 py-1.5 text-xs bg-cyan-600 text-white rounded-lg hover:bg-cyan-500 disabled:opacity-50 transition-colors",children:[(0,W.jsx)(l7.Search,{size:12}),r?"Scanning...":"Run Deep Scan"]})]}),i&&(0,W.jsx)("p",{className:"text-xs text-red-400",children:i}),e&&(0,W.jsxs)("div",{className:"space-y-3",children:[e.degraded&&(0,W.jsx)("p",{className:"text-[10px] text-yellow-400 bg-yellow-500/10 px-2 py-1 rounded",children:e.degradedReason}),e.correlations.length>0&&(0,W.jsxs)("div",{className:"space-y-1",children:[(0,W.jsx)("h4",{className:"text-xs text-slate-400 font-medium",children:"Cross-File Correlations"}),e.correlations.map((e,t)=>(0,W.jsxs)("div",{className:"flex items-start gap-2 px-3 py-2 bg-slate-800/30 rounded text-xs",children:[(0,W.jsx)(l0,{size:12,className:"critical"===e.severity?"text-red-400 mt-0.5":"high"===e.severity?"text-orange-400 mt-0.5":"text-yellow-400 mt-0.5"}),(0,W.jsxs)("div",{children:[(0,W.jsx)("p",{className:"text-slate-200",children:e.finding}),(0,W.jsxs)("p",{className:"text-slate-500 text-[10px]",children:["Files: ",e.files.join(", ")]})]})]},t))]}),Object.keys(e.intentBreakdown).length>0&&(0,W.jsxs)("div",{children:[(0,W.jsx)("h4",{className:"text-xs text-slate-400 font-medium mb-1",children:"Intent Breakdown"}),(0,W.jsx)("div",{className:"grid grid-cols-2 gap-1",children:Object.entries(e.intentBreakdown).map(([e,t])=>(0,W.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[(0,W.jsx)("div",{className:"flex-1",children:(0,W.jsx)("div",{className:"h-1.5 bg-slate-800 rounded-full overflow-hidden",children:(0,W.jsx)("div",{className:"h-full bg-cyan-500/60 rounded-full",style:{width:`${Math.min(100,5*t)}%`}})})}),(0,W.jsx)("span",{className:"text-slate-500 text-[10px] w-16 truncate",children:e}),(0,W.jsx)("span",{className:"text-slate-400 text-[10px] w-4 text-right",children:t})]},e))})]}),e.recommendations.length>0&&(0,W.jsxs)("div",{children:[(0,W.jsx)("h4",{className:"text-xs text-slate-400 font-medium mb-1",children:"Recommendations"}),(0,W.jsx)("ul",{className:"space-y-1",children:e.recommendations.map((e,t)=>(0,W.jsx)("li",{className:"text-xs text-slate-300 pl-3 relative before:absolute before:left-0 before:top-1.5 before:w-1.5 before:h-1.5 before:rounded-full before:bg-cyan-500/40",children:e},t))})]}),0===e.correlations.length&&0===Object.keys(e.intentBreakdown).length&&(0,W.jsx)("p",{className:"text-xs text-slate-500 text-center py-2",children:"No files provided for scanning. Upload skill files to analyse."})]}),!e&&!r&&(0,W.jsx)("p",{className:"text-xs text-slate-500 text-center py-2",children:"Run a deep scan to analyse skill files for cross-file threats and intent patterns."})]})}function dR(){return(0,W.jsxs)("div",{className:"space-y-3",children:[(0,W.jsxs)("div",{className:"flex items-center gap-2",children:[(0,W.jsx)(l3,{size:16,className:"text-cyan-400"}),(0,W.jsx)("h3",{className:"text-sm font-medium text-slate-200",children:"Deep Skill Scanner"})]}),(0,W.jsxs)("div",{className:"space-y-1",children:[(0,W.jsx)("h4",{className:"text-xs text-slate-400 font-medium",children:"Cross-File Correlations"}),cj.map((e,t)=>(0,W.jsxs)("div",{className:"flex items-start gap-2 px-3 py-2 bg-slate-800/30 rounded text-xs",children:[(0,W.jsx)(l0,{size:12,className:"critical"===e.severity?"text-red-400 mt-0.5":"high"===e.severity?"text-orange-400 mt-0.5":"text-yellow-400 mt-0.5"}),(0,W.jsxs)("div",{children:[(0,W.jsx)("p",{className:"text-slate-200",children:e.finding}),(0,W.jsxs)("p",{className:"text-slate-500 text-[10px]",children:["Files: ",e.files.join(", ")]})]})]},t))]}),(0,W.jsxs)("div",{children:[(0,W.jsx)("h4",{className:"text-xs text-slate-400 font-medium mb-1",children:"Intent Breakdown"}),(0,W.jsx)("div",{className:"grid grid-cols-2 gap-1",children:Object.entries(cw).map(([e,t])=>(0,W.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[(0,W.jsx)("div",{className:"flex-1",children:(0,W.jsx)("div",{className:"h-1.5 bg-slate-800 rounded-full overflow-hidden",children:(0,W.jsx)("div",{className:"h-full bg-cyan-500/60 rounded-full",style:{width:`${t}%`}})})}),(0,W.jsx)("span",{className:"text-slate-500 text-[10px] w-16 truncate",children:e}),(0,W.jsx)("span",{className:"text-slate-400 text-[10px] w-4 text-right",children:t})]},e))})]}),(0,W.jsxs)("div",{children:[(0,W.jsx)("h4",{className:"text-xs text-slate-400 font-medium mb-1",children:"Recommendations"}),(0,W.jsx)("ul",{className:"space-y-1",children:cN.map((e,t)=>(0,W.jsx)("li",{className:"text-xs text-slate-300 pl-3 relative before:absolute before:left-0 before:top-1.5 before:w-1.5 before:h-1.5 before:rounded-full before:bg-cyan-500/40",children:e},t))})]})]})}function dF(){return(0,W.jsx)("div",{className:"bg-slate-900/50 border border-slate-800 rounded-xl p-4",children:(0,W.jsx)(cx,{feature:"skill_scanner_deep",label:"Deep skill scanning with multi-file analysis and semantic intent detection.",children:(0,W.jsx)(dL,{})})})}let d$=[{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 dB(){let e=oF(),t=(0,sc.useMutation)({mutationFn:oR}),r=(0,sc.useMutation)({mutationFn:o$}),n=(0,sc.useMutation)({mutationFn:oB}),i=(0,sc.useMutation)({mutationFn:oU}),{data:a}=o3(),[s,l]=(0,H.useState)(null),[o,c]=(0,H.useState)(null),[d,u]=(0,H.useState)(!1),[h,p]=(0,H.useState)(""),[m,f]=(0,H.useState)(""),[x,y]=(0,H.useState)(!1),g=!!(a?.enabled&&a?.apiKeySet);return(0,W.jsxs)("div",{className:"h-full overflow-y-auto p-6",children:[(0,W.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,W.jsxs)("div",{children:[(0,W.jsx)("h2",{className:"text-lg font-semibold text-white",children:"Skills Scanner"}),(0,W.jsx)("p",{className:"text-xs text-slate-400 mt-0.5",children:"Scan agent instruction files for hidden threats"})]}),(0,W.jsxs)("button",{onClick:()=>{e.mutate(void 0,{onSuccess:e=>l(e)})},disabled:e.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:[e.isPending?(0,W.jsx)(ow,{size:14,className:"animate-spin"}):(0,W.jsx)(l3,{size:14}),"Scan All"]})]}),x&&(0,W.jsxs)("div",{className:"mb-4 bg-slate-900 border border-cyan-800/50 rounded-xl p-4 flex items-center gap-3",children:[(0,W.jsx)(oe,{size:20,className:"text-cyan-400 shrink-0"}),(0,W.jsxs)("div",{className:"flex-1",children:[(0,W.jsx)("p",{className:"text-sm font-medium text-white",children:"Connect to ShieldCortex Cloud"}),(0,W.jsx)("p",{className:"text-xs text-slate-400 mt-0.5",children:"Enable one-click skill removal and cloud-powered threat intelligence."})]}),(0,W.jsx)("button",{onClick:()=>y(!1),className:"text-xs text-slate-500 hover:text-slate-300 transition-colors",children:"Dismiss"})]}),s?(0,W.jsxs)("div",{className:"space-y-4",children:[(0,W.jsxs)("div",{className:"flex items-center gap-3 text-xs text-slate-400",children:[(0,W.jsxs)("span",{children:[(0,W.jsx)("span",{className:"text-white font-medium",children:s.totalScanned})," files scanned"]}),(0,W.jsx)("span",{className:"text-slate-600",children:"·"}),s.threatCount>0?(0,W.jsxs)("span",{children:[(0,W.jsx)("span",{className:"text-red-400 font-medium",children:s.threatCount})," with threats"]}):(0,W.jsx)("span",{className:"text-green-400",children:"All clean"}),(0,W.jsx)("span",{className:"text-slate-600",children:"·"}),(0,W.jsx)("span",{children:new Date(s.scannedAt).toLocaleTimeString()})]}),(0,W.jsx)(dI,{files:s.files,cloudConnected:g,onTrust:e=>{r.mutate(e,{onSuccess:()=>{s&&l({...s,files:s.files.map(t=>t.path===e?{...t,trusted:!0}:t),threatCount:s.files.filter(t=>!t.safe&&!t.trusted&&t.path!==e).length})}})},onUntrust:e=>{n.mutate(e,{onSuccess:()=>{s&&l({...s,files:s.files.map(t=>t.path===e?{...t,trusted:!1}:t),threatCount:s.files.filter(t=>{let r=t.path!==e&&t.trusted;return!t.safe&&!r}).length})}})},onRemove:e=>{i.mutate(e,{onSuccess:()=>{if(s){let t=s.files.filter(t=>t.path!==e);l({...s,files:t,totalScanned:t.length,threatCount:t.filter(e=>!e.safe&&!e.trusted).length})}}})},onCloudUpsell:()=>y(!0)})]}):e.isPending?(0,W.jsx)("div",{className:"flex items-center justify-center py-16",children:(0,W.jsx)(ow,{size:24,className:"text-cyan-400 animate-spin"})}):(0,W.jsxs)("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[(0,W.jsx)(l3,{size:32,className:"text-slate-600 mb-3"}),(0,W.jsx)("p",{className:"text-sm text-slate-400",children:"No skills scanned yet"}),(0,W.jsx)("p",{className:"text-xs text-slate-500 mt-1",children:'Click "Scan All" to discover and scan agent instruction files'})]}),(0,W.jsxs)("div",{className:"mt-6",children:[(0,W.jsxs)("button",{onClick:()=>u(!d),className:"flex items-center gap-1.5 text-xs text-slate-400 hover:text-slate-300 transition-colors",children:[d?(0,W.jsx)(oc,{size:14}):(0,W.jsx)(ds.ChevronRight,{size:14}),"Paste & Scan"]}),d&&(0,W.jsxs)("div",{className:"mt-3 bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,W.jsx)("textarea",{value:h,onChange:e=>p(e.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,W.jsxs)("div",{className:"flex items-center gap-3 mt-3",children:[(0,W.jsx)("select",{value:m,onChange:e=>f(e.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:d$.map(e=>(0,W.jsx)("option",{value:e.value,children:e.label},e.value))}),(0,W.jsxs)("button",{onClick:()=>{h.trim()&&t.mutate({content:h,format:m||void 0},{onSuccess:e=>c(e)})},disabled:t.isPending||!h.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:[t.isPending?(0,W.jsx)(ow,{size:12,className:"animate-spin"}):(0,W.jsx)(l3,{size:12}),"Scan Content"]})]}),o&&(0,W.jsxs)("div",{className:"mt-4 bg-slate-800/50 border border-slate-700 rounded-lg p-3",children:[(0,W.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,W.jsx)("span",{className:"text-xs font-medium text-white",children:o.skillName}),(0,W.jsx)(dM,{level:o.riskLevel}),(0,W.jsxs)("span",{className:"text-[10px] text-slate-500",children:[o.scanDurationMs,"ms"]})]}),(0,W.jsx)("p",{className:"text-xs text-slate-400",children:o.summary}),o.findings.length>0&&(0,W.jsx)(dT,{findings:o.findings})]})]})]}),(0,W.jsx)("div",{className:"mt-4",children:(0,W.jsx)(dF,{})})]})}let dU=(0,lD.default)("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"}]]),dq=(0,lD.default)("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"}]]),dV=(0,lD.default)("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"}]]),dK=(0,lD.default)("octagon-x",[["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z",key:"2d38gg"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]),dW=(0,lD.default)("play",[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]),dH=Q.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";function dQ(){let e,t,r,{data:n,isLoading:i,isLocked:a}={...e=(0,si.useQuery)({queryKey:["custom-patterns"],queryFn:()=>(0,sa.gatedFetch)(`${dH}/api/patterns`).then(e=>{if(!e.ok)throw Error("Failed to fetch custom patterns");return e.json()}),retry:(e,t)=>!(t instanceof sa.FeatureLockedError)&&e<2,refetchInterval:3e4}),isLocked:e.error instanceof sa.FeatureLockedError},s=(t=(0,so.useQueryClient)(),(0,sc.useMutation)({mutationFn:e=>(0,sa.gatedFetch)(`${dH}/api/patterns`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}).then(e=>e.ok?e.json():e.json().then(e=>{throw Error(e.error)})),onSuccess:()=>{t.invalidateQueries({queryKey:["custom-patterns"]})}})),l=(r=(0,so.useQueryClient)(),(0,sc.useMutation)({mutationFn:e=>(0,sa.gatedFetch)(`${dH}/api/patterns/${e}`,{method:"DELETE"}).then(e=>e.ok?e.json():e.json().then(e=>{throw Error(e.error)})),onSuccess:()=>{r.invalidateQueries({queryKey:["custom-patterns"]})}})),o=(0,sc.useMutation)({mutationFn:({id:e,text:t})=>(0,sa.gatedFetch)(`${dH}/api/patterns/${e}/test`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:t})}).then(e=>e.ok?e.json():e.json().then(e=>{throw Error(e.error)}))}),[c,d]=(0,H.useState)(!1),[u,h]=(0,H.useState)(null),[p,m]=(0,H.useState)({name:"",category:"custom",severity:"medium",regex:"",description:""}),f=n?.patterns??[],x=!0,y="";if(p.regex)try{new RegExp(p.regex)}catch(e){x=!1,y=e.message}return a?(0,W.jsx)(dY,{}):(0,W.jsxs)("div",{className:"space-y-3",children:[(0,W.jsxs)("div",{className:"flex items-center justify-between",children:[(0,W.jsxs)("div",{className:"flex items-center gap-2",children:[(0,W.jsx)(l6,{size:16,className:"text-red-400"}),(0,W.jsx)("h3",{className:"text-sm font-medium text-slate-200",children:"Custom Injection Patterns"}),(0,W.jsxs)("span",{className:"text-xs text-slate-500",children:[f.length,"/50"]})]}),(0,W.jsxs)("button",{onClick:()=>d(!c),className:"flex items-center gap-1 px-2 py-1 text-xs bg-red-600/20 text-red-400 rounded hover:bg-red-600/30 transition-colors",children:[(0,W.jsx)(ch,{size:12})," Add Pattern"]})]}),c&&(0,W.jsxs)("form",{onSubmit:e=>{e.preventDefault(),s.mutate(p,{onSuccess:()=>{d(!1),m({name:"",category:"custom",severity:"medium",regex:"",description:""})}})},className:"p-3 bg-slate-800/50 rounded-lg space-y-2",children:[(0,W.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,W.jsx)("input",{value:p.name,onChange:e=>m(t=>({...t,name:e.target.value})),placeholder:"Pattern name",required:!0,className:"px-2 py-1.5 text-xs bg-slate-900 border border-slate-700 rounded text-slate-200 placeholder:text-slate-600"}),(0,W.jsxs)("select",{value:p.severity,onChange:e=>m(t=>({...t,severity:e.target.value})),className:"px-2 py-1.5 text-xs bg-slate-900 border border-slate-700 rounded text-slate-200",children:[(0,W.jsx)("option",{value:"critical",children:"Critical"}),(0,W.jsx)("option",{value:"high",children:"High"}),(0,W.jsx)("option",{value:"medium",children:"Medium"}),(0,W.jsx)("option",{value:"low",children:"Low"})]})]}),(0,W.jsxs)("div",{className:"relative",children:[(0,W.jsx)("input",{value:p.regex,onChange:e=>m(t=>({...t,regex:e.target.value})),placeholder:"Regex pattern",required:!0,className:`w-full px-2 py-1.5 text-xs bg-slate-900 border rounded text-slate-200 font-mono placeholder:text-slate-600 ${x?"border-slate-700":"border-red-500"}`}),!x&&(0,W.jsx)("p",{className:"text-[10px] text-red-400 mt-0.5",children:y})]}),(0,W.jsx)("input",{value:p.description,onChange:e=>m(t=>({...t,description:e.target.value})),placeholder:"Description (optional)",className:"w-full px-2 py-1.5 text-xs bg-slate-900 border border-slate-700 rounded text-slate-200 placeholder:text-slate-600"}),(0,W.jsxs)("div",{className:"flex gap-2",children:[(0,W.jsx)("button",{type:"submit",disabled:s.isPending||!x,className:"px-3 py-1 text-xs bg-red-600 text-white rounded hover:bg-red-500 disabled:opacity-50",children:s.isPending?"Creating...":"Create"}),(0,W.jsx)("button",{type:"button",onClick:()=>d(!1),className:"px-3 py-1 text-xs text-slate-400 hover:text-slate-200",children:"Cancel"})]}),s.error&&(0,W.jsx)("p",{className:"text-xs text-red-400",children:s.error.message})]}),i?(0,W.jsx)("div",{className:"text-xs text-slate-500 py-4 text-center",children:"Loading patterns..."}):0===f.length?(0,W.jsx)("div",{className:"text-xs text-slate-500 py-4 text-center",children:'No custom patterns yet. Click "Add Pattern" to create one.'}):(0,W.jsx)("div",{className:"space-y-1",children:f.map(e=>(0,W.jsxs)("div",{className:"px-3 py-2 bg-slate-800/30 rounded text-xs space-y-1",children:[(0,W.jsxs)("div",{className:"flex items-center gap-2",children:[(0,W.jsx)("span",{className:"text-slate-200 flex-1 font-medium",children:e.name}),(0,W.jsx)("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-medium ${"critical"===e.severity?"bg-red-500/20 text-red-400":"high"===e.severity?"bg-orange-500/20 text-orange-400":"medium"===e.severity?"bg-yellow-500/20 text-yellow-400":"bg-slate-500/20 text-slate-400"}`,children:e.severity}),(0,W.jsx)("button",{onClick:()=>h(u?.id===e.id?null:{id:e.id,text:""}),className:"text-slate-500 hover:text-cyan-400",title:"Test pattern",children:(0,W.jsx)(dW,{size:12})}),(0,W.jsx)("button",{onClick:()=>l.mutate(e.id),className:"text-slate-500 hover:text-red-400",children:(0,W.jsx)(cp,{size:12})})]}),(0,W.jsx)("code",{className:"text-slate-500 text-[10px] block truncate",children:e.regex}),u?.id===e.id&&(0,W.jsxs)("div",{className:"flex gap-2 mt-1",children:[(0,W.jsx)("input",{value:u.text,onChange:t=>h({id:e.id,text:t.target.value}),placeholder:"Test text...",className:"flex-1 px-2 py-1 text-[10px] bg-slate-900 border border-slate-700 rounded text-slate-200 placeholder:text-slate-600"}),(0,W.jsx)("button",{onClick:()=>o.mutate({id:e.id,text:u.text}),disabled:!u.text,className:"px-2 py-1 text-[10px] bg-cyan-600/20 text-cyan-400 rounded hover:bg-cyan-600/30 disabled:opacity-50",children:"Test"}),o.data&&(0,W.jsxs)("span",{className:"text-[10px] text-slate-400 self-center",children:[o.data.count," matches"]})]})]},e.id))})]})}function dY(){return(0,W.jsxs)("div",{className:"space-y-3",children:[(0,W.jsxs)("div",{className:"flex items-center gap-2",children:[(0,W.jsx)(l6,{size:16,className:"text-red-400"}),(0,W.jsx)("h3",{className:"text-sm font-medium text-slate-200",children:"Custom Injection Patterns"}),(0,W.jsx)("span",{className:"text-xs text-slate-500",children:"0/50"})]}),(0,W.jsx)("div",{className:"space-y-1",children:cv.map(e=>(0,W.jsxs)("div",{className:"px-3 py-2 bg-slate-800/30 rounded text-xs space-y-1",children:[(0,W.jsxs)("div",{className:"flex items-center gap-2",children:[(0,W.jsx)("span",{className:"text-slate-200 flex-1 font-medium",children:e.name}),(0,W.jsx)("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-medium ${"critical"===e.severity?"bg-red-500/20 text-red-400":"high"===e.severity?"bg-orange-500/20 text-orange-400":"bg-yellow-500/20 text-yellow-400"}`,children:e.severity})]}),(0,W.jsx)("code",{className:"text-slate-500 text-[10px] block truncate",children:e.regex})]},e.id))})]})}function dX(){return(0,W.jsx)("div",{className:"bg-slate-900/50 border border-slate-800 rounded-xl p-4",children:(0,W.jsx)(cx,{feature:"custom_injection_patterns",label:"Define up to 50 custom regex patterns for detecting domain-specific threats.",children:(0,W.jsx)(dQ,{})})})}let dG=Q.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";function dZ(){let e,t,r,n,{data:i,isLoading:a,isLocked:s}={...e=(0,si.useQuery)({queryKey:["custom-policies"],queryFn:()=>(0,sa.gatedFetch)(`${dG}/api/iron-dome/policies`).then(e=>{if(!e.ok)throw Error("Failed to fetch custom policies");return e.json()}),retry:(e,t)=>!(t instanceof sa.FeatureLockedError)&&e<2,refetchInterval:3e4}),isLocked:e.error instanceof sa.FeatureLockedError},l=(t=(0,so.useQueryClient)(),(0,sc.useMutation)({mutationFn:e=>(0,sa.gatedFetch)(`${dG}/api/iron-dome/policies`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}).then(e=>e.ok?e.json():e.json().then(e=>{throw Error(e.error)})),onSuccess:()=>{t.invalidateQueries({queryKey:["custom-policies"]})}})),o=(r=(0,so.useQueryClient)(),(0,sc.useMutation)({mutationFn:e=>(0,sa.gatedFetch)(`${dG}/api/iron-dome/policies/${e}`,{method:"DELETE"}).then(e=>e.ok?e.json():e.json().then(e=>{throw Error(e.error)})),onSuccess:()=>{r.invalidateQueries({queryKey:["custom-policies"]})}})),c=(n=(0,so.useQueryClient)(),(0,sc.useMutation)({mutationFn:e=>(0,sa.gatedFetch)(`${dG}/api/iron-dome/policies/${e}/activate`,{method:"PUT"}).then(e=>e.ok?e.json():e.json().then(e=>{throw Error(e.error)})),onSuccess:()=>{n.invalidateQueries({queryKey:["custom-policies"]})}})),[d,u]=(0,H.useState)(!1),[h,p]=(0,H.useState)({name:"",description:""}),m=i?.policies??[];return s?(0,W.jsx)(dJ,{}):(0,W.jsxs)("div",{className:"space-y-3",children:[(0,W.jsxs)("div",{className:"flex items-center justify-between",children:[(0,W.jsxs)("div",{className:"flex items-center gap-2",children:[(0,W.jsx)(lZ,{size:16,className:"text-red-400"}),(0,W.jsx)("h3",{className:"text-sm font-medium text-slate-200",children:"Custom Iron Dome Policies"}),(0,W.jsxs)("span",{className:"text-xs text-slate-500",children:[m.length,"/10"]})]}),(0,W.jsxs)("button",{onClick:()=>u(!d),className:"flex items-center gap-1 px-2 py-1 text-xs bg-red-600/20 text-red-400 rounded hover:bg-red-600/30 transition-colors",children:[(0,W.jsx)(ch,{size:12})," Create Policy"]})]}),d&&(0,W.jsxs)("form",{onSubmit:e=>{e.preventDefault(),l.mutate({name:h.name,description:h.description,config:{}},{onSuccess:()=>{u(!1),p({name:"",description:""})}})},className:"p-3 bg-slate-800/50 rounded-lg space-y-2",children:[(0,W.jsx)("input",{value:h.name,onChange:e=>p(t=>({...t,name:e.target.value})),placeholder:"Policy name",required:!0,className:"w-full px-2 py-1.5 text-xs bg-slate-900 border border-slate-700 rounded text-slate-200 placeholder:text-slate-600"}),(0,W.jsx)("textarea",{value:h.description,onChange:e=>p(t=>({...t,description:e.target.value})),placeholder:"Description",rows:2,className:"w-full px-2 py-1.5 text-xs bg-slate-900 border border-slate-700 rounded text-slate-200 placeholder:text-slate-600 resize-none"}),(0,W.jsxs)("div",{className:"flex gap-2",children:[(0,W.jsx)("button",{type:"submit",disabled:l.isPending,className:"px-3 py-1 text-xs bg-red-600 text-white rounded hover:bg-red-500 disabled:opacity-50",children:l.isPending?"Creating...":"Create"}),(0,W.jsx)("button",{type:"button",onClick:()=>u(!1),className:"px-3 py-1 text-xs text-slate-400 hover:text-slate-200",children:"Cancel"})]}),l.error&&(0,W.jsx)("p",{className:"text-xs text-red-400",children:l.error.message})]}),a?(0,W.jsx)("div",{className:"text-xs text-slate-500 py-4 text-center",children:"Loading policies..."}):0===m.length?(0,W.jsx)("div",{className:"text-xs text-slate-500 py-4 text-center",children:'No custom policies yet. Click "Create Policy" to get started.'}):(0,W.jsx)("div",{className:"space-y-1",children:m.map(e=>(0,W.jsxs)("div",{className:"flex items-center gap-3 px-3 py-2 bg-slate-800/30 rounded text-xs",children:[(0,W.jsxs)("div",{className:"flex-1",children:[(0,W.jsxs)("div",{className:"flex items-center gap-2",children:[(0,W.jsx)("span",{className:"text-slate-200 font-medium",children:e.name}),1===e.is_active&&(0,W.jsx)("span",{className:"px-1.5 py-0.5 rounded bg-green-500/20 text-green-400 text-[10px] font-medium",children:"Active"})]}),e.description&&(0,W.jsx)("p",{className:"text-slate-500 text-[10px] mt-0.5",children:e.description})]}),!e.is_active&&(0,W.jsxs)("button",{onClick:()=>c.mutate(e.id),className:"flex items-center gap-1 px-2 py-1 text-[10px] bg-green-600/20 text-green-400 rounded hover:bg-green-600/30",title:"Set active",children:[(0,W.jsx)(lz,{size:10})," Activate"]}),(0,W.jsx)("button",{onClick:()=>o.mutate(e.id),className:"text-slate-500 hover:text-red-400",children:(0,W.jsx)(cp,{size:12})})]},e.id))})]})}function dJ(){return(0,W.jsxs)("div",{className:"space-y-3",children:[(0,W.jsxs)("div",{className:"flex items-center gap-2",children:[(0,W.jsx)(lZ,{size:16,className:"text-red-400"}),(0,W.jsx)("h3",{className:"text-sm font-medium text-slate-200",children:"Custom Iron Dome Policies"}),(0,W.jsx)("span",{className:"text-xs text-slate-500",children:"0/10"})]}),(0,W.jsx)("div",{className:"space-y-1",children:cb.map(e=>(0,W.jsx)("div",{className:"flex items-center gap-3 px-3 py-2 bg-slate-800/30 rounded text-xs",children:(0,W.jsxs)("div",{className:"flex-1",children:[(0,W.jsxs)("div",{className:"flex items-center gap-2",children:[(0,W.jsx)("span",{className:"text-slate-200 font-medium",children:e.name}),e.is_active&&(0,W.jsx)("span",{className:"px-1.5 py-0.5 rounded bg-green-500/20 text-green-400 text-[10px] font-medium",children:"Active"})]}),(0,W.jsx)("p",{className:"text-slate-500 text-[10px] mt-0.5",children:e.description})]})},e.id))})]})}function d0(){return(0,W.jsx)("div",{className:"bg-slate-900/50 border border-slate-800 rounded-xl p-4",children:(0,W.jsx)(cx,{feature:"custom_iron_dome_policies",label:"Create custom Iron Dome policies with tailored action gates and trust levels.",children:(0,W.jsx)(dZ,{})})})}let d1=[{id:"personal",label:"Personal",description:"Lighter touch for solo use",icon:lZ},{id:"enterprise",label:"Enterprise",description:"Financial & data protection",icon:cr},{id:"school",label:"School",description:"GDPR strict, pupil data guarded",icon:l4},{id:"paranoid",label:"Paranoid",description:"Everything requires approval",icon:l0}],d2=[{name:"Injection Scanner",description:"40+ patterns across 8 categories",icon:dV},{name:"Instruction Gateway",description:"Trusted channel validation",icon:dU},{name:"Action Gate",description:"Approve / block external actions",icon:cr},{name:"PII Guard",description:"Block sensitive data output",icon:ol},{name:"Kill Switch",description:"Emergency stop phrase",icon:dq},{name:"Sub-Agent Control",description:"Restrict spawned agent operations",icon:l4}],d5={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"},d4={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 d3(){let e,t,r,{data:n,isLoading:i}=oJ(),{data:a}=o0(50),s=(e=(0,so.useQueryClient)(),(0,sc.useMutation)({mutationFn:e=>oW(e),onSuccess:()=>{e.invalidateQueries({queryKey:["iron-dome-status"]}),e.invalidateQueries({queryKey:["iron-dome-audit"]})}})),l=(t=(0,so.useQueryClient)(),(0,sc.useMutation)({mutationFn:oH,onSuccess:()=>{t.invalidateQueries({queryKey:["iron-dome-status"]})}})),o=(0,sc.useMutation)({mutationFn:oQ}),c=o1(),d=(r=(0,so.useQueryClient)(),(0,sc.useMutation)({mutationFn:e=>oX(e),onSuccess:()=>{r.invalidateQueries({queryKey:["control-status"]}),r.invalidateQueries({queryKey:["iron-dome-status"]}),r.invalidateQueries({queryKey:["iron-dome-audit"]})}})),{data:u}=(0,si.useQuery)({queryKey:["control-status"],queryFn:oG,refetchInterval:5e3,retry:2}),[h,p]=(0,H.useState)(""),[m,f]=(0,H.useState)(null),[x,y]=(0,H.useState)(""),g=n?.enabled??!1,v=u?.killSwitchActive??!1,b=u?.killSwitchMeta??null,j=n?.profile,w=n?.config,N=a?.logs??[],k=N.filter(e=>"BLOCK"===e.firewall_result).length,S=N.filter(e=>"ALLOW"===e.firewall_result).length;return(0,W.jsxs)("div",{className:"h-full overflow-y-auto p-6",children:[(0,W.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,W.jsxs)("div",{className:"flex items-center gap-3",children:[(0,W.jsx)(l6,{size:20,className:"text-red-400"}),(0,W.jsx)("h2",{className:"text-lg font-semibold text-white",children:"Iron Dome"}),i?(0,W.jsx)("span",{className:"text-[10px] text-slate-500 animate-pulse",children:"Loading..."}):(0,W.jsx)("span",{className:`text-[10px] font-medium px-2 py-0.5 rounded-full ${g?"bg-red-500/20 text-red-400 border border-red-500/30":"bg-slate-700/50 text-slate-500"}`,children:g?"ACTIVE":"INACTIVE"})]}),g&&(0,W.jsxs)("button",{onClick:()=>{l.mutate()},disabled:l.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:[l.isPending?(0,W.jsx)(ow,{size:12,className:"animate-spin"}):(0,W.jsx)(dq,{size:12}),"Deactivate"]})]}),(0,W.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4 mb-6",children:[(0,W.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,W.jsx)("h3",{className:"text-sm font-medium text-slate-300 mb-3",children:"Security Profiles"}),(0,W.jsx)("div",{className:"grid grid-cols-2 gap-2",children:d1.map(({id:e,label:t,description:r,icon:n})=>(0,W.jsxs)("button",{onClick:()=>{s.mutate(e)},disabled:s.isPending,className:`text-left p-3 rounded-lg border transition-colors ${j===e?"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,W.jsxs)("div",{className:"flex items-center gap-1.5 mb-1",children:[(0,W.jsx)(n,{size:12}),(0,W.jsx)("span",{className:"text-xs font-medium",children:t})]}),(0,W.jsx)("div",{className:"text-[10px] text-slate-500",children:r})]},e))})]}),(0,W.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,W.jsx)("h3",{className:"text-sm font-medium text-slate-300 mb-3",children:"Module Status"}),(0,W.jsx)("div",{className:"space-y-2",children:d2.map(({name:e,description:t,icon:r})=>(0,W.jsxs)("div",{className:"flex items-center gap-3 px-3 py-2 rounded-lg bg-slate-800/50",children:[(0,W.jsx)(r,{size:14,className:g?"text-red-400":"text-slate-600"}),(0,W.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,W.jsx)("div",{className:"text-xs font-medium text-slate-300",children:e}),(0,W.jsx)("div",{className:"text-[10px] text-slate-500 truncate",children:t})]}),(0,W.jsx)("span",{className:`w-2 h-2 rounded-full ${g?"bg-red-400":"bg-slate-600"}`})]},e))})]})]}),g&&w&&(0,W.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4 mb-6",children:[(0,W.jsx)("h3",{className:"text-sm font-medium text-slate-300 mb-3",children:"Active Configuration"}),(0,W.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 text-xs",children:[(0,W.jsxs)("div",{children:[(0,W.jsx)("div",{className:"text-[10px] text-slate-500 uppercase mb-1",children:"Trusted Channels"}),(0,W.jsx)("div",{className:"flex flex-wrap gap-1",children:w.trustedChannels.map(e=>(0,W.jsx)("span",{className:"px-1.5 py-0.5 bg-slate-800 rounded text-slate-400",children:e},e))})]}),(0,W.jsxs)("div",{children:[(0,W.jsx)("div",{className:"text-[10px] text-slate-500 uppercase mb-1",children:"Requires Approval"}),(0,W.jsx)("div",{className:"flex flex-wrap gap-1",children:w.requireApproval.map(e=>(0,W.jsx)("span",{className:"px-1.5 py-0.5 bg-red-500/10 border border-red-500/20 rounded text-red-400",children:e},e))})]}),(0,W.jsxs)("div",{children:[(0,W.jsx)("div",{className:"text-[10px] text-slate-500 uppercase mb-1",children:"Kill Phrase"}),(0,W.jsx)("span",{className:"px-1.5 py-0.5 bg-slate-800 rounded text-slate-400 font-mono",children:w.killPhrase})]})]})]}),v?(0,W.jsxs)("div",{className:"bg-red-950/50 border-2 border-red-500/50 rounded-xl p-5 mb-6 animate-pulse-slow",children:[(0,W.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,W.jsx)(dK,{size:18,className:"text-red-400"}),(0,W.jsx)("h3",{className:"text-sm font-bold text-red-400 uppercase tracking-wide",children:"Kill Switch Active"}),(0,W.jsx)("span",{className:"ml-auto text-[10px] bg-red-500/20 text-red-400 px-2 py-0.5 rounded-full border border-red-500/30",children:"LOCKDOWN"})]}),(0,W.jsx)("p",{className:"text-xs text-red-300/80 mb-2",children:"All agent operations are blocked. No memory reads, writes, graph queries, or consolidation. Iron Dome remains active and continues protecting."}),b&&(0,W.jsxs)("div",{className:"bg-red-950/30 border border-red-500/20 rounded-lg p-3 mb-4 space-y-1",children:[(0,W.jsxs)("div",{className:"text-[10px] text-slate-500",children:[(0,W.jsx)("span",{className:"text-red-400 font-medium",children:"Triggered:"})," ",new Date(b.triggeredAt).toLocaleString()]}),(0,W.jsxs)("div",{className:"text-[10px] text-slate-500",children:[(0,W.jsx)("span",{className:"text-red-400 font-medium",children:"Source:"})," ","kill_phrase"===b.source?`Kill phrase "${b.phrase}"`:"manual"===b.source?"Manual (dashboard)":"mcp_tool"===b.source?"MCP tool":b.source]}),void 0!==b.memoryCountAtTrigger&&(0,W.jsxs)("div",{className:"text-[10px] text-slate-500",children:[(0,W.jsx)("span",{className:"text-red-400 font-medium",children:"Memories at trigger:"})," ",b.memoryCountAtTrigger]})]}),(0,W.jsxs)("div",{className:"space-y-2",children:[(0,W.jsx)("input",{type:"text",value:x,onChange:e=>y(e.target.value),placeholder:"Reason for resuming (required)...",className:"w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white placeholder:text-slate-500 focus:outline-none focus:ring-1 focus:ring-green-500"}),(0,W.jsxs)("div",{className:"flex items-center gap-3",children:[(0,W.jsxs)("button",{onClick:()=>{x.trim()&&(d.mutate(x.trim()),y(""))},disabled:d.isPending||!x.trim(),className:"flex items-center gap-1.5 px-4 py-2 bg-green-600 hover:bg-green-500 disabled:opacity-50 rounded-lg text-xs font-medium text-white transition-colors",children:[d.isPending?(0,W.jsx)(ow,{size:12,className:"animate-spin"}):(0,W.jsx)(dW,{size:12}),"Resume Agent"]}),(0,W.jsx)("span",{className:"text-[10px] text-slate-500",children:"Only resume after you've investigated the threat"})]})]})]}):(0,W.jsxs)("div",{className:"bg-slate-900 border border-orange-500/30 rounded-xl p-4 mb-6",children:[(0,W.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,W.jsx)(dK,{size:14,className:"text-orange-400"}),(0,W.jsx)("h3",{className:"text-sm font-medium text-orange-300",children:"Emergency Stop"})]}),(0,W.jsx)("p",{className:"text-xs text-slate-400 mb-3",children:"Immediately halts your agent when you suspect it has been compromised or is acting on poisoned data. Blocks ALL operations — no reads, writes, or modifications. Iron Dome stays active."}),w?.killPhrase&&(0,W.jsxs)("p",{className:"text-[10px] text-slate-500 mb-3",children:["Kill phrase: ",(0,W.jsxs)("span",{className:"font-mono text-slate-400",children:['"',w.killPhrase,'"']})," — say this in conversation for hands-free stop"]}),(0,W.jsxs)("button",{onClick:()=>c.mutate(),disabled:c.isPending,className:"flex items-center gap-1.5 px-4 py-2 bg-red-600 hover:bg-red-500 disabled:opacity-50 rounded-lg text-xs font-bold text-white uppercase tracking-wider transition-colors",children:[c.isPending?(0,W.jsx)(ow,{size:12,className:"animate-spin"}):(0,W.jsx)(dK,{size:14}),"Emergency Stop"]})]}),(0,W.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[(0,W.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,W.jsxs)("h3",{className:"text-sm font-medium text-slate-300 mb-3",children:[(0,W.jsx)(dV,{size:14,className:"inline mr-1.5 text-red-400"}),"Injection Scanner"]}),(0,W.jsx)("textarea",{value:h,onChange:e=>p(e.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,W.jsxs)("button",{onClick:()=>{h.trim()&&o.mutate(h,{onSuccess:e=>f(e)})},disabled:o.isPending||!h.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:[o.isPending?(0,W.jsx)(ow,{size:12,className:"animate-spin"}):(0,W.jsx)(l6,{size:12}),"Scan"]}),m&&(0,W.jsxs)("div",{className:"mt-3 space-y-2",children:[(0,W.jsxs)("div",{className:"flex items-center gap-2",children:[m.clean?(0,W.jsx)(oN,{size:14,className:"text-green-400"}):(0,W.jsx)(oI,{size:14,className:"text-red-400"}),(0,W.jsx)("span",{className:`text-[10px] font-medium px-2 py-0.5 rounded-full ${d4[m.riskLevel]??"bg-slate-500/20 text-slate-400"}`,children:m.riskLevel}),(0,W.jsx)("span",{className:"text-xs text-slate-400",children:m.summary})]}),m.detections.map((e,t)=>(0,W.jsxs)("div",{className:`border rounded-lg p-3 ${d5[e.severity]??"border-slate-700"}`,children:[(0,W.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,W.jsx)("span",{className:"text-[10px] font-medium uppercase",children:e.severity}),(0,W.jsx)("span",{className:"text-xs text-slate-300",children:e.category.replace(/_/g," ")})]}),(0,W.jsx)("p",{className:"text-[11px] text-slate-400 mb-1",children:e.description}),(0,W.jsx)("code",{className:"text-[10px] text-slate-500 bg-slate-800 px-1.5 py-0.5 rounded block truncate",children:e.match})]},t))]})]}),(0,W.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,W.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,W.jsx)("h3",{className:"text-sm font-medium text-slate-300",children:"Event Feed"}),(0,W.jsxs)("span",{className:"text-[10px] text-slate-500",children:["Last ",N.length," events"]})]}),(0,W.jsxs)("div",{className:"grid grid-cols-3 gap-2 mb-3",children:[(0,W.jsxs)("div",{className:"bg-slate-800/50 rounded-lg p-2 text-center",children:[(0,W.jsx)("div",{className:"text-sm font-bold text-slate-300",children:N.length}),(0,W.jsx)("div",{className:"text-[10px] text-slate-500",children:"Total"})]}),(0,W.jsxs)("div",{className:"bg-slate-800/50 rounded-lg p-2 text-center",children:[(0,W.jsx)("div",{className:"text-sm font-bold text-red-400",children:k}),(0,W.jsx)("div",{className:"text-[10px] text-slate-500",children:"Blocked"})]}),(0,W.jsxs)("div",{className:"bg-slate-800/50 rounded-lg p-2 text-center",children:[(0,W.jsx)("div",{className:"text-sm font-bold text-green-400",children:S}),(0,W.jsx)("div",{className:"text-[10px] text-slate-500",children:"Allowed"})]})]}),(0,W.jsx)("div",{className:"space-y-1 max-h-72 overflow-y-auto",children:0===N.length?(0,W.jsxs)("div",{className:"text-center py-6",children:[(0,W.jsx)(lZ,{size:20,className:"text-slate-600 mx-auto mb-1.5"}),(0,W.jsx)("p",{className:"text-[10px] text-slate-500",children:"No Iron Dome events yet"})]}):N.map((e,t)=>(0,W.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded-md bg-slate-800/50 text-xs",children:[(0,W.jsx)("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${"BLOCK"===e.firewall_result?"bg-red-400":"bg-green-400"}`}),(0,W.jsx)("span",{className:"text-slate-400 truncate flex-1",children:(e.reason??"").replace(/^\[iron-dome:\w+\]\s*/,"")}),(0,W.jsx)("span",{className:"text-[10px] text-slate-600 shrink-0",children:new Date(e.timestamp).toLocaleTimeString()})]},e.id??t))})]})]}),(0,W.jsx)("div",{className:"mt-4",children:(0,W.jsx)(dX,{})}),(0,W.jsx)("div",{className:"mt-4",children:(0,W.jsx)(d0,{})})]})}let d6=Q.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001",d8={architecture:"#3b82f6",error:"#ef4444",pattern:"#8b5cf6",preference:"#f59e0b",learning:"#10b981",context:"#6366f1",todo:"#f97316",note:"#94a3b8",relationship:"#ec4899",custom:"#64748b"},d7={short_term:"STM",long_term:"LTM",episodic:"Episodic"},d9={short_term:"#22d3ee",long_term:"#a78bfa",episodic:"#f472b6"},ue=["architecture","pattern","preference","error","context","learning","todo","note","relationship","custom"],ut=[{label:"All",value:"all"},{label:"STM",value:"short_term"},{label:"LTM",value:"long_term"},{label:"Episodic",value:"episodic"}];function ur(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}function un({className:e}){let[t,r]=(0,H.useState)([]),[n,i]=(0,H.useState)(!0),[a,s]=(0,H.useState)(null),[l,o]=(0,H.useState)(new Set),[c,d]=(0,H.useState)("all"),[u,h]=(0,H.useState)(""),p=(0,H.useRef)(null),m=(0,H.useRef)(new Map),[f,x]=(0,H.useState)(new Set);(0,H.useEffect)(()=>{let e=!1;return async function(){i(!0),s(null);try{let t=await (0,sa.authFetch)(`${d6}/api/memories?limit=200&sort=created_at&order=desc`);if(!t.ok)throw Error(`API returned ${t.status}`);let n=await t.json();e||r(Array.isArray(n)?n:n.memories??[])}catch(t){e||s(t instanceof Error?t.message:"Failed to load memories")}finally{e||i(!1)}}(),()=>{e=!0}},[]),(0,H.useEffect)(()=>(p.current=new IntersectionObserver(e=>{x(t=>{let r=new Set(t);for(let t of e){let e=Number(t.target.getAttribute("data-memory-id"));t.isIntersecting&&r.add(e)}return r})},{threshold:.1,rootMargin:"0px 0px 50px 0px"}),()=>p.current?.disconnect()),[]);let y=(0,H.useCallback)(e=>t=>{t&&(m.current.set(e,t),p.current?.observe(t))},[]),g=(0,H.useMemo)(()=>{let e=t;if(l.size>0&&(e=e.filter(e=>l.has(e.category))),"all"!==c&&(e=e.filter(e=>e.type===c)),u.trim()){let t=u.toLowerCase();e=e.filter(e=>e.title.toLowerCase().includes(t)||e.content.toLowerCase().includes(t))}return e},[t,l,c,u]),v=(0,H.useMemo)(()=>(function(e){let t=new Map;for(let r of e){let e=ur(r.createdAt);t.has(e)||t.set(e,[]),t.get(e).push(r)}return Array.from(t.entries()).sort(([e],[t])=>t.localeCompare(e)).map(([e,t])=>({key:e,label:function(e){let t=new Date,r=ur(t.toISOString()),n=new Date(t);n.setDate(n.getDate()-1);let i=ur(n.toISOString());if(e===r)return"Today";if(e===i)return"Yesterday";let[a,s,l]=e.split("-").map(Number),o=new Date(a,s-1,l);return o.toLocaleDateString(void 0,{month:"long",day:"numeric",year:o.getFullYear()!==t.getFullYear()?"numeric":void 0})}(e),memories:t}))})(g),[g]);return n?(0,W.jsx)("div",{className:`flex items-center justify-center h-full bg-[#0a0a0f] ${e??""}`,children:(0,W.jsxs)("div",{className:"flex flex-col items-center gap-3",children:[(0,W.jsx)("div",{className:"w-8 h-8 border-2 border-slate-700 border-t-cyan-500 rounded-full animate-spin"}),(0,W.jsx)("span",{className:"text-sm text-slate-400",children:"Loading timeline..."})]})}):a?(0,W.jsx)("div",{className:`flex items-center justify-center h-full bg-[#0a0a0f] ${e??""}`,children:(0,W.jsxs)("div",{className:"text-center space-y-2",children:[(0,W.jsx)("p",{className:"text-red-400 text-sm",children:"Failed to load memories"}),(0,W.jsx)("p",{className:"text-slate-500 text-xs",children:a})]})}):(0,W.jsxs)("div",{className:`h-full flex flex-col bg-[#0a0a0f] text-slate-200 ${e??""}`,children:[(0,W.jsxs)("div",{className:"shrink-0 border-b border-slate-800/60 px-4 py-3 space-y-3",children:[(0,W.jsx)("input",{type:"text",placeholder:"Search memories...",value:u,onChange:e=>h(e.target.value),className:"w-full bg-slate-900/60 border border-slate-700/50 rounded-lg px-3 py-2 text-sm text-slate-200 placeholder-slate-500 focus:outline-none focus:ring-1 focus:ring-cyan-500/40 focus:border-cyan-500/40"}),(0,W.jsxs)("div",{className:"flex items-center gap-2",children:[(0,W.jsx)("span",{className:"text-xs text-slate-500 uppercase tracking-wider mr-1",children:"Type"}),ut.map(e=>(0,W.jsx)("button",{onClick:()=>d(e.value),className:`px-2.5 py-1 rounded-md text-xs font-medium transition-colors ${c===e.value?"bg-cyan-500/20 text-cyan-400 border border-cyan-500/30":"bg-slate-800/40 text-slate-400 border border-slate-700/30 hover:bg-slate-800/80"}`,children:e.label},e.value))]}),(0,W.jsxs)("div",{className:"flex flex-wrap gap-1.5",children:[(0,W.jsx)("span",{className:"text-xs text-slate-500 uppercase tracking-wider mr-1 self-center",children:"Category"}),ue.map(e=>{let t=l.has(e),r=d8[e]??"#64748b";return(0,W.jsx)("button",{onClick:()=>{o(t=>{let r=new Set(t);return r.has(e)?r.delete(e):r.add(e),r})},className:"px-2.5 py-1 rounded-md text-xs font-medium transition-all",style:{backgroundColor:t?`${r}22`:"rgba(30, 41, 59, 0.4)",color:t?r:"#94a3b8",border:`1px solid ${t?`${r}55`:"rgba(51, 65, 85, 0.3)"}`},children:e},e)}),l.size>0&&(0,W.jsx)("button",{onClick:()=>o(new Set),className:"px-2 py-1 rounded-md text-xs text-slate-500 hover:text-slate-300 transition-colors",children:"Clear"})]})]}),(0,W.jsx)("div",{className:"flex-1 overflow-y-auto px-4 py-6",children:0===v.length?(0,W.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,W.jsxs)("div",{className:"text-center space-y-2 max-w-sm",children:[(0,W.jsx)("div",{className:"text-slate-600 text-4xl mb-3",children:"--"}),(0,W.jsx)("p",{className:"text-slate-400 text-sm",children:"No memories yet."}),(0,W.jsxs)("p",{className:"text-slate-500 text-xs",children:["Start a conversation and use ",(0,W.jsx)("code",{className:"text-cyan-500/80 bg-slate-800/60 px-1.5 py-0.5 rounded text-xs",children:"remember"})," to build your timeline."]})]})}):(0,W.jsxs)("div",{className:"relative",children:[(0,W.jsx)("div",{className:"absolute left-4 md:left-1/2 top-0 bottom-0 w-px bg-slate-800/80"}),v.map(e=>(0,W.jsxs)("div",{className:"mb-8",children:[(0,W.jsxs)("div",{className:"relative flex items-center mb-4",children:[(0,W.jsx)("div",{className:"absolute left-4 md:left-1/2 -translate-x-1/2 w-3 h-3 rounded-full bg-slate-700 border-2 border-slate-600 z-10"}),(0,W.jsx)("div",{className:"ml-10 md:ml-0 md:absolute md:left-1/2 md:translate-x-4",children:(0,W.jsx)("span",{className:"text-xs font-semibold text-slate-400 uppercase tracking-wider bg-[#0a0a0f] px-2",children:e.label})})]}),e.memories.map((e,t)=>{var r;let n=t%2==0,i=(r=e.salience)>=.8?{label:"Critical",colour:"#ef4444"}:r>=.6?{label:"High",colour:"#f59e0b"}:r>=.4?{label:"Medium",colour:"#3b82f6"}:{label:"Low",colour:"#64748b"},a=d8[e.category]??"#64748b",s=d9[e.type]??"#94a3b8",l=d7[e.type]??e.type,o=f.has(e.id);return(0,W.jsxs)("div",{ref:y(e.id),"data-memory-id":e.id,className:`relative flex mb-4 ${n?"md:justify-start justify-start":"md:justify-end justify-start"}`,style:{opacity:+!!o,transform:o?"translateY(0)":"translateY(12px)",transition:"opacity 0.4s ease-out, transform 0.4s ease-out"},children:[(0,W.jsx)("div",{className:"absolute left-4 md:left-1/2 top-4 -translate-x-1/2 w-2 h-2 rounded-full z-10",style:{backgroundColor:a}}),(0,W.jsxs)("div",{className:`ml-10 md:ml-0 w-full md:w-[calc(50%-2rem)] rounded-lg border border-slate-800/60 bg-slate-900/40 backdrop-blur-sm p-3 hover:border-slate-700/80 transition-colors ${n?"md:mr-auto md:ml-0":"md:ml-auto md:mr-0"}`,children:[(0,W.jsxs)("div",{className:"flex items-start justify-between gap-2 mb-1.5",children:[(0,W.jsx)("h3",{className:"text-sm font-medium text-slate-200 leading-tight flex-1 line-clamp-1",children:e.title}),(0,W.jsx)("span",{className:"text-[10px] text-slate-500 whitespace-nowrap",children:new Date(e.createdAt).toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})})]}),(0,W.jsx)("p",{className:"text-xs text-slate-400 line-clamp-2 mb-2 leading-relaxed",children:e.content}),(0,W.jsxs)("div",{className:"flex items-center flex-wrap gap-1.5",children:[(0,W.jsx)("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:`${a}18`,color:a,border:`1px solid ${a}33`},children:e.category}),(0,W.jsx)("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:`${s}18`,color:s,border:`1px solid ${s}33`},children:l}),(0,W.jsxs)("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px]",style:{color:i.colour},children:[(0,W.jsx)("span",{className:"w-1.5 h-1.5 rounded-full",style:{backgroundColor:i.colour}}),i.label]})]})]})]},e.id)})]},e.key))]})})]})}var ui=Symbol.for("immer-nothing"),ua=Symbol.for("immer-draftable"),us=Symbol.for("immer-state");function ul(e){throw Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var uo=Object,uc=uo.getPrototypeOf,ud="constructor",uu="prototype",uh="configurable",up="enumerable",um="writable",uf="value",ux=e=>!!e&&!!e[us];function uy(e){return!!e&&(ub(e)||uO(e)||!!e[ua]||!!e[ud]?.[ua]||uP(e)||uC(e))}var ug=uo[uu][ud].toString(),uv=new WeakMap;function ub(e){if(!e||!uA(e))return!1;let t=uc(e);if(null===t||t===uo[uu])return!0;let r=uo.hasOwnProperty.call(t,ud)&&t[ud];if(r===Object)return!0;if(!uE(r))return!1;let n=uv.get(r);return void 0===n&&(n=Function.toString.call(r),uv.set(r,n)),n===ug}function uj(e,t,r=!0){0===uw(e)?(r?Reflect.ownKeys(e):uo.keys(e)).forEach(r=>{t(r,e[r],e)}):e.forEach((r,n)=>t(n,r,e))}function uw(e){let t=e[us];return t?t.type_:uO(e)?1:uP(e)?2:3*!!uC(e)}var uN=(e,t,r=uw(e))=>2===r?e.has(t):uo[uu].hasOwnProperty.call(e,t),uk=(e,t,r=uw(e))=>2===r?e.get(t):e[t],uS=(e,t,r,n=uw(e))=>{2===n?e.set(t,r):3===n?e.add(r):e[t]=r},uO=Array.isArray,uP=e=>e instanceof Map,uC=e=>e instanceof Set,uA=e=>"object"==typeof e,uE=e=>"function"==typeof e,uM=e=>e.modified_?e.copy_:e.base_;function uT(e,t){if(uP(e))return new Map(e);if(uC(e))return new Set(e);if(uO(e))return Array[uu].slice.call(e);let r=ub(e);if(!0!==t&&("class_only"!==t||r)){let t=uc(e);if(null!==t&&r)return{...e};let n=uo.create(t);return uo.assign(n,e)}{let t=uo.getOwnPropertyDescriptors(e);delete t[us];let r=Reflect.ownKeys(t);for(let n=0;n<r.length;n++){let i=r[n],a=t[i];!1===a[um]&&(a[um]=!0,a[uh]=!0),(a.get||a.set)&&(t[i]={[uh]:!0,[um]:!0,[up]:a[up],[uf]:e[i]})}return uo.create(uc(e),t)}}function u_(e,t=!1){return uI(e)||ux(e)||!uy(e)||(uw(e)>1&&uo.defineProperties(e,{set:uD,add:uD,clear:uD,delete:uD}),uo.freeze(e),t&&uj(e,(e,t)=>{u_(t,!0)},!1)),e}var uD={[uf]:function(){ul(2)}};function uI(e){return!(null!==e&&uA(e))||uo.isFrozen(e)}var uz="MapSet",uL="Patches",uR="ArrayMethods",uF={};function u$(e){let t=uF[e];return t||ul(0,e),t}var uB=e=>!!uF[e];function uU(e,t){t&&(e.patchPlugin_=u$(uL),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function uq(e){uV(e),e.drafts_.forEach(uW),e.drafts_=null}function uV(e){e===m&&(m=e.parent_)}var uK=e=>m={drafts_:[],parent_:m,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:uB(uz)?u$(uz):void 0,arrayMethodsPlugin_:uB(uR)?u$(uR):void 0};function uW(e){let t=e[us];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function uH(e,t){t.unfinalizedDrafts_=t.drafts_.length;let r=t.drafts_[0];if(void 0!==e&&e!==r){r[us].modified_&&(uq(t),ul(4)),uy(e)&&(e=uQ(t,e));let{patchPlugin_:n}=t;n&&n.generateReplacementPatches_(r[us].base_,e,t)}else e=uQ(t,r);return function(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&u_(t,r)}(t,e,!0),uq(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==ui?e:void 0}function uQ(e,t){if(uI(t))return t;let r=t[us];if(!r)return u0(t,e.handledSet_,e);if(!uX(r,e))return t;if(!r.modified_)return r.base_;if(!r.finalized_){let{callbacks_:t}=r;if(t)for(;t.length>0;)t.pop()(e);uJ(r,e)}return r.copy_}function uY(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var uX=(e,t)=>e.scope_===t,uG=[];function uZ(e,t,r,n){let i=e.copy_||e.base_,a=e.type_;if(void 0!==n&&uk(i,n,a)===t)return void uS(i,n,r,a);if(!e.draftLocations_){let t=e.draftLocations_=new Map;uj(i,(e,r)=>{if(ux(r)){let n=t.get(r)||[];n.push(e),t.set(r,n)}})}for(let n of e.draftLocations_.get(t)??uG)uS(i,n,r,a)}function uJ(e,t){if(e.modified_&&!e.finalized_&&(3===e.type_||1===e.type_&&e.allIndicesReassigned_||(e.assigned_?.size??0)>0)){let{patchPlugin_:r}=t;if(r){let n=r.getPath(e);n&&r.generatePatches_(e,n,t)}uY(e)}}function u0(e,t,r){return!r.immer_.autoFreeze_&&r.unfinalizedDrafts_<1||ux(e)||t.has(e)||!uy(e)||uI(e)||(t.add(e),uj(e,(n,i)=>{if(ux(i)){let t=i[us];uX(t,r)&&(uS(e,n,uM(t),e.type_),uY(t))}else uy(i)&&u0(i,t,r)})),e}var u1={get(e,t){let r;if(t===us)return e;let n=e.scope_.arrayMethodsPlugin_,i=1===e.type_&&"string"==typeof t;if(i&&n?.isArrayOperationMethod(t))return n.createMethodInterceptor(e,t);let a=e.copy_||e.base_;if(!uN(a,t,e.type_)){var s;let r;return s=e,(r=u4(a,t))?uf in r?r[uf]:r.get?.call(s.draft_):void 0}let l=a[t];if(e.finalized_||!uy(l)||i&&e.operationMethod&&n?.isMutatingArrayMethod(e.operationMethod)&&Number.isInteger(r=+t)&&String(r)===t)return l;if(l===u5(e.base_,t)){u6(e);let r=1===e.type_?+t:t,n=u8(e.scope_,l,e,r);return e.copy_[r]=n}return l},has:(e,t)=>t in(e.copy_||e.base_),ownKeys:e=>Reflect.ownKeys(e.copy_||e.base_),set(e,t,r){let n=u4(e.copy_||e.base_,t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){let n=u5(e.copy_||e.base_,t),i=n?.[us];if(i&&i.base_===r)return e.copy_[t]=r,e.assigned_.set(t,!1),!0;if((r===n?0!==r||1/r==1/n:r!=r&&n!=n)&&(void 0!==r||uN(e.base_,t,e.type_)))return!0;u6(e),u3(e)}return!!(e.copy_[t]===r&&(void 0!==r||t in e.copy_)||Number.isNaN(r)&&Number.isNaN(e.copy_[t]))||(e.copy_[t]=r,e.assigned_.set(t,!0),!function(e,t,r){let{scope_:n}=e;if(ux(r)){let i=r[us];uX(i,n)&&i.callbacks_.push(function(){u6(e),uZ(e,r,uM(i),t)})}else uy(r)&&e.callbacks_.push(function(){let i=e.copy_||e.base_;3===e.type_?i.has(r)&&u0(r,n.handledSet_,n):uk(i,t,e.type_)===r&&n.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&u0(uk(e.copy_,t,e.type_),n.handledSet_,n)})}(e,t,r),!0)},deleteProperty:(e,t)=>(u6(e),void 0!==u5(e.base_,t)||t in e.base_?(e.assigned_.set(t,!1),u3(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){let r=e.copy_||e.base_,n=Reflect.getOwnPropertyDescriptor(r,t);return n?{[um]:!0,[uh]:1!==e.type_||"length"!==t,[up]:n[up],[uf]:r[t]}:n},defineProperty(){ul(11)},getPrototypeOf:e=>uc(e.base_),setPrototypeOf(){ul(12)}},u2={};for(let e in u1){let t=u1[e];u2[e]=function(){let e=arguments;return e[0]=e[0][0],t.apply(this,e)}}function u5(e,t){let r=e[us];return(r?r.copy_||r.base_:e)[t]}function u4(e,t){if(!(t in e))return;let r=uc(e);for(;r;){let e=Object.getOwnPropertyDescriptor(r,t);if(e)return e;r=uc(r)}}function u3(e){!e.modified_&&(e.modified_=!0,e.parent_&&u3(e.parent_))}function u6(e){e.copy_||(e.assigned_=new Map,e.copy_=uT(e.base_,e.scope_.immer_.useStrictShallowCopy_))}function u8(e,t,r,n){let[i,a]=uP(t)?u$(uz).proxyMap_(t,r):uC(t)?u$(uz).proxySet_(t,r):function(e,t){let r=uO(e),n={type_:+!!r,scope_:t?t.scope_:m,modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0},i=n,a=u1;r&&(i=[n],a=u2);let{revoke:s,proxy:l}=Proxy.revocable(i,a);return n.draft_=l,n.revoke_=s,[l,n]}(t,r);if((r?.scope_??m).drafts_.push(i),a.callbacks_=r?.callbacks_??[],a.key_=n,r&&void 0!==n)r.callbacks_.push(function(e){if(!a||!uX(a,e))return;e.mapSetPlugin_?.fixSetContents(a);let t=uM(a);uZ(r,a.draft_??a,t,n),uJ(a,e)});else a.callbacks_.push(function(e){e.mapSetPlugin_?.fixSetContents(a);let{patchPlugin_:t}=e;a.modified_&&t&&t.generatePatches_(a,[],e)});return i}function u7(e){return ux(e)||ul(10,e),function e(t){let r;if(!uy(t)||uI(t))return t;let n=t[us],i=!0;if(n){if(!n.modified_)return n.base_;n.finalized_=!0,r=uT(t,n.scope_.immer_.useStrictShallowCopy_),i=n.scope_.immer_.shouldUseStrictIteration()}else r=uT(t,!0);return uj(r,(t,n)=>{uS(r,t,e(n))},i),n&&(n.finalized_=!1),r}(e)}u2.deleteProperty=function(e,t){return u2.set.call(this,e,t,void 0)},u2.set=function(e,t,r){return u1.set.call(this,e[0],t,r,e[0])};var u9=new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(e,t,r)=>{let n;if(uE(e)&&!uE(t)){let r=t;t=e;let n=this;return function(e=r,...i){return n.produce(e,e=>t.call(this,e,...i))}}if(uE(t)||ul(6),void 0===r||uE(r)||ul(7),uy(e)){let i=uK(this),a=u8(i,e,void 0),s=!0;try{n=t(a),s=!1}finally{s?uq(i):uV(i)}return uU(i,r),uH(n,i)}if(e&&uA(e))ul(1,e);else{if(void 0===(n=t(e))&&(n=e),n===ui&&(n=void 0),this.autoFreeze_&&u_(n,!0),r){let t=[],i=[];u$(uL).generateReplacementPatches_(e,n,{patches_:t,inversePatches_:i}),r(t,i)}return n}},this.produceWithPatches=(e,t)=>{let r,n;return uE(e)?(t,...r)=>this.produceWithPatches(t,t=>e(t,...r)):[this.produce(e,t,(e,t)=>{r=e,n=t}),r,n]},"boolean"==typeof e?.autoFreeze&&this.setAutoFreeze(e.autoFreeze),"boolean"==typeof e?.useStrictShallowCopy&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),"boolean"==typeof e?.useStrictIteration&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){uy(e)||ul(8),ux(e)&&(e=u7(e));let t=uK(this),r=u8(t,e,void 0);return r[us].isManual_=!0,uV(t),r}finishDraft(e,t){let r=e&&e[us];r&&r.isManual_||ul(9);let{scope_:n}=r;return uU(n,t),uH(void 0,n)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let r;for(r=t.length-1;r>=0;r--){let n=t[r];if(0===n.path.length&&"replace"===n.op){e=n.value;break}}r>-1&&(t=t.slice(r+1));let n=u$(uL).applyPatches_;return ux(e)?n(e,t):this.produce(e,e=>n(e,t))}}().produce,he=e=>Array.isArray(e)?e:[e],ht=0,hr=class{revision=ht;_value;_lastValue;_isEqual=hn;constructor(e,t=hn){this._value=this._lastValue=e,this._isEqual=t}get value(){return this._value}set value(e){this.value!==e&&(this._value=e,this.revision=++ht)}};function hn(e,t){return e===t}function hi(e){return e instanceof hr||console.warn("Not a valid cell! ",e),e.value}var ha=(e,t)=>!1;function hs(){return function(e,t=hn){return new hr(null,t)}(0,ha)}var hl=e=>{let t=e.collectionTag;null===t&&(t=e.collectionTag=hs()),hi(t)};Symbol();var ho=0,hc=Object.getPrototypeOf({}),hd=class{constructor(e){this.value=e,this.value=e,this.tag.value=e}proxy=new Proxy(this,hu);tag=hs();tags={};children={};collectionTag=null;id=ho++},hu={get:(e,t)=>(function(){let{value:r}=e,n=Reflect.get(r,t);if("symbol"==typeof t||t in hc)return n;if("object"==typeof n&&null!==n){var i;let r=e.children[t];return void 0===r&&(r=e.children[t]=Array.isArray(i=n)?new hh(i):new hd(i)),r.tag&&hi(r.tag),r.proxy}{let r=e.tags[t];return void 0===r&&((r=e.tags[t]=hs()).value=n),hi(r),n}})(),ownKeys:e=>(hl(e),Reflect.ownKeys(e.value)),getOwnPropertyDescriptor:(e,t)=>Reflect.getOwnPropertyDescriptor(e.value,t),has:(e,t)=>Reflect.has(e.value,t)},hh=class{constructor(e){this.value=e,this.value=e,this.tag.value=e}proxy=new Proxy([this],hp);tag=hs();tags={};children={};collectionTag=null;id=ho++},hp={get:([e],t)=>("length"===t&&hl(e),hu.get(e,t)),ownKeys:([e])=>hu.ownKeys(e),getOwnPropertyDescriptor:([e],t)=>hu.getOwnPropertyDescriptor(e,t),has:([e],t)=>hu.has(e,t)},hm="u">typeof WeakRef?WeakRef:class{constructor(e){this.value=e}deref(){return this.value}};function hf(){return{s:0,v:void 0,o:null,p:null}}function hx(e,t={}){let r,n=hf(),{resultEqualityCheck:i}=t,a=0;function s(){let t,s=n,{length:l}=arguments;for(let e=0;e<l;e++){let t=arguments[e];if("function"==typeof t||"object"==typeof t&&null!==t){let e=s.o;null===e&&(s.o=e=new WeakMap);let r=e.get(t);void 0===r?(s=hf(),e.set(t,s)):s=r}else{let e=s.p;null===e&&(s.p=e=new Map);let r=e.get(t);void 0===r?(s=hf(),e.set(t,s)):s=r}}let o=s;if(1===s.s)t=s.v;else if(t=e.apply(null,arguments),a++,i){let e=r?.deref?.()??r;null!=e&&i(e,t)&&(t=e,0!==a&&a--),r="object"==typeof t&&null!==t||"function"==typeof t?new hm(t):t}return o.s=1,o.v=t,t}return s.clearCache=()=>{n=hf(),s.resetResultsCount()},s.resultsCount=()=>a,s.resetResultsCount=()=>{a=0},s}var hy=function(e,...t){let r="function"==typeof e?{memoize:e,memoizeOptions:t}:e,n=(...e)=>{let t,n,i=0,a=0,s={},l=e.pop();"object"==typeof l&&(s=l,l=e.pop()),function(e,t=`expected a function, instead received ${typeof e}`){if("function"!=typeof e)throw TypeError(t)}(l,`createSelector expects an output function after the inputs, but received: [${typeof l}]`);let{memoize:o,memoizeOptions:c=[],argsMemoize:d=hx,argsMemoizeOptions:u=[],devModeChecks:h={}}={...r,...s},p=he(c),m=he(u),f=(!function(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(e=>"function"==typeof e)){let r=e.map(e=>"function"==typeof e?`function ${e.name||"unnamed"}()`:typeof e).join(", ");throw TypeError(`${t}[${r}]`)}}(t=Array.isArray(e[0])?e[0]:e,"createSelector expects all input-selectors to be functions, but received the following types: "),t),x=o(function(){return i++,l.apply(null,arguments)},...p);return Object.assign(d(function(){a++;let e=function(e,t){let r=[],{length:n}=e;for(let i=0;i<n;i++)r.push(e[i].apply(null,t));return r}(f,arguments);return n=x.apply(null,e)},...m),{resultFunc:l,memoizedResultFunc:x,dependencies:f,dependencyRecomputations:()=>a,resetDependencyRecomputations:()=>{a=0},lastResult:()=>n,recomputations:()=>i,resetRecomputations:()=>{i=0},memoize:o,argsMemoize:d})};return Object.assign(n,{withTypes:()=>n}),n}(hx),hg=Object.assign((e,t=hy)=>{!function(e,t=`expected an object, instead received ${typeof e}`){if("object"!=typeof e)throw TypeError(t)}(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);let r=Object.keys(e);return t(r.map(t=>e[t]),(...e)=>e.reduce((e,t,n)=>(e[r[n]]=t,e),{}))},{withTypes:()=>hg});function hv(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var hb="function"==typeof Symbol&&Symbol.observable||"@@observable",hj=()=>Math.random().toString(36).substring(7).split("").join("."),hw={INIT:`@@redux/INIT${hj()}`,REPLACE:`@@redux/REPLACE${hj()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${hj()}`};function hN(e){if("object"!=typeof e||null===e)return!1;let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||null===Object.getPrototypeOf(e)}function hk(e){let t,r=Object.keys(e),n={};for(let t=0;t<r.length;t++){let i=r[t];"function"==typeof e[i]&&(n[i]=e[i])}let i=Object.keys(n);try{Object.keys(n).forEach(e=>{let t=n[e];if(void 0===t(void 0,{type:hw.INIT}))throw Error(hv(12));if(void 0===t(void 0,{type:hw.PROBE_UNKNOWN_ACTION()}))throw Error(hv(13))})}catch(e){t=e}return function(e={},r){if(t)throw t;let a=!1,s={};for(let t=0;t<i.length;t++){let l=i[t],o=n[l],c=e[l],d=o(c,r);if(void 0===d)throw r&&r.type,Error(hv(14));s[l]=d,a=a||d!==c}return(a=a||i.length!==Object.keys(e).length)?s:e}}function hS(...e){return 0===e.length?e=>e:1===e.length?e[0]:e.reduce((e,t)=>(...r)=>e(t(...r)))}function hO(e){return hN(e)&&"type"in e&&"string"==typeof e.type}function hP(e){return({dispatch:t,getState:r})=>n=>i=>"function"==typeof i?i(t,r,e):n(i)}var hC=hP(),hA="u">typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!=arguments.length)return"object"==typeof arguments[0]?hS:hS.apply(null,arguments)};function hE(e,t){function r(...n){if(t){let r=t(...n);if(!r)throw Error(pc(0));return{type:e,payload:r.payload,..."meta"in r&&{meta:r.meta},..."error"in r&&{error:r.error}}}return{type:e,payload:n[0]}}return r.toString=()=>`${e}`,r.type=e,r.match=t=>hO(t)&&t.type===e,r}"u">typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var hM=class e extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,e.prototype)}static get[Symbol.species](){return e}concat(...e){return super.concat.apply(this,e)}prepend(...t){return 1===t.length&&Array.isArray(t[0])?new e(...t[0].concat(this)):new e(...t.concat(this))}};function hT(e){return uy(e)?u9(e,()=>{}):e}function h_(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}var hD="RTK_autoBatch",hI=()=>e=>({payload:e,meta:{[hD]:!0}}),hz=e=>t=>{setTimeout(t,e)},hL=(e={type:"raf"})=>t=>(...r)=>{let n=t(...r),i=!0,a=!1,s=!1,l=new Set,o="tick"===e.type?queueMicrotask:"raf"===e.type?"u">typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:hz(10):"callback"===e.type?e.queueNotification:hz(e.timeout),c=()=>{s=!1,a&&(a=!1,l.forEach(e=>e()))};return Object.assign({},n,{subscribe(e){let t=n.subscribe(()=>i&&e());return l.add(e),()=>{t(),l.delete(e)}},dispatch(e){try{return(a=!(i=!e?.meta?.[hD]))&&!s&&(s=!0,o(c)),n.dispatch(e)}finally{i=!0}}})};function hR(e){let t,r={},n=[],i={addCase(e,t){let n="string"==typeof e?e:e.type;if(!n)throw Error(pc(28));if(n in r)throw Error(pc(29));return r[n]=t,i},addAsyncThunk:(e,t)=>(t.pending&&(r[e.pending.type]=t.pending),t.rejected&&(r[e.rejected.type]=t.rejected),t.fulfilled&&(r[e.fulfilled.type]=t.fulfilled),t.settled&&n.push({matcher:e.settled,reducer:t.settled}),i),addMatcher:(e,t)=>(n.push({matcher:e,reducer:t}),i),addDefaultCase:e=>(t=e,i)};return e(i),[r,n,t]}var hF=Symbol.for("rtk-slice-createasyncthunk"),h$=((u=h$||{}).reducer="reducer",u.reducerWithPrepare="reducerWithPrepare",u.asyncThunk="asyncThunk",u),hB=function({creators:e}={}){let t=e?.asyncThunk?.[hF];return function(e){let r,{name:n,reducerPath:i=n}=e;if(!n)throw Error(pc(11));let a=("function"==typeof e.reducers?e.reducers(function(){function e(e,t){return{_reducerDefinitionType:"asyncThunk",payloadCreator:e,...t}}return e.withTypes=()=>e,{reducer:e=>Object.assign({[e.name]:(...t)=>e(...t)}[e.name],{_reducerDefinitionType:"reducer"}),preparedReducer:(e,t)=>({_reducerDefinitionType:"reducerWithPrepare",prepare:e,reducer:t}),asyncThunk:e}}()):e.reducers)||{},s=Object.keys(a),l={},o={},c={},d=[],u={addCase(e,t){let r="string"==typeof e?e:e.type;if(!r)throw Error(pc(12));if(r in o)throw Error(pc(13));return o[r]=t,u},addMatcher:(e,t)=>(d.push({matcher:e,reducer:t}),u),exposeAction:(e,t)=>(c[e]=t,u),exposeCaseReducer:(e,t)=>(l[e]=t,u)};function h(){let[t={},r=[],n]="function"==typeof e.extraReducers?hR(e.extraReducers):[e.extraReducers],i={...t,...o};return function(e,t){let r,[n,i,a]=hR(t);if("function"==typeof e)r=()=>hT(e());else{let t=hT(e);r=()=>t}function s(e=r(),t){let l=[n[t.type],...i.filter(({matcher:e})=>e(t)).map(({reducer:e})=>e)];return 0===l.filter(e=>!!e).length&&(l=[a]),l.reduce((e,r)=>{if(r)if(ux(e)){let n=r(e,t);return void 0===n?e:n}else{if(uy(e))return u9(e,e=>r(e,t));let n=r(e,t);if(void 0===n){if(null===e)return e;throw Error("A case reducer on a non-draftable value must not return undefined")}return n}return e},e)}return s.getInitialState=r,s}(e.initialState,e=>{for(let t in i)e.addCase(t,i[t]);for(let t of d)e.addMatcher(t.matcher,t.reducer);for(let t of r)e.addMatcher(t.matcher,t.reducer);n&&e.addDefaultCase(n)})}s.forEach(r=>{let i=a[r],s={reducerName:r,type:`${n}/${r}`,createNotation:"function"==typeof e.reducers};"asyncThunk"===i._reducerDefinitionType?function({type:e,reducerName:t},r,n,i){if(!i)throw Error(pc(18));let{payloadCreator:a,fulfilled:s,pending:l,rejected:o,settled:c,options:d}=r,u=i(e,a,d);n.exposeAction(t,u),s&&n.addCase(u.fulfilled,s),l&&n.addCase(u.pending,l),o&&n.addCase(u.rejected,o),c&&n.addMatcher(u.settled,c),n.exposeCaseReducer(t,{fulfilled:s||hU,pending:l||hU,rejected:o||hU,settled:c||hU})}(s,i,u,t):function({type:e,reducerName:t,createNotation:r},n,i){let a,s;if("reducer"in n){if(r&&"reducerWithPrepare"!==n._reducerDefinitionType)throw Error(pc(17));a=n.reducer,s=n.prepare}else a=n;i.addCase(e,a).exposeCaseReducer(t,a).exposeAction(t,s?hE(e,s):hE(e))}(s,i,u)});let p=e=>e,m=new Map,f=new WeakMap;function x(e,t){return r||(r=h()),r(e,t)}function y(){return r||(r=h()),r.getInitialState()}function g(t,r=!1){function n(e){let i=e[t];return void 0===i&&r&&(i=h_(f,n,y)),i}function i(t=p){let n=h_(m,r,()=>new WeakMap);return h_(n,t,()=>{let n={};for(let[i,a]of Object.entries(e.selectors??{}))n[i]=function(e,t,r,n){function i(a,...s){let l=t(a);return void 0===l&&n&&(l=r()),e(l,...s)}return i.unwrapped=e,i}(a,t,()=>h_(f,t,y),r);return n})}return{reducerPath:t,getSelectors:i,get selectors(){return i(n)},selectSlice:n}}let v={name:n,reducer:x,actions:c,caseReducers:l,getInitialState:y,...g(i),injectInto(e,{reducerPath:t,...r}={}){let n=t??i;return e.inject({reducerPath:n,reducer:x},r),{...v,...g(n,!0)}}};return v}}();function hU(){}var hq="listener",hV="completed",hK="cancelled",hW=`task-${hK}`,hH=`task-${hV}`,hQ=`${hq}-${hK}`,hY=`${hq}-${hV}`,hX=class{constructor(e){this.code=e,this.message=`task ${hK} (reason: ${e})`}name="TaskAbortError";message},hG=(e,t)=>{if("function"!=typeof e)throw TypeError(pc(32))},hZ=()=>{},hJ=(e,t=hZ)=>(e.catch(t),e),h0=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),h1=e=>{if(e.aborted)throw new hX(e.reason)};function h2(e,t){let r=hZ;return new Promise((n,i)=>{let a=()=>i(new hX(e.reason));e.aborted?a():(r=h0(e,a),t.finally(()=>r()).then(n,i))}).finally(()=>{r=hZ})}var h5=async(e,t)=>{try{await Promise.resolve();let t=await e();return{status:"ok",value:t}}catch(e){return{status:e instanceof hX?"cancelled":"rejected",error:e}}finally{t?.()}},h4=e=>t=>hJ(h2(e,t).then(t=>(h1(e),t))),h3=e=>{let t=h4(e);return e=>t(new Promise(t=>setTimeout(t,e)))},{assign:h6}=Object,h8={},h7="listenerMiddleware",h9=e=>{let{type:t,actionCreator:r,matcher:n,predicate:i,effect:a}=e;if(t)i=hE(t).match;else if(r)t=r.type,i=r.match;else if(n)i=n;else if(i);else throw Error(pc(21));return hG(a,"options.listener"),{predicate:i,type:t,effect:a}},pe=h6(e=>{let{type:t,predicate:r,effect:n}=h9(e);return{id:((e=21)=>{let t="",r=e;for(;r--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t})(),effect:n,type:t,predicate:r,pending:new Set,unsubscribe:()=>{throw Error(pc(22))}}},{withTypes:()=>pe}),pt=(e,t)=>{let{type:r,effect:n,predicate:i}=h9(t);return Array.from(e.values()).find(e=>("string"==typeof r?e.type===r:e.predicate===i)&&e.effect===n)},pr=e=>{e.pending.forEach(e=>{e.abort(hQ)})},pn=(e,t,r)=>{try{e(t,r)}catch(e){setTimeout(()=>{throw e},0)}},pi=h6(hE(`${h7}/add`),{withTypes:()=>pi}),pa=hE(`${h7}/removeAll`),ps=h6(hE(`${h7}/remove`),{withTypes:()=>ps}),pl=(...e)=>{console.error(`${h7}/error`,...e)},po=(e={})=>{let t=new Map,r=new Map,{extra:n,onError:i=pl}=e;hG(i,"onError");let a=e=>{var r;return(r=pt(t,e)??pe(e)).unsubscribe=()=>t.delete(r.id),t.set(r.id,r),e=>{r.unsubscribe(),e?.cancelActive&&pr(r)}};h6(a,{withTypes:()=>a});let s=e=>{let r=pt(t,e);return r&&(r.unsubscribe(),e.cancelActive&&pr(r)),!!r};h6(s,{withTypes:()=>s});let l=async(e,s,l,o)=>{var c,d;let u,h=new AbortController,p=(c=h.signal,u=async(e,t)=>{h1(c);let r=()=>{},n=[new Promise((t,n)=>{let i=a({predicate:e,effect:(e,r)=>{r.unsubscribe(),t([e,r.getState(),r.getOriginalState()])}});r=()=>{i(),n()}})];null!=t&&n.push(new Promise(e=>setTimeout(e,t,null)));try{let e=await h2(c,Promise.race(n));return h1(c),e}finally{r()}},(e,t)=>hJ(u(e,t))),m=[];try{let i;e.pending.add(h),i=r.get(e)??0,r.set(e,i+1),await Promise.resolve(e.effect(s,h6({},l,{getOriginalState:o,condition:(e,t)=>p(e,t).then(Boolean),take:p,delay:h3(h.signal),pause:h4(h.signal),extra:n,signal:h.signal,fork:(d=h.signal,(e,t)=>{hG(e,"taskExecutor");let r=new AbortController;h0(d,()=>r.abort(d.reason));let n=h5(async()=>{h1(d),h1(r.signal);let t=await e({pause:h4(r.signal),delay:h3(r.signal),signal:r.signal});return h1(r.signal),t},()=>r.abort(hH));return t?.autoJoin&&m.push(n.catch(hZ)),{result:h4(d)(n),cancel(){r.abort(hW)}}}),unsubscribe:e.unsubscribe,subscribe:()=>{t.set(e.id,e)},cancelActiveListeners:()=>{e.pending.forEach((e,t,r)=>{e!==h&&(e.abort(hQ),r.delete(e))})},cancel:()=>{h.abort(hQ),e.pending.delete(h)},throwIfCancelled:()=>{h1(h.signal)}})))}catch(e){e instanceof hX||pn(i,e,{raisedBy:"effect"})}finally{let t;await Promise.all(m),h.abort(hY),1===(t=r.get(e)??1)?r.delete(e):r.set(e,t-1),e.pending.delete(h)}},o=()=>{for(let e of r.keys())pr(e);t.clear()};return{middleware:e=>r=>n=>{let c;if(!hO(n))return r(n);if(pi.match(n))return a(n.payload);if(pa.match(n))return void o();if(ps.match(n))return s(n.payload);let d=e.getState(),u=()=>{if(d===h8)throw Error(pc(23));return d};try{if(c=r(n),t.size>0){let r=e.getState();for(let a of Array.from(t.values())){let t=!1;try{t=a.predicate(n,r,d)}catch(e){t=!1,pn(i,e,{raisedBy:"predicate"})}t&&l(a,n,e,u)}}}finally{d=h8}return c},startListening:a,stopListening:s,clearListeners:o}};function pc(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}Symbol.for("rtk-state-proxy-original");var pd=e.i(78712);function pu(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4,r=10**t,n=Math.round(e*r)/r;return Object.is(n,-0)?0:n}function ph(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return e.reduce((e,t,n)=>{var i=r[n-1];return"string"==typeof i?e+i+t:void 0!==i?e+pu(i)+t:e+t},"")}var pp=e=>0===e?0:e>0?1:-1,pm=e=>"number"==typeof e&&e!=+e,pf=e=>"string"==typeof e&&e.indexOf("%")===e.length-1,px=e=>("number"==typeof e||e instanceof Number)&&!pm(e),py=e=>px(e)||"string"==typeof e,pg=0,pv=e=>{var t=++pg;return"".concat(e||"").concat(t)},pb=function(e,t){var r,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!px(e)&&"string"!=typeof e)return n;if(pf(e)){if(null==t)return n;var a=e.indexOf("%");r=t*parseFloat(e.slice(0,a))/100}else r=+e;return pm(r)&&(r=n),i&&null!=t&&r>t&&(r=t),r},pj=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,r={},n=0;n<t;n++)if(r[String(e[n])])return!0;else r[String(e[n])]=!0;return!1};function pw(e,t,r){return px(e)&&px(t)?pu(e+r*(t-e)):t}var pN=e=>null==e?e:"".concat(e.charAt(0).toUpperCase()).concat(e.slice(1));function pk(e){return null!=e}function pS(){}var pO=(e,t)=>{if(t&&Array.isArray(e)){var r=Number.parseInt(t,10);if(!pm(r))return e[r]}},pP=hB({name:"options",initialState:{chartName:"",tooltipPayloadSearcher:()=>void 0,eventEmitter:void 0,defaultTooltipEventType:"axis"},reducers:{createEventEmitter:e=>{null==e.eventEmitter&&(e.eventEmitter=Symbol("rechartsEventEmitter"))}}}),pC=pP.reducer,{createEventEmitter:pA}=pP.actions,pE=(e.i(8710),{notify(){},get:()=>[]}),pM="u">typeof window&&void 0!==window.document&&void 0!==window.document.createElement,pT="u">typeof navigator&&"ReactNative"===navigator.product,p_=pM||pT?H.useLayoutEffect:H.useEffect;function pD(e,t){return e===t?0!==e||0!==t||1/e==1/t:e!=e&&t!=t}var pI=Symbol.for("react-redux-context"),pz="u">typeof globalThis?globalThis:{},pL=function(){if(!H.createContext)return{};let e=pz[pI]??=new Map,t=e.get(H.createContext);return t||(t=H.createContext(null),e.set(H.createContext,t)),t}(),pR=function(e){let{children:t,context:r,serverState:n,store:i}=e,a=H.useMemo(()=>{let e=function(e,t){let r,n=pE,i=0,a=!1;function s(){c.onStateChange&&c.onStateChange()}function l(){if(i++,!r){let t,i;r=e.subscribe(s),t=null,i=null,n={clear(){t=null,i=null},notify(){let e=t;for(;e;)e.callback(),e=e.next},get(){let e=[],r=t;for(;r;)e.push(r),r=r.next;return e},subscribe(e){let r=!0,n=i={callback:e,next:null,prev:i};return n.prev?n.prev.next=n:t=n,function(){r&&null!==t&&(r=!1,n.next?n.next.prev=n.prev:i=n.prev,n.prev?n.prev.next=n.next:t=n.next)}}}}}function o(){i--,r&&0===i&&(r(),r=void 0,n.clear(),n=pE)}let c={addNestedSub:function(e){l();let t=n.subscribe(e),r=!1;return()=>{r||(r=!0,t(),o())}},notifyNestedSubs:function(){n.notify()},handleChangeWrapper:s,isSubscribed:function(){return a},trySubscribe:function(){a||(a=!0,l())},tryUnsubscribe:function(){a&&(a=!1,o())},getListeners:()=>n};return c}(i);return{store:i,subscription:e,getServerState:n?()=>n:void 0}},[i,n]),s=H.useMemo(()=>i.getState(),[i]);return p_(()=>{let{subscription:e}=a;return e.onStateChange=e.notifyNestedSubs,e.trySubscribe(),s!==i.getState()&&e.notifyNestedSubs(),()=>{e.tryUnsubscribe(),e.onStateChange=void 0}},[a,s]),H.createElement((r||pL).Provider,{value:a},t)};function pF(e=pL){return function(){return H.useContext(e)}}var p$=pF(),pB=Symbol.for("immer-nothing"),pU=Symbol.for("immer-draftable"),pq=Symbol.for("immer-state");function pV(e){throw Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var pK=Object.getPrototypeOf;function pW(e){return!!e&&!!e[pq]}function pH(e){return!!e&&(pX(e)||Array.isArray(e)||!!e[pU]||!!e.constructor?.[pU]||p1(e)||p2(e))}var pQ=Object.prototype.constructor.toString(),pY=new WeakMap;function pX(e){if(!e||"object"!=typeof e)return!1;let t=Object.getPrototypeOf(e);if(null===t||t===Object.prototype)return!0;let r=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;if(r===Object)return!0;if("function"!=typeof r)return!1;let n=pY.get(r);return void 0===n&&(n=Function.toString.call(r),pY.set(r,n)),n===pQ}function pG(e,t,r=!0){0===pZ(e)?(r?Reflect.ownKeys(e):Object.keys(e)).forEach(r=>{t(r,e[r],e)}):e.forEach((r,n)=>t(n,r,e))}function pZ(e){let t=e[pq];return t?t.type_:Array.isArray(e)?1:p1(e)?2:3*!!p2(e)}function pJ(e,t){return 2===pZ(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function p0(e,t,r){let n=pZ(e);2===n?e.set(t,r):3===n?e.add(r):e[t]=r}function p1(e){return e instanceof Map}function p2(e){return e instanceof Set}function p5(e){return e.copy_||e.base_}function p4(e,t){if(p1(e))return new Map(e);if(p2(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);let r=pX(e);if(!0!==t&&("class_only"!==t||r)){let t=pK(e);return null!==t&&r?{...e}:Object.assign(Object.create(t),e)}{let t=Object.getOwnPropertyDescriptors(e);delete t[pq];let r=Reflect.ownKeys(t);for(let n=0;n<r.length;n++){let i=r[n],a=t[i];!1===a.writable&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(t[i]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[i]})}return Object.create(pK(e),t)}}function p3(e,t=!1){return p8(e)||pW(e)||!pH(e)||(pZ(e)>1&&Object.defineProperties(e,{set:p6,add:p6,clear:p6,delete:p6}),Object.freeze(e),t&&Object.values(e).forEach(e=>p3(e,!0))),e}var p6={value:function(){pV(2)}};function p8(e){return null===e||"object"!=typeof e||Object.isFrozen(e)}var p7={};function p9(e){let t=p7[e];return t||pV(0,e),t}function me(e,t){t&&(p9("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function mt(e){mr(e),e.drafts_.forEach(mi),e.drafts_=null}function mr(e){e===f&&(f=e.parent_)}function mn(e){return f={drafts_:[],parent_:f,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function mi(e){let t=e[pq];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function ma(e,t){t.unfinalizedDrafts_=t.drafts_.length;let r=t.drafts_[0];return void 0!==e&&e!==r?(r[pq].modified_&&(mt(t),pV(4)),pH(e)&&(e=ms(t,e),t.parent_||mo(t,e)),t.patches_&&p9("Patches").generateReplacementPatches_(r[pq].base_,e,t.patches_,t.inversePatches_)):e=ms(t,r,[]),mt(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==pB?e:void 0}function ms(e,t,r){if(p8(t))return t;let n=e.immer_.shouldUseStrictIteration(),i=t[pq];if(!i)return pG(t,(n,a)=>ml(e,i,t,n,a,r),n),t;if(i.scope_!==e)return t;if(!i.modified_)return mo(e,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;let t=i.copy_,a=t,s=!1;3===i.type_&&(a=new Set(t),t.clear(),s=!0),pG(a,(n,a)=>ml(e,i,t,n,a,r,s),n),mo(e,t,!1),r&&e.patches_&&p9("Patches").generatePatches_(i,r,e.patches_,e.inversePatches_)}return i.copy_}function ml(e,t,r,n,i,a,s){if(null==i||"object"!=typeof i&&!s)return;let l=p8(i);if(!l||s){if(pW(i)){let s=ms(e,i,a&&t&&3!==t.type_&&!pJ(t.assigned_,n)?a.concat(n):void 0);if(p0(r,n,s),!pW(s))return;e.canAutoFreeze_=!1}else s&&r.add(i);if(pH(i)&&!l){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1||t&&t.base_&&t.base_[n]===i&&l)return;ms(e,i),(!t||!t.scope_.parent_)&&"symbol"!=typeof n&&(p1(r)?r.has(n):Object.prototype.propertyIsEnumerable.call(r,n))&&mo(e,i)}}}function mo(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&p3(t,r)}var mc={get(e,t){if(t===pq)return e;let r=p5(e);if(!pJ(r,t)){var n;let i;return n=e,(i=mh(r,t))?"value"in i?i.value:i.get?.call(n.draft_):void 0}let i=r[t];return e.finalized_||!pH(i)?i:i===mu(e.base_,t)?(mm(e),e.copy_[t]=mx(i,e)):i},has:(e,t)=>t in p5(e),ownKeys:e=>Reflect.ownKeys(p5(e)),set(e,t,r){let n=mh(p5(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){let n=mu(p5(e),t),i=n?.[pq];if(i&&i.base_===r)return e.copy_[t]=r,e.assigned_[t]=!1,!0;if((r===n?0!==r||1/r==1/n:r!=r&&n!=n)&&(void 0!==r||pJ(e.base_,t)))return!0;mm(e),mp(e)}return!!(e.copy_[t]===r&&(void 0!==r||t in e.copy_)||Number.isNaN(r)&&Number.isNaN(e.copy_[t]))||(e.copy_[t]=r,e.assigned_[t]=!0,!0)},deleteProperty:(e,t)=>(void 0!==mu(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,mm(e),mp(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){let r=p5(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:n.enumerable,value:r[t]}:n},defineProperty(){pV(11)},getPrototypeOf:e=>pK(e.base_),setPrototypeOf(){pV(12)}},md={};function mu(e,t){let r=e[pq];return(r?p5(r):e)[t]}function mh(e,t){if(!(t in e))return;let r=pK(e);for(;r;){let e=Object.getOwnPropertyDescriptor(r,t);if(e)return e;r=pK(r)}}function mp(e){!e.modified_&&(e.modified_=!0,e.parent_&&mp(e.parent_))}function mm(e){e.copy_||(e.copy_=p4(e.base_,e.scope_.immer_.useStrictShallowCopy_))}pG(mc,(e,t)=>{md[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}}),md.deleteProperty=function(e,t){return md.set.call(this,e,t,void 0)},md.set=function(e,t,r){return mc.set.call(this,e[0],t,r,e[0])};var mf=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(e,t,r)=>{let n;if("function"==typeof e&&"function"!=typeof t){let r=t;t=e;let n=this;return function(e=r,...i){return n.produce(e,e=>t.call(this,e,...i))}}if("function"!=typeof t&&pV(6),void 0!==r&&"function"!=typeof r&&pV(7),pH(e)){let i=mn(this),a=mx(e,void 0),s=!0;try{n=t(a),s=!1}finally{s?mt(i):mr(i)}return me(i,r),ma(n,i)}if(e&&"object"==typeof e)pV(1,e);else{if(void 0===(n=t(e))&&(n=e),n===pB&&(n=void 0),this.autoFreeze_&&p3(n,!0),r){let t=[],i=[];p9("Patches").generateReplacementPatches_(e,n,t,i),r(t,i)}return n}},this.produceWithPatches=(e,t)=>{let r,n;return"function"==typeof e?(t,...r)=>this.produceWithPatches(t,t=>e(t,...r)):[this.produce(e,t,(e,t)=>{r=e,n=t}),r,n]},"boolean"==typeof e?.autoFreeze&&this.setAutoFreeze(e.autoFreeze),"boolean"==typeof e?.useStrictShallowCopy&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),"boolean"==typeof e?.useStrictIteration&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){var t;pH(e)||pV(8),pW(e)&&(pW(t=e)||pV(10,t),e=function e(t){let r;if(!pH(t)||p8(t))return t;let n=t[pq],i=!0;if(n){if(!n.modified_)return n.base_;n.finalized_=!0,r=p4(t,n.scope_.immer_.useStrictShallowCopy_),i=n.scope_.immer_.shouldUseStrictIteration()}else r=p4(t,!0);return pG(r,(t,n)=>{p0(r,t,e(n))},i),n&&(n.finalized_=!1),r}(t));let r=mn(this),n=mx(e,void 0);return n[pq].isManual_=!0,mr(r),n}finishDraft(e,t){let r=e&&e[pq];r&&r.isManual_||pV(9);let{scope_:n}=r;return me(n,t),ma(void 0,n)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let r;for(r=t.length-1;r>=0;r--){let n=t[r];if(0===n.path.length&&"replace"===n.op){e=n.value;break}}r>-1&&(t=t.slice(r+1));let n=p9("Patches").applyPatches_;return pW(e)?n(e,t):this.produce(e,e=>n(e,t))}};function mx(e,t){let r=p1(e)?p9("MapSet").proxyMap_(e,t):p2(e)?p9("MapSet").proxySet_(e,t):function(e,t){let r=Array.isArray(e),n={type_:+!!r,scope_:t?t.scope_:f,modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1},i=n,a=mc;r&&(i=[n],a=md);let{revoke:s,proxy:l}=Proxy.revocable(i,a);return n.draft_=l,n.revoke_=s,l}(e,t);return(t?t.scope_:f).drafts_.push(r),r}new mf().produce;var my={active:!1,index:null,dataKey:void 0,graphicalItemId:void 0,coordinate:void 0},mg=hB({name:"tooltip",initialState:{itemInteraction:{click:my,hover:my},axisInteraction:{click:my,hover:my},keyboardInteraction:my,syncInteraction:{active:!1,index:null,dataKey:void 0,label:void 0,coordinate:void 0,sourceViewBox:void 0,graphicalItemId:void 0},tooltipItemPayloads:[],settings:{shared:void 0,trigger:"hover",axisId:0,active:!1,defaultIndex:void 0}},reducers:{addTooltipEntrySettings:{reducer(e,t){e.tooltipItemPayloads.push(t.payload)},prepare:hI()},replaceTooltipEntrySettings:{reducer(e,t){var{prev:r,next:n}=t.payload,i=u7(e).tooltipItemPayloads.indexOf(r);i>-1&&(e.tooltipItemPayloads[i]=n)},prepare:hI()},removeTooltipEntrySettings:{reducer(e,t){var r=u7(e).tooltipItemPayloads.indexOf(t.payload);r>-1&&e.tooltipItemPayloads.splice(r,1)},prepare:hI()},setTooltipSettingsState(e,t){e.settings=t.payload},setActiveMouseOverItemIndex(e,t){e.syncInteraction.active=!1,e.keyboardInteraction.active=!1,e.itemInteraction.hover.active=!0,e.itemInteraction.hover.index=t.payload.activeIndex,e.itemInteraction.hover.dataKey=t.payload.activeDataKey,e.itemInteraction.hover.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.hover.coordinate=t.payload.activeCoordinate},mouseLeaveChart(e){e.itemInteraction.hover.active=!1,e.axisInteraction.hover.active=!1},mouseLeaveItem(e){e.itemInteraction.hover.active=!1},setActiveClickItemIndex(e,t){e.syncInteraction.active=!1,e.itemInteraction.click.active=!0,e.keyboardInteraction.active=!1,e.itemInteraction.click.index=t.payload.activeIndex,e.itemInteraction.click.dataKey=t.payload.activeDataKey,e.itemInteraction.click.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.click.coordinate=t.payload.activeCoordinate},setMouseOverAxisIndex(e,t){e.syncInteraction.active=!1,e.axisInteraction.hover.active=!0,e.keyboardInteraction.active=!1,e.axisInteraction.hover.index=t.payload.activeIndex,e.axisInteraction.hover.dataKey=t.payload.activeDataKey,e.axisInteraction.hover.coordinate=t.payload.activeCoordinate},setMouseClickAxisIndex(e,t){e.syncInteraction.active=!1,e.keyboardInteraction.active=!1,e.axisInteraction.click.active=!0,e.axisInteraction.click.index=t.payload.activeIndex,e.axisInteraction.click.dataKey=t.payload.activeDataKey,e.axisInteraction.click.coordinate=t.payload.activeCoordinate},setSyncInteraction(e,t){e.syncInteraction=t.payload},setKeyboardInteraction(e,t){e.keyboardInteraction.active=t.payload.active,e.keyboardInteraction.index=t.payload.activeIndex,e.keyboardInteraction.coordinate=t.payload.activeCoordinate}}}),{addTooltipEntrySettings:mv,replaceTooltipEntrySettings:mb,removeTooltipEntrySettings:mj,setTooltipSettingsState:mw,setActiveMouseOverItemIndex:mN,mouseLeaveItem:mk,mouseLeaveChart:mS,setActiveClickItemIndex:mO,setMouseOverAxisIndex:mP,setMouseClickAxisIndex:mC,setSyncInteraction:mA,setKeyboardInteraction:mE}=mg.actions,mM=mg.reducer,mT=hB({name:"chartData",initialState:{chartData:void 0,computedData:void 0,dataStartIndex:0,dataEndIndex:0},reducers:{setChartData(e,t){if(e.chartData=t.payload,null==t.payload){e.dataStartIndex=0,e.dataEndIndex=0;return}t.payload.length>0&&e.dataEndIndex!==t.payload.length-1&&(e.dataEndIndex=t.payload.length-1)},setComputedData(e,t){e.computedData=t.payload},setDataStartEndIndexes(e,t){var{startIndex:r,endIndex:n}=t.payload;null!=r&&(e.dataStartIndex=r),null!=n&&(e.dataEndIndex=n)}}}),{setChartData:m_,setDataStartEndIndexes:mD,setComputedData:mI}=mT.actions,mz=mT.reducer,mL=hB({name:"chartLayout",initialState:{layoutType:"horizontal",width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},reducers:{setLayout(e,t){e.layoutType=t.payload},setChartSize(e,t){e.width=t.payload.width,e.height=t.payload.height},setMargin(e,t){var r,n,i,a;e.margin.top=null!=(r=t.payload.top)?r:0,e.margin.right=null!=(n=t.payload.right)?n:0,e.margin.bottom=null!=(i=t.payload.bottom)?i:0,e.margin.left=null!=(a=t.payload.left)?a:0},setScale(e,t){e.scale=t.payload}}}),{setMargin:mR,setLayout:mF,setChartSize:m$,setScale:mB}=mL.actions,mU=mL.reducer,mq=e.i(27688),mV=(0,H.createContext)(null),mK=e=>e,mW=()=>{var e=(0,H.useContext)(mV);return e?e.store.dispatch:mK},mH=()=>{},mQ=()=>mH,mY=(e,t)=>e===t;function mX(e){var t=(0,H.useContext)(mV),r=(0,H.useMemo)(()=>t?t=>{if(null!=t)return e(t)}:mH,[t,e]);return(0,mq.useSyncExternalStoreWithSelector)(t?t.subscription.addNestedSub:mQ,t?t.store.getState:mH,t?t.store.getState:mH,r,mY)}var mG=e.i(28914),mZ=e=>e.legend.settings;function mJ(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}function m0(e){return function(){return e}}function m1(e,t){if((i=e.length)>1)for(var r,n,i,a=1,s=e[t[0]],l=s.length;a<i;++a)for(n=s,s=e[t[a]],r=0;r<l;++r)s[r][1]+=s[r][0]=isNaN(n[r][1])?n[r][0]:n[r][1]}function m2(e){for(var t=e.length,r=Array(t);--t>=0;)r[t]=t;return r}function m5(e,t){return e[t]}function m4(e){let t=[];return t.key=e,t}function m3(e,t,r){return Array.isArray(e)&&e&&t+r!==0?e.slice(t,r+1):e}function m6(e){return Number.isFinite(e)}function m8(e){return"number"==typeof e&&e>0&&Number.isFinite(e)}function m7(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function m9(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?m7(Object(r),!0).forEach(function(t){var n,i,a;n=e,i=t,a=r[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in n?Object.defineProperty(n,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):n[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):m7(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function fe(e,t,r){return null==e||null==t?r:py(t)?(0,pd.default)(e,t,r):"function"==typeof t?t(e):r}hy([e=>e.legend.payload,mZ],(e,t)=>{var{itemSorter:r}=t,n=e.flat(1);return r?(0,mG.default)(n,r):n}),Array.prototype.slice;var ft=(e,t)=>"horizontal"===e&&"xAxis"===t||"vertical"===e&&"yAxis"===t||"centric"===e&&"angleAxis"===t||"radial"===e&&"radiusAxis"===t,fr={sign:e=>{var t,r=e.length;if(!(r<=0)){var n=null==(t=e[0])?void 0:t.length;if(null!=n&&!(n<=0))for(var i=0;i<n;++i)for(var a=0,s=0,l=0;l<r;++l){var o=e[l],c=null==o?void 0:o[i];if(null!=c){var d=c[1],u=c[0],h=pm(d)?u:d;h>=0?(c[0]=a,a+=h,c[1]=a):(c[0]=s,s+=h,c[1]=s)}}}},expand:function(e,t){if((n=e.length)>0){for(var r,n,i,a=0,s=e[0].length;a<s;++a){for(i=r=0;r<n;++r)i+=e[r][a][1]||0;if(i)for(r=0;r<n;++r)e[r][a][1]/=i}m1(e,t)}},none:m1,silhouette:function(e,t){if((r=e.length)>0){for(var r,n=0,i=e[t[0]],a=i.length;n<a;++n){for(var s=0,l=0;s<r;++s)l+=e[s][n][1]||0;i[n][1]+=i[n][0]=-l/2}m1(e,t)}},wiggle:function(e,t){if((i=e.length)>0&&(n=(r=e[t[0]]).length)>0){for(var r,n,i,a=0,s=1;s<n;++s){for(var l=0,o=0,c=0;l<i;++l){for(var d=e[t[l]],u=d[s][1]||0,h=(u-(d[s-1][1]||0))/2,p=0;p<l;++p){var m=e[t[p]];h+=(m[s][1]||0)-(m[s-1][1]||0)}o+=u,c+=h*u}r[s-1][1]+=r[s-1][0]=a,o&&(a-=c/o)}r[s-1][1]+=r[s-1][0]=a,m1(e,t)}},positive:e=>{var t,r=e.length;if(!(r<=0)){var n=null==(t=e[0])?void 0:t.length;if(null!=n&&!(n<=0))for(var i=0;i<n;++i)for(var a=0,s=0;s<r;++s){var l=e[s],o=null==l?void 0:l[i];if(null!=o){var c=pm(o[1])?o[0]:o[1];c>=0?(o[0]=a,a+=c,o[1]=a):(o[0]=0,o[1]=0)}}}}},fn=e=>{var{axis:t,ticks:r,offset:n,bandSize:i,entry:a,index:s}=e;if("category"===t.type)return r[s]?r[s].coordinate+n:null;var l=fe(a,t.dataKey,t.scale.domain()[s]);if(null==l)return null;var o=t.scale.map(l);return px(o)?o-i/2+n:null},fi=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,fa=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,fs=(e,t,r)=>{if(e&&e.scale&&e.scale.bandwidth){var n=e.scale.bandwidth();if(!r||n>0)return n}if(e&&t&&t.length>=2){for(var i=(0,mG.default)(t,e=>e.coordinate),a=1/0,s=1,l=i.length;s<l;s++){var o=i[s],c=i[s-1];a=Math.min(((null==o?void 0:o.coordinate)||0)-((null==c?void 0:c.coordinate)||0),a)}return a===1/0?0:a}return r?void 0:0};function fl(e){var{tooltipEntrySettings:t,dataKey:r,payload:n,value:i,name:a}=e;return m9(m9({},t),{},{dataKey:r,payload:n,value:i,name:a})}function fo(e,t){return e?String(e):"string"==typeof t?t:void 0}var fc=e=>e.layout.width,fd=e=>e.layout.height,fu=e=>e.layout.scale,fh=e=>e.layout.margin,fp=hy(e=>e.cartesianAxis.xAxis,e=>Object.values(e)),fm=hy(e=>e.cartesianAxis.yAxis,e=>Object.values(e));function ff(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function fx(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ff(Object(r),!0).forEach(function(t){var n,i,a;n=e,i=t,a=r[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in n?Object.defineProperty(n,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):n[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ff(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var fy=hy([fc,fd,fh,e=>e.brush.height,function(e){return fm(e).reduce((e,t)=>"left"!==t.orientation||t.mirror||t.hide?e:e+("number"==typeof t.width?t.width:60),0)},function(e){return fm(e).reduce((e,t)=>"right"!==t.orientation||t.mirror||t.hide?e:e+("number"==typeof t.width?t.width:60),0)},function(e){return fp(e).reduce((e,t)=>"top"!==t.orientation||t.mirror||t.hide?e:e+t.height,0)},function(e){return fp(e).reduce((e,t)=>"bottom"!==t.orientation||t.mirror||t.hide?e:e+t.height,0)},mZ,e=>e.legend.size],(e,t,r,n,i,a,s,l,o,c)=>{var d={left:(r.left||0)+i,right:(r.right||0)+a},u=fx(fx({},{top:(r.top||0)+s,bottom:(r.bottom||0)+l}),d),h=u.bottom;u.bottom+=n;var p=e-(u=((e,t,r)=>{if(t&&r){var{width:n,height:i}=r,{align:a,verticalAlign:s,layout:l}=t;if(("vertical"===l||"horizontal"===l&&"middle"===s)&&"center"!==a&&px(e[a]))return m9(m9({},e),{},{[a]:e[a]+(n||0)});if(("horizontal"===l||"vertical"===l&&"center"===a)&&"middle"!==s&&px(e[s]))return m9(m9({},e),{},{[s]:e[s]+(i||0)})}return e})(u,o,c)).left-u.right,m=t-u.top-u.bottom;return fx(fx({brushBottom:h},u),{},{width:Math.max(p,0),height:Math.max(m,0)})}),fg=hy(fy,e=>({x:e.left,y:e.top,width:e.width,height:e.height})),fv=hy(fc,fd,(e,t)=>({x:0,y:0,width:e,height:t})),fb=(0,H.createContext)(null),fj=()=>null!=(0,H.useContext)(fb),fw=e=>e.brush,fN=hy([fw,fy,fh],(e,t,r)=>({height:e.height,x:px(e.x)?e.x:t.left,y:px(e.y)?e.y:t.top+t.height+t.brushBottom-((null==r?void 0:r.bottom)||0),width:px(e.width)?e.width:t.width})),fk=e.i(15325),fS=function(e,t){for(var r=arguments.length,n=Array(r>2?r-2:0),i=2;i<r;i++)n[i-2]=arguments[i];if("u">typeof console&&console.warn&&(void 0===t&&console.warn("LogUtils requires an error message argument"),!e))if(void 0===t)console.warn("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var a=0;console.warn(t.replace(/%s/g,()=>n[a++]))}},fO="100%",fP="100%",fC={width:-1,height:-1},fA=(e,t,r)=>{var{width:n=fO,height:i=fP,aspect:a,maxHeight:s}=r,l=pf(n)?e:Number(n),o=pf(i)?t:Number(i);return a&&a>0&&(l?o=l/a:o&&(l=o*a),s&&null!=o&&o>s&&(o=s)),{calculatedWidth:l,calculatedHeight:o}},fE={width:0,height:0,overflow:"visible"},fM={width:0,overflowX:"visible"},fT={height:0,overflowY:"visible"},f_={};function fD(){return(fD=Object.assign.bind()).apply(null,arguments)}function fI(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function fz(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?fI(Object(r),!0).forEach(function(t){var n,i,a;n=e,i=t,a=r[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in n?Object.defineProperty(n,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):n[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):fI(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var fL=(0,H.createContext)(fC);function fR(e){var{children:t,width:r,height:n}=e,i=(0,H.useMemo)(()=>({width:r,height:n}),[r,n]);return m8(i.width)&&m8(i.height)?H.createElement(fL.Provider,{value:i},t):null}var fF=()=>(0,H.useContext)(fL),f$=(0,H.forwardRef)((e,t)=>{var{aspect:r,initialDimension:n=fC,width:i,height:a,minWidth:s=0,minHeight:l,maxHeight:o,children:c,debounce:d=0,id:u,className:h,onResize:p,style:m={}}=e,f=(0,H.useRef)(null),x=(0,H.useRef)();x.current=p,(0,H.useImperativeHandle)(t,()=>f.current);var[y,g]=(0,H.useState)({containerWidth:n.width,containerHeight:n.height}),v=(0,H.useCallback)((e,t)=>{g(r=>{var n=Math.round(e),i=Math.round(t);return r.containerWidth===n&&r.containerHeight===i?r:{containerWidth:n,containerHeight:i}})},[]);(0,H.useEffect)(()=>{if(null==f.current||"u"<typeof ResizeObserver)return pS;var e=e=>{var t,r=e[0];if(null!=r){var{width:n,height:i}=r.contentRect;v(n,i),null==(t=x.current)||t.call(x,n,i)}};d>0&&(e=(0,fk.default)(e,d,{trailing:!0,leading:!1}));var t=new ResizeObserver(e),{width:r,height:n}=f.current.getBoundingClientRect();return v(r,n),t.observe(f.current),()=>{t.disconnect()}},[v,d]);var{containerWidth:b,containerHeight:j}=y;fS(!r||r>0,"The aspect(%s) must be greater than zero.",r);var{calculatedWidth:w,calculatedHeight:N}=fA(b,j,{width:i,height:a,aspect:r,maxHeight:o});return fS(null!=w&&w>0||null!=N&&N>0,"The width(%s) and height(%s) of chart should be greater than 0,\n please check the style of container, or the props width(%s) and height(%s),\n or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the\n height and width.",w,N,i,a,s,l,r),H.createElement("div",{id:u?"".concat(u):void 0,className:sb("recharts-responsive-container",h),style:fz(fz({},m),{},{width:i,height:a,minWidth:s,minHeight:l,maxHeight:o}),ref:f},H.createElement("div",{style:(e=>{var{width:t,height:r}=e,n=pf(t),i=pf(r);return n&&i?fE:n?fM:i?fT:f_})({width:i,height:a})},H.createElement(fR,{width:w,height:N},c)))}),fB=(0,H.forwardRef)((e,t)=>{var r=fF();if(m8(r.width)&&m8(r.height))return e.children;var{width:n,height:i}=function(e){var{width:t,height:r,aspect:n}=e,i=t,a=r;return void 0===i&&void 0===a?(i=fO,a=fP):void 0===i?i=n&&n>0?void 0:fO:void 0===a&&(a=n&&n>0?void 0:fP),{width:i,height:a}}({width:e.width,height:e.height,aspect:e.aspect}),{calculatedWidth:a,calculatedHeight:s}=fA(void 0,void 0,{width:n,height:i,aspect:e.aspect,maxHeight:e.maxHeight});return px(a)&&px(s)?H.createElement(fR,{width:a,height:s},e.children):H.createElement(f$,fD({},e,{width:n,height:i,ref:t}))});function fU(e){if(e)return{x:e.x,y:e.y,upperWidth:"upperWidth"in e?e.upperWidth:e.width,lowerWidth:"lowerWidth"in e?e.lowerWidth:e.width,width:e.width,height:e.height}}var fq=()=>{var e,t=fj(),r=mX(fg),n=mX(fN),i=null==(e=mX(fw))?void 0:e.padding;return t&&n&&i?{width:n.width-i.left-i.right,height:n.height-i.top-i.bottom,x:i.left,y:i.top}:r},fV={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},fK=e=>e.layout.layoutType,fW=()=>{var e=mX(fK);if("horizontal"===e||"vertical"===e)return e},fH=e=>{var t=e.layout.layoutType;if("centric"===t||"radial"===t)return t},fQ=e=>{var t=mW(),r=fj(),{width:n,height:i}=e,a=fF(),s=n,l=i;return a&&(s=a.width>0?a.width:n,l=a.height>0?a.height:i),(0,H.useEffect)(()=>{!r&&m8(s)&&m8(l)&&t(m$({width:s,height:l}))},[t,r,s,l]),null},fY=e.i(56558);e.s([],81206),e.i(81206),e.s([],3771),e.i(3771);var fX=e.i(17603),fG=e.i(11276);function fZ(){var e,t,r=(0,fG.default)().unknown(void 0),n=r.domain,i=r.range,a=0,s=1,l=!1,o=0,c=0,d=.5;function u(){var r=n().length,u=s<a,h=u?s:a,p=u?a:s;e=(p-h)/Math.max(1,r-o+2*c),l&&(e=Math.floor(e)),h+=(p-h-e*(r-o))*d,t=e*(1-o),l&&(h=Math.round(h),t=Math.round(t));var m=(function(e,t,r){e*=1,t*=1,r=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+r;for(var n=-1,i=0|Math.max(0,Math.ceil((t-e)/r)),a=Array(i);++n<i;)a[n]=e+n*r;return a})(r).map(function(t){return h+e*t});return i(u?m.reverse():m)}return delete r.unknown,r.domain=function(e){return arguments.length?(n(e),u()):n()},r.range=function(e){return arguments.length?([a,s]=e,a*=1,s*=1,u()):[a,s]},r.rangeRound=function(e){return[a,s]=e,a*=1,s*=1,l=!0,u()},r.bandwidth=function(){return t},r.step=function(){return e},r.round=function(e){return arguments.length?(l=!!e,u()):l},r.padding=function(e){return arguments.length?(o=Math.min(1,c=+e),u()):o},r.paddingInner=function(e){return arguments.length?(o=Math.min(1,e),u()):o},r.paddingOuter=function(e){return arguments.length?(c=+e,u()):c},r.align=function(e){return arguments.length?(d=Math.max(0,Math.min(1,e)),u()):d},r.copy=function(){return fZ(n(),[a,s]).round(l).paddingInner(o).paddingOuter(c).align(d)},fX.initRange.apply(u(),arguments)}function fJ(){return function e(t){var r=t.copy;return t.padding=t.paddingOuter,delete t.paddingInner,delete t.paddingOuter,t.copy=function(){return e(r())},t}(fZ.apply(null,arguments).paddingInner(1))}let f0=Math.sqrt(50),f1=Math.sqrt(10),f2=Math.sqrt(2);function f5(e,t,r){let n,i,a,s=(t-e)/Math.max(0,r),l=Math.floor(Math.log10(s)),o=s/Math.pow(10,l),c=o>=f0?10:o>=f1?5:o>=f2?2:1;return(l<0?(n=Math.round(e*(a=Math.pow(10,-l)/c)),i=Math.round(t*a),n/a<e&&++n,i/a>t&&--i,a=-a):(n=Math.round(e/(a=Math.pow(10,l)*c)),i=Math.round(t/a),n*a<e&&++n,i*a>t&&--i),i<n&&.5<=r&&r<2)?f5(e,t,2*r):[n,i,a]}function f4(e,t,r){if(t*=1,e*=1,!((r*=1)>0))return[];if(e===t)return[e];let n=t<e,[i,a,s]=n?f5(t,e,r):f5(e,t,r);if(!(a>=i))return[];let l=a-i+1,o=Array(l);if(n)if(s<0)for(let e=0;e<l;++e)o[e]=-((a-e)/s);else for(let e=0;e<l;++e)o[e]=(a-e)*s;else if(s<0)for(let e=0;e<l;++e)o[e]=-((i+e)/s);else for(let e=0;e<l;++e)o[e]=(i+e)*s;return o}function f3(e,t,r){return f5(e*=1,t*=1,r*=1)[2]}function f6(e,t,r){t*=1,e*=1,r*=1;let n=t<e,i=n?f3(t,e,r):f3(e,t,r);return(n?-1:1)*(i<0?-(1/i):i)}function f8(e,t){return null==e||null==t?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function f7(e,t){return null==e||null==t?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function f9(e){let t,r,n;function i(e,n,a=0,s=e.length){if(a<s){if(0!==t(n,n))return s;do{let t=a+s>>>1;0>r(e[t],n)?a=t+1:s=t}while(a<s)}return a}return 2!==e.length?(t=f8,r=(t,r)=>f8(e(t),r),n=(t,r)=>e(t)-r):(t=e===f8||e===f7?e:xe,r=e,n=e),{left:i,center:function(e,t,r=0,a=e.length){let s=i(e,t,r,a-1);return s>r&&n(e[s-1],t)>-n(e[s],t)?s-1:s},right:function(e,n,i=0,a=e.length){if(i<a){if(0!==t(n,n))return a;do{let t=i+a>>>1;0>=r(e[t],n)?i=t+1:a=t}while(i<a)}return i}}}function xe(){return 0}function xt(e){return null===e?NaN:+e}let xr=f9(f8),xn=xr.right;xr.left,f9(xt).center;var xi=e.i(82938),xa=e.i(208),xs=e.i(6272),xl=e.i(11930),xo=e.i(44936);function xc(e,t){var r,n,i=typeof t;return null==t||"boolean"===i?(0,xo.default)(t):("number"===i?xs.default:"string"===i?(n=(0,xi.color)(t))?(t=n,xa.default):xl.default:t instanceof xi.color?xa.default:t instanceof Date?function(e,t){var r=new Date;return e*=1,t*=1,function(n){return r.setTime(e*(1-n)+t*n),r}}:!ArrayBuffer.isView(r=t)||r instanceof DataView?Array.isArray(t)?function(e,t){var r,n=t?t.length:0,i=e?Math.min(n,e.length):0,a=Array(i),s=Array(n);for(r=0;r<i;++r)a[r]=xc(e[r],t[r]);for(;r<n;++r)s[r]=t[r];return function(e){for(r=0;r<i;++r)s[r]=a[r](e);return s}}:"function"!=typeof t.valueOf&&"function"!=typeof t.toString||isNaN(t)?function(e,t){var r,n={},i={};for(r in(null===e||"object"!=typeof e)&&(e={}),(null===t||"object"!=typeof t)&&(t={}),t)r in e?n[r]=xc(e[r],t[r]):i[r]=t[r];return function(e){for(r in n)i[r]=n[r](e);return i}}:xs.default:function(e,t){t||(t=[]);var r,n=e?Math.min(t.length,e.length):0,i=t.slice();return function(a){for(r=0;r<n;++r)i[r]=e[r]*(1-a)+t[r]*a;return i}})(e,t)}var xd=e.i(25223);function xu(e,t){return e*=1,t*=1,function(r){return Math.round(e*(1-r)+t*r)}}function xh(e){return+e}var xp=[0,1];function xm(e){return e}function xf(e,t){var r;return(t-=e*=1)?function(r){return(r-e)/t}:(r=isNaN(t)?NaN:.5,function(){return r})}function xx(e,t,r){var n=e[0],i=e[1],a=t[0],s=t[1];return i<n?(n=xf(i,n),a=r(s,a)):(n=xf(n,i),a=r(a,s)),function(e){return a(n(e))}}function xy(e,t,r){var n=Math.min(e.length,t.length)-1,i=Array(n),a=Array(n),s=-1;for(e[n]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++s<n;)i[s]=xf(e[s],e[s+1]),a[s]=r(t[s],t[s+1]);return function(t){var r=xn(e,t,1,n)-1;return a[r](i[r](t))}}function xg(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function xv(){var e,t,r,n,i,a,s=xp,l=xp,o=xc,c=xm;function d(){var e,t,r,o=Math.min(s.length,l.length);return c!==xm&&(e=s[0],t=s[o-1],e>t&&(r=e,e=t,t=r),c=function(r){return Math.max(e,Math.min(t,r))}),n=o>2?xy:xx,i=a=null,u}function u(t){return null==t||isNaN(t*=1)?r:(i||(i=n(s.map(e),l,o)))(e(c(t)))}return u.invert=function(r){return c(t((a||(a=n(l,s.map(e),xd.interpolateNumber)))(r)))},u.domain=function(e){return arguments.length?(s=Array.from(e,xh),d()):s.slice()},u.range=function(e){return arguments.length?(l=Array.from(e),d()):l.slice()},u.rangeRound=function(e){return l=Array.from(e),o=xu,d()},u.clamp=function(e){return arguments.length?(c=!!e||xm,d()):c!==xm},u.interpolate=function(e){return arguments.length?(o=e,d()):o},u.unknown=function(e){return arguments.length?(r=e,u):r},function(r,n){return e=r,t=n,d()}}function xb(){return xv()(xm,xm)}function xj(e,t){if(!isFinite(e)||0===e)return null;var r=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"),n=e.slice(0,r);return[n.length>1?n[0]+n.slice(2):n,+e.slice(r+1)]}function xw(e){return(e=xj(Math.abs(e)))?e[1]:NaN}var xN=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function xk(e){var t;if(!(t=xN.exec(e)))throw Error("invalid format: "+e);return new xS({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}function xS(e){this.fill=void 0===e.fill?" ":e.fill+"",this.align=void 0===e.align?">":e.align+"",this.sign=void 0===e.sign?"-":e.sign+"",this.symbol=void 0===e.symbol?"":e.symbol+"",this.zero=!!e.zero,this.width=void 0===e.width?void 0:+e.width,this.comma=!!e.comma,this.precision=void 0===e.precision?void 0:+e.precision,this.trim=!!e.trim,this.type=void 0===e.type?"":e.type+""}function xO(e,t){var r=xj(e,t);if(!r)return e+"";var n=r[0],i=r[1];return i<0?"0."+Array(-i).join("0")+n:n.length>i+1?n.slice(0,i+1)+"."+n.slice(i+1):n+Array(i-n.length+2).join("0")}xk.prototype=xS.prototype,xS.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};let xP={"%":(e,t)=>(100*e).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:function(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)},e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>xO(100*e,t),r:xO,s:function(e,t){var r=xj(e,t);if(!r)return x=void 0,e.toPrecision(t);var n=r[0],i=r[1],a=i-(x=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,s=n.length;return a===s?n:a>s?n+Array(a-s+1).join("0"):a>0?n.slice(0,a)+"."+n.slice(a):"0."+Array(1-a).join("0")+xj(e,Math.max(0,t+a-1))[0]},X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function xC(e){return e}var xA=Array.prototype.map,xE=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function xM(e,t,r,n){var i,a,s=f6(e,t,r);switch((n=xk(null==n?",f":n)).type){case"s":var l=Math.max(Math.abs(e),Math.abs(t));return null!=n.precision||isNaN(a=Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(xw(l)/3)))-xw(Math.abs(s))))||(n.precision=a),v(n,l);case"":case"e":case"g":case"p":case"r":null!=n.precision||isNaN(a=Math.max(0,xw(Math.abs(Math.max(Math.abs(e),Math.abs(t)))-(i=Math.abs(i=s)))-xw(i))+1)||(n.precision=a-("e"===n.type));break;case"f":case"%":null!=n.precision||isNaN(a=Math.max(0,-xw(Math.abs(s))))||(n.precision=a-("%"===n.type)*2)}return g(n)}function xT(e){var t=e.domain;return e.ticks=function(e){var r=t();return f4(r[0],r[r.length-1],null==e?10:e)},e.tickFormat=function(e,r){var n=t();return xM(n[0],n[n.length-1],null==e?10:e,r)},e.nice=function(r){null==r&&(r=10);var n,i,a=t(),s=0,l=a.length-1,o=a[s],c=a[l],d=10;for(c<o&&(i=o,o=c,c=i,i=s,s=l,l=i);d-- >0;){if((i=f3(o,c,r))===n)return a[s]=o,a[l]=c,t(a);if(i>0)o=Math.floor(o/i)*i,c=Math.ceil(c/i)*i;else if(i<0)o=Math.ceil(o*i)/i,c=Math.floor(c*i)/i;else break;n=i}return e},e}function x_(){var e=xb();return e.copy=function(){return xg(e,x_())},fX.initRange.apply(e,arguments),xT(e)}function xD(e){var t;function r(e){return null==e||isNaN(e*=1)?t:e}return r.invert=r,r.domain=r.range=function(t){return arguments.length?(e=Array.from(t,xh),r):e.slice()},r.unknown=function(e){return arguments.length?(t=e,r):t},r.copy=function(){return xD(e).unknown(t)},e=arguments.length?Array.from(e,xh):[0,1],xT(r)}function xI(e,t){e=e.slice();var r,n=0,i=e.length-1,a=e[n],s=e[i];return s<a&&(r=n,n=i,i=r,r=a,a=s,s=r),e[n]=t.floor(a),e[i]=t.ceil(s),e}function xz(e){return Math.log(e)}function xL(e){return Math.exp(e)}function xR(e){return-Math.log(-e)}function xF(e){return-Math.exp(-e)}function x$(e){return isFinite(e)?+("1e"+e):e<0?0:e}function xB(e){return(t,r)=>-e(-t,r)}function xU(e){let t,r,n=e(xz,xL),i=n.domain,a=10;function s(){var s,l;return t=(s=a)===Math.E?Math.log:10===s&&Math.log10||2===s&&Math.log2||(s=Math.log(s),e=>Math.log(e)/s),r=10===(l=a)?x$:l===Math.E?Math.exp:e=>Math.pow(l,e),i()[0]<0?(t=xB(t),r=xB(r),e(xR,xF)):e(xz,xL),n}return n.base=function(e){return arguments.length?(a=+e,s()):a},n.domain=function(e){return arguments.length?(i(e),s()):i()},n.ticks=e=>{let n,s,l=i(),o=l[0],c=l[l.length-1],d=c<o;d&&([o,c]=[c,o]);let u=t(o),h=t(c),p=null==e?10:+e,m=[];if(!(a%1)&&h-u<p){if(u=Math.floor(u),h=Math.ceil(h),o>0){for(;u<=h;++u)for(n=1;n<a;++n)if(!((s=u<0?n/r(-u):n*r(u))<o)){if(s>c)break;m.push(s)}}else for(;u<=h;++u)for(n=a-1;n>=1;--n)if(!((s=u>0?n/r(-u):n*r(u))<o)){if(s>c)break;m.push(s)}2*m.length<p&&(m=f4(o,c,p))}else m=f4(u,h,Math.min(h-u,p)).map(r);return d?m.reverse():m},n.tickFormat=(e,i)=>{if(null==e&&(e=10),null==i&&(i=10===a?"s":","),"function"!=typeof i&&(a%1||null!=(i=xk(i)).precision||(i.trim=!0),i=g(i)),e===1/0)return i;let s=Math.max(1,a*e/n.ticks().length);return e=>{let n=e/r(Math.round(t(e)));return n*a<a-.5&&(n*=a),n<=s?i(e):""}},n.nice=()=>i(xI(i(),{floor:e=>r(Math.floor(t(e))),ceil:e=>r(Math.ceil(t(e)))})),n}function xq(){let e=xU(xv()).domain([1,10]);return e.copy=()=>xg(e,xq()).base(e.base()),fX.initRange.apply(e,arguments),e}function xV(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function xK(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function xW(e){var t=1,r=e(xV(1),xK(t));return r.constant=function(r){return arguments.length?e(xV(t=+r),xK(t)):t},xT(r)}function xH(){var e=xW(xv());return e.copy=function(){return xg(e,xH()).constant(e.constant())},fX.initRange.apply(e,arguments)}function xQ(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function xY(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function xX(e){return e<0?-e*e:e*e}function xG(e){var t=e(xm,xm),r=1;return t.exponent=function(t){return arguments.length?1==(r=+t)?e(xm,xm):.5===r?e(xY,xX):e(xQ(r),xQ(1/r)):r},xT(t)}function xZ(){var e=xG(xv());return e.copy=function(){return xg(e,xZ()).exponent(e.exponent())},fX.initRange.apply(e,arguments),e}function xJ(){return xZ.apply(null,arguments).exponent(.5)}function x0(e){return Math.sign(e)*e*e}function x1(){var e,t=xb(),r=[0,1],n=!1;function i(r){var i,a=Math.sign(i=t(r))*Math.sqrt(Math.abs(i));return isNaN(a)?e:n?Math.round(a):a}return i.invert=function(e){return t.invert(x0(e))},i.domain=function(e){return arguments.length?(t.domain(e),i):t.domain()},i.range=function(e){return arguments.length?(t.range((r=Array.from(e,xh)).map(x0)),i):r.slice()},i.rangeRound=function(e){return i.range(e).round(!0)},i.round=function(e){return arguments.length?(n=!!e,i):n},i.clamp=function(e){return arguments.length?(t.clamp(e),i):t.clamp()},i.unknown=function(t){return arguments.length?(e=t,i):e},i.copy=function(){return x1(t.domain(),r).round(n).clamp(t.clamp()).unknown(e)},fX.initRange.apply(i,arguments),xT(i)}g=(y=function(e){var t,r,n,i=void 0===e.grouping||void 0===e.thousands?xC:(t=xA.call(e.grouping,Number),r=e.thousands+"",function(e,n){for(var i=e.length,a=[],s=0,l=t[0],o=0;i>0&&l>0&&(o+l+1>n&&(l=Math.max(1,n-o)),a.push(e.substring(i-=l,i+l)),!((o+=l+1)>n));)l=t[s=(s+1)%t.length];return a.reverse().join(r)}),a=void 0===e.currency?"":e.currency[0]+"",s=void 0===e.currency?"":e.currency[1]+"",l=void 0===e.decimal?".":e.decimal+"",o=void 0===e.numerals?xC:(n=xA.call(e.numerals,String),function(e){return e.replace(/[0-9]/g,function(e){return n[+e]})}),c=void 0===e.percent?"%":e.percent+"",d=void 0===e.minus?"−":e.minus+"",u=void 0===e.nan?"NaN":e.nan+"";function h(e,t){var r=(e=xk(e)).fill,n=e.align,h=e.sign,p=e.symbol,m=e.zero,f=e.width,y=e.comma,g=e.precision,v=e.trim,b=e.type;"n"===b?(y=!0,b="g"):xP[b]||(void 0===g&&(g=12),v=!0,b="g"),(m||"0"===r&&"="===n)&&(m=!0,r="0",n="=");var j=(t&&void 0!==t.prefix?t.prefix:"")+("$"===p?a:"#"===p&&/[boxX]/.test(b)?"0"+b.toLowerCase():""),w=("$"===p?s:/[%p]/.test(b)?c:"")+(t&&void 0!==t.suffix?t.suffix:""),N=xP[b],k=/[defgprs%]/.test(b);function S(e){var t,a,s,c=j,p=w;if("c"===b)p=N(e)+p,e="";else{var S=(e*=1)<0||1/e<0;if(e=isNaN(e)?u:N(Math.abs(e),g),v&&(e=function(e){e:for(var t,r=e.length,n=1,i=-1;n<r;++n)switch(e[n]){case".":i=t=n;break;case"0":0===i&&(i=n),t=n;break;default:if(!+e[n])break e;i>0&&(i=0)}return i>0?e.slice(0,i)+e.slice(t+1):e}(e)),S&&0==+e&&"+"!==h&&(S=!1),c=(S?"("===h?h:d:"-"===h||"("===h?"":h)+c,p=("s"!==b||isNaN(e)||void 0===x?"":xE[8+x/3])+p+(S&&"("===h?")":""),k){for(t=-1,a=e.length;++t<a;)if(48>(s=e.charCodeAt(t))||s>57){p=(46===s?l+e.slice(t+1):e.slice(t))+p,e=e.slice(0,t);break}}}y&&!m&&(e=i(e,1/0));var O=c.length+e.length+p.length,P=O<f?Array(f-O+1).join(r):"";switch(y&&m&&(e=i(P+e,P.length?f-p.length:1/0),P=""),n){case"<":e=c+e+p+P;break;case"=":e=c+P+e+p;break;case"^":e=P.slice(0,O=P.length>>1)+c+e+p+P.slice(O);break;default:e=P+c+e+p}return o(e)}return g=void 0===g?6:/[gprs]/.test(b)?Math.max(1,Math.min(21,g)):Math.max(0,Math.min(20,g)),S.toString=function(){return e+""},S}return{format:h,formatPrefix:function(e,t){var r=3*Math.max(-8,Math.min(8,Math.floor(xw(t)/3))),n=Math.pow(10,-r),i=h(((e=xk(e)).type="f",e),{suffix:xE[8+r/3]});return function(e){return i(n*e)}}}}({thousands:",",grouping:[3],currency:["$",""]})).format,v=y.formatPrefix;var x2=e.i(96509),x5=e.i(45583);function x4(e,t){return(null==e||!(e>=e))-(null==t||!(t>=t))||(e<t?-1:+(e>t))}function x3(e,t,r){let n=e[t];e[t]=e[r],e[r]=n}function x6(){var e,t=[],r=[],n=[];function i(){var e=0,i=Math.max(1,r.length);for(n=Array(i-1);++e<i;)n[e-1]=function(e,t,r=xt){if(!(!(n=e.length)||isNaN(t*=1))){if(t<=0||n<2)return+r(e[0],0,e);if(t>=1)return+r(e[n-1],n-1,e);var n,i=(n-1)*t,a=Math.floor(i),s=+r(e[a],a,e);return s+(r(e[a+1],a+1,e)-s)*(i-a)}}(t,e/i);return a}function a(t){return null==t||isNaN(t*=1)?e:r[xn(n,t)]}return a.invertExtent=function(e){var i=r.indexOf(e);return i<0?[NaN,NaN]:[i>0?n[i-1]:t[0],i<n.length?n[i]:t[t.length-1]]},a.domain=function(e){if(!arguments.length)return t.slice();for(let r of(t=[],e))null==r||isNaN(r*=1)||t.push(r);return t.sort(f8),i()},a.range=function(e){return arguments.length?(r=Array.from(e),i()):r.slice()},a.unknown=function(t){return arguments.length?(e=t,a):e},a.quantiles=function(){return n.slice()},a.copy=function(){return x6().domain(t).range(r).unknown(e)},fX.initRange.apply(a,arguments)}function x8(){var e,t=0,r=1,n=1,i=[.5],a=[0,1];function s(t){return null!=t&&t<=t?a[xn(i,t,0,n)]:e}function l(){var e=-1;for(i=Array(n);++e<n;)i[e]=((e+1)*r-(e-n)*t)/(n+1);return s}return s.domain=function(e){return arguments.length?([t,r]=e,t*=1,r*=1,l()):[t,r]},s.range=function(e){return arguments.length?(n=(a=Array.from(e)).length-1,l()):a.slice()},s.invertExtent=function(e){var s=a.indexOf(e);return s<0?[NaN,NaN]:s<1?[t,i[0]]:s>=n?[i[n-1],r]:[i[s-1],i[s]]},s.unknown=function(t){return arguments.length&&(e=t),s},s.thresholds=function(){return i.slice()},s.copy=function(){return x8().domain([t,r]).range(a).unknown(e)},fX.initRange.apply(xT(s),arguments)}function x7(){var e,t=[.5],r=[0,1],n=1;function i(i){return null!=i&&i<=i?r[xn(t,i,0,n)]:e}return i.domain=function(e){return arguments.length?(n=Math.min((t=Array.from(e)).length,r.length-1),i):t.slice()},i.range=function(e){return arguments.length?(r=Array.from(e),n=Math.min(t.length,r.length-1),i):r.slice()},i.invertExtent=function(e){var n=r.indexOf(e);return[t[n-1],t[n]]},i.unknown=function(t){return arguments.length?(e=t,i):e},i.copy=function(){return x7().domain(t).range(r).unknown(e)},fX.initRange.apply(i,arguments)}let x9=new Date,ye=new Date;function yt(e,t,r,n){function i(t){return e(t=0==arguments.length?new Date:new Date(+t)),t}return i.floor=t=>(e(t=new Date(+t)),t),i.ceil=r=>(e(r=new Date(r-1)),t(r,1),e(r),r),i.round=e=>{let t=i(e),r=i.ceil(e);return e-t<r-e?t:r},i.offset=(e,r)=>(t(e=new Date(+e),null==r?1:Math.floor(r)),e),i.range=(r,n,a)=>{let s,l=[];if(r=i.ceil(r),a=null==a?1:Math.floor(a),!(r<n)||!(a>0))return l;do l.push(s=new Date(+r)),t(r,a),e(r);while(s<r&&r<n)return l},i.filter=r=>yt(t=>{if(t>=t)for(;e(t),!r(t);)t.setTime(t-1)},(e,n)=>{if(e>=e)if(n<0)for(;++n<=0;)for(;t(e,-1),!r(e););else for(;--n>=0;)for(;t(e,1),!r(e););}),r&&(i.count=(t,n)=>(x9.setTime(+t),ye.setTime(+n),e(x9),e(ye),Math.floor(r(x9,ye))),i.every=e=>isFinite(e=Math.floor(e))&&e>0?e>1?i.filter(n?t=>n(t)%e==0:t=>i.count(0,t)%e==0):i:null),i}let yr=yt(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());yr.every=e=>isFinite(e=Math.floor(e))&&e>0?yt(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,r)=>{t.setFullYear(t.getFullYear()+r*e)}):null,yr.range;let yn=yt(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());yn.every=e=>isFinite(e=Math.floor(e))&&e>0?yt(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCFullYear(t.getUTCFullYear()+r*e)}):null,yn.range;let yi=yt(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());yi.range;let ya=yt(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());ya.range;function ys(e){return yt(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(e,t)=>{e.setDate(e.getDate()+7*t)},(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*6e4)/6048e5)}let yl=ys(0),yo=ys(1),yc=ys(2),yd=ys(3),yu=ys(4),yh=ys(5),yp=ys(6);function ym(e){return yt(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+7*t)},(e,t)=>(t-e)/6048e5)}yl.range,yo.range,yc.range,yd.range,yu.range,yh.range,yp.range;let yf=ym(0),yx=ym(1),yy=ym(2),yg=ym(3),yv=ym(4),yb=ym(5),yj=ym(6);yf.range,yx.range,yy.range,yg.range,yv.range,yb.range,yj.range;let yw=yt(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*6e4)/864e5,e=>e.getDate()-1);yw.range;let yN=yt(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>e.getUTCDate()-1);yN.range;let yk=yt(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>Math.floor(e/864e5));yk.range;let yS=yt(e=>{e.setTime(e-e.getMilliseconds()-1e3*e.getSeconds()-6e4*e.getMinutes())},(e,t)=>{e.setTime(+e+36e5*t)},(e,t)=>(t-e)/36e5,e=>e.getHours());yS.range;let yO=yt(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+36e5*t)},(e,t)=>(t-e)/36e5,e=>e.getUTCHours());yO.range;let yP=yt(e=>{e.setTime(e-e.getMilliseconds()-1e3*e.getSeconds())},(e,t)=>{e.setTime(+e+6e4*t)},(e,t)=>(t-e)/6e4,e=>e.getMinutes());yP.range;let yC=yt(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+6e4*t)},(e,t)=>(t-e)/6e4,e=>e.getUTCMinutes());yC.range;let yA=yt(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+1e3*t)},(e,t)=>(t-e)/1e3,e=>e.getUTCSeconds());yA.range;let yE=yt(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);function yM(e,t,r,n,i,a){let s=[[yA,1,1e3],[yA,5,5e3],[yA,15,15e3],[yA,30,3e4],[a,1,6e4],[a,5,3e5],[a,15,9e5],[a,30,18e5],[i,1,36e5],[i,3,108e5],[i,6,216e5],[i,12,432e5],[n,1,864e5],[n,2,1728e5],[r,1,6048e5],[t,1,2592e6],[t,3,7776e6],[e,1,31536e6]];function l(t,r,n){let i=Math.abs(r-t)/n,a=f9(([,,e])=>e).right(s,i);if(a===s.length)return e.every(f6(t/31536e6,r/31536e6,n));if(0===a)return yE.every(Math.max(f6(t,r,n),1));let[l,o]=s[i/s[a-1][2]<s[a][2]/i?a-1:a];return l.every(o)}return[function(e,t,r){let n=t<e;n&&([e,t]=[t,e]);let i=r&&"function"==typeof r.range?r:l(e,t,r),a=i?i.range(e,+t+1):[];return n?a.reverse():a},l]}yE.every=e=>isFinite(e=Math.floor(e))&&e>0?e>1?yt(t=>{t.setTime(Math.floor(t/e)*e)},(t,r)=>{t.setTime(+t+r*e)},(t,r)=>(r-t)/e):yE:null,yE.range;let[yT,y_]=yM(yn,ya,yf,yk,yO,yC),[yD,yI]=yM(yr,yi,yl,yw,yS,yP);function yz(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function yL(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function yR(e,t,r){return{y:e,m:t,d:r,H:0,M:0,S:0,L:0}}var yF={"-":"",_:" ",0:"0"},y$=/^\s*\d+/,yB=/^%/,yU=/[\\^$*+?|[\]().{}]/g;function yq(e,t,r){var n=e<0?"-":"",i=(n?-e:e)+"",a=i.length;return n+(a<r?Array(r-a+1).join(t)+i:i)}function yV(e){return e.replace(yU,"\\$&")}function yK(e){return RegExp("^(?:"+e.map(yV).join("|")+")","i")}function yW(e){return new Map(e.map((e,t)=>[e.toLowerCase(),t]))}function yH(e,t,r){var n=y$.exec(t.slice(r,r+1));return n?(e.w=+n[0],r+n[0].length):-1}function yQ(e,t,r){var n=y$.exec(t.slice(r,r+1));return n?(e.u=+n[0],r+n[0].length):-1}function yY(e,t,r){var n=y$.exec(t.slice(r,r+2));return n?(e.U=+n[0],r+n[0].length):-1}function yX(e,t,r){var n=y$.exec(t.slice(r,r+2));return n?(e.V=+n[0],r+n[0].length):-1}function yG(e,t,r){var n=y$.exec(t.slice(r,r+2));return n?(e.W=+n[0],r+n[0].length):-1}function yZ(e,t,r){var n=y$.exec(t.slice(r,r+4));return n?(e.y=+n[0],r+n[0].length):-1}function yJ(e,t,r){var n=y$.exec(t.slice(r,r+2));return n?(e.y=+n[0]+(+n[0]>68?1900:2e3),r+n[0].length):-1}function y0(e,t,r){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(r,r+6));return n?(e.Z=n[1]?0:-(n[2]+(n[3]||"00")),r+n[0].length):-1}function y1(e,t,r){var n=y$.exec(t.slice(r,r+1));return n?(e.q=3*n[0]-3,r+n[0].length):-1}function y2(e,t,r){var n=y$.exec(t.slice(r,r+2));return n?(e.m=n[0]-1,r+n[0].length):-1}function y5(e,t,r){var n=y$.exec(t.slice(r,r+2));return n?(e.d=+n[0],r+n[0].length):-1}function y4(e,t,r){var n=y$.exec(t.slice(r,r+3));return n?(e.m=0,e.d=+n[0],r+n[0].length):-1}function y3(e,t,r){var n=y$.exec(t.slice(r,r+2));return n?(e.H=+n[0],r+n[0].length):-1}function y6(e,t,r){var n=y$.exec(t.slice(r,r+2));return n?(e.M=+n[0],r+n[0].length):-1}function y8(e,t,r){var n=y$.exec(t.slice(r,r+2));return n?(e.S=+n[0],r+n[0].length):-1}function y7(e,t,r){var n=y$.exec(t.slice(r,r+3));return n?(e.L=+n[0],r+n[0].length):-1}function y9(e,t,r){var n=y$.exec(t.slice(r,r+6));return n?(e.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function ge(e,t,r){var n=yB.exec(t.slice(r,r+1));return n?r+n[0].length:-1}function gt(e,t,r){var n=y$.exec(t.slice(r));return n?(e.Q=+n[0],r+n[0].length):-1}function gr(e,t,r){var n=y$.exec(t.slice(r));return n?(e.s=+n[0],r+n[0].length):-1}function gn(e,t){return yq(e.getDate(),t,2)}function gi(e,t){return yq(e.getHours(),t,2)}function ga(e,t){return yq(e.getHours()%12||12,t,2)}function gs(e,t){return yq(1+yw.count(yr(e),e),t,3)}function gl(e,t){return yq(e.getMilliseconds(),t,3)}function go(e,t){return gl(e,t)+"000"}function gc(e,t){return yq(e.getMonth()+1,t,2)}function gd(e,t){return yq(e.getMinutes(),t,2)}function gu(e,t){return yq(e.getSeconds(),t,2)}function gh(e){var t=e.getDay();return 0===t?7:t}function gp(e,t){return yq(yl.count(yr(e)-1,e),t,2)}function gm(e){var t=e.getDay();return t>=4||0===t?yu(e):yu.ceil(e)}function gf(e,t){return e=gm(e),yq(yu.count(yr(e),e)+(4===yr(e).getDay()),t,2)}function gx(e){return e.getDay()}function gy(e,t){return yq(yo.count(yr(e)-1,e),t,2)}function gg(e,t){return yq(e.getFullYear()%100,t,2)}function gv(e,t){return yq((e=gm(e)).getFullYear()%100,t,2)}function gb(e,t){return yq(e.getFullYear()%1e4,t,4)}function gj(e,t){var r=e.getDay();return yq((e=r>=4||0===r?yu(e):yu.ceil(e)).getFullYear()%1e4,t,4)}function gw(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+yq(t/60|0,"0",2)+yq(t%60,"0",2)}function gN(e,t){return yq(e.getUTCDate(),t,2)}function gk(e,t){return yq(e.getUTCHours(),t,2)}function gS(e,t){return yq(e.getUTCHours()%12||12,t,2)}function gO(e,t){return yq(1+yN.count(yn(e),e),t,3)}function gP(e,t){return yq(e.getUTCMilliseconds(),t,3)}function gC(e,t){return gP(e,t)+"000"}function gA(e,t){return yq(e.getUTCMonth()+1,t,2)}function gE(e,t){return yq(e.getUTCMinutes(),t,2)}function gM(e,t){return yq(e.getUTCSeconds(),t,2)}function gT(e){var t=e.getUTCDay();return 0===t?7:t}function g_(e,t){return yq(yf.count(yn(e)-1,e),t,2)}function gD(e){var t=e.getUTCDay();return t>=4||0===t?yv(e):yv.ceil(e)}function gI(e,t){return e=gD(e),yq(yv.count(yn(e),e)+(4===yn(e).getUTCDay()),t,2)}function gz(e){return e.getUTCDay()}function gL(e,t){return yq(yx.count(yn(e)-1,e),t,2)}function gR(e,t){return yq(e.getUTCFullYear()%100,t,2)}function gF(e,t){return yq((e=gD(e)).getUTCFullYear()%100,t,2)}function g$(e,t){return yq(e.getUTCFullYear()%1e4,t,4)}function gB(e,t){var r=e.getUTCDay();return yq((e=r>=4||0===r?yv(e):yv.ceil(e)).getUTCFullYear()%1e4,t,4)}function gU(){return"+0000"}function gq(){return"%"}function gV(e){return+e}function gK(e){return Math.floor(e/1e3)}function gW(e){return new Date(e)}function gH(e){return e instanceof Date?+e:+new Date(+e)}function gQ(e,t,r,n,i,a,s,l,o,c){var d=xb(),u=d.invert,h=d.domain,p=c(".%L"),m=c(":%S"),f=c("%I:%M"),x=c("%I %p"),y=c("%a %d"),g=c("%b %d"),v=c("%B"),b=c("%Y");function j(e){return(o(e)<e?p:l(e)<e?m:s(e)<e?f:a(e)<e?x:n(e)<e?i(e)<e?y:g:r(e)<e?v:b)(e)}return d.invert=function(e){return new Date(u(e))},d.domain=function(e){return arguments.length?h(Array.from(e,gH)):h().map(gW)},d.ticks=function(t){var r=h();return e(r[0],r[r.length-1],null==t?10:t)},d.tickFormat=function(e,t){return null==t?j:c(t)},d.nice=function(e){var r=h();return e&&"function"==typeof e.range||(e=t(r[0],r[r.length-1],null==e?10:e)),e?h(xI(r,e)):d},d.copy=function(){return xg(d,gQ(e,t,r,n,i,a,s,l,o,c))},d}function gY(){return fX.initRange.apply(gQ(yD,yI,yr,yi,yl,yw,yS,yP,yA,j).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function gX(){return fX.initRange.apply(gQ(yT,y_,yn,ya,yf,yN,yO,yC,yA,w).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function gG(){var e,t,r,n,i,a=0,s=1,l=xm,o=!1;function c(t){return null==t||isNaN(t*=1)?i:l(0===r?.5:(t=(n(t)-e)*r,o?Math.max(0,Math.min(1,t)):t))}function d(e){return function(t){var r,n;return arguments.length?([r,n]=t,l=e(r,n),c):[l(0),l(1)]}}return c.domain=function(i){return arguments.length?([a,s]=i,e=n(a*=1),t=n(s*=1),r=e===t?0:1/(t-e),c):[a,s]},c.clamp=function(e){return arguments.length?(o=!!e,c):o},c.interpolator=function(e){return arguments.length?(l=e,c):l},c.range=d(xc),c.rangeRound=d(xu),c.unknown=function(e){return arguments.length?(i=e,c):i},function(i){return n=i,e=i(a),t=i(s),r=e===t?0:1/(t-e),c}}function gZ(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function gJ(){var e=xT(gG()(xm));return e.copy=function(){return gZ(e,gJ())},fX.initInterpolator.apply(e,arguments)}function g0(){var e=xU(gG()).domain([1,10]);return e.copy=function(){return gZ(e,g0()).base(e.base())},fX.initInterpolator.apply(e,arguments)}function g1(){var e=xW(gG());return e.copy=function(){return gZ(e,g1()).constant(e.constant())},fX.initInterpolator.apply(e,arguments)}function g2(){var e=xG(gG());return e.copy=function(){return gZ(e,g2()).exponent(e.exponent())},fX.initInterpolator.apply(e,arguments)}function g5(){return g2.apply(null,arguments).exponent(.5)}function g4(){var e=[],t=xm;function r(r){if(null!=r&&!isNaN(r*=1))return t((xn(e,r,1)-1)/(e.length-1))}return r.domain=function(t){if(!arguments.length)return e.slice();for(let r of(e=[],t))null==r||isNaN(r*=1)||e.push(r);return e.sort(f8),r},r.interpolator=function(e){return arguments.length?(t=e,r):t},r.range=function(){return e.map((r,n)=>t(n/(e.length-1)))},r.quantiles=function(t){return Array.from({length:t+1},(r,n)=>(function(e,t,r){if(!(!(n=(e=Float64Array.from(function*(e,t){if(void 0===t)for(let t of e)null!=t&&(t*=1)>=t&&(yield t);else{let r=-1;for(let n of e)null!=(n=t(n,++r,e))&&(n*=1)>=n&&(yield n)}}(e,void 0))).length)||isNaN(t*=1))){if(t<=0||n<2)return(0,x5.default)(e);if(t>=1)return(0,x2.default)(e);var n,i=(n-1)*t,a=Math.floor(i),s=(0,x2.default)((function e(t,r,n=0,i=1/0,a){if(r=Math.floor(r),n=Math.floor(Math.max(0,n)),i=Math.floor(Math.min(t.length-1,i)),!(n<=r&&r<=i))return t;for(a=void 0===a?x4:function(e=f8){if(e===f8)return x4;if("function"!=typeof e)throw TypeError("compare is not a function");return(t,r)=>{let n=e(t,r);return n||0===n?n:(0===e(r,r))-(0===e(t,t))}}(a);i>n;){if(i-n>600){let s=i-n+1,l=r-n+1,o=Math.log(s),c=.5*Math.exp(2*o/3),d=.5*Math.sqrt(o*c*(s-c)/s)*(l-s/2<0?-1:1),u=Math.max(n,Math.floor(r-l*c/s+d)),h=Math.min(i,Math.floor(r+(s-l)*c/s+d));e(t,r,u,h,a)}let s=t[r],l=n,o=i;for(x3(t,n,r),a(t[i],s)>0&&x3(t,n,i);l<o;){for(x3(t,l,o),++l,--o;0>a(t[l],s);)++l;for(;a(t[o],s)>0;)--o}0===a(t[n],s)?x3(t,n,o):x3(t,++o,i),o<=r&&(n=o+1),r<=o&&(i=o-1)}return t})(e,a).subarray(0,a+1));return s+((0,x5.default)(e.subarray(a+1))-s)*(i-a)}})(e,n/t))},r.copy=function(){return g4(t).domain(e)},fX.initInterpolator.apply(r,arguments)}function g3(){var e,t,r,n,i,a,s,l=0,o=.5,c=1,d=1,u=xm,h=!1;function p(e){return isNaN(e*=1)?s:(e=.5+((e=+a(e))-t)*(d*e<d*t?n:i),u(h?Math.max(0,Math.min(1,e)):e))}function m(e){return function(t){var r,n,i;return arguments.length?([r,n,i]=t,u=function(e,t){void 0===t&&(t=e,e=xc);for(var r=0,n=t.length-1,i=t[0],a=Array(n<0?0:n);r<n;)a[r]=e(i,i=t[++r]);return function(e){var t=Math.max(0,Math.min(n-1,Math.floor(e*=n)));return a[t](e-t)}}(e,[r,n,i]),p):[u(0),u(.5),u(1)]}}return p.domain=function(s){return arguments.length?([l,o,c]=s,e=a(l*=1),t=a(o*=1),r=a(c*=1),n=e===t?0:.5/(t-e),i=t===r?0:.5/(r-t),d=t<e?-1:1,p):[l,o,c]},p.clamp=function(e){return arguments.length?(h=!!e,p):h},p.interpolator=function(e){return arguments.length?(u=e,p):u},p.range=m(xc),p.rangeRound=m(xu),p.unknown=function(e){return arguments.length?(s=e,p):s},function(s){return a=s,e=s(l),t=s(o),r=s(c),n=e===t?0:.5/(t-e),i=t===r?0:.5/(r-t),d=t<e?-1:1,p}}function g6(){var e=xT(g3()(xm));return e.copy=function(){return gZ(e,g6())},fX.initInterpolator.apply(e,arguments)}function g8(){var e=xU(g3()).domain([.1,1,10]);return e.copy=function(){return gZ(e,g8()).base(e.base())},fX.initInterpolator.apply(e,arguments)}function g7(){var e=xW(g3());return e.copy=function(){return gZ(e,g7()).constant(e.constant())},fX.initInterpolator.apply(e,arguments)}function g9(){var e=xG(g3());return e.copy=function(){return gZ(e,g9()).exponent(e.exponent())},fX.initInterpolator.apply(e,arguments)}function ve(){return g9.apply(null,arguments).exponent(.5)}j=(b=function(e){var t=e.dateTime,r=e.date,n=e.time,i=e.periods,a=e.days,s=e.shortDays,l=e.months,o=e.shortMonths,c=yK(i),d=yW(i),u=yK(a),h=yW(a),p=yK(s),m=yW(s),f=yK(l),x=yW(l),y=yK(o),g=yW(o),v={a:function(e){return s[e.getDay()]},A:function(e){return a[e.getDay()]},b:function(e){return o[e.getMonth()]},B:function(e){return l[e.getMonth()]},c:null,d:gn,e:gn,f:go,g:gv,G:gj,H:gi,I:ga,j:gs,L:gl,m:gc,M:gd,p:function(e){return i[+(e.getHours()>=12)]},q:function(e){return 1+~~(e.getMonth()/3)},Q:gV,s:gK,S:gu,u:gh,U:gp,V:gf,w:gx,W:gy,x:null,X:null,y:gg,Y:gb,Z:gw,"%":gq},b={a:function(e){return s[e.getUTCDay()]},A:function(e){return a[e.getUTCDay()]},b:function(e){return o[e.getUTCMonth()]},B:function(e){return l[e.getUTCMonth()]},c:null,d:gN,e:gN,f:gC,g:gF,G:gB,H:gk,I:gS,j:gO,L:gP,m:gA,M:gE,p:function(e){return i[+(e.getUTCHours()>=12)]},q:function(e){return 1+~~(e.getUTCMonth()/3)},Q:gV,s:gK,S:gM,u:gT,U:g_,V:gI,w:gz,W:gL,x:null,X:null,y:gR,Y:g$,Z:gU,"%":gq},j={a:function(e,t,r){var n=p.exec(t.slice(r));return n?(e.w=m.get(n[0].toLowerCase()),r+n[0].length):-1},A:function(e,t,r){var n=u.exec(t.slice(r));return n?(e.w=h.get(n[0].toLowerCase()),r+n[0].length):-1},b:function(e,t,r){var n=y.exec(t.slice(r));return n?(e.m=g.get(n[0].toLowerCase()),r+n[0].length):-1},B:function(e,t,r){var n=f.exec(t.slice(r));return n?(e.m=x.get(n[0].toLowerCase()),r+n[0].length):-1},c:function(e,r,n){return k(e,t,r,n)},d:y5,e:y5,f:y9,g:yJ,G:yZ,H:y3,I:y3,j:y4,L:y7,m:y2,M:y6,p:function(e,t,r){var n=c.exec(t.slice(r));return n?(e.p=d.get(n[0].toLowerCase()),r+n[0].length):-1},q:y1,Q:gt,s:gr,S:y8,u:yQ,U:yY,V:yX,w:yH,W:yG,x:function(e,t,n){return k(e,r,t,n)},X:function(e,t,r){return k(e,n,t,r)},y:yJ,Y:yZ,Z:y0,"%":ge};function w(e,t){return function(r){var n,i,a,s=[],l=-1,o=0,c=e.length;for(r instanceof Date||(r=new Date(+r));++l<c;)37===e.charCodeAt(l)&&(s.push(e.slice(o,l)),null!=(i=yF[n=e.charAt(++l)])?n=e.charAt(++l):i="e"===n?" ":"0",(a=t[n])&&(n=a(r,i)),s.push(n),o=l+1);return s.push(e.slice(o,l)),s.join("")}}function N(e,t){return function(r){var n,i,a=yR(1900,void 0,1);if(k(a,e,r+="",0)!=r.length)return null;if("Q"in a)return new Date(a.Q);if("s"in a)return new Date(1e3*a.s+("L"in a?a.L:0));if(!t||"Z"in a||(a.Z=0),"p"in a&&(a.H=a.H%12+12*a.p),void 0===a.m&&(a.m="q"in a?a.q:0),"V"in a){if(a.V<1||a.V>53)return null;"w"in a||(a.w=1),"Z"in a?(n=(i=(n=yL(yR(a.y,0,1))).getUTCDay())>4||0===i?yx.ceil(n):yx(n),n=yN.offset(n,(a.V-1)*7),a.y=n.getUTCFullYear(),a.m=n.getUTCMonth(),a.d=n.getUTCDate()+(a.w+6)%7):(n=(i=(n=yz(yR(a.y,0,1))).getDay())>4||0===i?yo.ceil(n):yo(n),n=yw.offset(n,(a.V-1)*7),a.y=n.getFullYear(),a.m=n.getMonth(),a.d=n.getDate()+(a.w+6)%7)}else("W"in a||"U"in a)&&("w"in a||(a.w="u"in a?a.u%7:+("W"in a)),i="Z"in a?yL(yR(a.y,0,1)).getUTCDay():yz(yR(a.y,0,1)).getDay(),a.m=0,a.d="W"in a?(a.w+6)%7+7*a.W-(i+5)%7:a.w+7*a.U-(i+6)%7);return"Z"in a?(a.H+=a.Z/100|0,a.M+=a.Z%100,yL(a)):yz(a)}}function k(e,t,r,n){for(var i,a,s=0,l=t.length,o=r.length;s<l;){if(n>=o)return -1;if(37===(i=t.charCodeAt(s++))){if(!(a=j[(i=t.charAt(s++))in yF?t.charAt(s++):i])||(n=a(e,r,n))<0)return -1}else if(i!=r.charCodeAt(n++))return -1}return n}return v.x=w(r,v),v.X=w(n,v),v.c=w(t,v),b.x=w(r,b),b.X=w(n,b),b.c=w(t,b),{format:function(e){var t=w(e+="",v);return t.toString=function(){return e},t},parse:function(e){var t=N(e+="",!1);return t.toString=function(){return e},t},utcFormat:function(e){var t=w(e+="",b);return t.toString=function(){return e},t},utcParse:function(e){var t=N(e+="",!0);return t.toString=function(){return e},t}}}({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]})).format,b.parse,w=b.utcFormat,b.utcParse,e.s(["scaleBand",()=>fZ,"scaleDiverging",()=>g6,"scaleDivergingLog",()=>g8,"scaleDivergingPow",()=>g9,"scaleDivergingSqrt",()=>ve,"scaleDivergingSymlog",()=>g7,"scaleIdentity",()=>xD,"scaleImplicit",()=>fG.implicit,"scaleLinear",()=>x_,"scaleLog",()=>xq,"scaleOrdinal",()=>fG.default,"scalePoint",()=>fJ,"scalePow",()=>xZ,"scaleQuantile",()=>x6,"scaleQuantize",()=>x8,"scaleRadial",()=>x1,"scaleSequential",()=>gJ,"scaleSequentialLog",()=>g0,"scaleSequentialPow",()=>g2,"scaleSequentialQuantile",()=>g4,"scaleSequentialSqrt",()=>g5,"scaleSequentialSymlog",()=>g1,"scaleSqrt",()=>xJ,"scaleSymlog",()=>xH,"scaleThreshold",()=>x7,"scaleTime",()=>gY,"scaleUtc",()=>gX,"tickFormat",()=>xM],84649),e.i(84649),e.s(["scaleBand",()=>fZ,"scaleDiverging",()=>g6,"scaleDivergingLog",()=>g8,"scaleDivergingPow",()=>g9,"scaleDivergingSqrt",()=>ve,"scaleDivergingSymlog",()=>g7,"scaleIdentity",()=>xD,"scaleImplicit",()=>fG.implicit,"scaleLinear",()=>x_,"scaleLog",()=>xq,"scaleOrdinal",()=>fG.default,"scalePoint",()=>fJ,"scalePow",()=>xZ,"scaleQuantile",()=>x6,"scaleQuantize",()=>x8,"scaleRadial",()=>x1,"scaleSequential",()=>gJ,"scaleSequentialLog",()=>g0,"scaleSequentialPow",()=>g2,"scaleSequentialQuantile",()=>g4,"scaleSequentialSqrt",()=>g5,"scaleSequentialSymlog",()=>g1,"scaleSqrt",()=>xJ,"scaleSymlog",()=>xH,"scaleThreshold",()=>x7,"scaleTime",()=>gY,"scaleUtc",()=>gX,"tickFormat",()=>xM],93628);var vt=e.i(93628),vr=e=>e.chartData,vn=hy([vr],e=>{var t=null!=e.chartData?e.chartData.length-1:0;return{chartData:e.chartData,computedData:e.computedData,dataEndIndex:t,dataStartIndex:0}}),vi=(e,t,r,n)=>n?vn(e):vr(e);function va(e){if(Array.isArray(e)&&2===e.length){var[t,r]=e;if(m6(t)&&m6(r))return!0}return!1}function vs(e,t,r){return r?e:[Math.min(e[0],t[0]),Math.max(e[1],t[1])]}function vl(e,t){if(t&&"function"!=typeof e&&Array.isArray(e)&&2===e.length){var r,n,[i,a]=e;if(m6(i))r=i;else if("function"==typeof i)return;if(m6(a))n=a;else if("function"==typeof a)return;var s=[r,n];if(va(s))return s}}var vo=e.i(73335);function vc(e){return 0===e?1:Math.floor(new vo.default(e).abs().log(10).toNumber())+1}function vd(e,t,r){for(var n=new vo.default(e),i=0,a=[];n.lt(t)&&i<1e5;)a.push(n.toNumber()),n=n.add(r),i++;return a}var vu=e=>{var[t,r]=e,[n,i]=[t,r];return t>r&&([n,i]=[r,t]),[n,i]},vh=(e,t,r)=>{if(e.lte(0))return new vo.default(0);var n=vc(e.toNumber()),i=new vo.default(10).pow(n),a=e.div(i),s=1!==n?.05:.1,l=new vo.default(Math.ceil(a.div(s).toNumber())).add(r).mul(s).mul(i);return new vo.default(t?l.toNumber():Math.ceil(l.toNumber()))},vp=function(e,t,r,n){var i,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!Number.isFinite((t-e)/(r-1)))return{step:new vo.default(0),tickMin:new vo.default(0),tickMax:new vo.default(0)};var s=vh(new vo.default(t).sub(e).div(r-1),n,a),l=Math.ceil((i=e<=0&&t>=0?new vo.default(0):(i=new vo.default(e).add(t).div(2)).sub(new vo.default(i).mod(s))).sub(e).div(s).toNumber()),o=Math.ceil(new vo.default(t).sub(i).div(s).toNumber()),c=l+o+1;return c>r?vp(e,t,r,n,a+1):(c<r&&(o=t>0?o+(r-c):o,l=t>0?l:l+(r-c)),{step:s,tickMin:i.sub(new vo.default(l).mul(s)),tickMax:i.add(new vo.default(o).mul(s))})},vm=function(e){var[t,r]=e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:6,i=!(arguments.length>2)||void 0===arguments[2]||arguments[2],a=Math.max(n,2),[s,l]=vu([t,r]);if(s===-1/0||l===1/0){var o=l===1/0?[s,...Array(n-1).fill(1/0)]:[...Array(n-1).fill(-1/0),l];return t>r?o.reverse():o}if(s===l)return((e,t,r)=>{var n=new vo.default(1),i=new vo.default(e);if(!i.isint()&&r){var a=Math.abs(e);a<1?(n=new vo.default(10).pow(vc(e)-1),i=new vo.default(Math.floor(i.div(n).toNumber())).mul(n)):a>1&&(i=new vo.default(Math.floor(e)))}else 0===e?i=new vo.default(Math.floor((t-1)/2)):r||(i=new vo.default(Math.floor(e)));for(var s=Math.floor((t-1)/2),l=[],o=0;o<t;o++)l.push(i.add(new vo.default(o-s).mul(n)).toNumber());return l})(s,n,i);var{step:c,tickMin:d,tickMax:u}=vp(s,l,a,i,0),h=vd(d,u.add(new vo.default(.1).mul(c)),c);return t>r?h.reverse():h},vf=function(e,t){var[r,n]=e,i=!(arguments.length>2)||void 0===arguments[2]||arguments[2],[a,s]=vu([r,n]);if(a===-1/0||s===1/0)return[r,n];if(a===s)return[a];var l=Math.max(t,2),o=vh(new vo.default(s).sub(a).div(l-1),i,0),c=[...vd(new vo.default(a),new vo.default(s),o),s];return!1===i&&(c=c.map(e=>Math.round(e))),r>n?c.reverse():c},vx=e=>e.rootProps.maxBarSize,vy=e=>e.rootProps.barCategoryGap,vg=e=>e.rootProps.stackOffset,vv=e=>e.rootProps.reverseStackOrder,vb=e=>e.options.chartName,vj=e=>e.rootProps.syncId,vw=e=>e.rootProps.syncMethod,vN=e=>e.options.eventEmitter;function vk(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function vS(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?vk(Object(r),!0).forEach(function(t){var n,i,a;n=e,i=t,a=r[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in n?Object.defineProperty(n,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):n[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):vk(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var vO=Math.PI/180,vP=(e,t,r,n)=>({x:e+Math.cos(-vO*n)*r,y:t+Math.sin(-vO*n)*r}),vC={grid:-100,barBackground:-50,area:100,cursorRectangle:200,bar:300,line:400,axis:500,scatter:600,activeBar:1e3,cursorLine:1100,activeDot:1200,label:2e3},vA={allowDecimals:!1,allowDuplicatedCategory:!0,allowDataOverflow:!1,angle:0,angleAxisId:0,axisLine:!0,axisLineType:"polygon",cx:0,cy:0,hide:!1,includeHidden:!1,label:!1,orientation:"outer",reversed:!1,scale:"auto",tick:!0,tickLine:!0,tickSize:8,type:"auto",zIndex:vC.axis},vE={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:!0,angle:0,axisLine:!0,includeHidden:!1,hide:!1,label:!1,orientation:"right",radiusAxisId:0,reversed:!1,scale:"auto",stroke:"#ccc",tick:!0,tickCount:5,tickLine:!0,type:"auto",zIndex:vC.axis},vM=(e,t)=>{if(e&&t)return null!=e&&e.reversed?[t[1],t[0]]:t};function vT(e,t,r){return"auto"!==r?r:null!=e?ft(e,t)?"category":"number":void 0}function v_(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function vD(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?v_(Object(r),!0).forEach(function(t){var n,i,a;n=e,i=t,a=r[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in n?Object.defineProperty(n,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):n[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):v_(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var vI={allowDataOverflow:vA.allowDataOverflow,allowDecimals:vA.allowDecimals,allowDuplicatedCategory:!1,dataKey:void 0,domain:void 0,id:vA.angleAxisId,includeHidden:!1,name:void 0,reversed:vA.reversed,scale:vA.scale,tick:vA.tick,tickCount:void 0,ticks:void 0,type:vA.type,unit:void 0},vz={allowDataOverflow:vE.allowDataOverflow,allowDecimals:vE.allowDecimals,allowDuplicatedCategory:vE.allowDuplicatedCategory,dataKey:void 0,domain:void 0,id:vE.radiusAxisId,includeHidden:vE.includeHidden,name:void 0,reversed:vE.reversed,scale:vE.scale,tick:vE.tick,tickCount:vE.tickCount,ticks:void 0,type:vE.type,unit:void 0},vL=hy([(e,t)=>{if(null!=t)return e.polarAxis.angleAxis[t]},fH],(e,t)=>{if(null!=e)return e;var r,n=null!=(r=vT(t,"angleAxis",vI.type))?r:"category";return vD(vD({},vI),{},{type:n})}),vR=hy([(e,t)=>e.polarAxis.radiusAxis[t],fH],(e,t)=>{if(null!=e)return e;var r,n=null!=(r=vT(t,"radiusAxis",vz.type))?r:"category";return vD(vD({},vz),{},{type:n})}),vF=e=>e.polarOptions,v$=hy([fc,fd,fy],function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{top:0,right:0,bottom:0,left:0,width:0,height:0,brushBottom:0};return Math.min(Math.abs(e-(r.left||0)-(r.right||0)),Math.abs(t-(r.top||0)-(r.bottom||0)))/2}),vB=hy([vF,v$],(e,t)=>{if(null!=e)return pb(e.innerRadius,t,0)}),vU=hy([vF,v$],(e,t)=>{if(null!=e)return pb(e.outerRadius,t,.8*t)}),vq=hy([vF],e=>{if(null==e)return[0,0];var{startAngle:t,endAngle:r}=e;return[t,r]});hy([vL,vq],vM);var vV=hy([v$,vB,vU],(e,t,r)=>{if(null!=e&&null!=t&&null!=r)return[t,r]});hy([vR,vV],vM);var vK=hy([fK,vF,vB,vU,fc,fd],(e,t,r,n,i,a)=>{if(("centric"===e||"radial"===e)&&null!=t&&null!=r&&null!=n){var{cx:s,cy:l,startAngle:o,endAngle:c}=t;return{cx:pb(s,i,i/2),cy:pb(l,a,a/2),innerRadius:r,outerRadius:n,startAngle:o,endAngle:c,clockWise:!1}}}),vW=(e,t)=>t,vH=(e,t,r)=>r;function vQ(e){return null==e?void 0:e.id}function vY(e,t,r){var{chartData:n=[]}=t,{allowDuplicatedCategory:i,dataKey:a}=r,s=new Map;return e.forEach(e=>{var t,r=null!=(t=e.data)?t:n;if(null!=r&&0!==r.length){var l=vQ(e);r.forEach((t,r)=>{var n,o=null==a||i?r:String(fe(t,a,null)),c=fe(t,e.dataKey,0);Object.assign(n=s.has(o)?s.get(o):{},{[l]:c}),s.set(o,n)})}}),Array.from(s.values())}function vX(e){return"stackId"in e&&null!=e.stackId&&null!=e.dataKey}var vG=(e,t)=>e===t||null!=e&&null!=t&&e[0]===t[0]&&e[1]===t[1];function vZ(e,t){return!!(Array.isArray(e)&&Array.isArray(t))&&0===e.length&&0===t.length||e===t}var vJ=e=>{var t=fK(e);return"horizontal"===t?"xAxis":"vertical"===t?"yAxis":"centric"===t?"angleAxis":"radiusAxis"},v0=e=>e.tooltip.settings.axisId;function v1(e){var t=e.ticks,r=e.bandwidth,n=e.range(),i=[Math.min(...n),Math.max(...n)];return{domain:()=>e.domain(),range:function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(()=>i),rangeMin:()=>i[0],rangeMax:()=>i[1],isInRange(e){var t=i[0],r=i[1];return t<=r?e>=t&&e<=r:e>=r&&e<=t},bandwidth:r?()=>r.call(e):void 0,ticks:t?r=>t.call(e,r):void 0,map:(t,r)=>{var n=e(t);if(null!=n){if(e.bandwidth&&null!=r&&r.position){var i=e.bandwidth();switch(r.position){case"middle":n+=i/2;break;case"end":n+=i}}return n}}}}function v2(e,t,r){if("function"==typeof e)return v1(e.copy().domain(t).range(r));if(null!=e){var n=function(e){if(e in vt)return vt[e]();var t="scale".concat(pN(e));if(t in vt)return vt[t]()}(e);if(null!=n)return n.domain(t).range(r),v1(n)}}function v5(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function v4(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?v5(Object(r),!0).forEach(function(t){var n,i,a;n=e,i=t,a=r[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in n?Object.defineProperty(n,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):n[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):v5(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var v3=[0,"auto"],v6={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:void 0,height:30,hide:!0,id:0,includeHidden:!1,interval:"preserveEnd",minTickGap:5,mirror:!1,name:void 0,orientation:"bottom",padding:{left:0,right:0},reversed:!1,scale:"auto",tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:"category",unit:void 0},v8=(e,t)=>e.cartesianAxis.xAxis[t],v7=(e,t)=>{var r=v8(e,t);return null==r?v6:r},v9={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:v3,hide:!0,id:0,includeHidden:!1,interval:"preserveEnd",minTickGap:5,mirror:!1,name:void 0,orientation:"left",padding:{top:0,bottom:0},reversed:!1,scale:"auto",tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:"number",unit:void 0,width:60},be=(e,t)=>e.cartesianAxis.yAxis[t],bt=(e,t)=>{var r=be(e,t);return null==r?v9:r},br={domain:[0,"auto"],includeHidden:!1,reversed:!1,allowDataOverflow:!1,allowDuplicatedCategory:!1,dataKey:void 0,id:0,name:"",range:[64,64],scale:"auto",type:"number",unit:""},bn=(e,t)=>{var r=e.cartesianAxis.zAxis[t];return null==r?br:r},bi=(e,t,r)=>{switch(t){case"xAxis":return v7(e,r);case"yAxis":return bt(e,r);case"zAxis":return bn(e,r);case"angleAxis":return vL(e,r);case"radiusAxis":return vR(e,r);default:throw Error("Unexpected axis type: ".concat(t))}},ba=(e,t,r)=>{switch(t){case"xAxis":return v7(e,r);case"yAxis":return bt(e,r);case"angleAxis":return vL(e,r);case"radiusAxis":return vR(e,r);default:throw Error("Unexpected axis type: ".concat(t))}},bs=e=>e.graphicalItems.cartesianItems.some(e=>"bar"===e.type)||e.graphicalItems.polarItems.some(e=>"radialBar"===e.type);function bl(e,t){return r=>{switch(e){case"xAxis":return"xAxisId"in r&&r.xAxisId===t;case"yAxis":return"yAxisId"in r&&r.yAxisId===t;case"zAxis":return"zAxisId"in r&&r.zAxisId===t;case"angleAxis":return"angleAxisId"in r&&r.angleAxisId===t;case"radiusAxis":return"radiusAxisId"in r&&r.radiusAxisId===t;default:return!1}}}var bo=e=>e.graphicalItems.cartesianItems,bc=hy([vW,vH],bl),bd=(e,t,r)=>e.filter(r).filter(e=>(null==t?void 0:t.includeHidden)===!0||!e.hide),bu=hy([bo,bi,bc],bd,{memoizeOptions:{resultEqualityCheck:vZ}}),bh=hy([bu],e=>e.filter(e=>"area"===e.type||"bar"===e.type).filter(vX)),bp=e=>e.filter(e=>!("stackId"in e)||void 0===e.stackId),bm=hy([bu],bp),bf=e=>e.map(e=>e.data).filter(Boolean).flat(1),bx=hy([bu],bf,{memoizeOptions:{resultEqualityCheck:vZ}}),by=(e,t)=>{var{chartData:r=[],dataStartIndex:n,dataEndIndex:i}=t;return e.length>0?e:r.slice(n,i+1)},bg=hy([bx,vi],by),bv=(e,t,r)=>(null==t?void 0:t.dataKey)!=null?e.map(e=>({value:fe(e,t.dataKey)})):r.length>0?r.map(e=>e.dataKey).flatMap(t=>e.map(e=>({value:fe(e,t)}))):e.map(e=>({value:e})),bb=hy([bg,bi,bu],bv);function bj(e,t){switch(e){case"xAxis":return"x"===t.direction;case"yAxis":return"y"===t.direction;default:return!1}}function bw(e){if(py(e)||e instanceof Date){var t=Number(e);if(m6(t))return t}}function bN(e){if(Array.isArray(e)){var t=[bw(e[0]),bw(e[1])];return va(t)?t:void 0}var r=bw(e);if(null!=r)return[r,r]}function bk(e){return e.map(bw).filter(pk)}var bS=e=>{var t=vJ(e),r=v0(e);return ba(e,t,r)},bO=hy([bS],e=>null==e?void 0:e.dataKey),bP=hy([bh,vi,bS],vY),bC=(e,t,r,n)=>Object.fromEntries(Object.entries(t.reduce((e,t)=>{if(null==t.stackId)return e;var r=e[t.stackId];return null==r&&(r=[]),r.push(t),e[t.stackId]=r,e},{})).map(t=>{var i,a,s,[l,o]=t,c=n?[...o].reverse():o,d=c.map(vQ);return[l,{stackedData:(a=null!=(i=fr[r])?i:m1,(s=(function(){var e=m0([]),t=m2,r=m1,n=m5;function i(i){var a,s,l=Array.from(e.apply(this,arguments),m4),o=l.length,c=-1;for(let e of i)for(a=0,++c;a<o;++a)(l[a][c]=[0,+n(e,l[a].key,c,i)]).data=e;for(a=0,s=mJ(t(l));a<o;++a)l[s[a]].index=a;return r(l,s),l}return i.keys=function(t){return arguments.length?(e="function"==typeof t?t:m0(Array.from(t)),i):e},i.value=function(e){return arguments.length?(n="function"==typeof e?e:m0(+e),i):n},i.order=function(e){return arguments.length?(t=null==e?m2:"function"==typeof e?e:m0(Array.from(e)),i):t},i.offset=function(e){return arguments.length?(r=null==e?m1:e,i):r},i})().keys(d).value((e,t)=>Number(fe(e,t,0))).order(m2).offset(a)(e)).forEach((t,r)=>{t.forEach((t,n)=>{var i=fe(e[n],d[r],0);Array.isArray(i)&&2===i.length&&px(i[0])&&px(i[1])&&(t[0]=i[0],t[1]=i[1])})}),s),graphicalItems:c}]})),bA=hy([bP,bh,vg,vv],bC),bE=(e,t,r,n)=>{var{dataStartIndex:i,dataEndIndex:a}=t;if(null==n&&"zAxis"!==r){var s=((e,t,r)=>{if(null!=e){let n;return[(n=Object.keys(e).reduce((n,i)=>{var a=e[i];if(!a)return n;var{stackedData:s}=a,l=s.reduce((e,n)=>{var i,a=[Math.min(...i=m3(n,t,r).flat(2).filter(px)),Math.max(...i)];return m6(a[0])&&m6(a[1])?[Math.min(e[0],a[0]),Math.max(e[1],a[1])]:e},[1/0,-1/0]);return[Math.min(l[0],n[0]),Math.max(l[1],n[1])]},[1/0,-1/0]))[0]===1/0?0:n[0],n[1]===-1/0?0:n[1]]}})(e,i,a);if(null==s||0!==s[0]||0!==s[1])return s}},bM=hy([bi],e=>e.allowDataOverflow),bT=e=>{var t;if(null==e||!("domain"in e))return v3;if(null!=e.domain)return e.domain;if("ticks"in e&&null!=e.ticks){if("number"===e.type){var r=bk(e.ticks);return[Math.min(...r),Math.max(...r)]}if("category"===e.type)return e.ticks.map(String)}return null!=(t=null==e?void 0:e.domain)?t:v3},b_=hy([bi],bT),bD=hy([b_,bM],vl),bI=hy([bA,vr,vW,bD],bE,{memoizeOptions:{resultEqualityCheck:vG}}),bz=e=>e.errorBars,bL=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=t.filter(Boolean);if(0!==n.length){var i=n.flat();return[Math.min(...i),Math.max(...i)]}},bR=(e,t,r,n,i)=>{var a,s;if(r.length>0&&e.forEach(e=>{r.forEach(r=>{var l,o,c=null==(l=n[r.id])?void 0:l.filter(e=>bj(i,e)),d=fe(e,null!=(o=t.dataKey)?o:r.dataKey),u=!(!c||"number"!=typeof d||pm(d))&&c.length?bk(c.flatMap(t=>{var r,n,i=fe(e,t.dataKey);if(Array.isArray(i)?[r,n]=i:r=n=i,m6(r)&&m6(n))return[d-r,d+n]})):[];if(u.length>=2){var h=Math.min(...u),p=Math.max(...u);(null==a||h<a)&&(a=h),(null==s||p>s)&&(s=p)}var m=bN(d);null!=m&&(a=null==a?m[0]:Math.min(a,m[0]),s=null==s?m[1]:Math.max(s,m[1]))})}),(null==t?void 0:t.dataKey)!=null&&e.forEach(e=>{var r=bN(fe(e,t.dataKey));null!=r&&(a=null==a?r[0]:Math.min(a,r[0]),s=null==s?r[1]:Math.max(s,r[1]))}),m6(a)&&m6(s))return[a,s]},bF=hy([bg,bi,bm,bz,vW],bR,{memoizeOptions:{resultEqualityCheck:vG}});function b$(e){var{value:t}=e;if(py(t)||t instanceof Date)return t}var bB=e=>e.referenceElements.dots,bU=(e,t,r)=>e.filter(e=>"extendDomain"===e.ifOverflow).filter(e=>"xAxis"===t?e.xAxisId===r:e.yAxisId===r),bq=hy([bB,vW,vH],bU),bV=e=>e.referenceElements.areas,bK=hy([bV,vW,vH],bU),bW=e=>e.referenceElements.lines,bH=hy([bW,vW,vH],bU),bQ=(e,t)=>{if(null!=e){var r=bk(e.map(e=>"xAxis"===t?e.x:e.y));if(0!==r.length)return[Math.min(...r),Math.max(...r)]}},bY=hy(bq,vW,bQ),bX=(e,t)=>{if(null!=e){var r=bk(e.flatMap(e=>["xAxis"===t?e.x1:e.y1,"xAxis"===t?e.x2:e.y2]));if(0!==r.length)return[Math.min(...r),Math.max(...r)]}},bG=hy([bK,vW],bX),bZ=(e,t)=>{if(null!=e){var r=e.flatMap(e=>"xAxis"===t?function(e){if(null!=e.x)return bk([e.x]);var t,r=null==(t=e.segment)?void 0:t.map(e=>e.x);return null==r||0===r.length?[]:bk(r)}(e):function(e){if(null!=e.y)return bk([e.y]);var t,r=null==(t=e.segment)?void 0:t.map(e=>e.y);return null==r||0===r.length?[]:bk(r)}(e));if(0!==r.length)return[Math.min(...r),Math.max(...r)]}},bJ=hy([bH,vW],bZ),b0=hy(bY,bJ,bG,(e,t,r)=>bL(e,r,t)),b1=(e,t,r,n,i,a,s,l)=>null!=r?r:function(e,t,r){if(r||null!=t){if("function"==typeof e&&null!=t)try{var n=e(t,r);if(va(n))return vs(n,t,r)}catch(e){}if(Array.isArray(e)&&2===e.length){var i,a,[s,l]=e;if("auto"===s)null!=t&&(i=Math.min(...t));else if(px(s))i=s;else if("function"==typeof s)try{null!=t&&(i=s(null==t?void 0:t[0]))}catch(e){}else if("string"==typeof s&&fi.test(s)){var o=fi.exec(s);if(null==o||null==o[1]||null==t)i=void 0;else{var c=+o[1];i=t[0]-c}}else i=null==t?void 0:t[0];if("auto"===l)null!=t&&(a=Math.max(...t));else if(px(l))a=l;else if("function"==typeof l)try{null!=t&&(a=l(null==t?void 0:t[1]))}catch(e){}else if("string"==typeof l&&fa.test(l)){var d=fa.exec(l);if(null==d||null==d[1]||null==t)a=void 0;else{var u=+d[1];a=t[1]+u}}else a=null==t?void 0:t[1];var h=[i,a];if(va(h))return null==t?h:vs(h,t,r)}}}(t,"vertical"===s&&"xAxis"===l||"horizontal"===s&&"yAxis"===l?bL(n,a,i):bL(a,i),e.allowDataOverflow),b2=hy([bi,b_,bD,bI,bF,b0,fK,vW],b1,{memoizeOptions:{resultEqualityCheck:vG}}),b5=[0,1],b4=(e,t,r,n,i,a,s)=>{if(null!=e&&null!=r&&0!==r.length||void 0!==s){var l,o,{dataKey:c,type:d}=e,u=ft(t,a);return u&&null==c?(0,fY.default)(0,null!=(o=null==r?void 0:r.length)?o:0):"category"===d?(l=n.map(b$).filter(e=>null!=e),u&&(null==e.dataKey||e.allowDuplicatedCategory&&pj(l))?(0,fY.default)(0,n.length):e.allowDuplicatedCategory?l:Array.from(new Set(l))):"expand"===i?b5:s}},b3=hy([bi,fK,bg,bb,vg,vW,b2],b4),b6=(e,t,r)=>{if(null!=e){var{scale:n,type:i}=e;if("auto"===n)return"category"===i&&r&&(r.indexOf("LineChart")>=0||r.indexOf("AreaChart")>=0||r.indexOf("ComposedChart")>=0&&!t)?"point":"category"===i?"band":"linear";if("string"==typeof n){var a="scale".concat(pN(n));return a in vt?a:"point"}}},b8=hy([bi,bs,vb],b6);function b7(e,t,r,n){if(null!=r&&null!=n)return"function"==typeof e.scale?v2(e.scale,r,n):v2(t,r,n)}var b9=(e,t,r)=>{var n=bT(t);if("auto"===r||"linear"===r){if(null!=t&&t.tickCount&&Array.isArray(n)&&("auto"===n[0]||"auto"===n[1])&&va(e))return vm(e,t.tickCount,t.allowDecimals);if(null!=t&&t.tickCount&&"number"===t.type&&va(e))return vf(e,t.tickCount,t.allowDecimals)}},je=hy([b3,ba,b8],b9),jt=(e,t,r,n)=>{if("angleAxis"!==n&&(null==e?void 0:e.type)==="number"&&va(t)&&Array.isArray(r)&&r.length>0){var i,a;return[Math.min(t[0],null!=(i=r[0])?i:0),Math.max(t[1],null!=(a=r[r.length-1])?a:0)]}return t},jr=hy([bi,b3,je,vW],jt),jn=hy(bb,bi,(e,t)=>{if(t&&"number"===t.type){var r=1/0,n=Array.from(bk(e.map(e=>e.value))).sort((e,t)=>e-t),i=n[0],a=n[n.length-1];if(null==i||null==a)return 1/0;var s=a-i;if(0===s)return 1/0;for(var l=0;l<n.length-1;l++){var o=n[l],c=n[l+1];null!=o&&null!=c&&(r=Math.min(r,c-o))}return r/s}}),ji=hy(jn,fK,vy,fy,(e,t,r,n,i)=>i,(e,t,r,n,i)=>{if(!m6(e))return 0;var a="vertical"===t?n.height:n.width;if("gap"===i)return e*a/2;if("no-gap"===i){var s=pb(r,e*a),l=e*a/2;return l-s-(l-s)/a*s}return 0}),ja=hy(v7,(e,t,r)=>{var n=v7(e,t);return null==n||"string"!=typeof n.padding?0:ji(e,"xAxis",t,r,n.padding)},(e,t)=>{if(null==e)return{left:0,right:0};var r,n,{padding:i}=e;return"string"==typeof i?{left:t,right:t}:{left:(null!=(r=i.left)?r:0)+t,right:(null!=(n=i.right)?n:0)+t}}),js=hy(bt,(e,t,r)=>{var n=bt(e,t);return null==n||"string"!=typeof n.padding?0:ji(e,"yAxis",t,r,n.padding)},(e,t)=>{if(null==e)return{top:0,bottom:0};var r,n,{padding:i}=e;return"string"==typeof i?{top:t,bottom:t}:{top:(null!=(r=i.top)?r:0)+t,bottom:(null!=(n=i.bottom)?n:0)+t}}),jl=hy([fy,ja,fN,fw,(e,t,r)=>r],(e,t,r,n,i)=>{var{padding:a}=n;return i?[a.left,r.width-a.right]:[e.left+t.left,e.left+e.width-t.right]}),jo=hy([fy,fK,js,fN,fw,(e,t,r)=>r],(e,t,r,n,i,a)=>{var{padding:s}=i;return a?[n.height-s.bottom,s.top]:"horizontal"===t?[e.top+e.height-r.bottom,e.top+r.top]:[e.top+r.top,e.top+e.height-r.bottom]}),jc=(e,t,r,n)=>{var i;switch(t){case"xAxis":return jl(e,r,n);case"yAxis":return jo(e,r,n);case"zAxis":return null==(i=bn(e,r))?void 0:i.range;case"angleAxis":return vq(e);case"radiusAxis":return vV(e,r);default:return}},jd=hy([bi,jc],vM),ju=hy([b8,jr],(e,t)=>{if(null!=t)if("linear"!==e)return t;else{if(!va(t)){for(var r,n,i=0;i<t.length;i++){var a=t[i];m6(a)&&((void 0===r||a<r)&&(r=a),(void 0===n||a>n)&&(n=a))}return void 0!==r&&void 0!==n?[r,n]:void 0}return t}}),jh=hy([bi,b8,ju,jd],b7);function jp(e,t){return e.id<t.id?-1:+(e.id>t.id)}hy([bu,bz,vW],(e,t,r)=>e.flatMap(e=>t[e.id]).filter(Boolean).filter(e=>bj(r,e)));var jm=(e,t)=>t,jf=(e,t,r)=>r,jx=hy(fp,jm,jf,(e,t,r)=>e.filter(e=>e.orientation===t).filter(e=>e.mirror===r).sort(jp)),jy=hy(fm,jm,jf,(e,t,r)=>e.filter(e=>e.orientation===t).filter(e=>e.mirror===r).sort(jp)),jg=(e,t)=>({width:e.width,height:t.height}),jv=hy(fy,v7,jg),jb=hy(fd,fy,jx,jm,jf,(e,t,r,n,i)=>{var a,s={};return r.forEach(r=>{var l=jg(t,r);null==a&&(a=((e,t,r)=>{switch(t){case"top":return e.top;case"bottom":return r-e.bottom;default:return 0}})(t,n,e));var o="top"===n&&!i||"bottom"===n&&i;s[r.id]=a-Number(o)*l.height,a+=(o?-1:1)*l.height}),s}),jj=hy(fc,fy,jy,jm,jf,(e,t,r,n,i)=>{var a,s={};return r.forEach(r=>{var l={width:"number"==typeof r.width?r.width:60,height:t.height};null==a&&(a=((e,t,r)=>{switch(t){case"left":return e.left;case"right":return r-e.right;default:return 0}})(t,n,e));var o="left"===n&&!i||"right"===n&&i;s[r.id]=a-Number(o)*l.width,a+=(o?-1:1)*l.width}),s}),jw=hy([fy,v7,(e,t)=>{var r=v7(e,t);if(null!=r)return jb(e,r.orientation,r.mirror)},(e,t)=>t],(e,t,r,n)=>{if(null!=t){var i=null==r?void 0:r[n];return null==i?{x:e.left,y:0}:{x:e.left,y:i}}}),jN=hy([fy,bt,(e,t)=>{var r=bt(e,t);if(null!=r)return jj(e,r.orientation,r.mirror)},(e,t)=>t],(e,t,r,n)=>{if(null!=t){var i=null==r?void 0:r[n];return null==i?{x:0,y:e.top}:{x:i,y:e.top}}}),jk=hy(fy,bt,(e,t)=>({width:"number"==typeof t.width?t.width:60,height:e.height})),jS=(e,t,r)=>{switch(t){case"xAxis":return jv(e,r).width;case"yAxis":return jk(e,r).height;default:return}},jO=(e,t,r,n)=>{if(null!=r){var{allowDuplicatedCategory:i,type:a,dataKey:s}=r,l=ft(e,n),o=t.map(e=>e.value);if(s&&l&&"category"===a&&i&&pj(o))return o}},jP=hy([fK,bb,bi,vW],jO),jC=(e,t,r,n)=>{if(null!=r&&null!=r.dataKey){var{type:i,scale:a}=r;if(ft(e,n)&&("number"===i||"auto"!==a))return t.map(e=>e.value)}},jA=hy([fK,bb,ba,vW],jC);hy([fK,(e,t,r)=>{switch(t){case"xAxis":return v7(e,r);case"yAxis":return bt(e,r);default:throw Error("Unexpected axis type: ".concat(t))}},b8,jh,jP,jA,jc,je,vW],(e,t,r,n,i,a,s,l,o)=>{if(null!=t){var c=ft(e,o);return{angle:t.angle,interval:t.interval,minTickGap:t.minTickGap,orientation:t.orientation,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit,axisType:o,categoricalDomain:a,duplicateDomain:i,isCategorical:c,niceTicks:l,range:s,realScaleType:r,scale:n}}});var jE=hy([fK,ba,b8,jh,je,jc,jP,jA,vW],(e,t,r,n,i,a,s,l,o)=>{if(null!=t&&null!=n){var c=ft(e,o),{type:d,ticks:u,tickCount:h}=t,p="scaleBand"===r&&"function"==typeof n.bandwidth?n.bandwidth()/2:2,m="category"===d&&n.bandwidth?n.bandwidth()/p:0;m="angleAxis"===o&&null!=a&&a.length>=2?2*pp(a[0]-a[1])*m:m;var f=u||i;return f?f.map((e,t)=>{var r=s?s.indexOf(e):e,i=n.map(r);return m6(i)?{index:t,coordinate:i+m,value:e,offset:m}:null}).filter(pk):c&&l?l.map((e,t)=>{var r=n.map(e);return m6(r)?{coordinate:r+m,value:e,index:t,offset:m}:null}).filter(pk):n.ticks?n.ticks(h).map((e,t)=>{var r=n.map(e);return m6(r)?{coordinate:r+m,value:e,index:t,offset:m}:null}).filter(pk):n.domain().map((e,t)=>{var r=n.map(e);return m6(r)?{coordinate:r+m,value:s?s[e]:e,index:t,offset:m}:null}).filter(pk)}}),jM=hy([fK,ba,jh,jc,jP,jA,vW],(e,t,r,n,i,a,s)=>{if(null!=t&&null!=r&&null!=n&&n[0]!==n[1]){var l=ft(e,s),{tickCount:o}=t,c=0;return(c="angleAxis"===s&&(null==n?void 0:n.length)>=2?2*pp(n[0]-n[1])*c:c,l&&a)?a.map((e,t)=>{var n=r.map(e);return m6(n)?{coordinate:n+c,value:e,index:t,offset:c}:null}).filter(pk):r.ticks?r.ticks(o).map((e,t)=>{var n=r.map(e);return m6(n)?{coordinate:n+c,value:e,index:t,offset:c}:null}).filter(pk):r.domain().map((e,t)=>{var n=r.map(e);return m6(n)?{coordinate:n+c,value:i?i[e]:e,index:t,offset:c}:null}).filter(pk)}}),jT=hy(bi,jh,(e,t)=>{if(null!=e&&null!=t)return v4(v4({},e),{},{scale:t})}),j_=hy([bi,b8,b3,jd],b7);hy((e,t,r)=>bn(e,r),j_,(e,t)=>{if(null!=e&&null!=t)return v4(v4({},e),{},{scale:t})});var jD=hy([fK,fp,fm],(e,t,r)=>{switch(e){case"horizontal":return t.some(e=>e.reversed)?"right-to-left":"left-to-right";case"vertical":return r.some(e=>e.reversed)?"bottom-to-top":"top-to-bottom";case"centric":case"radial":return"left-to-right";default:return}}),jI=e=>e.options.defaultTooltipEventType,jz=e=>e.options.validateTooltipEventTypes;function jL(e,t,r){if(null==e)return t;var n=e?"axis":"item";return null==r?t:r.includes(n)?n:t}function jR(e,t){return jL(t,jI(e),jz(e))}var jF=(e,t)=>{var r,n=Number(t);if(!pm(n)&&null!=t)return n>=0?null==e||null==(r=e[n])?void 0:r.value:void 0};function j$(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function jB(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?j$(Object(r),!0).forEach(function(t){var n,i,a;n=e,i=t,a=r[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in n?Object.defineProperty(n,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):n[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):j$(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var jU=(e,t,r,n)=>{if(null==t)return my;var i,a,s,l=(i=e,a=t,s=r,"axis"===a?"click"===s?i.axisInteraction.click:i.axisInteraction.hover:"click"===s?i.itemInteraction.click:i.itemInteraction.hover);if(null==l)return my;if(l.active)return l;if(e.keyboardInteraction.active)return e.keyboardInteraction;if(e.syncInteraction.active&&null!=e.syncInteraction.index)return e.syncInteraction;var o=!0===e.settings.active;if(null!=l.index){if(o)return jB(jB({},l),{},{active:!0})}else if(null!=n)return{active:!0,coordinate:void 0,dataKey:void 0,index:n,graphicalItemId:void 0};return jB(jB({},my),{},{coordinate:l.coordinate})},jq=(e,t,r,n)=>{var i=null==e?void 0:e.index;if(null==i)return null;var a=Number(i);if(!m6(a))return i;var s=Infinity;t.length>0&&(s=t.length-1);var l=Math.max(0,Math.min(a,s)),o=t[l];return null==o?String(l):!function(e,t,r){if(null==r||null==t)return!0;var n=fe(e,t);return!(null!=n&&va(r))||function(e,t){var r=function(e){if("number"==typeof e)return Number.isFinite(e)?e:void 0;if(e instanceof Date){var t=e.valueOf();return Number.isFinite(t)?t:void 0}var r=Number(e);return Number.isFinite(r)?r:void 0}(e),n=t[0],i=t[1];if(void 0===r)return!1;var a=Math.min(n,i),s=Math.max(n,i);return r>=a&&r<=s}(n,r)}(o,r,n)?null:String(l)},jV=(e,t,r,n,i,a,s)=>{if(null!=a){var l=s[0],o=null==l?void 0:l.getPosition(a);if(null!=o)return o;var c=null==i?void 0:i[Number(a)];if(c)if("horizontal"===r)return{x:c.coordinate,y:(n.top+t)/2};else return{x:(n.left+e)/2,y:c.coordinate}}},jK=(e,t,r,n)=>{if("axis"===t)return e.tooltipItemPayloads;if(0===e.tooltipItemPayloads.length)return[];if(null==(i="hover"===r?e.itemInteraction.hover.graphicalItemId:e.itemInteraction.click.graphicalItemId)&&null!=n){var i,a=e.tooltipItemPayloads[0];return null!=a?[a]:[]}return e.tooltipItemPayloads.filter(e=>{var t;return(null==(t=e.settings)?void 0:t.graphicalItemId)===i})},jW=e=>e.options.tooltipPayloadSearcher,jH=e=>e.tooltip;function jQ(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function jY(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?jQ(Object(r),!0).forEach(function(t){var n,i,a;n=e,i=t,a=r[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in n?Object.defineProperty(n,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):n[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):jQ(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var jX=(e,t,r,n,i,a,s)=>{if(null!=t&&null!=a){var{chartData:l,computedData:o,dataStartIndex:c,dataEndIndex:d}=r;return e.reduce((e,r)=>{var u,h,p,{dataDefinedOnItem:m,settings:f}=r,x=null!=m?m:l,y=Array.isArray(x)?m3(x,c,d):x,g=null!=(u=null==f?void 0:f.dataKey)?u:n,v=null==f?void 0:f.nameKey;return Array.isArray(h=n&&Array.isArray(y)&&!Array.isArray(y[0])&&"axis"===s?function(e,t,r){if(e&&e.length)return e.find(e=>e&&("function"==typeof t?t(e):(0,pd.default)(e,t))===r)}(y,n,i):a(y,t,o,v))?h.forEach(t=>{var r=jY(jY({},f),{},{name:t.name,unit:t.unit,color:void 0,fill:void 0});e.push(fl({tooltipEntrySettings:r,dataKey:t.dataKey,payload:t.payload,value:fe(t.payload,t.dataKey),name:t.name}))}):e.push(fl({tooltipEntrySettings:f,dataKey:g,payload:h,value:fe(h,g),name:null!=(p=fe(h,v))?p:null==f?void 0:f.name})),e},[])}},jG=hy([bS,bs,vb],b6),jZ=hy([e=>e.graphicalItems.cartesianItems,e=>e.graphicalItems.polarItems],(e,t)=>[...e,...t]),jJ=hy([vJ,v0],bl),j0=hy([jZ,bS,jJ],bd,{memoizeOptions:{resultEqualityCheck:vZ}}),j1=hy([j0],e=>e.filter(vX)),j2=hy([j0],bf,{memoizeOptions:{resultEqualityCheck:vZ}}),j5=hy([j2,vr],by),j4=hy([j1,vr,bS],vY),j3=hy([j5,bS,j0],bv),j6=hy([bS],bT),j8=hy([bS],e=>e.allowDataOverflow),j7=hy([j6,j8],vl),j9=hy([j0],e=>e.filter(vX)),we=hy([j4,j9,vg,vv],bC),wt=hy([we,vr,vJ,j7],bE),wr=hy([j0],bp),wn=hy([j5,bS,wr,bz,vJ],bR,{memoizeOptions:{resultEqualityCheck:vG}}),wi=hy([bB,vJ,v0],bU),wa=hy([wi,vJ],bQ),ws=hy([bV,vJ,v0],bU),wl=hy([ws,vJ],bX),wo=hy([bW,vJ,v0],bU),wc=hy([wo,vJ],bZ),wd=hy([wa,wc,wl],bL),wu=hy([bS,j6,j7,wt,wn,wd,fK,vJ],b1),wh=hy([bS,fK,j5,j3,vg,vJ,wu],b4),wp=hy([wh,bS,jG],b9),wm=hy([bS,wh,wp,vJ],jt),wf=e=>{var t=vJ(e),r=v0(e);return jc(e,t,r,!1)},wx=hy([bS,wf],vM),wy=hy([bS,jG,wm,wx],b7),wg=hy([fK,j3,bS,vJ],jO),wv=hy([fK,j3,bS,vJ],jC),wb=hy([fK,bS,jG,wy,wf,wg,wv,vJ],(e,t,r,n,i,a,s,l)=>{if(t){var{type:o}=t,c=ft(e,l);if(n){var d="scaleBand"===r&&n.bandwidth?n.bandwidth()/2:2,u="category"===o&&n.bandwidth?n.bandwidth()/d:0;return(u="angleAxis"===l&&null!=i&&(null==i?void 0:i.length)>=2?2*pp(i[0]-i[1])*u:u,c&&s)?s.map((e,t)=>{var r=n.map(e);return m6(r)?{coordinate:r+u,value:e,index:t,offset:u}:null}).filter(pk):n.domain().map((e,t)=>{var r=n.map(e);return m6(r)?{coordinate:r+u,value:a?a[e]:e,index:t,offset:u}:null}).filter(pk)}}}),wj=hy([jI,jz,e=>e.tooltip.settings],(e,t,r)=>jL(r.shared,e,t)),ww=e=>e.tooltip.settings.trigger,wN=e=>e.tooltip.settings.defaultIndex,wk=hy([jH,wj,ww,wN],jU),wS=hy([wk,j5,bO,wh],jq),wO=hy([wb,wS],jF),wP=hy([wk],e=>{if(e)return e.dataKey});hy([wk],e=>{if(e)return e.graphicalItemId});var wC=hy([jH,wj,ww,wN],jK),wA=hy([fc,fd,fK,fy,wb,wN,wC],jV),wE=hy([wk,wA],(e,t)=>null!=e&&e.coordinate?e.coordinate:t),wM=hy([wk],e=>{var t;return null!=(t=null==e?void 0:e.active)&&t}),wT=hy([wC,wS,vr,bO,wO,jW,wj],jX);function w_(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function wD(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?w_(Object(r),!0).forEach(function(t){var n,i,a;n=e,i=t,a=r[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in n?Object.defineProperty(n,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):n[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):w_(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}hy([wT],e=>{if(null!=e)return Array.from(new Set(e.map(e=>e.payload).filter(e=>null!=e)))});var wI=(e,t,r,n,i)=>{var a=null!=(u=null==t?void 0:t.length)?u:0;if(a<=1||null==e)return 0;if("angleAxis"===n&&null!=i&&1e-6>=Math.abs(Math.abs(i[1]-i[0])-360))for(var s=0;s<a;s++){var l=s>0?null==(h=r[s-1])?void 0:h.coordinate:null==(p=r[a-1])?void 0:p.coordinate,o=null==(m=r[s])?void 0:m.coordinate,c=s>=a-1?null==(f=r[0])?void 0:f.coordinate:null==(x=r[s+1])?void 0:x.coordinate,d=void 0;if(null!=l&&null!=o&&null!=c)if(pp(o-l)!==pp(c-o)){var u,h,p,m,f,x,y,g=[];if(pp(c-o)===pp(i[1]-i[0])){d=c;var v=o+i[1]-i[0];g[0]=Math.min(v,(v+l)/2),g[1]=Math.max(v,(v+l)/2)}else{d=l;var b=c+i[1]-i[0];g[0]=Math.min(o,(b+o)/2),g[1]=Math.max(o,(b+o)/2)}var j=[Math.min(o,(d+o)/2),Math.max(o,(d+o)/2)];if(e>j[0]&&e<=j[1]||e>=g[0]&&e<=g[1])return null==(y=r[s])?void 0:y.index}else{var w,N=Math.min(l,c),k=Math.max(l,c);if(e>(N+o)/2&&e<=(k+o)/2)return null==(w=r[s])?void 0:w.index}}else if(t)for(var S=0;S<a;S++){var O=t[S];if(null!=O){var P=t[S+1],C=t[S-1];if(0===S&&null!=P&&e<=(O.coordinate+P.coordinate)/2||S===a-1&&null!=C&&e>(O.coordinate+C.coordinate)/2||S>0&&S<a-1&&null!=C&&null!=P&&e>(O.coordinate+C.coordinate)/2&&e<=(O.coordinate+P.coordinate)/2)return O.index}}return -1},wz=(e,t)=>t,wL=(e,t,r)=>r,wR=(e,t,r,n)=>n,wF=hy(wb,e=>(0,mG.default)(e,e=>e.coordinate)),w$=hy([jH,wz,wL,wR],jU),wB=hy([w$,j5,bO,wh],jq),wU=hy([jH,wz,wL,wR],jK),wq=hy([fc,fd,fK,fy,wb,wR,wU],jV),wV=hy([w$,wq],(e,t)=>{var r;return null!=(r=e.coordinate)?r:t}),wK=hy([wb,wB],jF),wW=hy([wU,wB,vr,bO,wK,jW,wz],jX),wH=hy([w$,wB],(e,t)=>({isActive:e.active&&null!=t,activeIndex:t})),wQ=hy([(e,t)=>t,fK,vK,vJ,wx,wb,wF,fy],(e,t,r,n,i,a,s,l)=>{if(e&&t&&n&&i&&a){if("horizontal"===t||"vertical"===t){if(!e||!n||!i||!a)return;if(function(e,t){var{chartX:r,chartY:n}=e;return r>=t.left&&r<=t.left+t.width&&n>=t.top&&n<=t.top+t.height}(e,l)){var o=wI("horizontal"===t?e.chartX:"vertical"===t?e.chartY:void 0,s,a,n,i),c=((e,t,r,n)=>{var i=t.find(e=>e&&e.index===r);if(i){if("horizontal"===e)return{x:i.coordinate,y:n.chartY};if("vertical"===e)return{x:n.chartX,y:i.coordinate}}return{x:0,y:0}})(t,a,o,e);return{activeIndex:String(o),activeCoordinate:c}}return}if(e&&n&&i&&a&&r){var d=((e,t)=>{var r,{chartX:n,chartY:i}=e,{radius:a,angle:s}=((e,t)=>{var{x:r,y:n}=e,{cx:i,cy:a}=t,s=((e,t)=>{var{x:r,y:n}=e,{x:i,y:a}=t;return Math.sqrt((r-i)**2+(n-a)**2)})({x:r,y:n},{x:i,y:a});if(s<=0)return{radius:s,angle:0};var l=Math.acos((r-i)/s);return n>a&&(l=2*Math.PI-l),{radius:s,angle:180*l/Math.PI,angleInRadian:l}})({x:n,y:i},t),{innerRadius:l,outerRadius:o}=t;if(a<l||a>o||0===a)return null;var{startAngle:c,endAngle:d}=(e=>{var{startAngle:t,endAngle:r}=e,n=Math.min(Math.floor(t/360),Math.floor(r/360));return{startAngle:t-360*n,endAngle:r-360*n}})(t),u=s;if(c<=d){for(;u>d;)u-=360;for(;u<c;)u+=360;r=u>=c&&u<=d}else{for(;u>c;)u-=360;for(;u<d;)u+=360;r=u>=d&&u<=c}return r?vS(vS({},t),{},{radius:a,angle:((e,t)=>{var{startAngle:r,endAngle:n}=t;return e+360*Math.min(Math.floor(r/360),Math.floor(n/360))})(u,t)}):null})(e,r);if(d){var u=wI("centric"===t?d.angle:d.radius,s,a,n,i),h=((e,t,r,n)=>{var i=t.find(e=>e&&e.index===r);if(i){if("centric"===e){var a=i.coordinate,{radius:s}=n;return wD(wD(wD({},n),vP(n.cx,n.cy,s,a)),{},{angle:a,radius:s})}var l=i.coordinate,{angle:o}=n;return wD(wD(wD({},n),vP(n.cx,n.cy,l,o)),{},{angle:o,radius:l})}return{angle:0,clockWise:!1,cx:0,cy:0,endAngle:0,innerRadius:0,outerRadius:0,radius:0,startAngle:0,x:0,y:0}})(t,a,u,d);return{activeIndex:String(u),activeCoordinate:h}}return}}}),wY=e=>{var t=e.currentTarget.getBoundingClientRect(),r=t.width/e.currentTarget.offsetWidth,n=t.height/e.currentTarget.offsetHeight;return{chartX:Math.round((e.clientX-t.left)/r),chartY:Math.round((e.clientY-t.top)/n)}},wX=hE("mouseClick"),wG=po();wG.startListening({actionCreator:wX,effect:(e,t)=>{var r=e.payload,n=wQ(t.getState(),wY(r));(null==n?void 0:n.activeIndex)!=null&&t.dispatch(mC({activeIndex:n.activeIndex,activeDataKey:void 0,activeCoordinate:n.activeCoordinate}))}});var wZ=hE("mouseMove"),wJ=po(),w0=null;function w1(e,t){return t instanceof HTMLElement?"HTMLElement <".concat(t.tagName,' class="').concat(t.className,'">'):t===window?"global.window":"children"===e&&"object"==typeof t&&null!==t?"<<CHILDREN>>":t}function w2(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function w5(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?w2(Object(r),!0).forEach(function(t){var n,i,a;n=e,i=t,a=r[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in n?Object.defineProperty(n,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):n[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):w2(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}wJ.startListening({actionCreator:wZ,effect:(e,t)=>{var r=e.payload;null!==w0&&cancelAnimationFrame(w0);var n=wY(r);w0=requestAnimationFrame(()=>{var e=t.getState();if("axis"===jR(e,e.tooltip.settings.shared)){var r=wQ(e,n);(null==r?void 0:r.activeIndex)!=null?t.dispatch(mP({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate})):t.dispatch(mS())}w0=null})}});var w4=hB({name:"cartesianAxis",initialState:{xAxis:{},yAxis:{},zAxis:{}},reducers:{addXAxis:{reducer(e,t){e.xAxis[t.payload.id]=t.payload},prepare:hI()},replaceXAxis:{reducer(e,t){var{prev:r,next:n}=t.payload;void 0!==e.xAxis[r.id]&&(r.id!==n.id&&delete e.xAxis[r.id],e.xAxis[n.id]=n)},prepare:hI()},removeXAxis:{reducer(e,t){delete e.xAxis[t.payload.id]},prepare:hI()},addYAxis:{reducer(e,t){e.yAxis[t.payload.id]=t.payload},prepare:hI()},replaceYAxis:{reducer(e,t){var{prev:r,next:n}=t.payload;void 0!==e.yAxis[r.id]&&(r.id!==n.id&&delete e.yAxis[r.id],e.yAxis[n.id]=n)},prepare:hI()},removeYAxis:{reducer(e,t){delete e.yAxis[t.payload.id]},prepare:hI()},addZAxis:{reducer(e,t){e.zAxis[t.payload.id]=t.payload},prepare:hI()},replaceZAxis:{reducer(e,t){var{prev:r,next:n}=t.payload;void 0!==e.zAxis[r.id]&&(r.id!==n.id&&delete e.zAxis[r.id],e.zAxis[n.id]=n)},prepare:hI()},removeZAxis:{reducer(e,t){delete e.zAxis[t.payload.id]},prepare:hI()},updateYAxisWidth(e,t){var{id:r,width:n}=t.payload,i=e.yAxis[r];if(i){var a,s=i.widthHistory||[];if(3===s.length&&s[0]===s[2]&&n===s[1]&&n!==i.width&&1>=Math.abs(n-(null!=(a=s[0])?a:0)))return;var l=[...s,n].slice(-3);e.yAxis[r]=w5(w5({},i),{},{width:n,widthHistory:l})}}}}),{addXAxis:w3,replaceXAxis:w6,removeXAxis:w8,addYAxis:w7,replaceYAxis:w9,removeYAxis:Ne,addZAxis:Nt,replaceZAxis:Nr,removeZAxis:Nn,updateYAxisWidth:Ni}=w4.actions,Na=w4.reducer,Ns=hB({name:"graphicalItems",initialState:{cartesianItems:[],polarItems:[]},reducers:{addCartesianGraphicalItem:{reducer(e,t){e.cartesianItems.push(t.payload)},prepare:hI()},replaceCartesianGraphicalItem:{reducer(e,t){var{prev:r,next:n}=t.payload,i=u7(e).cartesianItems.indexOf(r);i>-1&&(e.cartesianItems[i]=n)},prepare:hI()},removeCartesianGraphicalItem:{reducer(e,t){var r=u7(e).cartesianItems.indexOf(t.payload);r>-1&&e.cartesianItems.splice(r,1)},prepare:hI()},addPolarGraphicalItem:{reducer(e,t){e.polarItems.push(t.payload)},prepare:hI()},removePolarGraphicalItem:{reducer(e,t){var r=u7(e).polarItems.indexOf(t.payload);r>-1&&e.polarItems.splice(r,1)},prepare:hI()}}}),{addCartesianGraphicalItem:Nl,replaceCartesianGraphicalItem:No,removeCartesianGraphicalItem:Nc,addPolarGraphicalItem:Nd,removePolarGraphicalItem:Nu}=Ns.actions,Nh=Ns.reducer,Np=hB({name:"referenceElements",initialState:{dots:[],areas:[],lines:[]},reducers:{addDot:(e,t)=>{e.dots.push(t.payload)},removeDot:(e,t)=>{var r=u7(e).dots.findIndex(e=>e===t.payload);-1!==r&&e.dots.splice(r,1)},addArea:(e,t)=>{e.areas.push(t.payload)},removeArea:(e,t)=>{var r=u7(e).areas.findIndex(e=>e===t.payload);-1!==r&&e.areas.splice(r,1)},addLine:(e,t)=>{e.lines.push(t.payload)},removeLine:(e,t)=>{var r=u7(e).lines.findIndex(e=>e===t.payload);-1!==r&&e.lines.splice(r,1)}}}),{addDot:Nm,removeDot:Nf,addArea:Nx,removeArea:Ny,addLine:Ng,removeLine:Nv}=Np.actions,Nb=Np.reducer,Nj={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},Nw=hB({name:"brush",initialState:Nj,reducers:{setBrushSettings:(e,t)=>null==t.payload?Nj:t.payload}}),{setBrushSettings:NN}=Nw.actions,Nk=Nw.reducer,NS=hB({name:"legend",initialState:{settings:{layout:"horizontal",align:"center",verticalAlign:"middle",itemSorter:"value"},size:{width:0,height:0},payload:[]},reducers:{setLegendSize(e,t){e.size.width=t.payload.width,e.size.height=t.payload.height},setLegendSettings(e,t){e.settings.align=t.payload.align,e.settings.layout=t.payload.layout,e.settings.verticalAlign=t.payload.verticalAlign,e.settings.itemSorter=t.payload.itemSorter},addLegendPayload:{reducer(e,t){e.payload.push(t.payload)},prepare:hI()},replaceLegendPayload:{reducer(e,t){var{prev:r,next:n}=t.payload,i=u7(e).payload.indexOf(r);i>-1&&(e.payload[i]=n)},prepare:hI()},removeLegendPayload:{reducer(e,t){var r=u7(e).payload.indexOf(t.payload);r>-1&&e.payload.splice(r,1)},prepare:hI()}}}),{setLegendSize:NO,setLegendSettings:NP,addLegendPayload:NC,replaceLegendPayload:NA,removeLegendPayload:NE}=NS.actions,NM=NS.reducer,NT={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,barSize:void 0,className:void 0,maxBarSize:void 0,stackOffset:"none",syncId:void 0,syncMethod:"index",baseValue:void 0,reverseStackOrder:!1},N_=hB({name:"rootProps",initialState:NT,reducers:{updateOptions:(e,t)=>{var r;e.accessibilityLayer=t.payload.accessibilityLayer,e.barCategoryGap=t.payload.barCategoryGap,e.barGap=null!=(r=t.payload.barGap)?r:NT.barGap,e.barSize=t.payload.barSize,e.maxBarSize=t.payload.maxBarSize,e.stackOffset=t.payload.stackOffset,e.syncId=t.payload.syncId,e.syncMethod=t.payload.syncMethod,e.className=t.payload.className,e.baseValue=t.payload.baseValue,e.reverseStackOrder=t.payload.reverseStackOrder}}}),ND=N_.reducer,{updateOptions:NI}=N_.actions,Nz=hB({name:"polarAxis",initialState:{radiusAxis:{},angleAxis:{}},reducers:{addRadiusAxis(e,t){e.radiusAxis[t.payload.id]=t.payload},removeRadiusAxis(e,t){delete e.radiusAxis[t.payload.id]},addAngleAxis(e,t){e.angleAxis[t.payload.id]=t.payload},removeAngleAxis(e,t){delete e.angleAxis[t.payload.id]}}}),{addRadiusAxis:NL,removeRadiusAxis:NR,addAngleAxis:NF,removeAngleAxis:N$}=Nz.actions,NB=Nz.reducer,NU=hB({name:"polarOptions",initialState:null,reducers:{updatePolarOptions:(e,t)=>t.payload}}),{updatePolarOptions:Nq}=NU.actions,NV=NU.reducer,NK=hE("keyDown"),NW=hE("focus"),NH=po();NH.startListening({actionCreator:NK,effect:(e,t)=>{var r=t.getState();if(!1===r.rootProps.accessibilityLayer)return;var{keyboardInteraction:n}=r.tooltip,i=e.payload;if("ArrowRight"===i||"ArrowLeft"===i||"Enter"===i){var a=jq(n,j5(r),bO(r),wh(r)),s=null==a?-1:Number(a);if(Number.isFinite(s)&&!(s<0)){var l=wb(r);if("Enter"===i){var o=wq(r,"axis","hover",String(n.index));t.dispatch(mE({active:!n.active,activeIndex:n.index,activeCoordinate:o}));return}var c=s+("ArrowRight"===i?1:-1)*("left-to-right"===jD(r)?1:-1);if(null!=l&&!(c>=l.length)&&!(c<0)){var d=wq(r,"axis","hover",String(c));t.dispatch(mE({active:!0,activeIndex:c.toString(),activeCoordinate:d}))}}}}}),NH.startListening({actionCreator:NW,effect:(e,t)=>{var r=t.getState();if(!1!==r.rootProps.accessibilityLayer){var{keyboardInteraction:n}=r.tooltip;if(!n.active&&null==n.index){var i=wq(r,"axis","hover",String("0"));t.dispatch(mE({active:!0,activeIndex:"0",activeCoordinate:i}))}}}});var NQ=hE("externalEvent"),NY=po(),NX=new Map;NY.startListening({actionCreator:NQ,effect:(e,t)=>{var{handler:r,reactEvent:n}=e.payload;if(null!=r){n.persist();var i=n.type,a=NX.get(i);void 0!==a&&cancelAnimationFrame(a);var s=requestAnimationFrame(()=>{try{var e=t.getState(),a={activeCoordinate:wE(e),activeDataKey:wP(e),activeIndex:wS(e),activeLabel:wO(e),activeTooltipIndex:wS(e),isTooltipActive:wM(e)};r(a,n)}finally{NX.delete(i)}});NX.set(i,s)}}});var NG=hy([jH],e=>e.tooltipItemPayloads),NZ=hy([NG,(e,t)=>t,(e,t,r)=>r],(e,t,r)=>{if(null!=t){var n=e.find(e=>e.settings.graphicalItemId===r);if(null!=n){var{getPosition:i}=n;if(null!=i)return i(t)}}}),NJ=hE("touchMove"),N0=po();N0.startListening({actionCreator:NJ,effect:(e,t)=>{var r=e.payload;if(null!=r.touches&&0!==r.touches.length){var n=t.getState(),i=jR(n,n.tooltip.settings.shared);if("axis"===i){var a=r.touches[0];if(null==a)return;var s=wQ(n,wY({clientX:a.clientX,clientY:a.clientY,currentTarget:r.currentTarget}));(null==s?void 0:s.activeIndex)!=null&&t.dispatch(mP({activeIndex:s.activeIndex,activeDataKey:void 0,activeCoordinate:s.activeCoordinate}))}else if("item"===i){var l,o=r.touches[0];if(null==document.elementFromPoint||null==o)return;var c=document.elementFromPoint(o.clientX,o.clientY);if(!c||!c.getAttribute)return;var d=c.getAttribute("data-recharts-item-index"),u=null!=(l=c.getAttribute("data-recharts-item-id"))?l:void 0,h=j0(n).find(e=>e.id===u);if(null==d||null==h||null==u)return;var{dataKey:p}=h,m=NZ(n,d,u);t.dispatch(mN({activeDataKey:p,activeIndex:d,activeCoordinate:m,activeGraphicalItemId:u}))}}}});var N1=hB({name:"errorBars",initialState:{},reducers:{addErrorBar:(e,t)=>{var{itemId:r,errorBar:n}=t.payload;e[r]||(e[r]=[]),e[r].push(n)},replaceErrorBar:(e,t)=>{var{itemId:r,prev:n,next:i}=t.payload;e[r]&&(e[r]=e[r].map(e=>e.dataKey===n.dataKey&&e.direction===n.direction?i:e))},removeErrorBar:(e,t)=>{var{itemId:r,errorBar:n}=t.payload;e[r]&&(e[r]=e[r].filter(e=>e.dataKey!==n.dataKey||e.direction!==n.direction))}}}),{addErrorBar:N2,replaceErrorBar:N5,removeErrorBar:N4}=N1.actions,N3=N1.reducer,N6={devToolsEnabled:!0,isSsr:!("u">typeof window&&window.document&&window.document.createElement&&window.setTimeout)};function N8(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function N7(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?N8(Object(r),!0).forEach(function(t){var n,i,a;n=e,i=t,a=r[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in n?Object.defineProperty(n,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):n[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):N8(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var N9={zIndexMap:Object.values(vC).reduce((e,t)=>N7(N7({},e),{},{[t]:{element:void 0,panoramaElement:void 0,consumers:0}}),{})},ke=new Set(Object.values(vC)),kt=hB({name:"zIndex",initialState:N9,reducers:{registerZIndexPortal:{reducer:(e,t)=>{var{zIndex:r}=t.payload;e.zIndexMap[r]?e.zIndexMap[r].consumers+=1:e.zIndexMap[r]={consumers:1,element:void 0,panoramaElement:void 0}},prepare:hI()},unregisterZIndexPortal:{reducer:(e,t)=>{var{zIndex:r}=t.payload;e.zIndexMap[r]&&(e.zIndexMap[r].consumers-=1,e.zIndexMap[r].consumers<=0&&!ke.has(r)&&delete e.zIndexMap[r])},prepare:hI()},registerZIndexPortalElement:{reducer:(e,t)=>{var{zIndex:r,element:n,isPanorama:i}=t.payload;e.zIndexMap[r]?i?e.zIndexMap[r].panoramaElement=n:e.zIndexMap[r].element=n:e.zIndexMap[r]={consumers:0,element:i?void 0:n,panoramaElement:i?n:void 0}},prepare:hI()},unregisterZIndexPortalElement:{reducer:(e,t)=>{var{zIndex:r}=t.payload;e.zIndexMap[r]&&(t.payload.isPanorama?e.zIndexMap[r].panoramaElement=void 0:e.zIndexMap[r].element=void 0)},prepare:hI()}}}),{registerZIndexPortal:kr,unregisterZIndexPortal:kn,registerZIndexPortalElement:ki,unregisterZIndexPortalElement:ka}=kt.actions,ks=hk({brush:Nk,cartesianAxis:Na,chartData:mz,errorBars:N3,graphicalItems:Nh,layout:mU,legend:NM,options:pC,polarAxis:NB,polarOptions:NV,referenceElements:Nb,rootProps:ND,tooltip:mM,zIndex:kt.reducer}),kl=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Chart";return function(e){let t,r,n,i=function(e){let{thunk:t=!0,immutableCheck:r=!0,serializableCheck:n=!0,actionCreatorCheck:i=!0}=e??{},a=new hM;return t&&("boolean"==typeof t?a.push(hC):a.push(hP(t.extraArgument))),a},{reducer:a,middleware:s,devTools:l=!0,duplicateMiddlewareCheck:o=!0,preloadedState:c,enhancers:d}=e||{};if("function"==typeof a)t=a;else if(hN(a))t=hk(a);else throw Error(pc(1));r="function"==typeof s?s(i):i();let u=hS;l&&(u=hA({trace:!1,..."object"==typeof l&&l}));let h=(n=function(...e){return t=>(r,n)=>{let i=t(r,n),a=()=>{throw Error(hv(15))},s={getState:i.getState,dispatch:(e,...t)=>a(e,...t)};return a=hS(...e.map(e=>e(s)))(i.dispatch),{...i,dispatch:a}}}(...r),function(e){let{autoBatch:t=!0}=e??{},r=new hM(n);return t&&r.push(hL("object"==typeof t?t:void 0)),r});return function e(t,r,n){if("function"!=typeof t)throw Error(hv(2));if("function"==typeof r&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw Error(hv(0));if("function"==typeof r&&void 0===n&&(n=r,r=void 0),void 0!==n){if("function"!=typeof n)throw Error(hv(1));return n(e)(t,r)}let i=t,a=r,s=new Map,l=s,o=0,c=!1;function d(){l===s&&(l=new Map,s.forEach((e,t)=>{l.set(t,e)}))}function u(){if(c)throw Error(hv(3));return a}function h(e){if("function"!=typeof e)throw Error(hv(4));if(c)throw Error(hv(5));let t=!0;d();let r=o++;return l.set(r,e),function(){if(t){if(c)throw Error(hv(6));t=!1,d(),l.delete(r),s=null}}}function p(e){if(!hN(e))throw Error(hv(7));if(void 0===e.type)throw Error(hv(8));if("string"!=typeof e.type)throw Error(hv(17));if(c)throw Error(hv(9));try{c=!0,a=i(a,e)}finally{c=!1}return(s=l).forEach(e=>{e()}),e}return p({type:hw.INIT}),{dispatch:p,subscribe:h,getState:u,replaceReducer:function(e){if("function"!=typeof e)throw Error(hv(10));i=e,p({type:hw.REPLACE})},[hb]:function(){return{subscribe(e){if("object"!=typeof e||null===e)throw Error(hv(11));function t(){e.next&&e.next(u())}return t(),{unsubscribe:h(t)}},[hb](){return this}}}}}(t,c,u(..."function"==typeof d?d(h):h()))}({reducer:ks,preloadedState:e,middleware:e=>e({serializableCheck:!1,immutableCheck:!["commonjs","es6","production"].includes("es6")}).concat([wG.middleware,wJ.middleware,NH.middleware,NY.middleware,N0.middleware]),enhancers:e=>{var t=e;return"function"==typeof e&&(t=e()),t.concat(hL({type:"raf"}))},devTools:N6.devToolsEnabled&&{serialize:{replacer:w1},name:"recharts-".concat(t)}})};function ko(e){var{preloadedState:t,children:r,reduxStoreName:n}=e,i=fj(),a=(0,H.useRef)(null);return i?r:(null==a.current&&(a.current=kl(t,n)),H.createElement(pR,{context:mV,store:a.current},r))}var kc=e=>{var{chartData:t}=e,r=mW(),n=fj();return(0,H.useEffect)(()=>n?()=>{}:(r(m_(t)),()=>{r(m_(void 0))}),[t,r,n]),null},kd=new Set(["axisLine","tickLine","activeBar","activeDot","activeLabel","activeShape","allowEscapeViewBox","background","cursor","dot","label","line","margin","padding","position","shape","style","tick","wrapperStyle","radius"]);function ku(e,t){for(var r of new Set([...Object.keys(e),...Object.keys(t)]))if(kd.has(r)){if(null==e[r]&&null==t[r])continue;if(!function(e,t){if(pD(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;let r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let n=0;n<r.length;n++)if(!Object.prototype.hasOwnProperty.call(t,r[n])||!pD(e[r[n]],t[r[n]]))return!1;return!0}(e[r],t[r]))return!1}else{var n,i;if(n=e[r],i=t[r],(null!=n||null!=i)&&("number"==typeof n&&"number"==typeof i?n!==i&&(n==n||i==i):n!==i))return!1}return!0}var kh=(0,H.memo)(function(e){var{layout:t,margin:r}=e,n=mW(),i=fj();return(0,H.useEffect)(()=>{i||(n(mF(t)),n(mR(r)))},[n,i,t,r]),null},ku);function kp(e){var t=mW();return(0,H.useEffect)(()=>{t(NI(e))},[t,e]),null}var km=()=>{var e;return null==(e=mX(e=>e.rootProps.accessibilityLayer))||e},kf=["dangerouslySetInnerHTML","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"];function kx(e){return"string"==typeof e&&kf.includes(e)}var ky=new Set(["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-flowto","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","className","color","height","id","lang","max","media","method","min","name","style","target","width","role","tabIndex","accentHeight","accumulate","additive","alignmentBaseline","allowReorder","alphabetic","amplitude","arabicForm","ascent","attributeName","attributeType","autoReverse","azimuth","baseFrequency","baselineShift","baseProfile","bbox","begin","bias","by","calcMode","capHeight","clip","clipPath","clipPathUnits","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRendering","contentScriptType","contentStyleType","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominantBaseline","dur","dx","dy","edgeMode","elevation","enableBackground","end","exponent","externalResourcesRequired","fill","fillOpacity","fillRule","filter","filterRes","filterUnits","floodColor","floodOpacity","focusable","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","format","from","fx","fy","g1","g2","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","gradientTransform","gradientUnits","hanging","horizAdvX","horizOriginX","href","ideographic","imageRendering","in2","in","intercept","k1","k2","k3","k4","k","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letterSpacing","lightingColor","limitingConeAngle","local","markerEnd","markerHeight","markerMid","markerStart","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overlinePosition","overlineThickness","paintOrder","panose1","pathLength","patternContentUnits","patternTransform","patternUnits","pointerEvents","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","renderingIntent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","seed","shapeRendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stopColor","stopOpacity","strikethroughPosition","strikethroughThickness","string","stroke","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","surfaceScale","systemLanguage","tableValues","targetX","targetY","textAnchor","textDecoration","textLength","textRendering","to","transform","u1","u2","underlinePosition","underlineThickness","unicode","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","values","vectorEffect","version","vertAdvY","vertOriginX","vertOriginY","vHanging","vIdeographic","viewTarget","visibility","vMathematical","widths","wordSpacing","writingMode","x1","x2","x","xChannelSelector","xHeight","xlinkActuate","xlinkArcrole","xlinkHref","xlinkRole","xlinkShow","xlinkTitle","xlinkType","xmlBase","xmlLang","xmlns","xmlnsXlink","xmlSpace","y1","y2","y","yChannelSelector","z","zoomAndPan","ref","key","angle"]);function kg(e){return"string"==typeof e&&ky.has(e)}function kv(e){return"string"==typeof e&&e.startsWith("data-")}function kb(e){if("object"!=typeof e||null===e)return{};var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(kg(r)||kv(r))&&(t[r]=e[r]);return t}function kj(e){return null==e?null:(0,H.isValidElement)(e)&&"object"==typeof e.props&&null!==e.props?kb(e.props):"object"!=typeof e||Array.isArray(e)?null:kb(e)}function kw(e){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(kg(r)||kv(r)||kx(r))&&(t[r]=e[r]);return t}var kN=["children","width","height","viewBox","className","style","title","desc"];function kk(){return(kk=Object.assign.bind()).apply(null,arguments)}var kS=(0,H.forwardRef)((e,t)=>{var{children:r,width:n,height:i,viewBox:a,className:s,style:l,title:o,desc:c}=e,d=function(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r={};for(var n in e)if(({}).hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;r[n]=e[n]}return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],-1===t.indexOf(r)&&({}).propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}(e,kN),u=a||{width:n,height:i,x:0,y:0},h=sb("recharts-surface",s);return H.createElement("svg",kk({},kw(d),{className:h,width:n,height:i,style:l,viewBox:"".concat(u.x," ").concat(u.y," ").concat(u.width," ").concat(u.height),ref:t}),H.createElement("title",null,o),H.createElement("desc",null,c),r)}),kO=hy(e=>e.zIndex.zIndexMap,(e,t)=>t,(e,t,r)=>r,(e,t,r)=>{if(null!=t){var n=e[t];if(null!=n)return r?n.panoramaElement:n.element}}),kP=hy(e=>e.zIndex.zIndexMap,e=>Array.from(new Set(Object.keys(e).map(e=>parseInt(e,10)).concat(Object.values(vC)))).sort((e,t)=>e-t),{memoizeOptions:{resultEqualityCheck:function(e,t){if(e.length===t.length){for(var r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}return!1}}});function kC(e){var{zIndex:t,isPanorama:r}=e,n=(0,H.useRef)(null),i=mW();return(0,H.useLayoutEffect)(()=>(n.current&&i(ki({zIndex:t,element:n.current,isPanorama:r})),()=>{i(ka({zIndex:t,isPanorama:r}))}),[i,t,r]),H.createElement("g",{tabIndex:-1,ref:n})}function kA(e){var{children:t,isPanorama:r}=e,n=mX(kP);if(!n||0===n.length)return t;var i=n.filter(e=>e<0),a=n.filter(e=>e>0);return H.createElement(H.Fragment,null,i.map(e=>H.createElement(kC,{key:e,zIndex:e,isPanorama:r})),t,a.map(e=>H.createElement(kC,{key:e,zIndex:e,isPanorama:r})))}var kE=["children"];function kM(){return(kM=Object.assign.bind()).apply(null,arguments)}var kT={width:"100%",height:"100%",display:"block"},k_=(0,H.forwardRef)((e,t)=>{var r,n,i=mX(fc),a=mX(fd),s=km();if(!m8(i)||!m8(a))return null;var{children:l,otherAttributes:o,title:c,desc:d}=e;return null!=o&&(r="number"==typeof o.tabIndex?o.tabIndex:s?0:void 0,n="string"==typeof o.role?o.role:s?"application":void 0),H.createElement(kS,kM({},o,{title:c,desc:d,role:n,tabIndex:r,width:i,height:a,style:kT,ref:t}),l)}),kD=e=>{var{children:t}=e,r=mX(fN);if(!r)return null;var{width:n,height:i,y:a,x:s}=r;return H.createElement(kS,{width:n,height:i,x:s,y:a},t)},kI=(0,H.forwardRef)((e,t)=>{var{children:r}=e,n=function(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r={};for(var n in e)if(({}).hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;r[n]=e[n]}return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],-1===t.indexOf(r)&&({}).propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}(e,kE);return fj()?H.createElement(kD,null,H.createElement(kA,{isPanorama:!0},r)):H.createElement(k_,kM({ref:t},n),H.createElement(kA,{isPanorama:!1},r))}),kz=new(e.i(236)).default,kL="recharts.syncEvent.tooltip",kR="recharts.syncEvent.brush";function kF(e){return e.tooltip.syncInteraction}var k$=["x","y"];function kB(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function kU(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?kB(Object(r),!0).forEach(function(t){var n,i,a;n=e,i=t,a=r[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in n?Object.defineProperty(n,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):n[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):kB(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var kq=(0,H.createContext)(null),kV=(0,H.createContext)(null);function kK(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function kW(){return(kW=Object.assign.bind()).apply(null,arguments)}var kH=()=>{var e,t,r,n,i,a,s,l,o,c,d,u;return e=mW(),(0,H.useEffect)(()=>{e(pA())},[e]),t=mX(vj),r=mX(vN),n=mW(),i=mX(vw),a=mX(wb),s=mX(fK),l=fq(),o=mX(e=>e.rootProps.className),(0,H.useEffect)(()=>{if(null==t)return pS;var e=(e,o,c)=>{if(r!==c&&t===e){if("index"===i){if(l&&null!=o&&null!=(d=o.payload)&&d.coordinate&&o.payload.sourceViewBox){var d,u,h=o.payload.coordinate,{x:p,y:m}=h,f=function(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r={};for(var n in e)if(({}).hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;r[n]=e[n]}return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],-1===t.indexOf(r)&&({}).propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}(h,k$),{x:x,y:y,width:g,height:v}=o.payload.sourceViewBox,b=kU(kU({},f),{},{x:l.x+(g?(p-x)/g:0)*l.width,y:l.y+(v?(m-y)/v:0)*l.height});n(kU(kU({},o),{},{payload:kU(kU({},o.payload),{},{coordinate:b})}))}else n(o);return}if(null!=a){if("function"==typeof i){var j=i(a,{activeTooltipIndex:null==o.payload.index?void 0:Number(o.payload.index),isTooltipActive:o.payload.active,activeIndex:null==o.payload.index?void 0:Number(o.payload.index),activeLabel:o.payload.label,activeDataKey:o.payload.dataKey,activeCoordinate:o.payload.coordinate});u=a[j]}else"value"===i&&(u=a.find(e=>String(e.value)===o.payload.label));var{coordinate:w}=o.payload;if(null==u||!1===o.payload.active||null==w||null==l)return void n(mA({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));var{x:N,y:k}=w,S=Math.min(N,l.x+l.width),O=Math.min(k,l.y+l.height),P={x:"horizontal"===s?u.coordinate:S,y:"horizontal"===s?O:u.coordinate};n(mA({active:o.payload.active,coordinate:P,dataKey:o.payload.dataKey,index:String(u.index),label:o.payload.label,sourceViewBox:o.payload.sourceViewBox,graphicalItemId:o.payload.graphicalItemId}))}}};return kz.on(kL,e),()=>{kz.off(kL,e)}},[o,n,r,t,i,a,s,l]),c=mX(vj),d=mX(vN),u=mW(),(0,H.useEffect)(()=>{if(null==c)return pS;var e=(e,t,r)=>{d!==r&&c===e&&u(mD(t))};return kz.on(kR,e),()=>{kz.off(kR,e)}},[u,d,c]),null};function kQ(e){if("number"==typeof e)return e;if("string"==typeof e){var t=parseFloat(e);if(!Number.isNaN(t))return t}return 0}var kY=(0,H.forwardRef)((e,t)=>{var r,n,i=(0,H.useRef)(null),[a,s]=(0,H.useState)({containerWidth:kQ(null==(r=e.style)?void 0:r.width),containerHeight:kQ(null==(n=e.style)?void 0:n.height)}),l=(0,H.useCallback)((e,t)=>{s(r=>{var n=Math.round(e),i=Math.round(t);return r.containerWidth===n&&r.containerHeight===i?r:{containerWidth:n,containerHeight:i}})},[]),o=(0,H.useCallback)(e=>{if("function"==typeof t&&t(e),null!=e&&"u">typeof ResizeObserver){var{width:r,height:n}=e.getBoundingClientRect();l(r,n);var a=new ResizeObserver(e=>{var t=e[0];if(null!=t){var{width:r,height:n}=t.contentRect;l(r,n)}});a.observe(e),i.current=a}},[t,l]);return(0,H.useEffect)(()=>()=>{var e=i.current;null!=e&&e.disconnect()},[l]),H.createElement(H.Fragment,null,H.createElement(fQ,{width:a.containerWidth,height:a.containerHeight}),H.createElement("div",kW({ref:o},e)))}),kX=(0,H.forwardRef)((e,t)=>{var{width:r,height:n}=e,[i,a]=(0,H.useState)({containerWidth:kQ(r),containerHeight:kQ(n)}),s=(0,H.useCallback)((e,t)=>{a(r=>{var n=Math.round(e),i=Math.round(t);return r.containerWidth===n&&r.containerHeight===i?r:{containerWidth:n,containerHeight:i}})},[]),l=(0,H.useCallback)(e=>{if("function"==typeof t&&t(e),null!=e){var{width:r,height:n}=e.getBoundingClientRect();s(r,n)}},[t,s]);return H.createElement(H.Fragment,null,H.createElement(fQ,{width:i.containerWidth,height:i.containerHeight}),H.createElement("div",kW({ref:l},e)))}),kG=(0,H.forwardRef)((e,t)=>{var{width:r,height:n}=e;return H.createElement(H.Fragment,null,H.createElement(fQ,{width:r,height:n}),H.createElement("div",kW({ref:t},e)))}),kZ=(0,H.forwardRef)((e,t)=>{var{width:r,height:n}=e;return"string"==typeof r||"string"==typeof n?H.createElement(kX,kW({},e,{ref:t})):"number"==typeof r&&"number"==typeof n?H.createElement(kG,kW({},e,{width:r,height:n,ref:t})):H.createElement(H.Fragment,null,H.createElement(fQ,{width:r,height:n}),H.createElement("div",kW({ref:t},e)))}),kJ=(0,H.forwardRef)((e,t)=>{var{children:r,className:n,height:i,onClick:a,onContextMenu:s,onDoubleClick:l,onMouseDown:o,onMouseEnter:c,onMouseLeave:d,onMouseMove:u,onMouseUp:h,onTouchEnd:p,onTouchMove:m,onTouchStart:f,style:x,width:y,responsive:g,dispatchTouchEvents:v=!0}=e,b=(0,H.useRef)(null),j=mW(),[w,N]=(0,H.useState)(null),[k,S]=(0,H.useState)(null),O=function(){var e=mW(),[t,r]=(0,H.useState)(null),n=mX(fu);return(0,H.useEffect)(()=>{if(null!=t){var r=t.getBoundingClientRect().width/t.offsetWidth;m6(r)&&r!==n&&e(mB(r))}},[t,e,n]),r}(),P=fF(),C=(null==P?void 0:P.width)>0?P.width:y,A=(null==P?void 0:P.height)>0?P.height:i,E=(0,H.useCallback)(e=>{O(e),"function"==typeof t&&t(e),N(e),S(e),null!=e&&(b.current=e)},[O,t,N,S]),M=(0,H.useCallback)(e=>{j(wX(e)),j(NQ({handler:a,reactEvent:e}))},[j,a]),T=(0,H.useCallback)(e=>{j(wZ(e)),j(NQ({handler:c,reactEvent:e}))},[j,c]),_=(0,H.useCallback)(e=>{j(mS()),j(NQ({handler:d,reactEvent:e}))},[j,d]),D=(0,H.useCallback)(e=>{j(wZ(e)),j(NQ({handler:u,reactEvent:e}))},[j,u]),I=(0,H.useCallback)(()=>{j(NW())},[j]),z=(0,H.useCallback)(e=>{j(NK(e.key))},[j]),L=(0,H.useCallback)(e=>{j(NQ({handler:s,reactEvent:e}))},[j,s]),R=(0,H.useCallback)(e=>{j(NQ({handler:l,reactEvent:e}))},[j,l]),F=(0,H.useCallback)(e=>{j(NQ({handler:o,reactEvent:e}))},[j,o]),$=(0,H.useCallback)(e=>{j(NQ({handler:h,reactEvent:e}))},[j,h]),B=(0,H.useCallback)(e=>{j(NQ({handler:f,reactEvent:e}))},[j,f]),U=(0,H.useCallback)(e=>{v&&j(NJ(e)),j(NQ({handler:m,reactEvent:e}))},[j,v,m]),q=(0,H.useCallback)(e=>{j(NQ({handler:p,reactEvent:e}))},[j,p]);return H.createElement(kq.Provider,{value:w},H.createElement(kV.Provider,{value:k},H.createElement(g?kY:kZ,{width:null!=C?C:null==x?void 0:x.width,height:null!=A?A:null==x?void 0:x.height,className:sb("recharts-wrapper",n),style:function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?kK(Object(r),!0).forEach(function(t){var n,i,a;n=e,i=t,a=r[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in n?Object.defineProperty(n,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):n[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):kK(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}({position:"relative",cursor:"default",width:C,height:A},x),onClick:M,onContextMenu:L,onDoubleClick:R,onFocus:I,onKeyDown:z,onMouseDown:F,onMouseEnter:T,onMouseLeave:_,onMouseMove:D,onMouseUp:$,onTouchEnd:q,onTouchMove:U,onTouchStart:B,ref:E},H.createElement(kH,null),r)))}),k0=hy([fy],e=>({top:e.top,bottom:e.bottom,left:e.left,right:e.right})),k1=hy([k0,fc,fd],(e,t,r)=>{if(e&&null!=t&&null!=r)return{x:e.left,y:e.top,width:Math.max(0,t-e.left-e.right),height:Math.max(0,r-e.top-e.bottom)}}),k2=(0,H.createContext)(void 0),k5=e=>{var{children:t}=e,[r]=(0,H.useState)("".concat(pv("recharts"),"-clip")),n=mX(k1);if(null==n)return null;var{x:i,y:a,width:s,height:l}=n;return H.createElement(k2.Provider,{value:r},H.createElement("defs",null,H.createElement("clipPath",{id:r},H.createElement("rect",{x:i,y:a,height:l,width:s}))),t)},k4=["width","height","responsive","children","className","style","compact","title","desc"],k3=(0,H.forwardRef)((e,t)=>{var{width:r,height:n,responsive:i,children:a,className:s,style:l,compact:o,title:c,desc:d}=e,u=kb(function(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r={};for(var n in e)if(({}).hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;r[n]=e[n]}return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],-1===t.indexOf(r)&&({}).propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}(e,k4));return o?H.createElement(H.Fragment,null,H.createElement(fQ,{width:r,height:n}),H.createElement(kI,{otherAttributes:u,title:c,desc:d},a)):H.createElement(kJ,{className:s,style:l,width:r,height:n,responsive:null!=i&&i,onClick:e.onClick,onMouseLeave:e.onMouseLeave,onMouseEnter:e.onMouseEnter,onMouseMove:e.onMouseMove,onMouseDown:e.onMouseDown,onMouseUp:e.onMouseUp,onContextMenu:e.onContextMenu,onDoubleClick:e.onDoubleClick,onTouchStart:e.onTouchStart,onTouchMove:e.onTouchMove,onTouchEnd:e.onTouchEnd},H.createElement(kI,{otherAttributes:u,title:c,desc:d,ref:t},H.createElement(k5,null,a)))});function k6(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function k8(e,t){var r=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?k6(Object(r),!0).forEach(function(t){var n,i,a;n=e,i=t,a=r[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in n?Object.defineProperty(n,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):n[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):k6(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}({},e);return Object.keys(t).reduce((e,r)=>(void 0===e[r]&&void 0!==t[r]&&(e[r]=t[r]),e),r)}function k7(){return(k7=Object.assign.bind()).apply(null,arguments)}var k9={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,layout:"horizontal",margin:{top:5,right:5,bottom:5,left:5},responsive:!1,reverseStackOrder:!1,stackOffset:"none",syncMethod:"index"},Se=(0,H.forwardRef)(function(e,t){var r,n=k8(e.categoricalChartProps,k9),{chartName:i,defaultTooltipEventType:a,validateTooltipEventTypes:s,tooltipPayloadSearcher:l,categoricalChartProps:o}=e;return H.createElement(ko,{preloadedState:{options:{chartName:i,defaultTooltipEventType:a,validateTooltipEventTypes:s,tooltipPayloadSearcher:l,eventEmitter:void 0}},reduxStoreName:null!=(r=o.id)?r:i},H.createElement(kc,{chartData:o.data}),H.createElement(kh,{layout:n.layout,margin:n.margin}),H.createElement(kp,{baseValue:n.baseValue,accessibilityLayer:n.accessibilityLayer,barCategoryGap:n.barCategoryGap,maxBarSize:n.maxBarSize,stackOffset:n.stackOffset,barGap:n.barGap,barSize:n.barSize,syncId:n.syncId,syncMethod:n.syncMethod,className:n.className,reverseStackOrder:n.reverseStackOrder}),H.createElement(k3,k7({},n,{ref:t})))}),St=["axis","item"],Sr=(0,H.forwardRef)((e,t)=>H.createElement(Se,{chartName:"BarChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:St,tooltipPayloadSearcher:pO,categoricalChartProps:e,ref:t})),Sn=H,Si=["children","className"];function Sa(){return(Sa=Object.assign.bind()).apply(null,arguments)}var Ss=H.forwardRef((e,t)=>{var{children:r,className:n}=e,i=function(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r={};for(var n in e)if(({}).hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;r[n]=e[n]}return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],-1===t.indexOf(r)&&({}).propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}(e,Si),a=sb("recharts-layer",n);return H.createElement("g",Sa({className:a},kw(i),{ref:t}),r)}),Sl=e=>null;Sl.displayName="Cell";var So=e.i(9944);function Sc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}var Sd=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Sc(Object(r),!0).forEach(function(t){var n,i,a;n=e,i=t,a=r[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in n?Object.defineProperty(n,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):n[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Sc(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}({},{cacheSize:2e3,enableCache:!0}),Su=new class{constructor(e){!function(e,t,r){var n;(t="symbol"==typeof(n=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"))?n:n+"")in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(this,"cache",new Map),this.maxSize=e}get(e){var t=this.cache.get(e);return void 0!==t&&(this.cache.delete(e),this.cache.set(e,t)),t}set(e,t){if(this.cache.has(e))this.cache.delete(e);else if(this.cache.size>=this.maxSize){var r=this.cache.keys().next().value;null!=r&&this.cache.delete(r)}this.cache.set(e,t)}clear(){this.cache.clear()}size(){return this.cache.size}}(Sd.cacheSize),Sh={position:"absolute",top:"-20000px",left:0,padding:0,margin:0,border:"none",whiteSpace:"pre"},Sp="recharts_measurement_span",Sm=(e,t)=>{try{var r=document.getElementById(Sp);r||((r=document.createElement("span")).setAttribute("id",Sp),r.setAttribute("aria-hidden","true"),document.body.appendChild(r)),Object.assign(r.style,Sh,t),r.textContent="".concat(e);var n=r.getBoundingClientRect();return{width:n.width,height:n.height}}catch(e){return{width:0,height:0}}},Sf=function(e){var t,r,n,i,a,s,l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(null==e||N6.isSsr)return{width:0,height:0};if(!Sd.enableCache)return Sm(e,l);var o=(t=l.fontSize||"",r=l.fontFamily||"",n=l.fontWeight||"",i=l.fontStyle||"",a=l.letterSpacing||"",s=l.textTransform||"","".concat(e,"|").concat(t,"|").concat(r,"|").concat(n,"|").concat(i,"|").concat(a,"|").concat(s)),c=Su.get(o);if(c)return c;var d=Sm(e,l);return Su.set(o,d),d},Sx=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,Sy=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,Sg=/^px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q$/,Sv=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,Sb={cm:96/2.54,mm:96/25.4,pt:96/72,pc:16,in:96,Q:96/101.6,px:1},Sj=["cm","mm","pt","pc","in","Q","px"];class Sw{static parse(e){var t,[,r,n]=null!=(t=Sv.exec(e))?t:[];return null==r?Sw.NaN:new Sw(parseFloat(r),null!=n?n:"")}constructor(e,t){this.num=e,this.unit=t,this.num=e,this.unit=t,pm(e)&&(this.unit=""),""===t||Sg.test(t)||(this.num=NaN,this.unit=""),Sj.includes(t)&&(this.num=e*Sb[t],this.unit="px")}add(e){return this.unit!==e.unit?new Sw(NaN,""):new Sw(this.num+e.num,this.unit)}subtract(e){return this.unit!==e.unit?new Sw(NaN,""):new Sw(this.num-e.num,this.unit)}multiply(e){return""!==this.unit&&""!==e.unit&&this.unit!==e.unit?new Sw(NaN,""):new Sw(this.num*e.num,this.unit||e.unit)}divide(e){return""!==this.unit&&""!==e.unit&&this.unit!==e.unit?new Sw(NaN,""):new Sw(this.num/e.num,this.unit||e.unit)}toString(){return"".concat(this.num).concat(this.unit)}isNaN(){return pm(this.num)}}function SN(e){if(null==e||e.includes("NaN"))return"NaN";for(var t=e;t.includes("*")||t.includes("/");){var r,[,n,i,a]=null!=(r=Sx.exec(t))?r:[],s=Sw.parse(null!=n?n:""),l=Sw.parse(null!=a?a:""),o="*"===i?s.multiply(l):s.divide(l);if(o.isNaN())return"NaN";t=t.replace(Sx,o.toString())}for(;t.includes("+")||/.-\d+(?:\.\d+)?/.test(t);){var c,[,d,u,h]=null!=(c=Sy.exec(t))?c:[],p=Sw.parse(null!=d?d:""),m=Sw.parse(null!=h?h:""),f="+"===u?p.add(m):p.subtract(m);if(f.isNaN())return"NaN";t=t.replace(Sy,f.toString())}return t}h="NaN",p=new Sw(NaN,""),(h="symbol"==typeof(c=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(h,"string"))?c:c+"")in Sw?Object.defineProperty(Sw,h,{value:p,enumerable:!0,configurable:!0,writable:!0}):Sw[h]=p;var Sk=/\(([^()]*)\)/;function SS(e){var t=function(e){try{var t;return t=e.replace(/\s+/g,""),t=function(e){for(var t,r=e;null!=(t=Sk.exec(r));){var[,n]=t;r=r.replace(Sk,SN(n))}return r}(t),t=SN(t)}catch(e){return"NaN"}}(e.slice(5,-1));return"NaN"===t?"":t}var SO=["x","y","lineHeight","capHeight","fill","scaleToFit","textAnchor","verticalAnchor"],SP=["dx","dy","angle","className","breakAll"];function SC(){return(SC=Object.assign.bind()).apply(null,arguments)}function SA(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r={};for(var n in e)if(({}).hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;r[n]=e[n]}return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],-1===t.indexOf(r)&&({}).propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var SE=/[ \f\n\r\t\v\u2028\u2029]+/,SM=e=>{var{children:t,breakAll:r,style:n}=e;try{var i=[];null!=t&&(i=r?t.toString().split(""):t.toString().split(SE));var a=i.map(e=>({word:e,width:Sf(e,n).width})),s=r?0:Sf(" ",n).width;return{wordsWithComputedWidth:a,spaceWidth:s}}catch(e){return null}},ST=(e,t,r,n)=>e.reduce((e,i)=>{var{word:a,width:s}=i,l=e[e.length-1];return l&&null!=s&&(null==t||n||l.width+s+r<Number(t))?(l.words.push(a),l.width+=s+r):e.push({words:[a],width:s}),e},[]),S_=e=>e.reduce((e,t)=>e.width>t.width?e:t),SD=(e,t,r,n,i,a,s,l)=>{var o=SM({breakAll:r,style:n,children:e.slice(0,t)+"…"});if(!o)return[!1,[]];var c=ST(o.wordsWithComputedWidth,a,s,l);return[c.length>i||S_(c).width>Number(a),c]},SI=e=>[{words:null==e?[]:e.toString().split(SE),width:void 0}],Sz="#808080",SL={angle:0,breakAll:!1,capHeight:"0.71em",fill:Sz,lineHeight:"1em",scaleToFit:!1,textAnchor:"start",verticalAnchor:"end",x:0,y:0},SR=(0,H.forwardRef)((e,t)=>{var r,n=k8(e,SL),{x:i,y:a,lineHeight:s,capHeight:l,fill:o,scaleToFit:c,textAnchor:d,verticalAnchor:u}=n,h=SA(n,SO),p=(0,H.useMemo)(()=>(e=>{var{width:t,scaleToFit:r,children:n,style:i,breakAll:a,maxLines:s}=e;if((t||r)&&!N6.isSsr){var l=SM({breakAll:a,children:n,style:i});if(!l)return SI(n);var{wordsWithComputedWidth:o,spaceWidth:c}=l;return((e,t,r,n,i)=>{var a,{maxLines:s,children:l,style:o,breakAll:c}=e,d=px(s),u=String(l),h=ST(t,n,r,i);if(!d||i||!(h.length>s||S_(h).width>Number(n)))return h;for(var p=0,m=u.length-1,f=0;p<=m&&f<=u.length-1;){var x=Math.floor((p+m)/2),[y,g]=SD(u,x-1,c,o,s,n,r,i),[v]=SD(u,x,c,o,s,n,r,i);if(y||v||(p=x+1),y&&v&&(m=x-1),!y&&v){a=g;break}f++}return a||h})({breakAll:a,children:n,maxLines:s,style:i},o,c,t,!!r)}return SI(n)})({breakAll:h.breakAll,children:h.children,maxLines:h.maxLines,scaleToFit:c,style:h.style,width:h.width}),[h.breakAll,h.children,h.maxLines,c,h.style,h.width]),{dx:m,dy:f,angle:x,className:y,breakAll:g}=h,v=SA(h,SP);if(!py(i)||!py(a)||0===p.length)return null;var b=Number(i)+(px(m)?m:0),j=Number(a)+(px(f)?f:0);if(!m6(b)||!m6(j))return null;switch(u){case"start":r=SS("calc(".concat(l,")"));break;case"middle":r=SS("calc(".concat((p.length-1)/2," * -").concat(s," + (").concat(l," / 2))"));break;default:r=SS("calc(".concat(p.length-1," * -").concat(s,")"))}var w=[],N=p[0];if(c&&null!=N){var k=N.width,{width:S}=h;w.push("scale(".concat(px(S)&&px(k)?S/k:1,")"))}return x&&w.push("rotate(".concat(x,", ").concat(b,", ").concat(j,")")),w.length&&(v.transform=w.join(" ")),H.createElement("text",SC({},kw(v),{ref:t,x:b,y:j,className:sb("recharts-text",y),textAnchor:d,fill:o.includes("url")?Sz:o}),p.map((e,t)=>{var n=e.words.join(g?"":" ");return H.createElement("tspan",{x:b,dy:0===t?r:s,key:"".concat(n,"-").concat(t)},n)}))});SR.displayName="Text";var SF=e.i(9854);function S$(e){var{zIndex:t,children:r}=e,n=void 0!==mX(fK)&&void 0!==t&&0!==t,i=fj(),a=mW();(0,H.useLayoutEffect)(()=>n?(a(kr({zIndex:t})),()=>{a(kn({zIndex:t}))}):pS,[a,t,n]);var s=mX(e=>kO(e,t,i));return n?s?(0,SF.createPortal)(r,s):null:r}function SB(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function SU(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?SB(Object(r),!0).forEach(function(t){var n,i,a;n=e,i=t,a=r[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in n?Object.defineProperty(n,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):n[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):SB(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var Sq=["labelRef"],SV=["content"];function SK(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r={};for(var n in e)if(({}).hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;r[n]=e[n]}return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],-1===t.indexOf(r)&&({}).propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function SW(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function SH(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?SW(Object(r),!0).forEach(function(t){var n,i,a;n=e,i=t,a=r[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in n?Object.defineProperty(n,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):n[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):SW(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function SQ(){return(SQ=Object.assign.bind()).apply(null,arguments)}var SY=(0,H.createContext)(null),SX=e=>{var{x:t,y:r,upperWidth:n,lowerWidth:i,width:a,height:s,children:l}=e,o=(0,H.useMemo)(()=>({x:t,y:r,upperWidth:n,lowerWidth:i,width:a,height:s}),[t,r,n,i,a,s]);return H.createElement(SY.Provider,{value:o},l)},SG=()=>{var e=(0,H.useContext)(SY),t=fq();return e||(t?fU(t):void 0)},SZ=(0,H.createContext)(null),SJ=e=>null!=e&&"function"==typeof e,S0=e=>null!=e&&"cx"in e&&px(e.cx),S1={angle:0,offset:5,zIndex:vC.label,position:"middle",textBreakAll:!1};function S2(e){var t,r,n,i,a,s,l=k8(e,S1),{viewBox:o,parentViewBox:c,position:d,value:u,children:h,content:p,className:m="",textBreakAll:f,labelRef:x}=l,y=(t=(0,H.useContext)(SZ),r=mX(vK),t||r),g=SG(),v=function(e){if(!S0(e))return e;var{cx:t,cy:r,outerRadius:n}=e,i=2*n;return{x:t-n,y:r-n,width:i,upperWidth:i,lowerWidth:i,height:i}}(i=null==o?"center"===d?g:null!=y?y:g:S0(o)?o:fU(o));if(!i||null==u&&null==h&&!(0,H.isValidElement)(p)&&"function"!=typeof p)return null;var b=SH(SH({},l),{},{viewBox:i});if((0,H.isValidElement)(p)){var{labelRef:j}=b,w=SK(b,Sq);return(0,H.cloneElement)(p,w)}if("function"==typeof p){var{content:N}=b,k=SK(b,SV);if(a=(0,H.createElement)(p,k),(0,H.isValidElement)(a))return a}else a=(e=>{var{value:t,formatter:r}=e,n=null==e.children?t:e.children;return"function"==typeof r?r(n):n})(l);var S=kw(l);if(S0(i)){if("insideStart"===d||"insideEnd"===d||"end"===d)return((e,t,r,n,i)=>{var a,s,{offset:l,className:o}=e,{cx:c,cy:d,innerRadius:u,outerRadius:h,startAngle:p,endAngle:m,clockWise:f}=i,x=(u+h)/2,y=pp(m-p)*Math.min(Math.abs(m-p),360),g=y>=0?1:-1;switch(t){case"insideStart":a=p+g*l,s=f;break;case"insideEnd":a=m-g*l,s=!f;break;case"end":a=m+g*l,s=f;break;default:throw Error("Unsupported position ".concat(t))}s=y<=0?s:!s;var v=vP(c,d,x,a),b=vP(c,d,x,a+(s?1:-1)*359),j="M".concat(v.x,",").concat(v.y,"\n A").concat(x,",").concat(x,",0,1,").concat(+!s,",\n ").concat(b.x,",").concat(b.y),w=null==e.id?pv("recharts-radial-line-"):e.id;return H.createElement("text",SQ({},n,{dominantBaseline:"central",className:sb("recharts-radial-bar-label",o)}),H.createElement("defs",null,H.createElement("path",{id:w,d:j})),H.createElement("textPath",{xlinkHref:"#".concat(w)},r))})(l,d,a,S,i);s=((e,t,r)=>{var{cx:n,cy:i,innerRadius:a,outerRadius:s,startAngle:l,endAngle:o}=e,c=(l+o)/2;if("outside"===r){var{x:d,y:u}=vP(n,i,s+t,c);return{x:d,y:u,textAnchor:d>=n?"start":"end",verticalAnchor:"middle"}}if("center"===r)return{x:n,y:i,textAnchor:"middle",verticalAnchor:"middle"};if("centerTop"===r)return{x:n,y:i,textAnchor:"middle",verticalAnchor:"start"};if("centerBottom"===r)return{x:n,y:i,textAnchor:"middle",verticalAnchor:"end"};var{x:h,y:p}=vP(n,i,(a+s)/2,c);return{x:h,y:p,textAnchor:"middle",verticalAnchor:"middle"}})(i,l.offset,l.position)}else{if(!v)return null;var O=(e=>{var{viewBox:t,position:r,offset:n=0,parentViewBox:i,clamp:a}=e,{x:s,y:l,height:o,upperWidth:c,lowerWidth:d}=fU(t),u=s+(c-d)/2,h=(s+u)/2,p=(c+d)/2,m=o>=0?1:-1,f=m*n,x=m>0?"end":"start",y=m>0?"start":"end",g=c>=0?1:-1,v=g*n,b=g>0?"end":"start",j=g>0?"start":"end";if("top"===r){var w={x:s+c/2,y:l-f,horizontalAnchor:"middle",verticalAnchor:x};return a&&i&&(w.height=Math.max(l-i.y,0),w.width=c),w}if("bottom"===r){var N={x:u+d/2,y:l+o+f,horizontalAnchor:"middle",verticalAnchor:y};return a&&i&&(N.height=Math.max(i.y+i.height-(l+o),0),N.width=d),N}if("left"===r){var k={x:h-v,y:l+o/2,horizontalAnchor:b,verticalAnchor:"middle"};return a&&i&&(k.width=Math.max(k.x-i.x,0),k.height=o),k}if("right"===r){var S={x:h+p+v,y:l+o/2,horizontalAnchor:j,verticalAnchor:"middle"};return a&&i&&(S.width=Math.max(i.x+i.width-S.x,0),S.height=o),S}var O=a&&i?{width:p,height:o}:{};return"insideLeft"===r?SU({x:h+v,y:l+o/2,horizontalAnchor:j,verticalAnchor:"middle"},O):"insideRight"===r?SU({x:h+p-v,y:l+o/2,horizontalAnchor:b,verticalAnchor:"middle"},O):"insideTop"===r?SU({x:s+c/2,y:l+f,horizontalAnchor:"middle",verticalAnchor:y},O):"insideBottom"===r?SU({x:u+d/2,y:l+o-f,horizontalAnchor:"middle",verticalAnchor:x},O):"insideTopLeft"===r?SU({x:s+v,y:l+f,horizontalAnchor:j,verticalAnchor:y},O):"insideTopRight"===r?SU({x:s+c-v,y:l+f,horizontalAnchor:b,verticalAnchor:y},O):"insideBottomLeft"===r?SU({x:u+v,y:l+o-f,horizontalAnchor:j,verticalAnchor:x},O):"insideBottomRight"===r?SU({x:u+d-v,y:l+o-f,horizontalAnchor:b,verticalAnchor:x},O):r&&"object"==typeof r&&(px(r.x)||pf(r.x))&&(px(r.y)||pf(r.y))?SU({x:s+pb(r.x,p),y:l+pb(r.y,o),horizontalAnchor:"end",verticalAnchor:"end"},O):SU({x:s+c/2,y:l+o/2,horizontalAnchor:"middle",verticalAnchor:"middle"},O)})({viewBox:v,position:d,offset:l.offset,parentViewBox:S0(c)?void 0:c,clamp:!0});s=SH(SH({x:O.x,y:O.y,textAnchor:O.horizontalAnchor,verticalAnchor:O.verticalAnchor},void 0!==O.width?{width:O.width}:{}),void 0!==O.height?{height:O.height}:{})}return H.createElement(S$,{zIndex:l.zIndex},H.createElement(SR,SQ({ref:x,className:sb("recharts-label",m)},S,s,{textAnchor:"start"===(n=S.textAnchor)||"middle"===n||"end"===n||"inherit"===n?S.textAnchor:s.textAnchor,breakAll:f}),a))}function S5(e){var{label:t,labelRef:r}=e;return((e,t,r)=>{if(!e)return null;var n={viewBox:t,labelRef:r};return!0===e?H.createElement(S2,SQ({key:"label-implicit"},n)):py(e)?H.createElement(S2,SQ({key:"label-implicit",value:e},n)):(0,H.isValidElement)(e)?e.type===S2?(0,H.cloneElement)(e,SH({key:"label-implicit"},n)):H.createElement(S2,SQ({key:"label-implicit",content:e},n)):SJ(e)?H.createElement(S2,SQ({key:"label-implicit",content:e},n)):e&&"object"==typeof e?H.createElement(S2,SQ({},e,{key:"label-implicit"},n)):null})(t,SG(),r)||null}S2.displayName="Label";var S4=["valueAccessor"],S3=["dataKey","clockWise","id","textBreakAll","zIndex"];function S6(){return(S6=Object.assign.bind()).apply(null,arguments)}function S8(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r={};for(var n in e)if(({}).hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;r[n]=e[n]}return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],-1===t.indexOf(r)&&({}).propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var S7=e=>Array.isArray(e.value)?(0,So.default)(e.value):e.value,S9=(0,H.createContext)(void 0),Oe=S9.Provider,Ot=(0,H.createContext)(void 0);function Or(e){var{valueAccessor:t=S7}=e,r=S8(e,S4),{dataKey:n,clockWise:i,id:a,textBreakAll:s,zIndex:l}=r,o=S8(r,S3),c=(0,H.useContext)(S9),d=(0,H.useContext)(Ot),u=c||d;return u&&u.length?H.createElement(S$,{zIndex:null!=l?l:vC.label},H.createElement(Ss,{className:"recharts-label-list"},u.map((e,i)=>{var l,c=null==n?t(e,i):fe(e.payload,n),d=null==a?{}:{id:"".concat(a,"-").concat(i)};return H.createElement(S2,S6({key:"label-".concat(i)},kw(e),o,d,{fill:null!=(l=r.fill)?l:e.fill,parentViewBox:e.parentViewBox,value:c,textBreakAll:s,viewBox:e.viewBox,index:i,zIndex:0}))}))):null}function On(e){var{label:t}=e;return t?!0===t?H.createElement(Or,{key:"labelList-implicit"}):H.isValidElement(t)||SJ(t)?H.createElement(Or,{key:"labelList-implicit",content:t}):"object"==typeof t?H.createElement(Or,S6({key:"labelList-implicit"},t,{type:String(t.type)})):null:null}Ot.Provider,Or.displayName="LabelList";var Oi=e.i(29095),Oa=e=>"string"==typeof e?e:e?e.displayName||e.name||"Component":"",Os=null,Ol=null,Oo=e=>{if(e===Os&&Array.isArray(Ol))return Ol;var t=[];return H.Children.forEach(e,e=>{null!=e&&((0,Oi.isFragment)(e)?t=t.concat(Oo(e.props.children)):t.push(e))}),Ol=t,Os=e,t},Oc=e=>"radius"in e&&"startAngle"in e&&"endAngle"in e,Od=(e,t,r)=>{if(null===e||"object"!=typeof e&&"function"!=typeof e)return null;var n=null;return Object.keys(e).forEach(i=>{var a=e[i];kx(i)&&"function"==typeof a&&(n||(n={}),n[i]=e=>(a(t,r,e),null))}),n},Ou=e.i(91804);function Oh(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function Op(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Oh(Object(r),!0).forEach(function(t){var n,i,a;n=e,i=t,a=r[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in n?Object.defineProperty(n,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):n[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Oh(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var Om=(e,t,r)=>e.map(e=>"".concat(e.replace(/([A-Z])/g,e=>"-".concat(e.toLowerCase()))," ").concat(t,"ms ").concat(r)).join(","),Of=(e,t)=>Object.keys(t).reduce((r,n)=>Op(Op({},r),{},{[n]:e(n,t[n])}),{});function Ox(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function Oy(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ox(Object(r),!0).forEach(function(t){var n,i,a;n=e,i=t,a=r[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in n?Object.defineProperty(n,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):n[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ox(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var Og=(e,t,r)=>e+(t-e)*r,Ov=e=>{var{from:t,to:r}=e;return t!==r},Ob=(e,t,r)=>{var n=Of((t,r)=>{if(Ov(r)){var[n,i]=e(r.from,r.to,r.velocity);return Oy(Oy({},r),{},{from:n,velocity:i})}return r},t);return r<1?Of((e,t)=>Ov(t)&&null!=n[e]?Oy(Oy({},t),{},{velocity:Og(t.velocity,n[e].velocity,r),from:Og(t.from,n[e].from,r)}):t,t):Ob(e,n,r-1)},Oj=(e,t)=>[0,3*e,3*t-6*e,3*e-3*t+1],Ow=(e,t)=>e.map((e,r)=>e*t**r).reduce((e,t)=>e+t),ON=(e,t)=>r=>Ow(Oj(e,t),r),Ok=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];if(1===t.length)switch(t[0]){case"linear":return[0,0,1,1];case"ease":return[.25,.1,.25,1];case"ease-in":return[.42,0,1,1];case"ease-out":return[.42,0,.58,1];case"ease-in-out":return[0,0,.58,1];default:var n=(e=>{var t,r=e.split("(");if(2!==r.length||"cubic-bezier"!==r[0])return null;var n=null==(t=r[1])||null==(t=t.split(")")[0])?void 0:t.split(",");if(null==n||4!==n.length)return null;var i=n.map(e=>parseFloat(e));return[i[0],i[1],i[2],i[3]]})(t[0]);if(n)return n}return 4===t.length?t:[0,0,1,1]},OS=function(){return((e,t,r,n)=>{var i=ON(e,r),a=ON(t,n),s=t=>Ow([...Oj(e,r).map((e,t)=>e*t).slice(1),0],t),l=e=>e>1?1:e<0?0:e,o=e=>{for(var t=e>1?1:e,r=t,n=0;n<8;++n){var o=i(r)-t,c=s(r);if(1e-4>Math.abs(o-t)||c<1e-4)break;r=l(r-o/c)}return a(r)};return o.isStepper=!1,o})(...Ok(...arguments))},OO=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{stiff:t=100,damping:r=8,dt:n=17}=e,i=(e,i,a)=>{var s=a+(-(e-i)*t-a*r)*n/1e3,l=a*n/1e3+e;return 1e-4>Math.abs(l-i)&&1e-4>Math.abs(s)?[i,0]:[l,s]};return i.isStepper=!0,i.dt=n,i};class OP{setTimeout(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=performance.now(),n=null,i=a=>{a-r>=t?e(a):"function"==typeof requestAnimationFrame&&(n=requestAnimationFrame(i))};return n=requestAnimationFrame(i),()=>{null!=n&&cancelAnimationFrame(n)}}}var OC=(0,H.createContext)(function(){var e,t,r,n,i;return e=new OP,t=()=>null,r=!1,n=null,i=a=>{if(!r){if(Array.isArray(a)){if(!a.length)return;var[s,...l]=a;if("number"==typeof s){n=e.setTimeout(i.bind(null,l),s);return}i(s),n=e.setTimeout(i.bind(null,l));return}"string"==typeof a&&t(a),"object"==typeof a&&t(a),"function"==typeof a&&a()}},{stop:()=>{r=!0},start:e=>{r=!1,n&&(n(),n=null),i(e)},subscribe:e=>(t=e,()=>{t=()=>null}),getTimeoutController:()=>e}}),OA={begin:0,duration:1e3,easing:"ease",isActive:!0,canBegin:!0,onAnimationEnd:()=>{},onAnimationStart:()=>{}},OE={t:0},OM={t:1};function OT(e){var t,r,n,i=k8(e,OA),{isActive:a,canBegin:s,duration:l,easing:o,begin:c,onAnimationEnd:d,onAnimationStart:u,children:h}=i,p="auto"===a?!N6.isSsr:a,m=(t=i.animationId,r=i.animationManager,n=(0,H.useContext)(OC),(0,H.useMemo)(()=>null!=r?r:n(t),[t,r,n])),[f,x]=(0,H.useState)(p?OE:OM),y=(0,H.useRef)(null);return(0,H.useEffect)(()=>{p||x(OM)},[p]),(0,H.useEffect)(()=>{if(!p||!s)return pS;var e=((e,t,r,n,i,a)=>{var s,l,o,c,d,u,h,p,m=[Object.keys(e),Object.keys(t)].reduce((e,t)=>e.filter(e=>t.includes(e)));return null==r?()=>(i(Oy(Oy({},e),t)),()=>{}):!0===r.isStepper?(l=m.reduce((r,n)=>Oy(Oy({},r),{},{[n]:{from:e[n],velocity:0,to:t[n]}}),{}),o=null,c=n=>{s||(s=n);var d=(n-s)/r.dt;l=Ob(r,l,d),i(Oy(Oy(Oy({},e),t),Of((e,t)=>t.from,l))),s=n,Object.values(l).filter(Ov).length&&(o=a.setTimeout(c))},()=>(o=a.setTimeout(c),()=>{var e;null==(e=o)||e()})):(u=null,h=m.reduce((r,n)=>{var i=e[n],a=t[n];return null==i||null==a?r:Oy(Oy({},r),{},{[n]:[i,a]})},{}),p=s=>{d||(d=s);var l=(s-d)/n,o=Of((e,t)=>Og(...t,r(l)),h);if(i(Oy(Oy(Oy({},e),t),o)),l<1)u=a.setTimeout(p);else{var c=Of((e,t)=>Og(...t,r(1)),h);i(Oy(Oy(Oy({},e),t),c))}},()=>(u=a.setTimeout(p),()=>{var e;null==(e=u)||e()}))})(OE,OM,(e=>{if("string"==typeof e)switch(e){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return OS(e);case"spring":return OO();default:if("cubic-bezier"===e.split("(")[0])return OS(e)}return"function"==typeof e?e:null})(o),l,x,m.getTimeoutController());return m.start([u,c,()=>{y.current=e()},l,d]),()=>{m.stop(),y.current&&y.current(),d()}},[p,s,l,o,c,u,d,m]),h(f.t)}function O_(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"animation-",r=(0,H.useRef)(pv(t)),n=(0,H.useRef)(e);return n.current!==e&&(r.current=pv(t),n.current=e),r.current}var OD=["radius"],OI=["radius"];function Oz(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function OL(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Oz(Object(r),!0).forEach(function(t){var n,i,a;n=e,i=t,a=r[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in n?Object.defineProperty(n,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):n[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Oz(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function OR(){return(OR=Object.assign.bind()).apply(null,arguments)}function OF(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r={};for(var n in e)if(({}).hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;r[n]=e[n]}return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],-1===t.indexOf(r)&&({}).propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function O$(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var OB=(e,t,r,n,i)=>{var a=pu(r),s=pu(n),l=Math.min(Math.abs(a)/2,Math.abs(s)/2),o=s>=0?1:-1,c=a>=0?1:-1,d=+(s>=0&&a>=0||s<0&&a<0);if(l>0&&Array.isArray(i)){for(var u=[0,0,0,0],h=0;h<4;h++){var p,m,f=null!=(m=i[h])?m:0;u[h]=f>l?l:f}p=ph(N||(N=O$(["M",",",""])),e,t+o*u[0]),u[0]>0&&(p+=ph(k||(k=O$(["A ",",",",0,0,",",",",",""])),u[0],u[0],d,e+c*u[0],t)),p+=ph(S||(S=O$(["L ",",",""])),e+r-c*u[1],t),u[1]>0&&(p+=ph(O||(O=O$(["A ",",",",0,0,",",\n ",",",""])),u[1],u[1],d,e+r,t+o*u[1])),p+=ph(P||(P=O$(["L ",",",""])),e+r,t+n-o*u[2]),u[2]>0&&(p+=ph(C||(C=O$(["A ",",",",0,0,",",\n ",",",""])),u[2],u[2],d,e+r-c*u[2],t+n)),p+=ph(A||(A=O$(["L ",",",""])),e+c*u[3],t+n),u[3]>0&&(p+=ph(E||(E=O$(["A ",",",",0,0,",",\n ",",",""])),u[3],u[3],d,e,t+n-o*u[3])),p+="Z"}else if(l>0&&i===+i&&i>0){var x=Math.min(l,i);p=ph(M||(M=O$(["M ",",","\n A ",",",",0,0,",",",",","\n L ",",","\n A ",",",",0,0,",",",",","\n L ",",","\n A ",",",",0,0,",",",",","\n L ",",","\n A ",",",",0,0,",",",","," Z"])),e,t+o*x,x,x,d,e+c*x,t,e+r-c*x,t,x,x,d,e+r,t+o*x,e+r,t+n-o*x,x,x,d,e+r-c*x,t+n,e+c*x,t+n,x,x,d,e,t+n-o*x)}else p=ph(T||(T=O$(["M ",","," h "," v "," h "," Z"])),e,t,r,n,-r);return p},OU={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},Oq=e=>{var t=k8(e,OU),r=(0,H.useRef)(null),[n,i]=(0,H.useState)(-1);(0,H.useEffect)(()=>{if(r.current&&r.current.getTotalLength)try{var e=r.current.getTotalLength();e&&i(e)}catch(e){}},[]);var{x:a,y:s,width:l,height:o,radius:c,className:d}=t,{animationEasing:u,animationDuration:h,animationBegin:p,isAnimationActive:m,isUpdateAnimationActive:f}=t,x=(0,H.useRef)(l),y=(0,H.useRef)(o),g=(0,H.useRef)(a),v=(0,H.useRef)(s),b=O_((0,H.useMemo)(()=>({x:a,y:s,width:l,height:o,radius:c}),[a,s,l,o,c]),"rectangle-");if(a!==+a||s!==+s||l!==+l||o!==+o||0===l||0===o)return null;var j=sb("recharts-rectangle",d);if(!f){var w=kw(t),{radius:N}=w,k=OF(w,OD);return H.createElement("path",OR({},k,{x:pu(a),y:pu(s),width:pu(l),height:pu(o),radius:"number"==typeof c?c:void 0,className:j,d:OB(a,s,l,o,c)}))}var S=x.current,O=y.current,P=g.current,C=v.current,A="0px ".concat(-1===n?1:n,"px"),E="".concat(n,"px 0px"),M=Om(["strokeDasharray"],h,"string"==typeof u?u:OU.animationEasing);return H.createElement(OT,{animationId:b,key:b,canBegin:n>0,duration:h,easing:u,isActive:f,begin:p},e=>{var n,i=pw(S,l,e),d=pw(O,o,e),u=pw(P,a,e),h=pw(C,s,e);r.current&&(x.current=i,y.current=d,g.current=u,v.current=h),n=m?e>0?{transition:M,strokeDasharray:E}:{strokeDasharray:A}:{strokeDasharray:E};var p=kw(t),{radius:f}=p,b=OF(p,OI);return H.createElement("path",OR({},b,{radius:"number"==typeof c?c:void 0,className:j,d:OB(u,h,i,d,c),ref:r,style:OL(OL({},n),t.style)}))})};function OV(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function OK(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?OV(Object(r),!0).forEach(function(t){var n,i,a;n=e,i=t,a=r[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in n?Object.defineProperty(n,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):n[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):OV(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function OW(){return(OW=Object.assign.bind()).apply(null,arguments)}function OH(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var OQ=(e,t,r,n,i)=>{var a=r-n;return ph(_||(_=OH(["M ",",",""])),e,t)+ph(D||(D=OH(["L ",",",""])),e+r,t)+ph(I||(I=OH(["L ",",",""])),e+r-a/2,t+i)+ph(z||(z=OH(["L ",",",""])),e+r-a/2-n,t+i)+ph(L||(L=OH(["L ",","," Z"])),e,t)},OY={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},OX=e=>{var t=k8(e,OY),{x:r,y:n,upperWidth:i,lowerWidth:a,height:s,className:l}=t,{animationEasing:o,animationDuration:c,animationBegin:d,isUpdateAnimationActive:u}=t,h=(0,H.useRef)(null),[p,m]=(0,H.useState)(-1),f=(0,H.useRef)(i),x=(0,H.useRef)(a),y=(0,H.useRef)(s),g=(0,H.useRef)(r),v=(0,H.useRef)(n),b=O_(e,"trapezoid-");if((0,H.useEffect)(()=>{if(h.current&&h.current.getTotalLength)try{var e=h.current.getTotalLength();e&&m(e)}catch(e){}},[]),r!==+r||n!==+n||i!==+i||a!==+a||s!==+s||0===i&&0===a||0===s)return null;var j=sb("recharts-trapezoid",l);if(!u)return H.createElement("g",null,H.createElement("path",OW({},kw(t),{className:j,d:OQ(r,n,i,a,s)})));var w=f.current,N=x.current,k=y.current,S=g.current,O=v.current,P="0px ".concat(-1===p?1:p,"px"),C="".concat(p,"px 0px"),A=Om(["strokeDasharray"],c,o);return H.createElement(OT,{animationId:b,key:b,canBegin:p>0,duration:c,easing:o,isActive:u,begin:d},e=>{var l=pw(w,i,e),o=pw(N,a,e),c=pw(k,s,e),d=pw(S,r,e),u=pw(O,n,e);h.current&&(f.current=l,x.current=o,y.current=c,g.current=d,v.current=u);var p=e>0?{transition:A,strokeDasharray:C}:{strokeDasharray:P};return H.createElement("path",OW({},kw(t),{className:j,d:OQ(d,u,l,o,c),ref:h,style:OK(OK({},p),t.style)}))})};function OG(){return(OG=Object.assign.bind()).apply(null,arguments)}function OZ(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var OJ=e=>{var{cx:t,cy:r,radius:n,angle:i,sign:a,isExternal:s,cornerRadius:l,cornerIsExternal:o}=e,c=l*(s?1:-1)+n,d=Math.asin(l/c)/vO,u=o?i:i+a*d,h=vP(t,r,c,u);return{center:h,circleTangency:vP(t,r,n,u),lineTangency:vP(t,r,c*Math.cos(d*vO),o?i-a*d:i),theta:d}},O0=e=>{var{cx:t,cy:r,innerRadius:n,outerRadius:i,startAngle:a,endAngle:s}=e,l=pp(s-a)*Math.min(Math.abs(s-a),359.999),o=a+l,c=vP(t,r,i,a),d=vP(t,r,i,o),u=ph(R||(R=OZ(["M ",",","\n A ",",",",0,\n ",",",",\n ",",","\n "])),c.x,c.y,i,i,+(Math.abs(l)>180),+(a>o),d.x,d.y);if(n>0){var h=vP(t,r,n,a),p=vP(t,r,n,o);u+=ph(F||(F=OZ(["L ",",","\n A ",",",",0,\n ",",",",\n ",","," Z"])),p.x,p.y,n,n,+(Math.abs(l)>180),+(a<=o),h.x,h.y)}else u+=ph($||($=OZ(["L ",","," Z"])),t,r);return u},O1={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},O2=e=>{var t,r=k8(e,O1),{cx:n,cy:i,innerRadius:a,outerRadius:s,cornerRadius:l,forceCornerRadius:o,cornerIsExternal:c,startAngle:d,endAngle:u,className:h}=r;if(s<a||d===u)return null;var p=sb("recharts-sector",h),m=s-a,f=pb(l,m,0,!0);return t=f>0&&360>Math.abs(d-u)?(e=>{var{cx:t,cy:r,innerRadius:n,outerRadius:i,cornerRadius:a,forceCornerRadius:s,cornerIsExternal:l,startAngle:o,endAngle:c}=e,d=pp(c-o),{circleTangency:u,lineTangency:h,theta:p}=OJ({cx:t,cy:r,radius:i,angle:o,sign:d,cornerRadius:a,cornerIsExternal:l}),{circleTangency:m,lineTangency:f,theta:x}=OJ({cx:t,cy:r,radius:i,angle:c,sign:-d,cornerRadius:a,cornerIsExternal:l}),y=l?Math.abs(o-c):Math.abs(o-c)-p-x;if(y<0)return s?ph(B||(B=OZ(["M ",",","\n a",",",",0,0,1,",",0\n a",",",",0,0,1,",",0\n "])),h.x,h.y,a,a,2*a,a,a,-(2*a)):O0({cx:t,cy:r,innerRadius:n,outerRadius:i,startAngle:o,endAngle:c});var g=ph(U||(U=OZ(["M ",",","\n A",",",",0,0,",",",",","\n A",",",",0,",",",",",",","\n A",",",",0,0,",",",",","\n "])),h.x,h.y,a,a,+(d<0),u.x,u.y,i,i,+(y>180),+(d<0),m.x,m.y,a,a,+(d<0),f.x,f.y);if(n>0){var{circleTangency:v,lineTangency:b,theta:j}=OJ({cx:t,cy:r,radius:n,angle:o,sign:d,isExternal:!0,cornerRadius:a,cornerIsExternal:l}),{circleTangency:w,lineTangency:N,theta:k}=OJ({cx:t,cy:r,radius:n,angle:c,sign:-d,isExternal:!0,cornerRadius:a,cornerIsExternal:l}),S=l?Math.abs(o-c):Math.abs(o-c)-j-k;if(S<0&&0===a)return"".concat(g,"L").concat(t,",").concat(r,"Z");g+=ph(q||(q=OZ(["L",",","\n A",",",",0,0,",",",",","\n A",",",",0,",",",",",",","\n A",",",",0,0,",",",",","Z"])),N.x,N.y,a,a,+(d<0),w.x,w.y,n,n,+(S>180),+(d>0),v.x,v.y,a,a,+(d<0),b.x,b.y)}else g+=ph(V||(V=OZ(["L",",","Z"])),t,r);return g})({cx:n,cy:i,innerRadius:a,outerRadius:s,cornerRadius:Math.min(f,m/2),forceCornerRadius:o,cornerIsExternal:c,startAngle:d,endAngle:u}):O0({cx:n,cy:i,innerRadius:a,outerRadius:s,startAngle:d,endAngle:u}),H.createElement("path",OG({},kw(r),{className:p,d:t}))};let O5=Math.PI,O4=2*O5,O3=O4-1e-6;function O6(e){this._+=e[0];for(let t=1,r=e.length;t<r;++t)this._+=arguments[t]+e[t]}class O8{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=null==e?O6:function(e){let t=Math.floor(e);if(!(t>=0))throw Error(`invalid digits: ${e}`);if(t>15)return O6;let r=10**t;return function(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=Math.round(arguments[t]*r)/r+e[t]}}(e)}moveTo(e,t){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,t){this._append`L${this._x1=+e},${this._y1=+t}`}quadraticCurveTo(e,t,r,n){this._append`Q${+e},${+t},${this._x1=+r},${this._y1=+n}`}bezierCurveTo(e,t,r,n,i,a){this._append`C${+e},${+t},${+r},${+n},${this._x1=+i},${this._y1=+a}`}arcTo(e,t,r,n,i){if(e*=1,t*=1,r*=1,n*=1,(i*=1)<0)throw Error(`negative radius: ${i}`);let a=this._x1,s=this._y1,l=r-e,o=n-t,c=a-e,d=s-t,u=c*c+d*d;if(null===this._x1)this._append`M${this._x1=e},${this._y1=t}`;else if(u>1e-6)if(Math.abs(d*l-o*c)>1e-6&&i){let h=r-a,p=n-s,m=l*l+o*o,f=Math.sqrt(m),x=Math.sqrt(u),y=i*Math.tan((O5-Math.acos((m+u-(h*h+p*p))/(2*f*x)))/2),g=y/x,v=y/f;Math.abs(g-1)>1e-6&&this._append`L${e+g*c},${t+g*d}`,this._append`A${i},${i},0,0,${+(d*h>c*p)},${this._x1=e+v*l},${this._y1=t+v*o}`}else this._append`L${this._x1=e},${this._y1=t}`}arc(e,t,r,n,i,a){if(e*=1,t*=1,r*=1,a=!!a,r<0)throw Error(`negative radius: ${r}`);let s=r*Math.cos(n),l=r*Math.sin(n),o=e+s,c=t+l,d=1^a,u=a?n-i:i-n;null===this._x1?this._append`M${o},${c}`:(Math.abs(this._x1-o)>1e-6||Math.abs(this._y1-c)>1e-6)&&this._append`L${o},${c}`,r&&(u<0&&(u=u%O4+O4),u>O3?this._append`A${r},${r},0,1,${d},${e-s},${t-l}A${r},${r},0,1,${d},${this._x1=o},${this._y1=c}`:u>1e-6&&this._append`A${r},${r},0,${+(u>=O5)},${d},${this._x1=e+r*Math.cos(i)},${this._y1=t+r*Math.sin(i)}`)}rect(e,t,r,n){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${r*=1}v${+n}h${-r}Z`}toString(){return this._}}function O7(e){let t=3;return e.digits=function(r){if(!arguments.length)return t;if(null==r)t=null;else{let e=Math.floor(r);if(!(e>=0))throw RangeError(`invalid digits: ${r}`);t=e}return e},()=>new O8(t)}O8.prototype;let O9=Math.cos,Pe=Math.sin,Pt=Math.sqrt,Pr=Math.PI,Pn=2*Pr;Pt(3);let Pi={draw(e,t){let r=Pt(t/Pr);e.moveTo(r,0),e.arc(0,0,r,0,Pn)}},Pa=Pt(1/3),Ps=2*Pa,Pl=Pe(Pr/10)/Pe(7*Pr/10),Po=Pe(Pn/10)*Pl,Pc=-O9(Pn/10)*Pl,Pd=Pt(3);Pt(3);let Pu=Pt(3)/2,Ph=1/Pt(12),Pp=(Ph/2+1)*3;var Pm=["type","size","sizeType"];function Pf(){return(Pf=Object.assign.bind()).apply(null,arguments)}function Px(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function Py(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Px(Object(r),!0).forEach(function(t){var n,i,a;n=e,i=t,a=r[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in n?Object.defineProperty(n,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):n[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Px(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var Pg={symbolCircle:Pi,symbolCross:{draw(e,t){let r=Pt(t/5)/2;e.moveTo(-3*r,-r),e.lineTo(-r,-r),e.lineTo(-r,-3*r),e.lineTo(r,-3*r),e.lineTo(r,-r),e.lineTo(3*r,-r),e.lineTo(3*r,r),e.lineTo(r,r),e.lineTo(r,3*r),e.lineTo(-r,3*r),e.lineTo(-r,r),e.lineTo(-3*r,r),e.closePath()}},symbolDiamond:{draw(e,t){let r=Pt(t/Ps),n=r*Pa;e.moveTo(0,-r),e.lineTo(n,0),e.lineTo(0,r),e.lineTo(-n,0),e.closePath()}},symbolSquare:{draw(e,t){let r=Pt(t),n=-r/2;e.rect(n,n,r,r)}},symbolStar:{draw(e,t){let r=Pt(.8908130915292852*t),n=Po*r,i=Pc*r;e.moveTo(0,-r),e.lineTo(n,i);for(let t=1;t<5;++t){let a=Pn*t/5,s=O9(a),l=Pe(a);e.lineTo(l*r,-s*r),e.lineTo(s*n-l*i,l*n+s*i)}e.closePath()}},symbolTriangle:{draw(e,t){let r=-Pt(t/(3*Pd));e.moveTo(0,2*r),e.lineTo(-Pd*r,-r),e.lineTo(Pd*r,-r),e.closePath()}},symbolWye:{draw(e,t){let r=Pt(t/Pp),n=r/2,i=r*Ph,a=r*Ph+r,s=-n;e.moveTo(n,i),e.lineTo(n,a),e.lineTo(s,a),e.lineTo(-.5*n-Pu*i,Pu*n+-.5*i),e.lineTo(-.5*n-Pu*a,Pu*n+-.5*a),e.lineTo(-.5*s-Pu*a,Pu*s+-.5*a),e.lineTo(-.5*n+Pu*i,-.5*i-Pu*n),e.lineTo(-.5*n+Pu*a,-.5*a-Pu*n),e.lineTo(-.5*s+Pu*a,-.5*a-Pu*s),e.closePath()}}},Pv=Math.PI/180,Pb=e=>{var{type:t="circle",size:r=64,sizeType:n="area"}=e,i=Py(Py({},function(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r={};for(var n in e)if(({}).hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;r[n]=e[n]}return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],-1===t.indexOf(r)&&({}).propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}(e,Pm)),{},{type:t,size:r,sizeType:n}),a="circle";"string"==typeof t&&(a=t);var{className:s,cx:l,cy:o}=i,c=kw(i);return px(l)&&px(o)&&px(r)?H.createElement("path",Pf({},c,{className:sb("recharts-symbols",s),transform:"translate(".concat(l,", ").concat(o,")"),d:(()=>{var e,t=(e=a,Pg["symbol".concat(pN(e))]||Pi),i=(function(e,t){let r=null,n=O7(i);function i(){let i;if(r||(r=i=n()),e.apply(this,arguments).draw(r,+t.apply(this,arguments)),i)return r=null,i+""||null}return e="function"==typeof e?e:m0(e||Pi),t="function"==typeof t?t:m0(void 0===t?64:+t),i.type=function(t){return arguments.length?(e="function"==typeof t?t:m0(t),i):e},i.size=function(e){return arguments.length?(t="function"==typeof e?e:m0(+e),i):t},i.context=function(e){return arguments.length?(r=null==e?null:e,i):r},i})().type(t).size(((e,t,r)=>{if("area"===t)return e;switch(r){case"cross":return 5*e*e/9;case"diamond":return .5*e*e/Math.sqrt(3);case"square":return e*e;case"star":var n=18*Pv;return 1.25*e*e*(Math.tan(n)-Math.tan(2*n)*Math.tan(n)**2);case"triangle":return Math.sqrt(3)*e*e/4;case"wye":return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}})(r,n,a))();if(null!==i)return i})()})):null};function Pj(e){this._context=e}function Pw(e){return new Pj(e)}function PN(e){return e[0]}function Pk(e){return e[1]}function PS(e,t){var r=m0(!0),n=null,i=Pw,a=null,s=O7(l);function l(l){var o,c,d,u=(l=mJ(l)).length,h=!1;for(null==n&&(a=i(d=s())),o=0;o<=u;++o)!(o<u&&r(c=l[o],o,l))===h&&((h=!h)?a.lineStart():a.lineEnd()),h&&a.point(+e(c,o,l),+t(c,o,l));if(d)return a=null,d+""||null}return e="function"==typeof e?e:void 0===e?PN:m0(e),t="function"==typeof t?t:void 0===t?Pk:m0(t),l.x=function(t){return arguments.length?(e="function"==typeof t?t:m0(+t),l):e},l.y=function(e){return arguments.length?(t="function"==typeof e?e:m0(+e),l):t},l.defined=function(e){return arguments.length?(r="function"==typeof e?e:m0(!!e),l):r},l.curve=function(e){return arguments.length?(i=e,null!=n&&(a=i(n)),l):i},l.context=function(e){return arguments.length?(null==e?n=a=null:a=i(n=e),l):n},l}function PO(e,t,r){var n=null,i=m0(!0),a=null,s=Pw,l=null,o=O7(c);function c(c){var d,u,h,p,m,f=(c=mJ(c)).length,x=!1,y=Array(f),g=Array(f);for(null==a&&(l=s(m=o())),d=0;d<=f;++d){if(!(d<f&&i(p=c[d],d,c))===x)if(x=!x)u=d,l.areaStart(),l.lineStart();else{for(l.lineEnd(),l.lineStart(),h=d-1;h>=u;--h)l.point(y[h],g[h]);l.lineEnd(),l.areaEnd()}x&&(y[d]=+e(p,d,c),g[d]=+t(p,d,c),l.point(n?+n(p,d,c):y[d],r?+r(p,d,c):g[d]))}if(m)return l=null,m+""||null}function d(){return PS().defined(i).curve(s).context(a)}return e="function"==typeof e?e:void 0===e?PN:m0(+e),t="function"==typeof t?t:void 0===t?m0(0):m0(+t),r="function"==typeof r?r:void 0===r?Pk:m0(+r),c.x=function(t){return arguments.length?(e="function"==typeof t?t:m0(+t),n=null,c):e},c.x0=function(t){return arguments.length?(e="function"==typeof t?t:m0(+t),c):e},c.x1=function(e){return arguments.length?(n=null==e?null:"function"==typeof e?e:m0(+e),c):n},c.y=function(e){return arguments.length?(t="function"==typeof e?e:m0(+e),r=null,c):t},c.y0=function(e){return arguments.length?(t="function"==typeof e?e:m0(+e),c):t},c.y1=function(e){return arguments.length?(r=null==e?null:"function"==typeof e?e:m0(+e),c):r},c.lineX0=c.lineY0=function(){return d().x(e).y(t)},c.lineY1=function(){return d().x(e).y(r)},c.lineX1=function(){return d().x(n).y(t)},c.defined=function(e){return arguments.length?(i="function"==typeof e?e:m0(!!e),c):i},c.curve=function(e){return arguments.length?(s=e,null!=a&&(l=s(a)),c):s},c.context=function(e){return arguments.length?(null==e?a=l=null:l=s(a=e),c):a},c}function PP(){}function PC(e,t,r){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+r)/6)}function PA(e){this._context=e}function PE(e){this._context=e}function PM(e){this._context=e}Pb.registerSymbol=(e,t)=>{Pg["symbol".concat(pN(e))]=t},Pj.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e*=1,t*=1,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t)}}},PA.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:PC(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e*=1,t*=1,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:PC(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}},PE.prototype={areaStart:PP,areaEnd:PP,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(e,t){switch(e*=1,t*=1,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:PC(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}},PM.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e*=1,t*=1,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var r=(this._x0+4*this._x1+e)/6,n=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:PC(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};class PT{constructor(e,t){this._context=e,this._x=t}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line}point(e,t){switch(e*=1,t*=1,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,t,e,t):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+t)/2,e,this._y0,e,t)}this._x0=e,this._y0=t}}function P_(e){this._context=e}P_.prototype={areaStart:PP,areaEnd:PP,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e*=1,t*=1,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function PD(e,t,r){var n=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(n||i<0&&-0),s=(r-e._y1)/(i||n<0&&-0);return((a<0?-1:1)+(s<0?-1:1))*Math.min(Math.abs(a),Math.abs(s),.5*Math.abs((a*i+s*n)/(n+i)))||0}function PI(e,t){var r=e._x1-e._x0;return r?(3*(e._y1-e._y0)/r-t)/2:t}function Pz(e,t,r){var n=e._x0,i=e._y0,a=e._x1,s=e._y1,l=(a-n)/3;e._context.bezierCurveTo(n+l,i+l*t,a-l,s-l*r,a,s)}function PL(e){this._context=e}function PR(e){this._context=new PF(e)}function PF(e){this._context=e}function P$(e){this._context=e}function PB(e){var t,r,n=e.length-1,i=Array(n),a=Array(n),s=Array(n);for(i[0]=0,a[0]=2,s[0]=e[0]+2*e[1],t=1;t<n-1;++t)i[t]=1,a[t]=4,s[t]=4*e[t]+2*e[t+1];for(i[n-1]=2,a[n-1]=7,s[n-1]=8*e[n-1]+e[n],t=1;t<n;++t)r=i[t]/a[t-1],a[t]-=r,s[t]-=r*s[t-1];for(i[n-1]=s[n-1]/a[n-1],t=n-2;t>=0;--t)i[t]=(s[t]-i[t+1])/a[t];for(t=0,a[n-1]=(e[n]+i[n-1])/2;t<n-1;++t)a[t]=2*e[t+1]-i[t+1];return[i,a]}function PU(e,t){this._context=e,this._t=t}function Pq(){return(Pq=Object.assign.bind()).apply(null,arguments)}function PV(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function PK(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?PV(Object(r),!0).forEach(function(t){var n,i,a;n=e,i=t,a=r[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in n?Object.defineProperty(n,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):n[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):PV(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}PL.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:Pz(this,this._t0,PI(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var r=NaN;if(t*=1,(e*=1)!==this._x1||t!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,Pz(this,PI(this,r=PD(this,e,t)),r);break;default:Pz(this,this._t0,r=PD(this,e,t))}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=r}}},(PR.prototype=Object.create(PL.prototype)).point=function(e,t){PL.prototype.point.call(this,t,e)},PF.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,r,n,i,a){this._context.bezierCurveTo(t,e,n,r,a,i)}},P$.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,r=e.length;if(r)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),2===r)this._context.lineTo(e[1],t[1]);else for(var n=PB(e),i=PB(t),a=0,s=1;s<r;++a,++s)this._context.bezierCurveTo(n[0][a],i[0][a],n[1][a],i[1][a],e[s],t[s]);(this._line||0!==this._line&&1===r)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}},PU.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&2===this._point&&this._context.lineTo(this._x,this._y),(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e*=1,t*=1,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var r=this._x*(1-this._t)+e*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,t)}}this._x=e,this._y=t}};var PW={curveBasisClosed:function(e){return new PE(e)},curveBasisOpen:function(e){return new PM(e)},curveBasis:function(e){return new PA(e)},curveBumpX:function(e){return new PT(e,!0)},curveBumpY:function(e){return new PT(e,!1)},curveLinearClosed:function(e){return new P_(e)},curveLinear:Pw,curveMonotoneX:function(e){return new PL(e)},curveMonotoneY:function(e){return new PR(e)},curveNatural:function(e){return new P$(e)},curveStep:function(e){return new PU(e,.5)},curveStepAfter:function(e){return new PU(e,1)},curveStepBefore:function(e){return new PU(e,0)}},PH=e=>m6(e.x)&&m6(e.y),PQ=e=>null!=e.base&&PH(e.base)&&PH(e),PY=e=>e.x,PX=e=>e.y,PG=e=>{var{className:t,points:r,path:n,pathRef:i}=e,a=mX(fK);if((!r||!r.length)&&!n)return null;var s={type:e.type,points:e.points,baseLine:e.baseLine,layout:e.layout||a,connectNulls:e.connectNulls},l=r&&r.length?(e=>{var{type:t="linear",points:r=[],baseLine:n,layout:i,connectNulls:a=!1}=e,s=((e,t)=>{if("function"==typeof e)return e;var r="curve".concat(pN(e));if(("curveMonotone"===r||"curveBump"===r)&&t){var n=PW["".concat(r).concat("vertical"===t?"Y":"X")];if(n)return n}return PW[r]||Pw})(t,i),l=a?r.filter(PH):r;if(Array.isArray(n)){var o=r.map((e,t)=>PK(PK({},e),{},{base:n[t]}));return("vertical"===i?PO().y(PX).x1(PY).x0(e=>e.base.x):PO().x(PY).y1(PX).y0(e=>e.base.y)).defined(PQ).curve(s)(a?o.filter(PQ):o)}return("vertical"===i&&px(n)?PO().y(PX).x1(PY).x0(n):px(n)?PO().x(PY).y1(PX).y0(n):PS().x(PY).y(PX)).defined(PH).curve(s)(l)})(s):n;return H.createElement("path",Pq({},kb(e),((e,t)=>{if(!e||"function"==typeof e||"boolean"==typeof e)return null;var r=e;if((0,H.isValidElement)(e)&&(r=e.props),"object"!=typeof r&&"function"!=typeof r)return null;var n={};return Object.keys(r).forEach(e=>{kx(e)&&(n[e]=t||(t=>r[e](r,t)))}),n})(e),{className:sb("recharts-curve",t),d:null===l?void 0:l,ref:i}))},PZ=["option","shapeType","activeClassName"];function PJ(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function P0(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?PJ(Object(r),!0).forEach(function(t){var n,i,a;n=e,i=t,a=r[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in n?Object.defineProperty(n,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):n[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):PJ(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function P1(e){var{shapeType:t,elementProps:r}=e;switch(t){case"rectangle":return H.createElement(Oq,r);case"trapezoid":return H.createElement(OX,r);case"sector":return H.createElement(O2,r);case"symbols":if("symbols"===t)return H.createElement(Pb,r);break;case"curve":return H.createElement(PG,r);default:return null}}function P2(e){var t,{option:r,shapeType:n,activeClassName:i="recharts-active-shape"}=e,a=function(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r={};for(var n in e)if(({}).hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;r[n]=e[n]}return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],-1===t.indexOf(r)&&({}).propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}(e,PZ);if((0,H.isValidElement)(r))t=(0,H.cloneElement)(r,P0(P0({},a),(0,H.isValidElement)(r)?r.props:r));else if("function"==typeof r)t=r(a,a.index);else if((0,Ou.default)(r)&&"boolean"!=typeof r){var s=P0(P0({},a),r);t=H.createElement(P1,{shapeType:n,elementProps:s})}else t=H.createElement(P1,{shapeType:n,elementProps:a});return a.isActive?H.createElement(Ss,{className:i},t):t}function P5(){return(P5=Object.assign.bind()).apply(null,arguments)}function P4(e){return H.createElement(P2,P5({shapeType:"rectangle",activeClassName:"recharts-active-bar"},e))}var P3=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(r,n)=>{if(px(e))return e;var i=px(r)||null==r;return i?e(r,n):(i||function(e,t){if(!e)throw Error("Invariant failed")}(!1,"minPointSize callback function received a value with type of ".concat(typeof r,". Currently only numbers or null/undefined are supported.")),t)}},P6=(e,t,r)=>{var n=mW();return(i,a)=>s=>{null==e||e(i,a,s),n(mN({activeIndex:String(a),activeDataKey:t,activeCoordinate:i.tooltipPosition,activeGraphicalItemId:r}))}},P8=e=>{var t=mW();return(r,n)=>i=>{null==e||e(r,n,i),t(mk())}},P7=(e,t,r)=>{var n=mW();return(i,a)=>s=>{null==e||e(i,a,s),n(mO({activeIndex:String(a),activeDataKey:t,activeCoordinate:i.tooltipPosition,activeGraphicalItemId:r}))}};function P9(e){var{tooltipEntrySettings:t}=e,r=mW(),n=fj(),i=(0,H.useRef)(null);return(0,H.useLayoutEffect)(()=>{n||(null===i.current?r(mv(t)):i.current!==t&&r(mb({prev:i.current,next:t})),i.current=t)},[t,r,n]),(0,H.useLayoutEffect)(()=>()=>{i.current&&(r(mj(i.current)),i.current=null)},[r]),null}var Ce=["children"],Ct=(0,H.createContext)({data:[],xAxisId:"xAxis-0",yAxisId:"yAxis-0",dataPointFormatter:()=>({x:0,y:0,value:0}),errorBarOffset:0});function Cr(e){var{children:t}=e,r=function(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r={};for(var n in e)if(({}).hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;r[n]=e[n]}return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],-1===t.indexOf(r)&&({}).propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}(e,Ce);return H.createElement(Ct.Provider,{value:r},t)}function Cn(e,t){var r,n,i=mX(t=>v7(t,e)),a=mX(e=>bt(e,t)),s=null!=(r=null==i?void 0:i.allowDataOverflow)?r:v6.allowDataOverflow,l=null!=(n=null==a?void 0:a.allowDataOverflow)?n:v9.allowDataOverflow;return{needClip:s||l,needClipX:s,needClipY:l}}function Ci(e){var{xAxisId:t,yAxisId:r,clipPathId:n}=e,i=mX(k1),{needClipX:a,needClipY:s,needClip:l}=Cn(t,r);if(!l||!i)return null;var{x:o,y:c,width:d,height:u}=i;return H.createElement("clipPath",{id:"clipPath-".concat(n)},H.createElement("rect",{x:a?o:o-d/2,y:s?c:c-u/2,width:a?d:2*d,height:s?u:2*u}))}var Ca=(e,t,r)=>{var n=null!=r?r:e;if(null!=n)return pb(n,t,0)};function Cs(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function Cl(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Cs(Object(r),!0).forEach(function(t){var n,i,a;n=e,i=t,a=r[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in n?Object.defineProperty(n,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):n[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Cs(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function Co(e,t){var r,n;return null!=(r=null==(n=e.graphicalItems.cartesianItems.find(e=>e.id===t))?void 0:n.xAxisId)?r:0}function Cc(e,t){var r,n;return null!=(r=null==(n=e.graphicalItems.cartesianItems.find(e=>e.id===t))?void 0:n.yAxisId)?r:0}var Cd=hy([bo,(e,t)=>t],(e,t)=>e.filter(e=>"bar"===e.type).find(e=>e.id===t)),Cu=hy([Cd],e=>null==e?void 0:e.maxBarSize),Ch=hy([fK,bo,Co,Cc,(e,t,r)=>r],(e,t,r,n,i)=>t.filter(t=>"horizontal"===e?t.xAxisId===r:t.yAxisId===n).filter(e=>e.isPanorama===i).filter(e=>!1===e.hide).filter(e=>"bar"===e.type)),Cp=hy([Ch,e=>e.rootProps.barSize,(e,t)=>{var r=fK(e),n=Co(e,t),i=Cc(e,t);if(null!=n&&null!=i)return"horizontal"===r?jS(e,"xAxis",n):jS(e,"yAxis",i)}],(e,t,r)=>{var n=e.filter(vX),i=e.filter(e=>null==e.stackId);return[...Object.entries(n.reduce((e,t)=>{var r=e[t.stackId];return null==r&&(r=[]),r.push(t),e[t.stackId]=r,e},{})).map(e=>{var n,[i,a]=e;return{stackId:i,dataKeys:a.map(e=>e.dataKey),barSize:Ca(t,r,null==(n=a[0])?void 0:n.barSize)}}),...i.map(e=>({stackId:void 0,dataKeys:[e.dataKey].filter(e=>null!=e),barSize:Ca(t,r,e.barSize)}))]}),Cm=(e,t,r)=>{var n,i,a=fK(e),s=Co(e,t),l=Cc(e,t);if(null!=s&&null!=l)return"horizontal"===a?(n=jT(e,"xAxis",s,r),i=jM(e,"xAxis",s,r)):(n=jT(e,"yAxis",l,r),i=jM(e,"yAxis",l,r)),fs(n,i)},Cf=hy([Cp,vx,e=>e.rootProps.barGap,vy,(e,t,r)=>{var n,i,a,s,l=Cd(e,t);if(null==l)return 0;var o=Co(e,t),c=Cc(e,t);if(null==o||null==c)return 0;var d=fK(e),u=vx(e),{maxBarSize:h}=l;return"horizontal"===d?(a=jT(e,"xAxis",o,r),s=jM(e,"xAxis",o,r)):(a=jT(e,"yAxis",c,r),s=jM(e,"yAxis",c,r)),null!=(n=null!=(i=fs(a,s,!0))?i:null==h?u:h)?n:0},Cm,Cu],(e,t,r,n,i,a,s)=>{var l=function(e,t,r,n,i){var a,s,l=n.length;if(!(l<1)){var o=pb(e,r,0,!0),c=[];if(m6(null==(a=n[0])?void 0:a.barSize)){var d=!1,u=r/l,h=n.reduce((e,t)=>e+(t.barSize||0),0);(h+=(l-1)*o)>=r&&(h-=(l-1)*o,o=0),h>=r&&u>0&&(d=!0,u*=.9,h=l*u);var p={offset:((r-h)/2|0)-o,size:0};s=n.reduce((e,t)=>{var r,n={stackId:t.stackId,dataKeys:t.dataKeys,position:{offset:p.offset+p.size+o,size:d?u:null!=(r=t.barSize)?r:0}},i=[...e,n];return p=n.position,i},c)}else{var m=pb(t,r,0,!0);r-2*m-(l-1)*o<=0&&(o=0);var f=(r-2*m-(l-1)*o)/l;f>1&&(f>>=0);var x=m6(i)?Math.min(f,i):f;s=n.reduce((e,t,r)=>[...e,{stackId:t.stackId,dataKeys:t.dataKeys,position:{offset:m+(f+o)*r+(f-x)/2,size:x}}],c)}return s}}(r,n,i!==a?i:a,e,null==s?t:s);return i!==a&&null!=l&&(l=l.map(e=>Cl(Cl({},e),{},{position:Cl(Cl({},e.position),{},{offset:e.position.offset-i/2})}))),l}),Cx=hy([Cf,Cd],(e,t)=>{if(null!=e&&null!=t){var r=e.find(e=>e.stackId===t.stackId&&null!=t.dataKey&&e.dataKeys.includes(t.dataKey));if(null!=r)return r.position}}),Cy=hy([(e,t,r)=>{var n=fK(e),i=Co(e,t),a=Cc(e,t);if(null!=i&&null!=a)return"horizontal"===n?bA(e,"yAxis",a,r):bA(e,"xAxis",i,r)},Cd],(e,t)=>{var r=vQ(t);if(!e||null==r||null==t)return;var{stackId:n}=t;if(null!=n){var i=e[n];if(i){var{stackedData:a}=i;if(a)return a.find(e=>e.key===r)}}}),Cg=hy([fy,fv,(e,t,r)=>{var n=Co(e,t);if(null!=n)return jT(e,"xAxis",n,r)},(e,t,r)=>{var n=Cc(e,t);if(null!=n)return jT(e,"yAxis",n,r)},(e,t,r)=>{var n=Co(e,t);if(null!=n)return jM(e,"xAxis",n,r)},(e,t,r)=>{var n=Cc(e,t);if(null!=n)return jM(e,"yAxis",n,r)},Cx,fK,(e,t,r)=>r?vn(e):vr(e),Cm,Cy,Cd,(e,t,r,n)=>n],(e,t,r,n,i,a,s,l,o,c,d,u,h)=>{var p,{chartData:m,dataStartIndex:f,dataEndIndex:x}=o;if(null!=u&&null!=s&&null!=t&&("horizontal"===l||"vertical"===l)&&null!=r&&null!=n&&null!=i&&null!=a&&null!=c){var{data:y}=u;if(null!=(p=null!=y&&y.length>0?y:null==m?void 0:m.slice(f,x+1)))return function(e){var{layout:t,barSettings:{dataKey:r,minPointSize:n},pos:i,bandSize:a,xAxis:s,yAxis:l,xAxisTicks:o,yAxisTicks:c,stackedData:d,displayedData:u,offset:h,cells:p,parentViewBox:m,dataStartIndex:f}=e,x="horizontal"===t?l:s,y=d?x.scale.domain():null,g=(e=>{var{numericAxis:t}=e,r=t.scale.domain();if("number"===t.type){var n=Math.min(r[0],r[1]),i=Math.max(r[0],r[1]);return n<=0&&i>=0?0:i<0?i:n}return r[0]})({numericAxis:x}),v=x.scale.map(g);return u.map((e,u)=>{if(d){var x=d[u+f];if(null==x)return null;j=((e,t)=>{if(!t||2!==t.length||!px(t[0])||!px(t[1]))return e;var r=Math.min(t[0],t[1]),n=Math.max(t[0],t[1]),i=[e[0],e[1]];return(!px(e[0])||e[0]<r)&&(i[0]=r),(!px(e[1])||e[1]>n)&&(i[1]=n),i[0]>n&&(i[0]=n),i[1]<r&&(i[1]=r),i})(x,y)}else Array.isArray(j=fe(e,r))||(j=[g,j]);var b=P3(n,0)(j[1],u);if("horizontal"===t){var j,w,N,k,S,O,P,C=l.scale.map(j[0]),A=l.scale.map(j[1]);if(null==C||null==A)return null;w=fn({axis:s,ticks:o,bandSize:a,offset:i.offset,entry:e,index:u}),N=null!=(P=null!=A?A:C)?P:void 0,k=i.size;var E=C-A;if(S=pm(E)?0:E,O={x:w,y:h.top,width:k,height:h.height},Math.abs(b)>0&&Math.abs(S)<Math.abs(b)){var M=pp(S||b)*(Math.abs(b)-Math.abs(S));N-=M,S+=M}}else{var T=s.scale.map(j[0]),_=s.scale.map(j[1]);if(null==T||null==_)return null;if(w=T,N=fn({axis:l,ticks:c,bandSize:a,offset:i.offset,entry:e,index:u}),k=_-T,S=i.size,O={x:h.left,y:N,width:h.width,height:S},Math.abs(b)>0&&Math.abs(k)<Math.abs(b)){var D=pp(k||b)*(Math.abs(b)-Math.abs(k));k+=D}}return null==w||null==N||null==k||null==S?null:C$(C$({},e),{},{stackedBarStart:v,x:w,y:N,width:k,height:S,value:d?j:j[1],payload:e,background:O,tooltipPosition:{x:w+k/2,y:N+S/2},parentViewBox:m},p&&p[u]&&p[u].props)}).filter(Boolean)}({layout:l,barSettings:u,pos:s,parentViewBox:t,bandSize:c,xAxis:r,yAxis:n,xAxisTicks:i,yAxisTicks:a,stackedData:d,displayedData:p,offset:e,cells:h,dataStartIndex:f})}});function Cv(e){var{legendPayload:t}=e,r=mW(),n=fj(),i=(0,H.useRef)(null);return(0,H.useLayoutEffect)(()=>{n||(null===i.current?r(NC(t)):i.current!==t&&r(NA({prev:i.current,next:t})),i.current=t)},[r,n,t]),(0,H.useLayoutEffect)(()=>()=>{i.current&&(r(NE(i.current)),i.current=null)},[r]),null}var Cb=null!=(K=H["useId".toString()])?K:()=>{var[e]=H.useState(()=>pv("uid-"));return e},Cj=(0,H.createContext)(void 0),Cw=e=>{var t,r,n,{id:i,type:a,children:s}=e,l=(t="recharts-".concat(a),r=i,n=Cb(),r||(t?"".concat(t,"-").concat(n):n));return H.createElement(Cj.Provider,{value:l},s(l))},CN=(0,H.memo)(e=>{var t=mW(),r=(0,H.useRef)(null);return(0,H.useLayoutEffect)(()=>{null===r.current?t(Nl(e)):r.current!==e&&t(No({prev:r.current,next:e})),r.current=e},[t,e]),(0,H.useLayoutEffect)(()=>()=>{r.current&&(t(Nc(r.current)),r.current=null)},[t]),null}),Ck=(e,t)=>t,CS=(e,t,r)=>r,CO=hy([Ck,bo,CS],(e,t,r)=>t.filter(e=>"bar"===e.type).filter(t=>t.stackId===e).filter(e=>e.isPanorama===r).filter(e=>!e.hide)),CP=hy([CO],e=>e.map(e=>e.id)),CC=hy([e=>e,Ck,CS],(e,t,r)=>{var n=CP(e,t,r),i=[];return n.forEach(t=>{var n=Cg(e,t,r,void 0);null==n||n.forEach((e,t)=>{i[t]=((e,t)=>{if(!e)return t;if(!t)return e;var r=Math.min(e.x,e.x+e.width,t.x,t.x+t.width),n=Math.min(e.y,e.y+e.height,t.y,t.y+t.height);return{x:r,y:n,width:Math.max(e.x,e.x+e.width,t.x,t.x+t.width)-r,height:Math.max(e.y,e.y+e.height,t.y,t.y+t.height)-n}})(i[t],e)})}),i}),CA=["index"];function CE(){return(CE=Object.assign.bind()).apply(null,arguments)}var CM=(0,H.createContext)(void 0),CT=(e,t)=>"recharts-bar-stack-clip-path-".concat(e,"-").concat(t),C_=e=>{var{index:t}=e,r=function(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r={};for(var n in e)if(({}).hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;r[n]=e[n]}return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],-1===t.indexOf(r)&&({}).propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}(e,CA),n=(e=>{var t=(0,H.useContext)(CM);if(null!=t){var{stackId:r}=t;return"url(#".concat(CT(r,e),")")}})(t);return H.createElement(Ss,CE({className:"recharts-bar-stack-layer",clipPath:n},r))},CD=["onMouseEnter","onMouseLeave","onClick"],CI=["value","background","tooltipPosition"],Cz=["id"],CL=["onMouseEnter","onClick","onMouseLeave"];function CR(){return(CR=Object.assign.bind()).apply(null,arguments)}function CF(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function C$(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?CF(Object(r),!0).forEach(function(t){var n,i,a;n=e,i=t,a=r[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in n?Object.defineProperty(n,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):n[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):CF(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function CB(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r={};for(var n in e)if(({}).hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;r[n]=e[n]}return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],-1===t.indexOf(r)&&({}).propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var CU=Sn.memo(e=>{var{dataKey:t,stroke:r,strokeWidth:n,fill:i,name:a,hide:s,unit:l,tooltipType:o,id:c}=e,d={dataDefinedOnItem:void 0,getPosition:pS,settings:{stroke:r,strokeWidth:n,fill:i,dataKey:t,nameKey:void 0,name:fo(a,t),hide:s,type:o,color:i,unit:l,graphicalItemId:c}};return Sn.createElement(P9,{tooltipEntrySettings:d})});function Cq(e){var t,r=mX(wS),{data:n,dataKey:i,background:a,allOtherBarProps:s}=e,{onMouseEnter:l,onMouseLeave:o,onClick:c}=s,d=CB(s,CD),u=P6(l,i,s.id),h=P8(o),p=P7(c,i,s.id);if(!a||null==n)return null;var m=kj(a);return Sn.createElement(S$,{zIndex:(t=vC.barBackground,a&&"object"==typeof a&&"zIndex"in a&&"number"==typeof a.zIndex&&m6(a.zIndex)?a.zIndex:t)},n.map((e,t)=>{var{value:n,background:s,tooltipPosition:l}=e,o=CB(e,CI);if(!s)return null;var c=u(e,t),f=h(e,t),x=p(e,t),y=C$(C$(C$(C$(C$({option:a,isActive:String(t)===r},o),{},{fill:"#eee"},s),m),Od(d,e,t)),{},{onMouseEnter:c,onMouseLeave:f,onClick:x,dataKey:i,index:t,className:"recharts-bar-background-rectangle"});return Sn.createElement(P4,CR({key:"background-bar-".concat(t)},y))}))}function CV(e){var{showLabels:t,children:r,rects:n}=e,i=null==n?void 0:n.map(e=>{var t={x:e.x,y:e.y,width:e.width,lowerWidth:e.width,upperWidth:e.width,height:e.height};return C$(C$({},t),{},{value:e.value,payload:e.payload,parentViewBox:e.parentViewBox,viewBox:t,fill:e.fill})});return Sn.createElement(Oe,{value:t?i:void 0},r)}function CK(e){var{shape:t,activeBar:r,baseProps:n,entry:i,index:a,dataKey:s}=e,l=mX(wS),o=mX(wP),c=r&&String(a)===l&&(null==o||s===o),d=c?r:t;return c?Sn.createElement(S$,{zIndex:vC.activeBar},Sn.createElement(C_,{index:a},Sn.createElement(P4,CR({},n,{name:String(n.name)},i,{isActive:c,option:d,index:a,dataKey:s})))):Sn.createElement(P4,CR({},n,{name:String(n.name)},i,{isActive:c,option:d,index:a,dataKey:s}))}function CW(e){var{shape:t,baseProps:r,entry:n,index:i,dataKey:a}=e;return Sn.createElement(P4,CR({},r,{name:String(r.name)},n,{isActive:!1,option:t,index:i,dataKey:a}))}function CH(e){var t,{data:r,props:n}=e,i=null!=(t=kb(n))?t:{},{id:a}=i,s=CB(i,Cz),{shape:l,dataKey:o,activeBar:c}=n,{onMouseEnter:d,onClick:u,onMouseLeave:h}=n,p=CB(n,CL),m=P6(d,o,a),f=P8(h),x=P7(u,o,a);return r?Sn.createElement(Sn.Fragment,null,r.map((e,t)=>Sn.createElement(C_,CR({index:t,key:"rectangle-".concat(null==e?void 0:e.x,"-").concat(null==e?void 0:e.y,"-").concat(null==e?void 0:e.value,"-").concat(t),className:"recharts-bar-rectangle"},Od(p,e,t),{onMouseEnter:m(e,t),onMouseLeave:f(e,t),onClick:x(e,t)}),c?Sn.createElement(CK,{shape:l,activeBar:c,baseProps:s,entry:e,index:t,dataKey:o}):Sn.createElement(CW,{shape:l,baseProps:s,entry:e,index:t,dataKey:o})))):null}function CQ(e){var{props:t,previousRectanglesRef:r}=e,{data:n,layout:i,isAnimationActive:a,animationBegin:s,animationDuration:l,animationEasing:o,onAnimationEnd:c,onAnimationStart:d}=t,u=r.current,h=O_(t,"recharts-bar-"),[p,m]=(0,Sn.useState)(!1),f=(0,Sn.useCallback)(()=>{"function"==typeof c&&c(),m(!1)},[c]),x=(0,Sn.useCallback)(()=>{"function"==typeof d&&d(),m(!0)},[d]);return Sn.createElement(CV,{showLabels:!p,rects:n},Sn.createElement(OT,{animationId:h,begin:s,duration:l,isActive:a,easing:o,onAnimationEnd:f,onAnimationStart:x,key:h},e=>{var a=1===e?n:null==n?void 0:n.map((t,r)=>{var n=u&&u[r];if(n)return C$(C$({},t),{},{x:pw(n.x,t.x,e),y:pw(n.y,t.y,e),width:pw(n.width,t.width,e),height:pw(n.height,t.height,e)});if("horizontal"===i){var a=pw(0,t.height,e),s=pw(t.stackedBarStart,t.y,e);return C$(C$({},t),{},{y:s,height:a})}var l=pw(0,t.width,e),o=pw(t.stackedBarStart,t.x,e);return C$(C$({},t),{},{width:l,x:o})});return(e>0&&(r.current=null!=a?a:null),null==a)?null:Sn.createElement(Ss,null,Sn.createElement(CH,{props:t,data:a}))}),Sn.createElement(On,{label:t.label}),t.children)}function CY(e){var t=(0,Sn.useRef)(null);return Sn.createElement(CQ,{previousRectanglesRef:t,props:e})}var CX=(e,t)=>{var r=Array.isArray(e.value)?e.value[1]:e.value;return{x:e.x,y:e.y,value:r,errorVal:fe(e,t)}};class CG extends Sn.PureComponent{render(){var{hide:e,data:t,dataKey:r,className:n,xAxisId:i,yAxisId:a,needClip:s,background:l,id:o}=this.props;if(e||null==t)return null;var c=sb("recharts-bar",n);return Sn.createElement(Ss,{className:c,id:o},s&&Sn.createElement("defs",null,Sn.createElement(Ci,{clipPathId:o,xAxisId:i,yAxisId:a})),Sn.createElement(Ss,{className:"recharts-bar-rectangles",clipPath:s?"url(#clipPath-".concat(o,")"):void 0},Sn.createElement(Cq,{data:t,dataKey:r,background:l,allOtherBarProps:this.props}),Sn.createElement(CY,this.props)))}}var CZ={activeBar:!1,animationBegin:0,animationDuration:400,animationEasing:"ease",background:!1,hide:!1,isAnimationActive:"auto",label:!1,legendType:"rect",minPointSize:0,xAxisId:0,yAxisId:0,zIndex:vC.bar};function CJ(e){var t,r,n,i,{xAxisId:a,yAxisId:s,hide:l,legendType:o,minPointSize:c,activeBar:d,animationBegin:u,animationDuration:h,animationEasing:p,isAnimationActive:m}=e,{needClip:f}=Cn(a,s),x=mX(fK),y=fj(),g=(t=e.children,r=[],n=[],n=Array.isArray(Sl)?Sl.map(e=>Oa(e)):[Oa(Sl)],Oo(t).forEach(e=>{var t=(0,pd.default)(e,"type.displayName")||(0,pd.default)(e,"type.name");t&&-1!==n.indexOf(t)&&r.push(e)}),r),v=mX(t=>Cg(t,e.id,y,g));if("vertical"!==x&&"horizontal"!==x)return null;var b=null==v?void 0:v[0];return i=null==b||null==b.height||null==b.width?0:"vertical"===x?b.height/2:b.width/2,Sn.createElement(Cr,{xAxisId:a,yAxisId:s,data:v,dataPointFormatter:CX,errorBarOffset:i},Sn.createElement(CG,CR({},e,{layout:x,needClip:f,data:v,xAxisId:a,yAxisId:s,hide:l,legendType:o,minPointSize:c,activeBar:d,animationBegin:u,animationDuration:h,animationEasing:p,isAnimationActive:m})))}var C0=Sn.memo(function(e){var t,r,n,i=k8(e,CZ),a=(r=i.stackId,null!=(n=(0,H.useContext)(CM))?n.stackId:null!=r?null==(t=r)?void 0:String(t):void 0),s=fj();return Sn.createElement(Cw,{id:i.id,type:"bar"},e=>Sn.createElement(Sn.Fragment,null,Sn.createElement(Cv,{legendPayload:(e=>{var{dataKey:t,name:r,fill:n,legendType:i,hide:a}=e;return[{inactive:a,dataKey:t,type:i,color:n,value:fo(r,t),payload:e}]})(i)}),Sn.createElement(CU,{dataKey:i.dataKey,stroke:i.stroke,strokeWidth:i.strokeWidth,fill:i.fill,name:i.name,hide:i.hide,unit:i.unit,tooltipType:i.tooltipType,id:e}),Sn.createElement(CN,{type:"bar",id:e,data:void 0,xAxisId:i.xAxisId,yAxisId:i.yAxisId,zAxisId:0,dataKey:i.dataKey,stackId:a,hide:i.hide,barSize:i.barSize,minPointSize:i.minPointSize,maxBarSize:i.maxBarSize,isPanorama:s}),Sn.createElement(S$,{zIndex:i.zIndex},Sn.createElement(CJ,CR({},i,{id:e})))))},ku);C0.displayName="Bar";var C1=function(e){var{width:t,height:r}=e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=(n%180+180)%180*Math.PI/180,a=Math.atan(r/t);return Math.abs(i>a&&i<Math.PI-a?r/Math.sin(i):t/Math.cos(i))};function C2(e,t){if(t<1)return[];if(1===t)return e;for(var r=[],n=0;n<e.length;n+=t){var i=e[n];void 0!==i&&r.push(i)}return r}function C5(e,t,r,n,i){if(e*t<e*n||e*t>e*i)return!1;var a=r();return e*(t-e*a/2-n)>=0&&e*(t+e*a/2-i)<=0}function C4(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function C3(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?C4(Object(r),!0).forEach(function(t){var n,i,a;n=e,i=t,a=r[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in n?Object.defineProperty(n,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):n[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):C4(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var C6=["axisLine","width","height","className","hide","ticks","axisType"];function C8(){return(C8=Object.assign.bind()).apply(null,arguments)}function C7(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function C9(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?C7(Object(r),!0).forEach(function(t){var n,i,a;n=e,i=t,a=r[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in n?Object.defineProperty(n,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):n[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):C7(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var Ae={x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:"bottom",ticks:[],stroke:"#666",tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:"preserveEnd",zIndex:vC.axis};function At(e){var{x:t,y:r,width:n,height:i,orientation:a,mirror:s,axisLine:l,otherSvgProps:o}=e;if(!l)return null;var c=C9(C9(C9({},o),kb(l)),{},{fill:"none"});if("top"===a||"bottom"===a){var d=+("top"===a&&!s||"bottom"===a&&s);c=C9(C9({},c),{},{x1:t,y1:r+d*i,x2:t+n,y2:r+d*i})}else{var u=+("left"===a&&!s||"right"===a&&s);c=C9(C9({},c),{},{x1:t+u*n,y1:r,x2:t+u*n,y2:r+i})}return H.createElement("line",C8({},c,{className:sb("recharts-cartesian-axis-line",(0,pd.default)(l,"className"))}))}function Ar(e){var t,{option:r,tickProps:n,value:i}=e,a=sb(n.className,"recharts-cartesian-axis-tick-value");if(H.isValidElement(r))t=H.cloneElement(r,C9(C9({},n),{},{className:a}));else if("function"==typeof r)t=r(C9(C9({},n),{},{className:a}));else{var s="recharts-cartesian-axis-tick-value";"boolean"!=typeof r&&(s=sb(s,r&&"object"==typeof r&&"className"in r&&"string"==typeof r.className?r.className:"")),t=H.createElement(SR,C8({},n,{className:s}),i)}return t}var An=(0,H.forwardRef)((e,t)=>{var{ticks:r=[],tick:n,tickLine:i,stroke:a,tickFormatter:s,unit:l,padding:o,tickTextProps:c,orientation:d,mirror:u,x:h,y:p,width:m,height:f,tickSize:x,tickMargin:y,fontSize:g,letterSpacing:v,getTicksConfig:b,events:j,axisType:w}=e,N=function(e,t,r){var n,{tick:i,ticks:a,viewBox:s,minTickGap:l,orientation:o,interval:c,tickFormatter:d,unit:u,angle:h}=e;if(!a||!a.length||!i)return[];if(px(c)||N6.isSsr)return null!=(n=C2(a,(px(c)?c:0)+1))?n:[];var p="top"===o||"bottom"===o?"width":"height",m=u&&"width"===p?Sf(u,{fontSize:t,letterSpacing:r}):{width:0,height:0},f=(e,n)=>{var i,a="function"==typeof d?d(e.value,n):e.value;return"width"===p?(i=Sf(a,{fontSize:t,letterSpacing:r}),C1({width:i.width+m.width,height:i.height+m.height},h)):Sf(a,{fontSize:t,letterSpacing:r})[p]},x=a[0],y=a[1],g=a.length>=2&&null!=x&&null!=y?pp(y.coordinate-x.coordinate):1,v=function(e,t,r){var n="width"===r,{x:i,y:a,width:s,height:l}=e;return 1===t?{start:n?i:a,end:n?i+s:a+l}:{start:n?i+s:a+l,end:n?i:a}}(s,g,p);return"equidistantPreserveStart"===c?function(e,t,r,n,i){for(var a,s=(n||[]).slice(),{start:l,end:o}=t,c=0,d=1,u=l;d<=s.length;)if(a=function(){var t,a=null==n?void 0:n[c];if(void 0===a)return{v:C2(n,d)};var s=c,h=()=>(void 0===t&&(t=r(a,s)),t),p=a.coordinate,m=0===c||C5(e,p,h,u,o);m||(c=0,u=l,d+=1),m&&(u=p+e*(h()/2+i),c+=d)}())return a.v;return[]}(g,v,f,a,l):"equidistantPreserveEnd"===c?function(e,t,r,n,i){var a=(n||[]).slice().length;if(0===a)return[];for(var{start:s,end:l}=t,o=1;o<=a;o++){for(var c,d=(a-1)%o,u=s,h=!0,p=d;p<a&&(0===(c=function(){var t,a=n[p];if(null==a)return 0;var s=p,o=()=>(void 0===t&&(t=r(a,s)),t),c=a.coordinate,m=p===d||C5(e,c,o,u,l);if(!m)return h=!1,1;m&&(u=c+e*(o()/2+i))}())||1!==c);p+=o);if(h){for(var m=[],f=d;f<a;f+=o){var x=n[f];null!=x&&m.push(x)}return m}}return[]}(g,v,f,a,l):("preserveStart"===c||"preserveStartEnd"===c?function(e,t,r,n,i,a){var s=(n||[]).slice(),l=s.length,{start:o,end:c}=t;if(a){var d=n[l-1];if(null!=d){var u=r(d,l-1),h=e*(d.coordinate+e*u/2-c);s[l-1]=d=C3(C3({},d),{},{tickCoord:h>0?d.coordinate-h*e:d.coordinate}),null!=d.tickCoord&&C5(e,d.tickCoord,()=>u,o,c)&&(c=d.tickCoord-e*(u/2+i),s[l-1]=C3(C3({},d),{},{isShow:!0}))}}for(var p=a?l-1:l,m=function(t){var n,a=s[t];if(null==a)return 1;var l=a,d=()=>(void 0===n&&(n=r(a,t)),n);if(0===t){var u=e*(l.coordinate-e*d()/2-o);s[t]=l=C3(C3({},l),{},{tickCoord:u<0?l.coordinate-u*e:l.coordinate})}else s[t]=l=C3(C3({},l),{},{tickCoord:l.coordinate});null!=l.tickCoord&&C5(e,l.tickCoord,d,o,c)&&(o=l.tickCoord+e*(d()/2+i),s[t]=C3(C3({},l),{},{isShow:!0}))},f=0;f<p;f++)if(m(f))continue;return s}(g,v,f,a,l,"preserveStartEnd"===c):function(e,t,r,n,i){for(var a=(n||[]).slice(),s=a.length,{start:l}=t,{end:o}=t,c=function(t){var n,c=a[t];if(null==c)return 1;var d=c,u=()=>(void 0===n&&(n=r(c,t)),n);if(t===s-1){var h=e*(d.coordinate+e*u()/2-o);a[t]=d=C3(C3({},d),{},{tickCoord:h>0?d.coordinate-h*e:d.coordinate})}else a[t]=d=C3(C3({},d),{},{tickCoord:d.coordinate});null!=d.tickCoord&&C5(e,d.tickCoord,u,l,o)&&(o=d.tickCoord-e*(u()/2+i),a[t]=C3(C3({},d),{},{isShow:!0}))},d=s-1;d>=0;d--)if(c(d))continue;return a}(g,v,f,a,l)).filter(e=>e.isShow)}(C9(C9({},b),{},{ticks:r}),g,v),k=function(e,t){switch(e){case"left":return t?"start":"end";case"right":return t?"end":"start";default:return"middle"}}(d,u),S=function(e,t){switch(e){case"left":case"right":return"middle";case"top":return t?"start":"end";default:return t?"end":"start"}}(d,u),O=kb(b),P=kj(n),C={};"object"==typeof i&&(C=i);var A=C9(C9({},O),{},{fill:"none"},C),E=N.map(e=>C9({entry:e},function(e,t,r,n,i,a,s,l,o){var c,d,u,h,p,m,f=l?-1:1,x=e.tickSize||s,y=px(e.tickCoord)?e.tickCoord:e.coordinate;switch(a){case"top":c=d=e.coordinate,m=(u=(h=r+!l*i)-f*x)-f*o,p=y;break;case"left":u=h=e.coordinate,p=(c=(d=t+!l*n)-f*x)-f*o,m=y;break;case"right":u=h=e.coordinate,p=(c=(d=t+l*n)+f*x)+f*o,m=y;break;default:c=d=e.coordinate,m=(u=(h=r+l*i)+f*x)+f*o,p=y}return{line:{x1:c,y1:u,x2:d,y2:h},tick:{x:p,y:m}}}(e,h,p,m,f,d,x,u,y))),M=E.map(e=>{var{entry:t,line:r}=e;return H.createElement(Ss,{className:"recharts-cartesian-axis-tick",key:"tick-".concat(t.value,"-").concat(t.coordinate,"-").concat(t.tickCoord)},i&&H.createElement("line",C8({},A,r,{className:sb("recharts-cartesian-axis-tick-line",(0,pd.default)(i,"className"))})))}),T=E.map((e,t)=>{var r,i,{entry:d,tick:u}=e,h=C9(C9(C9(C9({verticalAnchor:S},O),{},{textAnchor:k,stroke:"none",fill:a},u),{},{index:t,payload:d,visibleTicksCount:N.length,tickFormatter:s,padding:o},c),{},{angle:null!=(r=null!=(i=null==c?void 0:c.angle)?i:O.angle)?r:0}),p=C9(C9({},h),P);return H.createElement(Ss,C8({className:"recharts-cartesian-axis-tick-label",key:"tick-label-".concat(d.value,"-").concat(d.coordinate,"-").concat(d.tickCoord)},Od(j,d,t)),n&&H.createElement(Ar,{option:n,tickProps:p,value:"".concat("function"==typeof s?s(d.value,t):d.value).concat(l||"")}))});return H.createElement("g",{className:"recharts-cartesian-axis-ticks recharts-".concat(w,"-ticks")},T.length>0&&H.createElement(S$,{zIndex:vC.label},H.createElement("g",{className:"recharts-cartesian-axis-tick-labels recharts-".concat(w,"-tick-labels"),ref:t},T)),M.length>0&&H.createElement("g",{className:"recharts-cartesian-axis-tick-lines recharts-".concat(w,"-tick-lines")},M))}),Ai=(0,H.forwardRef)((e,t)=>{var{axisLine:r,width:n,height:i,className:a,hide:s,ticks:l,axisType:o}=e,c=function(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r={};for(var n in e)if(({}).hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;r[n]=e[n]}return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],-1===t.indexOf(r)&&({}).propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}(e,C6),[d,u]=(0,H.useState)(""),[h,p]=(0,H.useState)(""),m=(0,H.useRef)(null);(0,H.useImperativeHandle)(t,()=>({getCalculatedWidth:()=>{var t;return(e=>{var{ticks:t,label:r,labelGapWithTick:n=5,tickSize:i=0,tickMargin:a=0}=e,s=0;if(t){Array.from(t).forEach(e=>{if(e){var t=e.getBoundingClientRect();t.width>s&&(s=t.width)}});var l=r?r.getBoundingClientRect().width:0;return Math.round(s+(i+a)+l+(r?n:0))}return 0})({ticks:m.current,label:null==(t=e.labelRef)?void 0:t.current,labelGapWithTick:5,tickSize:e.tickSize,tickMargin:e.tickMargin})}}));var f=(0,H.useCallback)(e=>{if(e){var t=e.getElementsByClassName("recharts-cartesian-axis-tick-value");m.current=t;var r=t[0];if(r){var n=window.getComputedStyle(r),i=n.fontSize,a=n.letterSpacing;(i!==d||a!==h)&&(u(i),p(a))}}},[d,h]);return s||null!=n&&n<=0||null!=i&&i<=0?null:H.createElement(S$,{zIndex:e.zIndex},H.createElement(Ss,{className:sb("recharts-cartesian-axis",a)},H.createElement(At,{x:e.x,y:e.y,width:n,height:i,orientation:e.orientation,mirror:e.mirror,axisLine:r,otherSvgProps:kb(e)}),H.createElement(An,{ref:f,axisType:o,events:c,fontSize:d,getTicksConfig:e,height:e.height,letterSpacing:h,mirror:e.mirror,orientation:e.orientation,padding:e.padding,stroke:e.stroke,tick:e.tick,tickFormatter:e.tickFormatter,tickLine:e.tickLine,tickMargin:e.tickMargin,tickSize:e.tickSize,tickTextProps:e.tickTextProps,ticks:l,unit:e.unit,width:e.width,x:e.x,y:e.y}),H.createElement(SX,{x:e.x,y:e.y,width:e.width,height:e.height,lowerWidth:e.width,upperWidth:e.width},H.createElement(S5,{label:e.label,labelRef:e.labelRef}),e.children)))}),Aa=H.forwardRef((e,t)=>{var r=k8(e,Ae);return H.createElement(Ai,C8({},r,{ref:t}))});Aa.displayName="CartesianAxis";var As=["domain","range"],Al=["domain","range"];function Ao(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r={};for(var n in e)if(({}).hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;r[n]=e[n]}return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],-1===t.indexOf(r)&&({}).propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function Ac(e,t){return e===t||!!(Array.isArray(e)&&2===e.length&&Array.isArray(t))&&2===t.length&&e[0]===t[0]&&e[1]===t[1]}function Ad(e,t){if(e===t)return!0;var{domain:r,range:n}=e,i=Ao(e,As),{domain:a,range:s}=t,l=Ao(t,Al);return!!Ac(r,a)&&!!Ac(n,s)&&ku(i,l)}var Au=["type"],Ah=["dangerouslySetInnerHTML","ticks","scale"],Ap=["id","scale"];function Am(){return(Am=Object.assign.bind()).apply(null,arguments)}function Af(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function Ax(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Af(Object(r),!0).forEach(function(t){var n,i,a;n=e,i=t,a=r[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in n?Object.defineProperty(n,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):n[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Af(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function Ay(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r={};for(var n in e)if(({}).hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;r[n]=e[n]}return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],-1===t.indexOf(r)&&({}).propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function Ag(e){var t=mW(),r=(0,H.useRef)(null),n=fW(),{type:i}=e,a=Ay(e,Au),s=vT(n,"xAxis",i),l=(0,H.useMemo)(()=>{if(null!=s)return Ax(Ax({},a),{},{type:s})},[a,s]);return(0,H.useLayoutEffect)(()=>{null!=l&&(null===r.current?t(w3(l)):r.current!==l&&t(w6({prev:r.current,next:l})),r.current=l)},[l,t]),(0,H.useLayoutEffect)(()=>()=>{r.current&&(t(w8(r.current)),r.current=null)},[t]),null}var Av=e=>{var{xAxisId:t,className:r}=e,n=mX(fv),i=fj(),a="xAxis",s=mX(e=>jE(e,a,t,i)),l=mX(e=>jv(e,t)),o=mX(e=>jw(e,t)),c=mX(e=>v8(e,t));if(null==l||null==o||null==c)return null;var{dangerouslySetInnerHTML:d,ticks:u,scale:h}=e,p=Ay(e,Ah),{id:m,scale:f}=c,x=Ay(c,Ap);return H.createElement(Aa,Am({},p,x,{x:o.x,y:o.y,width:l.width,height:l.height,className:sb("recharts-".concat(a," ").concat(a),r),viewBox:n,ticks:s,axisType:a}))},Ab={allowDataOverflow:v6.allowDataOverflow,allowDecimals:v6.allowDecimals,allowDuplicatedCategory:v6.allowDuplicatedCategory,angle:v6.angle,axisLine:Ae.axisLine,height:v6.height,hide:!1,includeHidden:v6.includeHidden,interval:v6.interval,label:!1,minTickGap:v6.minTickGap,mirror:v6.mirror,orientation:v6.orientation,padding:v6.padding,reversed:v6.reversed,scale:v6.scale,tick:v6.tick,tickCount:v6.tickCount,tickLine:Ae.tickLine,tickSize:Ae.tickSize,type:v6.type,xAxisId:0},Aj=H.memo(e=>{var t=k8(e,Ab);return H.createElement(H.Fragment,null,H.createElement(Ag,{allowDataOverflow:t.allowDataOverflow,allowDecimals:t.allowDecimals,allowDuplicatedCategory:t.allowDuplicatedCategory,angle:t.angle,dataKey:t.dataKey,domain:t.domain,height:t.height,hide:t.hide,id:t.xAxisId,includeHidden:t.includeHidden,interval:t.interval,minTickGap:t.minTickGap,mirror:t.mirror,name:t.name,orientation:t.orientation,padding:t.padding,reversed:t.reversed,scale:t.scale,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit}),H.createElement(Av,t))},Ad);Aj.displayName="XAxis";var Aw=["type"],AN=["dangerouslySetInnerHTML","ticks","scale"],Ak=["id","scale"];function AS(){return(AS=Object.assign.bind()).apply(null,arguments)}function AO(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function AP(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?AO(Object(r),!0).forEach(function(t){var n,i,a;n=e,i=t,a=r[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in n?Object.defineProperty(n,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):n[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):AO(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function AC(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r={};for(var n in e)if(({}).hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;r[n]=e[n]}return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],-1===t.indexOf(r)&&({}).propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function AA(e){var t=mW(),r=(0,H.useRef)(null),n=fW(),{type:i}=e,a=AC(e,Aw),s=vT(n,"yAxis",i),l=(0,H.useMemo)(()=>{if(null!=s)return AP(AP({},a),{},{type:s})},[s,a]);return(0,H.useLayoutEffect)(()=>{null!=l&&(null===r.current?t(w7(l)):r.current!==l&&t(w9({prev:r.current,next:l})),r.current=l)},[l,t]),(0,H.useLayoutEffect)(()=>()=>{r.current&&(t(Ne(r.current)),r.current=null)},[t]),null}function AE(e){var{yAxisId:t,className:r,width:n,label:i}=e,a=(0,H.useRef)(null),s=(0,H.useRef)(null),l=mX(fv),o=fj(),c=mW(),d="yAxis",u=mX(e=>jk(e,t)),h=mX(e=>jN(e,t)),p=mX(e=>jE(e,d,t,o)),m=mX(e=>be(e,t));if((0,H.useLayoutEffect)(()=>{if(!("auto"!==n||!u||SJ(i)||(0,H.isValidElement)(i))&&null!=m){var e=a.current;if(e){var r=e.getCalculatedWidth();Math.round(u.width)!==Math.round(r)&&c(Ni({id:t,width:r}))}}},[p,u,c,i,t,n,m]),null==u||null==h||null==m)return null;var{dangerouslySetInnerHTML:f,ticks:x,scale:y}=e,g=AC(e,AN),{id:v,scale:b}=m,j=AC(m,Ak);return H.createElement(Aa,AS({},g,j,{ref:a,labelRef:s,x:h.x,y:h.y,tickTextProps:"auto"===n?{width:void 0}:{width:n},width:u.width,height:u.height,className:sb("recharts-".concat(d," ").concat(d),r),viewBox:l,ticks:p,axisType:d}))}var AM={allowDataOverflow:v9.allowDataOverflow,allowDecimals:v9.allowDecimals,allowDuplicatedCategory:v9.allowDuplicatedCategory,angle:v9.angle,axisLine:Ae.axisLine,hide:!1,includeHidden:v9.includeHidden,interval:v9.interval,label:!1,minTickGap:v9.minTickGap,mirror:v9.mirror,orientation:v9.orientation,padding:v9.padding,reversed:v9.reversed,scale:v9.scale,tick:v9.tick,tickCount:v9.tickCount,tickLine:Ae.tickLine,tickSize:Ae.tickSize,type:v9.type,width:v9.width,yAxisId:0},AT=H.memo(e=>{var t=k8(e,AM);return H.createElement(H.Fragment,null,H.createElement(AA,{interval:t.interval,id:t.yAxisId,scale:t.scale,type:t.type,domain:t.domain,allowDataOverflow:t.allowDataOverflow,dataKey:t.dataKey,allowDuplicatedCategory:t.allowDuplicatedCategory,allowDecimals:t.allowDecimals,tickCount:t.tickCount,padding:t.padding,includeHidden:t.includeHidden,reversed:t.reversed,ticks:t.ticks,width:t.width,orientation:t.orientation,mirror:t.mirror,hide:t.hide,unit:t.unit,name:t.name,angle:t.angle,minTickGap:t.minTickGap,tick:t.tick,tickFormatter:t.tickFormatter}),H.createElement(AE,t))},Ad);function A_(){return(A_=Object.assign.bind()).apply(null,arguments)}function AD(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function AI(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?AD(Object(r),!0).forEach(function(t){var n,i,a;n=e,i=t,a=r[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in n?Object.defineProperty(n,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):n[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):AD(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function Az(e){return Array.isArray(e)&&py(e[0])&&py(e[1])?e.join(" ~ "):e}AT.displayName="YAxis";var AL={margin:0,padding:10,backgroundColor:"#fff",border:"1px solid #ccc",whiteSpace:"nowrap"},AR={display:"block",paddingTop:4,paddingBottom:4,color:"#000"},AF={},A$=e=>{var{separator:t=" : ",contentStyle:r,itemStyle:n,labelStyle:i=AF,payload:a,formatter:s,itemSorter:l,wrapperClassName:o,labelClassName:c,label:d,labelFormatter:u,accessibilityLayer:h=!1}=e,p=AI(AI({},AL),r),m=AI({margin:0},i),f=null!=d,x=f?d:"",y=sb("recharts-default-tooltip",o),g=sb("recharts-tooltip-label",c);return f&&u&&null!=a&&(x=u(d,a)),H.createElement("div",A_({className:y,style:p},h?{role:"status","aria-live":"assertive"}:{}),H.createElement("p",{className:g,style:m},H.isValidElement(x)?x:"".concat(x)),(()=>{if(a&&a.length){var e=(l?(0,mG.default)(a,l):a).map((e,r)=>{if("none"===e.type)return null;var i=e.formatter||s||Az,{value:l,name:o}=e,c=l,d=o,u=i(l,o,e,r,a);if(Array.isArray(u))[c,d]=u;else{if(null==u)return null;c=u}var h=AI(AI({},AR),{},{color:e.color||AR.color},n);return H.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(r),style:h},py(d)?H.createElement("span",{className:"recharts-tooltip-item-name"},d):null,py(d)?H.createElement("span",{className:"recharts-tooltip-item-separator"},t):null,H.createElement("span",{className:"recharts-tooltip-item-value"},c),H.createElement("span",{className:"recharts-tooltip-item-unit"},e.unit||""))});return H.createElement("ul",{className:"recharts-tooltip-item-list",style:{padding:0,margin:0}},e)}return null})())},AB=H,AU="recharts-tooltip-wrapper",Aq={visibility:"hidden"};function AV(e){var{allowEscapeViewBox:t,coordinate:r,key:n,offset:i,position:a,reverseDirection:s,tooltipDimension:l,viewBox:o,viewBoxDimension:c}=e;if(a&&px(a[n]))return a[n];var d=r[n]-l-(i>0?i:0),u=r[n]+i;if(t[n])return s[n]?d:u;var h=o[n];return null==h?0:s[n]?d<h?Math.max(u,h):Math.max(d,h):null==c?0:u+l>h+c?Math.max(d,h):Math.max(u,h)}function AK(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function AW(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?AK(Object(r),!0).forEach(function(t){AH(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):AK(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function AH(e,t,r){var n;return(t="symbol"==typeof(n=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"))?n:n+"")in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class AQ extends AB.PureComponent{constructor(){super(...arguments),AH(this,"state",{dismissed:!1,dismissedAtCoordinate:{x:0,y:0}}),AH(this,"handleKeyDown",e=>{if("Escape"===e.key){var t,r,n,i;this.setState({dismissed:!0,dismissedAtCoordinate:{x:null!=(t=null==(r=this.props.coordinate)?void 0:r.x)?t:0,y:null!=(n=null==(i=this.props.coordinate)?void 0:i.y)?n:0}})}})}componentDidMount(){document.addEventListener("keydown",this.handleKeyDown)}componentWillUnmount(){document.removeEventListener("keydown",this.handleKeyDown)}componentDidUpdate(){var e,t;this.state.dismissed&&((null==(e=this.props.coordinate)?void 0:e.x)!==this.state.dismissedAtCoordinate.x||(null==(t=this.props.coordinate)?void 0:t.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}render(){var{active:e,allowEscapeViewBox:t,animationDuration:r,animationEasing:n,children:i,coordinate:a,hasPayload:s,isAnimationActive:l,offset:o,position:c,reverseDirection:d,useTranslate3d:u,viewBox:h,wrapperStyle:p,lastBoundingBox:m,innerRef:f,hasPortalFromProps:x}=this.props,{cssClasses:y,cssProperties:g}=function(e){var t,r,n,{allowEscapeViewBox:i,coordinate:a,offsetTop:s,offsetLeft:l,position:o,reverseDirection:c,tooltipBox:d,useTranslate3d:u,viewBox:h}=e;return{cssProperties:t=d.height>0&&d.width>0&&a?function(e){var{translateX:t,translateY:r,useTranslate3d:n}=e;return{transform:n?"translate3d(".concat(t,"px, ").concat(r,"px, 0)"):"translate(".concat(t,"px, ").concat(r,"px)")}}({translateX:r=AV({allowEscapeViewBox:i,coordinate:a,key:"x",offset:l,position:o,reverseDirection:c,tooltipDimension:d.width,viewBox:h,viewBoxDimension:h.width}),translateY:n=AV({allowEscapeViewBox:i,coordinate:a,key:"y",offset:s,position:o,reverseDirection:c,tooltipDimension:d.height,viewBox:h,viewBoxDimension:h.height}),useTranslate3d:u}):Aq,cssClasses:function(e){var{coordinate:t,translateX:r,translateY:n}=e;return sb(AU,{["".concat(AU,"-right")]:px(r)&&t&&px(t.x)&&r>=t.x,["".concat(AU,"-left")]:px(r)&&t&&px(t.x)&&r<t.x,["".concat(AU,"-bottom")]:px(n)&&t&&px(t.y)&&n>=t.y,["".concat(AU,"-top")]:px(n)&&t&&px(t.y)&&n<t.y})}({translateX:r,translateY:n,coordinate:a})}}({allowEscapeViewBox:t,coordinate:a,offsetLeft:"number"==typeof o?o:o.x,offsetTop:"number"==typeof o?o:o.y,position:c,reverseDirection:d,tooltipBox:{height:m.height,width:m.width},useTranslate3d:u,viewBox:h}),v=x?{}:AW(AW({transition:l&&e?"transform ".concat(r,"ms ").concat(n):void 0},g),{},{pointerEvents:"none",visibility:!this.state.dismissed&&e&&s?"visible":"hidden",position:"absolute",top:0,left:0}),b=AW(AW({},v),{},{visibility:!this.state.dismissed&&e&&s?"visible":"hidden"},p);return AB.createElement("div",{xmlns:"http://www.w3.org/1999/xhtml",tabIndex:-1,className:y,style:b,ref:f},i)}}var AY=e.i(40559),AX=["x","y","top","left","width","height","className"];function AG(){return(AG=Object.assign.bind()).apply(null,arguments)}function AZ(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}var AJ=e=>{var{x:t=0,y:r=0,top:n=0,left:i=0,width:a=0,height:s=0,className:l}=e,o=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?AZ(Object(r),!0).forEach(function(t){var n,i,a;n=e,i=t,a=r[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in n?Object.defineProperty(n,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):n[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):AZ(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}({x:t,y:r,top:n,left:i,width:a,height:s},function(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r={};for(var n in e)if(({}).hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;r[n]=e[n]}return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],-1===t.indexOf(r)&&({}).propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}(e,AX));return px(t)&&px(r)&&px(a)&&px(s)&&px(n)&&px(i)?H.createElement("path",AG({},kw(o),{className:sb("recharts-cross",l),d:"M".concat(t,",").concat(n,"v").concat(s,"M").concat(i,",").concat(r,"h").concat(a)})):null};function A0(e){var{cx:t,cy:r,radius:n,startAngle:i,endAngle:a}=e;return{points:[vP(t,r,n,i),vP(t,r,n,a)],cx:t,cy:r,radius:n,startAngle:i,endAngle:a}}function A1(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function A2(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?A1(Object(r),!0).forEach(function(t){var n,i,a;n=e,i=t,a=r[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in n?Object.defineProperty(n,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):n[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):A1(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function A5(){return(A5=Object.assign.bind()).apply(null,arguments)}function A4(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function A3(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?A4(Object(r),!0).forEach(function(t){var n,i,a;n=e,i=t,a=r[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in n?Object.defineProperty(n,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):n[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):A4(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function A6(e){var{cursor:t,cursorComp:r,cursorProps:n}=e;return(0,H.isValidElement)(t)?(0,H.cloneElement)(t,n):(0,H.createElement)(r,n)}function A8(e){var t,r,n,i,a,{coordinate:s,payload:l,index:o,offset:c,tooltipAxisBandSize:d,layout:u,cursor:h,tooltipEventType:p,chartName:m}=e;if(!h||!s||"ScatterChart"!==m&&"axis"!==p)return null;if("ScatterChart"===m)n=s,i=AJ,a=vC.cursorLine;else if("BarChart"===m)t=d/2,n={stroke:"none",fill:"#ccc",x:"horizontal"===u?s.x-t:c.left+.5,y:"horizontal"===u?c.top+.5:s.y-t,width:"horizontal"===u?d:c.width-1,height:"horizontal"===u?c.height-1:d},i=Oq,a=vC.cursorRectangle;else if("radial"===u&&Oc(s)){var{cx:f,cy:x,radius:y,startAngle:g,endAngle:v}=A0(s);n={cx:f,cy:x,startAngle:g,endAngle:v,innerRadius:y,outerRadius:y},i=O2,a=vC.cursorLine}else n={points:function(e,t,r){if("horizontal"===e)return[{x:t.x,y:r.top},{x:t.x,y:r.top+r.height}];if("vertical"===e)return[{x:r.left,y:t.y},{x:r.left+r.width,y:t.y}];if(Oc(t)){if("centric"===e){var{cx:n,cy:i,innerRadius:a,outerRadius:s,angle:l}=t,o=vP(n,i,a,l),c=vP(n,i,s,l);return[{x:o.x,y:o.y},{x:c.x,y:c.y}]}return A0(t)}}(u,s,c)},i=PG,a=vC.cursorLine;var b="object"==typeof h&&"className"in h?h.className:void 0,j=A3(A3(A3(A3({stroke:"#ccc",pointerEvents:"none"},c),n),kj(h)),{},{payload:l,payloadIndex:o,className:sb("recharts-tooltip-cursor",b)});return H.createElement(S$,{zIndex:null!=(r=e.zIndex)?r:a},H.createElement(A6,{cursor:h,cursorComp:i,cursorProps:j}))}function A7(e){var t,r,n,i,a=(t=mX(bS),r=mX(wb),n=mX(wy),t&&n?fs(A2(A2({},t),{},{scale:n}),r):fs(void 0,r)),s=null!=(i=mX(fy))?i:fV,l=mX(fK),o=mX(vb);return null==a||null==s||null==l||null==o?null:H.createElement(A8,A5({},e,{offset:s,layout:l,tooltipAxisBandSize:a,chartName:o}))}function A9(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function Ee(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?A9(Object(r),!0).forEach(function(t){var n,i,a;n=e,i=t,a=r[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in n?Object.defineProperty(n,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):n[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):A9(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function Et(e){return e.dataKey}var Er=[],En={allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",axisId:0,contentStyle:{},cursor:!0,filterNull:!0,includeHidden:!1,isAnimationActive:"auto",itemSorter:"name",itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:" : ",trigger:"hover",useTranslate3d:!1,wrapperStyle:{}};function Ei(e){var t,r,n,i,a,s,l,o,c,d,u,h=k8(e,En),{active:p,allowEscapeViewBox:m,animationDuration:f,animationEasing:x,content:y,filterNull:g,isAnimationActive:v,offset:b,payloadUniqBy:j,position:w,reverseDirection:N,useTranslate3d:k,wrapperStyle:S,cursor:O,shared:P,trigger:C,defaultIndex:A,portal:E,axisId:M}=h,T=mW(),_="number"==typeof A?String(A):A;(0,H.useEffect)(()=>{T(mw({shared:P,trigger:C,axisId:M,active:p,defaultIndex:_}))},[T,P,C,M,p,_]);var D=fq(),I=km(),z=mX(e=>jR(e,P)),{activeIndex:L,isActive:R}=null!=(d=mX(e=>wH(e,z,C,_)))?d:{},F=mX(e=>wW(e,z,C,_)),$=mX(e=>wK(e,z,C,_)),B=mX(e=>wV(e,z,C,_)),U=(0,H.useContext)(kq),q=null!=(u=null!=p?p:R)&&u,[V,K]=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],[t,r]=(0,H.useState)({height:0,left:0,top:0,width:0}),n=(0,H.useCallback)(e=>{if(null!=e){var n=e.getBoundingClientRect(),i={height:n.height,left:n.left,top:n.top,width:n.width};(Math.abs(i.height-t.height)>1||Math.abs(i.left-t.left)>1||Math.abs(i.top-t.top)>1||Math.abs(i.width-t.width)>1)&&r({height:i.height,left:i.left,top:i.top,width:i.width})}},[t.width,t.height,t.top,t.left,...e]);return[t,n]}([F,q]),W="axis"===z?$:void 0;t=mX(e=>((e,t,r)=>{if(null!=t){var n=jH(e);return"axis"===t?"hover"===r?n.axisInteraction.hover.dataKey:n.axisInteraction.click.dataKey:"hover"===r?n.itemInteraction.hover.dataKey:n.itemInteraction.click.dataKey}})(e,z,C)),r=mX(vN),n=mX(vj),i=mX(vw),s=null==(a=mX(kF))?void 0:a.active,l=fq(),(0,H.useEffect)(()=>{if(!s&&null!=n&&null!=r){var e=mA({active:q,coordinate:B,dataKey:t,index:L,label:"number"==typeof W?String(W):W,sourceViewBox:l,graphicalItemId:void 0});kz.emit(kL,n,e,r)}},[s,B,t,L,W,r,n,i,q,l]);var Q=null!=E?E:U;if(null==Q||null==D||null==z)return null;var Y=null!=F?F:Er;q||(Y=Er),g&&Y.length&&(o=Y.filter(e=>null!=e.value&&(!0!==e.hide||h.includeHidden)),Y=!0===j?(0,AY.default)(o,Et):"function"==typeof j?(0,AY.default)(o,j):o);var X=Y.length>0,G=H.createElement(AQ,{allowEscapeViewBox:m,animationDuration:f,animationEasing:x,isAnimationActive:v,active:q,coordinate:B,hasPayload:X,offset:b,position:w,reverseDirection:N,useTranslate3d:k,viewBox:D,wrapperStyle:S,lastBoundingBox:V,innerRef:K,hasPortalFromProps:!!E},(c=Ee(Ee({},h),{},{payload:Y,label:W,active:q,activeIndex:L,coordinate:B,accessibilityLayer:I}),H.isValidElement(y)?H.cloneElement(y,c):"function"==typeof y?H.createElement(y,c):H.createElement(A$,c)));return H.createElement(H.Fragment,null,(0,SF.createPortal)(G,Q),q&&H.createElement(A7,{cursor:O,tooltipEventType:z,coordinate:B,payload:Y,index:L}))}function Ea({stats:e,onNavigate:t}){let r=(0,H.useMemo)(()=>Object.entries(e.byCategory).map(([e,t])=>({category:e,count:t,color:(0,sy.getCategoryColor)(e),thin:t<3})).sort((e,t)=>t.count-e.count),[e.byCategory]);return 0===r.length?(0,W.jsx)("div",{className:"bg-slate-900/50 rounded-lg p-4 text-slate-400 text-sm",children:"No category data available."}):(0,W.jsxs)("div",{className:"bg-slate-900/50 rounded-lg p-4",children:[(0,W.jsx)(fB,{width:"100%",height:36*r.length+20,children:(0,W.jsxs)(Sr,{data:r,layout:"vertical",margin:{left:10,right:30},children:[(0,W.jsx)(Aj,{type:"number",hide:!0}),(0,W.jsx)(AT,{type:"category",dataKey:"category",width:100,tick:{fill:"#94a3b8",fontSize:12},axisLine:!1,tickLine:!1}),(0,W.jsx)(Ei,{contentStyle:{background:"#1e293b",border:"1px solid #334155",borderRadius:8},labelStyle:{color:"#e2e8f0"},itemStyle:{color:"#e2e8f0"}}),(0,W.jsx)(C0,{dataKey:"count",radius:[0,4,4,0],cursor:"pointer",onClick:(e,n)=>{void 0!==n&&r[n]&&t({category:r[n].category})},children:r.map((e,t)=>(0,W.jsx)(Sl,{fill:e.color},t))})]})}),r.some(e=>e.thin)&&(0,W.jsx)("div",{className:"mt-2 flex flex-wrap gap-2",children:r.filter(e=>e.thin).map(e=>(0,W.jsxs)("span",{className:"text-xs text-amber-400 bg-amber-400/10 px-2 py-0.5 rounded",children:["⚠ ",e.category," (",e.count,")"]},e.category))})]})}let Es=(0,lD.default)("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);function El({icon:e,title:t,count:r,children:n}){let[i,a]=(0,H.useState)(!1);return(0,W.jsxs)("div",{className:"border border-slate-800 rounded-lg overflow-hidden",children:[(0,W.jsxs)("button",{onClick:()=>a(!i),className:"w-full flex items-center gap-2 px-3 py-2 hover:bg-slate-800/50 transition-colors",children:[i?(0,W.jsx)(oc,{size:14,className:"text-slate-400"}):(0,W.jsx)(ds.ChevronRight,{size:14,className:"text-slate-400"}),(0,W.jsx)(e,{size:14,className:"text-slate-400"}),(0,W.jsx)("span",{className:"text-sm text-slate-200 flex-1 text-left",children:t}),(0,W.jsx)("span",{className:"text-xs px-1.5 py-0.5 rounded bg-slate-700 text-slate-300",children:r})]}),i&&(0,W.jsx)("div",{className:"px-3 pb-3 space-y-1",children:n})]})}function Eo({project:e}){let{data:t}=(0,st.useQuality)(e),{data:r}=(0,st.useContradictions)(e),n=t?.neverAccessed,i=t?.stale,a=t?.duplicates,s=r?.contradictions??[];return(0,W.jsxs)("div",{className:"space-y-2",children:[(0,W.jsx)(El,{icon:ol,title:"Never Accessed",count:n?.count??0,children:n?.items?.length?n.items.map((e,t)=>(0,W.jsxs)("div",{className:"text-xs text-slate-400 py-1 border-b border-slate-800/50 last:border-0",children:[(0,W.jsx)("span",{className:"text-slate-300",children:String(e.title||"Untitled")}),e.created_at?(0,W.jsx)("span",{className:"ml-2 text-slate-500",children:String(e.created_at).slice(0,10)}):null]},t)):(0,W.jsx)("div",{className:"text-xs text-slate-500",children:"None found"})}),(0,W.jsx)(El,{icon:l8,title:"Stale Memories",count:i?.count??0,children:i?.items?.length?i.items.map((e,t)=>{let r=Number(e.decayed_score??0),n=r<.3?"text-red-400":r<.5?"text-amber-400":"text-slate-400";return(0,W.jsxs)("div",{className:"text-xs text-slate-400 py-1 border-b border-slate-800/50 last:border-0 flex items-center gap-2",children:[(0,W.jsx)("span",{className:`${n} font-mono`,children:r.toFixed(2)}),(0,W.jsx)("span",{className:"text-slate-300",children:String(e.title||"Untitled")})]},t)}):(0,W.jsx)("div",{className:"text-xs text-slate-500",children:"None found"})}),(0,W.jsx)(El,{icon:Es,title:"Duplicates",count:a?.count??0,children:a?.items?.length?a.items.map((e,t)=>(0,W.jsxs)("div",{className:"text-xs text-slate-400 py-1 border-b border-slate-800/50 last:border-0",children:[(0,W.jsx)("span",{className:"text-slate-300",children:String(e.title_a||"Untitled")}),(0,W.jsx)("span",{className:"mx-1 text-slate-600",children:"↔"}),(0,W.jsx)("span",{className:"text-slate-300",children:String(e.title_b||"Untitled")})]},t)):(0,W.jsx)("div",{className:"text-xs text-slate-500",children:"None found"})}),(0,W.jsx)(El,{icon:l0,title:"Contradictions",count:s.length,children:s.length?s.map((e,t)=>(0,W.jsxs)("div",{className:"text-xs py-1 border-b border-slate-800/50 last:border-0",children:[(0,W.jsxs)("div",{className:"flex items-center gap-2 text-slate-400",children:[(0,W.jsx)("span",{className:"font-mono text-amber-400",children:e.score.toFixed(2)}),(0,W.jsx)("span",{className:"text-slate-300",children:e.memoryATitle}),(0,W.jsx)("span",{className:"text-slate-600",children:"↔"}),(0,W.jsx)("span",{className:"text-slate-300",children:e.memoryBTitle})]}),e.reason&&(0,W.jsx)("div",{className:"text-slate-500 mt-0.5 ml-10",children:e.reason})]},t)):(0,W.jsx)("div",{className:"text-xs text-slate-500",children:"None found"})})]})}function Ec({label:e,value:t,detail:r,tone:n="default"}){return(0,W.jsxs)("div",{className:`rounded-xl border p-4 ${"danger"===n?"border-red-500/30 bg-red-500/5":"warning"===n?"border-amber-500/30 bg-amber-500/5":"success"===n?"border-emerald-500/30 bg-emerald-500/5":"border-slate-800 bg-slate-900/70"}`,children:[(0,W.jsx)("div",{className:"text-xs uppercase tracking-[0.18em] text-slate-500",children:e}),(0,W.jsx)("div",{className:"mt-2 text-2xl font-semibold text-white",children:t}),(0,W.jsx)("div",{className:"mt-1 text-sm text-slate-400",children:r})]})}function Ed({action:e}){let t="critical"===e.tone?"border-red-500/30 bg-red-500/8":"warning"===e.tone?"border-amber-500/30 bg-amber-500/8":"border-emerald-500/30 bg-emerald-500/8",r="critical"===e.tone?(0,W.jsx)(l0,{size:16,className:"text-red-400 shrink-0"}):"warning"===e.tone?(0,W.jsx)(oP,{size:16,className:"text-amber-400 shrink-0"}):(0,W.jsx)(oN,{size:16,className:"text-emerald-400 shrink-0"});return(0,W.jsx)("button",{onClick:e.onClick,className:`w-full rounded-xl border p-4 text-left transition-colors hover:border-slate-500/60 hover:bg-slate-800/60 ${t}`,children:(0,W.jsxs)("div",{className:"flex items-start gap-3",children:[r,(0,W.jsxs)("div",{className:"flex-1",children:[(0,W.jsx)("div",{className:"text-sm font-medium text-white",children:e.title}),(0,W.jsx)("div",{className:"mt-1 text-sm text-slate-400",children:e.detail}),(0,W.jsxs)("div",{className:"mt-3 inline-flex items-center gap-1 text-xs font-medium text-cyan-300",children:[e.cta,(0,W.jsx)(oj,{size:12})]})]})]})})}function Eu({card:e,license:t,onOpen:r}){let n=e.feature?t?.features.find(t=>t.feature===e.feature):null,i=!!n&&!n.enabled,a=n?.requiredTier??"pro";return(0,W.jsxs)("div",{className:"rounded-xl border border-slate-800 bg-slate-900/70 p-4",children:[(0,W.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,W.jsxs)("div",{children:[(0,W.jsx)("div",{className:"text-sm font-medium text-white",children:e.title}),(0,W.jsx)("div",{className:"mt-1 text-sm text-slate-400",children:e.detail})]}),i?(0,W.jsxs)("span",{className:`inline-flex items-center gap-1 rounded-full px-2 py-1 text-[10px] font-semibold ${co[a]} ${cl[a]}`,children:[(0,W.jsx)(cr,{size:10}),cs[a]]}):(0,W.jsx)("span",{className:"rounded-full bg-emerald-500/10 px-2 py-1 text-[10px] font-semibold text-emerald-300",children:"Ready"})]}),(0,W.jsxs)("div",{className:"mt-4 flex items-center justify-between",children:[(0,W.jsxs)("button",{onClick:()=>r(e.target),className:"inline-flex items-center gap-1 rounded-lg border border-slate-700 px-3 py-2 text-xs font-medium text-slate-200 transition-colors hover:border-slate-500 hover:bg-slate-800",children:[i?`See ${cs[a]} workflow`:e.cta,(0,W.jsx)(oj,{size:12})]}),i&&(0,W.jsx)("a",{href:"https://shieldcortex.ai/pricing",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-cyan-300 hover:text-cyan-200",children:"Upgrade"})]})]})}function Eh({stats:e,selectedProject:t}){let{setViewMode:r,setCategoryFilter:n,setTypeFilter:i,setSelectedMemory:a,setReviewFocus:s}=(0,sr.useDashboardStore)(),{data:l}=(0,lq.useAuditStats)("24h",t||void 0),{data:o}=(0,lq.useQuarantine)("pending",10,t||void 0),{data:c}=(0,st.useQuality)(t||void 0),{data:d}=(0,st.useContradictions)(t||void 0),{data:u}=lQ(),h=e?.total??0,p=e?.decayDistribution?.healthy??0,m=e?.decayDistribution?.fading??0,f=e?.decayDistribution?.critical??0,x=e?.decayDistribution?Math.round(p/Math.max(1,h)*100):null,y=d?.count??d?.contradictions.length??0,g=o?.total??0,v=l?.blockedCount??0,b=c?.duplicates.count??0,j=c?.stale.count??0,w=c?.neverAccessed.count??0,N=(0,H.useMemo)(()=>Object.entries(e?.byCategory??{}).filter(([,e])=>e<3).sort((e,t)=>e[1]-t[1]),[e?.byCategory]),k=(0,H.useCallback)(e=>{a(null),r(e)},[a,r]),S=(0,H.useCallback)(e=>{a(null),s(e),r("review")},[s,a,r]),O=(0,H.useCallback)(e=>{n(e?.category??null),i(e?.type??null),a(null),r("memories")},[n,a,i,r]),P=(0,H.useMemo)(()=>{let e=[];if(g>0&&e.push({title:`${g} item${1===g?"":"s"} waiting in quarantine`,detail:"Review blocked or quarantined writes before they pile up into silent operator debt.",tone:g>10?"critical":"warning",cta:"Open review queue",onClick:()=>{s(null),k("quarantine")}}),y>0&&e.push({title:`${y} contradiction${1===y?"":"s"} in memory`,detail:"Conflicting facts reduce recall trust and are worth resolving before they become reinforced.",tone:y>5?"critical":"warning",cta:"Resolve contradictions",onClick:()=>S("contradictions")}),(j>0||w>0||b>0)&&e.push({title:"Memory cleanup work is available",detail:`${j} stale, ${b} duplicate, ${w} never-accessed memories are reducing signal quality.`,tone:j+b>10?"warning":"healthy",cta:b>0?"Merge duplicates":j>0?"Review stale memories":"Review unused memories",onClick:()=>S(b>0?"duplicates":j>0?"stale":"neverUsed")}),N.length>0){let[t,r]=N[0];e.push({title:"Knowledge coverage is thin in at least one category",detail:`${t} only has ${r} memor${1===r?"y":"ies"} right now, which makes recall brittle in that area.`,tone:"warning",cta:"Browse category coverage",onClick:()=>O({category:t})})}return 0===e.length&&e.push({title:"No urgent trust issues right now",detail:"Memory health, quarantine, and contradiction signals all look stable. This is a good time to explore the graph or recent audit activity.",tone:"healthy",cta:"Open graph view",onClick:()=>k("graph")}),e.slice(0,4)},[g,y,j,w,b,N,O,S,k,s]);return(0,W.jsx)("div",{className:"h-full overflow-y-auto p-6",children:(0,W.jsxs)("div",{className:"mx-auto max-w-7xl space-y-6",children:[(0,W.jsx)("section",{className:"rounded-2xl border border-slate-800 bg-gradient-to-br from-slate-950 via-slate-900 to-cyan-950/20 p-6",children:(0,W.jsxs)("div",{className:"flex flex-col gap-5 lg:flex-row lg:items-end lg:justify-between",children:[(0,W.jsxs)("div",{className:"max-w-3xl",children:[(0,W.jsxs)("div",{className:"inline-flex items-center gap-2 rounded-full border border-cyan-500/20 bg-cyan-500/10 px-3 py-1 text-xs font-medium text-cyan-300",children:[(0,W.jsx)(lZ,{size:12}),"Trust Console"]}),(0,W.jsx)("h2",{className:"mt-4 text-3xl font-semibold text-white",children:"One place to see whether your memory system is actually healthy."}),(0,W.jsx)("p",{className:"mt-3 text-sm leading-6 text-slate-400",children:t?`Project scope: ${t}. This view pulls memory quality, threat pressure, review queue, and graph coverage into one operational surface.`:"Workspace scope: all projects. This view pulls memory quality, threat pressure, review queue, and graph coverage into one operational surface."})]}),(0,W.jsxs)("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4 lg:w-[480px]",children:[(0,W.jsx)(Ec,{label:"Memory Base",value:String(h),detail:`${e?.averageSalience?`${Math.round(100*e.averageSalience)}% avg salience`:"No salience data yet"}`}),(0,W.jsx)(Ec,{label:"Healthy",value:null===x?"—":`${x}%`,detail:`${p} healthy \xb7 ${m} fading \xb7 ${f} critical`,tone:null!==x&&x<50?"warning":"success"}),(0,W.jsx)(Ec,{label:"Queue",value:String(g),detail:"Pending quarantine review",tone:g>0?"warning":"success"}),(0,W.jsx)(Ec,{label:"Blocked",value:String(v),detail:"Blocked operations in the last 24h",tone:v>0?"danger":"success"})]})]})}),(0,W.jsxs)("section",{className:"grid grid-cols-1 gap-6 xl:grid-cols-[1.15fr_0.85fr]",children:[(0,W.jsxs)("div",{className:"rounded-2xl border border-slate-800 bg-slate-900/60 p-5",children:[(0,W.jsxs)("div",{className:"flex items-center justify-between",children:[(0,W.jsxs)("div",{children:[(0,W.jsx)("h3",{className:"text-lg font-semibold text-white",children:"Urgent actions"}),(0,W.jsx)("p",{className:"mt-1 text-sm text-slate-400",children:"These are the quickest wins for trust, safety, or recall quality."})]}),(0,W.jsxs)("span",{className:"rounded-full bg-slate-800 px-2.5 py-1 text-xs text-slate-400",children:[P.length," active"]})]}),(0,W.jsx)("div",{className:"mt-4 grid grid-cols-1 gap-3",children:P.map(e=>(0,W.jsx)(Ed,{action:e},e.title))})]}),(0,W.jsxs)("div",{className:"rounded-2xl border border-slate-800 bg-slate-900/60 p-5",children:[(0,W.jsx)("h3",{className:"text-lg font-semibold text-white",children:"Operator snapshot"}),(0,W.jsx)("p",{className:"mt-1 text-sm text-slate-400",children:"A compact read of the things that most often turn into recall or trust problems."}),(0,W.jsxs)("div",{className:"mt-4 space-y-3",children:[(0,W.jsxs)("div",{className:"rounded-xl border border-slate-800 bg-slate-950/70 p-4",children:[(0,W.jsx)("div",{className:"text-sm font-medium text-white",children:"Memory hygiene"}),(0,W.jsxs)("div",{className:"mt-2 grid grid-cols-3 gap-3 text-sm",children:[(0,W.jsxs)("div",{children:[(0,W.jsx)("div",{className:"text-xl font-semibold text-white",children:b}),(0,W.jsx)("div",{className:"text-slate-500",children:"duplicates"})]}),(0,W.jsxs)("div",{children:[(0,W.jsx)("div",{className:"text-xl font-semibold text-white",children:j}),(0,W.jsx)("div",{className:"text-slate-500",children:"stale"})]}),(0,W.jsxs)("div",{children:[(0,W.jsx)("div",{className:"text-xl font-semibold text-white",children:w}),(0,W.jsx)("div",{className:"text-slate-500",children:"never used"})]})]})]}),(0,W.jsxs)("div",{className:"rounded-xl border border-slate-800 bg-slate-950/70 p-4",children:[(0,W.jsx)("div",{className:"text-sm font-medium text-white",children:"Knowledge coverage"}),(0,W.jsx)("div",{className:"mt-2 text-sm text-slate-400",children:N.length>0?(0,W.jsxs)(W.Fragment,{children:["Thin categories:"," ",N.slice(0,3).map(([e,t])=>`${e} (${t})`).join(" · ")]}):"No obviously thin categories right now."}),(0,W.jsxs)("button",{onClick:()=>k("graph"),className:"mt-3 inline-flex items-center gap-1 text-xs font-medium text-cyan-300",children:["Open graph coverage",(0,W.jsx)(oj,{size:12})]})]}),(0,W.jsxs)("div",{className:"rounded-xl border border-slate-800 bg-slate-950/70 p-4",children:[(0,W.jsx)("div",{className:"text-sm font-medium text-white",children:"Free vs Pro value"}),(0,W.jsx)("div",{className:"mt-2 text-sm text-slate-400",children:"Free gives visibility and cleanup. Pro adds stronger audit workflows, custom policy controls, and deeper skill review."})]})]})]})]}),(0,W.jsxs)("section",{className:"grid grid-cols-1 gap-6 xl:grid-cols-[1fr_1fr]",children:[(0,W.jsxs)("div",{className:"rounded-2xl border border-slate-800 bg-slate-900/60 p-5",children:[(0,W.jsxs)("div",{className:"flex items-center justify-between",children:[(0,W.jsxs)("div",{children:[(0,W.jsx)("h3",{className:"text-lg font-semibold text-white",children:"Knowledge coverage"}),(0,W.jsx)("p",{className:"mt-1 text-sm text-slate-400",children:"Thin categories are usually where recall feels random or incomplete."})]}),(0,W.jsxs)("button",{onClick:()=>k("graph"),className:"inline-flex items-center gap-1 rounded-lg border border-slate-700 px-3 py-2 text-xs text-slate-200 hover:border-slate-500 hover:bg-slate-800",children:[(0,W.jsx)(l5,{size:12}),"Open graph"]})]}),(0,W.jsx)("div",{className:"mt-4",children:e?(0,W.jsx)(Ea,{stats:e,onNavigate:({category:e})=>O({category:e??null})}):(0,W.jsx)("div",{className:"rounded-lg bg-slate-950/70 p-4 text-sm text-slate-500",children:"No category data available yet."})})]}),(0,W.jsxs)("div",{className:"rounded-2xl border border-slate-800 bg-slate-900/60 p-5",children:[(0,W.jsxs)("div",{className:"flex items-center justify-between",children:[(0,W.jsxs)("div",{children:[(0,W.jsx)("h3",{className:"text-lg font-semibold text-white",children:"Memory cleanup"}),(0,W.jsx)("p",{className:"mt-1 text-sm text-slate-400",children:"The fastest way to improve recall is usually removing ambiguity and dead weight."})]}),(0,W.jsxs)("button",{onClick:()=>k("memories"),className:"inline-flex items-center gap-1 rounded-lg border border-slate-700 px-3 py-2 text-xs text-slate-200 hover:border-slate-500 hover:bg-slate-800",children:[(0,W.jsx)(l1,{size:12}),"Open memories"]})]}),(0,W.jsx)("div",{className:"mt-4",children:(0,W.jsx)(Eo,{project:t||void 0})})]})]}),(0,W.jsxs)("section",{className:"grid grid-cols-1 gap-6 xl:grid-cols-[0.9fr_1.1fr]",children:[(0,W.jsxs)("div",{className:"rounded-2xl border border-slate-800 bg-slate-900/60 p-5",children:[(0,W.jsxs)("div",{className:"flex items-center gap-2",children:[(0,W.jsx)(ct.Sparkles,{size:16,className:"text-cyan-400"}),(0,W.jsx)("h3",{className:"text-lg font-semibold text-white",children:"Free workflows"})]}),(0,W.jsx)("p",{className:"mt-1 text-sm text-slate-400",children:"These are the core jobs the free dashboard should do well every day."}),(0,W.jsx)("div",{className:"mt-4 space-y-3",children:[{title:"Debug recall behavior",detail:"Run a query, inspect ranking factors, and compare expected memories against the returned set.",cta:"Open Recall",target:"recall"},{title:"Clean low-signal memory",detail:"Find stale, contradictory, low-trust, and never-used memories before they degrade recall quality.",cta:"Open Review",target:"review"},{title:"Explore the knowledge map",detail:"Use the graph to understand entity coverage and jump from concepts back to source memories.",cta:"Open Graph",target:"graph"}].map(e=>(0,W.jsxs)("div",{className:"rounded-xl border border-slate-800 bg-slate-950/70 p-4",children:[(0,W.jsx)("div",{className:"text-sm font-medium text-white",children:e.title}),(0,W.jsx)("div",{className:"mt-1 text-sm text-slate-400",children:e.detail}),(0,W.jsxs)("button",{onClick:()=>k(e.target),className:"mt-3 inline-flex items-center gap-1 text-xs font-medium text-cyan-300",children:[e.cta,(0,W.jsx)(oj,{size:12})]})]},e.title))})]}),(0,W.jsxs)("div",{className:"rounded-2xl border border-slate-800 bg-slate-900/60 p-5",children:[(0,W.jsxs)("div",{className:"flex items-center justify-between",children:[(0,W.jsxs)("div",{className:"flex items-center gap-2",children:[(0,W.jsx)(l3,{size:16,className:"text-violet-400"}),(0,W.jsx)("h3",{className:"text-lg font-semibold text-white",children:"Pro workflows"})]}),(0,W.jsx)("span",{className:`rounded-full px-2.5 py-1 text-xs font-medium ${co[u?.tier??"free"]} ${cl[u?.tier??"free"]}`,children:cs[u?.tier??"free"]})]}),(0,W.jsx)("p",{className:"mt-1 text-sm text-slate-400",children:"Paid value should save operator time, not just expose more settings."}),(0,W.jsx)("div",{className:"mt-4 grid grid-cols-1 gap-3 lg:grid-cols-3",children:[{feature:"audit_export",title:"Incident export",detail:"Turn audit history into a reviewable export for incidents, customer proof, or compliance evidence.",cta:"Open Audit export",target:"audit"},{feature:"custom_firewall_rules",title:"Custom defence controls",detail:"Add project-specific allow, block, and quarantine rules instead of relying only on generic patterns.",cta:"Open Security controls",target:"shield"},{feature:"skill_scanner_deep",title:"Deep skill review",detail:"Move from file-by-file scanning to richer skill analysis when reviewing custom agent instructions.",cta:"Open Skills",target:"skills"}].map(e=>(0,W.jsx)(Eu,{card:e,license:u,onOpen:k},e.title))})]})]})]})})}let Ep=[{keys:["g","s"],description:"Go to Shield view"},{keys:["g","m"],description:"Go to Memories view"},{keys:["g","t"],description:"Go to Timeline view"},{keys:["g","g"],description:"Go to Graph view"},{keys:["g","a"],description:"Go to Audit view"},{keys:["g","b"],description:"Go to Brain view"},{keys:["g","d"],description:"Go to Dome view"}],Em=[{keys:["/"],description:"Focus search input"},{keys:["Esc"],description:"Close panel / blur search"},{keys:["?"],description:"Toggle this help overlay"}];function Ef({children:e}){return(0,W.jsx)("kbd",{className:"inline-flex items-center justify-center min-w-[1.5rem] h-6 px-2 bg-slate-700 border border-slate-600 rounded text-xs font-mono text-slate-200 shadow-sm",children:e})}function Ex({shortcut:e}){return(0,W.jsxs)("div",{className:"flex items-center justify-between py-1.5",children:[(0,W.jsx)("span",{className:"text-sm text-slate-300",children:e.description}),(0,W.jsx)("div",{className:"flex items-center gap-1 ml-4 shrink-0",children:e.keys.map((e,t)=>(0,W.jsxs)("span",{className:"flex items-center gap-1",children:[t>0&&(0,W.jsx)("span",{className:"text-slate-500 text-xs",children:"then"}),(0,W.jsx)(Ef,{children:e})]},t))})]})}function Ey({open:e,onClose:t}){let r=(0,H.useRef)(null);return((0,H.useEffect)(()=>{if(!e)return;let n=e=>{r.current&&e.target===r.current&&t()};return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[e,t]),e)?(0,W.jsx)("div",{ref:r,className:"fixed inset-0 z-[100] flex items-center justify-center bg-black/60 backdrop-blur-sm transition-opacity duration-150",style:{opacity:+!!e},children:(0,W.jsxs)("div",{className:"bg-slate-900/95 border border-slate-700 rounded-xl shadow-2xl w-full max-w-md mx-4 p-6 backdrop-blur-md animate-in fade-in zoom-in-95 duration-150",children:[(0,W.jsxs)("div",{className:"flex items-center justify-between mb-5",children:[(0,W.jsx)("h2",{className:"text-lg font-semibold text-white",children:"Keyboard Shortcuts"}),(0,W.jsx)("button",{onClick:t,className:"text-slate-400 hover:text-white transition-colors text-sm",children:(0,W.jsx)(Ef,{children:"Esc"})})]}),(0,W.jsxs)("div",{className:"mb-5",children:[(0,W.jsx)("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-500 mb-2",children:"Navigation"}),(0,W.jsx)("div",{className:"space-y-0.5",children:Ep.map((e,t)=>(0,W.jsx)(Ex,{shortcut:e},t))})]}),(0,W.jsxs)("div",{children:[(0,W.jsx)("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-500 mb-2",children:"Actions"}),(0,W.jsx)("div",{className:"space-y-0.5",children:Em.map((e,t)=>(0,W.jsx)(Ex,{shortcut:e},t))})]}),(0,W.jsxs)("div",{className:"mt-5 pt-4 border-t border-slate-800 text-xs text-slate-500 text-center",children:["Chords: press ",(0,W.jsx)(Ef,{children:"g"})," then a letter within 500ms"]})]})}):null}let Eg=(0,se.default)(()=>e.A(9070),{loadableGenerated:{modules:[13213]},ssr:!1,loading:()=>(0,W.jsx)("div",{className:"w-full h-full flex items-center justify-center bg-slate-950",children:(0,W.jsx)("div",{className:"text-slate-400 animate-pulse",children:"Loading Graph..."})})}),Ev=(0,se.default)(()=>e.A(62838).then(e=>e.BrainControlCentre),{loadableGenerated:{modules:[41740]},ssr:!1,loading:()=>(0,W.jsx)("div",{className:"w-full h-full flex items-center justify-center bg-slate-950",children:(0,W.jsx)("div",{className:"text-slate-400 animate-pulse",children:"Loading Brain Control Centre..."})})});function Eb(){let e,[t,r]=(0,H.useState)(""),[n,i]=(0,H.useState)(!1),[a,s]=(0,H.useState)(!1),l=(0,H.useRef)(null),o=(0,H.useRef)(null),c=sn(t,300),{viewMode:d,setViewMode:u,selectedMemory:h,setSelectedMemory:p,setSelectedAuditEntry:m,projectFilter:f,setProjectFilter:x,typeFilter:y,setTypeFilter:g,categoryFilter:v,setCategoryFilter:b,addEvent:j}=(0,sr.useDashboardStore)(),{showHelp:w,setShowHelp:N}=function(e){let{onFocusSearch:t,onClosePanel:r,onNavigate:n,onToggleHelp:i}=e,[a,s]=(0,H.useState)(!1),l=(0,H.useRef)(null),o=(0,H.useCallback)(e=>{let o=e.target,c=o.tagName.toLowerCase(),d="input"===c||"textarea"===c||"select"===c||o.isContentEditable;if("Escape"===e.key)return a?void s(!1):d?void o.blur():void r();if(d)return;if("/"===e.key){e.preventDefault(),t();return}if("?"===e.key){e.preventDefault(),s(e=>!e),i();return}let u=Date.now(),h=l.current;if("g"===e.key){if(h&&"g"===h.key&&u-h.time<500){l.current=null,n("graph");return}l.current={key:"g",time:u};return}if(h&&"g"===h.key&&u-h.time<500){l.current=null;let t={s:"shield",m:"memories",t:"timeline",a:"audit",b:"brain",d:"dome"}[e.key];if(t)return void n(t)}l.current=null},[t,r,n,i,a]);return(0,H.useEffect)(()=>(document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)),[o]),{showHelp:a,setShowHelp:s}}({onFocusSearch:(0,H.useCallback)(()=>{l.current?.focus()},[]),onClosePanel:(0,H.useCallback)(()=>{p(null),m(null)},[p,m]),onNavigate:(0,H.useCallback)(e=>{u(e)},[u]),onToggleHelp:()=>{}}),{data:k=[]}=(e=sn(t,200),(0,si.useQuery)({queryKey:["suggestions",e],queryFn:()=>sl(e),enabled:e.length>=2,staleTime:3e4,refetchOnWindowFocus:!1})),{data:S}=(0,st.useProjects)();(0,H.useEffect)(()=>{let e=e=>{o.current&&!o.current.contains(e.target)&&l.current&&!l.current.contains(e.target)&&i(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);let{data:O=[],isLoading:P,isConnected:C,lastEvent:A}=(0,st.useMemoriesWithRealtime)({limit:1e3,query:c||void 0,mode:c?"search":"recent",project:f||void 0,type:y||void 0,category:v||void 0}),{data:E,isLoading:M}=(0,st.useStats)(f||void 0),{data:T=[]}=(0,st.useMemoryLinks)(f||void 0),_=(0,H.useRef)(A);(0,H.useEffect)(()=>{!A||A===_.current||(_.current=A,new Set(["memory_created","memory_accessed","memory_updated","memory_deleted","consolidation_complete","decay_tick"]).has(A.type)&&j({type:A.type,timestamp:A.timestamp,data:A.data}))},[A,j]);let D=(0,st.useAccessMemory)();(0,st.useConsolidate)();let{data:I}=(0,st.useControlStatus)();(0,st.usePauseMemory)(),(0,st.useResumeMemory)();let z=I?.paused??!1,{data:L}=o3(),R=L?.enabled&&L?.apiKeySet,F=o1(),$=I?.killSwitchActive??!1;return(0,W.jsxs)("div",{className:"h-screen w-screen bg-slate-950 text-white overflow-hidden flex flex-col",children:[(0,W.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,W.jsxs)("div",{className:"flex items-center gap-4",children:[(0,W.jsxs)("div",{className:"flex items-center gap-2",children:[(0,W.jsx)(lZ,{size:20,className:"text-cyan-400"}),(0,W.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,W.jsx)("div",{title:R?"Connected to ShieldCortex Cloud":"Cloud sync not configured",children:(0,W.jsx)(oe,{size:16,className:R?"text-emerald-400":"text-slate-600"})})]}),(0,W.jsx)("select",{value:f||"",onChange:e=>x(e.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:S?.projects.map(e=>(0,W.jsxs)("option",{value:e.project||"",children:[e.label," (",e.memory_count,")"]},e.project||"all"))}),(0,W.jsxs)("div",{className:"relative",children:[(0,W.jsx)(lT,{ref:l,type:"text",placeholder:"Search memories...",value:t,onChange:e=>{r(e.target.value),i(!0)},onFocus:()=>i(!0),onKeyDown:e=>{"Escape"===e.key&&i(!1)},className:"w-64 bg-slate-800 border-slate-700 text-white placeholder:text-slate-400 focus:ring-cyan-500"}),n&&k.length>0&&(0,W.jsx)("div",{ref:o,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:k.map((e,t)=>(0,W.jsxs)("button",{onClick:()=>{r(e.text),i(!1),l.current?.focus()},className:"w-full px-3 py-2 text-left hover:bg-slate-700 transition-colors flex items-center gap-2",children:[(0,W.jsx)("span",{className:"text-white text-sm truncate flex-1",children:e.text}),(0,W.jsx)("span",{className:"text-xs px-1.5 py-0.5 rounded bg-slate-600 text-slate-300",children:e.type})]},`${e.type}-${e.text}-${t}`))})]}),(0,W.jsxs)(lM,{variant:"outline",size:"sm",onClick:()=>s(!a),className:`border-slate-600 text-slate-300 hover:text-white hover:bg-slate-700 ${a?"bg-slate-700":""}`,title:"Filter memories by type and category",children:["Filters ",(y||v)&&"•"]})]}),(0,W.jsxs)("div",{className:"flex items-center gap-3",children:[$?(0,W.jsxs)("button",{onClick:()=>sr.useDashboardStore.getState().setViewMode("dome"),className:"flex items-center gap-1.5 px-3 py-1.5 bg-red-600/20 border border-red-500/50 rounded-lg text-xs font-bold text-red-400 uppercase tracking-wider animate-pulse cursor-pointer",title:"Kill switch is active — click to view details",children:[(0,W.jsx)(dK,{size:14}),"Kill Switch Active"]}):(0,W.jsxs)("button",{onClick:()=>F.mutate(),disabled:F.isPending,className:"flex items-center gap-1.5 px-3 py-1.5 bg-red-600/10 border border-red-500/30 hover:bg-red-600/20 hover:border-red-500/50 disabled:opacity-50 rounded-lg text-xs font-medium text-red-400 transition-colors",title:"Emergency Stop — immediately halt all agent operations",children:[F.isPending?(0,W.jsx)(ow,{size:12,className:"animate-spin"}):(0,W.jsx)(dK,{size:14}),"Emergency Stop"]}),(0,W.jsxs)("div",{className:"flex items-center gap-2 text-xs text-slate-400 px-2",children:[(0,W.jsx)("span",{className:`w-2 h-2 rounded-full ${$?"bg-red-500 animate-pulse":z?"bg-orange-500 animate-pulse":C?"bg-green-500":"bg-yellow-500"}`,title:$?"Kill switch active — all operations blocked":z?"Memory creation paused":C?"Real-time connected":"Polling mode"}),E?.total??O.length," memories"]})]})]}),a&&(0,W.jsxs)("div",{className:"h-12 border-b border-slate-800 flex items-center gap-4 px-4 bg-slate-900/30",children:[(0,W.jsxs)("div",{className:"flex items-center gap-2",children:[(0,W.jsx)("span",{className:"text-xs text-slate-400",children:"Type:"}),["short_term","long_term","episodic"].map(e=>(0,W.jsx)("button",{onClick:()=>g(y===e?null:e),className:`px-2 py-1 text-xs rounded-full transition-colors ${y===e?"bg-blue-600 text-white":"bg-slate-800 text-slate-300 hover:bg-slate-700"}`,children:e.replace("_","-")},e))]}),(0,W.jsx)("div",{className:"w-px h-6 bg-slate-700"}),(0,W.jsxs)("div",{className:"flex items-center gap-2",children:[(0,W.jsx)("span",{className:"text-xs text-slate-400",children:"Category:"}),["architecture","pattern","error","learning","preference","context"].map(e=>(0,W.jsx)("button",{onClick:()=>b(v===e?null:e),className:`px-2 py-1 text-xs rounded-full transition-colors ${v===e?"bg-purple-600 text-white":"bg-slate-800 text-slate-300 hover:bg-slate-700"}`,children:e},e))]}),(y||v)&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)("div",{className:"w-px h-6 bg-slate-700"}),(0,W.jsx)("button",{onClick:()=>{g(null),b(null)},className:"px-2 py-1 text-xs text-red-400 hover:text-red-300",children:"Clear all"})]})]}),(0,W.jsxs)("div",{className:"flex-1 flex overflow-hidden",children:[(0,W.jsx)(on,{}),(0,W.jsx)(eh,{mode:"wait",children:(0,W.jsxs)(a9.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},className:"flex-1 relative overflow-hidden",children:["overview"===d&&(0,W.jsx)(Eh,{stats:E,selectedProject:f}),"recall"===d&&(0,W.jsx)(cB,{}),"review"===d&&(0,W.jsx)(cY,{}),"shield"===d&&(0,W.jsx)(cP,{}),"cloud"===d&&(0,W.jsx)(cz,{}),"audit"===d&&(0,W.jsx)(c7,{}),"quarantine"===d&&(0,W.jsx)(dn,{}),"brain"===d&&(0,W.jsx)(Ev,{memories:O,links:T,stats:E,isLoading:P}),"graph"===d&&(0,W.jsx)(Eg,{}),"timeline"===d&&(0,W.jsx)(un,{}),"agents"===d&&(0,W.jsx)(dC,{}),"skills"===d&&(0,W.jsx)(dB,{}),"dome"===d&&(0,W.jsx)(d3,{}),"memories"===d&&(0,W.jsx)(lU,{memories:O,selectedMemory:h,onSelectMemory:e=>{p(e)},links:T,onReinforce:e=>{D.mutate(e)},onSelectMemoryById:e=>{let t=O.find(t=>t.id===e);t&&p(t)},isReinforcing:D.isPending,reinforceSuccess:D.isSuccess})]},d)})]}),(0,W.jsx)(Ey,{open:w,onClose:()=>N(!1)})]})}e.s(["default",()=>Eb],23733)}]);