shieldcortex 3.1.0 → 3.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +64 -9
- package/dashboard/.next/standalone/dashboard/.next/BUILD_ID +1 -1
- package/dashboard/.next/standalone/dashboard/.next/build-manifest.json +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.html +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.html +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/index.html +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/index.rsc +3 -3
- package/dashboard/.next/standalone/dashboard/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/index.segments/_full.segment.rsc +3 -3
- package/dashboard/.next/standalone/dashboard/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/index.segments/_index.segment.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/page_client-reference-manifest.js +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_3051539d._.js +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/pages/404.html +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/pages/500.html +2 -2
- package/dashboard/.next/standalone/dashboard/.next/static/chunks/98e2c181d5c4349f.js +1 -0
- package/dashboard/.next/standalone/dashboard/.next/static/chunks/9cb86821c1107fd6.js +9 -0
- package/dashboard/.next/standalone/dashboard/.next/static/chunks/a56c497e02afd4ba.css +3 -0
- package/dashboard/.next/standalone/dashboard/.next/static/chunks/a90355d73183a5e6.js +1 -0
- package/dist/api/routes/memories.js +366 -1
- package/dist/api/routes/recall.js +53 -0
- package/dist/cloud/graph-sync.js +6 -3
- package/dist/cloud/memory-sync.d.ts +1 -0
- package/dist/cloud/memory-sync.js +3 -0
- package/dist/database/init.js +29 -0
- package/dist/memory/search.d.ts +1 -0
- package/dist/memory/search.js +4 -0
- package/dist/memory/store.js +146 -28
- package/dist/memory/types.d.ts +31 -0
- package/dist/setup/quickstart.js +13 -6
- package/dist/tools/context.d.ts +4 -4
- package/dist/tools/forget.d.ts +4 -4
- package/dist/tools/recall.d.ts +8 -8
- package/dist/tools/remember.d.ts +19 -4
- package/dist/tools/remember.js +17 -1
- package/hooks/openclaw/cortex-memory/handler.ts +8 -0
- package/package.json +2 -2
- package/dashboard/.next/standalone/dashboard/.next/static/chunks/0a69eb25d08447ee.js +0 -1
- package/dashboard/.next/standalone/dashboard/.next/static/chunks/3cc7e8d4f73cf5d2.js +0 -1
- package/dashboard/.next/standalone/dashboard/.next/static/chunks/97537d3db46c8467.css +0 -3
- package/dashboard/.next/standalone/dashboard/.next/static/chunks/aa6e9b8a52353969.js +0 -9
- /package/dashboard/.next/standalone/dashboard/.next/static/{RnvqrTXo_jN8SuMdaNcIj → Oi8lTcFeUV-igSMtPHAG-}/_buildManifest.js +0 -0
- /package/dashboard/.next/standalone/dashboard/.next/static/{RnvqrTXo_jN8SuMdaNcIj → Oi8lTcFeUV-igSMtPHAG-}/_clientMiddlewareManifest.json +0 -0
- /package/dashboard/.next/standalone/dashboard/.next/static/{RnvqrTXo_jN8SuMdaNcIj → Oi8lTcFeUV-igSMtPHAG-}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,9 @@
|
|
|
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="",o="",l=!1;for(46===e.charCodeAt(0)&&(t.push(""),a++);a<r;){let n=e[a];o?"\\"===n&&a+1<r?s+=e[++a]:n===o?o="":s+=n:l?'"'===n||"'"===n?o=n:"]"===n?(l=!1,t.push(s),s=""):s+=n:"["===n?(l=!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,o){if(null==t)return o;switch(typeof r){case"string":{if(n.isUnsafeProperty(r))return o;let a=t[r];if(void 0===a)if(i.isDeepKey(r))return e(t,s.toPath(r),o);else return o;return a}case"number":case"symbol":{"number"==typeof r&&(r=a.toKey(r));let e=t[r];if(void 0===e)return o;return e}default:{if(Array.isArray(r)){var l=t,c=r,u=o;if(0===c.length)return u;let e=l;for(let t=0;t<c.length;t++){if(null==e||n.isUnsafeProperty(c[t]))return u;e=e[c[t]]}return void 0===e?u:e}if(r=Object.is(r?.valueOf(),-0)?"-0":String(r),n.isUnsafeProperty(r))return o;let e=t[r];if(void 0===e)return o;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,o=n.useEffect,l=n.useMemo,c=n.useDebugValue;r.useSyncExternalStoreWithSelector=function(e,t,r,n,u){var d=s(null);if(null===d.current){var h={hasValue:!1,value:null};d.current=h}else h=d.current;var p=a(e,(d=l(function(){function e(e){if(!o){if(o=!0,a=e,e=n(e),void 0!==u&&h.hasValue){var t=h.value;if(u(t,e))return s=t}return s=e}if(t=s,i(a,e))return t;var r=n(e);return void 0!==u&&u(t,r)?(a=e,t):(a=e,s=r)}var a,s,o=!1,l=void 0===r?null:r;return[function(){return e(t())},null===l?void 0:function(){return e(l())}]},[t,r,n,u]))[0],d[1]);return o(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 o=(e,t)=>{let r=e;for(let e=0;e<t.length&&null!=r;++e)r=r[t[e]];return r},l=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:l.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]:o(n,r.path):"function"==typeof r?r(n):Array.isArray(r)?o(n,r):"object"==typeof n?n[r]:n})})).slice().sort((e,t)=>{for(let i=0;i<l.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"),o=null==n||n.includes("trailing"),l=()=>{null!==a&&(e.apply(i,a),i=void 0,a=null)},c=null,u=()=>{null!=c&&clearTimeout(c),c=setTimeout(()=>{c=null,o&&l(),d()},t)},d=()=>{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;u(),s&&t&&l()};return h.schedule=u,h.cancel=d,h.flush=()=>{l()},r?.addEventListener("abort",d,{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:o}=r,l=[,,];a&&(l[0]="leading"),s&&(l[1]="trailing");let c=null,u=n.debounce(function(...t){i=e.apply(this,t),c=null},t,{edges:l}),d=function(...t){return null!=o&&(null===c&&(c=Date.now()),Date.now()-c>=o)?(i=e.apply(this,t),c=Date.now(),u.cancel(),u.schedule(),i):(u.apply(this,t),i)};return d.cancel=u.cancel,d.flush=()=>(u.flush(),i),d}},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] ",o=s+"Invalid argument: ",l=s+"Exponent out of range: ",c=Math.floor,u=Math.pow,d=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,h=c(1286742750677284.5),p={};function f(e,t){var r,n,i,s,o,l,c,u,d=e.constructor,h=d.precision;if(!e.s||!t.s)return t.s||(t=new d(e)),a?k(t,h):t;if(c=e.d,u=t.d,o=e.e,i=t.e,c=c.slice(),s=o-i){for(s<0?(n=c,s=-s,l=u.length):(n=u,i=o,l=c.length),s>(l=(o=Math.ceil(h/7))>l?o+1:l+1)&&(s=l,n.length=1),n.reverse();s--;)n.push(0);n.reverse()}for((l=c.length)-(s=u.length)<0&&(s=l,n=u,u=c,c=n),r=0;s;)r=(c[--s]=c[s]+u[s]+r)/1e7|0,c[s]%=1e7;for(r&&(c.unshift(r),++i),l=c.length;0==c[--l];)c.pop();return t.d=c,t.e=i,a?k(t,h):t}function m(e,t,r){if(e!==~~e||e<t||e>r)throw Error(o+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,o=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,o),w(e,o),o),a=!0,k(t,i))},p.minus=p.sub=function(e){return e=new this.constructor(e),this.s==e.s?S(this,e):f(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?f(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(o+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,o,l,u=this.constructor;if(this.s<1){if(!this.s)return new u(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 u(t=i==1/0?"5e"+e:(t=i.toExponential()).slice(0,t.indexOf("e")+1)+e)):n=new u(i.toString()),i=l=(r=u.precision)+3;;)if(n=(o=n).plus(y(this,o,l+2)).times(.5),x(o.d).slice(0,l)===(t=x(n.d)).slice(0,l)){if(t=t.slice(l-3,l+1),i==l&&"4999"==t){if(k(o,r+1,0),o.times(o).eq(this)){n=o;break}}else if("9999"!=t)break;l+=4}return a=!0,k(n,r)},p.times=p.mul=function(e){var t,r,n,i,s,o,l,c,u,d=this.constructor,h=this.d,p=(e=new d(e)).d;if(!this.s||!e.s)return new d(0);for(e.s*=this.s,r=this.e+e.e,(c=h.length)<(u=p.length)&&(s=h,h=p,p=s,o=c,c=u,u=o),s=[],n=o=c+u;n--;)s.push(0);for(n=u;--n>=0;){for(t=0,i=c+n;i>n;)l=s[i]+p[n]*h[i-n-1]+t,s[i--]=l%1e7|0,t=l/1e7|0;s[i]=(s[i]+t)%1e7|0}for(;!s[--o];)s.pop();return t?++r:s.shift(),e.d=s,e.e=r,a?k(e,d.precision):e},p.toDecimalPlaces=p.todp=function(e,t){var r=this,n=r.constructor;return(r=new n(r),void 0===e)?r:(m(e,0,1e9),void 0===t?t=n.rounding:m(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):(m(e,0,1e9),void 0===t?t=i.rounding:m(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):(m(e,0,1e9),void 0===t?t=i.rounding:m(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,o,l,u,d=this,h=d.constructor,p=+(e=new h(e));if(!e.s)return new h(n);if(!(d=new h(d)).s){if(e.s<1)throw Error(s+"Infinity");return d}if(d.eq(n))return d;if(i=h.precision,e.eq(n))return k(d,i);if(u=(t=e.e)>=(r=e.d.length-1),l=d.s,u){if((r=p<0?-p:p)<=0x1fffffffffffff){for(o=new h(n),t=Math.ceil(i/7+4),a=!1;r%2&&P((o=o.times(d)).d,t),0!==(r=c(r/2));)P((d=d.times(d)).d,t);return a=!0,e.s<0?new h(n).div(o):k(o,i)}}else if(l<0)throw Error(s+"NaN");return l=l<0&&1&e.d[Math.max(t,r)]?-1:1,d.s=1,a=!1,o=e.times(w(d,i+12)),a=!0,(o=g(o)).s=l,o},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)):(m(e,1,1e9),void 0===t?t=a.rounding:m(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):(m(e,1,1e9),void 0===t?t=r.rounding:m(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,o){var l,c,u,d,h,p,f,m,x,y,g,b,j,w,N,S,O,P,C=n.constructor,E=n.s==i.s?1:-1,M=n.d,A=i.d;if(!n.s)return new C(n);if(!i.s)throw Error(s+"Division by zero");for(u=0,c=n.e-i.e,O=A.length,N=M.length,m=(f=new C(E)).d=[];A[u]==(M[u]||0);)++u;if(A[u]>(M[u]||0)&&--c,(b=null==a?a=C.precision:o?a+(v(n)-v(i))+1:a)<0)return new C(0);if(b=b/7+2|0,u=0,1==O)for(d=0,A=A[0],b++;(u<N||d)&&b--;u++)j=1e7*d+(M[u]||0),m[u]=j/A|0,d=j%A|0;else{for((d=1e7/(A[0]+1)|0)>1&&(A=e(A,d),M=e(M,d),O=A.length,N=M.length),w=O,y=(x=M.slice(0,O)).length;y<O;)x[y++]=0;(P=A.slice()).unshift(0),S=A[0],A[1]>=1e7/2&&++S;do d=0,(l=t(A,x,O,y))<0?(g=x[0],O!=y&&(g=1e7*g+(x[1]||0)),(d=g/S|0)>1?(d>=1e7&&(d=1e7-1),p=(h=e(A,d)).length,y=x.length,1==(l=t(h,x,p,y))&&(d--,r(h,O<p?P:A,p))):(0==d&&(l=d=1),h=A.slice()),(p=h.length)<y&&h.unshift(0),r(x,h,y),-1==l&&(y=x.length,(l=t(A,x,O,y))<1&&(d++,r(x,O<y?P:A,y))),y=x.length):0===l&&(d++,x=[0]),m[u++]=d,l&&x[0]?x[y++]=M[w]||0:(x=[M[w]],y=1);while((w++<N||void 0!==x[0])&&b--)}return m[0]||m.shift(),f.e=c,k(f,o?a+v(f)+1:a)}}();function g(e,t){var r,i,s,o,c,d=0,h=0,p=e.constructor,f=p.precision;if(v(e)>16)throw Error(l+v(e));if(!e.s)return new p(n);for(null==t?(a=!1,c=f):c=t,o=new p(.03125);e.abs().gte(.1);)e=e.times(o),h+=5;for(c+=Math.log(u(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(++d),x((o=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=f,null==t?(a=!0,k(s,f)):s}s=o}}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,o,l,c,u,d,h,p,f=1,m=e,g=m.d,j=m.constructor,N=j.precision;if(m.s<1)throw Error(s+(m.s?"NaN":"-Infinity"));if(m.eq(n))return new j(0);if(null==t?(a=!1,h=N):h=t,m.eq(10))return null==t&&(a=!0),b(j,h);if(j.precision=h+=10,i=(r=x(g)).charAt(0),!(15e14>Math.abs(l=v(m))))return d=b(j,h+2,N).times(l+""),m=w(new j(i+"."+r.slice(1)),h-10).plus(d),j.precision=N,null==t?(a=!0,k(m,N)):m;for(;i<7&&1!=i||1==i&&r.charAt(1)>3;)i=(r=x((m=m.times(e)).d)).charAt(0),f++;for(l=v(m),i>1?(m=new j("0."+r),l++):m=new j(i+"."+r.slice(1)),u=c=m=y(m.minus(n),m.plus(n),h),p=k(m.times(m),h),o=3;;){if(c=k(c.times(p),h),x((d=u.plus(y(c,new j(o),h))).d).slice(0,h)===x(u.d).slice(0,h))return u=u.times(2),0!==l&&(u=u.plus(b(j,h+2,N).times(l+""))),u=y(u,new j(f),h),j.precision=N,null==t?(a=!0,k(u,N)):u;u=d,o+=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(l+r)}else e.s=0,e.e=0,e.d=[0];return e}function k(e,t,r){var n,i,s,o,d,p,f,m,x=e.d;for(o=1,s=x[0];s>=10;s/=10)o++;if((n=t-o)<0)n+=7,i=t,f=x[m=0];else{if((m=Math.ceil((n+1)/7))>=(s=x.length))return e;for(o=1,f=s=x[m];s>=10;s/=10)o++;n%=7,i=n-7+o}if(void 0!==r&&(d=f/(s=u(10,o-i-1))%10|0,p=t<0||void 0!==x[m+1]||f%s,p=r<4?(d||p)&&(0==r||r==(e.s<0?3:2)):d>5||5==d&&(4==r||p||6==r&&(n>0?i>0?f/u(10,o-i):0:x[m-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]=u(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=m,s=1,m--):(x.length=m+1,s=u(10,7-n),x[m]=i>0?(f/u(10,o-i)%u(10,i)|0)*s:0),p)for(;;)if(0==m){1e7==(x[0]+=s)&&(x[0]=1,++e.e);break}else{if(x[m]+=s,1e7!=x[m])break;x[m--]=0,s=1}for(n=x.length;0===x[--n];)x.pop();if(a&&(e.e>h||e.e<-h))throw Error(l+v(e));return e}function S(e,t){var r,n,i,s,o,l,c,u,d,h,p=e.constructor,f=p.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new p(e),a?k(t,f):t;if(c=e.d,h=t.d,n=t.e,u=e.e,c=c.slice(),o=u-n){for((d=o<0)?(r=c,o=-o,l=h.length):(r=h,n=u,l=c.length),o>(i=Math.max(Math.ceil(f/7),l)+2)&&(o=i,r.length=1),r.reverse(),i=o;i--;)r.push(0);r.reverse()}else{for((d=(i=c.length)<(l=h.length))&&(l=i),i=0;i<l;i++)if(c[i]!=h[i]){d=c[i]<h[i];break}o=0}for(d&&(r=c,c=h,h=r,t.s=-t.s),l=c.length,i=h.length-l;i>0;--i)c[l++]=0;for(i=h.length;i>o;){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[--l];)c.pop();for(;0===c[0];c.shift())--n;return c[0]?(t.d=c,t.e=n,a?k(t,f):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(o+r+": "+n);if(void 0!==(n=e[r="LN10"]))if(n==Math.LN10)this[r]=new this(n);else throw Error(o+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(o+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(o+e);if(45===e.charCodeAt(0)?(e=e.slice(1),this.s=-1):this.s=1,d.test(e))N(this,e);else throw Error(o+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 o(e,t,r,n,a){if("function"!=typeof r)throw TypeError("The listener must be a function");var o=new s(r,n||e,a),l=i?i+t:t;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],o]:e._events[l].push(o):(e._events[l]=o,e._eventsCount++),e}function l(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 o=i?i+e:e;if(!this._events[o])return!1;var l,c,u=this._events[o],d=arguments.length;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),d){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,t),!0;case 3:return u.fn.call(u.context,t,r),!0;case 4:return u.fn.call(u.context,t,r,n),!0;case 5:return u.fn.call(u.context,t,r,n,a),!0;case 6:return u.fn.call(u.context,t,r,n,a,s),!0}for(c=1,l=Array(d-1);c<d;c++)l[c-1]=arguments[c];u.fn.apply(u.context,l)}else{var h,p=u.length;for(c=0;c<p;c++)switch(u[c].once&&this.removeListener(e,u[c].fn,void 0,!0),d){case 1:u[c].fn.call(u[c].context);break;case 2:u[c].fn.call(u[c].context,t);break;case 3:u[c].fn.call(u[c].context,t,r);break;case 4:u[c].fn.call(u[c].context,t,r,n);break;default:if(!l)for(h=1,l=Array(d-1);h<d;h++)l[h-1]=arguments[h];u[c].fn.apply(u[c].context,l)}}return!0},c.prototype.on=function(e,t,r){return o(this,e,t,r,!1)},c.prototype.once=function(e,t,r){return o(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 l(this,a),this;var s=this._events[a];if(s.fn)s.fn!==t||n&&!s.once||r&&s.context!==r||l(this,a);else{for(var o=0,c=[],u=s.length;o<u;o++)(s[o].fn!==t||n&&!s[o].once||r&&s[o].context!==r)&&c.push(s[o]);c.length?this._events[a]=1===c.length?c[0]:c:l(this,a)}return this},c.prototype.removeAllListeners=function(e){var t;return e?(t=i?i+e:e,this._events[t]&&l(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,o=n?Symbol.for("react.strict_mode"):60108,l=n?Symbol.for("react.profiler"):60114,c=n?Symbol.for("react.provider"):60109,u=n?Symbol.for("react.context"):60110,d=n?Symbol.for("react.async_mode"):60111,h=n?Symbol.for("react.concurrent_mode"):60111,p=n?Symbol.for("react.forward_ref"):60112,f=n?Symbol.for("react.suspense"):60113,m=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 d:case h:case s:case l:case o:case f:return e;default:switch(e=e&&e.$$typeof){case u: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=d,r.ConcurrentMode=h,r.ContextConsumer=u,r.ContextProvider=c,r.Element=i,r.ForwardRef=p,r.Fragment=s,r.Lazy=y,r.Memo=x,r.Portal=a,r.Profiler=l,r.StrictMode=o,r.Suspense=f,r.isAsyncMode=function(e){return N(e)||w(e)===d},r.isConcurrentMode=N,r.isContextConsumer=function(e){return w(e)===u},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)===l},r.isStrictMode=function(e){return w(e)===o},r.isSuspense=function(e){return w(e)===f},r.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===s||e===h||e===l||e===o||e===f||e===m||"object"==typeof e&&null!==e&&(e.$$typeof===y||e.$$typeof===x||e.$$typeof===c||e.$$typeof===u||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 o(e,t,r,n);if(t instanceof Map){var a=e,s=t,c=r,u=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,u))return!1;return!0}if(t instanceof Set)return l(e,t,r,n);let d=Object.keys(t);if(null==e||i.isPrimitive(e))return 0===d.length;if(0===d.length)return!0;if(n?.has(t))return n.get(t)===e;n?.set(t,e);try{for(let a=0;a<d.length;a++){let s=d[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 o(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],o=!1;for(let l=0;l<e.length;l++){if(i.has(l))continue;let c=e[l],u=!1;if(r(c,s,a,e,t,n)&&(u=!0),u){i.add(l),o=!0;break}}if(!o)return!1}return!0}function l(e,t,r,n){return 0===t.size||e instanceof Set&&o([...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,o,l){let c=n(t,r,i,a,o,l);return void 0!==c?!!c:s(t,r,e,l)},new Map)},r.isSetMatch=l},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=l(e),r=t[0],n=t[1];return(r+n)*3/4-n},t.toByteArray=function(e){var t,r,a=l(e),s=a[0],o=a[1],c=new i((s+o)*3/4-o),u=0,d=o>0?s-4:s;for(r=0;r<d;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[u++]=t>>16&255,c[u++]=t>>8&255,c[u++]=255&t;return 2===o&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,c[u++]=255&t),1===o&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,c[u++]=t>>8&255,c[u++]=255&t),c},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,a=[],s=0,o=n-i;s<o;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>o?o: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,o=a.length;s<o;++s)r[s]=a[s],n[a.charCodeAt(s)]=s;function l(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,o.prototype),t}function o(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 u(e)}return l(e,t,r)}function l(e,t,r){if("string"==typeof e){var n=e,i=t;if(("string"!=typeof i||""===i)&&(i="utf8"),!o.isEncoding(i))throw TypeError("Unknown encoding: "+i);var a=0|p(n,i),l=s(a),c=l.write(n,i);return c!==a&&(l=l.slice(0,c)),l}if(ArrayBuffer.isView(e))return d(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(E(e,ArrayBuffer)||e&&E(e.buffer,ArrayBuffer)||"u">typeof SharedArrayBuffer&&(E(e,SharedArrayBuffer)||e&&E(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),o.prototype),n}(e,t,r);if("number"==typeof e)throw TypeError('The "value" argument must not be of type number. Received type number');var u=e.valueOf&&e.valueOf();if(null!=u&&u!==e)return o.from(u,t,r);var f=function(e){if(o.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):d(e):"Buffer"===e.type&&Array.isArray(e.data)?d(e.data):void 0}(e);if(f)return f;if("u">typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return o.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 u(e){return c(e),s(e<0?0:0|h(e))}function d(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=o,t.SlowBuffer=function(e){return+e!=e&&(e=0),o.alloc(+e)},t.INSPECT_MAX_BYTES=50,t.kMaxLength=0x7fffffff,o.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}}(),!o.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(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}}),o.poolSize=8192,o.from=function(e,t,r){return l(e,t,r)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array),o.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)},o.allocUnsafe=function(e){return u(e)},o.allocUnsafeSlow=function(e){return u(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(o.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||E(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 f(e,t,r){var i,a,s,o=!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+=M[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(o)throw TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),o=!0}}function m(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=o.from(t,n)),o.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,o=e.length,l=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,o/=2,l/=2,r/=2}function c(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var u=-1;for(a=r;a<o;a++)if(c(e,a)===c(t,-1===u?0:a-u)){if(-1===u&&(u=a),a-u+1===l)return u*s}else -1!==u&&(a-=a-u),u=-1}else for(r+l>o&&(r=o-l),a=r;a>=0;a--){for(var d=!0,h=0;h<l;h++)if(c(e,a+h)!==c(t,h)){d=!1;break}if(d)return a}return -1}o.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==o.prototype},o.compare=function(e,t){if(E(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),E(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),!o.isBuffer(e)||!o.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)},o.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}},o.concat=function(e,t){if(!Array.isArray(e))throw TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return o.alloc(0);if(void 0===t)for(r=0,t=0;r<e.length;++r)t+=e[r].length;var r,n=o.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var a=e[r];if(E(a,Uint8Array)&&(a=o.from(a)),!o.isBuffer(a))throw TypeError('"list" argument must be an Array of Buffers');a.copy(n,i),i+=a.length}return n},o.byteLength=p,o.prototype._isBuffer=!0,o.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)m(this,t,t+1);return this},o.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)m(this,t,t+3),m(this,t+1,t+2);return this},o.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)m(this,t,t+7),m(this,t+1,t+6),m(this,t+2,t+5),m(this,t+3,t+4);return this},o.prototype.toString=function(){var e=this.length;return 0===e?"":0==arguments.length?g(this,0,e):f.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(e){if(!o.isBuffer(e))throw TypeError("Argument must be a Buffer");return this===e||0===o.compare(this,e)},o.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&&(o.prototype[a]=o.prototype.inspect),o.prototype.compare=function(e,t,r,n,i){if(E(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),!o.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,l=Math.min(a,s),c=this.slice(n,i),u=e.slice(t,r),d=0;d<l;++d)if(c[d]!==u[d]){a=c[d],s=u[d];break}return a<s?-1:+(s<a)},o.prototype.includes=function(e,t,r){return -1!==this.indexOf(e,t,r)},o.prototype.indexOf=function(e,t,r){return x(this,e,t,r,!0)},o.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,o,l,c=e[i],u=null,d=c>239?4:c>223?3:c>191?2:1;if(i+d<=r)switch(d){case 1:c<128&&(u=c);break;case 2:(192&(a=e[i+1]))==128&&(l=(31&c)<<6|63&a)>127&&(u=l);break;case 3:a=e[i+1],s=e[i+2],(192&a)==128&&(192&s)==128&&(l=(15&c)<<12|(63&a)<<6|63&s)>2047&&(l<55296||l>57343)&&(u=l);break;case 4:a=e[i+1],s=e[i+2],o=e[i+3],(192&a)==128&&(192&s)==128&&(192&o)==128&&(l=(15&c)<<18|(63&a)<<12|(63&s)<<6|63&o)>65535&&l<1114112&&(u=l)}null===u?(u=65533,d=1):u>65535&&(u-=65536,n.push(u>>>10&1023|55296),u=56320|1023&u),n.push(u),i+=d}var h=n,p=h.length;if(p<=4096)return String.fromCharCode.apply(String,h);for(var f="",m=0;m<p;)f+=String.fromCharCode.apply(String,h.slice(m,m+=4096));return f}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(!o.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}o.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,o,l,c,u,d,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 o,l=parseInt(t.substr(2*s,2),16);if((o=l)!=o)break;e[r+s]=l}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,o=r,C(O(e),this,s,o);case"latin1":case"binary":return function(e,t,r,n){return C(O(t),e,r,n)}(this,e,t,r);case"base64":return l=t,c=r,C(P(e),this,l,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return u=t,d=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-u),this,u,d);default:if(p)throw TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),p=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},o.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,o.prototype),n},o.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},o.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},o.prototype.readUInt8=function(e,t){return e>>>=0,t||v(e,1,this.length),this[e]},o.prototype.readUInt16LE=function(e,t){return e>>>=0,t||v(e,2,this.length),this[e]|this[e+1]<<8},o.prototype.readUInt16BE=function(e,t){return e>>>=0,t||v(e,2,this.length),this[e]<<8|this[e+1]},o.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]},o.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])},o.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},o.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},o.prototype.readInt8=function(e,t){return(e>>>=0,t||v(e,1,this.length),128&this[e])?-((255-this[e]+1)*1):this[e]},o.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},o.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},o.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},o.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]},o.prototype.readFloatLE=function(e,t){return e>>>=0,t||v(e,4,this.length),i.read(this,e,!0,23,4)},o.prototype.readFloatBE=function(e,t){return e>>>=0,t||v(e,4,this.length),i.read(this,e,!1,23,4)},o.prototype.readDoubleLE=function(e,t){return e>>>=0,t||v(e,8,this.length),i.read(this,e,!0,52,8)},o.prototype.readDoubleBE=function(e,t){return e>>>=0,t||v(e,8,this.length),i.read(this,e,!1,52,8)},o.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},o.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},o.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},o.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},o.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},o.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},o.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},o.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,o=0;for(this[t]=255&e;++a<r&&(s*=256);)e<0&&0===o&&0!==this[t+a-1]&&(o=1),this[t+a]=(e/s|0)-o&255;return t+r},o.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,o=0;for(this[t+a]=255&e;--a>=0&&(s*=256);)e<0&&0===o&&0!==this[t+a+1]&&(o=1),this[t+a]=(e/s|0)-o&255;return t+r},o.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},o.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},o.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},o.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},o.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},o.prototype.writeFloatLE=function(e,t,r){return w(this,e,t,!0,r)},o.prototype.writeFloatBE=function(e,t,r){return w(this,e,t,!1,r)},o.prototype.writeDoubleLE=function(e,t,r){return N(this,e,t,!0,r)},o.prototype.writeDoubleBE=function(e,t,r){return N(this,e,t,!1,r)},o.prototype.copy=function(e,t,r,n){if(!o.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},o.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&&!o.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=o.isBuffer(e)?e:o.from(e,n),l=s.length;if(0===l)throw TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<r-t;++i)this[i+t]=s[i%l]}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 E(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}var M=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,o=8*i-n-1,l=(1<<o)-1,c=l>>1,u=-7,d=r?i-1:0,h=r?-1:1,p=e[t+d];for(d+=h,a=p&(1<<-u)-1,p>>=-u,u+=o;u>0;a=256*a+e[t+d],d+=h,u-=8);for(s=a&(1<<-u)-1,a>>=-u,u+=n;u>0;s=256*s+e[t+d],d+=h,u-=8);if(0===a)a=1-c;else{if(a===l)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,o,l,c=8*a-i-1,u=(1<<c)-1,d=u>>1,h=5960464477539062e-23*(23===i),p=n?0:a-1,f=n?1:-1,m=+(t<0||0===t&&1/t<0);for(isNaN(t=Math.abs(t))||t===1/0?(o=+!!isNaN(t),s=u):(s=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-s))<1&&(s--,l*=2),s+d>=1?t+=h/l:t+=h*Math.pow(2,1-d),t*l>=2&&(s++,l/=2),s+d>=u?(o=0,s=u):s+d>=1?(o=(t*l-1)*Math.pow(2,i),s+=d):(o=t*Math.pow(2,d-1)*Math.pow(2,i),s=0));i>=8;e[r+p]=255&o,p+=f,o/=256,i-=8);for(s=s<<i|o,c+=i;c>0;e[r+p]=255&s,p+=f,s/=256,c-=8);e[r+p-f]|=128*m}}},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),o=e.r(38193),l=e.r(74513);function c(e,t,r,i=new Map,d){let h=d?.(e,t,r,i);if(void 0!==h)return h;if(o.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,d);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,d));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,d));return t}if(void 0!==n.Buffer&&n.Buffer.isBuffer(e))return e.subarray();if(l.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,d);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),u(t,e,r,i,d),t}if("u">typeof File&&e instanceof File){let t=new File([e],e.name,{type:e.type});return i.set(e,t),u(t,e,r,i,d),t}if("u">typeof Blob&&e instanceof Blob){let t=new Blob([e],{type:e.type});return i.set(e,t),u(t,e,r,i,d),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,u(t,e,r,i,d),t}if(e instanceof Boolean){let t=new Boolean(e.valueOf());return i.set(e,t),u(t,e,r,i,d),t}if(e instanceof Number){let t=new Number(e.valueOf());return i.set(e,t),u(t,e,r,i,d),t}if(e instanceof String){let t=new String(e.valueOf());return i.set(e,t),u(t,e,r,i,d),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),u(t,e,r,i,d),t}return e}function u(e,t,r=e,n,a){let s=[...Object.keys(t),...i.getSymbols(t)];for(let i=0;i<s.length;i++){let o=s[i],l=Object.getOwnPropertyDescriptor(e,o);(null==l||l.writable)&&(e[o]=c(t[o],o,r,n,a))}}r.cloneDeepWith=function(e,t){return c(e,void 0,e,new Map,t)},r.cloneDeepWithImpl=c,r.copyProperties=u},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,o,l)=>{let c=t?.(r,s,o,l);if(void 0!==c)return c;if("object"==typeof e){if(i.getTag(e)===a.objectTag&&"function"!=typeof e.constructor){let t={};return l.set(e,t),n.copyProperties(t,e,o,l),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 o=e;for(let e=0;e<r.length;e++){let t=r[e];if((null==o||!Object.hasOwn(o,t))&&!((Array.isArray(o)||a.isArguments(o))&&i.isIndex(t)&&t<o.length))return!1;o=o[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),o=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?o.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),o=e.r(68077);r.uniqBy=function(e,t=a.identity){return s.isArrayLikeObject(e)?n.uniqBy(Array.from(e),i.ary(o.iteratee(t),1)):[]}},40559,(e,t,r)=>{t.exports=e.r(38953).uniqBy},23733,e=>{"use strict";let t,r,n,i,a,s,o,l;var c,u,d,h,p,f,m,x,y,g,v,b,j,w,N,k,S,O,P,C,E,M,A,T,_,D,I,L,z,R,F,$,B,U,V,q,K,W=e.i(27493),H=e.i(4),Y=e.i(22534);let Q=(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),o=(0,er.useRef)({width:0,height:0,top:0,left:0,right:0,bottom:0}),{nonce:l}=(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:u,left:d,right:h,bottom:p}=o.current;if(t||!s.current||!e||!c)return;let f="left"===r?`left: ${d}`:`right: ${h}`,m="bottom"===n?`bottom: ${p}`:`top: ${u}`;s.current.dataset.motionPopId=a;let x=document.createElement("style");l&&(x.nonce=l);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
|
+
${f}px !important;
|
|
7
|
+
${m}px !important;
|
|
8
|
+
}
|
|
9
|
+
`),()=>{y.contains(x)&&y.removeChild(x)}},[t]),(0,W.jsx)(ea,{isPresent:t,childRef:s,sizeRef:o,children:er.cloneElement(e,{ref:c})})}let eo=({children:e,initial:t,isPresent:r,onExitComplete:n,custom:i,presenceAffectsLayout:a,mode:s,anchorX:o,anchorY:l,root:c})=>{let u=X(el),d=(0,H.useId)(),h=!0,p=(0,H.useMemo)(()=>(h=!1,{id:d,initial:t,isPresent:r,custom:i,onExitComplete:e=>{for(let t of(u.set(e,!0),u.values()))if(!t)return;n&&n()},register:e=>(u.set(e,!1),()=>u.delete(e))}),[r,u,n]);return a&&h&&(p={...p}),(0,H.useMemo)(()=>{u.forEach((e,t)=>u.set(t,!1))},[r]),H.useEffect(()=>{r||u.size||!n||n()},[r]),"popLayout"===s&&(e=(0,W.jsx)(es,{isPresent:r,anchorX:o,anchorY:l,root:c,children:e})),(0,W.jsx)(J.Provider,{value:p,children:e})};function el(){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 eu=e=>e.key||"";function ed(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:o="left",anchorY:l="top",root:c})=>{let[u,d]=ec(s),h=(0,H.useMemo)(()=>ed(e),[e]),p=s&&!u?[]:h.map(eu),f=(0,H.useRef)(!0),m=(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(()=>{f.current=!1,m.current=h;for(let e=0;e<b.length;e++){let t=eu(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=eu(r);p.includes(n)||(e.splice(t,0,r),w.push(r))}return"wait"===a&&w.length&&(e=w),j(ed(e)),v(h),null}let{forceRender:N}=(0,H.useContext)(Q);return(0,W.jsx)(W.Fragment,{children:b.map(e=>{let g=eu(e),v=(!s||!!u)&&(h===b||p.includes(g));return(0,W.jsx)(eo,{isPresent:v,initial:(!f.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(m.current),s&&d?.(),n&&n())},anchorX:o,anchorY:l,children:e},g)})})},ep=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],ef=new Set(ep),em=(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=>em(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,o]=n.match(eb);return{[e]:parseFloat(i),[t]:parseFloat(a),[r]:parseFloat(s),alpha:void 0!==o?parseFloat(o):1}},ek={...ex,transform:e=>Math.round(em(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"),eE=eP("%"),eM=eP("px"),eA=eP("vh"),eT=eP("vw"),e_={...eE,parse:e=>eE.parse(e)/100,transform:e=>eE.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)+", "+eE.transform(ev(t))+", "+eE.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)}},eL=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,ez="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(ez),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===ez?i+=ev(e[a]):t===eR?i+=eI.transform(e[a]):i+=e[a]}return i}}let eV=e=>"number"==typeof e?0:eI.test(e)?eI.getAnimatableNone(e):e,eq={test:function(e){return isNaN(e)&&"string"==typeof e&&(e.match(eb)?.length||0)+(e.match(eL)?.length||0)>0},parse:eB,createTransformer:eU,getAnimatableNone:function(e){let t=eB(e);return eU(e)(t.map(eV))}},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,eY={...eq,getAnimatableNone:e=>{let t=e.match(eH);return t?t.map(eW).join(" "):e}},eQ={...ex,transform:Math.round},eX={borderWidth:eM,borderTopWidth:eM,borderRightWidth:eM,borderBottomWidth:eM,borderLeftWidth:eM,borderRadius:eM,borderTopLeftRadius:eM,borderTopRightRadius:eM,borderBottomRightRadius:eM,borderBottomLeftRadius:eM,width:eM,maxWidth:eM,height:eM,maxHeight:eM,top:eM,right:eM,bottom:eM,left:eM,inset:eM,insetBlock:eM,insetBlockStart:eM,insetBlockEnd:eM,insetInline:eM,insetInlineStart:eM,insetInlineEnd:eM,padding:eM,paddingTop:eM,paddingRight:eM,paddingBottom:eM,paddingLeft:eM,paddingBlock:eM,paddingBlockStart:eM,paddingBlockEnd:eM,paddingInline:eM,paddingInlineStart:eM,paddingInlineEnd:eM,margin:eM,marginTop:eM,marginRight:eM,marginBottom:eM,marginLeft:eM,marginBlock:eM,marginBlockStart:eM,marginBlockEnd:eM,marginInline:eM,marginInlineStart:eM,marginInlineEnd:eM,fontSize:eM,backgroundPositionX:eM,backgroundPositionY:eM,rotate:eC,rotateX:eC,rotateY:eC,rotateZ:eC,scale:eg,scaleX:eg,scaleY:eg,scaleZ:eg,skew:eC,skewX:eC,skewY:eC,distance:eM,translateX:eM,translateY:eM,translateZ:eM,x:eM,y:eM,z:eM,perspective:eM,transformPerspective:eM,opacity:ey,originX:e_,originY:e_,originZ:eM,zIndex:eQ,fillOpacity:ey,strokeOpacity:ey,numOctaves:eQ},eG={...eX,color:eI,backgroundColor:eI,outlineColor:eI,fill:eI,stroke:eI,borderColor:eI,borderTopColor:eI,borderRightColor:eI,borderBottomColor:eI,borderLeftColor:eI,filter:eY,WebkitFilter:eY},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,eM,eE,eC,eT,eA,{test:e=>"auto"===e,parse:e=>e}],e8=e=>e6.find(e3(e)),e7=()=>{},e9=()=>{};Y.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,to=e=>180*e/Math.PI,tl=e=>tu(to(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:tl,rotateZ:tl,skewX:e=>to(Math.atan(e[1])),skewY:e=>to(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},tu=e=>((e%=360)<0&&(e+=360),e),td=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:td,scaleY:th,scale:e=>(td(e)+th(e))/2,rotateX:e=>tu(to(Math.atan2(e[6],e[5]))),rotateY:e=>tu(to(Math.atan2(-e[2],e[0]))),rotateZ:tl,rotate:tl,skewX:e=>to(Math.atan(e[4])),skewY:e=>to(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function tf(e){return+!!e.includes("scale")}function tm(e,t){let r,n;if(!e||"none"===e)return tf(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 tf(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===eM,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})=>tm(t,"x"),y:(e,{transform:t})=>tm(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,o={delta:0,timestamp:0,isProcessing:!1},l=0;function c(t){s.has(t)&&(u.schedule(t),e()),l++,t(o)}let u={schedule:(e,t=!1,a=!1)=>{let o=a&&i?r:n;return t&&s.add(e),o.has(e)||o.add(e),e},cancel:e=>{n.delete(e),s.delete(e)},process:e=>{if(o=e,i){a=!0;return}i=!0,[r,n]=[n,r],r.forEach(c),t,l=0,r.clear(),i=!1,a&&(a=!1,u.process(e))}};return u}(a,t?r:void 0),e),{}),{setup:o,read:l,resolveKeyframes:c,preUpdate:u,update:d,preRender:h,render:p,postRender:f}=s,m=()=>{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,o.process(i),l.process(i),c.process(i),u.process(i),d.process(i),h.process(i),p.process(i),f.process(i),i.isProcessing=!1,r&&t&&(n=!1,e(m))};return{schedule:tN.reduce((t,a)=>{let o=s[a];return t[a]=(t,a=!1,s=!1)=>(!r&&(r=!0,n=!0,i.isProcessing||e(m)),o.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),tE=new Set,tM=!1,tA=!1,tT=!1;function t_(){if(tA){let e=Array.from(tE).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)})}tA=!1,tM=!1,tE.forEach(e=>e.complete(tT)),tE.clear()}function tD(){tE.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(tA=!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?(tE.add(this),tM||(tM=!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),tE.delete(this)}cancel(){"scheduled"===this.state&&(tE.delete(this),this.state="pending")}resume(){"pending"===this.state&&this.scheduleResolve()}}function tL(e,t){let r=eZ(e);return r!==eY&&(r=eq),r.getAnimatableNone?r.getAnimatableNone(t):void 0}let tz=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&&!tz.has(t)&&e$(t).values.length&&(n=e[i]),i++}if(n&&r)for(let i of t)e[i]=tL(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 tV(){t=void 0}let tq={now:()=>(void 0===t&&tq.set(tP.isProcessing||tw.useManualTiming?tP.timestamp:performance.now()),t),set:e=>{t=e,queueMicrotask(tV)}};class tK{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{let t=tq.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=tq.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 o&&o.push(this),this.current}getPrevious(){return this.prev}getVelocity(){var e;let t=tq.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,eq],tY={current:null},tQ={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=tq.now();this.renderScheduledAt<e&&(this.renderScheduledAt=e,tS.render(this.render,!1,!0))};const{latestValues:o,renderState:l}=a;this.latestValues=o,this.baseTarget={...o},this.initialValues=t.initial?{...o}:{},this.renderState=l,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,...u}=this.scrapeMotionValuesFromProps(t,{},this);for(const e in u){const t=u[e];void 0!==o[e]&&e5(t)&&t.set(o[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:(tQ.current||function(){if(tQ.current=!0,tX)if(window.matchMedia){let e=window.matchMedia("(prefers-reduced-motion)"),t=()=>tY.current=e.matches;e.addEventListener("change",t),t()}else tY.current=!1}(),this.shouldReduceMotion=tY.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=ef.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))&&eq.test(t)&&(r=tL(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,o=!1;for(let e in t){let r=t[e];if(ef.has(e)){s=!0;continue}if(tt(e)){i[e]=r;continue}{let t=rt(r,eX[e]);e.startsWith("origin")?(o=!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],o=e[s];if(void 0===o)continue;let l=!0;if("number"==typeof o)l=o===+!!s.startsWith("scale");else{let e=parseFloat(o);l=s.startsWith("scale")?1===e:0===e}if(!l||r){let e=rt(o,eX[s]);if(!l){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")),o){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"},ro=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function rl(e,{attrX:t,attrY:r,attrScale:n,pathLength:i,pathSpacing:a=1,pathOffset:s=0,...o},l,c,u){if(ri(e,o,c),l){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};let{attrs:d,style:h}=e;for(let e of(d.transform&&(h.transform=d.transform,delete d.transform),(h.transform||d.transformOrigin)&&(h.transformOrigin=d.transformOrigin??"50% 50%",delete d.transformOrigin),h.transform&&(h.transformBox=u?.transformBox??"fill-box",delete d.transformBox),ro))void 0!==d[e]&&(h[e]=d[e],delete d[e]);void 0!==t&&(d.x=t),void 0!==r&&(d.y=r),void 0!==n&&(d.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}`}(d,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"]),ru=e=>"string"==typeof e&&"svg"===e.toLowerCase();function rd(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(!eM.test(e))return e;else e=parseFloat(e);let r=rh(e,t.target.x),n=rh(e,t.target.y);return`${r}% ${n}%`}},rf=(e,t,r)=>e+(t-e)*r,rm={borderRadius:{...rp,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:rp,borderTopRightRadius:rp,borderBottomLeftRadius:rp,borderBottomRightRadius:rp,boxShadow:{correct:(e,{treeScale:t,projectionDelta:r})=>{let n=eq.parse(e);if(n.length>5)return e;let i=eq.createTransformer(e),a=+("number"!=typeof n[0]),s=r.x.scale*t.x,o=r.y.scale*t.y;n[0+a]/=s,n[1+a]/=o;let l=rf(s,o,.5);return"number"==typeof n[2+a]&&(n[2+a]/=l),"number"==typeof n[3+a]&&(n[3+a]/=l),i(n)}}};function rx(e,{layout:t,layoutId:r}){return ef.has(e)||e.startsWith("origin")||(t||void 0!==r)&&(!!rm[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(ef.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){rl(e,t,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(e,t,r,n){for(let r in rd(e,t,void 0,n),t.attrs)e.setAttribute(rc.has(r)?r:re(r),t.attrs[r])}mount(e){this.isSVGTag=ru(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 rE(e,t,r,n,i=.5){let a=rf(e.min,e.max,i);rO(e,t,r,a,n)}function rM(e,t){rE(e.x,t.x,t.scaleX,t.scale,t.originX),rE(e.y,t.y,t.scaleY,t.scale,t.originY)}function rA(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=rd}readValueFromInstance(e,t){if(ef.has(t))return this.projection?.isProjecting?tf(t):((e,t)=>{let{transform:r="none"}=getComputedStyle(e);return tm(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 rA(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}),rL=(0,H.createContext)({});function rz(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 rV=e=>!rU(e);try{u=(()=>{let e=Error("Cannot find module '@emotion/is-prop-valid'");throw e.code="MODULE_NOT_FOUND",e})().default,"function"==typeof u&&(rV=e=>e.startsWith("on")?!rU(e):u(e))}catch{}function rq(e){return e5(e)?e.get():e}let rK=e=>(t,r)=>{let n=(0,H.useContext)(rL),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]=rq(a[e]);let{initial:s,animate:o}=e,l=t2(e),c=t5(e);t&&c&&!l&&!1!==e.inherit&&(void 0===s&&(s=t.initial),void 0===o&&(o=t.animate));let u=!!r&&!1===r.initial,d=(u=u||!1===s)?o:s;if(d&&"boolean"!=typeof d&&!tZ(d)){let t=Array.isArray(d)?d:[d];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=u?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$}),rY={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"]},rQ=!1;function rX(){return!function(){if(rQ)return;let e={};for(let t in rY)e[t]={isEnabled:e=>rY[t].some(t=>!!e[t])};t8=e,rQ=!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 o(r,n){var o;let l,c,u,d={...(0,H.useContext)(en),...r,layoutId:function({layoutId:e}){let t=(0,H.useContext)(Q).id;return t&&void 0!==e?t+"-"+e:e}(r)},{isStatic:h}=d,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)(rL));return(0,H.useMemo)(()=>({initial:t,animate:r}),[rz(t),rz(r)])}(r),f=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}}(d);l=t.MeasureLayout,p.visualElement=function(e,t,r,n,i,a){let{visualElement:s}=(0,H.useContext)(rL),o=(0,H.useContext)(rI),l=(0,H.useContext)(J),c=(0,H.useContext)(en).reducedMotion,u=(0,H.useRef)(null),d=(0,H.useRef)(!1);n=n||o.renderer,!u.current&&n&&(u.current=n(e,{visualState:t,parent:s,props:r,presenceContext:l,blockInitialAnimation:!!l&&!1===l.initial,reducedMotionConfig:c,isSVG:a}),d.current&&u.current&&(u.current.manuallyAnimateOnMount=!0));let h=u.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:o,layoutScroll:l,layoutRoot:c,layoutCrossfade:u}=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||o&&r0(o),visualElement:e,animationType:"string"==typeof a?a:"both",initialPromotionConfig:n,crossfade:u,layoutScroll:l,layoutRoot:c})}(u.current,r,i,p);let f=(0,H.useRef)(!1);(0,H.useInsertionEffect)(()=>{h&&f.current&&h.update(r,l)});let m=r[rZ],x=(0,H.useRef)(!!m&&!window.MotionHandoffIsComplete?.(m)&&window.MotionHasOptimisedAnimation?.(m));return Z(()=>{d.current=!0,h&&(f.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?.(m)}),x.current=!1),h.enteringChildren=void 0)}),h}(e,f,d,i,t.ProjectionNode,a)}return(0,W.jsxs)(rL.Provider,{value:p,children:[l&&p.visualElement?(0,W.jsx)(l,{visualElement:p.visualElement,...d}):null,function(e,t,r,{latestValues:n},i,a=!1,s){let o=(s??rD(e)?function(e,t,r,n){let i=(0,H.useMemo)(()=>{let r=r$();return rl(r,t,ru(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),l=function(e,t,r){let n={};for(let i in e)("values"!==i||"object"!=typeof e.values)&&(rV(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?{...l,...o,ref:r}:{},{children:u}=t,d=(0,H.useMemo)(()=>e5(u)?u.get():u,[u]);return(0,H.createElement)(e,{...c,children:d})}(e,r,(o=p.visualElement,c=(0,H.useRef)(n),(0,H.useInsertionEffect)(()=>{c.current=n}),u=(0,H.useRef)(null),(0,H.useCallback)(e=>{e&&f.onMount?.(e),o&&(e?o.mount(e):o.unmount());let t=c.current;if("function"==typeof t)if(e){let r=t(e);"function"==typeof r&&(u.current=r)}else u.current?(u.current(),u.current=null):t(e);else t&&(t.current=e)},[o])),f,h,t,a)]})}o.displayName=`motion.${"string"==typeof e?e:`create(${e.displayName??e.name??""})`}`;let l=(0,H.forwardRef)(o);return l[rG]=e,l}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,o=2*r-n;i=nt(o,n,e+1/3),a=nt(o,n,e),s=nt(o,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=rf(r.alpha,n.alpha,e),eS.transform(i))},no=new Set(["none","hidden"]);function nl(e,t){return r=>rf(e,t,r)}function nc(e){return"number"==typeof e?nl:"string"==typeof e?tn(e)?nr:eI.test(e)?ns:nh:Array.isArray(e)?nu:"object"==typeof e?eI.test(e)?ns:nd:nr}function nu(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 nd(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=eq.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(no.has(e)&&!i.values.length||no.has(t)&&!n.values.length)return no.has(e)?r=>r<=0?e:t:r=>r>=1?t:e;return r9(nu(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]],o=e.values[s]??0;r[i]=o,n[a]++}return r}(n,i),i.values),r)};function np(e,t,r){return"number"==typeof e&&"number"==typeof t&&"number"==typeof r?rf(e,t,r):nc(e)(e,t)}let nf=e=>{let t=({timestamp:t})=>e(t);return{start:(e=!0)=>tS.update(t,e),stop:()=>tO(t),now:()=>tP.isProcessing?tP.timestamp:tq.now()}},nm=(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],o=n.keyframes[n.keyframes.length-1],l={done:!1,value:s},{stiffness:c,damping:u,mass:d,duration:h,velocity:p,isResolvedFromDuration:f}=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*em(.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=em(.05,1,s),e=em(.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,o=Math.exp(-n),l=nw(Math.pow(t,2),s);return(n*r+r-a)*o*(-i(t)+.001>0?-1:1)/l}):(i=t=>-.001+Math.exp(-t*e)*((t-r)*e+1),a=t=>e*e*(r-t)*Math.exp(-t*e));let o=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(o))return{stiffness:100,damping:10,duration:e};{let t=Math.pow(o,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)}),m=p||0,x=u/(2*Math.sqrt(c*d)),y=o-s,g=Math.sqrt(c/d)/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=>o-Math.exp(-x*g*t)*((m+x*g*y)/e*Math.sin(e*t)+y*Math.cos(e*t))}else if(1===x)r=e=>o-Math.exp(-g*e)*(y+(m+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 o-r*((m+x*g*y)*Math.sinh(n)+e*y*Math.cosh(n))/e}}let b={calculatedDuration:f&&h||null,next:e=>{let t=r(e);if(f)l.done=e>=h;else{let n=0===e?m:0;x<1&&(n=0===e?r8(m):ny(r,e,t));let s=Math.abs(o-t)<=a;l.done=Math.abs(n)<=i&&s}return l.value=l.done?o:t,l},toString:()=>{let e=Math.min(nx(b),2e4),t=nm(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:o,max:l,restDelta:c=.5,restSpeed:u}){let d,h,p=e[0],f={done:!1,value:p},m=r*t,x=p+m,y=void 0===s?x:s(x);y!==x&&(m=y-p);let g=e=>-m*Math.exp(-e/n),v=e=>y+g(e),b=e=>{let t=g(e),r=v(e);f.done=Math.abs(t)<=c,f.value=f.done?y:r},j=e=>{let t;if(t=f.value,void 0!==o&&t<o||void 0!==l&&t>l){var r;d=e,h=nO({keyframes:[f.value,(r=f.value,void 0===o?l:void 0===l||Math.abs(o-r)<Math.abs(l-r)?o:l)],velocity:ny(v,e,f.value),damping:i,stiffness:a,restDelta:c,restSpeed:u})}};return j(0),{calculatedDuration:null,next:e=>{let t=!1;return(h||void 0!==d||(t=!0,b(e),j(e)),void 0!==d&&e>=d)?h.next(e-d):(t||b(e),f)}}}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 nE(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,o=0;do(a=nC(s=t+(r-t)/2,n,i)-e)>0?r=s:t=s;while(Math.abs(a)>1e-7&&++o<12)return s}(i,0,1,e,r),t,n)}let nM=nE(.42,0,1,1),nA=nE(0,0,.58,1),nT=nE(.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=nE(.33,1.53,.69,.99),nL=nD(nI),nz=n_(nL),nR=e=>(e*=2)<1?.5*nL(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],nV={linear:tj,easeIn:nM,easeInOut:nT,easeOut:nA,circIn:nF,circInOut:nB,circOut:n$,backIn:nL,backInOut:nz,backOut:nI,anticipate:nR},nq=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 nE(t,r,n,i)}return"string"==typeof e?(e9(void 0!==nV[e],`Invalid easing type '${e}'`,"invalid-easing-type"),nV[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(nq):nq(n),o={done:!1,value:t[0]},l=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 o=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),l=o.length,c=r=>{if(s&&r<e[0])return t[0];let n=0;if(l>1)for(;n<e.length-2&&!(r<e[n+1]);n++);let i=nK(e[n],e[n+1],r);return o[n](i)};return r?t=>c(em(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(rf(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=>(o.value=l(t),o.done=t>=e,o)}}let nH=e=>null!==e;function nY(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 nQ={decay:nP,inertia:nP,tween:nW,keyframes:nW,spring:nO};function nX(e){"string"==typeof e.type&&(e.type=nQ[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!==tq.now()&&this.tick(tq.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,o=t||nW;o!==nW&&"number"!=typeof s[0]&&(this.mixKeyframes=r9(nZ,np(s[0],s[1])),s=[0,100]);let l=o({...e,keyframes:s});"mirror"===i&&(this.mirroredGenerator=o({...e,keyframes:[...s].reverse(),velocity:-a})),null===l.calculatedDuration&&(l.calculatedDuration=nx(l));let{calculatedDuration:c}=l;this.calculatedDuration=c,this.resolvedDuration=c+n,this.totalDuration=this.resolvedDuration*(r+1)-n,this.generator=l}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:o}=this;if(null===this.startTime)return r.next(0);let{delay:l=0,keyframes:c,repeat:u,repeatType:d,repeatDelay:h,type:p,onUpdate:f,finalKeyframe:m}=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-l*(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(u){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,u+1))%2&&("reverse"===d?(r=1-r,h&&(r-=h/s)):"mirror"===d&&(v=a)),g=em(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===o||(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=nY(c,this.options,m,this.speed)),f&&f(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(tq.now());let t=this.playbackSpeed!==e;this.playbackSpeed=e,t&&(this.time=this.currentTime/1e3)}play(){if(this.isStopped)return;let{driver:e=nf,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(tq.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:o}=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 l=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:o="easeOut",times:l}={},c){let u={[t]:r};l&&(u.offset=l);let d=function e(t,r){if(t)return"function"==typeof t?n5()?nm(t,r):"ease-out":nU(t)?n4(t):Array.isArray(t)?t.map(t=>e(t,r)||n3.easeOut):n3[t]}(o,i);Array.isArray(d)&&(u.easing=d);let h={delay:n,duration:i,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:a+1,direction:"reverse"===s?"alternate":"normal"};c&&(h.pseudoElement=c);let p=e.animate(u,h);return p}(t,r,n,l,i),!1===l.autoplay&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){let e=nY(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()}o?.(),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:nz,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}),o=Math.max(10,tq.now()-this.startTime),l=em(0,10,o-10);t.setWithVelocity(s.sample(Math.max(0,o-l)).value,s.sample(o).value,l),s.stop()}}let ie=(e,t)=>"zIndex"!==t&&!!("number"==typeof e||Array.isArray(e)||"string"==typeof e&&(eq.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:o,motionValue:l,element:c,...u}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=tq.now();const d={autoplay:e,delay:t,type:r,repeat:n,repeatDelay:i,repeatType:a,name:o,motionValue:l,element:c,...u},h=c?.KeyframeResolver||tI;this.keyframeResolver=new h(s,(e,t,r)=>this.onKeyframesResolved(e,t,d,!r),o,l,c),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,t,r,n){this.keyframeResolver=void 0;let{name:i,type:a,velocity:s,delay:o,isHandoff:l,onUpdate:c}=r;this.resolvedAt=tq.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),o=ie(a,t);return e7(s===o,`You are trying to animate ${t} from "${i}" to "${a}". "${s?a:i}" is not an animatable value.`,"value-not-animatable"),!!s&&!!o&&(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||!o)&&c?.(nY(e,r,t)),e[0]=e[e.length-1],it(r),r.repeat=0);let u={startTime:n?this.resolvedAt&&this.resolvedAt-this.createdAt>40?this.resolvedAt:this.createdAt:void 0,finalKeyframe:t,...r,keyframes:e},d=!l&&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:o,transformTemplate:l}=t.owner.getProps();return ii()&&r&&ir.has(r)&&("transform"!==r||!l)&&!o&&!n&&"mirror"!==i&&0!==a&&"inertia"!==s}(u),h=u.motionValue?.owner?.current,p=d?new n9({...u,element:h}):new nJ(u);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},io={type:"keyframes",duration:.8},il={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},ic=e=>null!==e,iu=(e,t,r,n={},i,a)=>s=>{let o=r4(n,e)||{},l=o.delay||n.delay||0,{elapsed:c=0}=n;c-=r8(l);let u={keyframes:Array.isArray(r)?r:[null,r],ease:"easeOut",velocity:t.getVelocity(),...o,delay:-c,onUpdate:e=>{t.set(e),o.onUpdate&&o.onUpdate(e)},onComplete:()=>{s(),o.onComplete&&o.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:o,from:l,elapsed:c,...u}){return!!Object.keys(u).length}(o)&&Object.assign(u,((e,{keyframes:t})=>t.length>2?io:ef.has(e)?e.startsWith("scale")?{type:"spring",stiffness:550,damping:0===t[1]?2*Math.sqrt(550):30,restSpeed:10}:is:il)(e,u)),u.duration&&(u.duration=r8(u.duration)),u.repeatDelay&&(u.repeatDelay=r8(u.repeatDelay)),void 0!==u.from&&(u.keyframes[0]=u.from);let d=!1;if(!1!==u.type&&(0!==u.duration||u.repeatDelay)||(it(u),0===u.delay&&(d=!0)),(tw.instantAnimations||tw.skipAnimations)&&(d=!0,it(u),u.delay=0),u.allowFlatten=!o.type&&!o.ease,d&&!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]}(u.keyframes,o);if(void 0!==e)return void tS.update(()=>{u.onUpdate(e),u.onComplete()})}return o.isSync?new nJ(u):new ia(u)};function id(e,t,{delay:r=0,transitionOverride:n,type:i}={}){let{transition:a=e.getDefaultTransition(),transitionEnd:s,...o}=t;n&&(a=n);let l=[],c=i&&e.animationState&&e.animationState.getState()[i];for(let t in o){let n=e.getValue(t,e.latestValues[t]??null),i=o[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)},u=n.get();if(void 0!==u&&!n.isAnimating&&!Array.isArray(i)&&i===u&&!s.velocity)continue;let d=!1;if(window.MotionHandoffAnimation){let r=e.props[rZ];if(r){let e=window.MotionHandoffAnimation(r,t,tS);null!==e&&(s.startTime=e,d=!0)}}r6(e,t),n.start(iu(t,n,i,e.shouldReduceMotion&&e4.has(t)?{type:!1}:s,e,d));let h=n.animation;h&&l.push(h)}return s&&Promise.all(l).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)})}),l}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,o=(s-1)*n;return"function"==typeof r?r(a,s):1===i?a*n:o-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(id(e,n,r)):()=>Promise.resolve(),s=e.variantChildren&&e.variantChildren.size?(n=0)=>{let{delayChildren:a=0,staggerChildren:s,staggerDirection:o}=i;return function(e,t,r=0,n=0,i=0,a=1,s){let o=[];for(let l of e.variantChildren)l.notify("AnimationStart",t),o.push(ip(l,t,{...s,delay:r+("function"==typeof n?0:n)+ih(e.variantChildren,l,n,i,a)}).then(()=>l.notify("AnimationComplete",t)));return Promise.all(o)}(e,t,n,a,s,o,r)}:()=>Promise.resolve(),{when:o}=i;if(!o)return Promise.all([a(),s(r.delay)]);{let[e,t]="beforeChildren"===o?[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=rf(t.min,t.max,e.origin),e.scale=iP(r)/iP(t),e.translate=rf(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 iE(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 iM(e,t,r){e.min=r.min+t.min,e.max=e.min+iP(t)}function iA(e,t,r){e.min=t.min-r.min,e.max=e.min+iP(t)}function iT(e,t,r){iA(e.x,t.x,r.x),iA(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 iL=({current:e})=>e?e.ownerDocument.defaultView:null,iz=(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(iz(e.x,t.x)**2+iz(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:o,onMove:l}=this.handlers;n||(o&&o(this.lastMoveEvent,r),this.startEvent=this.lastMoveEvent),l&&l(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 o=i$(iD(e),this.transformPagePoint),{point:l}=o,{timestamp:c}=tP;this.history=[{...l,timestamp:c}];const{onSessionStart:u}=t;u&&u(e,iU(o,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,iV(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=iV(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 iV(e){return e[e.length-1]}function iq(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 iY=new WeakMap;class iQ{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(eE.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)},o=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t,this.stop(e,t),this.latestPointerEvent=null,this.latestPanInfo=null},l=()=>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:o,resumeAnimation:l},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:c,distanceThreshold:r,contextWindow:iL(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?rf(t,e,n.min):Math.max(e,t):void 0!==r&&e>r&&(e=n?rf(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:iq(e.x,r,i),y:iq(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=rA(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(),o=this.constraints||{};return Promise.all(iw(s=>{if(!iX(s,t,this.currentDirection))return;let l=o&&o[s]||{};a&&(l={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,...l};return this.startAxisValueAnimation(s,c)})).then(s)}startAxisValueAnimation(e,t){let r=this.getAxisMotionValue(e);return r6(this.visualElement,e),r.start(iu(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]-rf(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,o,l=t.get();n[e]=(r={min:l,max:l},i=this.constraints[e],a=.5,s=iP(r),(o=iP(i))>s?a=nK(i.min,i.max-s,r.min):s>o&&(a=nK(r.min,r.max-o,i.min)),em(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(rf(i,a,n[t]))})}addListeners(){if(!this.visualElement.current)return;iY.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)(Q);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(eE.test(t)&&(t=parseFloat(t),t=rf(s.min,s.max,t/100)-s.min),"number"!=typeof t)return;let o=rf(a.min,a.max,n);e===a&&(o-=t),e.min=i5(e.min,t,r,o,i),e.max=i5(e.max,t,r,o,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 ao(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}let al=["TopLeft","TopRight","BottomLeft","BottomRight"],ac=al.length,au=e=>"string"==typeof e?parseFloat(e):e,ad=e=>"number"==typeof e||eM.test(e);function ah(e,t){return void 0!==e[t]?e[t]:e.borderRadius}let ap=am(0,.5,n$),af=am(.5,.95,tj);function am(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=tq.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:o}=i.getProps(),l=!this.targetLayout||!aa(this.targetLayout,n),c=!t&&r;if(this.options.layoutRoot||this.resumeFrom||c||t&&(l||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);let t={...r4(a,"layout"),onPlay:s,onComplete:o};(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(aE);return}if(this.animationId<=this.animationCommitId)return void this.nodes.forEach(aM);this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(aA),this.nodes.forEach(ak),this.nodes.forEach(aS)):this.nodes.forEach(aM),this.clearAllSnapshots();let e=tq.now();tP.delta=em(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(aL)}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)),aV((t=n).x),aV(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&&rM(r,{x:-n.scroll.offset.x,y:-n.scroll.offset.y}),rN(n.latestValues)&&rM(r,n.latestValues)}return rN(this.latestValues)&&rM(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,o,l;this.forceRelativeParentToResolveTarget(),s=this.target,o=this.relativeTarget,l=this.relativeParent.target,iM(s.x,o.x,l.x),iM(s.y,o.y,l.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 o=0;o<s;o++){a=(i=r[o]).projectionDelta;let{visualElement:s}=i.options;(!s||!s.props.style||"contents"!==s.props.style.display)&&(n&&i.options.layoutScroll&&i.scroll&&i!==i.root&&rM(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)&&rM(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:o}=e;if(!o){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(),iE(this.projectionDelta,this.layoutCorrected,o,this.latestValues),this.treeScale.x===a&&this.treeScale.y===s&&ao(this.projectionDelta.x,this.prevProjectionDelta.x)&&ao(this.projectionDelta.y,this.prevProjectionDelta.y)||(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",o))}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 o=e2(),l=(n?n.source:void 0)!==(this.layout?this.layout.source:void 0),c=this.getStack(),u=!c||c.members.length<=1,d=!!(l&&!u&&!0===this.options.crossfade&&!this.path.some(aF));this.animationProgress=0,this.mixTargetDelta=t=>{let n=t/1e3;if(az(s.x,e.x,n),az(s.y,e.y,n),this.setTargetDelta(s),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout){var c,h,p,f,m,x;iT(o,this.layout.layoutBox,this.relativeParent.layout.layoutBox),p=this.relativeTarget,f=this.relativeTargetOrigin,m=o,x=n,aR(p.x,f.x,m.x,x),aR(p.y,f.y,m.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)}l&&(this.animationValues=a,function(e,t,r,n,i,a){i?(e.opacity=rf(0,r.opacity??1,ap(n)),e.opacityExit=rf(t.opacity??1,0,af(n))):a&&(e.opacity=rf(t.opacity??1,r.opacity??1,n));for(let i=0;i<ac;i++){let a=`border${al[i]}Radius`,s=ah(t,a),o=ah(r,a);(void 0!==s||void 0!==o)&&(s||(s=0),o||(o=0),0===s||0===o||ad(s)===ad(o)?(e[a]=Math.max(rf(au(s),au(o),n),0),(eE.test(o)||eE.test(s))&&(e[a]+="%")):e[a]=o)}(t.rotate||r.rotate)&&(e.rotate=rf(t.rotate||0,r.rotate||0,n))}(a,i,this.latestValues,n,d,u)),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(iu("",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&&aq(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),rM(t,i),iE(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=rq(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=rq(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:o}=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) `),o&&(n+=`skewY(${o}deg) `)}let o=e.x.scale*t.x,l=e.y.scale*t.y;return(1!==o||1!==l)&&(n+=`scale(${o}, ${l})`),n||"none"}(this.projectionDeltaWithTransform,this.treeScale,i);r&&(a=r(i,a)),e.transform=a;let{x:s,y:o}=this.projectionDelta;for(let t in e.transformOrigin=`${100*s.origin}% ${100*o.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,rm){if(void 0===i[t])continue;let{correct:r,applyTo:s,isCSSVariable:o}=rm[t],l="none"===a?i[t]:r(i[t],n);if(s){let t=s.length;for(let r=0;r<t;r++)e[s[r]]=l}else o?this.options.visualElement.renderState.vars[t]=l:e[t]=l}this.options.layoutId&&(e.pointerEvents=n===this?rq(t?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(e=>e.currentAnimation?.stop()),this.root.nodes.forEach(aE),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}):aq(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();iE(s,r,t.layoutBox);let o=e0();a?iE(o,e.applyTransform(n,!0),t.measuredBox):iE(o,r,t.layoutBox);let l=!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 o=e2();iT(o,r,a.layoutBox),aa(s,o)||(c=!0),n.options.layoutRoot&&(e.relativeTarget=o,e.relativeTargetOrigin=s,e.relativeParent=n)}}}e.notifyListeners("didUpdate",{layout:r,snapshot:t,delta:o,layoutDelta:s,hasLayoutChanged:l,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 aE(e){e.clearMeasurements()}function aM(e){e.isLayoutDirty=!1}function aA(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 aL(e){e.removeLeadSnapshot()}function az(e,t,r){e.translate=rf(t.translate,0,r),e.scale=rf(t.scale,1,r),e.origin=t.origin,e.originPoint=t.originPoint}function aR(e,t,r,n){e.min=rf(t.min,r.min,n),e.max=rf(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 aV(e){e.min=aU(e.min),e.max=aU(e.max)}function aq(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},aY=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 aQ(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(id(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,o=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)||{},l=[],c=new Set,u={},d=1/0;for(let t=0;t<ig;t++){var h,p;let f=iy[t],m=r[f],x=void 0!==s[f]?s[f]:o[f],y=tJ(x),g=f===a?m.isActive:null;!1===g&&(d=t);let v=x===o[f]&&x!==s[f]&&y;if(v&&n&&e.manuallyAnimateOnMount&&(v=!1),m.protectedKeys={...u},!m.isActive&&null===g||!x&&!m.prevProp||tZ(x)||"boolean"==typeof x)continue;let b=(h=m.prevProp,"string"==typeof(p=x)?p!==h:!!Array.isArray(p)&&!ix(p,h)),j=b||f===a&&m.isActive&&!v&&y||t>d&&y,w=!1,N=Array.isArray(x)?x:[x],k=N.reduce(i(f),{});!1===g&&(k={});let{prevResolvedValues:S={}}=m,O={...S,...k},P=t=>{j=!0,c.has(t)&&(w=!0,c.delete(t)),m.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(!u.hasOwnProperty(e))(r3(t)&&r3(r)?ix(t,r):t===r)?void 0!==t&&c.has(e)?P(e):m.protectedKeys[e]=!0:null!=t?P(e):c.add(e)}m.prevProp=x,m.prevResolvedValues=k,m.isActive&&(u={...u,...k}),n&&e.blockInitialAnimation&&(j=!1);let C=v&&b,E=!C||w;j&&E&&l.push(...N.map(t=>{let r={type:f};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}),l.push({animation:t})}let f=!!l.length;return n&&(!1===s.initial||s.initial===s.animate)&&!e.manuallyAnimateOnMount&&(f=!1),n=!1,f?t(l):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,o={root:n?n.current:void 0,rootMargin:i,threshold:"number"==typeof a?a:a7[a]},l=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]}(o),a4.set(e,l),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]=aQ(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",o),window.removeEventListener("pointercancel",l),aJ.has(n)&&aJ.delete(n),a2(e)&&"function"==typeof a&&a(e,{success:t})},o=e=>{s(e,n===window||n===document||r.useGlobalTarget||aZ(n,e.target))},l=e=>{s(e,!1)};window.addEventListener("pointerup",o,i),window.addEventListener("pointercancel",l,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]=aQ(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:iL(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 iQ(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:aY,MeasureLayout:i2},layout:{ProjectionNode:aY,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=Y.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";async function so(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}function sl(){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 sc=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),su=[],sd=(e,t,r)=>{if(0==e.length-t)return r.classGroupId;let n=e[t],i=r.nextPart.get(n);if(i){let r=sd(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("-"),o=a.length;for(let e=0;e<o;e++){let t=a[e];if(t.validator(s))return t.classGroupId}},sh=(e,t)=>{let r=sc();for(let n in e)sp(e[n],r,n,t);return r},sp=(e,t,r,n)=>{let i=e.length;for(let a=0;a<i;a++)sf(e[a],t,r,n)},sf=(e,t,r,n)=>{"string"==typeof e?sm(e,t,r):"function"==typeof e?sx(e,t,r,n):sy(e,t,r,n)},sm=(e,t,r)=>{(""===e?t:sg(t,e)).classGroupId=r},sx=(e,t,r,n)=>{sv(e)?sp(e(n),t,r,n):(null===t.validators&&(t.validators=[]),t.validators.push({classGroupId:r,validator:e}))},sy=(e,t,r,n)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,s]=i[e];sp(s,sg(t,a),r,n)}},sg=(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=sc(),r.nextPart.set(t,i)),r=i}return r},sv=e=>"isThemeGetter"in e&&!0===e.isThemeGetter,sb=[],sj=(e,t,r,n,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:n,isExternal:i}),sw=/\s+/,sN=e=>{let t;if("string"==typeof e)return e;let r="";for(let n=0;n<e.length;n++)e[n]&&(t=sN(e[n]))&&(r&&(r+=" "),r+=t);return r},sk=[],sS=e=>{let t=t=>t[e]||sk;return t.isThemeGetter=!0,t},sO=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,sP=/^\((?:(\w[\w-]*):)?(.+)\)$/i,sC=/^\d+\/\d+$/,sE=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,sM=/\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$/,sA=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,sT=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,s_=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,sD=e=>sC.test(e),sI=e=>!!e&&!Number.isNaN(Number(e)),sL=e=>!!e&&Number.isInteger(Number(e)),sz=e=>e.endsWith("%")&&sI(e.slice(0,-1)),sR=e=>sE.test(e),sF=()=>!0,s$=e=>sM.test(e)&&!sA.test(e),sB=()=>!1,sU=e=>sT.test(e),sV=e=>s_.test(e),sq=e=>!sW(e)&&!sZ(e),sK=e=>s3(e,s9,sB),sW=e=>sO.test(e),sH=e=>s3(e,oe,s$),sY=e=>s3(e,ot,sI),sQ=e=>s3(e,s8,sB),sX=e=>s3(e,s7,sV),sG=e=>s3(e,on,sU),sZ=e=>sP.test(e),sJ=e=>s6(e,oe),s0=e=>s6(e,or),s1=e=>s6(e,s8),s2=e=>s6(e,s9),s5=e=>s6(e,s7),s4=e=>s6(e,on,!0),s3=(e,t,r)=>{let n=sO.exec(e);return!!n&&(n[1]?t(n[1]):r(n[2]))},s6=(e,t,r=!1)=>{let n=sP.exec(e);return!!n&&(n[1]?t(n[1]):r)},s8=e=>"position"===e||"percentage"===e,s7=e=>"image"===e||"url"===e,s9=e=>"length"===e||"size"===e||"bg-size"===e,oe=e=>"length"===e,ot=e=>"number"===e,or=e=>"family-name"===e,on=e=>"shadow"===e,oi=((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=[],o=e.trim().split(sw),l="";for(let e=o.length-1;e>=0;e-=1){let t=o[e],{isExternal:c,modifiers:u,hasImportantModifier:d,baseClassName:h,maybePostfixModifierPosition:p}=r(t);if(c){l=t+(l.length>0?" "+l:l);continue}let f=!!p,m=n(f?h.substring(0,p):h);if(!m){if(!f||!(m=n(h))){l=t+(l.length>0?" "+l:l);continue}f=!1}let x=0===u.length?"":1===u.length?u[0]:a(u).join(":"),y=d?x+"!":x,g=y+m;if(s.indexOf(g)>-1)continue;s.push(g);let v=i(m,f);for(let e=0;e<v.length;++e){let t=v[e];s.push(y+t)}l=t+(l.length>0?" "+l:l)}return l})(e,r);return i(e,a),a};return a=o=>{var l;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)}}})((l=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 o=0;o<s;o++){let s=e[o];if(0===n&&0===i){if(":"===s){r.push(e.slice(a,o)),a=o+1;continue}if("/"===s){t=o;continue}}"["===s?n++:"]"===s?n--:"("===s?i++:")"===s&&i--}let o=0===r.length?e:e.slice(a),l=o,c=!1;return o.endsWith("!")?(l=o.slice(0,-1),c=!0):o.startsWith("!")&&(l=o.slice(1),c=!0),sj(r,c,l,t&&t>a?t-a:void 0)};if(t){let e=t+":",r=n;n=t=>t.startsWith(e)?r(t.slice(e.length)):sj(sb,!1,t,void 0,!0)}if(r){let e=n;n=t=>r({className:t,parseClassName:e})}return n})(l),sortModifiers:(c=new Map,l.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 sh(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 sd(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||su}return r[e]||su}}})(l)}).cache.get,i=r.cache.set,a=s,s(o)},(...e)=>a(((...e)=>{let t,r,n=0,i="";for(;n<e.length;)(t=e[n++])&&(r=sN(t))&&(i&&(i+=" "),i+=r);return i})(...e))})(()=>{let e=sS("color"),t=sS("font"),r=sS("text"),n=sS("font-weight"),i=sS("tracking"),a=sS("leading"),s=sS("breakpoint"),o=sS("container"),l=sS("spacing"),c=sS("radius"),u=sS("shadow"),d=sS("inset-shadow"),h=sS("text-shadow"),p=sS("drop-shadow"),f=sS("blur"),m=sS("perspective"),x=sS("aspect"),y=sS("ease"),g=sS("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(),sZ,sW],w=()=>["auto","hidden","clip","visible","scroll"],N=()=>["auto","contain","none"],k=()=>[sZ,sW,l],S=()=>[sD,"full","auto",...k()],O=()=>[sL,"none","subgrid",sZ,sW],P=()=>["auto",{span:["full",sL,sZ,sW]},sL,sZ,sW],C=()=>[sL,"auto",sZ,sW],E=()=>["auto","min","max","fr",sZ,sW],M=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],A=()=>["start","end","center","stretch","center-safe","end-safe"],T=()=>["auto",...k()],_=()=>[sD,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...k()],D=()=>[e,sZ,sW],I=()=>[...b(),s1,sQ,{position:[sZ,sW]}],L=()=>["no-repeat",{repeat:["","x","y","space","round"]}],z=()=>["auto","cover","contain",s2,sK,{size:[sZ,sW]}],R=()=>[sz,sJ,sH],F=()=>["","none","full",c,sZ,sW],$=()=>["",sI,sJ,sH],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"],V=()=>[sI,sz,s1,sQ],q=()=>["","none",f,sZ,sW],K=()=>["none",sI,sZ,sW],W=()=>["none",sI,sZ,sW],H=()=>[sI,sZ,sW],Y=()=>[sD,"full",...k()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[sR],breakpoint:[sR],color:[sF],container:[sR],"drop-shadow":[sR],ease:["in","out","in-out"],font:[sq],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[sR],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[sR],shadow:[sR],spacing:["px",sI],text:[sR],"text-shadow":[sR],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",sD,sW,sZ,x]}],container:["container"],columns:[{columns:[sI,sW,sZ,o]}],"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:[sL,"auto",sZ,sW]}],basis:[{basis:[sD,"full","auto",o,...k()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[sI,sD,"auto","initial","none",sW]}],grow:[{grow:["",sI,sZ,sW]}],shrink:[{shrink:["",sI,sZ,sW]}],order:[{order:[sL,"first","last","none",sZ,sW]}],"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":E()}],"auto-rows":[{"auto-rows":E()}],gap:[{gap:k()}],"gap-x":[{"gap-x":k()}],"gap-y":[{"gap-y":k()}],"justify-content":[{justify:[...M(),"normal"]}],"justify-items":[{"justify-items":[...A(),"normal"]}],"justify-self":[{"justify-self":["auto",...A()]}],"align-content":[{content:["normal",...M()]}],"align-items":[{items:[...A(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...A(),{baseline:["","last"]}]}],"place-content":[{"place-content":M()}],"place-items":[{"place-items":[...A(),"baseline"]}],"place-self":[{"place-self":["auto",...A()]}],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:[o,"screen",..._()]}],"min-w":[{"min-w":[o,"screen","none",..._()]}],"max-w":[{"max-w":[o,"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,sJ,sH]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,sZ,sY]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",sz,sW]}],"font-family":[{font:[s0,sW,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,sZ,sW]}],"line-clamp":[{"line-clamp":[sI,"none",sZ,sY]}],leading:[{leading:[a,...k()]}],"list-image":[{"list-image":["none",sZ,sW]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",sZ,sW]}],"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:[sI,"from-font","auto",sZ,sH]}],"text-decoration-color":[{decoration:D()}],"underline-offset":[{"underline-offset":[sI,"auto",sZ,sW]}],"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",sZ,sW]}],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",sZ,sW]}],"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:L()}],"bg-size":[{bg:z()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},sL,sZ,sW],radial:["",sZ,sW],conic:[sL,sZ,sW]},s5,sX]}],"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":[sI,sZ,sW]}],"outline-w":[{outline:["",sI,sJ,sH]}],"outline-color":[{outline:D()}],shadow:[{shadow:["","none",u,s4,sG]}],"shadow-color":[{shadow:D()}],"inset-shadow":[{"inset-shadow":["none",d,s4,sG]}],"inset-shadow-color":[{"inset-shadow":D()}],"ring-w":[{ring:$()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:D()}],"ring-offset-w":[{"ring-offset":[sI,sH]}],"ring-offset-color":[{"ring-offset":D()}],"inset-ring-w":[{"inset-ring":$()}],"inset-ring-color":[{"inset-ring":D()}],"text-shadow":[{"text-shadow":["none",h,s4,sG]}],"text-shadow-color":[{"text-shadow":D()}],opacity:[{opacity:[sI,sZ,sW]}],"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":[sI]}],"mask-image-linear-from-pos":[{"mask-linear-from":V()}],"mask-image-linear-to-pos":[{"mask-linear-to":V()}],"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":V()}],"mask-image-t-to-pos":[{"mask-t-to":V()}],"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":V()}],"mask-image-r-to-pos":[{"mask-r-to":V()}],"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":V()}],"mask-image-b-to-pos":[{"mask-b-to":V()}],"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":V()}],"mask-image-l-to-pos":[{"mask-l-to":V()}],"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":V()}],"mask-image-x-to-pos":[{"mask-x-to":V()}],"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":V()}],"mask-image-y-to-pos":[{"mask-y-to":V()}],"mask-image-y-from-color":[{"mask-y-from":D()}],"mask-image-y-to-color":[{"mask-y-to":D()}],"mask-image-radial":[{"mask-radial":[sZ,sW]}],"mask-image-radial-from-pos":[{"mask-radial-from":V()}],"mask-image-radial-to-pos":[{"mask-radial-to":V()}],"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":[sI]}],"mask-image-conic-from-pos":[{"mask-conic-from":V()}],"mask-image-conic-to-pos":[{"mask-conic-to":V()}],"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:L()}],"mask-size":[{mask:z()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",sZ,sW]}],filter:[{filter:["","none",sZ,sW]}],blur:[{blur:q()}],brightness:[{brightness:[sI,sZ,sW]}],contrast:[{contrast:[sI,sZ,sW]}],"drop-shadow":[{"drop-shadow":["","none",p,s4,sG]}],"drop-shadow-color":[{"drop-shadow":D()}],grayscale:[{grayscale:["",sI,sZ,sW]}],"hue-rotate":[{"hue-rotate":[sI,sZ,sW]}],invert:[{invert:["",sI,sZ,sW]}],saturate:[{saturate:[sI,sZ,sW]}],sepia:[{sepia:["",sI,sZ,sW]}],"backdrop-filter":[{"backdrop-filter":["","none",sZ,sW]}],"backdrop-blur":[{"backdrop-blur":q()}],"backdrop-brightness":[{"backdrop-brightness":[sI,sZ,sW]}],"backdrop-contrast":[{"backdrop-contrast":[sI,sZ,sW]}],"backdrop-grayscale":[{"backdrop-grayscale":["",sI,sZ,sW]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[sI,sZ,sW]}],"backdrop-invert":[{"backdrop-invert":["",sI,sZ,sW]}],"backdrop-opacity":[{"backdrop-opacity":[sI,sZ,sW]}],"backdrop-saturate":[{"backdrop-saturate":[sI,sZ,sW]}],"backdrop-sepia":[{"backdrop-sepia":["",sI,sZ,sW]}],"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",sZ,sW]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[sI,"initial",sZ,sW]}],ease:[{ease:["linear","initial",y,sZ,sW]}],delay:[{delay:[sI,sZ,sW]}],animate:[{animate:["none",g,sZ,sW]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[m,sZ,sW]}],"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:[sZ,sW,"","none","gpu","cpu"]}],"transform-origin":[{origin:j()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Y()}],"translate-x":[{"translate-x":Y()}],"translate-y":[{"translate-y":Y()}],"translate-z":[{"translate-z":Y()}],"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",sZ,sW]}],"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",sZ,sW]}],fill:[{fill:["none",...D()]}],"stroke-w":[{stroke:[sI,sJ,sH,sY]}],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 oa(...e){return oi(sl(e))}function os({className:e,...t}){return(0,W.jsx)("div",{"data-slot":"card",className:oa("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...t})}function oo({className:e,...t}){return(0,W.jsx)("div",{"data-slot":"card-header",className:oa("@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 ol({className:e,...t}){return(0,W.jsx)("div",{"data-slot":"card-title",className:oa("leading-none font-semibold",e),...t})}function oc({className:e,...t}){return(0,W.jsx)("div",{"data-slot":"card-content",className:oa("px-6",e),...t})}function ou(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}var od=Symbol.for("react.lazy"),oh=H[" use ".trim().toString()];function op(e){var t;return null!=e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===od&&"_payload"in e&&"object"==typeof(t=e._payload)&&null!==t&&"then"in t}var of=((l=H.forwardRef((e,t)=>{let{children:r,...n}=e;if(op(r)&&"function"==typeof oh&&(r=oh(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),o=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&&(o.ref=t?function(...e){return t=>{let r=!1,n=e.map(e=>{let n=ou(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():ou(e[t],null)}}}}(t,s):s),H.cloneElement(r,o)}return H.Children.count(r)>1?H.Children.only(null):null})).displayName="Slot.SlotClone",n=l,(i=H.forwardRef((e,t)=>{let{children:r,...i}=e;op(r)&&"function"==typeof oh&&(r=oh(r._payload));let a=H.Children.toArray(r),s=a.find(ox);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),om=Symbol("radix.slottable");function ox(e){return H.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===om}let oy=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,og=(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 sl(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=oy(i)||oy(a);return r[t][s]}),o=e&&Object.entries(e).reduce((e,t)=>{let[r,n]=t;return void 0===n||(e[r]=n),e},{});return sl(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,...o}[t]):({...n,...o})[t]===r})?[...e,r,i]:e},[]),null==e?void 0:e.class,null==e?void 0:e.className)});function ov({className:e,variant:t="default",size:r="default",asChild:n=!1,...i}){return(0,W.jsx)(n?of:"button",{"data-slot":"button","data-variant":t,"data-size":r,className:oa(og({variant:t,size:r,className:e})),...i})}function ob({className:e,type:t,...r}){return(0,W.jsx)("input",{type:t,"data-slot":"input",className:oa("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 oj=e.i(97358),ow=e.i(33368),oN=e.i(24929);let ok=(0,oN.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"}]]),oS=(0,oN.default)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]),oO={references:{color:"#60a5fa",label:"References",icon:"→"},extends:{color:"#34d399",label:"Extends",icon:"⊃"},contradicts:{color:"#f87171",label:"Contradicts",icon:"⊗"},related:{color:"#a78bfa",label:"Related",icon:"~"}},oP=["architecture","pattern","preference","error","context","learning","todo","note","relationship","custom"];function oC({memory:e,links:t=[],memories:r=[],onClose:n,onReinforce:i,onSelectMemory:a,isReinforcing:s=!1,reinforceSuccess:o=!1}){let[l,c]=(0,H.useState)(!1),[u,d]=(0,H.useState)(!1),[h,p]=(0,H.useState)(null),[f,m]=(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,E]=(0,H.useState)(e.id);C!==e.id&&(E(e.id),m(!1),S(!1),y(e.title),v(e.content),j(e.category),N((e.tags||[]).join(", "))),(0,H.useEffect)(()=>{if(o&&h===e.id){let e=setTimeout(()=>c(!0),0),t=setTimeout(()=>c(!1),1500);return()=>{clearTimeout(e),clearTimeout(t)}}},[o,h,e.id]);let M=(0,ow.calculateDecayFactor)(e),A=(0,oj.getCategoryColor)(e.category),T=(0,oj.getTypeColor)(e.type),_=M>.7?{label:"Healthy",color:"#22C55E",bgColor:"rgba(34, 197, 94, 0.15)"}:M>.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`};return(0,W.jsxs)(os,{className:`bg-slate-900 border-slate-700 h-full overflow-auto transition-all duration-300 ${l?"ring-2 ring-green-500 ring-opacity-75":""} ${u?"ring-2 ring-emerald-500 ring-opacity-75":""}`,children:[(0,W.jsxs)(oo,{className:"border-b border-slate-700 pb-3",children:[(0,W.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[f?(0,W.jsx)(ob,{value:x,onChange:e=>y(e.target.value),className:"bg-slate-800 border-slate-600 text-white text-lg font-semibold"}):(0,W.jsxs)(ol,{className:"text-lg font-semibold text-white leading-tight flex items-center gap-2",children:[u&&(0,W.jsx)(oS,{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:[!f&&(0,W.jsx)(ov,{variant:"ghost",size:"sm",onClick:()=>m(!0),className:"text-slate-400 hover:text-white",title:"Edit memory",children:(0,W.jsx)(ok,{className:"w-4 h-4"})}),(0,W.jsx)(ov,{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:[f?(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:oP.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:A+"20",color:A},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)(oc,{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"}),f?(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})]}),f&&(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)(ob,{value:w,onChange:e=>N(e.target.value),placeholder:"tag1, tag2, tag3",className:"bg-slate-800 border-slate-600 text-white text-sm"})]}),f?(0,W.jsxs)("div",{className:"flex gap-2",children:[(0,W.jsx)(ov,{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)?m(!1):O.mutate({id:e.id,updates:r},{onSuccess:()=>{m(!1),d(!0),setTimeout(()=>d(!1),1500)}})},disabled:O.isPending,className:"flex-1 bg-emerald-600 hover:bg-emerald-700",children:O.isPending?"Saving...":"Save Changes"}),(0,W.jsx)(ov,{variant:"outline",size:"sm",onClick:()=>{m(!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,!f&&(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:M>.7?"Memory is strong and stable":M>.4?"Memory is fading - reinforce to preserve":"Memory at risk of deletion - reinforce now"})]})]}),!f&&(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*M).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*M}%`,backgroundColor:_.color}})})]})]}),!f&&(0,W.jsxs)("div",{className:`bg-slate-800 rounded-lg p-3 space-y-2 transition-all duration-300 ${l?"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 ${l?"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 ${l?"text-green-400":"text-white"}`,children:l?"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()})]})]}),!f&&(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:e.status||"active"})]}),(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"})]})]})]}),!f&&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=oO[t]||oO.related,s=(0,oj.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}`)})})]}),!f&&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))})]}),!f&&(0,W.jsxs)("div",{className:"space-y-2 pt-2",children:[i&&(0,W.jsx)(ov,{variant:"default",size:"sm",onClick:()=>{p(e.id),i?.(e.id)},disabled:s,className:`w-full transition-all duration-300 ${l?"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..."]}):l?(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)(ov,{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)(ov,{variant:"outline",size:"sm",onClick:()=>S(!1),className:"flex-1 border-slate-600 text-slate-300 hover:text-white",children:"Cancel"})]})]}):(0,W.jsx)(ov,{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"})]})]})]})}var oE=e.i(1235),oM=e.i(71921);let oA=Y.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";async function oT(e){let t=e?`?project=${encodeURIComponent(e)}`:"",r=await (0,sa.authFetch)(`${oA}/api/review/queue${t}`);if(!r.ok)throw Error("Failed to fetch review queue");return r.json()}async function o_(e){let t=await (0,sa.authFetch)(`${oA}/api/memories/${e.id}/review`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw Error("Failed to update review state");return t.json()}function oD(){let e=(0,oE.useQueryClient)();return(0,oM.useMutation)({mutationFn:o_,onSuccess:()=>{e.invalidateQueries({queryKey:["review-queue"]}),e.invalidateQueries({queryKey:["memories"]}),e.invalidateQueries({queryKey:["quality"]}),e.invalidateQueries({queryKey:["contradictions"]}),e.invalidateQueries({queryKey:["stats"]})}})}function oI(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 oL({memory:e,isSelected:t,onSelect:r,isChecked:n,onCheck:i}){let a=(0,oj.getCategoryColor)(e.category),s=(0,oj.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 ",oI(e.createdAt)]}),(0,W.jsxs)("span",{children:["Accessed ",oI(e.lastAccessed)]})]})]})}let oz=Y.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";function oR(e){return new Date(e).toLocaleString()}function oF({memories:e,selectedMemory:t,onSelectMemory:r}){let[n,i]=(0,H.useState)("salience"),[a,s]=(0,H.useState)("grid"),[o,l]=(0,H.useState)(!1),[c,u]=(0,H.useState)(new Set),[d,h]=(0,H.useState)(!1),[p,f]=(0,H.useState)(null),m=(0,oE.useQueryClient)(),{data:x}=(0,st.useOpenClawSessions)(),y=oD(),g=x?.sessions??[];(0,H.useEffect)(()=>{g.length?p&&g.some(e=>e.sessionId===p)||f(g[0].sessionId):f(null)},[g,p]);let v=(0,H.useMemo)(()=>g.find(e=>e.sessionId===p)??g[0]??null,[g,p]),b=(0,H.useMemo)(()=>{let t=[...e];return t.sort((e,t)=>{switch(n){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,n]),j=(0,H.useCallback)((e,t)=>{u(r=>{let n=new Set(r);return t?n.add(e):n.delete(e),n})},[]),w=async()=>{if(0!==c.size){h(!0);try{await Promise.all(Array.from(c).map(e=>(0,sa.authFetch)(`${oz}/api/memories/${e}`,{method:"DELETE"}))),u(new Set),m.invalidateQueries({queryKey:["memories"]})}finally{h(!1)}}},N=(0,H.useCallback)((e,t)=>{y.mutate({id:e.id,action:t,reviewedBy:"capture-session"},{onSuccess:async()=>{await Promise.all([m.invalidateQueries({queryKey:["memories"]}),m.invalidateQueries({queryKey:["openclaw-sessions"]}),m.invalidateQueries({queryKey:["review-queue"]})])}})},[m,y]);return(0,W.jsxs)("div",{className:"flex flex-col h-full",children:[(0,W.jsxs)("div",{className:"flex items-center gap-3 px-4 py-2 border-b border-slate-800 shrink-0",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:n,onChange:e=>i(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:()=>s("grid"),className:`px-2 py-1 text-xs ${"grid"===a?"bg-slate-700 text-white":"text-slate-400 hover:text-white"}`,children:"Grid"}),(0,W.jsx)("button",{onClick:()=>s("list"),className:`px-2 py-1 text-xs ${"list"===a?"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:()=>{l(!o),u(new Set)},className:`px-2 py-1 text-xs rounded ${o?"bg-blue-600 text-white":"bg-slate-800 text-slate-400 hover:text-white"}`,children:"Select"}),o&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)("button",{onClick:()=>u(new Set(b.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:w,disabled:0===c.size||d,className:"px-2 py-1 text-xs rounded bg-red-600/20 text-red-400 hover:bg-red-600/40 disabled:opacity-40",children:d?"Deleting...":`Delete (${c.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:x?.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:x?.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:x?.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:[g.length," recent"]})]}),(0,W.jsxs)("div",{className:"mt-4 space-y-3",children:[g.slice(0,8).map(e=>(0,W.jsxs)("button",{onClick:()=>f(e.sessionId),className:`block w-full rounded-xl border p-4 text-left transition-colors ${v?.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)),!x?.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:v?`OpenClaw session ${v.sessionId}`:"Select a session"})]}),v&&(0,W.jsxs)("div",{className:"text-right text-xs text-slate-500",children:[(0,W.jsxs)("div",{children:["First seen ",oR(v.firstSeenAt)]}),(0,W.jsxs)("div",{children:["Last seen ",oR(v.lastSeenAt)]})]})]}),v?(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:v.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:v.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:v.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:v.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:v.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:v.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:v.models.join(", ")||"model unknown"}),(0,W.jsx)("div",{children:v.agentIds.join(", ")||"agent unknown"})]})]}),(0,W.jsx)("div",{className:"mt-4 space-y-3",children:v.memories.length>0?v.memories.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",{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 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:"State"}),(0,W.jsx)("div",{className:"text-sm text-slate-100",children:e.status||"active"})]})]}),(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",{onClick:()=>N(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",children:e.pinned?"Unpin":"Pin"}),(0,W.jsx)("button",{onClick:()=>N(e,"suppress"),className:"rounded-lg border border-amber-500/40 px-3 py-1 text-xs text-amber-300 hover:bg-amber-500/10",children:"Discard"}),(0,W.jsx)("button",{onClick:()=>N(e,"archive"),className:"rounded-lg border border-slate-700 px-3 py-1 text-xs text-slate-300 hover:border-slate-500",children:"Archive"}),(0,W.jsx)("button",{onClick:()=>N(e,"canonicalize"),className:"rounded-lg border border-emerald-500/40 px-3 py-1 text-xs text-emerald-300 hover:bg-emerald-500/10",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: ",v.threats," · blocked hints: ",v.blocked," · quarantine hints: ",v.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:[v.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:oR(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}`)),!v.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.jsx)("div",{className:"flex-1 overflow-y-auto p-4",children:(0,W.jsx)("div",{className:"grid"===a?"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-3":"flex flex-col gap-3 max-w-2xl",children:b.map(e=>(0,W.jsx)(oL,{memory:e,isSelected:t?.id===e.id,onSelect:r,isChecked:o?c.has(e.id):void 0,onCheck:o?j:void 0},e.id))})})]})}var o$=e.i(87353);let oB=Y.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";async function oU(){let e=await (0,sa.authFetch)(`${oB}/api/license/status`);if(!e.ok)throw Error("Failed to fetch license status");return e.json()}async function oV(e){let t=await (0,sa.authFetch)(`${oB}/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 oq(){let e=await (0,sa.authFetch)(`${oB}/api/license/deactivate`,{method:"POST"});if(!e.ok)throw Error("Failed to deactivate license");return e.json()}function oK(){return(0,si.useQuery)({queryKey:["license-status"],queryFn:oU,refetchInterval:6e4,retry:2})}let oW=Y.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";function oH({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,o=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:o,fill:"none",stroke:t,strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",opacity:.6})})}let oY=(0,oN.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"}]]),oQ=(0,oN.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"}]]),oX=(0,oN.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"}]]),oG=(0,oN.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"}]]),oZ=(0,oN.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"}]]),oJ=(0,oN.default)("brain",[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]]),o0=(0,oN.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"}]]),o1=(0,oN.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"}]]),o2=(0,oN.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"}]]),o5=(0,oN.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"}]]),o4=(0,oN.default)("clock",[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);var o3=e.i(6847);let o6=(0,oN.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"}]]),o8=(0,oN.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"}]]),o7=[{id:"overview",label:"Home",icon:oY},{id:"recall",label:"Recall",icon:o3.Search},{id:"review",label:"Review",icon:o6},{id:"shield",label:"Shield",icon:oQ},{id:"graph",label:"Graph",icon:o0},{id:"cloud",label:"Cloud",icon:o8},{id:"audit",label:"Audit",icon:oX},{id:"memories",label:"Capture",icon:oZ},{id:"quarantine",label:"Queue",icon:oG},{id:"agents",label:"Agents",icon:o1},{id:"skills",label:"Skills",icon:o2},{id:"dome",label:"Dome",icon:o5},{id:"timeline",label:"Timeline",icon:o4},{id:"brain",label:"Brain",icon:oJ}],o9=new Set(["shield","audit","skills","dome"]);function le(){let{viewMode:e,setViewMode:t}=(0,sr.useDashboardStore)(),{data:r}=(0,st.useStats)(),{data:n}=(0,o$.useAuditStats)("24h"),{data:i}=(0,st.useVersion)(),{data:a}=oK(),{memoryTrend:s,threatTrend:o}=function(){let{data:e}=(0,si.useQuery)({queryKey:["activity-trend"],queryFn:async()=>{let e=await (0,sa.authFetch)(`${oW}/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)(`${oW}/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),o=new Map;if(n?.logs)for(let e of n.logs){let t=e.timestamp.slice(0,10);o.set(t,(o.get(t)??0)+1)}return{memoryTrend:s,threatTrend:i.map(e=>o.get(e)??0)}}(),l=!a||"free"===a.tier,c=r?.decayDistribution?Math.round(r.decayDistribution.healthy/Math.max(1,r.total)*100):null,u=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:o7.map(({id:r,label:n,icon:i})=>{let a="memories"===r?s:"shield"===r?o:null,c="shield"===r?"#f87171":"#22d3ee",d=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 ${d?"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}),d&&(0,W.jsx)(oH,{data:a,color:c,width:24,height:10}),(0,W.jsx)("span",{className:"text-[9px] leading-none",children:n}),"shield"===r&&u>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:u>99?"99+":u}),l&&o9.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]})]})]})}let lt=(0,oN.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"}]]),lr=(0,oN.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"}]]),ln=(0,oN.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"}]]),li=(0,oN.default)("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),la=[{key:"trust",label:"Trust",icon:oQ,color:"text-blue-400",bg:"bg-blue-400/10"},{key:"firewall",label:"Firewall",icon:lt,color:"text-orange-400",bg:"bg-orange-400/10"},{key:"sensitivity",label:"Sensitivity",icon:lr,color:"text-purple-400",bg:"bg-purple-400/10"},{key:"fragmentation",label:"Fragment",icon:ln,color:"text-cyan-400",bg:"bg-cyan-400/10"},{key:"audit",label:"Audit",icon:oX,color:"text-green-400",bg:"bg-green-400/10"}],ls={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 lo({timeRange:e}){let{projectFilter:t}=(0,sr.useDashboardStore)(),{data:r,isLoading:n,isError:i}=(0,o$.useAuditStats)(e,t||void 0),{data:a}=(0,o$.useDefenceConfig)(),s=(0,o$.useSetDefenceMode)(),[o,l]=(0,H.useState)(!1),c=(0,H.useRef)(null),u=a?.mode??"balanced",d=ls[u];return(0,H.useEffect)(()=>{function e(e){c.current&&!c.current.contains(e.target)&&l(!1)}return o&&document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[o]),(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)(oG,{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:la.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<la.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:()=>l(!o),className:`text-xs font-medium ${d.color} ${d.bg} px-2 py-0.5 rounded flex items-center gap-1 hover:opacity-80 transition-opacity`,children:[u,(0,W.jsx)(li,{size:10})]}),o&&(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=ls[e];return(0,W.jsxs)("button",{onClick:()=>{s.mutate(e),l(!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===u?t.color+" font-medium":"text-slate-400"}`,children:[e,e===u&&(0,W.jsx)("span",{className:"text-[10px]",children:"✓"})]},e)})})]})]})]})}function ll(){let{setViewMode:e,projectFilter:t}=(0,sr.useDashboardStore)(),{data:r,isLoading:n,isError:i}=(0,o$.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)(oG,{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 lc({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:o,isError:l}=(0,o$.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]),u=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"}),o?(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..."})}):l?(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/u*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 lu({timeRange:e}){let{projectFilter:t}=(0,sr.useDashboardStore)(),{data:r,isLoading:n,isError:i}=(0,o$.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),o=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))})]}),o.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:o.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 ld=Y.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";function lh(e){return e>70?"#22c55e":e>=40?"#eab308":"#ef4444"}function lp({score:e,size:t=120,strokeWidth:r=8}){let n=(t-r)/2,i=2*Math.PI*n,a=i-e/100*i,s=lh(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 lf({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 lm(){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)(`${ld}/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:o,components:l}=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)(lp,{score:o}),(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:lh(o)},children:o})})]})}),(0,W.jsxs)("div",{className:"space-y-3",children:[(0,W.jsx)(lf,{component:l.freshness}),(0,W.jsx)(lf,{component:l.coverage}),(0,W.jsx)(lf,{component:l.consistency}),(0,W.jsx)(lf,{component:l.consolidation})]})]})}let lx=(0,oN.default)("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),ly=(0,oN.default)("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),lg=(0,oN.default)("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);var lv=e.i(17278);let lb=(0,oN.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 lj(){let{projectFilter:e}=(0,sr.useDashboardStore)(),{data:t}=(0,o$.useAuditStats)("30d",e||void 0),{data:r}=oK(),[n,i]=(0,H.useState)("upsell"),[a,s]=(0,H.useState)(""),[o,l]=(0,H.useState)(null),[c,u]=(0,H.useState)(""),[d,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||!o)return;let e=setInterval(async()=>{try{let t=await fetch(`https://api.shieldcortex.ai/v1/auth/setup-status/${o}`),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&&(u("Setup expired. Please try again."),i("upsell"),clearInterval(e))}catch{}},3e3);return()=>clearInterval(e)},[n,o]);let p=async e=>{if(e.preventDefault(),a&&!d){u(""),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?(l(t.setup_id),i("polling")):u(t.error||"Failed to start setup")}catch{u("Could not reach ShieldCortex Cloud. Check your connection.")}finally{h(!1)}}},f=()=>{localStorage.setItem("shieldcortex_cloud_dismissed",new Date().toISOString()),i("hidden")};if("hidden"===n)return null;let m=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:f,className:"absolute top-3 right-3 text-slate-500 hover:text-slate-300 transition-colors",title:"Dismiss for 30 days",children:(0,W.jsx)(lv.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)(o8,{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:m>0?`You've blocked ${m} 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)(lb,{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:f,className:"absolute top-3 right-3 text-slate-500 hover:text-slate-300 transition-colors",title:"Dismiss for 30 days",children:(0,W.jsx)(lv.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)(o8,{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:m>0?`You've blocked ${m} 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:d,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:[d?(0,W.jsx)(ly,{size:14,className:"animate-spin"}):(0,W.jsx)(lx,{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)(ly,{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)(lg,{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 lw=(0,oN.default)("clock-3",[["path",{d:"M12 6v6h4",key:"135r8i"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]),lN=(0,oN.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"}]]),lk=(0,oN.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"}]]),lS=[];function lO(){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("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):lS,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}}},refetchInterval:1e4})}function lP(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 lC(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 lE(){let{data:e,isLoading:t}=lO(),r=(0,sr.useDashboardStore)(e=>e.setViewMode);if(t||!e)return null;let{enabled:n,apiKeySet:i,lastSyncAt:a,queue:s,device:o}=e,l=s.byKind.memory,c="disabled",u="Cloud sync disabled",d="Enable cloud sync with a Team+ key to replicate memories.";if(n&&i){let e=!!a&&Date.now()-new Date(a).getTime()>864e5;l.failed>0||s.failed>0?(c="warning",u="Cloud sync needs attention",d=s.lastError??"One or more sync jobs failed and need retry."):l.pending>0||s.pending>0?(c="queued",u=l.pending>0?"Memory sync queued":"Cloud sync queued",d=s.nextRetryAt?`Next retry ${lC(s.nextRetryAt)}`:"Waiting to flush queued sync jobs."):e?(c="warning",u="Cloud sync stale",d=a?`Last successful sync ${lP(a)}`:"No successful sync recorded yet."):(c="healthy",u="Cloud sync healthy",d=a?`Last successful sync ${lP(a)}`:"Connected and ready to sync.")}let h=function(e){switch(e){case"healthy":return{border:"border-emerald-500/20",bg:"bg-emerald-500/10",text:"text-emerald-300",icon:lg};case"queued":return{border:"border-amber-500/20",bg:"bg-amber-500/10",text:"text-amber-300",icon:lN};case"warning":return{border:"border-red-500/20",bg:"bg-red-500/10",text:"text-red-300",icon:oG};default:return{border:"border-slate-700",bg:"bg-slate-800/80",text:"text-slate-300",icon:lk}}}(c),p=h.icon;return(0,W.jsxs)("div",{className:`mb-4 rounded-xl border ${h.border} ${h.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)(p,{size:16,className:h.text}),(0,W.jsx)("span",{className:`text-sm font-medium ${h.text}`,children:u})]}),(0,W.jsx)("p",{className:"mt-1 text-xs text-slate-400",children:d}),(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)(lk,{size:11}),o.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)(lw,{size:11}),"Synced ",lP(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 ",lP(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:l.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:"Failed jobs"}),(0,W.jsx)("div",{className:`mt-1 text-lg font-semibold ${s.failed>0?"text-red-300":"text-white"}`,children:s.failed}),(0,W.jsx)("div",{className:"text-[11px] text-slate-500",children:"all payload kinds"})]}),(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:l.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?lC(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 lM=(0,oN.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"}]]),lA=Y.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";async function lT(e){let t=await (0,sa.authFetch)(`${lA}/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 l_(e){let t=await (0,sa.authFetch)(`${lA}/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 lD(){return(0,oM.useMutation)({mutationFn:e=>lT(e)})}async function lI(e){let t=await (0,sa.authFetch)(`${lA}/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 lL(e){let t=await (0,sa.authFetch)(`${lA}/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 lz(e){let t=await (0,sa.authFetch)(`${lA}/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 lR(){let e=lD(),{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)(ly,{size:12,className:"animate-spin"}):(0,W.jsx)(o2,{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)(lg,{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)(lM,{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)(lx,{size:12})]})]}):e.isPending?(0,W.jsx)("div",{className:"flex items-center justify-center py-4",children:(0,W.jsx)(ly,{size:16,className:"text-cyan-400 animate-spin"})}):(0,W.jsxs)("div",{className:"text-center py-3",children:[(0,W.jsx)(o2,{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 lF=Y.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";async function l$(){let e=await (0,sa.authFetch)(`${lF}/api/iron-dome/status`);if(!e.ok)throw Error("Failed to fetch Iron Dome status");return e.json()}async function lB(e){let t=await (0,sa.authFetch)(`${lF}/api/iron-dome/activate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({profile:e})});if(!t.ok)throw Error("Failed to activate Iron Dome");return t.json()}async function lU(){let e=await (0,sa.authFetch)(`${lF}/api/iron-dome/deactivate`,{method:"POST"});if(!e.ok)throw Error("Failed to deactivate Iron Dome");return e.json()}async function lV(e){let t=await (0,sa.authFetch)(`${lF}/api/iron-dome/scan`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:e})});if(!t.ok)throw Error("Failed to scan text");return t.json()}async function lq(){let e=await (0,sa.authFetch)(`${lF}/api/iron-dome/emergency-stop`,{method:"POST"});if(!e.ok)throw Error("Failed to trigger emergency stop");return e.json()}async function lK(e){let t=await (0,sa.authFetch)(`${lF}/api/iron-dome/resume`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:e||"Resumed via dashboard"})});if(!t.ok)throw Error("Failed to resume operations");return t.json()}async function lW(){let e=await (0,sa.authFetch)(`${lF}/api/control/status`);if(!e.ok)throw Error("Failed to fetch control status");return e.json()}async function lH(e){let t=new URLSearchParams;e&&t.set("limit",e.toString());let r=await (0,sa.authFetch)(`${lF}/api/iron-dome/audit?${t}`);if(!r.ok)throw Error("Failed to fetch Iron Dome audit");return r.json()}function lY(){return(0,si.useQuery)({queryKey:["iron-dome-status"],queryFn:l$,refetchInterval:3e4,retry:2})}function lQ(e){return(0,si.useQuery)({queryKey:["iron-dome-audit",e],queryFn:()=>lH(e),refetchInterval:3e4,retry:2})}function lX(){let e=(0,oE.useQueryClient)();return(0,oM.useMutation)({mutationFn:lq,onSuccess:()=>{e.invalidateQueries({queryKey:["iron-dome-status"]}),e.invalidateQueries({queryKey:["iron-dome-audit"]}),e.invalidateQueries({queryKey:["control-status"]})}})}function lG(){let{data:e,isLoading:t}=lY(),{data:r}=lQ(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,o=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:o}),(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)(oQ,{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 lZ=[],lJ="http://localhost:3001";function l0(){return(0,si.useQuery)({queryKey:["cloud-config"],queryFn:async()=>{var e;let t,r,n=await (0,sa.authFetch)(`${lJ}/api/cloud/config`);if(!n.ok)throw Error("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):lZ,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 l1(){let e=(0,oE.useQueryClient)();return(0,oM.useMutation)({mutationFn:async e=>{let t=await (0,sa.authFetch)(`${lJ}/api/cloud/config`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw Error("Failed to update cloud config");return t.json()},onSuccess:()=>{e.invalidateQueries({queryKey:["cloud-config"]}),e.invalidateQueries({queryKey:["cloud-sync-status"]})}})}function l2(e,t,r){return Math.max(t,Math.min(r,e))}function l5({initialAutoMemory:e,initialDedupe:t,initialNoveltyThreshold:r,initialMaxRecent:n}){let i=l1(),[a,s]=(0,H.useState)(e),[o,l]=(0,H.useState)(t),[c,u]=(0,H.useState)(String(r)),[d,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:()=>l(!o),disabled:!a,className:`h-6 w-11 rounded-full transition-colors ${o&&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 ${o&&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)(ob,{type:"number",step:"0.01",min:.6,max:.99,value:c,disabled:!a||!o,onChange:e=>u(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)(ob,{type:"number",step:"1",min:50,max:1e3,value:d,disabled:!a||!o,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)(ov,{size:"sm",onClick:()=>{let e=l2(Number.parseFloat(c),.6,.99),t=Math.floor(l2(Number.parseInt(d,10),50,1e3));i.mutate({openclawAutoMemory:a,openclawAutoMemoryDedupe:o,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)(ly,{size:12,className:"animate-spin"}):null,"Save"]})]})]})}function l4(){let{data:e,isLoading:t}=l0(),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)(l5,{initialAutoMemory:r?.autoMemory??!1,initialDedupe:r?.dedupe??!0,initialNoveltyThreshold:r?.noveltyThreshold??.88,initialMaxRecent:r?.maxRecent??300},n)]})}let l3=(0,oN.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 l6=e.i(13808);let l8=(0,oN.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"}]]),l7=(0,oN.default)("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]),l9="https://api.shieldcortex.ai",ce=Y.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001",ct={free:"Free",pro:"Pro",team:"Team",enterprise:"Enterprise"},cr={free:"text-slate-400",pro:"text-cyan-400",team:"text-violet-400",enterprise:"text-amber-400"},cn={free:"bg-slate-400/10",pro:"bg-cyan-400/10",team:"bg-violet-400/10",enterprise:"bg-amber-400/10"},ci={pro:{label:"Pro",price:"£29/mo"},team:{label:"Team",price:"£99/mo"}},ca=["Custom injection patterns","Custom Iron Dome policies","Custom firewall rules","Audit export (JSON/CSV)","Skill scanner deep mode"];function cs(){let e,t,{data:r,isLoading:n}=oK(),i=(e=(0,oE.useQueryClient)(),(0,oM.useMutation)({mutationFn:e=>oV(e),onSuccess:()=>{e.invalidateQueries({queryKey:["license-status"]})}})),a=(t=(0,oE.useQueryClient)(),(0,oM.useMutation)({mutationFn:oq,onSuccess:()=>{t.invalidateQueries({queryKey:["license-status"]})}})),s=function(){let e=(0,oE.useQueryClient)(),[t,r]=(0,H.useState)("idle"),[n,i]=(0,H.useState)(null),[a,s]=(0,H.useState)(null),o=(0,H.useCallback)(async(e,t)=>{r("submitting"),i(null);try{let n=await fetch(`${l9}/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(`${l9}/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)(`${ce}/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:o,reset:(0,H.useCallback)(()=>{r("idle"),i(null),s(null)},[])}}(),[o,l]=(0,H.useState)(""),[c,u]=(0,H.useState)("default"),[d,h]=(0,H.useState)(""),[p,f]=(0,H.useState)("pro"),[m,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)(oQ,{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)(l6.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:ca.map(e=>(0,W.jsxs)("div",{className:"flex items-center gap-1.5 text-xs",children:[(0,W.jsx)(l8,{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)(lg,{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)(ly,{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(),u("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:d,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:()=>f(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:[ci[e].label," — ",ci[e].price]},e))}),(0,W.jsxs)("div",{className:"flex items-center gap-2",children:[(0,W.jsx)("button",{onClick:()=>s.startCheckout(d,p),disabled:"submitting"===s.state||!d.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)(ly,{size:12,className:"animate-spin"}):"Continue to Checkout"}),(0,W.jsx)("button",{onClick:()=>{u("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(),o.trim()&&i.mutate(o.trim(),{onSuccess:()=>{l(""),u("default")}})},className:"flex gap-2",children:[(0,W.jsx)("input",{type:"text",placeholder:"sc_pro_...",value:o,onChange:e=>l(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||!o.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)(ly,{size:12,className:"animate-spin"}):"Activate"}),(0,W.jsx)("button",{type:"button",onClick:()=>{u("default"),l(""),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:()=>u("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:()=>u("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)(l3,{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(),u("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(),u("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)(oQ,{size:16,className:cr[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 ${cr[y]} ${cn[y]}`,children:ct[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(!m),className:"flex items-center gap-1 text-[10px] text-slate-500 hover:text-slate-300 transition-colors mb-2",children:[m?(0,W.jsx)(l7,{size:12}):(0,W.jsx)(li,{size:12}),m?"Hide features":"Show features"]}),m&&(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)(lg,{size:12,className:"text-emerald-400 shrink-0"}):(0,W.jsx)(lM,{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 ${cr[e.requiredTier]} ${cn[e.requiredTier]}`,children:ct[e.requiredTier]})]},e.feature))}),(0,W.jsx)("button",{onClick:()=>{confirm(`Remove your ${ct[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 co=(0,oN.default)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),cl=(0,oN.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"}]]),cc=(0,oN.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"}]]),cu=(0,oN.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 cd({feature:e,children:t,label:r}){let{data:n}=oK();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)(l8,{size:24,className:"text-slate-500 mb-2"}),(0,W.jsxs)("p",{className:"text-sm font-medium text-slate-300 mb-1",children:[ct[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 ",ct[a],(0,W.jsx)(lb,{size:10})]})]})]})}let ch=Y.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001",cp=[{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}],cf=[{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}],cm=[{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}],cx=[{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"}],cy={"File access":45,"Network calls":30,"Process exec":15,"Memory write":10},cg=["Restrict filesystem writes to a sandboxed directory","Add explicit network permission declarations to SKILL.md"];function cv(){let e,t,r,n,{data:i,isLoading:a,isLocked:s}={...e=(0,si.useQuery)({queryKey:["firewall-rules"],queryFn:()=>(0,sa.gatedFetch)(`${ch}/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},o=(t=(0,oE.useQueryClient)(),(0,oM.useMutation)({mutationFn:e=>(0,sa.gatedFetch)(`${ch}/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"]})}})),l=(r=(0,oE.useQueryClient)(),(0,oM.useMutation)({mutationFn:({id:e,...t})=>(0,sa.gatedFetch)(`${ch}/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,oE.useQueryClient)(),(0,oM.useMutation)({mutationFn:e=>(0,sa.gatedFetch)(`${ch}/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"]})}})),[u,d]=(0,H.useState)(!1),[h,p]=(0,H.useState)({name:"",priority:100,condition_type:"regex",condition_value:"",action:"block"}),f=i?.rules??[];return s?(0,W.jsx)(cb,{}):(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)(oQ,{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:[f.length,"/25"]})]}),(0,W.jsxs)("button",{onClick:()=>d(!u),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)(co,{size:12})," Add Rule"]})]}),u&&(0,W.jsxs)("form",{onSubmit:e=>{e.preventDefault(),o.mutate(h,{onSuccess:()=>{d(!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:o.isPending,className:"px-3 py-1 text-xs bg-cyan-600 text-white rounded hover:bg-cyan-500 disabled:opacity-50",children:o.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"})]}),o.error&&(0,W.jsx)("p",{className:"text-xs text-red-400",children:o.error.message})]}),a?(0,W.jsx)("div",{className:"text-xs text-slate-500 py-4 text-center",children:"Loading rules..."}):0===f.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:f.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:()=>l.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)(cu,{size:14,className:"text-cyan-400"}):(0,W.jsx)(cc,{size:14})}),(0,W.jsx)("button",{onClick:()=>c.mutate(e.id),className:"text-slate-500 hover:text-red-400",children:(0,W.jsx)(cl,{size:12})})]},e.id))})]})}function cb(){return(0,W.jsxs)("div",{className:"space-y-3",children:[(0,W.jsxs)("div",{className:"flex items-center gap-2",children:[(0,W.jsx)(oQ,{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:cp.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 cj(){return(0,W.jsx)("div",{className:"bg-slate-900/50 border border-slate-800 rounded-xl p-4",children:(0,W.jsx)(cd,{feature:"custom_firewall_rules",label:"Add custom rules to control what gets blocked, allowed, or quarantined.",children:(0,W.jsx)(cv,{})})})}function cw(){let[e,t]=(0,H.useState)("24h");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.jsx)("h2",{className:"text-lg font-semibold text-white",children:"Defence Overview"}),(0,W.jsx)("div",{className:"flex gap-1 bg-slate-800 rounded-lg 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.jsx)(cs,{}),(0,W.jsx)(lE,{}),(0,W.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[(0,W.jsx)(lo,{timeRange:e}),(0,W.jsx)(ll,{}),(0,W.jsx)(lc,{timeRange:e}),(0,W.jsx)(lu,{timeRange:e})]}),(0,W.jsx)("div",{className:"mt-4",children:(0,W.jsx)(lm,{})}),(0,W.jsx)("div",{className:"mt-4",children:(0,W.jsx)(lR,{})}),(0,W.jsx)("div",{className:"mt-4",children:(0,W.jsx)(lG,{})}),(0,W.jsx)("div",{className:"mt-4",children:(0,W.jsx)(l4,{})}),(0,W.jsx)("div",{className:"mt-4",children:(0,W.jsx)(cj,{})}),(0,W.jsx)(lj,{})]})}let cN=(0,oN.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"}]]),ck=(0,oN.default)("shield-alert",[["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:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);function cS(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 cO(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 cP(){let{data:e,isLoading:t}=lO(),{data:r}=oK();if(t||!e)return null;let n="border-slate-700 bg-slate-900/70 text-slate-200",i="Cloud sync disabled",a="Enable cloud sync and activate a Team licence to start replicating local data.",s=o8;return e.enabled&&e.apiKeySet&&!e.featureEnabled?(n="border-amber-500/30 bg-amber-500/10 text-amber-200",i="Cloud configured but licence locked",a=`Cloud sync requires the ${ct[e.requiredTier]} tier. Current tier: ${ct[r?.tier??"free"]}.`,s=cN):e.enabled&&e.apiKeySet&&e.queue.failed>0?(n="border-red-500/30 bg-red-500/10 text-red-200",i="Cloud sync needs attention",a=e.queue.lastError??"One or more queued sync jobs are failing.",s=ck):e.enabled&&e.apiKeySet&&e.queue.pending>0?(n="border-amber-500/30 bg-amber-500/10 text-amber-200",i="Cloud sync is catching up",a=e.queue.nextRetryAt?`Next retry ${cO(e.queue.nextRetryAt)}.`:"Queued jobs are waiting to flush.",s=lN):e.enabled&&e.apiKeySet&&(n="border-emerald-500/30 bg-emerald-500/10 text-emerald-200",i="Cloud sync healthy",a=e.lastSyncAt?`Last successful sync ${cS(e.lastSyncAt)}.`:"Connected and ready to sync.",s=lg),(0,W.jsx)("div",{className:`rounded-2xl border p-4 ${n}`,children:(0,W.jsxs)("div",{className:"flex items-start gap-3",children:[(0,W.jsx)(s,{size:18,className:"mt-0.5 shrink-0"}),(0,W.jsxs)("div",{children:[(0,W.jsx)("h2",{className:"text-sm font-semibold",children:i}),(0,W.jsx)("p",{className:"mt-1 text-sm opacity-90",children:a})]})]})})}function cC({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 cE({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 cM(){let{data:e}=l0(),{data:t}=(0,si.useQuery)({queryKey:["cloud-projects"],queryFn:async()=>{let e=await (0,sa.authFetch)(`${lJ}/api/cloud/projects`);if(!e.ok)throw Error("Failed to fetch cloud projects");return e.json()},staleTime:3e4}),r=l1(),[n,i]=(0,H.useState)(null),a=t?.projects??[],s=n??e?.syncControls??{projectMode:"all",projects:[],contentMode:"full",excludeSensitive:!1};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-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."}),(0,W.jsx)("div",{className:"mt-3 max-h-48 overflow-y-auto rounded-lg border border-slate-800 bg-slate-900/40 p-3",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 cA(){let{data:e,isLoading:t}=lO(),{data:r,isLoading:n}=l0(),{data:i,isLoading:a}=oK();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,o=e.queue.byKind.memory,l=e.queue.byKind.graph,c=e.lastSyncAt?cS(e.lastSyncAt):"Never";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:"Inspect local-to-cloud replication health, queue pressure, device identity, and Team licence gating."})]}),(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 ${cn[s]} ${cr[s]}`,children:ct[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: ",c]})]})]}),(0,W.jsx)(cP,{}),(0,W.jsxs)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-4",children:[(0,W.jsx)(cC,{label:"Device",value:e.device.name,detail:`${e.device.platform} \xb7 ${e.device.id.slice(0,12)}`,icon:lk}),(0,W.jsx)(cC,{label:"Cloud Target",value:new URL(e.baseUrl).host,detail:e.enabled?"Configured target":"Disabled in config",icon:o8}),(0,W.jsx)(cC,{label:"Memory Queue",value:o.pending,detail:`${o.failed} failed \xb7 ${o.synced} synced`,icon:oZ}),(0,W.jsx)(cC,{label:"Graph Queue",value:l.pending,detail:`${l.failed} failed \xb7 ${l.synced} synced`,icon:o0})]}),(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:"Queue Breakdown"}),(0,W.jsx)("p",{className:"mt-1 text-sm text-slate-400",children:"Pending and failed sync jobs by payload type. This is the fastest way to spot whether memories or graph slices are backing up."})]})}),(0,W.jsxs)("div",{className:"mt-5 grid grid-cols-1 gap-3 md:grid-cols-2 2xl:grid-cols-4",children:[(0,W.jsx)(cE,{label:"Memory",...o}),(0,W.jsx)(cE,{label:"Graph",...l}),(0,W.jsx)(cE,{label:"Audit",...e.queue.byKind.audit}),(0,W.jsx)(cE,{label:"Quarantine",...e.queue.byKind.quarantine})]}),(0,W.jsx)("div",{className:"mt-5 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?cS(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?cO(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"}),(0,W.jsx)("td",{className:"px-4 py-3",children:e.queue.failed}),(0,W.jsx)("td",{className:"px-4 py-3 text-slate-400",children:"A non-zero count usually means auth, network, or schema mismatch problems."})]}),(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?cS(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)(cM,{}),(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:"Configuration"}),(0,W.jsxs)("div",{className:"mt-4 space-y-3 text-sm",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:"Cloud endpoint"}),(0,W.jsx)("div",{className:"mt-2 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:"Feature gate"}),(0,W.jsxs)("div",{className:"mt-2 flex items-center gap-2",children:[e.featureEnabled?(0,W.jsx)(lg,{size:16,className:"text-emerald-400"}):(0,W.jsx)(oG,{size:16,className:"text-amber-400"}),(0,W.jsx)("span",{className:"font-medium text-white",children:e.featureEnabled?"Team cloud sync enabled":`Requires ${ct[e.requiredTier]} tier`})]})]}),(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:"Current sync policy"}),(0,W.jsxs)("div",{className:"mt-2 grid grid-cols-2 gap-2 text-xs text-slate-300",children:[(0,W.jsxs)("span",{children:["Projects: ",e.controls.projectMode]}),(0,W.jsxs)("span",{children:["Content: ",e.controls.contentMode]}),(0,W.jsxs)("span",{children:["Sensitive filter: ",e.controls.excludeSensitive?"Enabled":"Off"]}),(0,W.jsxs)("span",{children:["Selected projects: ",e.controls.projects.length]})]})]}),(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: ",r.openclawMemory.autoMemory?"On":"Off"]}),(0,W.jsxs)("span",{children:["Dedupe: ",r.openclawMemory.dedupe?"On":"Off"]}),(0,W.jsxs)("span",{children:["Novelty threshold: ",r.openclawMemory.noveltyThreshold]}),(0,W.jsxs)("span",{children:["Recent window: ",r.openclawMemory.maxRecent]})]})]})]})]}),(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 text-red-300",children:[(0,W.jsx)(oG,{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.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)(lw,{size:12}),"Retry ",cO(e.queue.nextRetryAt)]})]}):(0,W.jsxs)("div",{className:"flex items-center gap-2 text-sm text-emerald-300",children:[(0,W.jsx)(lg,{size:16}),"No recent sync errors recorded."]})})]})]})]})]})})}let cT=(0,oN.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"}]]),c_=Y.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";async function cD(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)(`${c_}/api/recall/explain?${t.toString()}`);if(!r.ok)throw Error("Failed to explain recall");return r.json()}async function cI(e,t){let r=new URLSearchParams({mode:"search",query:e,limit:"8"});t&&r.set("project",t);let n=await (0,sa.authFetch)(`${c_}/api/memories?${r.toString()}`);if(!n.ok)throw Error("Failed to fetch memory candidates");return(await n.json()).memories}function cL(){var e;let{projectFilter:t,setSelectedMemory:r,setViewMode:n}=(0,sr.useDashboardStore)(),[i,a]=(0,H.useState)(""),[s,o]=(0,H.useState)(""),[l,c]=(0,H.useState)(""),[u,d]=(0,H.useState)(null),[h,p]=(0,H.useState)([]),f=(0,oM.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}});(0,H.useEffect)(()=>{p(JSON.parse(window.localStorage.getItem("shieldcortex:recall-history")??"[]"))},[]);let{data:m,isLoading:x}=(e=(0,H.useMemo)(()=>s.trim()?{query:s.trim(),project:t,expectedId:u}:null,[s,t,u]),(0,si.useQuery)({queryKey:["recall-explain",e],queryFn:()=>cD(e),enabled:!!e?.query?.trim(),staleTime:3e4})),{data:y=[]}=(0,si.useQuery)({queryKey:["memory-candidates",l,t],queryFn:()=>cI(l,t),enabled:l.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.jsx)("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)(l6.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:"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()&&(o(i.trim()),f.mutate(i.trim(),{onSuccess:e=>p(e)}))},children:[(0,W.jsxs)("div",{className:"flex gap-3",children:[(0,W.jsxs)("div",{className:"relative flex-1",children:[(0,W.jsx)(o3.Search,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-slate-500"}),(0,W.jsx)(ob,{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)(ov,{type:"submit",className:"h-11 bg-cyan-600 hover:bg-cyan-500",children:"Explain recall"})]}),h.length>0&&(0,W.jsx)("div",{className:"flex flex-wrap gap-2",children:h.map(e=>(0,W.jsx)("button",{type:"button",onClick:()=>{a(e),o(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)("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.18em] text-slate-500",children:"Expected memory"}),(0,W.jsx)(ob,{value:l,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:y.map(e=>(0,W.jsxs)("button",{onClick:()=>{d(e.id),c(e.title)},className:`block w-full rounded-lg border px-3 py-2 text-left text-sm ${u===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 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:[m?.total??0," results"]})]}),x&&(0,W.jsx)("div",{className:"text-sm text-slate-400",children:"Explaining…"})]}),(0,W.jsxs)("div",{className:"mt-4 space-y-3",children:[m?.results.map((e,t)=>(0,W.jsxs)("button",{onClick:()=>{r(e.memory),n("memories")},className:"block w-full rounded-xl border border-slate-800 bg-slate-950/70 p-4 text-left hover:border-slate-600",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)(ck,{size:12}),e.contradictions.length," contradiction link",1===e.contradictions.length?"":"s"]})]},e.memory.id)),!x&&!m?.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)(cT,{size:13}),"Expected memory debugger"]}),m?.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:m.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: ",m.expectedMemory.rank??"not returned"]}),(0,W.jsxs)("div",{children:["Status: ",m.expectedMemory.status]}),(0,W.jsxs)("div",{children:["Capture: ",m.expectedMemory.captureMethod," · ",m.expectedMemory.sourceKind]})]}),(0,W.jsx)("div",{className:"space-y-2",children:m.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 to compare it against the ranked result set."})]}),(0,W.jsxs)("div",{className:"rounded-2xl border border-slate-800 bg-slate-900/70 p-5",children:[(0,W.jsx)("div",{className:"text-xs uppercase tracking-[0.18em] text-slate-500",children:"Likely misses"}),(0,W.jsxs)("div",{className:"mt-4 space-y-3",children:[(m?.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)),!m?.misses?.length&&(0,W.jsx)("div",{className:"text-sm text-slate-400",children:"No notable misses for this query."})]})]})]})]})]})})}let cz=(0,oN.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"}]]),cR=(0,oN.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"}]]),cF=(0,oN.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"}]]),c$=(0,oN.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 cB({memory:e,onOpen:t}){let r=oD(),n=t=>{r.mutate({id:e.id,action:t,reviewedBy:"dashboard"})};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"}),(0,W.jsxs)("button",{onClick:()=>n(e.pinned?"unpin":"pin"),className:"rounded-lg border border-slate-700 px-3 py-1 text-xs text-slate-300 hover:border-slate-500",children:[(0,W.jsx)(cF,{className:"mr-1 inline h-3 w-3"}),e.pinned?"Unpin":"Pin"]}),(0,W.jsx)("button",{onClick:()=>n("suppress"),className:"rounded-lg border border-amber-500/40 px-3 py-1 text-xs text-amber-300 hover:bg-amber-500/10",children:"Suppress"}),(0,W.jsxs)("button",{onClick:()=>n("archive"),className:"rounded-lg border border-slate-700 px-3 py-1 text-xs text-slate-300 hover:border-slate-500",children:[(0,W.jsx)(cz,{className:"mr-1 inline h-3 w-3"}),"Archive"]}),(0,W.jsxs)("button",{onClick:()=>n(e.cloudExcluded?"includeCloud":"excludeCloud"),className:"rounded-lg border border-slate-700 px-3 py-1 text-xs text-slate-300 hover:border-slate-500",children:[(0,W.jsx)(cR,{className:"mr-1 inline h-3 w-3"}),e.cloudExcluded?"Include cloud":"Exclude cloud"]}),(0,W.jsx)("button",{onClick:()=>n("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",children:"global"===e.scope?"Project scope":"Make global"}),(0,W.jsx)("button",{onClick:()=>n("canonicalize"),className:"rounded-lg border border-emerald-500/40 px-3 py-1 text-xs text-emerald-300 hover:bg-emerald-500/10",children:"Canonical"})]})}function cU({title:e,detail:t,items:r,onOpen:n}){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.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:"State"}),(0,W.jsx)("div",{className:"text-sm text-slate-100",children:e.status||"active"})]})]}),(0,W.jsx)(cB,{memory:e,onOpen:n})]},e.id)),!r.length&&(0,W.jsx)("div",{className:"text-sm text-slate-400",children:"Nothing to review here."})]})]})}function cV(){let{projectFilter:e,setSelectedMemory:t,setViewMode:r}=(0,sr.useDashboardStore)(),{data:n,isLoading:i}=(0,si.useQuery)({queryKey:["review-queue",e],queryFn:()=>oT(e),staleTime:3e4}),a=e=>{t(e),r("memories")};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:"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)(c$,{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(n?.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)(l6.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:n?.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:n?.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:n?.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:n?.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:n?.openClaw.pinned??0})]})]})]})]}),i&&(0,W.jsx)("div",{className:"text-sm text-slate-400",children:"Loading review queue…"}),(0,W.jsxs)("div",{className:"grid gap-6 xl:grid-cols-2",children:[(0,W.jsx)(cU,{title:"Low trust",detail:"These memories came from weaker or noisier sources.",items:n?.sections.lowTrust??[],onOpen:a}),(0,W.jsx)(cU,{title:"Noisy auto-extracted",detail:"Auto capture is useful, but not every extraction deserves to stay hot.",items:n?.sections.noisyAutoExtracted??[],onOpen:a}),(0,W.jsx)(cU,{title:"Stale",detail:"Useful once, maybe. Worth archiving or refreshing now.",items:n?.sections.stale??[],onOpen:a}),(0,W.jsx)(cU,{title:"Never used",detail:"Stored but never recalled. High count usually means capture is too noisy.",items:n?.sections.neverUsed??[],onOpen:a}),(0,W.jsx)(cU,{title:"Projectless",detail:"These memories have no useful project scope and are likely to leak into the wrong context.",items:n?.sections.projectless??[],onOpen:a}),(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 gap-2",children:[(0,W.jsx)(ck,{size:16,className:"text-amber-300"}),(0,W.jsx)("h3",{className:"text-lg font-semibold text-white",children:"Contradiction clusters"})]}),(0,W.jsxs)("div",{className:"mt-4 space-y-3",children:[(n?.sections.contradictions??[]).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.jsx)("div",{className:"text-sm font-medium text-white",children:e.memoryA.title}),(0,W.jsx)("div",{className:"mt-1 text-xs text-slate-500",children:"conflicts with"}),(0,W.jsx)("div",{className:"mt-1 text-sm font-medium text-white",children:e.memoryB.title}),(0,W.jsx)("div",{className:"mt-2 text-xs text-slate-400",children:e.reason}),(0,W.jsxs)("div",{className:"mt-3 flex gap-2",children:[(0,W.jsx)("button",{onClick:()=>a(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:()=>a(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"})]})]},`${e.memoryA.id}-${e.memoryB.id}`)),!n?.sections.contradictions?.length&&(0,W.jsx)("div",{className:"text-sm text-slate-400",children:"No contradiction clusters detected."})]})]})]})]})})}let cq=(0,oN.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"}]]),cK=(0,oN.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"}]]),cW=Y.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";function cH(){let e=(0,oM.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)(`${cW}/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),o=document.createElement("a");return o.href=s,o.download=`shieldcortex-audit-${Date.now()}.${"csv"===e?"csv":"json"}`,document.body.appendChild(o),o.click(),document.body.removeChild(o),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)(cq,{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)(cK,{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)(oX,{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)(cq,{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 cY(){return(0,W.jsx)("div",{className:"bg-slate-900/50 border border-slate-800 rounded-xl p-4",children:(0,W.jsx)(cd,{feature:"audit_export",label:"Export your full audit trail as JSON or CSV for compliance reporting.",children:(0,W.jsx)(cH,{})})})}let cQ={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 cX(){let{projectFilter:e,selectedAuditEntry:t,setSelectedAuditEntry:r}=(0,sr.useDashboardStore)(),[n,i]=(0,H.useState)("24h"),[a,s]=(0,H.useState)(void 0),[o,l]=(0,H.useState)(void 0),c={"24h":24,"7d":168,"30d":720},[u,d]=(0,H.useState)(()=>Date.now());(0,H.useEffect)(()=>{d(Date.now())},[n]);let h=(0,H.useMemo)(()=>new Date(6e4*Math.floor((u-36e5*c[n])/6e4)).toISOString(),[u,n]),{data:p,isLoading:f}=(0,o$.useAuditLogs)({startTime:h,source:a,firewallResult:o,project:e||void 0,limit:200}),m=(0,H.useMemo)(()=>p?.logs??[],[p?.logs]),x=(0,H.useCallback)(e=>{if(!t||0===m.length)return;let n=m.findIndex(e=>e.id===t.id);"Escape"===e.key?r(null):"ArrowDown"===e.key&&n<m.length-1?(e.preventDefault(),r(m[n+1])):"ArrowUp"===e.key&&n>0&&(e.preventDefault(),r(m[n-1]))},[t,m,r]);return(0,H.useEffect)(()=>(window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)),[x]),(0,W.jsxs)("div",{className:"h-full flex flex-col overflow-hidden",children:[(0,W.jsxs)("div",{className:"p-4 border-b border-slate-800 shrink-0",children:[(0,W.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,W.jsx)("h2",{className:"text-lg font-semibold text-white",children:"Audit Log"}),(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:"flex gap-2",children:[(0,W.jsxs)("select",{value:o||"",onChange:e=>l(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.jsxs)("span",{className:"text-xs text-slate-500 self-center ml-auto",children:[m.length," entries"]})]})]}),(0,W.jsx)("div",{className:"flex-1 overflow-y-auto",children:f?(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===m.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.jsxs)("table",{className:"w-full text-xs",children:[(0,W.jsx)("thead",{className:"sticky top-0 bg-slate-900",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:m.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 ${cQ[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))})]})}),(0,W.jsx)("div",{className:"mt-4",children:(0,W.jsx)(cY,{})})]})}let cG={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"}},cZ={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)"}},cJ={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 c0(e){return e>=.7?"#22C55E":e>=.4?"#EAB308":"#EF4444"}function c1(e){return e>.5?"#EF4444":e>.2?"#EAB308":"#94a3b8"}function c2({entry:e,onClose:t,onViewMemory:r}){let[n,i]=(0,H.useState)(!1),a=cG[e.firewall_result]||cG.ALLOW,s=cZ[e.sensitivity_level]||cZ.PUBLIC,o=function(e){try{let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}(e.threat_indicators),l=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)(os,{className:"bg-slate-900 border-slate-700 h-full overflow-auto",children:[(0,W.jsxs)(oo,{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)(ov,{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)(oc,{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:c0(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:c0(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:c1(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:c1(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"}),o.length>0?(0,W.jsx)("div",{className:"flex flex-wrap gap-1.5",children:o.map((e,t)=>{let r=cJ[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"})]}),l.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:l.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)(ov,{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)(ov,{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 c5=(0,oN.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"}]]),c4=(0,oN.default)("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]),c3=(0,oN.default)("square-minus",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 12h8",key:"1wcyev"}]]);function c6({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 store the memory in the database.":"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 c8(){let{projectFilter:e}=(0,sr.useDashboardStore)(),[t,r]=(0,H.useState)("pending"),{data:n,isLoading:i}=(0,o$.useQuarantine)(t,100,e||void 0),a=(0,o$.useApproveQuarantine)(),s=(0,o$.useRejectQuarantine)(),o=(0,o$.useBulkApproveQuarantine)(),l=(0,o$.useBulkRejectQuarantine)(),[c,u]=(0,H.useState)(null),[d,h]=(0,H.useState)(new Set),[p,f]=(0,H.useState)(null),m=n?.items??[],x=m.filter(e=>"pending"===e.status),y=x.length>0&&x.every(e=>d.has(e.id)),g=x.some(e=>d.has(e.id)),v=(0,H.useCallback)(e=>{h(t=>{let r=new Set(t);return r.has(e)?r.delete(e):r.add(e),r})},[]),b=(0,H.useCallback)(()=>{y?h(new Set):h(new Set(x.map(e=>e.id)))},[y,x]);return(0,W.jsxs)("div",{className:"h-full flex flex-col overflow-hidden",children:[c&&(0,W.jsx)(c6,{action:c.action,item:c.item,onConfirm:()=>{c&&("approve"===c.action?a.mutate(c.item.id):s.mutate({id:c.item.id}),u(null))},onCancel:()=>u(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"," ",d.size," item",1!==d.size?"s":"","?"]}),(0,W.jsx)("p",{className:"text-xs text-slate-400 mb-4",children:"approve"===p?"This will store all selected memories in the database.":"This will permanently discard all selected memories."}),(0,W.jsxs)("div",{className:"flex gap-2 justify-end",children:[(0,W.jsx)("button",{onClick:()=>f(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===d.size)return;let e=Array.from(d);"approve"===p?o.mutate(e):l.mutate(e),h(new Set),f(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"," ",d.size," item",1!==d.size?"s":""]})]})]})}),(0,W.jsxs)("div",{className:"p-4 border-b border-slate-800 shrink-0",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&&x.length>0&&(0,W.jsxs)("div",{className:"flex items-center gap-3 mt-3",children:[(0,W.jsxs)("button",{onClick:b,className:"flex items-center gap-1.5 text-xs text-slate-400 hover:text-white transition-colors",children:[y?(0,W.jsx)(c5,{size:14,className:"text-cyan-400"}):g?(0,W.jsx)(c3,{size:14,className:"text-cyan-400"}):(0,W.jsx)(c4,{size:14}),y?"Deselect all":"Select all"]}),g&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)("span",{className:"text-xs text-slate-500",children:[d.size," selected"]}),(0,W.jsxs)("button",{onClick:()=>f("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)(oS,{size:12})," Approve"]}),(0,W.jsxs)("button",{onClick:()=>f("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)(lv.X,{size:12})," Reject"]})]})]})]}),(0,W.jsx)("div",{className:"flex-1 overflow-y-auto p-4",children:i?(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 quarantine items..."})}):0===m.length?(0,W.jsxs)("div",{className:"flex flex-col items-center justify-center h-32 text-slate-500",children:[(0,W.jsx)(oG,{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:m.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 ${d.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:()=>v(e.id),className:"mt-0.5 text-slate-500 hover:text-cyan-400 transition-colors shrink-0",children:d.has(e.id)?(0,W.jsx)(c5,{size:14,className:"text-cyan-400"}):(0,W.jsx)(c4,{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 max-h-24 overflow-y-auto whitespace-pre-wrap",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:()=>u({action:"approve",item:e}),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)(oS,{size:12})," Approve"]}),(0,W.jsxs)("button",{onClick:()=>u({action:"reject",item:e}),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)(lv.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 c7=(0,oN.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"}]]),c9=(0,oN.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 ue=e.i(22934);let ut=Y.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";async function ur(e,t){let r=new URLSearchParams({timeRange:e});t&&r.set("project",t);let n=await (0,sa.authFetch)(`${ut}/api/v1/agents?${r}`);if(!n.ok)throw Error("Failed to fetch agent registry");return n.json()}async function un(e,t,r){let n=encodeURIComponent(e),i=new URLSearchParams({timeRange:t});r&&i.set("project",r);let a=await (0,sa.authFetch)(`${ut}/api/v1/agents/${n}/timeline?${i}`);if(!a.ok)throw Error("Failed to fetch agent timeline");return a.json()}async function ui(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)(`${ut}/api/v1/agents/${r}/operations?${n}`);if(!i.ok)throw Error("Failed to fetch agent operations");return i.json()}function ua(e,t){return(0,si.useQuery)({queryKey:["agent-operations",e,t],queryFn:()=>ui(e,t),enabled:!!e,refetchInterval:3e4,retry:2})}function us(e){return e>=.7?"full":e>=.5?"limited":"restricted"}let uo={full:"text-green-400",limited:"text-yellow-400",restricted:"text-red-400"},ul={full:"bg-green-500/10",limited:"bg-yellow-500/10",restricted:"bg-red-500/10"},uc={full:"Full Access",limited:"Limited",restricted:"Restricted"},uu=460,ud=90;function uh({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:()=>un(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:o}=(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*uu,s=e=>10+(1-e)*ud,o=i.map((t,r)=>{let n=a(e[r]),i=s(t.trust_score);return`${0===r?"M":"L"} ${n} ${i}`}),l=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),u=[];for(let e=0;e<c;e++){let i=r+n*e/(c-1||1),s=new Date(i);u.push({x:a(i),label:"24h"===t?s.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):s.toLocaleDateString([],{month:"short",day:"numeric"})})}return{linePath:o.join(" "),dots:l,xLabels:u}},[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)*ud,x2:30+uu,y2:10+(1-.7)*ud,stroke:"#22c55e",strokeWidth:"0.5",strokeDasharray:"4 2",opacity:"0.3"}),(0,W.jsx)("line",{x1:30,y1:10+.5*ud,x2:30+uu,y2:10+.5*ud,stroke:"#eab308",strokeWidth:"0.5",strokeDasharray:"4 2",opacity:"0.3"}),(0,W.jsx)("text",{x:26,y:10+(1-.7)*ud+3,fill:"#64748b",fontSize:"8",textAnchor:"end",children:"0.7"}),(0,W.jsx)("text",{x:26,y:10+.5*ud+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+ud+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)),o.map((e,t)=>(0,W.jsx)("text",{x:e.x,y:116,fill:"#64748b",fontSize:"8",textAnchor:"middle",children:e.label},t))]})}let up={BLOCK:"text-red-400 bg-red-500/10",QUARANTINE:"text-yellow-400 bg-yellow-500/10"};function uf({identifier:e}){let{data:t,isLoading:r}=ua(e,{firewallResult:"BLOCK",limit:20}),{data:n}=ua(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 ${up[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 um=(0,oN.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"}]]),ux=Y.default.env.NEXT_PUBLIC_WS_URL||"ws://localhost:3001/ws/events";function uy({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(ux);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)(um,{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 ug({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)(ue.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 uv({score:e}){let t=us(e);return(0,W.jsxs)("span",{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-medium ${uo[t]} ${ul[t]}`,children:[e.toFixed(2)," · ",uc[t]]})}function ub({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 uj(){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"),[o,l]=(0,H.useState)(!1),[c,u]=(0,H.useState)(null),[d,h]=(0,H.useState)(null),[p,f]=(0,H.useState)(!1),[m]=(0,H.useState)(()=>Date.now()),{data:x,isLoading:y}=function(e="24h",t){return(0,si.useQuery)({queryKey:["agents",e,t],queryFn:()=>ur(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)),d&&(e=e.filter(e=>us(e.avg_trust_score)===d)),p&&(e=e.filter(e=>e.flagged_count>0)),e},[g,c,d,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?o?r.localeCompare(n):n.localeCompare(r):o?r-n:n-r}),e},[v,a,o]),j=(0,H.useMemo)(()=>[...new Set(g.map(e=>e.source_type))],[g]),w=e=>{a===e?l(!o):(s(e),l(!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)(o1,{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)(c7,{size:12,className:"text-slate-500"}),j.map(e=>(0,W.jsx)("button",{onClick:()=>u(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(d===e?null:e),className:`px-1.5 py-0.5 text-[10px] rounded transition-colors ${d===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:()=>f(!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)(oG,{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)(c9,{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)(c9,{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)(c9,{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)(c9,{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)(ug,{identifier:e.source_identifier,compact:!0}),(0,W.jsx)("div",{className:"mt-0.5",children:(0,W.jsx)(ub,{type:e.source_type})})]}),(0,W.jsx)(uv,{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=m-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)(ug,{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)(ub,{type:n.source_type}),(0,W.jsx)(uv,{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)(uh,{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)(uf,{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)(uy,{agentFilter:n.source_identifier})]})]})})]})}let uw=(0,oN.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"}]]),uN={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 uk({level:e}){let t=uN[e]??uN.low;return(0,W.jsx)("span",{className:`text-[10px] font-medium px-1.5 py-0.5 rounded ${t}`,children:e.toUpperCase()})}function uS({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)(uk,{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 uO(e){let t=e.split(/[/\\]/);return t[t.length-1]||e}function uP({file:e,cloudConnected:t,onTrust:r,onUntrust:n,onRemove:i,onCloudUpsell:a}){let[s,o]=(0,H.useState)(!e.safe),[l,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:()=>o(!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)(uw,{size:16,className:"text-cyan-400 shrink-0"}):e.safe?(0,W.jsx)(lg,{size:16,className:"text-green-400 shrink-0"}):(0,W.jsx)(lM,{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||uO(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)(uk,{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)(li,{size:14,className:"text-slate-500 shrink-0"}):(0,W.jsx)(ue.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)(uw,{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)(oQ,{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)(cl,{size:14})})]})]}),l&&(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||uO(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)(uS,{findings:e.findings})})]})}function uC({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)(uP,{file:e,cloudConnected:t,onTrust:r,onUntrust:n,onRemove:i,onCloudUpsell:a},e.path))})}let uE=Y.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";function uM(){let[e,t]=(0,H.useState)(null),[r,n]=(0,H.useState)(!1),[i,a]=(0,H.useState)(null),[s,o]=(0,H.useState)(!1),l=async()=>{n(!0),a(null);try{let e=await (0,sa.gatedFetch)(`${uE}/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?o(!0):a(e.message)}finally{n(!1)}};return s?(0,W.jsx)(uA,{}):(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)(o2,{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:l,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)(o3.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)(oG,{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 uA(){return(0,W.jsxs)("div",{className:"space-y-3",children:[(0,W.jsxs)("div",{className:"flex items-center gap-2",children:[(0,W.jsx)(o2,{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"}),cx.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)(oG,{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(cy).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:cg.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 uT(){return(0,W.jsx)("div",{className:"bg-slate-900/50 border border-slate-800 rounded-xl p-4",children:(0,W.jsx)(cd,{feature:"skill_scanner_deep",label:"Deep skill scanning with multi-file analysis and semantic intent detection.",children:(0,W.jsx)(uM,{})})})}let u_=[{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 uD(){let e=lD(),t=(0,oM.useMutation)({mutationFn:l_}),r=(0,oM.useMutation)({mutationFn:lI}),n=(0,oM.useMutation)({mutationFn:lL}),i=(0,oM.useMutation)({mutationFn:lz}),{data:a}=l0(),[s,o]=(0,H.useState)(null),[l,c]=(0,H.useState)(null),[u,d]=(0,H.useState)(!1),[h,p]=(0,H.useState)(""),[f,m]=(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=>o(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)(ly,{size:14,className:"animate-spin"}):(0,W.jsx)(o2,{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)(o8,{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)(uC,{files:s.files,cloudConnected:g,onTrust:e=>{r.mutate(e,{onSuccess:()=>{s&&o({...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&&o({...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);o({...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)(ly,{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)(o2,{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:()=>d(!u),className:"flex items-center gap-1.5 text-xs text-slate-400 hover:text-slate-300 transition-colors",children:[u?(0,W.jsx)(li,{size:14}):(0,W.jsx)(ue.ChevronRight,{size:14}),"Paste & Scan"]}),u&&(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:f,onChange:e=>m(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:u_.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:f||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)(ly,{size:12,className:"animate-spin"}):(0,W.jsx)(o2,{size:12}),"Scan Content"]})]}),l&&(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:l.skillName}),(0,W.jsx)(uk,{level:l.riskLevel}),(0,W.jsxs)("span",{className:"text-[10px] text-slate-500",children:[l.scanDurationMs,"ms"]})]}),(0,W.jsx)("p",{className:"text-xs text-slate-400",children:l.summary}),l.findings.length>0&&(0,W.jsx)(uS,{findings:l.findings})]})]})]}),(0,W.jsx)("div",{className:"mt-4",children:(0,W.jsx)(uT,{})})]})}let uI=(0,oN.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"}]]),uL=(0,oN.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"}]]),uz=(0,oN.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"}]]),uR=(0,oN.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"}]]),uF=(0,oN.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"}]]),u$=Y.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";function uB(){let e,t,r,{data:n,isLoading:i,isLocked:a}={...e=(0,si.useQuery)({queryKey:["custom-patterns"],queryFn:()=>(0,sa.gatedFetch)(`${u$}/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,oE.useQueryClient)(),(0,oM.useMutation)({mutationFn:e=>(0,sa.gatedFetch)(`${u$}/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"]})}})),o=(r=(0,oE.useQueryClient)(),(0,oM.useMutation)({mutationFn:e=>(0,sa.gatedFetch)(`${u$}/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"]})}})),l=(0,oM.useMutation)({mutationFn:({id:e,text:t})=>(0,sa.gatedFetch)(`${u$}/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,u]=(0,H.useState)(!1),[d,h]=(0,H.useState)(null),[p,f]=(0,H.useState)({name:"",category:"custom",severity:"medium",regex:"",description:""}),m=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)(uU,{}):(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)(o5,{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:[m.length,"/50"]})]}),(0,W.jsxs)("button",{onClick:()=>u(!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)(co,{size:12})," Add Pattern"]})]}),c&&(0,W.jsxs)("form",{onSubmit:e=>{e.preventDefault(),s.mutate(p,{onSuccess:()=>{u(!1),f({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=>f(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=>f(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=>f(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=>f(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:()=>u(!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===m.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:m.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(d?.id===e.id?null:{id:e.id,text:""}),className:"text-slate-500 hover:text-cyan-400",title:"Test pattern",children:(0,W.jsx)(uF,{size:12})}),(0,W.jsx)("button",{onClick:()=>o.mutate(e.id),className:"text-slate-500 hover:text-red-400",children:(0,W.jsx)(cl,{size:12})})]}),(0,W.jsx)("code",{className:"text-slate-500 text-[10px] block truncate",children:e.regex}),d?.id===e.id&&(0,W.jsxs)("div",{className:"flex gap-2 mt-1",children:[(0,W.jsx)("input",{value:d.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:()=>l.mutate({id:e.id,text:d.text}),disabled:!d.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"}),l.data&&(0,W.jsxs)("span",{className:"text-[10px] text-slate-400 self-center",children:[l.data.count," matches"]})]})]},e.id))})]})}function uU(){return(0,W.jsxs)("div",{className:"space-y-3",children:[(0,W.jsxs)("div",{className:"flex items-center gap-2",children:[(0,W.jsx)(o5,{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:cf.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 uV(){return(0,W.jsx)("div",{className:"bg-slate-900/50 border border-slate-800 rounded-xl p-4",children:(0,W.jsx)(cd,{feature:"custom_injection_patterns",label:"Define up to 50 custom regex patterns for detecting domain-specific threats.",children:(0,W.jsx)(uB,{})})})}let uq=Y.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";function uK(){let e,t,r,n,{data:i,isLoading:a,isLocked:s}={...e=(0,si.useQuery)({queryKey:["custom-policies"],queryFn:()=>(0,sa.gatedFetch)(`${uq}/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},o=(t=(0,oE.useQueryClient)(),(0,oM.useMutation)({mutationFn:e=>(0,sa.gatedFetch)(`${uq}/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"]})}})),l=(r=(0,oE.useQueryClient)(),(0,oM.useMutation)({mutationFn:e=>(0,sa.gatedFetch)(`${uq}/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,oE.useQueryClient)(),(0,oM.useMutation)({mutationFn:e=>(0,sa.gatedFetch)(`${uq}/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"]})}})),[u,d]=(0,H.useState)(!1),[h,p]=(0,H.useState)({name:"",description:""}),f=i?.policies??[];return s?(0,W.jsx)(uW,{}):(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)(oQ,{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:[f.length,"/10"]})]}),(0,W.jsxs)("button",{onClick:()=>d(!u),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)(co,{size:12})," Create Policy"]})]}),u&&(0,W.jsxs)("form",{onSubmit:e=>{e.preventDefault(),o.mutate({name:h.name,description:h.description,config:{}},{onSuccess:()=>{d(!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:o.isPending,className:"px-3 py-1 text-xs bg-red-600 text-white rounded hover:bg-red-500 disabled:opacity-50",children:o.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"})]}),o.error&&(0,W.jsx)("p",{className:"text-xs text-red-400",children:o.error.message})]}),a?(0,W.jsx)("div",{className:"text-xs text-slate-500 py-4 text-center",children:"Loading policies..."}):0===f.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:f.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)(oS,{size:10})," Activate"]}),(0,W.jsx)("button",{onClick:()=>l.mutate(e.id),className:"text-slate-500 hover:text-red-400",children:(0,W.jsx)(cl,{size:12})})]},e.id))})]})}function uW(){return(0,W.jsxs)("div",{className:"space-y-3",children:[(0,W.jsxs)("div",{className:"flex items-center gap-2",children:[(0,W.jsx)(oQ,{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:cm.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 uH(){return(0,W.jsx)("div",{className:"bg-slate-900/50 border border-slate-800 rounded-xl p-4",children:(0,W.jsx)(cd,{feature:"custom_iron_dome_policies",label:"Create custom Iron Dome policies with tailored action gates and trust levels.",children:(0,W.jsx)(uK,{})})})}let uY=[{id:"personal",label:"Personal",description:"Lighter touch for solo use",icon:oQ},{id:"enterprise",label:"Enterprise",description:"Financial & data protection",icon:l8},{id:"school",label:"School",description:"GDPR strict, pupil data guarded",icon:o1},{id:"paranoid",label:"Paranoid",description:"Everything requires approval",icon:oG}],uQ=[{name:"Injection Scanner",description:"40+ patterns across 8 categories",icon:uz},{name:"Instruction Gateway",description:"Trusted channel validation",icon:uI},{name:"Action Gate",description:"Approve / block external actions",icon:l8},{name:"PII Guard",description:"Block sensitive data output",icon:lr},{name:"Kill Switch",description:"Emergency stop phrase",icon:uL},{name:"Sub-Agent Control",description:"Restrict spawned agent operations",icon:o1}],uX={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"},uG={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 uZ(){let e,t,r,{data:n,isLoading:i}=lY(),{data:a}=lQ(50),s=(e=(0,oE.useQueryClient)(),(0,oM.useMutation)({mutationFn:e=>lB(e),onSuccess:()=>{e.invalidateQueries({queryKey:["iron-dome-status"]}),e.invalidateQueries({queryKey:["iron-dome-audit"]})}})),o=(t=(0,oE.useQueryClient)(),(0,oM.useMutation)({mutationFn:lU,onSuccess:()=>{t.invalidateQueries({queryKey:["iron-dome-status"]})}})),l=(0,oM.useMutation)({mutationFn:lV}),c=lX(),u=(r=(0,oE.useQueryClient)(),(0,oM.useMutation)({mutationFn:e=>lK(e),onSuccess:()=>{r.invalidateQueries({queryKey:["control-status"]}),r.invalidateQueries({queryKey:["iron-dome-status"]}),r.invalidateQueries({queryKey:["iron-dome-audit"]})}})),{data:d}=(0,si.useQuery)({queryKey:["control-status"],queryFn:lW,refetchInterval:5e3,retry:2}),[h,p]=(0,H.useState)(""),[f,m]=(0,H.useState)(null),[x,y]=(0,H.useState)(""),g=n?.enabled??!1,v=d?.killSwitchActive??!1,b=d?.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)(o5,{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:()=>{o.mutate()},disabled:o.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:[o.isPending?(0,W.jsx)(ly,{size:12,className:"animate-spin"}):(0,W.jsx)(uL,{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:uY.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:uQ.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)(uR,{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()&&(u.mutate(x.trim()),y(""))},disabled:u.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:[u.isPending?(0,W.jsx)(ly,{size:12,className:"animate-spin"}):(0,W.jsx)(uF,{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)(uR,{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)(ly,{size:12,className:"animate-spin"}):(0,W.jsx)(uR,{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)(uz,{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()&&l.mutate(h,{onSuccess:e=>m(e)})},disabled:l.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:[l.isPending?(0,W.jsx)(ly,{size:12,className:"animate-spin"}):(0,W.jsx)(o5,{size:12}),"Scan"]}),f&&(0,W.jsxs)("div",{className:"mt-3 space-y-2",children:[(0,W.jsxs)("div",{className:"flex items-center gap-2",children:[f.clean?(0,W.jsx)(lg,{size:14,className:"text-green-400"}):(0,W.jsx)(lM,{size:14,className:"text-red-400"}),(0,W.jsx)("span",{className:`text-[10px] font-medium px-2 py-0.5 rounded-full ${uG[f.riskLevel]??"bg-slate-500/20 text-slate-400"}`,children:f.riskLevel}),(0,W.jsx)("span",{className:"text-xs text-slate-400",children:f.summary})]}),f.detections.map((e,t)=>(0,W.jsxs)("div",{className:`border rounded-lg p-3 ${uX[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)(oQ,{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)(uV,{})}),(0,W.jsx)("div",{className:"mt-4",children:(0,W.jsx)(uH,{})})]})}let uJ=Y.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001",u0={architecture:"#3b82f6",error:"#ef4444",pattern:"#8b5cf6",preference:"#f59e0b",learning:"#10b981",context:"#6366f1",todo:"#f97316",note:"#94a3b8",relationship:"#ec4899",custom:"#64748b"},u1={short_term:"STM",long_term:"LTM",episodic:"Episodic"},u2={short_term:"#22d3ee",long_term:"#a78bfa",episodic:"#f472b6"},u5=["architecture","pattern","preference","error","context","learning","todo","note","relationship","custom"],u4=[{label:"All",value:"all"},{label:"STM",value:"short_term"},{label:"LTM",value:"long_term"},{label:"Episodic",value:"episodic"}];function u3(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}function u6({className:e}){let[t,r]=(0,H.useState)([]),[n,i]=(0,H.useState)(!0),[a,s]=(0,H.useState)(null),[o,l]=(0,H.useState)(new Set),[c,u]=(0,H.useState)("all"),[d,h]=(0,H.useState)(""),p=(0,H.useRef)(null),f=(0,H.useRef)(new Map),[m,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)(`${uJ}/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&&(f.current.set(e,t),p.current?.observe(t))},[]),g=(0,H.useMemo)(()=>{let e=t;if(o.size>0&&(e=e.filter(e=>o.has(e.category))),"all"!==c&&(e=e.filter(e=>e.type===c)),d.trim()){let t=d.toLowerCase();e=e.filter(e=>e.title.toLowerCase().includes(t)||e.content.toLowerCase().includes(t))}return e},[t,o,c,d]),v=(0,H.useMemo)(()=>(function(e){let t=new Map;for(let r of e){let e=u3(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=u3(t.toISOString()),n=new Date(t);n.setDate(n.getDate()-1);let i=u3(n.toISOString());if(e===r)return"Today";if(e===i)return"Yesterday";let[a,s,o]=e.split("-").map(Number),l=new Date(a,s-1,o);return l.toLocaleDateString(void 0,{month:"long",day:"numeric",year:l.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:d,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"}),u4.map(e=>(0,W.jsx)("button",{onClick:()=>u(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"}),u5.map(e=>{let t=o.has(e),r=u0[e]??"#64748b";return(0,W.jsx)("button",{onClick:()=>{l(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)}),o.size>0&&(0,W.jsx)("button",{onClick:()=>l(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=u0[e.category]??"#64748b",s=u2[e.type]??"#94a3b8",o=u1[e.type]??e.type,l=m.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:+!!l,transform:l?"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:o}),(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 u8=Symbol.for("immer-nothing"),u7=Symbol.for("immer-draftable"),u9=Symbol.for("immer-state");function de(e){throw Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var dt=Object,dr=dt.getPrototypeOf,dn="constructor",di="prototype",da="configurable",ds="enumerable",dl="writable",dc="value",du=e=>!!e&&!!e[u9];function dd(e){return!!e&&(df(e)||db(e)||!!e[u7]||!!e[dn]?.[u7]||dj(e)||dw(e))}var dh=dt[di][dn].toString(),dp=new WeakMap;function df(e){if(!e||!dN(e))return!1;let t=dr(e);if(null===t||t===dt[di])return!0;let r=dt.hasOwnProperty.call(t,dn)&&t[dn];if(r===Object)return!0;if(!dk(r))return!1;let n=dp.get(r);return void 0===n&&(n=Function.toString.call(r),dp.set(r,n)),n===dh}function dm(e,t,r=!0){0===dx(e)?(r?Reflect.ownKeys(e):dt.keys(e)).forEach(r=>{t(r,e[r],e)}):e.forEach((r,n)=>t(n,r,e))}function dx(e){let t=e[u9];return t?t.type_:db(e)?1:dj(e)?2:3*!!dw(e)}var dy=(e,t,r=dx(e))=>2===r?e.has(t):dt[di].hasOwnProperty.call(e,t),dg=(e,t,r=dx(e))=>2===r?e.get(t):e[t],dv=(e,t,r,n=dx(e))=>{2===n?e.set(t,r):3===n?e.add(r):e[t]=r},db=Array.isArray,dj=e=>e instanceof Map,dw=e=>e instanceof Set,dN=e=>"object"==typeof e,dk=e=>"function"==typeof e,dS=e=>e.modified_?e.copy_:e.base_;function dO(e,t){if(dj(e))return new Map(e);if(dw(e))return new Set(e);if(db(e))return Array[di].slice.call(e);let r=df(e);if(!0!==t&&("class_only"!==t||r)){let t=dr(e);if(null!==t&&r)return{...e};let n=dt.create(t);return dt.assign(n,e)}{let t=dt.getOwnPropertyDescriptors(e);delete t[u9];let r=Reflect.ownKeys(t);for(let n=0;n<r.length;n++){let i=r[n],a=t[i];!1===a[dl]&&(a[dl]=!0,a[da]=!0),(a.get||a.set)&&(t[i]={[da]:!0,[dl]:!0,[ds]:a[ds],[dc]:e[i]})}return dt.create(dr(e),t)}}function dP(e,t=!1){return dE(e)||du(e)||!dd(e)||(dx(e)>1&&dt.defineProperties(e,{set:dC,add:dC,clear:dC,delete:dC}),dt.freeze(e),t&&dm(e,(e,t)=>{dP(t,!0)},!1)),e}var dC={[dc]:function(){de(2)}};function dE(e){return!(null!==e&&dN(e))||dt.isFrozen(e)}var dM="MapSet",dA="Patches",dT="ArrayMethods",d_={};function dD(e){let t=d_[e];return t||de(0,e),t}var dI=e=>!!d_[e];function dL(e,t){t&&(e.patchPlugin_=dD(dA),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function dz(e){dR(e),e.drafts_.forEach(d$),e.drafts_=null}function dR(e){e===f&&(f=e.parent_)}var dF=e=>f={drafts_:[],parent_:f,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:dI(dM)?dD(dM):void 0,arrayMethodsPlugin_:dI(dT)?dD(dT):void 0};function d$(e){let t=e[u9];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function dB(e,t){t.unfinalizedDrafts_=t.drafts_.length;let r=t.drafts_[0];if(void 0!==e&&e!==r){r[u9].modified_&&(dz(t),de(4)),dd(e)&&(e=dU(t,e));let{patchPlugin_:n}=t;n&&n.generateReplacementPatches_(r[u9].base_,e,t)}else e=dU(t,r);return function(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&dP(t,r)}(t,e,!0),dz(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==u8?e:void 0}function dU(e,t){if(dE(t))return t;let r=t[u9];if(!r)return dY(t,e.handledSet_,e);if(!dq(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);dH(r,e)}return r.copy_}function dV(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var dq=(e,t)=>e.scope_===t,dK=[];function dW(e,t,r,n){let i=e.copy_||e.base_,a=e.type_;if(void 0!==n&&dg(i,n,a)===t)return void dv(i,n,r,a);if(!e.draftLocations_){let t=e.draftLocations_=new Map;dm(i,(e,r)=>{if(du(r)){let n=t.get(r)||[];n.push(e),t.set(r,n)}})}for(let n of e.draftLocations_.get(t)??dK)dv(i,n,r,a)}function dH(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)}dV(e)}}function dY(e,t,r){return!r.immer_.autoFreeze_&&r.unfinalizedDrafts_<1||du(e)||t.has(e)||!dd(e)||dE(e)||(t.add(e),dm(e,(n,i)=>{if(du(i)){let t=i[u9];dq(t,r)&&(dv(e,n,dS(t),e.type_),dV(t))}else dd(i)&&dY(i,t,r)})),e}var dQ={get(e,t){let r;if(t===u9)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(!dy(a,t,e.type_)){var s;let r;return s=e,(r=dZ(a,t))?dc in r?r[dc]:r.get?.call(s.draft_):void 0}let o=a[t];if(e.finalized_||!dd(o)||i&&e.operationMethod&&n?.isMutatingArrayMethod(e.operationMethod)&&Number.isInteger(r=+t)&&String(r)===t)return o;if(o===dG(e.base_,t)){d0(e);let r=1===e.type_?+t:t,n=d1(e.scope_,o,e,r);return e.copy_[r]=n}return o},has:(e,t)=>t in(e.copy_||e.base_),ownKeys:e=>Reflect.ownKeys(e.copy_||e.base_),set(e,t,r){let n=dZ(e.copy_||e.base_,t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){let n=dG(e.copy_||e.base_,t),i=n?.[u9];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||dy(e.base_,t,e.type_)))return!0;d0(e),dJ(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(du(r)){let i=r[u9];dq(i,n)&&i.callbacks_.push(function(){d0(e),dW(e,r,dS(i),t)})}else dd(r)&&e.callbacks_.push(function(){let i=e.copy_||e.base_;3===e.type_?i.has(r)&&dY(r,n.handledSet_,n):dg(i,t,e.type_)===r&&n.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&dY(dg(e.copy_,t,e.type_),n.handledSet_,n)})}(e,t,r),!0)},deleteProperty:(e,t)=>(d0(e),void 0!==dG(e.base_,t)||t in e.base_?(e.assigned_.set(t,!1),dJ(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?{[dl]:!0,[da]:1!==e.type_||"length"!==t,[ds]:n[ds],[dc]:r[t]}:n},defineProperty(){de(11)},getPrototypeOf:e=>dr(e.base_),setPrototypeOf(){de(12)}},dX={};for(let e in dQ){let t=dQ[e];dX[e]=function(){let e=arguments;return e[0]=e[0][0],t.apply(this,e)}}function dG(e,t){let r=e[u9];return(r?r.copy_||r.base_:e)[t]}function dZ(e,t){if(!(t in e))return;let r=dr(e);for(;r;){let e=Object.getOwnPropertyDescriptor(r,t);if(e)return e;r=dr(r)}}function dJ(e){!e.modified_&&(e.modified_=!0,e.parent_&&dJ(e.parent_))}function d0(e){e.copy_||(e.assigned_=new Map,e.copy_=dO(e.base_,e.scope_.immer_.useStrictShallowCopy_))}function d1(e,t,r,n){let[i,a]=dj(t)?dD(dM).proxyMap_(t,r):dw(t)?dD(dM).proxySet_(t,r):function(e,t){let r=db(e),n={type_:+!!r,scope_:t?t.scope_:f,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=dQ;r&&(i=[n],a=dX);let{revoke:s,proxy:o}=Proxy.revocable(i,a);return n.draft_=o,n.revoke_=s,[o,n]}(t,r);if((r?.scope_??f).drafts_.push(i),a.callbacks_=r?.callbacks_??[],a.key_=n,r&&void 0!==n)r.callbacks_.push(function(e){if(!a||!dq(a,e))return;e.mapSetPlugin_?.fixSetContents(a);let t=dS(a);dW(r,a.draft_??a,t,n),dH(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 d2(e){return du(e)||de(10,e),function e(t){let r;if(!dd(t)||dE(t))return t;let n=t[u9],i=!0;if(n){if(!n.modified_)return n.base_;n.finalized_=!0,r=dO(t,n.scope_.immer_.useStrictShallowCopy_),i=n.scope_.immer_.shouldUseStrictIteration()}else r=dO(t,!0);return dm(r,(t,n)=>{dv(r,t,e(n))},i),n&&(n.finalized_=!1),r}(e)}dX.deleteProperty=function(e,t){return dX.set.call(this,e,t,void 0)},dX.set=function(e,t,r){return dQ.set.call(this,e[0],t,r,e[0])};var d5=new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(e,t,r)=>{let n;if(dk(e)&&!dk(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(dk(t)||de(6),void 0===r||dk(r)||de(7),dd(e)){let i=dF(this),a=d1(i,e,void 0),s=!0;try{n=t(a),s=!1}finally{s?dz(i):dR(i)}return dL(i,r),dB(n,i)}if(e&&dN(e))de(1,e);else{if(void 0===(n=t(e))&&(n=e),n===u8&&(n=void 0),this.autoFreeze_&&dP(n,!0),r){let t=[],i=[];dD(dA).generateReplacementPatches_(e,n,{patches_:t,inversePatches_:i}),r(t,i)}return n}},this.produceWithPatches=(e,t)=>{let r,n;return dk(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){dd(e)||de(8),du(e)&&(e=d2(e));let t=dF(this),r=d1(t,e,void 0);return r[u9].isManual_=!0,dR(t),r}finishDraft(e,t){let r=e&&e[u9];r&&r.isManual_||de(9);let{scope_:n}=r;return dL(n,t),dB(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=dD(dA).applyPatches_;return du(e)?n(e,t):this.produce(e,e=>n(e,t))}}().produce,d4=e=>Array.isArray(e)?e:[e],d3=0,d6=class{revision=d3;_value;_lastValue;_isEqual=d8;constructor(e,t=d8){this._value=this._lastValue=e,this._isEqual=t}get value(){return this._value}set value(e){this.value!==e&&(this._value=e,this.revision=++d3)}};function d8(e,t){return e===t}function d7(e){return e instanceof d6||console.warn("Not a valid cell! ",e),e.value}var d9=(e,t)=>!1;function he(){return function(e,t=d8){return new d6(null,t)}(0,d9)}var ht=e=>{let t=e.collectionTag;null===t&&(t=e.collectionTag=he()),d7(t)};Symbol();var hr=0,hn=Object.getPrototypeOf({}),hi=class{constructor(e){this.value=e,this.value=e,this.tag.value=e}proxy=new Proxy(this,ha);tag=he();tags={};children={};collectionTag=null;id=hr++},ha={get:(e,t)=>(function(){let{value:r}=e,n=Reflect.get(r,t);if("symbol"==typeof t||t in hn)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 hs(i):new hi(i)),r.tag&&d7(r.tag),r.proxy}{let r=e.tags[t];return void 0===r&&((r=e.tags[t]=he()).value=n),d7(r),n}})(),ownKeys:e=>(ht(e),Reflect.ownKeys(e.value)),getOwnPropertyDescriptor:(e,t)=>Reflect.getOwnPropertyDescriptor(e.value,t),has:(e,t)=>Reflect.has(e.value,t)},hs=class{constructor(e){this.value=e,this.value=e,this.tag.value=e}proxy=new Proxy([this],ho);tag=he();tags={};children={};collectionTag=null;id=hr++},ho={get:([e],t)=>("length"===t&&ht(e),ha.get(e,t)),ownKeys:([e])=>ha.ownKeys(e),getOwnPropertyDescriptor:([e],t)=>ha.getOwnPropertyDescriptor(e,t),has:([e],t)=>ha.has(e,t)},hl="u">typeof WeakRef?WeakRef:class{constructor(e){this.value=e}deref(){return this.value}};function hc(){return{s:0,v:void 0,o:null,p:null}}function hu(e,t={}){let r,n=hc(),{resultEqualityCheck:i}=t,a=0;function s(){let t,s=n,{length:o}=arguments;for(let e=0;e<o;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=hc(),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=hc(),e.set(t,s)):s=r}}let l=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 hl(t):t}return l.s=1,l.v=t,t}return s.clearCache=()=>{n=hc(),s.resetResultsCount()},s.resultsCount=()=>a,s.resetResultsCount=()=>{a=0},s}var hd=function(e,...t){let r="function"==typeof e?{memoize:e,memoizeOptions:t}:e,n=(...e)=>{let t,n,i=0,a=0,s={},o=e.pop();"object"==typeof o&&(s=o,o=e.pop()),function(e,t=`expected a function, instead received ${typeof e}`){if("function"!=typeof e)throw TypeError(t)}(o,`createSelector expects an output function after the inputs, but received: [${typeof o}]`);let{memoize:l,memoizeOptions:c=[],argsMemoize:u=hu,argsMemoizeOptions:d=[],devModeChecks:h={}}={...r,...s},p=d4(c),f=d4(d),m=(!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=l(function(){return i++,o.apply(null,arguments)},...p);return Object.assign(u(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}(m,arguments);return n=x.apply(null,e)},...f),{resultFunc:o,memoizedResultFunc:x,dependencies:m,dependencyRecomputations:()=>a,resetDependencyRecomputations:()=>{a=0},lastResult:()=>n,recomputations:()=>i,resetRecomputations:()=>{i=0},memoize:l,argsMemoize:u})};return Object.assign(n,{withTypes:()=>n}),n}(hu),hh=Object.assign((e,t=hd)=>{!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:()=>hh});function hp(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 hf="function"==typeof Symbol&&Symbol.observable||"@@observable",hm=()=>Math.random().toString(36).substring(7).split("").join("."),hx={INIT:`@@redux/INIT${hm()}`,REPLACE:`@@redux/REPLACE${hm()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${hm()}`};function hy(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 hg(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:hx.INIT}))throw Error(hp(12));if(void 0===t(void 0,{type:hx.PROBE_UNKNOWN_ACTION()}))throw Error(hp(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 o=i[t],l=n[o],c=e[o],u=l(c,r);if(void 0===u)throw r&&r.type,Error(hp(14));s[o]=u,a=a||u!==c}return(a=a||i.length!==Object.keys(e).length)?s:e}}function hv(...e){return 0===e.length?e=>e:1===e.length?e[0]:e.reduce((e,t)=>(...r)=>e(t(...r)))}function hb(e){return hy(e)&&"type"in e&&"string"==typeof e.type}function hj(e){return({dispatch:t,getState:r})=>n=>i=>"function"==typeof i?i(t,r,e):n(i)}var hw=hj(),hN="u">typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!=arguments.length)return"object"==typeof arguments[0]?hv:hv.apply(null,arguments)};function hk(e,t){function r(...n){if(t){let r=t(...n);if(!r)throw Error(pn(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=>hb(t)&&t.type===e,r}"u">typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var hS=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 hO(e){return dd(e)?d5(e,()=>{}):e}function hP(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}var hC="RTK_autoBatch",hE=()=>e=>({payload:e,meta:{[hC]:!0}}),hM=e=>t=>{setTimeout(t,e)},hA=(e={type:"raf"})=>t=>(...r)=>{let n=t(...r),i=!0,a=!1,s=!1,o=new Set,l="tick"===e.type?queueMicrotask:"raf"===e.type?"u">typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:hM(10):"callback"===e.type?e.queueNotification:hM(e.timeout),c=()=>{s=!1,a&&(a=!1,o.forEach(e=>e()))};return Object.assign({},n,{subscribe(e){let t=n.subscribe(()=>i&&e());return o.add(e),()=>{t(),o.delete(e)}},dispatch(e){try{return(a=!(i=!e?.meta?.[hC]))&&!s&&(s=!0,l(c)),n.dispatch(e)}finally{i=!0}}})};function hT(e){let t,r={},n=[],i={addCase(e,t){let n="string"==typeof e?e:e.type;if(!n)throw Error(pn(28));if(n in r)throw Error(pn(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 h_=Symbol.for("rtk-slice-createasyncthunk"),hD=((d=hD||{}).reducer="reducer",d.reducerWithPrepare="reducerWithPrepare",d.asyncThunk="asyncThunk",d),hI=function({creators:e}={}){let t=e?.asyncThunk?.[h_];return function(e){let r,{name:n,reducerPath:i=n}=e;if(!n)throw Error(pn(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),o={},l={},c={},u=[],d={addCase(e,t){let r="string"==typeof e?e:e.type;if(!r)throw Error(pn(12));if(r in l)throw Error(pn(13));return l[r]=t,d},addMatcher:(e,t)=>(u.push({matcher:e,reducer:t}),d),exposeAction:(e,t)=>(c[e]=t,d),exposeCaseReducer:(e,t)=>(o[e]=t,d)};function h(){let[t={},r=[],n]="function"==typeof e.extraReducers?hT(e.extraReducers):[e.extraReducers],i={...t,...l};return function(e,t){let r,[n,i,a]=hT(t);if("function"==typeof e)r=()=>hO(e());else{let t=hO(e);r=()=>t}function s(e=r(),t){let o=[n[t.type],...i.filter(({matcher:e})=>e(t)).map(({reducer:e})=>e)];return 0===o.filter(e=>!!e).length&&(o=[a]),o.reduce((e,r)=>{if(r)if(du(e)){let n=r(e,t);return void 0===n?e:n}else{if(dd(e))return d5(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 u)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(pn(18));let{payloadCreator:a,fulfilled:s,pending:o,rejected:l,settled:c,options:u}=r,d=i(e,a,u);n.exposeAction(t,d),s&&n.addCase(d.fulfilled,s),o&&n.addCase(d.pending,o),l&&n.addCase(d.rejected,l),c&&n.addMatcher(d.settled,c),n.exposeCaseReducer(t,{fulfilled:s||hL,pending:o||hL,rejected:l||hL,settled:c||hL})}(s,i,d,t):function({type:e,reducerName:t,createNotation:r},n,i){let a,s;if("reducer"in n){if(r&&"reducerWithPrepare"!==n._reducerDefinitionType)throw Error(pn(17));a=n.reducer,s=n.prepare}else a=n;i.addCase(e,a).exposeCaseReducer(t,a).exposeAction(t,s?hk(e,s):hk(e))}(s,i,d)});let p=e=>e,f=new Map,m=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=hP(m,n,y)),i}function i(t=p){let n=hP(f,r,()=>new WeakMap);return hP(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 o=t(a);return void 0===o&&n&&(o=r()),e(o,...s)}return i.unwrapped=e,i}(a,t,()=>hP(m,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:o,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 hL(){}var hz="listener",hR="completed",hF="cancelled",h$=`task-${hF}`,hB=`task-${hR}`,hU=`${hz}-${hF}`,hV=`${hz}-${hR}`,hq=class{constructor(e){this.code=e,this.message=`task ${hF} (reason: ${e})`}name="TaskAbortError";message},hK=(e,t)=>{if("function"!=typeof e)throw TypeError(pn(32))},hW=()=>{},hH=(e,t=hW)=>(e.catch(t),e),hY=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),hQ=e=>{if(e.aborted)throw new hq(e.reason)};function hX(e,t){let r=hW;return new Promise((n,i)=>{let a=()=>i(new hq(e.reason));e.aborted?a():(r=hY(e,a),t.finally(()=>r()).then(n,i))}).finally(()=>{r=hW})}var hG=async(e,t)=>{try{await Promise.resolve();let t=await e();return{status:"ok",value:t}}catch(e){return{status:e instanceof hq?"cancelled":"rejected",error:e}}finally{t?.()}},hZ=e=>t=>hH(hX(e,t).then(t=>(hQ(e),t))),hJ=e=>{let t=hZ(e);return e=>t(new Promise(t=>setTimeout(t,e)))},{assign:h0}=Object,h1={},h2="listenerMiddleware",h5=e=>{let{type:t,actionCreator:r,matcher:n,predicate:i,effect:a}=e;if(t)i=hk(t).match;else if(r)t=r.type,i=r.match;else if(n)i=n;else if(i);else throw Error(pn(21));return hK(a,"options.listener"),{predicate:i,type:t,effect:a}},h4=h0(e=>{let{type:t,predicate:r,effect:n}=h5(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(pn(22))}}},{withTypes:()=>h4}),h3=(e,t)=>{let{type:r,effect:n,predicate:i}=h5(t);return Array.from(e.values()).find(e=>("string"==typeof r?e.type===r:e.predicate===i)&&e.effect===n)},h6=e=>{e.pending.forEach(e=>{e.abort(hU)})},h8=(e,t,r)=>{try{e(t,r)}catch(e){setTimeout(()=>{throw e},0)}},h7=h0(hk(`${h2}/add`),{withTypes:()=>h7}),h9=hk(`${h2}/removeAll`),pe=h0(hk(`${h2}/remove`),{withTypes:()=>pe}),pt=(...e)=>{console.error(`${h2}/error`,...e)},pr=(e={})=>{let t=new Map,r=new Map,{extra:n,onError:i=pt}=e;hK(i,"onError");let a=e=>{var r;return(r=h3(t,e)??h4(e)).unsubscribe=()=>t.delete(r.id),t.set(r.id,r),e=>{r.unsubscribe(),e?.cancelActive&&h6(r)}};h0(a,{withTypes:()=>a});let s=e=>{let r=h3(t,e);return r&&(r.unsubscribe(),e.cancelActive&&h6(r)),!!r};h0(s,{withTypes:()=>s});let o=async(e,s,o,l)=>{var c,u;let d,h=new AbortController,p=(c=h.signal,d=async(e,t)=>{hQ(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 hX(c,Promise.race(n));return hQ(c),e}finally{r()}},(e,t)=>hH(d(e,t))),f=[];try{let i;e.pending.add(h),i=r.get(e)??0,r.set(e,i+1),await Promise.resolve(e.effect(s,h0({},o,{getOriginalState:l,condition:(e,t)=>p(e,t).then(Boolean),take:p,delay:hJ(h.signal),pause:hZ(h.signal),extra:n,signal:h.signal,fork:(u=h.signal,(e,t)=>{hK(e,"taskExecutor");let r=new AbortController;hY(u,()=>r.abort(u.reason));let n=hG(async()=>{hQ(u),hQ(r.signal);let t=await e({pause:hZ(r.signal),delay:hJ(r.signal),signal:r.signal});return hQ(r.signal),t},()=>r.abort(hB));return t?.autoJoin&&f.push(n.catch(hW)),{result:hZ(u)(n),cancel(){r.abort(h$)}}}),unsubscribe:e.unsubscribe,subscribe:()=>{t.set(e.id,e)},cancelActiveListeners:()=>{e.pending.forEach((e,t,r)=>{e!==h&&(e.abort(hU),r.delete(e))})},cancel:()=>{h.abort(hU),e.pending.delete(h)},throwIfCancelled:()=>{hQ(h.signal)}})))}catch(e){e instanceof hq||h8(i,e,{raisedBy:"effect"})}finally{let t;await Promise.all(f),h.abort(hV),1===(t=r.get(e)??1)?r.delete(e):r.set(e,t-1),e.pending.delete(h)}},l=()=>{for(let e of r.keys())h6(e);t.clear()};return{middleware:e=>r=>n=>{let c;if(!hb(n))return r(n);if(h7.match(n))return a(n.payload);if(h9.match(n))return void l();if(pe.match(n))return s(n.payload);let u=e.getState(),d=()=>{if(u===h1)throw Error(pn(23));return u};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,u)}catch(e){t=!1,h8(i,e,{raisedBy:"predicate"})}t&&o(a,n,e,d)}}}finally{u=h1}return c},startListening:a,stopListening:s,clearListeners:l}};function pn(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 pi=e.i(78712);function pa(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 ps(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+pa(i)+t:e+t},"")}var po=e=>0===e?0:e>0?1:-1,pl=e=>"number"==typeof e&&e!=+e,pc=e=>"string"==typeof e&&e.indexOf("%")===e.length-1,pu=e=>("number"==typeof e||e instanceof Number)&&!pl(e),pd=e=>pu(e)||"string"==typeof e,ph=0,pp=e=>{var t=++ph;return"".concat(e||"").concat(t)},pf=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(!pu(e)&&"string"!=typeof e)return n;if(pc(e)){if(null==t)return n;var a=e.indexOf("%");r=t*parseFloat(e.slice(0,a))/100}else r=+e;return pl(r)&&(r=n),i&&null!=t&&r>t&&(r=t),r},pm=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 px(e,t,r){return pu(e)&&pu(t)?pa(e+r*(t-e)):t}var py=e=>null==e?e:"".concat(e.charAt(0).toUpperCase()).concat(e.slice(1));function pg(e){return null!=e}function pv(){}var pb=(e,t)=>{if(t&&Array.isArray(e)){var r=Number.parseInt(t,10);if(!pl(r))return e[r]}},pj=hI({name:"options",initialState:{chartName:"",tooltipPayloadSearcher:()=>void 0,eventEmitter:void 0,defaultTooltipEventType:"axis"},reducers:{createEventEmitter:e=>{null==e.eventEmitter&&(e.eventEmitter=Symbol("rechartsEventEmitter"))}}}),pw=pj.reducer,{createEventEmitter:pN}=pj.actions,pk=(e.i(8710),{notify(){},get:()=>[]}),pS="u">typeof window&&void 0!==window.document&&void 0!==window.document.createElement,pO="u">typeof navigator&&"ReactNative"===navigator.product,pP=pS||pO?H.useLayoutEffect:H.useEffect;function pC(e,t){return e===t?0!==e||0!==t||1/e==1/t:e!=e&&t!=t}var pE=Symbol.for("react-redux-context"),pM="u">typeof globalThis?globalThis:{},pA=function(){if(!H.createContext)return{};let e=pM[pE]??=new Map,t=e.get(H.createContext);return t||(t=H.createContext(null),e.set(H.createContext,t)),t}(),pT=function(e){let{children:t,context:r,serverState:n,store:i}=e,a=H.useMemo(()=>{let e=function(e,t){let r,n=pk,i=0,a=!1;function s(){c.onStateChange&&c.onStateChange()}function o(){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 l(){i--,r&&0===i&&(r(),r=void 0,n.clear(),n=pk)}let c={addNestedSub:function(e){o();let t=n.subscribe(e),r=!1;return()=>{r||(r=!0,t(),l())}},notifyNestedSubs:function(){n.notify()},handleChangeWrapper:s,isSubscribed:function(){return a},trySubscribe:function(){a||(a=!0,o())},tryUnsubscribe:function(){a&&(a=!1,l())},getListeners:()=>n};return c}(i);return{store:i,subscription:e,getServerState:n?()=>n:void 0}},[i,n]),s=H.useMemo(()=>i.getState(),[i]);return pP(()=>{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||pA).Provider,{value:a},t)};function p_(e=pA){return function(){return H.useContext(e)}}var pD=p_(),pI=Symbol.for("immer-nothing"),pL=Symbol.for("immer-draftable"),pz=Symbol.for("immer-state");function pR(e){throw Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var pF=Object.getPrototypeOf;function p$(e){return!!e&&!!e[pz]}function pB(e){return!!e&&(pq(e)||Array.isArray(e)||!!e[pL]||!!e.constructor?.[pL]||pQ(e)||pX(e))}var pU=Object.prototype.constructor.toString(),pV=new WeakMap;function pq(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=pV.get(r);return void 0===n&&(n=Function.toString.call(r),pV.set(r,n)),n===pU}function pK(e,t,r=!0){0===pW(e)?(r?Reflect.ownKeys(e):Object.keys(e)).forEach(r=>{t(r,e[r],e)}):e.forEach((r,n)=>t(n,r,e))}function pW(e){let t=e[pz];return t?t.type_:Array.isArray(e)?1:pQ(e)?2:3*!!pX(e)}function pH(e,t){return 2===pW(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function pY(e,t,r){let n=pW(e);2===n?e.set(t,r):3===n?e.add(r):e[t]=r}function pQ(e){return e instanceof Map}function pX(e){return e instanceof Set}function pG(e){return e.copy_||e.base_}function pZ(e,t){if(pQ(e))return new Map(e);if(pX(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);let r=pq(e);if(!0!==t&&("class_only"!==t||r)){let t=pF(e);return null!==t&&r?{...e}:Object.assign(Object.create(t),e)}{let t=Object.getOwnPropertyDescriptors(e);delete t[pz];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(pF(e),t)}}function pJ(e,t=!1){return p1(e)||p$(e)||!pB(e)||(pW(e)>1&&Object.defineProperties(e,{set:p0,add:p0,clear:p0,delete:p0}),Object.freeze(e),t&&Object.values(e).forEach(e=>pJ(e,!0))),e}var p0={value:function(){pR(2)}};function p1(e){return null===e||"object"!=typeof e||Object.isFrozen(e)}var p2={};function p5(e){let t=p2[e];return t||pR(0,e),t}function p4(e,t){t&&(p5("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function p3(e){p6(e),e.drafts_.forEach(p7),e.drafts_=null}function p6(e){e===m&&(m=e.parent_)}function p8(e){return m={drafts_:[],parent_:m,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function p7(e){let t=e[pz];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function p9(e,t){t.unfinalizedDrafts_=t.drafts_.length;let r=t.drafts_[0];return void 0!==e&&e!==r?(r[pz].modified_&&(p3(t),pR(4)),pB(e)&&(e=fe(t,e),t.parent_||fr(t,e)),t.patches_&&p5("Patches").generateReplacementPatches_(r[pz].base_,e,t.patches_,t.inversePatches_)):e=fe(t,r,[]),p3(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==pI?e:void 0}function fe(e,t,r){if(p1(t))return t;let n=e.immer_.shouldUseStrictIteration(),i=t[pz];if(!i)return pK(t,(n,a)=>ft(e,i,t,n,a,r),n),t;if(i.scope_!==e)return t;if(!i.modified_)return fr(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),pK(a,(n,a)=>ft(e,i,t,n,a,r,s),n),fr(e,t,!1),r&&e.patches_&&p5("Patches").generatePatches_(i,r,e.patches_,e.inversePatches_)}return i.copy_}function ft(e,t,r,n,i,a,s){if(null==i||"object"!=typeof i&&!s)return;let o=p1(i);if(!o||s){if(p$(i)){let s=fe(e,i,a&&t&&3!==t.type_&&!pH(t.assigned_,n)?a.concat(n):void 0);if(pY(r,n,s),!p$(s))return;e.canAutoFreeze_=!1}else s&&r.add(i);if(pB(i)&&!o){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1||t&&t.base_&&t.base_[n]===i&&o)return;fe(e,i),(!t||!t.scope_.parent_)&&"symbol"!=typeof n&&(pQ(r)?r.has(n):Object.prototype.propertyIsEnumerable.call(r,n))&&fr(e,i)}}}function fr(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&pJ(t,r)}var fn={get(e,t){if(t===pz)return e;let r=pG(e);if(!pH(r,t)){var n;let i;return n=e,(i=fs(r,t))?"value"in i?i.value:i.get?.call(n.draft_):void 0}let i=r[t];return e.finalized_||!pB(i)?i:i===fa(e.base_,t)?(fl(e),e.copy_[t]=fu(i,e)):i},has:(e,t)=>t in pG(e),ownKeys:e=>Reflect.ownKeys(pG(e)),set(e,t,r){let n=fs(pG(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){let n=fa(pG(e),t),i=n?.[pz];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||pH(e.base_,t)))return!0;fl(e),fo(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!==fa(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,fl(e),fo(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){let r=pG(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:n.enumerable,value:r[t]}:n},defineProperty(){pR(11)},getPrototypeOf:e=>pF(e.base_),setPrototypeOf(){pR(12)}},fi={};function fa(e,t){let r=e[pz];return(r?pG(r):e)[t]}function fs(e,t){if(!(t in e))return;let r=pF(e);for(;r;){let e=Object.getOwnPropertyDescriptor(r,t);if(e)return e;r=pF(r)}}function fo(e){!e.modified_&&(e.modified_=!0,e.parent_&&fo(e.parent_))}function fl(e){e.copy_||(e.copy_=pZ(e.base_,e.scope_.immer_.useStrictShallowCopy_))}pK(fn,(e,t)=>{fi[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}}),fi.deleteProperty=function(e,t){return fi.set.call(this,e,t,void 0)},fi.set=function(e,t,r){return fn.set.call(this,e[0],t,r,e[0])};var fc=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&&pR(6),void 0!==r&&"function"!=typeof r&&pR(7),pB(e)){let i=p8(this),a=fu(e,void 0),s=!0;try{n=t(a),s=!1}finally{s?p3(i):p6(i)}return p4(i,r),p9(n,i)}if(e&&"object"==typeof e)pR(1,e);else{if(void 0===(n=t(e))&&(n=e),n===pI&&(n=void 0),this.autoFreeze_&&pJ(n,!0),r){let t=[],i=[];p5("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;pB(e)||pR(8),p$(e)&&(p$(t=e)||pR(10,t),e=function e(t){let r;if(!pB(t)||p1(t))return t;let n=t[pz],i=!0;if(n){if(!n.modified_)return n.base_;n.finalized_=!0,r=pZ(t,n.scope_.immer_.useStrictShallowCopy_),i=n.scope_.immer_.shouldUseStrictIteration()}else r=pZ(t,!0);return pK(r,(t,n)=>{pY(r,t,e(n))},i),n&&(n.finalized_=!1),r}(t));let r=p8(this),n=fu(e,void 0);return n[pz].isManual_=!0,p6(r),n}finishDraft(e,t){let r=e&&e[pz];r&&r.isManual_||pR(9);let{scope_:n}=r;return p4(n,t),p9(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=p5("Patches").applyPatches_;return p$(e)?n(e,t):this.produce(e,e=>n(e,t))}};function fu(e,t){let r=pQ(e)?p5("MapSet").proxyMap_(e,t):pX(e)?p5("MapSet").proxySet_(e,t):function(e,t){let r=Array.isArray(e),n={type_:+!!r,scope_:t?t.scope_:m,modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1},i=n,a=fn;r&&(i=[n],a=fi);let{revoke:s,proxy:o}=Proxy.revocable(i,a);return n.draft_=o,n.revoke_=s,o}(e,t);return(t?t.scope_:m).drafts_.push(r),r}new fc().produce;var fd={active:!1,index:null,dataKey:void 0,graphicalItemId:void 0,coordinate:void 0},fh=hI({name:"tooltip",initialState:{itemInteraction:{click:fd,hover:fd},axisInteraction:{click:fd,hover:fd},keyboardInteraction:fd,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:hE()},replaceTooltipEntrySettings:{reducer(e,t){var{prev:r,next:n}=t.payload,i=d2(e).tooltipItemPayloads.indexOf(r);i>-1&&(e.tooltipItemPayloads[i]=n)},prepare:hE()},removeTooltipEntrySettings:{reducer(e,t){var r=d2(e).tooltipItemPayloads.indexOf(t.payload);r>-1&&e.tooltipItemPayloads.splice(r,1)},prepare:hE()},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:fp,replaceTooltipEntrySettings:ff,removeTooltipEntrySettings:fm,setTooltipSettingsState:fx,setActiveMouseOverItemIndex:fy,mouseLeaveItem:fg,mouseLeaveChart:fv,setActiveClickItemIndex:fb,setMouseOverAxisIndex:fj,setMouseClickAxisIndex:fw,setSyncInteraction:fN,setKeyboardInteraction:fk}=fh.actions,fS=fh.reducer,fO=hI({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:fP,setDataStartEndIndexes:fC,setComputedData:fE}=fO.actions,fM=fO.reducer,fA=hI({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:fT,setLayout:f_,setChartSize:fD,setScale:fI}=fA.actions,fL=fA.reducer,fz=e.i(27688),fR=(0,H.createContext)(null),fF=e=>e,f$=()=>{var e=(0,H.useContext)(fR);return e?e.store.dispatch:fF},fB=()=>{},fU=()=>fB,fV=(e,t)=>e===t;function fq(e){var t=(0,H.useContext)(fR),r=(0,H.useMemo)(()=>t?t=>{if(null!=t)return e(t)}:fB,[t,e]);return(0,fz.useSyncExternalStoreWithSelector)(t?t.subscription.addNestedSub:fU,t?t.store.getState:fB,t?t.store.getState:fB,r,fV)}var fK=e.i(28914),fW=e=>e.legend.settings;function fH(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}function fY(e){return function(){return e}}function fQ(e,t){if((i=e.length)>1)for(var r,n,i,a=1,s=e[t[0]],o=s.length;a<i;++a)for(n=s,s=e[t[a]],r=0;r<o;++r)s[r][1]+=s[r][0]=isNaN(n[r][1])?n[r][0]:n[r][1]}function fX(e){for(var t=e.length,r=Array(t);--t>=0;)r[t]=t;return r}function fG(e,t){return e[t]}function fZ(e){let t=[];return t.key=e,t}function fJ(e,t,r){return Array.isArray(e)&&e&&t+r!==0?e.slice(t,r+1):e}function f0(e){return Number.isFinite(e)}function f1(e){return"number"==typeof e&&e>0&&Number.isFinite(e)}function f2(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 f5(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?f2(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)):f2(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function f4(e,t,r){return null==e||null==t?r:pd(t)?(0,pi.default)(e,t,r):"function"==typeof t?t(e):r}hd([e=>e.legend.payload,fW],(e,t)=>{var{itemSorter:r}=t,n=e.flat(1);return r?(0,fK.default)(n,r):n}),Array.prototype.slice;var f3=(e,t)=>"horizontal"===e&&"xAxis"===t||"vertical"===e&&"yAxis"===t||"centric"===e&&"angleAxis"===t||"radial"===e&&"radiusAxis"===t,f6={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,o=0;o<r;++o){var l=e[o],c=null==l?void 0:l[i];if(null!=c){var u=c[1],d=c[0],h=pl(u)?d:u;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}fQ(e,t)}},none:fQ,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,o=0;s<r;++s)o+=e[s][n][1]||0;i[n][1]+=i[n][0]=-o/2}fQ(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 o=0,l=0,c=0;o<i;++o){for(var u=e[t[o]],d=u[s][1]||0,h=(d-(u[s-1][1]||0))/2,p=0;p<o;++p){var f=e[t[p]];h+=(f[s][1]||0)-(f[s-1][1]||0)}l+=d,c+=h*d}r[s-1][1]+=r[s-1][0]=a,l&&(a-=c/l)}r[s-1][1]+=r[s-1][0]=a,fQ(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 o=e[s],l=null==o?void 0:o[i];if(null!=l){var c=pl(l[1])?l[0]:l[1];c>=0?(l[0]=a,a+=c,l[1]=a):(l[0]=0,l[1]=0)}}}}},f8=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 o=f4(a,t.dataKey,t.scale.domain()[s]);if(null==o)return null;var l=t.scale.map(o);return pu(l)?l-i/2+n:null},f7=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,f9=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,me=(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,fK.default)(t,e=>e.coordinate),a=1/0,s=1,o=i.length;s<o;s++){var l=i[s],c=i[s-1];a=Math.min(((null==l?void 0:l.coordinate)||0)-((null==c?void 0:c.coordinate)||0),a)}return a===1/0?0:a}return r?void 0:0};function mt(e){var{tooltipEntrySettings:t,dataKey:r,payload:n,value:i,name:a}=e;return f5(f5({},t),{},{dataKey:r,payload:n,value:i,name:a})}function mr(e,t){return e?String(e):"string"==typeof t?t:void 0}var mn=e=>e.layout.width,mi=e=>e.layout.height,ma=e=>e.layout.scale,ms=e=>e.layout.margin,mo=hd(e=>e.cartesianAxis.xAxis,e=>Object.values(e)),ml=hd(e=>e.cartesianAxis.yAxis,e=>Object.values(e));function mc(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 mu(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?mc(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)):mc(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var md=hd([mn,mi,ms,e=>e.brush.height,function(e){return ml(e).reduce((e,t)=>"left"!==t.orientation||t.mirror||t.hide?e:e+("number"==typeof t.width?t.width:60),0)},function(e){return ml(e).reduce((e,t)=>"right"!==t.orientation||t.mirror||t.hide?e:e+("number"==typeof t.width?t.width:60),0)},function(e){return mo(e).reduce((e,t)=>"top"!==t.orientation||t.mirror||t.hide?e:e+t.height,0)},function(e){return mo(e).reduce((e,t)=>"bottom"!==t.orientation||t.mirror||t.hide?e:e+t.height,0)},fW,e=>e.legend.size],(e,t,r,n,i,a,s,o,l,c)=>{var u={left:(r.left||0)+i,right:(r.right||0)+a},d=mu(mu({},{top:(r.top||0)+s,bottom:(r.bottom||0)+o}),u),h=d.bottom;d.bottom+=n;var p=e-(d=((e,t,r)=>{if(t&&r){var{width:n,height:i}=r,{align:a,verticalAlign:s,layout:o}=t;if(("vertical"===o||"horizontal"===o&&"middle"===s)&&"center"!==a&&pu(e[a]))return f5(f5({},e),{},{[a]:e[a]+(n||0)});if(("horizontal"===o||"vertical"===o&&"center"===a)&&"middle"!==s&&pu(e[s]))return f5(f5({},e),{},{[s]:e[s]+(i||0)})}return e})(d,l,c)).left-d.right,f=t-d.top-d.bottom;return mu(mu({brushBottom:h},d),{},{width:Math.max(p,0),height:Math.max(f,0)})}),mh=hd(md,e=>({x:e.left,y:e.top,width:e.width,height:e.height})),mp=hd(mn,mi,(e,t)=>({x:0,y:0,width:e,height:t})),mf=(0,H.createContext)(null),mm=()=>null!=(0,H.useContext)(mf),mx=e=>e.brush,my=hd([mx,md,ms],(e,t,r)=>({height:e.height,x:pu(e.x)?e.x:t.left,y:pu(e.y)?e.y:t.top+t.height+t.brushBottom-((null==r?void 0:r.bottom)||0),width:pu(e.width)?e.width:t.width})),mg=e.i(15325),mv=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++]))}},mb="100%",mj="100%",mw={width:-1,height:-1},mN=(e,t,r)=>{var{width:n=mb,height:i=mj,aspect:a,maxHeight:s}=r,o=pc(n)?e:Number(n),l=pc(i)?t:Number(i);return a&&a>0&&(o?l=o/a:l&&(o=l*a),s&&null!=l&&l>s&&(l=s)),{calculatedWidth:o,calculatedHeight:l}},mk={width:0,height:0,overflow:"visible"},mS={width:0,overflowX:"visible"},mO={height:0,overflowY:"visible"},mP={};function mC(){return(mC=Object.assign.bind()).apply(null,arguments)}function mE(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 mM(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?mE(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)):mE(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var mA=(0,H.createContext)(mw);function mT(e){var{children:t,width:r,height:n}=e,i=(0,H.useMemo)(()=>({width:r,height:n}),[r,n]);return f1(i.width)&&f1(i.height)?H.createElement(mA.Provider,{value:i},t):null}var m_=()=>(0,H.useContext)(mA),mD=(0,H.forwardRef)((e,t)=>{var{aspect:r,initialDimension:n=mw,width:i,height:a,minWidth:s=0,minHeight:o,maxHeight:l,children:c,debounce:u=0,id:d,className:h,onResize:p,style:f={}}=e,m=(0,H.useRef)(null),x=(0,H.useRef)();x.current=p,(0,H.useImperativeHandle)(t,()=>m.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==m.current||"u"<typeof ResizeObserver)return pv;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)}};u>0&&(e=(0,mg.default)(e,u,{trailing:!0,leading:!1}));var t=new ResizeObserver(e),{width:r,height:n}=m.current.getBoundingClientRect();return v(r,n),t.observe(m.current),()=>{t.disconnect()}},[v,u]);var{containerWidth:b,containerHeight:j}=y;mv(!r||r>0,"The aspect(%s) must be greater than zero.",r);var{calculatedWidth:w,calculatedHeight:N}=mN(b,j,{width:i,height:a,aspect:r,maxHeight:l});return mv(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,o,r),H.createElement("div",{id:d?"".concat(d):void 0,className:sl("recharts-responsive-container",h),style:mM(mM({},f),{},{width:i,height:a,minWidth:s,minHeight:o,maxHeight:l}),ref:m},H.createElement("div",{style:(e=>{var{width:t,height:r}=e,n=pc(t),i=pc(r);return n&&i?mk:n?mS:i?mO:mP})({width:i,height:a})},H.createElement(mT,{width:w,height:N},c)))}),mI=(0,H.forwardRef)((e,t)=>{var r=m_();if(f1(r.width)&&f1(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=mb,a=mj):void 0===i?i=n&&n>0?void 0:mb:void 0===a&&(a=n&&n>0?void 0:mj),{width:i,height:a}}({width:e.width,height:e.height,aspect:e.aspect}),{calculatedWidth:a,calculatedHeight:s}=mN(void 0,void 0,{width:n,height:i,aspect:e.aspect,maxHeight:e.maxHeight});return pu(a)&&pu(s)?H.createElement(mT,{width:a,height:s},e.children):H.createElement(mD,mC({},e,{width:n,height:i,ref:t}))});function mL(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 mz=()=>{var e,t=mm(),r=fq(mh),n=fq(my),i=null==(e=fq(mx))?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},mR={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},mF=e=>e.layout.layoutType,m$=()=>{var e=fq(mF);if("horizontal"===e||"vertical"===e)return e},mB=e=>{var t=e.layout.layoutType;if("centric"===t||"radial"===t)return t},mU=e=>{var t=f$(),r=mm(),{width:n,height:i}=e,a=m_(),s=n,o=i;return a&&(s=a.width>0?a.width:n,o=a.height>0?a.height:i),(0,H.useEffect)(()=>{!r&&f1(s)&&f1(o)&&t(fD({width:s,height:o}))},[t,r,s,o]),null},mV=e.i(56558);e.s([],81206),e.i(81206),e.s([],3771),e.i(3771);var mq=e.i(17603),mK=e.i(11276);function mW(){var e,t,r=(0,mK.default)().unknown(void 0),n=r.domain,i=r.range,a=0,s=1,o=!1,l=0,c=0,u=.5;function d(){var r=n().length,d=s<a,h=d?s:a,p=d?a:s;e=(p-h)/Math.max(1,r-l+2*c),o&&(e=Math.floor(e)),h+=(p-h-e*(r-l))*u,t=e*(1-l),o&&(h=Math.round(h),t=Math.round(t));var f=(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(d?f.reverse():f)}return delete r.unknown,r.domain=function(e){return arguments.length?(n(e),d()):n()},r.range=function(e){return arguments.length?([a,s]=e,a*=1,s*=1,d()):[a,s]},r.rangeRound=function(e){return[a,s]=e,a*=1,s*=1,o=!0,d()},r.bandwidth=function(){return t},r.step=function(){return e},r.round=function(e){return arguments.length?(o=!!e,d()):o},r.padding=function(e){return arguments.length?(l=Math.min(1,c=+e),d()):l},r.paddingInner=function(e){return arguments.length?(l=Math.min(1,e),d()):l},r.paddingOuter=function(e){return arguments.length?(c=+e,d()):c},r.align=function(e){return arguments.length?(u=Math.max(0,Math.min(1,e)),d()):u},r.copy=function(){return mW(n(),[a,s]).round(o).paddingInner(l).paddingOuter(c).align(u)},mq.initRange.apply(d(),arguments)}function mH(){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}(mW.apply(null,arguments).paddingInner(1))}let mY=Math.sqrt(50),mQ=Math.sqrt(10),mX=Math.sqrt(2);function mG(e,t,r){let n,i,a,s=(t-e)/Math.max(0,r),o=Math.floor(Math.log10(s)),l=s/Math.pow(10,o),c=l>=mY?10:l>=mQ?5:l>=mX?2:1;return(o<0?(n=Math.round(e*(a=Math.pow(10,-o)/c)),i=Math.round(t*a),n/a<e&&++n,i/a>t&&--i,a=-a):(n=Math.round(e/(a=Math.pow(10,o)*c)),i=Math.round(t/a),n*a<e&&++n,i*a>t&&--i),i<n&&.5<=r&&r<2)?mG(e,t,2*r):[n,i,a]}function mZ(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?mG(t,e,r):mG(e,t,r);if(!(a>=i))return[];let o=a-i+1,l=Array(o);if(n)if(s<0)for(let e=0;e<o;++e)l[e]=-((a-e)/s);else for(let e=0;e<o;++e)l[e]=(a-e)*s;else if(s<0)for(let e=0;e<o;++e)l[e]=-((i+e)/s);else for(let e=0;e<o;++e)l[e]=(i+e)*s;return l}function mJ(e,t,r){return mG(e*=1,t*=1,r*=1)[2]}function m0(e,t,r){t*=1,e*=1,r*=1;let n=t<e,i=n?mJ(t,e,r):mJ(e,t,r);return(n?-1:1)*(i<0?-(1/i):i)}function m1(e,t){return null==e||null==t?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function m2(e,t){return null==e||null==t?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function m5(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=m1,r=(t,r)=>m1(e(t),r),n=(t,r)=>e(t)-r):(t=e===m1||e===m2?e:m4,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 m4(){return 0}function m3(e){return null===e?NaN:+e}let m6=m5(m1),m8=m6.right;m6.left,m5(m3).center;var m7=e.i(82938),m9=e.i(208),xe=e.i(6272),xt=e.i(11930),xr=e.i(44936);function xn(e,t){var r,n,i=typeof t;return null==t||"boolean"===i?(0,xr.default)(t):("number"===i?xe.default:"string"===i?(n=(0,m7.color)(t))?(t=n,m9.default):xt.default:t instanceof m7.color?m9.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]=xn(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]=xn(e[r],t[r]):i[r]=t[r];return function(e){for(r in n)i[r]=n[r](e);return i}}:xe.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 xi=e.i(25223);function xa(e,t){return e*=1,t*=1,function(r){return Math.round(e*(1-r)+t*r)}}function xs(e){return+e}var xo=[0,1];function xl(e){return e}function xc(e,t){var r;return(t-=e*=1)?function(r){return(r-e)/t}:(r=isNaN(t)?NaN:.5,function(){return r})}function xu(e,t,r){var n=e[0],i=e[1],a=t[0],s=t[1];return i<n?(n=xc(i,n),a=r(s,a)):(n=xc(n,i),a=r(a,s)),function(e){return a(n(e))}}function xd(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]=xc(e[s],e[s+1]),a[s]=r(t[s],t[s+1]);return function(t){var r=m8(e,t,1,n)-1;return a[r](i[r](t))}}function xh(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function xp(){var e,t,r,n,i,a,s=xo,o=xo,l=xn,c=xl;function u(){var e,t,r,l=Math.min(s.length,o.length);return c!==xl&&(e=s[0],t=s[l-1],e>t&&(r=e,e=t,t=r),c=function(r){return Math.max(e,Math.min(t,r))}),n=l>2?xd:xu,i=a=null,d}function d(t){return null==t||isNaN(t*=1)?r:(i||(i=n(s.map(e),o,l)))(e(c(t)))}return d.invert=function(r){return c(t((a||(a=n(o,s.map(e),xi.interpolateNumber)))(r)))},d.domain=function(e){return arguments.length?(s=Array.from(e,xs),u()):s.slice()},d.range=function(e){return arguments.length?(o=Array.from(e),u()):o.slice()},d.rangeRound=function(e){return o=Array.from(e),l=xa,u()},d.clamp=function(e){return arguments.length?(c=!!e||xl,u()):c!==xl},d.interpolate=function(e){return arguments.length?(l=e,u()):l},d.unknown=function(e){return arguments.length?(r=e,d):r},function(r,n){return e=r,t=n,u()}}function xf(){return xp()(xl,xl)}function xm(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 xx(e){return(e=xm(Math.abs(e)))?e[1]:NaN}var xy=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function xg(e){var t;if(!(t=xy.exec(e)))throw Error("invalid format: "+e);return new xv({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 xv(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 xb(e,t){var r=xm(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")}xg.prototype=xv.prototype,xv.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 xj={"%":(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)=>xb(100*e,t),r:xb,s:function(e,t){var r=xm(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")+xm(e,Math.max(0,t+a-1))[0]},X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function xw(e){return e}var xN=Array.prototype.map,xk=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function xS(e,t,r,n){var i,a,s=m0(e,t,r);switch((n=xg(null==n?",f":n)).type){case"s":var o=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(xx(o)/3)))-xx(Math.abs(s))))||(n.precision=a),v(n,o);case"":case"e":case"g":case"p":case"r":null!=n.precision||isNaN(a=Math.max(0,xx(Math.abs(Math.max(Math.abs(e),Math.abs(t)))-(i=Math.abs(i=s)))-xx(i))+1)||(n.precision=a-("e"===n.type));break;case"f":case"%":null!=n.precision||isNaN(a=Math.max(0,-xx(Math.abs(s))))||(n.precision=a-("%"===n.type)*2)}return g(n)}function xO(e){var t=e.domain;return e.ticks=function(e){var r=t();return mZ(r[0],r[r.length-1],null==e?10:e)},e.tickFormat=function(e,r){var n=t();return xS(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,o=a.length-1,l=a[s],c=a[o],u=10;for(c<l&&(i=l,l=c,c=i,i=s,s=o,o=i);u-- >0;){if((i=mJ(l,c,r))===n)return a[s]=l,a[o]=c,t(a);if(i>0)l=Math.floor(l/i)*i,c=Math.ceil(c/i)*i;else if(i<0)l=Math.ceil(l*i)/i,c=Math.floor(c*i)/i;else break;n=i}return e},e}function xP(){var e=xf();return e.copy=function(){return xh(e,xP())},mq.initRange.apply(e,arguments),xO(e)}function xC(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,xs),r):e.slice()},r.unknown=function(e){return arguments.length?(t=e,r):t},r.copy=function(){return xC(e).unknown(t)},e=arguments.length?Array.from(e,xs):[0,1],xO(r)}function xE(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 xM(e){return Math.log(e)}function xA(e){return Math.exp(e)}function xT(e){return-Math.log(-e)}function x_(e){return-Math.exp(-e)}function xD(e){return isFinite(e)?+("1e"+e):e<0?0:e}function xI(e){return(t,r)=>-e(-t,r)}function xL(e){let t,r,n=e(xM,xA),i=n.domain,a=10;function s(){var s,o;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===(o=a)?xD:o===Math.E?Math.exp:e=>Math.pow(o,e),i()[0]<0?(t=xI(t),r=xI(r),e(xT,x_)):e(xM,xA),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,o=i(),l=o[0],c=o[o.length-1],u=c<l;u&&([l,c]=[c,l]);let d=t(l),h=t(c),p=null==e?10:+e,f=[];if(!(a%1)&&h-d<p){if(d=Math.floor(d),h=Math.ceil(h),l>0){for(;d<=h;++d)for(n=1;n<a;++n)if(!((s=d<0?n/r(-d):n*r(d))<l)){if(s>c)break;f.push(s)}}else for(;d<=h;++d)for(n=a-1;n>=1;--n)if(!((s=d>0?n/r(-d):n*r(d))<l)){if(s>c)break;f.push(s)}2*f.length<p&&(f=mZ(l,c,p))}else f=mZ(d,h,Math.min(h-d,p)).map(r);return u?f.reverse():f},n.tickFormat=(e,i)=>{if(null==e&&(e=10),null==i&&(i=10===a?"s":","),"function"!=typeof i&&(a%1||null!=(i=xg(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(xE(i(),{floor:e=>r(Math.floor(t(e))),ceil:e=>r(Math.ceil(t(e)))})),n}function xz(){let e=xL(xp()).domain([1,10]);return e.copy=()=>xh(e,xz()).base(e.base()),mq.initRange.apply(e,arguments),e}function xR(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function xF(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function x$(e){var t=1,r=e(xR(1),xF(t));return r.constant=function(r){return arguments.length?e(xR(t=+r),xF(t)):t},xO(r)}function xB(){var e=x$(xp());return e.copy=function(){return xh(e,xB()).constant(e.constant())},mq.initRange.apply(e,arguments)}function xU(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function xV(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function xq(e){return e<0?-e*e:e*e}function xK(e){var t=e(xl,xl),r=1;return t.exponent=function(t){return arguments.length?1==(r=+t)?e(xl,xl):.5===r?e(xV,xq):e(xU(r),xU(1/r)):r},xO(t)}function xW(){var e=xK(xp());return e.copy=function(){return xh(e,xW()).exponent(e.exponent())},mq.initRange.apply(e,arguments),e}function xH(){return xW.apply(null,arguments).exponent(.5)}function xY(e){return Math.sign(e)*e*e}function xQ(){var e,t=xf(),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(xY(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,xs)).map(xY)),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 xQ(t.domain(),r).round(n).clamp(t.clamp()).unknown(e)},mq.initRange.apply(i,arguments),xO(i)}g=(y=function(e){var t,r,n,i=void 0===e.grouping||void 0===e.thousands?xw:(t=xN.call(e.grouping,Number),r=e.thousands+"",function(e,n){for(var i=e.length,a=[],s=0,o=t[0],l=0;i>0&&o>0&&(l+o+1>n&&(o=Math.max(1,n-l)),a.push(e.substring(i-=o,i+o)),!((l+=o+1)>n));)o=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]+"",o=void 0===e.decimal?".":e.decimal+"",l=void 0===e.numerals?xw:(n=xN.call(e.numerals,String),function(e){return e.replace(/[0-9]/g,function(e){return n[+e]})}),c=void 0===e.percent?"%":e.percent+"",u=void 0===e.minus?"−":e.minus+"",d=void 0===e.nan?"NaN":e.nan+"";function h(e,t){var r=(e=xg(e)).fill,n=e.align,h=e.sign,p=e.symbol,f=e.zero,m=e.width,y=e.comma,g=e.precision,v=e.trim,b=e.type;"n"===b?(y=!0,b="g"):xj[b]||(void 0===g&&(g=12),v=!0,b="g"),(f||"0"===r&&"="===n)&&(f=!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=xj[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)?d: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:u:"-"===h||"("===h?"":h)+c,p=("s"!==b||isNaN(e)||void 0===x?"":xk[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?o+e.slice(t+1):e.slice(t))+p,e=e.slice(0,t);break}}}y&&!f&&(e=i(e,1/0));var O=c.length+e.length+p.length,P=O<m?Array(m-O+1).join(r):"";switch(y&&f&&(e=i(P+e,P.length?m-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 l(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(xx(t)/3))),n=Math.pow(10,-r),i=h(((e=xg(e)).type="f",e),{suffix:xk[8+r/3]});return function(e){return i(n*e)}}}}({thousands:",",grouping:[3],currency:["$",""]})).format,v=y.formatPrefix;var xX=e.i(96509),xG=e.i(45583);function xZ(e,t){return(null==e||!(e>=e))-(null==t||!(t>=t))||(e<t?-1:+(e>t))}function xJ(e,t,r){let n=e[t];e[t]=e[r],e[r]=n}function x0(){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=m3){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[m8(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(m1),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 x0().domain(t).range(r).unknown(e)},mq.initRange.apply(a,arguments)}function x1(){var e,t=0,r=1,n=1,i=[.5],a=[0,1];function s(t){return null!=t&&t<=t?a[m8(i,t,0,n)]:e}function o(){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,o()):[t,r]},s.range=function(e){return arguments.length?(n=(a=Array.from(e)).length-1,o()):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 x1().domain([t,r]).range(a).unknown(e)},mq.initRange.apply(xO(s),arguments)}function x2(){var e,t=[.5],r=[0,1],n=1;function i(i){return null!=i&&i<=i?r[m8(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 x2().domain(t).range(r).unknown(e)},mq.initRange.apply(i,arguments)}let x5=new Date,x4=new Date;function x3(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,o=[];if(r=i.ceil(r),a=null==a?1:Math.floor(a),!(r<n)||!(a>0))return o;do o.push(s=new Date(+r)),t(r,a),e(r);while(s<r&&r<n)return o},i.filter=r=>x3(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)=>(x5.setTime(+t),x4.setTime(+n),e(x5),e(x4),Math.floor(r(x5,x4))),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 x6=x3(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());x6.every=e=>isFinite(e=Math.floor(e))&&e>0?x3(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,x6.range;let x8=x3(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());x8.every=e=>isFinite(e=Math.floor(e))&&e>0?x3(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,x8.range;let x7=x3(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());x7.range;let x9=x3(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());x9.range;function ye(e){return x3(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 yt=ye(0),yr=ye(1),yn=ye(2),yi=ye(3),ya=ye(4),ys=ye(5),yo=ye(6);function yl(e){return x3(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)}yt.range,yr.range,yn.range,yi.range,ya.range,ys.range,yo.range;let yc=yl(0),yu=yl(1),yd=yl(2),yh=yl(3),yp=yl(4),yf=yl(5),ym=yl(6);yc.range,yu.range,yd.range,yh.range,yp.range,yf.range,ym.range;let yx=x3(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);yx.range;let yy=x3(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>e.getUTCDate()-1);yy.range;let yg=x3(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>Math.floor(e/864e5));yg.range;let yv=x3(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());yv.range;let yb=x3(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+36e5*t)},(e,t)=>(t-e)/36e5,e=>e.getUTCHours());yb.range;let yj=x3(e=>{e.setTime(e-e.getMilliseconds()-1e3*e.getSeconds())},(e,t)=>{e.setTime(+e+6e4*t)},(e,t)=>(t-e)/6e4,e=>e.getMinutes());yj.range;let yw=x3(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+6e4*t)},(e,t)=>(t-e)/6e4,e=>e.getUTCMinutes());yw.range;let yN=x3(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+1e3*t)},(e,t)=>(t-e)/1e3,e=>e.getUTCSeconds());yN.range;let yk=x3(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);function yS(e,t,r,n,i,a){let s=[[yN,1,1e3],[yN,5,5e3],[yN,15,15e3],[yN,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 o(t,r,n){let i=Math.abs(r-t)/n,a=m5(([,,e])=>e).right(s,i);if(a===s.length)return e.every(m0(t/31536e6,r/31536e6,n));if(0===a)return yk.every(Math.max(m0(t,r,n),1));let[o,l]=s[i/s[a-1][2]<s[a][2]/i?a-1:a];return o.every(l)}return[function(e,t,r){let n=t<e;n&&([e,t]=[t,e]);let i=r&&"function"==typeof r.range?r:o(e,t,r),a=i?i.range(e,+t+1):[];return n?a.reverse():a},o]}yk.every=e=>isFinite(e=Math.floor(e))&&e>0?e>1?x3(t=>{t.setTime(Math.floor(t/e)*e)},(t,r)=>{t.setTime(+t+r*e)},(t,r)=>(r-t)/e):yk:null,yk.range;let[yO,yP]=yS(x8,x9,yc,yg,yb,yw),[yC,yE]=yS(x6,x7,yt,yx,yv,yj);function yM(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 yA(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 yT(e,t,r){return{y:e,m:t,d:r,H:0,M:0,S:0,L:0}}var y_={"-":"",_:" ",0:"0"},yD=/^\s*\d+/,yI=/^%/,yL=/[\\^$*+?|[\]().{}]/g;function yz(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 yR(e){return e.replace(yL,"\\$&")}function yF(e){return RegExp("^(?:"+e.map(yR).join("|")+")","i")}function y$(e){return new Map(e.map((e,t)=>[e.toLowerCase(),t]))}function yB(e,t,r){var n=yD.exec(t.slice(r,r+1));return n?(e.w=+n[0],r+n[0].length):-1}function yU(e,t,r){var n=yD.exec(t.slice(r,r+1));return n?(e.u=+n[0],r+n[0].length):-1}function yV(e,t,r){var n=yD.exec(t.slice(r,r+2));return n?(e.U=+n[0],r+n[0].length):-1}function yq(e,t,r){var n=yD.exec(t.slice(r,r+2));return n?(e.V=+n[0],r+n[0].length):-1}function yK(e,t,r){var n=yD.exec(t.slice(r,r+2));return n?(e.W=+n[0],r+n[0].length):-1}function yW(e,t,r){var n=yD.exec(t.slice(r,r+4));return n?(e.y=+n[0],r+n[0].length):-1}function yH(e,t,r){var n=yD.exec(t.slice(r,r+2));return n?(e.y=+n[0]+(+n[0]>68?1900:2e3),r+n[0].length):-1}function yY(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 yQ(e,t,r){var n=yD.exec(t.slice(r,r+1));return n?(e.q=3*n[0]-3,r+n[0].length):-1}function yX(e,t,r){var n=yD.exec(t.slice(r,r+2));return n?(e.m=n[0]-1,r+n[0].length):-1}function yG(e,t,r){var n=yD.exec(t.slice(r,r+2));return n?(e.d=+n[0],r+n[0].length):-1}function yZ(e,t,r){var n=yD.exec(t.slice(r,r+3));return n?(e.m=0,e.d=+n[0],r+n[0].length):-1}function yJ(e,t,r){var n=yD.exec(t.slice(r,r+2));return n?(e.H=+n[0],r+n[0].length):-1}function y0(e,t,r){var n=yD.exec(t.slice(r,r+2));return n?(e.M=+n[0],r+n[0].length):-1}function y1(e,t,r){var n=yD.exec(t.slice(r,r+2));return n?(e.S=+n[0],r+n[0].length):-1}function y2(e,t,r){var n=yD.exec(t.slice(r,r+3));return n?(e.L=+n[0],r+n[0].length):-1}function y5(e,t,r){var n=yD.exec(t.slice(r,r+6));return n?(e.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function y4(e,t,r){var n=yI.exec(t.slice(r,r+1));return n?r+n[0].length:-1}function y3(e,t,r){var n=yD.exec(t.slice(r));return n?(e.Q=+n[0],r+n[0].length):-1}function y6(e,t,r){var n=yD.exec(t.slice(r));return n?(e.s=+n[0],r+n[0].length):-1}function y8(e,t){return yz(e.getDate(),t,2)}function y7(e,t){return yz(e.getHours(),t,2)}function y9(e,t){return yz(e.getHours()%12||12,t,2)}function ge(e,t){return yz(1+yx.count(x6(e),e),t,3)}function gt(e,t){return yz(e.getMilliseconds(),t,3)}function gr(e,t){return gt(e,t)+"000"}function gn(e,t){return yz(e.getMonth()+1,t,2)}function gi(e,t){return yz(e.getMinutes(),t,2)}function ga(e,t){return yz(e.getSeconds(),t,2)}function gs(e){var t=e.getDay();return 0===t?7:t}function go(e,t){return yz(yt.count(x6(e)-1,e),t,2)}function gl(e){var t=e.getDay();return t>=4||0===t?ya(e):ya.ceil(e)}function gc(e,t){return e=gl(e),yz(ya.count(x6(e),e)+(4===x6(e).getDay()),t,2)}function gu(e){return e.getDay()}function gd(e,t){return yz(yr.count(x6(e)-1,e),t,2)}function gh(e,t){return yz(e.getFullYear()%100,t,2)}function gp(e,t){return yz((e=gl(e)).getFullYear()%100,t,2)}function gf(e,t){return yz(e.getFullYear()%1e4,t,4)}function gm(e,t){var r=e.getDay();return yz((e=r>=4||0===r?ya(e):ya.ceil(e)).getFullYear()%1e4,t,4)}function gx(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+yz(t/60|0,"0",2)+yz(t%60,"0",2)}function gy(e,t){return yz(e.getUTCDate(),t,2)}function gg(e,t){return yz(e.getUTCHours(),t,2)}function gv(e,t){return yz(e.getUTCHours()%12||12,t,2)}function gb(e,t){return yz(1+yy.count(x8(e),e),t,3)}function gj(e,t){return yz(e.getUTCMilliseconds(),t,3)}function gw(e,t){return gj(e,t)+"000"}function gN(e,t){return yz(e.getUTCMonth()+1,t,2)}function gk(e,t){return yz(e.getUTCMinutes(),t,2)}function gS(e,t){return yz(e.getUTCSeconds(),t,2)}function gO(e){var t=e.getUTCDay();return 0===t?7:t}function gP(e,t){return yz(yc.count(x8(e)-1,e),t,2)}function gC(e){var t=e.getUTCDay();return t>=4||0===t?yp(e):yp.ceil(e)}function gE(e,t){return e=gC(e),yz(yp.count(x8(e),e)+(4===x8(e).getUTCDay()),t,2)}function gM(e){return e.getUTCDay()}function gA(e,t){return yz(yu.count(x8(e)-1,e),t,2)}function gT(e,t){return yz(e.getUTCFullYear()%100,t,2)}function g_(e,t){return yz((e=gC(e)).getUTCFullYear()%100,t,2)}function gD(e,t){return yz(e.getUTCFullYear()%1e4,t,4)}function gI(e,t){var r=e.getUTCDay();return yz((e=r>=4||0===r?yp(e):yp.ceil(e)).getUTCFullYear()%1e4,t,4)}function gL(){return"+0000"}function gz(){return"%"}function gR(e){return+e}function gF(e){return Math.floor(e/1e3)}function g$(e){return new Date(e)}function gB(e){return e instanceof Date?+e:+new Date(+e)}function gU(e,t,r,n,i,a,s,o,l,c){var u=xf(),d=u.invert,h=u.domain,p=c(".%L"),f=c(":%S"),m=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(l(e)<e?p:o(e)<e?f:s(e)<e?m:a(e)<e?x:n(e)<e?i(e)<e?y:g:r(e)<e?v:b)(e)}return u.invert=function(e){return new Date(d(e))},u.domain=function(e){return arguments.length?h(Array.from(e,gB)):h().map(g$)},u.ticks=function(t){var r=h();return e(r[0],r[r.length-1],null==t?10:t)},u.tickFormat=function(e,t){return null==t?j:c(t)},u.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(xE(r,e)):u},u.copy=function(){return xh(u,gU(e,t,r,n,i,a,s,o,l,c))},u}function gV(){return mq.initRange.apply(gU(yC,yE,x6,x7,yt,yx,yv,yj,yN,j).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function gq(){return mq.initRange.apply(gU(yO,yP,x8,x9,yc,yy,yb,yw,yN,w).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function gK(){var e,t,r,n,i,a=0,s=1,o=xl,l=!1;function c(t){return null==t||isNaN(t*=1)?i:o(0===r?.5:(t=(n(t)-e)*r,l?Math.max(0,Math.min(1,t)):t))}function u(e){return function(t){var r,n;return arguments.length?([r,n]=t,o=e(r,n),c):[o(0),o(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?(l=!!e,c):l},c.interpolator=function(e){return arguments.length?(o=e,c):o},c.range=u(xn),c.rangeRound=u(xa),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 gW(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function gH(){var e=xO(gK()(xl));return e.copy=function(){return gW(e,gH())},mq.initInterpolator.apply(e,arguments)}function gY(){var e=xL(gK()).domain([1,10]);return e.copy=function(){return gW(e,gY()).base(e.base())},mq.initInterpolator.apply(e,arguments)}function gQ(){var e=x$(gK());return e.copy=function(){return gW(e,gQ()).constant(e.constant())},mq.initInterpolator.apply(e,arguments)}function gX(){var e=xK(gK());return e.copy=function(){return gW(e,gX()).exponent(e.exponent())},mq.initInterpolator.apply(e,arguments)}function gG(){return gX.apply(null,arguments).exponent(.5)}function gZ(){var e=[],t=xl;function r(r){if(null!=r&&!isNaN(r*=1))return t((m8(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(m1),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,xG.default)(e);if(t>=1)return(0,xX.default)(e);var n,i=(n-1)*t,a=Math.floor(i),s=(0,xX.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?xZ:function(e=m1){if(e===m1)return xZ;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,o=r-n+1,l=Math.log(s),c=.5*Math.exp(2*l/3),u=.5*Math.sqrt(l*c*(s-c)/s)*(o-s/2<0?-1:1),d=Math.max(n,Math.floor(r-o*c/s+u)),h=Math.min(i,Math.floor(r+(s-o)*c/s+u));e(t,r,d,h,a)}let s=t[r],o=n,l=i;for(xJ(t,n,r),a(t[i],s)>0&&xJ(t,n,i);o<l;){for(xJ(t,o,l),++o,--l;0>a(t[o],s);)++o;for(;a(t[l],s)>0;)--l}0===a(t[n],s)?xJ(t,n,l):xJ(t,++l,i),l<=r&&(n=l+1),r<=l&&(i=l-1)}return t})(e,a).subarray(0,a+1));return s+((0,xG.default)(e.subarray(a+1))-s)*(i-a)}})(e,n/t))},r.copy=function(){return gZ(t).domain(e)},mq.initInterpolator.apply(r,arguments)}function gJ(){var e,t,r,n,i,a,s,o=0,l=.5,c=1,u=1,d=xl,h=!1;function p(e){return isNaN(e*=1)?s:(e=.5+((e=+a(e))-t)*(u*e<u*t?n:i),d(h?Math.max(0,Math.min(1,e)):e))}function f(e){return function(t){var r,n,i;return arguments.length?([r,n,i]=t,d=function(e,t){void 0===t&&(t=e,e=xn);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):[d(0),d(.5),d(1)]}}return p.domain=function(s){return arguments.length?([o,l,c]=s,e=a(o*=1),t=a(l*=1),r=a(c*=1),n=e===t?0:.5/(t-e),i=t===r?0:.5/(r-t),u=t<e?-1:1,p):[o,l,c]},p.clamp=function(e){return arguments.length?(h=!!e,p):h},p.interpolator=function(e){return arguments.length?(d=e,p):d},p.range=f(xn),p.rangeRound=f(xa),p.unknown=function(e){return arguments.length?(s=e,p):s},function(s){return a=s,e=s(o),t=s(l),r=s(c),n=e===t?0:.5/(t-e),i=t===r?0:.5/(r-t),u=t<e?-1:1,p}}function g0(){var e=xO(gJ()(xl));return e.copy=function(){return gW(e,g0())},mq.initInterpolator.apply(e,arguments)}function g1(){var e=xL(gJ()).domain([.1,1,10]);return e.copy=function(){return gW(e,g1()).base(e.base())},mq.initInterpolator.apply(e,arguments)}function g2(){var e=x$(gJ());return e.copy=function(){return gW(e,g2()).constant(e.constant())},mq.initInterpolator.apply(e,arguments)}function g5(){var e=xK(gJ());return e.copy=function(){return gW(e,g5()).exponent(e.exponent())},mq.initInterpolator.apply(e,arguments)}function g4(){return g5.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,o=e.months,l=e.shortMonths,c=yF(i),u=y$(i),d=yF(a),h=y$(a),p=yF(s),f=y$(s),m=yF(o),x=y$(o),y=yF(l),g=y$(l),v={a:function(e){return s[e.getDay()]},A:function(e){return a[e.getDay()]},b:function(e){return l[e.getMonth()]},B:function(e){return o[e.getMonth()]},c:null,d:y8,e:y8,f:gr,g:gp,G:gm,H:y7,I:y9,j:ge,L:gt,m:gn,M:gi,p:function(e){return i[+(e.getHours()>=12)]},q:function(e){return 1+~~(e.getMonth()/3)},Q:gR,s:gF,S:ga,u:gs,U:go,V:gc,w:gu,W:gd,x:null,X:null,y:gh,Y:gf,Z:gx,"%":gz},b={a:function(e){return s[e.getUTCDay()]},A:function(e){return a[e.getUTCDay()]},b:function(e){return l[e.getUTCMonth()]},B:function(e){return o[e.getUTCMonth()]},c:null,d:gy,e:gy,f:gw,g:g_,G:gI,H:gg,I:gv,j:gb,L:gj,m:gN,M:gk,p:function(e){return i[+(e.getUTCHours()>=12)]},q:function(e){return 1+~~(e.getUTCMonth()/3)},Q:gR,s:gF,S:gS,u:gO,U:gP,V:gE,w:gM,W:gA,x:null,X:null,y:gT,Y:gD,Z:gL,"%":gz},j={a:function(e,t,r){var n=p.exec(t.slice(r));return n?(e.w=f.get(n[0].toLowerCase()),r+n[0].length):-1},A:function(e,t,r){var n=d.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=m.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:yG,e:yG,f:y5,g:yH,G:yW,H:yJ,I:yJ,j:yZ,L:y2,m:yX,M:y0,p:function(e,t,r){var n=c.exec(t.slice(r));return n?(e.p=u.get(n[0].toLowerCase()),r+n[0].length):-1},q:yQ,Q:y3,s:y6,S:y1,u:yU,U:yV,V:yq,w:yB,W:yK,x:function(e,t,n){return k(e,r,t,n)},X:function(e,t,r){return k(e,n,t,r)},y:yH,Y:yW,Z:yY,"%":y4};function w(e,t){return function(r){var n,i,a,s=[],o=-1,l=0,c=e.length;for(r instanceof Date||(r=new Date(+r));++o<c;)37===e.charCodeAt(o)&&(s.push(e.slice(l,o)),null!=(i=y_[n=e.charAt(++o)])?n=e.charAt(++o):i="e"===n?" ":"0",(a=t[n])&&(n=a(r,i)),s.push(n),l=o+1);return s.push(e.slice(l,o)),s.join("")}}function N(e,t){return function(r){var n,i,a=yT(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=yA(yT(a.y,0,1))).getUTCDay())>4||0===i?yu.ceil(n):yu(n),n=yy.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=yM(yT(a.y,0,1))).getDay())>4||0===i?yr.ceil(n):yr(n),n=yx.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?yA(yT(a.y,0,1)).getUTCDay():yM(yT(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,yA(a)):yM(a)}}function k(e,t,r,n){for(var i,a,s=0,o=t.length,l=r.length;s<o;){if(n>=l)return -1;if(37===(i=t.charCodeAt(s++))){if(!(a=j[(i=t.charAt(s++))in y_?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",()=>mW,"scaleDiverging",()=>g0,"scaleDivergingLog",()=>g1,"scaleDivergingPow",()=>g5,"scaleDivergingSqrt",()=>g4,"scaleDivergingSymlog",()=>g2,"scaleIdentity",()=>xC,"scaleImplicit",()=>mK.implicit,"scaleLinear",()=>xP,"scaleLog",()=>xz,"scaleOrdinal",()=>mK.default,"scalePoint",()=>mH,"scalePow",()=>xW,"scaleQuantile",()=>x0,"scaleQuantize",()=>x1,"scaleRadial",()=>xQ,"scaleSequential",()=>gH,"scaleSequentialLog",()=>gY,"scaleSequentialPow",()=>gX,"scaleSequentialQuantile",()=>gZ,"scaleSequentialSqrt",()=>gG,"scaleSequentialSymlog",()=>gQ,"scaleSqrt",()=>xH,"scaleSymlog",()=>xB,"scaleThreshold",()=>x2,"scaleTime",()=>gV,"scaleUtc",()=>gq,"tickFormat",()=>xS],84649),e.i(84649),e.s(["scaleBand",()=>mW,"scaleDiverging",()=>g0,"scaleDivergingLog",()=>g1,"scaleDivergingPow",()=>g5,"scaleDivergingSqrt",()=>g4,"scaleDivergingSymlog",()=>g2,"scaleIdentity",()=>xC,"scaleImplicit",()=>mK.implicit,"scaleLinear",()=>xP,"scaleLog",()=>xz,"scaleOrdinal",()=>mK.default,"scalePoint",()=>mH,"scalePow",()=>xW,"scaleQuantile",()=>x0,"scaleQuantize",()=>x1,"scaleRadial",()=>xQ,"scaleSequential",()=>gH,"scaleSequentialLog",()=>gY,"scaleSequentialPow",()=>gX,"scaleSequentialQuantile",()=>gZ,"scaleSequentialSqrt",()=>gG,"scaleSequentialSymlog",()=>gQ,"scaleSqrt",()=>xH,"scaleSymlog",()=>xB,"scaleThreshold",()=>x2,"scaleTime",()=>gV,"scaleUtc",()=>gq,"tickFormat",()=>xS],93628);var g3=e.i(93628),g6=e=>e.chartData,g8=hd([g6],e=>{var t=null!=e.chartData?e.chartData.length-1:0;return{chartData:e.chartData,computedData:e.computedData,dataEndIndex:t,dataStartIndex:0}}),g7=(e,t,r,n)=>n?g8(e):g6(e);function g9(e){if(Array.isArray(e)&&2===e.length){var[t,r]=e;if(f0(t)&&f0(r))return!0}return!1}function ve(e,t,r){return r?e:[Math.min(e[0],t[0]),Math.max(e[1],t[1])]}function vt(e,t){if(t&&"function"!=typeof e&&Array.isArray(e)&&2===e.length){var r,n,[i,a]=e;if(f0(i))r=i;else if("function"==typeof i)return;if(f0(a))n=a;else if("function"==typeof a)return;var s=[r,n];if(g9(s))return s}}var vr=e.i(73335);function vn(e){return 0===e?1:Math.floor(new vr.default(e).abs().log(10).toNumber())+1}function vi(e,t,r){for(var n=new vr.default(e),i=0,a=[];n.lt(t)&&i<1e5;)a.push(n.toNumber()),n=n.add(r),i++;return a}var va=e=>{var[t,r]=e,[n,i]=[t,r];return t>r&&([n,i]=[r,t]),[n,i]},vs=(e,t,r)=>{if(e.lte(0))return new vr.default(0);var n=vn(e.toNumber()),i=new vr.default(10).pow(n),a=e.div(i),s=1!==n?.05:.1,o=new vr.default(Math.ceil(a.div(s).toNumber())).add(r).mul(s).mul(i);return new vr.default(t?o.toNumber():Math.ceil(o.toNumber()))},vo=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 vr.default(0),tickMin:new vr.default(0),tickMax:new vr.default(0)};var s=vs(new vr.default(t).sub(e).div(r-1),n,a),o=Math.ceil((i=e<=0&&t>=0?new vr.default(0):(i=new vr.default(e).add(t).div(2)).sub(new vr.default(i).mod(s))).sub(e).div(s).toNumber()),l=Math.ceil(new vr.default(t).sub(i).div(s).toNumber()),c=o+l+1;return c>r?vo(e,t,r,n,a+1):(c<r&&(l=t>0?l+(r-c):l,o=t>0?o:o+(r-c)),{step:s,tickMin:i.sub(new vr.default(o).mul(s)),tickMax:i.add(new vr.default(l).mul(s))})},vl=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,o]=va([t,r]);if(s===-1/0||o===1/0){var l=o===1/0?[s,...Array(n-1).fill(1/0)]:[...Array(n-1).fill(-1/0),o];return t>r?l.reverse():l}if(s===o)return((e,t,r)=>{var n=new vr.default(1),i=new vr.default(e);if(!i.isint()&&r){var a=Math.abs(e);a<1?(n=new vr.default(10).pow(vn(e)-1),i=new vr.default(Math.floor(i.div(n).toNumber())).mul(n)):a>1&&(i=new vr.default(Math.floor(e)))}else 0===e?i=new vr.default(Math.floor((t-1)/2)):r||(i=new vr.default(Math.floor(e)));for(var s=Math.floor((t-1)/2),o=[],l=0;l<t;l++)o.push(i.add(new vr.default(l-s).mul(n)).toNumber());return o})(s,n,i);var{step:c,tickMin:u,tickMax:d}=vo(s,o,a,i,0),h=vi(u,d.add(new vr.default(.1).mul(c)),c);return t>r?h.reverse():h},vc=function(e,t){var[r,n]=e,i=!(arguments.length>2)||void 0===arguments[2]||arguments[2],[a,s]=va([r,n]);if(a===-1/0||s===1/0)return[r,n];if(a===s)return[a];var o=Math.max(t,2),l=vs(new vr.default(s).sub(a).div(o-1),i,0),c=[...vi(new vr.default(a),new vr.default(s),l),s];return!1===i&&(c=c.map(e=>Math.round(e))),r>n?c.reverse():c},vu=e=>e.rootProps.maxBarSize,vd=e=>e.rootProps.barCategoryGap,vh=e=>e.rootProps.stackOffset,vp=e=>e.rootProps.reverseStackOrder,vf=e=>e.options.chartName,vm=e=>e.rootProps.syncId,vx=e=>e.rootProps.syncMethod,vy=e=>e.options.eventEmitter;function vg(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 vv(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?vg(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)):vg(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var vb=Math.PI/180,vj=(e,t,r,n)=>({x:e+Math.cos(-vb*n)*r,y:t+Math.sin(-vb*n)*r}),vw={grid:-100,barBackground:-50,area:100,cursorRectangle:200,bar:300,line:400,axis:500,scatter:600,activeBar:1e3,cursorLine:1100,activeDot:1200,label:2e3},vN={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:vw.axis},vk={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:vw.axis},vS=(e,t)=>{if(e&&t)return null!=e&&e.reversed?[t[1],t[0]]:t};function vO(e,t,r){return"auto"!==r?r:null!=e?f3(e,t)?"category":"number":void 0}function vP(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 vC(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?vP(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)):vP(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var vE={allowDataOverflow:vN.allowDataOverflow,allowDecimals:vN.allowDecimals,allowDuplicatedCategory:!1,dataKey:void 0,domain:void 0,id:vN.angleAxisId,includeHidden:!1,name:void 0,reversed:vN.reversed,scale:vN.scale,tick:vN.tick,tickCount:void 0,ticks:void 0,type:vN.type,unit:void 0},vM={allowDataOverflow:vk.allowDataOverflow,allowDecimals:vk.allowDecimals,allowDuplicatedCategory:vk.allowDuplicatedCategory,dataKey:void 0,domain:void 0,id:vk.radiusAxisId,includeHidden:vk.includeHidden,name:void 0,reversed:vk.reversed,scale:vk.scale,tick:vk.tick,tickCount:vk.tickCount,ticks:void 0,type:vk.type,unit:void 0},vA=hd([(e,t)=>{if(null!=t)return e.polarAxis.angleAxis[t]},mB],(e,t)=>{if(null!=e)return e;var r,n=null!=(r=vO(t,"angleAxis",vE.type))?r:"category";return vC(vC({},vE),{},{type:n})}),vT=hd([(e,t)=>e.polarAxis.radiusAxis[t],mB],(e,t)=>{if(null!=e)return e;var r,n=null!=(r=vO(t,"radiusAxis",vM.type))?r:"category";return vC(vC({},vM),{},{type:n})}),v_=e=>e.polarOptions,vD=hd([mn,mi,md],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}),vI=hd([v_,vD],(e,t)=>{if(null!=e)return pf(e.innerRadius,t,0)}),vL=hd([v_,vD],(e,t)=>{if(null!=e)return pf(e.outerRadius,t,.8*t)}),vz=hd([v_],e=>{if(null==e)return[0,0];var{startAngle:t,endAngle:r}=e;return[t,r]});hd([vA,vz],vS);var vR=hd([vD,vI,vL],(e,t,r)=>{if(null!=e&&null!=t&&null!=r)return[t,r]});hd([vT,vR],vS);var vF=hd([mF,v_,vI,vL,mn,mi],(e,t,r,n,i,a)=>{if(("centric"===e||"radial"===e)&&null!=t&&null!=r&&null!=n){var{cx:s,cy:o,startAngle:l,endAngle:c}=t;return{cx:pf(s,i,i/2),cy:pf(o,a,a/2),innerRadius:r,outerRadius:n,startAngle:l,endAngle:c,clockWise:!1}}}),v$=(e,t)=>t,vB=(e,t,r)=>r;function vU(e){return null==e?void 0:e.id}function vV(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 o=vU(e);r.forEach((t,r)=>{var n,l=null==a||i?r:String(f4(t,a,null)),c=f4(t,e.dataKey,0);Object.assign(n=s.has(l)?s.get(l):{},{[o]:c}),s.set(l,n)})}}),Array.from(s.values())}function vq(e){return"stackId"in e&&null!=e.stackId&&null!=e.dataKey}var vK=(e,t)=>e===t||null!=e&&null!=t&&e[0]===t[0]&&e[1]===t[1];function vW(e,t){return!!(Array.isArray(e)&&Array.isArray(t))&&0===e.length&&0===t.length||e===t}var vH=e=>{var t=mF(e);return"horizontal"===t?"xAxis":"vertical"===t?"yAxis":"centric"===t?"angleAxis":"radiusAxis"},vY=e=>e.tooltip.settings.axisId;function vQ(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 vX(e,t,r){if("function"==typeof e)return vQ(e.copy().domain(t).range(r));if(null!=e){var n=function(e){if(e in g3)return g3[e]();var t="scale".concat(py(e));if(t in g3)return g3[t]()}(e);if(null!=n)return n.domain(t).range(r),vQ(n)}}function vG(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 vZ(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?vG(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)):vG(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var vJ=[0,"auto"],v0={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},v1=(e,t)=>e.cartesianAxis.xAxis[t],v2=(e,t)=>{var r=v1(e,t);return null==r?v0:r},v5={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:vJ,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},v4=(e,t)=>e.cartesianAxis.yAxis[t],v3=(e,t)=>{var r=v4(e,t);return null==r?v5:r},v6={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:""},v8=(e,t)=>{var r=e.cartesianAxis.zAxis[t];return null==r?v6:r},v7=(e,t,r)=>{switch(t){case"xAxis":return v2(e,r);case"yAxis":return v3(e,r);case"zAxis":return v8(e,r);case"angleAxis":return vA(e,r);case"radiusAxis":return vT(e,r);default:throw Error("Unexpected axis type: ".concat(t))}},v9=(e,t,r)=>{switch(t){case"xAxis":return v2(e,r);case"yAxis":return v3(e,r);case"angleAxis":return vA(e,r);case"radiusAxis":return vT(e,r);default:throw Error("Unexpected axis type: ".concat(t))}},be=e=>e.graphicalItems.cartesianItems.some(e=>"bar"===e.type)||e.graphicalItems.polarItems.some(e=>"radialBar"===e.type);function bt(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 br=e=>e.graphicalItems.cartesianItems,bn=hd([v$,vB],bt),bi=(e,t,r)=>e.filter(r).filter(e=>(null==t?void 0:t.includeHidden)===!0||!e.hide),ba=hd([br,v7,bn],bi,{memoizeOptions:{resultEqualityCheck:vW}}),bs=hd([ba],e=>e.filter(e=>"area"===e.type||"bar"===e.type).filter(vq)),bo=e=>e.filter(e=>!("stackId"in e)||void 0===e.stackId),bl=hd([ba],bo),bc=e=>e.map(e=>e.data).filter(Boolean).flat(1),bu=hd([ba],bc,{memoizeOptions:{resultEqualityCheck:vW}}),bd=(e,t)=>{var{chartData:r=[],dataStartIndex:n,dataEndIndex:i}=t;return e.length>0?e:r.slice(n,i+1)},bh=hd([bu,g7],bd),bp=(e,t,r)=>(null==t?void 0:t.dataKey)!=null?e.map(e=>({value:f4(e,t.dataKey)})):r.length>0?r.map(e=>e.dataKey).flatMap(t=>e.map(e=>({value:f4(e,t)}))):e.map(e=>({value:e})),bf=hd([bh,v7,ba],bp);function bm(e,t){switch(e){case"xAxis":return"x"===t.direction;case"yAxis":return"y"===t.direction;default:return!1}}function bx(e){if(pd(e)||e instanceof Date){var t=Number(e);if(f0(t))return t}}function by(e){if(Array.isArray(e)){var t=[bx(e[0]),bx(e[1])];return g9(t)?t:void 0}var r=bx(e);if(null!=r)return[r,r]}function bg(e){return e.map(bx).filter(pg)}var bv=e=>{var t=vH(e),r=vY(e);return v9(e,t,r)},bb=hd([bv],e=>null==e?void 0:e.dataKey),bj=hd([bs,g7,bv],vV),bw=(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,[o,l]=t,c=n?[...l].reverse():l,u=c.map(vU);return[o,{stackedData:(a=null!=(i=f6[r])?i:fQ,(s=(function(){var e=fY([]),t=fX,r=fQ,n=fG;function i(i){var a,s,o=Array.from(e.apply(this,arguments),fZ),l=o.length,c=-1;for(let e of i)for(a=0,++c;a<l;++a)(o[a][c]=[0,+n(e,o[a].key,c,i)]).data=e;for(a=0,s=fH(t(o));a<l;++a)o[s[a]].index=a;return r(o,s),o}return i.keys=function(t){return arguments.length?(e="function"==typeof t?t:fY(Array.from(t)),i):e},i.value=function(e){return arguments.length?(n="function"==typeof e?e:fY(+e),i):n},i.order=function(e){return arguments.length?(t=null==e?fX:"function"==typeof e?e:fY(Array.from(e)),i):t},i.offset=function(e){return arguments.length?(r=null==e?fQ:e,i):r},i})().keys(u).value((e,t)=>Number(f4(e,t,0))).order(fX).offset(a)(e)).forEach((t,r)=>{t.forEach((t,n)=>{var i=f4(e[n],u[r],0);Array.isArray(i)&&2===i.length&&pu(i[0])&&pu(i[1])&&(t[0]=i[0],t[1]=i[1])})}),s),graphicalItems:c}]})),bN=hd([bj,bs,vh,vp],bw),bk=(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,o=s.reduce((e,n)=>{var i,a=[Math.min(...i=fJ(n,t,r).flat(2).filter(pu)),Math.max(...i)];return f0(a[0])&&f0(a[1])?[Math.min(e[0],a[0]),Math.max(e[1],a[1])]:e},[1/0,-1/0]);return[Math.min(o[0],n[0]),Math.max(o[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}},bS=hd([v7],e=>e.allowDataOverflow),bO=e=>{var t;if(null==e||!("domain"in e))return vJ;if(null!=e.domain)return e.domain;if("ticks"in e&&null!=e.ticks){if("number"===e.type){var r=bg(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:vJ},bP=hd([v7],bO),bC=hd([bP,bS],vt),bE=hd([bN,g6,v$,bC],bk,{memoizeOptions:{resultEqualityCheck:vK}}),bM=e=>e.errorBars,bA=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)]}},bT=(e,t,r,n,i)=>{var a,s;if(r.length>0&&e.forEach(e=>{r.forEach(r=>{var o,l,c=null==(o=n[r.id])?void 0:o.filter(e=>bm(i,e)),u=f4(e,null!=(l=t.dataKey)?l:r.dataKey),d=!(!c||"number"!=typeof u||pl(u))&&c.length?bg(c.flatMap(t=>{var r,n,i=f4(e,t.dataKey);if(Array.isArray(i)?[r,n]=i:r=n=i,f0(r)&&f0(n))return[u-r,u+n]})):[];if(d.length>=2){var h=Math.min(...d),p=Math.max(...d);(null==a||h<a)&&(a=h),(null==s||p>s)&&(s=p)}var f=by(u);null!=f&&(a=null==a?f[0]:Math.min(a,f[0]),s=null==s?f[1]:Math.max(s,f[1]))})}),(null==t?void 0:t.dataKey)!=null&&e.forEach(e=>{var r=by(f4(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]))}),f0(a)&&f0(s))return[a,s]},b_=hd([bh,v7,bl,bM,v$],bT,{memoizeOptions:{resultEqualityCheck:vK}});function bD(e){var{value:t}=e;if(pd(t)||t instanceof Date)return t}var bI=e=>e.referenceElements.dots,bL=(e,t,r)=>e.filter(e=>"extendDomain"===e.ifOverflow).filter(e=>"xAxis"===t?e.xAxisId===r:e.yAxisId===r),bz=hd([bI,v$,vB],bL),bR=e=>e.referenceElements.areas,bF=hd([bR,v$,vB],bL),b$=e=>e.referenceElements.lines,bB=hd([b$,v$,vB],bL),bU=(e,t)=>{if(null!=e){var r=bg(e.map(e=>"xAxis"===t?e.x:e.y));if(0!==r.length)return[Math.min(...r),Math.max(...r)]}},bV=hd(bz,v$,bU),bq=(e,t)=>{if(null!=e){var r=bg(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)]}},bK=hd([bF,v$],bq),bW=(e,t)=>{if(null!=e){var r=e.flatMap(e=>"xAxis"===t?function(e){if(null!=e.x)return bg([e.x]);var t,r=null==(t=e.segment)?void 0:t.map(e=>e.x);return null==r||0===r.length?[]:bg(r)}(e):function(e){if(null!=e.y)return bg([e.y]);var t,r=null==(t=e.segment)?void 0:t.map(e=>e.y);return null==r||0===r.length?[]:bg(r)}(e));if(0!==r.length)return[Math.min(...r),Math.max(...r)]}},bH=hd([bB,v$],bW),bY=hd(bV,bH,bK,(e,t,r)=>bA(e,r,t)),bQ=(e,t,r,n,i,a,s,o)=>null!=r?r:function(e,t,r){if(r||null!=t){if("function"==typeof e&&null!=t)try{var n=e(t,r);if(g9(n))return ve(n,t,r)}catch(e){}if(Array.isArray(e)&&2===e.length){var i,a,[s,o]=e;if("auto"===s)null!=t&&(i=Math.min(...t));else if(pu(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&&f7.test(s)){var l=f7.exec(s);if(null==l||null==l[1]||null==t)i=void 0;else{var c=+l[1];i=t[0]-c}}else i=null==t?void 0:t[0];if("auto"===o)null!=t&&(a=Math.max(...t));else if(pu(o))a=o;else if("function"==typeof o)try{null!=t&&(a=o(null==t?void 0:t[1]))}catch(e){}else if("string"==typeof o&&f9.test(o)){var u=f9.exec(o);if(null==u||null==u[1]||null==t)a=void 0;else{var d=+u[1];a=t[1]+d}}else a=null==t?void 0:t[1];var h=[i,a];if(g9(h))return null==t?h:ve(h,t,r)}}}(t,"vertical"===s&&"xAxis"===o||"horizontal"===s&&"yAxis"===o?bA(n,a,i):bA(a,i),e.allowDataOverflow),bX=hd([v7,bP,bC,bE,b_,bY,mF,v$],bQ,{memoizeOptions:{resultEqualityCheck:vK}}),bG=[0,1],bZ=(e,t,r,n,i,a,s)=>{if(null!=e&&null!=r&&0!==r.length||void 0!==s){var o,l,{dataKey:c,type:u}=e,d=f3(t,a);return d&&null==c?(0,mV.default)(0,null!=(l=null==r?void 0:r.length)?l:0):"category"===u?(o=n.map(bD).filter(e=>null!=e),d&&(null==e.dataKey||e.allowDuplicatedCategory&&pm(o))?(0,mV.default)(0,n.length):e.allowDuplicatedCategory?o:Array.from(new Set(o))):"expand"===i?bG:s}},bJ=hd([v7,mF,bh,bf,vh,v$,bX],bZ),b0=(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(py(n));return a in g3?a:"point"}}},b1=hd([v7,be,vf],b0);function b2(e,t,r,n){if(null!=r&&null!=n)return"function"==typeof e.scale?vX(e.scale,r,n):vX(t,r,n)}var b5=(e,t,r)=>{var n=bO(t);if("auto"===r||"linear"===r){if(null!=t&&t.tickCount&&Array.isArray(n)&&("auto"===n[0]||"auto"===n[1])&&g9(e))return vl(e,t.tickCount,t.allowDecimals);if(null!=t&&t.tickCount&&"number"===t.type&&g9(e))return vc(e,t.tickCount,t.allowDecimals)}},b4=hd([bJ,v9,b1],b5),b3=(e,t,r,n)=>{if("angleAxis"!==n&&(null==e?void 0:e.type)==="number"&&g9(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},b6=hd([v7,bJ,b4,v$],b3),b8=hd(bf,v7,(e,t)=>{if(t&&"number"===t.type){var r=1/0,n=Array.from(bg(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 o=0;o<n.length-1;o++){var l=n[o],c=n[o+1];null!=l&&null!=c&&(r=Math.min(r,c-l))}return r/s}}),b7=hd(b8,mF,vd,md,(e,t,r,n,i)=>i,(e,t,r,n,i)=>{if(!f0(e))return 0;var a="vertical"===t?n.height:n.width;if("gap"===i)return e*a/2;if("no-gap"===i){var s=pf(r,e*a),o=e*a/2;return o-s-(o-s)/a*s}return 0}),b9=hd(v2,(e,t,r)=>{var n=v2(e,t);return null==n||"string"!=typeof n.padding?0:b7(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}}),je=hd(v3,(e,t,r)=>{var n=v3(e,t);return null==n||"string"!=typeof n.padding?0:b7(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}}),jt=hd([md,b9,my,mx,(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]}),jr=hd([md,mF,je,my,mx,(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]}),jn=(e,t,r,n)=>{var i;switch(t){case"xAxis":return jt(e,r,n);case"yAxis":return jr(e,r,n);case"zAxis":return null==(i=v8(e,r))?void 0:i.range;case"angleAxis":return vz(e);case"radiusAxis":return vR(e,r);default:return}},ji=hd([v7,jn],vS),ja=hd([b1,b6],(e,t)=>{if(null!=t)if("linear"!==e)return t;else{if(!g9(t)){for(var r,n,i=0;i<t.length;i++){var a=t[i];f0(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}}),js=hd([v7,b1,ja,ji],b2);function jo(e,t){return e.id<t.id?-1:+(e.id>t.id)}hd([ba,bM,v$],(e,t,r)=>e.flatMap(e=>t[e.id]).filter(Boolean).filter(e=>bm(r,e)));var jl=(e,t)=>t,jc=(e,t,r)=>r,ju=hd(mo,jl,jc,(e,t,r)=>e.filter(e=>e.orientation===t).filter(e=>e.mirror===r).sort(jo)),jd=hd(ml,jl,jc,(e,t,r)=>e.filter(e=>e.orientation===t).filter(e=>e.mirror===r).sort(jo)),jh=(e,t)=>({width:e.width,height:t.height}),jp=hd(md,v2,jh),jf=hd(mi,md,ju,jl,jc,(e,t,r,n,i)=>{var a,s={};return r.forEach(r=>{var o=jh(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 l="top"===n&&!i||"bottom"===n&&i;s[r.id]=a-Number(l)*o.height,a+=(l?-1:1)*o.height}),s}),jm=hd(mn,md,jd,jl,jc,(e,t,r,n,i)=>{var a,s={};return r.forEach(r=>{var o={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 l="left"===n&&!i||"right"===n&&i;s[r.id]=a-Number(l)*o.width,a+=(l?-1:1)*o.width}),s}),jx=hd([md,v2,(e,t)=>{var r=v2(e,t);if(null!=r)return jf(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}}}),jy=hd([md,v3,(e,t)=>{var r=v3(e,t);if(null!=r)return jm(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}}}),jg=hd(md,v3,(e,t)=>({width:"number"==typeof t.width?t.width:60,height:e.height})),jv=(e,t,r)=>{switch(t){case"xAxis":return jp(e,r).width;case"yAxis":return jg(e,r).height;default:return}},jb=(e,t,r,n)=>{if(null!=r){var{allowDuplicatedCategory:i,type:a,dataKey:s}=r,o=f3(e,n),l=t.map(e=>e.value);if(s&&o&&"category"===a&&i&&pm(l))return l}},jj=hd([mF,bf,v7,v$],jb),jw=(e,t,r,n)=>{if(null!=r&&null!=r.dataKey){var{type:i,scale:a}=r;if(f3(e,n)&&("number"===i||"auto"!==a))return t.map(e=>e.value)}},jN=hd([mF,bf,v9,v$],jw);hd([mF,(e,t,r)=>{switch(t){case"xAxis":return v2(e,r);case"yAxis":return v3(e,r);default:throw Error("Unexpected axis type: ".concat(t))}},b1,js,jj,jN,jn,b4,v$],(e,t,r,n,i,a,s,o,l)=>{if(null!=t){var c=f3(e,l);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:l,categoricalDomain:a,duplicateDomain:i,isCategorical:c,niceTicks:o,range:s,realScaleType:r,scale:n}}});var jk=hd([mF,v9,b1,js,b4,jn,jj,jN,v$],(e,t,r,n,i,a,s,o,l)=>{if(null!=t&&null!=n){var c=f3(e,l),{type:u,ticks:d,tickCount:h}=t,p="scaleBand"===r&&"function"==typeof n.bandwidth?n.bandwidth()/2:2,f="category"===u&&n.bandwidth?n.bandwidth()/p:0;f="angleAxis"===l&&null!=a&&a.length>=2?2*po(a[0]-a[1])*f:f;var m=d||i;return m?m.map((e,t)=>{var r=s?s.indexOf(e):e,i=n.map(r);return f0(i)?{index:t,coordinate:i+f,value:e,offset:f}:null}).filter(pg):c&&o?o.map((e,t)=>{var r=n.map(e);return f0(r)?{coordinate:r+f,value:e,index:t,offset:f}:null}).filter(pg):n.ticks?n.ticks(h).map((e,t)=>{var r=n.map(e);return f0(r)?{coordinate:r+f,value:e,index:t,offset:f}:null}).filter(pg):n.domain().map((e,t)=>{var r=n.map(e);return f0(r)?{coordinate:r+f,value:s?s[e]:e,index:t,offset:f}:null}).filter(pg)}}),jS=hd([mF,v9,js,jn,jj,jN,v$],(e,t,r,n,i,a,s)=>{if(null!=t&&null!=r&&null!=n&&n[0]!==n[1]){var o=f3(e,s),{tickCount:l}=t,c=0;return(c="angleAxis"===s&&(null==n?void 0:n.length)>=2?2*po(n[0]-n[1])*c:c,o&&a)?a.map((e,t)=>{var n=r.map(e);return f0(n)?{coordinate:n+c,value:e,index:t,offset:c}:null}).filter(pg):r.ticks?r.ticks(l).map((e,t)=>{var n=r.map(e);return f0(n)?{coordinate:n+c,value:e,index:t,offset:c}:null}).filter(pg):r.domain().map((e,t)=>{var n=r.map(e);return f0(n)?{coordinate:n+c,value:i?i[e]:e,index:t,offset:c}:null}).filter(pg)}}),jO=hd(v7,js,(e,t)=>{if(null!=e&&null!=t)return vZ(vZ({},e),{},{scale:t})}),jP=hd([v7,b1,bJ,ji],b2);hd((e,t,r)=>v8(e,r),jP,(e,t)=>{if(null!=e&&null!=t)return vZ(vZ({},e),{},{scale:t})});var jC=hd([mF,mo,ml],(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}}),jE=e=>e.options.defaultTooltipEventType,jM=e=>e.options.validateTooltipEventTypes;function jA(e,t,r){if(null==e)return t;var n=e?"axis":"item";return null==r?t:r.includes(n)?n:t}function jT(e,t){return jA(t,jE(e),jM(e))}var j_=(e,t)=>{var r,n=Number(t);if(!pl(n)&&null!=t)return n>=0?null==e||null==(r=e[n])?void 0:r.value:void 0};function jD(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 jI(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?jD(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)):jD(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var jL=(e,t,r,n)=>{if(null==t)return fd;var i,a,s,o=(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==o)return fd;if(o.active)return o;if(e.keyboardInteraction.active)return e.keyboardInteraction;if(e.syncInteraction.active&&null!=e.syncInteraction.index)return e.syncInteraction;var l=!0===e.settings.active;if(null!=o.index){if(l)return jI(jI({},o),{},{active:!0})}else if(null!=n)return{active:!0,coordinate:void 0,dataKey:void 0,index:n,graphicalItemId:void 0};return jI(jI({},fd),{},{coordinate:o.coordinate})},jz=(e,t,r,n)=>{var i=null==e?void 0:e.index;if(null==i)return null;var a=Number(i);if(!f0(a))return i;var s=Infinity;t.length>0&&(s=t.length-1);var o=Math.max(0,Math.min(a,s)),l=t[o];return null==l?String(o):!function(e,t,r){if(null==r||null==t)return!0;var n=f4(e,t);return!(null!=n&&g9(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)}(l,r,n)?null:String(o)},jR=(e,t,r,n,i,a,s)=>{if(null!=a){var o=s[0],l=null==o?void 0:o.getPosition(a);if(null!=l)return l;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}}},jF=(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})},j$=e=>e.options.tooltipPayloadSearcher,jB=e=>e.tooltip;function jU(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 jV(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?jU(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)):jU(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var jq=(e,t,r,n,i,a,s)=>{if(null!=t&&null!=a){var{chartData:o,computedData:l,dataStartIndex:c,dataEndIndex:u}=r;return e.reduce((e,r)=>{var d,h,p,{dataDefinedOnItem:f,settings:m}=r,x=null!=f?f:o,y=Array.isArray(x)?fJ(x,c,u):x,g=null!=(d=null==m?void 0:m.dataKey)?d:n,v=null==m?void 0:m.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,pi.default)(e,t))===r)}(y,n,i):a(y,t,l,v))?h.forEach(t=>{var r=jV(jV({},m),{},{name:t.name,unit:t.unit,color:void 0,fill:void 0});e.push(mt({tooltipEntrySettings:r,dataKey:t.dataKey,payload:t.payload,value:f4(t.payload,t.dataKey),name:t.name}))}):e.push(mt({tooltipEntrySettings:m,dataKey:g,payload:h,value:f4(h,g),name:null!=(p=f4(h,v))?p:null==m?void 0:m.name})),e},[])}},jK=hd([bv,be,vf],b0),jW=hd([e=>e.graphicalItems.cartesianItems,e=>e.graphicalItems.polarItems],(e,t)=>[...e,...t]),jH=hd([vH,vY],bt),jY=hd([jW,bv,jH],bi,{memoizeOptions:{resultEqualityCheck:vW}}),jQ=hd([jY],e=>e.filter(vq)),jX=hd([jY],bc,{memoizeOptions:{resultEqualityCheck:vW}}),jG=hd([jX,g6],bd),jZ=hd([jQ,g6,bv],vV),jJ=hd([jG,bv,jY],bp),j0=hd([bv],bO),j1=hd([bv],e=>e.allowDataOverflow),j2=hd([j0,j1],vt),j5=hd([jY],e=>e.filter(vq)),j4=hd([jZ,j5,vh,vp],bw),j3=hd([j4,g6,vH,j2],bk),j6=hd([jY],bo),j8=hd([jG,bv,j6,bM,vH],bT,{memoizeOptions:{resultEqualityCheck:vK}}),j7=hd([bI,vH,vY],bL),j9=hd([j7,vH],bU),we=hd([bR,vH,vY],bL),wt=hd([we,vH],bq),wr=hd([b$,vH,vY],bL),wn=hd([wr,vH],bW),wi=hd([j9,wn,wt],bA),wa=hd([bv,j0,j2,j3,j8,wi,mF,vH],bQ),ws=hd([bv,mF,jG,jJ,vh,vH,wa],bZ),wo=hd([ws,bv,jK],b5),wl=hd([bv,ws,wo,vH],b3),wc=e=>{var t=vH(e),r=vY(e);return jn(e,t,r,!1)},wu=hd([bv,wc],vS),wd=hd([bv,jK,wl,wu],b2),wh=hd([mF,jJ,bv,vH],jb),wp=hd([mF,jJ,bv,vH],jw),wf=hd([mF,bv,jK,wd,wc,wh,wp,vH],(e,t,r,n,i,a,s,o)=>{if(t){var{type:l}=t,c=f3(e,o);if(n){var u="scaleBand"===r&&n.bandwidth?n.bandwidth()/2:2,d="category"===l&&n.bandwidth?n.bandwidth()/u:0;return(d="angleAxis"===o&&null!=i&&(null==i?void 0:i.length)>=2?2*po(i[0]-i[1])*d:d,c&&s)?s.map((e,t)=>{var r=n.map(e);return f0(r)?{coordinate:r+d,value:e,index:t,offset:d}:null}).filter(pg):n.domain().map((e,t)=>{var r=n.map(e);return f0(r)?{coordinate:r+d,value:a?a[e]:e,index:t,offset:d}:null}).filter(pg)}}}),wm=hd([jE,jM,e=>e.tooltip.settings],(e,t,r)=>jA(r.shared,e,t)),wx=e=>e.tooltip.settings.trigger,wy=e=>e.tooltip.settings.defaultIndex,wg=hd([jB,wm,wx,wy],jL),wv=hd([wg,jG,bb,ws],jz),wb=hd([wf,wv],j_),wj=hd([wg],e=>{if(e)return e.dataKey});hd([wg],e=>{if(e)return e.graphicalItemId});var ww=hd([jB,wm,wx,wy],jF),wN=hd([mn,mi,mF,md,wf,wy,ww],jR),wk=hd([wg,wN],(e,t)=>null!=e&&e.coordinate?e.coordinate:t),wS=hd([wg],e=>{var t;return null!=(t=null==e?void 0:e.active)&&t}),wO=hd([ww,wv,g6,bb,wb,j$,wm],jq);function wP(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 wC(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?wP(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)):wP(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}hd([wO],e=>{if(null!=e)return Array.from(new Set(e.map(e=>e.payload).filter(e=>null!=e)))});var wE=(e,t,r,n,i)=>{var a=null!=(d=null==t?void 0:t.length)?d: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 o=s>0?null==(h=r[s-1])?void 0:h.coordinate:null==(p=r[a-1])?void 0:p.coordinate,l=null==(f=r[s])?void 0:f.coordinate,c=s>=a-1?null==(m=r[0])?void 0:m.coordinate:null==(x=r[s+1])?void 0:x.coordinate,u=void 0;if(null!=o&&null!=l&&null!=c)if(po(l-o)!==po(c-l)){var d,h,p,f,m,x,y,g=[];if(po(c-l)===po(i[1]-i[0])){u=c;var v=l+i[1]-i[0];g[0]=Math.min(v,(v+o)/2),g[1]=Math.max(v,(v+o)/2)}else{u=o;var b=c+i[1]-i[0];g[0]=Math.min(l,(b+l)/2),g[1]=Math.max(l,(b+l)/2)}var j=[Math.min(l,(u+l)/2),Math.max(l,(u+l)/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(o,c),k=Math.max(o,c);if(e>(N+l)/2&&e<=(k+l)/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},wM=(e,t)=>t,wA=(e,t,r)=>r,wT=(e,t,r,n)=>n,w_=hd(wf,e=>(0,fK.default)(e,e=>e.coordinate)),wD=hd([jB,wM,wA,wT],jL),wI=hd([wD,jG,bb,ws],jz),wL=hd([jB,wM,wA,wT],jF),wz=hd([mn,mi,mF,md,wf,wT,wL],jR),wR=hd([wD,wz],(e,t)=>{var r;return null!=(r=e.coordinate)?r:t}),wF=hd([wf,wI],j_),w$=hd([wL,wI,g6,bb,wF,j$,wM],jq),wB=hd([wD,wI],(e,t)=>({isActive:e.active&&null!=t,activeIndex:t})),wU=hd([(e,t)=>t,mF,vF,vH,wu,wf,w_,md],(e,t,r,n,i,a,s,o)=>{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,o)){var l=wE("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,l,e);return{activeIndex:String(l),activeCoordinate:c}}return}if(e&&n&&i&&a&&r){var u=((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 o=Math.acos((r-i)/s);return n>a&&(o=2*Math.PI-o),{radius:s,angle:180*o/Math.PI,angleInRadian:o}})({x:n,y:i},t),{innerRadius:o,outerRadius:l}=t;if(a<o||a>l||0===a)return null;var{startAngle:c,endAngle:u}=(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),d=s;if(c<=u){for(;d>u;)d-=360;for(;d<c;)d+=360;r=d>=c&&d<=u}else{for(;d>c;)d-=360;for(;d<u;)d+=360;r=d>=u&&d<=c}return r?vv(vv({},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))})(d,t)}):null})(e,r);if(u){var d=wE("centric"===t?u.angle:u.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 wC(wC(wC({},n),vj(n.cx,n.cy,s,a)),{},{angle:a,radius:s})}var o=i.coordinate,{angle:l}=n;return wC(wC(wC({},n),vj(n.cx,n.cy,o,l)),{},{angle:l,radius:o})}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,d,u);return{activeIndex:String(d),activeCoordinate:h}}return}}}),wV=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)}},wq=hk("mouseClick"),wK=pr();wK.startListening({actionCreator:wq,effect:(e,t)=>{var r=e.payload,n=wU(t.getState(),wV(r));(null==n?void 0:n.activeIndex)!=null&&t.dispatch(fw({activeIndex:n.activeIndex,activeDataKey:void 0,activeCoordinate:n.activeCoordinate}))}});var wW=hk("mouseMove"),wH=pr(),wY=null;function wQ(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 wX(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 wG(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?wX(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)):wX(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}wH.startListening({actionCreator:wW,effect:(e,t)=>{var r=e.payload;null!==wY&&cancelAnimationFrame(wY);var n=wV(r);wY=requestAnimationFrame(()=>{var e=t.getState();if("axis"===jT(e,e.tooltip.settings.shared)){var r=wU(e,n);(null==r?void 0:r.activeIndex)!=null?t.dispatch(fj({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate})):t.dispatch(fv())}wY=null})}});var wZ=hI({name:"cartesianAxis",initialState:{xAxis:{},yAxis:{},zAxis:{}},reducers:{addXAxis:{reducer(e,t){e.xAxis[t.payload.id]=t.payload},prepare:hE()},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:hE()},removeXAxis:{reducer(e,t){delete e.xAxis[t.payload.id]},prepare:hE()},addYAxis:{reducer(e,t){e.yAxis[t.payload.id]=t.payload},prepare:hE()},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:hE()},removeYAxis:{reducer(e,t){delete e.yAxis[t.payload.id]},prepare:hE()},addZAxis:{reducer(e,t){e.zAxis[t.payload.id]=t.payload},prepare:hE()},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:hE()},removeZAxis:{reducer(e,t){delete e.zAxis[t.payload.id]},prepare:hE()},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 o=[...s,n].slice(-3);e.yAxis[r]=wG(wG({},i),{},{width:n,widthHistory:o})}}}}),{addXAxis:wJ,replaceXAxis:w0,removeXAxis:w1,addYAxis:w2,replaceYAxis:w5,removeYAxis:w4,addZAxis:w3,replaceZAxis:w6,removeZAxis:w8,updateYAxisWidth:w7}=wZ.actions,w9=wZ.reducer,Ne=hI({name:"graphicalItems",initialState:{cartesianItems:[],polarItems:[]},reducers:{addCartesianGraphicalItem:{reducer(e,t){e.cartesianItems.push(t.payload)},prepare:hE()},replaceCartesianGraphicalItem:{reducer(e,t){var{prev:r,next:n}=t.payload,i=d2(e).cartesianItems.indexOf(r);i>-1&&(e.cartesianItems[i]=n)},prepare:hE()},removeCartesianGraphicalItem:{reducer(e,t){var r=d2(e).cartesianItems.indexOf(t.payload);r>-1&&e.cartesianItems.splice(r,1)},prepare:hE()},addPolarGraphicalItem:{reducer(e,t){e.polarItems.push(t.payload)},prepare:hE()},removePolarGraphicalItem:{reducer(e,t){var r=d2(e).polarItems.indexOf(t.payload);r>-1&&e.polarItems.splice(r,1)},prepare:hE()}}}),{addCartesianGraphicalItem:Nt,replaceCartesianGraphicalItem:Nr,removeCartesianGraphicalItem:Nn,addPolarGraphicalItem:Ni,removePolarGraphicalItem:Na}=Ne.actions,Ns=Ne.reducer,No=hI({name:"referenceElements",initialState:{dots:[],areas:[],lines:[]},reducers:{addDot:(e,t)=>{e.dots.push(t.payload)},removeDot:(e,t)=>{var r=d2(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=d2(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=d2(e).lines.findIndex(e=>e===t.payload);-1!==r&&e.lines.splice(r,1)}}}),{addDot:Nl,removeDot:Nc,addArea:Nu,removeArea:Nd,addLine:Nh,removeLine:Np}=No.actions,Nf=No.reducer,Nm={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},Nx=hI({name:"brush",initialState:Nm,reducers:{setBrushSettings:(e,t)=>null==t.payload?Nm:t.payload}}),{setBrushSettings:Ny}=Nx.actions,Ng=Nx.reducer,Nv=hI({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:hE()},replaceLegendPayload:{reducer(e,t){var{prev:r,next:n}=t.payload,i=d2(e).payload.indexOf(r);i>-1&&(e.payload[i]=n)},prepare:hE()},removeLegendPayload:{reducer(e,t){var r=d2(e).payload.indexOf(t.payload);r>-1&&e.payload.splice(r,1)},prepare:hE()}}}),{setLegendSize:Nb,setLegendSettings:Nj,addLegendPayload:Nw,replaceLegendPayload:NN,removeLegendPayload:Nk}=Nv.actions,NS=Nv.reducer,NO={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},NP=hI({name:"rootProps",initialState:NO,reducers:{updateOptions:(e,t)=>{var r;e.accessibilityLayer=t.payload.accessibilityLayer,e.barCategoryGap=t.payload.barCategoryGap,e.barGap=null!=(r=t.payload.barGap)?r:NO.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}}}),NC=NP.reducer,{updateOptions:NE}=NP.actions,NM=hI({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:NA,removeRadiusAxis:NT,addAngleAxis:N_,removeAngleAxis:ND}=NM.actions,NI=NM.reducer,NL=hI({name:"polarOptions",initialState:null,reducers:{updatePolarOptions:(e,t)=>t.payload}}),{updatePolarOptions:Nz}=NL.actions,NR=NL.reducer,NF=hk("keyDown"),N$=hk("focus"),NB=pr();NB.startListening({actionCreator:NF,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=jz(n,jG(r),bb(r),ws(r)),s=null==a?-1:Number(a);if(Number.isFinite(s)&&!(s<0)){var o=wf(r);if("Enter"===i){var l=wz(r,"axis","hover",String(n.index));t.dispatch(fk({active:!n.active,activeIndex:n.index,activeCoordinate:l}));return}var c=s+("ArrowRight"===i?1:-1)*("left-to-right"===jC(r)?1:-1);if(null!=o&&!(c>=o.length)&&!(c<0)){var u=wz(r,"axis","hover",String(c));t.dispatch(fk({active:!0,activeIndex:c.toString(),activeCoordinate:u}))}}}}}),NB.startListening({actionCreator:N$,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=wz(r,"axis","hover",String("0"));t.dispatch(fk({active:!0,activeIndex:"0",activeCoordinate:i}))}}}});var NU=hk("externalEvent"),NV=pr(),Nq=new Map;NV.startListening({actionCreator:NU,effect:(e,t)=>{var{handler:r,reactEvent:n}=e.payload;if(null!=r){n.persist();var i=n.type,a=Nq.get(i);void 0!==a&&cancelAnimationFrame(a);var s=requestAnimationFrame(()=>{try{var e=t.getState(),a={activeCoordinate:wk(e),activeDataKey:wj(e),activeIndex:wv(e),activeLabel:wb(e),activeTooltipIndex:wv(e),isTooltipActive:wS(e)};r(a,n)}finally{Nq.delete(i)}});Nq.set(i,s)}}});var NK=hd([jB],e=>e.tooltipItemPayloads),NW=hd([NK,(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)}}}),NH=hk("touchMove"),NY=pr();NY.startListening({actionCreator:NH,effect:(e,t)=>{var r=e.payload;if(null!=r.touches&&0!==r.touches.length){var n=t.getState(),i=jT(n,n.tooltip.settings.shared);if("axis"===i){var a=r.touches[0];if(null==a)return;var s=wU(n,wV({clientX:a.clientX,clientY:a.clientY,currentTarget:r.currentTarget}));(null==s?void 0:s.activeIndex)!=null&&t.dispatch(fj({activeIndex:s.activeIndex,activeDataKey:void 0,activeCoordinate:s.activeCoordinate}))}else if("item"===i){var o,l=r.touches[0];if(null==document.elementFromPoint||null==l)return;var c=document.elementFromPoint(l.clientX,l.clientY);if(!c||!c.getAttribute)return;var u=c.getAttribute("data-recharts-item-index"),d=null!=(o=c.getAttribute("data-recharts-item-id"))?o:void 0,h=jY(n).find(e=>e.id===d);if(null==u||null==h||null==d)return;var{dataKey:p}=h,f=NW(n,u,d);t.dispatch(fy({activeDataKey:p,activeIndex:u,activeCoordinate:f,activeGraphicalItemId:d}))}}}});var NQ=hI({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:NX,replaceErrorBar:NG,removeErrorBar:NZ}=NQ.actions,NJ=NQ.reducer,N0={devToolsEnabled:!0,isSsr:!("u">typeof window&&window.document&&window.document.createElement&&window.setTimeout)};function N1(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 N2(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?N1(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)):N1(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var N5={zIndexMap:Object.values(vw).reduce((e,t)=>N2(N2({},e),{},{[t]:{element:void 0,panoramaElement:void 0,consumers:0}}),{})},N4=new Set(Object.values(vw)),N3=hI({name:"zIndex",initialState:N5,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:hE()},unregisterZIndexPortal:{reducer:(e,t)=>{var{zIndex:r}=t.payload;e.zIndexMap[r]&&(e.zIndexMap[r].consumers-=1,e.zIndexMap[r].consumers<=0&&!N4.has(r)&&delete e.zIndexMap[r])},prepare:hE()},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:hE()},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:hE()}}}),{registerZIndexPortal:N6,unregisterZIndexPortal:N8,registerZIndexPortalElement:N7,unregisterZIndexPortalElement:N9}=N3.actions,ke=hg({brush:Ng,cartesianAxis:w9,chartData:fM,errorBars:NJ,graphicalItems:Ns,layout:fL,legend:NS,options:pw,polarAxis:NI,polarOptions:NR,referenceElements:Nf,rootProps:NC,tooltip:fS,zIndex:N3.reducer}),kt=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 hS;return t&&("boolean"==typeof t?a.push(hw):a.push(hj(t.extraArgument))),a},{reducer:a,middleware:s,devTools:o=!0,duplicateMiddlewareCheck:l=!0,preloadedState:c,enhancers:u}=e||{};if("function"==typeof a)t=a;else if(hy(a))t=hg(a);else throw Error(pn(1));r="function"==typeof s?s(i):i();let d=hv;o&&(d=hN({trace:!1,..."object"==typeof o&&o}));let h=(n=function(...e){return t=>(r,n)=>{let i=t(r,n),a=()=>{throw Error(hp(15))},s={getState:i.getState,dispatch:(e,...t)=>a(e,...t)};return a=hv(...e.map(e=>e(s)))(i.dispatch),{...i,dispatch:a}}}(...r),function(e){let{autoBatch:t=!0}=e??{},r=new hS(n);return t&&r.push(hA("object"==typeof t?t:void 0)),r});return function e(t,r,n){if("function"!=typeof t)throw Error(hp(2));if("function"==typeof r&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw Error(hp(0));if("function"==typeof r&&void 0===n&&(n=r,r=void 0),void 0!==n){if("function"!=typeof n)throw Error(hp(1));return n(e)(t,r)}let i=t,a=r,s=new Map,o=s,l=0,c=!1;function u(){o===s&&(o=new Map,s.forEach((e,t)=>{o.set(t,e)}))}function d(){if(c)throw Error(hp(3));return a}function h(e){if("function"!=typeof e)throw Error(hp(4));if(c)throw Error(hp(5));let t=!0;u();let r=l++;return o.set(r,e),function(){if(t){if(c)throw Error(hp(6));t=!1,u(),o.delete(r),s=null}}}function p(e){if(!hy(e))throw Error(hp(7));if(void 0===e.type)throw Error(hp(8));if("string"!=typeof e.type)throw Error(hp(17));if(c)throw Error(hp(9));try{c=!0,a=i(a,e)}finally{c=!1}return(s=o).forEach(e=>{e()}),e}return p({type:hx.INIT}),{dispatch:p,subscribe:h,getState:d,replaceReducer:function(e){if("function"!=typeof e)throw Error(hp(10));i=e,p({type:hx.REPLACE})},[hf]:function(){return{subscribe(e){if("object"!=typeof e||null===e)throw Error(hp(11));function t(){e.next&&e.next(d())}return t(),{unsubscribe:h(t)}},[hf](){return this}}}}}(t,c,d(..."function"==typeof u?u(h):h()))}({reducer:ke,preloadedState:e,middleware:e=>e({serializableCheck:!1,immutableCheck:!["commonjs","es6","production"].includes("es6")}).concat([wK.middleware,wH.middleware,NB.middleware,NV.middleware,NY.middleware]),enhancers:e=>{var t=e;return"function"==typeof e&&(t=e()),t.concat(hA({type:"raf"}))},devTools:N0.devToolsEnabled&&{serialize:{replacer:wQ},name:"recharts-".concat(t)}})};function kr(e){var{preloadedState:t,children:r,reduxStoreName:n}=e,i=mm(),a=(0,H.useRef)(null);return i?r:(null==a.current&&(a.current=kt(t,n)),H.createElement(pT,{context:fR,store:a.current},r))}var kn=e=>{var{chartData:t}=e,r=f$(),n=mm();return(0,H.useEffect)(()=>n?()=>{}:(r(fP(t)),()=>{r(fP(void 0))}),[t,r,n]),null},ki=new Set(["axisLine","tickLine","activeBar","activeDot","activeLabel","activeShape","allowEscapeViewBox","background","cursor","dot","label","line","margin","padding","position","shape","style","tick","wrapperStyle","radius"]);function ka(e,t){for(var r of new Set([...Object.keys(e),...Object.keys(t)]))if(ki.has(r)){if(null==e[r]&&null==t[r])continue;if(!function(e,t){if(pC(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])||!pC(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 ks=(0,H.memo)(function(e){var{layout:t,margin:r}=e,n=f$(),i=mm();return(0,H.useEffect)(()=>{i||(n(f_(t)),n(fT(r)))},[n,i,t,r]),null},ka);function ko(e){var t=f$();return(0,H.useEffect)(()=>{t(NE(e))},[t,e]),null}var kl=()=>{var e;return null==(e=fq(e=>e.rootProps.accessibilityLayer))||e},kc=["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 ku(e){return"string"==typeof e&&kc.includes(e)}var kd=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 kh(e){return"string"==typeof e&&kd.has(e)}function kp(e){return"string"==typeof e&&e.startsWith("data-")}function kf(e){if("object"!=typeof e||null===e)return{};var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(kh(r)||kp(r))&&(t[r]=e[r]);return t}function km(e){return null==e?null:(0,H.isValidElement)(e)&&"object"==typeof e.props&&null!==e.props?kf(e.props):"object"!=typeof e||Array.isArray(e)?null:kf(e)}function kx(e){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(kh(r)||kp(r)||ku(r))&&(t[r]=e[r]);return t}var ky=["children","width","height","viewBox","className","style","title","desc"];function kg(){return(kg=Object.assign.bind()).apply(null,arguments)}var kv=(0,H.forwardRef)((e,t)=>{var{children:r,width:n,height:i,viewBox:a,className:s,style:o,title:l,desc:c}=e,u=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,ky),d=a||{width:n,height:i,x:0,y:0},h=sl("recharts-surface",s);return H.createElement("svg",kg({},kx(u),{className:h,width:n,height:i,style:o,viewBox:"".concat(d.x," ").concat(d.y," ").concat(d.width," ").concat(d.height),ref:t}),H.createElement("title",null,l),H.createElement("desc",null,c),r)}),kb=hd(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}}),kj=hd(e=>e.zIndex.zIndexMap,e=>Array.from(new Set(Object.keys(e).map(e=>parseInt(e,10)).concat(Object.values(vw)))).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 kw(e){var{zIndex:t,isPanorama:r}=e,n=(0,H.useRef)(null),i=f$();return(0,H.useLayoutEffect)(()=>(n.current&&i(N7({zIndex:t,element:n.current,isPanorama:r})),()=>{i(N9({zIndex:t,isPanorama:r}))}),[i,t,r]),H.createElement("g",{tabIndex:-1,ref:n})}function kN(e){var{children:t,isPanorama:r}=e,n=fq(kj);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(kw,{key:e,zIndex:e,isPanorama:r})),t,a.map(e=>H.createElement(kw,{key:e,zIndex:e,isPanorama:r})))}var kk=["children"];function kS(){return(kS=Object.assign.bind()).apply(null,arguments)}var kO={width:"100%",height:"100%",display:"block"},kP=(0,H.forwardRef)((e,t)=>{var r,n,i=fq(mn),a=fq(mi),s=kl();if(!f1(i)||!f1(a))return null;var{children:o,otherAttributes:l,title:c,desc:u}=e;return null!=l&&(r="number"==typeof l.tabIndex?l.tabIndex:s?0:void 0,n="string"==typeof l.role?l.role:s?"application":void 0),H.createElement(kv,kS({},l,{title:c,desc:u,role:n,tabIndex:r,width:i,height:a,style:kO,ref:t}),o)}),kC=e=>{var{children:t}=e,r=fq(my);if(!r)return null;var{width:n,height:i,y:a,x:s}=r;return H.createElement(kv,{width:n,height:i,x:s,y:a},t)},kE=(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,kk);return mm()?H.createElement(kC,null,H.createElement(kN,{isPanorama:!0},r)):H.createElement(kP,kS({ref:t},n),H.createElement(kN,{isPanorama:!1},r))}),kM=new(e.i(236)).default,kA="recharts.syncEvent.tooltip",kT="recharts.syncEvent.brush";function k_(e){return e.tooltip.syncInteraction}var kD=["x","y"];function kI(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 kL(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?kI(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)):kI(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var kz=(0,H.createContext)(null),kR=(0,H.createContext)(null);function kF(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 k$(){return(k$=Object.assign.bind()).apply(null,arguments)}var kB=()=>{var e,t,r,n,i,a,s,o,l,c,u,d;return e=f$(),(0,H.useEffect)(()=>{e(pN())},[e]),t=fq(vm),r=fq(vy),n=f$(),i=fq(vx),a=fq(wf),s=fq(mF),o=mz(),l=fq(e=>e.rootProps.className),(0,H.useEffect)(()=>{if(null==t)return pv;var e=(e,l,c)=>{if(r!==c&&t===e){if("index"===i){if(o&&null!=l&&null!=(u=l.payload)&&u.coordinate&&l.payload.sourceViewBox){var u,d,h=l.payload.coordinate,{x:p,y:f}=h,m=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,kD),{x:x,y:y,width:g,height:v}=l.payload.sourceViewBox,b=kL(kL({},m),{},{x:o.x+(g?(p-x)/g:0)*o.width,y:o.y+(v?(f-y)/v:0)*o.height});n(kL(kL({},l),{},{payload:kL(kL({},l.payload),{},{coordinate:b})}))}else n(l);return}if(null!=a){if("function"==typeof i){var j=i(a,{activeTooltipIndex:null==l.payload.index?void 0:Number(l.payload.index),isTooltipActive:l.payload.active,activeIndex:null==l.payload.index?void 0:Number(l.payload.index),activeLabel:l.payload.label,activeDataKey:l.payload.dataKey,activeCoordinate:l.payload.coordinate});d=a[j]}else"value"===i&&(d=a.find(e=>String(e.value)===l.payload.label));var{coordinate:w}=l.payload;if(null==d||!1===l.payload.active||null==w||null==o)return void n(fN({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,o.x+o.width),O=Math.min(k,o.y+o.height),P={x:"horizontal"===s?d.coordinate:S,y:"horizontal"===s?O:d.coordinate};n(fN({active:l.payload.active,coordinate:P,dataKey:l.payload.dataKey,index:String(d.index),label:l.payload.label,sourceViewBox:l.payload.sourceViewBox,graphicalItemId:l.payload.graphicalItemId}))}}};return kM.on(kA,e),()=>{kM.off(kA,e)}},[l,n,r,t,i,a,s,o]),c=fq(vm),u=fq(vy),d=f$(),(0,H.useEffect)(()=>{if(null==c)return pv;var e=(e,t,r)=>{u!==r&&c===e&&d(fC(t))};return kM.on(kT,e),()=>{kM.off(kT,e)}},[d,u,c]),null};function kU(e){if("number"==typeof e)return e;if("string"==typeof e){var t=parseFloat(e);if(!Number.isNaN(t))return t}return 0}var kV=(0,H.forwardRef)((e,t)=>{var r,n,i=(0,H.useRef)(null),[a,s]=(0,H.useState)({containerWidth:kU(null==(r=e.style)?void 0:r.width),containerHeight:kU(null==(n=e.style)?void 0:n.height)}),o=(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}})},[]),l=(0,H.useCallback)(e=>{if("function"==typeof t&&t(e),null!=e&&"u">typeof ResizeObserver){var{width:r,height:n}=e.getBoundingClientRect();o(r,n);var a=new ResizeObserver(e=>{var t=e[0];if(null!=t){var{width:r,height:n}=t.contentRect;o(r,n)}});a.observe(e),i.current=a}},[t,o]);return(0,H.useEffect)(()=>()=>{var e=i.current;null!=e&&e.disconnect()},[o]),H.createElement(H.Fragment,null,H.createElement(mU,{width:a.containerWidth,height:a.containerHeight}),H.createElement("div",k$({ref:l},e)))}),kq=(0,H.forwardRef)((e,t)=>{var{width:r,height:n}=e,[i,a]=(0,H.useState)({containerWidth:kU(r),containerHeight:kU(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}})},[]),o=(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(mU,{width:i.containerWidth,height:i.containerHeight}),H.createElement("div",k$({ref:o},e)))}),kK=(0,H.forwardRef)((e,t)=>{var{width:r,height:n}=e;return H.createElement(H.Fragment,null,H.createElement(mU,{width:r,height:n}),H.createElement("div",k$({ref:t},e)))}),kW=(0,H.forwardRef)((e,t)=>{var{width:r,height:n}=e;return"string"==typeof r||"string"==typeof n?H.createElement(kq,k$({},e,{ref:t})):"number"==typeof r&&"number"==typeof n?H.createElement(kK,k$({},e,{width:r,height:n,ref:t})):H.createElement(H.Fragment,null,H.createElement(mU,{width:r,height:n}),H.createElement("div",k$({ref:t},e)))}),kH=(0,H.forwardRef)((e,t)=>{var{children:r,className:n,height:i,onClick:a,onContextMenu:s,onDoubleClick:o,onMouseDown:l,onMouseEnter:c,onMouseLeave:u,onMouseMove:d,onMouseUp:h,onTouchEnd:p,onTouchMove:f,onTouchStart:m,style:x,width:y,responsive:g,dispatchTouchEvents:v=!0}=e,b=(0,H.useRef)(null),j=f$(),[w,N]=(0,H.useState)(null),[k,S]=(0,H.useState)(null),O=function(){var e=f$(),[t,r]=(0,H.useState)(null),n=fq(ma);return(0,H.useEffect)(()=>{if(null!=t){var r=t.getBoundingClientRect().width/t.offsetWidth;f0(r)&&r!==n&&e(fI(r))}},[t,e,n]),r}(),P=m_(),C=(null==P?void 0:P.width)>0?P.width:y,E=(null==P?void 0:P.height)>0?P.height:i,M=(0,H.useCallback)(e=>{O(e),"function"==typeof t&&t(e),N(e),S(e),null!=e&&(b.current=e)},[O,t,N,S]),A=(0,H.useCallback)(e=>{j(wq(e)),j(NU({handler:a,reactEvent:e}))},[j,a]),T=(0,H.useCallback)(e=>{j(wW(e)),j(NU({handler:c,reactEvent:e}))},[j,c]),_=(0,H.useCallback)(e=>{j(fv()),j(NU({handler:u,reactEvent:e}))},[j,u]),D=(0,H.useCallback)(e=>{j(wW(e)),j(NU({handler:d,reactEvent:e}))},[j,d]),I=(0,H.useCallback)(()=>{j(N$())},[j]),L=(0,H.useCallback)(e=>{j(NF(e.key))},[j]),z=(0,H.useCallback)(e=>{j(NU({handler:s,reactEvent:e}))},[j,s]),R=(0,H.useCallback)(e=>{j(NU({handler:o,reactEvent:e}))},[j,o]),F=(0,H.useCallback)(e=>{j(NU({handler:l,reactEvent:e}))},[j,l]),$=(0,H.useCallback)(e=>{j(NU({handler:h,reactEvent:e}))},[j,h]),B=(0,H.useCallback)(e=>{j(NU({handler:m,reactEvent:e}))},[j,m]),U=(0,H.useCallback)(e=>{v&&j(NH(e)),j(NU({handler:f,reactEvent:e}))},[j,v,f]),V=(0,H.useCallback)(e=>{j(NU({handler:p,reactEvent:e}))},[j,p]);return H.createElement(kz.Provider,{value:w},H.createElement(kR.Provider,{value:k},H.createElement(g?kV:kW,{width:null!=C?C:null==x?void 0:x.width,height:null!=E?E:null==x?void 0:x.height,className:sl("recharts-wrapper",n),style:function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?kF(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)):kF(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}({position:"relative",cursor:"default",width:C,height:E},x),onClick:A,onContextMenu:z,onDoubleClick:R,onFocus:I,onKeyDown:L,onMouseDown:F,onMouseEnter:T,onMouseLeave:_,onMouseMove:D,onMouseUp:$,onTouchEnd:V,onTouchMove:U,onTouchStart:B,ref:M},H.createElement(kB,null),r)))}),kY=hd([md],e=>({top:e.top,bottom:e.bottom,left:e.left,right:e.right})),kQ=hd([kY,mn,mi],(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)}}),kX=(0,H.createContext)(void 0),kG=e=>{var{children:t}=e,[r]=(0,H.useState)("".concat(pp("recharts"),"-clip")),n=fq(kQ);if(null==n)return null;var{x:i,y:a,width:s,height:o}=n;return H.createElement(kX.Provider,{value:r},H.createElement("defs",null,H.createElement("clipPath",{id:r},H.createElement("rect",{x:i,y:a,height:o,width:s}))),t)},kZ=["width","height","responsive","children","className","style","compact","title","desc"],kJ=(0,H.forwardRef)((e,t)=>{var{width:r,height:n,responsive:i,children:a,className:s,style:o,compact:l,title:c,desc:u}=e,d=kf(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,kZ));return l?H.createElement(H.Fragment,null,H.createElement(mU,{width:r,height:n}),H.createElement(kE,{otherAttributes:d,title:c,desc:u},a)):H.createElement(kH,{className:s,style:o,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(kE,{otherAttributes:d,title:c,desc:u,ref:t},H.createElement(kG,null,a)))});function k0(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 k1(e,t){var r=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?k0(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)):k0(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 k2(){return(k2=Object.assign.bind()).apply(null,arguments)}var k5={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"},k4=(0,H.forwardRef)(function(e,t){var r,n=k1(e.categoricalChartProps,k5),{chartName:i,defaultTooltipEventType:a,validateTooltipEventTypes:s,tooltipPayloadSearcher:o,categoricalChartProps:l}=e;return H.createElement(kr,{preloadedState:{options:{chartName:i,defaultTooltipEventType:a,validateTooltipEventTypes:s,tooltipPayloadSearcher:o,eventEmitter:void 0}},reduxStoreName:null!=(r=l.id)?r:i},H.createElement(kn,{chartData:l.data}),H.createElement(ks,{layout:n.layout,margin:n.margin}),H.createElement(ko,{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(kJ,k2({},n,{ref:t})))}),k3=["axis","item"],k6=(0,H.forwardRef)((e,t)=>H.createElement(k4,{chartName:"BarChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:k3,tooltipPayloadSearcher:pb,categoricalChartProps:e,ref:t})),k8=H,k7=["children","className"];function k9(){return(k9=Object.assign.bind()).apply(null,arguments)}var Se=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,k7),a=sl("recharts-layer",n);return H.createElement("g",k9({className:a},kx(i),{ref:t}),r)}),St=e=>null;St.displayName="Cell";var Sr=e.i(9944);function Sn(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 Si=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Sn(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)):Sn(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}({},{cacheSize:2e3,enableCache:!0}),Sa=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}}(Si.cacheSize),Ss={position:"absolute",top:"-20000px",left:0,padding:0,margin:0,border:"none",whiteSpace:"pre"},So="recharts_measurement_span",Sl=(e,t)=>{try{var r=document.getElementById(So);r||((r=document.createElement("span")).setAttribute("id",So),r.setAttribute("aria-hidden","true"),document.body.appendChild(r)),Object.assign(r.style,Ss,t),r.textContent="".concat(e);var n=r.getBoundingClientRect();return{width:n.width,height:n.height}}catch(e){return{width:0,height:0}}},Sc=function(e){var t,r,n,i,a,s,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(null==e||N0.isSsr)return{width:0,height:0};if(!Si.enableCache)return Sl(e,o);var l=(t=o.fontSize||"",r=o.fontFamily||"",n=o.fontWeight||"",i=o.fontStyle||"",a=o.letterSpacing||"",s=o.textTransform||"","".concat(e,"|").concat(t,"|").concat(r,"|").concat(n,"|").concat(i,"|").concat(a,"|").concat(s)),c=Sa.get(l);if(c)return c;var u=Sl(e,o);return Sa.set(l,u),u},Su=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,Sd=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,Sh=/^px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q$/,Sp=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,Sf={cm:96/2.54,mm:96/25.4,pt:96/72,pc:16,in:96,Q:96/101.6,px:1},Sm=["cm","mm","pt","pc","in","Q","px"];class Sx{static parse(e){var t,[,r,n]=null!=(t=Sp.exec(e))?t:[];return null==r?Sx.NaN:new Sx(parseFloat(r),null!=n?n:"")}constructor(e,t){this.num=e,this.unit=t,this.num=e,this.unit=t,pl(e)&&(this.unit=""),""===t||Sh.test(t)||(this.num=NaN,this.unit=""),Sm.includes(t)&&(this.num=e*Sf[t],this.unit="px")}add(e){return this.unit!==e.unit?new Sx(NaN,""):new Sx(this.num+e.num,this.unit)}subtract(e){return this.unit!==e.unit?new Sx(NaN,""):new Sx(this.num-e.num,this.unit)}multiply(e){return""!==this.unit&&""!==e.unit&&this.unit!==e.unit?new Sx(NaN,""):new Sx(this.num*e.num,this.unit||e.unit)}divide(e){return""!==this.unit&&""!==e.unit&&this.unit!==e.unit?new Sx(NaN,""):new Sx(this.num/e.num,this.unit||e.unit)}toString(){return"".concat(this.num).concat(this.unit)}isNaN(){return pl(this.num)}}function Sy(e){if(null==e||e.includes("NaN"))return"NaN";for(var t=e;t.includes("*")||t.includes("/");){var r,[,n,i,a]=null!=(r=Su.exec(t))?r:[],s=Sx.parse(null!=n?n:""),o=Sx.parse(null!=a?a:""),l="*"===i?s.multiply(o):s.divide(o);if(l.isNaN())return"NaN";t=t.replace(Su,l.toString())}for(;t.includes("+")||/.-\d+(?:\.\d+)?/.test(t);){var c,[,u,d,h]=null!=(c=Sd.exec(t))?c:[],p=Sx.parse(null!=u?u:""),f=Sx.parse(null!=h?h:""),m="+"===d?p.add(f):p.subtract(f);if(m.isNaN())return"NaN";t=t.replace(Sd,m.toString())}return t}h="NaN",p=new Sx(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 Sx?Object.defineProperty(Sx,h,{value:p,enumerable:!0,configurable:!0,writable:!0}):Sx[h]=p;var Sg=/\(([^()]*)\)/;function Sv(e){var t=function(e){try{var t;return t=e.replace(/\s+/g,""),t=function(e){for(var t,r=e;null!=(t=Sg.exec(r));){var[,n]=t;r=r.replace(Sg,Sy(n))}return r}(t),t=Sy(t)}catch(e){return"NaN"}}(e.slice(5,-1));return"NaN"===t?"":t}var Sb=["x","y","lineHeight","capHeight","fill","scaleToFit","textAnchor","verticalAnchor"],Sj=["dx","dy","angle","className","breakAll"];function Sw(){return(Sw=Object.assign.bind()).apply(null,arguments)}function SN(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 Sk=/[ \f\n\r\t\v\u2028\u2029]+/,SS=e=>{var{children:t,breakAll:r,style:n}=e;try{var i=[];null!=t&&(i=r?t.toString().split(""):t.toString().split(Sk));var a=i.map(e=>({word:e,width:Sc(e,n).width})),s=r?0:Sc(" ",n).width;return{wordsWithComputedWidth:a,spaceWidth:s}}catch(e){return null}},SO=(e,t,r,n)=>e.reduce((e,i)=>{var{word:a,width:s}=i,o=e[e.length-1];return o&&null!=s&&(null==t||n||o.width+s+r<Number(t))?(o.words.push(a),o.width+=s+r):e.push({words:[a],width:s}),e},[]),SP=e=>e.reduce((e,t)=>e.width>t.width?e:t),SC=(e,t,r,n,i,a,s,o)=>{var l=SS({breakAll:r,style:n,children:e.slice(0,t)+"…"});if(!l)return[!1,[]];var c=SO(l.wordsWithComputedWidth,a,s,o);return[c.length>i||SP(c).width>Number(a),c]},SE=e=>[{words:null==e?[]:e.toString().split(Sk),width:void 0}],SM="#808080",SA={angle:0,breakAll:!1,capHeight:"0.71em",fill:SM,lineHeight:"1em",scaleToFit:!1,textAnchor:"start",verticalAnchor:"end",x:0,y:0},ST=(0,H.forwardRef)((e,t)=>{var r,n=k1(e,SA),{x:i,y:a,lineHeight:s,capHeight:o,fill:l,scaleToFit:c,textAnchor:u,verticalAnchor:d}=n,h=SN(n,Sb),p=(0,H.useMemo)(()=>(e=>{var{width:t,scaleToFit:r,children:n,style:i,breakAll:a,maxLines:s}=e;if((t||r)&&!N0.isSsr){var o=SS({breakAll:a,children:n,style:i});if(!o)return SE(n);var{wordsWithComputedWidth:l,spaceWidth:c}=o;return((e,t,r,n,i)=>{var a,{maxLines:s,children:o,style:l,breakAll:c}=e,u=pu(s),d=String(o),h=SO(t,n,r,i);if(!u||i||!(h.length>s||SP(h).width>Number(n)))return h;for(var p=0,f=d.length-1,m=0;p<=f&&m<=d.length-1;){var x=Math.floor((p+f)/2),[y,g]=SC(d,x-1,c,l,s,n,r,i),[v]=SC(d,x,c,l,s,n,r,i);if(y||v||(p=x+1),y&&v&&(f=x-1),!y&&v){a=g;break}m++}return a||h})({breakAll:a,children:n,maxLines:s,style:i},l,c,t,!!r)}return SE(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:f,dy:m,angle:x,className:y,breakAll:g}=h,v=SN(h,Sj);if(!pd(i)||!pd(a)||0===p.length)return null;var b=Number(i)+(pu(f)?f:0),j=Number(a)+(pu(m)?m:0);if(!f0(b)||!f0(j))return null;switch(d){case"start":r=Sv("calc(".concat(o,")"));break;case"middle":r=Sv("calc(".concat((p.length-1)/2," * -").concat(s," + (").concat(o," / 2))"));break;default:r=Sv("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(pu(S)&&pu(k)?S/k:1,")"))}return x&&w.push("rotate(".concat(x,", ").concat(b,", ").concat(j,")")),w.length&&(v.transform=w.join(" ")),H.createElement("text",Sw({},kx(v),{ref:t,x:b,y:j,className:sl("recharts-text",y),textAnchor:u,fill:l.includes("url")?SM:l}),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)}))});ST.displayName="Text";var S_=e.i(9854);function SD(e){var{zIndex:t,children:r}=e,n=void 0!==fq(mF)&&void 0!==t&&0!==t,i=mm(),a=f$();(0,H.useLayoutEffect)(()=>n?(a(N6({zIndex:t})),()=>{a(N8({zIndex:t}))}):pv,[a,t,n]);var s=fq(e=>kb(e,t,i));return n?s?(0,S_.createPortal)(r,s):null:r}function SI(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 SL(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?SI(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)):SI(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var Sz=["labelRef"],SR=["content"];function SF(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 S$(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 SB(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?S$(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)):S$(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function SU(){return(SU=Object.assign.bind()).apply(null,arguments)}var SV=(0,H.createContext)(null),Sq=e=>{var{x:t,y:r,upperWidth:n,lowerWidth:i,width:a,height:s,children:o}=e,l=(0,H.useMemo)(()=>({x:t,y:r,upperWidth:n,lowerWidth:i,width:a,height:s}),[t,r,n,i,a,s]);return H.createElement(SV.Provider,{value:l},o)},SK=()=>{var e=(0,H.useContext)(SV),t=mz();return e||(t?mL(t):void 0)},SW=(0,H.createContext)(null),SH=e=>null!=e&&"function"==typeof e,SY=e=>null!=e&&"cx"in e&&pu(e.cx),SQ={angle:0,offset:5,zIndex:vw.label,position:"middle",textBreakAll:!1};function SX(e){var t,r,n,i,a,s,o=k1(e,SQ),{viewBox:l,parentViewBox:c,position:u,value:d,children:h,content:p,className:f="",textBreakAll:m,labelRef:x}=o,y=(t=(0,H.useContext)(SW),r=fq(vF),t||r),g=SK(),v=function(e){if(!SY(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==l?"center"===u?g:null!=y?y:g:SY(l)?l:mL(l));if(!i||null==d&&null==h&&!(0,H.isValidElement)(p)&&"function"!=typeof p)return null;var b=SB(SB({},o),{},{viewBox:i});if((0,H.isValidElement)(p)){var{labelRef:j}=b,w=SF(b,Sz);return(0,H.cloneElement)(p,w)}if("function"==typeof p){var{content:N}=b,k=SF(b,SR);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})(o);var S=kx(o);if(SY(i)){if("insideStart"===u||"insideEnd"===u||"end"===u)return((e,t,r,n,i)=>{var a,s,{offset:o,className:l}=e,{cx:c,cy:u,innerRadius:d,outerRadius:h,startAngle:p,endAngle:f,clockWise:m}=i,x=(d+h)/2,y=po(f-p)*Math.min(Math.abs(f-p),360),g=y>=0?1:-1;switch(t){case"insideStart":a=p+g*o,s=m;break;case"insideEnd":a=f-g*o,s=!m;break;case"end":a=f+g*o,s=m;break;default:throw Error("Unsupported position ".concat(t))}s=y<=0?s:!s;var v=vj(c,u,x,a),b=vj(c,u,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?pp("recharts-radial-line-"):e.id;return H.createElement("text",SU({},n,{dominantBaseline:"central",className:sl("recharts-radial-bar-label",l)}),H.createElement("defs",null,H.createElement("path",{id:w,d:j})),H.createElement("textPath",{xlinkHref:"#".concat(w)},r))})(o,u,a,S,i);s=((e,t,r)=>{var{cx:n,cy:i,innerRadius:a,outerRadius:s,startAngle:o,endAngle:l}=e,c=(o+l)/2;if("outside"===r){var{x:u,y:d}=vj(n,i,s+t,c);return{x:u,y:d,textAnchor:u>=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}=vj(n,i,(a+s)/2,c);return{x:h,y:p,textAnchor:"middle",verticalAnchor:"middle"}})(i,o.offset,o.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:o,height:l,upperWidth:c,lowerWidth:u}=mL(t),d=s+(c-u)/2,h=(s+d)/2,p=(c+u)/2,f=l>=0?1:-1,m=f*n,x=f>0?"end":"start",y=f>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:o-m,horizontalAnchor:"middle",verticalAnchor:x};return a&&i&&(w.height=Math.max(o-i.y,0),w.width=c),w}if("bottom"===r){var N={x:d+u/2,y:o+l+m,horizontalAnchor:"middle",verticalAnchor:y};return a&&i&&(N.height=Math.max(i.y+i.height-(o+l),0),N.width=u),N}if("left"===r){var k={x:h-v,y:o+l/2,horizontalAnchor:b,verticalAnchor:"middle"};return a&&i&&(k.width=Math.max(k.x-i.x,0),k.height=l),k}if("right"===r){var S={x:h+p+v,y:o+l/2,horizontalAnchor:j,verticalAnchor:"middle"};return a&&i&&(S.width=Math.max(i.x+i.width-S.x,0),S.height=l),S}var O=a&&i?{width:p,height:l}:{};return"insideLeft"===r?SL({x:h+v,y:o+l/2,horizontalAnchor:j,verticalAnchor:"middle"},O):"insideRight"===r?SL({x:h+p-v,y:o+l/2,horizontalAnchor:b,verticalAnchor:"middle"},O):"insideTop"===r?SL({x:s+c/2,y:o+m,horizontalAnchor:"middle",verticalAnchor:y},O):"insideBottom"===r?SL({x:d+u/2,y:o+l-m,horizontalAnchor:"middle",verticalAnchor:x},O):"insideTopLeft"===r?SL({x:s+v,y:o+m,horizontalAnchor:j,verticalAnchor:y},O):"insideTopRight"===r?SL({x:s+c-v,y:o+m,horizontalAnchor:b,verticalAnchor:y},O):"insideBottomLeft"===r?SL({x:d+v,y:o+l-m,horizontalAnchor:j,verticalAnchor:x},O):"insideBottomRight"===r?SL({x:d+u-v,y:o+l-m,horizontalAnchor:b,verticalAnchor:x},O):r&&"object"==typeof r&&(pu(r.x)||pc(r.x))&&(pu(r.y)||pc(r.y))?SL({x:s+pf(r.x,p),y:o+pf(r.y,l),horizontalAnchor:"end",verticalAnchor:"end"},O):SL({x:s+c/2,y:o+l/2,horizontalAnchor:"middle",verticalAnchor:"middle"},O)})({viewBox:v,position:u,offset:o.offset,parentViewBox:SY(c)?void 0:c,clamp:!0});s=SB(SB({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(SD,{zIndex:o.zIndex},H.createElement(ST,SU({ref:x,className:sl("recharts-label",f)},S,s,{textAnchor:"start"===(n=S.textAnchor)||"middle"===n||"end"===n||"inherit"===n?S.textAnchor:s.textAnchor,breakAll:m}),a))}function SG(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(SX,SU({key:"label-implicit"},n)):pd(e)?H.createElement(SX,SU({key:"label-implicit",value:e},n)):(0,H.isValidElement)(e)?e.type===SX?(0,H.cloneElement)(e,SB({key:"label-implicit"},n)):H.createElement(SX,SU({key:"label-implicit",content:e},n)):SH(e)?H.createElement(SX,SU({key:"label-implicit",content:e},n)):e&&"object"==typeof e?H.createElement(SX,SU({},e,{key:"label-implicit"},n)):null})(t,SK(),r)||null}SX.displayName="Label";var SZ=["valueAccessor"],SJ=["dataKey","clockWise","id","textBreakAll","zIndex"];function S0(){return(S0=Object.assign.bind()).apply(null,arguments)}function S1(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 S2=e=>Array.isArray(e.value)?(0,Sr.default)(e.value):e.value,S5=(0,H.createContext)(void 0),S4=S5.Provider,S3=(0,H.createContext)(void 0);function S6(e){var{valueAccessor:t=S2}=e,r=S1(e,SZ),{dataKey:n,clockWise:i,id:a,textBreakAll:s,zIndex:o}=r,l=S1(r,SJ),c=(0,H.useContext)(S5),u=(0,H.useContext)(S3),d=c||u;return d&&d.length?H.createElement(SD,{zIndex:null!=o?o:vw.label},H.createElement(Se,{className:"recharts-label-list"},d.map((e,i)=>{var o,c=null==n?t(e,i):f4(e.payload,n),u=null==a?{}:{id:"".concat(a,"-").concat(i)};return H.createElement(SX,S0({key:"label-".concat(i)},kx(e),l,u,{fill:null!=(o=r.fill)?o:e.fill,parentViewBox:e.parentViewBox,value:c,textBreakAll:s,viewBox:e.viewBox,index:i,zIndex:0}))}))):null}function S8(e){var{label:t}=e;return t?!0===t?H.createElement(S6,{key:"labelList-implicit"}):H.isValidElement(t)||SH(t)?H.createElement(S6,{key:"labelList-implicit",content:t}):"object"==typeof t?H.createElement(S6,S0({key:"labelList-implicit"},t,{type:String(t.type)})):null:null}S3.Provider,S6.displayName="LabelList";var S7=e.i(29095),S9=e=>"string"==typeof e?e:e?e.displayName||e.name||"Component":"",Oe=null,Ot=null,Or=e=>{if(e===Oe&&Array.isArray(Ot))return Ot;var t=[];return H.Children.forEach(e,e=>{null!=e&&((0,S7.isFragment)(e)?t=t.concat(Or(e.props.children)):t.push(e))}),Ot=t,Oe=e,t},On=e=>"radius"in e&&"startAngle"in e&&"endAngle"in e,Oi=(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];ku(i)&&"function"==typeof a&&(n||(n={}),n[i]=e=>(a(t,r,e),null))}),n},Oa=e.i(91804);function Os(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 Oo(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Os(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)):Os(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var Ol=(e,t,r)=>e.map(e=>"".concat(e.replace(/([A-Z])/g,e=>"-".concat(e.toLowerCase()))," ").concat(t,"ms ").concat(r)).join(","),Oc=(e,t)=>Object.keys(t).reduce((r,n)=>Oo(Oo({},r),{},{[n]:e(n,t[n])}),{});function Ou(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 Od(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ou(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)):Ou(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var Oh=(e,t,r)=>e+(t-e)*r,Op=e=>{var{from:t,to:r}=e;return t!==r},Of=(e,t,r)=>{var n=Oc((t,r)=>{if(Op(r)){var[n,i]=e(r.from,r.to,r.velocity);return Od(Od({},r),{},{from:n,velocity:i})}return r},t);return r<1?Oc((e,t)=>Op(t)&&null!=n[e]?Od(Od({},t),{},{velocity:Oh(t.velocity,n[e].velocity,r),from:Oh(t.from,n[e].from,r)}):t,t):Of(e,n,r-1)},Om=(e,t)=>[0,3*e,3*t-6*e,3*e-3*t+1],Ox=(e,t)=>e.map((e,r)=>e*t**r).reduce((e,t)=>e+t),Oy=(e,t)=>r=>Ox(Om(e,t),r),Og=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]},Ov=function(){return((e,t,r,n)=>{var i=Oy(e,r),a=Oy(t,n),s=t=>Ox([...Om(e,r).map((e,t)=>e*t).slice(1),0],t),o=e=>e>1?1:e<0?0:e,l=e=>{for(var t=e>1?1:e,r=t,n=0;n<8;++n){var l=i(r)-t,c=s(r);if(1e-4>Math.abs(l-t)||c<1e-4)break;r=o(r-l/c)}return a(r)};return l.isStepper=!1,l})(...Og(...arguments))},Ob=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,o=a*n/1e3+e;return 1e-4>Math.abs(o-i)&&1e-4>Math.abs(s)?[i,0]:[o,s]};return i.isStepper=!0,i.dt=n,i};class Oj{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 Ow=(0,H.createContext)(function(){var e,t,r,n,i;return e=new Oj,t=()=>null,r=!1,n=null,i=a=>{if(!r){if(Array.isArray(a)){if(!a.length)return;var[s,...o]=a;if("number"==typeof s){n=e.setTimeout(i.bind(null,o),s);return}i(s),n=e.setTimeout(i.bind(null,o));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}}),ON={begin:0,duration:1e3,easing:"ease",isActive:!0,canBegin:!0,onAnimationEnd:()=>{},onAnimationStart:()=>{}},Ok={t:0},OS={t:1};function OO(e){var t,r,n,i=k1(e,ON),{isActive:a,canBegin:s,duration:o,easing:l,begin:c,onAnimationEnd:u,onAnimationStart:d,children:h}=i,p="auto"===a?!N0.isSsr:a,f=(t=i.animationId,r=i.animationManager,n=(0,H.useContext)(Ow),(0,H.useMemo)(()=>null!=r?r:n(t),[t,r,n])),[m,x]=(0,H.useState)(p?Ok:OS),y=(0,H.useRef)(null);return(0,H.useEffect)(()=>{p||x(OS)},[p]),(0,H.useEffect)(()=>{if(!p||!s)return pv;var e=((e,t,r,n,i,a)=>{var s,o,l,c,u,d,h,p,f=[Object.keys(e),Object.keys(t)].reduce((e,t)=>e.filter(e=>t.includes(e)));return null==r?()=>(i(Od(Od({},e),t)),()=>{}):!0===r.isStepper?(o=f.reduce((r,n)=>Od(Od({},r),{},{[n]:{from:e[n],velocity:0,to:t[n]}}),{}),l=null,c=n=>{s||(s=n);var u=(n-s)/r.dt;o=Of(r,o,u),i(Od(Od(Od({},e),t),Oc((e,t)=>t.from,o))),s=n,Object.values(o).filter(Op).length&&(l=a.setTimeout(c))},()=>(l=a.setTimeout(c),()=>{var e;null==(e=l)||e()})):(d=null,h=f.reduce((r,n)=>{var i=e[n],a=t[n];return null==i||null==a?r:Od(Od({},r),{},{[n]:[i,a]})},{}),p=s=>{u||(u=s);var o=(s-u)/n,l=Oc((e,t)=>Oh(...t,r(o)),h);if(i(Od(Od(Od({},e),t),l)),o<1)d=a.setTimeout(p);else{var c=Oc((e,t)=>Oh(...t,r(1)),h);i(Od(Od(Od({},e),t),c))}},()=>(d=a.setTimeout(p),()=>{var e;null==(e=d)||e()}))})(Ok,OS,(e=>{if("string"==typeof e)switch(e){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return Ov(e);case"spring":return Ob();default:if("cubic-bezier"===e.split("(")[0])return Ov(e)}return"function"==typeof e?e:null})(l),o,x,f.getTimeoutController());return f.start([d,c,()=>{y.current=e()},o,u]),()=>{f.stop(),y.current&&y.current(),u()}},[p,s,o,l,c,d,u,f]),h(m.t)}function OP(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"animation-",r=(0,H.useRef)(pp(t)),n=(0,H.useRef)(e);return n.current!==e&&(r.current=pp(t),n.current=e),r.current}var OC=["radius"],OE=["radius"];function OM(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 OA(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?OM(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)):OM(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function OT(){return(OT=Object.assign.bind()).apply(null,arguments)}function O_(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 OD(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var OI=(e,t,r,n,i)=>{var a=pa(r),s=pa(n),o=Math.min(Math.abs(a)/2,Math.abs(s)/2),l=s>=0?1:-1,c=a>=0?1:-1,u=+(s>=0&&a>=0||s<0&&a<0);if(o>0&&Array.isArray(i)){for(var d=[0,0,0,0],h=0;h<4;h++){var p,f,m=null!=(f=i[h])?f:0;d[h]=m>o?o:m}p=ps(N||(N=OD(["M",",",""])),e,t+l*d[0]),d[0]>0&&(p+=ps(k||(k=OD(["A ",",",",0,0,",",",",",""])),d[0],d[0],u,e+c*d[0],t)),p+=ps(S||(S=OD(["L ",",",""])),e+r-c*d[1],t),d[1]>0&&(p+=ps(O||(O=OD(["A ",",",",0,0,",",\n ",",",""])),d[1],d[1],u,e+r,t+l*d[1])),p+=ps(P||(P=OD(["L ",",",""])),e+r,t+n-l*d[2]),d[2]>0&&(p+=ps(C||(C=OD(["A ",",",",0,0,",",\n ",",",""])),d[2],d[2],u,e+r-c*d[2],t+n)),p+=ps(E||(E=OD(["L ",",",""])),e+c*d[3],t+n),d[3]>0&&(p+=ps(M||(M=OD(["A ",",",",0,0,",",\n ",",",""])),d[3],d[3],u,e,t+n-l*d[3])),p+="Z"}else if(o>0&&i===+i&&i>0){var x=Math.min(o,i);p=ps(A||(A=OD(["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+l*x,x,x,u,e+c*x,t,e+r-c*x,t,x,x,u,e+r,t+l*x,e+r,t+n-l*x,x,x,u,e+r-c*x,t+n,e+c*x,t+n,x,x,u,e,t+n-l*x)}else p=ps(T||(T=OD(["M ",","," h "," v "," h "," Z"])),e,t,r,n,-r);return p},OL={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},Oz=e=>{var t=k1(e,OL),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:o,height:l,radius:c,className:u}=t,{animationEasing:d,animationDuration:h,animationBegin:p,isAnimationActive:f,isUpdateAnimationActive:m}=t,x=(0,H.useRef)(o),y=(0,H.useRef)(l),g=(0,H.useRef)(a),v=(0,H.useRef)(s),b=OP((0,H.useMemo)(()=>({x:a,y:s,width:o,height:l,radius:c}),[a,s,o,l,c]),"rectangle-");if(a!==+a||s!==+s||o!==+o||l!==+l||0===o||0===l)return null;var j=sl("recharts-rectangle",u);if(!m){var w=kx(t),{radius:N}=w,k=O_(w,OC);return H.createElement("path",OT({},k,{x:pa(a),y:pa(s),width:pa(o),height:pa(l),radius:"number"==typeof c?c:void 0,className:j,d:OI(a,s,o,l,c)}))}var S=x.current,O=y.current,P=g.current,C=v.current,E="0px ".concat(-1===n?1:n,"px"),M="".concat(n,"px 0px"),A=Ol(["strokeDasharray"],h,"string"==typeof d?d:OL.animationEasing);return H.createElement(OO,{animationId:b,key:b,canBegin:n>0,duration:h,easing:d,isActive:m,begin:p},e=>{var n,i=px(S,o,e),u=px(O,l,e),d=px(P,a,e),h=px(C,s,e);r.current&&(x.current=i,y.current=u,g.current=d,v.current=h),n=f?e>0?{transition:A,strokeDasharray:M}:{strokeDasharray:E}:{strokeDasharray:M};var p=kx(t),{radius:m}=p,b=O_(p,OE);return H.createElement("path",OT({},b,{radius:"number"==typeof c?c:void 0,className:j,d:OI(d,h,i,u,c),ref:r,style:OA(OA({},n),t.style)}))})};function OR(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 OF(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?OR(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)):OR(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function O$(){return(O$=Object.assign.bind()).apply(null,arguments)}function OB(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var OU=(e,t,r,n,i)=>{var a=r-n;return ps(_||(_=OB(["M ",",",""])),e,t)+ps(D||(D=OB(["L ",",",""])),e+r,t)+ps(I||(I=OB(["L ",",",""])),e+r-a/2,t+i)+ps(L||(L=OB(["L ",",",""])),e+r-a/2-n,t+i)+ps(z||(z=OB(["L ",","," Z"])),e,t)},OV={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},Oq=e=>{var t=k1(e,OV),{x:r,y:n,upperWidth:i,lowerWidth:a,height:s,className:o}=t,{animationEasing:l,animationDuration:c,animationBegin:u,isUpdateAnimationActive:d}=t,h=(0,H.useRef)(null),[p,f]=(0,H.useState)(-1),m=(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=OP(e,"trapezoid-");if((0,H.useEffect)(()=>{if(h.current&&h.current.getTotalLength)try{var e=h.current.getTotalLength();e&&f(e)}catch(e){}},[]),r!==+r||n!==+n||i!==+i||a!==+a||s!==+s||0===i&&0===a||0===s)return null;var j=sl("recharts-trapezoid",o);if(!d)return H.createElement("g",null,H.createElement("path",O$({},kx(t),{className:j,d:OU(r,n,i,a,s)})));var w=m.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"),E=Ol(["strokeDasharray"],c,l);return H.createElement(OO,{animationId:b,key:b,canBegin:p>0,duration:c,easing:l,isActive:d,begin:u},e=>{var o=px(w,i,e),l=px(N,a,e),c=px(k,s,e),u=px(S,r,e),d=px(O,n,e);h.current&&(m.current=o,x.current=l,y.current=c,g.current=u,v.current=d);var p=e>0?{transition:E,strokeDasharray:C}:{strokeDasharray:P};return H.createElement("path",O$({},kx(t),{className:j,d:OU(u,d,o,l,c),ref:h,style:OF(OF({},p),t.style)}))})};function OK(){return(OK=Object.assign.bind()).apply(null,arguments)}function OW(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var OH=e=>{var{cx:t,cy:r,radius:n,angle:i,sign:a,isExternal:s,cornerRadius:o,cornerIsExternal:l}=e,c=o*(s?1:-1)+n,u=Math.asin(o/c)/vb,d=l?i:i+a*u,h=vj(t,r,c,d);return{center:h,circleTangency:vj(t,r,n,d),lineTangency:vj(t,r,c*Math.cos(u*vb),l?i-a*u:i),theta:u}},OY=e=>{var{cx:t,cy:r,innerRadius:n,outerRadius:i,startAngle:a,endAngle:s}=e,o=po(s-a)*Math.min(Math.abs(s-a),359.999),l=a+o,c=vj(t,r,i,a),u=vj(t,r,i,l),d=ps(R||(R=OW(["M ",",","\n A ",",",",0,\n ",",",",\n ",",","\n "])),c.x,c.y,i,i,+(Math.abs(o)>180),+(a>l),u.x,u.y);if(n>0){var h=vj(t,r,n,a),p=vj(t,r,n,l);d+=ps(F||(F=OW(["L ",",","\n A ",",",",0,\n ",",",",\n ",","," Z"])),p.x,p.y,n,n,+(Math.abs(o)>180),+(a<=l),h.x,h.y)}else d+=ps($||($=OW(["L ",","," Z"])),t,r);return d},OQ={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},OX=e=>{var t,r=k1(e,OQ),{cx:n,cy:i,innerRadius:a,outerRadius:s,cornerRadius:o,forceCornerRadius:l,cornerIsExternal:c,startAngle:u,endAngle:d,className:h}=r;if(s<a||u===d)return null;var p=sl("recharts-sector",h),f=s-a,m=pf(o,f,0,!0);return t=m>0&&360>Math.abs(u-d)?(e=>{var{cx:t,cy:r,innerRadius:n,outerRadius:i,cornerRadius:a,forceCornerRadius:s,cornerIsExternal:o,startAngle:l,endAngle:c}=e,u=po(c-l),{circleTangency:d,lineTangency:h,theta:p}=OH({cx:t,cy:r,radius:i,angle:l,sign:u,cornerRadius:a,cornerIsExternal:o}),{circleTangency:f,lineTangency:m,theta:x}=OH({cx:t,cy:r,radius:i,angle:c,sign:-u,cornerRadius:a,cornerIsExternal:o}),y=o?Math.abs(l-c):Math.abs(l-c)-p-x;if(y<0)return s?ps(B||(B=OW(["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)):OY({cx:t,cy:r,innerRadius:n,outerRadius:i,startAngle:l,endAngle:c});var g=ps(U||(U=OW(["M ",",","\n A",",",",0,0,",",",",","\n A",",",",0,",",",",",",","\n A",",",",0,0,",",",",","\n "])),h.x,h.y,a,a,+(u<0),d.x,d.y,i,i,+(y>180),+(u<0),f.x,f.y,a,a,+(u<0),m.x,m.y);if(n>0){var{circleTangency:v,lineTangency:b,theta:j}=OH({cx:t,cy:r,radius:n,angle:l,sign:u,isExternal:!0,cornerRadius:a,cornerIsExternal:o}),{circleTangency:w,lineTangency:N,theta:k}=OH({cx:t,cy:r,radius:n,angle:c,sign:-u,isExternal:!0,cornerRadius:a,cornerIsExternal:o}),S=o?Math.abs(l-c):Math.abs(l-c)-j-k;if(S<0&&0===a)return"".concat(g,"L").concat(t,",").concat(r,"Z");g+=ps(V||(V=OW(["L",",","\n A",",",",0,0,",",",",","\n A",",",",0,",",",",",",","\n A",",",",0,0,",",",",","Z"])),N.x,N.y,a,a,+(u<0),w.x,w.y,n,n,+(S>180),+(u>0),v.x,v.y,a,a,+(u<0),b.x,b.y)}else g+=ps(q||(q=OW(["L",",","Z"])),t,r);return g})({cx:n,cy:i,innerRadius:a,outerRadius:s,cornerRadius:Math.min(m,f/2),forceCornerRadius:l,cornerIsExternal:c,startAngle:u,endAngle:d}):OY({cx:n,cy:i,innerRadius:a,outerRadius:s,startAngle:u,endAngle:d}),H.createElement("path",OK({},kx(r),{className:p,d:t}))};let OG=Math.PI,OZ=2*OG,OJ=OZ-1e-6;function O0(e){this._+=e[0];for(let t=1,r=e.length;t<r;++t)this._+=arguments[t]+e[t]}class O1{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=null==e?O0:function(e){let t=Math.floor(e);if(!(t>=0))throw Error(`invalid digits: ${e}`);if(t>15)return O0;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,o=r-e,l=n-t,c=a-e,u=s-t,d=c*c+u*u;if(null===this._x1)this._append`M${this._x1=e},${this._y1=t}`;else if(d>1e-6)if(Math.abs(u*o-l*c)>1e-6&&i){let h=r-a,p=n-s,f=o*o+l*l,m=Math.sqrt(f),x=Math.sqrt(d),y=i*Math.tan((OG-Math.acos((f+d-(h*h+p*p))/(2*m*x)))/2),g=y/x,v=y/m;Math.abs(g-1)>1e-6&&this._append`L${e+g*c},${t+g*u}`,this._append`A${i},${i},0,0,${+(u*h>c*p)},${this._x1=e+v*o},${this._y1=t+v*l}`}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),o=r*Math.sin(n),l=e+s,c=t+o,u=1^a,d=a?n-i:i-n;null===this._x1?this._append`M${l},${c}`:(Math.abs(this._x1-l)>1e-6||Math.abs(this._y1-c)>1e-6)&&this._append`L${l},${c}`,r&&(d<0&&(d=d%OZ+OZ),d>OJ?this._append`A${r},${r},0,1,${u},${e-s},${t-o}A${r},${r},0,1,${u},${this._x1=l},${this._y1=c}`:d>1e-6&&this._append`A${r},${r},0,${+(d>=OG)},${u},${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 O2(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 O1(t)}O1.prototype;let O5=Math.cos,O4=Math.sin,O3=Math.sqrt,O6=Math.PI,O8=2*O6;O3(3);let O7={draw(e,t){let r=O3(t/O6);e.moveTo(r,0),e.arc(0,0,r,0,O8)}},O9=O3(1/3),Pe=2*O9,Pt=O4(O6/10)/O4(7*O6/10),Pr=O4(O8/10)*Pt,Pn=-O5(O8/10)*Pt,Pi=O3(3);O3(3);let Pa=O3(3)/2,Ps=1/O3(12),Po=(Ps/2+1)*3;var Pl=["type","size","sizeType"];function Pc(){return(Pc=Object.assign.bind()).apply(null,arguments)}function Pu(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 Pd(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Pu(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)):Pu(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var Ph={symbolCircle:O7,symbolCross:{draw(e,t){let r=O3(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=O3(t/Pe),n=r*O9;e.moveTo(0,-r),e.lineTo(n,0),e.lineTo(0,r),e.lineTo(-n,0),e.closePath()}},symbolSquare:{draw(e,t){let r=O3(t),n=-r/2;e.rect(n,n,r,r)}},symbolStar:{draw(e,t){let r=O3(.8908130915292852*t),n=Pr*r,i=Pn*r;e.moveTo(0,-r),e.lineTo(n,i);for(let t=1;t<5;++t){let a=O8*t/5,s=O5(a),o=O4(a);e.lineTo(o*r,-s*r),e.lineTo(s*n-o*i,o*n+s*i)}e.closePath()}},symbolTriangle:{draw(e,t){let r=-O3(t/(3*Pi));e.moveTo(0,2*r),e.lineTo(-Pi*r,-r),e.lineTo(Pi*r,-r),e.closePath()}},symbolWye:{draw(e,t){let r=O3(t/Po),n=r/2,i=r*Ps,a=r*Ps+r,s=-n;e.moveTo(n,i),e.lineTo(n,a),e.lineTo(s,a),e.lineTo(-.5*n-Pa*i,Pa*n+-.5*i),e.lineTo(-.5*n-Pa*a,Pa*n+-.5*a),e.lineTo(-.5*s-Pa*a,Pa*s+-.5*a),e.lineTo(-.5*n+Pa*i,-.5*i-Pa*n),e.lineTo(-.5*n+Pa*a,-.5*a-Pa*n),e.lineTo(-.5*s+Pa*a,-.5*a-Pa*s),e.closePath()}}},Pp=Math.PI/180,Pf=e=>{var{type:t="circle",size:r=64,sizeType:n="area"}=e,i=Pd(Pd({},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,Pl)),{},{type:t,size:r,sizeType:n}),a="circle";"string"==typeof t&&(a=t);var{className:s,cx:o,cy:l}=i,c=kx(i);return pu(o)&&pu(l)&&pu(r)?H.createElement("path",Pc({},c,{className:sl("recharts-symbols",s),transform:"translate(".concat(o,", ").concat(l,")"),d:(()=>{var e,t=(e=a,Ph["symbol".concat(py(e))]||O7),i=(function(e,t){let r=null,n=O2(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:fY(e||O7),t="function"==typeof t?t:fY(void 0===t?64:+t),i.type=function(t){return arguments.length?(e="function"==typeof t?t:fY(t),i):e},i.size=function(e){return arguments.length?(t="function"==typeof e?e:fY(+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*Pp;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 Pm(e){this._context=e}function Px(e){return new Pm(e)}function Py(e){return e[0]}function Pg(e){return e[1]}function Pv(e,t){var r=fY(!0),n=null,i=Px,a=null,s=O2(o);function o(o){var l,c,u,d=(o=fH(o)).length,h=!1;for(null==n&&(a=i(u=s())),l=0;l<=d;++l)!(l<d&&r(c=o[l],l,o))===h&&((h=!h)?a.lineStart():a.lineEnd()),h&&a.point(+e(c,l,o),+t(c,l,o));if(u)return a=null,u+""||null}return e="function"==typeof e?e:void 0===e?Py:fY(e),t="function"==typeof t?t:void 0===t?Pg:fY(t),o.x=function(t){return arguments.length?(e="function"==typeof t?t:fY(+t),o):e},o.y=function(e){return arguments.length?(t="function"==typeof e?e:fY(+e),o):t},o.defined=function(e){return arguments.length?(r="function"==typeof e?e:fY(!!e),o):r},o.curve=function(e){return arguments.length?(i=e,null!=n&&(a=i(n)),o):i},o.context=function(e){return arguments.length?(null==e?n=a=null:a=i(n=e),o):n},o}function Pb(e,t,r){var n=null,i=fY(!0),a=null,s=Px,o=null,l=O2(c);function c(c){var u,d,h,p,f,m=(c=fH(c)).length,x=!1,y=Array(m),g=Array(m);for(null==a&&(o=s(f=l())),u=0;u<=m;++u){if(!(u<m&&i(p=c[u],u,c))===x)if(x=!x)d=u,o.areaStart(),o.lineStart();else{for(o.lineEnd(),o.lineStart(),h=u-1;h>=d;--h)o.point(y[h],g[h]);o.lineEnd(),o.areaEnd()}x&&(y[u]=+e(p,u,c),g[u]=+t(p,u,c),o.point(n?+n(p,u,c):y[u],r?+r(p,u,c):g[u]))}if(f)return o=null,f+""||null}function u(){return Pv().defined(i).curve(s).context(a)}return e="function"==typeof e?e:void 0===e?Py:fY(+e),t="function"==typeof t?t:void 0===t?fY(0):fY(+t),r="function"==typeof r?r:void 0===r?Pg:fY(+r),c.x=function(t){return arguments.length?(e="function"==typeof t?t:fY(+t),n=null,c):e},c.x0=function(t){return arguments.length?(e="function"==typeof t?t:fY(+t),c):e},c.x1=function(e){return arguments.length?(n=null==e?null:"function"==typeof e?e:fY(+e),c):n},c.y=function(e){return arguments.length?(t="function"==typeof e?e:fY(+e),r=null,c):t},c.y0=function(e){return arguments.length?(t="function"==typeof e?e:fY(+e),c):t},c.y1=function(e){return arguments.length?(r=null==e?null:"function"==typeof e?e:fY(+e),c):r},c.lineX0=c.lineY0=function(){return u().x(e).y(t)},c.lineY1=function(){return u().x(e).y(r)},c.lineX1=function(){return u().x(n).y(t)},c.defined=function(e){return arguments.length?(i="function"==typeof e?e:fY(!!e),c):i},c.curve=function(e){return arguments.length?(s=e,null!=a&&(o=s(a)),c):s},c.context=function(e){return arguments.length?(null==e?a=o=null:o=s(a=e),c):a},c}function Pj(){}function Pw(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 PN(e){this._context=e}function Pk(e){this._context=e}function PS(e){this._context=e}Pf.registerSymbol=(e,t)=>{Ph["symbol".concat(py(e))]=t},Pm.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)}}},PN.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:Pw(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:Pw(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}},Pk.prototype={areaStart:Pj,areaEnd:Pj,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:Pw(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}},PS.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:Pw(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};class PO{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 PP(e){this._context=e}PP.prototype={areaStart:Pj,areaEnd:Pj,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 PC(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 PE(e,t){var r=e._x1-e._x0;return r?(3*(e._y1-e._y0)/r-t)/2:t}function PM(e,t,r){var n=e._x0,i=e._y0,a=e._x1,s=e._y1,o=(a-n)/3;e._context.bezierCurveTo(n+o,i+o*t,a-o,s-o*r,a,s)}function PA(e){this._context=e}function PT(e){this._context=new P_(e)}function P_(e){this._context=e}function PD(e){this._context=e}function PI(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 PL(e,t){this._context=e,this._t=t}function Pz(){return(Pz=Object.assign.bind()).apply(null,arguments)}function PR(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 PF(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?PR(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)):PR(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}PA.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:PM(this,this._t0,PE(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,PM(this,PE(this,r=PC(this,e,t)),r);break;default:PM(this,this._t0,r=PC(this,e,t))}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=r}}},(PT.prototype=Object.create(PA.prototype)).point=function(e,t){PA.prototype.point.call(this,t,e)},P_.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)}},PD.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=PI(e),i=PI(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)}},PL.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 P$={curveBasisClosed:function(e){return new Pk(e)},curveBasisOpen:function(e){return new PS(e)},curveBasis:function(e){return new PN(e)},curveBumpX:function(e){return new PO(e,!0)},curveBumpY:function(e){return new PO(e,!1)},curveLinearClosed:function(e){return new PP(e)},curveLinear:Px,curveMonotoneX:function(e){return new PA(e)},curveMonotoneY:function(e){return new PT(e)},curveNatural:function(e){return new PD(e)},curveStep:function(e){return new PL(e,.5)},curveStepAfter:function(e){return new PL(e,1)},curveStepBefore:function(e){return new PL(e,0)}},PB=e=>f0(e.x)&&f0(e.y),PU=e=>null!=e.base&&PB(e.base)&&PB(e),PV=e=>e.x,Pq=e=>e.y,PK=e=>{var{className:t,points:r,path:n,pathRef:i}=e,a=fq(mF);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},o=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(py(e));if(("curveMonotone"===r||"curveBump"===r)&&t){var n=P$["".concat(r).concat("vertical"===t?"Y":"X")];if(n)return n}return P$[r]||Px})(t,i),o=a?r.filter(PB):r;if(Array.isArray(n)){var l=r.map((e,t)=>PF(PF({},e),{},{base:n[t]}));return("vertical"===i?Pb().y(Pq).x1(PV).x0(e=>e.base.x):Pb().x(PV).y1(Pq).y0(e=>e.base.y)).defined(PU).curve(s)(a?l.filter(PU):l)}return("vertical"===i&&pu(n)?Pb().y(Pq).x1(PV).x0(n):pu(n)?Pb().x(PV).y1(Pq).y0(n):Pv().x(PV).y(Pq)).defined(PB).curve(s)(o)})(s):n;return H.createElement("path",Pz({},kf(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=>{ku(e)&&(n[e]=t||(t=>r[e](r,t)))}),n})(e),{className:sl("recharts-curve",t),d:null===o?void 0:o,ref:i}))},PW=["option","shapeType","activeClassName"];function PH(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?PH(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)):PH(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function PQ(e){var{shapeType:t,elementProps:r}=e;switch(t){case"rectangle":return H.createElement(Oz,r);case"trapezoid":return H.createElement(Oq,r);case"sector":return H.createElement(OX,r);case"symbols":if("symbols"===t)return H.createElement(Pf,r);break;case"curve":return H.createElement(PK,r);default:return null}}function PX(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,PW);if((0,H.isValidElement)(r))t=(0,H.cloneElement)(r,PY(PY({},a),(0,H.isValidElement)(r)?r.props:r));else if("function"==typeof r)t=r(a,a.index);else if((0,Oa.default)(r)&&"boolean"!=typeof r){var s=PY(PY({},a),r);t=H.createElement(PQ,{shapeType:n,elementProps:s})}else t=H.createElement(PQ,{shapeType:n,elementProps:a});return a.isActive?H.createElement(Se,{className:i},t):t}function PG(){return(PG=Object.assign.bind()).apply(null,arguments)}function PZ(e){return H.createElement(PX,PG({shapeType:"rectangle",activeClassName:"recharts-active-bar"},e))}var PJ=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(r,n)=>{if(pu(e))return e;var i=pu(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)}},P0=(e,t,r)=>{var n=f$();return(i,a)=>s=>{null==e||e(i,a,s),n(fy({activeIndex:String(a),activeDataKey:t,activeCoordinate:i.tooltipPosition,activeGraphicalItemId:r}))}},P1=e=>{var t=f$();return(r,n)=>i=>{null==e||e(r,n,i),t(fg())}},P2=(e,t,r)=>{var n=f$();return(i,a)=>s=>{null==e||e(i,a,s),n(fb({activeIndex:String(a),activeDataKey:t,activeCoordinate:i.tooltipPosition,activeGraphicalItemId:r}))}};function P5(e){var{tooltipEntrySettings:t}=e,r=f$(),n=mm(),i=(0,H.useRef)(null);return(0,H.useLayoutEffect)(()=>{n||(null===i.current?r(fp(t)):i.current!==t&&r(ff({prev:i.current,next:t})),i.current=t)},[t,r,n]),(0,H.useLayoutEffect)(()=>()=>{i.current&&(r(fm(i.current)),i.current=null)},[r]),null}var P4=["children"],P3=(0,H.createContext)({data:[],xAxisId:"xAxis-0",yAxisId:"yAxis-0",dataPointFormatter:()=>({x:0,y:0,value:0}),errorBarOffset:0});function P6(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,P4);return H.createElement(P3.Provider,{value:r},t)}function P8(e,t){var r,n,i=fq(t=>v2(t,e)),a=fq(e=>v3(e,t)),s=null!=(r=null==i?void 0:i.allowDataOverflow)?r:v0.allowDataOverflow,o=null!=(n=null==a?void 0:a.allowDataOverflow)?n:v5.allowDataOverflow;return{needClip:s||o,needClipX:s,needClipY:o}}function P7(e){var{xAxisId:t,yAxisId:r,clipPathId:n}=e,i=fq(kQ),{needClipX:a,needClipY:s,needClip:o}=P8(t,r);if(!o||!i)return null;var{x:l,y:c,width:u,height:d}=i;return H.createElement("clipPath",{id:"clipPath-".concat(n)},H.createElement("rect",{x:a?l:l-u/2,y:s?c:c-d/2,width:a?u:2*u,height:s?d:2*d}))}var P9=(e,t,r)=>{var n=null!=r?r:e;if(null!=n)return pf(n,t,0)};function Ce(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 Ct(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ce(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)):Ce(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function Cr(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 Cn(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 Ci=hd([br,(e,t)=>t],(e,t)=>e.filter(e=>"bar"===e.type).find(e=>e.id===t)),Ca=hd([Ci],e=>null==e?void 0:e.maxBarSize),Cs=hd([mF,br,Cr,Cn,(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)),Co=hd([Cs,e=>e.rootProps.barSize,(e,t)=>{var r=mF(e),n=Cr(e,t),i=Cn(e,t);if(null!=n&&null!=i)return"horizontal"===r?jv(e,"xAxis",n):jv(e,"yAxis",i)}],(e,t,r)=>{var n=e.filter(vq),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:P9(t,r,null==(n=a[0])?void 0:n.barSize)}}),...i.map(e=>({stackId:void 0,dataKeys:[e.dataKey].filter(e=>null!=e),barSize:P9(t,r,e.barSize)}))]}),Cl=(e,t,r)=>{var n,i,a=mF(e),s=Cr(e,t),o=Cn(e,t);if(null!=s&&null!=o)return"horizontal"===a?(n=jO(e,"xAxis",s,r),i=jS(e,"xAxis",s,r)):(n=jO(e,"yAxis",o,r),i=jS(e,"yAxis",o,r)),me(n,i)},Cc=hd([Co,vu,e=>e.rootProps.barGap,vd,(e,t,r)=>{var n,i,a,s,o=Ci(e,t);if(null==o)return 0;var l=Cr(e,t),c=Cn(e,t);if(null==l||null==c)return 0;var u=mF(e),d=vu(e),{maxBarSize:h}=o;return"horizontal"===u?(a=jO(e,"xAxis",l,r),s=jS(e,"xAxis",l,r)):(a=jO(e,"yAxis",c,r),s=jS(e,"yAxis",c,r)),null!=(n=null!=(i=me(a,s,!0))?i:null==h?d:h)?n:0},Cl,Ca],(e,t,r,n,i,a,s)=>{var o=function(e,t,r,n,i){var a,s,o=n.length;if(!(o<1)){var l=pf(e,r,0,!0),c=[];if(f0(null==(a=n[0])?void 0:a.barSize)){var u=!1,d=r/o,h=n.reduce((e,t)=>e+(t.barSize||0),0);(h+=(o-1)*l)>=r&&(h-=(o-1)*l,l=0),h>=r&&d>0&&(u=!0,d*=.9,h=o*d);var p={offset:((r-h)/2|0)-l,size:0};s=n.reduce((e,t)=>{var r,n={stackId:t.stackId,dataKeys:t.dataKeys,position:{offset:p.offset+p.size+l,size:u?d:null!=(r=t.barSize)?r:0}},i=[...e,n];return p=n.position,i},c)}else{var f=pf(t,r,0,!0);r-2*f-(o-1)*l<=0&&(l=0);var m=(r-2*f-(o-1)*l)/o;m>1&&(m>>=0);var x=f0(i)?Math.min(m,i):m;s=n.reduce((e,t,r)=>[...e,{stackId:t.stackId,dataKeys:t.dataKeys,position:{offset:f+(m+l)*r+(m-x)/2,size:x}}],c)}return s}}(r,n,i!==a?i:a,e,null==s?t:s);return i!==a&&null!=o&&(o=o.map(e=>Ct(Ct({},e),{},{position:Ct(Ct({},e.position),{},{offset:e.position.offset-i/2})}))),o}),Cu=hd([Cc,Ci],(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}}),Cd=hd([(e,t,r)=>{var n=mF(e),i=Cr(e,t),a=Cn(e,t);if(null!=i&&null!=a)return"horizontal"===n?bN(e,"yAxis",a,r):bN(e,"xAxis",i,r)},Ci],(e,t)=>{var r=vU(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)}}}),Ch=hd([md,mp,(e,t,r)=>{var n=Cr(e,t);if(null!=n)return jO(e,"xAxis",n,r)},(e,t,r)=>{var n=Cn(e,t);if(null!=n)return jO(e,"yAxis",n,r)},(e,t,r)=>{var n=Cr(e,t);if(null!=n)return jS(e,"xAxis",n,r)},(e,t,r)=>{var n=Cn(e,t);if(null!=n)return jS(e,"yAxis",n,r)},Cu,mF,(e,t,r)=>r?g8(e):g6(e),Cl,Cd,Ci,(e,t,r,n)=>n],(e,t,r,n,i,a,s,o,l,c,u,d,h)=>{var p,{chartData:f,dataStartIndex:m,dataEndIndex:x}=l;if(null!=d&&null!=s&&null!=t&&("horizontal"===o||"vertical"===o)&&null!=r&&null!=n&&null!=i&&null!=a&&null!=c){var{data:y}=d;if(null!=(p=null!=y&&y.length>0?y:null==f?void 0:f.slice(m,x+1)))return function(e){var{layout:t,barSettings:{dataKey:r,minPointSize:n},pos:i,bandSize:a,xAxis:s,yAxis:o,xAxisTicks:l,yAxisTicks:c,stackedData:u,displayedData:d,offset:h,cells:p,parentViewBox:f,dataStartIndex:m}=e,x="horizontal"===t?o:s,y=u?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 d.map((e,d)=>{if(u){var x=u[d+m];if(null==x)return null;j=((e,t)=>{if(!t||2!==t.length||!pu(t[0])||!pu(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(!pu(e[0])||e[0]<r)&&(i[0]=r),(!pu(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=f4(e,r))||(j=[g,j]);var b=PJ(n,0)(j[1],d);if("horizontal"===t){var j,w,N,k,S,O,P,C=o.scale.map(j[0]),E=o.scale.map(j[1]);if(null==C||null==E)return null;w=f8({axis:s,ticks:l,bandSize:a,offset:i.offset,entry:e,index:d}),N=null!=(P=null!=E?E:C)?P:void 0,k=i.size;var M=C-E;if(S=pl(M)?0:M,O={x:w,y:h.top,width:k,height:h.height},Math.abs(b)>0&&Math.abs(S)<Math.abs(b)){var A=po(S||b)*(Math.abs(b)-Math.abs(S));N-=A,S+=A}}else{var T=s.scale.map(j[0]),_=s.scale.map(j[1]);if(null==T||null==_)return null;if(w=T,N=f8({axis:o,ticks:c,bandSize:a,offset:i.offset,entry:e,index:d}),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=po(k||b)*(Math.abs(b)-Math.abs(k));k+=D}}return null==w||null==N||null==k||null==S?null:CD(CD({},e),{},{stackedBarStart:v,x:w,y:N,width:k,height:S,value:u?j:j[1],payload:e,background:O,tooltipPosition:{x:w+k/2,y:N+S/2},parentViewBox:f},p&&p[d]&&p[d].props)}).filter(Boolean)}({layout:o,barSettings:d,pos:s,parentViewBox:t,bandSize:c,xAxis:r,yAxis:n,xAxisTicks:i,yAxisTicks:a,stackedData:u,displayedData:p,offset:e,cells:h,dataStartIndex:m})}});function Cp(e){var{legendPayload:t}=e,r=f$(),n=mm(),i=(0,H.useRef)(null);return(0,H.useLayoutEffect)(()=>{n||(null===i.current?r(Nw(t)):i.current!==t&&r(NN({prev:i.current,next:t})),i.current=t)},[r,n,t]),(0,H.useLayoutEffect)(()=>()=>{i.current&&(r(Nk(i.current)),i.current=null)},[r]),null}var Cf=null!=(K=H["useId".toString()])?K:()=>{var[e]=H.useState(()=>pp("uid-"));return e},Cm=(0,H.createContext)(void 0),Cx=e=>{var t,r,n,{id:i,type:a,children:s}=e,o=(t="recharts-".concat(a),r=i,n=Cf(),r||(t?"".concat(t,"-").concat(n):n));return H.createElement(Cm.Provider,{value:o},s(o))},Cy=(0,H.memo)(e=>{var t=f$(),r=(0,H.useRef)(null);return(0,H.useLayoutEffect)(()=>{null===r.current?t(Nt(e)):r.current!==e&&t(Nr({prev:r.current,next:e})),r.current=e},[t,e]),(0,H.useLayoutEffect)(()=>()=>{r.current&&(t(Nn(r.current)),r.current=null)},[t]),null}),Cg=(e,t)=>t,Cv=(e,t,r)=>r,Cb=hd([Cg,br,Cv],(e,t,r)=>t.filter(e=>"bar"===e.type).filter(t=>t.stackId===e).filter(e=>e.isPanorama===r).filter(e=>!e.hide)),Cj=hd([Cb],e=>e.map(e=>e.id)),Cw=hd([e=>e,Cg,Cv],(e,t,r)=>{var n=Cj(e,t,r),i=[];return n.forEach(t=>{var n=Ch(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}),CN=["index"];function Ck(){return(Ck=Object.assign.bind()).apply(null,arguments)}var CS=(0,H.createContext)(void 0),CO=(e,t)=>"recharts-bar-stack-clip-path-".concat(e,"-").concat(t),CP=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,CN),n=(e=>{var t=(0,H.useContext)(CS);if(null!=t){var{stackId:r}=t;return"url(#".concat(CO(r,e),")")}})(t);return H.createElement(Se,Ck({className:"recharts-bar-stack-layer",clipPath:n},r))},CC=["onMouseEnter","onMouseLeave","onClick"],CE=["value","background","tooltipPosition"],CM=["id"],CA=["onMouseEnter","onClick","onMouseLeave"];function CT(){return(CT=Object.assign.bind()).apply(null,arguments)}function C_(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 CD(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?C_(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)):C_(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function CI(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 CL=k8.memo(e=>{var{dataKey:t,stroke:r,strokeWidth:n,fill:i,name:a,hide:s,unit:o,tooltipType:l,id:c}=e,u={dataDefinedOnItem:void 0,getPosition:pv,settings:{stroke:r,strokeWidth:n,fill:i,dataKey:t,nameKey:void 0,name:mr(a,t),hide:s,type:l,color:i,unit:o,graphicalItemId:c}};return k8.createElement(P5,{tooltipEntrySettings:u})});function Cz(e){var t,r=fq(wv),{data:n,dataKey:i,background:a,allOtherBarProps:s}=e,{onMouseEnter:o,onMouseLeave:l,onClick:c}=s,u=CI(s,CC),d=P0(o,i,s.id),h=P1(l),p=P2(c,i,s.id);if(!a||null==n)return null;var f=km(a);return k8.createElement(SD,{zIndex:(t=vw.barBackground,a&&"object"==typeof a&&"zIndex"in a&&"number"==typeof a.zIndex&&f0(a.zIndex)?a.zIndex:t)},n.map((e,t)=>{var{value:n,background:s,tooltipPosition:o}=e,l=CI(e,CE);if(!s)return null;var c=d(e,t),m=h(e,t),x=p(e,t),y=CD(CD(CD(CD(CD({option:a,isActive:String(t)===r},l),{},{fill:"#eee"},s),f),Oi(u,e,t)),{},{onMouseEnter:c,onMouseLeave:m,onClick:x,dataKey:i,index:t,className:"recharts-bar-background-rectangle"});return k8.createElement(PZ,CT({key:"background-bar-".concat(t)},y))}))}function CR(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 CD(CD({},t),{},{value:e.value,payload:e.payload,parentViewBox:e.parentViewBox,viewBox:t,fill:e.fill})});return k8.createElement(S4,{value:t?i:void 0},r)}function CF(e){var{shape:t,activeBar:r,baseProps:n,entry:i,index:a,dataKey:s}=e,o=fq(wv),l=fq(wj),c=r&&String(a)===o&&(null==l||s===l),u=c?r:t;return c?k8.createElement(SD,{zIndex:vw.activeBar},k8.createElement(CP,{index:a},k8.createElement(PZ,CT({},n,{name:String(n.name)},i,{isActive:c,option:u,index:a,dataKey:s})))):k8.createElement(PZ,CT({},n,{name:String(n.name)},i,{isActive:c,option:u,index:a,dataKey:s}))}function C$(e){var{shape:t,baseProps:r,entry:n,index:i,dataKey:a}=e;return k8.createElement(PZ,CT({},r,{name:String(r.name)},n,{isActive:!1,option:t,index:i,dataKey:a}))}function CB(e){var t,{data:r,props:n}=e,i=null!=(t=kf(n))?t:{},{id:a}=i,s=CI(i,CM),{shape:o,dataKey:l,activeBar:c}=n,{onMouseEnter:u,onClick:d,onMouseLeave:h}=n,p=CI(n,CA),f=P0(u,l,a),m=P1(h),x=P2(d,l,a);return r?k8.createElement(k8.Fragment,null,r.map((e,t)=>k8.createElement(CP,CT({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"},Oi(p,e,t),{onMouseEnter:f(e,t),onMouseLeave:m(e,t),onClick:x(e,t)}),c?k8.createElement(CF,{shape:o,activeBar:c,baseProps:s,entry:e,index:t,dataKey:l}):k8.createElement(C$,{shape:o,baseProps:s,entry:e,index:t,dataKey:l})))):null}function CU(e){var{props:t,previousRectanglesRef:r}=e,{data:n,layout:i,isAnimationActive:a,animationBegin:s,animationDuration:o,animationEasing:l,onAnimationEnd:c,onAnimationStart:u}=t,d=r.current,h=OP(t,"recharts-bar-"),[p,f]=(0,k8.useState)(!1),m=(0,k8.useCallback)(()=>{"function"==typeof c&&c(),f(!1)},[c]),x=(0,k8.useCallback)(()=>{"function"==typeof u&&u(),f(!0)},[u]);return k8.createElement(CR,{showLabels:!p,rects:n},k8.createElement(OO,{animationId:h,begin:s,duration:o,isActive:a,easing:l,onAnimationEnd:m,onAnimationStart:x,key:h},e=>{var a=1===e?n:null==n?void 0:n.map((t,r)=>{var n=d&&d[r];if(n)return CD(CD({},t),{},{x:px(n.x,t.x,e),y:px(n.y,t.y,e),width:px(n.width,t.width,e),height:px(n.height,t.height,e)});if("horizontal"===i){var a=px(0,t.height,e),s=px(t.stackedBarStart,t.y,e);return CD(CD({},t),{},{y:s,height:a})}var o=px(0,t.width,e),l=px(t.stackedBarStart,t.x,e);return CD(CD({},t),{},{width:o,x:l})});return(e>0&&(r.current=null!=a?a:null),null==a)?null:k8.createElement(Se,null,k8.createElement(CB,{props:t,data:a}))}),k8.createElement(S8,{label:t.label}),t.children)}function CV(e){var t=(0,k8.useRef)(null);return k8.createElement(CU,{previousRectanglesRef:t,props:e})}var Cq=(e,t)=>{var r=Array.isArray(e.value)?e.value[1]:e.value;return{x:e.x,y:e.y,value:r,errorVal:f4(e,t)}};class CK extends k8.PureComponent{render(){var{hide:e,data:t,dataKey:r,className:n,xAxisId:i,yAxisId:a,needClip:s,background:o,id:l}=this.props;if(e||null==t)return null;var c=sl("recharts-bar",n);return k8.createElement(Se,{className:c,id:l},s&&k8.createElement("defs",null,k8.createElement(P7,{clipPathId:l,xAxisId:i,yAxisId:a})),k8.createElement(Se,{className:"recharts-bar-rectangles",clipPath:s?"url(#clipPath-".concat(l,")"):void 0},k8.createElement(Cz,{data:t,dataKey:r,background:o,allOtherBarProps:this.props}),k8.createElement(CV,this.props)))}}var CW={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:vw.bar};function CH(e){var t,r,n,i,{xAxisId:a,yAxisId:s,hide:o,legendType:l,minPointSize:c,activeBar:u,animationBegin:d,animationDuration:h,animationEasing:p,isAnimationActive:f}=e,{needClip:m}=P8(a,s),x=fq(mF),y=mm(),g=(t=e.children,r=[],n=[],n=Array.isArray(St)?St.map(e=>S9(e)):[S9(St)],Or(t).forEach(e=>{var t=(0,pi.default)(e,"type.displayName")||(0,pi.default)(e,"type.name");t&&-1!==n.indexOf(t)&&r.push(e)}),r),v=fq(t=>Ch(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,k8.createElement(P6,{xAxisId:a,yAxisId:s,data:v,dataPointFormatter:Cq,errorBarOffset:i},k8.createElement(CK,CT({},e,{layout:x,needClip:m,data:v,xAxisId:a,yAxisId:s,hide:o,legendType:l,minPointSize:c,activeBar:u,animationBegin:d,animationDuration:h,animationEasing:p,isAnimationActive:f})))}var CY=k8.memo(function(e){var t,r,n,i=k1(e,CW),a=(r=i.stackId,null!=(n=(0,H.useContext)(CS))?n.stackId:null!=r?null==(t=r)?void 0:String(t):void 0),s=mm();return k8.createElement(Cx,{id:i.id,type:"bar"},e=>k8.createElement(k8.Fragment,null,k8.createElement(Cp,{legendPayload:(e=>{var{dataKey:t,name:r,fill:n,legendType:i,hide:a}=e;return[{inactive:a,dataKey:t,type:i,color:n,value:mr(r,t),payload:e}]})(i)}),k8.createElement(CL,{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}),k8.createElement(Cy,{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}),k8.createElement(SD,{zIndex:i.zIndex},k8.createElement(CH,CT({},i,{id:e})))))},ka);CY.displayName="Bar";var CQ=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 CX(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 CG(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 CZ(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 CJ(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?CZ(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)):CZ(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var C0=["axisLine","width","height","className","hide","ticks","axisType"];function C1(){return(C1=Object.assign.bind()).apply(null,arguments)}function C2(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 C5(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?C2(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)):C2(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var C4={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:vw.axis};function C3(e){var{x:t,y:r,width:n,height:i,orientation:a,mirror:s,axisLine:o,otherSvgProps:l}=e;if(!o)return null;var c=C5(C5(C5({},l),kf(o)),{},{fill:"none"});if("top"===a||"bottom"===a){var u=+("top"===a&&!s||"bottom"===a&&s);c=C5(C5({},c),{},{x1:t,y1:r+u*i,x2:t+n,y2:r+u*i})}else{var d=+("left"===a&&!s||"right"===a&&s);c=C5(C5({},c),{},{x1:t+d*n,y1:r,x2:t+d*n,y2:r+i})}return H.createElement("line",C1({},c,{className:sl("recharts-cartesian-axis-line",(0,pi.default)(o,"className"))}))}function C6(e){var t,{option:r,tickProps:n,value:i}=e,a=sl(n.className,"recharts-cartesian-axis-tick-value");if(H.isValidElement(r))t=H.cloneElement(r,C5(C5({},n),{},{className:a}));else if("function"==typeof r)t=r(C5(C5({},n),{},{className:a}));else{var s="recharts-cartesian-axis-tick-value";"boolean"!=typeof r&&(s=sl(s,r&&"object"==typeof r&&"className"in r&&"string"==typeof r.className?r.className:"")),t=H.createElement(ST,C1({},n,{className:s}),i)}return t}var C8=(0,H.forwardRef)((e,t)=>{var{ticks:r=[],tick:n,tickLine:i,stroke:a,tickFormatter:s,unit:o,padding:l,tickTextProps:c,orientation:u,mirror:d,x:h,y:p,width:f,height:m,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:o,orientation:l,interval:c,tickFormatter:u,unit:d,angle:h}=e;if(!a||!a.length||!i)return[];if(pu(c)||N0.isSsr)return null!=(n=CX(a,(pu(c)?c:0)+1))?n:[];var p="top"===l||"bottom"===l?"width":"height",f=d&&"width"===p?Sc(d,{fontSize:t,letterSpacing:r}):{width:0,height:0},m=(e,n)=>{var i,a="function"==typeof u?u(e.value,n):e.value;return"width"===p?(i=Sc(a,{fontSize:t,letterSpacing:r}),CQ({width:i.width+f.width,height:i.height+f.height},h)):Sc(a,{fontSize:t,letterSpacing:r})[p]},x=a[0],y=a[1],g=a.length>=2&&null!=x&&null!=y?po(y.coordinate-x.coordinate):1,v=function(e,t,r){var n="width"===r,{x:i,y:a,width:s,height:o}=e;return 1===t?{start:n?i:a,end:n?i+s:a+o}:{start:n?i+s:a+o,end:n?i:a}}(s,g,p);return"equidistantPreserveStart"===c?function(e,t,r,n,i){for(var a,s=(n||[]).slice(),{start:o,end:l}=t,c=0,u=1,d=o;u<=s.length;)if(a=function(){var t,a=null==n?void 0:n[c];if(void 0===a)return{v:CX(n,u)};var s=c,h=()=>(void 0===t&&(t=r(a,s)),t),p=a.coordinate,f=0===c||CG(e,p,h,d,l);f||(c=0,d=o,u+=1),f&&(d=p+e*(h()/2+i),c+=u)}())return a.v;return[]}(g,v,m,a,o):"equidistantPreserveEnd"===c?function(e,t,r,n,i){var a=(n||[]).slice().length;if(0===a)return[];for(var{start:s,end:o}=t,l=1;l<=a;l++){for(var c,u=(a-1)%l,d=s,h=!0,p=u;p<a&&(0===(c=function(){var t,a=n[p];if(null==a)return 0;var s=p,l=()=>(void 0===t&&(t=r(a,s)),t),c=a.coordinate,f=p===u||CG(e,c,l,d,o);if(!f)return h=!1,1;f&&(d=c+e*(l()/2+i))}())||1!==c);p+=l);if(h){for(var f=[],m=u;m<a;m+=l){var x=n[m];null!=x&&f.push(x)}return f}}return[]}(g,v,m,a,o):("preserveStart"===c||"preserveStartEnd"===c?function(e,t,r,n,i,a){var s=(n||[]).slice(),o=s.length,{start:l,end:c}=t;if(a){var u=n[o-1];if(null!=u){var d=r(u,o-1),h=e*(u.coordinate+e*d/2-c);s[o-1]=u=CJ(CJ({},u),{},{tickCoord:h>0?u.coordinate-h*e:u.coordinate}),null!=u.tickCoord&&CG(e,u.tickCoord,()=>d,l,c)&&(c=u.tickCoord-e*(d/2+i),s[o-1]=CJ(CJ({},u),{},{isShow:!0}))}}for(var p=a?o-1:o,f=function(t){var n,a=s[t];if(null==a)return 1;var o=a,u=()=>(void 0===n&&(n=r(a,t)),n);if(0===t){var d=e*(o.coordinate-e*u()/2-l);s[t]=o=CJ(CJ({},o),{},{tickCoord:d<0?o.coordinate-d*e:o.coordinate})}else s[t]=o=CJ(CJ({},o),{},{tickCoord:o.coordinate});null!=o.tickCoord&&CG(e,o.tickCoord,u,l,c)&&(l=o.tickCoord+e*(u()/2+i),s[t]=CJ(CJ({},o),{},{isShow:!0}))},m=0;m<p;m++)if(f(m))continue;return s}(g,v,m,a,o,"preserveStartEnd"===c):function(e,t,r,n,i){for(var a=(n||[]).slice(),s=a.length,{start:o}=t,{end:l}=t,c=function(t){var n,c=a[t];if(null==c)return 1;var u=c,d=()=>(void 0===n&&(n=r(c,t)),n);if(t===s-1){var h=e*(u.coordinate+e*d()/2-l);a[t]=u=CJ(CJ({},u),{},{tickCoord:h>0?u.coordinate-h*e:u.coordinate})}else a[t]=u=CJ(CJ({},u),{},{tickCoord:u.coordinate});null!=u.tickCoord&&CG(e,u.tickCoord,d,o,l)&&(l=u.tickCoord-e*(d()/2+i),a[t]=CJ(CJ({},u),{},{isShow:!0}))},u=s-1;u>=0;u--)if(c(u))continue;return a}(g,v,m,a,o)).filter(e=>e.isShow)}(C5(C5({},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"}}(u,d),S=function(e,t){switch(e){case"left":case"right":return"middle";case"top":return t?"start":"end";default:return t?"end":"start"}}(u,d),O=kf(b),P=km(n),C={};"object"==typeof i&&(C=i);var E=C5(C5({},O),{},{fill:"none"},C),M=N.map(e=>C5({entry:e},function(e,t,r,n,i,a,s,o,l){var c,u,d,h,p,f,m=o?-1:1,x=e.tickSize||s,y=pu(e.tickCoord)?e.tickCoord:e.coordinate;switch(a){case"top":c=u=e.coordinate,f=(d=(h=r+!o*i)-m*x)-m*l,p=y;break;case"left":d=h=e.coordinate,p=(c=(u=t+!o*n)-m*x)-m*l,f=y;break;case"right":d=h=e.coordinate,p=(c=(u=t+o*n)+m*x)+m*l,f=y;break;default:c=u=e.coordinate,f=(d=(h=r+o*i)+m*x)+m*l,p=y}return{line:{x1:c,y1:d,x2:u,y2:h},tick:{x:p,y:f}}}(e,h,p,f,m,u,x,d,y))),A=M.map(e=>{var{entry:t,line:r}=e;return H.createElement(Se,{className:"recharts-cartesian-axis-tick",key:"tick-".concat(t.value,"-").concat(t.coordinate,"-").concat(t.tickCoord)},i&&H.createElement("line",C1({},E,r,{className:sl("recharts-cartesian-axis-tick-line",(0,pi.default)(i,"className"))})))}),T=M.map((e,t)=>{var r,i,{entry:u,tick:d}=e,h=C5(C5(C5(C5({verticalAnchor:S},O),{},{textAnchor:k,stroke:"none",fill:a},d),{},{index:t,payload:u,visibleTicksCount:N.length,tickFormatter:s,padding:l},c),{},{angle:null!=(r=null!=(i=null==c?void 0:c.angle)?i:O.angle)?r:0}),p=C5(C5({},h),P);return H.createElement(Se,C1({className:"recharts-cartesian-axis-tick-label",key:"tick-label-".concat(u.value,"-").concat(u.coordinate,"-").concat(u.tickCoord)},Oi(j,u,t)),n&&H.createElement(C6,{option:n,tickProps:p,value:"".concat("function"==typeof s?s(u.value,t):u.value).concat(o||"")}))});return H.createElement("g",{className:"recharts-cartesian-axis-ticks recharts-".concat(w,"-ticks")},T.length>0&&H.createElement(SD,{zIndex:vw.label},H.createElement("g",{className:"recharts-cartesian-axis-tick-labels recharts-".concat(w,"-tick-labels"),ref:t},T)),A.length>0&&H.createElement("g",{className:"recharts-cartesian-axis-tick-lines recharts-".concat(w,"-tick-lines")},A))}),C7=(0,H.forwardRef)((e,t)=>{var{axisLine:r,width:n,height:i,className:a,hide:s,ticks:o,axisType:l}=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,C0),[u,d]=(0,H.useState)(""),[h,p]=(0,H.useState)(""),f=(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 o=r?r.getBoundingClientRect().width:0;return Math.round(s+(i+a)+o+(r?n:0))}return 0})({ticks:f.current,label:null==(t=e.labelRef)?void 0:t.current,labelGapWithTick:5,tickSize:e.tickSize,tickMargin:e.tickMargin})}}));var m=(0,H.useCallback)(e=>{if(e){var t=e.getElementsByClassName("recharts-cartesian-axis-tick-value");f.current=t;var r=t[0];if(r){var n=window.getComputedStyle(r),i=n.fontSize,a=n.letterSpacing;(i!==u||a!==h)&&(d(i),p(a))}}},[u,h]);return s||null!=n&&n<=0||null!=i&&i<=0?null:H.createElement(SD,{zIndex:e.zIndex},H.createElement(Se,{className:sl("recharts-cartesian-axis",a)},H.createElement(C3,{x:e.x,y:e.y,width:n,height:i,orientation:e.orientation,mirror:e.mirror,axisLine:r,otherSvgProps:kf(e)}),H.createElement(C8,{ref:m,axisType:l,events:c,fontSize:u,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:o,unit:e.unit,width:e.width,x:e.x,y:e.y}),H.createElement(Sq,{x:e.x,y:e.y,width:e.width,height:e.height,lowerWidth:e.width,upperWidth:e.width},H.createElement(SG,{label:e.label,labelRef:e.labelRef}),e.children)))}),C9=H.forwardRef((e,t)=>{var r=k1(e,C4);return H.createElement(C7,C1({},r,{ref:t}))});C9.displayName="CartesianAxis";var Ee=["domain","range"],Et=["domain","range"];function Er(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 En(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 Ei(e,t){if(e===t)return!0;var{domain:r,range:n}=e,i=Er(e,Ee),{domain:a,range:s}=t,o=Er(t,Et);return!!En(r,a)&&!!En(n,s)&&ka(i,o)}var Ea=["type"],Es=["dangerouslySetInnerHTML","ticks","scale"],Eo=["id","scale"];function El(){return(El=Object.assign.bind()).apply(null,arguments)}function Ec(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 Eu(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ec(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)):Ec(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function Ed(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 Eh(e){var t=f$(),r=(0,H.useRef)(null),n=m$(),{type:i}=e,a=Ed(e,Ea),s=vO(n,"xAxis",i),o=(0,H.useMemo)(()=>{if(null!=s)return Eu(Eu({},a),{},{type:s})},[a,s]);return(0,H.useLayoutEffect)(()=>{null!=o&&(null===r.current?t(wJ(o)):r.current!==o&&t(w0({prev:r.current,next:o})),r.current=o)},[o,t]),(0,H.useLayoutEffect)(()=>()=>{r.current&&(t(w1(r.current)),r.current=null)},[t]),null}var Ep=e=>{var{xAxisId:t,className:r}=e,n=fq(mp),i=mm(),a="xAxis",s=fq(e=>jk(e,a,t,i)),o=fq(e=>jp(e,t)),l=fq(e=>jx(e,t)),c=fq(e=>v1(e,t));if(null==o||null==l||null==c)return null;var{dangerouslySetInnerHTML:u,ticks:d,scale:h}=e,p=Ed(e,Es),{id:f,scale:m}=c,x=Ed(c,Eo);return H.createElement(C9,El({},p,x,{x:l.x,y:l.y,width:o.width,height:o.height,className:sl("recharts-".concat(a," ").concat(a),r),viewBox:n,ticks:s,axisType:a}))},Ef={allowDataOverflow:v0.allowDataOverflow,allowDecimals:v0.allowDecimals,allowDuplicatedCategory:v0.allowDuplicatedCategory,angle:v0.angle,axisLine:C4.axisLine,height:v0.height,hide:!1,includeHidden:v0.includeHidden,interval:v0.interval,label:!1,minTickGap:v0.minTickGap,mirror:v0.mirror,orientation:v0.orientation,padding:v0.padding,reversed:v0.reversed,scale:v0.scale,tick:v0.tick,tickCount:v0.tickCount,tickLine:C4.tickLine,tickSize:C4.tickSize,type:v0.type,xAxisId:0},Em=H.memo(e=>{var t=k1(e,Ef);return H.createElement(H.Fragment,null,H.createElement(Eh,{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(Ep,t))},Ei);Em.displayName="XAxis";var Ex=["type"],Ey=["dangerouslySetInnerHTML","ticks","scale"],Eg=["id","scale"];function Ev(){return(Ev=Object.assign.bind()).apply(null,arguments)}function Eb(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 Ej(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Eb(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)):Eb(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function Ew(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 EN(e){var t=f$(),r=(0,H.useRef)(null),n=m$(),{type:i}=e,a=Ew(e,Ex),s=vO(n,"yAxis",i),o=(0,H.useMemo)(()=>{if(null!=s)return Ej(Ej({},a),{},{type:s})},[s,a]);return(0,H.useLayoutEffect)(()=>{null!=o&&(null===r.current?t(w2(o)):r.current!==o&&t(w5({prev:r.current,next:o})),r.current=o)},[o,t]),(0,H.useLayoutEffect)(()=>()=>{r.current&&(t(w4(r.current)),r.current=null)},[t]),null}function Ek(e){var{yAxisId:t,className:r,width:n,label:i}=e,a=(0,H.useRef)(null),s=(0,H.useRef)(null),o=fq(mp),l=mm(),c=f$(),u="yAxis",d=fq(e=>jg(e,t)),h=fq(e=>jy(e,t)),p=fq(e=>jk(e,u,t,l)),f=fq(e=>v4(e,t));if((0,H.useLayoutEffect)(()=>{if(!("auto"!==n||!d||SH(i)||(0,H.isValidElement)(i))&&null!=f){var e=a.current;if(e){var r=e.getCalculatedWidth();Math.round(d.width)!==Math.round(r)&&c(w7({id:t,width:r}))}}},[p,d,c,i,t,n,f]),null==d||null==h||null==f)return null;var{dangerouslySetInnerHTML:m,ticks:x,scale:y}=e,g=Ew(e,Ey),{id:v,scale:b}=f,j=Ew(f,Eg);return H.createElement(C9,Ev({},g,j,{ref:a,labelRef:s,x:h.x,y:h.y,tickTextProps:"auto"===n?{width:void 0}:{width:n},width:d.width,height:d.height,className:sl("recharts-".concat(u," ").concat(u),r),viewBox:o,ticks:p,axisType:u}))}var ES={allowDataOverflow:v5.allowDataOverflow,allowDecimals:v5.allowDecimals,allowDuplicatedCategory:v5.allowDuplicatedCategory,angle:v5.angle,axisLine:C4.axisLine,hide:!1,includeHidden:v5.includeHidden,interval:v5.interval,label:!1,minTickGap:v5.minTickGap,mirror:v5.mirror,orientation:v5.orientation,padding:v5.padding,reversed:v5.reversed,scale:v5.scale,tick:v5.tick,tickCount:v5.tickCount,tickLine:C4.tickLine,tickSize:C4.tickSize,type:v5.type,width:v5.width,yAxisId:0},EO=H.memo(e=>{var t=k1(e,ES);return H.createElement(H.Fragment,null,H.createElement(EN,{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(Ek,t))},Ei);function EP(){return(EP=Object.assign.bind()).apply(null,arguments)}function EC(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?EC(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)):EC(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function EM(e){return Array.isArray(e)&&pd(e[0])&&pd(e[1])?e.join(" ~ "):e}EO.displayName="YAxis";var EA={margin:0,padding:10,backgroundColor:"#fff",border:"1px solid #ccc",whiteSpace:"nowrap"},ET={display:"block",paddingTop:4,paddingBottom:4,color:"#000"},E_={},ED=e=>{var{separator:t=" : ",contentStyle:r,itemStyle:n,labelStyle:i=E_,payload:a,formatter:s,itemSorter:o,wrapperClassName:l,labelClassName:c,label:u,labelFormatter:d,accessibilityLayer:h=!1}=e,p=EE(EE({},EA),r),f=EE({margin:0},i),m=null!=u,x=m?u:"",y=sl("recharts-default-tooltip",l),g=sl("recharts-tooltip-label",c);return m&&d&&null!=a&&(x=d(u,a)),H.createElement("div",EP({className:y,style:p},h?{role:"status","aria-live":"assertive"}:{}),H.createElement("p",{className:g,style:f},H.isValidElement(x)?x:"".concat(x)),(()=>{if(a&&a.length){var e=(o?(0,fK.default)(a,o):a).map((e,r)=>{if("none"===e.type)return null;var i=e.formatter||s||EM,{value:o,name:l}=e,c=o,u=l,d=i(o,l,e,r,a);if(Array.isArray(d))[c,u]=d;else{if(null==d)return null;c=d}var h=EE(EE({},ET),{},{color:e.color||ET.color},n);return H.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(r),style:h},pd(u)?H.createElement("span",{className:"recharts-tooltip-item-name"},u):null,pd(u)?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})())},EI=H,EL="recharts-tooltip-wrapper",Ez={visibility:"hidden"};function ER(e){var{allowEscapeViewBox:t,coordinate:r,key:n,offset:i,position:a,reverseDirection:s,tooltipDimension:o,viewBox:l,viewBoxDimension:c}=e;if(a&&pu(a[n]))return a[n];var u=r[n]-o-(i>0?i:0),d=r[n]+i;if(t[n])return s[n]?u:d;var h=l[n];return null==h?0:s[n]?u<h?Math.max(d,h):Math.max(u,h):null==c?0:d+o>h+c?Math.max(u,h):Math.max(d,h)}function EF(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 E$(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?EF(Object(r),!0).forEach(function(t){EB(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):EF(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function EB(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 EU extends EI.PureComponent{constructor(){super(...arguments),EB(this,"state",{dismissed:!1,dismissedAtCoordinate:{x:0,y:0}}),EB(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:o,offset:l,position:c,reverseDirection:u,useTranslate3d:d,viewBox:h,wrapperStyle:p,lastBoundingBox:f,innerRef:m,hasPortalFromProps:x}=this.props,{cssClasses:y,cssProperties:g}=function(e){var t,r,n,{allowEscapeViewBox:i,coordinate:a,offsetTop:s,offsetLeft:o,position:l,reverseDirection:c,tooltipBox:u,useTranslate3d:d,viewBox:h}=e;return{cssProperties:t=u.height>0&&u.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=ER({allowEscapeViewBox:i,coordinate:a,key:"x",offset:o,position:l,reverseDirection:c,tooltipDimension:u.width,viewBox:h,viewBoxDimension:h.width}),translateY:n=ER({allowEscapeViewBox:i,coordinate:a,key:"y",offset:s,position:l,reverseDirection:c,tooltipDimension:u.height,viewBox:h,viewBoxDimension:h.height}),useTranslate3d:d}):Ez,cssClasses:function(e){var{coordinate:t,translateX:r,translateY:n}=e;return sl(EL,{["".concat(EL,"-right")]:pu(r)&&t&&pu(t.x)&&r>=t.x,["".concat(EL,"-left")]:pu(r)&&t&&pu(t.x)&&r<t.x,["".concat(EL,"-bottom")]:pu(n)&&t&&pu(t.y)&&n>=t.y,["".concat(EL,"-top")]:pu(n)&&t&&pu(t.y)&&n<t.y})}({translateX:r,translateY:n,coordinate:a})}}({allowEscapeViewBox:t,coordinate:a,offsetLeft:"number"==typeof l?l:l.x,offsetTop:"number"==typeof l?l:l.y,position:c,reverseDirection:u,tooltipBox:{height:f.height,width:f.width},useTranslate3d:d,viewBox:h}),v=x?{}:E$(E$({transition:o&&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=E$(E$({},v),{},{visibility:!this.state.dismissed&&e&&s?"visible":"hidden"},p);return EI.createElement("div",{xmlns:"http://www.w3.org/1999/xhtml",tabIndex:-1,className:y,style:b,ref:m},i)}}var EV=e.i(40559),Eq=["x","y","top","left","width","height","className"];function EK(){return(EK=Object.assign.bind()).apply(null,arguments)}function EW(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 EH=e=>{var{x:t=0,y:r=0,top:n=0,left:i=0,width:a=0,height:s=0,className:o}=e,l=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?EW(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)):EW(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,Eq));return pu(t)&&pu(r)&&pu(a)&&pu(s)&&pu(n)&&pu(i)?H.createElement("path",EK({},kx(l),{className:sl("recharts-cross",o),d:"M".concat(t,",").concat(n,"v").concat(s,"M").concat(i,",").concat(r,"h").concat(a)})):null};function EY(e){var{cx:t,cy:r,radius:n,startAngle:i,endAngle:a}=e;return{points:[vj(t,r,n,i),vj(t,r,n,a)],cx:t,cy:r,radius:n,startAngle:i,endAngle:a}}function EQ(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 EX(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?EQ(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)):EQ(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function EG(){return(EG=Object.assign.bind()).apply(null,arguments)}function EZ(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 EJ(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?EZ(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)):EZ(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function E0(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 E1(e){var t,r,n,i,a,{coordinate:s,payload:o,index:l,offset:c,tooltipAxisBandSize:u,layout:d,cursor:h,tooltipEventType:p,chartName:f}=e;if(!h||!s||"ScatterChart"!==f&&"axis"!==p)return null;if("ScatterChart"===f)n=s,i=EH,a=vw.cursorLine;else if("BarChart"===f)t=u/2,n={stroke:"none",fill:"#ccc",x:"horizontal"===d?s.x-t:c.left+.5,y:"horizontal"===d?c.top+.5:s.y-t,width:"horizontal"===d?u:c.width-1,height:"horizontal"===d?c.height-1:u},i=Oz,a=vw.cursorRectangle;else if("radial"===d&&On(s)){var{cx:m,cy:x,radius:y,startAngle:g,endAngle:v}=EY(s);n={cx:m,cy:x,startAngle:g,endAngle:v,innerRadius:y,outerRadius:y},i=OX,a=vw.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(On(t)){if("centric"===e){var{cx:n,cy:i,innerRadius:a,outerRadius:s,angle:o}=t,l=vj(n,i,a,o),c=vj(n,i,s,o);return[{x:l.x,y:l.y},{x:c.x,y:c.y}]}return EY(t)}}(d,s,c)},i=PK,a=vw.cursorLine;var b="object"==typeof h&&"className"in h?h.className:void 0,j=EJ(EJ(EJ(EJ({stroke:"#ccc",pointerEvents:"none"},c),n),km(h)),{},{payload:o,payloadIndex:l,className:sl("recharts-tooltip-cursor",b)});return H.createElement(SD,{zIndex:null!=(r=e.zIndex)?r:a},H.createElement(E0,{cursor:h,cursorComp:i,cursorProps:j}))}function E2(e){var t,r,n,i,a=(t=fq(bv),r=fq(wf),n=fq(wd),t&&n?me(EX(EX({},t),{},{scale:n}),r):me(void 0,r)),s=null!=(i=fq(md))?i:mR,o=fq(mF),l=fq(vf);return null==a||null==s||null==o||null==l?null:H.createElement(E1,EG({},e,{offset:s,layout:o,tooltipAxisBandSize:a,chartName:l}))}function E5(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 E4(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?E5(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)):E5(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function E3(e){return e.dataKey}var E6=[],E8={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 E7(e){var t,r,n,i,a,s,o,l,c,u,d,h=k1(e,E8),{active:p,allowEscapeViewBox:f,animationDuration:m,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:E,portal:M,axisId:A}=h,T=f$(),_="number"==typeof E?String(E):E;(0,H.useEffect)(()=>{T(fx({shared:P,trigger:C,axisId:A,active:p,defaultIndex:_}))},[T,P,C,A,p,_]);var D=mz(),I=kl(),L=fq(e=>jT(e,P)),{activeIndex:z,isActive:R}=null!=(u=fq(e=>wB(e,L,C,_)))?u:{},F=fq(e=>w$(e,L,C,_)),$=fq(e=>wF(e,L,C,_)),B=fq(e=>wR(e,L,C,_)),U=(0,H.useContext)(kz),V=null!=(d=null!=p?p:R)&&d,[q,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,V]),W="axis"===L?$:void 0;t=fq(e=>((e,t,r)=>{if(null!=t){var n=jB(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,L,C)),r=fq(vy),n=fq(vm),i=fq(vx),s=null==(a=fq(k_))?void 0:a.active,o=mz(),(0,H.useEffect)(()=>{if(!s&&null!=n&&null!=r){var e=fN({active:V,coordinate:B,dataKey:t,index:z,label:"number"==typeof W?String(W):W,sourceViewBox:o,graphicalItemId:void 0});kM.emit(kA,n,e,r)}},[s,B,t,z,W,r,n,i,V,o]);var Y=null!=M?M:U;if(null==Y||null==D||null==L)return null;var Q=null!=F?F:E6;V||(Q=E6),g&&Q.length&&(l=Q.filter(e=>null!=e.value&&(!0!==e.hide||h.includeHidden)),Q=!0===j?(0,EV.default)(l,E3):"function"==typeof j?(0,EV.default)(l,j):l);var X=Q.length>0,G=H.createElement(EU,{allowEscapeViewBox:f,animationDuration:m,animationEasing:x,isAnimationActive:v,active:V,coordinate:B,hasPayload:X,offset:b,position:w,reverseDirection:N,useTranslate3d:k,viewBox:D,wrapperStyle:S,lastBoundingBox:q,innerRef:K,hasPortalFromProps:!!M},(c=E4(E4({},h),{},{payload:Q,label:W,active:V,activeIndex:z,coordinate:B,accessibilityLayer:I}),H.isValidElement(y)?H.cloneElement(y,c):"function"==typeof y?H.createElement(y,c):H.createElement(ED,c)));return H.createElement(H.Fragment,null,(0,S_.createPortal)(G,Y),V&&H.createElement(E2,{cursor:O,tooltipEventType:L,coordinate:B,payload:Q,index:z}))}function E9({stats:e,onNavigate:t}){let r=(0,H.useMemo)(()=>Object.entries(e.byCategory).map(([e,t])=>({category:e,count:t,color:(0,oj.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)(mI,{width:"100%",height:36*r.length+20,children:(0,W.jsxs)(k6,{data:r,layout:"vertical",margin:{left:10,right:30},children:[(0,W.jsx)(Em,{type:"number",hide:!0}),(0,W.jsx)(EO,{type:"category",dataKey:"category",width:100,tick:{fill:"#94a3b8",fontSize:12},axisLine:!1,tickLine:!1}),(0,W.jsx)(E7,{contentStyle:{background:"#1e293b",border:"1px solid #334155",borderRadius:8},labelStyle:{color:"#e2e8f0"},itemStyle:{color:"#e2e8f0"}}),(0,W.jsx)(CY,{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)(St,{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 Me=(0,oN.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 Mt({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)(li,{size:14,className:"text-slate-400"}):(0,W.jsx)(ue.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 Mr({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)(Mt,{icon:lr,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)(Mt,{icon:o4,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)(Mt,{icon:Me,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)(Mt,{icon:oG,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 Mn({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 Mi({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)(oG,{size:16,className:"text-red-400 shrink-0"}):"warning"===e.tone?(0,W.jsx)(lw,{size:16,className:"text-amber-400 shrink-0"}):(0,W.jsx)(lg,{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)(lx,{size:12})]})]})]})})}function Ma({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 ${cn[a]} ${cr[a]}`,children:[(0,W.jsx)(l8,{size:10}),ct[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 ${ct[a]} workflow`:e.cta,(0,W.jsx)(lx,{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 Ms({stats:e,selectedProject:t}){let{setViewMode:r,setCategoryFilter:n,setTypeFilter:i,setSelectedMemory:a}=(0,sr.useDashboardStore)(),{data:s}=(0,o$.useAuditStats)("24h",t||void 0),{data:o}=(0,o$.useQuarantine)("pending",10,t||void 0),{data:l}=(0,st.useQuality)(t||void 0),{data:c}=(0,st.useContradictions)(t||void 0),{data:u}=oK(),d=e?.total??0,h=e?.decayDistribution?.healthy??0,p=e?.decayDistribution?.fading??0,f=e?.decayDistribution?.critical??0,m=e?.decayDistribution?Math.round(h/Math.max(1,d)*100):null,x=c?.count??c?.contradictions.length??0,y=o?.total??0,g=s?.blockedCount??0,v=l?.duplicates.count??0,b=l?.stale.count??0,j=l?.neverAccessed.count??0,w=(0,H.useMemo)(()=>Object.entries(e?.byCategory??{}).filter(([,e])=>e<3).sort((e,t)=>e[1]-t[1]),[e?.byCategory]),N=(0,H.useCallback)(e=>{a(null),r(e)},[a,r]),k=(0,H.useCallback)(e=>{n(e?.category??null),i(e?.type??null),a(null),r("memories")},[n,a,i,r]),S=(0,H.useMemo)(()=>{let e=[];if(y>0&&e.push({title:`${y} item${1===y?"":"s"} waiting in quarantine`,detail:"Review blocked or quarantined writes before they pile up into silent operator debt.",tone:y>10?"critical":"warning",cta:"Open review queue",onClick:()=>N("quarantine")}),x>0&&e.push({title:`${x} contradiction${1===x?"":"s"} in memory`,detail:"Conflicting facts reduce recall trust and are worth resolving before they become reinforced.",tone:x>5?"critical":"warning",cta:"Open review workflow",onClick:()=>N("review")}),(b>0||j>0||v>0)&&e.push({title:"Memory cleanup work is available",detail:`${b} stale, ${v} duplicate, ${j} never-accessed memories are reducing signal quality.`,tone:b+v>10?"warning":"healthy",cta:"Open review workflow",onClick:()=>N("review")}),w.length>0){let[t,r]=w[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:()=>k({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:()=>N("graph")}),e.slice(0,4)},[y,x,b,j,v,w,k,N]);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)(oQ,{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)(Mn,{label:"Memory Base",value:String(d),detail:`${e?.averageSalience?`${Math.round(100*e.averageSalience)}% avg salience`:"No salience data yet"}`}),(0,W.jsx)(Mn,{label:"Healthy",value:null===m?"—":`${m}%`,detail:`${h} healthy \xb7 ${p} fading \xb7 ${f} critical`,tone:null!==m&&m<50?"warning":"success"}),(0,W.jsx)(Mn,{label:"Queue",value:String(y),detail:"Pending quarantine review",tone:y>0?"warning":"success"}),(0,W.jsx)(Mn,{label:"Blocked",value:String(g),detail:"Blocked operations in the last 24h",tone:g>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:[S.length," active"]})]}),(0,W.jsx)("div",{className:"mt-4 grid grid-cols-1 gap-3",children:S.map(e=>(0,W.jsx)(Mi,{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:v}),(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:b}),(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:j}),(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:w.length>0?(0,W.jsxs)(W.Fragment,{children:["Thin categories:"," ",w.slice(0,3).map(([e,t])=>`${e} (${t})`).join(" · ")]}):"No obviously thin categories right now."}),(0,W.jsxs)("button",{onClick:()=>N("graph"),className:"mt-3 inline-flex items-center gap-1 text-xs font-medium text-cyan-300",children:["Open graph coverage",(0,W.jsx)(lx,{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:()=>N("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)(o0,{size:12}),"Open graph"]})]}),(0,W.jsx)("div",{className:"mt-4",children:e?(0,W.jsx)(E9,{stats:e,onNavigate:({category:e})=>k({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:()=>N("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)(oZ,{size:12}),"Open memories"]})]}),(0,W.jsx)("div",{className:"mt-4",children:(0,W.jsx)(Mr,{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)(l6.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:()=>N(e.target),className:"mt-3 inline-flex items-center gap-1 text-xs font-medium text-cyan-300",children:[e.cta,(0,W.jsx)(lx,{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)(o2,{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 ${cn[u?.tier??"free"]} ${cr[u?.tier??"free"]}`,children:ct[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)(Ma,{card:e,license:u,onOpen:N},e.title))})]})]})]})})}let Mo=[{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"}],Ml=[{keys:["/"],description:"Focus search input"},{keys:["Esc"],description:"Close panel / blur search"},{keys:["?"],description:"Toggle this help overlay"}];function Mc({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 Mu({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)(Mc,{children:e})]},t))})]})}function Md({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)(Mc,{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:Mo.map((e,t)=>(0,W.jsx)(Mu,{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:Ml.map((e,t)=>(0,W.jsx)(Mu,{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)(Mc,{children:"g"})," then a letter within 500ms"]})]})}):null}let Mh=(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..."})})}),Mp=(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 Mf(){let e,[t,r]=(0,H.useState)(""),[n,i]=(0,H.useState)(!1),[a,s]=(0,H.useState)(!1),o=(0,H.useRef)(null),l=(0,H.useRef)(null),c=sn(t,300),{viewMode:u,setViewMode:d,selectedMemory:h,setSelectedMemory:p,selectedAuditEntry:f,setSelectedAuditEntry:m,projectFilter:x,setProjectFilter:y,typeFilter:g,setTypeFilter:v,categoryFilter:b,setCategoryFilter:j,addEvent:w}=(0,sr.useDashboardStore)(),{showHelp:N,setShowHelp:k}=function(e){let{onFocusSearch:t,onClosePanel:r,onNavigate:n,onToggleHelp:i}=e,[a,s]=(0,H.useState)(!1),o=(0,H.useRef)(null),l=(0,H.useCallback)(e=>{let l=e.target,c=l.tagName.toLowerCase(),u="input"===c||"textarea"===c||"select"===c||l.isContentEditable;if("Escape"===e.key)return a?void s(!1):u?void l.blur():void r();if(u)return;if("/"===e.key){e.preventDefault(),t();return}if("?"===e.key){e.preventDefault(),s(e=>!e),i();return}let d=Date.now(),h=o.current;if("g"===e.key){if(h&&"g"===h.key&&d-h.time<500){o.current=null,n("graph");return}o.current={key:"g",time:d};return}if(h&&"g"===h.key&&d-h.time<500){o.current=null;let t={s:"shield",m:"memories",t:"timeline",a:"audit",b:"brain",d:"dome"}[e.key];if(t)return void n(t)}o.current=null},[t,r,n,i,a]);return(0,H.useEffect)(()=>(document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)),[l]),{showHelp:a,setShowHelp:s}}({onFocusSearch:(0,H.useCallback)(()=>{o.current?.focus()},[]),onClosePanel:(0,H.useCallback)(()=>{p(null),m(null)},[p,m]),onNavigate:(0,H.useCallback)(e=>{d(e)},[d]),onToggleHelp:()=>{}}),{data:S=[]}=(e=sn(t,200),(0,si.useQuery)({queryKey:["suggestions",e],queryFn:()=>so(e),enabled:e.length>=2,staleTime:3e4,refetchOnWindowFocus:!1})),{data:O}=(0,st.useProjects)();(0,H.useEffect)(()=>{let e=e=>{l.current&&!l.current.contains(e.target)&&o.current&&!o.current.contains(e.target)&&i(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);let{data:P=[],isLoading:C,isConnected:E,lastEvent:M}=(0,st.useMemoriesWithRealtime)({limit:1e3,query:c||void 0,mode:c?"search":"recent",project:x||void 0,type:g||void 0,category:b||void 0}),{data:A,isLoading:T}=(0,st.useStats)(x||void 0),{data:_=[]}=(0,st.useMemoryLinks)(x||void 0),D=(0,H.useRef)(M);(0,H.useEffect)(()=>{!M||M===D.current||(D.current=M,new Set(["memory_created","memory_accessed","memory_updated","memory_deleted","consolidation_complete","decay_tick"]).has(M.type)&&w({type:M.type,timestamp:M.timestamp,data:M.data}))},[M,w]);let I=(0,st.useAccessMemory)();(0,st.useConsolidate)();let{data:L}=(0,st.useControlStatus)();(0,st.usePauseMemory)(),(0,st.useResumeMemory)();let z=L?.paused??!1,{data:R}=l0(),F=R?.enabled&&R?.apiKeySet,$=lX(),B=L?.killSwitchActive??!1,U=e=>{let t=P.find(t=>t.id===e);t&&p(t)},V="overview"===u||"recall"===u||"review"===u||"shield"===u||"cloud"===u||"audit"===u||"quarantine"===u||"agents"===u||"skills"===u||"dome"===u;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)(oQ,{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:F?"Connected to ShieldCortex Cloud":"Cloud sync not configured",children:(0,W.jsx)(o8,{size:16,className:F?"text-emerald-400":"text-slate-600"})})]}),(0,W.jsx)("select",{value:x||"",onChange:e=>y(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:O?.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)(ob,{ref:o,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&&S.length>0&&(0,W.jsx)("div",{ref:l,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:S.map((e,t)=>(0,W.jsxs)("button",{onClick:()=>{r(e.text),i(!1),o.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)(ov,{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 ",(g||b)&&"•"]})]}),(0,W.jsxs)("div",{className:"flex items-center gap-3",children:[B?(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)(uR,{size:14}),"Kill Switch Active"]}):(0,W.jsxs)("button",{onClick:()=>$.mutate(),disabled:$.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:[$.isPending?(0,W.jsx)(ly,{size:12,className:"animate-spin"}):(0,W.jsx)(uR,{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 ${B?"bg-red-500 animate-pulse":z?"bg-orange-500 animate-pulse":E?"bg-green-500":"bg-yellow-500"}`,title:B?"Kill switch active — all operations blocked":z?"Memory creation paused":E?"Real-time connected":"Polling mode"}),A?.total??P.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:()=>v(g===e?null:e),className:`px-2 py-1 text-xs rounded-full transition-colors ${g===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:()=>j(b===e?null:e),className:`px-2 py-1 text-xs rounded-full transition-colors ${b===e?"bg-purple-600 text-white":"bg-slate-800 text-slate-300 hover:bg-slate-700"}`,children:e},e))]}),(g||b)&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)("div",{className:"w-px h-6 bg-slate-700"}),(0,W.jsx)("button",{onClick:()=>{v(null),j(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)(le,{}),(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"===u&&(0,W.jsx)(Ms,{stats:A,selectedProject:x}),"recall"===u&&(0,W.jsx)(cL,{}),"review"===u&&(0,W.jsx)(cV,{}),"shield"===u&&(0,W.jsx)(cw,{}),"cloud"===u&&(0,W.jsx)(cA,{}),"audit"===u&&(0,W.jsx)(cX,{}),"quarantine"===u&&(0,W.jsx)(c8,{}),"brain"===u&&(0,W.jsx)(Mp,{memories:P,links:_,stats:A,isLoading:C}),"graph"===u&&(0,W.jsx)(Mh,{}),"timeline"===u&&(0,W.jsx)(u6,{}),"agents"===u&&(0,W.jsx)(uj,{}),"skills"===u&&(0,W.jsx)(uD,{}),"dome"===u&&(0,W.jsx)(uZ,{}),"memories"===u&&(0,W.jsx)(oF,{memories:P,selectedMemory:h,onSelectMemory:e=>{p(e)}})]},u)}),h&&!V&&"brain"!==u&&"graph"!==u&&"timeline"!==u&&(0,W.jsx)("div",{className:"w-80 border-l border-slate-800 overflow-y-auto shrink-0",children:(0,W.jsx)(oC,{memory:h,links:_,memories:P,onClose:()=>p(null),onReinforce:e=>{I.mutate(e)},onSelectMemory:U,isReinforcing:I.isPending,reinforceSuccess:I.isSuccess})}),f&&"audit"===u&&(0,W.jsx)("div",{className:"w-80 border-l border-slate-800 overflow-y-auto shrink-0",children:(0,W.jsx)(c2,{entry:f,onClose:()=>m(null),onViewMemory:e=>{m(null),U(e),sr.useDashboardStore.getState().setViewMode("memories")}})})]}),(0,W.jsx)(Md,{open:N,onClose:()=>k(!1)})]})}e.s(["default",()=>Mf],23733)}]);
|