Files
mercado.clube67.com/backend/public/admin-v2/assets/index-n43auBDg.js
T

1068 lines
1.4 MiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
function N8(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const s in r)if(s!=="default"&&!(s in e)){const i=Object.getOwnPropertyDescriptor(r,s);i&&Object.defineProperty(e,s,i.get?i:{enumerable:!0,get:()=>r[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();var Ld=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function De(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var u_={exports:{}},Qh={},d_={exports:{}},Pe={};/**
* @license React
* react.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var ud=Symbol.for("react.element"),S8=Symbol.for("react.portal"),k8=Symbol.for("react.fragment"),C8=Symbol.for("react.strict_mode"),_8=Symbol.for("react.profiler"),A8=Symbol.for("react.provider"),P8=Symbol.for("react.context"),E8=Symbol.for("react.forward_ref"),O8=Symbol.for("react.suspense"),T8=Symbol.for("react.memo"),$8=Symbol.for("react.lazy"),Cw=Symbol.iterator;function M8(e){return e===null||typeof e!="object"?null:(e=Cw&&e[Cw]||e["@@iterator"],typeof e=="function"?e:null)}var f_={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},p_=Object.assign,h_={};function Cl(e,t,n){this.props=e,this.context=t,this.refs=h_,this.updater=n||f_}Cl.prototype.isReactComponent={};Cl.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Cl.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function m_(){}m_.prototype=Cl.prototype;function hb(e,t,n){this.props=e,this.context=t,this.refs=h_,this.updater=n||f_}var mb=hb.prototype=new m_;mb.constructor=hb;p_(mb,Cl.prototype);mb.isPureReactComponent=!0;var _w=Array.isArray,x_=Object.prototype.hasOwnProperty,xb={current:null},g_={key:!0,ref:!0,__self:!0,__source:!0};function v_(e,t,n){var r,s={},i=null,o=null;if(t!=null)for(r in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(i=""+t.key),t)x_.call(t,r)&&!g_.hasOwnProperty(r)&&(s[r]=t[r]);var l=arguments.length-2;if(l===1)s.children=n;else if(1<l){for(var c=Array(l),u=0;u<l;u++)c[u]=arguments[u+2];s.children=c}if(e&&e.defaultProps)for(r in l=e.defaultProps,l)s[r]===void 0&&(s[r]=l[r]);return{$$typeof:ud,type:e,key:i,ref:o,props:s,_owner:xb.current}}function R8(e,t){return{$$typeof:ud,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function gb(e){return typeof e=="object"&&e!==null&&e.$$typeof===ud}function D8(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var Aw=/\/+/g;function kx(e,t){return typeof e=="object"&&e!==null&&e.key!=null?D8(""+e.key):t.toString(36)}function Ef(e,t,n,r,s){var i=typeof e;(i==="undefined"||i==="boolean")&&(e=null);var o=!1;if(e===null)o=!0;else switch(i){case"string":case"number":o=!0;break;case"object":switch(e.$$typeof){case ud:case S8:o=!0}}if(o)return o=e,s=s(o),e=r===""?"."+kx(o,0):r,_w(s)?(n="",e!=null&&(n=e.replace(Aw,"$&/")+"/"),Ef(s,t,n,"",function(u){return u})):s!=null&&(gb(s)&&(s=R8(s,n+(!s.key||o&&o.key===s.key?"":(""+s.key).replace(Aw,"$&/")+"/")+e)),t.push(s)),1;if(o=0,r=r===""?".":r+":",_w(e))for(var l=0;l<e.length;l++){i=e[l];var c=r+kx(i,l);o+=Ef(i,t,n,c,s)}else if(c=M8(e),typeof c=="function")for(e=c.call(e),l=0;!(i=e.next()).done;)i=i.value,c=r+kx(i,l++),o+=Ef(i,t,n,c,s);else if(i==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return o}function zd(e,t,n){if(e==null)return e;var r=[],s=0;return Ef(e,r,"","",function(i){return t.call(n,i,s++)}),r}function I8(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var mn={current:null},Of={transition:null},L8={ReactCurrentDispatcher:mn,ReactCurrentBatchConfig:Of,ReactCurrentOwner:xb};function y_(){throw Error("act(...) is not supported in production builds of React.")}Pe.Children={map:zd,forEach:function(e,t,n){zd(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return zd(e,function(){t++}),t},toArray:function(e){return zd(e,function(t){return t})||[]},only:function(e){if(!gb(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Pe.Component=Cl;Pe.Fragment=k8;Pe.Profiler=_8;Pe.PureComponent=hb;Pe.StrictMode=C8;Pe.Suspense=O8;Pe.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=L8;Pe.act=y_;Pe.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=p_({},e.props),s=e.key,i=e.ref,o=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,o=xb.current),t.key!==void 0&&(s=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(c in t)x_.call(t,c)&&!g_.hasOwnProperty(c)&&(r[c]=t[c]===void 0&&l!==void 0?l[c]:t[c])}var c=arguments.length-2;if(c===1)r.children=n;else if(1<c){l=Array(c);for(var u=0;u<c;u++)l[u]=arguments[u+2];r.children=l}return{$$typeof:ud,type:e.type,key:s,ref:i,props:r,_owner:o}};Pe.createContext=function(e){return e={$$typeof:P8,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:A8,_context:e},e.Consumer=e};Pe.createElement=v_;Pe.createFactory=function(e){var t=v_.bind(null,e);return t.type=e,t};Pe.createRef=function(){return{current:null}};Pe.forwardRef=function(e){return{$$typeof:E8,render:e}};Pe.isValidElement=gb;Pe.lazy=function(e){return{$$typeof:$8,_payload:{_status:-1,_result:e},_init:I8}};Pe.memo=function(e,t){return{$$typeof:T8,type:e,compare:t===void 0?null:t}};Pe.startTransition=function(e){var t=Of.transition;Of.transition={};try{e()}finally{Of.transition=t}};Pe.unstable_act=y_;Pe.useCallback=function(e,t){return mn.current.useCallback(e,t)};Pe.useContext=function(e){return mn.current.useContext(e)};Pe.useDebugValue=function(){};Pe.useDeferredValue=function(e){return mn.current.useDeferredValue(e)};Pe.useEffect=function(e,t){return mn.current.useEffect(e,t)};Pe.useId=function(){return mn.current.useId()};Pe.useImperativeHandle=function(e,t,n){return mn.current.useImperativeHandle(e,t,n)};Pe.useInsertionEffect=function(e,t){return mn.current.useInsertionEffect(e,t)};Pe.useLayoutEffect=function(e,t){return mn.current.useLayoutEffect(e,t)};Pe.useMemo=function(e,t){return mn.current.useMemo(e,t)};Pe.useReducer=function(e,t,n){return mn.current.useReducer(e,t,n)};Pe.useRef=function(e){return mn.current.useRef(e)};Pe.useState=function(e){return mn.current.useState(e)};Pe.useSyncExternalStore=function(e,t,n){return mn.current.useSyncExternalStore(e,t,n)};Pe.useTransition=function(){return mn.current.useTransition()};Pe.version="18.3.1";d_.exports=Pe;var b=d_.exports;const O=De(b),z8=N8({__proto__:null,default:O},[b]);/**
* @license React
* react-jsx-runtime.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var B8=b,F8=Symbol.for("react.element"),V8=Symbol.for("react.fragment"),U8=Object.prototype.hasOwnProperty,W8=B8.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,q8={key:!0,ref:!0,__self:!0,__source:!0};function b_(e,t,n){var r,s={},i=null,o=null;n!==void 0&&(i=""+n),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(o=t.ref);for(r in t)U8.call(t,r)&&!q8.hasOwnProperty(r)&&(s[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)s[r]===void 0&&(s[r]=t[r]);return{$$typeof:F8,type:e,key:i,ref:o,props:s,_owner:W8.current}}Qh.Fragment=V8;Qh.jsx=b_;Qh.jsxs=b_;u_.exports=Qh;var a=u_.exports,ag={},j_={exports:{}},Vn={},w_={exports:{}},N_={};/**
* @license React
* scheduler.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/(function(e){function t(T,V){var X=T.length;T.push(V);e:for(;0<X;){var U=X-1>>>1,L=T[U];if(0<s(L,V))T[U]=V,T[X]=L,X=U;else break e}}function n(T){return T.length===0?null:T[0]}function r(T){if(T.length===0)return null;var V=T[0],X=T.pop();if(X!==V){T[0]=X;e:for(var U=0,L=T.length,B=L>>>1;U<B;){var ae=2*(U+1)-1,se=T[ae],xe=ae+1,H=T[xe];if(0>s(se,X))xe<L&&0>s(H,se)?(T[U]=H,T[xe]=X,U=xe):(T[U]=se,T[ae]=X,U=ae);else if(xe<L&&0>s(H,X))T[U]=H,T[xe]=X,U=xe;else break e}}return V}function s(T,V){var X=T.sortIndex-V.sortIndex;return X!==0?X:T.id-V.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var o=Date,l=o.now();e.unstable_now=function(){return o.now()-l}}var c=[],u=[],d=1,f=null,p=3,h=!1,m=!1,v=!1,x=typeof setTimeout=="function"?setTimeout:null,y=typeof clearTimeout=="function"?clearTimeout:null,g=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function j(T){for(var V=n(u);V!==null;){if(V.callback===null)r(u);else if(V.startTime<=T)r(u),V.sortIndex=V.expirationTime,t(c,V);else break;V=n(u)}}function N(T){if(v=!1,j(T),!m)if(n(c)!==null)m=!0,M(w);else{var V=n(u);V!==null&&W(N,V.startTime-T)}}function w(T,V){m=!1,v&&(v=!1,y(C),C=-1),h=!0;var X=p;try{for(j(V),f=n(c);f!==null&&(!(f.expirationTime>V)||T&&!E());){var U=f.callback;if(typeof U=="function"){f.callback=null,p=f.priorityLevel;var L=U(f.expirationTime<=V);V=e.unstable_now(),typeof L=="function"?f.callback=L:f===n(c)&&r(c),j(V)}else r(c);f=n(c)}if(f!==null)var B=!0;else{var ae=n(u);ae!==null&&W(N,ae.startTime-V),B=!1}return B}finally{f=null,p=X,h=!1}}var S=!1,k=null,C=-1,_=5,A=-1;function E(){return!(e.unstable_now()-A<_)}function P(){if(k!==null){var T=e.unstable_now();A=T;var V=!0;try{V=k(!0,T)}finally{V?D():(S=!1,k=null)}}else S=!1}var D;if(typeof g=="function")D=function(){g(P)};else if(typeof MessageChannel<"u"){var I=new MessageChannel,R=I.port2;I.port1.onmessage=P,D=function(){R.postMessage(null)}}else D=function(){x(P,0)};function M(T){k=T,S||(S=!0,D())}function W(T,V){C=x(function(){T(e.unstable_now())},V)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(T){T.callback=null},e.unstable_continueExecution=function(){m||h||(m=!0,M(w))},e.unstable_forceFrameRate=function(T){0>T||125<T?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):_=0<T?Math.floor(1e3/T):5},e.unstable_getCurrentPriorityLevel=function(){return p},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function(T){switch(p){case 1:case 2:case 3:var V=3;break;default:V=p}var X=p;p=V;try{return T()}finally{p=X}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(T,V){switch(T){case 1:case 2:case 3:case 4:case 5:break;default:T=3}var X=p;p=T;try{return V()}finally{p=X}},e.unstable_scheduleCallback=function(T,V,X){var U=e.unstable_now();switch(typeof X=="object"&&X!==null?(X=X.delay,X=typeof X=="number"&&0<X?U+X:U):X=U,T){case 1:var L=-1;break;case 2:L=250;break;case 5:L=1073741823;break;case 4:L=1e4;break;default:L=5e3}return L=X+L,T={id:d++,callback:V,priorityLevel:T,startTime:X,expirationTime:L,sortIndex:-1},X>U?(T.sortIndex=X,t(u,T),n(c)===null&&T===n(u)&&(v?(y(C),C=-1):v=!0,W(N,X-U))):(T.sortIndex=L,t(c,T),m||h||(m=!0,M(w))),T},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(T){var V=p;return function(){var X=p;p=V;try{return T.apply(this,arguments)}finally{p=X}}}})(N_);w_.exports=N_;var H8=w_.exports;/**
* @license React
* react-dom.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var K8=b,Fn=H8;function te(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var S_=new Set,eu={};function Li(e,t){Fo(e,t),Fo(e+"Capture",t)}function Fo(e,t){for(eu[e]=t,e=0;e<t.length;e++)S_.add(t[e])}var ka=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),sg=Object.prototype.hasOwnProperty,G8=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,Pw={},Ew={};function X8(e){return sg.call(Ew,e)?!0:sg.call(Pw,e)?!1:G8.test(e)?Ew[e]=!0:(Pw[e]=!0,!1)}function Y8(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function Q8(e,t,n,r){if(t===null||typeof t>"u"||Y8(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function xn(e,t,n,r,s,i,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=s,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=o}var Ht={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Ht[e]=new xn(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Ht[t]=new xn(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Ht[e]=new xn(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Ht[e]=new xn(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){Ht[e]=new xn(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Ht[e]=new xn(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Ht[e]=new xn(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Ht[e]=new xn(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Ht[e]=new xn(e,5,!1,e.toLowerCase(),null,!1,!1)});var vb=/[\-:]([a-z])/g;function yb(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(vb,yb);Ht[t]=new xn(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(vb,yb);Ht[t]=new xn(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(vb,yb);Ht[t]=new xn(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Ht[e]=new xn(e,1,!1,e.toLowerCase(),null,!1,!1)});Ht.xlinkHref=new xn("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Ht[e]=new xn(e,1,!1,e.toLowerCase(),null,!0,!0)});function bb(e,t,n,r){var s=Ht.hasOwnProperty(t)?Ht[t]:null;(s!==null?s.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(Q8(t,n,s,r)&&(n=null),r||s===null?X8(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):s.mustUseProperty?e[s.propertyName]=n===null?s.type===3?!1:"":n:(t=s.attributeName,r=s.attributeNamespace,n===null?e.removeAttribute(t):(s=s.type,n=s===3||s===4&&n===!0?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var Ma=K8.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Bd=Symbol.for("react.element"),io=Symbol.for("react.portal"),oo=Symbol.for("react.fragment"),jb=Symbol.for("react.strict_mode"),ig=Symbol.for("react.profiler"),k_=Symbol.for("react.provider"),C_=Symbol.for("react.context"),wb=Symbol.for("react.forward_ref"),og=Symbol.for("react.suspense"),lg=Symbol.for("react.suspense_list"),Nb=Symbol.for("react.memo"),Ha=Symbol.for("react.lazy"),__=Symbol.for("react.offscreen"),Ow=Symbol.iterator;function tc(e){return e===null||typeof e!="object"?null:(e=Ow&&e[Ow]||e["@@iterator"],typeof e=="function"?e:null)}var lt=Object.assign,Cx;function Nc(e){if(Cx===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Cx=t&&t[1]||""}return`
`+Cx+e}var _x=!1;function Ax(e,t){if(!e||_x)return"";_x=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(u){var r=u}Reflect.construct(e,[],t)}else{try{t.call()}catch(u){r=u}e.call(t.prototype)}else{try{throw Error()}catch(u){r=u}e()}}catch(u){if(u&&r&&typeof u.stack=="string"){for(var s=u.stack.split(`
`),i=r.stack.split(`
`),o=s.length-1,l=i.length-1;1<=o&&0<=l&&s[o]!==i[l];)l--;for(;1<=o&&0<=l;o--,l--)if(s[o]!==i[l]){if(o!==1||l!==1)do if(o--,l--,0>l||s[o]!==i[l]){var c=`
`+s[o].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),c}while(1<=o&&0<=l);break}}}finally{_x=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Nc(e):""}function J8(e){switch(e.tag){case 5:return Nc(e.type);case 16:return Nc("Lazy");case 13:return Nc("Suspense");case 19:return Nc("SuspenseList");case 0:case 2:case 15:return e=Ax(e.type,!1),e;case 11:return e=Ax(e.type.render,!1),e;case 1:return e=Ax(e.type,!0),e;default:return""}}function cg(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case oo:return"Fragment";case io:return"Portal";case ig:return"Profiler";case jb:return"StrictMode";case og:return"Suspense";case lg:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case C_:return(e.displayName||"Context")+".Consumer";case k_:return(e._context.displayName||"Context")+".Provider";case wb:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Nb:return t=e.displayName||null,t!==null?t:cg(e.type)||"Memo";case Ha:t=e._payload,e=e._init;try{return cg(e(t))}catch{}}return null}function Z8(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return cg(t);case 8:return t===jb?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function gs(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function A_(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function eM(e){var t=A_(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var s=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(o){r=""+o,i.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Fd(e){e._valueTracker||(e._valueTracker=eM(e))}function P_(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=A_(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function sp(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function ug(e,t){var n=t.checked;return lt({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Tw(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=gs(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function E_(e,t){t=t.checked,t!=null&&bb(e,"checked",t,!1)}function dg(e,t){E_(e,t);var n=gs(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?fg(e,t.type,n):t.hasOwnProperty("defaultValue")&&fg(e,t.type,gs(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function $w(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function fg(e,t,n){(t!=="number"||sp(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Sc=Array.isArray;function Ao(e,t,n,r){if(e=e.options,t){t={};for(var s=0;s<n.length;s++)t["$"+n[s]]=!0;for(n=0;n<e.length;n++)s=t.hasOwnProperty("$"+e[n].value),e[n].selected!==s&&(e[n].selected=s),s&&r&&(e[n].defaultSelected=!0)}else{for(n=""+gs(n),t=null,s=0;s<e.length;s++){if(e[s].value===n){e[s].selected=!0,r&&(e[s].defaultSelected=!0);return}t!==null||e[s].disabled||(t=e[s])}t!==null&&(t.selected=!0)}}function pg(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(te(91));return lt({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Mw(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(te(92));if(Sc(n)){if(1<n.length)throw Error(te(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:gs(n)}}function O_(e,t){var n=gs(t.value),r=gs(t.defaultValue);n!=null&&(n=""+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=""+r)}function Rw(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function T_(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function hg(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?T_(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Vd,$_=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,r,s){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,s)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(Vd=Vd||document.createElement("div"),Vd.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Vd.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function tu(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Ec={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},tM=["Webkit","ms","Moz","O"];Object.keys(Ec).forEach(function(e){tM.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Ec[t]=Ec[e]})});function M_(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Ec.hasOwnProperty(e)&&Ec[e]?(""+t).trim():t+"px"}function R_(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=M_(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,s):e[n]=s}}var nM=lt({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function mg(e,t){if(t){if(nM[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(te(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(te(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(te(61))}if(t.style!=null&&typeof t.style!="object")throw Error(te(62))}}function xg(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var gg=null;function Sb(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var vg=null,Po=null,Eo=null;function Dw(e){if(e=pd(e)){if(typeof vg!="function")throw Error(te(280));var t=e.stateNode;t&&(t=nm(t),vg(e.stateNode,e.type,t))}}function D_(e){Po?Eo?Eo.push(e):Eo=[e]:Po=e}function I_(){if(Po){var e=Po,t=Eo;if(Eo=Po=null,Dw(e),t)for(e=0;e<t.length;e++)Dw(t[e])}}function L_(e,t){return e(t)}function z_(){}var Px=!1;function B_(e,t,n){if(Px)return e(t,n);Px=!0;try{return L_(e,t,n)}finally{Px=!1,(Po!==null||Eo!==null)&&(z_(),I_())}}function nu(e,t){var n=e.stateNode;if(n===null)return null;var r=nm(n);if(r===null)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(te(231,t,typeof n));return n}var yg=!1;if(ka)try{var nc={};Object.defineProperty(nc,"passive",{get:function(){yg=!0}}),window.addEventListener("test",nc,nc),window.removeEventListener("test",nc,nc)}catch{yg=!1}function rM(e,t,n,r,s,i,o,l,c){var u=Array.prototype.slice.call(arguments,3);try{t.apply(n,u)}catch(d){this.onError(d)}}var Oc=!1,ip=null,op=!1,bg=null,aM={onError:function(e){Oc=!0,ip=e}};function sM(e,t,n,r,s,i,o,l,c){Oc=!1,ip=null,rM.apply(aM,arguments)}function iM(e,t,n,r,s,i,o,l,c){if(sM.apply(this,arguments),Oc){if(Oc){var u=ip;Oc=!1,ip=null}else throw Error(te(198));op||(op=!0,bg=u)}}function zi(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function F_(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function Iw(e){if(zi(e)!==e)throw Error(te(188))}function oM(e){var t=e.alternate;if(!t){if(t=zi(e),t===null)throw Error(te(188));return t!==e?null:e}for(var n=e,r=t;;){var s=n.return;if(s===null)break;var i=s.alternate;if(i===null){if(r=s.return,r!==null){n=r;continue}break}if(s.child===i.child){for(i=s.child;i;){if(i===n)return Iw(s),e;if(i===r)return Iw(s),t;i=i.sibling}throw Error(te(188))}if(n.return!==r.return)n=s,r=i;else{for(var o=!1,l=s.child;l;){if(l===n){o=!0,n=s,r=i;break}if(l===r){o=!0,r=s,n=i;break}l=l.sibling}if(!o){for(l=i.child;l;){if(l===n){o=!0,n=i,r=s;break}if(l===r){o=!0,r=i,n=s;break}l=l.sibling}if(!o)throw Error(te(189))}}if(n.alternate!==r)throw Error(te(190))}if(n.tag!==3)throw Error(te(188));return n.stateNode.current===n?e:t}function V_(e){return e=oM(e),e!==null?U_(e):null}function U_(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=U_(e);if(t!==null)return t;e=e.sibling}return null}var W_=Fn.unstable_scheduleCallback,Lw=Fn.unstable_cancelCallback,lM=Fn.unstable_shouldYield,cM=Fn.unstable_requestPaint,ht=Fn.unstable_now,uM=Fn.unstable_getCurrentPriorityLevel,kb=Fn.unstable_ImmediatePriority,q_=Fn.unstable_UserBlockingPriority,lp=Fn.unstable_NormalPriority,dM=Fn.unstable_LowPriority,H_=Fn.unstable_IdlePriority,Jh=null,Yr=null;function fM(e){if(Yr&&typeof Yr.onCommitFiberRoot=="function")try{Yr.onCommitFiberRoot(Jh,e,void 0,(e.current.flags&128)===128)}catch{}}var Cr=Math.clz32?Math.clz32:mM,pM=Math.log,hM=Math.LN2;function mM(e){return e>>>=0,e===0?32:31-(pM(e)/hM|0)|0}var Ud=64,Wd=4194304;function kc(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function cp(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,s=e.suspendedLanes,i=e.pingedLanes,o=n&268435455;if(o!==0){var l=o&~s;l!==0?r=kc(l):(i&=o,i!==0&&(r=kc(i)))}else o=n&~s,o!==0?r=kc(o):i!==0&&(r=kc(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&s)&&(s=r&-r,i=t&-t,s>=i||s===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-Cr(t),s=1<<n,r|=e[n],t&=~s;return r}function xM(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function gM(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,s=e.expirationTimes,i=e.pendingLanes;0<i;){var o=31-Cr(i),l=1<<o,c=s[o];c===-1?(!(l&n)||l&r)&&(s[o]=xM(l,t)):c<=t&&(e.expiredLanes|=l),i&=~l}}function jg(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function K_(){var e=Ud;return Ud<<=1,!(Ud&4194240)&&(Ud=64),e}function Ex(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function dd(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Cr(t),e[t]=n}function vM(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var s=31-Cr(n),i=1<<s;t[s]=0,r[s]=-1,e[s]=-1,n&=~i}}function Cb(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Cr(n),s=1<<r;s&t|e[r]&t&&(e[r]|=t),n&=~s}}var Ie=0;function G_(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var X_,_b,Y_,Q_,J_,wg=!1,qd=[],is=null,os=null,ls=null,ru=new Map,au=new Map,Qa=[],yM="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function zw(e,t){switch(e){case"focusin":case"focusout":is=null;break;case"dragenter":case"dragleave":os=null;break;case"mouseover":case"mouseout":ls=null;break;case"pointerover":case"pointerout":ru.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":au.delete(t.pointerId)}}function rc(e,t,n,r,s,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:i,targetContainers:[s]},t!==null&&(t=pd(t),t!==null&&_b(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,s!==null&&t.indexOf(s)===-1&&t.push(s),e)}function bM(e,t,n,r,s){switch(t){case"focusin":return is=rc(is,e,t,n,r,s),!0;case"dragenter":return os=rc(os,e,t,n,r,s),!0;case"mouseover":return ls=rc(ls,e,t,n,r,s),!0;case"pointerover":var i=s.pointerId;return ru.set(i,rc(ru.get(i)||null,e,t,n,r,s)),!0;case"gotpointercapture":return i=s.pointerId,au.set(i,rc(au.get(i)||null,e,t,n,r,s)),!0}return!1}function Z_(e){var t=ri(e.target);if(t!==null){var n=zi(t);if(n!==null){if(t=n.tag,t===13){if(t=F_(n),t!==null){e.blockedOn=t,J_(e.priority,function(){Y_(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Tf(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Ng(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);gg=r,n.target.dispatchEvent(r),gg=null}else return t=pd(n),t!==null&&_b(t),e.blockedOn=n,!1;t.shift()}return!0}function Bw(e,t,n){Tf(e)&&n.delete(t)}function jM(){wg=!1,is!==null&&Tf(is)&&(is=null),os!==null&&Tf(os)&&(os=null),ls!==null&&Tf(ls)&&(ls=null),ru.forEach(Bw),au.forEach(Bw)}function ac(e,t){e.blockedOn===t&&(e.blockedOn=null,wg||(wg=!0,Fn.unstable_scheduleCallback(Fn.unstable_NormalPriority,jM)))}function su(e){function t(s){return ac(s,e)}if(0<qd.length){ac(qd[0],e);for(var n=1;n<qd.length;n++){var r=qd[n];r.blockedOn===e&&(r.blockedOn=null)}}for(is!==null&&ac(is,e),os!==null&&ac(os,e),ls!==null&&ac(ls,e),ru.forEach(t),au.forEach(t),n=0;n<Qa.length;n++)r=Qa[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<Qa.length&&(n=Qa[0],n.blockedOn===null);)Z_(n),n.blockedOn===null&&Qa.shift()}var Oo=Ma.ReactCurrentBatchConfig,up=!0;function wM(e,t,n,r){var s=Ie,i=Oo.transition;Oo.transition=null;try{Ie=1,Ab(e,t,n,r)}finally{Ie=s,Oo.transition=i}}function NM(e,t,n,r){var s=Ie,i=Oo.transition;Oo.transition=null;try{Ie=4,Ab(e,t,n,r)}finally{Ie=s,Oo.transition=i}}function Ab(e,t,n,r){if(up){var s=Ng(e,t,n,r);if(s===null)Bx(e,t,r,dp,n),zw(e,r);else if(bM(s,e,t,n,r))r.stopPropagation();else if(zw(e,r),t&4&&-1<yM.indexOf(e)){for(;s!==null;){var i=pd(s);if(i!==null&&X_(i),i=Ng(e,t,n,r),i===null&&Bx(e,t,r,dp,n),i===s)break;s=i}s!==null&&r.stopPropagation()}else Bx(e,t,r,null,n)}}var dp=null;function Ng(e,t,n,r){if(dp=null,e=Sb(r),e=ri(e),e!==null)if(t=zi(e),t===null)e=null;else if(n=t.tag,n===13){if(e=F_(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return dp=e,null}function eA(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(uM()){case kb:return 1;case q_:return 4;case lp:case dM:return 16;case H_:return 536870912;default:return 16}default:return 16}}var es=null,Pb=null,$f=null;function tA(){if($f)return $f;var e,t=Pb,n=t.length,r,s="value"in es?es.value:es.textContent,i=s.length;for(e=0;e<n&&t[e]===s[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===s[i-r];r++);return $f=s.slice(e,1<r?1-r:void 0)}function Mf(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Hd(){return!0}function Fw(){return!1}function Un(e){function t(n,r,s,i,o){this._reactName=n,this._targetInst=s,this.type=r,this.nativeEvent=i,this.target=o,this.currentTarget=null;for(var l in e)e.hasOwnProperty(l)&&(n=e[l],this[l]=n?n(i):i[l]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?Hd:Fw,this.isPropagationStopped=Fw,this}return lt(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Hd)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Hd)},persist:function(){},isPersistent:Hd}),t}var _l={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Eb=Un(_l),fd=lt({},_l,{view:0,detail:0}),SM=Un(fd),Ox,Tx,sc,Zh=lt({},fd,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ob,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==sc&&(sc&&e.type==="mousemove"?(Ox=e.screenX-sc.screenX,Tx=e.screenY-sc.screenY):Tx=Ox=0,sc=e),Ox)},movementY:function(e){return"movementY"in e?e.movementY:Tx}}),Vw=Un(Zh),kM=lt({},Zh,{dataTransfer:0}),CM=Un(kM),_M=lt({},fd,{relatedTarget:0}),$x=Un(_M),AM=lt({},_l,{animationName:0,elapsedTime:0,pseudoElement:0}),PM=Un(AM),EM=lt({},_l,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),OM=Un(EM),TM=lt({},_l,{data:0}),Uw=Un(TM),$M={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},MM={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},RM={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function DM(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=RM[e])?!!t[e]:!1}function Ob(){return DM}var IM=lt({},fd,{key:function(e){if(e.key){var t=$M[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Mf(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?MM[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ob,charCode:function(e){return e.type==="keypress"?Mf(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Mf(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),LM=Un(IM),zM=lt({},Zh,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Ww=Un(zM),BM=lt({},fd,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ob}),FM=Un(BM),VM=lt({},_l,{propertyName:0,elapsedTime:0,pseudoElement:0}),UM=Un(VM),WM=lt({},Zh,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),qM=Un(WM),HM=[9,13,27,32],Tb=ka&&"CompositionEvent"in window,Tc=null;ka&&"documentMode"in document&&(Tc=document.documentMode);var KM=ka&&"TextEvent"in window&&!Tc,nA=ka&&(!Tb||Tc&&8<Tc&&11>=Tc),qw=" ",Hw=!1;function rA(e,t){switch(e){case"keyup":return HM.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function aA(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var lo=!1;function GM(e,t){switch(e){case"compositionend":return aA(t);case"keypress":return t.which!==32?null:(Hw=!0,qw);case"textInput":return e=t.data,e===qw&&Hw?null:e;default:return null}}function XM(e,t){if(lo)return e==="compositionend"||!Tb&&rA(e,t)?(e=tA(),$f=Pb=es=null,lo=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return nA&&t.locale!=="ko"?null:t.data;default:return null}}var YM={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Kw(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!YM[e.type]:t==="textarea"}function sA(e,t,n,r){D_(r),t=fp(t,"onChange"),0<t.length&&(n=new Eb("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var $c=null,iu=null;function QM(e){xA(e,0)}function em(e){var t=fo(e);if(P_(t))return e}function JM(e,t){if(e==="change")return t}var iA=!1;if(ka){var Mx;if(ka){var Rx="oninput"in document;if(!Rx){var Gw=document.createElement("div");Gw.setAttribute("oninput","return;"),Rx=typeof Gw.oninput=="function"}Mx=Rx}else Mx=!1;iA=Mx&&(!document.documentMode||9<document.documentMode)}function Xw(){$c&&($c.detachEvent("onpropertychange",oA),iu=$c=null)}function oA(e){if(e.propertyName==="value"&&em(iu)){var t=[];sA(t,iu,e,Sb(e)),B_(QM,t)}}function ZM(e,t,n){e==="focusin"?(Xw(),$c=t,iu=n,$c.attachEvent("onpropertychange",oA)):e==="focusout"&&Xw()}function eR(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return em(iu)}function tR(e,t){if(e==="click")return em(t)}function nR(e,t){if(e==="input"||e==="change")return em(t)}function rR(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Mr=typeof Object.is=="function"?Object.is:rR;function ou(e,t){if(Mr(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var s=n[r];if(!sg.call(t,s)||!Mr(e[s],t[s]))return!1}return!0}function Yw(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Qw(e,t){var n=Yw(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Yw(n)}}function lA(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?lA(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function cA(){for(var e=window,t=sp();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=sp(e.document)}return t}function $b(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function aR(e){var t=cA(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&lA(n.ownerDocument.documentElement,n)){if(r!==null&&$b(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var s=n.textContent.length,i=Math.min(r.start,s);r=r.end===void 0?i:Math.min(r.end,s),!e.extend&&i>r&&(s=r,r=i,i=s),s=Qw(n,i);var o=Qw(n,r);s&&o&&(e.rangeCount!==1||e.anchorNode!==s.node||e.anchorOffset!==s.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(s.node,s.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var sR=ka&&"documentMode"in document&&11>=document.documentMode,co=null,Sg=null,Mc=null,kg=!1;function Jw(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;kg||co==null||co!==sp(r)||(r=co,"selectionStart"in r&&$b(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Mc&&ou(Mc,r)||(Mc=r,r=fp(Sg,"onSelect"),0<r.length&&(t=new Eb("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=co)))}function Kd(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var uo={animationend:Kd("Animation","AnimationEnd"),animationiteration:Kd("Animation","AnimationIteration"),animationstart:Kd("Animation","AnimationStart"),transitionend:Kd("Transition","TransitionEnd")},Dx={},uA={};ka&&(uA=document.createElement("div").style,"AnimationEvent"in window||(delete uo.animationend.animation,delete uo.animationiteration.animation,delete uo.animationstart.animation),"TransitionEvent"in window||delete uo.transitionend.transition);function tm(e){if(Dx[e])return Dx[e];if(!uo[e])return e;var t=uo[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in uA)return Dx[e]=t[n];return e}var dA=tm("animationend"),fA=tm("animationiteration"),pA=tm("animationstart"),hA=tm("transitionend"),mA=new Map,Zw="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Ps(e,t){mA.set(e,t),Li(t,[e])}for(var Ix=0;Ix<Zw.length;Ix++){var Lx=Zw[Ix],iR=Lx.toLowerCase(),oR=Lx[0].toUpperCase()+Lx.slice(1);Ps(iR,"on"+oR)}Ps(dA,"onAnimationEnd");Ps(fA,"onAnimationIteration");Ps(pA,"onAnimationStart");Ps("dblclick","onDoubleClick");Ps("focusin","onFocus");Ps("focusout","onBlur");Ps(hA,"onTransitionEnd");Fo("onMouseEnter",["mouseout","mouseover"]);Fo("onMouseLeave",["mouseout","mouseover"]);Fo("onPointerEnter",["pointerout","pointerover"]);Fo("onPointerLeave",["pointerout","pointerover"]);Li("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Li("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Li("onBeforeInput",["compositionend","keypress","textInput","paste"]);Li("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Li("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Li("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Cc="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),lR=new Set("cancel close invalid load scroll toggle".split(" ").concat(Cc));function e2(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,iM(r,t,void 0,e),e.currentTarget=null}function xA(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],s=r.event;r=r.listeners;e:{var i=void 0;if(t)for(var o=r.length-1;0<=o;o--){var l=r[o],c=l.instance,u=l.currentTarget;if(l=l.listener,c!==i&&s.isPropagationStopped())break e;e2(s,l,u),i=c}else for(o=0;o<r.length;o++){if(l=r[o],c=l.instance,u=l.currentTarget,l=l.listener,c!==i&&s.isPropagationStopped())break e;e2(s,l,u),i=c}}}if(op)throw e=bg,op=!1,bg=null,e}function Xe(e,t){var n=t[Eg];n===void 0&&(n=t[Eg]=new Set);var r=e+"__bubble";n.has(r)||(gA(t,e,2,!1),n.add(r))}function zx(e,t,n){var r=0;t&&(r|=4),gA(n,e,r,t)}var Gd="_reactListening"+Math.random().toString(36).slice(2);function lu(e){if(!e[Gd]){e[Gd]=!0,S_.forEach(function(n){n!=="selectionchange"&&(lR.has(n)||zx(n,!1,e),zx(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Gd]||(t[Gd]=!0,zx("selectionchange",!1,t))}}function gA(e,t,n,r){switch(eA(t)){case 1:var s=wM;break;case 4:s=NM;break;default:s=Ab}n=s.bind(null,t,n,e),s=void 0,!yg||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(s=!0),r?s!==void 0?e.addEventListener(t,n,{capture:!0,passive:s}):e.addEventListener(t,n,!0):s!==void 0?e.addEventListener(t,n,{passive:s}):e.addEventListener(t,n,!1)}function Bx(e,t,n,r,s){var i=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var l=r.stateNode.containerInfo;if(l===s||l.nodeType===8&&l.parentNode===s)break;if(o===4)for(o=r.return;o!==null;){var c=o.tag;if((c===3||c===4)&&(c=o.stateNode.containerInfo,c===s||c.nodeType===8&&c.parentNode===s))return;o=o.return}for(;l!==null;){if(o=ri(l),o===null)return;if(c=o.tag,c===5||c===6){r=i=o;continue e}l=l.parentNode}}r=r.return}B_(function(){var u=i,d=Sb(n),f=[];e:{var p=mA.get(e);if(p!==void 0){var h=Eb,m=e;switch(e){case"keypress":if(Mf(n)===0)break e;case"keydown":case"keyup":h=LM;break;case"focusin":m="focus",h=$x;break;case"focusout":m="blur",h=$x;break;case"beforeblur":case"afterblur":h=$x;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":h=Vw;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":h=CM;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":h=FM;break;case dA:case fA:case pA:h=PM;break;case hA:h=UM;break;case"scroll":h=SM;break;case"wheel":h=qM;break;case"copy":case"cut":case"paste":h=OM;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":h=Ww}var v=(t&4)!==0,x=!v&&e==="scroll",y=v?p!==null?p+"Capture":null:p;v=[];for(var g=u,j;g!==null;){j=g;var N=j.stateNode;if(j.tag===5&&N!==null&&(j=N,y!==null&&(N=nu(g,y),N!=null&&v.push(cu(g,N,j)))),x)break;g=g.return}0<v.length&&(p=new h(p,m,null,n,d),f.push({event:p,listeners:v}))}}if(!(t&7)){e:{if(p=e==="mouseover"||e==="pointerover",h=e==="mouseout"||e==="pointerout",p&&n!==gg&&(m=n.relatedTarget||n.fromElement)&&(ri(m)||m[Ca]))break e;if((h||p)&&(p=d.window===d?d:(p=d.ownerDocument)?p.defaultView||p.parentWindow:window,h?(m=n.relatedTarget||n.toElement,h=u,m=m?ri(m):null,m!==null&&(x=zi(m),m!==x||m.tag!==5&&m.tag!==6)&&(m=null)):(h=null,m=u),h!==m)){if(v=Vw,N="onMouseLeave",y="onMouseEnter",g="mouse",(e==="pointerout"||e==="pointerover")&&(v=Ww,N="onPointerLeave",y="onPointerEnter",g="pointer"),x=h==null?p:fo(h),j=m==null?p:fo(m),p=new v(N,g+"leave",h,n,d),p.target=x,p.relatedTarget=j,N=null,ri(d)===u&&(v=new v(y,g+"enter",m,n,d),v.target=j,v.relatedTarget=x,N=v),x=N,h&&m)t:{for(v=h,y=m,g=0,j=v;j;j=Ji(j))g++;for(j=0,N=y;N;N=Ji(N))j++;for(;0<g-j;)v=Ji(v),g--;for(;0<j-g;)y=Ji(y),j--;for(;g--;){if(v===y||y!==null&&v===y.alternate)break t;v=Ji(v),y=Ji(y)}v=null}else v=null;h!==null&&t2(f,p,h,v,!1),m!==null&&x!==null&&t2(f,x,m,v,!0)}}e:{if(p=u?fo(u):window,h=p.nodeName&&p.nodeName.toLowerCase(),h==="select"||h==="input"&&p.type==="file")var w=JM;else if(Kw(p))if(iA)w=nR;else{w=eR;var S=ZM}else(h=p.nodeName)&&h.toLowerCase()==="input"&&(p.type==="checkbox"||p.type==="radio")&&(w=tR);if(w&&(w=w(e,u))){sA(f,w,n,d);break e}S&&S(e,p,u),e==="focusout"&&(S=p._wrapperState)&&S.controlled&&p.type==="number"&&fg(p,"number",p.value)}switch(S=u?fo(u):window,e){case"focusin":(Kw(S)||S.contentEditable==="true")&&(co=S,Sg=u,Mc=null);break;case"focusout":Mc=Sg=co=null;break;case"mousedown":kg=!0;break;case"contextmenu":case"mouseup":case"dragend":kg=!1,Jw(f,n,d);break;case"selectionchange":if(sR)break;case"keydown":case"keyup":Jw(f,n,d)}var k;if(Tb)e:{switch(e){case"compositionstart":var C="onCompositionStart";break e;case"compositionend":C="onCompositionEnd";break e;case"compositionupdate":C="onCompositionUpdate";break e}C=void 0}else lo?rA(e,n)&&(C="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(C="onCompositionStart");C&&(nA&&n.locale!=="ko"&&(lo||C!=="onCompositionStart"?C==="onCompositionEnd"&&lo&&(k=tA()):(es=d,Pb="value"in es?es.value:es.textContent,lo=!0)),S=fp(u,C),0<S.length&&(C=new Uw(C,e,null,n,d),f.push({event:C,listeners:S}),k?C.data=k:(k=aA(n),k!==null&&(C.data=k)))),(k=KM?GM(e,n):XM(e,n))&&(u=fp(u,"onBeforeInput"),0<u.length&&(d=new Uw("onBeforeInput","beforeinput",null,n,d),f.push({event:d,listeners:u}),d.data=k))}xA(f,t)})}function cu(e,t,n){return{instance:e,listener:t,currentTarget:n}}function fp(e,t){for(var n=t+"Capture",r=[];e!==null;){var s=e,i=s.stateNode;s.tag===5&&i!==null&&(s=i,i=nu(e,n),i!=null&&r.unshift(cu(e,i,s)),i=nu(e,t),i!=null&&r.push(cu(e,i,s))),e=e.return}return r}function Ji(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function t2(e,t,n,r,s){for(var i=t._reactName,o=[];n!==null&&n!==r;){var l=n,c=l.alternate,u=l.stateNode;if(c!==null&&c===r)break;l.tag===5&&u!==null&&(l=u,s?(c=nu(n,i),c!=null&&o.unshift(cu(n,c,l))):s||(c=nu(n,i),c!=null&&o.push(cu(n,c,l)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var cR=/\r\n?/g,uR=/\u0000|\uFFFD/g;function n2(e){return(typeof e=="string"?e:""+e).replace(cR,`
`).replace(uR,"")}function Xd(e,t,n){if(t=n2(t),n2(e)!==t&&n)throw Error(te(425))}function pp(){}var Cg=null,_g=null;function Ag(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Pg=typeof setTimeout=="function"?setTimeout:void 0,dR=typeof clearTimeout=="function"?clearTimeout:void 0,r2=typeof Promise=="function"?Promise:void 0,fR=typeof queueMicrotask=="function"?queueMicrotask:typeof r2<"u"?function(e){return r2.resolve(null).then(e).catch(pR)}:Pg;function pR(e){setTimeout(function(){throw e})}function Fx(e,t){var n=t,r=0;do{var s=n.nextSibling;if(e.removeChild(n),s&&s.nodeType===8)if(n=s.data,n==="/$"){if(r===0){e.removeChild(s),su(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=s}while(n);su(t)}function cs(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function a2(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var Al=Math.random().toString(36).slice(2),qr="__reactFiber$"+Al,uu="__reactProps$"+Al,Ca="__reactContainer$"+Al,Eg="__reactEvents$"+Al,hR="__reactListeners$"+Al,mR="__reactHandles$"+Al;function ri(e){var t=e[qr];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Ca]||n[qr]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=a2(e);e!==null;){if(n=e[qr])return n;e=a2(e)}return t}e=n,n=e.parentNode}return null}function pd(e){return e=e[qr]||e[Ca],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function fo(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(te(33))}function nm(e){return e[uu]||null}var Og=[],po=-1;function Es(e){return{current:e}}function Ze(e){0>po||(e.current=Og[po],Og[po]=null,po--)}function Ke(e,t){po++,Og[po]=e.current,e.current=t}var vs={},an=Es(vs),kn=Es(!1),Ni=vs;function Vo(e,t){var n=e.type.contextTypes;if(!n)return vs;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var s={},i;for(i in n)s[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=s),s}function Cn(e){return e=e.childContextTypes,e!=null}function hp(){Ze(kn),Ze(an)}function s2(e,t,n){if(an.current!==vs)throw Error(te(168));Ke(an,t),Ke(kn,n)}function vA(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var s in r)if(!(s in t))throw Error(te(108,Z8(e)||"Unknown",s));return lt({},n,r)}function mp(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||vs,Ni=an.current,Ke(an,e),Ke(kn,kn.current),!0}function i2(e,t,n){var r=e.stateNode;if(!r)throw Error(te(169));n?(e=vA(e,t,Ni),r.__reactInternalMemoizedMergedChildContext=e,Ze(kn),Ze(an),Ke(an,e)):Ze(kn),Ke(kn,n)}var ma=null,rm=!1,Vx=!1;function yA(e){ma===null?ma=[e]:ma.push(e)}function xR(e){rm=!0,yA(e)}function Os(){if(!Vx&&ma!==null){Vx=!0;var e=0,t=Ie;try{var n=ma;for(Ie=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}ma=null,rm=!1}catch(s){throw ma!==null&&(ma=ma.slice(e+1)),W_(kb,Os),s}finally{Ie=t,Vx=!1}}return null}var ho=[],mo=0,xp=null,gp=0,Qn=[],Jn=0,Si=null,xa=1,ga="";function Ks(e,t){ho[mo++]=gp,ho[mo++]=xp,xp=e,gp=t}function bA(e,t,n){Qn[Jn++]=xa,Qn[Jn++]=ga,Qn[Jn++]=Si,Si=e;var r=xa;e=ga;var s=32-Cr(r)-1;r&=~(1<<s),n+=1;var i=32-Cr(t)+s;if(30<i){var o=s-s%5;i=(r&(1<<o)-1).toString(32),r>>=o,s-=o,xa=1<<32-Cr(t)+s|n<<s|r,ga=i+e}else xa=1<<i|n<<s|r,ga=e}function Mb(e){e.return!==null&&(Ks(e,1),bA(e,1,0))}function Rb(e){for(;e===xp;)xp=ho[--mo],ho[mo]=null,gp=ho[--mo],ho[mo]=null;for(;e===Si;)Si=Qn[--Jn],Qn[Jn]=null,ga=Qn[--Jn],Qn[Jn]=null,xa=Qn[--Jn],Qn[Jn]=null}var In=null,Dn=null,nt=!1,Sr=null;function jA(e,t){var n=rr(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function o2(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,In=e,Dn=cs(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,In=e,Dn=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=Si!==null?{id:xa,overflow:ga}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=rr(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,In=e,Dn=null,!0):!1;default:return!1}}function Tg(e){return(e.mode&1)!==0&&(e.flags&128)===0}function $g(e){if(nt){var t=Dn;if(t){var n=t;if(!o2(e,t)){if(Tg(e))throw Error(te(418));t=cs(n.nextSibling);var r=In;t&&o2(e,t)?jA(r,n):(e.flags=e.flags&-4097|2,nt=!1,In=e)}}else{if(Tg(e))throw Error(te(418));e.flags=e.flags&-4097|2,nt=!1,In=e}}}function l2(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;In=e}function Yd(e){if(e!==In)return!1;if(!nt)return l2(e),nt=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!Ag(e.type,e.memoizedProps)),t&&(t=Dn)){if(Tg(e))throw wA(),Error(te(418));for(;t;)jA(e,t),t=cs(t.nextSibling)}if(l2(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(te(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){Dn=cs(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}Dn=null}}else Dn=In?cs(e.stateNode.nextSibling):null;return!0}function wA(){for(var e=Dn;e;)e=cs(e.nextSibling)}function Uo(){Dn=In=null,nt=!1}function Db(e){Sr===null?Sr=[e]:Sr.push(e)}var gR=Ma.ReactCurrentBatchConfig;function ic(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(te(309));var r=n.stateNode}if(!r)throw Error(te(147,e));var s=r,i=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===i?t.ref:(t=function(o){var l=s.refs;o===null?delete l[i]:l[i]=o},t._stringRef=i,t)}if(typeof e!="string")throw Error(te(284));if(!n._owner)throw Error(te(290,e))}return e}function Qd(e,t){throw e=Object.prototype.toString.call(t),Error(te(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function c2(e){var t=e._init;return t(e._payload)}function NA(e){function t(y,g){if(e){var j=y.deletions;j===null?(y.deletions=[g],y.flags|=16):j.push(g)}}function n(y,g){if(!e)return null;for(;g!==null;)t(y,g),g=g.sibling;return null}function r(y,g){for(y=new Map;g!==null;)g.key!==null?y.set(g.key,g):y.set(g.index,g),g=g.sibling;return y}function s(y,g){return y=ps(y,g),y.index=0,y.sibling=null,y}function i(y,g,j){return y.index=j,e?(j=y.alternate,j!==null?(j=j.index,j<g?(y.flags|=2,g):j):(y.flags|=2,g)):(y.flags|=1048576,g)}function o(y){return e&&y.alternate===null&&(y.flags|=2),y}function l(y,g,j,N){return g===null||g.tag!==6?(g=Xx(j,y.mode,N),g.return=y,g):(g=s(g,j),g.return=y,g)}function c(y,g,j,N){var w=j.type;return w===oo?d(y,g,j.props.children,N,j.key):g!==null&&(g.elementType===w||typeof w=="object"&&w!==null&&w.$$typeof===Ha&&c2(w)===g.type)?(N=s(g,j.props),N.ref=ic(y,g,j),N.return=y,N):(N=Ff(j.type,j.key,j.props,null,y.mode,N),N.ref=ic(y,g,j),N.return=y,N)}function u(y,g,j,N){return g===null||g.tag!==4||g.stateNode.containerInfo!==j.containerInfo||g.stateNode.implementation!==j.implementation?(g=Yx(j,y.mode,N),g.return=y,g):(g=s(g,j.children||[]),g.return=y,g)}function d(y,g,j,N,w){return g===null||g.tag!==7?(g=xi(j,y.mode,N,w),g.return=y,g):(g=s(g,j),g.return=y,g)}function f(y,g,j){if(typeof g=="string"&&g!==""||typeof g=="number")return g=Xx(""+g,y.mode,j),g.return=y,g;if(typeof g=="object"&&g!==null){switch(g.$$typeof){case Bd:return j=Ff(g.type,g.key,g.props,null,y.mode,j),j.ref=ic(y,null,g),j.return=y,j;case io:return g=Yx(g,y.mode,j),g.return=y,g;case Ha:var N=g._init;return f(y,N(g._payload),j)}if(Sc(g)||tc(g))return g=xi(g,y.mode,j,null),g.return=y,g;Qd(y,g)}return null}function p(y,g,j,N){var w=g!==null?g.key:null;if(typeof j=="string"&&j!==""||typeof j=="number")return w!==null?null:l(y,g,""+j,N);if(typeof j=="object"&&j!==null){switch(j.$$typeof){case Bd:return j.key===w?c(y,g,j,N):null;case io:return j.key===w?u(y,g,j,N):null;case Ha:return w=j._init,p(y,g,w(j._payload),N)}if(Sc(j)||tc(j))return w!==null?null:d(y,g,j,N,null);Qd(y,j)}return null}function h(y,g,j,N,w){if(typeof N=="string"&&N!==""||typeof N=="number")return y=y.get(j)||null,l(g,y,""+N,w);if(typeof N=="object"&&N!==null){switch(N.$$typeof){case Bd:return y=y.get(N.key===null?j:N.key)||null,c(g,y,N,w);case io:return y=y.get(N.key===null?j:N.key)||null,u(g,y,N,w);case Ha:var S=N._init;return h(y,g,j,S(N._payload),w)}if(Sc(N)||tc(N))return y=y.get(j)||null,d(g,y,N,w,null);Qd(g,N)}return null}function m(y,g,j,N){for(var w=null,S=null,k=g,C=g=0,_=null;k!==null&&C<j.length;C++){k.index>C?(_=k,k=null):_=k.sibling;var A=p(y,k,j[C],N);if(A===null){k===null&&(k=_);break}e&&k&&A.alternate===null&&t(y,k),g=i(A,g,C),S===null?w=A:S.sibling=A,S=A,k=_}if(C===j.length)return n(y,k),nt&&Ks(y,C),w;if(k===null){for(;C<j.length;C++)k=f(y,j[C],N),k!==null&&(g=i(k,g,C),S===null?w=k:S.sibling=k,S=k);return nt&&Ks(y,C),w}for(k=r(y,k);C<j.length;C++)_=h(k,y,C,j[C],N),_!==null&&(e&&_.alternate!==null&&k.delete(_.key===null?C:_.key),g=i(_,g,C),S===null?w=_:S.sibling=_,S=_);return e&&k.forEach(function(E){return t(y,E)}),nt&&Ks(y,C),w}function v(y,g,j,N){var w=tc(j);if(typeof w!="function")throw Error(te(150));if(j=w.call(j),j==null)throw Error(te(151));for(var S=w=null,k=g,C=g=0,_=null,A=j.next();k!==null&&!A.done;C++,A=j.next()){k.index>C?(_=k,k=null):_=k.sibling;var E=p(y,k,A.value,N);if(E===null){k===null&&(k=_);break}e&&k&&E.alternate===null&&t(y,k),g=i(E,g,C),S===null?w=E:S.sibling=E,S=E,k=_}if(A.done)return n(y,k),nt&&Ks(y,C),w;if(k===null){for(;!A.done;C++,A=j.next())A=f(y,A.value,N),A!==null&&(g=i(A,g,C),S===null?w=A:S.sibling=A,S=A);return nt&&Ks(y,C),w}for(k=r(y,k);!A.done;C++,A=j.next())A=h(k,y,C,A.value,N),A!==null&&(e&&A.alternate!==null&&k.delete(A.key===null?C:A.key),g=i(A,g,C),S===null?w=A:S.sibling=A,S=A);return e&&k.forEach(function(P){return t(y,P)}),nt&&Ks(y,C),w}function x(y,g,j,N){if(typeof j=="object"&&j!==null&&j.type===oo&&j.key===null&&(j=j.props.children),typeof j=="object"&&j!==null){switch(j.$$typeof){case Bd:e:{for(var w=j.key,S=g;S!==null;){if(S.key===w){if(w=j.type,w===oo){if(S.tag===7){n(y,S.sibling),g=s(S,j.props.children),g.return=y,y=g;break e}}else if(S.elementType===w||typeof w=="object"&&w!==null&&w.$$typeof===Ha&&c2(w)===S.type){n(y,S.sibling),g=s(S,j.props),g.ref=ic(y,S,j),g.return=y,y=g;break e}n(y,S);break}else t(y,S);S=S.sibling}j.type===oo?(g=xi(j.props.children,y.mode,N,j.key),g.return=y,y=g):(N=Ff(j.type,j.key,j.props,null,y.mode,N),N.ref=ic(y,g,j),N.return=y,y=N)}return o(y);case io:e:{for(S=j.key;g!==null;){if(g.key===S)if(g.tag===4&&g.stateNode.containerInfo===j.containerInfo&&g.stateNode.implementation===j.implementation){n(y,g.sibling),g=s(g,j.children||[]),g.return=y,y=g;break e}else{n(y,g);break}else t(y,g);g=g.sibling}g=Yx(j,y.mode,N),g.return=y,y=g}return o(y);case Ha:return S=j._init,x(y,g,S(j._payload),N)}if(Sc(j))return m(y,g,j,N);if(tc(j))return v(y,g,j,N);Qd(y,j)}return typeof j=="string"&&j!==""||typeof j=="number"?(j=""+j,g!==null&&g.tag===6?(n(y,g.sibling),g=s(g,j),g.return=y,y=g):(n(y,g),g=Xx(j,y.mode,N),g.return=y,y=g),o(y)):n(y,g)}return x}var Wo=NA(!0),SA=NA(!1),vp=Es(null),yp=null,xo=null,Ib=null;function Lb(){Ib=xo=yp=null}function zb(e){var t=vp.current;Ze(vp),e._currentValue=t}function Mg(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function To(e,t){yp=e,Ib=xo=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Nn=!0),e.firstContext=null)}function cr(e){var t=e._currentValue;if(Ib!==e)if(e={context:e,memoizedValue:t,next:null},xo===null){if(yp===null)throw Error(te(308));xo=e,yp.dependencies={lanes:0,firstContext:e}}else xo=xo.next=e;return t}var ai=null;function Bb(e){ai===null?ai=[e]:ai.push(e)}function kA(e,t,n,r){var s=t.interleaved;return s===null?(n.next=n,Bb(t)):(n.next=s.next,s.next=n),t.interleaved=n,_a(e,r)}function _a(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Ka=!1;function Fb(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function CA(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function wa(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function us(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,$e&2){var s=r.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),r.pending=t,_a(e,n)}return s=r.interleaved,s===null?(t.next=t,Bb(r)):(t.next=s.next,s.next=t),r.interleaved=t,_a(e,n)}function Rf(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Cb(e,n)}}function u2(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var s=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?s=i=o:i=i.next=o,n=n.next}while(n!==null);i===null?s=i=t:i=i.next=t}else s=i=t;n={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:i,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function bp(e,t,n,r){var s=e.updateQueue;Ka=!1;var i=s.firstBaseUpdate,o=s.lastBaseUpdate,l=s.shared.pending;if(l!==null){s.shared.pending=null;var c=l,u=c.next;c.next=null,o===null?i=u:o.next=u,o=c;var d=e.alternate;d!==null&&(d=d.updateQueue,l=d.lastBaseUpdate,l!==o&&(l===null?d.firstBaseUpdate=u:l.next=u,d.lastBaseUpdate=c))}if(i!==null){var f=s.baseState;o=0,d=u=c=null,l=i;do{var p=l.lane,h=l.eventTime;if((r&p)===p){d!==null&&(d=d.next={eventTime:h,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var m=e,v=l;switch(p=t,h=n,v.tag){case 1:if(m=v.payload,typeof m=="function"){f=m.call(h,f,p);break e}f=m;break e;case 3:m.flags=m.flags&-65537|128;case 0:if(m=v.payload,p=typeof m=="function"?m.call(h,f,p):m,p==null)break e;f=lt({},f,p);break e;case 2:Ka=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,p=s.effects,p===null?s.effects=[l]:p.push(l))}else h={eventTime:h,lane:p,tag:l.tag,payload:l.payload,callback:l.callback,next:null},d===null?(u=d=h,c=f):d=d.next=h,o|=p;if(l=l.next,l===null){if(l=s.shared.pending,l===null)break;p=l,l=p.next,p.next=null,s.lastBaseUpdate=p,s.shared.pending=null}}while(!0);if(d===null&&(c=f),s.baseState=c,s.firstBaseUpdate=u,s.lastBaseUpdate=d,t=s.shared.interleaved,t!==null){s=t;do o|=s.lane,s=s.next;while(s!==t)}else i===null&&(s.shared.lanes=0);Ci|=o,e.lanes=o,e.memoizedState=f}}function d2(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],s=r.callback;if(s!==null){if(r.callback=null,r=n,typeof s!="function")throw Error(te(191,s));s.call(r)}}}var hd={},Qr=Es(hd),du=Es(hd),fu=Es(hd);function si(e){if(e===hd)throw Error(te(174));return e}function Vb(e,t){switch(Ke(fu,t),Ke(du,e),Ke(Qr,hd),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:hg(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=hg(t,e)}Ze(Qr),Ke(Qr,t)}function qo(){Ze(Qr),Ze(du),Ze(fu)}function _A(e){si(fu.current);var t=si(Qr.current),n=hg(t,e.type);t!==n&&(Ke(du,e),Ke(Qr,n))}function Ub(e){du.current===e&&(Ze(Qr),Ze(du))}var it=Es(0);function jp(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Ux=[];function Wb(){for(var e=0;e<Ux.length;e++)Ux[e]._workInProgressVersionPrimary=null;Ux.length=0}var Df=Ma.ReactCurrentDispatcher,Wx=Ma.ReactCurrentBatchConfig,ki=0,ot=null,_t=null,Dt=null,wp=!1,Rc=!1,pu=0,vR=0;function Gt(){throw Error(te(321))}function qb(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Mr(e[n],t[n]))return!1;return!0}function Hb(e,t,n,r,s,i){if(ki=i,ot=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Df.current=e===null||e.memoizedState===null?wR:NR,e=n(r,s),Rc){i=0;do{if(Rc=!1,pu=0,25<=i)throw Error(te(301));i+=1,Dt=_t=null,t.updateQueue=null,Df.current=SR,e=n(r,s)}while(Rc)}if(Df.current=Np,t=_t!==null&&_t.next!==null,ki=0,Dt=_t=ot=null,wp=!1,t)throw Error(te(300));return e}function Kb(){var e=pu!==0;return pu=0,e}function Fr(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Dt===null?ot.memoizedState=Dt=e:Dt=Dt.next=e,Dt}function ur(){if(_t===null){var e=ot.alternate;e=e!==null?e.memoizedState:null}else e=_t.next;var t=Dt===null?ot.memoizedState:Dt.next;if(t!==null)Dt=t,_t=e;else{if(e===null)throw Error(te(310));_t=e,e={memoizedState:_t.memoizedState,baseState:_t.baseState,baseQueue:_t.baseQueue,queue:_t.queue,next:null},Dt===null?ot.memoizedState=Dt=e:Dt=Dt.next=e}return Dt}function hu(e,t){return typeof t=="function"?t(e):t}function qx(e){var t=ur(),n=t.queue;if(n===null)throw Error(te(311));n.lastRenderedReducer=e;var r=_t,s=r.baseQueue,i=n.pending;if(i!==null){if(s!==null){var o=s.next;s.next=i.next,i.next=o}r.baseQueue=s=i,n.pending=null}if(s!==null){i=s.next,r=r.baseState;var l=o=null,c=null,u=i;do{var d=u.lane;if((ki&d)===d)c!==null&&(c=c.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),r=u.hasEagerState?u.eagerState:e(r,u.action);else{var f={lane:d,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};c===null?(l=c=f,o=r):c=c.next=f,ot.lanes|=d,Ci|=d}u=u.next}while(u!==null&&u!==i);c===null?o=r:c.next=l,Mr(r,t.memoizedState)||(Nn=!0),t.memoizedState=r,t.baseState=o,t.baseQueue=c,n.lastRenderedState=r}if(e=n.interleaved,e!==null){s=e;do i=s.lane,ot.lanes|=i,Ci|=i,s=s.next;while(s!==e)}else s===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Hx(e){var t=ur(),n=t.queue;if(n===null)throw Error(te(311));n.lastRenderedReducer=e;var r=n.dispatch,s=n.pending,i=t.memoizedState;if(s!==null){n.pending=null;var o=s=s.next;do i=e(i,o.action),o=o.next;while(o!==s);Mr(i,t.memoizedState)||(Nn=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function AA(){}function PA(e,t){var n=ot,r=ur(),s=t(),i=!Mr(r.memoizedState,s);if(i&&(r.memoizedState=s,Nn=!0),r=r.queue,Gb(TA.bind(null,n,r,e),[e]),r.getSnapshot!==t||i||Dt!==null&&Dt.memoizedState.tag&1){if(n.flags|=2048,mu(9,OA.bind(null,n,r,s,t),void 0,null),Lt===null)throw Error(te(349));ki&30||EA(n,t,s)}return s}function EA(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=ot.updateQueue,t===null?(t={lastEffect:null,stores:null},ot.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function OA(e,t,n,r){t.value=n,t.getSnapshot=r,$A(t)&&MA(e)}function TA(e,t,n){return n(function(){$A(t)&&MA(e)})}function $A(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Mr(e,n)}catch{return!0}}function MA(e){var t=_a(e,1);t!==null&&_r(t,e,1,-1)}function f2(e){var t=Fr();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:hu,lastRenderedState:e},t.queue=e,e=e.dispatch=jR.bind(null,ot,e),[t.memoizedState,e]}function mu(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=ot.updateQueue,t===null?(t={lastEffect:null,stores:null},ot.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function RA(){return ur().memoizedState}function If(e,t,n,r){var s=Fr();ot.flags|=e,s.memoizedState=mu(1|t,n,void 0,r===void 0?null:r)}function am(e,t,n,r){var s=ur();r=r===void 0?null:r;var i=void 0;if(_t!==null){var o=_t.memoizedState;if(i=o.destroy,r!==null&&qb(r,o.deps)){s.memoizedState=mu(t,n,i,r);return}}ot.flags|=e,s.memoizedState=mu(1|t,n,i,r)}function p2(e,t){return If(8390656,8,e,t)}function Gb(e,t){return am(2048,8,e,t)}function DA(e,t){return am(4,2,e,t)}function IA(e,t){return am(4,4,e,t)}function LA(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function zA(e,t,n){return n=n!=null?n.concat([e]):null,am(4,4,LA.bind(null,t,e),n)}function Xb(){}function BA(e,t){var n=ur();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&qb(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function FA(e,t){var n=ur();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&qb(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function VA(e,t,n){return ki&21?(Mr(n,t)||(n=K_(),ot.lanes|=n,Ci|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Nn=!0),e.memoizedState=n)}function yR(e,t){var n=Ie;Ie=n!==0&&4>n?n:4,e(!0);var r=Wx.transition;Wx.transition={};try{e(!1),t()}finally{Ie=n,Wx.transition=r}}function UA(){return ur().memoizedState}function bR(e,t,n){var r=fs(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},WA(e))qA(t,n);else if(n=kA(e,t,n,r),n!==null){var s=pn();_r(n,e,r,s),HA(n,t,r)}}function jR(e,t,n){var r=fs(e),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(WA(e))qA(t,s);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var o=t.lastRenderedState,l=i(o,n);if(s.hasEagerState=!0,s.eagerState=l,Mr(l,o)){var c=t.interleaved;c===null?(s.next=s,Bb(t)):(s.next=c.next,c.next=s),t.interleaved=s;return}}catch{}finally{}n=kA(e,t,s,r),n!==null&&(s=pn(),_r(n,e,r,s),HA(n,t,r))}}function WA(e){var t=e.alternate;return e===ot||t!==null&&t===ot}function qA(e,t){Rc=wp=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function HA(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Cb(e,n)}}var Np={readContext:cr,useCallback:Gt,useContext:Gt,useEffect:Gt,useImperativeHandle:Gt,useInsertionEffect:Gt,useLayoutEffect:Gt,useMemo:Gt,useReducer:Gt,useRef:Gt,useState:Gt,useDebugValue:Gt,useDeferredValue:Gt,useTransition:Gt,useMutableSource:Gt,useSyncExternalStore:Gt,useId:Gt,unstable_isNewReconciler:!1},wR={readContext:cr,useCallback:function(e,t){return Fr().memoizedState=[e,t===void 0?null:t],e},useContext:cr,useEffect:p2,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,If(4194308,4,LA.bind(null,t,e),n)},useLayoutEffect:function(e,t){return If(4194308,4,e,t)},useInsertionEffect:function(e,t){return If(4,2,e,t)},useMemo:function(e,t){var n=Fr();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Fr();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=bR.bind(null,ot,e),[r.memoizedState,e]},useRef:function(e){var t=Fr();return e={current:e},t.memoizedState=e},useState:f2,useDebugValue:Xb,useDeferredValue:function(e){return Fr().memoizedState=e},useTransition:function(){var e=f2(!1),t=e[0];return e=yR.bind(null,e[1]),Fr().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=ot,s=Fr();if(nt){if(n===void 0)throw Error(te(407));n=n()}else{if(n=t(),Lt===null)throw Error(te(349));ki&30||EA(r,t,n)}s.memoizedState=n;var i={value:n,getSnapshot:t};return s.queue=i,p2(TA.bind(null,r,i,e),[e]),r.flags|=2048,mu(9,OA.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=Fr(),t=Lt.identifierPrefix;if(nt){var n=ga,r=xa;n=(r&~(1<<32-Cr(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=pu++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=vR++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},NR={readContext:cr,useCallback:BA,useContext:cr,useEffect:Gb,useImperativeHandle:zA,useInsertionEffect:DA,useLayoutEffect:IA,useMemo:FA,useReducer:qx,useRef:RA,useState:function(){return qx(hu)},useDebugValue:Xb,useDeferredValue:function(e){var t=ur();return VA(t,_t.memoizedState,e)},useTransition:function(){var e=qx(hu)[0],t=ur().memoizedState;return[e,t]},useMutableSource:AA,useSyncExternalStore:PA,useId:UA,unstable_isNewReconciler:!1},SR={readContext:cr,useCallback:BA,useContext:cr,useEffect:Gb,useImperativeHandle:zA,useInsertionEffect:DA,useLayoutEffect:IA,useMemo:FA,useReducer:Hx,useRef:RA,useState:function(){return Hx(hu)},useDebugValue:Xb,useDeferredValue:function(e){var t=ur();return _t===null?t.memoizedState=e:VA(t,_t.memoizedState,e)},useTransition:function(){var e=Hx(hu)[0],t=ur().memoizedState;return[e,t]},useMutableSource:AA,useSyncExternalStore:PA,useId:UA,unstable_isNewReconciler:!1};function br(e,t){if(e&&e.defaultProps){t=lt({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function Rg(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:lt({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var sm={isMounted:function(e){return(e=e._reactInternals)?zi(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=pn(),s=fs(e),i=wa(r,s);i.payload=t,n!=null&&(i.callback=n),t=us(e,i,s),t!==null&&(_r(t,e,s,r),Rf(t,e,s))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=pn(),s=fs(e),i=wa(r,s);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=us(e,i,s),t!==null&&(_r(t,e,s,r),Rf(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=pn(),r=fs(e),s=wa(n,r);s.tag=2,t!=null&&(s.callback=t),t=us(e,s,r),t!==null&&(_r(t,e,r,n),Rf(t,e,r))}};function h2(e,t,n,r,s,i,o){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,i,o):t.prototype&&t.prototype.isPureReactComponent?!ou(n,r)||!ou(s,i):!0}function KA(e,t,n){var r=!1,s=vs,i=t.contextType;return typeof i=="object"&&i!==null?i=cr(i):(s=Cn(t)?Ni:an.current,r=t.contextTypes,i=(r=r!=null)?Vo(e,s):vs),t=new t(n,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=sm,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=s,e.__reactInternalMemoizedMaskedChildContext=i),t}function m2(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&sm.enqueueReplaceState(t,t.state,null)}function Dg(e,t,n,r){var s=e.stateNode;s.props=n,s.state=e.memoizedState,s.refs={},Fb(e);var i=t.contextType;typeof i=="object"&&i!==null?s.context=cr(i):(i=Cn(t)?Ni:an.current,s.context=Vo(e,i)),s.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(Rg(e,t,i,n),s.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof s.getSnapshotBeforeUpdate=="function"||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(t=s.state,typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount(),t!==s.state&&sm.enqueueReplaceState(s,s.state,null),bp(e,n,s,r),s.state=e.memoizedState),typeof s.componentDidMount=="function"&&(e.flags|=4194308)}function Ho(e,t){try{var n="",r=t;do n+=J8(r),r=r.return;while(r);var s=n}catch(i){s=`
Error generating stack: `+i.message+`
`+i.stack}return{value:e,source:t,stack:s,digest:null}}function Kx(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Ig(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var kR=typeof WeakMap=="function"?WeakMap:Map;function GA(e,t,n){n=wa(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){kp||(kp=!0,Kg=r),Ig(e,t)},n}function XA(e,t,n){n=wa(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var s=t.value;n.payload=function(){return r(s)},n.callback=function(){Ig(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){Ig(e,t),typeof r!="function"&&(ds===null?ds=new Set([this]):ds.add(this));var o=t.stack;this.componentDidCatch(t.value,{componentStack:o!==null?o:""})}),n}function x2(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new kR;var s=new Set;r.set(t,s)}else s=r.get(t),s===void 0&&(s=new Set,r.set(t,s));s.has(n)||(s.add(n),e=zR.bind(null,e,t,n),t.then(e,e))}function g2(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function v2(e,t,n,r,s){return e.mode&1?(e.flags|=65536,e.lanes=s,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=wa(-1,1),t.tag=2,us(n,t,1))),n.lanes|=1),e)}var CR=Ma.ReactCurrentOwner,Nn=!1;function sn(e,t,n,r){t.child=e===null?SA(t,null,n,r):Wo(t,e.child,n,r)}function y2(e,t,n,r,s){n=n.render;var i=t.ref;return To(t,s),r=Hb(e,t,n,r,i,s),n=Kb(),e!==null&&!Nn?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,Aa(e,t,s)):(nt&&n&&Mb(t),t.flags|=1,sn(e,t,r,s),t.child)}function b2(e,t,n,r,s){if(e===null){var i=n.type;return typeof i=="function"&&!r1(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,YA(e,t,i,r,s)):(e=Ff(n.type,null,r,t,t.mode,s),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!(e.lanes&s)){var o=i.memoizedProps;if(n=n.compare,n=n!==null?n:ou,n(o,r)&&e.ref===t.ref)return Aa(e,t,s)}return t.flags|=1,e=ps(i,r),e.ref=t.ref,e.return=t,t.child=e}function YA(e,t,n,r,s){if(e!==null){var i=e.memoizedProps;if(ou(i,r)&&e.ref===t.ref)if(Nn=!1,t.pendingProps=r=i,(e.lanes&s)!==0)e.flags&131072&&(Nn=!0);else return t.lanes=e.lanes,Aa(e,t,s)}return Lg(e,t,n,r,s)}function QA(e,t,n){var r=t.pendingProps,s=r.children,i=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Ke(vo,$n),$n|=n;else{if(!(n&1073741824))return e=i!==null?i.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Ke(vo,$n),$n|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,Ke(vo,$n),$n|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,Ke(vo,$n),$n|=r;return sn(e,t,s,n),t.child}function JA(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Lg(e,t,n,r,s){var i=Cn(n)?Ni:an.current;return i=Vo(t,i),To(t,s),n=Hb(e,t,n,r,i,s),r=Kb(),e!==null&&!Nn?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,Aa(e,t,s)):(nt&&r&&Mb(t),t.flags|=1,sn(e,t,n,s),t.child)}function j2(e,t,n,r,s){if(Cn(n)){var i=!0;mp(t)}else i=!1;if(To(t,s),t.stateNode===null)Lf(e,t),KA(t,n,r),Dg(t,n,r,s),r=!0;else if(e===null){var o=t.stateNode,l=t.memoizedProps;o.props=l;var c=o.context,u=n.contextType;typeof u=="object"&&u!==null?u=cr(u):(u=Cn(n)?Ni:an.current,u=Vo(t,u));var d=n.getDerivedStateFromProps,f=typeof d=="function"||typeof o.getSnapshotBeforeUpdate=="function";f||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==r||c!==u)&&m2(t,o,r,u),Ka=!1;var p=t.memoizedState;o.state=p,bp(t,r,o,s),c=t.memoizedState,l!==r||p!==c||kn.current||Ka?(typeof d=="function"&&(Rg(t,n,d,r),c=t.memoizedState),(l=Ka||h2(t,n,l,r,p,c,u))?(f||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(t.flags|=4194308)):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=c),o.props=r,o.state=c,o.context=u,r=l):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,CA(e,t),l=t.memoizedProps,u=t.type===t.elementType?l:br(t.type,l),o.props=u,f=t.pendingProps,p=o.context,c=n.contextType,typeof c=="object"&&c!==null?c=cr(c):(c=Cn(n)?Ni:an.current,c=Vo(t,c));var h=n.getDerivedStateFromProps;(d=typeof h=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==f||p!==c)&&m2(t,o,r,c),Ka=!1,p=t.memoizedState,o.state=p,bp(t,r,o,s);var m=t.memoizedState;l!==f||p!==m||kn.current||Ka?(typeof h=="function"&&(Rg(t,n,h,r),m=t.memoizedState),(u=Ka||h2(t,n,u,r,p,m,c)||!1)?(d||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(r,m,c),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(r,m,c)),typeof o.componentDidUpdate=="function"&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof o.componentDidUpdate!="function"||l===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=m),o.props=r,o.state=m,o.context=c,r=u):(typeof o.componentDidUpdate!="function"||l===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),r=!1)}return zg(e,t,n,r,i,s)}function zg(e,t,n,r,s,i){JA(e,t);var o=(t.flags&128)!==0;if(!r&&!o)return s&&i2(t,n,!1),Aa(e,t,i);r=t.stateNode,CR.current=t;var l=o&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&o?(t.child=Wo(t,e.child,null,i),t.child=Wo(t,null,l,i)):sn(e,t,l,i),t.memoizedState=r.state,s&&i2(t,n,!0),t.child}function ZA(e){var t=e.stateNode;t.pendingContext?s2(e,t.pendingContext,t.pendingContext!==t.context):t.context&&s2(e,t.context,!1),Vb(e,t.containerInfo)}function w2(e,t,n,r,s){return Uo(),Db(s),t.flags|=256,sn(e,t,n,r),t.child}var Bg={dehydrated:null,treeContext:null,retryLane:0};function Fg(e){return{baseLanes:e,cachePool:null,transitions:null}}function eP(e,t,n){var r=t.pendingProps,s=it.current,i=!1,o=(t.flags&128)!==0,l;if((l=o)||(l=e!==null&&e.memoizedState===null?!1:(s&2)!==0),l?(i=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(s|=1),Ke(it,s&1),e===null)return $g(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(o=r.children,e=r.fallback,i?(r=t.mode,i=t.child,o={mode:"hidden",children:o},!(r&1)&&i!==null?(i.childLanes=0,i.pendingProps=o):i=lm(o,r,0,null),e=xi(e,r,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=Fg(n),t.memoizedState=Bg,e):Yb(t,o));if(s=e.memoizedState,s!==null&&(l=s.dehydrated,l!==null))return _R(e,t,o,r,l,s,n);if(i){i=r.fallback,o=t.mode,s=e.child,l=s.sibling;var c={mode:"hidden",children:r.children};return!(o&1)&&t.child!==s?(r=t.child,r.childLanes=0,r.pendingProps=c,t.deletions=null):(r=ps(s,c),r.subtreeFlags=s.subtreeFlags&14680064),l!==null?i=ps(l,i):(i=xi(i,o,n,null),i.flags|=2),i.return=t,r.return=t,r.sibling=i,t.child=r,r=i,i=t.child,o=e.child.memoizedState,o=o===null?Fg(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},i.memoizedState=o,i.childLanes=e.childLanes&~n,t.memoizedState=Bg,r}return i=e.child,e=i.sibling,r=ps(i,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function Yb(e,t){return t=lm({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Jd(e,t,n,r){return r!==null&&Db(r),Wo(t,e.child,null,n),e=Yb(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function _R(e,t,n,r,s,i,o){if(n)return t.flags&256?(t.flags&=-257,r=Kx(Error(te(422))),Jd(e,t,o,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=r.fallback,s=t.mode,r=lm({mode:"visible",children:r.children},s,0,null),i=xi(i,s,o,null),i.flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,t.mode&1&&Wo(t,e.child,null,o),t.child.memoizedState=Fg(o),t.memoizedState=Bg,i);if(!(t.mode&1))return Jd(e,t,o,null);if(s.data==="$!"){if(r=s.nextSibling&&s.nextSibling.dataset,r)var l=r.dgst;return r=l,i=Error(te(419)),r=Kx(i,r,void 0),Jd(e,t,o,r)}if(l=(o&e.childLanes)!==0,Nn||l){if(r=Lt,r!==null){switch(o&-o){case 4:s=2;break;case 16:s=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:s=32;break;case 536870912:s=268435456;break;default:s=0}s=s&(r.suspendedLanes|o)?0:s,s!==0&&s!==i.retryLane&&(i.retryLane=s,_a(e,s),_r(r,e,s,-1))}return n1(),r=Kx(Error(te(421))),Jd(e,t,o,r)}return s.data==="$?"?(t.flags|=128,t.child=e.child,t=BR.bind(null,e),s._reactRetry=t,null):(e=i.treeContext,Dn=cs(s.nextSibling),In=t,nt=!0,Sr=null,e!==null&&(Qn[Jn++]=xa,Qn[Jn++]=ga,Qn[Jn++]=Si,xa=e.id,ga=e.overflow,Si=t),t=Yb(t,r.children),t.flags|=4096,t)}function N2(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Mg(e.return,t,n)}function Gx(e,t,n,r,s){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:s}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=s)}function tP(e,t,n){var r=t.pendingProps,s=r.revealOrder,i=r.tail;if(sn(e,t,r.children,n),r=it.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&N2(e,n,t);else if(e.tag===19)N2(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(Ke(it,r),!(t.mode&1))t.memoizedState=null;else switch(s){case"forwards":for(n=t.child,s=null;n!==null;)e=n.alternate,e!==null&&jp(e)===null&&(s=n),n=n.sibling;n=s,n===null?(s=t.child,t.child=null):(s=n.sibling,n.sibling=null),Gx(t,!1,s,n,i);break;case"backwards":for(n=null,s=t.child,t.child=null;s!==null;){if(e=s.alternate,e!==null&&jp(e)===null){t.child=s;break}e=s.sibling,s.sibling=n,n=s,s=e}Gx(t,!0,n,null,i);break;case"together":Gx(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Lf(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Aa(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Ci|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(te(153));if(t.child!==null){for(e=t.child,n=ps(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=ps(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function AR(e,t,n){switch(t.tag){case 3:ZA(t),Uo();break;case 5:_A(t);break;case 1:Cn(t.type)&&mp(t);break;case 4:Vb(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,s=t.memoizedProps.value;Ke(vp,r._currentValue),r._currentValue=s;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(Ke(it,it.current&1),t.flags|=128,null):n&t.child.childLanes?eP(e,t,n):(Ke(it,it.current&1),e=Aa(e,t,n),e!==null?e.sibling:null);Ke(it,it.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return tP(e,t,n);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),Ke(it,it.current),r)break;return null;case 22:case 23:return t.lanes=0,QA(e,t,n)}return Aa(e,t,n)}var nP,Vg,rP,aP;nP=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};Vg=function(){};rP=function(e,t,n,r){var s=e.memoizedProps;if(s!==r){e=t.stateNode,si(Qr.current);var i=null;switch(n){case"input":s=ug(e,s),r=ug(e,r),i=[];break;case"select":s=lt({},s,{value:void 0}),r=lt({},r,{value:void 0}),i=[];break;case"textarea":s=pg(e,s),r=pg(e,r),i=[];break;default:typeof s.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=pp)}mg(n,r);var o;n=null;for(u in s)if(!r.hasOwnProperty(u)&&s.hasOwnProperty(u)&&s[u]!=null)if(u==="style"){var l=s[u];for(o in l)l.hasOwnProperty(o)&&(n||(n={}),n[o]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(eu.hasOwnProperty(u)?i||(i=[]):(i=i||[]).push(u,null));for(u in r){var c=r[u];if(l=s!=null?s[u]:void 0,r.hasOwnProperty(u)&&c!==l&&(c!=null||l!=null))if(u==="style")if(l){for(o in l)!l.hasOwnProperty(o)||c&&c.hasOwnProperty(o)||(n||(n={}),n[o]="");for(o in c)c.hasOwnProperty(o)&&l[o]!==c[o]&&(n||(n={}),n[o]=c[o])}else n||(i||(i=[]),i.push(u,n)),n=c;else u==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,l=l?l.__html:void 0,c!=null&&l!==c&&(i=i||[]).push(u,c)):u==="children"?typeof c!="string"&&typeof c!="number"||(i=i||[]).push(u,""+c):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(eu.hasOwnProperty(u)?(c!=null&&u==="onScroll"&&Xe("scroll",e),i||l===c||(i=[])):(i=i||[]).push(u,c))}n&&(i=i||[]).push("style",n);var u=i;(t.updateQueue=u)&&(t.flags|=4)}};aP=function(e,t,n,r){n!==r&&(t.flags|=4)};function oc(e,t){if(!nt)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Xt(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var s=e.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags&14680064,r|=s.flags&14680064,s.return=e,s=s.sibling;else for(s=e.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags,r|=s.flags,s.return=e,s=s.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function PR(e,t,n){var r=t.pendingProps;switch(Rb(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Xt(t),null;case 1:return Cn(t.type)&&hp(),Xt(t),null;case 3:return r=t.stateNode,qo(),Ze(kn),Ze(an),Wb(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Yd(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Sr!==null&&(Yg(Sr),Sr=null))),Vg(e,t),Xt(t),null;case 5:Ub(t);var s=si(fu.current);if(n=t.type,e!==null&&t.stateNode!=null)rP(e,t,n,r,s),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(te(166));return Xt(t),null}if(e=si(Qr.current),Yd(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[qr]=t,r[uu]=i,e=(t.mode&1)!==0,n){case"dialog":Xe("cancel",r),Xe("close",r);break;case"iframe":case"object":case"embed":Xe("load",r);break;case"video":case"audio":for(s=0;s<Cc.length;s++)Xe(Cc[s],r);break;case"source":Xe("error",r);break;case"img":case"image":case"link":Xe("error",r),Xe("load",r);break;case"details":Xe("toggle",r);break;case"input":Tw(r,i),Xe("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},Xe("invalid",r);break;case"textarea":Mw(r,i),Xe("invalid",r)}mg(n,i),s=null;for(var o in i)if(i.hasOwnProperty(o)){var l=i[o];o==="children"?typeof l=="string"?r.textContent!==l&&(i.suppressHydrationWarning!==!0&&Xd(r.textContent,l,e),s=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(i.suppressHydrationWarning!==!0&&Xd(r.textContent,l,e),s=["children",""+l]):eu.hasOwnProperty(o)&&l!=null&&o==="onScroll"&&Xe("scroll",r)}switch(n){case"input":Fd(r),$w(r,i,!0);break;case"textarea":Fd(r),Rw(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=pp)}r=s,t.updateQueue=r,r!==null&&(t.flags|=4)}else{o=s.nodeType===9?s:s.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=T_(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=o.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=o.createElement(n,{is:r.is}):(e=o.createElement(n),n==="select"&&(o=e,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):e=o.createElementNS(e,n),e[qr]=t,e[uu]=r,nP(e,t,!1,!1),t.stateNode=e;e:{switch(o=xg(n,r),n){case"dialog":Xe("cancel",e),Xe("close",e),s=r;break;case"iframe":case"object":case"embed":Xe("load",e),s=r;break;case"video":case"audio":for(s=0;s<Cc.length;s++)Xe(Cc[s],e);s=r;break;case"source":Xe("error",e),s=r;break;case"img":case"image":case"link":Xe("error",e),Xe("load",e),s=r;break;case"details":Xe("toggle",e),s=r;break;case"input":Tw(e,r),s=ug(e,r),Xe("invalid",e);break;case"option":s=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},s=lt({},r,{value:void 0}),Xe("invalid",e);break;case"textarea":Mw(e,r),s=pg(e,r),Xe("invalid",e);break;default:s=r}mg(n,s),l=s;for(i in l)if(l.hasOwnProperty(i)){var c=l[i];i==="style"?R_(e,c):i==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&$_(e,c)):i==="children"?typeof c=="string"?(n!=="textarea"||c!=="")&&tu(e,c):typeof c=="number"&&tu(e,""+c):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(eu.hasOwnProperty(i)?c!=null&&i==="onScroll"&&Xe("scroll",e):c!=null&&bb(e,i,c,o))}switch(n){case"input":Fd(e),$w(e,r,!1);break;case"textarea":Fd(e),Rw(e);break;case"option":r.value!=null&&e.setAttribute("value",""+gs(r.value));break;case"select":e.multiple=!!r.multiple,i=r.value,i!=null?Ao(e,!!r.multiple,i,!1):r.defaultValue!=null&&Ao(e,!!r.multiple,r.defaultValue,!0);break;default:typeof s.onClick=="function"&&(e.onclick=pp)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return Xt(t),null;case 6:if(e&&t.stateNode!=null)aP(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(te(166));if(n=si(fu.current),si(Qr.current),Yd(t)){if(r=t.stateNode,n=t.memoizedProps,r[qr]=t,(i=r.nodeValue!==n)&&(e=In,e!==null))switch(e.tag){case 3:Xd(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Xd(r.nodeValue,n,(e.mode&1)!==0)}i&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[qr]=t,t.stateNode=r}return Xt(t),null;case 13:if(Ze(it),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(nt&&Dn!==null&&t.mode&1&&!(t.flags&128))wA(),Uo(),t.flags|=98560,i=!1;else if(i=Yd(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(te(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(te(317));i[qr]=t}else Uo(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Xt(t),i=!1}else Sr!==null&&(Yg(Sr),Sr=null),i=!0;if(!i)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||it.current&1?Pt===0&&(Pt=3):n1())),t.updateQueue!==null&&(t.flags|=4),Xt(t),null);case 4:return qo(),Vg(e,t),e===null&&lu(t.stateNode.containerInfo),Xt(t),null;case 10:return zb(t.type._context),Xt(t),null;case 17:return Cn(t.type)&&hp(),Xt(t),null;case 19:if(Ze(it),i=t.memoizedState,i===null)return Xt(t),null;if(r=(t.flags&128)!==0,o=i.rendering,o===null)if(r)oc(i,!1);else{if(Pt!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=jp(e),o!==null){for(t.flags|=128,oc(i,!1),r=o.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)i=n,e=r,i.flags&=14680066,o=i.alternate,o===null?(i.childLanes=0,i.lanes=e,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=o.childLanes,i.lanes=o.lanes,i.child=o.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=o.memoizedProps,i.memoizedState=o.memoizedState,i.updateQueue=o.updateQueue,i.type=o.type,e=o.dependencies,i.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return Ke(it,it.current&1|2),t.child}e=e.sibling}i.tail!==null&&ht()>Ko&&(t.flags|=128,r=!0,oc(i,!1),t.lanes=4194304)}else{if(!r)if(e=jp(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),oc(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!nt)return Xt(t),null}else 2*ht()-i.renderingStartTime>Ko&&n!==1073741824&&(t.flags|=128,r=!0,oc(i,!1),t.lanes=4194304);i.isBackwards?(o.sibling=t.child,t.child=o):(n=i.last,n!==null?n.sibling=o:t.child=o,i.last=o)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=ht(),t.sibling=null,n=it.current,Ke(it,r?n&1|2:n&1),t):(Xt(t),null);case 22:case 23:return t1(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?$n&1073741824&&(Xt(t),t.subtreeFlags&6&&(t.flags|=8192)):Xt(t),null;case 24:return null;case 25:return null}throw Error(te(156,t.tag))}function ER(e,t){switch(Rb(t),t.tag){case 1:return Cn(t.type)&&hp(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return qo(),Ze(kn),Ze(an),Wb(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Ub(t),null;case 13:if(Ze(it),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(te(340));Uo()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Ze(it),null;case 4:return qo(),null;case 10:return zb(t.type._context),null;case 22:case 23:return t1(),null;case 24:return null;default:return null}}var Zd=!1,Zt=!1,OR=typeof WeakSet=="function"?WeakSet:Set,de=null;function go(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){ut(e,t,r)}else n.current=null}function Ug(e,t,n){try{n()}catch(r){ut(e,t,r)}}var S2=!1;function TR(e,t){if(Cg=up,e=cA(),$b(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var s=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var o=0,l=-1,c=-1,u=0,d=0,f=e,p=null;t:for(;;){for(var h;f!==n||s!==0&&f.nodeType!==3||(l=o+s),f!==i||r!==0&&f.nodeType!==3||(c=o+r),f.nodeType===3&&(o+=f.nodeValue.length),(h=f.firstChild)!==null;)p=f,f=h;for(;;){if(f===e)break t;if(p===n&&++u===s&&(l=o),p===i&&++d===r&&(c=o),(h=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=h}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(_g={focusedElem:e,selectionRange:n},up=!1,de=t;de!==null;)if(t=de,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,de=e;else for(;de!==null;){t=de;try{var m=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(m!==null){var v=m.memoizedProps,x=m.memoizedState,y=t.stateNode,g=y.getSnapshotBeforeUpdate(t.elementType===t.type?v:br(t.type,v),x);y.__reactInternalSnapshotBeforeUpdate=g}break;case 3:var j=t.stateNode.containerInfo;j.nodeType===1?j.textContent="":j.nodeType===9&&j.documentElement&&j.removeChild(j.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(te(163))}}catch(N){ut(t,t.return,N)}if(e=t.sibling,e!==null){e.return=t.return,de=e;break}de=t.return}return m=S2,S2=!1,m}function Dc(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&e)===e){var i=s.destroy;s.destroy=void 0,i!==void 0&&Ug(t,n,i)}s=s.next}while(s!==r)}}function im(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Wg(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function sP(e){var t=e.alternate;t!==null&&(e.alternate=null,sP(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[qr],delete t[uu],delete t[Eg],delete t[hR],delete t[mR])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function iP(e){return e.tag===5||e.tag===3||e.tag===4}function k2(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||iP(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function qg(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=pp));else if(r!==4&&(e=e.child,e!==null))for(qg(e,t,n),e=e.sibling;e!==null;)qg(e,t,n),e=e.sibling}function Hg(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Hg(e,t,n),e=e.sibling;e!==null;)Hg(e,t,n),e=e.sibling}var Ft=null,jr=!1;function Va(e,t,n){for(n=n.child;n!==null;)oP(e,t,n),n=n.sibling}function oP(e,t,n){if(Yr&&typeof Yr.onCommitFiberUnmount=="function")try{Yr.onCommitFiberUnmount(Jh,n)}catch{}switch(n.tag){case 5:Zt||go(n,t);case 6:var r=Ft,s=jr;Ft=null,Va(e,t,n),Ft=r,jr=s,Ft!==null&&(jr?(e=Ft,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Ft.removeChild(n.stateNode));break;case 18:Ft!==null&&(jr?(e=Ft,n=n.stateNode,e.nodeType===8?Fx(e.parentNode,n):e.nodeType===1&&Fx(e,n),su(e)):Fx(Ft,n.stateNode));break;case 4:r=Ft,s=jr,Ft=n.stateNode.containerInfo,jr=!0,Va(e,t,n),Ft=r,jr=s;break;case 0:case 11:case 14:case 15:if(!Zt&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){s=r=r.next;do{var i=s,o=i.destroy;i=i.tag,o!==void 0&&(i&2||i&4)&&Ug(n,t,o),s=s.next}while(s!==r)}Va(e,t,n);break;case 1:if(!Zt&&(go(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){ut(n,t,l)}Va(e,t,n);break;case 21:Va(e,t,n);break;case 22:n.mode&1?(Zt=(r=Zt)||n.memoizedState!==null,Va(e,t,n),Zt=r):Va(e,t,n);break;default:Va(e,t,n)}}function C2(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new OR),t.forEach(function(r){var s=FR.bind(null,e,r);n.has(r)||(n.add(r),r.then(s,s))})}}function mr(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var s=n[r];try{var i=e,o=t,l=o;e:for(;l!==null;){switch(l.tag){case 5:Ft=l.stateNode,jr=!1;break e;case 3:Ft=l.stateNode.containerInfo,jr=!0;break e;case 4:Ft=l.stateNode.containerInfo,jr=!0;break e}l=l.return}if(Ft===null)throw Error(te(160));oP(i,o,s),Ft=null,jr=!1;var c=s.alternate;c!==null&&(c.return=null),s.return=null}catch(u){ut(s,t,u)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)lP(t,e),t=t.sibling}function lP(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(mr(t,e),Br(e),r&4){try{Dc(3,e,e.return),im(3,e)}catch(v){ut(e,e.return,v)}try{Dc(5,e,e.return)}catch(v){ut(e,e.return,v)}}break;case 1:mr(t,e),Br(e),r&512&&n!==null&&go(n,n.return);break;case 5:if(mr(t,e),Br(e),r&512&&n!==null&&go(n,n.return),e.flags&32){var s=e.stateNode;try{tu(s,"")}catch(v){ut(e,e.return,v)}}if(r&4&&(s=e.stateNode,s!=null)){var i=e.memoizedProps,o=n!==null?n.memoizedProps:i,l=e.type,c=e.updateQueue;if(e.updateQueue=null,c!==null)try{l==="input"&&i.type==="radio"&&i.name!=null&&E_(s,i),xg(l,o);var u=xg(l,i);for(o=0;o<c.length;o+=2){var d=c[o],f=c[o+1];d==="style"?R_(s,f):d==="dangerouslySetInnerHTML"?$_(s,f):d==="children"?tu(s,f):bb(s,d,f,u)}switch(l){case"input":dg(s,i);break;case"textarea":O_(s,i);break;case"select":var p=s._wrapperState.wasMultiple;s._wrapperState.wasMultiple=!!i.multiple;var h=i.value;h!=null?Ao(s,!!i.multiple,h,!1):p!==!!i.multiple&&(i.defaultValue!=null?Ao(s,!!i.multiple,i.defaultValue,!0):Ao(s,!!i.multiple,i.multiple?[]:"",!1))}s[uu]=i}catch(v){ut(e,e.return,v)}}break;case 6:if(mr(t,e),Br(e),r&4){if(e.stateNode===null)throw Error(te(162));s=e.stateNode,i=e.memoizedProps;try{s.nodeValue=i}catch(v){ut(e,e.return,v)}}break;case 3:if(mr(t,e),Br(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{su(t.containerInfo)}catch(v){ut(e,e.return,v)}break;case 4:mr(t,e),Br(e);break;case 13:mr(t,e),Br(e),s=e.child,s.flags&8192&&(i=s.memoizedState!==null,s.stateNode.isHidden=i,!i||s.alternate!==null&&s.alternate.memoizedState!==null||(Zb=ht())),r&4&&C2(e);break;case 22:if(d=n!==null&&n.memoizedState!==null,e.mode&1?(Zt=(u=Zt)||d,mr(t,e),Zt=u):mr(t,e),Br(e),r&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!d&&e.mode&1)for(de=e,d=e.child;d!==null;){for(f=de=d;de!==null;){switch(p=de,h=p.child,p.tag){case 0:case 11:case 14:case 15:Dc(4,p,p.return);break;case 1:go(p,p.return);var m=p.stateNode;if(typeof m.componentWillUnmount=="function"){r=p,n=p.return;try{t=r,m.props=t.memoizedProps,m.state=t.memoizedState,m.componentWillUnmount()}catch(v){ut(r,n,v)}}break;case 5:go(p,p.return);break;case 22:if(p.memoizedState!==null){A2(f);continue}}h!==null?(h.return=p,de=h):A2(f)}d=d.sibling}e:for(d=null,f=e;;){if(f.tag===5){if(d===null){d=f;try{s=f.stateNode,u?(i=s.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(l=f.stateNode,c=f.memoizedProps.style,o=c!=null&&c.hasOwnProperty("display")?c.display:null,l.style.display=M_("display",o))}catch(v){ut(e,e.return,v)}}}else if(f.tag===6){if(d===null)try{f.stateNode.nodeValue=u?"":f.memoizedProps}catch(v){ut(e,e.return,v)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===e)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===e)break e;for(;f.sibling===null;){if(f.return===null||f.return===e)break e;d===f&&(d=null),f=f.return}d===f&&(d=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:mr(t,e),Br(e),r&4&&C2(e);break;case 21:break;default:mr(t,e),Br(e)}}function Br(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(iP(n)){var r=n;break e}n=n.return}throw Error(te(160))}switch(r.tag){case 5:var s=r.stateNode;r.flags&32&&(tu(s,""),r.flags&=-33);var i=k2(e);Hg(e,i,s);break;case 3:case 4:var o=r.stateNode.containerInfo,l=k2(e);qg(e,l,o);break;default:throw Error(te(161))}}catch(c){ut(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function $R(e,t,n){de=e,cP(e)}function cP(e,t,n){for(var r=(e.mode&1)!==0;de!==null;){var s=de,i=s.child;if(s.tag===22&&r){var o=s.memoizedState!==null||Zd;if(!o){var l=s.alternate,c=l!==null&&l.memoizedState!==null||Zt;l=Zd;var u=Zt;if(Zd=o,(Zt=c)&&!u)for(de=s;de!==null;)o=de,c=o.child,o.tag===22&&o.memoizedState!==null?P2(s):c!==null?(c.return=o,de=c):P2(s);for(;i!==null;)de=i,cP(i),i=i.sibling;de=s,Zd=l,Zt=u}_2(e)}else s.subtreeFlags&8772&&i!==null?(i.return=s,de=i):_2(e)}}function _2(e){for(;de!==null;){var t=de;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Zt||im(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!Zt)if(n===null)r.componentDidMount();else{var s=t.elementType===t.type?n.memoizedProps:br(t.type,n.memoizedProps);r.componentDidUpdate(s,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&d2(t,i,r);break;case 3:var o=t.updateQueue;if(o!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}d2(t,o,n)}break;case 5:var l=t.stateNode;if(n===null&&t.flags&4){n=l;var c=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":c.autoFocus&&n.focus();break;case"img":c.src&&(n.src=c.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var u=t.alternate;if(u!==null){var d=u.memoizedState;if(d!==null){var f=d.dehydrated;f!==null&&su(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(te(163))}Zt||t.flags&512&&Wg(t)}catch(p){ut(t,t.return,p)}}if(t===e){de=null;break}if(n=t.sibling,n!==null){n.return=t.return,de=n;break}de=t.return}}function A2(e){for(;de!==null;){var t=de;if(t===e){de=null;break}var n=t.sibling;if(n!==null){n.return=t.return,de=n;break}de=t.return}}function P2(e){for(;de!==null;){var t=de;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{im(4,t)}catch(c){ut(t,n,c)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var s=t.return;try{r.componentDidMount()}catch(c){ut(t,s,c)}}var i=t.return;try{Wg(t)}catch(c){ut(t,i,c)}break;case 5:var o=t.return;try{Wg(t)}catch(c){ut(t,o,c)}}}catch(c){ut(t,t.return,c)}if(t===e){de=null;break}var l=t.sibling;if(l!==null){l.return=t.return,de=l;break}de=t.return}}var MR=Math.ceil,Sp=Ma.ReactCurrentDispatcher,Qb=Ma.ReactCurrentOwner,ir=Ma.ReactCurrentBatchConfig,$e=0,Lt=null,bt=null,qt=0,$n=0,vo=Es(0),Pt=0,xu=null,Ci=0,om=0,Jb=0,Ic=null,wn=null,Zb=0,Ko=1/0,pa=null,kp=!1,Kg=null,ds=null,ef=!1,ts=null,Cp=0,Lc=0,Gg=null,zf=-1,Bf=0;function pn(){return $e&6?ht():zf!==-1?zf:zf=ht()}function fs(e){return e.mode&1?$e&2&&qt!==0?qt&-qt:gR.transition!==null?(Bf===0&&(Bf=K_()),Bf):(e=Ie,e!==0||(e=window.event,e=e===void 0?16:eA(e.type)),e):1}function _r(e,t,n,r){if(50<Lc)throw Lc=0,Gg=null,Error(te(185));dd(e,n,r),(!($e&2)||e!==Lt)&&(e===Lt&&(!($e&2)&&(om|=n),Pt===4&&Ja(e,qt)),_n(e,r),n===1&&$e===0&&!(t.mode&1)&&(Ko=ht()+500,rm&&Os()))}function _n(e,t){var n=e.callbackNode;gM(e,t);var r=cp(e,e===Lt?qt:0);if(r===0)n!==null&&Lw(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&Lw(n),t===1)e.tag===0?xR(E2.bind(null,e)):yA(E2.bind(null,e)),fR(function(){!($e&6)&&Os()}),n=null;else{switch(G_(r)){case 1:n=kb;break;case 4:n=q_;break;case 16:n=lp;break;case 536870912:n=H_;break;default:n=lp}n=gP(n,uP.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function uP(e,t){if(zf=-1,Bf=0,$e&6)throw Error(te(327));var n=e.callbackNode;if($o()&&e.callbackNode!==n)return null;var r=cp(e,e===Lt?qt:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=_p(e,r);else{t=r;var s=$e;$e|=2;var i=fP();(Lt!==e||qt!==t)&&(pa=null,Ko=ht()+500,mi(e,t));do try{IR();break}catch(l){dP(e,l)}while(!0);Lb(),Sp.current=i,$e=s,bt!==null?t=0:(Lt=null,qt=0,t=Pt)}if(t!==0){if(t===2&&(s=jg(e),s!==0&&(r=s,t=Xg(e,s))),t===1)throw n=xu,mi(e,0),Ja(e,r),_n(e,ht()),n;if(t===6)Ja(e,r);else{if(s=e.current.alternate,!(r&30)&&!RR(s)&&(t=_p(e,r),t===2&&(i=jg(e),i!==0&&(r=i,t=Xg(e,i))),t===1))throw n=xu,mi(e,0),Ja(e,r),_n(e,ht()),n;switch(e.finishedWork=s,e.finishedLanes=r,t){case 0:case 1:throw Error(te(345));case 2:Gs(e,wn,pa);break;case 3:if(Ja(e,r),(r&130023424)===r&&(t=Zb+500-ht(),10<t)){if(cp(e,0)!==0)break;if(s=e.suspendedLanes,(s&r)!==r){pn(),e.pingedLanes|=e.suspendedLanes&s;break}e.timeoutHandle=Pg(Gs.bind(null,e,wn,pa),t);break}Gs(e,wn,pa);break;case 4:if(Ja(e,r),(r&4194240)===r)break;for(t=e.eventTimes,s=-1;0<r;){var o=31-Cr(r);i=1<<o,o=t[o],o>s&&(s=o),r&=~i}if(r=s,r=ht()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*MR(r/1960))-r,10<r){e.timeoutHandle=Pg(Gs.bind(null,e,wn,pa),r);break}Gs(e,wn,pa);break;case 5:Gs(e,wn,pa);break;default:throw Error(te(329))}}}return _n(e,ht()),e.callbackNode===n?uP.bind(null,e):null}function Xg(e,t){var n=Ic;return e.current.memoizedState.isDehydrated&&(mi(e,t).flags|=256),e=_p(e,t),e!==2&&(t=wn,wn=n,t!==null&&Yg(t)),e}function Yg(e){wn===null?wn=e:wn.push.apply(wn,e)}function RR(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var s=n[r],i=s.getSnapshot;s=s.value;try{if(!Mr(i(),s))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Ja(e,t){for(t&=~Jb,t&=~om,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Cr(t),r=1<<n;e[n]=-1,t&=~r}}function E2(e){if($e&6)throw Error(te(327));$o();var t=cp(e,0);if(!(t&1))return _n(e,ht()),null;var n=_p(e,t);if(e.tag!==0&&n===2){var r=jg(e);r!==0&&(t=r,n=Xg(e,r))}if(n===1)throw n=xu,mi(e,0),Ja(e,t),_n(e,ht()),n;if(n===6)throw Error(te(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Gs(e,wn,pa),_n(e,ht()),null}function e1(e,t){var n=$e;$e|=1;try{return e(t)}finally{$e=n,$e===0&&(Ko=ht()+500,rm&&Os())}}function _i(e){ts!==null&&ts.tag===0&&!($e&6)&&$o();var t=$e;$e|=1;var n=ir.transition,r=Ie;try{if(ir.transition=null,Ie=1,e)return e()}finally{Ie=r,ir.transition=n,$e=t,!($e&6)&&Os()}}function t1(){$n=vo.current,Ze(vo)}function mi(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,dR(n)),bt!==null)for(n=bt.return;n!==null;){var r=n;switch(Rb(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&hp();break;case 3:qo(),Ze(kn),Ze(an),Wb();break;case 5:Ub(r);break;case 4:qo();break;case 13:Ze(it);break;case 19:Ze(it);break;case 10:zb(r.type._context);break;case 22:case 23:t1()}n=n.return}if(Lt=e,bt=e=ps(e.current,null),qt=$n=t,Pt=0,xu=null,Jb=om=Ci=0,wn=Ic=null,ai!==null){for(t=0;t<ai.length;t++)if(n=ai[t],r=n.interleaved,r!==null){n.interleaved=null;var s=r.next,i=n.pending;if(i!==null){var o=i.next;i.next=s,r.next=o}n.pending=r}ai=null}return e}function dP(e,t){do{var n=bt;try{if(Lb(),Df.current=Np,wp){for(var r=ot.memoizedState;r!==null;){var s=r.queue;s!==null&&(s.pending=null),r=r.next}wp=!1}if(ki=0,Dt=_t=ot=null,Rc=!1,pu=0,Qb.current=null,n===null||n.return===null){Pt=1,xu=t,bt=null;break}e:{var i=e,o=n.return,l=n,c=t;if(t=qt,l.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var u=c,d=l,f=d.tag;if(!(d.mode&1)&&(f===0||f===11||f===15)){var p=d.alternate;p?(d.updateQueue=p.updateQueue,d.memoizedState=p.memoizedState,d.lanes=p.lanes):(d.updateQueue=null,d.memoizedState=null)}var h=g2(o);if(h!==null){h.flags&=-257,v2(h,o,l,i,t),h.mode&1&&x2(i,u,t),t=h,c=u;var m=t.updateQueue;if(m===null){var v=new Set;v.add(c),t.updateQueue=v}else m.add(c);break e}else{if(!(t&1)){x2(i,u,t),n1();break e}c=Error(te(426))}}else if(nt&&l.mode&1){var x=g2(o);if(x!==null){!(x.flags&65536)&&(x.flags|=256),v2(x,o,l,i,t),Db(Ho(c,l));break e}}i=c=Ho(c,l),Pt!==4&&(Pt=2),Ic===null?Ic=[i]:Ic.push(i),i=o;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var y=GA(i,c,t);u2(i,y);break e;case 1:l=c;var g=i.type,j=i.stateNode;if(!(i.flags&128)&&(typeof g.getDerivedStateFromError=="function"||j!==null&&typeof j.componentDidCatch=="function"&&(ds===null||!ds.has(j)))){i.flags|=65536,t&=-t,i.lanes|=t;var N=XA(i,l,t);u2(i,N);break e}}i=i.return}while(i!==null)}hP(n)}catch(w){t=w,bt===n&&n!==null&&(bt=n=n.return);continue}break}while(!0)}function fP(){var e=Sp.current;return Sp.current=Np,e===null?Np:e}function n1(){(Pt===0||Pt===3||Pt===2)&&(Pt=4),Lt===null||!(Ci&268435455)&&!(om&268435455)||Ja(Lt,qt)}function _p(e,t){var n=$e;$e|=2;var r=fP();(Lt!==e||qt!==t)&&(pa=null,mi(e,t));do try{DR();break}catch(s){dP(e,s)}while(!0);if(Lb(),$e=n,Sp.current=r,bt!==null)throw Error(te(261));return Lt=null,qt=0,Pt}function DR(){for(;bt!==null;)pP(bt)}function IR(){for(;bt!==null&&!lM();)pP(bt)}function pP(e){var t=xP(e.alternate,e,$n);e.memoizedProps=e.pendingProps,t===null?hP(e):bt=t,Qb.current=null}function hP(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=ER(n,t),n!==null){n.flags&=32767,bt=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Pt=6,bt=null;return}}else if(n=PR(n,t,$n),n!==null){bt=n;return}if(t=t.sibling,t!==null){bt=t;return}bt=t=e}while(t!==null);Pt===0&&(Pt=5)}function Gs(e,t,n){var r=Ie,s=ir.transition;try{ir.transition=null,Ie=1,LR(e,t,n,r)}finally{ir.transition=s,Ie=r}return null}function LR(e,t,n,r){do $o();while(ts!==null);if($e&6)throw Error(te(327));n=e.finishedWork;var s=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(te(177));e.callbackNode=null,e.callbackPriority=0;var i=n.lanes|n.childLanes;if(vM(e,i),e===Lt&&(bt=Lt=null,qt=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||ef||(ef=!0,gP(lp,function(){return $o(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=ir.transition,ir.transition=null;var o=Ie;Ie=1;var l=$e;$e|=4,Qb.current=null,TR(e,n),lP(n,e),aR(_g),up=!!Cg,_g=Cg=null,e.current=n,$R(n),cM(),$e=l,Ie=o,ir.transition=i}else e.current=n;if(ef&&(ef=!1,ts=e,Cp=s),i=e.pendingLanes,i===0&&(ds=null),fM(n.stateNode),_n(e,ht()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)s=t[n],r(s.value,{componentStack:s.stack,digest:s.digest});if(kp)throw kp=!1,e=Kg,Kg=null,e;return Cp&1&&e.tag!==0&&$o(),i=e.pendingLanes,i&1?e===Gg?Lc++:(Lc=0,Gg=e):Lc=0,Os(),null}function $o(){if(ts!==null){var e=G_(Cp),t=ir.transition,n=Ie;try{if(ir.transition=null,Ie=16>e?16:e,ts===null)var r=!1;else{if(e=ts,ts=null,Cp=0,$e&6)throw Error(te(331));var s=$e;for($e|=4,de=e.current;de!==null;){var i=de,o=i.child;if(de.flags&16){var l=i.deletions;if(l!==null){for(var c=0;c<l.length;c++){var u=l[c];for(de=u;de!==null;){var d=de;switch(d.tag){case 0:case 11:case 15:Dc(8,d,i)}var f=d.child;if(f!==null)f.return=d,de=f;else for(;de!==null;){d=de;var p=d.sibling,h=d.return;if(sP(d),d===u){de=null;break}if(p!==null){p.return=h,de=p;break}de=h}}}var m=i.alternate;if(m!==null){var v=m.child;if(v!==null){m.child=null;do{var x=v.sibling;v.sibling=null,v=x}while(v!==null)}}de=i}}if(i.subtreeFlags&2064&&o!==null)o.return=i,de=o;else e:for(;de!==null;){if(i=de,i.flags&2048)switch(i.tag){case 0:case 11:case 15:Dc(9,i,i.return)}var y=i.sibling;if(y!==null){y.return=i.return,de=y;break e}de=i.return}}var g=e.current;for(de=g;de!==null;){o=de;var j=o.child;if(o.subtreeFlags&2064&&j!==null)j.return=o,de=j;else e:for(o=g;de!==null;){if(l=de,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:im(9,l)}}catch(w){ut(l,l.return,w)}if(l===o){de=null;break e}var N=l.sibling;if(N!==null){N.return=l.return,de=N;break e}de=l.return}}if($e=s,Os(),Yr&&typeof Yr.onPostCommitFiberRoot=="function")try{Yr.onPostCommitFiberRoot(Jh,e)}catch{}r=!0}return r}finally{Ie=n,ir.transition=t}}return!1}function O2(e,t,n){t=Ho(n,t),t=GA(e,t,1),e=us(e,t,1),t=pn(),e!==null&&(dd(e,1,t),_n(e,t))}function ut(e,t,n){if(e.tag===3)O2(e,e,n);else for(;t!==null;){if(t.tag===3){O2(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(ds===null||!ds.has(r))){e=Ho(n,e),e=XA(t,e,1),t=us(t,e,1),e=pn(),t!==null&&(dd(t,1,e),_n(t,e));break}}t=t.return}}function zR(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=pn(),e.pingedLanes|=e.suspendedLanes&n,Lt===e&&(qt&n)===n&&(Pt===4||Pt===3&&(qt&130023424)===qt&&500>ht()-Zb?mi(e,0):Jb|=n),_n(e,t)}function mP(e,t){t===0&&(e.mode&1?(t=Wd,Wd<<=1,!(Wd&130023424)&&(Wd=4194304)):t=1);var n=pn();e=_a(e,t),e!==null&&(dd(e,t,n),_n(e,n))}function BR(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),mP(e,n)}function FR(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,s=e.memoizedState;s!==null&&(n=s.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(te(314))}r!==null&&r.delete(t),mP(e,n)}var xP;xP=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||kn.current)Nn=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Nn=!1,AR(e,t,n);Nn=!!(e.flags&131072)}else Nn=!1,nt&&t.flags&1048576&&bA(t,gp,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Lf(e,t),e=t.pendingProps;var s=Vo(t,an.current);To(t,n),s=Hb(null,t,r,e,s,n);var i=Kb();return t.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Cn(r)?(i=!0,mp(t)):i=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,Fb(t),s.updater=sm,t.stateNode=s,s._reactInternals=t,Dg(t,r,e,n),t=zg(null,t,r,!0,i,n)):(t.tag=0,nt&&i&&Mb(t),sn(null,t,s,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Lf(e,t),e=t.pendingProps,s=r._init,r=s(r._payload),t.type=r,s=t.tag=UR(r),e=br(r,e),s){case 0:t=Lg(null,t,r,e,n);break e;case 1:t=j2(null,t,r,e,n);break e;case 11:t=y2(null,t,r,e,n);break e;case 14:t=b2(null,t,r,br(r.type,e),n);break e}throw Error(te(306,r,""))}return t;case 0:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:br(r,s),Lg(e,t,r,s,n);case 1:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:br(r,s),j2(e,t,r,s,n);case 3:e:{if(ZA(t),e===null)throw Error(te(387));r=t.pendingProps,i=t.memoizedState,s=i.element,CA(e,t),bp(t,r,null,n);var o=t.memoizedState;if(r=o.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){s=Ho(Error(te(423)),t),t=w2(e,t,r,n,s);break e}else if(r!==s){s=Ho(Error(te(424)),t),t=w2(e,t,r,n,s);break e}else for(Dn=cs(t.stateNode.containerInfo.firstChild),In=t,nt=!0,Sr=null,n=SA(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Uo(),r===s){t=Aa(e,t,n);break e}sn(e,t,r,n)}t=t.child}return t;case 5:return _A(t),e===null&&$g(t),r=t.type,s=t.pendingProps,i=e!==null?e.memoizedProps:null,o=s.children,Ag(r,s)?o=null:i!==null&&Ag(r,i)&&(t.flags|=32),JA(e,t),sn(e,t,o,n),t.child;case 6:return e===null&&$g(t),null;case 13:return eP(e,t,n);case 4:return Vb(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Wo(t,null,r,n):sn(e,t,r,n),t.child;case 11:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:br(r,s),y2(e,t,r,s,n);case 7:return sn(e,t,t.pendingProps,n),t.child;case 8:return sn(e,t,t.pendingProps.children,n),t.child;case 12:return sn(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,s=t.pendingProps,i=t.memoizedProps,o=s.value,Ke(vp,r._currentValue),r._currentValue=o,i!==null)if(Mr(i.value,o)){if(i.children===s.children&&!kn.current){t=Aa(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var l=i.dependencies;if(l!==null){o=i.child;for(var c=l.firstContext;c!==null;){if(c.context===r){if(i.tag===1){c=wa(-1,n&-n),c.tag=2;var u=i.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?c.next=c:(c.next=d.next,d.next=c),u.pending=c}}i.lanes|=n,c=i.alternate,c!==null&&(c.lanes|=n),Mg(i.return,n,t),l.lanes|=n;break}c=c.next}}else if(i.tag===10)o=i.type===t.type?null:i.child;else if(i.tag===18){if(o=i.return,o===null)throw Error(te(341));o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),Mg(o,n,t),o=i.sibling}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===t){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}sn(e,t,s.children,n),t=t.child}return t;case 9:return s=t.type,r=t.pendingProps.children,To(t,n),s=cr(s),r=r(s),t.flags|=1,sn(e,t,r,n),t.child;case 14:return r=t.type,s=br(r,t.pendingProps),s=br(r.type,s),b2(e,t,r,s,n);case 15:return YA(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:br(r,s),Lf(e,t),t.tag=1,Cn(r)?(e=!0,mp(t)):e=!1,To(t,n),KA(t,r,s),Dg(t,r,s,n),zg(null,t,r,!0,e,n);case 19:return tP(e,t,n);case 22:return QA(e,t,n)}throw Error(te(156,t.tag))};function gP(e,t){return W_(e,t)}function VR(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function rr(e,t,n,r){return new VR(e,t,n,r)}function r1(e){return e=e.prototype,!(!e||!e.isReactComponent)}function UR(e){if(typeof e=="function")return r1(e)?1:0;if(e!=null){if(e=e.$$typeof,e===wb)return 11;if(e===Nb)return 14}return 2}function ps(e,t){var n=e.alternate;return n===null?(n=rr(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Ff(e,t,n,r,s,i){var o=2;if(r=e,typeof e=="function")r1(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case oo:return xi(n.children,s,i,t);case jb:o=8,s|=8;break;case ig:return e=rr(12,n,t,s|2),e.elementType=ig,e.lanes=i,e;case og:return e=rr(13,n,t,s),e.elementType=og,e.lanes=i,e;case lg:return e=rr(19,n,t,s),e.elementType=lg,e.lanes=i,e;case __:return lm(n,s,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case k_:o=10;break e;case C_:o=9;break e;case wb:o=11;break e;case Nb:o=14;break e;case Ha:o=16,r=null;break e}throw Error(te(130,e==null?e:typeof e,""))}return t=rr(o,n,t,s),t.elementType=e,t.type=r,t.lanes=i,t}function xi(e,t,n,r){return e=rr(7,e,r,t),e.lanes=n,e}function lm(e,t,n,r){return e=rr(22,e,r,t),e.elementType=__,e.lanes=n,e.stateNode={isHidden:!1},e}function Xx(e,t,n){return e=rr(6,e,null,t),e.lanes=n,e}function Yx(e,t,n){return t=rr(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function WR(e,t,n,r,s){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Ex(0),this.expirationTimes=Ex(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ex(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function a1(e,t,n,r,s,i,o,l,c){return e=new WR(e,t,n,l,c),t===1?(t=1,i===!0&&(t|=8)):t=0,i=rr(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Fb(i),e}function qR(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:io,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function vP(e){if(!e)return vs;e=e._reactInternals;e:{if(zi(e)!==e||e.tag!==1)throw Error(te(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Cn(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(te(171))}if(e.tag===1){var n=e.type;if(Cn(n))return vA(e,n,t)}return t}function yP(e,t,n,r,s,i,o,l,c){return e=a1(n,r,!0,e,s,i,o,l,c),e.context=vP(null),n=e.current,r=pn(),s=fs(n),i=wa(r,s),i.callback=t??null,us(n,i,s),e.current.lanes=s,dd(e,s,r),_n(e,r),e}function cm(e,t,n,r){var s=t.current,i=pn(),o=fs(s);return n=vP(n),t.context===null?t.context=n:t.pendingContext=n,t=wa(i,o),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=us(s,t,o),e!==null&&(_r(e,s,o,i),Rf(e,s,o)),o}function Ap(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function T2(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function s1(e,t){T2(e,t),(e=e.alternate)&&T2(e,t)}function HR(){return null}var bP=typeof reportError=="function"?reportError:function(e){console.error(e)};function i1(e){this._internalRoot=e}um.prototype.render=i1.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(te(409));cm(e,t,null,null)};um.prototype.unmount=i1.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;_i(function(){cm(null,e,null,null)}),t[Ca]=null}};function um(e){this._internalRoot=e}um.prototype.unstable_scheduleHydration=function(e){if(e){var t=Q_();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Qa.length&&t!==0&&t<Qa[n].priority;n++);Qa.splice(n,0,e),n===0&&Z_(e)}};function o1(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function dm(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function $2(){}function KR(e,t,n,r,s){if(s){if(typeof r=="function"){var i=r;r=function(){var u=Ap(o);i.call(u)}}var o=yP(t,r,e,0,null,!1,!1,"",$2);return e._reactRootContainer=o,e[Ca]=o.current,lu(e.nodeType===8?e.parentNode:e),_i(),o}for(;s=e.lastChild;)e.removeChild(s);if(typeof r=="function"){var l=r;r=function(){var u=Ap(c);l.call(u)}}var c=a1(e,0,!1,null,null,!1,!1,"",$2);return e._reactRootContainer=c,e[Ca]=c.current,lu(e.nodeType===8?e.parentNode:e),_i(function(){cm(t,c,n,r)}),c}function fm(e,t,n,r,s){var i=n._reactRootContainer;if(i){var o=i;if(typeof s=="function"){var l=s;s=function(){var c=Ap(o);l.call(c)}}cm(t,o,e,s)}else o=KR(n,t,e,s,r);return Ap(o)}X_=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=kc(t.pendingLanes);n!==0&&(Cb(t,n|1),_n(t,ht()),!($e&6)&&(Ko=ht()+500,Os()))}break;case 13:_i(function(){var r=_a(e,1);if(r!==null){var s=pn();_r(r,e,1,s)}}),s1(e,1)}};_b=function(e){if(e.tag===13){var t=_a(e,134217728);if(t!==null){var n=pn();_r(t,e,134217728,n)}s1(e,134217728)}};Y_=function(e){if(e.tag===13){var t=fs(e),n=_a(e,t);if(n!==null){var r=pn();_r(n,e,t,r)}s1(e,t)}};Q_=function(){return Ie};J_=function(e,t){var n=Ie;try{return Ie=e,t()}finally{Ie=n}};vg=function(e,t,n){switch(t){case"input":if(dg(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var s=nm(r);if(!s)throw Error(te(90));P_(r),dg(r,s)}}}break;case"textarea":O_(e,n);break;case"select":t=n.value,t!=null&&Ao(e,!!n.multiple,t,!1)}};L_=e1;z_=_i;var GR={usingClientEntryPoint:!1,Events:[pd,fo,nm,D_,I_,e1]},lc={findFiberByHostInstance:ri,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},XR={bundleType:lc.bundleType,version:lc.version,rendererPackageName:lc.rendererPackageName,rendererConfig:lc.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Ma.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=V_(e),e===null?null:e.stateNode},findFiberByHostInstance:lc.findFiberByHostInstance||HR,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var tf=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!tf.isDisabled&&tf.supportsFiber)try{Jh=tf.inject(XR),Yr=tf}catch{}}Vn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=GR;Vn.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!o1(t))throw Error(te(200));return qR(e,t,null,n)};Vn.createRoot=function(e,t){if(!o1(e))throw Error(te(299));var n=!1,r="",s=bP;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(s=t.onRecoverableError)),t=a1(e,1,!1,null,null,n,!1,r,s),e[Ca]=t.current,lu(e.nodeType===8?e.parentNode:e),new i1(t)};Vn.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(te(188)):(e=Object.keys(e).join(","),Error(te(268,e)));return e=V_(t),e=e===null?null:e.stateNode,e};Vn.flushSync=function(e){return _i(e)};Vn.hydrate=function(e,t,n){if(!dm(t))throw Error(te(200));return fm(null,e,t,!0,n)};Vn.hydrateRoot=function(e,t,n){if(!o1(e))throw Error(te(405));var r=n!=null&&n.hydratedSources||null,s=!1,i="",o=bP;if(n!=null&&(n.unstable_strictMode===!0&&(s=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(o=n.onRecoverableError)),t=yP(t,null,e,1,n??null,s,!1,i,o),e[Ca]=t.current,lu(e),r)for(e=0;e<r.length;e++)n=r[e],s=n._getVersion,s=s(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,s]:t.mutableSourceEagerHydrationData.push(n,s);return new um(t)};Vn.render=function(e,t,n){if(!dm(t))throw Error(te(200));return fm(null,e,t,!1,n)};Vn.unmountComponentAtNode=function(e){if(!dm(e))throw Error(te(40));return e._reactRootContainer?(_i(function(){fm(null,null,e,!1,function(){e._reactRootContainer=null,e[Ca]=null})}),!0):!1};Vn.unstable_batchedUpdates=e1;Vn.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!dm(n))throw Error(te(200));if(e==null||e._reactInternals===void 0)throw Error(te(38));return fm(e,t,n,!1,r)};Vn.version="18.3.1-next-f1338f8080-20240426";function jP(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(jP)}catch(e){console.error(e)}}jP(),j_.exports=Vn;var Bi=j_.exports;const YR=De(Bi);var M2=Bi;ag.createRoot=M2.createRoot,ag.hydrateRoot=M2.hydrateRoot;/**
* @remix-run/router v1.23.2
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/function gu(){return gu=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},gu.apply(this,arguments)}var ns;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(ns||(ns={}));const R2="popstate";function QR(e){e===void 0&&(e={});function t(r,s){let{pathname:i,search:o,hash:l}=r.location;return Qg("",{pathname:i,search:o,hash:l},s.state&&s.state.usr||null,s.state&&s.state.key||"default")}function n(r,s){return typeof s=="string"?s:Pp(s)}return ZR(t,n,null,e)}function wt(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function l1(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function JR(){return Math.random().toString(36).substr(2,8)}function D2(e,t){return{usr:e.state,key:e.key,idx:t}}function Qg(e,t,n,r){return n===void 0&&(n=null),gu({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?Pl(t):t,{state:n,key:t&&t.key||r||JR()})}function Pp(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function Pl(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function ZR(e,t,n,r){r===void 0&&(r={});let{window:s=document.defaultView,v5Compat:i=!1}=r,o=s.history,l=ns.Pop,c=null,u=d();u==null&&(u=0,o.replaceState(gu({},o.state,{idx:u}),""));function d(){return(o.state||{idx:null}).idx}function f(){l=ns.Pop;let x=d(),y=x==null?null:x-u;u=x,c&&c({action:l,location:v.location,delta:y})}function p(x,y){l=ns.Push;let g=Qg(v.location,x,y);u=d()+1;let j=D2(g,u),N=v.createHref(g);try{o.pushState(j,"",N)}catch(w){if(w instanceof DOMException&&w.name==="DataCloneError")throw w;s.location.assign(N)}i&&c&&c({action:l,location:v.location,delta:1})}function h(x,y){l=ns.Replace;let g=Qg(v.location,x,y);u=d();let j=D2(g,u),N=v.createHref(g);o.replaceState(j,"",N),i&&c&&c({action:l,location:v.location,delta:0})}function m(x){let y=s.location.origin!=="null"?s.location.origin:s.location.href,g=typeof x=="string"?x:Pp(x);return g=g.replace(/ $/,"%20"),wt(y,"No window.location.(origin|href) available to create URL for href: "+g),new URL(g,y)}let v={get action(){return l},get location(){return e(s,o)},listen(x){if(c)throw new Error("A history only accepts one active listener");return s.addEventListener(R2,f),c=x,()=>{s.removeEventListener(R2,f),c=null}},createHref(x){return t(s,x)},createURL:m,encodeLocation(x){let y=m(x);return{pathname:y.pathname,search:y.search,hash:y.hash}},push:p,replace:h,go(x){return o.go(x)}};return v}var I2;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(I2||(I2={}));function eD(e,t,n){return n===void 0&&(n="/"),tD(e,t,n)}function tD(e,t,n,r){let s=typeof t=="string"?Pl(t):t,i=c1(s.pathname||"/",n);if(i==null)return null;let o=wP(e);nD(o);let l=null;for(let c=0;l==null&&c<o.length;++c){let u=hD(i);l=dD(o[c],u)}return l}function wP(e,t,n,r){t===void 0&&(t=[]),n===void 0&&(n=[]),r===void 0&&(r="");let s=(i,o,l)=>{let c={relativePath:l===void 0?i.path||"":l,caseSensitive:i.caseSensitive===!0,childrenIndex:o,route:i};c.relativePath.startsWith("/")&&(wt(c.relativePath.startsWith(r),'Absolute route path "'+c.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),c.relativePath=c.relativePath.slice(r.length));let u=hs([r,c.relativePath]),d=n.concat(c);i.children&&i.children.length>0&&(wt(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),wP(i.children,t,d,u)),!(i.path==null&&!i.index)&&t.push({path:u,score:cD(u,i.index),routesMeta:d})};return e.forEach((i,o)=>{var l;if(i.path===""||!((l=i.path)!=null&&l.includes("?")))s(i,o);else for(let c of NP(i.path))s(i,o,c)}),t}function NP(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,s=n.endsWith("?"),i=n.replace(/\?$/,"");if(r.length===0)return s?[i,""]:[i];let o=NP(r.join("/")),l=[];return l.push(...o.map(c=>c===""?i:[i,c].join("/"))),s&&l.push(...o),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function nD(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:uD(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const rD=/^:[\w-]+$/,aD=3,sD=2,iD=1,oD=10,lD=-2,L2=e=>e==="*";function cD(e,t){let n=e.split("/"),r=n.length;return n.some(L2)&&(r+=lD),t&&(r+=sD),n.filter(s=>!L2(s)).reduce((s,i)=>s+(rD.test(i)?aD:i===""?iD:oD),r)}function uD(e,t){return e.length===t.length&&e.slice(0,-1).every((r,s)=>r===t[s])?e[e.length-1]-t[t.length-1]:0}function dD(e,t,n){let{routesMeta:r}=e,s={},i="/",o=[];for(let l=0;l<r.length;++l){let c=r[l],u=l===r.length-1,d=i==="/"?t:t.slice(i.length)||"/",f=fD({path:c.relativePath,caseSensitive:c.caseSensitive,end:u},d),p=c.route;if(!f)return null;Object.assign(s,f.params),o.push({params:s,pathname:hs([i,f.pathname]),pathnameBase:yD(hs([i,f.pathnameBase])),route:p}),f.pathnameBase!=="/"&&(i=hs([i,f.pathnameBase]))}return o}function fD(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=pD(e.path,e.caseSensitive,e.end),s=t.match(n);if(!s)return null;let i=s[0],o=i.replace(/(.)\/+$/,"$1"),l=s.slice(1);return{params:r.reduce((u,d,f)=>{let{paramName:p,isOptional:h}=d;if(p==="*"){let v=l[f]||"";o=i.slice(0,i.length-v.length).replace(/(.)\/+$/,"$1")}const m=l[f];return h&&!m?u[p]=void 0:u[p]=(m||"").replace(/%2F/g,"/"),u},{}),pathname:i,pathnameBase:o,pattern:e}}function pD(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),l1(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let r=[],s="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,l,c)=>(r.push({paramName:l,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),s+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?s+="\\/*$":e!==""&&e!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,t?void 0:"i"),r]}function hD(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return l1(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function c1(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}const mD=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,xD=e=>mD.test(e);function gD(e,t){t===void 0&&(t="/");let{pathname:n,search:r="",hash:s=""}=typeof e=="string"?Pl(e):e,i;if(n)if(xD(n))i=n;else{if(n.includes("//")){let o=n;n=n.replace(/\/\/+/g,"/"),l1(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+n))}n.startsWith("/")?i=z2(n.substring(1),"/"):i=z2(n,t)}else i=t;return{pathname:i,search:bD(r),hash:jD(s)}}function z2(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(s=>{s===".."?n.length>1&&n.pop():s!=="."&&n.push(s)}),n.length>1?n.join("/"):"/"}function Qx(e,t,n,r){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function vD(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function SP(e,t){let n=vD(e);return t?n.map((r,s)=>s===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function kP(e,t,n,r){r===void 0&&(r=!1);let s;typeof e=="string"?s=Pl(e):(s=gu({},e),wt(!s.pathname||!s.pathname.includes("?"),Qx("?","pathname","search",s)),wt(!s.pathname||!s.pathname.includes("#"),Qx("#","pathname","hash",s)),wt(!s.search||!s.search.includes("#"),Qx("#","search","hash",s)));let i=e===""||s.pathname==="",o=i?"/":s.pathname,l;if(o==null)l=n;else{let f=t.length-1;if(!r&&o.startsWith("..")){let p=o.split("/");for(;p[0]==="..";)p.shift(),f-=1;s.pathname=p.join("/")}l=f>=0?t[f]:"/"}let c=gD(s,l),u=o&&o!=="/"&&o.endsWith("/"),d=(i||o===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(u||d)&&(c.pathname+="/"),c}const hs=e=>e.join("/").replace(/\/\/+/g,"/"),yD=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),bD=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,jD=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function wD(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const CP=["post","put","patch","delete"];new Set(CP);const ND=["get",...CP];new Set(ND);/**
* React Router v6.30.3
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/function vu(){return vu=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},vu.apply(this,arguments)}const u1=b.createContext(null),SD=b.createContext(null),Fi=b.createContext(null),pm=b.createContext(null),Vi=b.createContext({outlet:null,matches:[],isDataRoute:!1}),_P=b.createContext(null);function kD(e,t){let{relative:n}=t===void 0?{}:t;md()||wt(!1);let{basename:r,navigator:s}=b.useContext(Fi),{hash:i,pathname:o,search:l}=PP(e,{relative:n}),c=o;return r!=="/"&&(c=o==="/"?r:hs([r,o])),s.createHref({pathname:c,search:l,hash:i})}function md(){return b.useContext(pm)!=null}function El(){return md()||wt(!1),b.useContext(pm).location}function AP(e){b.useContext(Fi).static||b.useLayoutEffect(e)}function hm(){let{isDataRoute:e}=b.useContext(Vi);return e?LD():CD()}function CD(){md()||wt(!1);let e=b.useContext(u1),{basename:t,future:n,navigator:r}=b.useContext(Fi),{matches:s}=b.useContext(Vi),{pathname:i}=El(),o=JSON.stringify(SP(s,n.v7_relativeSplatPath)),l=b.useRef(!1);return AP(()=>{l.current=!0}),b.useCallback(function(u,d){if(d===void 0&&(d={}),!l.current)return;if(typeof u=="number"){r.go(u);return}let f=kP(u,JSON.parse(o),i,d.relative==="path");e==null&&t!=="/"&&(f.pathname=f.pathname==="/"?t:hs([t,f.pathname])),(d.replace?r.replace:r.push)(f,d.state,d)},[t,r,o,i,e])}function PP(e,t){let{relative:n}=t===void 0?{}:t,{future:r}=b.useContext(Fi),{matches:s}=b.useContext(Vi),{pathname:i}=El(),o=JSON.stringify(SP(s,r.v7_relativeSplatPath));return b.useMemo(()=>kP(e,JSON.parse(o),i,n==="path"),[e,o,i,n])}function _D(e,t){return AD(e,t)}function AD(e,t,n,r){md()||wt(!1);let{navigator:s}=b.useContext(Fi),{matches:i}=b.useContext(Vi),o=i[i.length-1],l=o?o.params:{};o&&o.pathname;let c=o?o.pathnameBase:"/";o&&o.route;let u=El(),d;if(t){var f;let x=typeof t=="string"?Pl(t):t;c==="/"||(f=x.pathname)!=null&&f.startsWith(c)||wt(!1),d=x}else d=u;let p=d.pathname||"/",h=p;if(c!=="/"){let x=c.replace(/^\//,"").split("/");h="/"+p.replace(/^\//,"").split("/").slice(x.length).join("/")}let m=eD(e,{pathname:h}),v=$D(m&&m.map(x=>Object.assign({},x,{params:Object.assign({},l,x.params),pathname:hs([c,s.encodeLocation?s.encodeLocation(x.pathname).pathname:x.pathname]),pathnameBase:x.pathnameBase==="/"?c:hs([c,s.encodeLocation?s.encodeLocation(x.pathnameBase).pathname:x.pathnameBase])})),i,n,r);return t&&v?b.createElement(pm.Provider,{value:{location:vu({pathname:"/",search:"",hash:"",state:null,key:"default"},d),navigationType:ns.Pop}},v):v}function PD(){let e=ID(),t=wD(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,s={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return b.createElement(b.Fragment,null,b.createElement("h2",null,"Unexpected Application Error!"),b.createElement("h3",{style:{fontStyle:"italic"}},t),n?b.createElement("pre",{style:s},n):null,null)}const ED=b.createElement(PD,null);class OD extends b.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?b.createElement(Vi.Provider,{value:this.props.routeContext},b.createElement(_P.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function TD(e){let{routeContext:t,match:n,children:r}=e,s=b.useContext(u1);return s&&s.static&&s.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=n.route.id),b.createElement(Vi.Provider,{value:t},r)}function $D(e,t,n,r){var s;if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var i;if(!n)return null;if(n.errors)e=n.matches;else if((i=r)!=null&&i.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let o=e,l=(s=n)==null?void 0:s.errors;if(l!=null){let d=o.findIndex(f=>f.route.id&&(l==null?void 0:l[f.route.id])!==void 0);d>=0||wt(!1),o=o.slice(0,Math.min(o.length,d+1))}let c=!1,u=-1;if(n&&r&&r.v7_partialHydration)for(let d=0;d<o.length;d++){let f=o[d];if((f.route.HydrateFallback||f.route.hydrateFallbackElement)&&(u=d),f.route.id){let{loaderData:p,errors:h}=n,m=f.route.loader&&p[f.route.id]===void 0&&(!h||h[f.route.id]===void 0);if(f.route.lazy||m){c=!0,u>=0?o=o.slice(0,u+1):o=[o[0]];break}}}return o.reduceRight((d,f,p)=>{let h,m=!1,v=null,x=null;n&&(h=l&&f.route.id?l[f.route.id]:void 0,v=f.route.errorElement||ED,c&&(u<0&&p===0?(zD("route-fallback"),m=!0,x=null):u===p&&(m=!0,x=f.route.hydrateFallbackElement||null)));let y=t.concat(o.slice(0,p+1)),g=()=>{let j;return h?j=v:m?j=x:f.route.Component?j=b.createElement(f.route.Component,null):f.route.element?j=f.route.element:j=d,b.createElement(TD,{match:f,routeContext:{outlet:d,matches:y,isDataRoute:n!=null},children:j})};return n&&(f.route.ErrorBoundary||f.route.errorElement||p===0)?b.createElement(OD,{location:n.location,revalidation:n.revalidation,component:v,error:h,children:g(),routeContext:{outlet:null,matches:y,isDataRoute:!0}}):g()},null)}var EP=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(EP||{}),OP=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(OP||{});function MD(e){let t=b.useContext(u1);return t||wt(!1),t}function RD(e){let t=b.useContext(SD);return t||wt(!1),t}function DD(e){let t=b.useContext(Vi);return t||wt(!1),t}function TP(e){let t=DD(),n=t.matches[t.matches.length-1];return n.route.id||wt(!1),n.route.id}function ID(){var e;let t=b.useContext(_P),n=RD(),r=TP();return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function LD(){let{router:e}=MD(EP.UseNavigateStable),t=TP(OP.UseNavigateStable),n=b.useRef(!1);return AP(()=>{n.current=!0}),b.useCallback(function(s,i){i===void 0&&(i={}),n.current&&(typeof s=="number"?e.navigate(s):e.navigate(s,vu({fromRouteId:t},i)))},[e,t])}const B2={};function zD(e,t,n){B2[e]||(B2[e]=!0)}function BD(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function st(e){wt(!1)}function FD(e){let{basename:t="/",children:n=null,location:r,navigationType:s=ns.Pop,navigator:i,static:o=!1,future:l}=e;md()&&wt(!1);let c=t.replace(/^\/*/,"/"),u=b.useMemo(()=>({basename:c,navigator:i,static:o,future:vu({v7_relativeSplatPath:!1},l)}),[c,l,i,o]);typeof r=="string"&&(r=Pl(r));let{pathname:d="/",search:f="",hash:p="",state:h=null,key:m="default"}=r,v=b.useMemo(()=>{let x=c1(d,c);return x==null?null:{location:{pathname:x,search:f,hash:p,state:h,key:m},navigationType:s}},[c,d,f,p,h,m,s]);return v==null?null:b.createElement(Fi.Provider,{value:u},b.createElement(pm.Provider,{children:n,value:v}))}function VD(e){let{children:t,location:n}=e;return _D(Jg(t),n)}new Promise(()=>{});function Jg(e,t){t===void 0&&(t=[]);let n=[];return b.Children.forEach(e,(r,s)=>{if(!b.isValidElement(r))return;let i=[...t,s];if(r.type===b.Fragment){n.push.apply(n,Jg(r.props.children,i));return}r.type!==st&&wt(!1),!r.props.index||!r.props.children||wt(!1);let o={id:r.props.id||i.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(o.children=Jg(r.props.children,i)),n.push(o)}),n}/**
* React Router DOM v6.30.3
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/function Zg(){return Zg=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Zg.apply(this,arguments)}function UD(e,t){if(e==null)return{};var n={},r=Object.keys(e),s,i;for(i=0;i<r.length;i++)s=r[i],!(t.indexOf(s)>=0)&&(n[s]=e[s]);return n}function WD(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function qD(e,t){return e.button===0&&(!t||t==="_self")&&!WD(e)}const HD=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],KD="6";try{window.__reactRouterVersion=KD}catch{}const GD="startTransition",F2=z8[GD];function XD(e){let{basename:t,children:n,future:r,window:s}=e,i=b.useRef();i.current==null&&(i.current=QR({window:s,v5Compat:!0}));let o=i.current,[l,c]=b.useState({action:o.action,location:o.location}),{v7_startTransition:u}=r||{},d=b.useCallback(f=>{u&&F2?F2(()=>c(f)):c(f)},[c,u]);return b.useLayoutEffect(()=>o.listen(d),[o,d]),b.useEffect(()=>BD(r),[r]),b.createElement(FD,{basename:t,children:n,location:l.location,navigationType:l.action,navigator:o,future:r})}const YD=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",QD=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,$P=b.forwardRef(function(t,n){let{onClick:r,relative:s,reloadDocument:i,replace:o,state:l,target:c,to:u,preventScrollReset:d,viewTransition:f}=t,p=UD(t,HD),{basename:h}=b.useContext(Fi),m,v=!1;if(typeof u=="string"&&QD.test(u)&&(m=u,YD))try{let j=new URL(window.location.href),N=u.startsWith("//")?new URL(j.protocol+u):new URL(u),w=c1(N.pathname,h);N.origin===j.origin&&w!=null?u=w+N.search+N.hash:v=!0}catch{}let x=kD(u,{relative:s}),y=JD(u,{replace:o,state:l,target:c,preventScrollReset:d,relative:s,viewTransition:f});function g(j){r&&r(j),j.defaultPrevented||y(j)}return b.createElement("a",Zg({},p,{href:m||x,onClick:v||i?r:g,ref:n,target:c}))});var V2;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(V2||(V2={}));var U2;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(U2||(U2={}));function JD(e,t){let{target:n,replace:r,state:s,preventScrollReset:i,relative:o,viewTransition:l}=t===void 0?{}:t,c=hm(),u=El(),d=PP(e,{relative:o});return b.useCallback(f=>{if(qD(f,n)){f.preventDefault();let p=r!==void 0?r:Pp(u)===Pp(d);c(e,{replace:p,state:s,preventScrollReset:i,relative:o,viewTransition:l})}},[u,c,d,r,s,n,e,i,o,l])}/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ZD=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),MP=(...e)=>e.filter((t,n,r)=>!!t&&r.indexOf(t)===n).join(" ");/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/var eI={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const tI=b.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:s="",children:i,iconNode:o,...l},c)=>b.createElement("svg",{ref:c,...eI,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:MP("lucide",s),...l},[...o.map(([u,d])=>b.createElement(u,d)),...Array.isArray(i)?i:[i]]));/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Y=(e,t)=>{const n=b.forwardRef(({className:r,...s},i)=>b.createElement(tI,{ref:i,iconNode:t,className:MP(`lucide-${ZD(e)}`,r),...s}));return n.displayName=`${e}`,n};/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const nI=Y("ArchiveRestore",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h2",key:"tvwodi"}],["path",{d:"M20 8v11a2 2 0 0 1-2 2h-2",key:"1gkqxj"}],["path",{d:"m9 15 3-3 3 3",key:"1pd0qc"}],["path",{d:"M12 12v9",key:"192myk"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const rI=Y("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"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const aI=Y("ArrowDownLeft",[["path",{d:"M17 7 7 17",key:"15tmo1"}],["path",{d:"M17 17H7V7",key:"1org7z"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ui=Y("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const RP=Y("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const sI=Y("ArrowUpRight",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const iI=Y("Award",[["path",{d:"m15.477 12.89 1.515 8.526a.5.5 0 0 1-.81.47l-3.58-2.687a1 1 0 0 0-1.197 0l-3.586 2.686a.5.5 0 0 1-.81-.469l1.514-8.526",key:"1yiouv"}],["circle",{cx:"12",cy:"8",r:"6",key:"1vp47v"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ys=Y("BarChart2",[["line",{x1:"18",x2:"18",y1:"20",y2:"10",key:"1xfpm4"}],["line",{x1:"12",x2:"12",y1:"20",y2:"4",key:"be30l9"}],["line",{x1:"6",x2:"6",y1:"20",y2:"14",key:"1r4le6"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const yu=Y("BarChart3",[["path",{d:"M3 3v18h18",key:"1s2lah"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const oI=Y("BellOff",[["path",{d:"M8.7 3A6 6 0 0 1 18 8a21.3 21.3 0 0 0 .6 5",key:"o7mx20"}],["path",{d:"M17 17H3s3-2 3-9a4.67 4.67 0 0 1 .3-1.7",key:"16f1lm"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Vf=Y("Bell",[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ep=Y("BookOpen",[["path",{d:"M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z",key:"vv98re"}],["path",{d:"M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z",key:"1cyq3y"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const lI=Y("BookmarkPlus",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}],["line",{x1:"12",x2:"12",y1:"7",y2:"13",key:"1cppfj"}],["line",{x1:"15",x2:"9",y1:"10",y2:"10",key:"1gty7f"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ra=Y("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const d1=Y("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const mm=Y("Briefcase",[["path",{d:"M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16",key:"jecpp"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const f1=Y("Building2",[["path",{d:"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",key:"1b4qmf"}],["path",{d:"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"i71pzd"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2",key:"10jefs"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"M10 10h4",key:"tcdvrf"}],["path",{d:"M10 14h4",key:"kelpxr"}],["path",{d:"M10 18h4",key:"1ulq68"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const DP=Y("CalendarDays",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Op=Y("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const W2=Y("CameraOff",[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16",key:"qmtpty"}],["path",{d:"M9.5 4h5L17 7h3a2 2 0 0 1 2 2v7.5",key:"1ufyfc"}],["path",{d:"M14.121 15.121A3 3 0 1 1 9.88 10.88",key:"11zox6"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const q2=Y("Camera",[["path",{d:"M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z",key:"1tc9qg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Tp=Y("CheckCheck",[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const jt=Y("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const aa=Y("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const xd=Y("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Pa=Y("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const p1=Y("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ar=Y("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const h1=Y("CircleArrowRight",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"m12 16 4-4-4-4",key:"1i9zcv"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ts=Y("CircleCheckBig",[["path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14",key:"g774vq"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const nn=Y("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ol=Y("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const IP=Y("CirclePause",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"10",x2:"10",y1:"15",y2:"9",key:"c1nkhi"}],["line",{x1:"14",x2:"14",y1:"15",y2:"9",key:"h65svq"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Jx=Y("CircleUserRound",[["path",{d:"M18 20a6 6 0 0 0-12 0",key:"1qehca"}],["circle",{cx:"12",cy:"10",r:"4",key:"1h16sb"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ai=Y("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const bu=Y("ClipboardList",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const hn=Y("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const cI=Y("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"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const xm=Y("DollarSign",[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const m1=Y("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const uI=Y("EllipsisVertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const LP=Y("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const $p=Y("Eye",[["path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z",key:"rwhkz3"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Hr=Y("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const dI=Y("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ev=Y("Flag",[["path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z",key:"i9b6wo"}],["line",{x1:"4",x2:"4",y1:"22",y2:"15",key:"1cm3nv"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const fI=Y("FlaskConical",[["path",{d:"M10 2v7.527a2 2 0 0 1-.211.896L4.72 20.55a1 1 0 0 0 .9 1.45h12.76a1 1 0 0 0 .9-1.45l-5.069-10.127A2 2 0 0 1 14 9.527V2",key:"pzvekw"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M7 16h10",key:"wp8him"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const zP=Y("Gift",[["rect",{x:"3",y:"8",width:"18",height:"4",rx:"1",key:"bkv52"}],["path",{d:"M12 8v13",key:"1c76mn"}],["path",{d:"M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7",key:"6wjy6b"}],["path",{d:"M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5",key:"1ihvrl"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const pI=Y("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const hI=Y("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const mI=Y("Headphones",[["path",{d:"M3 14h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-7a9 9 0 0 1 18 0v7a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3",key:"1xhozi"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const xI=Y("HeartPulse",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}],["path",{d:"M3.22 12H9.5l.5-1 2 4.5 2-7 1.5 3.5h5.27",key:"1uw2ng"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const BP=Y("ImagePlus",[["path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7",key:"31hg93"}],["line",{x1:"16",x2:"22",y1:"5",y2:"5",key:"ez7e4s"}],["line",{x1:"19",x2:"19",y1:"2",y2:"8",key:"1gkr8c"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const FP=Y("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Pr=Y("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"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const gI=Y("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const vI=Y("KeyRound",[["path",{d:"M2 18v3c0 .6.4 1 1 1h4v-3h3v-3h2l1.4-1.4a6.5 6.5 0 1 0-4-4Z",key:"167ctg"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const yI=Y("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"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const tv=Y("Landmark",[["line",{x1:"3",x2:"21",y1:"22",y2:"22",key:"j8o0r"}],["line",{x1:"6",x2:"6",y1:"18",y2:"11",key:"10tf0k"}],["line",{x1:"10",x2:"10",y1:"18",y2:"11",key:"54lgf6"}],["line",{x1:"14",x2:"14",y1:"18",y2:"11",key:"380y"}],["line",{x1:"18",x2:"18",y1:"18",y2:"11",key:"1kevvc"}],["polygon",{points:"12 2 20 7 4 7",key:"jkujk7"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const bI=Y("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const nv=Y("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const VP=Y("LayoutGrid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const jI=Y("LayoutTemplate",[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const nf=Y("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Go=Y("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const UP=Y("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const WP=Y("List",[["line",{x1:"8",x2:"21",y1:"6",y2:"6",key:"7ey8pc"}],["line",{x1:"8",x2:"21",y1:"12",y2:"12",key:"rjfblc"}],["line",{x1:"8",x2:"21",y1:"18",y2:"18",key:"c3b1m8"}],["line",{x1:"3",x2:"3.01",y1:"6",y2:"6",key:"1g7gq3"}],["line",{x1:"3",x2:"3.01",y1:"12",y2:"12",key:"1pjlvk"}],["line",{x1:"3",x2:"3.01",y1:"18",y2:"18",key:"28t2mc"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Vr=Y("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const wI=Y("LogIn",[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const NI=Y("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const SI=Y("MailOpen",[["path",{d:"M21.2 8.4c.5.38.8.97.8 1.6v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V10a2 2 0 0 1 .8-1.6l8-6a2 2 0 0 1 2.4 0l8 6Z",key:"1jhwl8"}],["path",{d:"m22 10-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 10",key:"1qfld7"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const kI=Y("Mail",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const gm=Y("MapPin",[["path",{d:"M20 10c0 6-8 12-8 12s-8-6-8-12a8 8 0 0 1 16 0Z",key:"2oe9fu"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ju=Y("Megaphone",[["path",{d:"m3 11 18-5v12L3 14v-3z",key:"n962bs"}],["path",{d:"M11.6 16.8a3 3 0 1 1-5.8-1.6",key:"1yl0tm"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const CI=Y("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const x1=Y("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const rn=Y("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const _I=Y("MessagesSquare",[["path",{d:"M14 9a2 2 0 0 1-2 2H6l-4 4V4c0-1.1.9-2 2-2h8a2 2 0 0 1 2 2z",key:"jj09z8"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1",key:"1cx29u"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const g1=Y("Mic",[["path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z",key:"131961"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const qP=Y("MousePointerClick",[["path",{d:"m9 9 5 12 1.8-5.2L21 14Z",key:"1b76lo"}],["path",{d:"M7.2 2.2 8 5.1",key:"1cfko1"}],["path",{d:"m5.1 8-2.9-.8",key:"1go3kf"}],["path",{d:"M14 4.1 12 6",key:"ita8i4"}],["path",{d:"m6 12-1.9 2",key:"mnht97"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const AI=Y("Network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const PI=Y("Package2",[["path",{d:"M3 9h18v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V9Z",key:"1ront0"}],["path",{d:"m3 9 2.45-4.9A2 2 0 0 1 7.24 3h9.52a2 2 0 0 1 1.8 1.1L21 9",key:"19h2x1"}],["path",{d:"M12 3v6",key:"1holv5"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Mp=Y("PackageOpen",[["path",{d:"M12 22v-9",key:"x3hkom"}],["path",{d:"M15.17 2.21a1.67 1.67 0 0 1 1.63 0L21 4.57a1.93 1.93 0 0 1 0 3.36L8.82 14.79a1.655 1.655 0 0 1-1.64 0L3 12.43a1.93 1.93 0 0 1 0-3.36z",key:"2ntwy6"}],["path",{d:"M20 13v3.87a2.06 2.06 0 0 1-1.11 1.83l-6 3.08a1.93 1.93 0 0 1-1.78 0l-6-3.08A2.06 2.06 0 0 1 4 16.87V13",key:"1pmm1c"}],["path",{d:"M21 12.43a1.93 1.93 0 0 0 0-3.36L8.83 2.2a1.64 1.64 0 0 0-1.63 0L3 4.57a1.93 1.93 0 0 0 0 3.36l12.18 6.86a1.636 1.636 0 0 0 1.63 0z",key:"12ttoo"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const bs=Y("Package",[["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const EI=Y("Palette",[["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z",key:"12rzf8"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const OI=Y("Paperclip",[["path",{d:"m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48",key:"1u3ebp"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const vm=Y("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z",key:"ymcmye"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Er=Y("Pen",[["path",{d:"M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z",key:"5qss01"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const HP=Y("Pencil",[["path",{d:"M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z",key:"5qss01"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const wu=Y("Phone",[["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const TI=Y("PinOff",[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["line",{x1:"12",x2:"12",y1:"17",y2:"22",key:"1jrz49"}],["path",{d:"M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V17h12",key:"13x2n8"}],["path",{d:"M15 9.34V6h1a2 2 0 0 0 0-4H7.89",key:"reo3ki"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const H2=Y("Pin",[["line",{x1:"12",x2:"12",y1:"17",y2:"22",key:"1jrz49"}],["path",{d:"M5 17h14v-1.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V6h1a2 2 0 0 0 0-4H8a2 2 0 0 0 0 4h1v4.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24Z",key:"13yl11"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Oe=Y("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const $I=Y("PowerOff",[["path",{d:"M18.36 6.64A9 9 0 0 1 20.77 15",key:"dxknvb"}],["path",{d:"M6.16 6.16a9 9 0 1 0 12.68 12.68",key:"1x7qb5"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const KP=Y("Power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const GP=Y("Printer",[["path",{d:"M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2",key:"143wyd"}],["path",{d:"M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6",key:"1itne7"}],["rect",{x:"6",y:"14",width:"12",height:"8",rx:"1",key:"1ue0tg"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const XP=Y("Puzzle",[["path",{d:"M19.439 7.85c-.049.322.059.648.289.878l1.568 1.568c.47.47.706 1.087.706 1.704s-.235 1.233-.706 1.704l-1.611 1.611a.98.98 0 0 1-.837.276c-.47-.07-.802-.48-.968-.925a2.501 2.501 0 1 0-3.214 3.214c.446.166.855.497.925.968a.979.979 0 0 1-.276.837l-1.61 1.61a2.404 2.404 0 0 1-1.705.707 2.402 2.402 0 0 1-1.704-.706l-1.568-1.568a1.026 1.026 0 0 0-.877-.29c-.493.074-.84.504-1.02.968a2.5 2.5 0 1 1-3.237-3.237c.464-.18.894-.527.967-1.02a1.026 1.026 0 0 0-.289-.877l-1.568-1.568A2.402 2.402 0 0 1 1.998 12c0-.617.236-1.234.706-1.704L4.23 8.77c.24-.24.581-.353.917-.303.515.077.877.528 1.073 1.01a2.5 2.5 0 1 0 3.259-3.259c-.482-.196-.933-.558-1.01-1.073-.05-.336.062-.676.303-.917l1.525-1.525A2.402 2.402 0 0 1 12 1.998c.617 0 1.234.236 1.704.706l1.568 1.568c.23.23.556.338.877.29.493-.074.84-.504 1.02-.968a2.5 2.5 0 1 1 3.237 3.237c-.464.18-.894.527-.967 1.02Z",key:"i0oyt7"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const js=Y("QrCode",[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ke=Y("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const MI=Y("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const or=Y("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ir=Y("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Rr=Y("Send",[["path",{d:"m22 2-7 20-4-9-9-4Z",key:"1q3vgg"}],["path",{d:"M22 2 11 13",key:"nzbqef"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const RI=Y("Settings2",[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const v1=Y("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const YP=Y("ShieldAlert",[["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"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Pi=Y("ShieldCheck",[["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"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ws=Y("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"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const QP=Y("ShoppingBag",[["path",{d:"M6 2 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4Z",key:"hou9p0"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M16 10a4 4 0 0 1-8 0",key:"1ltviw"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const JP=Y("ShoppingCart",[["circle",{cx:"8",cy:"21",r:"1",key:"jimo8o"}],["circle",{cx:"19",cy:"21",r:"1",key:"13723u"}],["path",{d:"M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12",key:"9zh506"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const DI=Y("Siren",[["path",{d:"M7 18v-6a5 5 0 1 1 10 0v6",key:"pcx96s"}],["path",{d:"M5 21a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-1a2 2 0 0 0-2-2H7a2 2 0 0 0-2 2z",key:"1b4s83"}],["path",{d:"M21 12h1",key:"jtio3y"}],["path",{d:"M18.5 4.5 18 5",key:"g5sp9y"}],["path",{d:"M2 12h1",key:"1uaihz"}],["path",{d:"M12 2v1",key:"11qlp1"}],["path",{d:"m4.929 4.929.707.707",key:"1i51kw"}],["path",{d:"M12 12v6",key:"3ahymv"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const y1=Y("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const II=Y("Smile",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const rv=Y("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const LI=Y("StarOff",[["path",{d:"M8.34 8.34 2 9.27l5 4.87L5.82 21 12 17.77 18.18 21l-.59-3.43",key:"16m0ql"}],["path",{d:"M18.42 12.76 22 9.27l-6.91-1L12 2l-1.44 2.91",key:"1vt8nq"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const gd=Y("Star",[["polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2",key:"8f66p6"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const zI=Y("Stethoscope",[["path",{d:"M4.8 2.3A.3.3 0 1 0 5 2H4a2 2 0 0 0-2 2v5a6 6 0 0 0 6 6v0a6 6 0 0 0 6-6V4a2 2 0 0 0-2-2h-1a.2.2 0 1 0 .3.3",key:"1jd90r"}],["path",{d:"M8 15v1a6 6 0 0 0 6 6v0a6 6 0 0 0 6-6v-4",key:"126ukv"}],["circle",{cx:"20",cy:"10",r:"2",key:"ts1r5v"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Xo=Y("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const BI=Y("Target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const av=Y("Ticket",[["path",{d:"M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"qn84l0"}],["path",{d:"M13 5v2",key:"dyzc3o"}],["path",{d:"M13 17v2",key:"1ont0d"}],["path",{d:"M13 11v2",key:"1wjjxi"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ZP=Y("Timer",[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ns=Y("ToggleLeft",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"6",ry:"6",key:"f2vt7d"}],["circle",{cx:"8",cy:"12",r:"2",key:"1nvbw3"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ss=Y("ToggleRight",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"6",ry:"6",key:"f2vt7d"}],["circle",{cx:"16",cy:"12",r:"2",key:"4ma0v8"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Te=Y("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const FI=Y("TrendingDown",[["polyline",{points:"22 17 13.5 8.5 8.5 13.5 2 7",key:"1r2t7k"}],["polyline",{points:"16 17 22 17 22 11",key:"11uiuu"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Wi=Y("TrendingUp",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Kt=Y("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ym=Y("Trophy",[["path",{d:"M6 9H4.5a2.5 2.5 0 0 1 0-5H6",key:"17hqa7"}],["path",{d:"M18 9h1.5a2.5 2.5 0 0 0 0-5H18",key:"lmptdp"}],["path",{d:"M4 22h16",key:"57wxv0"}],["path",{d:"M10 14.66V17c0 .55-.47.98-.97 1.21C7.85 18.75 7 20.24 7 22",key:"1nw9bq"}],["path",{d:"M14 14.66V17c0 .55.47.98.97 1.21C16.15 18.75 17 20.24 17 22",key:"1np0yb"}],["path",{d:"M18 2H6v7a6 6 0 0 0 12 0V2Z",key:"u46fv3"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Nu=Y("Truck",[["path",{d:"M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2",key:"wrbu53"}],["path",{d:"M15 18H9",key:"1lyqi6"}],["path",{d:"M19 18h2a1 1 0 0 0 1-1v-3.65a1 1 0 0 0-.22-.624l-3.48-4.35A1 1 0 0 0 17.52 8H14",key:"lysw3i"}],["circle",{cx:"17",cy:"18",r:"2",key:"332jqn"}],["circle",{cx:"7",cy:"18",r:"2",key:"19iecd"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const eE=Y("Type",[["polyline",{points:"4 7 4 4 20 4 20 7",key:"1nosan"}],["line",{x1:"9",x2:"15",y1:"20",y2:"20",key:"swin9y"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Uf=Y("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Tl=Y("UserCheck",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["polyline",{points:"16 11 18 13 22 9",key:"1pwet4"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const VI=Y("UserCog",[["circle",{cx:"18",cy:"15",r:"3",key:"gjjjvw"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M10 15H6a4 4 0 0 0-4 4v2",key:"1nfge6"}],["path",{d:"m21.7 16.4-.9-.3",key:"12j9ji"}],["path",{d:"m15.2 13.9-.9-.3",key:"1fdjdi"}],["path",{d:"m16.6 18.7.3-.9",key:"heedtr"}],["path",{d:"m19.1 12.2.3-.9",key:"1af3ki"}],["path",{d:"m19.6 18.7-.4-1",key:"1x9vze"}],["path",{d:"m16.8 12.3-.4-1",key:"vqeiwj"}],["path",{d:"m14.3 16.6 1-.4",key:"1qlj63"}],["path",{d:"m20.7 13.8 1-.4",key:"1v5t8k"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const UI=Y("UserPlus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ks=Y("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const WI=Y("UsersRound",[["path",{d:"M18 21a8 8 0 0 0-16 0",key:"3ypg7q"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"M22 20c0-3.37-2-6.5-4-8a5 5 0 0 0-.45-8.3",key:"10s06x"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const et=Y("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const tE=Y("Video",[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const sv=Y("Webhook",[["path",{d:"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2",key:"q3hayz"}],["path",{d:"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06",key:"1go1hn"}],["path",{d:"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8",key:"qlwsc0"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const K2=Y("WifiOff",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const nE=Y("Wifi",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ce=Y("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Mo=Y("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"}]]);function rE(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(n=rE(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Ne(){for(var e,t,n=0,r="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=rE(e))&&(r&&(r+=" "),r+=t);return r}var qI=Array.isArray,En=qI,HI=typeof Ld=="object"&&Ld&&Ld.Object===Object&&Ld,aE=HI,KI=aE,GI=typeof self=="object"&&self&&self.Object===Object&&self,XI=KI||GI||Function("return this")(),ca=XI,YI=ca,QI=YI.Symbol,vd=QI,G2=vd,sE=Object.prototype,JI=sE.hasOwnProperty,ZI=sE.toString,cc=G2?G2.toStringTag:void 0;function eL(e){var t=JI.call(e,cc),n=e[cc];try{e[cc]=void 0;var r=!0}catch{}var s=ZI.call(e);return r&&(t?e[cc]=n:delete e[cc]),s}var tL=eL,nL=Object.prototype,rL=nL.toString;function aL(e){return rL.call(e)}var sL=aL,X2=vd,iL=tL,oL=sL,lL="[object Null]",cL="[object Undefined]",Y2=X2?X2.toStringTag:void 0;function uL(e){return e==null?e===void 0?cL:lL:Y2&&Y2 in Object(e)?iL(e):oL(e)}var Ra=uL;function dL(e){return e!=null&&typeof e=="object"}var Da=dL,fL=Ra,pL=Da,hL="[object Symbol]";function mL(e){return typeof e=="symbol"||pL(e)&&fL(e)==hL}var $l=mL,xL=En,gL=$l,vL=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,yL=/^\w*$/;function bL(e,t){if(xL(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||gL(e)?!0:yL.test(e)||!vL.test(e)||t!=null&&e in Object(t)}var b1=bL;function jL(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var $s=jL;const Ml=De($s);var wL=Ra,NL=$s,SL="[object AsyncFunction]",kL="[object Function]",CL="[object GeneratorFunction]",_L="[object Proxy]";function AL(e){if(!NL(e))return!1;var t=wL(e);return t==kL||t==CL||t==SL||t==_L}var j1=AL;const ve=De(j1);var PL=ca,EL=PL["__core-js_shared__"],OL=EL,Zx=OL,Q2=function(){var e=/[^.]+$/.exec(Zx&&Zx.keys&&Zx.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function TL(e){return!!Q2&&Q2 in e}var $L=TL,ML=Function.prototype,RL=ML.toString;function DL(e){if(e!=null){try{return RL.call(e)}catch{}try{return e+""}catch{}}return""}var iE=DL,IL=j1,LL=$L,zL=$s,BL=iE,FL=/[\\^$.*+?()[\]{}|]/g,VL=/^\[object .+?Constructor\]$/,UL=Function.prototype,WL=Object.prototype,qL=UL.toString,HL=WL.hasOwnProperty,KL=RegExp("^"+qL.call(HL).replace(FL,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function GL(e){if(!zL(e)||LL(e))return!1;var t=IL(e)?KL:VL;return t.test(BL(e))}var XL=GL;function YL(e,t){return e==null?void 0:e[t]}var QL=YL,JL=XL,ZL=QL;function e9(e,t){var n=ZL(e,t);return JL(n)?n:void 0}var qi=e9,t9=qi,n9=t9(Object,"create"),bm=n9,J2=bm;function r9(){this.__data__=J2?J2(null):{},this.size=0}var a9=r9;function s9(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var i9=s9,o9=bm,l9="__lodash_hash_undefined__",c9=Object.prototype,u9=c9.hasOwnProperty;function d9(e){var t=this.__data__;if(o9){var n=t[e];return n===l9?void 0:n}return u9.call(t,e)?t[e]:void 0}var f9=d9,p9=bm,h9=Object.prototype,m9=h9.hasOwnProperty;function x9(e){var t=this.__data__;return p9?t[e]!==void 0:m9.call(t,e)}var g9=x9,v9=bm,y9="__lodash_hash_undefined__";function b9(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=v9&&t===void 0?y9:t,this}var j9=b9,w9=a9,N9=i9,S9=f9,k9=g9,C9=j9;function Rl(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Rl.prototype.clear=w9;Rl.prototype.delete=N9;Rl.prototype.get=S9;Rl.prototype.has=k9;Rl.prototype.set=C9;var _9=Rl;function A9(){this.__data__=[],this.size=0}var P9=A9;function E9(e,t){return e===t||e!==e&&t!==t}var w1=E9,O9=w1;function T9(e,t){for(var n=e.length;n--;)if(O9(e[n][0],t))return n;return-1}var jm=T9,$9=jm,M9=Array.prototype,R9=M9.splice;function D9(e){var t=this.__data__,n=$9(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():R9.call(t,n,1),--this.size,!0}var I9=D9,L9=jm;function z9(e){var t=this.__data__,n=L9(t,e);return n<0?void 0:t[n][1]}var B9=z9,F9=jm;function V9(e){return F9(this.__data__,e)>-1}var U9=V9,W9=jm;function q9(e,t){var n=this.__data__,r=W9(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}var H9=q9,K9=P9,G9=I9,X9=B9,Y9=U9,Q9=H9;function Dl(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Dl.prototype.clear=K9;Dl.prototype.delete=G9;Dl.prototype.get=X9;Dl.prototype.has=Y9;Dl.prototype.set=Q9;var wm=Dl,J9=qi,Z9=ca,ez=J9(Z9,"Map"),N1=ez,Z2=_9,tz=wm,nz=N1;function rz(){this.size=0,this.__data__={hash:new Z2,map:new(nz||tz),string:new Z2}}var az=rz;function sz(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var iz=sz,oz=iz;function lz(e,t){var n=e.__data__;return oz(t)?n[typeof t=="string"?"string":"hash"]:n.map}var Nm=lz,cz=Nm;function uz(e){var t=cz(this,e).delete(e);return this.size-=t?1:0,t}var dz=uz,fz=Nm;function pz(e){return fz(this,e).get(e)}var hz=pz,mz=Nm;function xz(e){return mz(this,e).has(e)}var gz=xz,vz=Nm;function yz(e,t){var n=vz(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}var bz=yz,jz=az,wz=dz,Nz=hz,Sz=gz,kz=bz;function Il(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Il.prototype.clear=jz;Il.prototype.delete=wz;Il.prototype.get=Nz;Il.prototype.has=Sz;Il.prototype.set=kz;var S1=Il,oE=S1,Cz="Expected a function";function k1(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(Cz);var n=function(){var r=arguments,s=t?t.apply(this,r):r[0],i=n.cache;if(i.has(s))return i.get(s);var o=e.apply(this,r);return n.cache=i.set(s,o)||i,o};return n.cache=new(k1.Cache||oE),n}k1.Cache=oE;var lE=k1;const _z=De(lE);var Az=lE,Pz=500;function Ez(e){var t=Az(e,function(r){return n.size===Pz&&n.clear(),r}),n=t.cache;return t}var Oz=Ez,Tz=Oz,$z=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Mz=/\\(\\)?/g,Rz=Tz(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace($z,function(n,r,s,i){t.push(s?i.replace(Mz,"$1"):r||n)}),t}),Dz=Rz;function Iz(e,t){for(var n=-1,r=e==null?0:e.length,s=Array(r);++n<r;)s[n]=t(e[n],n,e);return s}var C1=Iz,eN=vd,Lz=C1,zz=En,Bz=$l,tN=eN?eN.prototype:void 0,nN=tN?tN.toString:void 0;function cE(e){if(typeof e=="string")return e;if(zz(e))return Lz(e,cE)+"";if(Bz(e))return nN?nN.call(e):"";var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}var Fz=cE,Vz=Fz;function Uz(e){return e==null?"":Vz(e)}var uE=Uz,Wz=En,qz=b1,Hz=Dz,Kz=uE;function Gz(e,t){return Wz(e)?e:qz(e,t)?[e]:Hz(Kz(e))}var dE=Gz,Xz=$l;function Yz(e){if(typeof e=="string"||Xz(e))return e;var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}var Sm=Yz,Qz=dE,Jz=Sm;function Zz(e,t){t=Qz(t,e);for(var n=0,r=t.length;e!=null&&n<r;)e=e[Jz(t[n++])];return n&&n==r?e:void 0}var _1=Zz,e7=_1;function t7(e,t,n){var r=e==null?void 0:e7(e,t);return r===void 0?n:r}var fE=t7;const Ln=De(fE);function n7(e){return e==null}var r7=n7;const je=De(r7);var a7=Ra,s7=En,i7=Da,o7="[object String]";function l7(e){return typeof e=="string"||!s7(e)&&i7(e)&&a7(e)==o7}var c7=l7;const Ei=De(c7);var pE={exports:{}},Le={};/**
* @license React
* react-is.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var A1=Symbol.for("react.element"),P1=Symbol.for("react.portal"),km=Symbol.for("react.fragment"),Cm=Symbol.for("react.strict_mode"),_m=Symbol.for("react.profiler"),Am=Symbol.for("react.provider"),Pm=Symbol.for("react.context"),u7=Symbol.for("react.server_context"),Em=Symbol.for("react.forward_ref"),Om=Symbol.for("react.suspense"),Tm=Symbol.for("react.suspense_list"),$m=Symbol.for("react.memo"),Mm=Symbol.for("react.lazy"),d7=Symbol.for("react.offscreen"),hE;hE=Symbol.for("react.module.reference");function fr(e){if(typeof e=="object"&&e!==null){var t=e.$$typeof;switch(t){case A1:switch(e=e.type,e){case km:case _m:case Cm:case Om:case Tm:return e;default:switch(e=e&&e.$$typeof,e){case u7:case Pm:case Em:case Mm:case $m:case Am:return e;default:return t}}case P1:return t}}}Le.ContextConsumer=Pm;Le.ContextProvider=Am;Le.Element=A1;Le.ForwardRef=Em;Le.Fragment=km;Le.Lazy=Mm;Le.Memo=$m;Le.Portal=P1;Le.Profiler=_m;Le.StrictMode=Cm;Le.Suspense=Om;Le.SuspenseList=Tm;Le.isAsyncMode=function(){return!1};Le.isConcurrentMode=function(){return!1};Le.isContextConsumer=function(e){return fr(e)===Pm};Le.isContextProvider=function(e){return fr(e)===Am};Le.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===A1};Le.isForwardRef=function(e){return fr(e)===Em};Le.isFragment=function(e){return fr(e)===km};Le.isLazy=function(e){return fr(e)===Mm};Le.isMemo=function(e){return fr(e)===$m};Le.isPortal=function(e){return fr(e)===P1};Le.isProfiler=function(e){return fr(e)===_m};Le.isStrictMode=function(e){return fr(e)===Cm};Le.isSuspense=function(e){return fr(e)===Om};Le.isSuspenseList=function(e){return fr(e)===Tm};Le.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===km||e===_m||e===Cm||e===Om||e===Tm||e===d7||typeof e=="object"&&e!==null&&(e.$$typeof===Mm||e.$$typeof===$m||e.$$typeof===Am||e.$$typeof===Pm||e.$$typeof===Em||e.$$typeof===hE||e.getModuleId!==void 0)};Le.typeOf=fr;pE.exports=Le;var f7=pE.exports,p7=Ra,h7=Da,m7="[object Number]";function x7(e){return typeof e=="number"||h7(e)&&p7(e)==m7}var mE=x7;const g7=De(mE);var v7=mE;function y7(e){return v7(e)&&e!=+e}var b7=y7;const Ll=De(b7);var ln=function(t){return t===0?0:t>0?1:-1},ii=function(t){return Ei(t)&&t.indexOf("%")===t.length-1},ee=function(t){return g7(t)&&!Ll(t)},j7=function(t){return je(t)},Et=function(t){return ee(t)||Ei(t)},w7=0,Hi=function(t){var n=++w7;return"".concat(t||"").concat(n)},cn=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!ee(t)&&!Ei(t))return r;var i;if(ii(t)){var o=t.indexOf("%");i=n*parseFloat(t.slice(0,o))/100}else i=+t;return Ll(i)&&(i=r),s&&i>n&&(i=n),i},Za=function(t){if(!t)return null;var n=Object.keys(t);return n&&n.length?t[n[0]]:null},N7=function(t){if(!Array.isArray(t))return!1;for(var n=t.length,r={},s=0;s<n;s++)if(!r[t[s]])r[t[s]]=!0;else return!0;return!1},At=function(t,n){return ee(t)&&ee(n)?function(r){return t+r*(n-t)}:function(){return n}};function Rp(e,t,n){return!e||!e.length?null:e.find(function(r){return r&&(typeof t=="function"?t(r):Ln(r,t))===n})}var S7=function(t,n){return ee(t)&&ee(n)?t-n:Ei(t)&&Ei(n)?t.localeCompare(n):t instanceof Date&&n instanceof Date?t.getTime()-n.getTime():String(t).localeCompare(String(n))};function Ro(e,t){for(var n in e)if({}.hasOwnProperty.call(e,n)&&(!{}.hasOwnProperty.call(t,n)||e[n]!==t[n]))return!1;for(var r in t)if({}.hasOwnProperty.call(t,r)&&!{}.hasOwnProperty.call(e,r))return!1;return!0}function iv(e){"@babel/helpers - typeof";return iv=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},iv(e)}var k7=["viewBox","children"],C7=["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"],rN=["points","pathLength"],e0={svg:k7,polygon:rN,polyline:rN},E1=["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"],Dp=function(t,n){if(!t||typeof t=="function"||typeof t=="boolean")return null;var r=t;if(b.isValidElement(t)&&(r=t.props),!Ml(r))return null;var s={};return Object.keys(r).forEach(function(i){E1.includes(i)&&(s[i]=n||function(o){return r[i](r,o)})}),s},_7=function(t,n,r){return function(s){return t(n,r,s),null}},Oi=function(t,n,r){if(!Ml(t)||iv(t)!=="object")return null;var s=null;return Object.keys(t).forEach(function(i){var o=t[i];E1.includes(i)&&typeof o=="function"&&(s||(s={}),s[i]=_7(o,n,r))}),s},A7=["children"],P7=["children"];function aN(e,t){if(e==null)return{};var n=E7(e,t),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)r=i[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function E7(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function ov(e){"@babel/helpers - typeof";return ov=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ov(e)}var sN={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart",contextmenu:"onContextMenu",dblclick:"onDoubleClick"},Na=function(t){return typeof t=="string"?t:t?t.displayName||t.name||"Component":""},iN=null,t0=null,O1=function e(t){if(t===iN&&Array.isArray(t0))return t0;var n=[];return b.Children.forEach(t,function(r){je(r)||(f7.isFragment(r)?n=n.concat(e(r.props.children)):n.push(r))}),t0=n,iN=t,n};function zn(e,t){var n=[],r=[];return Array.isArray(t)?r=t.map(function(s){return Na(s)}):r=[Na(t)],O1(e).forEach(function(s){var i=Ln(s,"type.displayName")||Ln(s,"type.name");r.indexOf(i)!==-1&&n.push(s)}),n}function Mn(e,t){var n=zn(e,t);return n&&n[0]}var oN=function(t){if(!t||!t.props)return!1;var n=t.props,r=n.width,s=n.height;return!(!ee(r)||r<=0||!ee(s)||s<=0)},O7=["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColormatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-url","foreignObject","g","glyph","glyphRef","hkern","image","line","lineGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"],T7=function(t){return t&&t.type&&Ei(t.type)&&O7.indexOf(t.type)>=0},xE=function(t){return t&&ov(t)==="object"&&"clipDot"in t},$7=function(t,n,r,s){var i,o=(i=e0==null?void 0:e0[s])!==null&&i!==void 0?i:[];return n.startsWith("data-")||!ve(t)&&(s&&o.includes(n)||C7.includes(n))||r&&E1.includes(n)},me=function(t,n,r){if(!t||typeof t=="function"||typeof t=="boolean")return null;var s=t;if(b.isValidElement(t)&&(s=t.props),!Ml(s))return null;var i={};return Object.keys(s).forEach(function(o){var l;$7((l=s)===null||l===void 0?void 0:l[o],o,n,r)&&(i[o]=s[o])}),i},lv=function e(t,n){if(t===n)return!0;var r=b.Children.count(t);if(r!==b.Children.count(n))return!1;if(r===0)return!0;if(r===1)return lN(Array.isArray(t)?t[0]:t,Array.isArray(n)?n[0]:n);for(var s=0;s<r;s++){var i=t[s],o=n[s];if(Array.isArray(i)||Array.isArray(o)){if(!e(i,o))return!1}else if(!lN(i,o))return!1}return!0},lN=function(t,n){if(je(t)&&je(n))return!0;if(!je(t)&&!je(n)){var r=t.props||{},s=r.children,i=aN(r,A7),o=n.props||{},l=o.children,c=aN(o,P7);return s&&l?Ro(i,c)&&lv(s,l):!s&&!l?Ro(i,c):!1}return!1},cN=function(t,n){var r=[],s={};return O1(t).forEach(function(i,o){if(T7(i))r.push(i);else if(i){var l=Na(i.type),c=n[l]||{},u=c.handler,d=c.once;if(u&&(!d||!s[l])){var f=u(i,l,o);r.push(f),s[l]=!0}}}),r},M7=function(t){var n=t&&t.type;return n&&sN[n]?sN[n]:null},R7=function(t,n){return O1(n).indexOf(t)},D7=["children","width","height","viewBox","className","style","title","desc"];function cv(){return cv=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},cv.apply(this,arguments)}function I7(e,t){if(e==null)return{};var n=L7(e,t),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)r=i[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function L7(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function uv(e){var t=e.children,n=e.width,r=e.height,s=e.viewBox,i=e.className,o=e.style,l=e.title,c=e.desc,u=I7(e,D7),d=s||{width:n,height:r,x:0,y:0},f=Ne("recharts-surface",i);return O.createElement("svg",cv({},me(u,!0,"svg"),{className:f,width:n,height:r,style:o,viewBox:"".concat(d.x," ").concat(d.y," ").concat(d.width," ").concat(d.height)}),O.createElement("title",null,l),O.createElement("desc",null,c),t)}var z7=["children","className"];function dv(){return dv=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},dv.apply(this,arguments)}function B7(e,t){if(e==null)return{};var n=F7(e,t),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)r=i[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function F7(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var Ae=O.forwardRef(function(e,t){var n=e.children,r=e.className,s=B7(e,z7),i=Ne("recharts-layer",r);return O.createElement("g",dv({className:i},me(s,!0),{ref:t}),n)}),Or=function(t,n){for(var r=arguments.length,s=new Array(r>2?r-2:0),i=2;i<r;i++)s[i-2]=arguments[i]};function V7(e,t,n){var r=-1,s=e.length;t<0&&(t=-t>s?0:s+t),n=n>s?s:n,n<0&&(n+=s),s=t>n?0:n-t>>>0,t>>>=0;for(var i=Array(s);++r<s;)i[r]=e[r+t];return i}var U7=V7,W7=U7;function q7(e,t,n){var r=e.length;return n=n===void 0?r:n,!t&&n>=r?e:W7(e,t,n)}var H7=q7,K7="\\ud800-\\udfff",G7="\\u0300-\\u036f",X7="\\ufe20-\\ufe2f",Y7="\\u20d0-\\u20ff",Q7=G7+X7+Y7,J7="\\ufe0e\\ufe0f",Z7="\\u200d",eB=RegExp("["+Z7+K7+Q7+J7+"]");function tB(e){return eB.test(e)}var gE=tB;function nB(e){return e.split("")}var rB=nB,vE="\\ud800-\\udfff",aB="\\u0300-\\u036f",sB="\\ufe20-\\ufe2f",iB="\\u20d0-\\u20ff",oB=aB+sB+iB,lB="\\ufe0e\\ufe0f",cB="["+vE+"]",fv="["+oB+"]",pv="\\ud83c[\\udffb-\\udfff]",uB="(?:"+fv+"|"+pv+")",yE="[^"+vE+"]",bE="(?:\\ud83c[\\udde6-\\uddff]){2}",jE="[\\ud800-\\udbff][\\udc00-\\udfff]",dB="\\u200d",wE=uB+"?",NE="["+lB+"]?",fB="(?:"+dB+"(?:"+[yE,bE,jE].join("|")+")"+NE+wE+")*",pB=NE+wE+fB,hB="(?:"+[yE+fv+"?",fv,bE,jE,cB].join("|")+")",mB=RegExp(pv+"(?="+pv+")|"+hB+pB,"g");function xB(e){return e.match(mB)||[]}var gB=xB,vB=rB,yB=gE,bB=gB;function jB(e){return yB(e)?bB(e):vB(e)}var wB=jB,NB=H7,SB=gE,kB=wB,CB=uE;function _B(e){return function(t){t=CB(t);var n=SB(t)?kB(t):void 0,r=n?n[0]:t.charAt(0),s=n?NB(n,1).join(""):t.slice(1);return r[e]()+s}}var AB=_B,PB=AB,EB=PB("toUpperCase"),OB=EB;const Rm=De(OB);function He(e){return function(){return e}}const SE=Math.cos,Ip=Math.sin,Lr=Math.sqrt,Lp=Math.PI,Dm=2*Lp,hv=Math.PI,mv=2*hv,Xs=1e-6,TB=mv-Xs;function kE(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function $B(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return kE;const n=10**t;return function(r){this._+=r[0];for(let s=1,i=r.length;s<i;++s)this._+=Math.round(arguments[s]*n)/n+r[s]}}class MB{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?kE:$B(t)}moveTo(t,n){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,n){this._append`L${this._x1=+t},${this._y1=+n}`}quadraticCurveTo(t,n,r,s){this._append`Q${+t},${+n},${this._x1=+r},${this._y1=+s}`}bezierCurveTo(t,n,r,s,i,o){this._append`C${+t},${+n},${+r},${+s},${this._x1=+i},${this._y1=+o}`}arcTo(t,n,r,s,i){if(t=+t,n=+n,r=+r,s=+s,i=+i,i<0)throw new Error(`negative radius: ${i}`);let o=this._x1,l=this._y1,c=r-t,u=s-n,d=o-t,f=l-n,p=d*d+f*f;if(this._x1===null)this._append`M${this._x1=t},${this._y1=n}`;else if(p>Xs)if(!(Math.abs(f*c-u*d)>Xs)||!i)this._append`L${this._x1=t},${this._y1=n}`;else{let h=r-o,m=s-l,v=c*c+u*u,x=h*h+m*m,y=Math.sqrt(v),g=Math.sqrt(p),j=i*Math.tan((hv-Math.acos((v+p-x)/(2*y*g)))/2),N=j/g,w=j/y;Math.abs(N-1)>Xs&&this._append`L${t+N*d},${n+N*f}`,this._append`A${i},${i},0,0,${+(f*h>d*m)},${this._x1=t+w*c},${this._y1=n+w*u}`}}arc(t,n,r,s,i,o){if(t=+t,n=+n,r=+r,o=!!o,r<0)throw new Error(`negative radius: ${r}`);let l=r*Math.cos(s),c=r*Math.sin(s),u=t+l,d=n+c,f=1^o,p=o?s-i:i-s;this._x1===null?this._append`M${u},${d}`:(Math.abs(this._x1-u)>Xs||Math.abs(this._y1-d)>Xs)&&this._append`L${u},${d}`,r&&(p<0&&(p=p%mv+mv),p>TB?this._append`A${r},${r},0,1,${f},${t-l},${n-c}A${r},${r},0,1,${f},${this._x1=u},${this._y1=d}`:p>Xs&&this._append`A${r},${r},0,${+(p>=hv)},${f},${this._x1=t+r*Math.cos(i)},${this._y1=n+r*Math.sin(i)}`)}rect(t,n,r,s){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${r=+r}v${+s}h${-r}Z`}toString(){return this._}}function T1(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{const r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);t=r}return e},()=>new MB(t)}function $1(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function CE(e){this._context=e}CE.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,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);break}}};function Im(e){return new CE(e)}function _E(e){return e[0]}function AE(e){return e[1]}function PE(e,t){var n=He(!0),r=null,s=Im,i=null,o=T1(l);e=typeof e=="function"?e:e===void 0?_E:He(e),t=typeof t=="function"?t:t===void 0?AE:He(t);function l(c){var u,d=(c=$1(c)).length,f,p=!1,h;for(r==null&&(i=s(h=o())),u=0;u<=d;++u)!(u<d&&n(f=c[u],u,c))===p&&((p=!p)?i.lineStart():i.lineEnd()),p&&i.point(+e(f,u,c),+t(f,u,c));if(h)return i=null,h+""||null}return l.x=function(c){return arguments.length?(e=typeof c=="function"?c:He(+c),l):e},l.y=function(c){return arguments.length?(t=typeof c=="function"?c:He(+c),l):t},l.defined=function(c){return arguments.length?(n=typeof c=="function"?c:He(!!c),l):n},l.curve=function(c){return arguments.length?(s=c,r!=null&&(i=s(r)),l):s},l.context=function(c){return arguments.length?(c==null?r=i=null:i=s(r=c),l):r},l}function rf(e,t,n){var r=null,s=He(!0),i=null,o=Im,l=null,c=T1(u);e=typeof e=="function"?e:e===void 0?_E:He(+e),t=typeof t=="function"?t:He(t===void 0?0:+t),n=typeof n=="function"?n:n===void 0?AE:He(+n);function u(f){var p,h,m,v=(f=$1(f)).length,x,y=!1,g,j=new Array(v),N=new Array(v);for(i==null&&(l=o(g=c())),p=0;p<=v;++p){if(!(p<v&&s(x=f[p],p,f))===y)if(y=!y)h=p,l.areaStart(),l.lineStart();else{for(l.lineEnd(),l.lineStart(),m=p-1;m>=h;--m)l.point(j[m],N[m]);l.lineEnd(),l.areaEnd()}y&&(j[p]=+e(x,p,f),N[p]=+t(x,p,f),l.point(r?+r(x,p,f):j[p],n?+n(x,p,f):N[p]))}if(g)return l=null,g+""||null}function d(){return PE().defined(s).curve(o).context(i)}return u.x=function(f){return arguments.length?(e=typeof f=="function"?f:He(+f),r=null,u):e},u.x0=function(f){return arguments.length?(e=typeof f=="function"?f:He(+f),u):e},u.x1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:He(+f),u):r},u.y=function(f){return arguments.length?(t=typeof f=="function"?f:He(+f),n=null,u):t},u.y0=function(f){return arguments.length?(t=typeof f=="function"?f:He(+f),u):t},u.y1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:He(+f),u):n},u.lineX0=u.lineY0=function(){return d().x(e).y(t)},u.lineY1=function(){return d().x(e).y(n)},u.lineX1=function(){return d().x(r).y(t)},u.defined=function(f){return arguments.length?(s=typeof f=="function"?f:He(!!f),u):s},u.curve=function(f){return arguments.length?(o=f,i!=null&&(l=o(i)),u):o},u.context=function(f){return arguments.length?(f==null?i=l=null:l=o(i=f),u):i},u}class EE{constructor(t,n){this._context=t,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,n){switch(t=+t,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,n,t,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,t,this._y0,t,n);break}}this._x0=t,this._y0=n}}function RB(e){return new EE(e,!0)}function DB(e){return new EE(e,!1)}const M1={draw(e,t){const n=Lr(t/Lp);e.moveTo(n,0),e.arc(0,0,n,0,Dm)}},IB={draw(e,t){const n=Lr(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},OE=Lr(1/3),LB=OE*2,zB={draw(e,t){const n=Lr(t/LB),r=n*OE;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},BB={draw(e,t){const n=Lr(t),r=-n/2;e.rect(r,r,n,n)}},FB=.8908130915292852,TE=Ip(Lp/10)/Ip(7*Lp/10),VB=Ip(Dm/10)*TE,UB=-SE(Dm/10)*TE,WB={draw(e,t){const n=Lr(t*FB),r=VB*n,s=UB*n;e.moveTo(0,-n),e.lineTo(r,s);for(let i=1;i<5;++i){const o=Dm*i/5,l=SE(o),c=Ip(o);e.lineTo(c*n,-l*n),e.lineTo(l*r-c*s,c*r+l*s)}e.closePath()}},n0=Lr(3),qB={draw(e,t){const n=-Lr(t/(n0*3));e.moveTo(0,n*2),e.lineTo(-n0*n,-n),e.lineTo(n0*n,-n),e.closePath()}},qn=-.5,Hn=Lr(3)/2,xv=1/Lr(12),HB=(xv/2+1)*3,KB={draw(e,t){const n=Lr(t/HB),r=n/2,s=n*xv,i=r,o=n*xv+n,l=-i,c=o;e.moveTo(r,s),e.lineTo(i,o),e.lineTo(l,c),e.lineTo(qn*r-Hn*s,Hn*r+qn*s),e.lineTo(qn*i-Hn*o,Hn*i+qn*o),e.lineTo(qn*l-Hn*c,Hn*l+qn*c),e.lineTo(qn*r+Hn*s,qn*s-Hn*r),e.lineTo(qn*i+Hn*o,qn*o-Hn*i),e.lineTo(qn*l+Hn*c,qn*c-Hn*l),e.closePath()}};function GB(e,t){let n=null,r=T1(s);e=typeof e=="function"?e:He(e||M1),t=typeof t=="function"?t:He(t===void 0?64:+t);function s(){let i;if(n||(n=i=r()),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),i)return n=null,i+""||null}return s.type=function(i){return arguments.length?(e=typeof i=="function"?i:He(i),s):e},s.size=function(i){return arguments.length?(t=typeof i=="function"?i:He(+i),s):t},s.context=function(i){return arguments.length?(n=i??null,s):n},s}function zp(){}function Bp(e,t,n){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+n)/6)}function $E(e){this._context=e}$E.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:Bp(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,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:Bp(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function XB(e){return new $E(e)}function ME(e){this._context=e}ME.prototype={areaStart:zp,areaEnd:zp,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,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:Bp(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function YB(e){return new ME(e)}function RE(e){this._context=e}RE.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:Bp(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function QB(e){return new RE(e)}function DE(e){this._context=e}DE.prototype={areaStart:zp,areaEnd:zp,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function JB(e){return new DE(e)}function uN(e){return e<0?-1:1}function dN(e,t,n){var r=e._x1-e._x0,s=t-e._x1,i=(e._y1-e._y0)/(r||s<0&&-0),o=(n-e._y1)/(s||r<0&&-0),l=(i*s+o*r)/(r+s);return(uN(i)+uN(o))*Math.min(Math.abs(i),Math.abs(o),.5*Math.abs(l))||0}function fN(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function r0(e,t,n){var r=e._x0,s=e._y0,i=e._x1,o=e._y1,l=(i-r)/3;e._context.bezierCurveTo(r+l,s+l*t,i-l,o-l*n,i,o)}function Fp(e){this._context=e}Fp.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:r0(this,this._t0,fN(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===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,r0(this,fN(this,n=dN(this,e,t)),n);break;default:r0(this,this._t0,n=dN(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function IE(e){this._context=new LE(e)}(IE.prototype=Object.create(Fp.prototype)).point=function(e,t){Fp.prototype.point.call(this,t,e)};function LE(e){this._context=e}LE.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,n,r,s,i){this._context.bezierCurveTo(t,e,r,n,i,s)}};function ZB(e){return new Fp(e)}function eF(e){return new IE(e)}function zE(e){this._context=e}zE.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,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=pN(e),s=pN(t),i=0,o=1;o<n;++i,++o)this._context.bezierCurveTo(r[0][i],s[0][i],r[1][i],s[1][i],e[o],t[o]);(this._line||this._line!==0&&n===1)&&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)}};function pN(e){var t,n=e.length-1,r,s=new Array(n),i=new Array(n),o=new Array(n);for(s[0]=0,i[0]=2,o[0]=e[0]+2*e[1],t=1;t<n-1;++t)s[t]=1,i[t]=4,o[t]=4*e[t]+2*e[t+1];for(s[n-1]=2,i[n-1]=7,o[n-1]=8*e[n-1]+e[n],t=1;t<n;++t)r=s[t]/i[t-1],i[t]-=r,o[t]-=r*o[t-1];for(s[n-1]=o[n-1]/i[n-1],t=n-2;t>=0;--t)s[t]=(o[t]-s[t+1])/i[t];for(i[n-1]=(e[n]+s[n-1])/2,t=0;t<n-1;++t)i[t]=2*e[t+1]-s[t+1];return[s,i]}function tF(e){return new zE(e)}function Lm(e,t){this._context=e,this._t=t}Lm.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,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 n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}}this._x=e,this._y=t}};function nF(e){return new Lm(e,.5)}function rF(e){return new Lm(e,0)}function aF(e){return new Lm(e,1)}function Yo(e,t){if((o=e.length)>1)for(var n=1,r,s,i=e[t[0]],o,l=i.length;n<o;++n)for(s=i,i=e[t[n]],r=0;r<l;++r)i[r][1]+=i[r][0]=isNaN(s[r][1])?s[r][0]:s[r][1]}function gv(e){for(var t=e.length,n=new Array(t);--t>=0;)n[t]=t;return n}function sF(e,t){return e[t]}function iF(e){const t=[];return t.key=e,t}function oF(){var e=He([]),t=gv,n=Yo,r=sF;function s(i){var o=Array.from(e.apply(this,arguments),iF),l,c=o.length,u=-1,d;for(const f of i)for(l=0,++u;l<c;++l)(o[l][u]=[0,+r(f,o[l].key,u,i)]).data=f;for(l=0,d=$1(t(o));l<c;++l)o[d[l]].index=l;return n(o,d),o}return s.keys=function(i){return arguments.length?(e=typeof i=="function"?i:He(Array.from(i)),s):e},s.value=function(i){return arguments.length?(r=typeof i=="function"?i:He(+i),s):r},s.order=function(i){return arguments.length?(t=i==null?gv:typeof i=="function"?i:He(Array.from(i)),s):t},s.offset=function(i){return arguments.length?(n=i??Yo,s):n},s}function lF(e,t){if((r=e.length)>0){for(var n,r,s=0,i=e[0].length,o;s<i;++s){for(o=n=0;n<r;++n)o+=e[n][s][1]||0;if(o)for(n=0;n<r;++n)e[n][s][1]/=o}Yo(e,t)}}function cF(e,t){if((s=e.length)>0){for(var n=0,r=e[t[0]],s,i=r.length;n<i;++n){for(var o=0,l=0;o<s;++o)l+=e[o][n][1]||0;r[n][1]+=r[n][0]=-l/2}Yo(e,t)}}function uF(e,t){if(!(!((o=e.length)>0)||!((i=(s=e[t[0]]).length)>0))){for(var n=0,r=1,s,i,o;r<i;++r){for(var l=0,c=0,u=0;l<o;++l){for(var d=e[t[l]],f=d[r][1]||0,p=d[r-1][1]||0,h=(f-p)/2,m=0;m<l;++m){var v=e[t[m]],x=v[r][1]||0,y=v[r-1][1]||0;h+=x-y}c+=f,u+=h*f}s[r-1][1]+=s[r-1][0]=n,c&&(n-=u/c)}s[r-1][1]+=s[r-1][0]=n,Yo(e,t)}}function Su(e){"@babel/helpers - typeof";return Su=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Su(e)}var dF=["type","size","sizeType"];function vv(){return vv=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},vv.apply(this,arguments)}function hN(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function mN(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?hN(Object(n),!0).forEach(function(r){fF(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):hN(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function fF(e,t,n){return t=pF(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function pF(e){var t=hF(e,"string");return Su(t)=="symbol"?t:t+""}function hF(e,t){if(Su(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Su(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function mF(e,t){if(e==null)return{};var n=xF(e,t),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)r=i[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function xF(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var BE={symbolCircle:M1,symbolCross:IB,symbolDiamond:zB,symbolSquare:BB,symbolStar:WB,symbolTriangle:qB,symbolWye:KB},gF=Math.PI/180,vF=function(t){var n="symbol".concat(Rm(t));return BE[n]||M1},yF=function(t,n,r){if(n==="area")return t;switch(r){case"cross":return 5*t*t/9;case"diamond":return .5*t*t/Math.sqrt(3);case"square":return t*t;case"star":{var s=18*gF;return 1.25*t*t*(Math.tan(s)-Math.tan(s*2)*Math.pow(Math.tan(s),2))}case"triangle":return Math.sqrt(3)*t*t/4;case"wye":return(21-10*Math.sqrt(3))*t*t/8;default:return Math.PI*t*t/4}},bF=function(t,n){BE["symbol".concat(Rm(t))]=n},R1=function(t){var n=t.type,r=n===void 0?"circle":n,s=t.size,i=s===void 0?64:s,o=t.sizeType,l=o===void 0?"area":o,c=mF(t,dF),u=mN(mN({},c),{},{type:r,size:i,sizeType:l}),d=function(){var x=vF(r),y=GB().type(x).size(yF(i,l,r));return y()},f=u.className,p=u.cx,h=u.cy,m=me(u,!0);return p===+p&&h===+h&&i===+i?O.createElement("path",vv({},m,{className:Ne("recharts-symbols",f),transform:"translate(".concat(p,", ").concat(h,")"),d:d()})):null};R1.registerSymbol=bF;function Qo(e){"@babel/helpers - typeof";return Qo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Qo(e)}function yv(){return yv=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},yv.apply(this,arguments)}function xN(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function jF(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?xN(Object(n),!0).forEach(function(r){ku(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):xN(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function wF(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function NF(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,VE(r.key),r)}}function SF(e,t,n){return t&&NF(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function kF(e,t,n){return t=Vp(t),CF(e,FE()?Reflect.construct(t,n||[],Vp(e).constructor):t.apply(e,n))}function CF(e,t){if(t&&(Qo(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return _F(e)}function _F(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function FE(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(FE=function(){return!!e})()}function Vp(e){return Vp=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Vp(e)}function AF(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&bv(e,t)}function bv(e,t){return bv=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},bv(e,t)}function ku(e,t,n){return t=VE(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function VE(e){var t=PF(e,"string");return Qo(t)=="symbol"?t:t+""}function PF(e,t){if(Qo(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Qo(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Kn=32,D1=function(e){function t(){return wF(this,t),kF(this,t,arguments)}return AF(t,e),SF(t,[{key:"renderIcon",value:function(r){var s=this.props.inactiveColor,i=Kn/2,o=Kn/6,l=Kn/3,c=r.inactive?s:r.color;if(r.type==="plainline")return O.createElement("line",{strokeWidth:4,fill:"none",stroke:c,strokeDasharray:r.payload.strokeDasharray,x1:0,y1:i,x2:Kn,y2:i,className:"recharts-legend-icon"});if(r.type==="line")return O.createElement("path",{strokeWidth:4,fill:"none",stroke:c,d:"M0,".concat(i,"h").concat(l,`
A`).concat(o,",").concat(o,",0,1,1,").concat(2*l,",").concat(i,`
H`).concat(Kn,"M").concat(2*l,",").concat(i,`
A`).concat(o,",").concat(o,",0,1,1,").concat(l,",").concat(i),className:"recharts-legend-icon"});if(r.type==="rect")return O.createElement("path",{stroke:"none",fill:c,d:"M0,".concat(Kn/8,"h").concat(Kn,"v").concat(Kn*3/4,"h").concat(-Kn,"z"),className:"recharts-legend-icon"});if(O.isValidElement(r.legendIcon)){var u=jF({},r);return delete u.legendIcon,O.cloneElement(r.legendIcon,u)}return O.createElement(R1,{fill:c,cx:i,cy:i,size:Kn,sizeType:"diameter",type:r.type})}},{key:"renderItems",value:function(){var r=this,s=this.props,i=s.payload,o=s.iconSize,l=s.layout,c=s.formatter,u=s.inactiveColor,d={x:0,y:0,width:Kn,height:Kn},f={display:l==="horizontal"?"inline-block":"block",marginRight:10},p={display:"inline-block",verticalAlign:"middle",marginRight:4};return i.map(function(h,m){var v=h.formatter||c,x=Ne(ku(ku({"recharts-legend-item":!0},"legend-item-".concat(m),!0),"inactive",h.inactive));if(h.type==="none")return null;var y=ve(h.value)?null:h.value;Or(!ve(h.value),`The name property is also required when using a function for the dataKey of a chart's cartesian components. Ex: <Bar name="Name of my Data"/>`);var g=h.inactive?u:h.color;return O.createElement("li",yv({className:x,style:f,key:"legend-item-".concat(m)},Oi(r.props,h,m)),O.createElement(uv,{width:o,height:o,viewBox:d,style:p},r.renderIcon(h)),O.createElement("span",{className:"recharts-legend-item-text",style:{color:g}},v?v(y,h,m):y))})}},{key:"render",value:function(){var r=this.props,s=r.payload,i=r.layout,o=r.align;if(!s||!s.length)return null;var l={padding:0,margin:0,textAlign:i==="horizontal"?o:"left"};return O.createElement("ul",{className:"recharts-default-legend",style:l},this.renderItems())}}])}(b.PureComponent);ku(D1,"displayName","Legend");ku(D1,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var EF=wm;function OF(){this.__data__=new EF,this.size=0}var TF=OF;function $F(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}var MF=$F;function RF(e){return this.__data__.get(e)}var DF=RF;function IF(e){return this.__data__.has(e)}var LF=IF,zF=wm,BF=N1,FF=S1,VF=200;function UF(e,t){var n=this.__data__;if(n instanceof zF){var r=n.__data__;if(!BF||r.length<VF-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new FF(r)}return n.set(e,t),this.size=n.size,this}var WF=UF,qF=wm,HF=TF,KF=MF,GF=DF,XF=LF,YF=WF;function zl(e){var t=this.__data__=new qF(e);this.size=t.size}zl.prototype.clear=HF;zl.prototype.delete=KF;zl.prototype.get=GF;zl.prototype.has=XF;zl.prototype.set=YF;var UE=zl,QF="__lodash_hash_undefined__";function JF(e){return this.__data__.set(e,QF),this}var ZF=JF;function eV(e){return this.__data__.has(e)}var tV=eV,nV=S1,rV=ZF,aV=tV;function Up(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new nV;++t<n;)this.add(e[t])}Up.prototype.add=Up.prototype.push=rV;Up.prototype.has=aV;var WE=Up;function sV(e,t){for(var n=-1,r=e==null?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}var qE=sV;function iV(e,t){return e.has(t)}var HE=iV,oV=WE,lV=qE,cV=HE,uV=1,dV=2;function fV(e,t,n,r,s,i){var o=n&uV,l=e.length,c=t.length;if(l!=c&&!(o&&c>l))return!1;var u=i.get(e),d=i.get(t);if(u&&d)return u==t&&d==e;var f=-1,p=!0,h=n&dV?new oV:void 0;for(i.set(e,t),i.set(t,e);++f<l;){var m=e[f],v=t[f];if(r)var x=o?r(v,m,f,t,e,i):r(m,v,f,e,t,i);if(x!==void 0){if(x)continue;p=!1;break}if(h){if(!lV(t,function(y,g){if(!cV(h,g)&&(m===y||s(m,y,n,r,i)))return h.push(g)})){p=!1;break}}else if(!(m===v||s(m,v,n,r,i))){p=!1;break}}return i.delete(e),i.delete(t),p}var KE=fV,pV=ca,hV=pV.Uint8Array,mV=hV;function xV(e){var t=-1,n=Array(e.size);return e.forEach(function(r,s){n[++t]=[s,r]}),n}var gV=xV;function vV(e){var t=-1,n=Array(e.size);return e.forEach(function(r){n[++t]=r}),n}var I1=vV,gN=vd,vN=mV,yV=w1,bV=KE,jV=gV,wV=I1,NV=1,SV=2,kV="[object Boolean]",CV="[object Date]",_V="[object Error]",AV="[object Map]",PV="[object Number]",EV="[object RegExp]",OV="[object Set]",TV="[object String]",$V="[object Symbol]",MV="[object ArrayBuffer]",RV="[object DataView]",yN=gN?gN.prototype:void 0,a0=yN?yN.valueOf:void 0;function DV(e,t,n,r,s,i,o){switch(n){case RV:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case MV:return!(e.byteLength!=t.byteLength||!i(new vN(e),new vN(t)));case kV:case CV:case PV:return yV(+e,+t);case _V:return e.name==t.name&&e.message==t.message;case EV:case TV:return e==t+"";case AV:var l=jV;case OV:var c=r&NV;if(l||(l=wV),e.size!=t.size&&!c)return!1;var u=o.get(e);if(u)return u==t;r|=SV,o.set(e,t);var d=bV(l(e),l(t),r,s,i,o);return o.delete(e),d;case $V:if(a0)return a0.call(e)==a0.call(t)}return!1}var IV=DV;function LV(e,t){for(var n=-1,r=t.length,s=e.length;++n<r;)e[s+n]=t[n];return e}var GE=LV,zV=GE,BV=En;function FV(e,t,n){var r=t(e);return BV(e)?r:zV(r,n(e))}var VV=FV;function UV(e,t){for(var n=-1,r=e==null?0:e.length,s=0,i=[];++n<r;){var o=e[n];t(o,n,e)&&(i[s++]=o)}return i}var WV=UV;function qV(){return[]}var HV=qV,KV=WV,GV=HV,XV=Object.prototype,YV=XV.propertyIsEnumerable,bN=Object.getOwnPropertySymbols,QV=bN?function(e){return e==null?[]:(e=Object(e),KV(bN(e),function(t){return YV.call(e,t)}))}:GV,JV=QV;function ZV(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}var eU=ZV,tU=Ra,nU=Da,rU="[object Arguments]";function aU(e){return nU(e)&&tU(e)==rU}var sU=aU,jN=sU,iU=Da,XE=Object.prototype,oU=XE.hasOwnProperty,lU=XE.propertyIsEnumerable,cU=jN(function(){return arguments}())?jN:function(e){return iU(e)&&oU.call(e,"callee")&&!lU.call(e,"callee")},L1=cU,Wp={exports:{}};function uU(){return!1}var dU=uU;Wp.exports;(function(e,t){var n=ca,r=dU,s=t&&!t.nodeType&&t,i=s&&!0&&e&&!e.nodeType&&e,o=i&&i.exports===s,l=o?n.Buffer:void 0,c=l?l.isBuffer:void 0,u=c||r;e.exports=u})(Wp,Wp.exports);var YE=Wp.exports,fU=9007199254740991,pU=/^(?:0|[1-9]\d*)$/;function hU(e,t){var n=typeof e;return t=t??fU,!!t&&(n=="number"||n!="symbol"&&pU.test(e))&&e>-1&&e%1==0&&e<t}var z1=hU,mU=9007199254740991;function xU(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=mU}var B1=xU,gU=Ra,vU=B1,yU=Da,bU="[object Arguments]",jU="[object Array]",wU="[object Boolean]",NU="[object Date]",SU="[object Error]",kU="[object Function]",CU="[object Map]",_U="[object Number]",AU="[object Object]",PU="[object RegExp]",EU="[object Set]",OU="[object String]",TU="[object WeakMap]",$U="[object ArrayBuffer]",MU="[object DataView]",RU="[object Float32Array]",DU="[object Float64Array]",IU="[object Int8Array]",LU="[object Int16Array]",zU="[object Int32Array]",BU="[object Uint8Array]",FU="[object Uint8ClampedArray]",VU="[object Uint16Array]",UU="[object Uint32Array]",Ye={};Ye[RU]=Ye[DU]=Ye[IU]=Ye[LU]=Ye[zU]=Ye[BU]=Ye[FU]=Ye[VU]=Ye[UU]=!0;Ye[bU]=Ye[jU]=Ye[$U]=Ye[wU]=Ye[MU]=Ye[NU]=Ye[SU]=Ye[kU]=Ye[CU]=Ye[_U]=Ye[AU]=Ye[PU]=Ye[EU]=Ye[OU]=Ye[TU]=!1;function WU(e){return yU(e)&&vU(e.length)&&!!Ye[gU(e)]}var qU=WU;function HU(e){return function(t){return e(t)}}var QE=HU,qp={exports:{}};qp.exports;(function(e,t){var n=aE,r=t&&!t.nodeType&&t,s=r&&!0&&e&&!e.nodeType&&e,i=s&&s.exports===r,o=i&&n.process,l=function(){try{var c=s&&s.require&&s.require("util").types;return c||o&&o.binding&&o.binding("util")}catch{}}();e.exports=l})(qp,qp.exports);var KU=qp.exports,GU=qU,XU=QE,wN=KU,NN=wN&&wN.isTypedArray,YU=NN?XU(NN):GU,JE=YU,QU=eU,JU=L1,ZU=En,eW=YE,tW=z1,nW=JE,rW=Object.prototype,aW=rW.hasOwnProperty;function sW(e,t){var n=ZU(e),r=!n&&JU(e),s=!n&&!r&&eW(e),i=!n&&!r&&!s&&nW(e),o=n||r||s||i,l=o?QU(e.length,String):[],c=l.length;for(var u in e)(t||aW.call(e,u))&&!(o&&(u=="length"||s&&(u=="offset"||u=="parent")||i&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||tW(u,c)))&&l.push(u);return l}var iW=sW,oW=Object.prototype;function lW(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||oW;return e===n}var cW=lW;function uW(e,t){return function(n){return e(t(n))}}var ZE=uW,dW=ZE,fW=dW(Object.keys,Object),pW=fW,hW=cW,mW=pW,xW=Object.prototype,gW=xW.hasOwnProperty;function vW(e){if(!hW(e))return mW(e);var t=[];for(var n in Object(e))gW.call(e,n)&&n!="constructor"&&t.push(n);return t}var yW=vW,bW=j1,jW=B1;function wW(e){return e!=null&&jW(e.length)&&!bW(e)}var yd=wW,NW=iW,SW=yW,kW=yd;function CW(e){return kW(e)?NW(e):SW(e)}var zm=CW,_W=VV,AW=JV,PW=zm;function EW(e){return _W(e,PW,AW)}var OW=EW,SN=OW,TW=1,$W=Object.prototype,MW=$W.hasOwnProperty;function RW(e,t,n,r,s,i){var o=n&TW,l=SN(e),c=l.length,u=SN(t),d=u.length;if(c!=d&&!o)return!1;for(var f=c;f--;){var p=l[f];if(!(o?p in t:MW.call(t,p)))return!1}var h=i.get(e),m=i.get(t);if(h&&m)return h==t&&m==e;var v=!0;i.set(e,t),i.set(t,e);for(var x=o;++f<c;){p=l[f];var y=e[p],g=t[p];if(r)var j=o?r(g,y,p,t,e,i):r(y,g,p,e,t,i);if(!(j===void 0?y===g||s(y,g,n,r,i):j)){v=!1;break}x||(x=p=="constructor")}if(v&&!x){var N=e.constructor,w=t.constructor;N!=w&&"constructor"in e&&"constructor"in t&&!(typeof N=="function"&&N instanceof N&&typeof w=="function"&&w instanceof w)&&(v=!1)}return i.delete(e),i.delete(t),v}var DW=RW,IW=qi,LW=ca,zW=IW(LW,"DataView"),BW=zW,FW=qi,VW=ca,UW=FW(VW,"Promise"),WW=UW,qW=qi,HW=ca,KW=qW(HW,"Set"),eO=KW,GW=qi,XW=ca,YW=GW(XW,"WeakMap"),QW=YW,jv=BW,wv=N1,Nv=WW,Sv=eO,kv=QW,tO=Ra,Bl=iE,kN="[object Map]",JW="[object Object]",CN="[object Promise]",_N="[object Set]",AN="[object WeakMap]",PN="[object DataView]",ZW=Bl(jv),eq=Bl(wv),tq=Bl(Nv),nq=Bl(Sv),rq=Bl(kv),Ys=tO;(jv&&Ys(new jv(new ArrayBuffer(1)))!=PN||wv&&Ys(new wv)!=kN||Nv&&Ys(Nv.resolve())!=CN||Sv&&Ys(new Sv)!=_N||kv&&Ys(new kv)!=AN)&&(Ys=function(e){var t=tO(e),n=t==JW?e.constructor:void 0,r=n?Bl(n):"";if(r)switch(r){case ZW:return PN;case eq:return kN;case tq:return CN;case nq:return _N;case rq:return AN}return t});var aq=Ys,s0=UE,sq=KE,iq=IV,oq=DW,EN=aq,ON=En,TN=YE,lq=JE,cq=1,$N="[object Arguments]",MN="[object Array]",af="[object Object]",uq=Object.prototype,RN=uq.hasOwnProperty;function dq(e,t,n,r,s,i){var o=ON(e),l=ON(t),c=o?MN:EN(e),u=l?MN:EN(t);c=c==$N?af:c,u=u==$N?af:u;var d=c==af,f=u==af,p=c==u;if(p&&TN(e)){if(!TN(t))return!1;o=!0,d=!1}if(p&&!d)return i||(i=new s0),o||lq(e)?sq(e,t,n,r,s,i):iq(e,t,c,n,r,s,i);if(!(n&cq)){var h=d&&RN.call(e,"__wrapped__"),m=f&&RN.call(t,"__wrapped__");if(h||m){var v=h?e.value():e,x=m?t.value():t;return i||(i=new s0),s(v,x,n,r,i)}}return p?(i||(i=new s0),oq(e,t,n,r,s,i)):!1}var fq=dq,pq=fq,DN=Da;function nO(e,t,n,r,s){return e===t?!0:e==null||t==null||!DN(e)&&!DN(t)?e!==e&&t!==t:pq(e,t,n,r,nO,s)}var F1=nO,hq=UE,mq=F1,xq=1,gq=2;function vq(e,t,n,r){var s=n.length,i=s,o=!r;if(e==null)return!i;for(e=Object(e);s--;){var l=n[s];if(o&&l[2]?l[1]!==e[l[0]]:!(l[0]in e))return!1}for(;++s<i;){l=n[s];var c=l[0],u=e[c],d=l[1];if(o&&l[2]){if(u===void 0&&!(c in e))return!1}else{var f=new hq;if(r)var p=r(u,d,c,e,t,f);if(!(p===void 0?mq(d,u,xq|gq,r,f):p))return!1}}return!0}var yq=vq,bq=$s;function jq(e){return e===e&&!bq(e)}var rO=jq,wq=rO,Nq=zm;function Sq(e){for(var t=Nq(e),n=t.length;n--;){var r=t[n],s=e[r];t[n]=[r,s,wq(s)]}return t}var kq=Sq;function Cq(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==void 0||e in Object(n))}}var aO=Cq,_q=yq,Aq=kq,Pq=aO;function Eq(e){var t=Aq(e);return t.length==1&&t[0][2]?Pq(t[0][0],t[0][1]):function(n){return n===e||_q(n,e,t)}}var Oq=Eq;function Tq(e,t){return e!=null&&t in Object(e)}var $q=Tq,Mq=dE,Rq=L1,Dq=En,Iq=z1,Lq=B1,zq=Sm;function Bq(e,t,n){t=Mq(t,e);for(var r=-1,s=t.length,i=!1;++r<s;){var o=zq(t[r]);if(!(i=e!=null&&n(e,o)))break;e=e[o]}return i||++r!=s?i:(s=e==null?0:e.length,!!s&&Lq(s)&&Iq(o,s)&&(Dq(e)||Rq(e)))}var Fq=Bq,Vq=$q,Uq=Fq;function Wq(e,t){return e!=null&&Uq(e,t,Vq)}var qq=Wq,Hq=F1,Kq=fE,Gq=qq,Xq=b1,Yq=rO,Qq=aO,Jq=Sm,Zq=1,eH=2;function tH(e,t){return Xq(e)&&Yq(t)?Qq(Jq(e),t):function(n){var r=Kq(n,e);return r===void 0&&r===t?Gq(n,e):Hq(t,r,Zq|eH)}}var nH=tH;function rH(e){return e}var Fl=rH;function aH(e){return function(t){return t==null?void 0:t[e]}}var sH=aH,iH=_1;function oH(e){return function(t){return iH(t,e)}}var lH=oH,cH=sH,uH=lH,dH=b1,fH=Sm;function pH(e){return dH(e)?cH(fH(e)):uH(e)}var hH=pH,mH=Oq,xH=nH,gH=Fl,vH=En,yH=hH;function bH(e){return typeof e=="function"?e:e==null?gH:typeof e=="object"?vH(e)?xH(e[0],e[1]):mH(e):yH(e)}var ua=bH;function jH(e,t,n,r){for(var s=e.length,i=n+(r?1:-1);r?i--:++i<s;)if(t(e[i],i,e))return i;return-1}var sO=jH;function wH(e){return e!==e}var NH=wH;function SH(e,t,n){for(var r=n-1,s=e.length;++r<s;)if(e[r]===t)return r;return-1}var kH=SH,CH=sO,_H=NH,AH=kH;function PH(e,t,n){return t===t?AH(e,t,n):CH(e,_H,n)}var EH=PH,OH=EH;function TH(e,t){var n=e==null?0:e.length;return!!n&&OH(e,t,0)>-1}var $H=TH;function MH(e,t,n){for(var r=-1,s=e==null?0:e.length;++r<s;)if(n(t,e[r]))return!0;return!1}var RH=MH;function DH(){}var IH=DH,i0=eO,LH=IH,zH=I1,BH=1/0,FH=i0&&1/zH(new i0([,-0]))[1]==BH?function(e){return new i0(e)}:LH,VH=FH,UH=WE,WH=$H,qH=RH,HH=HE,KH=VH,GH=I1,XH=200;function YH(e,t,n){var r=-1,s=WH,i=e.length,o=!0,l=[],c=l;if(n)o=!1,s=qH;else if(i>=XH){var u=t?null:KH(e);if(u)return GH(u);o=!1,s=HH,c=new UH}else c=t?[]:l;e:for(;++r<i;){var d=e[r],f=t?t(d):d;if(d=n||d!==0?d:0,o&&f===f){for(var p=c.length;p--;)if(c[p]===f)continue e;t&&c.push(f),l.push(d)}else s(c,f,n)||(c!==l&&c.push(f),l.push(d))}return l}var QH=YH,JH=ua,ZH=QH;function eK(e,t){return e&&e.length?ZH(e,JH(t)):[]}var tK=eK;const IN=De(tK);function iO(e,t,n){return t===!0?IN(e,n):ve(t)?IN(e,t):e}function Jo(e){"@babel/helpers - typeof";return Jo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Jo(e)}var nK=["ref"];function LN(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function fa(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?LN(Object(n),!0).forEach(function(r){Bm(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):LN(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function rK(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function zN(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,lO(r.key),r)}}function aK(e,t,n){return t&&zN(e.prototype,t),n&&zN(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function sK(e,t,n){return t=Hp(t),iK(e,oO()?Reflect.construct(t,n||[],Hp(e).constructor):t.apply(e,n))}function iK(e,t){if(t&&(Jo(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return oK(e)}function oK(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function oO(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(oO=function(){return!!e})()}function Hp(e){return Hp=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Hp(e)}function lK(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Cv(e,t)}function Cv(e,t){return Cv=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},Cv(e,t)}function Bm(e,t,n){return t=lO(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function lO(e){var t=cK(e,"string");return Jo(t)=="symbol"?t:t+""}function cK(e,t){if(Jo(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Jo(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function uK(e,t){if(e==null)return{};var n=dK(e,t),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)r=i[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function dK(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function fK(e){return e.value}function pK(e,t){if(O.isValidElement(e))return O.cloneElement(e,t);if(typeof e=="function")return O.createElement(e,t);t.ref;var n=uK(t,nK);return O.createElement(D1,n)}var BN=1,ms=function(e){function t(){var n;rK(this,t);for(var r=arguments.length,s=new Array(r),i=0;i<r;i++)s[i]=arguments[i];return n=sK(this,t,[].concat(s)),Bm(n,"lastBoundingBox",{width:-1,height:-1}),n}return lK(t,e),aK(t,[{key:"componentDidMount",value:function(){this.updateBBox()}},{key:"componentDidUpdate",value:function(){this.updateBBox()}},{key:"getBBox",value:function(){if(this.wrapperNode&&this.wrapperNode.getBoundingClientRect){var r=this.wrapperNode.getBoundingClientRect();return r.height=this.wrapperNode.offsetHeight,r.width=this.wrapperNode.offsetWidth,r}return null}},{key:"updateBBox",value:function(){var r=this.props.onBBoxUpdate,s=this.getBBox();s?(Math.abs(s.width-this.lastBoundingBox.width)>BN||Math.abs(s.height-this.lastBoundingBox.height)>BN)&&(this.lastBoundingBox.width=s.width,this.lastBoundingBox.height=s.height,r&&r(s)):(this.lastBoundingBox.width!==-1||this.lastBoundingBox.height!==-1)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,r&&r(null))}},{key:"getBBoxSnapshot",value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?fa({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(r){var s=this.props,i=s.layout,o=s.align,l=s.verticalAlign,c=s.margin,u=s.chartWidth,d=s.chartHeight,f,p;if(!r||(r.left===void 0||r.left===null)&&(r.right===void 0||r.right===null))if(o==="center"&&i==="vertical"){var h=this.getBBoxSnapshot();f={left:((u||0)-h.width)/2}}else f=o==="right"?{right:c&&c.right||0}:{left:c&&c.left||0};if(!r||(r.top===void 0||r.top===null)&&(r.bottom===void 0||r.bottom===null))if(l==="middle"){var m=this.getBBoxSnapshot();p={top:((d||0)-m.height)/2}}else p=l==="bottom"?{bottom:c&&c.bottom||0}:{top:c&&c.top||0};return fa(fa({},f),p)}},{key:"render",value:function(){var r=this,s=this.props,i=s.content,o=s.width,l=s.height,c=s.wrapperStyle,u=s.payloadUniqBy,d=s.payload,f=fa(fa({position:"absolute",width:o||"auto",height:l||"auto"},this.getDefaultPosition(c)),c);return O.createElement("div",{className:"recharts-legend-wrapper",style:f,ref:function(h){r.wrapperNode=h}},pK(i,fa(fa({},this.props),{},{payload:iO(d,u,fK)})))}}],[{key:"getWithHeight",value:function(r,s){var i=fa(fa({},this.defaultProps),r.props),o=i.layout;return o==="vertical"&&ee(r.props.height)?{height:r.props.height}:o==="horizontal"?{width:r.props.width||s}:null}}])}(b.PureComponent);Bm(ms,"displayName","Legend");Bm(ms,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var FN=vd,hK=L1,mK=En,VN=FN?FN.isConcatSpreadable:void 0;function xK(e){return mK(e)||hK(e)||!!(VN&&e&&e[VN])}var gK=xK,vK=GE,yK=gK;function cO(e,t,n,r,s){var i=-1,o=e.length;for(n||(n=yK),s||(s=[]);++i<o;){var l=e[i];t>0&&n(l)?t>1?cO(l,t-1,n,r,s):vK(s,l):r||(s[s.length]=l)}return s}var uO=cO;function bK(e){return function(t,n,r){for(var s=-1,i=Object(t),o=r(t),l=o.length;l--;){var c=o[e?l:++s];if(n(i[c],c,i)===!1)break}return t}}var jK=bK,wK=jK,NK=wK(),SK=NK,kK=SK,CK=zm;function _K(e,t){return e&&kK(e,t,CK)}var dO=_K,AK=yd;function PK(e,t){return function(n,r){if(n==null)return n;if(!AK(n))return e(n,r);for(var s=n.length,i=t?s:-1,o=Object(n);(t?i--:++i<s)&&r(o[i],i,o)!==!1;);return n}}var EK=PK,OK=dO,TK=EK,$K=TK(OK),V1=$K,MK=V1,RK=yd;function DK(e,t){var n=-1,r=RK(e)?Array(e.length):[];return MK(e,function(s,i,o){r[++n]=t(s,i,o)}),r}var fO=DK;function IK(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}var LK=IK,UN=$l;function zK(e,t){if(e!==t){var n=e!==void 0,r=e===null,s=e===e,i=UN(e),o=t!==void 0,l=t===null,c=t===t,u=UN(t);if(!l&&!u&&!i&&e>t||i&&o&&c&&!l&&!u||r&&o&&c||!n&&c||!s)return 1;if(!r&&!i&&!u&&e<t||u&&n&&s&&!r&&!i||l&&n&&s||!o&&s||!c)return-1}return 0}var BK=zK,FK=BK;function VK(e,t,n){for(var r=-1,s=e.criteria,i=t.criteria,o=s.length,l=n.length;++r<o;){var c=FK(s[r],i[r]);if(c){if(r>=l)return c;var u=n[r];return c*(u=="desc"?-1:1)}}return e.index-t.index}var UK=VK,o0=C1,WK=_1,qK=ua,HK=fO,KK=LK,GK=QE,XK=UK,YK=Fl,QK=En;function JK(e,t,n){t.length?t=o0(t,function(i){return QK(i)?function(o){return WK(o,i.length===1?i[0]:i)}:i}):t=[YK];var r=-1;t=o0(t,GK(qK));var s=HK(e,function(i,o,l){var c=o0(t,function(u){return u(i)});return{criteria:c,index:++r,value:i}});return KK(s,function(i,o){return XK(i,o,n)})}var ZK=JK;function eG(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}var tG=eG,nG=tG,WN=Math.max;function rG(e,t,n){return t=WN(t===void 0?e.length-1:t,0),function(){for(var r=arguments,s=-1,i=WN(r.length-t,0),o=Array(i);++s<i;)o[s]=r[t+s];s=-1;for(var l=Array(t+1);++s<t;)l[s]=r[s];return l[t]=n(o),nG(e,this,l)}}var aG=rG;function sG(e){return function(){return e}}var iG=sG,oG=qi,lG=function(){try{var e=oG(Object,"defineProperty");return e({},"",{}),e}catch{}}(),pO=lG,cG=iG,qN=pO,uG=Fl,dG=qN?function(e,t){return qN(e,"toString",{configurable:!0,enumerable:!1,value:cG(t),writable:!0})}:uG,fG=dG,pG=800,hG=16,mG=Date.now;function xG(e){var t=0,n=0;return function(){var r=mG(),s=hG-(r-n);if(n=r,s>0){if(++t>=pG)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var gG=xG,vG=fG,yG=gG,bG=yG(vG),jG=bG,wG=Fl,NG=aG,SG=jG;function kG(e,t){return SG(NG(e,t,wG),e+"")}var CG=kG,_G=w1,AG=yd,PG=z1,EG=$s;function OG(e,t,n){if(!EG(n))return!1;var r=typeof t;return(r=="number"?AG(n)&&PG(t,n.length):r=="string"&&t in n)?_G(n[t],e):!1}var Fm=OG,TG=uO,$G=ZK,MG=CG,HN=Fm,RG=MG(function(e,t){if(e==null)return[];var n=t.length;return n>1&&HN(e,t[0],t[1])?t=[]:n>2&&HN(t[0],t[1],t[2])&&(t=[t[0]]),$G(e,TG(t,1),[])}),DG=RG;const U1=De(DG);function Cu(e){"@babel/helpers - typeof";return Cu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Cu(e)}function _v(){return _v=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},_v.apply(this,arguments)}function IG(e,t){return FG(e)||BG(e,t)||zG(e,t)||LG()}function LG(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function zG(e,t){if(e){if(typeof e=="string")return KN(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return KN(e,t)}}function KN(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function BG(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,s,i,o,l=[],c=!0,u=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(d){u=!0,s=d}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function FG(e){if(Array.isArray(e))return e}function GN(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function l0(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?GN(Object(n),!0).forEach(function(r){VG(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):GN(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function VG(e,t,n){return t=UG(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function UG(e){var t=WG(e,"string");return Cu(t)=="symbol"?t:t+""}function WG(e,t){if(Cu(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Cu(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function qG(e){return Array.isArray(e)&&Et(e[0])&&Et(e[1])?e.join(" ~ "):e}var HG=function(t){var n=t.separator,r=n===void 0?" : ":n,s=t.contentStyle,i=s===void 0?{}:s,o=t.itemStyle,l=o===void 0?{}:o,c=t.labelStyle,u=c===void 0?{}:c,d=t.payload,f=t.formatter,p=t.itemSorter,h=t.wrapperClassName,m=t.labelClassName,v=t.label,x=t.labelFormatter,y=t.accessibilityLayer,g=y===void 0?!1:y,j=function(){if(d&&d.length){var P={padding:0,margin:0},D=(p?U1(d,p):d).map(function(I,R){if(I.type==="none")return null;var M=l0({display:"block",paddingTop:4,paddingBottom:4,color:I.color||"#000"},l),W=I.formatter||f||qG,T=I.value,V=I.name,X=T,U=V;if(W&&X!=null&&U!=null){var L=W(T,V,I,R,d);if(Array.isArray(L)){var B=IG(L,2);X=B[0],U=B[1]}else X=L}return O.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(R),style:M},Et(U)?O.createElement("span",{className:"recharts-tooltip-item-name"},U):null,Et(U)?O.createElement("span",{className:"recharts-tooltip-item-separator"},r):null,O.createElement("span",{className:"recharts-tooltip-item-value"},X),O.createElement("span",{className:"recharts-tooltip-item-unit"},I.unit||""))});return O.createElement("ul",{className:"recharts-tooltip-item-list",style:P},D)}return null},N=l0({margin:0,padding:10,backgroundColor:"#fff",border:"1px solid #ccc",whiteSpace:"nowrap"},i),w=l0({margin:0},u),S=!je(v),k=S?v:"",C=Ne("recharts-default-tooltip",h),_=Ne("recharts-tooltip-label",m);S&&x&&d!==void 0&&d!==null&&(k=x(v,d));var A=g?{role:"status","aria-live":"assertive"}:{};return O.createElement("div",_v({className:C,style:N},A),O.createElement("p",{className:_,style:w},O.isValidElement(k)?k:"".concat(k)),j())};function _u(e){"@babel/helpers - typeof";return _u=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_u(e)}function sf(e,t,n){return t=KG(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function KG(e){var t=GG(e,"string");return _u(t)=="symbol"?t:t+""}function GG(e,t){if(_u(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(_u(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var uc="recharts-tooltip-wrapper",XG={visibility:"hidden"};function YG(e){var t=e.coordinate,n=e.translateX,r=e.translateY;return Ne(uc,sf(sf(sf(sf({},"".concat(uc,"-right"),ee(n)&&t&&ee(t.x)&&n>=t.x),"".concat(uc,"-left"),ee(n)&&t&&ee(t.x)&&n<t.x),"".concat(uc,"-bottom"),ee(r)&&t&&ee(t.y)&&r>=t.y),"".concat(uc,"-top"),ee(r)&&t&&ee(t.y)&&r<t.y))}function XN(e){var t=e.allowEscapeViewBox,n=e.coordinate,r=e.key,s=e.offsetTopLeft,i=e.position,o=e.reverseDirection,l=e.tooltipDimension,c=e.viewBox,u=e.viewBoxDimension;if(i&&ee(i[r]))return i[r];var d=n[r]-l-s,f=n[r]+s;if(t[r])return o[r]?d:f;if(o[r]){var p=d,h=c[r];return p<h?Math.max(f,c[r]):Math.max(d,c[r])}var m=f+l,v=c[r]+u;return m>v?Math.max(d,c[r]):Math.max(f,c[r])}function QG(e){var t=e.translateX,n=e.translateY,r=e.useTranslate3d;return{transform:r?"translate3d(".concat(t,"px, ").concat(n,"px, 0)"):"translate(".concat(t,"px, ").concat(n,"px)")}}function JG(e){var t=e.allowEscapeViewBox,n=e.coordinate,r=e.offsetTopLeft,s=e.position,i=e.reverseDirection,o=e.tooltipBox,l=e.useTranslate3d,c=e.viewBox,u,d,f;return o.height>0&&o.width>0&&n?(d=XN({allowEscapeViewBox:t,coordinate:n,key:"x",offsetTopLeft:r,position:s,reverseDirection:i,tooltipDimension:o.width,viewBox:c,viewBoxDimension:c.width}),f=XN({allowEscapeViewBox:t,coordinate:n,key:"y",offsetTopLeft:r,position:s,reverseDirection:i,tooltipDimension:o.height,viewBox:c,viewBoxDimension:c.height}),u=QG({translateX:d,translateY:f,useTranslate3d:l})):u=XG,{cssProperties:u,cssClasses:YG({translateX:d,translateY:f,coordinate:n})}}function Zo(e){"@babel/helpers - typeof";return Zo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Zo(e)}function YN(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function QN(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?YN(Object(n),!0).forEach(function(r){Pv(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):YN(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function ZG(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function eX(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,mO(r.key),r)}}function tX(e,t,n){return t&&eX(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function nX(e,t,n){return t=Kp(t),rX(e,hO()?Reflect.construct(t,n||[],Kp(e).constructor):t.apply(e,n))}function rX(e,t){if(t&&(Zo(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return aX(e)}function aX(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function hO(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(hO=function(){return!!e})()}function Kp(e){return Kp=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Kp(e)}function sX(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Av(e,t)}function Av(e,t){return Av=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},Av(e,t)}function Pv(e,t,n){return t=mO(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function mO(e){var t=iX(e,"string");return Zo(t)=="symbol"?t:t+""}function iX(e,t){if(Zo(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Zo(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var JN=1,oX=function(e){function t(){var n;ZG(this,t);for(var r=arguments.length,s=new Array(r),i=0;i<r;i++)s[i]=arguments[i];return n=nX(this,t,[].concat(s)),Pv(n,"state",{dismissed:!1,dismissedAtCoordinate:{x:0,y:0},lastBoundingBox:{width:-1,height:-1}}),Pv(n,"handleKeyDown",function(o){if(o.key==="Escape"){var l,c,u,d;n.setState({dismissed:!0,dismissedAtCoordinate:{x:(l=(c=n.props.coordinate)===null||c===void 0?void 0:c.x)!==null&&l!==void 0?l:0,y:(u=(d=n.props.coordinate)===null||d===void 0?void 0:d.y)!==null&&u!==void 0?u:0}})}}),n}return sX(t,e),tX(t,[{key:"updateBBox",value:function(){if(this.wrapperNode&&this.wrapperNode.getBoundingClientRect){var r=this.wrapperNode.getBoundingClientRect();(Math.abs(r.width-this.state.lastBoundingBox.width)>JN||Math.abs(r.height-this.state.lastBoundingBox.height)>JN)&&this.setState({lastBoundingBox:{width:r.width,height:r.height}})}else(this.state.lastBoundingBox.width!==-1||this.state.lastBoundingBox.height!==-1)&&this.setState({lastBoundingBox:{width:-1,height:-1}})}},{key:"componentDidMount",value:function(){document.addEventListener("keydown",this.handleKeyDown),this.updateBBox()}},{key:"componentWillUnmount",value:function(){document.removeEventListener("keydown",this.handleKeyDown)}},{key:"componentDidUpdate",value:function(){var r,s;this.props.active&&this.updateBBox(),this.state.dismissed&&(((r=this.props.coordinate)===null||r===void 0?void 0:r.x)!==this.state.dismissedAtCoordinate.x||((s=this.props.coordinate)===null||s===void 0?void 0:s.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}},{key:"render",value:function(){var r=this,s=this.props,i=s.active,o=s.allowEscapeViewBox,l=s.animationDuration,c=s.animationEasing,u=s.children,d=s.coordinate,f=s.hasPayload,p=s.isAnimationActive,h=s.offset,m=s.position,v=s.reverseDirection,x=s.useTranslate3d,y=s.viewBox,g=s.wrapperStyle,j=JG({allowEscapeViewBox:o,coordinate:d,offsetTopLeft:h,position:m,reverseDirection:v,tooltipBox:this.state.lastBoundingBox,useTranslate3d:x,viewBox:y}),N=j.cssClasses,w=j.cssProperties,S=QN(QN({transition:p&&i?"transform ".concat(l,"ms ").concat(c):void 0},w),{},{pointerEvents:"none",visibility:!this.state.dismissed&&i&&f?"visible":"hidden",position:"absolute",top:0,left:0},g);return O.createElement("div",{tabIndex:-1,className:N,style:S,ref:function(C){r.wrapperNode=C}},u)}}])}(b.PureComponent),lX=function(){return!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout)},Ms={isSsr:lX()};function el(e){"@babel/helpers - typeof";return el=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},el(e)}function ZN(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function eS(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ZN(Object(n),!0).forEach(function(r){W1(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ZN(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function cX(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function uX(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,gO(r.key),r)}}function dX(e,t,n){return t&&uX(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function fX(e,t,n){return t=Gp(t),pX(e,xO()?Reflect.construct(t,n||[],Gp(e).constructor):t.apply(e,n))}function pX(e,t){if(t&&(el(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return hX(e)}function hX(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function xO(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(xO=function(){return!!e})()}function Gp(e){return Gp=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Gp(e)}function mX(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Ev(e,t)}function Ev(e,t){return Ev=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},Ev(e,t)}function W1(e,t,n){return t=gO(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function gO(e){var t=xX(e,"string");return el(t)=="symbol"?t:t+""}function xX(e,t){if(el(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(el(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function gX(e){return e.dataKey}function vX(e,t){return O.isValidElement(e)?O.cloneElement(e,t):typeof e=="function"?O.createElement(e,t):O.createElement(HG,t)}var on=function(e){function t(){return cX(this,t),fX(this,t,arguments)}return mX(t,e),dX(t,[{key:"render",value:function(){var r=this,s=this.props,i=s.active,o=s.allowEscapeViewBox,l=s.animationDuration,c=s.animationEasing,u=s.content,d=s.coordinate,f=s.filterNull,p=s.isAnimationActive,h=s.offset,m=s.payload,v=s.payloadUniqBy,x=s.position,y=s.reverseDirection,g=s.useTranslate3d,j=s.viewBox,N=s.wrapperStyle,w=m??[];f&&w.length&&(w=iO(m.filter(function(k){return k.value!=null&&(k.hide!==!0||r.props.includeHidden)}),v,gX));var S=w.length>0;return O.createElement(oX,{allowEscapeViewBox:o,animationDuration:l,animationEasing:c,isAnimationActive:p,active:i,coordinate:d,hasPayload:S,offset:h,position:x,reverseDirection:y,useTranslate3d:g,viewBox:j,wrapperStyle:N},vX(u,eS(eS({},this.props),{},{payload:w})))}}])}(b.PureComponent);W1(on,"displayName","Tooltip");W1(on,"defaultProps",{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!Ms.isSsr,itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:" : ",trigger:"hover",useTranslate3d:!1,viewBox:{x:0,y:0,height:0,width:0},wrapperStyle:{}});var yX=ca,bX=function(){return yX.Date.now()},jX=bX,wX=/\s/;function NX(e){for(var t=e.length;t--&&wX.test(e.charAt(t)););return t}var SX=NX,kX=SX,CX=/^\s+/;function _X(e){return e&&e.slice(0,kX(e)+1).replace(CX,"")}var AX=_X,PX=AX,tS=$s,EX=$l,nS=NaN,OX=/^[-+]0x[0-9a-f]+$/i,TX=/^0b[01]+$/i,$X=/^0o[0-7]+$/i,MX=parseInt;function RX(e){if(typeof e=="number")return e;if(EX(e))return nS;if(tS(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=tS(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=PX(e);var n=TX.test(e);return n||$X.test(e)?MX(e.slice(2),n?2:8):OX.test(e)?nS:+e}var vO=RX,DX=$s,c0=jX,rS=vO,IX="Expected a function",LX=Math.max,zX=Math.min;function BX(e,t,n){var r,s,i,o,l,c,u=0,d=!1,f=!1,p=!0;if(typeof e!="function")throw new TypeError(IX);t=rS(t)||0,DX(n)&&(d=!!n.leading,f="maxWait"in n,i=f?LX(rS(n.maxWait)||0,t):i,p="trailing"in n?!!n.trailing:p);function h(S){var k=r,C=s;return r=s=void 0,u=S,o=e.apply(C,k),o}function m(S){return u=S,l=setTimeout(y,t),d?h(S):o}function v(S){var k=S-c,C=S-u,_=t-k;return f?zX(_,i-C):_}function x(S){var k=S-c,C=S-u;return c===void 0||k>=t||k<0||f&&C>=i}function y(){var S=c0();if(x(S))return g(S);l=setTimeout(y,v(S))}function g(S){return l=void 0,p&&r?h(S):(r=s=void 0,o)}function j(){l!==void 0&&clearTimeout(l),u=0,r=c=s=l=void 0}function N(){return l===void 0?o:g(c0())}function w(){var S=c0(),k=x(S);if(r=arguments,s=this,c=S,k){if(l===void 0)return m(c);if(f)return clearTimeout(l),l=setTimeout(y,t),h(c)}return l===void 0&&(l=setTimeout(y,t)),o}return w.cancel=j,w.flush=N,w}var FX=BX,VX=FX,UX=$s,WX="Expected a function";function qX(e,t,n){var r=!0,s=!0;if(typeof e!="function")throw new TypeError(WX);return UX(n)&&(r="leading"in n?!!n.leading:r,s="trailing"in n?!!n.trailing:s),VX(e,t,{leading:r,maxWait:t,trailing:s})}var HX=qX;const yO=De(HX);function Au(e){"@babel/helpers - typeof";return Au=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Au(e)}function aS(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function of(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?aS(Object(n),!0).forEach(function(r){KX(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):aS(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function KX(e,t,n){return t=GX(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function GX(e){var t=XX(e,"string");return Au(t)=="symbol"?t:t+""}function XX(e,t){if(Au(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Au(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function YX(e,t){return eY(e)||ZX(e,t)||JX(e,t)||QX()}function QX(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function JX(e,t){if(e){if(typeof e=="string")return sS(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return sS(e,t)}}function sS(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ZX(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,s,i,o,l=[],c=!0,u=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(d){u=!0,s=d}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function eY(e){if(Array.isArray(e))return e}var Do=b.forwardRef(function(e,t){var n=e.aspect,r=e.initialDimension,s=r===void 0?{width:-1,height:-1}:r,i=e.width,o=i===void 0?"100%":i,l=e.height,c=l===void 0?"100%":l,u=e.minWidth,d=u===void 0?0:u,f=e.minHeight,p=e.maxHeight,h=e.children,m=e.debounce,v=m===void 0?0:m,x=e.id,y=e.className,g=e.onResize,j=e.style,N=j===void 0?{}:j,w=b.useRef(null),S=b.useRef();S.current=g,b.useImperativeHandle(t,function(){return Object.defineProperty(w.current,"current",{get:function(){return console.warn("The usage of ref.current.current is deprecated and will no longer be supported."),w.current},configurable:!0})});var k=b.useState({containerWidth:s.width,containerHeight:s.height}),C=YX(k,2),_=C[0],A=C[1],E=b.useCallback(function(D,I){A(function(R){var M=Math.round(D),W=Math.round(I);return R.containerWidth===M&&R.containerHeight===W?R:{containerWidth:M,containerHeight:W}})},[]);b.useEffect(function(){var D=function(V){var X,U=V[0].contentRect,L=U.width,B=U.height;E(L,B),(X=S.current)===null||X===void 0||X.call(S,L,B)};v>0&&(D=yO(D,v,{trailing:!0,leading:!1}));var I=new ResizeObserver(D),R=w.current.getBoundingClientRect(),M=R.width,W=R.height;return E(M,W),I.observe(w.current),function(){I.disconnect()}},[E,v]);var P=b.useMemo(function(){var D=_.containerWidth,I=_.containerHeight;if(D<0||I<0)return null;Or(ii(o)||ii(c),`The width(%s) and height(%s) are both fixed numbers,
maybe you don't need to use a ResponsiveContainer.`,o,c),Or(!n||n>0,"The aspect(%s) must be greater than zero.",n);var R=ii(o)?D:o,M=ii(c)?I:c;n&&n>0&&(R?M=R/n:M&&(R=M*n),p&&M>p&&(M=p)),Or(R>0||M>0,`The width(%s) and height(%s) of chart should be greater than 0,
please check the style of container, or the props width(%s) and height(%s),
or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the
height and width.`,R,M,o,c,d,f,n);var W=!Array.isArray(h)&&Na(h.type).endsWith("Chart");return O.Children.map(h,function(T){return O.isValidElement(T)?b.cloneElement(T,of({width:R,height:M},W?{style:of({height:"100%",width:"100%",maxHeight:M,maxWidth:R},T.props.style)}:{})):T})},[n,h,c,p,f,d,_,o]);return O.createElement("div",{id:x?"".concat(x):void 0,className:Ne("recharts-responsive-container",y),style:of(of({},N),{},{width:o,height:c,minWidth:d,minHeight:f,maxHeight:p}),ref:w},P)}),Vm=function(t){return null};Vm.displayName="Cell";function Pu(e){"@babel/helpers - typeof";return Pu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Pu(e)}function iS(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function Ov(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?iS(Object(n),!0).forEach(function(r){tY(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):iS(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function tY(e,t,n){return t=nY(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function nY(e){var t=rY(e,"string");return Pu(t)=="symbol"?t:t+""}function rY(e,t){if(Pu(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Pu(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Zi={widthCache:{},cacheCount:0},aY=2e3,sY={position:"absolute",top:"-20000px",left:0,padding:0,margin:0,border:"none",whiteSpace:"pre"},oS="recharts_measurement_span";function iY(e){var t=Ov({},e);return Object.keys(t).forEach(function(n){t[n]||delete t[n]}),t}var zc=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(t==null||Ms.isSsr)return{width:0,height:0};var r=iY(n),s=JSON.stringify({text:t,copyStyle:r});if(Zi.widthCache[s])return Zi.widthCache[s];try{var i=document.getElementById(oS);i||(i=document.createElement("span"),i.setAttribute("id",oS),i.setAttribute("aria-hidden","true"),document.body.appendChild(i));var o=Ov(Ov({},sY),r);Object.assign(i.style,o),i.textContent="".concat(t);var l=i.getBoundingClientRect(),c={width:l.width,height:l.height};return Zi.widthCache[s]=c,++Zi.cacheCount>aY&&(Zi.cacheCount=0,Zi.widthCache={}),c}catch{return{width:0,height:0}}},oY=function(t){return{top:t.top+window.scrollY-document.documentElement.clientTop,left:t.left+window.scrollX-document.documentElement.clientLeft}};function Eu(e){"@babel/helpers - typeof";return Eu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Eu(e)}function Xp(e,t){return dY(e)||uY(e,t)||cY(e,t)||lY()}function lY(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function cY(e,t){if(e){if(typeof e=="string")return lS(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return lS(e,t)}}function lS(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function uY(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,s,i,o,l=[],c=!0,u=!1;try{if(i=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(d){u=!0,s=d}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function dY(e){if(Array.isArray(e))return e}function fY(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function cS(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,hY(r.key),r)}}function pY(e,t,n){return t&&cS(e.prototype,t),n&&cS(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function hY(e){var t=mY(e,"string");return Eu(t)=="symbol"?t:t+""}function mY(e,t){if(Eu(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Eu(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var uS=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,dS=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,xY=/^px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q$/,gY=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,bO={cm:96/2.54,mm:96/25.4,pt:96/72,pc:96/6,in:96,Q:96/(2.54*40),px:1},vY=Object.keys(bO),yo="NaN";function yY(e,t){return e*bO[t]}var lf=function(){function e(t,n){fY(this,e),this.num=t,this.unit=n,this.num=t,this.unit=n,Number.isNaN(t)&&(this.unit=""),n!==""&&!xY.test(n)&&(this.num=NaN,this.unit=""),vY.includes(n)&&(this.num=yY(t,n),this.unit="px")}return pY(e,[{key:"add",value:function(n){return this.unit!==n.unit?new e(NaN,""):new e(this.num+n.num,this.unit)}},{key:"subtract",value:function(n){return this.unit!==n.unit?new e(NaN,""):new e(this.num-n.num,this.unit)}},{key:"multiply",value:function(n){return this.unit!==""&&n.unit!==""&&this.unit!==n.unit?new e(NaN,""):new e(this.num*n.num,this.unit||n.unit)}},{key:"divide",value:function(n){return this.unit!==""&&n.unit!==""&&this.unit!==n.unit?new e(NaN,""):new e(this.num/n.num,this.unit||n.unit)}},{key:"toString",value:function(){return"".concat(this.num).concat(this.unit)}},{key:"isNaN",value:function(){return Number.isNaN(this.num)}}],[{key:"parse",value:function(n){var r,s=(r=gY.exec(n))!==null&&r!==void 0?r:[],i=Xp(s,3),o=i[1],l=i[2];return new e(parseFloat(o),l??"")}}])}();function jO(e){if(e.includes(yo))return yo;for(var t=e;t.includes("*")||t.includes("/");){var n,r=(n=uS.exec(t))!==null&&n!==void 0?n:[],s=Xp(r,4),i=s[1],o=s[2],l=s[3],c=lf.parse(i??""),u=lf.parse(l??""),d=o==="*"?c.multiply(u):c.divide(u);if(d.isNaN())return yo;t=t.replace(uS,d.toString())}for(;t.includes("+")||/.-\d+(?:\.\d+)?/.test(t);){var f,p=(f=dS.exec(t))!==null&&f!==void 0?f:[],h=Xp(p,4),m=h[1],v=h[2],x=h[3],y=lf.parse(m??""),g=lf.parse(x??""),j=v==="+"?y.add(g):y.subtract(g);if(j.isNaN())return yo;t=t.replace(dS,j.toString())}return t}var fS=/\(([^()]*)\)/;function bY(e){for(var t=e;t.includes("(");){var n=fS.exec(t),r=Xp(n,2),s=r[1];t=t.replace(fS,jO(s))}return t}function jY(e){var t=e.replace(/\s+/g,"");return t=bY(t),t=jO(t),t}function wY(e){try{return jY(e)}catch{return yo}}function u0(e){var t=wY(e.slice(5,-1));return t===yo?"":t}var NY=["x","y","lineHeight","capHeight","scaleToFit","textAnchor","verticalAnchor","fill"],SY=["dx","dy","angle","className","breakAll"];function Tv(){return Tv=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Tv.apply(this,arguments)}function pS(e,t){if(e==null)return{};var n=kY(e,t),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)r=i[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function kY(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function hS(e,t){return PY(e)||AY(e,t)||_Y(e,t)||CY()}function CY(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _Y(e,t){if(e){if(typeof e=="string")return mS(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return mS(e,t)}}function mS(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function AY(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,s,i,o,l=[],c=!0,u=!1;try{if(i=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(d){u=!0,s=d}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function PY(e){if(Array.isArray(e))return e}var wO=/[ \f\n\r\t\v\u2028\u2029]+/,NO=function(t){var n=t.children,r=t.breakAll,s=t.style;try{var i=[];je(n)||(r?i=n.toString().split(""):i=n.toString().split(wO));var o=i.map(function(c){return{word:c,width:zc(c,s).width}}),l=r?0:zc(" ",s).width;return{wordsWithComputedWidth:o,spaceWidth:l}}catch{return null}},EY=function(t,n,r,s,i){var o=t.maxLines,l=t.children,c=t.style,u=t.breakAll,d=ee(o),f=l,p=function(){var R=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return R.reduce(function(M,W){var T=W.word,V=W.width,X=M[M.length-1];if(X&&(s==null||i||X.width+V+r<Number(s)))X.words.push(T),X.width+=V+r;else{var U={words:[T],width:V};M.push(U)}return M},[])},h=p(n),m=function(R){return R.reduce(function(M,W){return M.width>W.width?M:W})};if(!d)return h;for(var v="…",x=function(R){var M=f.slice(0,R),W=NO({breakAll:u,style:c,children:M+v}).wordsWithComputedWidth,T=p(W),V=T.length>o||m(T).width>Number(s);return[V,T]},y=0,g=f.length-1,j=0,N;y<=g&&j<=f.length-1;){var w=Math.floor((y+g)/2),S=w-1,k=x(S),C=hS(k,2),_=C[0],A=C[1],E=x(w),P=hS(E,1),D=P[0];if(!_&&!D&&(y=w+1),_&&D&&(g=w-1),!_&&D){N=A;break}j++}return N||h},xS=function(t){var n=je(t)?[]:t.toString().split(wO);return[{words:n}]},OY=function(t){var n=t.width,r=t.scaleToFit,s=t.children,i=t.style,o=t.breakAll,l=t.maxLines;if((n||r)&&!Ms.isSsr){var c,u,d=NO({breakAll:o,children:s,style:i});if(d){var f=d.wordsWithComputedWidth,p=d.spaceWidth;c=f,u=p}else return xS(s);return EY({breakAll:o,children:s,maxLines:l,style:i},c,u,n,r)}return xS(s)},gS="#808080",Ti=function(t){var n=t.x,r=n===void 0?0:n,s=t.y,i=s===void 0?0:s,o=t.lineHeight,l=o===void 0?"1em":o,c=t.capHeight,u=c===void 0?"0.71em":c,d=t.scaleToFit,f=d===void 0?!1:d,p=t.textAnchor,h=p===void 0?"start":p,m=t.verticalAnchor,v=m===void 0?"end":m,x=t.fill,y=x===void 0?gS:x,g=pS(t,NY),j=b.useMemo(function(){return OY({breakAll:g.breakAll,children:g.children,maxLines:g.maxLines,scaleToFit:f,style:g.style,width:g.width})},[g.breakAll,g.children,g.maxLines,f,g.style,g.width]),N=g.dx,w=g.dy,S=g.angle,k=g.className,C=g.breakAll,_=pS(g,SY);if(!Et(r)||!Et(i))return null;var A=r+(ee(N)?N:0),E=i+(ee(w)?w:0),P;switch(v){case"start":P=u0("calc(".concat(u,")"));break;case"middle":P=u0("calc(".concat((j.length-1)/2," * -").concat(l," + (").concat(u," / 2))"));break;default:P=u0("calc(".concat(j.length-1," * -").concat(l,")"));break}var D=[];if(f){var I=j[0].width,R=g.width;D.push("scale(".concat((ee(R)?R/I:1)/I,")"))}return S&&D.push("rotate(".concat(S,", ").concat(A,", ").concat(E,")")),D.length&&(_.transform=D.join(" ")),O.createElement("text",Tv({},me(_,!0),{x:A,y:E,className:Ne("recharts-text",k),textAnchor:h,fill:y.includes("url")?gS:y}),j.map(function(M,W){var T=M.words.join(C?"":" ");return O.createElement("tspan",{x:A,dy:W===0?P:l,key:"".concat(T,"-").concat(W)},T)}))};function xs(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function TY(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function q1(e){let t,n,r;e.length!==2?(t=xs,n=(l,c)=>xs(e(l),c),r=(l,c)=>e(l)-c):(t=e===xs||e===TY?e:$Y,n=e,r=e);function s(l,c,u=0,d=l.length){if(u<d){if(t(c,c)!==0)return d;do{const f=u+d>>>1;n(l[f],c)<0?u=f+1:d=f}while(u<d)}return u}function i(l,c,u=0,d=l.length){if(u<d){if(t(c,c)!==0)return d;do{const f=u+d>>>1;n(l[f],c)<=0?u=f+1:d=f}while(u<d)}return u}function o(l,c,u=0,d=l.length){const f=s(l,c,u,d-1);return f>u&&r(l[f-1],c)>-r(l[f],c)?f-1:f}return{left:s,center:o,right:i}}function $Y(){return 0}function SO(e){return e===null?NaN:+e}function*MY(e,t){for(let n of e)n!=null&&(n=+n)>=n&&(yield n)}const RY=q1(xs),bd=RY.right;q1(SO).center;class vS extends Map{constructor(t,n=LY){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),t!=null)for(const[r,s]of t)this.set(r,s)}get(t){return super.get(yS(this,t))}has(t){return super.has(yS(this,t))}set(t,n){return super.set(DY(this,t),n)}delete(t){return super.delete(IY(this,t))}}function yS({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):n}function DY({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function IY({_intern:e,_key:t},n){const r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function LY(e){return e!==null&&typeof e=="object"?e.valueOf():e}function zY(e=xs){if(e===xs)return kO;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,n)=>{const r=e(t,n);return r||r===0?r:(e(n,n)===0)-(e(t,t)===0)}}function kO(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(e<t?-1:e>t?1:0)}const BY=Math.sqrt(50),FY=Math.sqrt(10),VY=Math.sqrt(2);function Yp(e,t,n){const r=(t-e)/Math.max(0,n),s=Math.floor(Math.log10(r)),i=r/Math.pow(10,s),o=i>=BY?10:i>=FY?5:i>=VY?2:1;let l,c,u;return s<0?(u=Math.pow(10,-s)/o,l=Math.round(e*u),c=Math.round(t*u),l/u<e&&++l,c/u>t&&--c,u=-u):(u=Math.pow(10,s)*o,l=Math.round(e/u),c=Math.round(t/u),l*u<e&&++l,c*u>t&&--c),c<l&&.5<=n&&n<2?Yp(e,t,n*2):[l,c,u]}function $v(e,t,n){if(t=+t,e=+e,n=+n,!(n>0))return[];if(e===t)return[e];const r=t<e,[s,i,o]=r?Yp(t,e,n):Yp(e,t,n);if(!(i>=s))return[];const l=i-s+1,c=new Array(l);if(r)if(o<0)for(let u=0;u<l;++u)c[u]=(i-u)/-o;else for(let u=0;u<l;++u)c[u]=(i-u)*o;else if(o<0)for(let u=0;u<l;++u)c[u]=(s+u)/-o;else for(let u=0;u<l;++u)c[u]=(s+u)*o;return c}function Mv(e,t,n){return t=+t,e=+e,n=+n,Yp(e,t,n)[2]}function Rv(e,t,n){t=+t,e=+e,n=+n;const r=t<e,s=r?Mv(t,e,n):Mv(e,t,n);return(r?-1:1)*(s<0?1/-s:s)}function bS(e,t){let n;for(const r of e)r!=null&&(n<r||n===void 0&&r>=r)&&(n=r);return n}function jS(e,t){let n;for(const r of e)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);return n}function CO(e,t,n=0,r=1/0,s){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(e.length-1,r)),!(n<=t&&t<=r))return e;for(s=s===void 0?kO:zY(s);r>n;){if(r-n>600){const c=r-n+1,u=t-n+1,d=Math.log(c),f=.5*Math.exp(2*d/3),p=.5*Math.sqrt(d*f*(c-f)/c)*(u-c/2<0?-1:1),h=Math.max(n,Math.floor(t-u*f/c+p)),m=Math.min(r,Math.floor(t+(c-u)*f/c+p));CO(e,t,h,m,s)}const i=e[t];let o=n,l=r;for(dc(e,n,t),s(e[r],i)>0&&dc(e,n,r);o<l;){for(dc(e,o,l),++o,--l;s(e[o],i)<0;)++o;for(;s(e[l],i)>0;)--l}s(e[n],i)===0?dc(e,n,l):(++l,dc(e,l,r)),l<=t&&(n=l+1),t<=l&&(r=l-1)}return e}function dc(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function UY(e,t,n){if(e=Float64Array.from(MY(e)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return jS(e);if(t>=1)return bS(e);var r,s=(r-1)*t,i=Math.floor(s),o=bS(CO(e,i).subarray(0,i+1)),l=jS(e.subarray(i+1));return o+(l-o)*(s-i)}}function WY(e,t,n=SO){if(!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return+n(e[0],0,e);if(t>=1)return+n(e[r-1],r-1,e);var r,s=(r-1)*t,i=Math.floor(s),o=+n(e[i],i,e),l=+n(e[i+1],i+1,e);return o+(l-o)*(s-i)}}function qY(e,t,n){e=+e,t=+t,n=(s=arguments.length)<2?(t=e,e=0,1):s<3?1:+n;for(var r=-1,s=Math.max(0,Math.ceil((t-e)/n))|0,i=new Array(s);++r<s;)i[r]=e+r*n;return i}function pr(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}function Ia(e,t){switch(arguments.length){case 0:break;case 1:{typeof e=="function"?this.interpolator(e):this.range(e);break}default:{this.domain(e),typeof t=="function"?this.interpolator(t):this.range(t);break}}return this}const Dv=Symbol("implicit");function H1(){var e=new vS,t=[],n=[],r=Dv;function s(i){let o=e.get(i);if(o===void 0){if(r!==Dv)return r;e.set(i,o=t.push(i)-1)}return n[o%n.length]}return s.domain=function(i){if(!arguments.length)return t.slice();t=[],e=new vS;for(const o of i)e.has(o)||e.set(o,t.push(o)-1);return s},s.range=function(i){return arguments.length?(n=Array.from(i),s):n.slice()},s.unknown=function(i){return arguments.length?(r=i,s):r},s.copy=function(){return H1(t,n).unknown(r)},pr.apply(s,arguments),s}function Ou(){var e=H1().unknown(void 0),t=e.domain,n=e.range,r=0,s=1,i,o,l=!1,c=0,u=0,d=.5;delete e.unknown;function f(){var p=t().length,h=s<r,m=h?s:r,v=h?r:s;i=(v-m)/Math.max(1,p-c+u*2),l&&(i=Math.floor(i)),m+=(v-m-i*(p-c))*d,o=i*(1-c),l&&(m=Math.round(m),o=Math.round(o));var x=qY(p).map(function(y){return m+i*y});return n(h?x.reverse():x)}return e.domain=function(p){return arguments.length?(t(p),f()):t()},e.range=function(p){return arguments.length?([r,s]=p,r=+r,s=+s,f()):[r,s]},e.rangeRound=function(p){return[r,s]=p,r=+r,s=+s,l=!0,f()},e.bandwidth=function(){return o},e.step=function(){return i},e.round=function(p){return arguments.length?(l=!!p,f()):l},e.padding=function(p){return arguments.length?(c=Math.min(1,u=+p),f()):c},e.paddingInner=function(p){return arguments.length?(c=Math.min(1,p),f()):c},e.paddingOuter=function(p){return arguments.length?(u=+p,f()):u},e.align=function(p){return arguments.length?(d=Math.max(0,Math.min(1,p)),f()):d},e.copy=function(){return Ou(t(),[r,s]).round(l).paddingInner(c).paddingOuter(u).align(d)},pr.apply(f(),arguments)}function _O(e){var t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,delete e.paddingOuter,e.copy=function(){return _O(t())},e}function Bc(){return _O(Ou.apply(null,arguments).paddingInner(1))}function K1(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function AO(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function jd(){}var Tu=.7,Qp=1/Tu,Io="\\s*([+-]?\\d+)\\s*",$u="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Jr="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",HY=/^#([0-9a-f]{3,8})$/,KY=new RegExp(`^rgb\\(${Io},${Io},${Io}\\)$`),GY=new RegExp(`^rgb\\(${Jr},${Jr},${Jr}\\)$`),XY=new RegExp(`^rgba\\(${Io},${Io},${Io},${$u}\\)$`),YY=new RegExp(`^rgba\\(${Jr},${Jr},${Jr},${$u}\\)$`),QY=new RegExp(`^hsl\\(${$u},${Jr},${Jr}\\)$`),JY=new RegExp(`^hsla\\(${$u},${Jr},${Jr},${$u}\\)$`),wS={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};K1(jd,Mu,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:NS,formatHex:NS,formatHex8:ZY,formatHsl:eQ,formatRgb:SS,toString:SS});function NS(){return this.rgb().formatHex()}function ZY(){return this.rgb().formatHex8()}function eQ(){return PO(this).formatHsl()}function SS(){return this.rgb().formatRgb()}function Mu(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=HY.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?kS(t):n===3?new Sn(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?cf(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?cf(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=KY.exec(e))?new Sn(t[1],t[2],t[3],1):(t=GY.exec(e))?new Sn(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=XY.exec(e))?cf(t[1],t[2],t[3],t[4]):(t=YY.exec(e))?cf(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=QY.exec(e))?AS(t[1],t[2]/100,t[3]/100,1):(t=JY.exec(e))?AS(t[1],t[2]/100,t[3]/100,t[4]):wS.hasOwnProperty(e)?kS(wS[e]):e==="transparent"?new Sn(NaN,NaN,NaN,0):null}function kS(e){return new Sn(e>>16&255,e>>8&255,e&255,1)}function cf(e,t,n,r){return r<=0&&(e=t=n=NaN),new Sn(e,t,n,r)}function tQ(e){return e instanceof jd||(e=Mu(e)),e?(e=e.rgb(),new Sn(e.r,e.g,e.b,e.opacity)):new Sn}function Iv(e,t,n,r){return arguments.length===1?tQ(e):new Sn(e,t,n,r??1)}function Sn(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}K1(Sn,Iv,AO(jd,{brighter(e){return e=e==null?Qp:Math.pow(Qp,e),new Sn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Tu:Math.pow(Tu,e),new Sn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Sn(gi(this.r),gi(this.g),gi(this.b),Jp(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:CS,formatHex:CS,formatHex8:nQ,formatRgb:_S,toString:_S}));function CS(){return`#${oi(this.r)}${oi(this.g)}${oi(this.b)}`}function nQ(){return`#${oi(this.r)}${oi(this.g)}${oi(this.b)}${oi((isNaN(this.opacity)?1:this.opacity)*255)}`}function _S(){const e=Jp(this.opacity);return`${e===1?"rgb(":"rgba("}${gi(this.r)}, ${gi(this.g)}, ${gi(this.b)}${e===1?")":`, ${e})`}`}function Jp(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function gi(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function oi(e){return e=gi(e),(e<16?"0":"")+e.toString(16)}function AS(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new kr(e,t,n,r)}function PO(e){if(e instanceof kr)return new kr(e.h,e.s,e.l,e.opacity);if(e instanceof jd||(e=Mu(e)),!e)return new kr;if(e instanceof kr)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,s=Math.min(t,n,r),i=Math.max(t,n,r),o=NaN,l=i-s,c=(i+s)/2;return l?(t===i?o=(n-r)/l+(n<r)*6:n===i?o=(r-t)/l+2:o=(t-n)/l+4,l/=c<.5?i+s:2-i-s,o*=60):l=c>0&&c<1?0:o,new kr(o,l,c,e.opacity)}function rQ(e,t,n,r){return arguments.length===1?PO(e):new kr(e,t,n,r??1)}function kr(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}K1(kr,rQ,AO(jd,{brighter(e){return e=e==null?Qp:Math.pow(Qp,e),new kr(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Tu:Math.pow(Tu,e),new kr(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,s=2*n-r;return new Sn(d0(e>=240?e-240:e+120,s,r),d0(e,s,r),d0(e<120?e+240:e-120,s,r),this.opacity)},clamp(){return new kr(PS(this.h),uf(this.s),uf(this.l),Jp(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Jp(this.opacity);return`${e===1?"hsl(":"hsla("}${PS(this.h)}, ${uf(this.s)*100}%, ${uf(this.l)*100}%${e===1?")":`, ${e})`}`}}));function PS(e){return e=(e||0)%360,e<0?e+360:e}function uf(e){return Math.max(0,Math.min(1,e||0))}function d0(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const G1=e=>()=>e;function aQ(e,t){return function(n){return e+n*t}}function sQ(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function iQ(e){return(e=+e)==1?EO:function(t,n){return n-t?sQ(t,n,e):G1(isNaN(t)?n:t)}}function EO(e,t){var n=t-e;return n?aQ(e,n):G1(isNaN(e)?t:e)}const ES=function e(t){var n=iQ(t);function r(s,i){var o=n((s=Iv(s)).r,(i=Iv(i)).r),l=n(s.g,i.g),c=n(s.b,i.b),u=EO(s.opacity,i.opacity);return function(d){return s.r=o(d),s.g=l(d),s.b=c(d),s.opacity=u(d),s+""}}return r.gamma=e,r}(1);function oQ(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),s;return function(i){for(s=0;s<n;++s)r[s]=e[s]*(1-i)+t[s]*i;return r}}function lQ(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function cQ(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,s=new Array(r),i=new Array(n),o;for(o=0;o<r;++o)s[o]=Vl(e[o],t[o]);for(;o<n;++o)i[o]=t[o];return function(l){for(o=0;o<r;++o)i[o]=s[o](l);return i}}function uQ(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function Zp(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function dQ(e,t){var n={},r={},s;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(s in t)s in e?n[s]=Vl(e[s],t[s]):r[s]=t[s];return function(i){for(s in n)r[s]=n[s](i);return r}}var Lv=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,f0=new RegExp(Lv.source,"g");function fQ(e){return function(){return e}}function pQ(e){return function(t){return e(t)+""}}function hQ(e,t){var n=Lv.lastIndex=f0.lastIndex=0,r,s,i,o=-1,l=[],c=[];for(e=e+"",t=t+"";(r=Lv.exec(e))&&(s=f0.exec(t));)(i=s.index)>n&&(i=t.slice(n,i),l[o]?l[o]+=i:l[++o]=i),(r=r[0])===(s=s[0])?l[o]?l[o]+=s:l[++o]=s:(l[++o]=null,c.push({i:o,x:Zp(r,s)})),n=f0.lastIndex;return n<t.length&&(i=t.slice(n),l[o]?l[o]+=i:l[++o]=i),l.length<2?c[0]?pQ(c[0].x):fQ(t):(t=c.length,function(u){for(var d=0,f;d<t;++d)l[(f=c[d]).i]=f.x(u);return l.join("")})}function Vl(e,t){var n=typeof t,r;return t==null||n==="boolean"?G1(t):(n==="number"?Zp:n==="string"?(r=Mu(t))?(t=r,ES):hQ:t instanceof Mu?ES:t instanceof Date?uQ:lQ(t)?oQ:Array.isArray(t)?cQ:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?dQ:Zp)(e,t)}function X1(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}function mQ(e,t){t===void 0&&(t=e,e=Vl);for(var n=0,r=t.length-1,s=t[0],i=new Array(r<0?0:r);n<r;)i[n]=e(s,s=t[++n]);return function(o){var l=Math.max(0,Math.min(r-1,Math.floor(o*=r)));return i[l](o-l)}}function xQ(e){return function(){return e}}function eh(e){return+e}var OS=[0,1];function un(e){return e}function zv(e,t){return(t-=e=+e)?function(n){return(n-e)/t}:xQ(isNaN(t)?NaN:.5)}function gQ(e,t){var n;return e>t&&(n=e,e=t,t=n),function(r){return Math.max(e,Math.min(t,r))}}function vQ(e,t,n){var r=e[0],s=e[1],i=t[0],o=t[1];return s<r?(r=zv(s,r),i=n(o,i)):(r=zv(r,s),i=n(i,o)),function(l){return i(r(l))}}function yQ(e,t,n){var r=Math.min(e.length,t.length)-1,s=new Array(r),i=new Array(r),o=-1;for(e[r]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++o<r;)s[o]=zv(e[o],e[o+1]),i[o]=n(t[o],t[o+1]);return function(l){var c=bd(e,l,1,r)-1;return i[c](s[c](l))}}function wd(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function Um(){var e=OS,t=OS,n=Vl,r,s,i,o=un,l,c,u;function d(){var p=Math.min(e.length,t.length);return o!==un&&(o=gQ(e[0],e[p-1])),l=p>2?yQ:vQ,c=u=null,f}function f(p){return p==null||isNaN(p=+p)?i:(c||(c=l(e.map(r),t,n)))(r(o(p)))}return f.invert=function(p){return o(s((u||(u=l(t,e.map(r),Zp)))(p)))},f.domain=function(p){return arguments.length?(e=Array.from(p,eh),d()):e.slice()},f.range=function(p){return arguments.length?(t=Array.from(p),d()):t.slice()},f.rangeRound=function(p){return t=Array.from(p),n=X1,d()},f.clamp=function(p){return arguments.length?(o=p?!0:un,d()):o!==un},f.interpolate=function(p){return arguments.length?(n=p,d()):n},f.unknown=function(p){return arguments.length?(i=p,f):i},function(p,h){return r=p,s=h,d()}}function Y1(){return Um()(un,un)}function bQ(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function th(e,t){if(!isFinite(e)||e===0)return null;var n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"),r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function tl(e){return e=th(Math.abs(e)),e?e[1]:NaN}function jQ(e,t){return function(n,r){for(var s=n.length,i=[],o=0,l=e[0],c=0;s>0&&l>0&&(c+l+1>r&&(l=Math.max(1,r-c)),i.push(n.substring(s-=l,s+l)),!((c+=l+1)>r));)l=e[o=(o+1)%e.length];return i.reverse().join(t)}}function wQ(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var NQ=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Ru(e){if(!(t=NQ.exec(e)))throw new Error("invalid format: "+e);var t;return new Q1({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]})}Ru.prototype=Q1.prototype;function Q1(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}Q1.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function SQ(e){e:for(var t=e.length,n=1,r=-1,s;n<t;++n)switch(e[n]){case".":r=s=n;break;case"0":r===0&&(r=n),s=n;break;default:if(!+e[n])break e;r>0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(s+1):e}var nh;function kQ(e,t){var n=th(e,t);if(!n)return nh=void 0,e.toPrecision(t);var r=n[0],s=n[1],i=s-(nh=Math.max(-8,Math.min(8,Math.floor(s/3)))*3)+1,o=r.length;return i===o?r:i>o?r+new Array(i-o+1).join("0"):i>0?r.slice(0,i)+"."+r.slice(i):"0."+new Array(1-i).join("0")+th(e,Math.max(0,t+i-1))[0]}function TS(e,t){var n=th(e,t);if(!n)return e+"";var r=n[0],s=n[1];return s<0?"0."+new Array(-s).join("0")+r:r.length>s+1?r.slice(0,s+1)+"."+r.slice(s+1):r+new Array(s-r.length+2).join("0")}const $S={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:bQ,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)=>TS(e*100,t),r:TS,s:kQ,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function MS(e){return e}var RS=Array.prototype.map,DS=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function CQ(e){var t=e.grouping===void 0||e.thousands===void 0?MS:jQ(RS.call(e.grouping,Number),e.thousands+""),n=e.currency===void 0?"":e.currency[0]+"",r=e.currency===void 0?"":e.currency[1]+"",s=e.decimal===void 0?".":e.decimal+"",i=e.numerals===void 0?MS:wQ(RS.call(e.numerals,String)),o=e.percent===void 0?"%":e.percent+"",l=e.minus===void 0?"":e.minus+"",c=e.nan===void 0?"NaN":e.nan+"";function u(f,p){f=Ru(f);var h=f.fill,m=f.align,v=f.sign,x=f.symbol,y=f.zero,g=f.width,j=f.comma,N=f.precision,w=f.trim,S=f.type;S==="n"?(j=!0,S="g"):$S[S]||(N===void 0&&(N=12),w=!0,S="g"),(y||h==="0"&&m==="=")&&(y=!0,h="0",m="=");var k=(p&&p.prefix!==void 0?p.prefix:"")+(x==="$"?n:x==="#"&&/[boxX]/.test(S)?"0"+S.toLowerCase():""),C=(x==="$"?r:/[%p]/.test(S)?o:"")+(p&&p.suffix!==void 0?p.suffix:""),_=$S[S],A=/[defgprs%]/.test(S);N=N===void 0?6:/[gprs]/.test(S)?Math.max(1,Math.min(21,N)):Math.max(0,Math.min(20,N));function E(P){var D=k,I=C,R,M,W;if(S==="c")I=_(P)+I,P="";else{P=+P;var T=P<0||1/P<0;if(P=isNaN(P)?c:_(Math.abs(P),N),w&&(P=SQ(P)),T&&+P==0&&v!=="+"&&(T=!1),D=(T?v==="("?v:l:v==="-"||v==="("?"":v)+D,I=(S==="s"&&!isNaN(P)&&nh!==void 0?DS[8+nh/3]:"")+I+(T&&v==="("?")":""),A){for(R=-1,M=P.length;++R<M;)if(W=P.charCodeAt(R),48>W||W>57){I=(W===46?s+P.slice(R+1):P.slice(R))+I,P=P.slice(0,R);break}}}j&&!y&&(P=t(P,1/0));var V=D.length+P.length+I.length,X=V<g?new Array(g-V+1).join(h):"";switch(j&&y&&(P=t(X+P,X.length?g-I.length:1/0),X=""),m){case"<":P=D+P+I+X;break;case"=":P=D+X+P+I;break;case"^":P=X.slice(0,V=X.length>>1)+D+P+I+X.slice(V);break;default:P=X+D+P+I;break}return i(P)}return E.toString=function(){return f+""},E}function d(f,p){var h=Math.max(-8,Math.min(8,Math.floor(tl(p)/3)))*3,m=Math.pow(10,-h),v=u((f=Ru(f),f.type="f",f),{suffix:DS[8+h/3]});return function(x){return v(m*x)}}return{format:u,formatPrefix:d}}var df,J1,OO;_Q({thousands:",",grouping:[3],currency:["$",""]});function _Q(e){return df=CQ(e),J1=df.format,OO=df.formatPrefix,df}function AQ(e){return Math.max(0,-tl(Math.abs(e)))}function PQ(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(tl(t)/3)))*3-tl(Math.abs(e)))}function EQ(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,tl(t)-tl(e))+1}function TO(e,t,n,r){var s=Rv(e,t,n),i;switch(r=Ru(r??",f"),r.type){case"s":{var o=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(i=PQ(s,o))&&(r.precision=i),OO(r,o)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(i=EQ(s,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=i-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(i=AQ(s))&&(r.precision=i-(r.type==="%")*2);break}}return J1(r)}function Rs(e){var t=e.domain;return e.ticks=function(n){var r=t();return $v(r[0],r[r.length-1],n??10)},e.tickFormat=function(n,r){var s=t();return TO(s[0],s[s.length-1],n??10,r)},e.nice=function(n){n==null&&(n=10);var r=t(),s=0,i=r.length-1,o=r[s],l=r[i],c,u,d=10;for(l<o&&(u=o,o=l,l=u,u=s,s=i,i=u);d-- >0;){if(u=Mv(o,l,n),u===c)return r[s]=o,r[i]=l,t(r);if(u>0)o=Math.floor(o/u)*u,l=Math.ceil(l/u)*u;else if(u<0)o=Math.ceil(o*u)/u,l=Math.floor(l*u)/u;else break;c=u}return e},e}function rh(){var e=Y1();return e.copy=function(){return wd(e,rh())},pr.apply(e,arguments),Rs(e)}function $O(e){var t;function n(r){return r==null||isNaN(r=+r)?t:r}return n.invert=n,n.domain=n.range=function(r){return arguments.length?(e=Array.from(r,eh),n):e.slice()},n.unknown=function(r){return arguments.length?(t=r,n):t},n.copy=function(){return $O(e).unknown(t)},e=arguments.length?Array.from(e,eh):[0,1],Rs(n)}function MO(e,t){e=e.slice();var n=0,r=e.length-1,s=e[n],i=e[r],o;return i<s&&(o=n,n=r,r=o,o=s,s=i,i=o),e[n]=t.floor(s),e[r]=t.ceil(i),e}function IS(e){return Math.log(e)}function LS(e){return Math.exp(e)}function OQ(e){return-Math.log(-e)}function TQ(e){return-Math.exp(-e)}function $Q(e){return isFinite(e)?+("1e"+e):e<0?0:e}function MQ(e){return e===10?$Q:e===Math.E?Math.exp:t=>Math.pow(e,t)}function RQ(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function zS(e){return(t,n)=>-e(-t,n)}function Z1(e){const t=e(IS,LS),n=t.domain;let r=10,s,i;function o(){return s=RQ(r),i=MQ(r),n()[0]<0?(s=zS(s),i=zS(i),e(OQ,TQ)):e(IS,LS),t}return t.base=function(l){return arguments.length?(r=+l,o()):r},t.domain=function(l){return arguments.length?(n(l),o()):n()},t.ticks=l=>{const c=n();let u=c[0],d=c[c.length-1];const f=d<u;f&&([u,d]=[d,u]);let p=s(u),h=s(d),m,v;const x=l==null?10:+l;let y=[];if(!(r%1)&&h-p<x){if(p=Math.floor(p),h=Math.ceil(h),u>0){for(;p<=h;++p)for(m=1;m<r;++m)if(v=p<0?m/i(-p):m*i(p),!(v<u)){if(v>d)break;y.push(v)}}else for(;p<=h;++p)for(m=r-1;m>=1;--m)if(v=p>0?m/i(-p):m*i(p),!(v<u)){if(v>d)break;y.push(v)}y.length*2<x&&(y=$v(u,d,x))}else y=$v(p,h,Math.min(h-p,x)).map(i);return f?y.reverse():y},t.tickFormat=(l,c)=>{if(l==null&&(l=10),c==null&&(c=r===10?"s":","),typeof c!="function"&&(!(r%1)&&(c=Ru(c)).precision==null&&(c.trim=!0),c=J1(c)),l===1/0)return c;const u=Math.max(1,r*l/t.ticks().length);return d=>{let f=d/i(Math.round(s(d)));return f*r<r-.5&&(f*=r),f<=u?c(d):""}},t.nice=()=>n(MO(n(),{floor:l=>i(Math.floor(s(l))),ceil:l=>i(Math.ceil(s(l)))})),t}function RO(){const e=Z1(Um()).domain([1,10]);return e.copy=()=>wd(e,RO()).base(e.base()),pr.apply(e,arguments),e}function BS(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function FS(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function ej(e){var t=1,n=e(BS(t),FS(t));return n.constant=function(r){return arguments.length?e(BS(t=+r),FS(t)):t},Rs(n)}function DO(){var e=ej(Um());return e.copy=function(){return wd(e,DO()).constant(e.constant())},pr.apply(e,arguments)}function VS(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function DQ(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function IQ(e){return e<0?-e*e:e*e}function tj(e){var t=e(un,un),n=1;function r(){return n===1?e(un,un):n===.5?e(DQ,IQ):e(VS(n),VS(1/n))}return t.exponent=function(s){return arguments.length?(n=+s,r()):n},Rs(t)}function nj(){var e=tj(Um());return e.copy=function(){return wd(e,nj()).exponent(e.exponent())},pr.apply(e,arguments),e}function LQ(){return nj.apply(null,arguments).exponent(.5)}function US(e){return Math.sign(e)*e*e}function zQ(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function IO(){var e=Y1(),t=[0,1],n=!1,r;function s(i){var o=zQ(e(i));return isNaN(o)?r:n?Math.round(o):o}return s.invert=function(i){return e.invert(US(i))},s.domain=function(i){return arguments.length?(e.domain(i),s):e.domain()},s.range=function(i){return arguments.length?(e.range((t=Array.from(i,eh)).map(US)),s):t.slice()},s.rangeRound=function(i){return s.range(i).round(!0)},s.round=function(i){return arguments.length?(n=!!i,s):n},s.clamp=function(i){return arguments.length?(e.clamp(i),s):e.clamp()},s.unknown=function(i){return arguments.length?(r=i,s):r},s.copy=function(){return IO(e.domain(),t).round(n).clamp(e.clamp()).unknown(r)},pr.apply(s,arguments),Rs(s)}function LO(){var e=[],t=[],n=[],r;function s(){var o=0,l=Math.max(1,t.length);for(n=new Array(l-1);++o<l;)n[o-1]=WY(e,o/l);return i}function i(o){return o==null||isNaN(o=+o)?r:t[bd(n,o)]}return i.invertExtent=function(o){var l=t.indexOf(o);return l<0?[NaN,NaN]:[l>0?n[l-1]:e[0],l<n.length?n[l]:e[e.length-1]]},i.domain=function(o){if(!arguments.length)return e.slice();e=[];for(let l of o)l!=null&&!isNaN(l=+l)&&e.push(l);return e.sort(xs),s()},i.range=function(o){return arguments.length?(t=Array.from(o),s()):t.slice()},i.unknown=function(o){return arguments.length?(r=o,i):r},i.quantiles=function(){return n.slice()},i.copy=function(){return LO().domain(e).range(t).unknown(r)},pr.apply(i,arguments)}function zO(){var e=0,t=1,n=1,r=[.5],s=[0,1],i;function o(c){return c!=null&&c<=c?s[bd(r,c,0,n)]:i}function l(){var c=-1;for(r=new Array(n);++c<n;)r[c]=((c+1)*t-(c-n)*e)/(n+1);return o}return o.domain=function(c){return arguments.length?([e,t]=c,e=+e,t=+t,l()):[e,t]},o.range=function(c){return arguments.length?(n=(s=Array.from(c)).length-1,l()):s.slice()},o.invertExtent=function(c){var u=s.indexOf(c);return u<0?[NaN,NaN]:u<1?[e,r[0]]:u>=n?[r[n-1],t]:[r[u-1],r[u]]},o.unknown=function(c){return arguments.length&&(i=c),o},o.thresholds=function(){return r.slice()},o.copy=function(){return zO().domain([e,t]).range(s).unknown(i)},pr.apply(Rs(o),arguments)}function BO(){var e=[.5],t=[0,1],n,r=1;function s(i){return i!=null&&i<=i?t[bd(e,i,0,r)]:n}return s.domain=function(i){return arguments.length?(e=Array.from(i),r=Math.min(e.length,t.length-1),s):e.slice()},s.range=function(i){return arguments.length?(t=Array.from(i),r=Math.min(e.length,t.length-1),s):t.slice()},s.invertExtent=function(i){var o=t.indexOf(i);return[e[o-1],e[o]]},s.unknown=function(i){return arguments.length?(n=i,s):n},s.copy=function(){return BO().domain(e).range(t).unknown(n)},pr.apply(s,arguments)}const p0=new Date,h0=new Date;function Ot(e,t,n,r){function s(i){return e(i=arguments.length===0?new Date:new Date(+i)),i}return s.floor=i=>(e(i=new Date(+i)),i),s.ceil=i=>(e(i=new Date(i-1)),t(i,1),e(i),i),s.round=i=>{const o=s(i),l=s.ceil(i);return i-o<l-i?o:l},s.offset=(i,o)=>(t(i=new Date(+i),o==null?1:Math.floor(o)),i),s.range=(i,o,l)=>{const c=[];if(i=s.ceil(i),l=l==null?1:Math.floor(l),!(i<o)||!(l>0))return c;let u;do c.push(u=new Date(+i)),t(i,l),e(i);while(u<i&&i<o);return c},s.filter=i=>Ot(o=>{if(o>=o)for(;e(o),!i(o);)o.setTime(o-1)},(o,l)=>{if(o>=o)if(l<0)for(;++l<=0;)for(;t(o,-1),!i(o););else for(;--l>=0;)for(;t(o,1),!i(o););}),n&&(s.count=(i,o)=>(p0.setTime(+i),h0.setTime(+o),e(p0),e(h0),Math.floor(n(p0,h0))),s.every=i=>(i=Math.floor(i),!isFinite(i)||!(i>0)?null:i>1?s.filter(r?o=>r(o)%i===0:o=>s.count(0,o)%i===0):s)),s}const ah=Ot(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);ah.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?Ot(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):ah);ah.range;const va=1e3,ar=va*60,ya=ar*60,Ea=ya*24,rj=Ea*7,WS=Ea*30,m0=Ea*365,li=Ot(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*va)},(e,t)=>(t-e)/va,e=>e.getUTCSeconds());li.range;const aj=Ot(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*va)},(e,t)=>{e.setTime(+e+t*ar)},(e,t)=>(t-e)/ar,e=>e.getMinutes());aj.range;const sj=Ot(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*ar)},(e,t)=>(t-e)/ar,e=>e.getUTCMinutes());sj.range;const ij=Ot(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*va-e.getMinutes()*ar)},(e,t)=>{e.setTime(+e+t*ya)},(e,t)=>(t-e)/ya,e=>e.getHours());ij.range;const oj=Ot(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*ya)},(e,t)=>(t-e)/ya,e=>e.getUTCHours());oj.range;const Nd=Ot(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*ar)/Ea,e=>e.getDate()-1);Nd.range;const Wm=Ot(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Ea,e=>e.getUTCDate()-1);Wm.range;const FO=Ot(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Ea,e=>Math.floor(e/Ea));FO.range;function Ki(e){return Ot(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,n)=>{t.setDate(t.getDate()+n*7)},(t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*ar)/rj)}const qm=Ki(0),sh=Ki(1),BQ=Ki(2),FQ=Ki(3),nl=Ki(4),VQ=Ki(5),UQ=Ki(6);qm.range;sh.range;BQ.range;FQ.range;nl.range;VQ.range;UQ.range;function Gi(e){return Ot(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCDate(t.getUTCDate()+n*7)},(t,n)=>(n-t)/rj)}const Hm=Gi(0),ih=Gi(1),WQ=Gi(2),qQ=Gi(3),rl=Gi(4),HQ=Gi(5),KQ=Gi(6);Hm.range;ih.range;WQ.range;qQ.range;rl.range;HQ.range;KQ.range;const lj=Ot(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());lj.range;const cj=Ot(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());cj.range;const Oa=Ot(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());Oa.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Ot(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)});Oa.range;const Ta=Ot(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());Ta.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Ot(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)});Ta.range;function VO(e,t,n,r,s,i){const o=[[li,1,va],[li,5,5*va],[li,15,15*va],[li,30,30*va],[i,1,ar],[i,5,5*ar],[i,15,15*ar],[i,30,30*ar],[s,1,ya],[s,3,3*ya],[s,6,6*ya],[s,12,12*ya],[r,1,Ea],[r,2,2*Ea],[n,1,rj],[t,1,WS],[t,3,3*WS],[e,1,m0]];function l(u,d,f){const p=d<u;p&&([u,d]=[d,u]);const h=f&&typeof f.range=="function"?f:c(u,d,f),m=h?h.range(u,+d+1):[];return p?m.reverse():m}function c(u,d,f){const p=Math.abs(d-u)/f,h=q1(([,,x])=>x).right(o,p);if(h===o.length)return e.every(Rv(u/m0,d/m0,f));if(h===0)return ah.every(Math.max(Rv(u,d,f),1));const[m,v]=o[p/o[h-1][2]<o[h][2]/p?h-1:h];return m.every(v)}return[l,c]}const[GQ,XQ]=VO(Ta,cj,Hm,FO,oj,sj),[YQ,QQ]=VO(Oa,lj,qm,Nd,ij,aj);function x0(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 g0(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 fc(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}function JQ(e){var t=e.dateTime,n=e.date,r=e.time,s=e.periods,i=e.days,o=e.shortDays,l=e.months,c=e.shortMonths,u=pc(s),d=hc(s),f=pc(i),p=hc(i),h=pc(o),m=hc(o),v=pc(l),x=hc(l),y=pc(c),g=hc(c),j={a:W,A:T,b:V,B:X,c:null,d:YS,e:YS,f:jJ,g:OJ,G:$J,H:vJ,I:yJ,j:bJ,L:UO,m:wJ,M:NJ,p:U,q:L,Q:ZS,s:ek,S:SJ,u:kJ,U:CJ,V:_J,w:AJ,W:PJ,x:null,X:null,y:EJ,Y:TJ,Z:MJ,"%":JS},N={a:B,A:ae,b:se,B:xe,c:null,d:QS,e:QS,f:LJ,g:GJ,G:YJ,H:RJ,I:DJ,j:IJ,L:qO,m:zJ,M:BJ,p:H,q:le,Q:ZS,s:ek,S:FJ,u:VJ,U:UJ,V:WJ,w:qJ,W:HJ,x:null,X:null,y:KJ,Y:XJ,Z:QJ,"%":JS},w={a:A,A:E,b:P,B:D,c:I,d:GS,e:GS,f:hJ,g:KS,G:HS,H:XS,I:XS,j:uJ,L:pJ,m:cJ,M:dJ,p:_,q:lJ,Q:xJ,s:gJ,S:fJ,u:rJ,U:aJ,V:sJ,w:nJ,W:iJ,x:R,X:M,y:KS,Y:HS,Z:oJ,"%":mJ};j.x=S(n,j),j.X=S(r,j),j.c=S(t,j),N.x=S(n,N),N.X=S(r,N),N.c=S(t,N);function S(Z,F){return function(z){var q=[],ie=-1,oe=0,we=Z.length,Ee,ze,gn;for(z instanceof Date||(z=new Date(+z));++ie<we;)Z.charCodeAt(ie)===37&&(q.push(Z.slice(oe,ie)),(ze=qS[Ee=Z.charAt(++ie)])!=null?Ee=Z.charAt(++ie):ze=Ee==="e"?" ":"0",(gn=F[Ee])&&(Ee=gn(z,ze)),q.push(Ee),oe=ie+1);return q.push(Z.slice(oe,ie)),q.join("")}}function k(Z,F){return function(z){var q=fc(1900,void 0,1),ie=C(q,Z,z+="",0),oe,we;if(ie!=z.length)return null;if("Q"in q)return new Date(q.Q);if("s"in q)return new Date(q.s*1e3+("L"in q?q.L:0));if(F&&!("Z"in q)&&(q.Z=0),"p"in q&&(q.H=q.H%12+q.p*12),q.m===void 0&&(q.m="q"in q?q.q:0),"V"in q){if(q.V<1||q.V>53)return null;"w"in q||(q.w=1),"Z"in q?(oe=g0(fc(q.y,0,1)),we=oe.getUTCDay(),oe=we>4||we===0?ih.ceil(oe):ih(oe),oe=Wm.offset(oe,(q.V-1)*7),q.y=oe.getUTCFullYear(),q.m=oe.getUTCMonth(),q.d=oe.getUTCDate()+(q.w+6)%7):(oe=x0(fc(q.y,0,1)),we=oe.getDay(),oe=we>4||we===0?sh.ceil(oe):sh(oe),oe=Nd.offset(oe,(q.V-1)*7),q.y=oe.getFullYear(),q.m=oe.getMonth(),q.d=oe.getDate()+(q.w+6)%7)}else("W"in q||"U"in q)&&("w"in q||(q.w="u"in q?q.u%7:"W"in q?1:0),we="Z"in q?g0(fc(q.y,0,1)).getUTCDay():x0(fc(q.y,0,1)).getDay(),q.m=0,q.d="W"in q?(q.w+6)%7+q.W*7-(we+5)%7:q.w+q.U*7-(we+6)%7);return"Z"in q?(q.H+=q.Z/100|0,q.M+=q.Z%100,g0(q)):x0(q)}}function C(Z,F,z,q){for(var ie=0,oe=F.length,we=z.length,Ee,ze;ie<oe;){if(q>=we)return-1;if(Ee=F.charCodeAt(ie++),Ee===37){if(Ee=F.charAt(ie++),ze=w[Ee in qS?F.charAt(ie++):Ee],!ze||(q=ze(Z,z,q))<0)return-1}else if(Ee!=z.charCodeAt(q++))return-1}return q}function _(Z,F,z){var q=u.exec(F.slice(z));return q?(Z.p=d.get(q[0].toLowerCase()),z+q[0].length):-1}function A(Z,F,z){var q=h.exec(F.slice(z));return q?(Z.w=m.get(q[0].toLowerCase()),z+q[0].length):-1}function E(Z,F,z){var q=f.exec(F.slice(z));return q?(Z.w=p.get(q[0].toLowerCase()),z+q[0].length):-1}function P(Z,F,z){var q=y.exec(F.slice(z));return q?(Z.m=g.get(q[0].toLowerCase()),z+q[0].length):-1}function D(Z,F,z){var q=v.exec(F.slice(z));return q?(Z.m=x.get(q[0].toLowerCase()),z+q[0].length):-1}function I(Z,F,z){return C(Z,t,F,z)}function R(Z,F,z){return C(Z,n,F,z)}function M(Z,F,z){return C(Z,r,F,z)}function W(Z){return o[Z.getDay()]}function T(Z){return i[Z.getDay()]}function V(Z){return c[Z.getMonth()]}function X(Z){return l[Z.getMonth()]}function U(Z){return s[+(Z.getHours()>=12)]}function L(Z){return 1+~~(Z.getMonth()/3)}function B(Z){return o[Z.getUTCDay()]}function ae(Z){return i[Z.getUTCDay()]}function se(Z){return c[Z.getUTCMonth()]}function xe(Z){return l[Z.getUTCMonth()]}function H(Z){return s[+(Z.getUTCHours()>=12)]}function le(Z){return 1+~~(Z.getUTCMonth()/3)}return{format:function(Z){var F=S(Z+="",j);return F.toString=function(){return Z},F},parse:function(Z){var F=k(Z+="",!1);return F.toString=function(){return Z},F},utcFormat:function(Z){var F=S(Z+="",N);return F.toString=function(){return Z},F},utcParse:function(Z){var F=k(Z+="",!0);return F.toString=function(){return Z},F}}}var qS={"-":"",_:" ",0:"0"},zt=/^\s*\d+/,ZQ=/^%/,eJ=/[\\^$*+?|[\]().{}]/g;function Me(e,t,n){var r=e<0?"-":"",s=(r?-e:e)+"",i=s.length;return r+(i<n?new Array(n-i+1).join(t)+s:s)}function tJ(e){return e.replace(eJ,"\\$&")}function pc(e){return new RegExp("^(?:"+e.map(tJ).join("|")+")","i")}function hc(e){return new Map(e.map((t,n)=>[t.toLowerCase(),n]))}function nJ(e,t,n){var r=zt.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function rJ(e,t,n){var r=zt.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function aJ(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function sJ(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function iJ(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function HS(e,t,n){var r=zt.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function KS(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function oJ(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function lJ(e,t,n){var r=zt.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function cJ(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function GS(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function uJ(e,t,n){var r=zt.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function XS(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function dJ(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function fJ(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function pJ(e,t,n){var r=zt.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function hJ(e,t,n){var r=zt.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function mJ(e,t,n){var r=ZQ.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function xJ(e,t,n){var r=zt.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function gJ(e,t,n){var r=zt.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function YS(e,t){return Me(e.getDate(),t,2)}function vJ(e,t){return Me(e.getHours(),t,2)}function yJ(e,t){return Me(e.getHours()%12||12,t,2)}function bJ(e,t){return Me(1+Nd.count(Oa(e),e),t,3)}function UO(e,t){return Me(e.getMilliseconds(),t,3)}function jJ(e,t){return UO(e,t)+"000"}function wJ(e,t){return Me(e.getMonth()+1,t,2)}function NJ(e,t){return Me(e.getMinutes(),t,2)}function SJ(e,t){return Me(e.getSeconds(),t,2)}function kJ(e){var t=e.getDay();return t===0?7:t}function CJ(e,t){return Me(qm.count(Oa(e)-1,e),t,2)}function WO(e){var t=e.getDay();return t>=4||t===0?nl(e):nl.ceil(e)}function _J(e,t){return e=WO(e),Me(nl.count(Oa(e),e)+(Oa(e).getDay()===4),t,2)}function AJ(e){return e.getDay()}function PJ(e,t){return Me(sh.count(Oa(e)-1,e),t,2)}function EJ(e,t){return Me(e.getFullYear()%100,t,2)}function OJ(e,t){return e=WO(e),Me(e.getFullYear()%100,t,2)}function TJ(e,t){return Me(e.getFullYear()%1e4,t,4)}function $J(e,t){var n=e.getDay();return e=n>=4||n===0?nl(e):nl.ceil(e),Me(e.getFullYear()%1e4,t,4)}function MJ(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+Me(t/60|0,"0",2)+Me(t%60,"0",2)}function QS(e,t){return Me(e.getUTCDate(),t,2)}function RJ(e,t){return Me(e.getUTCHours(),t,2)}function DJ(e,t){return Me(e.getUTCHours()%12||12,t,2)}function IJ(e,t){return Me(1+Wm.count(Ta(e),e),t,3)}function qO(e,t){return Me(e.getUTCMilliseconds(),t,3)}function LJ(e,t){return qO(e,t)+"000"}function zJ(e,t){return Me(e.getUTCMonth()+1,t,2)}function BJ(e,t){return Me(e.getUTCMinutes(),t,2)}function FJ(e,t){return Me(e.getUTCSeconds(),t,2)}function VJ(e){var t=e.getUTCDay();return t===0?7:t}function UJ(e,t){return Me(Hm.count(Ta(e)-1,e),t,2)}function HO(e){var t=e.getUTCDay();return t>=4||t===0?rl(e):rl.ceil(e)}function WJ(e,t){return e=HO(e),Me(rl.count(Ta(e),e)+(Ta(e).getUTCDay()===4),t,2)}function qJ(e){return e.getUTCDay()}function HJ(e,t){return Me(ih.count(Ta(e)-1,e),t,2)}function KJ(e,t){return Me(e.getUTCFullYear()%100,t,2)}function GJ(e,t){return e=HO(e),Me(e.getUTCFullYear()%100,t,2)}function XJ(e,t){return Me(e.getUTCFullYear()%1e4,t,4)}function YJ(e,t){var n=e.getUTCDay();return e=n>=4||n===0?rl(e):rl.ceil(e),Me(e.getUTCFullYear()%1e4,t,4)}function QJ(){return"+0000"}function JS(){return"%"}function ZS(e){return+e}function ek(e){return Math.floor(+e/1e3)}var eo,KO,GO;JJ({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function JJ(e){return eo=JQ(e),KO=eo.format,eo.parse,GO=eo.utcFormat,eo.utcParse,eo}function ZJ(e){return new Date(e)}function eZ(e){return e instanceof Date?+e:+new Date(+e)}function uj(e,t,n,r,s,i,o,l,c,u){var d=Y1(),f=d.invert,p=d.domain,h=u(".%L"),m=u(":%S"),v=u("%I:%M"),x=u("%I %p"),y=u("%a %d"),g=u("%b %d"),j=u("%B"),N=u("%Y");function w(S){return(c(S)<S?h:l(S)<S?m:o(S)<S?v:i(S)<S?x:r(S)<S?s(S)<S?y:g:n(S)<S?j:N)(S)}return d.invert=function(S){return new Date(f(S))},d.domain=function(S){return arguments.length?p(Array.from(S,eZ)):p().map(ZJ)},d.ticks=function(S){var k=p();return e(k[0],k[k.length-1],S??10)},d.tickFormat=function(S,k){return k==null?w:u(k)},d.nice=function(S){var k=p();return(!S||typeof S.range!="function")&&(S=t(k[0],k[k.length-1],S??10)),S?p(MO(k,S)):d},d.copy=function(){return wd(d,uj(e,t,n,r,s,i,o,l,c,u))},d}function tZ(){return pr.apply(uj(YQ,QQ,Oa,lj,qm,Nd,ij,aj,li,KO).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function nZ(){return pr.apply(uj(GQ,XQ,Ta,cj,Hm,Wm,oj,sj,li,GO).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function Km(){var e=0,t=1,n,r,s,i,o=un,l=!1,c;function u(f){return f==null||isNaN(f=+f)?c:o(s===0?.5:(f=(i(f)-n)*s,l?Math.max(0,Math.min(1,f)):f))}u.domain=function(f){return arguments.length?([e,t]=f,n=i(e=+e),r=i(t=+t),s=n===r?0:1/(r-n),u):[e,t]},u.clamp=function(f){return arguments.length?(l=!!f,u):l},u.interpolator=function(f){return arguments.length?(o=f,u):o};function d(f){return function(p){var h,m;return arguments.length?([h,m]=p,o=f(h,m),u):[o(0),o(1)]}}return u.range=d(Vl),u.rangeRound=d(X1),u.unknown=function(f){return arguments.length?(c=f,u):c},function(f){return i=f,n=f(e),r=f(t),s=n===r?0:1/(r-n),u}}function Ds(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function XO(){var e=Rs(Km()(un));return e.copy=function(){return Ds(e,XO())},Ia.apply(e,arguments)}function YO(){var e=Z1(Km()).domain([1,10]);return e.copy=function(){return Ds(e,YO()).base(e.base())},Ia.apply(e,arguments)}function QO(){var e=ej(Km());return e.copy=function(){return Ds(e,QO()).constant(e.constant())},Ia.apply(e,arguments)}function dj(){var e=tj(Km());return e.copy=function(){return Ds(e,dj()).exponent(e.exponent())},Ia.apply(e,arguments)}function rZ(){return dj.apply(null,arguments).exponent(.5)}function JO(){var e=[],t=un;function n(r){if(r!=null&&!isNaN(r=+r))return t((bd(e,r,1)-1)/(e.length-1))}return n.domain=function(r){if(!arguments.length)return e.slice();e=[];for(let s of r)s!=null&&!isNaN(s=+s)&&e.push(s);return e.sort(xs),n},n.interpolator=function(r){return arguments.length?(t=r,n):t},n.range=function(){return e.map((r,s)=>t(s/(e.length-1)))},n.quantiles=function(r){return Array.from({length:r+1},(s,i)=>UY(e,i/r))},n.copy=function(){return JO(t).domain(e)},Ia.apply(n,arguments)}function Gm(){var e=0,t=.5,n=1,r=1,s,i,o,l,c,u=un,d,f=!1,p;function h(v){return isNaN(v=+v)?p:(v=.5+((v=+d(v))-i)*(r*v<r*i?l:c),u(f?Math.max(0,Math.min(1,v)):v))}h.domain=function(v){return arguments.length?([e,t,n]=v,s=d(e=+e),i=d(t=+t),o=d(n=+n),l=s===i?0:.5/(i-s),c=i===o?0:.5/(o-i),r=i<s?-1:1,h):[e,t,n]},h.clamp=function(v){return arguments.length?(f=!!v,h):f},h.interpolator=function(v){return arguments.length?(u=v,h):u};function m(v){return function(x){var y,g,j;return arguments.length?([y,g,j]=x,u=mQ(v,[y,g,j]),h):[u(0),u(.5),u(1)]}}return h.range=m(Vl),h.rangeRound=m(X1),h.unknown=function(v){return arguments.length?(p=v,h):p},function(v){return d=v,s=v(e),i=v(t),o=v(n),l=s===i?0:.5/(i-s),c=i===o?0:.5/(o-i),r=i<s?-1:1,h}}function ZO(){var e=Rs(Gm()(un));return e.copy=function(){return Ds(e,ZO())},Ia.apply(e,arguments)}function e3(){var e=Z1(Gm()).domain([.1,1,10]);return e.copy=function(){return Ds(e,e3()).base(e.base())},Ia.apply(e,arguments)}function t3(){var e=ej(Gm());return e.copy=function(){return Ds(e,t3()).constant(e.constant())},Ia.apply(e,arguments)}function fj(){var e=tj(Gm());return e.copy=function(){return Ds(e,fj()).exponent(e.exponent())},Ia.apply(e,arguments)}function aZ(){return fj.apply(null,arguments).exponent(.5)}const tk=Object.freeze(Object.defineProperty({__proto__:null,scaleBand:Ou,scaleDiverging:ZO,scaleDivergingLog:e3,scaleDivergingPow:fj,scaleDivergingSqrt:aZ,scaleDivergingSymlog:t3,scaleIdentity:$O,scaleImplicit:Dv,scaleLinear:rh,scaleLog:RO,scaleOrdinal:H1,scalePoint:Bc,scalePow:nj,scaleQuantile:LO,scaleQuantize:zO,scaleRadial:IO,scaleSequential:XO,scaleSequentialLog:YO,scaleSequentialPow:dj,scaleSequentialQuantile:JO,scaleSequentialSqrt:rZ,scaleSequentialSymlog:QO,scaleSqrt:LQ,scaleSymlog:DO,scaleThreshold:BO,scaleTime:tZ,scaleUtc:nZ,tickFormat:TO},Symbol.toStringTag,{value:"Module"}));var sZ=$l;function iZ(e,t,n){for(var r=-1,s=e.length;++r<s;){var i=e[r],o=t(i);if(o!=null&&(l===void 0?o===o&&!sZ(o):n(o,l)))var l=o,c=i}return c}var Xm=iZ;function oZ(e,t){return e>t}var n3=oZ,lZ=Xm,cZ=n3,uZ=Fl;function dZ(e){return e&&e.length?lZ(e,uZ,cZ):void 0}var fZ=dZ;const rs=De(fZ);function pZ(e,t){return e<t}var r3=pZ,hZ=Xm,mZ=r3,xZ=Fl;function gZ(e){return e&&e.length?hZ(e,xZ,mZ):void 0}var vZ=gZ;const Ym=De(vZ);var yZ=C1,bZ=ua,jZ=fO,wZ=En;function NZ(e,t){var n=wZ(e)?yZ:jZ;return n(e,bZ(t))}var SZ=NZ,kZ=uO,CZ=SZ;function _Z(e,t){return kZ(CZ(e,t),1)}var AZ=_Z;const PZ=De(AZ);var EZ=F1;function OZ(e,t){return EZ(e,t)}var TZ=OZ;const $i=De(TZ);var Ul=1e9,$Z={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},hj,rt=!0,dr="[DecimalError] ",vi=dr+"Invalid argument: ",pj=dr+"Exponent out of range: ",Wl=Math.floor,Qs=Math.pow,MZ=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Rn,Rt=1e7,Qe=7,a3=9007199254740991,oh=Wl(a3/Qe),fe={};fe.absoluteValue=fe.abs=function(){var e=new this.constructor(this);return e.s&&(e.s=1),e};fe.comparedTo=fe.cmp=function(e){var t,n,r,s,i=this;if(e=new i.constructor(e),i.s!==e.s)return i.s||-e.s;if(i.e!==e.e)return i.e>e.e^i.s<0?1:-1;for(r=i.d.length,s=e.d.length,t=0,n=r<s?r:s;t<n;++t)if(i.d[t]!==e.d[t])return i.d[t]>e.d[t]^i.s<0?1:-1;return r===s?0:r>s^i.s<0?1:-1};fe.decimalPlaces=fe.dp=function(){var e=this,t=e.d.length-1,n=(t-e.e)*Qe;if(t=e.d[t],t)for(;t%10==0;t/=10)n--;return n<0?0:n};fe.dividedBy=fe.div=function(e){return Sa(this,new this.constructor(e))};fe.dividedToIntegerBy=fe.idiv=function(e){var t=this,n=t.constructor;return Ve(Sa(t,new n(e),0,1),n.precision)};fe.equals=fe.eq=function(e){return!this.cmp(e)};fe.exponent=function(){return Nt(this)};fe.greaterThan=fe.gt=function(e){return this.cmp(e)>0};fe.greaterThanOrEqualTo=fe.gte=function(e){return this.cmp(e)>=0};fe.isInteger=fe.isint=function(){return this.e>this.d.length-2};fe.isNegative=fe.isneg=function(){return this.s<0};fe.isPositive=fe.ispos=function(){return this.s>0};fe.isZero=function(){return this.s===0};fe.lessThan=fe.lt=function(e){return this.cmp(e)<0};fe.lessThanOrEqualTo=fe.lte=function(e){return this.cmp(e)<1};fe.logarithm=fe.log=function(e){var t,n=this,r=n.constructor,s=r.precision,i=s+5;if(e===void 0)e=new r(10);else if(e=new r(e),e.s<1||e.eq(Rn))throw Error(dr+"NaN");if(n.s<1)throw Error(dr+(n.s?"NaN":"-Infinity"));return n.eq(Rn)?new r(0):(rt=!1,t=Sa(Du(n,i),Du(e,i),i),rt=!0,Ve(t,s))};fe.minus=fe.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?o3(t,e):s3(t,(e.s=-e.s,e))};fe.modulo=fe.mod=function(e){var t,n=this,r=n.constructor,s=r.precision;if(e=new r(e),!e.s)throw Error(dr+"NaN");return n.s?(rt=!1,t=Sa(n,e,0,1).times(e),rt=!0,n.minus(t)):Ve(new r(n),s)};fe.naturalExponential=fe.exp=function(){return i3(this)};fe.naturalLogarithm=fe.ln=function(){return Du(this)};fe.negated=fe.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};fe.plus=fe.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?s3(t,e):o3(t,(e.s=-e.s,e))};fe.precision=fe.sd=function(e){var t,n,r,s=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(vi+e);if(t=Nt(s)+1,r=s.d.length-1,n=r*Qe+1,r=s.d[r],r){for(;r%10==0;r/=10)n--;for(r=s.d[0];r>=10;r/=10)n++}return e&&t>n?t:n};fe.squareRoot=fe.sqrt=function(){var e,t,n,r,s,i,o,l=this,c=l.constructor;if(l.s<1){if(!l.s)return new c(0);throw Error(dr+"NaN")}for(e=Nt(l),rt=!1,s=Math.sqrt(+l),s==0||s==1/0?(t=Kr(l.d),(t.length+e)%2==0&&(t+="0"),s=Math.sqrt(t),e=Wl((e+1)/2)-(e<0||e%2),s==1/0?t="5e"+e:(t=s.toExponential(),t=t.slice(0,t.indexOf("e")+1)+e),r=new c(t)):r=new c(s.toString()),n=c.precision,s=o=n+3;;)if(i=r,r=i.plus(Sa(l,i,o+2)).times(.5),Kr(i.d).slice(0,o)===(t=Kr(r.d)).slice(0,o)){if(t=t.slice(o-3,o+1),s==o&&t=="4999"){if(Ve(i,n+1,0),i.times(i).eq(l)){r=i;break}}else if(t!="9999")break;o+=4}return rt=!0,Ve(r,n)};fe.times=fe.mul=function(e){var t,n,r,s,i,o,l,c,u,d=this,f=d.constructor,p=d.d,h=(e=new f(e)).d;if(!d.s||!e.s)return new f(0);for(e.s*=d.s,n=d.e+e.e,c=p.length,u=h.length,c<u&&(i=p,p=h,h=i,o=c,c=u,u=o),i=[],o=c+u,r=o;r--;)i.push(0);for(r=u;--r>=0;){for(t=0,s=c+r;s>r;)l=i[s]+h[r]*p[s-r-1]+t,i[s--]=l%Rt|0,t=l/Rt|0;i[s]=(i[s]+t)%Rt|0}for(;!i[--o];)i.pop();return t?++n:i.shift(),e.d=i,e.e=n,rt?Ve(e,f.precision):e};fe.toDecimalPlaces=fe.todp=function(e,t){var n=this,r=n.constructor;return n=new r(n),e===void 0?n:(sa(e,0,Ul),t===void 0?t=r.rounding:sa(t,0,8),Ve(n,e+Nt(n)+1,t))};fe.toExponential=function(e,t){var n,r=this,s=r.constructor;return e===void 0?n=Mi(r,!0):(sa(e,0,Ul),t===void 0?t=s.rounding:sa(t,0,8),r=Ve(new s(r),e+1,t),n=Mi(r,!0,e+1)),n};fe.toFixed=function(e,t){var n,r,s=this,i=s.constructor;return e===void 0?Mi(s):(sa(e,0,Ul),t===void 0?t=i.rounding:sa(t,0,8),r=Ve(new i(s),e+Nt(s)+1,t),n=Mi(r.abs(),!1,e+Nt(r)+1),s.isneg()&&!s.isZero()?"-"+n:n)};fe.toInteger=fe.toint=function(){var e=this,t=e.constructor;return Ve(new t(e),Nt(e)+1,t.rounding)};fe.toNumber=function(){return+this};fe.toPower=fe.pow=function(e){var t,n,r,s,i,o,l=this,c=l.constructor,u=12,d=+(e=new c(e));if(!e.s)return new c(Rn);if(l=new c(l),!l.s){if(e.s<1)throw Error(dr+"Infinity");return l}if(l.eq(Rn))return l;if(r=c.precision,e.eq(Rn))return Ve(l,r);if(t=e.e,n=e.d.length-1,o=t>=n,i=l.s,o){if((n=d<0?-d:d)<=a3){for(s=new c(Rn),t=Math.ceil(r/Qe+4),rt=!1;n%2&&(s=s.times(l),rk(s.d,t)),n=Wl(n/2),n!==0;)l=l.times(l),rk(l.d,t);return rt=!0,e.s<0?new c(Rn).div(s):Ve(s,r)}}else if(i<0)throw Error(dr+"NaN");return i=i<0&&e.d[Math.max(t,n)]&1?-1:1,l.s=1,rt=!1,s=e.times(Du(l,r+u)),rt=!0,s=i3(s),s.s=i,s};fe.toPrecision=function(e,t){var n,r,s=this,i=s.constructor;return e===void 0?(n=Nt(s),r=Mi(s,n<=i.toExpNeg||n>=i.toExpPos)):(sa(e,1,Ul),t===void 0?t=i.rounding:sa(t,0,8),s=Ve(new i(s),e,t),n=Nt(s),r=Mi(s,e<=n||n<=i.toExpNeg,e)),r};fe.toSignificantDigits=fe.tosd=function(e,t){var n=this,r=n.constructor;return e===void 0?(e=r.precision,t=r.rounding):(sa(e,1,Ul),t===void 0?t=r.rounding:sa(t,0,8)),Ve(new r(n),e,t)};fe.toString=fe.valueOf=fe.val=fe.toJSON=fe[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,t=Nt(e),n=e.constructor;return Mi(e,t<=n.toExpNeg||t>=n.toExpPos)};function s3(e,t){var n,r,s,i,o,l,c,u,d=e.constructor,f=d.precision;if(!e.s||!t.s)return t.s||(t=new d(e)),rt?Ve(t,f):t;if(c=e.d,u=t.d,o=e.e,s=t.e,c=c.slice(),i=o-s,i){for(i<0?(r=c,i=-i,l=u.length):(r=u,s=o,l=c.length),o=Math.ceil(f/Qe),l=o>l?o+1:l+1,i>l&&(i=l,r.length=1),r.reverse();i--;)r.push(0);r.reverse()}for(l=c.length,i=u.length,l-i<0&&(i=l,r=u,u=c,c=r),n=0;i;)n=(c[--i]=c[i]+u[i]+n)/Rt|0,c[i]%=Rt;for(n&&(c.unshift(n),++s),l=c.length;c[--l]==0;)c.pop();return t.d=c,t.e=s,rt?Ve(t,f):t}function sa(e,t,n){if(e!==~~e||e<t||e>n)throw Error(vi+e)}function Kr(e){var t,n,r,s=e.length-1,i="",o=e[0];if(s>0){for(i+=o,t=1;t<s;t++)r=e[t]+"",n=Qe-r.length,n&&(i+=Ga(n)),i+=r;o=e[t],r=o+"",n=Qe-r.length,n&&(i+=Ga(n))}else if(o===0)return"0";for(;o%10===0;)o/=10;return i+o}var Sa=function(){function e(r,s){var i,o=0,l=r.length;for(r=r.slice();l--;)i=r[l]*s+o,r[l]=i%Rt|0,o=i/Rt|0;return o&&r.unshift(o),r}function t(r,s,i,o){var l,c;if(i!=o)c=i>o?1:-1;else for(l=c=0;l<i;l++)if(r[l]!=s[l]){c=r[l]>s[l]?1:-1;break}return c}function n(r,s,i){for(var o=0;i--;)r[i]-=o,o=r[i]<s[i]?1:0,r[i]=o*Rt+r[i]-s[i];for(;!r[0]&&r.length>1;)r.shift()}return function(r,s,i,o){var l,c,u,d,f,p,h,m,v,x,y,g,j,N,w,S,k,C,_=r.constructor,A=r.s==s.s?1:-1,E=r.d,P=s.d;if(!r.s)return new _(r);if(!s.s)throw Error(dr+"Division by zero");for(c=r.e-s.e,k=P.length,w=E.length,h=new _(A),m=h.d=[],u=0;P[u]==(E[u]||0);)++u;if(P[u]>(E[u]||0)&&--c,i==null?g=i=_.precision:o?g=i+(Nt(r)-Nt(s))+1:g=i,g<0)return new _(0);if(g=g/Qe+2|0,u=0,k==1)for(d=0,P=P[0],g++;(u<w||d)&&g--;u++)j=d*Rt+(E[u]||0),m[u]=j/P|0,d=j%P|0;else{for(d=Rt/(P[0]+1)|0,d>1&&(P=e(P,d),E=e(E,d),k=P.length,w=E.length),N=k,v=E.slice(0,k),x=v.length;x<k;)v[x++]=0;C=P.slice(),C.unshift(0),S=P[0],P[1]>=Rt/2&&++S;do d=0,l=t(P,v,k,x),l<0?(y=v[0],k!=x&&(y=y*Rt+(v[1]||0)),d=y/S|0,d>1?(d>=Rt&&(d=Rt-1),f=e(P,d),p=f.length,x=v.length,l=t(f,v,p,x),l==1&&(d--,n(f,k<p?C:P,p))):(d==0&&(l=d=1),f=P.slice()),p=f.length,p<x&&f.unshift(0),n(v,f,x),l==-1&&(x=v.length,l=t(P,v,k,x),l<1&&(d++,n(v,k<x?C:P,x))),x=v.length):l===0&&(d++,v=[0]),m[u++]=d,l&&v[0]?v[x++]=E[N]||0:(v=[E[N]],x=1);while((N++<w||v[0]!==void 0)&&g--)}return m[0]||m.shift(),h.e=c,Ve(h,o?i+Nt(h)+1:i)}}();function i3(e,t){var n,r,s,i,o,l,c=0,u=0,d=e.constructor,f=d.precision;if(Nt(e)>16)throw Error(pj+Nt(e));if(!e.s)return new d(Rn);for(rt=!1,l=f,o=new d(.03125);e.abs().gte(.1);)e=e.times(o),u+=5;for(r=Math.log(Qs(2,u))/Math.LN10*2+5|0,l+=r,n=s=i=new d(Rn),d.precision=l;;){if(s=Ve(s.times(e),l),n=n.times(++c),o=i.plus(Sa(s,n,l)),Kr(o.d).slice(0,l)===Kr(i.d).slice(0,l)){for(;u--;)i=Ve(i.times(i),l);return d.precision=f,t==null?(rt=!0,Ve(i,f)):i}i=o}}function Nt(e){for(var t=e.e*Qe,n=e.d[0];n>=10;n/=10)t++;return t}function v0(e,t,n){if(t>e.LN10.sd())throw rt=!0,n&&(e.precision=n),Error(dr+"LN10 precision limit exceeded");return Ve(new e(e.LN10),t)}function Ga(e){for(var t="";e--;)t+="0";return t}function Du(e,t){var n,r,s,i,o,l,c,u,d,f=1,p=10,h=e,m=h.d,v=h.constructor,x=v.precision;if(h.s<1)throw Error(dr+(h.s?"NaN":"-Infinity"));if(h.eq(Rn))return new v(0);if(t==null?(rt=!1,u=x):u=t,h.eq(10))return t==null&&(rt=!0),v0(v,u);if(u+=p,v.precision=u,n=Kr(m),r=n.charAt(0),i=Nt(h),Math.abs(i)<15e14){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)h=h.times(e),n=Kr(h.d),r=n.charAt(0),f++;i=Nt(h),r>1?(h=new v("0."+n),i++):h=new v(r+"."+n.slice(1))}else return c=v0(v,u+2,x).times(i+""),h=Du(new v(r+"."+n.slice(1)),u-p).plus(c),v.precision=x,t==null?(rt=!0,Ve(h,x)):h;for(l=o=h=Sa(h.minus(Rn),h.plus(Rn),u),d=Ve(h.times(h),u),s=3;;){if(o=Ve(o.times(d),u),c=l.plus(Sa(o,new v(s),u)),Kr(c.d).slice(0,u)===Kr(l.d).slice(0,u))return l=l.times(2),i!==0&&(l=l.plus(v0(v,u+2,x).times(i+""))),l=Sa(l,new v(f),u),v.precision=x,t==null?(rt=!0,Ve(l,x)):l;l=c,s+=2}}function nk(e,t){var n,r,s;for((n=t.indexOf("."))>-1&&(t=t.replace(".","")),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;t.charCodeAt(r)===48;)++r;for(s=t.length;t.charCodeAt(s-1)===48;)--s;if(t=t.slice(r,s),t){if(s-=r,n=n-r-1,e.e=Wl(n/Qe),e.d=[],r=(n+1)%Qe,n<0&&(r+=Qe),r<s){for(r&&e.d.push(+t.slice(0,r)),s-=Qe;r<s;)e.d.push(+t.slice(r,r+=Qe));t=t.slice(r),r=Qe-t.length}else r-=s;for(;r--;)t+="0";if(e.d.push(+t),rt&&(e.e>oh||e.e<-oh))throw Error(pj+n)}else e.s=0,e.e=0,e.d=[0];return e}function Ve(e,t,n){var r,s,i,o,l,c,u,d,f=e.d;for(o=1,i=f[0];i>=10;i/=10)o++;if(r=t-o,r<0)r+=Qe,s=t,u=f[d=0];else{if(d=Math.ceil((r+1)/Qe),i=f.length,d>=i)return e;for(u=i=f[d],o=1;i>=10;i/=10)o++;r%=Qe,s=r-Qe+o}if(n!==void 0&&(i=Qs(10,o-s-1),l=u/i%10|0,c=t<0||f[d+1]!==void 0||u%i,c=n<4?(l||c)&&(n==0||n==(e.s<0?3:2)):l>5||l==5&&(n==4||c||n==6&&(r>0?s>0?u/Qs(10,o-s):0:f[d-1])%10&1||n==(e.s<0?8:7))),t<1||!f[0])return c?(i=Nt(e),f.length=1,t=t-i-1,f[0]=Qs(10,(Qe-t%Qe)%Qe),e.e=Wl(-t/Qe)||0):(f.length=1,f[0]=e.e=e.s=0),e;if(r==0?(f.length=d,i=1,d--):(f.length=d+1,i=Qs(10,Qe-r),f[d]=s>0?(u/Qs(10,o-s)%Qs(10,s)|0)*i:0),c)for(;;)if(d==0){(f[0]+=i)==Rt&&(f[0]=1,++e.e);break}else{if(f[d]+=i,f[d]!=Rt)break;f[d--]=0,i=1}for(r=f.length;f[--r]===0;)f.pop();if(rt&&(e.e>oh||e.e<-oh))throw Error(pj+Nt(e));return e}function o3(e,t){var n,r,s,i,o,l,c,u,d,f,p=e.constructor,h=p.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new p(e),rt?Ve(t,h):t;if(c=e.d,f=t.d,r=t.e,u=e.e,c=c.slice(),o=u-r,o){for(d=o<0,d?(n=c,o=-o,l=f.length):(n=f,r=u,l=c.length),s=Math.max(Math.ceil(h/Qe),l)+2,o>s&&(o=s,n.length=1),n.reverse(),s=o;s--;)n.push(0);n.reverse()}else{for(s=c.length,l=f.length,d=s<l,d&&(l=s),s=0;s<l;s++)if(c[s]!=f[s]){d=c[s]<f[s];break}o=0}for(d&&(n=c,c=f,f=n,t.s=-t.s),l=c.length,s=f.length-l;s>0;--s)c[l++]=0;for(s=f.length;s>o;){if(c[--s]<f[s]){for(i=s;i&&c[--i]===0;)c[i]=Rt-1;--c[i],c[s]+=Rt}c[s]-=f[s]}for(;c[--l]===0;)c.pop();for(;c[0]===0;c.shift())--r;return c[0]?(t.d=c,t.e=r,rt?Ve(t,h):t):new p(0)}function Mi(e,t,n){var r,s=Nt(e),i=Kr(e.d),o=i.length;return t?(n&&(r=n-o)>0?i=i.charAt(0)+"."+i.slice(1)+Ga(r):o>1&&(i=i.charAt(0)+"."+i.slice(1)),i=i+(s<0?"e":"e+")+s):s<0?(i="0."+Ga(-s-1)+i,n&&(r=n-o)>0&&(i+=Ga(r))):s>=o?(i+=Ga(s+1-o),n&&(r=n-s-1)>0&&(i=i+"."+Ga(r))):((r=s+1)<o&&(i=i.slice(0,r)+"."+i.slice(r)),n&&(r=n-o)>0&&(s+1===o&&(i+="."),i+=Ga(r))),e.s<0?"-"+i:i}function rk(e,t){if(e.length>t)return e.length=t,!0}function l3(e){var t,n,r;function s(i){var o=this;if(!(o instanceof s))return new s(i);if(o.constructor=s,i instanceof s){o.s=i.s,o.e=i.e,o.d=(i=i.d)?i.slice():i;return}if(typeof i=="number"){if(i*0!==0)throw Error(vi+i);if(i>0)o.s=1;else if(i<0)i=-i,o.s=-1;else{o.s=0,o.e=0,o.d=[0];return}if(i===~~i&&i<1e7){o.e=0,o.d=[i];return}return nk(o,i.toString())}else if(typeof i!="string")throw Error(vi+i);if(i.charCodeAt(0)===45?(i=i.slice(1),o.s=-1):o.s=1,MZ.test(i))nk(o,i);else throw Error(vi+i)}if(s.prototype=fe,s.ROUND_UP=0,s.ROUND_DOWN=1,s.ROUND_CEIL=2,s.ROUND_FLOOR=3,s.ROUND_HALF_UP=4,s.ROUND_HALF_DOWN=5,s.ROUND_HALF_EVEN=6,s.ROUND_HALF_CEIL=7,s.ROUND_HALF_FLOOR=8,s.clone=l3,s.config=s.set=RZ,e===void 0&&(e={}),e)for(r=["precision","rounding","toExpNeg","toExpPos","LN10"],t=0;t<r.length;)e.hasOwnProperty(n=r[t++])||(e[n]=this[n]);return s.config(e),s}function RZ(e){if(!e||typeof e!="object")throw Error(dr+"Object expected");var t,n,r,s=["precision",1,Ul,"rounding",0,8,"toExpNeg",-1/0,0,"toExpPos",0,1/0];for(t=0;t<s.length;t+=3)if((r=e[n=s[t]])!==void 0)if(Wl(r)===r&&r>=s[t+1]&&r<=s[t+2])this[n]=r;else throw Error(vi+n+": "+r);if((r=e[n="LN10"])!==void 0)if(r==Math.LN10)this[n]=new this(r);else throw Error(vi+n+": "+r);return this}var hj=l3($Z);Rn=new hj(1);const Be=hj;function DZ(e){return BZ(e)||zZ(e)||LZ(e)||IZ()}function IZ(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function LZ(e,t){if(e){if(typeof e=="string")return Bv(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Bv(e,t)}}function zZ(e){if(typeof Symbol<"u"&&Symbol.iterator in Object(e))return Array.from(e)}function BZ(e){if(Array.isArray(e))return Bv(e)}function Bv(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var FZ=function(t){return t},c3={},u3=function(t){return t===c3},ak=function(t){return function n(){return arguments.length===0||arguments.length===1&&u3(arguments.length<=0?void 0:arguments[0])?n:t.apply(void 0,arguments)}},VZ=function e(t,n){return t===1?n:ak(function(){for(var r=arguments.length,s=new Array(r),i=0;i<r;i++)s[i]=arguments[i];var o=s.filter(function(l){return l!==c3}).length;return o>=t?n.apply(void 0,s):e(t-o,ak(function(){for(var l=arguments.length,c=new Array(l),u=0;u<l;u++)c[u]=arguments[u];var d=s.map(function(f){return u3(f)?c.shift():f});return n.apply(void 0,DZ(d).concat(c))}))})},Qm=function(t){return VZ(t.length,t)},Fv=function(t,n){for(var r=[],s=t;s<n;++s)r[s-t]=s;return r},UZ=Qm(function(e,t){return Array.isArray(t)?t.map(e):Object.keys(t).map(function(n){return t[n]}).map(e)}),WZ=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];if(!n.length)return FZ;var s=n.reverse(),i=s[0],o=s.slice(1);return function(){return o.reduce(function(l,c){return c(l)},i.apply(void 0,arguments))}},Vv=function(t){return Array.isArray(t)?t.reverse():t.split("").reverse.join("")},d3=function(t){var n=null,r=null;return function(){for(var s=arguments.length,i=new Array(s),o=0;o<s;o++)i[o]=arguments[o];return n&&i.every(function(l,c){return l===n[c]})||(n=i,r=t.apply(void 0,i)),r}};function qZ(e){var t;return e===0?t=1:t=Math.floor(new Be(e).abs().log(10).toNumber())+1,t}function HZ(e,t,n){for(var r=new Be(e),s=0,i=[];r.lt(t)&&s<1e5;)i.push(r.toNumber()),r=r.add(n),s++;return i}var KZ=Qm(function(e,t,n){var r=+e,s=+t;return r+n*(s-r)}),GZ=Qm(function(e,t,n){var r=t-+e;return r=r||1/0,(n-e)/r}),XZ=Qm(function(e,t,n){var r=t-+e;return r=r||1/0,Math.max(0,Math.min(1,(n-e)/r))});const Jm={rangeStep:HZ,getDigitCount:qZ,interpolateNumber:KZ,uninterpolateNumber:GZ,uninterpolateTruncation:XZ};function Uv(e){return JZ(e)||QZ(e)||f3(e)||YZ()}function YZ(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function QZ(e){if(typeof Symbol<"u"&&Symbol.iterator in Object(e))return Array.from(e)}function JZ(e){if(Array.isArray(e))return Wv(e)}function Iu(e,t){return tee(e)||eee(e,t)||f3(e,t)||ZZ()}function ZZ(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function f3(e,t){if(e){if(typeof e=="string")return Wv(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Wv(e,t)}}function Wv(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function eee(e,t){if(!(typeof Symbol>"u"||!(Symbol.iterator in Object(e)))){var n=[],r=!0,s=!1,i=void 0;try{for(var o=e[Symbol.iterator](),l;!(r=(l=o.next()).done)&&(n.push(l.value),!(t&&n.length===t));r=!0);}catch(c){s=!0,i=c}finally{try{!r&&o.return!=null&&o.return()}finally{if(s)throw i}}return n}}function tee(e){if(Array.isArray(e))return e}function p3(e){var t=Iu(e,2),n=t[0],r=t[1],s=n,i=r;return n>r&&(s=r,i=n),[s,i]}function h3(e,t,n){if(e.lte(0))return new Be(0);var r=Jm.getDigitCount(e.toNumber()),s=new Be(10).pow(r),i=e.div(s),o=r!==1?.05:.1,l=new Be(Math.ceil(i.div(o).toNumber())).add(n).mul(o),c=l.mul(s);return t?c:new Be(Math.ceil(c))}function nee(e,t,n){var r=1,s=new Be(e);if(!s.isint()&&n){var i=Math.abs(e);i<1?(r=new Be(10).pow(Jm.getDigitCount(e)-1),s=new Be(Math.floor(s.div(r).toNumber())).mul(r)):i>1&&(s=new Be(Math.floor(e)))}else e===0?s=new Be(Math.floor((t-1)/2)):n||(s=new Be(Math.floor(e)));var o=Math.floor((t-1)/2),l=WZ(UZ(function(c){return s.add(new Be(c-o).mul(r)).toNumber()}),Fv);return l(0,t)}function m3(e,t,n,r){var s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((t-e)/(n-1)))return{step:new Be(0),tickMin:new Be(0),tickMax:new Be(0)};var i=h3(new Be(t).sub(e).div(n-1),r,s),o;e<=0&&t>=0?o=new Be(0):(o=new Be(e).add(t).div(2),o=o.sub(new Be(o).mod(i)));var l=Math.ceil(o.sub(e).div(i).toNumber()),c=Math.ceil(new Be(t).sub(o).div(i).toNumber()),u=l+c+1;return u>n?m3(e,t,n,r,s+1):(u<n&&(c=t>0?c+(n-u):c,l=t>0?l:l+(n-u)),{step:i,tickMin:o.sub(new Be(l).mul(i)),tickMax:o.add(new Be(c).mul(i))})}function ree(e){var t=Iu(e,2),n=t[0],r=t[1],s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=Math.max(s,2),l=p3([n,r]),c=Iu(l,2),u=c[0],d=c[1];if(u===-1/0||d===1/0){var f=d===1/0?[u].concat(Uv(Fv(0,s-1).map(function(){return 1/0}))):[].concat(Uv(Fv(0,s-1).map(function(){return-1/0})),[d]);return n>r?Vv(f):f}if(u===d)return nee(u,s,i);var p=m3(u,d,o,i),h=p.step,m=p.tickMin,v=p.tickMax,x=Jm.rangeStep(m,v.add(new Be(.1).mul(h)),h);return n>r?Vv(x):x}function aee(e,t){var n=Iu(e,2),r=n[0],s=n[1],i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=p3([r,s]),l=Iu(o,2),c=l[0],u=l[1];if(c===-1/0||u===1/0)return[r,s];if(c===u)return[c];var d=Math.max(t,2),f=h3(new Be(u).sub(c).div(d-1),i,0),p=[].concat(Uv(Jm.rangeStep(new Be(c),new Be(u).sub(new Be(.99).mul(f)),f)),[u]);return r>s?Vv(p):p}var see=d3(ree),iee=d3(aee),oee="Invariant failed";function Ri(e,t){throw new Error(oee)}var lee=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function al(e){"@babel/helpers - typeof";return al=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},al(e)}function lh(){return lh=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},lh.apply(this,arguments)}function cee(e,t){return pee(e)||fee(e,t)||dee(e,t)||uee()}function uee(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function dee(e,t){if(e){if(typeof e=="string")return sk(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return sk(e,t)}}function sk(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function fee(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,s,i,o,l=[],c=!0,u=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(d){u=!0,s=d}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function pee(e){if(Array.isArray(e))return e}function hee(e,t){if(e==null)return{};var n=mee(e,t),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)r=i[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function mee(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function xee(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function gee(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,v3(r.key),r)}}function vee(e,t,n){return t&&gee(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function yee(e,t,n){return t=ch(t),bee(e,x3()?Reflect.construct(t,n||[],ch(e).constructor):t.apply(e,n))}function bee(e,t){if(t&&(al(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return jee(e)}function jee(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function x3(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(x3=function(){return!!e})()}function ch(e){return ch=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},ch(e)}function wee(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&qv(e,t)}function qv(e,t){return qv=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},qv(e,t)}function g3(e,t,n){return t=v3(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function v3(e){var t=Nee(e,"string");return al(t)=="symbol"?t:t+""}function Nee(e,t){if(al(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(al(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Sd=function(e){function t(){return xee(this,t),yee(this,t,arguments)}return wee(t,e),vee(t,[{key:"render",value:function(){var r=this.props,s=r.offset,i=r.layout,o=r.width,l=r.dataKey,c=r.data,u=r.dataPointFormatter,d=r.xAxis,f=r.yAxis,p=hee(r,lee),h=me(p,!1);this.props.direction==="x"&&d.type!=="number"&&Ri();var m=c.map(function(v){var x=u(v,l),y=x.x,g=x.y,j=x.value,N=x.errorVal;if(!N)return null;var w=[],S,k;if(Array.isArray(N)){var C=cee(N,2);S=C[0],k=C[1]}else S=k=N;if(i==="vertical"){var _=d.scale,A=g+s,E=A+o,P=A-o,D=_(j-S),I=_(j+k);w.push({x1:I,y1:E,x2:I,y2:P}),w.push({x1:D,y1:A,x2:I,y2:A}),w.push({x1:D,y1:E,x2:D,y2:P})}else if(i==="horizontal"){var R=f.scale,M=y+s,W=M-o,T=M+o,V=R(j-S),X=R(j+k);w.push({x1:W,y1:X,x2:T,y2:X}),w.push({x1:M,y1:V,x2:M,y2:X}),w.push({x1:W,y1:V,x2:T,y2:V})}return O.createElement(Ae,lh({className:"recharts-errorBar",key:"bar-".concat(w.map(function(U){return"".concat(U.x1,"-").concat(U.x2,"-").concat(U.y1,"-").concat(U.y2)}))},h),w.map(function(U){return O.createElement("line",lh({},U,{key:"line-".concat(U.x1,"-").concat(U.x2,"-").concat(U.y1,"-").concat(U.y2)}))}))});return O.createElement(Ae,{className:"recharts-errorBars"},m)}}])}(O.Component);g3(Sd,"defaultProps",{stroke:"black",strokeWidth:1.5,width:5,offset:0,layout:"horizontal"});g3(Sd,"displayName","ErrorBar");function Lu(e){"@babel/helpers - typeof";return Lu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Lu(e)}function ik(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function Vs(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ik(Object(n),!0).forEach(function(r){See(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ik(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function See(e,t,n){return t=kee(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function kee(e){var t=Cee(e,"string");return Lu(t)=="symbol"?t:t+""}function Cee(e,t){if(Lu(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Lu(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var y3=function(t){var n=t.children,r=t.formattedGraphicalItems,s=t.legendWidth,i=t.legendContent,o=Mn(n,ms);if(!o)return null;var l=ms.defaultProps,c=l!==void 0?Vs(Vs({},l),o.props):{},u;return o.props&&o.props.payload?u=o.props&&o.props.payload:i==="children"?u=(r||[]).reduce(function(d,f){var p=f.item,h=f.props,m=h.sectors||h.data||[];return d.concat(m.map(function(v){return{type:o.props.iconType||p.props.legendType,value:v.name,color:v.fill,payload:v}}))},[]):u=(r||[]).map(function(d){var f=d.item,p=f.type.defaultProps,h=p!==void 0?Vs(Vs({},p),f.props):{},m=h.dataKey,v=h.name,x=h.legendType,y=h.hide;return{inactive:y,dataKey:m,type:c.iconType||x||"square",color:mj(f),value:v||m,payload:h}}),Vs(Vs(Vs({},c),ms.getWithHeight(o,s)),{},{payload:u,item:o})};function zu(e){"@babel/helpers - typeof";return zu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},zu(e)}function ok(e){return Eee(e)||Pee(e)||Aee(e)||_ee()}function _ee(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Aee(e,t){if(e){if(typeof e=="string")return Hv(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Hv(e,t)}}function Pee(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Eee(e){if(Array.isArray(e))return Hv(e)}function Hv(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function lk(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function dt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?lk(Object(n),!0).forEach(function(r){Lo(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):lk(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Lo(e,t,n){return t=Oee(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Oee(e){var t=Tee(e,"string");return zu(t)=="symbol"?t:t+""}function Tee(e,t){if(zu(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(zu(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function mt(e,t,n){return je(e)||je(t)?n:Et(t)?Ln(e,t,n):ve(t)?t(e):n}function Fc(e,t,n,r){var s=PZ(e,function(l){return mt(l,t)});if(n==="number"){var i=s.filter(function(l){return ee(l)||parseFloat(l)});return i.length?[Ym(i),rs(i)]:[1/0,-1/0]}var o=r?s.filter(function(l){return!je(l)}):s;return o.map(function(l){return Et(l)||l instanceof Date?l:""})}var $ee=function(t){var n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],s=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,o=-1,l=(n=r==null?void 0:r.length)!==null&&n!==void 0?n:0;if(l<=1)return 0;if(i&&i.axisType==="angleAxis"&&Math.abs(Math.abs(i.range[1]-i.range[0])-360)<=1e-6)for(var c=i.range,u=0;u<l;u++){var d=u>0?s[u-1].coordinate:s[l-1].coordinate,f=s[u].coordinate,p=u>=l-1?s[0].coordinate:s[u+1].coordinate,h=void 0;if(ln(f-d)!==ln(p-f)){var m=[];if(ln(p-f)===ln(c[1]-c[0])){h=p;var v=f+c[1]-c[0];m[0]=Math.min(v,(v+d)/2),m[1]=Math.max(v,(v+d)/2)}else{h=d;var x=p+c[1]-c[0];m[0]=Math.min(f,(x+f)/2),m[1]=Math.max(f,(x+f)/2)}var y=[Math.min(f,(h+f)/2),Math.max(f,(h+f)/2)];if(t>y[0]&&t<=y[1]||t>=m[0]&&t<=m[1]){o=s[u].index;break}}else{var g=Math.min(d,p),j=Math.max(d,p);if(t>(g+f)/2&&t<=(j+f)/2){o=s[u].index;break}}}else for(var N=0;N<l;N++)if(N===0&&t<=(r[N].coordinate+r[N+1].coordinate)/2||N>0&&N<l-1&&t>(r[N].coordinate+r[N-1].coordinate)/2&&t<=(r[N].coordinate+r[N+1].coordinate)/2||N===l-1&&t>(r[N].coordinate+r[N-1].coordinate)/2){o=r[N].index;break}return o},mj=function(t){var n,r=t,s=r.type.displayName,i=(n=t.type)!==null&&n!==void 0&&n.defaultProps?dt(dt({},t.type.defaultProps),t.props):t.props,o=i.stroke,l=i.fill,c;switch(s){case"Line":c=o;break;case"Area":case"Radar":c=o&&o!=="none"?o:l;break;default:c=l;break}return c},Mee=function(t){var n=t.barSize,r=t.totalSize,s=t.stackGroups,i=s===void 0?{}:s;if(!i)return{};for(var o={},l=Object.keys(i),c=0,u=l.length;c<u;c++)for(var d=i[l[c]].stackGroups,f=Object.keys(d),p=0,h=f.length;p<h;p++){var m=d[f[p]],v=m.items,x=m.cateAxisId,y=v.filter(function(k){return Na(k.type).indexOf("Bar")>=0});if(y&&y.length){var g=y[0].type.defaultProps,j=g!==void 0?dt(dt({},g),y[0].props):y[0].props,N=j.barSize,w=j[x];o[w]||(o[w]=[]);var S=je(N)?n:N;o[w].push({item:y[0],stackList:y.slice(1),barSize:je(S)?void 0:cn(S,r,0)})}}return o},Ree=function(t){var n=t.barGap,r=t.barCategoryGap,s=t.bandSize,i=t.sizeList,o=i===void 0?[]:i,l=t.maxBarSize,c=o.length;if(c<1)return null;var u=cn(n,s,0,!0),d,f=[];if(o[0].barSize===+o[0].barSize){var p=!1,h=s/c,m=o.reduce(function(N,w){return N+w.barSize||0},0);m+=(c-1)*u,m>=s&&(m-=(c-1)*u,u=0),m>=s&&h>0&&(p=!0,h*=.9,m=c*h);var v=(s-m)/2>>0,x={offset:v-u,size:0};d=o.reduce(function(N,w){var S={item:w.item,position:{offset:x.offset+x.size+u,size:p?h:w.barSize}},k=[].concat(ok(N),[S]);return x=k[k.length-1].position,w.stackList&&w.stackList.length&&w.stackList.forEach(function(C){k.push({item:C,position:x})}),k},f)}else{var y=cn(r,s,0,!0);s-2*y-(c-1)*u<=0&&(u=0);var g=(s-2*y-(c-1)*u)/c;g>1&&(g>>=0);var j=l===+l?Math.min(g,l):g;d=o.reduce(function(N,w,S){var k=[].concat(ok(N),[{item:w.item,position:{offset:y+(g+u)*S+(g-j)/2,size:j}}]);return w.stackList&&w.stackList.length&&w.stackList.forEach(function(C){k.push({item:C,position:k[k.length-1].position})}),k},f)}return d},Dee=function(t,n,r,s){var i=r.children,o=r.width,l=r.margin,c=o-(l.left||0)-(l.right||0),u=y3({children:i,legendWidth:c});if(u){var d=s||{},f=d.width,p=d.height,h=u.align,m=u.verticalAlign,v=u.layout;if((v==="vertical"||v==="horizontal"&&m==="middle")&&h!=="center"&&ee(t[h]))return dt(dt({},t),{},Lo({},h,t[h]+(f||0)));if((v==="horizontal"||v==="vertical"&&h==="center")&&m!=="middle"&&ee(t[m]))return dt(dt({},t),{},Lo({},m,t[m]+(p||0)))}return t},Iee=function(t,n,r){return je(n)?!0:t==="horizontal"?n==="yAxis":t==="vertical"||r==="x"?n==="xAxis":r==="y"?n==="yAxis":!0},b3=function(t,n,r,s,i){var o=n.props.children,l=zn(o,Sd).filter(function(u){return Iee(s,i,u.props.direction)});if(l&&l.length){var c=l.map(function(u){return u.props.dataKey});return t.reduce(function(u,d){var f=mt(d,r);if(je(f))return u;var p=Array.isArray(f)?[Ym(f),rs(f)]:[f,f],h=c.reduce(function(m,v){var x=mt(d,v,0),y=p[0]-Math.abs(Array.isArray(x)?x[0]:x),g=p[1]+Math.abs(Array.isArray(x)?x[1]:x);return[Math.min(y,m[0]),Math.max(g,m[1])]},[1/0,-1/0]);return[Math.min(h[0],u[0]),Math.max(h[1],u[1])]},[1/0,-1/0])}return null},Lee=function(t,n,r,s,i){var o=n.map(function(l){return b3(t,l,r,i,s)}).filter(function(l){return!je(l)});return o&&o.length?o.reduce(function(l,c){return[Math.min(l[0],c[0]),Math.max(l[1],c[1])]},[1/0,-1/0]):null},j3=function(t,n,r,s,i){var o=n.map(function(c){var u=c.props.dataKey;return r==="number"&&u&&b3(t,c,u,s)||Fc(t,u,r,i)});if(r==="number")return o.reduce(function(c,u){return[Math.min(c[0],u[0]),Math.max(c[1],u[1])]},[1/0,-1/0]);var l={};return o.reduce(function(c,u){for(var d=0,f=u.length;d<f;d++)l[u[d]]||(l[u[d]]=!0,c.push(u[d]));return c},[])},w3=function(t,n){return t==="horizontal"&&n==="xAxis"||t==="vertical"&&n==="yAxis"||t==="centric"&&n==="angleAxis"||t==="radial"&&n==="radiusAxis"},N3=function(t,n,r,s){if(s)return t.map(function(c){return c.coordinate});var i,o,l=t.map(function(c){return c.coordinate===n&&(i=!0),c.coordinate===r&&(o=!0),c.coordinate});return i||l.push(n),o||l.push(r),l},ba=function(t,n,r){if(!t)return null;var s=t.scale,i=t.duplicateDomain,o=t.type,l=t.range,c=t.realScaleType==="scaleBand"?s.bandwidth()/2:2,u=(n||r)&&o==="category"&&s.bandwidth?s.bandwidth()/c:0;if(u=t.axisType==="angleAxis"&&(l==null?void 0:l.length)>=2?ln(l[0]-l[1])*2*u:u,n&&(t.ticks||t.niceTicks)){var d=(t.ticks||t.niceTicks).map(function(f){var p=i?i.indexOf(f):f;return{coordinate:s(p)+u,value:f,offset:u}});return d.filter(function(f){return!Ll(f.coordinate)})}return t.isCategorical&&t.categoricalDomain?t.categoricalDomain.map(function(f,p){return{coordinate:s(f)+u,value:f,index:p,offset:u}}):s.ticks&&!r?s.ticks(t.tickCount).map(function(f){return{coordinate:s(f)+u,value:f,offset:u}}):s.domain().map(function(f,p){return{coordinate:s(f)+u,value:i?i[f]:f,index:p,offset:u}})},y0=new WeakMap,ff=function(t,n){if(typeof n!="function")return t;y0.has(t)||y0.set(t,new WeakMap);var r=y0.get(t);if(r.has(n))return r.get(n);var s=function(){t.apply(void 0,arguments),n.apply(void 0,arguments)};return r.set(n,s),s},S3=function(t,n,r){var s=t.scale,i=t.type,o=t.layout,l=t.axisType;if(s==="auto")return o==="radial"&&l==="radiusAxis"?{scale:Ou(),realScaleType:"band"}:o==="radial"&&l==="angleAxis"?{scale:rh(),realScaleType:"linear"}:i==="category"&&n&&(n.indexOf("LineChart")>=0||n.indexOf("AreaChart")>=0||n.indexOf("ComposedChart")>=0&&!r)?{scale:Bc(),realScaleType:"point"}:i==="category"?{scale:Ou(),realScaleType:"band"}:{scale:rh(),realScaleType:"linear"};if(Ei(s)){var c="scale".concat(Rm(s));return{scale:(tk[c]||Bc)(),realScaleType:tk[c]?c:"point"}}return ve(s)?{scale:s}:{scale:Bc(),realScaleType:"point"}},ck=1e-4,k3=function(t){var n=t.domain();if(!(!n||n.length<=2)){var r=n.length,s=t.range(),i=Math.min(s[0],s[1])-ck,o=Math.max(s[0],s[1])+ck,l=t(n[0]),c=t(n[r-1]);(l<i||l>o||c<i||c>o)&&t.domain([n[0],n[r-1]])}},zee=function(t,n){if(!t)return null;for(var r=0,s=t.length;r<s;r++)if(t[r].item===n)return t[r].position;return null},Bee=function(t,n){if(!n||n.length!==2||!ee(n[0])||!ee(n[1]))return t;var r=Math.min(n[0],n[1]),s=Math.max(n[0],n[1]),i=[t[0],t[1]];return(!ee(t[0])||t[0]<r)&&(i[0]=r),(!ee(t[1])||t[1]>s)&&(i[1]=s),i[0]>s&&(i[0]=s),i[1]<r&&(i[1]=r),i},Fee=function(t){var n=t.length;if(!(n<=0))for(var r=0,s=t[0].length;r<s;++r)for(var i=0,o=0,l=0;l<n;++l){var c=Ll(t[l][r][1])?t[l][r][0]:t[l][r][1];c>=0?(t[l][r][0]=i,t[l][r][1]=i+c,i=t[l][r][1]):(t[l][r][0]=o,t[l][r][1]=o+c,o=t[l][r][1])}},Vee=function(t){var n=t.length;if(!(n<=0))for(var r=0,s=t[0].length;r<s;++r)for(var i=0,o=0;o<n;++o){var l=Ll(t[o][r][1])?t[o][r][0]:t[o][r][1];l>=0?(t[o][r][0]=i,t[o][r][1]=i+l,i=t[o][r][1]):(t[o][r][0]=0,t[o][r][1]=0)}},Uee={sign:Fee,expand:lF,none:Yo,silhouette:cF,wiggle:uF,positive:Vee},Wee=function(t,n,r){var s=n.map(function(l){return l.props.dataKey}),i=Uee[r],o=oF().keys(s).value(function(l,c){return+mt(l,c,0)}).order(gv).offset(i);return o(t)},qee=function(t,n,r,s,i,o){if(!t)return null;var l=o?n.reverse():n,c={},u=l.reduce(function(f,p){var h,m=(h=p.type)!==null&&h!==void 0&&h.defaultProps?dt(dt({},p.type.defaultProps),p.props):p.props,v=m.stackId,x=m.hide;if(x)return f;var y=m[r],g=f[y]||{hasStack:!1,stackGroups:{}};if(Et(v)){var j=g.stackGroups[v]||{numericAxisId:r,cateAxisId:s,items:[]};j.items.push(p),g.hasStack=!0,g.stackGroups[v]=j}else g.stackGroups[Hi("_stackId_")]={numericAxisId:r,cateAxisId:s,items:[p]};return dt(dt({},f),{},Lo({},y,g))},c),d={};return Object.keys(u).reduce(function(f,p){var h=u[p];if(h.hasStack){var m={};h.stackGroups=Object.keys(h.stackGroups).reduce(function(v,x){var y=h.stackGroups[x];return dt(dt({},v),{},Lo({},x,{numericAxisId:r,cateAxisId:s,items:y.items,stackedData:Wee(t,y.items,i)}))},m)}return dt(dt({},f),{},Lo({},p,h))},d)},C3=function(t,n){var r=n.realScaleType,s=n.type,i=n.tickCount,o=n.originalDomain,l=n.allowDecimals,c=r||n.scale;if(c!=="auto"&&c!=="linear")return null;if(i&&s==="number"&&o&&(o[0]==="auto"||o[1]==="auto")){var u=t.domain();if(!u.length)return null;var d=see(u,i,l);return t.domain([Ym(d),rs(d)]),{niceTicks:d}}if(i&&s==="number"){var f=t.domain(),p=iee(f,i,l);return{niceTicks:p}}return null};function uh(e){var t=e.axis,n=e.ticks,r=e.bandSize,s=e.entry,i=e.index,o=e.dataKey;if(t.type==="category"){if(!t.allowDuplicatedCategory&&t.dataKey&&!je(s[t.dataKey])){var l=Rp(n,"value",s[t.dataKey]);if(l)return l.coordinate+r/2}return n[i]?n[i].coordinate+r/2:null}var c=mt(s,je(o)?t.dataKey:o);return je(c)?null:t.scale(c)}var uk=function(t){var n=t.axis,r=t.ticks,s=t.offset,i=t.bandSize,o=t.entry,l=t.index;if(n.type==="category")return r[l]?r[l].coordinate+s:null;var c=mt(o,n.dataKey,n.domain[l]);return je(c)?null:n.scale(c)-i/2+s},Hee=function(t){var n=t.numericAxis,r=n.scale.domain();if(n.type==="number"){var s=Math.min(r[0],r[1]),i=Math.max(r[0],r[1]);return s<=0&&i>=0?0:i<0?i:s}return r[0]},Kee=function(t,n){var r,s=(r=t.type)!==null&&r!==void 0&&r.defaultProps?dt(dt({},t.type.defaultProps),t.props):t.props,i=s.stackId;if(Et(i)){var o=n[i];if(o){var l=o.items.indexOf(t);return l>=0?o.stackedData[l]:null}}return null},Gee=function(t){return t.reduce(function(n,r){return[Ym(r.concat([n[0]]).filter(ee)),rs(r.concat([n[1]]).filter(ee))]},[1/0,-1/0])},_3=function(t,n,r){return Object.keys(t).reduce(function(s,i){var o=t[i],l=o.stackedData,c=l.reduce(function(u,d){var f=Gee(d.slice(n,r+1));return[Math.min(u[0],f[0]),Math.max(u[1],f[1])]},[1/0,-1/0]);return[Math.min(c[0],s[0]),Math.max(c[1],s[1])]},[1/0,-1/0]).map(function(s){return s===1/0||s===-1/0?0:s})},dk=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,fk=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Kv=function(t,n,r){if(ve(t))return t(n,r);if(!Array.isArray(t))return n;var s=[];if(ee(t[0]))s[0]=r?t[0]:Math.min(t[0],n[0]);else if(dk.test(t[0])){var i=+dk.exec(t[0])[1];s[0]=n[0]-i}else ve(t[0])?s[0]=t[0](n[0]):s[0]=n[0];if(ee(t[1]))s[1]=r?t[1]:Math.max(t[1],n[1]);else if(fk.test(t[1])){var o=+fk.exec(t[1])[1];s[1]=n[1]+o}else ve(t[1])?s[1]=t[1](n[1]):s[1]=n[1];return s},dh=function(t,n,r){if(t&&t.scale&&t.scale.bandwidth){var s=t.scale.bandwidth();if(!r||s>0)return s}if(t&&n&&n.length>=2){for(var i=U1(n,function(f){return f.coordinate}),o=1/0,l=1,c=i.length;l<c;l++){var u=i[l],d=i[l-1];o=Math.min((u.coordinate||0)-(d.coordinate||0),o)}return o===1/0?0:o}return r?void 0:0},pk=function(t,n,r){return!t||!t.length||$i(t,Ln(r,"type.defaultProps.domain"))?n:t},A3=function(t,n){var r=t.type.defaultProps?dt(dt({},t.type.defaultProps),t.props):t.props,s=r.dataKey,i=r.name,o=r.unit,l=r.formatter,c=r.tooltipType,u=r.chartType,d=r.hide;return dt(dt({},me(t,!1)),{},{dataKey:s,unit:o,formatter:l,name:i||s,color:mj(t),value:mt(n,s),type:c,payload:n,chartType:u,hide:d})};function Bu(e){"@babel/helpers - typeof";return Bu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Bu(e)}function hk(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function ha(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?hk(Object(n),!0).forEach(function(r){P3(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):hk(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function P3(e,t,n){return t=Xee(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Xee(e){var t=Yee(e,"string");return Bu(t)=="symbol"?t:t+""}function Yee(e,t){if(Bu(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Bu(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Qee(e,t){return tte(e)||ete(e,t)||Zee(e,t)||Jee()}function Jee(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Zee(e,t){if(e){if(typeof e=="string")return mk(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return mk(e,t)}}function mk(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ete(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,s,i,o,l=[],c=!0,u=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(d){u=!0,s=d}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function tte(e){if(Array.isArray(e))return e}var fh=Math.PI/180,nte=function(t){return t*180/Math.PI},Ge=function(t,n,r,s){return{x:t+Math.cos(-fh*s)*r,y:n+Math.sin(-fh*s)*r}},E3=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(t-(r.left||0)-(r.right||0)),Math.abs(n-(r.top||0)-(r.bottom||0)))/2},rte=function(t,n,r,s,i){var o=t.width,l=t.height,c=t.startAngle,u=t.endAngle,d=cn(t.cx,o,o/2),f=cn(t.cy,l,l/2),p=E3(o,l,r),h=cn(t.innerRadius,p,0),m=cn(t.outerRadius,p,p*.8),v=Object.keys(n);return v.reduce(function(x,y){var g=n[y],j=g.domain,N=g.reversed,w;if(je(g.range))s==="angleAxis"?w=[c,u]:s==="radiusAxis"&&(w=[h,m]),N&&(w=[w[1],w[0]]);else{w=g.range;var S=w,k=Qee(S,2);c=k[0],u=k[1]}var C=S3(g,i),_=C.realScaleType,A=C.scale;A.domain(j).range(w),k3(A);var E=C3(A,ha(ha({},g),{},{realScaleType:_})),P=ha(ha(ha({},g),E),{},{range:w,radius:m,realScaleType:_,scale:A,cx:d,cy:f,innerRadius:h,outerRadius:m,startAngle:c,endAngle:u});return ha(ha({},x),{},P3({},y,P))},{})},ate=function(t,n){var r=t.x,s=t.y,i=n.x,o=n.y;return Math.sqrt(Math.pow(r-i,2)+Math.pow(s-o,2))},ste=function(t,n){var r=t.x,s=t.y,i=n.cx,o=n.cy,l=ate({x:r,y:s},{x:i,y:o});if(l<=0)return{radius:l};var c=(r-i)/l,u=Math.acos(c);return s>o&&(u=2*Math.PI-u),{radius:l,angle:nte(u),angleInRadian:u}},ite=function(t){var n=t.startAngle,r=t.endAngle,s=Math.floor(n/360),i=Math.floor(r/360),o=Math.min(s,i);return{startAngle:n-o*360,endAngle:r-o*360}},ote=function(t,n){var r=n.startAngle,s=n.endAngle,i=Math.floor(r/360),o=Math.floor(s/360),l=Math.min(i,o);return t+l*360},xk=function(t,n){var r=t.x,s=t.y,i=ste({x:r,y:s},n),o=i.radius,l=i.angle,c=n.innerRadius,u=n.outerRadius;if(o<c||o>u)return!1;if(o===0)return!0;var d=ite(n),f=d.startAngle,p=d.endAngle,h=l,m;if(f<=p){for(;h>p;)h-=360;for(;h<f;)h+=360;m=h>=f&&h<=p}else{for(;h>f;)h-=360;for(;h<p;)h+=360;m=h>=p&&h<=f}return m?ha(ha({},n),{},{radius:o,angle:ote(h,n)}):null},O3=function(t){return!b.isValidElement(t)&&!ve(t)&&typeof t!="boolean"?t.className:""};function Fu(e){"@babel/helpers - typeof";return Fu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Fu(e)}var lte=["offset"];function cte(e){return pte(e)||fte(e)||dte(e)||ute()}function ute(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function dte(e,t){if(e){if(typeof e=="string")return Gv(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Gv(e,t)}}function fte(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function pte(e){if(Array.isArray(e))return Gv(e)}function Gv(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function hte(e,t){if(e==null)return{};var n=mte(e,t),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)r=i[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function mte(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function gk(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function kt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?gk(Object(n),!0).forEach(function(r){xte(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):gk(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function xte(e,t,n){return t=gte(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function gte(e){var t=vte(e,"string");return Fu(t)=="symbol"?t:t+""}function vte(e,t){if(Fu(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Fu(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Vu(){return Vu=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Vu.apply(this,arguments)}var yte=function(t){var n=t.value,r=t.formatter,s=je(t.children)?n:t.children;return ve(r)?r(s):s},bte=function(t,n){var r=ln(n-t),s=Math.min(Math.abs(n-t),360);return r*s},jte=function(t,n,r){var s=t.position,i=t.viewBox,o=t.offset,l=t.className,c=i,u=c.cx,d=c.cy,f=c.innerRadius,p=c.outerRadius,h=c.startAngle,m=c.endAngle,v=c.clockWise,x=(f+p)/2,y=bte(h,m),g=y>=0?1:-1,j,N;s==="insideStart"?(j=h+g*o,N=v):s==="insideEnd"?(j=m-g*o,N=!v):s==="end"&&(j=m+g*o,N=v),N=y<=0?N:!N;var w=Ge(u,d,x,j),S=Ge(u,d,x,j+(N?1:-1)*359),k="M".concat(w.x,",").concat(w.y,`
A`).concat(x,",").concat(x,",0,1,").concat(N?0:1,`,
`).concat(S.x,",").concat(S.y),C=je(t.id)?Hi("recharts-radial-line-"):t.id;return O.createElement("text",Vu({},r,{dominantBaseline:"central",className:Ne("recharts-radial-bar-label",l)}),O.createElement("defs",null,O.createElement("path",{id:C,d:k})),O.createElement("textPath",{xlinkHref:"#".concat(C)},n))},wte=function(t){var n=t.viewBox,r=t.offset,s=t.position,i=n,o=i.cx,l=i.cy,c=i.innerRadius,u=i.outerRadius,d=i.startAngle,f=i.endAngle,p=(d+f)/2;if(s==="outside"){var h=Ge(o,l,u+r,p),m=h.x,v=h.y;return{x:m,y:v,textAnchor:m>=o?"start":"end",verticalAnchor:"middle"}}if(s==="center")return{x:o,y:l,textAnchor:"middle",verticalAnchor:"middle"};if(s==="centerTop")return{x:o,y:l,textAnchor:"middle",verticalAnchor:"start"};if(s==="centerBottom")return{x:o,y:l,textAnchor:"middle",verticalAnchor:"end"};var x=(c+u)/2,y=Ge(o,l,x,p),g=y.x,j=y.y;return{x:g,y:j,textAnchor:"middle",verticalAnchor:"middle"}},Nte=function(t){var n=t.viewBox,r=t.parentViewBox,s=t.offset,i=t.position,o=n,l=o.x,c=o.y,u=o.width,d=o.height,f=d>=0?1:-1,p=f*s,h=f>0?"end":"start",m=f>0?"start":"end",v=u>=0?1:-1,x=v*s,y=v>0?"end":"start",g=v>0?"start":"end";if(i==="top"){var j={x:l+u/2,y:c-f*s,textAnchor:"middle",verticalAnchor:h};return kt(kt({},j),r?{height:Math.max(c-r.y,0),width:u}:{})}if(i==="bottom"){var N={x:l+u/2,y:c+d+p,textAnchor:"middle",verticalAnchor:m};return kt(kt({},N),r?{height:Math.max(r.y+r.height-(c+d),0),width:u}:{})}if(i==="left"){var w={x:l-x,y:c+d/2,textAnchor:y,verticalAnchor:"middle"};return kt(kt({},w),r?{width:Math.max(w.x-r.x,0),height:d}:{})}if(i==="right"){var S={x:l+u+x,y:c+d/2,textAnchor:g,verticalAnchor:"middle"};return kt(kt({},S),r?{width:Math.max(r.x+r.width-S.x,0),height:d}:{})}var k=r?{width:u,height:d}:{};return i==="insideLeft"?kt({x:l+x,y:c+d/2,textAnchor:g,verticalAnchor:"middle"},k):i==="insideRight"?kt({x:l+u-x,y:c+d/2,textAnchor:y,verticalAnchor:"middle"},k):i==="insideTop"?kt({x:l+u/2,y:c+p,textAnchor:"middle",verticalAnchor:m},k):i==="insideBottom"?kt({x:l+u/2,y:c+d-p,textAnchor:"middle",verticalAnchor:h},k):i==="insideTopLeft"?kt({x:l+x,y:c+p,textAnchor:g,verticalAnchor:m},k):i==="insideTopRight"?kt({x:l+u-x,y:c+p,textAnchor:y,verticalAnchor:m},k):i==="insideBottomLeft"?kt({x:l+x,y:c+d-p,textAnchor:g,verticalAnchor:h},k):i==="insideBottomRight"?kt({x:l+u-x,y:c+d-p,textAnchor:y,verticalAnchor:h},k):Ml(i)&&(ee(i.x)||ii(i.x))&&(ee(i.y)||ii(i.y))?kt({x:l+cn(i.x,u),y:c+cn(i.y,d),textAnchor:"end",verticalAnchor:"end"},k):kt({x:l+u/2,y:c+d/2,textAnchor:"middle",verticalAnchor:"middle"},k)},Ste=function(t){return"cx"in t&&ee(t.cx)};function It(e){var t=e.offset,n=t===void 0?5:t,r=hte(e,lte),s=kt({offset:n},r),i=s.viewBox,o=s.position,l=s.value,c=s.children,u=s.content,d=s.className,f=d===void 0?"":d,p=s.textBreakAll;if(!i||je(l)&&je(c)&&!b.isValidElement(u)&&!ve(u))return null;if(b.isValidElement(u))return b.cloneElement(u,s);var h;if(ve(u)){if(h=b.createElement(u,s),b.isValidElement(h))return h}else h=yte(s);var m=Ste(i),v=me(s,!0);if(m&&(o==="insideStart"||o==="insideEnd"||o==="end"))return jte(s,h,v);var x=m?wte(s):Nte(s);return O.createElement(Ti,Vu({className:Ne("recharts-label",f)},v,x,{breakAll:p}),h)}It.displayName="Label";var T3=function(t){var n=t.cx,r=t.cy,s=t.angle,i=t.startAngle,o=t.endAngle,l=t.r,c=t.radius,u=t.innerRadius,d=t.outerRadius,f=t.x,p=t.y,h=t.top,m=t.left,v=t.width,x=t.height,y=t.clockWise,g=t.labelViewBox;if(g)return g;if(ee(v)&&ee(x)){if(ee(f)&&ee(p))return{x:f,y:p,width:v,height:x};if(ee(h)&&ee(m))return{x:h,y:m,width:v,height:x}}return ee(f)&&ee(p)?{x:f,y:p,width:0,height:0}:ee(n)&&ee(r)?{cx:n,cy:r,startAngle:i||s||0,endAngle:o||s||0,innerRadius:u||0,outerRadius:d||c||l||0,clockWise:y}:t.viewBox?t.viewBox:{}},kte=function(t,n){return t?t===!0?O.createElement(It,{key:"label-implicit",viewBox:n}):Et(t)?O.createElement(It,{key:"label-implicit",viewBox:n,value:t}):b.isValidElement(t)?t.type===It?b.cloneElement(t,{key:"label-implicit",viewBox:n}):O.createElement(It,{key:"label-implicit",content:t,viewBox:n}):ve(t)?O.createElement(It,{key:"label-implicit",content:t,viewBox:n}):Ml(t)?O.createElement(It,Vu({viewBox:n},t,{key:"label-implicit"})):null:null},Cte=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!t||!t.children&&r&&!t.label)return null;var s=t.children,i=T3(t),o=zn(s,It).map(function(c,u){return b.cloneElement(c,{viewBox:n||i,key:"label-".concat(u)})});if(!r)return o;var l=kte(t.label,n||i);return[l].concat(cte(o))};It.parseViewBox=T3;It.renderCallByParent=Cte;function _te(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}var Ate=_te;const Pte=De(Ate);function Uu(e){"@babel/helpers - typeof";return Uu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Uu(e)}var Ete=["valueAccessor"],Ote=["data","dataKey","clockWise","id","textBreakAll"];function Tte(e){return Dte(e)||Rte(e)||Mte(e)||$te()}function $te(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Mte(e,t){if(e){if(typeof e=="string")return Xv(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Xv(e,t)}}function Rte(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Dte(e){if(Array.isArray(e))return Xv(e)}function Xv(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ph(){return ph=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ph.apply(this,arguments)}function vk(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function yk(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?vk(Object(n),!0).forEach(function(r){Ite(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):vk(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Ite(e,t,n){return t=Lte(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Lte(e){var t=zte(e,"string");return Uu(t)=="symbol"?t:t+""}function zte(e,t){if(Uu(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Uu(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function bk(e,t){if(e==null)return{};var n=Bte(e,t),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)r=i[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Bte(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var Fte=function(t){return Array.isArray(t.value)?Pte(t.value):t.value};function Zr(e){var t=e.valueAccessor,n=t===void 0?Fte:t,r=bk(e,Ete),s=r.data,i=r.dataKey,o=r.clockWise,l=r.id,c=r.textBreakAll,u=bk(r,Ote);return!s||!s.length?null:O.createElement(Ae,{className:"recharts-label-list"},s.map(function(d,f){var p=je(i)?n(d,f):mt(d&&d.payload,i),h=je(l)?{}:{id:"".concat(l,"-").concat(f)};return O.createElement(It,ph({},me(d,!0),u,h,{parentViewBox:d.parentViewBox,value:p,textBreakAll:c,viewBox:It.parseViewBox(je(o)?d:yk(yk({},d),{},{clockWise:o})),key:"label-".concat(f),index:f}))}))}Zr.displayName="LabelList";function Vte(e,t){return e?e===!0?O.createElement(Zr,{key:"labelList-implicit",data:t}):O.isValidElement(e)||ve(e)?O.createElement(Zr,{key:"labelList-implicit",data:t,content:e}):Ml(e)?O.createElement(Zr,ph({data:t},e,{key:"labelList-implicit"})):null:null}function Ute(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&n&&!e.label)return null;var r=e.children,s=zn(r,Zr).map(function(o,l){return b.cloneElement(o,{data:t,key:"labelList-".concat(l)})});if(!n)return s;var i=Vte(e.label,t);return[i].concat(Tte(s))}Zr.renderCallByParent=Ute;function Wu(e){"@babel/helpers - typeof";return Wu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Wu(e)}function Yv(){return Yv=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Yv.apply(this,arguments)}function jk(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function wk(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?jk(Object(n),!0).forEach(function(r){Wte(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):jk(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Wte(e,t,n){return t=qte(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function qte(e){var t=Hte(e,"string");return Wu(t)=="symbol"?t:t+""}function Hte(e,t){if(Wu(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Wu(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Kte=function(t,n){var r=ln(n-t),s=Math.min(Math.abs(n-t),359.999);return r*s},pf=function(t){var n=t.cx,r=t.cy,s=t.radius,i=t.angle,o=t.sign,l=t.isExternal,c=t.cornerRadius,u=t.cornerIsExternal,d=c*(l?1:-1)+s,f=Math.asin(c/d)/fh,p=u?i:i+o*f,h=Ge(n,r,d,p),m=Ge(n,r,s,p),v=u?i-o*f:i,x=Ge(n,r,d*Math.cos(f*fh),v);return{center:h,circleTangency:m,lineTangency:x,theta:f}},$3=function(t){var n=t.cx,r=t.cy,s=t.innerRadius,i=t.outerRadius,o=t.startAngle,l=t.endAngle,c=Kte(o,l),u=o+c,d=Ge(n,r,i,o),f=Ge(n,r,i,u),p="M ".concat(d.x,",").concat(d.y,`
A `).concat(i,",").concat(i,`,0,
`).concat(+(Math.abs(c)>180),",").concat(+(o>u),`,
`).concat(f.x,",").concat(f.y,`
`);if(s>0){var h=Ge(n,r,s,o),m=Ge(n,r,s,u);p+="L ".concat(m.x,",").concat(m.y,`
A `).concat(s,",").concat(s,`,0,
`).concat(+(Math.abs(c)>180),",").concat(+(o<=u),`,
`).concat(h.x,",").concat(h.y," Z")}else p+="L ".concat(n,",").concat(r," Z");return p},Gte=function(t){var n=t.cx,r=t.cy,s=t.innerRadius,i=t.outerRadius,o=t.cornerRadius,l=t.forceCornerRadius,c=t.cornerIsExternal,u=t.startAngle,d=t.endAngle,f=ln(d-u),p=pf({cx:n,cy:r,radius:i,angle:u,sign:f,cornerRadius:o,cornerIsExternal:c}),h=p.circleTangency,m=p.lineTangency,v=p.theta,x=pf({cx:n,cy:r,radius:i,angle:d,sign:-f,cornerRadius:o,cornerIsExternal:c}),y=x.circleTangency,g=x.lineTangency,j=x.theta,N=c?Math.abs(u-d):Math.abs(u-d)-v-j;if(N<0)return l?"M ".concat(m.x,",").concat(m.y,`
a`).concat(o,",").concat(o,",0,0,1,").concat(o*2,`,0
a`).concat(o,",").concat(o,",0,0,1,").concat(-o*2,`,0
`):$3({cx:n,cy:r,innerRadius:s,outerRadius:i,startAngle:u,endAngle:d});var w="M ".concat(m.x,",").concat(m.y,`
A`).concat(o,",").concat(o,",0,0,").concat(+(f<0),",").concat(h.x,",").concat(h.y,`
A`).concat(i,",").concat(i,",0,").concat(+(N>180),",").concat(+(f<0),",").concat(y.x,",").concat(y.y,`
A`).concat(o,",").concat(o,",0,0,").concat(+(f<0),",").concat(g.x,",").concat(g.y,`
`);if(s>0){var S=pf({cx:n,cy:r,radius:s,angle:u,sign:f,isExternal:!0,cornerRadius:o,cornerIsExternal:c}),k=S.circleTangency,C=S.lineTangency,_=S.theta,A=pf({cx:n,cy:r,radius:s,angle:d,sign:-f,isExternal:!0,cornerRadius:o,cornerIsExternal:c}),E=A.circleTangency,P=A.lineTangency,D=A.theta,I=c?Math.abs(u-d):Math.abs(u-d)-_-D;if(I<0&&o===0)return"".concat(w,"L").concat(n,",").concat(r,"Z");w+="L".concat(P.x,",").concat(P.y,`
A`).concat(o,",").concat(o,",0,0,").concat(+(f<0),",").concat(E.x,",").concat(E.y,`
A`).concat(s,",").concat(s,",0,").concat(+(I>180),",").concat(+(f>0),",").concat(k.x,",").concat(k.y,`
A`).concat(o,",").concat(o,",0,0,").concat(+(f<0),",").concat(C.x,",").concat(C.y,"Z")}else w+="L".concat(n,",").concat(r,"Z");return w},Xte={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},M3=function(t){var n=wk(wk({},Xte),t),r=n.cx,s=n.cy,i=n.innerRadius,o=n.outerRadius,l=n.cornerRadius,c=n.forceCornerRadius,u=n.cornerIsExternal,d=n.startAngle,f=n.endAngle,p=n.className;if(o<i||d===f)return null;var h=Ne("recharts-sector",p),m=o-i,v=cn(l,m,0,!0),x;return v>0&&Math.abs(d-f)<360?x=Gte({cx:r,cy:s,innerRadius:i,outerRadius:o,cornerRadius:Math.min(v,m/2),forceCornerRadius:c,cornerIsExternal:u,startAngle:d,endAngle:f}):x=$3({cx:r,cy:s,innerRadius:i,outerRadius:o,startAngle:d,endAngle:f}),O.createElement("path",Yv({},me(n,!0),{className:h,d:x,role:"img"}))};function qu(e){"@babel/helpers - typeof";return qu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},qu(e)}function Qv(){return Qv=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Qv.apply(this,arguments)}function Nk(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function Sk(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Nk(Object(n),!0).forEach(function(r){Yte(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Nk(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Yte(e,t,n){return t=Qte(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Qte(e){var t=Jte(e,"string");return qu(t)=="symbol"?t:t+""}function Jte(e,t){if(qu(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(qu(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var kk={curveBasisClosed:YB,curveBasisOpen:QB,curveBasis:XB,curveBumpX:RB,curveBumpY:DB,curveLinearClosed:JB,curveLinear:Im,curveMonotoneX:ZB,curveMonotoneY:eF,curveNatural:tF,curveStep:nF,curveStepAfter:aF,curveStepBefore:rF},hf=function(t){return t.x===+t.x&&t.y===+t.y},mc=function(t){return t.x},xc=function(t){return t.y},Zte=function(t,n){if(ve(t))return t;var r="curve".concat(Rm(t));return(r==="curveMonotone"||r==="curveBump")&&n?kk["".concat(r).concat(n==="vertical"?"Y":"X")]:kk[r]||Im},ene=function(t){var n=t.type,r=n===void 0?"linear":n,s=t.points,i=s===void 0?[]:s,o=t.baseLine,l=t.layout,c=t.connectNulls,u=c===void 0?!1:c,d=Zte(r,l),f=u?i.filter(function(v){return hf(v)}):i,p;if(Array.isArray(o)){var h=u?o.filter(function(v){return hf(v)}):o,m=f.map(function(v,x){return Sk(Sk({},v),{},{base:h[x]})});return l==="vertical"?p=rf().y(xc).x1(mc).x0(function(v){return v.base.x}):p=rf().x(mc).y1(xc).y0(function(v){return v.base.y}),p.defined(hf).curve(d),p(m)}return l==="vertical"&&ee(o)?p=rf().y(xc).x1(mc).x0(o):ee(o)?p=rf().x(mc).y1(xc).y0(o):p=PE().x(mc).y(xc),p.defined(hf).curve(d),p(f)},yi=function(t){var n=t.className,r=t.points,s=t.path,i=t.pathRef;if((!r||!r.length)&&!s)return null;var o=r&&r.length?ene(t):s;return b.createElement("path",Qv({},me(t,!1),Dp(t),{className:Ne("recharts-curve",n),d:o,ref:i}))},R3={exports:{}},tne="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",nne=tne,rne=nne;function D3(){}function I3(){}I3.resetWarningCache=D3;var ane=function(){function e(r,s,i,o,l,c){if(c!==rne){var u=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}e.isRequired=e;function t(){return e}var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:I3,resetWarningCache:D3};return n.PropTypes=n,n};R3.exports=ane();var sne=R3.exports;const Re=De(sne),{getOwnPropertyNames:ine,getOwnPropertySymbols:one}=Object,{hasOwnProperty:lne}=Object.prototype;function b0(e,t){return function(r,s,i){return e(r,s,i)&&t(r,s,i)}}function mf(e){return function(n,r,s){if(!n||!r||typeof n!="object"||typeof r!="object")return e(n,r,s);const{cache:i}=s,o=i.get(n),l=i.get(r);if(o&&l)return o===r&&l===n;i.set(n,r),i.set(r,n);const c=e(n,r,s);return i.delete(n),i.delete(r),c}}function cne(e){return e!=null?e[Symbol.toStringTag]:void 0}function Ck(e){return ine(e).concat(one(e))}const une=Object.hasOwn||((e,t)=>lne.call(e,t));function Xi(e,t){return e===t||!e&&!t&&e!==e&&t!==t}const dne="__v",fne="__o",pne="_owner",{getOwnPropertyDescriptor:_k,keys:Ak}=Object;function hne(e,t){return e.byteLength===t.byteLength&&hh(new Uint8Array(e),new Uint8Array(t))}function mne(e,t,n){let r=e.length;if(t.length!==r)return!1;for(;r-- >0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function xne(e,t){return e.byteLength===t.byteLength&&hh(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function gne(e,t){return Xi(e.getTime(),t.getTime())}function vne(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function yne(e,t){return e===t}function Pk(e,t,n){const r=e.size;if(r!==t.size)return!1;if(!r)return!0;const s=new Array(r),i=e.entries();let o,l,c=0;for(;(o=i.next())&&!o.done;){const u=t.entries();let d=!1,f=0;for(;(l=u.next())&&!l.done;){if(s[f]){f++;continue}const p=o.value,h=l.value;if(n.equals(p[0],h[0],c,f,e,t,n)&&n.equals(p[1],h[1],p[0],h[0],e,t,n)){d=s[f]=!0;break}f++}if(!d)return!1;c++}return!0}const bne=Xi;function jne(e,t,n){const r=Ak(e);let s=r.length;if(Ak(t).length!==s)return!1;for(;s-- >0;)if(!L3(e,t,n,r[s]))return!1;return!0}function gc(e,t,n){const r=Ck(e);let s=r.length;if(Ck(t).length!==s)return!1;let i,o,l;for(;s-- >0;)if(i=r[s],!L3(e,t,n,i)||(o=_k(e,i),l=_k(t,i),(o||l)&&(!o||!l||o.configurable!==l.configurable||o.enumerable!==l.enumerable||o.writable!==l.writable)))return!1;return!0}function wne(e,t){return Xi(e.valueOf(),t.valueOf())}function Nne(e,t){return e.source===t.source&&e.flags===t.flags}function Ek(e,t,n){const r=e.size;if(r!==t.size)return!1;if(!r)return!0;const s=new Array(r),i=e.values();let o,l;for(;(o=i.next())&&!o.done;){const c=t.values();let u=!1,d=0;for(;(l=c.next())&&!l.done;){if(!s[d]&&n.equals(o.value,l.value,o.value,l.value,e,t,n)){u=s[d]=!0;break}d++}if(!u)return!1}return!0}function hh(e,t){let n=e.byteLength;if(t.byteLength!==n||e.byteOffset!==t.byteOffset)return!1;for(;n-- >0;)if(e[n]!==t[n])return!1;return!0}function Sne(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function L3(e,t,n,r){return(r===pne||r===fne||r===dne)&&(e.$$typeof||t.$$typeof)?!0:une(t,r)&&n.equals(e[r],t[r],r,r,e,t,n)}const kne="[object ArrayBuffer]",Cne="[object Arguments]",_ne="[object Boolean]",Ane="[object DataView]",Pne="[object Date]",Ene="[object Error]",One="[object Map]",Tne="[object Number]",$ne="[object Object]",Mne="[object RegExp]",Rne="[object Set]",Dne="[object String]",Ine={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},Lne="[object URL]",zne=Object.prototype.toString;function Bne({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:s,areFunctionsEqual:i,areMapsEqual:o,areNumbersEqual:l,areObjectsEqual:c,arePrimitiveWrappersEqual:u,areRegExpsEqual:d,areSetsEqual:f,areTypedArraysEqual:p,areUrlsEqual:h,unknownTagComparators:m}){return function(x,y,g){if(x===y)return!0;if(x==null||y==null)return!1;const j=typeof x;if(j!==typeof y)return!1;if(j!=="object")return j==="number"?l(x,y,g):j==="function"?i(x,y,g):!1;const N=x.constructor;if(N!==y.constructor)return!1;if(N===Object)return c(x,y,g);if(Array.isArray(x))return t(x,y,g);if(N===Date)return r(x,y,g);if(N===RegExp)return d(x,y,g);if(N===Map)return o(x,y,g);if(N===Set)return f(x,y,g);const w=zne.call(x);if(w===Pne)return r(x,y,g);if(w===Mne)return d(x,y,g);if(w===One)return o(x,y,g);if(w===Rne)return f(x,y,g);if(w===$ne)return typeof x.then!="function"&&typeof y.then!="function"&&c(x,y,g);if(w===Lne)return h(x,y,g);if(w===Ene)return s(x,y,g);if(w===Cne)return c(x,y,g);if(Ine[w])return p(x,y,g);if(w===kne)return e(x,y,g);if(w===Ane)return n(x,y,g);if(w===_ne||w===Tne||w===Dne)return u(x,y,g);if(m){let S=m[w];if(!S){const k=cne(x);k&&(S=m[k])}if(S)return S(x,y,g)}return!1}}function Fne({circular:e,createCustomConfig:t,strict:n}){let r={areArrayBuffersEqual:hne,areArraysEqual:n?gc:mne,areDataViewsEqual:xne,areDatesEqual:gne,areErrorsEqual:vne,areFunctionsEqual:yne,areMapsEqual:n?b0(Pk,gc):Pk,areNumbersEqual:bne,areObjectsEqual:n?gc:jne,arePrimitiveWrappersEqual:wne,areRegExpsEqual:Nne,areSetsEqual:n?b0(Ek,gc):Ek,areTypedArraysEqual:n?b0(hh,gc):hh,areUrlsEqual:Sne,unknownTagComparators:void 0};if(t&&(r=Object.assign({},r,t(r))),e){const s=mf(r.areArraysEqual),i=mf(r.areMapsEqual),o=mf(r.areObjectsEqual),l=mf(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:s,areMapsEqual:i,areObjectsEqual:o,areSetsEqual:l})}return r}function Vne(e){return function(t,n,r,s,i,o,l){return e(t,n,l)}}function Une({circular:e,comparator:t,createState:n,equals:r,strict:s}){if(n)return function(l,c){const{cache:u=e?new WeakMap:void 0,meta:d}=n();return t(l,c,{cache:u,equals:r,meta:d,strict:s})};if(e)return function(l,c){return t(l,c,{cache:new WeakMap,equals:r,meta:void 0,strict:s})};const i={cache:void 0,equals:r,meta:void 0,strict:s};return function(l,c){return t(l,c,i)}}const Wne=Is();Is({strict:!0});Is({circular:!0});Is({circular:!0,strict:!0});Is({createInternalComparator:()=>Xi});Is({strict:!0,createInternalComparator:()=>Xi});Is({circular:!0,createInternalComparator:()=>Xi});Is({circular:!0,createInternalComparator:()=>Xi,strict:!0});function Is(e={}){const{circular:t=!1,createInternalComparator:n,createState:r,strict:s=!1}=e,i=Fne(e),o=Bne(i),l=n?n(o):Vne(o);return Une({circular:t,comparator:o,createState:r,equals:l,strict:s})}function qne(e){typeof requestAnimationFrame<"u"&&requestAnimationFrame(e)}function Ok(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=-1,r=function s(i){n<0&&(n=i),i-n>t?(e(i),n=-1):qne(s)};requestAnimationFrame(r)}function Jv(e){"@babel/helpers - typeof";return Jv=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Jv(e)}function Hne(e){return Yne(e)||Xne(e)||Gne(e)||Kne()}function Kne(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Gne(e,t){if(e){if(typeof e=="string")return Tk(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Tk(e,t)}}function Tk(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Xne(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Yne(e){if(Array.isArray(e))return e}function Qne(){var e={},t=function(){return null},n=!1,r=function s(i){if(!n){if(Array.isArray(i)){if(!i.length)return;var o=i,l=Hne(o),c=l[0],u=l.slice(1);if(typeof c=="number"){Ok(s.bind(null,u),c);return}s(c),Ok(s.bind(null,u));return}Jv(i)==="object"&&(e=i,t(e)),typeof i=="function"&&i()}};return{stop:function(){n=!0},start:function(i){n=!1,r(i)},subscribe:function(i){return t=i,function(){t=function(){return null}}}}}function Hu(e){"@babel/helpers - typeof";return Hu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Hu(e)}function $k(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function Mk(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?$k(Object(n),!0).forEach(function(r){z3(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$k(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function z3(e,t,n){return t=Jne(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Jne(e){var t=Zne(e,"string");return Hu(t)==="symbol"?t:String(t)}function Zne(e,t){if(Hu(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Hu(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var ere=function(t,n){return[Object.keys(t),Object.keys(n)].reduce(function(r,s){return r.filter(function(i){return s.includes(i)})})},tre=function(t){return t},nre=function(t){return t.replace(/([A-Z])/g,function(n){return"-".concat(n.toLowerCase())})},Vc=function(t,n){return Object.keys(n).reduce(function(r,s){return Mk(Mk({},r),{},z3({},s,t(s,n[s])))},{})},Rk=function(t,n,r){return t.map(function(s){return"".concat(nre(s)," ").concat(n,"ms ").concat(r)}).join(",")};function rre(e,t){return ire(e)||sre(e,t)||B3(e,t)||are()}function are(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function sre(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,s,i,o,l=[],c=!0,u=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(d){u=!0,s=d}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function ire(e){if(Array.isArray(e))return e}function ore(e){return ure(e)||cre(e)||B3(e)||lre()}function lre(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function B3(e,t){if(e){if(typeof e=="string")return Zv(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Zv(e,t)}}function cre(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function ure(e){if(Array.isArray(e))return Zv(e)}function Zv(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var mh=1e-4,F3=function(t,n){return[0,3*t,3*n-6*t,3*t-3*n+1]},V3=function(t,n){return t.map(function(r,s){return r*Math.pow(n,s)}).reduce(function(r,s){return r+s})},Dk=function(t,n){return function(r){var s=F3(t,n);return V3(s,r)}},dre=function(t,n){return function(r){var s=F3(t,n),i=[].concat(ore(s.map(function(o,l){return o*l}).slice(1)),[0]);return V3(i,r)}},Ik=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var s=n[0],i=n[1],o=n[2],l=n[3];if(n.length===1)switch(n[0]){case"linear":s=0,i=0,o=1,l=1;break;case"ease":s=.25,i=.1,o=.25,l=1;break;case"ease-in":s=.42,i=0,o=1,l=1;break;case"ease-out":s=.42,i=0,o=.58,l=1;break;case"ease-in-out":s=0,i=0,o=.58,l=1;break;default:{var c=n[0].split("(");if(c[0]==="cubic-bezier"&&c[1].split(")")[0].split(",").length===4){var u=c[1].split(")")[0].split(",").map(function(x){return parseFloat(x)}),d=rre(u,4);s=d[0],i=d[1],o=d[2],l=d[3]}}}var f=Dk(s,o),p=Dk(i,l),h=dre(s,o),m=function(y){return y>1?1:y<0?0:y},v=function(y){for(var g=y>1?1:y,j=g,N=0;N<8;++N){var w=f(j)-g,S=h(j);if(Math.abs(w-g)<mh||S<mh)return p(j);j=m(j-w/S)}return p(j)};return v.isStepper=!1,v},fre=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=t.stiff,r=n===void 0?100:n,s=t.damping,i=s===void 0?8:s,o=t.dt,l=o===void 0?17:o,c=function(d,f,p){var h=-(d-f)*r,m=p*i,v=p+(h-m)*l/1e3,x=p*l/1e3+d;return Math.abs(x-f)<mh&&Math.abs(v)<mh?[f,0]:[x,v]};return c.isStepper=!0,c.dt=l,c},pre=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var s=n[0];if(typeof s=="string")switch(s){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return Ik(s);case"spring":return fre();default:if(s.split("(")[0]==="cubic-bezier")return Ik(s)}return typeof s=="function"?s:null};function Ku(e){"@babel/helpers - typeof";return Ku=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ku(e)}function Lk(e){return xre(e)||mre(e)||U3(e)||hre()}function hre(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function mre(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function xre(e){if(Array.isArray(e))return ty(e)}function zk(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function Bt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?zk(Object(n),!0).forEach(function(r){ey(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):zk(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function ey(e,t,n){return t=gre(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function gre(e){var t=vre(e,"string");return Ku(t)==="symbol"?t:String(t)}function vre(e,t){if(Ku(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Ku(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function yre(e,t){return wre(e)||jre(e,t)||U3(e,t)||bre()}function bre(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function U3(e,t){if(e){if(typeof e=="string")return ty(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ty(e,t)}}function ty(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function jre(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,s,i,o,l=[],c=!0,u=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(d){u=!0,s=d}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function wre(e){if(Array.isArray(e))return e}var xh=function(t,n,r){return t+(n-t)*r},ny=function(t){var n=t.from,r=t.to;return n!==r},Nre=function e(t,n,r){var s=Vc(function(i,o){if(ny(o)){var l=t(o.from,o.to,o.velocity),c=yre(l,2),u=c[0],d=c[1];return Bt(Bt({},o),{},{from:u,velocity:d})}return o},n);return r<1?Vc(function(i,o){return ny(o)?Bt(Bt({},o),{},{velocity:xh(o.velocity,s[i].velocity,r),from:xh(o.from,s[i].from,r)}):o},n):e(t,s,r-1)};const Sre=function(e,t,n,r,s){var i=ere(e,t),o=i.reduce(function(x,y){return Bt(Bt({},x),{},ey({},y,[e[y],t[y]]))},{}),l=i.reduce(function(x,y){return Bt(Bt({},x),{},ey({},y,{from:e[y],velocity:0,to:t[y]}))},{}),c=-1,u,d,f=function(){return null},p=function(){return Vc(function(y,g){return g.from},l)},h=function(){return!Object.values(l).filter(ny).length},m=function(y){u||(u=y);var g=y-u,j=g/n.dt;l=Nre(n,l,j),s(Bt(Bt(Bt({},e),t),p())),u=y,h()||(c=requestAnimationFrame(f))},v=function(y){d||(d=y);var g=(y-d)/r,j=Vc(function(w,S){return xh.apply(void 0,Lk(S).concat([n(g)]))},o);if(s(Bt(Bt(Bt({},e),t),j)),g<1)c=requestAnimationFrame(f);else{var N=Vc(function(w,S){return xh.apply(void 0,Lk(S).concat([n(1)]))},o);s(Bt(Bt(Bt({},e),t),N))}};return f=n.isStepper?m:v,function(){return requestAnimationFrame(f),function(){cancelAnimationFrame(c)}}};function sl(e){"@babel/helpers - typeof";return sl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},sl(e)}var kre=["children","begin","duration","attributeName","easing","isActive","steps","from","to","canBegin","onAnimationEnd","shouldReAnimate","onAnimationReStart"];function Cre(e,t){if(e==null)return{};var n=_re(e,t),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)r=i[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function _re(e,t){if(e==null)return{};var n={},r=Object.keys(e),s,i;for(i=0;i<r.length;i++)s=r[i],!(t.indexOf(s)>=0)&&(n[s]=e[s]);return n}function j0(e){return Ore(e)||Ere(e)||Pre(e)||Are()}function Are(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Pre(e,t){if(e){if(typeof e=="string")return ry(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ry(e,t)}}function Ere(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Ore(e){if(Array.isArray(e))return ry(e)}function ry(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Bk(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function xr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Bk(Object(n),!0).forEach(function(r){_c(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Bk(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function _c(e,t,n){return t=W3(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Tre(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function $re(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,W3(r.key),r)}}function Mre(e,t,n){return t&&$re(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function W3(e){var t=Rre(e,"string");return sl(t)==="symbol"?t:String(t)}function Rre(e,t){if(sl(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(sl(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Dre(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ay(e,t)}function ay(e,t){return ay=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},ay(e,t)}function Ire(e){var t=Lre();return function(){var r=gh(e),s;if(t){var i=gh(this).constructor;s=Reflect.construct(r,arguments,i)}else s=r.apply(this,arguments);return sy(this,s)}}function sy(e,t){if(t&&(sl(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return iy(e)}function iy(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Lre(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function gh(e){return gh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},gh(e)}var Dr=function(e){Dre(n,e);var t=Ire(n);function n(r,s){var i;Tre(this,n),i=t.call(this,r,s);var o=i.props,l=o.isActive,c=o.attributeName,u=o.from,d=o.to,f=o.steps,p=o.children,h=o.duration;if(i.handleStyleChange=i.handleStyleChange.bind(iy(i)),i.changeStyle=i.changeStyle.bind(iy(i)),!l||h<=0)return i.state={style:{}},typeof p=="function"&&(i.state={style:d}),sy(i);if(f&&f.length)i.state={style:f[0].style};else if(u){if(typeof p=="function")return i.state={style:u},sy(i);i.state={style:c?_c({},c,u):u}}else i.state={style:{}};return i}return Mre(n,[{key:"componentDidMount",value:function(){var s=this.props,i=s.isActive,o=s.canBegin;this.mounted=!0,!(!i||!o)&&this.runAnimation(this.props)}},{key:"componentDidUpdate",value:function(s){var i=this.props,o=i.isActive,l=i.canBegin,c=i.attributeName,u=i.shouldReAnimate,d=i.to,f=i.from,p=this.state.style;if(l){if(!o){var h={style:c?_c({},c,d):d};this.state&&p&&(c&&p[c]!==d||!c&&p!==d)&&this.setState(h);return}if(!(Wne(s.to,d)&&s.canBegin&&s.isActive)){var m=!s.canBegin||!s.isActive;this.manager&&this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation();var v=m||u?f:s.to;if(this.state&&p){var x={style:c?_c({},c,v):v};(c&&p[c]!==v||!c&&p!==v)&&this.setState(x)}this.runAnimation(xr(xr({},this.props),{},{from:v,begin:0}))}}}},{key:"componentWillUnmount",value:function(){this.mounted=!1;var s=this.props.onAnimationEnd;this.unSubscribe&&this.unSubscribe(),this.manager&&(this.manager.stop(),this.manager=null),this.stopJSAnimation&&this.stopJSAnimation(),s&&s()}},{key:"handleStyleChange",value:function(s){this.changeStyle(s)}},{key:"changeStyle",value:function(s){this.mounted&&this.setState({style:s})}},{key:"runJSAnimation",value:function(s){var i=this,o=s.from,l=s.to,c=s.duration,u=s.easing,d=s.begin,f=s.onAnimationEnd,p=s.onAnimationStart,h=Sre(o,l,pre(u),c,this.changeStyle),m=function(){i.stopJSAnimation=h()};this.manager.start([p,d,m,c,f])}},{key:"runStepAnimation",value:function(s){var i=this,o=s.steps,l=s.begin,c=s.onAnimationStart,u=o[0],d=u.style,f=u.duration,p=f===void 0?0:f,h=function(v,x,y){if(y===0)return v;var g=x.duration,j=x.easing,N=j===void 0?"ease":j,w=x.style,S=x.properties,k=x.onAnimationEnd,C=y>0?o[y-1]:x,_=S||Object.keys(w);if(typeof N=="function"||N==="spring")return[].concat(j0(v),[i.runJSAnimation.bind(i,{from:C.style,to:w,duration:g,easing:N}),g]);var A=Rk(_,g,N),E=xr(xr(xr({},C.style),w),{},{transition:A});return[].concat(j0(v),[E,g,k]).filter(tre)};return this.manager.start([c].concat(j0(o.reduce(h,[d,Math.max(p,l)])),[s.onAnimationEnd]))}},{key:"runAnimation",value:function(s){this.manager||(this.manager=Qne());var i=s.begin,o=s.duration,l=s.attributeName,c=s.to,u=s.easing,d=s.onAnimationStart,f=s.onAnimationEnd,p=s.steps,h=s.children,m=this.manager;if(this.unSubscribe=m.subscribe(this.handleStyleChange),typeof u=="function"||typeof h=="function"||u==="spring"){this.runJSAnimation(s);return}if(p.length>1){this.runStepAnimation(s);return}var v=l?_c({},l,c):c,x=Rk(Object.keys(v),o,u);m.start([d,i,xr(xr({},v),{},{transition:x}),o,f])}},{key:"render",value:function(){var s=this.props,i=s.children;s.begin;var o=s.duration;s.attributeName,s.easing;var l=s.isActive;s.steps,s.from,s.to,s.canBegin,s.onAnimationEnd,s.shouldReAnimate,s.onAnimationReStart;var c=Cre(s,kre),u=b.Children.count(i),d=this.state.style;if(typeof i=="function")return i(d);if(!l||u===0||o<=0)return i;var f=function(h){var m=h.props,v=m.style,x=v===void 0?{}:v,y=m.className,g=b.cloneElement(h,xr(xr({},c),{},{style:xr(xr({},x),d),className:y}));return g};return u===1?f(b.Children.only(i)):O.createElement("div",null,b.Children.map(i,function(p){return f(p)}))}}]),n}(b.PureComponent);Dr.displayName="Animate";Dr.defaultProps={begin:0,duration:1e3,from:"",to:"",attributeName:"",easing:"ease",isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}};Dr.propTypes={from:Re.oneOfType([Re.object,Re.string]),to:Re.oneOfType([Re.object,Re.string]),attributeName:Re.string,duration:Re.number,begin:Re.number,easing:Re.oneOfType([Re.string,Re.func]),steps:Re.arrayOf(Re.shape({duration:Re.number.isRequired,style:Re.object.isRequired,easing:Re.oneOfType([Re.oneOf(["ease","ease-in","ease-out","ease-in-out","linear"]),Re.func]),properties:Re.arrayOf("string"),onAnimationEnd:Re.func})),children:Re.oneOfType([Re.node,Re.func]),isActive:Re.bool,canBegin:Re.bool,onAnimationEnd:Re.func,shouldReAnimate:Re.bool,onAnimationStart:Re.func,onAnimationReStart:Re.func};function Gu(e){"@babel/helpers - typeof";return Gu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Gu(e)}function vh(){return vh=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},vh.apply(this,arguments)}function zre(e,t){return Ure(e)||Vre(e,t)||Fre(e,t)||Bre()}function Bre(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Fre(e,t){if(e){if(typeof e=="string")return Fk(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Fk(e,t)}}function Fk(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Vre(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,s,i,o,l=[],c=!0,u=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(d){u=!0,s=d}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function Ure(e){if(Array.isArray(e))return e}function Vk(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function Uk(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Vk(Object(n),!0).forEach(function(r){Wre(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Vk(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Wre(e,t,n){return t=qre(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function qre(e){var t=Hre(e,"string");return Gu(t)=="symbol"?t:t+""}function Hre(e,t){if(Gu(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Gu(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Wk=function(t,n,r,s,i){var o=Math.min(Math.abs(r)/2,Math.abs(s)/2),l=s>=0?1:-1,c=r>=0?1:-1,u=s>=0&&r>=0||s<0&&r<0?1:0,d;if(o>0&&i instanceof Array){for(var f=[0,0,0,0],p=0,h=4;p<h;p++)f[p]=i[p]>o?o:i[p];d="M".concat(t,",").concat(n+l*f[0]),f[0]>0&&(d+="A ".concat(f[0],",").concat(f[0],",0,0,").concat(u,",").concat(t+c*f[0],",").concat(n)),d+="L ".concat(t+r-c*f[1],",").concat(n),f[1]>0&&(d+="A ".concat(f[1],",").concat(f[1],",0,0,").concat(u,`,
`).concat(t+r,",").concat(n+l*f[1])),d+="L ".concat(t+r,",").concat(n+s-l*f[2]),f[2]>0&&(d+="A ".concat(f[2],",").concat(f[2],",0,0,").concat(u,`,
`).concat(t+r-c*f[2],",").concat(n+s)),d+="L ".concat(t+c*f[3],",").concat(n+s),f[3]>0&&(d+="A ".concat(f[3],",").concat(f[3],",0,0,").concat(u,`,
`).concat(t,",").concat(n+s-l*f[3])),d+="Z"}else if(o>0&&i===+i&&i>0){var m=Math.min(o,i);d="M ".concat(t,",").concat(n+l*m,`
A `).concat(m,",").concat(m,",0,0,").concat(u,",").concat(t+c*m,",").concat(n,`
L `).concat(t+r-c*m,",").concat(n,`
A `).concat(m,",").concat(m,",0,0,").concat(u,",").concat(t+r,",").concat(n+l*m,`
L `).concat(t+r,",").concat(n+s-l*m,`
A `).concat(m,",").concat(m,",0,0,").concat(u,",").concat(t+r-c*m,",").concat(n+s,`
L `).concat(t+c*m,",").concat(n+s,`
A `).concat(m,",").concat(m,",0,0,").concat(u,",").concat(t,",").concat(n+s-l*m," Z")}else d="M ".concat(t,",").concat(n," h ").concat(r," v ").concat(s," h ").concat(-r," Z");return d},Kre=function(t,n){if(!t||!n)return!1;var r=t.x,s=t.y,i=n.x,o=n.y,l=n.width,c=n.height;if(Math.abs(l)>0&&Math.abs(c)>0){var u=Math.min(i,i+l),d=Math.max(i,i+l),f=Math.min(o,o+c),p=Math.max(o,o+c);return r>=u&&r<=d&&s>=f&&s<=p}return!1},Gre={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},xj=function(t){var n=Uk(Uk({},Gre),t),r=b.useRef(),s=b.useState(-1),i=zre(s,2),o=i[0],l=i[1];b.useEffect(function(){if(r.current&&r.current.getTotalLength)try{var N=r.current.getTotalLength();N&&l(N)}catch{}},[]);var c=n.x,u=n.y,d=n.width,f=n.height,p=n.radius,h=n.className,m=n.animationEasing,v=n.animationDuration,x=n.animationBegin,y=n.isAnimationActive,g=n.isUpdateAnimationActive;if(c!==+c||u!==+u||d!==+d||f!==+f||d===0||f===0)return null;var j=Ne("recharts-rectangle",h);return g?O.createElement(Dr,{canBegin:o>0,from:{width:d,height:f,x:c,y:u},to:{width:d,height:f,x:c,y:u},duration:v,animationEasing:m,isActive:g},function(N){var w=N.width,S=N.height,k=N.x,C=N.y;return O.createElement(Dr,{canBegin:o>0,from:"0px ".concat(o===-1?1:o,"px"),to:"".concat(o,"px 0px"),attributeName:"strokeDasharray",begin:x,duration:v,isActive:y,easing:m},O.createElement("path",vh({},me(n,!0),{className:j,d:Wk(k,C,w,S,p),ref:r})))}):O.createElement("path",vh({},me(n,!0),{className:j,d:Wk(c,u,d,f,p)}))},Xre=["points","className","baseLinePoints","connectNulls"];function bo(){return bo=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},bo.apply(this,arguments)}function Yre(e,t){if(e==null)return{};var n=Qre(e,t),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)r=i[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Qre(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function qk(e){return tae(e)||eae(e)||Zre(e)||Jre()}function Jre(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Zre(e,t){if(e){if(typeof e=="string")return oy(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return oy(e,t)}}function eae(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function tae(e){if(Array.isArray(e))return oy(e)}function oy(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Hk=function(t){return t&&t.x===+t.x&&t.y===+t.y},nae=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],n=[[]];return t.forEach(function(r){Hk(r)?n[n.length-1].push(r):n[n.length-1].length>0&&n.push([])}),Hk(t[0])&&n[n.length-1].push(t[0]),n[n.length-1].length<=0&&(n=n.slice(0,-1)),n},Uc=function(t,n){var r=nae(t);n&&(r=[r.reduce(function(i,o){return[].concat(qk(i),qk(o))},[])]);var s=r.map(function(i){return i.reduce(function(o,l,c){return"".concat(o).concat(c===0?"M":"L").concat(l.x,",").concat(l.y)},"")}).join("");return r.length===1?"".concat(s,"Z"):s},rae=function(t,n,r){var s=Uc(t,r);return"".concat(s.slice(-1)==="Z"?s.slice(0,-1):s,"L").concat(Uc(n.reverse(),r).slice(1))},aae=function(t){var n=t.points,r=t.className,s=t.baseLinePoints,i=t.connectNulls,o=Yre(t,Xre);if(!n||!n.length)return null;var l=Ne("recharts-polygon",r);if(s&&s.length){var c=o.stroke&&o.stroke!=="none",u=rae(n,s,i);return O.createElement("g",{className:l},O.createElement("path",bo({},me(o,!0),{fill:u.slice(-1)==="Z"?o.fill:"none",stroke:"none",d:u})),c?O.createElement("path",bo({},me(o,!0),{fill:"none",d:Uc(n,i)})):null,c?O.createElement("path",bo({},me(o,!0),{fill:"none",d:Uc(s,i)})):null)}var d=Uc(n,i);return O.createElement("path",bo({},me(o,!0),{fill:d.slice(-1)==="Z"?o.fill:"none",className:l,d}))};function ly(){return ly=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ly.apply(this,arguments)}var kd=function(t){var n=t.cx,r=t.cy,s=t.r,i=t.className,o=Ne("recharts-dot",i);return n===+n&&r===+r&&s===+s?b.createElement("circle",ly({},me(t,!1),Dp(t),{className:o,cx:n,cy:r,r:s})):null};function Xu(e){"@babel/helpers - typeof";return Xu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Xu(e)}var sae=["x","y","top","left","width","height","className"];function cy(){return cy=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},cy.apply(this,arguments)}function Kk(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function iae(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Kk(Object(n),!0).forEach(function(r){oae(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Kk(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function oae(e,t,n){return t=lae(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function lae(e){var t=cae(e,"string");return Xu(t)=="symbol"?t:t+""}function cae(e,t){if(Xu(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Xu(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function uae(e,t){if(e==null)return{};var n=dae(e,t),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)r=i[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function dae(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var fae=function(t,n,r,s,i,o){return"M".concat(t,",").concat(i,"v").concat(s,"M").concat(o,",").concat(n,"h").concat(r)},pae=function(t){var n=t.x,r=n===void 0?0:n,s=t.y,i=s===void 0?0:s,o=t.top,l=o===void 0?0:o,c=t.left,u=c===void 0?0:c,d=t.width,f=d===void 0?0:d,p=t.height,h=p===void 0?0:p,m=t.className,v=uae(t,sae),x=iae({x:r,y:i,top:l,left:u,width:f,height:h},v);return!ee(r)||!ee(i)||!ee(f)||!ee(h)||!ee(l)||!ee(u)?null:O.createElement("path",cy({},me(x,!0),{className:Ne("recharts-cross",m),d:fae(r,i,f,h,l,u)}))},hae=Xm,mae=n3,xae=ua;function gae(e,t){return e&&e.length?hae(e,xae(t),mae):void 0}var vae=gae;const yae=De(vae);var bae=Xm,jae=ua,wae=r3;function Nae(e,t){return e&&e.length?bae(e,jae(t),wae):void 0}var Sae=Nae;const kae=De(Sae);var Cae=["cx","cy","angle","ticks","axisLine"],_ae=["ticks","tick","angle","tickFormatter","stroke"];function il(e){"@babel/helpers - typeof";return il=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},il(e)}function Wc(){return Wc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Wc.apply(this,arguments)}function Gk(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function Us(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Gk(Object(n),!0).forEach(function(r){Zm(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Gk(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Xk(e,t){if(e==null)return{};var n=Aae(e,t),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)r=i[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Aae(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Pae(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Yk(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,H3(r.key),r)}}function Eae(e,t,n){return t&&Yk(e.prototype,t),n&&Yk(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Oae(e,t,n){return t=yh(t),Tae(e,q3()?Reflect.construct(t,n||[],yh(e).constructor):t.apply(e,n))}function Tae(e,t){if(t&&(il(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return $ae(e)}function $ae(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function q3(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(q3=function(){return!!e})()}function yh(e){return yh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},yh(e)}function Mae(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&uy(e,t)}function uy(e,t){return uy=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},uy(e,t)}function Zm(e,t,n){return t=H3(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function H3(e){var t=Rae(e,"string");return il(t)=="symbol"?t:t+""}function Rae(e,t){if(il(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(il(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var ex=function(e){function t(){return Pae(this,t),Oae(this,t,arguments)}return Mae(t,e),Eae(t,[{key:"getTickValueCoord",value:function(r){var s=r.coordinate,i=this.props,o=i.angle,l=i.cx,c=i.cy;return Ge(l,c,s,o)}},{key:"getTickTextAnchor",value:function(){var r=this.props.orientation,s;switch(r){case"left":s="end";break;case"right":s="start";break;default:s="middle";break}return s}},{key:"getViewBox",value:function(){var r=this.props,s=r.cx,i=r.cy,o=r.angle,l=r.ticks,c=yae(l,function(d){return d.coordinate||0}),u=kae(l,function(d){return d.coordinate||0});return{cx:s,cy:i,startAngle:o,endAngle:o,innerRadius:u.coordinate||0,outerRadius:c.coordinate||0}}},{key:"renderAxisLine",value:function(){var r=this.props,s=r.cx,i=r.cy,o=r.angle,l=r.ticks,c=r.axisLine,u=Xk(r,Cae),d=l.reduce(function(m,v){return[Math.min(m[0],v.coordinate),Math.max(m[1],v.coordinate)]},[1/0,-1/0]),f=Ge(s,i,d[0],o),p=Ge(s,i,d[1],o),h=Us(Us(Us({},me(u,!1)),{},{fill:"none"},me(c,!1)),{},{x1:f.x,y1:f.y,x2:p.x,y2:p.y});return O.createElement("line",Wc({className:"recharts-polar-radius-axis-line"},h))}},{key:"renderTicks",value:function(){var r=this,s=this.props,i=s.ticks,o=s.tick,l=s.angle,c=s.tickFormatter,u=s.stroke,d=Xk(s,_ae),f=this.getTickTextAnchor(),p=me(d,!1),h=me(o,!1),m=i.map(function(v,x){var y=r.getTickValueCoord(v),g=Us(Us(Us(Us({textAnchor:f,transform:"rotate(".concat(90-l,", ").concat(y.x,", ").concat(y.y,")")},p),{},{stroke:"none",fill:u},h),{},{index:x},y),{},{payload:v});return O.createElement(Ae,Wc({className:Ne("recharts-polar-radius-axis-tick",O3(o)),key:"tick-".concat(v.coordinate)},Oi(r.props,v,x)),t.renderTickItem(o,g,c?c(v.value,x):v.value))});return O.createElement(Ae,{className:"recharts-polar-radius-axis-ticks"},m)}},{key:"render",value:function(){var r=this.props,s=r.ticks,i=r.axisLine,o=r.tick;return!s||!s.length?null:O.createElement(Ae,{className:Ne("recharts-polar-radius-axis",this.props.className)},i&&this.renderAxisLine(),o&&this.renderTicks(),It.renderCallByParent(this.props,this.getViewBox()))}}],[{key:"renderTickItem",value:function(r,s,i){var o;return O.isValidElement(r)?o=O.cloneElement(r,s):ve(r)?o=r(s):o=O.createElement(Ti,Wc({},s,{className:"recharts-polar-radius-axis-tick-value"}),i),o}}])}(b.PureComponent);Zm(ex,"displayName","PolarRadiusAxis");Zm(ex,"axisType","radiusAxis");Zm(ex,"defaultProps",{type:"number",radiusAxisId:0,cx:0,cy:0,angle:0,orientation:"right",stroke:"#ccc",axisLine:!0,tick:!0,tickCount:5,allowDataOverflow:!1,scale:"auto",allowDuplicatedCategory:!0});function ol(e){"@babel/helpers - typeof";return ol=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ol(e)}function ni(){return ni=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ni.apply(this,arguments)}function Qk(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function Ws(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Qk(Object(n),!0).forEach(function(r){tx(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Qk(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Dae(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Jk(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,G3(r.key),r)}}function Iae(e,t,n){return t&&Jk(e.prototype,t),n&&Jk(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Lae(e,t,n){return t=bh(t),zae(e,K3()?Reflect.construct(t,n||[],bh(e).constructor):t.apply(e,n))}function zae(e,t){if(t&&(ol(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Bae(e)}function Bae(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function K3(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(K3=function(){return!!e})()}function bh(e){return bh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},bh(e)}function Fae(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&dy(e,t)}function dy(e,t){return dy=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},dy(e,t)}function tx(e,t,n){return t=G3(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function G3(e){var t=Vae(e,"string");return ol(t)=="symbol"?t:t+""}function Vae(e,t){if(ol(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(ol(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Uae=Math.PI/180,Zk=1e-5,nx=function(e){function t(){return Dae(this,t),Lae(this,t,arguments)}return Fae(t,e),Iae(t,[{key:"getTickLineCoord",value:function(r){var s=this.props,i=s.cx,o=s.cy,l=s.radius,c=s.orientation,u=s.tickSize,d=u||8,f=Ge(i,o,l,r.coordinate),p=Ge(i,o,l+(c==="inner"?-1:1)*d,r.coordinate);return{x1:f.x,y1:f.y,x2:p.x,y2:p.y}}},{key:"getTickTextAnchor",value:function(r){var s=this.props.orientation,i=Math.cos(-r.coordinate*Uae),o;return i>Zk?o=s==="outer"?"start":"end":i<-Zk?o=s==="outer"?"end":"start":o="middle",o}},{key:"renderAxisLine",value:function(){var r=this.props,s=r.cx,i=r.cy,o=r.radius,l=r.axisLine,c=r.axisLineType,u=Ws(Ws({},me(this.props,!1)),{},{fill:"none"},me(l,!1));if(c==="circle")return O.createElement(kd,ni({className:"recharts-polar-angle-axis-line"},u,{cx:s,cy:i,r:o}));var d=this.props.ticks,f=d.map(function(p){return Ge(s,i,o,p.coordinate)});return O.createElement(aae,ni({className:"recharts-polar-angle-axis-line"},u,{points:f}))}},{key:"renderTicks",value:function(){var r=this,s=this.props,i=s.ticks,o=s.tick,l=s.tickLine,c=s.tickFormatter,u=s.stroke,d=me(this.props,!1),f=me(o,!1),p=Ws(Ws({},d),{},{fill:"none"},me(l,!1)),h=i.map(function(m,v){var x=r.getTickLineCoord(m),y=r.getTickTextAnchor(m),g=Ws(Ws(Ws({textAnchor:y},d),{},{stroke:"none",fill:u},f),{},{index:v,payload:m,x:x.x2,y:x.y2});return O.createElement(Ae,ni({className:Ne("recharts-polar-angle-axis-tick",O3(o)),key:"tick-".concat(m.coordinate)},Oi(r.props,m,v)),l&&O.createElement("line",ni({className:"recharts-polar-angle-axis-tick-line"},p,x)),o&&t.renderTickItem(o,g,c?c(m.value,v):m.value))});return O.createElement(Ae,{className:"recharts-polar-angle-axis-ticks"},h)}},{key:"render",value:function(){var r=this.props,s=r.ticks,i=r.radius,o=r.axisLine;return i<=0||!s||!s.length?null:O.createElement(Ae,{className:Ne("recharts-polar-angle-axis",this.props.className)},o&&this.renderAxisLine(),this.renderTicks())}}],[{key:"renderTickItem",value:function(r,s,i){var o;return O.isValidElement(r)?o=O.cloneElement(r,s):ve(r)?o=r(s):o=O.createElement(Ti,ni({},s,{className:"recharts-polar-angle-axis-tick-value"}),i),o}}])}(b.PureComponent);tx(nx,"displayName","PolarAngleAxis");tx(nx,"axisType","angleAxis");tx(nx,"defaultProps",{type:"category",angleAxisId:0,scale:"auto",cx:0,cy:0,orientation:"outer",axisLine:!0,tickLine:!0,tickSize:8,tick:!0,hide:!1,allowDuplicatedCategory:!0});var Wae=ZE,qae=Wae(Object.getPrototypeOf,Object),Hae=qae,Kae=Ra,Gae=Hae,Xae=Da,Yae="[object Object]",Qae=Function.prototype,Jae=Object.prototype,X3=Qae.toString,Zae=Jae.hasOwnProperty,ese=X3.call(Object);function tse(e){if(!Xae(e)||Kae(e)!=Yae)return!1;var t=Gae(e);if(t===null)return!0;var n=Zae.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&X3.call(n)==ese}var nse=tse;const rse=De(nse);var ase=Ra,sse=Da,ise="[object Boolean]";function ose(e){return e===!0||e===!1||sse(e)&&ase(e)==ise}var lse=ose;const cse=De(lse);function Yu(e){"@babel/helpers - typeof";return Yu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Yu(e)}function jh(){return jh=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},jh.apply(this,arguments)}function use(e,t){return hse(e)||pse(e,t)||fse(e,t)||dse()}function dse(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function fse(e,t){if(e){if(typeof e=="string")return e5(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return e5(e,t)}}function e5(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function pse(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,s,i,o,l=[],c=!0,u=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(d){u=!0,s=d}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function hse(e){if(Array.isArray(e))return e}function t5(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function n5(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?t5(Object(n),!0).forEach(function(r){mse(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):t5(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function mse(e,t,n){return t=xse(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function xse(e){var t=gse(e,"string");return Yu(t)=="symbol"?t:t+""}function gse(e,t){if(Yu(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Yu(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var r5=function(t,n,r,s,i){var o=r-s,l;return l="M ".concat(t,",").concat(n),l+="L ".concat(t+r,",").concat(n),l+="L ".concat(t+r-o/2,",").concat(n+i),l+="L ".concat(t+r-o/2-s,",").concat(n+i),l+="L ".concat(t,",").concat(n," Z"),l},vse={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},yse=function(t){var n=n5(n5({},vse),t),r=b.useRef(),s=b.useState(-1),i=use(s,2),o=i[0],l=i[1];b.useEffect(function(){if(r.current&&r.current.getTotalLength)try{var j=r.current.getTotalLength();j&&l(j)}catch{}},[]);var c=n.x,u=n.y,d=n.upperWidth,f=n.lowerWidth,p=n.height,h=n.className,m=n.animationEasing,v=n.animationDuration,x=n.animationBegin,y=n.isUpdateAnimationActive;if(c!==+c||u!==+u||d!==+d||f!==+f||p!==+p||d===0&&f===0||p===0)return null;var g=Ne("recharts-trapezoid",h);return y?O.createElement(Dr,{canBegin:o>0,from:{upperWidth:0,lowerWidth:0,height:p,x:c,y:u},to:{upperWidth:d,lowerWidth:f,height:p,x:c,y:u},duration:v,animationEasing:m,isActive:y},function(j){var N=j.upperWidth,w=j.lowerWidth,S=j.height,k=j.x,C=j.y;return O.createElement(Dr,{canBegin:o>0,from:"0px ".concat(o===-1?1:o,"px"),to:"".concat(o,"px 0px"),attributeName:"strokeDasharray",begin:x,duration:v,easing:m},O.createElement("path",jh({},me(n,!0),{className:g,d:r5(k,C,N,w,S),ref:r})))}):O.createElement("g",null,O.createElement("path",jh({},me(n,!0),{className:g,d:r5(c,u,d,f,p)})))},bse=["option","shapeType","propTransformer","activeClassName","isActive"];function Qu(e){"@babel/helpers - typeof";return Qu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Qu(e)}function jse(e,t){if(e==null)return{};var n=wse(e,t),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)r=i[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function wse(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function a5(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function wh(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?a5(Object(n),!0).forEach(function(r){Nse(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a5(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Nse(e,t,n){return t=Sse(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Sse(e){var t=kse(e,"string");return Qu(t)=="symbol"?t:t+""}function kse(e,t){if(Qu(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Qu(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Cse(e,t){return wh(wh({},t),e)}function _se(e,t){return e==="symbols"}function s5(e){var t=e.shapeType,n=e.elementProps;switch(t){case"rectangle":return O.createElement(xj,n);case"trapezoid":return O.createElement(yse,n);case"sector":return O.createElement(M3,n);case"symbols":if(_se(t))return O.createElement(R1,n);break;default:return null}}function Ase(e){return b.isValidElement(e)?e.props:e}function Y3(e){var t=e.option,n=e.shapeType,r=e.propTransformer,s=r===void 0?Cse:r,i=e.activeClassName,o=i===void 0?"recharts-active-shape":i,l=e.isActive,c=jse(e,bse),u;if(b.isValidElement(t))u=b.cloneElement(t,wh(wh({},c),Ase(t)));else if(ve(t))u=t(c);else if(rse(t)&&!cse(t)){var d=s(t,c);u=O.createElement(s5,{shapeType:n,elementProps:d})}else{var f=c;u=O.createElement(s5,{shapeType:n,elementProps:f})}return l?O.createElement(Ae,{className:o},u):u}function rx(e,t){return t!=null&&"trapezoids"in e.props}function ax(e,t){return t!=null&&"sectors"in e.props}function Ju(e,t){return t!=null&&"points"in e.props}function Pse(e,t){var n,r,s=e.x===(t==null||(n=t.labelViewBox)===null||n===void 0?void 0:n.x)||e.x===t.x,i=e.y===(t==null||(r=t.labelViewBox)===null||r===void 0?void 0:r.y)||e.y===t.y;return s&&i}function Ese(e,t){var n=e.endAngle===t.endAngle,r=e.startAngle===t.startAngle;return n&&r}function Ose(e,t){var n=e.x===t.x,r=e.y===t.y,s=e.z===t.z;return n&&r&&s}function Tse(e,t){var n;return rx(e,t)?n=Pse:ax(e,t)?n=Ese:Ju(e,t)&&(n=Ose),n}function $se(e,t){var n;return rx(e,t)?n="trapezoids":ax(e,t)?n="sectors":Ju(e,t)&&(n="points"),n}function Mse(e,t){if(rx(e,t)){var n;return(n=t.tooltipPayload)===null||n===void 0||(n=n[0])===null||n===void 0||(n=n.payload)===null||n===void 0?void 0:n.payload}if(ax(e,t)){var r;return(r=t.tooltipPayload)===null||r===void 0||(r=r[0])===null||r===void 0||(r=r.payload)===null||r===void 0?void 0:r.payload}return Ju(e,t)?t.payload:{}}function Rse(e){var t=e.activeTooltipItem,n=e.graphicalItem,r=e.itemData,s=$se(n,t),i=Mse(n,t),o=r.filter(function(c,u){var d=$i(i,c),f=n.props[s].filter(function(m){var v=Tse(n,t);return v(m,t)}),p=n.props[s].indexOf(f[f.length-1]),h=u===p;return d&&h}),l=r.indexOf(o[o.length-1]);return l}var Wf;function ll(e){"@babel/helpers - typeof";return ll=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ll(e)}function jo(){return jo=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},jo.apply(this,arguments)}function i5(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function qe(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?i5(Object(n),!0).forEach(function(r){tr(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i5(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Dse(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o5(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,J3(r.key),r)}}function Ise(e,t,n){return t&&o5(e.prototype,t),n&&o5(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Lse(e,t,n){return t=Nh(t),zse(e,Q3()?Reflect.construct(t,n||[],Nh(e).constructor):t.apply(e,n))}function zse(e,t){if(t&&(ll(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Bse(e)}function Bse(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Q3(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Q3=function(){return!!e})()}function Nh(e){return Nh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Nh(e)}function Fse(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&fy(e,t)}function fy(e,t){return fy=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},fy(e,t)}function tr(e,t,n){return t=J3(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function J3(e){var t=Vse(e,"string");return ll(t)=="symbol"?t:t+""}function Vse(e,t){if(ll(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(ll(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var La=function(e){function t(n){var r;return Dse(this,t),r=Lse(this,t,[n]),tr(r,"pieRef",null),tr(r,"sectorRefs",[]),tr(r,"id",Hi("recharts-pie-")),tr(r,"handleAnimationEnd",function(){var s=r.props.onAnimationEnd;r.setState({isAnimationFinished:!0}),ve(s)&&s()}),tr(r,"handleAnimationStart",function(){var s=r.props.onAnimationStart;r.setState({isAnimationFinished:!1}),ve(s)&&s()}),r.state={isAnimationFinished:!n.isAnimationActive,prevIsAnimationActive:n.isAnimationActive,prevAnimationId:n.animationId,sectorToFocus:0},r}return Fse(t,e),Ise(t,[{key:"isActiveIndex",value:function(r){var s=this.props.activeIndex;return Array.isArray(s)?s.indexOf(r)!==-1:r===s}},{key:"hasActiveIndex",value:function(){var r=this.props.activeIndex;return Array.isArray(r)?r.length!==0:r||r===0}},{key:"renderLabels",value:function(r){var s=this.props.isAnimationActive;if(s&&!this.state.isAnimationFinished)return null;var i=this.props,o=i.label,l=i.labelLine,c=i.dataKey,u=i.valueKey,d=me(this.props,!1),f=me(o,!1),p=me(l,!1),h=o&&o.offsetRadius||20,m=r.map(function(v,x){var y=(v.startAngle+v.endAngle)/2,g=Ge(v.cx,v.cy,v.outerRadius+h,y),j=qe(qe(qe(qe({},d),v),{},{stroke:"none"},f),{},{index:x,textAnchor:t.getTextAnchor(g.x,v.cx)},g),N=qe(qe(qe(qe({},d),v),{},{fill:"none",stroke:v.fill},p),{},{index:x,points:[Ge(v.cx,v.cy,v.outerRadius,y),g]}),w=c;return je(c)&&je(u)?w="value":je(c)&&(w=u),O.createElement(Ae,{key:"label-".concat(v.startAngle,"-").concat(v.endAngle,"-").concat(v.midAngle,"-").concat(x)},l&&t.renderLabelLineItem(l,N,"line"),t.renderLabelItem(o,j,mt(v,w)))});return O.createElement(Ae,{className:"recharts-pie-labels"},m)}},{key:"renderSectorsStatically",value:function(r){var s=this,i=this.props,o=i.activeShape,l=i.blendStroke,c=i.inactiveShape;return r.map(function(u,d){if((u==null?void 0:u.startAngle)===0&&(u==null?void 0:u.endAngle)===0&&r.length!==1)return null;var f=s.isActiveIndex(d),p=c&&s.hasActiveIndex()?c:null,h=f?o:p,m=qe(qe({},u),{},{stroke:l?u.fill:u.stroke,tabIndex:-1});return O.createElement(Ae,jo({ref:function(x){x&&!s.sectorRefs.includes(x)&&s.sectorRefs.push(x)},tabIndex:-1,className:"recharts-pie-sector"},Oi(s.props,u,d),{key:"sector-".concat(u==null?void 0:u.startAngle,"-").concat(u==null?void 0:u.endAngle,"-").concat(u.midAngle,"-").concat(d)}),O.createElement(Y3,jo({option:h,isActive:f,shapeType:"sector"},m)))})}},{key:"renderSectorsWithAnimation",value:function(){var r=this,s=this.props,i=s.sectors,o=s.isAnimationActive,l=s.animationBegin,c=s.animationDuration,u=s.animationEasing,d=s.animationId,f=this.state,p=f.prevSectors,h=f.prevIsAnimationActive;return O.createElement(Dr,{begin:l,duration:c,isActive:o,easing:u,from:{t:0},to:{t:1},key:"pie-".concat(d,"-").concat(h),onAnimationStart:this.handleAnimationStart,onAnimationEnd:this.handleAnimationEnd},function(m){var v=m.t,x=[],y=i&&i[0],g=y.startAngle;return i.forEach(function(j,N){var w=p&&p[N],S=N>0?Ln(j,"paddingAngle",0):0;if(w){var k=At(w.endAngle-w.startAngle,j.endAngle-j.startAngle),C=qe(qe({},j),{},{startAngle:g+S,endAngle:g+k(v)+S});x.push(C),g=C.endAngle}else{var _=j.endAngle,A=j.startAngle,E=At(0,_-A),P=E(v),D=qe(qe({},j),{},{startAngle:g+S,endAngle:g+P+S});x.push(D),g=D.endAngle}}),O.createElement(Ae,null,r.renderSectorsStatically(x))})}},{key:"attachKeyboardHandlers",value:function(r){var s=this;r.onkeydown=function(i){if(!i.altKey)switch(i.key){case"ArrowLeft":{var o=++s.state.sectorToFocus%s.sectorRefs.length;s.sectorRefs[o].focus(),s.setState({sectorToFocus:o});break}case"ArrowRight":{var l=--s.state.sectorToFocus<0?s.sectorRefs.length-1:s.state.sectorToFocus%s.sectorRefs.length;s.sectorRefs[l].focus(),s.setState({sectorToFocus:l});break}case"Escape":{s.sectorRefs[s.state.sectorToFocus].blur(),s.setState({sectorToFocus:0});break}}}}},{key:"renderSectors",value:function(){var r=this.props,s=r.sectors,i=r.isAnimationActive,o=this.state.prevSectors;return i&&s&&s.length&&(!o||!$i(o,s))?this.renderSectorsWithAnimation():this.renderSectorsStatically(s)}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var r=this,s=this.props,i=s.hide,o=s.sectors,l=s.className,c=s.label,u=s.cx,d=s.cy,f=s.innerRadius,p=s.outerRadius,h=s.isAnimationActive,m=this.state.isAnimationFinished;if(i||!o||!o.length||!ee(u)||!ee(d)||!ee(f)||!ee(p))return null;var v=Ne("recharts-pie",l);return O.createElement(Ae,{tabIndex:this.props.rootTabIndex,className:v,ref:function(y){r.pieRef=y}},this.renderSectors(),c&&this.renderLabels(o),It.renderCallByParent(this.props,null,!1),(!h||m)&&Zr.renderCallByParent(this.props,o,!1))}}],[{key:"getDerivedStateFromProps",value:function(r,s){return s.prevIsAnimationActive!==r.isAnimationActive?{prevIsAnimationActive:r.isAnimationActive,prevAnimationId:r.animationId,curSectors:r.sectors,prevSectors:[],isAnimationFinished:!0}:r.isAnimationActive&&r.animationId!==s.prevAnimationId?{prevAnimationId:r.animationId,curSectors:r.sectors,prevSectors:s.curSectors,isAnimationFinished:!0}:r.sectors!==s.curSectors?{curSectors:r.sectors,isAnimationFinished:!0}:null}},{key:"getTextAnchor",value:function(r,s){return r>s?"start":r<s?"end":"middle"}},{key:"renderLabelLineItem",value:function(r,s,i){if(O.isValidElement(r))return O.cloneElement(r,s);if(ve(r))return r(s);var o=Ne("recharts-pie-label-line",typeof r!="boolean"?r.className:"");return O.createElement(yi,jo({},s,{key:i,type:"linear",className:o}))}},{key:"renderLabelItem",value:function(r,s,i){if(O.isValidElement(r))return O.cloneElement(r,s);var o=i;if(ve(r)&&(o=r(s),O.isValidElement(o)))return o;var l=Ne("recharts-pie-label-text",typeof r!="boolean"&&!ve(r)?r.className:"");return O.createElement(Ti,jo({},s,{alignmentBaseline:"middle",className:l}),o)}}])}(b.PureComponent);Wf=La;tr(La,"displayName","Pie");tr(La,"defaultProps",{stroke:"#fff",fill:"#808080",legendType:"rect",cx:"50%",cy:"50%",startAngle:0,endAngle:360,innerRadius:0,outerRadius:"80%",paddingAngle:0,labelLine:!0,hide:!1,minAngle:0,isAnimationActive:!Ms.isSsr,animationBegin:400,animationDuration:1500,animationEasing:"ease",nameKey:"name",blendStroke:!1,rootTabIndex:0});tr(La,"parseDeltaAngle",function(e,t){var n=ln(t-e),r=Math.min(Math.abs(t-e),360);return n*r});tr(La,"getRealPieData",function(e){var t=e.data,n=e.children,r=me(e,!1),s=zn(n,Vm);return t&&t.length?t.map(function(i,o){return qe(qe(qe({payload:i},r),i),s&&s[o]&&s[o].props)}):s&&s.length?s.map(function(i){return qe(qe({},r),i.props)}):[]});tr(La,"parseCoordinateOfPie",function(e,t){var n=t.top,r=t.left,s=t.width,i=t.height,o=E3(s,i),l=r+cn(e.cx,s,s/2),c=n+cn(e.cy,i,i/2),u=cn(e.innerRadius,o,0),d=cn(e.outerRadius,o,o*.8),f=e.maxRadius||Math.sqrt(s*s+i*i)/2;return{cx:l,cy:c,innerRadius:u,outerRadius:d,maxRadius:f}});tr(La,"getComposedData",function(e){var t=e.item,n=e.offset,r=t.type.defaultProps!==void 0?qe(qe({},t.type.defaultProps),t.props):t.props,s=Wf.getRealPieData(r);if(!s||!s.length)return null;var i=r.cornerRadius,o=r.startAngle,l=r.endAngle,c=r.paddingAngle,u=r.dataKey,d=r.nameKey,f=r.valueKey,p=r.tooltipType,h=Math.abs(r.minAngle),m=Wf.parseCoordinateOfPie(r,n),v=Wf.parseDeltaAngle(o,l),x=Math.abs(v),y=u;je(u)&&je(f)?(Or(!1,`Use "dataKey" to specify the value of pie,
the props "valueKey" will be deprecated in 1.1.0`),y="value"):je(u)&&(Or(!1,`Use "dataKey" to specify the value of pie,
the props "valueKey" will be deprecated in 1.1.0`),y=f);var g=s.filter(function(C){return mt(C,y,0)!==0}).length,j=(x>=360?g:g-1)*c,N=x-g*h-j,w=s.reduce(function(C,_){var A=mt(_,y,0);return C+(ee(A)?A:0)},0),S;if(w>0){var k;S=s.map(function(C,_){var A=mt(C,y,0),E=mt(C,d,_),P=(ee(A)?A:0)/w,D;_?D=k.endAngle+ln(v)*c*(A!==0?1:0):D=o;var I=D+ln(v)*((A!==0?h:0)+P*N),R=(D+I)/2,M=(m.innerRadius+m.outerRadius)/2,W=[{name:E,value:A,payload:C,dataKey:y,type:p}],T=Ge(m.cx,m.cy,M,R);return k=qe(qe(qe({percent:P,cornerRadius:i,name:E,tooltipPayload:W,midAngle:R,middleRadius:M,tooltipPosition:T},C),m),{},{value:mt(C,y),startAngle:D,endAngle:I,payload:C,paddingAngle:ln(v)*c}),k})}return qe(qe({},m),{},{sectors:S,data:s})});var Use=Math.ceil,Wse=Math.max;function qse(e,t,n,r){for(var s=-1,i=Wse(Use((t-e)/(n||1)),0),o=Array(i);i--;)o[r?i:++s]=e,e+=n;return o}var Hse=qse,Kse=vO,l5=1/0,Gse=17976931348623157e292;function Xse(e){if(!e)return e===0?e:0;if(e=Kse(e),e===l5||e===-l5){var t=e<0?-1:1;return t*Gse}return e===e?e:0}var Z3=Xse,Yse=Hse,Qse=Fm,w0=Z3;function Jse(e){return function(t,n,r){return r&&typeof r!="number"&&Qse(t,n,r)&&(n=r=void 0),t=w0(t),n===void 0?(n=t,t=0):n=w0(n),r=r===void 0?t<n?1:-1:w0(r),Yse(t,n,r,e)}}var Zse=Jse,eie=Zse,tie=eie(),nie=tie;const Sh=De(nie);function Zu(e){"@babel/helpers - typeof";return Zu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Zu(e)}function c5(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function u5(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?c5(Object(n),!0).forEach(function(r){eT(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):c5(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function eT(e,t,n){return t=rie(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function rie(e){var t=aie(e,"string");return Zu(t)=="symbol"?t:t+""}function aie(e,t){if(Zu(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Zu(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var sie=["Webkit","Moz","O","ms"],iie=function(t,n){var r=t.replace(/(\w)/,function(i){return i.toUpperCase()}),s=sie.reduce(function(i,o){return u5(u5({},i),{},eT({},o+r,n))},{});return s[t]=n,s};function cl(e){"@babel/helpers - typeof";return cl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},cl(e)}function kh(){return kh=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},kh.apply(this,arguments)}function d5(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function N0(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?d5(Object(n),!0).forEach(function(r){Tn(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):d5(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function oie(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function f5(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,nT(r.key),r)}}function lie(e,t,n){return t&&f5(e.prototype,t),n&&f5(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function cie(e,t,n){return t=Ch(t),uie(e,tT()?Reflect.construct(t,n||[],Ch(e).constructor):t.apply(e,n))}function uie(e,t){if(t&&(cl(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return die(e)}function die(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function tT(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(tT=function(){return!!e})()}function Ch(e){return Ch=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Ch(e)}function fie(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&py(e,t)}function py(e,t){return py=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},py(e,t)}function Tn(e,t,n){return t=nT(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function nT(e){var t=pie(e,"string");return cl(t)=="symbol"?t:t+""}function pie(e,t){if(cl(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(cl(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var hie=function(t){var n=t.data,r=t.startIndex,s=t.endIndex,i=t.x,o=t.width,l=t.travellerWidth;if(!n||!n.length)return{};var c=n.length,u=Bc().domain(Sh(0,c)).range([i,i+o-l]),d=u.domain().map(function(f){return u(f)});return{isTextActive:!1,isSlideMoving:!1,isTravellerMoving:!1,isTravellerFocused:!1,startX:u(r),endX:u(s),scale:u,scaleValues:d}},p5=function(t){return t.changedTouches&&!!t.changedTouches.length},ul=function(e){function t(n){var r;return oie(this,t),r=cie(this,t,[n]),Tn(r,"handleDrag",function(s){r.leaveTimer&&(clearTimeout(r.leaveTimer),r.leaveTimer=null),r.state.isTravellerMoving?r.handleTravellerMove(s):r.state.isSlideMoving&&r.handleSlideDrag(s)}),Tn(r,"handleTouchMove",function(s){s.changedTouches!=null&&s.changedTouches.length>0&&r.handleDrag(s.changedTouches[0])}),Tn(r,"handleDragEnd",function(){r.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var s=r.props,i=s.endIndex,o=s.onDragEnd,l=s.startIndex;o==null||o({endIndex:i,startIndex:l})}),r.detachDragEndListener()}),Tn(r,"handleLeaveWrapper",function(){(r.state.isTravellerMoving||r.state.isSlideMoving)&&(r.leaveTimer=window.setTimeout(r.handleDragEnd,r.props.leaveTimeOut))}),Tn(r,"handleEnterSlideOrTraveller",function(){r.setState({isTextActive:!0})}),Tn(r,"handleLeaveSlideOrTraveller",function(){r.setState({isTextActive:!1})}),Tn(r,"handleSlideDragStart",function(s){var i=p5(s)?s.changedTouches[0]:s;r.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:i.pageX}),r.attachDragEndListener()}),r.travellerDragStartHandlers={startX:r.handleTravellerDragStart.bind(r,"startX"),endX:r.handleTravellerDragStart.bind(r,"endX")},r.state={},r}return fie(t,e),lie(t,[{key:"componentWillUnmount",value:function(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}},{key:"getIndex",value:function(r){var s=r.startX,i=r.endX,o=this.state.scaleValues,l=this.props,c=l.gap,u=l.data,d=u.length-1,f=Math.min(s,i),p=Math.max(s,i),h=t.getIndexInRange(o,f),m=t.getIndexInRange(o,p);return{startIndex:h-h%c,endIndex:m===d?d:m-m%c}}},{key:"getTextOfTick",value:function(r){var s=this.props,i=s.data,o=s.tickFormatter,l=s.dataKey,c=mt(i[r],l,r);return ve(o)?o(c,r):c}},{key:"attachDragEndListener",value:function(){window.addEventListener("mouseup",this.handleDragEnd,!0),window.addEventListener("touchend",this.handleDragEnd,!0),window.addEventListener("mousemove",this.handleDrag,!0)}},{key:"detachDragEndListener",value:function(){window.removeEventListener("mouseup",this.handleDragEnd,!0),window.removeEventListener("touchend",this.handleDragEnd,!0),window.removeEventListener("mousemove",this.handleDrag,!0)}},{key:"handleSlideDrag",value:function(r){var s=this.state,i=s.slideMoveStartX,o=s.startX,l=s.endX,c=this.props,u=c.x,d=c.width,f=c.travellerWidth,p=c.startIndex,h=c.endIndex,m=c.onChange,v=r.pageX-i;v>0?v=Math.min(v,u+d-f-l,u+d-f-o):v<0&&(v=Math.max(v,u-o,u-l));var x=this.getIndex({startX:o+v,endX:l+v});(x.startIndex!==p||x.endIndex!==h)&&m&&m(x),this.setState({startX:o+v,endX:l+v,slideMoveStartX:r.pageX})}},{key:"handleTravellerDragStart",value:function(r,s){var i=p5(s)?s.changedTouches[0]:s;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:r,brushMoveStartX:i.pageX}),this.attachDragEndListener()}},{key:"handleTravellerMove",value:function(r){var s=this.state,i=s.brushMoveStartX,o=s.movingTravellerId,l=s.endX,c=s.startX,u=this.state[o],d=this.props,f=d.x,p=d.width,h=d.travellerWidth,m=d.onChange,v=d.gap,x=d.data,y={startX:this.state.startX,endX:this.state.endX},g=r.pageX-i;g>0?g=Math.min(g,f+p-h-u):g<0&&(g=Math.max(g,f-u)),y[o]=u+g;var j=this.getIndex(y),N=j.startIndex,w=j.endIndex,S=function(){var C=x.length-1;return o==="startX"&&(l>c?N%v===0:w%v===0)||l<c&&w===C||o==="endX"&&(l>c?w%v===0:N%v===0)||l>c&&w===C};this.setState(Tn(Tn({},o,u+g),"brushMoveStartX",r.pageX),function(){m&&S()&&m(j)})}},{key:"handleTravellerMoveKeyboard",value:function(r,s){var i=this,o=this.state,l=o.scaleValues,c=o.startX,u=o.endX,d=this.state[s],f=l.indexOf(d);if(f!==-1){var p=f+r;if(!(p===-1||p>=l.length)){var h=l[p];s==="startX"&&h>=u||s==="endX"&&h<=c||this.setState(Tn({},s,h),function(){i.props.onChange(i.getIndex({startX:i.state.startX,endX:i.state.endX}))})}}}},{key:"renderBackground",value:function(){var r=this.props,s=r.x,i=r.y,o=r.width,l=r.height,c=r.fill,u=r.stroke;return O.createElement("rect",{stroke:u,fill:c,x:s,y:i,width:o,height:l})}},{key:"renderPanorama",value:function(){var r=this.props,s=r.x,i=r.y,o=r.width,l=r.height,c=r.data,u=r.children,d=r.padding,f=b.Children.only(u);return f?O.cloneElement(f,{x:s,y:i,width:o,height:l,margin:d,compact:!0,data:c}):null}},{key:"renderTravellerLayer",value:function(r,s){var i,o,l=this,c=this.props,u=c.y,d=c.travellerWidth,f=c.height,p=c.traveller,h=c.ariaLabel,m=c.data,v=c.startIndex,x=c.endIndex,y=Math.max(r,this.props.x),g=N0(N0({},me(this.props,!1)),{},{x:y,y:u,width:d,height:f}),j=h||"Min value: ".concat((i=m[v])===null||i===void 0?void 0:i.name,", Max value: ").concat((o=m[x])===null||o===void 0?void 0:o.name);return O.createElement(Ae,{tabIndex:0,role:"slider","aria-label":j,"aria-valuenow":r,className:"recharts-brush-traveller",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[s],onTouchStart:this.travellerDragStartHandlers[s],onKeyDown:function(w){["ArrowLeft","ArrowRight"].includes(w.key)&&(w.preventDefault(),w.stopPropagation(),l.handleTravellerMoveKeyboard(w.key==="ArrowRight"?1:-1,s))},onFocus:function(){l.setState({isTravellerFocused:!0})},onBlur:function(){l.setState({isTravellerFocused:!1})},style:{cursor:"col-resize"}},t.renderTraveller(p,g))}},{key:"renderSlide",value:function(r,s){var i=this.props,o=i.y,l=i.height,c=i.stroke,u=i.travellerWidth,d=Math.min(r,s)+u,f=Math.max(Math.abs(s-r)-u,0);return O.createElement("rect",{className:"recharts-brush-slide",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart,style:{cursor:"move"},stroke:"none",fill:c,fillOpacity:.2,x:d,y:o,width:f,height:l})}},{key:"renderText",value:function(){var r=this.props,s=r.startIndex,i=r.endIndex,o=r.y,l=r.height,c=r.travellerWidth,u=r.stroke,d=this.state,f=d.startX,p=d.endX,h=5,m={pointerEvents:"none",fill:u};return O.createElement(Ae,{className:"recharts-brush-texts"},O.createElement(Ti,kh({textAnchor:"end",verticalAnchor:"middle",x:Math.min(f,p)-h,y:o+l/2},m),this.getTextOfTick(s)),O.createElement(Ti,kh({textAnchor:"start",verticalAnchor:"middle",x:Math.max(f,p)+c+h,y:o+l/2},m),this.getTextOfTick(i)))}},{key:"render",value:function(){var r=this.props,s=r.data,i=r.className,o=r.children,l=r.x,c=r.y,u=r.width,d=r.height,f=r.alwaysShowText,p=this.state,h=p.startX,m=p.endX,v=p.isTextActive,x=p.isSlideMoving,y=p.isTravellerMoving,g=p.isTravellerFocused;if(!s||!s.length||!ee(l)||!ee(c)||!ee(u)||!ee(d)||u<=0||d<=0)return null;var j=Ne("recharts-brush",i),N=O.Children.count(o)===1,w=iie("userSelect","none");return O.createElement(Ae,{className:j,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:w},this.renderBackground(),N&&this.renderPanorama(),this.renderSlide(h,m),this.renderTravellerLayer(h,"startX"),this.renderTravellerLayer(m,"endX"),(v||x||y||g||f)&&this.renderText())}}],[{key:"renderDefaultTraveller",value:function(r){var s=r.x,i=r.y,o=r.width,l=r.height,c=r.stroke,u=Math.floor(i+l/2)-1;return O.createElement(O.Fragment,null,O.createElement("rect",{x:s,y:i,width:o,height:l,fill:c,stroke:"none"}),O.createElement("line",{x1:s+1,y1:u,x2:s+o-1,y2:u,fill:"none",stroke:"#fff"}),O.createElement("line",{x1:s+1,y1:u+2,x2:s+o-1,y2:u+2,fill:"none",stroke:"#fff"}))}},{key:"renderTraveller",value:function(r,s){var i;return O.isValidElement(r)?i=O.cloneElement(r,s):ve(r)?i=r(s):i=t.renderDefaultTraveller(s),i}},{key:"getDerivedStateFromProps",value:function(r,s){var i=r.data,o=r.width,l=r.x,c=r.travellerWidth,u=r.updateId,d=r.startIndex,f=r.endIndex;if(i!==s.prevData||u!==s.prevUpdateId)return N0({prevData:i,prevTravellerWidth:c,prevUpdateId:u,prevX:l,prevWidth:o},i&&i.length?hie({data:i,width:o,x:l,travellerWidth:c,startIndex:d,endIndex:f}):{scale:null,scaleValues:null});if(s.scale&&(o!==s.prevWidth||l!==s.prevX||c!==s.prevTravellerWidth)){s.scale.range([l,l+o-c]);var p=s.scale.domain().map(function(h){return s.scale(h)});return{prevData:i,prevTravellerWidth:c,prevUpdateId:u,prevX:l,prevWidth:o,startX:s.scale(r.startIndex),endX:s.scale(r.endIndex),scaleValues:p}}return null}},{key:"getIndexInRange",value:function(r,s){for(var i=r.length,o=0,l=i-1;l-o>1;){var c=Math.floor((o+l)/2);r[c]>s?l=c:o=c}return s>=r[l]?l:o}}])}(b.PureComponent);Tn(ul,"displayName","Brush");Tn(ul,"defaultProps",{height:40,travellerWidth:5,gap:1,fill:"#fff",stroke:"#666",padding:{top:1,right:1,bottom:1,left:1},leaveTimeOut:1e3,alwaysShowText:!1});var mie=V1;function xie(e,t){var n;return mie(e,function(r,s,i){return n=t(r,s,i),!n}),!!n}var gie=xie,vie=qE,yie=ua,bie=gie,jie=En,wie=Fm;function Nie(e,t,n){var r=jie(e)?vie:bie;return n&&wie(e,t,n)&&(t=void 0),r(e,yie(t))}var Sie=Nie;const kie=De(Sie);var ea=function(t,n){var r=t.alwaysShow,s=t.ifOverflow;return r&&(s="extendDomain"),s===n},h5=pO;function Cie(e,t,n){t=="__proto__"&&h5?h5(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}var _ie=Cie,Aie=_ie,Pie=dO,Eie=ua;function Oie(e,t){var n={};return t=Eie(t),Pie(e,function(r,s,i){Aie(n,s,t(r,s,i))}),n}var Tie=Oie;const $ie=De(Tie);function Mie(e,t){for(var n=-1,r=e==null?0:e.length;++n<r;)if(!t(e[n],n,e))return!1;return!0}var Rie=Mie,Die=V1;function Iie(e,t){var n=!0;return Die(e,function(r,s,i){return n=!!t(r,s,i),n}),n}var Lie=Iie,zie=Rie,Bie=Lie,Fie=ua,Vie=En,Uie=Fm;function Wie(e,t,n){var r=Vie(e)?zie:Bie;return n&&Uie(e,t,n)&&(t=void 0),r(e,Fie(t))}var qie=Wie;const rT=De(qie);var Hie=["x","y"];function ed(e){"@babel/helpers - typeof";return ed=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ed(e)}function hy(){return hy=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},hy.apply(this,arguments)}function m5(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function vc(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?m5(Object(n),!0).forEach(function(r){Kie(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):m5(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Kie(e,t,n){return t=Gie(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Gie(e){var t=Xie(e,"string");return ed(t)=="symbol"?t:t+""}function Xie(e,t){if(ed(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(ed(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Yie(e,t){if(e==null)return{};var n=Qie(e,t),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)r=i[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Qie(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Jie(e,t){var n=e.x,r=e.y,s=Yie(e,Hie),i="".concat(n),o=parseInt(i,10),l="".concat(r),c=parseInt(l,10),u="".concat(t.height||s.height),d=parseInt(u,10),f="".concat(t.width||s.width),p=parseInt(f,10);return vc(vc(vc(vc(vc({},t),s),o?{x:o}:{}),c?{y:c}:{}),{},{height:d,width:p,name:t.name,radius:t.radius})}function x5(e){return O.createElement(Y3,hy({shapeType:"rectangle",propTransformer:Jie,activeClassName:"recharts-active-bar"},e))}var Zie=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return function(r,s){if(typeof t=="number")return t;var i=ee(r)||j7(r);return i?t(r,s):(i||Ri(),n)}},eoe=["value","background"],aT;function dl(e){"@babel/helpers - typeof";return dl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},dl(e)}function toe(e,t){if(e==null)return{};var n=noe(e,t),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)r=i[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function noe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function _h(){return _h=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},_h.apply(this,arguments)}function g5(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function vt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?g5(Object(n),!0).forEach(function(r){as(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):g5(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function roe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function v5(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,iT(r.key),r)}}function aoe(e,t,n){return t&&v5(e.prototype,t),n&&v5(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function soe(e,t,n){return t=Ah(t),ioe(e,sT()?Reflect.construct(t,n||[],Ah(e).constructor):t.apply(e,n))}function ioe(e,t){if(t&&(dl(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return ooe(e)}function ooe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function sT(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(sT=function(){return!!e})()}function Ah(e){return Ah=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Ah(e)}function loe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&my(e,t)}function my(e,t){return my=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},my(e,t)}function as(e,t,n){return t=iT(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function iT(e){var t=coe(e,"string");return dl(t)=="symbol"?t:t+""}function coe(e,t){if(dl(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(dl(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var $a=function(e){function t(){var n;roe(this,t);for(var r=arguments.length,s=new Array(r),i=0;i<r;i++)s[i]=arguments[i];return n=soe(this,t,[].concat(s)),as(n,"state",{isAnimationFinished:!1}),as(n,"id",Hi("recharts-bar-")),as(n,"handleAnimationEnd",function(){var o=n.props.onAnimationEnd;n.setState({isAnimationFinished:!0}),o&&o()}),as(n,"handleAnimationStart",function(){var o=n.props.onAnimationStart;n.setState({isAnimationFinished:!1}),o&&o()}),n}return loe(t,e),aoe(t,[{key:"renderRectanglesStatically",value:function(r){var s=this,i=this.props,o=i.shape,l=i.dataKey,c=i.activeIndex,u=i.activeBar,d=me(this.props,!1);return r&&r.map(function(f,p){var h=p===c,m=h?u:o,v=vt(vt(vt({},d),f),{},{isActive:h,option:m,index:p,dataKey:l,onAnimationStart:s.handleAnimationStart,onAnimationEnd:s.handleAnimationEnd});return O.createElement(Ae,_h({className:"recharts-bar-rectangle"},Oi(s.props,f,p),{key:"rectangle-".concat(f==null?void 0:f.x,"-").concat(f==null?void 0:f.y,"-").concat(f==null?void 0:f.value,"-").concat(p)}),O.createElement(x5,v))})}},{key:"renderRectanglesWithAnimation",value:function(){var r=this,s=this.props,i=s.data,o=s.layout,l=s.isAnimationActive,c=s.animationBegin,u=s.animationDuration,d=s.animationEasing,f=s.animationId,p=this.state.prevData;return O.createElement(Dr,{begin:c,duration:u,isActive:l,easing:d,from:{t:0},to:{t:1},key:"bar-".concat(f),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(h){var m=h.t,v=i.map(function(x,y){var g=p&&p[y];if(g){var j=At(g.x,x.x),N=At(g.y,x.y),w=At(g.width,x.width),S=At(g.height,x.height);return vt(vt({},x),{},{x:j(m),y:N(m),width:w(m),height:S(m)})}if(o==="horizontal"){var k=At(0,x.height),C=k(m);return vt(vt({},x),{},{y:x.y+x.height-C,height:C})}var _=At(0,x.width),A=_(m);return vt(vt({},x),{},{width:A})});return O.createElement(Ae,null,r.renderRectanglesStatically(v))})}},{key:"renderRectangles",value:function(){var r=this.props,s=r.data,i=r.isAnimationActive,o=this.state.prevData;return i&&s&&s.length&&(!o||!$i(o,s))?this.renderRectanglesWithAnimation():this.renderRectanglesStatically(s)}},{key:"renderBackground",value:function(){var r=this,s=this.props,i=s.data,o=s.dataKey,l=s.activeIndex,c=me(this.props.background,!1);return i.map(function(u,d){u.value;var f=u.background,p=toe(u,eoe);if(!f)return null;var h=vt(vt(vt(vt(vt({},p),{},{fill:"#eee"},f),c),Oi(r.props,u,d)),{},{onAnimationStart:r.handleAnimationStart,onAnimationEnd:r.handleAnimationEnd,dataKey:o,index:d,className:"recharts-bar-background-rectangle"});return O.createElement(x5,_h({key:"background-bar-".concat(d),option:r.props.background,isActive:d===l},h))})}},{key:"renderErrorBar",value:function(r,s){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var i=this.props,o=i.data,l=i.xAxis,c=i.yAxis,u=i.layout,d=i.children,f=zn(d,Sd);if(!f)return null;var p=u==="vertical"?o[0].height/2:o[0].width/2,h=function(x,y){var g=Array.isArray(x.value)?x.value[1]:x.value;return{x:x.x,y:x.y,value:g,errorVal:mt(x,y)}},m={clipPath:r?"url(#clipPath-".concat(s,")"):null};return O.createElement(Ae,m,f.map(function(v){return O.cloneElement(v,{key:"error-bar-".concat(s,"-").concat(v.props.dataKey),data:o,xAxis:l,yAxis:c,layout:u,offset:p,dataPointFormatter:h})}))}},{key:"render",value:function(){var r=this.props,s=r.hide,i=r.data,o=r.className,l=r.xAxis,c=r.yAxis,u=r.left,d=r.top,f=r.width,p=r.height,h=r.isAnimationActive,m=r.background,v=r.id;if(s||!i||!i.length)return null;var x=this.state.isAnimationFinished,y=Ne("recharts-bar",o),g=l&&l.allowDataOverflow,j=c&&c.allowDataOverflow,N=g||j,w=je(v)?this.id:v;return O.createElement(Ae,{className:y},g||j?O.createElement("defs",null,O.createElement("clipPath",{id:"clipPath-".concat(w)},O.createElement("rect",{x:g?u:u-f/2,y:j?d:d-p/2,width:g?f:f*2,height:j?p:p*2}))):null,O.createElement(Ae,{className:"recharts-bar-rectangles",clipPath:N?"url(#clipPath-".concat(w,")"):null},m?this.renderBackground():null,this.renderRectangles()),this.renderErrorBar(N,w),(!h||x)&&Zr.renderCallByParent(this.props,i))}}],[{key:"getDerivedStateFromProps",value:function(r,s){return r.animationId!==s.prevAnimationId?{prevAnimationId:r.animationId,curData:r.data,prevData:s.curData}:r.data!==s.curData?{curData:r.data}:null}}])}(b.PureComponent);aT=$a;as($a,"displayName","Bar");as($a,"defaultProps",{xAxisId:0,yAxisId:0,legendType:"rect",minPointSize:0,hide:!1,data:[],layout:"vertical",activeBar:!1,isAnimationActive:!Ms.isSsr,animationBegin:0,animationDuration:400,animationEasing:"ease"});as($a,"getComposedData",function(e){var t=e.props,n=e.item,r=e.barPosition,s=e.bandSize,i=e.xAxis,o=e.yAxis,l=e.xAxisTicks,c=e.yAxisTicks,u=e.stackedData,d=e.dataStartIndex,f=e.displayedData,p=e.offset,h=zee(r,n);if(!h)return null;var m=t.layout,v=n.type.defaultProps,x=v!==void 0?vt(vt({},v),n.props):n.props,y=x.dataKey,g=x.children,j=x.minPointSize,N=m==="horizontal"?o:i,w=u?N.scale.domain():null,S=Hee({numericAxis:N}),k=zn(g,Vm),C=f.map(function(_,A){var E,P,D,I,R,M;u?E=Bee(u[d+A],w):(E=mt(_,y),Array.isArray(E)||(E=[S,E]));var W=Zie(j,aT.defaultProps.minPointSize)(E[1],A);if(m==="horizontal"){var T,V=[o.scale(E[0]),o.scale(E[1])],X=V[0],U=V[1];P=uk({axis:i,ticks:l,bandSize:s,offset:h.offset,entry:_,index:A}),D=(T=U??X)!==null&&T!==void 0?T:void 0,I=h.size;var L=X-U;if(R=Number.isNaN(L)?0:L,M={x:P,y:o.y,width:I,height:o.height},Math.abs(W)>0&&Math.abs(R)<Math.abs(W)){var B=ln(R||W)*(Math.abs(W)-Math.abs(R));D-=B,R+=B}}else{var ae=[i.scale(E[0]),i.scale(E[1])],se=ae[0],xe=ae[1];if(P=se,D=uk({axis:o,ticks:c,bandSize:s,offset:h.offset,entry:_,index:A}),I=xe-se,R=h.size,M={x:i.x,y:D,width:i.width,height:R},Math.abs(W)>0&&Math.abs(I)<Math.abs(W)){var H=ln(I||W)*(Math.abs(W)-Math.abs(I));I+=H}}return vt(vt(vt({},_),{},{x:P,y:D,width:I,height:R,value:u?E:E[1],payload:_,background:M},k&&k[A]&&k[A].props),{},{tooltipPayload:[A3(n,_)],tooltipPosition:{x:P+I/2,y:D+R/2}})});return vt({data:C,layout:m},p)});function td(e){"@babel/helpers - typeof";return td=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},td(e)}function uoe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function y5(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,oT(r.key),r)}}function doe(e,t,n){return t&&y5(e.prototype,t),n&&y5(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function b5(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function wr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?b5(Object(n),!0).forEach(function(r){sx(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):b5(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function sx(e,t,n){return t=oT(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function oT(e){var t=foe(e,"string");return td(t)=="symbol"?t:t+""}function foe(e,t){if(td(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(td(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var gj=function(t,n,r,s,i){var o=t.width,l=t.height,c=t.layout,u=t.children,d=Object.keys(n),f={left:r.left,leftMirror:r.left,right:o-r.right,rightMirror:o-r.right,top:r.top,topMirror:r.top,bottom:l-r.bottom,bottomMirror:l-r.bottom},p=!!Mn(u,$a);return d.reduce(function(h,m){var v=n[m],x=v.orientation,y=v.domain,g=v.padding,j=g===void 0?{}:g,N=v.mirror,w=v.reversed,S="".concat(x).concat(N?"Mirror":""),k,C,_,A,E;if(v.type==="number"&&(v.padding==="gap"||v.padding==="no-gap")){var P=y[1]-y[0],D=1/0,I=v.categoricalDomain.sort(S7);if(I.forEach(function(ae,se){se>0&&(D=Math.min((ae||0)-(I[se-1]||0),D))}),Number.isFinite(D)){var R=D/P,M=v.layout==="vertical"?r.height:r.width;if(v.padding==="gap"&&(k=R*M/2),v.padding==="no-gap"){var W=cn(t.barCategoryGap,R*M),T=R*M/2;k=T-W-(T-W)/M*W}}}s==="xAxis"?C=[r.left+(j.left||0)+(k||0),r.left+r.width-(j.right||0)-(k||0)]:s==="yAxis"?C=c==="horizontal"?[r.top+r.height-(j.bottom||0),r.top+(j.top||0)]:[r.top+(j.top||0)+(k||0),r.top+r.height-(j.bottom||0)-(k||0)]:C=v.range,w&&(C=[C[1],C[0]]);var V=S3(v,i,p),X=V.scale,U=V.realScaleType;X.domain(y).range(C),k3(X);var L=C3(X,wr(wr({},v),{},{realScaleType:U}));s==="xAxis"?(E=x==="top"&&!N||x==="bottom"&&N,_=r.left,A=f[S]-E*v.height):s==="yAxis"&&(E=x==="left"&&!N||x==="right"&&N,_=f[S]-E*v.width,A=r.top);var B=wr(wr(wr({},v),L),{},{realScaleType:U,x:_,y:A,scale:X,width:s==="xAxis"?r.width:v.width,height:s==="yAxis"?r.height:v.height});return B.bandSize=dh(B,L),!v.hide&&s==="xAxis"?f[S]+=(E?-1:1)*B.height:v.hide||(f[S]+=(E?-1:1)*B.width),wr(wr({},h),{},sx({},m,B))},{})},lT=function(t,n){var r=t.x,s=t.y,i=n.x,o=n.y;return{x:Math.min(r,i),y:Math.min(s,o),width:Math.abs(i-r),height:Math.abs(o-s)}},poe=function(t){var n=t.x1,r=t.y1,s=t.x2,i=t.y2;return lT({x:n,y:r},{x:s,y:i})},cT=function(){function e(t){uoe(this,e),this.scale=t}return doe(e,[{key:"domain",get:function(){return this.scale.domain}},{key:"range",get:function(){return this.scale.range}},{key:"rangeMin",get:function(){return this.range()[0]}},{key:"rangeMax",get:function(){return this.range()[1]}},{key:"bandwidth",get:function(){return this.scale.bandwidth}},{key:"apply",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=r.bandAware,i=r.position;if(n!==void 0){if(i)switch(i){case"start":return this.scale(n);case"middle":{var o=this.bandwidth?this.bandwidth()/2:0;return this.scale(n)+o}case"end":{var l=this.bandwidth?this.bandwidth():0;return this.scale(n)+l}default:return this.scale(n)}if(s){var c=this.bandwidth?this.bandwidth()/2:0;return this.scale(n)+c}return this.scale(n)}}},{key:"isInRange",value:function(n){var r=this.range(),s=r[0],i=r[r.length-1];return s<=i?n>=s&&n<=i:n>=i&&n<=s}}],[{key:"create",value:function(n){return new e(n)}}])}();sx(cT,"EPS",1e-4);var vj=function(t){var n=Object.keys(t).reduce(function(r,s){return wr(wr({},r),{},sx({},s,cT.create(t[s])))},{});return wr(wr({},n),{},{apply:function(s){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=i.bandAware,l=i.position;return $ie(s,function(c,u){return n[u].apply(c,{bandAware:o,position:l})})},isInRange:function(s){return rT(s,function(i,o){return n[o].isInRange(i)})}})};function hoe(e){return(e%180+180)%180}var moe=function(t){var n=t.width,r=t.height,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,i=hoe(s),o=i*Math.PI/180,l=Math.atan(r/n),c=o>l&&o<Math.PI-l?r/Math.sin(o):n/Math.cos(o);return Math.abs(c)},xoe=ua,goe=yd,voe=zm;function yoe(e){return function(t,n,r){var s=Object(t);if(!goe(t)){var i=xoe(n);t=voe(t),n=function(l){return i(s[l],l,s)}}var o=e(t,n,r);return o>-1?s[i?t[o]:o]:void 0}}var boe=yoe,joe=Z3;function woe(e){var t=joe(e),n=t%1;return t===t?n?t-n:t:0}var Noe=woe,Soe=sO,koe=ua,Coe=Noe,_oe=Math.max;function Aoe(e,t,n){var r=e==null?0:e.length;if(!r)return-1;var s=n==null?0:Coe(n);return s<0&&(s=_oe(r+s,0)),Soe(e,koe(t),s)}var Poe=Aoe,Eoe=boe,Ooe=Poe,Toe=Eoe(Ooe),$oe=Toe;const Moe=De($oe);var Roe=_z(function(e){return{x:e.left,y:e.top,width:e.width,height:e.height}},function(e){return["l",e.left,"t",e.top,"w",e.width,"h",e.height].join("")}),yj=b.createContext(void 0),bj=b.createContext(void 0),uT=b.createContext(void 0),dT=b.createContext({}),fT=b.createContext(void 0),pT=b.createContext(0),hT=b.createContext(0),j5=function(t){var n=t.state,r=n.xAxisMap,s=n.yAxisMap,i=n.offset,o=t.clipPathId,l=t.children,c=t.width,u=t.height,d=Roe(i);return O.createElement(yj.Provider,{value:r},O.createElement(bj.Provider,{value:s},O.createElement(dT.Provider,{value:i},O.createElement(uT.Provider,{value:d},O.createElement(fT.Provider,{value:o},O.createElement(pT.Provider,{value:u},O.createElement(hT.Provider,{value:c},l)))))))},Doe=function(){return b.useContext(fT)},mT=function(t){var n=b.useContext(yj);n==null&&Ri();var r=n[t];return r==null&&Ri(),r},Ioe=function(){var t=b.useContext(yj);return Za(t)},Loe=function(){var t=b.useContext(bj),n=Moe(t,function(r){return rT(r.domain,Number.isFinite)});return n||Za(t)},xT=function(t){var n=b.useContext(bj);n==null&&Ri();var r=n[t];return r==null&&Ri(),r},zoe=function(){var t=b.useContext(uT);return t},Boe=function(){return b.useContext(dT)},jj=function(){return b.useContext(hT)},wj=function(){return b.useContext(pT)};function fl(e){"@babel/helpers - typeof";return fl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},fl(e)}function Foe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Voe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,vT(r.key),r)}}function Uoe(e,t,n){return t&&Voe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Woe(e,t,n){return t=Ph(t),qoe(e,gT()?Reflect.construct(t,n||[],Ph(e).constructor):t.apply(e,n))}function qoe(e,t){if(t&&(fl(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Hoe(e)}function Hoe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function gT(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(gT=function(){return!!e})()}function Ph(e){return Ph=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Ph(e)}function Koe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&xy(e,t)}function xy(e,t){return xy=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},xy(e,t)}function w5(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function N5(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?w5(Object(n),!0).forEach(function(r){Nj(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):w5(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Nj(e,t,n){return t=vT(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function vT(e){var t=Goe(e,"string");return fl(t)=="symbol"?t:t+""}function Goe(e,t){if(fl(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(fl(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function Xoe(e,t){return Zoe(e)||Joe(e,t)||Qoe(e,t)||Yoe()}function Yoe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Qoe(e,t){if(e){if(typeof e=="string")return S5(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return S5(e,t)}}function S5(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Joe(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,s,i,o,l=[],c=!0,u=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(d){u=!0,s=d}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function Zoe(e){if(Array.isArray(e))return e}function gy(){return gy=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},gy.apply(this,arguments)}var ele=function(t,n){var r;return O.isValidElement(t)?r=O.cloneElement(t,n):ve(t)?r=t(n):r=O.createElement("line",gy({},n,{className:"recharts-reference-line-line"})),r},tle=function(t,n,r,s,i,o,l,c,u){var d=i.x,f=i.y,p=i.width,h=i.height;if(r){var m=u.y,v=t.y.apply(m,{position:o});if(ea(u,"discard")&&!t.y.isInRange(v))return null;var x=[{x:d+p,y:v},{x:d,y:v}];return c==="left"?x.reverse():x}if(n){var y=u.x,g=t.x.apply(y,{position:o});if(ea(u,"discard")&&!t.x.isInRange(g))return null;var j=[{x:g,y:f+h},{x:g,y:f}];return l==="top"?j.reverse():j}if(s){var N=u.segment,w=N.map(function(S){return t.apply(S,{position:o})});return ea(u,"discard")&&kie(w,function(S){return!t.isInRange(S)})?null:w}return null};function nle(e){var t=e.x,n=e.y,r=e.segment,s=e.xAxisId,i=e.yAxisId,o=e.shape,l=e.className,c=e.alwaysShow,u=Doe(),d=mT(s),f=xT(i),p=zoe();if(!u||!p)return null;Or(c===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.');var h=vj({x:d.scale,y:f.scale}),m=Et(t),v=Et(n),x=r&&r.length===2,y=tle(h,m,v,x,p,e.position,d.orientation,f.orientation,e);if(!y)return null;var g=Xoe(y,2),j=g[0],N=j.x,w=j.y,S=g[1],k=S.x,C=S.y,_=ea(e,"hidden")?"url(#".concat(u,")"):void 0,A=N5(N5({clipPath:_},me(e,!0)),{},{x1:N,y1:w,x2:k,y2:C});return O.createElement(Ae,{className:Ne("recharts-reference-line",l)},ele(o,A),It.renderCallByParent(e,poe({x1:N,y1:w,x2:k,y2:C})))}var Sj=function(e){function t(){return Foe(this,t),Woe(this,t,arguments)}return Koe(t,e),Uoe(t,[{key:"render",value:function(){return O.createElement(nle,this.props)}}])}(O.Component);Nj(Sj,"displayName","ReferenceLine");Nj(Sj,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,fill:"none",stroke:"#ccc",fillOpacity:1,strokeWidth:1,position:"middle"});function vy(){return vy=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},vy.apply(this,arguments)}function pl(e){"@babel/helpers - typeof";return pl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},pl(e)}function k5(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function C5(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?k5(Object(n),!0).forEach(function(r){ix(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):k5(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function rle(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ale(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,bT(r.key),r)}}function sle(e,t,n){return t&&ale(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function ile(e,t,n){return t=Eh(t),ole(e,yT()?Reflect.construct(t,n||[],Eh(e).constructor):t.apply(e,n))}function ole(e,t){if(t&&(pl(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return lle(e)}function lle(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function yT(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(yT=function(){return!!e})()}function Eh(e){return Eh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Eh(e)}function cle(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&yy(e,t)}function yy(e,t){return yy=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},yy(e,t)}function ix(e,t,n){return t=bT(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function bT(e){var t=ule(e,"string");return pl(t)=="symbol"?t:t+""}function ule(e,t){if(pl(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(pl(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var dle=function(t){var n=t.x,r=t.y,s=t.xAxis,i=t.yAxis,o=vj({x:s.scale,y:i.scale}),l=o.apply({x:n,y:r},{bandAware:!0});return ea(t,"discard")&&!o.isInRange(l)?null:l},ox=function(e){function t(){return rle(this,t),ile(this,t,arguments)}return cle(t,e),sle(t,[{key:"render",value:function(){var r=this.props,s=r.x,i=r.y,o=r.r,l=r.alwaysShow,c=r.clipPathId,u=Et(s),d=Et(i);if(Or(l===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.'),!u||!d)return null;var f=dle(this.props);if(!f)return null;var p=f.x,h=f.y,m=this.props,v=m.shape,x=m.className,y=ea(this.props,"hidden")?"url(#".concat(c,")"):void 0,g=C5(C5({clipPath:y},me(this.props,!0)),{},{cx:p,cy:h});return O.createElement(Ae,{className:Ne("recharts-reference-dot",x)},t.renderDot(v,g),It.renderCallByParent(this.props,{x:p-o,y:h-o,width:2*o,height:2*o}))}}])}(O.Component);ix(ox,"displayName","ReferenceDot");ix(ox,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,r:10,fill:"#fff",stroke:"#ccc",fillOpacity:1,strokeWidth:1});ix(ox,"renderDot",function(e,t){var n;return O.isValidElement(e)?n=O.cloneElement(e,t):ve(e)?n=e(t):n=O.createElement(kd,vy({},t,{cx:t.cx,cy:t.cy,className:"recharts-reference-dot-dot"})),n});function by(){return by=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},by.apply(this,arguments)}function hl(e){"@babel/helpers - typeof";return hl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},hl(e)}function _5(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function A5(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?_5(Object(n),!0).forEach(function(r){lx(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_5(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function fle(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ple(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,wT(r.key),r)}}function hle(e,t,n){return t&&ple(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function mle(e,t,n){return t=Oh(t),xle(e,jT()?Reflect.construct(t,n||[],Oh(e).constructor):t.apply(e,n))}function xle(e,t){if(t&&(hl(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return gle(e)}function gle(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function jT(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(jT=function(){return!!e})()}function Oh(e){return Oh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Oh(e)}function vle(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&jy(e,t)}function jy(e,t){return jy=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},jy(e,t)}function lx(e,t,n){return t=wT(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function wT(e){var t=yle(e,"string");return hl(t)=="symbol"?t:t+""}function yle(e,t){if(hl(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(hl(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var ble=function(t,n,r,s,i){var o=i.x1,l=i.x2,c=i.y1,u=i.y2,d=i.xAxis,f=i.yAxis;if(!d||!f)return null;var p=vj({x:d.scale,y:f.scale}),h={x:t?p.x.apply(o,{position:"start"}):p.x.rangeMin,y:r?p.y.apply(c,{position:"start"}):p.y.rangeMin},m={x:n?p.x.apply(l,{position:"end"}):p.x.rangeMax,y:s?p.y.apply(u,{position:"end"}):p.y.rangeMax};return ea(i,"discard")&&(!p.isInRange(h)||!p.isInRange(m))?null:lT(h,m)},cx=function(e){function t(){return fle(this,t),mle(this,t,arguments)}return vle(t,e),hle(t,[{key:"render",value:function(){var r=this.props,s=r.x1,i=r.x2,o=r.y1,l=r.y2,c=r.className,u=r.alwaysShow,d=r.clipPathId;Or(u===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.');var f=Et(s),p=Et(i),h=Et(o),m=Et(l),v=this.props.shape;if(!f&&!p&&!h&&!m&&!v)return null;var x=ble(f,p,h,m,this.props);if(!x&&!v)return null;var y=ea(this.props,"hidden")?"url(#".concat(d,")"):void 0;return O.createElement(Ae,{className:Ne("recharts-reference-area",c)},t.renderRect(v,A5(A5({clipPath:y},me(this.props,!0)),x)),It.renderCallByParent(this.props,x))}}])}(O.Component);lx(cx,"displayName","ReferenceArea");lx(cx,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,r:10,fill:"#ccc",fillOpacity:.5,stroke:"none",strokeWidth:1});lx(cx,"renderRect",function(e,t){var n;return O.isValidElement(e)?n=O.cloneElement(e,t):ve(e)?n=e(t):n=O.createElement(xj,by({},t,{className:"recharts-reference-area-rect"})),n});function NT(e,t,n){if(t<1)return[];if(t===1&&n===void 0)return e;for(var r=[],s=0;s<e.length;s+=t)r.push(e[s]);return r}function jle(e,t,n){var r={width:e.width+t.width,height:e.height+t.height};return moe(r,n)}function wle(e,t,n){var r=n==="width",s=e.x,i=e.y,o=e.width,l=e.height;return t===1?{start:r?s:i,end:r?s+o:i+l}:{start:r?s+o:i+l,end:r?s:i}}function Th(e,t,n,r,s){if(e*t<e*r||e*t>e*s)return!1;var i=n();return e*(t-e*i/2-r)>=0&&e*(t+e*i/2-s)<=0}function Nle(e,t){return NT(e,t+1)}function Sle(e,t,n,r,s){for(var i=(r||[]).slice(),o=t.start,l=t.end,c=0,u=1,d=o,f=function(){var m=r==null?void 0:r[c];if(m===void 0)return{v:NT(r,u)};var v=c,x,y=function(){return x===void 0&&(x=n(m,v)),x},g=m.coordinate,j=c===0||Th(e,g,y,d,l);j||(c=0,d=o,u+=1),j&&(d=g+e*(y()/2+s),c+=u)},p;u<=i.length;)if(p=f(),p)return p.v;return[]}function nd(e){"@babel/helpers - typeof";return nd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},nd(e)}function P5(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function Jt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?P5(Object(n),!0).forEach(function(r){kle(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):P5(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function kle(e,t,n){return t=Cle(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Cle(e){var t=_le(e,"string");return nd(t)=="symbol"?t:t+""}function _le(e,t){if(nd(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(nd(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ale(e,t,n,r,s){for(var i=(r||[]).slice(),o=i.length,l=t.start,c=t.end,u=function(p){var h=i[p],m,v=function(){return m===void 0&&(m=n(h,p)),m};if(p===o-1){var x=e*(h.coordinate+e*v()/2-c);i[p]=h=Jt(Jt({},h),{},{tickCoord:x>0?h.coordinate-x*e:h.coordinate})}else i[p]=h=Jt(Jt({},h),{},{tickCoord:h.coordinate});var y=Th(e,h.tickCoord,v,l,c);y&&(c=h.tickCoord-e*(v()/2+s),i[p]=Jt(Jt({},h),{},{isShow:!0}))},d=o-1;d>=0;d--)u(d);return i}function Ple(e,t,n,r,s,i){var o=(r||[]).slice(),l=o.length,c=t.start,u=t.end;if(i){var d=r[l-1],f=n(d,l-1),p=e*(d.coordinate+e*f/2-u);o[l-1]=d=Jt(Jt({},d),{},{tickCoord:p>0?d.coordinate-p*e:d.coordinate});var h=Th(e,d.tickCoord,function(){return f},c,u);h&&(u=d.tickCoord-e*(f/2+s),o[l-1]=Jt(Jt({},d),{},{isShow:!0}))}for(var m=i?l-1:l,v=function(g){var j=o[g],N,w=function(){return N===void 0&&(N=n(j,g)),N};if(g===0){var S=e*(j.coordinate-e*w()/2-c);o[g]=j=Jt(Jt({},j),{},{tickCoord:S<0?j.coordinate-S*e:j.coordinate})}else o[g]=j=Jt(Jt({},j),{},{tickCoord:j.coordinate});var k=Th(e,j.tickCoord,w,c,u);k&&(c=j.tickCoord+e*(w()/2+s),o[g]=Jt(Jt({},j),{},{isShow:!0}))},x=0;x<m;x++)v(x);return o}function kj(e,t,n){var r=e.tick,s=e.ticks,i=e.viewBox,o=e.minTickGap,l=e.orientation,c=e.interval,u=e.tickFormatter,d=e.unit,f=e.angle;if(!s||!s.length||!r)return[];if(ee(c)||Ms.isSsr)return Nle(s,typeof c=="number"&&ee(c)?c:0);var p=[],h=l==="top"||l==="bottom"?"width":"height",m=d&&h==="width"?zc(d,{fontSize:t,letterSpacing:n}):{width:0,height:0},v=function(j,N){var w=ve(u)?u(j.value,N):j.value;return h==="width"?jle(zc(w,{fontSize:t,letterSpacing:n}),m,f):zc(w,{fontSize:t,letterSpacing:n})[h]},x=s.length>=2?ln(s[1].coordinate-s[0].coordinate):1,y=wle(i,x,h);return c==="equidistantPreserveStart"?Sle(x,y,v,s,o):(c==="preserveStart"||c==="preserveStartEnd"?p=Ple(x,y,v,s,o,c==="preserveStartEnd"):p=Ale(x,y,v,s,o),p.filter(function(g){return g.isShow}))}var Ele=["viewBox"],Ole=["viewBox"],Tle=["ticks"];function ml(e){"@babel/helpers - typeof";return ml=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ml(e)}function wo(){return wo=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},wo.apply(this,arguments)}function E5(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function St(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?E5(Object(n),!0).forEach(function(r){Cj(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):E5(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function S0(e,t){if(e==null)return{};var n=$le(e,t),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)r=i[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function $le(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Mle(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function O5(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,kT(r.key),r)}}function Rle(e,t,n){return t&&O5(e.prototype,t),n&&O5(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Dle(e,t,n){return t=$h(t),Ile(e,ST()?Reflect.construct(t,n||[],$h(e).constructor):t.apply(e,n))}function Ile(e,t){if(t&&(ml(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Lle(e)}function Lle(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ST(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(ST=function(){return!!e})()}function $h(e){return $h=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},$h(e)}function zle(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&wy(e,t)}function wy(e,t){return wy=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},wy(e,t)}function Cj(e,t,n){return t=kT(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function kT(e){var t=Ble(e,"string");return ml(t)=="symbol"?t:t+""}function Ble(e,t){if(ml(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(ml(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var ql=function(e){function t(n){var r;return Mle(this,t),r=Dle(this,t,[n]),r.state={fontSize:"",letterSpacing:""},r}return zle(t,e),Rle(t,[{key:"shouldComponentUpdate",value:function(r,s){var i=r.viewBox,o=S0(r,Ele),l=this.props,c=l.viewBox,u=S0(l,Ole);return!Ro(i,c)||!Ro(o,u)||!Ro(s,this.state)}},{key:"componentDidMount",value:function(){var r=this.layerReference;if(r){var s=r.getElementsByClassName("recharts-cartesian-axis-tick-value")[0];s&&this.setState({fontSize:window.getComputedStyle(s).fontSize,letterSpacing:window.getComputedStyle(s).letterSpacing})}}},{key:"getTickLineCoord",value:function(r){var s=this.props,i=s.x,o=s.y,l=s.width,c=s.height,u=s.orientation,d=s.tickSize,f=s.mirror,p=s.tickMargin,h,m,v,x,y,g,j=f?-1:1,N=r.tickSize||d,w=ee(r.tickCoord)?r.tickCoord:r.coordinate;switch(u){case"top":h=m=r.coordinate,x=o+ +!f*c,v=x-j*N,g=v-j*p,y=w;break;case"left":v=x=r.coordinate,m=i+ +!f*l,h=m-j*N,y=h-j*p,g=w;break;case"right":v=x=r.coordinate,m=i+ +f*l,h=m+j*N,y=h+j*p,g=w;break;default:h=m=r.coordinate,x=o+ +f*c,v=x+j*N,g=v+j*p,y=w;break}return{line:{x1:h,y1:v,x2:m,y2:x},tick:{x:y,y:g}}}},{key:"getTickTextAnchor",value:function(){var r=this.props,s=r.orientation,i=r.mirror,o;switch(s){case"left":o=i?"start":"end";break;case"right":o=i?"end":"start";break;default:o="middle";break}return o}},{key:"getTickVerticalAnchor",value:function(){var r=this.props,s=r.orientation,i=r.mirror,o="end";switch(s){case"left":case"right":o="middle";break;case"top":o=i?"start":"end";break;default:o=i?"end":"start";break}return o}},{key:"renderAxisLine",value:function(){var r=this.props,s=r.x,i=r.y,o=r.width,l=r.height,c=r.orientation,u=r.mirror,d=r.axisLine,f=St(St(St({},me(this.props,!1)),me(d,!1)),{},{fill:"none"});if(c==="top"||c==="bottom"){var p=+(c==="top"&&!u||c==="bottom"&&u);f=St(St({},f),{},{x1:s,y1:i+p*l,x2:s+o,y2:i+p*l})}else{var h=+(c==="left"&&!u||c==="right"&&u);f=St(St({},f),{},{x1:s+h*o,y1:i,x2:s+h*o,y2:i+l})}return O.createElement("line",wo({},f,{className:Ne("recharts-cartesian-axis-line",Ln(d,"className"))}))}},{key:"renderTicks",value:function(r,s,i){var o=this,l=this.props,c=l.tickLine,u=l.stroke,d=l.tick,f=l.tickFormatter,p=l.unit,h=kj(St(St({},this.props),{},{ticks:r}),s,i),m=this.getTickTextAnchor(),v=this.getTickVerticalAnchor(),x=me(this.props,!1),y=me(d,!1),g=St(St({},x),{},{fill:"none"},me(c,!1)),j=h.map(function(N,w){var S=o.getTickLineCoord(N),k=S.line,C=S.tick,_=St(St(St(St({textAnchor:m,verticalAnchor:v},x),{},{stroke:"none",fill:u},y),C),{},{index:w,payload:N,visibleTicksCount:h.length,tickFormatter:f});return O.createElement(Ae,wo({className:"recharts-cartesian-axis-tick",key:"tick-".concat(N.value,"-").concat(N.coordinate,"-").concat(N.tickCoord)},Oi(o.props,N,w)),c&&O.createElement("line",wo({},g,k,{className:Ne("recharts-cartesian-axis-tick-line",Ln(c,"className"))})),d&&t.renderTickItem(d,_,"".concat(ve(f)?f(N.value,w):N.value).concat(p||"")))});return O.createElement("g",{className:"recharts-cartesian-axis-ticks"},j)}},{key:"render",value:function(){var r=this,s=this.props,i=s.axisLine,o=s.width,l=s.height,c=s.ticksGenerator,u=s.className,d=s.hide;if(d)return null;var f=this.props,p=f.ticks,h=S0(f,Tle),m=p;return ve(c)&&(m=p&&p.length>0?c(this.props):c(h)),o<=0||l<=0||!m||!m.length?null:O.createElement(Ae,{className:Ne("recharts-cartesian-axis",u),ref:function(x){r.layerReference=x}},i&&this.renderAxisLine(),this.renderTicks(m,this.state.fontSize,this.state.letterSpacing),It.renderCallByParent(this.props))}}],[{key:"renderTickItem",value:function(r,s,i){var o,l=Ne(s.className,"recharts-cartesian-axis-tick-value");return O.isValidElement(r)?o=O.cloneElement(r,St(St({},s),{},{className:l})):ve(r)?o=r(St(St({},s),{},{className:l})):o=O.createElement(Ti,wo({},s,{className:"recharts-cartesian-axis-tick-value"}),i),o}}])}(b.Component);Cj(ql,"displayName","CartesianAxis");Cj(ql,"defaultProps",{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"});var Fle=["x1","y1","x2","y2","key"],Vle=["offset"];function Di(e){"@babel/helpers - typeof";return Di=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Di(e)}function T5(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function en(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?T5(Object(n),!0).forEach(function(r){Ule(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):T5(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Ule(e,t,n){return t=Wle(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Wle(e){var t=qle(e,"string");return Di(t)=="symbol"?t:t+""}function qle(e,t){if(Di(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Di(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ci(){return ci=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ci.apply(this,arguments)}function $5(e,t){if(e==null)return{};var n=Hle(e,t),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)r=i[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Hle(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var Kle=function(t){var n=t.fill;if(!n||n==="none")return null;var r=t.fillOpacity,s=t.x,i=t.y,o=t.width,l=t.height,c=t.ry;return O.createElement("rect",{x:s,y:i,ry:c,width:o,height:l,stroke:"none",fill:n,fillOpacity:r,className:"recharts-cartesian-grid-bg"})};function CT(e,t){var n;if(O.isValidElement(e))n=O.cloneElement(e,t);else if(ve(e))n=e(t);else{var r=t.x1,s=t.y1,i=t.x2,o=t.y2,l=t.key,c=$5(t,Fle),u=me(c,!1);u.offset;var d=$5(u,Vle);n=O.createElement("line",ci({},d,{x1:r,y1:s,x2:i,y2:o,fill:"none",key:l}))}return n}function Gle(e){var t=e.x,n=e.width,r=e.horizontal,s=r===void 0?!0:r,i=e.horizontalPoints;if(!s||!i||!i.length)return null;var o=i.map(function(l,c){var u=en(en({},e),{},{x1:t,y1:l,x2:t+n,y2:l,key:"line-".concat(c),index:c});return CT(s,u)});return O.createElement("g",{className:"recharts-cartesian-grid-horizontal"},o)}function Xle(e){var t=e.y,n=e.height,r=e.vertical,s=r===void 0?!0:r,i=e.verticalPoints;if(!s||!i||!i.length)return null;var o=i.map(function(l,c){var u=en(en({},e),{},{x1:l,y1:t,x2:l,y2:t+n,key:"line-".concat(c),index:c});return CT(s,u)});return O.createElement("g",{className:"recharts-cartesian-grid-vertical"},o)}function Yle(e){var t=e.horizontalFill,n=e.fillOpacity,r=e.x,s=e.y,i=e.width,o=e.height,l=e.horizontalPoints,c=e.horizontal,u=c===void 0?!0:c;if(!u||!t||!t.length)return null;var d=l.map(function(p){return Math.round(p+s-s)}).sort(function(p,h){return p-h});s!==d[0]&&d.unshift(0);var f=d.map(function(p,h){var m=!d[h+1],v=m?s+o-p:d[h+1]-p;if(v<=0)return null;var x=h%t.length;return O.createElement("rect",{key:"react-".concat(h),y:p,x:r,height:v,width:i,stroke:"none",fill:t[x],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return O.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},f)}function Qle(e){var t=e.vertical,n=t===void 0?!0:t,r=e.verticalFill,s=e.fillOpacity,i=e.x,o=e.y,l=e.width,c=e.height,u=e.verticalPoints;if(!n||!r||!r.length)return null;var d=u.map(function(p){return Math.round(p+i-i)}).sort(function(p,h){return p-h});i!==d[0]&&d.unshift(0);var f=d.map(function(p,h){var m=!d[h+1],v=m?i+l-p:d[h+1]-p;if(v<=0)return null;var x=h%r.length;return O.createElement("rect",{key:"react-".concat(h),x:p,y:o,width:v,height:c,stroke:"none",fill:r[x],fillOpacity:s,className:"recharts-cartesian-grid-bg"})});return O.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},f)}var Jle=function(t,n){var r=t.xAxis,s=t.width,i=t.height,o=t.offset;return N3(kj(en(en(en({},ql.defaultProps),r),{},{ticks:ba(r,!0),viewBox:{x:0,y:0,width:s,height:i}})),o.left,o.left+o.width,n)},Zle=function(t,n){var r=t.yAxis,s=t.width,i=t.height,o=t.offset;return N3(kj(en(en(en({},ql.defaultProps),r),{},{ticks:ba(r,!0),viewBox:{x:0,y:0,width:s,height:i}})),o.top,o.top+o.height,n)},to={horizontal:!0,vertical:!0,stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function xl(e){var t,n,r,s,i,o,l=jj(),c=wj(),u=Boe(),d=en(en({},e),{},{stroke:(t=e.stroke)!==null&&t!==void 0?t:to.stroke,fill:(n=e.fill)!==null&&n!==void 0?n:to.fill,horizontal:(r=e.horizontal)!==null&&r!==void 0?r:to.horizontal,horizontalFill:(s=e.horizontalFill)!==null&&s!==void 0?s:to.horizontalFill,vertical:(i=e.vertical)!==null&&i!==void 0?i:to.vertical,verticalFill:(o=e.verticalFill)!==null&&o!==void 0?o:to.verticalFill,x:ee(e.x)?e.x:u.left,y:ee(e.y)?e.y:u.top,width:ee(e.width)?e.width:u.width,height:ee(e.height)?e.height:u.height}),f=d.x,p=d.y,h=d.width,m=d.height,v=d.syncWithTicks,x=d.horizontalValues,y=d.verticalValues,g=Ioe(),j=Loe();if(!ee(h)||h<=0||!ee(m)||m<=0||!ee(f)||f!==+f||!ee(p)||p!==+p)return null;var N=d.verticalCoordinatesGenerator||Jle,w=d.horizontalCoordinatesGenerator||Zle,S=d.horizontalPoints,k=d.verticalPoints;if((!S||!S.length)&&ve(w)){var C=x&&x.length,_=w({yAxis:j?en(en({},j),{},{ticks:C?x:j.ticks}):void 0,width:l,height:c,offset:u},C?!0:v);Or(Array.isArray(_),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(Di(_),"]")),Array.isArray(_)&&(S=_)}if((!k||!k.length)&&ve(N)){var A=y&&y.length,E=N({xAxis:g?en(en({},g),{},{ticks:A?y:g.ticks}):void 0,width:l,height:c,offset:u},A?!0:v);Or(Array.isArray(E),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(Di(E),"]")),Array.isArray(E)&&(k=E)}return O.createElement("g",{className:"recharts-cartesian-grid"},O.createElement(Kle,{fill:d.fill,fillOpacity:d.fillOpacity,x:d.x,y:d.y,width:d.width,height:d.height,ry:d.ry}),O.createElement(Gle,ci({},d,{offset:u,horizontalPoints:S,xAxis:g,yAxis:j})),O.createElement(Xle,ci({},d,{offset:u,verticalPoints:k,xAxis:g,yAxis:j})),O.createElement(Yle,ci({},d,{horizontalPoints:S})),O.createElement(Qle,ci({},d,{verticalPoints:k})))}xl.displayName="CartesianGrid";var ece=["type","layout","connectNulls","ref"],tce=["key"];function gl(e){"@babel/helpers - typeof";return gl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},gl(e)}function M5(e,t){if(e==null)return{};var n=nce(e,t),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)r=i[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function nce(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function qc(){return qc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},qc.apply(this,arguments)}function R5(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function On(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?R5(Object(n),!0).forEach(function(r){Nr(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):R5(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function no(e){return ice(e)||sce(e)||ace(e)||rce()}function rce(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ace(e,t){if(e){if(typeof e=="string")return Ny(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ny(e,t)}}function sce(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function ice(e){if(Array.isArray(e))return Ny(e)}function Ny(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function oce(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function D5(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,AT(r.key),r)}}function lce(e,t,n){return t&&D5(e.prototype,t),n&&D5(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function cce(e,t,n){return t=Mh(t),uce(e,_T()?Reflect.construct(t,n||[],Mh(e).constructor):t.apply(e,n))}function uce(e,t){if(t&&(gl(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return dce(e)}function dce(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _T(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(_T=function(){return!!e})()}function Mh(e){return Mh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Mh(e)}function fce(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Sy(e,t)}function Sy(e,t){return Sy=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},Sy(e,t)}function Nr(e,t,n){return t=AT(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function AT(e){var t=pce(e,"string");return gl(t)=="symbol"?t:t+""}function pce(e,t){if(gl(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(gl(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Cd=function(e){function t(){var n;oce(this,t);for(var r=arguments.length,s=new Array(r),i=0;i<r;i++)s[i]=arguments[i];return n=cce(this,t,[].concat(s)),Nr(n,"state",{isAnimationFinished:!0,totalLength:0}),Nr(n,"generateSimpleStrokeDasharray",function(o,l){return"".concat(l,"px ").concat(o-l,"px")}),Nr(n,"getStrokeDasharray",function(o,l,c){var u=c.reduce(function(y,g){return y+g});if(!u)return n.generateSimpleStrokeDasharray(l,o);for(var d=Math.floor(o/u),f=o%u,p=l-o,h=[],m=0,v=0;m<c.length;v+=c[m],++m)if(v+c[m]>f){h=[].concat(no(c.slice(0,m)),[f-v]);break}var x=h.length%2===0?[0,p]:[p];return[].concat(no(t.repeat(c,d)),no(h),x).map(function(y){return"".concat(y,"px")}).join(", ")}),Nr(n,"id",Hi("recharts-line-")),Nr(n,"pathRef",function(o){n.mainCurve=o}),Nr(n,"handleAnimationEnd",function(){n.setState({isAnimationFinished:!0}),n.props.onAnimationEnd&&n.props.onAnimationEnd()}),Nr(n,"handleAnimationStart",function(){n.setState({isAnimationFinished:!1}),n.props.onAnimationStart&&n.props.onAnimationStart()}),n}return fce(t,e),lce(t,[{key:"componentDidMount",value:function(){if(this.props.isAnimationActive){var r=this.getTotalLength();this.setState({totalLength:r})}}},{key:"componentDidUpdate",value:function(){if(this.props.isAnimationActive){var r=this.getTotalLength();r!==this.state.totalLength&&this.setState({totalLength:r})}}},{key:"getTotalLength",value:function(){var r=this.mainCurve;try{return r&&r.getTotalLength&&r.getTotalLength()||0}catch{return 0}}},{key:"renderErrorBar",value:function(r,s){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var i=this.props,o=i.points,l=i.xAxis,c=i.yAxis,u=i.layout,d=i.children,f=zn(d,Sd);if(!f)return null;var p=function(v,x){return{x:v.x,y:v.y,value:v.value,errorVal:mt(v.payload,x)}},h={clipPath:r?"url(#clipPath-".concat(s,")"):null};return O.createElement(Ae,h,f.map(function(m){return O.cloneElement(m,{key:"bar-".concat(m.props.dataKey),data:o,xAxis:l,yAxis:c,layout:u,dataPointFormatter:p})}))}},{key:"renderDots",value:function(r,s,i){var o=this.props.isAnimationActive;if(o&&!this.state.isAnimationFinished)return null;var l=this.props,c=l.dot,u=l.points,d=l.dataKey,f=me(this.props,!1),p=me(c,!0),h=u.map(function(v,x){var y=On(On(On({key:"dot-".concat(x),r:3},f),p),{},{index:x,cx:v.x,cy:v.y,value:v.value,dataKey:d,payload:v.payload,points:u});return t.renderDotItem(c,y)}),m={clipPath:r?"url(#clipPath-".concat(s?"":"dots-").concat(i,")"):null};return O.createElement(Ae,qc({className:"recharts-line-dots",key:"dots"},m),h)}},{key:"renderCurveStatically",value:function(r,s,i,o){var l=this.props,c=l.type,u=l.layout,d=l.connectNulls;l.ref;var f=M5(l,ece),p=On(On(On({},me(f,!0)),{},{fill:"none",className:"recharts-line-curve",clipPath:s?"url(#clipPath-".concat(i,")"):null,points:r},o),{},{type:c,layout:u,connectNulls:d});return O.createElement(yi,qc({},p,{pathRef:this.pathRef}))}},{key:"renderCurveWithAnimation",value:function(r,s){var i=this,o=this.props,l=o.points,c=o.strokeDasharray,u=o.isAnimationActive,d=o.animationBegin,f=o.animationDuration,p=o.animationEasing,h=o.animationId,m=o.animateNewValues,v=o.width,x=o.height,y=this.state,g=y.prevPoints,j=y.totalLength;return O.createElement(Dr,{begin:d,duration:f,isActive:u,easing:p,from:{t:0},to:{t:1},key:"line-".concat(h),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(N){var w=N.t;if(g){var S=g.length/l.length,k=l.map(function(P,D){var I=Math.floor(D*S);if(g[I]){var R=g[I],M=At(R.x,P.x),W=At(R.y,P.y);return On(On({},P),{},{x:M(w),y:W(w)})}if(m){var T=At(v*2,P.x),V=At(x/2,P.y);return On(On({},P),{},{x:T(w),y:V(w)})}return On(On({},P),{},{x:P.x,y:P.y})});return i.renderCurveStatically(k,r,s)}var C=At(0,j),_=C(w),A;if(c){var E="".concat(c).split(/[,\s]+/gim).map(function(P){return parseFloat(P)});A=i.getStrokeDasharray(_,j,E)}else A=i.generateSimpleStrokeDasharray(j,_);return i.renderCurveStatically(l,r,s,{strokeDasharray:A})})}},{key:"renderCurve",value:function(r,s){var i=this.props,o=i.points,l=i.isAnimationActive,c=this.state,u=c.prevPoints,d=c.totalLength;return l&&o&&o.length&&(!u&&d>0||!$i(u,o))?this.renderCurveWithAnimation(r,s):this.renderCurveStatically(o,r,s)}},{key:"render",value:function(){var r,s=this.props,i=s.hide,o=s.dot,l=s.points,c=s.className,u=s.xAxis,d=s.yAxis,f=s.top,p=s.left,h=s.width,m=s.height,v=s.isAnimationActive,x=s.id;if(i||!l||!l.length)return null;var y=this.state.isAnimationFinished,g=l.length===1,j=Ne("recharts-line",c),N=u&&u.allowDataOverflow,w=d&&d.allowDataOverflow,S=N||w,k=je(x)?this.id:x,C=(r=me(o,!1))!==null&&r!==void 0?r:{r:3,strokeWidth:2},_=C.r,A=_===void 0?3:_,E=C.strokeWidth,P=E===void 0?2:E,D=xE(o)?o:{},I=D.clipDot,R=I===void 0?!0:I,M=A*2+P;return O.createElement(Ae,{className:j},N||w?O.createElement("defs",null,O.createElement("clipPath",{id:"clipPath-".concat(k)},O.createElement("rect",{x:N?p:p-h/2,y:w?f:f-m/2,width:N?h:h*2,height:w?m:m*2})),!R&&O.createElement("clipPath",{id:"clipPath-dots-".concat(k)},O.createElement("rect",{x:p-M/2,y:f-M/2,width:h+M,height:m+M}))):null,!g&&this.renderCurve(S,k),this.renderErrorBar(S,k),(g||o)&&this.renderDots(S,R,k),(!v||y)&&Zr.renderCallByParent(this.props,l))}}],[{key:"getDerivedStateFromProps",value:function(r,s){return r.animationId!==s.prevAnimationId?{prevAnimationId:r.animationId,curPoints:r.points,prevPoints:s.curPoints}:r.points!==s.curPoints?{curPoints:r.points}:null}},{key:"repeat",value:function(r,s){for(var i=r.length%2!==0?[].concat(no(r),[0]):r,o=[],l=0;l<s;++l)o=[].concat(no(o),no(i));return o}},{key:"renderDotItem",value:function(r,s){var i;if(O.isValidElement(r))i=O.cloneElement(r,s);else if(ve(r))i=r(s);else{var o=s.key,l=M5(s,tce),c=Ne("recharts-line-dot",typeof r!="boolean"?r.className:"");i=O.createElement(kd,qc({key:o},l,{className:c}))}return i}}])}(b.PureComponent);Nr(Cd,"displayName","Line");Nr(Cd,"defaultProps",{xAxisId:0,yAxisId:0,connectNulls:!1,activeDot:!0,dot:!0,legendType:"line",stroke:"#3182bd",strokeWidth:1,fill:"#fff",points:[],isAnimationActive:!Ms.isSsr,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",hide:!1,label:!1});Nr(Cd,"getComposedData",function(e){var t=e.props,n=e.xAxis,r=e.yAxis,s=e.xAxisTicks,i=e.yAxisTicks,o=e.dataKey,l=e.bandSize,c=e.displayedData,u=e.offset,d=t.layout,f=c.map(function(p,h){var m=mt(p,o);return d==="horizontal"?{x:uh({axis:n,ticks:s,bandSize:l,entry:p,index:h}),y:je(m)?null:r.scale(m),value:m,payload:p}:{x:je(m)?null:n.scale(m),y:uh({axis:r,ticks:i,bandSize:l,entry:p,index:h}),value:m,payload:p}});return On({points:f,layout:d},u)});var hce=["layout","type","stroke","connectNulls","isRange","ref"],mce=["key"],PT;function vl(e){"@babel/helpers - typeof";return vl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},vl(e)}function ET(e,t){if(e==null)return{};var n=xce(e,t),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)r=i[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function xce(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function ui(){return ui=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ui.apply(this,arguments)}function I5(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function Ua(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?I5(Object(n),!0).forEach(function(r){Gr(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):I5(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function gce(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function L5(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,TT(r.key),r)}}function vce(e,t,n){return t&&L5(e.prototype,t),n&&L5(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function yce(e,t,n){return t=Rh(t),bce(e,OT()?Reflect.construct(t,n||[],Rh(e).constructor):t.apply(e,n))}function bce(e,t){if(t&&(vl(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return jce(e)}function jce(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function OT(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(OT=function(){return!!e})()}function Rh(e){return Rh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Rh(e)}function wce(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ky(e,t)}function ky(e,t){return ky=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},ky(e,t)}function Gr(e,t,n){return t=TT(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function TT(e){var t=Nce(e,"string");return vl(t)=="symbol"?t:t+""}function Nce(e,t){if(vl(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(vl(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var za=function(e){function t(){var n;gce(this,t);for(var r=arguments.length,s=new Array(r),i=0;i<r;i++)s[i]=arguments[i];return n=yce(this,t,[].concat(s)),Gr(n,"state",{isAnimationFinished:!0}),Gr(n,"id",Hi("recharts-area-")),Gr(n,"handleAnimationEnd",function(){var o=n.props.onAnimationEnd;n.setState({isAnimationFinished:!0}),ve(o)&&o()}),Gr(n,"handleAnimationStart",function(){var o=n.props.onAnimationStart;n.setState({isAnimationFinished:!1}),ve(o)&&o()}),n}return wce(t,e),vce(t,[{key:"renderDots",value:function(r,s,i){var o=this.props.isAnimationActive,l=this.state.isAnimationFinished;if(o&&!l)return null;var c=this.props,u=c.dot,d=c.points,f=c.dataKey,p=me(this.props,!1),h=me(u,!0),m=d.map(function(x,y){var g=Ua(Ua(Ua({key:"dot-".concat(y),r:3},p),h),{},{index:y,cx:x.x,cy:x.y,dataKey:f,value:x.value,payload:x.payload,points:d});return t.renderDotItem(u,g)}),v={clipPath:r?"url(#clipPath-".concat(s?"":"dots-").concat(i,")"):null};return O.createElement(Ae,ui({className:"recharts-area-dots"},v),m)}},{key:"renderHorizontalRect",value:function(r){var s=this.props,i=s.baseLine,o=s.points,l=s.strokeWidth,c=o[0].x,u=o[o.length-1].x,d=r*Math.abs(c-u),f=rs(o.map(function(p){return p.y||0}));return ee(i)&&typeof i=="number"?f=Math.max(i,f):i&&Array.isArray(i)&&i.length&&(f=Math.max(rs(i.map(function(p){return p.y||0})),f)),ee(f)?O.createElement("rect",{x:c<u?c:c-d,y:0,width:d,height:Math.floor(f+(l?parseInt("".concat(l),10):1))}):null}},{key:"renderVerticalRect",value:function(r){var s=this.props,i=s.baseLine,o=s.points,l=s.strokeWidth,c=o[0].y,u=o[o.length-1].y,d=r*Math.abs(c-u),f=rs(o.map(function(p){return p.x||0}));return ee(i)&&typeof i=="number"?f=Math.max(i,f):i&&Array.isArray(i)&&i.length&&(f=Math.max(rs(i.map(function(p){return p.x||0})),f)),ee(f)?O.createElement("rect",{x:0,y:c<u?c:c-d,width:f+(l?parseInt("".concat(l),10):1),height:Math.floor(d)}):null}},{key:"renderClipRect",value:function(r){var s=this.props.layout;return s==="vertical"?this.renderVerticalRect(r):this.renderHorizontalRect(r)}},{key:"renderAreaStatically",value:function(r,s,i,o){var l=this.props,c=l.layout,u=l.type,d=l.stroke,f=l.connectNulls,p=l.isRange;l.ref;var h=ET(l,hce);return O.createElement(Ae,{clipPath:i?"url(#clipPath-".concat(o,")"):null},O.createElement(yi,ui({},me(h,!0),{points:r,connectNulls:f,type:u,baseLine:s,layout:c,stroke:"none",className:"recharts-area-area"})),d!=="none"&&O.createElement(yi,ui({},me(this.props,!1),{className:"recharts-area-curve",layout:c,type:u,connectNulls:f,fill:"none",points:r})),d!=="none"&&p&&O.createElement(yi,ui({},me(this.props,!1),{className:"recharts-area-curve",layout:c,type:u,connectNulls:f,fill:"none",points:s})))}},{key:"renderAreaWithAnimation",value:function(r,s){var i=this,o=this.props,l=o.points,c=o.baseLine,u=o.isAnimationActive,d=o.animationBegin,f=o.animationDuration,p=o.animationEasing,h=o.animationId,m=this.state,v=m.prevPoints,x=m.prevBaseLine;return O.createElement(Dr,{begin:d,duration:f,isActive:u,easing:p,from:{t:0},to:{t:1},key:"area-".concat(h),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(y){var g=y.t;if(v){var j=v.length/l.length,N=l.map(function(C,_){var A=Math.floor(_*j);if(v[A]){var E=v[A],P=At(E.x,C.x),D=At(E.y,C.y);return Ua(Ua({},C),{},{x:P(g),y:D(g)})}return C}),w;if(ee(c)&&typeof c=="number"){var S=At(x,c);w=S(g)}else if(je(c)||Ll(c)){var k=At(x,0);w=k(g)}else w=c.map(function(C,_){var A=Math.floor(_*j);if(x[A]){var E=x[A],P=At(E.x,C.x),D=At(E.y,C.y);return Ua(Ua({},C),{},{x:P(g),y:D(g)})}return C});return i.renderAreaStatically(N,w,r,s)}return O.createElement(Ae,null,O.createElement("defs",null,O.createElement("clipPath",{id:"animationClipPath-".concat(s)},i.renderClipRect(g))),O.createElement(Ae,{clipPath:"url(#animationClipPath-".concat(s,")")},i.renderAreaStatically(l,c,r,s)))})}},{key:"renderArea",value:function(r,s){var i=this.props,o=i.points,l=i.baseLine,c=i.isAnimationActive,u=this.state,d=u.prevPoints,f=u.prevBaseLine,p=u.totalLength;return c&&o&&o.length&&(!d&&p>0||!$i(d,o)||!$i(f,l))?this.renderAreaWithAnimation(r,s):this.renderAreaStatically(o,l,r,s)}},{key:"render",value:function(){var r,s=this.props,i=s.hide,o=s.dot,l=s.points,c=s.className,u=s.top,d=s.left,f=s.xAxis,p=s.yAxis,h=s.width,m=s.height,v=s.isAnimationActive,x=s.id;if(i||!l||!l.length)return null;var y=this.state.isAnimationFinished,g=l.length===1,j=Ne("recharts-area",c),N=f&&f.allowDataOverflow,w=p&&p.allowDataOverflow,S=N||w,k=je(x)?this.id:x,C=(r=me(o,!1))!==null&&r!==void 0?r:{r:3,strokeWidth:2},_=C.r,A=_===void 0?3:_,E=C.strokeWidth,P=E===void 0?2:E,D=xE(o)?o:{},I=D.clipDot,R=I===void 0?!0:I,M=A*2+P;return O.createElement(Ae,{className:j},N||w?O.createElement("defs",null,O.createElement("clipPath",{id:"clipPath-".concat(k)},O.createElement("rect",{x:N?d:d-h/2,y:w?u:u-m/2,width:N?h:h*2,height:w?m:m*2})),!R&&O.createElement("clipPath",{id:"clipPath-dots-".concat(k)},O.createElement("rect",{x:d-M/2,y:u-M/2,width:h+M,height:m+M}))):null,g?null:this.renderArea(S,k),(o||g)&&this.renderDots(S,R,k),(!v||y)&&Zr.renderCallByParent(this.props,l))}}],[{key:"getDerivedStateFromProps",value:function(r,s){return r.animationId!==s.prevAnimationId?{prevAnimationId:r.animationId,curPoints:r.points,curBaseLine:r.baseLine,prevPoints:s.curPoints,prevBaseLine:s.curBaseLine}:r.points!==s.curPoints||r.baseLine!==s.curBaseLine?{curPoints:r.points,curBaseLine:r.baseLine}:null}}])}(b.PureComponent);PT=za;Gr(za,"displayName","Area");Gr(za,"defaultProps",{stroke:"#3182bd",fill:"#3182bd",fillOpacity:.6,xAxisId:0,yAxisId:0,legendType:"line",connectNulls:!1,points:[],dot:!1,activeDot:!0,hide:!1,isAnimationActive:!Ms.isSsr,animationBegin:0,animationDuration:1500,animationEasing:"ease"});Gr(za,"getBaseValue",function(e,t,n,r){var s=e.layout,i=e.baseValue,o=t.props.baseValue,l=o??i;if(ee(l)&&typeof l=="number")return l;var c=s==="horizontal"?r:n,u=c.scale.domain();if(c.type==="number"){var d=Math.max(u[0],u[1]),f=Math.min(u[0],u[1]);return l==="dataMin"?f:l==="dataMax"||d<0?d:Math.max(Math.min(u[0],u[1]),0)}return l==="dataMin"?u[0]:l==="dataMax"?u[1]:u[0]});Gr(za,"getComposedData",function(e){var t=e.props,n=e.item,r=e.xAxis,s=e.yAxis,i=e.xAxisTicks,o=e.yAxisTicks,l=e.bandSize,c=e.dataKey,u=e.stackedData,d=e.dataStartIndex,f=e.displayedData,p=e.offset,h=t.layout,m=u&&u.length,v=PT.getBaseValue(t,n,r,s),x=h==="horizontal",y=!1,g=f.map(function(N,w){var S;m?S=u[d+w]:(S=mt(N,c),Array.isArray(S)?y=!0:S=[v,S]);var k=S[1]==null||m&&mt(N,c)==null;return x?{x:uh({axis:r,ticks:i,bandSize:l,entry:N,index:w}),y:k?null:s.scale(S[1]),value:S,payload:N}:{x:k?null:r.scale(S[1]),y:uh({axis:s,ticks:o,bandSize:l,entry:N,index:w}),value:S,payload:N}}),j;return m||y?j=g.map(function(N){var w=Array.isArray(N.value)?N.value[0]:null;return x?{x:N.x,y:w!=null&&N.y!=null?s.scale(w):null}:{x:w!=null?r.scale(w):null,y:N.y}}):j=x?s.scale(v):r.scale(v),Ua({points:g,baseLine:j,layout:h,isRange:y},p)});Gr(za,"renderDotItem",function(e,t){var n;if(O.isValidElement(e))n=O.cloneElement(e,t);else if(ve(e))n=e(t);else{var r=Ne("recharts-area-dot",typeof e!="boolean"?e.className:""),s=t.key,i=ET(t,mce);n=O.createElement(kd,ui({},i,{key:s,className:r}))}return n});function yl(e){"@babel/helpers - typeof";return yl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yl(e)}function Sce(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function kce(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,RT(r.key),r)}}function Cce(e,t,n){return t&&kce(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function _ce(e,t,n){return t=Dh(t),Ace(e,$T()?Reflect.construct(t,n||[],Dh(e).constructor):t.apply(e,n))}function Ace(e,t){if(t&&(yl(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Pce(e)}function Pce(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function $T(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return($T=function(){return!!e})()}function Dh(e){return Dh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Dh(e)}function Ece(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Cy(e,t)}function Cy(e,t){return Cy=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},Cy(e,t)}function MT(e,t,n){return t=RT(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function RT(e){var t=Oce(e,"string");return yl(t)=="symbol"?t:t+""}function Oce(e,t){if(yl(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(yl(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function _y(){return _y=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},_y.apply(this,arguments)}function Tce(e){var t=e.xAxisId,n=jj(),r=wj(),s=mT(t);return s==null?null:b.createElement(ql,_y({},s,{className:Ne("recharts-".concat(s.axisType," ").concat(s.axisType),s.className),viewBox:{x:0,y:0,width:n,height:r},ticksGenerator:function(o){return ba(o,!0)}}))}var ia=function(e){function t(){return Sce(this,t),_ce(this,t,arguments)}return Ece(t,e),Cce(t,[{key:"render",value:function(){return b.createElement(Tce,this.props)}}])}(b.Component);MT(ia,"displayName","XAxis");MT(ia,"defaultProps",{allowDecimals:!0,hide:!1,orientation:"bottom",width:0,height:30,mirror:!1,xAxisId:0,tickCount:5,type:"category",padding:{left:0,right:0},allowDataOverflow:!1,scale:"auto",reversed:!1,allowDuplicatedCategory:!0});function bl(e){"@babel/helpers - typeof";return bl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},bl(e)}function $ce(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Mce(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,LT(r.key),r)}}function Rce(e,t,n){return t&&Mce(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Dce(e,t,n){return t=Ih(t),Ice(e,DT()?Reflect.construct(t,n||[],Ih(e).constructor):t.apply(e,n))}function Ice(e,t){if(t&&(bl(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Lce(e)}function Lce(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function DT(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(DT=function(){return!!e})()}function Ih(e){return Ih=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Ih(e)}function zce(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Ay(e,t)}function Ay(e,t){return Ay=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},Ay(e,t)}function IT(e,t,n){return t=LT(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function LT(e){var t=Bce(e,"string");return bl(t)=="symbol"?t:t+""}function Bce(e,t){if(bl(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(bl(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function Py(){return Py=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Py.apply(this,arguments)}var Fce=function(t){var n=t.yAxisId,r=jj(),s=wj(),i=xT(n);return i==null?null:b.createElement(ql,Py({},i,{className:Ne("recharts-".concat(i.axisType," ").concat(i.axisType),i.className),viewBox:{x:0,y:0,width:r,height:s},ticksGenerator:function(l){return ba(l,!0)}}))},oa=function(e){function t(){return $ce(this,t),Dce(this,t,arguments)}return zce(t,e),Rce(t,[{key:"render",value:function(){return b.createElement(Fce,this.props)}}])}(b.Component);IT(oa,"displayName","YAxis");IT(oa,"defaultProps",{allowDuplicatedCategory:!0,allowDecimals:!0,hide:!1,orientation:"left",width:60,height:0,mirror:!1,yAxisId:0,tickCount:5,type:"number",padding:{top:0,bottom:0},allowDataOverflow:!1,scale:"auto",reversed:!1});function z5(e){return qce(e)||Wce(e)||Uce(e)||Vce()}function Vce(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Uce(e,t){if(e){if(typeof e=="string")return Ey(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ey(e,t)}}function Wce(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function qce(e){if(Array.isArray(e))return Ey(e)}function Ey(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Oy=function(t,n,r,s,i){var o=zn(t,Sj),l=zn(t,ox),c=[].concat(z5(o),z5(l)),u=zn(t,cx),d="".concat(s,"Id"),f=s[0],p=n;if(c.length&&(p=c.reduce(function(v,x){if(x.props[d]===r&&ea(x.props,"extendDomain")&&ee(x.props[f])){var y=x.props[f];return[Math.min(v[0],y),Math.max(v[1],y)]}return v},p)),u.length){var h="".concat(f,"1"),m="".concat(f,"2");p=u.reduce(function(v,x){if(x.props[d]===r&&ea(x.props,"extendDomain")&&ee(x.props[h])&&ee(x.props[m])){var y=x.props[h],g=x.props[m];return[Math.min(v[0],y,g),Math.max(v[1],y,g)]}return v},p)}return i&&i.length&&(p=i.reduce(function(v,x){return ee(x)?[Math.min(v[0],x),Math.max(v[1],x)]:v},p)),p},zT={exports:{}};(function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function s(c,u,d){this.fn=c,this.context=u,this.once=d||!1}function i(c,u,d,f,p){if(typeof d!="function")throw new TypeError("The listener must be a function");var h=new s(d,f||c,p),m=n?n+u:u;return c._events[m]?c._events[m].fn?c._events[m]=[c._events[m],h]:c._events[m].push(h):(c._events[m]=h,c._eventsCount++),c}function o(c,u){--c._eventsCount===0?c._events=new r:delete c._events[u]}function l(){this._events=new r,this._eventsCount=0}l.prototype.eventNames=function(){var u=[],d,f;if(this._eventsCount===0)return u;for(f in d=this._events)t.call(d,f)&&u.push(n?f.slice(1):f);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(d)):u},l.prototype.listeners=function(u){var d=n?n+u:u,f=this._events[d];if(!f)return[];if(f.fn)return[f.fn];for(var p=0,h=f.length,m=new Array(h);p<h;p++)m[p]=f[p].fn;return m},l.prototype.listenerCount=function(u){var d=n?n+u:u,f=this._events[d];return f?f.fn?1:f.length:0},l.prototype.emit=function(u,d,f,p,h,m){var v=n?n+u:u;if(!this._events[v])return!1;var x=this._events[v],y=arguments.length,g,j;if(x.fn){switch(x.once&&this.removeListener(u,x.fn,void 0,!0),y){case 1:return x.fn.call(x.context),!0;case 2:return x.fn.call(x.context,d),!0;case 3:return x.fn.call(x.context,d,f),!0;case 4:return x.fn.call(x.context,d,f,p),!0;case 5:return x.fn.call(x.context,d,f,p,h),!0;case 6:return x.fn.call(x.context,d,f,p,h,m),!0}for(j=1,g=new Array(y-1);j<y;j++)g[j-1]=arguments[j];x.fn.apply(x.context,g)}else{var N=x.length,w;for(j=0;j<N;j++)switch(x[j].once&&this.removeListener(u,x[j].fn,void 0,!0),y){case 1:x[j].fn.call(x[j].context);break;case 2:x[j].fn.call(x[j].context,d);break;case 3:x[j].fn.call(x[j].context,d,f);break;case 4:x[j].fn.call(x[j].context,d,f,p);break;default:if(!g)for(w=1,g=new Array(y-1);w<y;w++)g[w-1]=arguments[w];x[j].fn.apply(x[j].context,g)}}return!0},l.prototype.on=function(u,d,f){return i(this,u,d,f,!1)},l.prototype.once=function(u,d,f){return i(this,u,d,f,!0)},l.prototype.removeListener=function(u,d,f,p){var h=n?n+u:u;if(!this._events[h])return this;if(!d)return o(this,h),this;var m=this._events[h];if(m.fn)m.fn===d&&(!p||m.once)&&(!f||m.context===f)&&o(this,h);else{for(var v=0,x=[],y=m.length;v<y;v++)(m[v].fn!==d||p&&!m[v].once||f&&m[v].context!==f)&&x.push(m[v]);x.length?this._events[h]=x.length===1?x[0]:x:o(this,h)}return this},l.prototype.removeAllListeners=function(u){var d;return u?(d=n?n+u:u,this._events[d]&&o(this,d)):(this._events=new r,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=n,l.EventEmitter=l,e.exports=l})(zT);var Hce=zT.exports;const Kce=De(Hce);var k0=new Kce,C0="recharts.syncMouseEvents";function rd(e){"@babel/helpers - typeof";return rd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},rd(e)}function Gce(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Xce(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,BT(r.key),r)}}function Yce(e,t,n){return t&&Xce(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function _0(e,t,n){return t=BT(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function BT(e){var t=Qce(e,"string");return rd(t)=="symbol"?t:t+""}function Qce(e,t){if(rd(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(rd(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Jce=function(){function e(){Gce(this,e),_0(this,"activeIndex",0),_0(this,"coordinateList",[]),_0(this,"layout","horizontal")}return Yce(e,[{key:"setDetails",value:function(n){var r,s=n.coordinateList,i=s===void 0?null:s,o=n.container,l=o===void 0?null:o,c=n.layout,u=c===void 0?null:c,d=n.offset,f=d===void 0?null:d,p=n.mouseHandlerCallback,h=p===void 0?null:p;this.coordinateList=(r=i??this.coordinateList)!==null&&r!==void 0?r:[],this.container=l??this.container,this.layout=u??this.layout,this.offset=f??this.offset,this.mouseHandlerCallback=h??this.mouseHandlerCallback,this.activeIndex=Math.min(Math.max(this.activeIndex,0),this.coordinateList.length-1)}},{key:"focus",value:function(){this.spoofMouse()}},{key:"keyboardEvent",value:function(n){if(this.coordinateList.length!==0)switch(n.key){case"ArrowRight":{if(this.layout!=="horizontal")return;this.activeIndex=Math.min(this.activeIndex+1,this.coordinateList.length-1),this.spoofMouse();break}case"ArrowLeft":{if(this.layout!=="horizontal")return;this.activeIndex=Math.max(this.activeIndex-1,0),this.spoofMouse();break}}}},{key:"setIndex",value:function(n){this.activeIndex=n}},{key:"spoofMouse",value:function(){var n,r;if(this.layout==="horizontal"&&this.coordinateList.length!==0){var s=this.container.getBoundingClientRect(),i=s.x,o=s.y,l=s.height,c=this.coordinateList[this.activeIndex].coordinate,u=((n=window)===null||n===void 0?void 0:n.scrollX)||0,d=((r=window)===null||r===void 0?void 0:r.scrollY)||0,f=i+c+u,p=o+this.offset.top+l/2+d;this.mouseHandlerCallback({pageX:f,pageY:p})}}}])}();function Zce(e,t,n){if(n==="number"&&t===!0&&Array.isArray(e)){var r=e==null?void 0:e[0],s=e==null?void 0:e[1];if(r&&s&&ee(r)&&ee(s))return!0}return!1}function eue(e,t,n,r){var s=r/2;return{stroke:"none",fill:"#ccc",x:e==="horizontal"?t.x-s:n.left+.5,y:e==="horizontal"?n.top+.5:t.y-s,width:e==="horizontal"?r:n.width-1,height:e==="horizontal"?n.height-1:r}}function FT(e){var t=e.cx,n=e.cy,r=e.radius,s=e.startAngle,i=e.endAngle,o=Ge(t,n,r,s),l=Ge(t,n,r,i);return{points:[o,l],cx:t,cy:n,radius:r,startAngle:s,endAngle:i}}function tue(e,t,n){var r,s,i,o;if(e==="horizontal")r=t.x,i=r,s=n.top,o=n.top+n.height;else if(e==="vertical")s=t.y,o=s,r=n.left,i=n.left+n.width;else if(t.cx!=null&&t.cy!=null)if(e==="centric"){var l=t.cx,c=t.cy,u=t.innerRadius,d=t.outerRadius,f=t.angle,p=Ge(l,c,u,f),h=Ge(l,c,d,f);r=p.x,s=p.y,i=h.x,o=h.y}else return FT(t);return[{x:r,y:s},{x:i,y:o}]}function ad(e){"@babel/helpers - typeof";return ad=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ad(e)}function B5(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function xf(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?B5(Object(n),!0).forEach(function(r){nue(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):B5(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function nue(e,t,n){return t=rue(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function rue(e){var t=aue(e,"string");return ad(t)=="symbol"?t:t+""}function aue(e,t){if(ad(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(ad(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function sue(e){var t,n,r=e.element,s=e.tooltipEventType,i=e.isActive,o=e.activeCoordinate,l=e.activePayload,c=e.offset,u=e.activeTooltipIndex,d=e.tooltipAxisBandSize,f=e.layout,p=e.chartName,h=(t=r.props.cursor)!==null&&t!==void 0?t:(n=r.type.defaultProps)===null||n===void 0?void 0:n.cursor;if(!r||!h||!i||!o||p!=="ScatterChart"&&s!=="axis")return null;var m,v=yi;if(p==="ScatterChart")m=o,v=pae;else if(p==="BarChart")m=eue(f,o,c,d),v=xj;else if(f==="radial"){var x=FT(o),y=x.cx,g=x.cy,j=x.radius,N=x.startAngle,w=x.endAngle;m={cx:y,cy:g,startAngle:N,endAngle:w,innerRadius:j,outerRadius:j},v=M3}else m={points:tue(f,o,c)},v=yi;var S=xf(xf(xf(xf({stroke:"#ccc",pointerEvents:"none"},c),m),me(h,!1)),{},{payload:l,payloadIndex:u,className:Ne("recharts-tooltip-cursor",h.className)});return b.isValidElement(h)?b.cloneElement(h,S):b.createElement(v,S)}var iue=["item"],oue=["children","className","width","height","style","compact","title","desc"];function jl(e){"@babel/helpers - typeof";return jl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},jl(e)}function No(){return No=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},No.apply(this,arguments)}function F5(e,t){return uue(e)||cue(e,t)||UT(e,t)||lue()}function lue(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function cue(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,s,i,o,l=[],c=!0,u=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(d){u=!0,s=d}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function uue(e){if(Array.isArray(e))return e}function V5(e,t){if(e==null)return{};var n=due(e,t),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)r=i[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function due(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function fue(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function pue(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,WT(r.key),r)}}function hue(e,t,n){return t&&pue(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function mue(e,t,n){return t=Lh(t),xue(e,VT()?Reflect.construct(t,n||[],Lh(e).constructor):t.apply(e,n))}function xue(e,t){if(t&&(jl(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return gue(e)}function gue(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function VT(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(VT=function(){return!!e})()}function Lh(e){return Lh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Lh(e)}function vue(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Ty(e,t)}function Ty(e,t){return Ty=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},Ty(e,t)}function wl(e){return jue(e)||bue(e)||UT(e)||yue()}function yue(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function UT(e,t){if(e){if(typeof e=="string")return $y(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return $y(e,t)}}function bue(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function jue(e){if(Array.isArray(e))return $y(e)}function $y(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function U5(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function J(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?U5(Object(n),!0).forEach(function(r){ge(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):U5(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function ge(e,t,n){return t=WT(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function WT(e){var t=wue(e,"string");return jl(t)=="symbol"?t:t+""}function wue(e,t){if(jl(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(jl(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Nue={xAxis:["bottom","top"],yAxis:["left","right"]},Sue={width:"100%",height:"100%"},qT={x:0,y:0};function gf(e){return e}var kue=function(t,n){return n==="horizontal"?t.x:n==="vertical"?t.y:n==="centric"?t.angle:t.radius},Cue=function(t,n,r,s){var i=n.find(function(d){return d&&d.index===r});if(i){if(t==="horizontal")return{x:i.coordinate,y:s.y};if(t==="vertical")return{x:s.x,y:i.coordinate};if(t==="centric"){var o=i.coordinate,l=s.radius;return J(J(J({},s),Ge(s.cx,s.cy,l,o)),{},{angle:o,radius:l})}var c=i.coordinate,u=s.angle;return J(J(J({},s),Ge(s.cx,s.cy,c,u)),{},{angle:u,radius:c})}return qT},ux=function(t,n){var r=n.graphicalItems,s=n.dataStartIndex,i=n.dataEndIndex,o=(r??[]).reduce(function(l,c){var u=c.props.data;return u&&u.length?[].concat(wl(l),wl(u)):l},[]);return o.length>0?o:t&&t.length&&ee(s)&&ee(i)?t.slice(s,i+1):[]};function HT(e){return e==="number"?[0,"auto"]:void 0}var My=function(t,n,r,s){var i=t.graphicalItems,o=t.tooltipAxis,l=ux(n,t);return r<0||!i||!i.length||r>=l.length?null:i.reduce(function(c,u){var d,f=(d=u.props.data)!==null&&d!==void 0?d:n;f&&t.dataStartIndex+t.dataEndIndex!==0&&t.dataEndIndex-t.dataStartIndex>=r&&(f=f.slice(t.dataStartIndex,t.dataEndIndex+1));var p;if(o.dataKey&&!o.allowDuplicatedCategory){var h=f===void 0?l:f;p=Rp(h,o.dataKey,s)}else p=f&&f[r]||l[r];return p?[].concat(wl(c),[A3(u,p)]):c},[])},W5=function(t,n,r,s){var i=s||{x:t.chartX,y:t.chartY},o=kue(i,r),l=t.orderedTooltipTicks,c=t.tooltipAxis,u=t.tooltipTicks,d=$ee(o,l,u,c);if(d>=0&&u){var f=u[d]&&u[d].value,p=My(t,n,d,f),h=Cue(r,l,d,i);return{activeTooltipIndex:d,activeLabel:f,activePayload:p,activeCoordinate:h}}return null},_ue=function(t,n){var r=n.axes,s=n.graphicalItems,i=n.axisType,o=n.axisIdKey,l=n.stackGroups,c=n.dataStartIndex,u=n.dataEndIndex,d=t.layout,f=t.children,p=t.stackOffset,h=w3(d,i);return r.reduce(function(m,v){var x,y=v.type.defaultProps!==void 0?J(J({},v.type.defaultProps),v.props):v.props,g=y.type,j=y.dataKey,N=y.allowDataOverflow,w=y.allowDuplicatedCategory,S=y.scale,k=y.ticks,C=y.includeHidden,_=y[o];if(m[_])return m;var A=ux(t.data,{graphicalItems:s.filter(function(L){var B,ae=o in L.props?L.props[o]:(B=L.type.defaultProps)===null||B===void 0?void 0:B[o];return ae===_}),dataStartIndex:c,dataEndIndex:u}),E=A.length,P,D,I;Zce(y.domain,N,g)&&(P=Kv(y.domain,null,N),h&&(g==="number"||S!=="auto")&&(I=Fc(A,j,"category")));var R=HT(g);if(!P||P.length===0){var M,W=(M=y.domain)!==null&&M!==void 0?M:R;if(j){if(P=Fc(A,j,g),g==="category"&&h){var T=N7(P);w&&T?(D=P,P=Sh(0,E)):w||(P=pk(W,P,v).reduce(function(L,B){return L.indexOf(B)>=0?L:[].concat(wl(L),[B])},[]))}else if(g==="category")w?P=P.filter(function(L){return L!==""&&!je(L)}):P=pk(W,P,v).reduce(function(L,B){return L.indexOf(B)>=0||B===""||je(B)?L:[].concat(wl(L),[B])},[]);else if(g==="number"){var V=Lee(A,s.filter(function(L){var B,ae,se=o in L.props?L.props[o]:(B=L.type.defaultProps)===null||B===void 0?void 0:B[o],xe="hide"in L.props?L.props.hide:(ae=L.type.defaultProps)===null||ae===void 0?void 0:ae.hide;return se===_&&(C||!xe)}),j,i,d);V&&(P=V)}h&&(g==="number"||S!=="auto")&&(I=Fc(A,j,"category"))}else h?P=Sh(0,E):l&&l[_]&&l[_].hasStack&&g==="number"?P=p==="expand"?[0,1]:_3(l[_].stackGroups,c,u):P=j3(A,s.filter(function(L){var B=o in L.props?L.props[o]:L.type.defaultProps[o],ae="hide"in L.props?L.props.hide:L.type.defaultProps.hide;return B===_&&(C||!ae)}),g,d,!0);if(g==="number")P=Oy(f,P,_,i,k),W&&(P=Kv(W,P,N));else if(g==="category"&&W){var X=W,U=P.every(function(L){return X.indexOf(L)>=0});U&&(P=X)}}return J(J({},m),{},ge({},_,J(J({},y),{},{axisType:i,domain:P,categoricalDomain:I,duplicateDomain:D,originalDomain:(x=y.domain)!==null&&x!==void 0?x:R,isCategorical:h,layout:d})))},{})},Aue=function(t,n){var r=n.graphicalItems,s=n.Axis,i=n.axisType,o=n.axisIdKey,l=n.stackGroups,c=n.dataStartIndex,u=n.dataEndIndex,d=t.layout,f=t.children,p=ux(t.data,{graphicalItems:r,dataStartIndex:c,dataEndIndex:u}),h=p.length,m=w3(d,i),v=-1;return r.reduce(function(x,y){var g=y.type.defaultProps!==void 0?J(J({},y.type.defaultProps),y.props):y.props,j=g[o],N=HT("number");if(!x[j]){v++;var w;return m?w=Sh(0,h):l&&l[j]&&l[j].hasStack?(w=_3(l[j].stackGroups,c,u),w=Oy(f,w,j,i)):(w=Kv(N,j3(p,r.filter(function(S){var k,C,_=o in S.props?S.props[o]:(k=S.type.defaultProps)===null||k===void 0?void 0:k[o],A="hide"in S.props?S.props.hide:(C=S.type.defaultProps)===null||C===void 0?void 0:C.hide;return _===j&&!A}),"number",d),s.defaultProps.allowDataOverflow),w=Oy(f,w,j,i)),J(J({},x),{},ge({},j,J(J({axisType:i},s.defaultProps),{},{hide:!0,orientation:Ln(Nue,"".concat(i,".").concat(v%2),null),domain:w,originalDomain:N,isCategorical:m,layout:d})))}return x},{})},Pue=function(t,n){var r=n.axisType,s=r===void 0?"xAxis":r,i=n.AxisComp,o=n.graphicalItems,l=n.stackGroups,c=n.dataStartIndex,u=n.dataEndIndex,d=t.children,f="".concat(s,"Id"),p=zn(d,i),h={};return p&&p.length?h=_ue(t,{axes:p,graphicalItems:o,axisType:s,axisIdKey:f,stackGroups:l,dataStartIndex:c,dataEndIndex:u}):o&&o.length&&(h=Aue(t,{Axis:i,graphicalItems:o,axisType:s,axisIdKey:f,stackGroups:l,dataStartIndex:c,dataEndIndex:u})),h},Eue=function(t){var n=Za(t),r=ba(n,!1,!0);return{tooltipTicks:r,orderedTooltipTicks:U1(r,function(s){return s.coordinate}),tooltipAxis:n,tooltipAxisBandSize:dh(n,r)}},q5=function(t){var n=t.children,r=t.defaultShowTooltip,s=Mn(n,ul),i=0,o=0;return t.data&&t.data.length!==0&&(o=t.data.length-1),s&&s.props&&(s.props.startIndex>=0&&(i=s.props.startIndex),s.props.endIndex>=0&&(o=s.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:i,dataEndIndex:o,activeTooltipIndex:-1,isTooltipActive:!!r}},Oue=function(t){return!t||!t.length?!1:t.some(function(n){var r=Na(n&&n.type);return r&&r.indexOf("Bar")>=0})},H5=function(t){return t==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:t==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:t==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},Tue=function(t,n){var r=t.props,s=t.graphicalItems,i=t.xAxisMap,o=i===void 0?{}:i,l=t.yAxisMap,c=l===void 0?{}:l,u=r.width,d=r.height,f=r.children,p=r.margin||{},h=Mn(f,ul),m=Mn(f,ms),v=Object.keys(c).reduce(function(w,S){var k=c[S],C=k.orientation;return!k.mirror&&!k.hide?J(J({},w),{},ge({},C,w[C]+k.width)):w},{left:p.left||0,right:p.right||0}),x=Object.keys(o).reduce(function(w,S){var k=o[S],C=k.orientation;return!k.mirror&&!k.hide?J(J({},w),{},ge({},C,Ln(w,"".concat(C))+k.height)):w},{top:p.top||0,bottom:p.bottom||0}),y=J(J({},x),v),g=y.bottom;h&&(y.bottom+=h.props.height||ul.defaultProps.height),m&&n&&(y=Dee(y,s,r,n));var j=u-y.left-y.right,N=d-y.top-y.bottom;return J(J({brushBottom:g},y),{},{width:Math.max(j,0),height:Math.max(N,0)})},$ue=function(t,n){if(n==="xAxis")return t[n].width;if(n==="yAxis")return t[n].height},dx=function(t){var n=t.chartName,r=t.GraphicalChild,s=t.defaultTooltipEventType,i=s===void 0?"axis":s,o=t.validateTooltipEventTypes,l=o===void 0?["axis"]:o,c=t.axisComponents,u=t.legendContent,d=t.formatAxisMap,f=t.defaultProps,p=function(y,g){var j=g.graphicalItems,N=g.stackGroups,w=g.offset,S=g.updateId,k=g.dataStartIndex,C=g.dataEndIndex,_=y.barSize,A=y.layout,E=y.barGap,P=y.barCategoryGap,D=y.maxBarSize,I=H5(A),R=I.numericAxisName,M=I.cateAxisName,W=Oue(j),T=[];return j.forEach(function(V,X){var U=ux(y.data,{graphicalItems:[V],dataStartIndex:k,dataEndIndex:C}),L=V.type.defaultProps!==void 0?J(J({},V.type.defaultProps),V.props):V.props,B=L.dataKey,ae=L.maxBarSize,se=L["".concat(R,"Id")],xe=L["".concat(M,"Id")],H={},le=c.reduce(function(bn,jn){var Wn=g["".concat(jn.axisType,"Map")],ne=L["".concat(jn.axisType,"Id")];Wn&&Wn[ne]||jn.axisType==="zAxis"||Ri();var Se=Wn[ne];return J(J({},bn),{},ge(ge({},jn.axisType,Se),"".concat(jn.axisType,"Ticks"),ba(Se)))},H),Z=le[M],F=le["".concat(M,"Ticks")],z=N&&N[se]&&N[se].hasStack&&Kee(V,N[se].stackGroups),q=Na(V.type).indexOf("Bar")>=0,ie=dh(Z,F),oe=[],we=W&&Mee({barSize:_,stackGroups:N,totalSize:$ue(le,M)});if(q){var Ee,ze,gn=je(ae)?D:ae,vn=(Ee=(ze=dh(Z,F,!0))!==null&&ze!==void 0?ze:gn)!==null&&Ee!==void 0?Ee:0;oe=Ree({barGap:E,barCategoryGap:P,bandSize:vn!==ie?vn:ie,sizeList:we[xe],maxBarSize:gn}),vn!==ie&&(oe=oe.map(function(bn){return J(J({},bn),{},{position:J(J({},bn.position),{},{offset:bn.position.offset-vn/2})})}))}var yn=V&&V.type&&V.type.getComposedData;yn&&T.push({props:J(J({},yn(J(J({},le),{},{displayedData:U,props:y,dataKey:B,item:V,bandSize:ie,barPosition:oe,offset:w,stackedData:z,layout:A,dataStartIndex:k,dataEndIndex:C}))),{},ge(ge(ge({key:V.key||"item-".concat(X)},R,le[R]),M,le[M]),"animationId",S)),childIndex:R7(V,y.children),item:V})}),T},h=function(y,g){var j=y.props,N=y.dataStartIndex,w=y.dataEndIndex,S=y.updateId;if(!oN({props:j}))return null;var k=j.children,C=j.layout,_=j.stackOffset,A=j.data,E=j.reverseStackOrder,P=H5(C),D=P.numericAxisName,I=P.cateAxisName,R=zn(k,r),M=qee(A,R,"".concat(D,"Id"),"".concat(I,"Id"),_,E),W=c.reduce(function(L,B){var ae="".concat(B.axisType,"Map");return J(J({},L),{},ge({},ae,Pue(j,J(J({},B),{},{graphicalItems:R,stackGroups:B.axisType===D&&M,dataStartIndex:N,dataEndIndex:w}))))},{}),T=Tue(J(J({},W),{},{props:j,graphicalItems:R}),g==null?void 0:g.legendBBox);Object.keys(W).forEach(function(L){W[L]=d(j,W[L],T,L.replace("Map",""),n)});var V=W["".concat(I,"Map")],X=Eue(V),U=p(j,J(J({},W),{},{dataStartIndex:N,dataEndIndex:w,updateId:S,graphicalItems:R,stackGroups:M,offset:T}));return J(J({formattedGraphicalItems:U,graphicalItems:R,offset:T,stackGroups:M},X),W)},m=function(x){function y(g){var j,N,w;return fue(this,y),w=mue(this,y,[g]),ge(w,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),ge(w,"accessibilityManager",new Jce),ge(w,"handleLegendBBoxUpdate",function(S){if(S){var k=w.state,C=k.dataStartIndex,_=k.dataEndIndex,A=k.updateId;w.setState(J({legendBBox:S},h({props:w.props,dataStartIndex:C,dataEndIndex:_,updateId:A},J(J({},w.state),{},{legendBBox:S}))))}}),ge(w,"handleReceiveSyncEvent",function(S,k,C){if(w.props.syncId===S){if(C===w.eventEmitterSymbol&&typeof w.props.syncMethod!="function")return;w.applySyncEvent(k)}}),ge(w,"handleBrushChange",function(S){var k=S.startIndex,C=S.endIndex;if(k!==w.state.dataStartIndex||C!==w.state.dataEndIndex){var _=w.state.updateId;w.setState(function(){return J({dataStartIndex:k,dataEndIndex:C},h({props:w.props,dataStartIndex:k,dataEndIndex:C,updateId:_},w.state))}),w.triggerSyncEvent({dataStartIndex:k,dataEndIndex:C})}}),ge(w,"handleMouseEnter",function(S){var k=w.getMouseInfo(S);if(k){var C=J(J({},k),{},{isTooltipActive:!0});w.setState(C),w.triggerSyncEvent(C);var _=w.props.onMouseEnter;ve(_)&&_(C,S)}}),ge(w,"triggeredAfterMouseMove",function(S){var k=w.getMouseInfo(S),C=k?J(J({},k),{},{isTooltipActive:!0}):{isTooltipActive:!1};w.setState(C),w.triggerSyncEvent(C);var _=w.props.onMouseMove;ve(_)&&_(C,S)}),ge(w,"handleItemMouseEnter",function(S){w.setState(function(){return{isTooltipActive:!0,activeItem:S,activePayload:S.tooltipPayload,activeCoordinate:S.tooltipPosition||{x:S.cx,y:S.cy}}})}),ge(w,"handleItemMouseLeave",function(){w.setState(function(){return{isTooltipActive:!1}})}),ge(w,"handleMouseMove",function(S){S.persist(),w.throttleTriggeredAfterMouseMove(S)}),ge(w,"handleMouseLeave",function(S){w.throttleTriggeredAfterMouseMove.cancel();var k={isTooltipActive:!1};w.setState(k),w.triggerSyncEvent(k);var C=w.props.onMouseLeave;ve(C)&&C(k,S)}),ge(w,"handleOuterEvent",function(S){var k=M7(S),C=Ln(w.props,"".concat(k));if(k&&ve(C)){var _,A;/.*touch.*/i.test(k)?A=w.getMouseInfo(S.changedTouches[0]):A=w.getMouseInfo(S),C((_=A)!==null&&_!==void 0?_:{},S)}}),ge(w,"handleClick",function(S){var k=w.getMouseInfo(S);if(k){var C=J(J({},k),{},{isTooltipActive:!0});w.setState(C),w.triggerSyncEvent(C);var _=w.props.onClick;ve(_)&&_(C,S)}}),ge(w,"handleMouseDown",function(S){var k=w.props.onMouseDown;if(ve(k)){var C=w.getMouseInfo(S);k(C,S)}}),ge(w,"handleMouseUp",function(S){var k=w.props.onMouseUp;if(ve(k)){var C=w.getMouseInfo(S);k(C,S)}}),ge(w,"handleTouchMove",function(S){S.changedTouches!=null&&S.changedTouches.length>0&&w.throttleTriggeredAfterMouseMove(S.changedTouches[0])}),ge(w,"handleTouchStart",function(S){S.changedTouches!=null&&S.changedTouches.length>0&&w.handleMouseDown(S.changedTouches[0])}),ge(w,"handleTouchEnd",function(S){S.changedTouches!=null&&S.changedTouches.length>0&&w.handleMouseUp(S.changedTouches[0])}),ge(w,"handleDoubleClick",function(S){var k=w.props.onDoubleClick;if(ve(k)){var C=w.getMouseInfo(S);k(C,S)}}),ge(w,"handleContextMenu",function(S){var k=w.props.onContextMenu;if(ve(k)){var C=w.getMouseInfo(S);k(C,S)}}),ge(w,"triggerSyncEvent",function(S){w.props.syncId!==void 0&&k0.emit(C0,w.props.syncId,S,w.eventEmitterSymbol)}),ge(w,"applySyncEvent",function(S){var k=w.props,C=k.layout,_=k.syncMethod,A=w.state.updateId,E=S.dataStartIndex,P=S.dataEndIndex;if(S.dataStartIndex!==void 0||S.dataEndIndex!==void 0)w.setState(J({dataStartIndex:E,dataEndIndex:P},h({props:w.props,dataStartIndex:E,dataEndIndex:P,updateId:A},w.state)));else if(S.activeTooltipIndex!==void 0){var D=S.chartX,I=S.chartY,R=S.activeTooltipIndex,M=w.state,W=M.offset,T=M.tooltipTicks;if(!W)return;if(typeof _=="function")R=_(T,S);else if(_==="value"){R=-1;for(var V=0;V<T.length;V++)if(T[V].value===S.activeLabel){R=V;break}}var X=J(J({},W),{},{x:W.left,y:W.top}),U=Math.min(D,X.x+X.width),L=Math.min(I,X.y+X.height),B=T[R]&&T[R].value,ae=My(w.state,w.props.data,R),se=T[R]?{x:C==="horizontal"?T[R].coordinate:U,y:C==="horizontal"?L:T[R].coordinate}:qT;w.setState(J(J({},S),{},{activeLabel:B,activeCoordinate:se,activePayload:ae,activeTooltipIndex:R}))}else w.setState(S)}),ge(w,"renderCursor",function(S){var k,C=w.state,_=C.isTooltipActive,A=C.activeCoordinate,E=C.activePayload,P=C.offset,D=C.activeTooltipIndex,I=C.tooltipAxisBandSize,R=w.getTooltipEventType(),M=(k=S.props.active)!==null&&k!==void 0?k:_,W=w.props.layout,T=S.key||"_recharts-cursor";return O.createElement(sue,{key:T,activeCoordinate:A,activePayload:E,activeTooltipIndex:D,chartName:n,element:S,isActive:M,layout:W,offset:P,tooltipAxisBandSize:I,tooltipEventType:R})}),ge(w,"renderPolarAxis",function(S,k,C){var _=Ln(S,"type.axisType"),A=Ln(w.state,"".concat(_,"Map")),E=S.type.defaultProps,P=E!==void 0?J(J({},E),S.props):S.props,D=A&&A[P["".concat(_,"Id")]];return b.cloneElement(S,J(J({},D),{},{className:Ne(_,D.className),key:S.key||"".concat(k,"-").concat(C),ticks:ba(D,!0)}))}),ge(w,"renderPolarGrid",function(S){var k=S.props,C=k.radialLines,_=k.polarAngles,A=k.polarRadius,E=w.state,P=E.radiusAxisMap,D=E.angleAxisMap,I=Za(P),R=Za(D),M=R.cx,W=R.cy,T=R.innerRadius,V=R.outerRadius;return b.cloneElement(S,{polarAngles:Array.isArray(_)?_:ba(R,!0).map(function(X){return X.coordinate}),polarRadius:Array.isArray(A)?A:ba(I,!0).map(function(X){return X.coordinate}),cx:M,cy:W,innerRadius:T,outerRadius:V,key:S.key||"polar-grid",radialLines:C})}),ge(w,"renderLegend",function(){var S=w.state.formattedGraphicalItems,k=w.props,C=k.children,_=k.width,A=k.height,E=w.props.margin||{},P=_-(E.left||0)-(E.right||0),D=y3({children:C,formattedGraphicalItems:S,legendWidth:P,legendContent:u});if(!D)return null;var I=D.item,R=V5(D,iue);return b.cloneElement(I,J(J({},R),{},{chartWidth:_,chartHeight:A,margin:E,onBBoxUpdate:w.handleLegendBBoxUpdate}))}),ge(w,"renderTooltip",function(){var S,k=w.props,C=k.children,_=k.accessibilityLayer,A=Mn(C,on);if(!A)return null;var E=w.state,P=E.isTooltipActive,D=E.activeCoordinate,I=E.activePayload,R=E.activeLabel,M=E.offset,W=(S=A.props.active)!==null&&S!==void 0?S:P;return b.cloneElement(A,{viewBox:J(J({},M),{},{x:M.left,y:M.top}),active:W,label:R,payload:W?I:[],coordinate:D,accessibilityLayer:_})}),ge(w,"renderBrush",function(S){var k=w.props,C=k.margin,_=k.data,A=w.state,E=A.offset,P=A.dataStartIndex,D=A.dataEndIndex,I=A.updateId;return b.cloneElement(S,{key:S.key||"_recharts-brush",onChange:ff(w.handleBrushChange,S.props.onChange),data:_,x:ee(S.props.x)?S.props.x:E.left,y:ee(S.props.y)?S.props.y:E.top+E.height+E.brushBottom-(C.bottom||0),width:ee(S.props.width)?S.props.width:E.width,startIndex:P,endIndex:D,updateId:"brush-".concat(I)})}),ge(w,"renderReferenceElement",function(S,k,C){if(!S)return null;var _=w,A=_.clipPathId,E=w.state,P=E.xAxisMap,D=E.yAxisMap,I=E.offset,R=S.type.defaultProps||{},M=S.props,W=M.xAxisId,T=W===void 0?R.xAxisId:W,V=M.yAxisId,X=V===void 0?R.yAxisId:V;return b.cloneElement(S,{key:S.key||"".concat(k,"-").concat(C),xAxis:P[T],yAxis:D[X],viewBox:{x:I.left,y:I.top,width:I.width,height:I.height},clipPathId:A})}),ge(w,"renderActivePoints",function(S){var k=S.item,C=S.activePoint,_=S.basePoint,A=S.childIndex,E=S.isRange,P=[],D=k.props.key,I=k.item.type.defaultProps!==void 0?J(J({},k.item.type.defaultProps),k.item.props):k.item.props,R=I.activeDot,M=I.dataKey,W=J(J({index:A,dataKey:M,cx:C.x,cy:C.y,r:4,fill:mj(k.item),strokeWidth:2,stroke:"#fff",payload:C.payload,value:C.value},me(R,!1)),Dp(R));return P.push(y.renderActiveDot(R,W,"".concat(D,"-activePoint-").concat(A))),_?P.push(y.renderActiveDot(R,J(J({},W),{},{cx:_.x,cy:_.y}),"".concat(D,"-basePoint-").concat(A))):E&&P.push(null),P}),ge(w,"renderGraphicChild",function(S,k,C){var _=w.filterFormatItem(S,k,C);if(!_)return null;var A=w.getTooltipEventType(),E=w.state,P=E.isTooltipActive,D=E.tooltipAxis,I=E.activeTooltipIndex,R=E.activeLabel,M=w.props.children,W=Mn(M,on),T=_.props,V=T.points,X=T.isRange,U=T.baseLine,L=_.item.type.defaultProps!==void 0?J(J({},_.item.type.defaultProps),_.item.props):_.item.props,B=L.activeDot,ae=L.hide,se=L.activeBar,xe=L.activeShape,H=!!(!ae&&P&&W&&(B||se||xe)),le={};A!=="axis"&&W&&W.props.trigger==="click"?le={onClick:ff(w.handleItemMouseEnter,S.props.onClick)}:A!=="axis"&&(le={onMouseLeave:ff(w.handleItemMouseLeave,S.props.onMouseLeave),onMouseEnter:ff(w.handleItemMouseEnter,S.props.onMouseEnter)});var Z=b.cloneElement(S,J(J({},_.props),le));function F(jn){return typeof D.dataKey=="function"?D.dataKey(jn.payload):null}if(H)if(I>=0){var z,q;if(D.dataKey&&!D.allowDuplicatedCategory){var ie=typeof D.dataKey=="function"?F:"payload.".concat(D.dataKey.toString());z=Rp(V,ie,R),q=X&&U&&Rp(U,ie,R)}else z=V==null?void 0:V[I],q=X&&U&&U[I];if(xe||se){var oe=S.props.activeIndex!==void 0?S.props.activeIndex:I;return[b.cloneElement(S,J(J(J({},_.props),le),{},{activeIndex:oe})),null,null]}if(!je(z))return[Z].concat(wl(w.renderActivePoints({item:_,activePoint:z,basePoint:q,childIndex:I,isRange:X})))}else{var we,Ee=(we=w.getItemByXY(w.state.activeCoordinate))!==null&&we!==void 0?we:{graphicalItem:Z},ze=Ee.graphicalItem,gn=ze.item,vn=gn===void 0?S:gn,yn=ze.childIndex,bn=J(J(J({},_.props),le),{},{activeIndex:yn});return[b.cloneElement(vn,bn),null,null]}return X?[Z,null,null]:[Z,null]}),ge(w,"renderCustomized",function(S,k,C){return b.cloneElement(S,J(J({key:"recharts-customized-".concat(C)},w.props),w.state))}),ge(w,"renderMap",{CartesianGrid:{handler:gf,once:!0},ReferenceArea:{handler:w.renderReferenceElement},ReferenceLine:{handler:gf},ReferenceDot:{handler:w.renderReferenceElement},XAxis:{handler:gf},YAxis:{handler:gf},Brush:{handler:w.renderBrush,once:!0},Bar:{handler:w.renderGraphicChild},Line:{handler:w.renderGraphicChild},Area:{handler:w.renderGraphicChild},Radar:{handler:w.renderGraphicChild},RadialBar:{handler:w.renderGraphicChild},Scatter:{handler:w.renderGraphicChild},Pie:{handler:w.renderGraphicChild},Funnel:{handler:w.renderGraphicChild},Tooltip:{handler:w.renderCursor,once:!0},PolarGrid:{handler:w.renderPolarGrid,once:!0},PolarAngleAxis:{handler:w.renderPolarAxis},PolarRadiusAxis:{handler:w.renderPolarAxis},Customized:{handler:w.renderCustomized}}),w.clipPathId="".concat((j=g.id)!==null&&j!==void 0?j:Hi("recharts"),"-clip"),w.throttleTriggeredAfterMouseMove=yO(w.triggeredAfterMouseMove,(N=g.throttleDelay)!==null&&N!==void 0?N:1e3/60),w.state={},w}return vue(y,x),hue(y,[{key:"componentDidMount",value:function(){var j,N;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(j=this.props.margin.left)!==null&&j!==void 0?j:0,top:(N=this.props.margin.top)!==null&&N!==void 0?N:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var j=this.props,N=j.children,w=j.data,S=j.height,k=j.layout,C=Mn(N,on);if(C){var _=C.props.defaultIndex;if(!(typeof _!="number"||_<0||_>this.state.tooltipTicks.length-1)){var A=this.state.tooltipTicks[_]&&this.state.tooltipTicks[_].value,E=My(this.state,w,_,A),P=this.state.tooltipTicks[_].coordinate,D=(this.state.offset.top+S)/2,I=k==="horizontal",R=I?{x:P,y:D}:{y:P,x:D},M=this.state.formattedGraphicalItems.find(function(T){var V=T.item;return V.type.name==="Scatter"});M&&(R=J(J({},R),M.props.points[_].tooltipPosition),E=M.props.points[_].tooltipPayload);var W={activeTooltipIndex:_,isTooltipActive:!0,activeLabel:A,activePayload:E,activeCoordinate:R};this.setState(W),this.renderCursor(C),this.accessibilityManager.setIndex(_)}}}},{key:"getSnapshotBeforeUpdate",value:function(j,N){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==N.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==j.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==j.margin){var w,S;this.accessibilityManager.setDetails({offset:{left:(w=this.props.margin.left)!==null&&w!==void 0?w:0,top:(S=this.props.margin.top)!==null&&S!==void 0?S:0}})}return null}},{key:"componentDidUpdate",value:function(j){lv([Mn(j.children,on)],[Mn(this.props.children,on)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var j=Mn(this.props.children,on);if(j&&typeof j.props.shared=="boolean"){var N=j.props.shared?"axis":"item";return l.indexOf(N)>=0?N:i}return i}},{key:"getMouseInfo",value:function(j){if(!this.container)return null;var N=this.container,w=N.getBoundingClientRect(),S=oY(w),k={chartX:Math.round(j.pageX-S.left),chartY:Math.round(j.pageY-S.top)},C=w.width/N.offsetWidth||1,_=this.inRange(k.chartX,k.chartY,C);if(!_)return null;var A=this.state,E=A.xAxisMap,P=A.yAxisMap,D=this.getTooltipEventType(),I=W5(this.state,this.props.data,this.props.layout,_);if(D!=="axis"&&E&&P){var R=Za(E).scale,M=Za(P).scale,W=R&&R.invert?R.invert(k.chartX):null,T=M&&M.invert?M.invert(k.chartY):null;return J(J({},k),{},{xValue:W,yValue:T},I)}return I?J(J({},k),I):null}},{key:"inRange",value:function(j,N){var w=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,S=this.props.layout,k=j/w,C=N/w;if(S==="horizontal"||S==="vertical"){var _=this.state.offset,A=k>=_.left&&k<=_.left+_.width&&C>=_.top&&C<=_.top+_.height;return A?{x:k,y:C}:null}var E=this.state,P=E.angleAxisMap,D=E.radiusAxisMap;if(P&&D){var I=Za(P);return xk({x:k,y:C},I)}return null}},{key:"parseEventsOfWrapper",value:function(){var j=this.props.children,N=this.getTooltipEventType(),w=Mn(j,on),S={};w&&N==="axis"&&(w.props.trigger==="click"?S={onClick:this.handleClick}:S={onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu});var k=Dp(this.props,this.handleOuterEvent);return J(J({},k),S)}},{key:"addListener",value:function(){k0.on(C0,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){k0.removeListener(C0,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(j,N,w){for(var S=this.state.formattedGraphicalItems,k=0,C=S.length;k<C;k++){var _=S[k];if(_.item===j||_.props.key===j.key||N===Na(_.item.type)&&w===_.childIndex)return _}return null}},{key:"renderClipPath",value:function(){var j=this.clipPathId,N=this.state.offset,w=N.left,S=N.top,k=N.height,C=N.width;return O.createElement("defs",null,O.createElement("clipPath",{id:j},O.createElement("rect",{x:w,y:S,height:k,width:C})))}},{key:"getXScales",value:function(){var j=this.state.xAxisMap;return j?Object.entries(j).reduce(function(N,w){var S=F5(w,2),k=S[0],C=S[1];return J(J({},N),{},ge({},k,C.scale))},{}):null}},{key:"getYScales",value:function(){var j=this.state.yAxisMap;return j?Object.entries(j).reduce(function(N,w){var S=F5(w,2),k=S[0],C=S[1];return J(J({},N),{},ge({},k,C.scale))},{}):null}},{key:"getXScaleByAxisId",value:function(j){var N;return(N=this.state.xAxisMap)===null||N===void 0||(N=N[j])===null||N===void 0?void 0:N.scale}},{key:"getYScaleByAxisId",value:function(j){var N;return(N=this.state.yAxisMap)===null||N===void 0||(N=N[j])===null||N===void 0?void 0:N.scale}},{key:"getItemByXY",value:function(j){var N=this.state,w=N.formattedGraphicalItems,S=N.activeItem;if(w&&w.length)for(var k=0,C=w.length;k<C;k++){var _=w[k],A=_.props,E=_.item,P=E.type.defaultProps!==void 0?J(J({},E.type.defaultProps),E.props):E.props,D=Na(E.type);if(D==="Bar"){var I=(A.data||[]).find(function(T){return Kre(j,T)});if(I)return{graphicalItem:_,payload:I}}else if(D==="RadialBar"){var R=(A.data||[]).find(function(T){return xk(j,T)});if(R)return{graphicalItem:_,payload:R}}else if(rx(_,S)||ax(_,S)||Ju(_,S)){var M=Rse({graphicalItem:_,activeTooltipItem:S,itemData:P.data}),W=P.activeIndex===void 0?M:P.activeIndex;return{graphicalItem:J(J({},_),{},{childIndex:W}),payload:Ju(_,S)?P.data[M]:_.props.data[M]}}}return null}},{key:"render",value:function(){var j=this;if(!oN(this))return null;var N=this.props,w=N.children,S=N.className,k=N.width,C=N.height,_=N.style,A=N.compact,E=N.title,P=N.desc,D=V5(N,oue),I=me(D,!1);if(A)return O.createElement(j5,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},O.createElement(uv,No({},I,{width:k,height:C,title:E,desc:P}),this.renderClipPath(),cN(w,this.renderMap)));if(this.props.accessibilityLayer){var R,M;I.tabIndex=(R=this.props.tabIndex)!==null&&R!==void 0?R:0,I.role=(M=this.props.role)!==null&&M!==void 0?M:"application",I.onKeyDown=function(T){j.accessibilityManager.keyboardEvent(T)},I.onFocus=function(){j.accessibilityManager.focus()}}var W=this.parseEventsOfWrapper();return O.createElement(j5,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},O.createElement("div",No({className:Ne("recharts-wrapper",S),style:J({position:"relative",cursor:"default",width:k,height:C},_)},W,{ref:function(V){j.container=V}}),O.createElement(uv,No({},I,{width:k,height:C,title:E,desc:P,style:Sue}),this.renderClipPath(),cN(w,this.renderMap)),this.renderLegend(),this.renderTooltip()))}}])}(b.Component);ge(m,"displayName",n),ge(m,"defaultProps",J({layout:"horizontal",stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:{top:5,right:5,bottom:5,left:5},reverseStackOrder:!1,syncMethod:"index"},f)),ge(m,"getDerivedStateFromProps",function(x,y){var g=x.dataKey,j=x.data,N=x.children,w=x.width,S=x.height,k=x.layout,C=x.stackOffset,_=x.margin,A=y.dataStartIndex,E=y.dataEndIndex;if(y.updateId===void 0){var P=q5(x);return J(J(J({},P),{},{updateId:0},h(J(J({props:x},P),{},{updateId:0}),y)),{},{prevDataKey:g,prevData:j,prevWidth:w,prevHeight:S,prevLayout:k,prevStackOffset:C,prevMargin:_,prevChildren:N})}if(g!==y.prevDataKey||j!==y.prevData||w!==y.prevWidth||S!==y.prevHeight||k!==y.prevLayout||C!==y.prevStackOffset||!Ro(_,y.prevMargin)){var D=q5(x),I={chartX:y.chartX,chartY:y.chartY,isTooltipActive:y.isTooltipActive},R=J(J({},W5(y,j,k)),{},{updateId:y.updateId+1}),M=J(J(J({},D),I),R);return J(J(J({},M),h(J({props:x},M),y)),{},{prevDataKey:g,prevData:j,prevWidth:w,prevHeight:S,prevLayout:k,prevStackOffset:C,prevMargin:_,prevChildren:N})}if(!lv(N,y.prevChildren)){var W,T,V,X,U=Mn(N,ul),L=U&&(W=(T=U.props)===null||T===void 0?void 0:T.startIndex)!==null&&W!==void 0?W:A,B=U&&(V=(X=U.props)===null||X===void 0?void 0:X.endIndex)!==null&&V!==void 0?V:E,ae=L!==A||B!==E,se=!je(j),xe=se&&!ae?y.updateId:y.updateId+1;return J(J({updateId:xe},h(J(J({props:x},y),{},{updateId:xe,dataStartIndex:L,dataEndIndex:B}),y)),{},{prevChildren:N,dataStartIndex:L,dataEndIndex:B})}return null}),ge(m,"renderActiveDot",function(x,y,g){var j;return b.isValidElement(x)?j=b.cloneElement(x,y):ve(x)?j=x(y):j=O.createElement(kd,y),O.createElement(Ae,{className:"recharts-active-dot",key:g},j)});var v=b.forwardRef(function(y,g){return O.createElement(m,No({},y,{ref:g}))});return v.displayName=m.displayName,v},Mue=dx({chartName:"LineChart",GraphicalChild:Cd,axisComponents:[{axisType:"xAxis",AxisComp:ia},{axisType:"yAxis",AxisComp:oa}],formatAxisMap:gj}),KT=dx({chartName:"BarChart",GraphicalChild:$a,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:ia},{axisType:"yAxis",AxisComp:oa}],formatAxisMap:gj}),Rue=dx({chartName:"PieChart",GraphicalChild:La,validateTooltipEventTypes:["item"],defaultTooltipEventType:"item",legendContent:"children",axisComponents:[{axisType:"angleAxis",AxisComp:nx},{axisType:"radiusAxis",AxisComp:ex}],formatAxisMap:rte,defaultProps:{layout:"centric",startAngle:0,endAngle:360,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"}}),GT=dx({chartName:"AreaChart",GraphicalChild:za,axisComponents:[{axisType:"xAxis",AxisComp:ia},{axisType:"yAxis",AxisComp:oa}],formatAxisMap:gj});function XT(e,t){return function(){return e.apply(t,arguments)}}const{toString:Due}=Object.prototype,{getPrototypeOf:_j}=Object,{iterator:fx,toStringTag:YT}=Symbol,px=(e=>t=>{const n=Due.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),zr=e=>(e=e.toLowerCase(),t=>px(t)===e),hx=e=>t=>typeof t===e,{isArray:Hl}=Array,Nl=hx("undefined");function _d(e){return e!==null&&!Nl(e)&&e.constructor!==null&&!Nl(e.constructor)&&An(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const QT=zr("ArrayBuffer");function Iue(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&QT(e.buffer),t}const Lue=hx("string"),An=hx("function"),JT=hx("number"),Ad=e=>e!==null&&typeof e=="object",zue=e=>e===!0||e===!1,qf=e=>{if(px(e)!=="object")return!1;const t=_j(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(YT in e)&&!(fx in e)},Bue=e=>{if(!Ad(e)||_d(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},Fue=zr("Date"),Vue=zr("File"),Uue=e=>!!(e&&typeof e.uri<"u"),Wue=e=>e&&typeof e.getParts<"u",que=zr("Blob"),Hue=zr("FileList"),Kue=e=>Ad(e)&&An(e.pipe);function Gue(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const K5=Gue(),G5=typeof K5.FormData<"u"?K5.FormData:void 0,Xue=e=>{let t;return e&&(G5&&e instanceof G5||An(e.append)&&((t=px(e))==="formdata"||t==="object"&&An(e.toString)&&e.toString()==="[object FormData]"))},Yue=zr("URLSearchParams"),[Que,Jue,Zue,ede]=["ReadableStream","Request","Response","Headers"].map(zr),tde=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Pd(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,s;if(typeof e!="object"&&(e=[e]),Hl(e))for(r=0,s=e.length;r<s;r++)t.call(null,e[r],r,e);else{if(_d(e))return;const i=n?Object.getOwnPropertyNames(e):Object.keys(e),o=i.length;let l;for(r=0;r<o;r++)l=i[r],t.call(null,e[l],l,e)}}function ZT(e,t){if(_d(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r=n.length,s;for(;r-- >0;)if(s=n[r],t===s.toLowerCase())return s;return null}const di=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,e6=e=>!Nl(e)&&e!==di;function Ry(){const{caseless:e,skipUndefined:t}=e6(this)&&this||{},n={},r=(s,i)=>{if(i==="__proto__"||i==="constructor"||i==="prototype")return;const o=e&&ZT(n,i)||i;qf(n[o])&&qf(s)?n[o]=Ry(n[o],s):qf(s)?n[o]=Ry({},s):Hl(s)?n[o]=s.slice():(!t||!Nl(s))&&(n[o]=s)};for(let s=0,i=arguments.length;s<i;s++)arguments[s]&&Pd(arguments[s],r);return n}const nde=(e,t,n,{allOwnKeys:r}={})=>(Pd(t,(s,i)=>{n&&An(s)?Object.defineProperty(e,i,{value:XT(s,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,i,{value:s,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),e),rde=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),ade=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},sde=(e,t,n,r)=>{let s,i,o;const l={};if(t=t||{},e==null)return t;do{for(s=Object.getOwnPropertyNames(e),i=s.length;i-- >0;)o=s[i],(!r||r(o,e,t))&&!l[o]&&(t[o]=e[o],l[o]=!0);e=n!==!1&&_j(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},ide=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},ode=e=>{if(!e)return null;if(Hl(e))return e;let t=e.length;if(!JT(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},lde=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&_j(Uint8Array)),cde=(e,t)=>{const r=(e&&e[fx]).call(e);let s;for(;(s=r.next())&&!s.done;){const i=s.value;t.call(e,i[0],i[1])}},ude=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},dde=zr("HTMLFormElement"),fde=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),X5=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),pde=zr("RegExp"),t6=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};Pd(n,(s,i)=>{let o;(o=t(s,i,e))!==!1&&(r[i]=o||s)}),Object.defineProperties(e,r)},hde=e=>{t6(e,(t,n)=>{if(An(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(An(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},mde=(e,t)=>{const n={},r=s=>{s.forEach(i=>{n[i]=!0})};return Hl(e)?r(e):r(String(e).split(t)),n},xde=()=>{},gde=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function vde(e){return!!(e&&An(e.append)&&e[YT]==="FormData"&&e[fx])}const yde=e=>{const t=new Array(10),n=(r,s)=>{if(Ad(r)){if(t.indexOf(r)>=0)return;if(_d(r))return r;if(!("toJSON"in r)){t[s]=r;const i=Hl(r)?[]:{};return Pd(r,(o,l)=>{const c=n(o,s+1);!Nl(c)&&(i[l]=c)}),t[s]=void 0,i}}return r};return n(e,0)},bde=zr("AsyncFunction"),jde=e=>e&&(Ad(e)||An(e))&&An(e.then)&&An(e.catch),n6=((e,t)=>e?setImmediate:t?((n,r)=>(di.addEventListener("message",({source:s,data:i})=>{s===di&&i===n&&r.length&&r.shift()()},!1),s=>{r.push(s),di.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",An(di.postMessage)),wde=typeof queueMicrotask<"u"?queueMicrotask.bind(di):typeof process<"u"&&process.nextTick||n6,Nde=e=>e!=null&&An(e[fx]),G={isArray:Hl,isArrayBuffer:QT,isBuffer:_d,isFormData:Xue,isArrayBufferView:Iue,isString:Lue,isNumber:JT,isBoolean:zue,isObject:Ad,isPlainObject:qf,isEmptyObject:Bue,isReadableStream:Que,isRequest:Jue,isResponse:Zue,isHeaders:ede,isUndefined:Nl,isDate:Fue,isFile:Vue,isReactNativeBlob:Uue,isReactNative:Wue,isBlob:que,isRegExp:pde,isFunction:An,isStream:Kue,isURLSearchParams:Yue,isTypedArray:lde,isFileList:Hue,forEach:Pd,merge:Ry,extend:nde,trim:tde,stripBOM:rde,inherits:ade,toFlatObject:sde,kindOf:px,kindOfTest:zr,endsWith:ide,toArray:ode,forEachEntry:cde,matchAll:ude,isHTMLForm:dde,hasOwnProperty:X5,hasOwnProp:X5,reduceDescriptors:t6,freezeMethods:hde,toObjectSet:mde,toCamelCase:fde,noop:xde,toFiniteNumber:gde,findKey:ZT,global:di,isContextDefined:e6,isSpecCompliantForm:vde,toJSONObject:yde,isAsyncFn:bde,isThenable:jde,setImmediate:n6,asap:wde,isIterable:Nde};let be=class r6 extends Error{static from(t,n,r,s,i,o){const l=new r6(t.message,n||t.code,r,s,i);return l.cause=t,l.name=t.name,t.status!=null&&l.status==null&&(l.status=t.status),o&&Object.assign(l,o),l}constructor(t,n,r,s,i){super(t),Object.defineProperty(this,"message",{value:t,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,n&&(this.code=n),r&&(this.config=r),s&&(this.request=s),i&&(this.response=i,this.status=i.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:G.toJSONObject(this.config),code:this.code,status:this.status}}};be.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";be.ERR_BAD_OPTION="ERR_BAD_OPTION";be.ECONNABORTED="ECONNABORTED";be.ETIMEDOUT="ETIMEDOUT";be.ERR_NETWORK="ERR_NETWORK";be.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";be.ERR_DEPRECATED="ERR_DEPRECATED";be.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";be.ERR_BAD_REQUEST="ERR_BAD_REQUEST";be.ERR_CANCELED="ERR_CANCELED";be.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";be.ERR_INVALID_URL="ERR_INVALID_URL";const Sde=null;function Dy(e){return G.isPlainObject(e)||G.isArray(e)}function a6(e){return G.endsWith(e,"[]")?e.slice(0,-2):e}function A0(e,t,n){return e?e.concat(t).map(function(s,i){return s=a6(s),!n&&i?"["+s+"]":s}).join(n?".":""):t}function kde(e){return G.isArray(e)&&!e.some(Dy)}const Cde=G.toFlatObject(G,{},null,function(t){return/^is[A-Z]/.test(t)});function mx(e,t,n){if(!G.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=G.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(v,x){return!G.isUndefined(x[v])});const r=n.metaTokens,s=n.visitor||d,i=n.dots,o=n.indexes,c=(n.Blob||typeof Blob<"u"&&Blob)&&G.isSpecCompliantForm(t);if(!G.isFunction(s))throw new TypeError("visitor must be a function");function u(m){if(m===null)return"";if(G.isDate(m))return m.toISOString();if(G.isBoolean(m))return m.toString();if(!c&&G.isBlob(m))throw new be("Blob is not supported. Use a Buffer instead.");return G.isArrayBuffer(m)||G.isTypedArray(m)?c&&typeof Blob=="function"?new Blob([m]):Buffer.from(m):m}function d(m,v,x){let y=m;if(G.isReactNative(t)&&G.isReactNativeBlob(m))return t.append(A0(x,v,i),u(m)),!1;if(m&&!x&&typeof m=="object"){if(G.endsWith(v,"{}"))v=r?v:v.slice(0,-2),m=JSON.stringify(m);else if(G.isArray(m)&&kde(m)||(G.isFileList(m)||G.endsWith(v,"[]"))&&(y=G.toArray(m)))return v=a6(v),y.forEach(function(j,N){!(G.isUndefined(j)||j===null)&&t.append(o===!0?A0([v],N,i):o===null?v:v+"[]",u(j))}),!1}return Dy(m)?!0:(t.append(A0(x,v,i),u(m)),!1)}const f=[],p=Object.assign(Cde,{defaultVisitor:d,convertValue:u,isVisitable:Dy});function h(m,v){if(!G.isUndefined(m)){if(f.indexOf(m)!==-1)throw Error("Circular reference detected in "+v.join("."));f.push(m),G.forEach(m,function(y,g){(!(G.isUndefined(y)||y===null)&&s.call(t,y,G.isString(g)?g.trim():g,v,p))===!0&&h(y,v?v.concat(g):[g])}),f.pop()}}if(!G.isObject(e))throw new TypeError("data must be an object");return h(e),t}function Y5(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function Aj(e,t){this._pairs=[],e&&mx(e,this,t)}const s6=Aj.prototype;s6.append=function(t,n){this._pairs.push([t,n])};s6.toString=function(t){const n=t?function(r){return t.call(this,r,Y5)}:Y5;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function _de(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function i6(e,t,n){if(!t)return e;const r=n&&n.encode||_de,s=G.isFunction(n)?{serialize:n}:n,i=s&&s.serialize;let o;if(i?o=i(t,s):o=G.isURLSearchParams(t)?t.toString():new Aj(t,s).toString(r),o){const l=e.indexOf("#");l!==-1&&(e=e.slice(0,l)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class Q5{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){G.forEach(this.handlers,function(r){r!==null&&t(r)})}}const Pj={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},Ade=typeof URLSearchParams<"u"?URLSearchParams:Aj,Pde=typeof FormData<"u"?FormData:null,Ede=typeof Blob<"u"?Blob:null,Ode={isBrowser:!0,classes:{URLSearchParams:Ade,FormData:Pde,Blob:Ede},protocols:["http","https","file","blob","url","data"]},Ej=typeof window<"u"&&typeof document<"u",Iy=typeof navigator=="object"&&navigator||void 0,Tde=Ej&&(!Iy||["ReactNative","NativeScript","NS"].indexOf(Iy.product)<0),$de=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Mde=Ej&&window.location.href||"http://localhost",Rde=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Ej,hasStandardBrowserEnv:Tde,hasStandardBrowserWebWorkerEnv:$de,navigator:Iy,origin:Mde},Symbol.toStringTag,{value:"Module"})),tn={...Rde,...Ode};function Dde(e,t){return mx(e,new tn.classes.URLSearchParams,{visitor:function(n,r,s,i){return tn.isNode&&G.isBuffer(n)?(this.append(r,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}function Ide(e){return G.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function Lde(e){const t={},n=Object.keys(e);let r;const s=n.length;let i;for(r=0;r<s;r++)i=n[r],t[i]=e[i];return t}function o6(e){function t(n,r,s,i){let o=n[i++];if(o==="__proto__")return!0;const l=Number.isFinite(+o),c=i>=n.length;return o=!o&&G.isArray(s)?s.length:o,c?(G.hasOwnProp(s,o)?s[o]=[s[o],r]:s[o]=r,!l):((!s[o]||!G.isObject(s[o]))&&(s[o]=[]),t(n,r,s[o],i)&&G.isArray(s[o])&&(s[o]=Lde(s[o])),!l)}if(G.isFormData(e)&&G.isFunction(e.entries)){const n={};return G.forEachEntry(e,(r,s)=>{t(Ide(r),s,n,0)}),n}return null}function zde(e,t,n){if(G.isString(e))try{return(t||JSON.parse)(e),G.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const Ed={transitional:Pj,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,i=G.isObject(t);if(i&&G.isHTMLForm(t)&&(t=new FormData(t)),G.isFormData(t))return s?JSON.stringify(o6(t)):t;if(G.isArrayBuffer(t)||G.isBuffer(t)||G.isStream(t)||G.isFile(t)||G.isBlob(t)||G.isReadableStream(t))return t;if(G.isArrayBufferView(t))return t.buffer;if(G.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let l;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return Dde(t,this.formSerializer).toString();if((l=G.isFileList(t))||r.indexOf("multipart/form-data")>-1){const c=this.env&&this.env.FormData;return mx(l?{"files[]":t}:t,c&&new c,this.formSerializer)}}return i||s?(n.setContentType("application/json",!1),zde(t)):t}],transformResponse:[function(t){const n=this.transitional||Ed.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if(G.isResponse(t)||G.isReadableStream(t))return t;if(t&&G.isString(t)&&(r&&!this.responseType||s)){const o=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(t,this.parseReviver)}catch(l){if(o)throw l.name==="SyntaxError"?be.from(l,be.ERR_BAD_RESPONSE,this,null,this.response):l}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:tn.classes.FormData,Blob:tn.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};G.forEach(["delete","get","head","post","put","patch"],e=>{Ed.headers[e]={}});const Bde=G.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Fde=e=>{const t={};let n,r,s;return e&&e.split(`
`).forEach(function(o){s=o.indexOf(":"),n=o.substring(0,s).trim().toLowerCase(),r=o.substring(s+1).trim(),!(!n||t[n]&&Bde[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t},J5=Symbol("internals"),Vde=e=>!/[\r\n]/.test(e);function l6(e,t){if(!(e===!1||e==null)){if(G.isArray(e)){e.forEach(n=>l6(n,t));return}if(!Vde(String(e)))throw new Error(`Invalid character in header content ["${t}"]`)}}function yc(e){return e&&String(e).trim().toLowerCase()}function Ude(e){let t=e.length;for(;t>0;){const n=e.charCodeAt(t-1);if(n!==10&&n!==13)break;t-=1}return t===e.length?e:e.slice(0,t)}function Hf(e){return e===!1||e==null?e:G.isArray(e)?e.map(Hf):Ude(String(e))}function Wde(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}const qde=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function P0(e,t,n,r,s){if(G.isFunction(r))return r.call(this,t,n);if(s&&(t=n),!!G.isString(t)){if(G.isString(r))return t.indexOf(r)!==-1;if(G.isRegExp(r))return r.test(t)}}function Hde(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function Kde(e,t){const n=G.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(s,i,o){return this[r].call(this,t,s,i,o)},configurable:!0})})}let Pn=class{constructor(t){t&&this.set(t)}set(t,n,r){const s=this;function i(l,c,u){const d=yc(c);if(!d)throw new Error("header name must be a non-empty string");const f=G.findKey(s,d);(!f||s[f]===void 0||u===!0||u===void 0&&s[f]!==!1)&&(l6(l,c),s[f||c]=Hf(l))}const o=(l,c)=>G.forEach(l,(u,d)=>i(u,d,c));if(G.isPlainObject(t)||t instanceof this.constructor)o(t,n);else if(G.isString(t)&&(t=t.trim())&&!qde(t))o(Fde(t),n);else if(G.isObject(t)&&G.isIterable(t)){let l={},c,u;for(const d of t){if(!G.isArray(d))throw TypeError("Object iterator must return a key-value pair");l[u=d[0]]=(c=l[u])?G.isArray(c)?[...c,d[1]]:[c,d[1]]:d[1]}o(l,n)}else t!=null&&i(n,t,r);return this}get(t,n){if(t=yc(t),t){const r=G.findKey(this,t);if(r){const s=this[r];if(!n)return s;if(n===!0)return Wde(s);if(G.isFunction(n))return n.call(this,s,r);if(G.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=yc(t),t){const r=G.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||P0(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let s=!1;function i(o){if(o=yc(o),o){const l=G.findKey(r,o);l&&(!n||P0(r,r[l],l,n))&&(delete r[l],s=!0)}}return G.isArray(t)?t.forEach(i):i(t),s}clear(t){const n=Object.keys(this);let r=n.length,s=!1;for(;r--;){const i=n[r];(!t||P0(this,this[i],i,t,!0))&&(delete this[i],s=!0)}return s}normalize(t){const n=this,r={};return G.forEach(this,(s,i)=>{const o=G.findKey(r,i);if(o){n[o]=Hf(s),delete n[i];return}const l=t?Hde(i):String(i).trim();l!==i&&delete n[i],n[l]=Hf(s),r[l]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return G.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=t&&G.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(`
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(s=>r.set(s)),r}static accessor(t){const r=(this[J5]=this[J5]={accessors:{}}).accessors,s=this.prototype;function i(o){const l=yc(o);r[l]||(Kde(s,o),r[l]=!0)}return G.isArray(t)?t.forEach(i):i(t),this}};Pn.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);G.reduceDescriptors(Pn.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});G.freezeMethods(Pn);function E0(e,t){const n=this||Ed,r=t||n,s=Pn.from(r.headers);let i=r.data;return G.forEach(e,function(l){i=l.call(n,i,s.normalize(),t?t.status:void 0)}),s.normalize(),i}function c6(e){return!!(e&&e.__CANCEL__)}let Od=class extends be{constructor(t,n,r){super(t??"canceled",be.ERR_CANCELED,n,r),this.name="CanceledError",this.__CANCEL__=!0}};function u6(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new be("Request failed with status code "+n.status,[be.ERR_BAD_REQUEST,be.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function Gde(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function Xde(e,t){e=e||10;const n=new Array(e),r=new Array(e);let s=0,i=0,o;return t=t!==void 0?t:1e3,function(c){const u=Date.now(),d=r[i];o||(o=u),n[s]=c,r[s]=u;let f=i,p=0;for(;f!==s;)p+=n[f++],f=f%e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),u-o<t)return;const h=d&&u-d;return h?Math.round(p*1e3/h):void 0}}function Yde(e,t){let n=0,r=1e3/t,s,i;const o=(u,d=Date.now())=>{n=d,s=null,i&&(clearTimeout(i),i=null),e(...u)};return[(...u)=>{const d=Date.now(),f=d-n;f>=r?o(u,d):(s=u,i||(i=setTimeout(()=>{i=null,o(s)},r-f)))},()=>s&&o(s)]}const zh=(e,t,n=3)=>{let r=0;const s=Xde(50,250);return Yde(i=>{const o=i.loaded,l=i.lengthComputable?i.total:void 0,c=o-r,u=s(c),d=o<=l;r=o;const f={loaded:o,total:l,progress:l?o/l:void 0,bytes:c,rate:u||void 0,estimated:u&&l&&d?(l-o)/u:void 0,event:i,lengthComputable:l!=null,[t?"download":"upload"]:!0};e(f)},n)},Z5=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},e4=e=>(...t)=>G.asap(()=>e(...t)),Qde=tn.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,tn.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(tn.origin),tn.navigator&&/(msie|trident)/i.test(tn.navigator.userAgent)):()=>!0,Jde=tn.hasStandardBrowserEnv?{write(e,t,n,r,s,i,o){if(typeof document>"u")return;const l=[`${e}=${encodeURIComponent(t)}`];G.isNumber(n)&&l.push(`expires=${new Date(n).toUTCString()}`),G.isString(r)&&l.push(`path=${r}`),G.isString(s)&&l.push(`domain=${s}`),i===!0&&l.push("secure"),G.isString(o)&&l.push(`SameSite=${o}`),document.cookie=l.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function Zde(e){return typeof e!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function efe(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function d6(e,t,n){let r=!Zde(t);return e&&(r||n==!1)?efe(e,t):t}const t4=e=>e instanceof Pn?{...e}:e;function Ii(e,t){t=t||{};const n={};function r(u,d,f,p){return G.isPlainObject(u)&&G.isPlainObject(d)?G.merge.call({caseless:p},u,d):G.isPlainObject(d)?G.merge({},d):G.isArray(d)?d.slice():d}function s(u,d,f,p){if(G.isUndefined(d)){if(!G.isUndefined(u))return r(void 0,u,f,p)}else return r(u,d,f,p)}function i(u,d){if(!G.isUndefined(d))return r(void 0,d)}function o(u,d){if(G.isUndefined(d)){if(!G.isUndefined(u))return r(void 0,u)}else return r(void 0,d)}function l(u,d,f){if(f in t)return r(u,d);if(f in e)return r(void 0,u)}const c={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:l,headers:(u,d,f)=>s(t4(u),t4(d),f,!0)};return G.forEach(Object.keys({...e,...t}),function(d){if(d==="__proto__"||d==="constructor"||d==="prototype")return;const f=G.hasOwnProp(c,d)?c[d]:s,p=f(e[d],t[d],d);G.isUndefined(p)&&f!==l||(n[d]=p)}),n}const f6=e=>{const t=Ii({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:i,headers:o,auth:l}=t;if(t.headers=o=Pn.from(o),t.url=i6(d6(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),l&&o.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):""))),G.isFormData(n)){if(tn.hasStandardBrowserEnv||tn.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(G.isFunction(n.getHeaders)){const c=n.getHeaders(),u=["content-type","content-length"];Object.entries(c).forEach(([d,f])=>{u.includes(d.toLowerCase())&&o.set(d,f)})}}if(tn.hasStandardBrowserEnv&&(r&&G.isFunction(r)&&(r=r(t)),r||r!==!1&&Qde(t.url))){const c=s&&i&&Jde.read(i);c&&o.set(s,c)}return t},tfe=typeof XMLHttpRequest<"u",nfe=tfe&&function(e){return new Promise(function(n,r){const s=f6(e);let i=s.data;const o=Pn.from(s.headers).normalize();let{responseType:l,onUploadProgress:c,onDownloadProgress:u}=s,d,f,p,h,m;function v(){h&&h(),m&&m(),s.cancelToken&&s.cancelToken.unsubscribe(d),s.signal&&s.signal.removeEventListener("abort",d)}let x=new XMLHttpRequest;x.open(s.method.toUpperCase(),s.url,!0),x.timeout=s.timeout;function y(){if(!x)return;const j=Pn.from("getAllResponseHeaders"in x&&x.getAllResponseHeaders()),w={data:!l||l==="text"||l==="json"?x.responseText:x.response,status:x.status,statusText:x.statusText,headers:j,config:e,request:x};u6(function(k){n(k),v()},function(k){r(k),v()},w),x=null}"onloadend"in x?x.onloadend=y:x.onreadystatechange=function(){!x||x.readyState!==4||x.status===0&&!(x.responseURL&&x.responseURL.indexOf("file:")===0)||setTimeout(y)},x.onabort=function(){x&&(r(new be("Request aborted",be.ECONNABORTED,e,x)),x=null)},x.onerror=function(N){const w=N&&N.message?N.message:"Network Error",S=new be(w,be.ERR_NETWORK,e,x);S.event=N||null,r(S),x=null},x.ontimeout=function(){let N=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const w=s.transitional||Pj;s.timeoutErrorMessage&&(N=s.timeoutErrorMessage),r(new be(N,w.clarifyTimeoutError?be.ETIMEDOUT:be.ECONNABORTED,e,x)),x=null},i===void 0&&o.setContentType(null),"setRequestHeader"in x&&G.forEach(o.toJSON(),function(N,w){x.setRequestHeader(w,N)}),G.isUndefined(s.withCredentials)||(x.withCredentials=!!s.withCredentials),l&&l!=="json"&&(x.responseType=s.responseType),u&&([p,m]=zh(u,!0),x.addEventListener("progress",p)),c&&x.upload&&([f,h]=zh(c),x.upload.addEventListener("progress",f),x.upload.addEventListener("loadend",h)),(s.cancelToken||s.signal)&&(d=j=>{x&&(r(!j||j.type?new Od(null,e,x):j),x.abort(),x=null)},s.cancelToken&&s.cancelToken.subscribe(d),s.signal&&(s.signal.aborted?d():s.signal.addEventListener("abort",d)));const g=Gde(s.url);if(g&&tn.protocols.indexOf(g)===-1){r(new be("Unsupported protocol "+g+":",be.ERR_BAD_REQUEST,e));return}x.send(i||null)})},rfe=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,s;const i=function(u){if(!s){s=!0,l();const d=u instanceof Error?u:this.reason;r.abort(d instanceof be?d:new Od(d instanceof Error?d.message:d))}};let o=t&&setTimeout(()=>{o=null,i(new be(`timeout of ${t}ms exceeded`,be.ETIMEDOUT))},t);const l=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(u=>{u.unsubscribe?u.unsubscribe(i):u.removeEventListener("abort",i)}),e=null)};e.forEach(u=>u.addEventListener("abort",i));const{signal:c}=r;return c.unsubscribe=()=>G.asap(l),c}},afe=function*(e,t){let n=e.byteLength;if(n<t){yield e;return}let r=0,s;for(;r<n;)s=r+t,yield e.slice(r,s),r=s},sfe=async function*(e,t){for await(const n of ife(e))yield*afe(n,t)},ife=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:n,value:r}=await t.read();if(n)break;yield r}}finally{await t.cancel()}},n4=(e,t,n,r)=>{const s=sfe(e,t);let i=0,o,l=c=>{o||(o=!0,r&&r(c))};return new ReadableStream({async pull(c){try{const{done:u,value:d}=await s.next();if(u){l(),c.close();return}let f=d.byteLength;if(n){let p=i+=f;n(p)}c.enqueue(new Uint8Array(d))}catch(u){throw l(u),u}},cancel(c){return l(c),s.return()}},{highWaterMark:2})},r4=64*1024,{isFunction:vf}=G,ofe=(({Request:e,Response:t})=>({Request:e,Response:t}))(G.global),{ReadableStream:a4,TextEncoder:s4}=G.global,i4=(e,...t)=>{try{return!!e(...t)}catch{return!1}},lfe=e=>{e=G.merge.call({skipUndefined:!0},ofe,e);const{fetch:t,Request:n,Response:r}=e,s=t?vf(t):typeof fetch=="function",i=vf(n),o=vf(r);if(!s)return!1;const l=s&&vf(a4),c=s&&(typeof s4=="function"?(m=>v=>m.encode(v))(new s4):async m=>new Uint8Array(await new n(m).arrayBuffer())),u=i&&l&&i4(()=>{let m=!1;const v=new a4,x=new n(tn.origin,{body:v,method:"POST",get duplex(){return m=!0,"half"}}).headers.has("Content-Type");return v.cancel(),m&&!x}),d=o&&l&&i4(()=>G.isReadableStream(new r("").body)),f={stream:d&&(m=>m.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(m=>{!f[m]&&(f[m]=(v,x)=>{let y=v&&v[m];if(y)return y.call(v);throw new be(`Response type '${m}' is not supported`,be.ERR_NOT_SUPPORT,x)})});const p=async m=>{if(m==null)return 0;if(G.isBlob(m))return m.size;if(G.isSpecCompliantForm(m))return(await new n(tn.origin,{method:"POST",body:m}).arrayBuffer()).byteLength;if(G.isArrayBufferView(m)||G.isArrayBuffer(m))return m.byteLength;if(G.isURLSearchParams(m)&&(m=m+""),G.isString(m))return(await c(m)).byteLength},h=async(m,v)=>{const x=G.toFiniteNumber(m.getContentLength());return x??p(v)};return async m=>{let{url:v,method:x,data:y,signal:g,cancelToken:j,timeout:N,onDownloadProgress:w,onUploadProgress:S,responseType:k,headers:C,withCredentials:_="same-origin",fetchOptions:A}=f6(m),E=t||fetch;k=k?(k+"").toLowerCase():"text";let P=rfe([g,j&&j.toAbortSignal()],N),D=null;const I=P&&P.unsubscribe&&(()=>{P.unsubscribe()});let R;try{if(S&&u&&x!=="get"&&x!=="head"&&(R=await h(C,y))!==0){let U=new n(v,{method:"POST",body:y,duplex:"half"}),L;if(G.isFormData(y)&&(L=U.headers.get("content-type"))&&C.setContentType(L),U.body){const[B,ae]=Z5(R,zh(e4(S)));y=n4(U.body,r4,B,ae)}}G.isString(_)||(_=_?"include":"omit");const M=i&&"credentials"in n.prototype,W={...A,signal:P,method:x.toUpperCase(),headers:C.normalize().toJSON(),body:y,duplex:"half",credentials:M?_:void 0};D=i&&new n(v,W);let T=await(i?E(D,A):E(v,W));const V=d&&(k==="stream"||k==="response");if(d&&(w||V&&I)){const U={};["status","statusText","headers"].forEach(se=>{U[se]=T[se]});const L=G.toFiniteNumber(T.headers.get("content-length")),[B,ae]=w&&Z5(L,zh(e4(w),!0))||[];T=new r(n4(T.body,r4,B,()=>{ae&&ae(),I&&I()}),U)}k=k||"text";let X=await f[G.findKey(f,k)||"text"](T,m);return!V&&I&&I(),await new Promise((U,L)=>{u6(U,L,{data:X,headers:Pn.from(T.headers),status:T.status,statusText:T.statusText,config:m,request:D})})}catch(M){throw I&&I(),M&&M.name==="TypeError"&&/Load failed|fetch/i.test(M.message)?Object.assign(new be("Network Error",be.ERR_NETWORK,m,D,M&&M.response),{cause:M.cause||M}):be.from(M,M&&M.code,m,D,M&&M.response)}}},cfe=new Map,p6=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:s}=t,i=[r,s,n];let o=i.length,l=o,c,u,d=cfe;for(;l--;)c=i[l],u=d.get(c),u===void 0&&d.set(c,u=l?new Map:lfe(t)),d=u;return u};p6();const Oj={http:Sde,xhr:nfe,fetch:{get:p6}};G.forEach(Oj,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const o4=e=>`- ${e}`,ufe=e=>G.isFunction(e)||e===null||e===!1;function dfe(e,t){e=G.isArray(e)?e:[e];const{length:n}=e;let r,s;const i={};for(let o=0;o<n;o++){r=e[o];let l;if(s=r,!ufe(r)&&(s=Oj[(l=String(r)).toLowerCase()],s===void 0))throw new be(`Unknown adapter '${l}'`);if(s&&(G.isFunction(s)||(s=s.get(t))))break;i[l||"#"+o]=s}if(!s){const o=Object.entries(i).map(([c,u])=>`adapter ${c} `+(u===!1?"is not supported by the environment":"is not available in the build"));let l=n?o.length>1?`since :
`+o.map(o4).join(`
`):" "+o4(o[0]):"as no adapter specified";throw new be("There is no suitable adapter to dispatch the request "+l,"ERR_NOT_SUPPORT")}return s}const h6={getAdapter:dfe,adapters:Oj};function O0(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Od(null,e)}function l4(e){return O0(e),e.headers=Pn.from(e.headers),e.data=E0.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),h6.getAdapter(e.adapter||Ed.adapter,e)(e).then(function(r){return O0(e),r.data=E0.call(e,e.transformResponse,r),r.headers=Pn.from(r.headers),r},function(r){return c6(r)||(O0(e),r&&r.response&&(r.response.data=E0.call(e,e.transformResponse,r.response),r.response.headers=Pn.from(r.response.headers))),Promise.reject(r)})}const m6="1.15.0",xx={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{xx[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const c4={};xx.transitional=function(t,n,r){function s(i,o){return"[Axios v"+m6+"] Transitional option '"+i+"'"+o+(r?". "+r:"")}return(i,o,l)=>{if(t===!1)throw new be(s(o," has been removed"+(n?" in "+n:"")),be.ERR_DEPRECATED);return n&&!c4[o]&&(c4[o]=!0,console.warn(s(o," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(i,o,l):!0}};xx.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function ffe(e,t,n){if(typeof e!="object")throw new be("options must be an object",be.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let s=r.length;for(;s-- >0;){const i=r[s],o=t[i];if(o){const l=e[i],c=l===void 0||o(l,i,e);if(c!==!0)throw new be("option "+i+" must be "+c,be.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new be("Unknown option "+i,be.ERR_BAD_OPTION)}}const Kf={assertOptions:ffe,validators:xx},Gn=Kf.validators;let bi=class{constructor(t){this.defaults=t||{},this.interceptors={request:new Q5,response:new Q5}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const i=(()=>{if(!s.stack)return"";const o=s.stack.indexOf(`
`);return o===-1?"":s.stack.slice(o+1)})();try{if(!r.stack)r.stack=i;else if(i){const o=i.indexOf(`
`),l=o===-1?-1:i.indexOf(`
`,o+1),c=l===-1?"":i.slice(l+1);String(r.stack).endsWith(c)||(r.stack+=`
`+i)}}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Ii(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:i}=n;r!==void 0&&Kf.assertOptions(r,{silentJSONParsing:Gn.transitional(Gn.boolean),forcedJSONParsing:Gn.transitional(Gn.boolean),clarifyTimeoutError:Gn.transitional(Gn.boolean),legacyInterceptorReqResOrdering:Gn.transitional(Gn.boolean)},!1),s!=null&&(G.isFunction(s)?n.paramsSerializer={serialize:s}:Kf.assertOptions(s,{encode:Gn.function,serialize:Gn.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Kf.assertOptions(n,{baseUrl:Gn.spelling("baseURL"),withXsrfToken:Gn.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=i&&G.merge(i.common,i[n.method]);i&&G.forEach(["delete","get","head","post","put","patch","common"],m=>{delete i[m]}),n.headers=Pn.concat(o,i);const l=[];let c=!0;this.interceptors.request.forEach(function(v){if(typeof v.runWhen=="function"&&v.runWhen(n)===!1)return;c=c&&v.synchronous;const x=n.transitional||Pj;x&&x.legacyInterceptorReqResOrdering?l.unshift(v.fulfilled,v.rejected):l.push(v.fulfilled,v.rejected)});const u=[];this.interceptors.response.forEach(function(v){u.push(v.fulfilled,v.rejected)});let d,f=0,p;if(!c){const m=[l4.bind(this),void 0];for(m.unshift(...l),m.push(...u),p=m.length,d=Promise.resolve(n);f<p;)d=d.then(m[f++],m[f++]);return d}p=l.length;let h=n;for(;f<p;){const m=l[f++],v=l[f++];try{h=m(h)}catch(x){v.call(this,x);break}}try{d=l4.call(this,h)}catch(m){return Promise.reject(m)}for(f=0,p=u.length;f<p;)d=d.then(u[f++],u[f++]);return d}getUri(t){t=Ii(this.defaults,t);const n=d6(t.baseURL,t.url,t.allowAbsoluteUrls);return i6(n,t.params,t.paramsSerializer)}};G.forEach(["delete","get","head","options"],function(t){bi.prototype[t]=function(n,r){return this.request(Ii(r||{},{method:t,url:n,data:(r||{}).data}))}});G.forEach(["post","put","patch"],function(t){function n(r){return function(i,o,l){return this.request(Ii(l||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}bi.prototype[t]=n(),bi.prototype[t+"Form"]=n(!0)});let pfe=class x6{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(i){n=i});const r=this;this.promise.then(s=>{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](s);r._listeners=null}),this.promise.then=s=>{let i;const o=new Promise(l=>{r.subscribe(l),i=l}).then(s);return o.cancel=function(){r.unsubscribe(i)},o},t(function(i,o,l){r.reason||(r.reason=new Od(i,o,l),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new x6(function(s){t=s}),cancel:t}}};function hfe(e){return function(n){return e.apply(null,n)}}function mfe(e){return G.isObject(e)&&e.isAxiosError===!0}const Ly={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Ly).forEach(([e,t])=>{Ly[t]=e});function g6(e){const t=new bi(e),n=XT(bi.prototype.request,t);return G.extend(n,bi.prototype,t,{allOwnKeys:!0}),G.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return g6(Ii(e,s))},n}const xt=g6(Ed);xt.Axios=bi;xt.CanceledError=Od;xt.CancelToken=pfe;xt.isCancel=c6;xt.VERSION=m6;xt.toFormData=mx;xt.AxiosError=be;xt.Cancel=xt.CanceledError;xt.all=function(t){return Promise.all(t)};xt.spread=hfe;xt.isAxiosError=mfe;xt.mergeConfig=Ii;xt.AxiosHeaders=Pn;xt.formToJSON=e=>o6(G.isHTMLForm(e)?new FormData(e):e);xt.getAdapter=h6.getAdapter;xt.HttpStatusCode=Ly;xt.default=xt;const{Axios:Cye,AxiosError:_ye,CanceledError:Aye,isCancel:Pye,CancelToken:Eye,VERSION:Oye,all:Tye,Cancel:$ye,isAxiosError:Mye,spread:Rye,toFormData:Dye,AxiosHeaders:Iye,HttpStatusCode:Lye,formToJSON:zye,getAdapter:Bye,mergeConfig:Fye}=xt,$=xt.create({baseURL:"/api",withCredentials:!0});$.interceptors.response.use(e=>e,e=>{var t;return((t=e.response)==null?void 0:t.status)===401&&window.dispatchEvent(new CustomEvent("auth:logout")),Promise.reject(e)});const xfe={getDashboard:()=>$.get("/analytics/dashboard").then(e=>e.data)},gr={list:()=>$.get("/raffle").then(e=>e.data),getDetail:e=>$.get(`/raffle/${e}`).then(t=>t.data),draw:e=>$.post(`/raffle/${e}/draw`).then(t=>t.data),create:e=>$.post("/raffle",e).then(t=>t.data),update:(e,t)=>$.put(`/raffle/${e}`,t).then(n=>n.data),delete:e=>$.delete(`/raffle/${e}`).then(t=>t.data),getDiscounts:e=>$.get(`/raffle/${e}/discounts`).then(t=>t.data),saveDiscounts:(e,t)=>$.post(`/raffle/${e}/discounts`,{tiers:t}).then(n=>n.data),getFlashPromo:e=>$.get(`/raffle/${e}/flash-promo`).then(t=>t.data),createFlashPromo:(e,t)=>$.post(`/raffle/${e}/flash-promo`,t).then(n=>n.data),cancelFlashPromo:(e,t)=>$.delete(`/raffle/${e}/flash-promo/${t}`).then(n=>n.data)},yf={list:()=>$.get("/promotions/all").then(e=>e.data),create:e=>$.post("/promotions",e).then(t=>t.data),update:(e,t)=>$.put(`/promotions/${e}`,t).then(n=>n.data),delete:e=>$.delete(`/promotions/${e}`).then(t=>t.data)},T0={list:()=>$.get("/users").then(e=>e.data),update:(e,t)=>$.put(`/users/${e}`,t).then(n=>n.data),delete:e=>$.delete(`/users/${e}`).then(t=>t.data)},u4={getAsaasKey:()=>$.get("/settings/asaas").then(e=>e.data),saveAsaasKey:e=>$.post("/settings/asaas",{key:e}).then(t=>t.data)},qs={list:()=>$.get("/plugins").then(e=>e.data),activate:e=>$.post(`/plugins/${e}/activate`).then(t=>t.data),deactivate:e=>$.post(`/plugins/${e}/deactivate`).then(t=>t.data),getConfig:e=>$.get(`/plugins/${e}/config`).then(t=>t.data),setConfig:(e,t)=>$.put(`/plugins/${e}/config`,t).then(n=>n.data)},gfe={list:e=>$.get("/orders",{params:e}).then(t=>t.data)},d4={list:e=>$.get("/claims",{params:e?{status:e}:{}}).then(t=>t.data),updateStatus:(e,t)=>$.patch(`/claims/${e}`,{status:t}).then(n=>n.data)},f4={get:()=>$.get("/admin/club/reports").then(e=>e.data),exportCsv:e=>$.get("/admin/club/members",{params:{...e,limit:9999}}).then(t=>t.data)},Ut={listMembers:(e,t)=>$.get("/admin/club/members",{params:{club_id:e,...t}}).then(n=>n.data),updateMemberStatus:(e,t)=>$.patch(`/admin/club/members/${e}`,{status:t}).then(n=>n.data),listPartners:e=>$.get("/admin/club/partners",{params:{club_id:e}}).then(t=>t.data),createPartner:e=>$.post("/admin/club/partners",e).then(t=>t.data),updatePartner:(e,t)=>$.put(`/admin/club/partners/${e}`,t).then(n=>n.data),deletePartner:e=>$.delete(`/admin/club/partners/${e}`).then(t=>t.data),listPlans:e=>$.get("/admin/club/plans",{params:{club_id:e}}).then(t=>t.data),createPlan:e=>$.post("/admin/club/plans",e).then(t=>t.data),updatePlan:(e,t)=>$.put(`/admin/club/plans/${e}`,t).then(n=>n.data),deletePlan:e=>$.delete(`/admin/club/plans/${e}`).then(t=>t.data),saveContent:(e,t)=>$.put(`/admin/club/${e}/content`,t).then(n=>n.data),listFaqs:e=>$.get("/admin/club/faqs",{params:{club_id:e}}).then(t=>t.data),createFaq:e=>$.post("/admin/club/faqs",e).then(t=>t.data),updateFaq:(e,t)=>$.put(`/admin/club/faqs/${e}`,t).then(n=>n.data),deleteFaq:e=>$.delete(`/admin/club/faqs/${e}`).then(t=>t.data)},Xr={kpi:()=>$.get("/admin/jobs/kpi").then(e=>e.data),list:e=>$.get("/admin/jobs",{params:e}).then(t=>t.data),create:e=>$.post("/admin/jobs",e).then(t=>t.data),update:(e,t)=>$.put(`/admin/jobs/${e}`,t).then(n=>n.data),toggle:e=>$.patch(`/admin/jobs/${e}/toggle`).then(t=>t.data),remove:e=>$.delete(`/admin/jobs/${e}`).then(t=>t.data),getApplications:(e,t)=>$.get(`/admin/jobs/${e}/applications`,{params:t}).then(n=>n.data),getApplication:e=>$.get(`/admin/applications/${e}`).then(t=>t.data),updateApplication:(e,t)=>$.patch(`/admin/applications/${e}`,t).then(n=>n.data),searchResumes:e=>$.get("/admin/resumes",{params:e}).then(t=>t.data),getResume:e=>$.get(`/admin/resumes/${e}`).then(t=>t.data)},Hc={get:()=>$.get("/admin/me").then(e=>e.data),linkAccount:e=>$.patch("/admin/me/account",{account_id:e}).then(t=>t.data)},bf={list:()=>$.get("/admins").then(e=>e.data),create:e=>$.post("/admins",e).then(t=>t.data),update:(e,t)=>$.put(`/admins/${e}`,t).then(n=>n.data),delete:e=>$.delete(`/admins/${e}`).then(t=>t.data)},p4={request:async(e,t)=>{const n=await fetch("/api/pair/proxy/request",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({email:e,nwUrl:t})}),r=await n.json();if(!n.ok)throw new Error(r.error||"Erro ao solicitar código");return r},confirm:async(e,t,n)=>{const r=await fetch("/api/pair/proxy/confirm",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({email:e,code:t,nwUrl:n})}),s=await r.json();if(!r.ok)throw new Error(s.error||"Código inválido");return s}},he={getSessions:()=>$.get("/nw/v1/sessions").then(e=>e.data),getQr:e=>$.get(`/nw/v1/sessions/${e}/qr`).then(t=>t.data),getInbox:(e,t,n=50)=>$.get("/nw/v1/inbox",{params:{session:e,search:t,limit:n}}).then(r=>r.data),getMessages:(e,t=50,n)=>$.get(`/nw/v1/inbox/${e}/messages`,{params:{limit:t,before:n}}).then(r=>r.data),send:(e,t)=>$.post(`/nw/v1/inbox/${e}/send`,{text:t}).then(n=>n.data),markRead:e=>$.post(`/nw/v1/inbox/${e}/read`).then(t=>t.data),archive:(e,t)=>$.patch(`/nw/v1/inbox/${e}/archive`,{archived:t}).then(n=>n.data),pin:(e,t)=>$.patch(`/nw/v1/inbox/${e}/pin`,{pinned:t}).then(n=>n.data),deleteChat:e=>$.delete(`/nw/v1/inbox/${e}`).then(t=>t.data),getWebhooks:()=>$.get("/nw/v1/webhooks").then(e=>e.data),createWebhook:e=>$.post("/nw/v1/webhooks",e).then(t=>t.data),deleteWebhook:e=>$.delete(`/nw/v1/webhooks/${e}`).then(t=>t.data),toggleWebhook:(e,t)=>$.patch(`/nw/v1/webhooks/${e}`,{active:t}).then(n=>n.data),secretariaAsk:(e,t,n)=>$.post("/nw/v1/secretaria/ask",{chatId:e,message:t,contactName:n}).then(r=>r.data),startConversation:(e,t,n)=>$.post("/nw/v1/conversations",{sessionId:e,phone:t,text:n}).then(r=>r.data),createSession:e=>$.post("/nw/v1/sessions",{name:e}).then(t=>t.data),deleteSession:e=>$.delete(`/nw/v1/sessions/${e}`).then(t=>t.data),getNumbers:()=>$.get("/nw/v1/secretaria/numbers").then(e=>e.data),saveNumber:e=>$.post("/nw/v1/secretaria/numbers",e).then(t=>t.data),updateNumber:(e,t)=>$.put(`/nw/v1/secretaria/numbers/${e}`,t).then(n=>n.data),deleteNumber:e=>$.delete(`/nw/v1/secretaria/numbers/${e}`).then(t=>t.data),getMetrics:e=>$.get("/admin/nw/metrics",{params:{period:e??"7d"}}).then(t=>t.data),getAutoReplyMode:()=>$.get("/admin/nw/auto-reply-mode").then(e=>e.data),setAutoReplyMode:e=>$.put("/admin/nw/auto-reply-mode",{mode:e}).then(t=>t.data),syncKnowledge:()=>$.post("/admin/nw/sync-knowledge").then(e=>e.data),secGetAgent:()=>$.get("/nw/v1/sec/agent").then(e=>e.data),secCreateAgent:e=>$.post("/nw/v1/sec/agent",e).then(t=>t.data),secUpdateAgent:(e,t)=>$.put(`/nw/v1/sec/agent/${e}`,t).then(n=>n.data),secGetNodes:()=>$.get("/nw/v1/sec/nodes").then(e=>e.data),secCreateNode:e=>$.post("/nw/v1/sec/nodes",e).then(t=>t.data),secUpdateNode:(e,t)=>$.put(`/nw/v1/sec/nodes/${e}`,t).then(n=>n.data),secDeleteNode:e=>$.delete(`/nw/v1/sec/nodes/${e}`).then(t=>t.data),secGetSlots:()=>$.get("/nw/v1/sec/slots").then(e=>e.data),secCreateSlot:e=>$.post("/nw/v1/sec/slots",e).then(t=>t.data),secDeleteSlot:e=>$.delete(`/nw/v1/sec/slots/${e}`).then(t=>t.data),secGetConversations:()=>$.get("/nw/v1/sec/conversations").then(e=>e.data),secGetConvMessages:e=>$.get(`/nw/v1/sec/conversations/${e}/messages`).then(t=>t.data),secFinalizeConv:e=>$.post(`/nw/v1/sec/conversations/${e}/finalize`).then(t=>t.data),secTestAsk:(e,t)=>$.post("/nw/v1/secretaria/ask",{chatId:`test-panel-${e}`,message:t,contactName:"Teste Admin"}).then(n=>n.data),secGetKeys:()=>$.get("/nw/v1/sec/keys").then(e=>e.data),secSaveKeys:e=>$.put("/nw/v1/sec/keys",e).then(t=>t.data),getHandoffMode:e=>$.get(`/nw/handoff/${encodeURIComponent(e)}`).then(t=>t.data),setHandoffMode:(e,t)=>$.patch(`/nw/handoff/${encodeURIComponent(e)}`,{mode:t}).then(n=>n.data),sendRich:(e,t)=>$.post(`/nw/v1/inbox/${e}/send`,t).then(n=>n.data),listTemplates:e=>$.get("/nw/v1/templates",{params:e}).then(t=>t.data),createTemplate:e=>$.post("/nw/v1/templates",e).then(t=>t.data),deleteTemplate:e=>$.delete(`/nw/v1/templates/${e}`).then(t=>t.data),markTemplateUsed:e=>$.post(`/nw/v1/templates/${e}/use`).then(t=>t.data),listScheduled:()=>$.get("/nw/v1/scheduled").then(e=>e.data),createScheduled:e=>$.post("/nw/v1/scheduled",e).then(t=>t.data),deleteScheduled:e=>$.delete(`/nw/v1/scheduled/${e}`).then(t=>t.data),pauseScheduled:e=>$.post(`/nw/v1/scheduled/${e}/pause`).then(t=>t.data),resumeScheduled:e=>$.post(`/nw/v1/scheduled/${e}/resume`).then(t=>t.data)},v6={assume:e=>$.post("/admin/escalation/assume",e).then(t=>t.data),transfer:e=>$.post("/admin/protocol/transfer",e).then(t=>t.data)},vfe={answer:(e,t)=>$.post(`/human-api/answer/${e}`,{answer:t}).then(n=>n.data)},h4={close:e=>$.post("/admin/protocol/close",e).then(t=>t.data),flag:e=>$.post("/admin/protocol/flag",e).then(t=>t.data)},m4={save:e=>$.post("/admin/knowledge/save",e).then(t=>t.data),promote:e=>$.post(`/admin/knowledge/promote/${e}`).then(t=>t.data),list:(e=!1)=>$.get(`/admin/knowledge${e?"":"?promoted=false"}`).then(t=>t.data)},Ac={send:(e,t)=>$.post("/admin/inbox/direct-message",{to_account:e,content:t}).then(n=>n.data),getConversation:(e,t=50)=>$.get(`/admin/inbox/direct/${e}?limit=${t}`).then(n=>n.data),getLastMessages:()=>$.get("/admin/inbox/direct-messages").then(e=>e.data),getColleagues:()=>$.get("/admin/inbox/colleagues").then(e=>e.data),markAsRead:e=>$.patch(`/admin/inbox/direct/${e}/read`).then(t=>t.data)},Kc={list:()=>$.get("/admin/inbox/groups").then(e=>e.data),getMessages:(e,t=50,n)=>{const r=new URLSearchParams({limit:String(t)});return n&&r.set("before",n),$.get(`/admin/inbox/groups/${e}/messages?${r}`).then(s=>s.data)},sendMessage:(e,t)=>$.post(`/admin/inbox/groups/${e}/message`,{content:t}).then(n=>n.data),getMembers:e=>$.get(`/admin/inbox/groups/${e}/members`).then(t=>t.data),markRead:e=>$.post(`/admin/inbox/groups/${e}/read`).then(t=>t.data)},Gf={send:e=>$.post("/admin/inbox/broadcast",{content:e}).then(t=>t.data),list:()=>$.get("/admin/inbox/broadcasts").then(e=>e.data),markSeen:()=>$.post("/admin/inbox/broadcasts/seen").then(e=>e.data)},Zn={list:e=>$.get("/admin/accounts",{params:e}).then(t=>t.data),get:e=>$.get(`/admin/accounts/${e}`).then(t=>t.data),create:e=>$.post("/admin/accounts",e).then(t=>t.data),update:(e,t)=>$.put(`/admin/accounts/${e}`,t).then(n=>n.data),remove:e=>$.delete(`/admin/accounts/${e}`).then(t=>t.data)},er={list:()=>$.get("/admin/sectors").then(e=>e.data),get:e=>$.get(`/admin/sectors/${e}`).then(t=>t.data),create:e=>$.post("/admin/sectors",e).then(t=>t.data),update:(e,t)=>$.put(`/admin/sectors/${e}`,t).then(n=>n.data),remove:e=>$.delete(`/admin/sectors/${e}`).then(t=>t.data),getBrain:e=>$.get(`/admin/sectors/${e}/brain`).then(t=>t.data),createBrain:(e,t)=>$.post(`/admin/sectors/${e}/brain`,t).then(n=>n.data),updateBrain:(e,t)=>$.put(`/admin/sectors/brain/${e}`,t).then(n=>n.data),deleteBrain:e=>$.delete(`/admin/sectors/brain/${e}`).then(t=>t.data)},Js={list:e=>$.get("/admin/team-members",{params:e}).then(t=>t.data),add:e=>$.post("/admin/team-members",e).then(t=>t.data),update:(e,t)=>$.put(`/admin/team-members/${e}`,t).then(n=>n.data),remove:e=>$.delete(`/admin/team-members/${e}`).then(t=>t.data)},Gc={listThreads:e=>$.get("/admin/inbox/threads",{params:{account_id:e}}).then(t=>t.data),getThread:e=>$.get(`/admin/inbox/threads/${e}`).then(t=>t.data),postMessage:e=>$.post("/admin/inbox/messages",e).then(t=>t.data),markRead:(e,t)=>$.post(`/admin/inbox/threads/${e}/read`,{account_id:t}).then(n=>n.data),unreadCount:e=>$.get("/admin/inbox/unread",{params:{account_id:e}}).then(t=>t.data)},Qt={list:e=>$.get("/clientes",{params:e}).then(t=>t.data),get:e=>$.get(`/clientes/${e}`).then(t=>t.data),create:e=>$.post("/clientes",e).then(t=>t.data),update:(e,t)=>$.put(`/clientes/${e}`,t).then(n=>n.data),delete:e=>$.delete(`/clientes/${e}`).then(t=>t.data),listEnderecos:e=>$.get(`/clientes/${e}/enderecos`).then(t=>t.data),addEndereco:(e,t)=>$.post(`/clientes/${e}/enderecos`,t).then(n=>n.data),updateEndereco:(e,t,n)=>$.put(`/clientes/${e}/enderecos/${t}`,n).then(r=>r.data),deleteEndereco:(e,t)=>$.delete(`/clientes/${e}/enderecos/${t}`).then(n=>n.data),listTelefones:e=>$.get(`/clientes/${e}/telefones`).then(t=>t.data),addTelefone:(e,t)=>$.post(`/clientes/${e}/telefones`,t).then(n=>n.data),updateTelefone:(e,t,n)=>$.put(`/clientes/${e}/telefones/${t}`,n).then(r=>r.data),deleteTelefone:(e,t)=>$.delete(`/clientes/${e}/telefones/${t}`).then(n=>n.data),listResponsaveis:e=>$.get(`/clientes/${e}/responsaveis`).then(t=>t.data),addResponsavel:(e,t)=>$.post(`/clientes/${e}/responsaveis`,t).then(n=>n.data),updateResponsavel:(e,t,n)=>$.put(`/clientes/${e}/responsaveis/${t}`,n).then(r=>r.data),deleteResponsavel:(e,t)=>$.delete(`/clientes/${e}/responsaveis/${t}`).then(n=>n.data)},zo={list:e=>$.get("/produtos/admin/all",{params:e}).then(t=>t.data),listPublic:e=>$.get("/produtos",{params:e}).then(t=>t.data),categorias:()=>$.get("/produtos/categorias").then(e=>e.data),get:e=>$.get(`/produtos/${e}`).then(t=>t.data),create:e=>$.post("/produtos",e).then(t=>t.data),update:(e,t)=>$.put(`/produtos/${e}`,t).then(n=>n.data),updateEstoque:(e,t)=>$.patch(`/produtos/${e}/estoque`,{estoque:t}).then(n=>n.data),updatePreco:(e,t)=>$.patch(`/produtos/${e}/preco`,{preco:t}).then(n=>n.data),updatePromo:(e,t)=>$.patch(`/produtos/${e}/preco`,{preco_promocional:t}).then(n=>n.data),delete:e=>$.delete(`/produtos/${e}`).then(t=>t.data),importar:e=>$.post("/produtos/importar",{produtos:e}).then(t=>t.data)},pt={listPedidos:e=>$.get("/cotacoes/admin/pedidos",{params:e}).then(t=>t.data),getPedido:e=>$.get(`/cotacoes/admin/pedidos/${e}`).then(t=>t.data),contadores:()=>$.get("/cotacoes/admin/pedidos/contadores").then(e=>e.data),listFinanceiro:()=>$.get("/cotacoes/admin/financeiro").then(e=>e.data),financeiroDecisao:(e,t,n)=>$.patch(`/cotacoes/admin/financeiro/${e}`,{acao:t,obs:n}).then(r=>r.data),wppSemResposta:(e=5)=>$.get(`/cotacoes/admin/whatsapp/sem-resposta?limiar=${e}`).then(t=>t.data),notificacoes:e=>$.get("/cotacoes/admin/pedidos/notificacoes",{params:{minutes:e}}).then(t=>t.data),updateStatus:(e,t)=>$.patch(`/cotacoes/admin/pedidos/${e}/status`,{status:t}).then(n=>n.data),atribuirEquipe:(e,t)=>$.patch(`/cotacoes/admin/pedidos/${e}/equipe`,{equipe_id:t}).then(n=>n.data),marcarSeparado:(e,t)=>$.patch(`/cotacoes/admin/pedidos/itens/${e}/separado`,{separado:t}).then(n=>n.data),marcarEntregue:(e,t)=>$.patch(`/cotacoes/admin/pedidos/${e}/status`,{status:"entregue",responsavel_entrega:t}).then(n=>n.data),marcarEmbalado:(e,t)=>$.patch(`/cotacoes/admin/pedidos/${e}/embalagem`,{embalador:t}).then(n=>n.data),marcarEmbaladoPorId:(e,t)=>$.patch(`/cotacoes/admin/pedidos/${e}/embalagem`,{embalador_id:t}).then(n=>n.data),marcarEntreguePorId:(e,t)=>$.patch(`/cotacoes/admin/pedidos/${e}/status`,{status:"entregue",expedidor_id:t}).then(n=>n.data),setResponsavel:(e,t,n)=>$.patch(`/cotacoes/admin/pedidos/${e}/responsavel/${t}`,{account_id:n}).then(r=>r.data),registrarCupom:(e,t)=>$.post(`/cotacoes/admin/pedidos/${e}/cupom`,t).then(n=>n.data),listColaboradores:e=>$.get("/cotacoes/admin/colaboradores/disponiveis",{params:{funcao:e}}).then(t=>t.data)},So={contadores:()=>$.get("/cotacoes/admin/inbox/contadores").then(e=>e.data),listBySetor:(e,t)=>$.get(`/cotacoes/admin/inbox/setor/${e}`,{params:{nao_lidas:t}}).then(n=>n.data),listByPedido:e=>$.get(`/cotacoes/admin/inbox/pedido/${e}`).then(t=>t.data),enviar:e=>$.post("/cotacoes/admin/inbox",e).then(t=>t.data),marcarLida:e=>$.patch(`/cotacoes/admin/inbox/${e}/lida`).then(t=>t.data),marcarTodasPedido:e=>$.patch(`/cotacoes/admin/inbox/pedido/${e}/lidas`).then(t=>t.data),marcarTodasSetor:e=>$.patch(`/cotacoes/admin/inbox/setor/${e}/lidas`).then(t=>t.data)},yfe={list:()=>$.get("/admin/nw-teams").then(e=>e.data)};function Cs({isOpen:e,onClose:t,title:n,children:r}){return e?a.jsxs("div",{className:"fixed inset-0 z-[100] flex items-center justify-center p-4",children:[a.jsx("div",{className:"absolute inset-0 bg-black/80 backdrop-blur-sm animate-in fade-in duration-300",onClick:t}),a.jsxs("div",{className:"relative bg-slate-900 border border-slate-800 w-full max-w-lg rounded-[2rem] shadow-2xl animate-in zoom-in-95 fade-in duration-300 overflow-hidden",children:[a.jsxs("div",{className:"p-8 border-b border-slate-800 flex justify-between items-center bg-slate-800/20",children:[a.jsx("h3",{className:"text-xl font-black text-white tracking-tight italic uppercase",children:n}),a.jsx("button",{onClick:t,className:"p-2 hover:bg-slate-800 text-slate-500 hover:text-white rounded-xl transition-all",children:a.jsx(Ce,{size:24})})]}),a.jsx("div",{className:"p-8 max-h-[70vh] overflow-y-auto custom-scrollbar",children:r})]})]}):null}function bfe(){const[e,t]=b.useState([]),[n,r]=b.useState(!0),[s,i]=b.useState(""),[o,l]=b.useState(!1),[c,u]=b.useState(null),[d,f]=b.useState({nome:"",email:"",cpf:"",telefone:"",source:""}),p=async()=>{r(!0);const g=await T0.list();t(g),r(!1)};b.useEffect(()=>{p()},[]);const h=b.useMemo(()=>e.filter(g=>{var j,N,w,S;return((j=g.nome)==null?void 0:j.toLowerCase().includes(s.toLowerCase()))||((N=g.cpf)==null?void 0:N.includes(s))||((w=g.telefone)==null?void 0:w.includes(s))||((S=g.email)==null?void 0:S.toLowerCase().includes(s.toLowerCase()))}),[e,s]),m=()=>{const g=["ID","Nome","Email","CPF","Telefone","IP","Fonte","Data Cadastro"],j=h.map(k=>[k.id,k.nome,k.email||"",k.cpf||"",k.telefone||"",k.ip||"",k.source||"",new Date(k.timestamp||k.created_at).toLocaleString("pt-BR")]),N=[g.join(","),...j.map(k=>k.map(C=>`"${C}"`).join(","))].join(`
`),w=new Blob([N],{type:"text/csv;charset=utf-8;"}),S=document.createElement("a");S.href=URL.createObjectURL(w),S.download=`leads_alemao_${new Date().toISOString().split("T")[0]}.csv`,S.click()},v=g=>{u(g),f({nome:g.nome,email:g.email||"",cpf:g.cpf||"",telefone:g.telefone||"",source:g.source||"hotspot"}),l(!0)},x=async g=>{g.preventDefault();try{await T0.update(c.id,d),l(!1),p()}catch{alert("Erro ao atualizar usuário")}},y=async g=>{if(confirm("Tem certeza que deseja remover este cliente da base?"))try{await T0.delete(g),p()}catch{alert("Erro ao excluir")}};return a.jsxs("div",{className:"space-y-8 animate-in fade-in slide-in-from-bottom-4 duration-500",children:[a.jsxs("header",{className:"flex justify-between items-end",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-3xl font-black text-white tracking-tighter uppercase italic",children:"Clientes WiFi & Web"}),a.jsx("p",{className:"text-slate-400 mt-1 font-medium",children:"Gestão de leads captados pelo ecossistema."})]}),a.jsxs("button",{onClick:m,className:"flex items-center gap-2 px-6 py-3 bg-slate-800 hover:bg-slate-700 text-slate-300 rounded-2xl border border-slate-700 transition-all font-bold uppercase italic text-[10px] tracking-widest active:scale-95",children:[a.jsx(m1,{size:18}),"Exportar Leads (CSV)"]})]}),a.jsxs("div",{className:"bg-slate-900/40 backdrop-blur-md border border-slate-800 rounded-[2.5rem] overflow-hidden",children:[a.jsxs("div",{className:"p-8 border-b border-slate-800 flex items-center gap-6",children:[a.jsxs("div",{className:"flex-1 relative group",children:[a.jsx(Ir,{size:20,className:"absolute left-5 top-1/2 -translate-y-1/2 text-slate-500 group-focus-within:text-cyan-400 transition-colors"}),a.jsx("input",{type:"text",value:s,onChange:g=>i(g.target.value),placeholder:"Filtrar por nome, telefone, CPF ou e-mail...",className:"w-full bg-slate-800/50 border border-slate-700 rounded-2xl pl-14 pr-6 py-4 text-sm text-white placeholder:text-slate-600 focus:ring-1 ring-cyan-500 outline-none transition-all"})]}),a.jsx("div",{className:"hidden lg:flex items-center gap-4 px-6 py-3 bg-slate-800/20 border border-slate-800 rounded-2xl",children:a.jsxs("div",{className:"flex flex-col",children:[a.jsx("span",{className:"text-[10px] text-slate-500 font-black uppercase tracking-widest",children:"Total na Base"}),a.jsx("span",{className:"text-white font-black tabular-nums",children:e.length})]})})]}),a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-left",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"bg-slate-800/30 text-slate-500 text-[10px] uppercase tracking-widest font-black",children:[a.jsx("th",{className:"px-8 py-5",children:"Perfil do Cliente"}),a.jsx("th",{className:"px-8 py-5",children:"Identificação"}),a.jsx("th",{className:"px-8 py-5",children:"Origem / IP"}),a.jsx("th",{className:"px-8 py-5 text-right",children:"Ações"})]})}),a.jsx("tbody",{className:"divide-y divide-slate-800/50",children:n?[1,2,3,4,5].map(g=>a.jsx("tr",{className:"animate-pulse",children:a.jsx("td",{colSpan:4,className:"px-8 py-8 bg-slate-800/5"})},g)):h.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:4,className:"px-8 py-20 text-center text-slate-500 font-medium italic",children:"Nenhum cliente encontrado para sua busca."})}):h.map(g=>a.jsxs("tr",{className:"hover:bg-cyan-500/[0.02] transition-colors group",children:[a.jsx("td",{className:"px-8 py-6",children:a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsxs("div",{className:"w-12 h-12 rounded-2xl bg-gradient-to-br from-slate-700 to-slate-800 flex items-center justify-center text-slate-500 border border-white/5 relative group-hover:scale-110 transition-transform",children:[a.jsx(et,{size:24}),g.source==="hotspot"&&a.jsx("div",{className:"absolute -top-1 -right-1 w-4 h-4 bg-cyan-500 rounded-full border-2 border-slate-900 flex items-center justify-center",children:a.jsx(pI,{size:8,className:"text-white"})})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-white font-black text-sm uppercase tracking-tight",children:g.nome}),a.jsx("div",{className:"text-slate-500 text-[11px] font-bold",children:g.email||"SEM E-MAIL"})]})]})}),a.jsx("td",{className:"px-8 py-6",children:a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"text-xs text-slate-300 font-bold flex items-center gap-2",children:[a.jsx(ws,{size:12,className:"text-slate-600"}),g.cpf||"CPF NÃO INFO"]}),a.jsx("div",{className:"text-xs text-cyan-400 font-black tabular-nums",children:g.telefone||"SEM TELEFONE"})]})}),a.jsx("td",{className:"px-8 py-6",children:a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:`text-[10px] font-black uppercase tracking-widest ${g.source==="web"?"text-purple-400":"text-cyan-500"}`,children:g.source||"hotspot"}),a.jsxs("div",{className:"text-[10px] text-slate-500 font-bold tabular-nums",children:["IP: ",g.ip||"---"]})]})}),a.jsx("td",{className:"px-8 py-6 text-right",children:a.jsxs("div",{className:"flex justify-end gap-3 translate-x-4 opacity-0 group-hover:opacity-100 group-hover:translate-x-0 transition-all",children:[a.jsx("button",{onClick:()=>v(g),className:"p-3 bg-slate-800 text-slate-400 hover:text-white hover:bg-slate-700 rounded-xl transition-all border border-slate-700",children:a.jsx(vm,{size:16})}),a.jsx("button",{onClick:()=>y(g.id),className:"p-3 bg-rose-500/10 text-rose-500 hover:bg-rose-500 hover:text-white rounded-xl transition-all border border-rose-500/10",children:a.jsx(Te,{size:16})})]})})]},g.id))})]})})]}),a.jsx(Cs,{isOpen:o,onClose:()=>l(!1),title:"Editar Perfil do Cliente",children:a.jsxs("form",{onSubmit:x,className:"space-y-6",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-[10px] font-black uppercase tracking-widest text-slate-500 mb-2",children:"Nome Completo"}),a.jsx("input",{required:!0,type:"text",value:d.nome,onChange:g=>f({...d,nome:g.target.value}),className:"w-full bg-slate-800/50 border border-slate-700 rounded-xl px-4 py-3 text-white focus:ring-1 ring-cyan-500 outline-none transition-all"})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-[10px] font-black uppercase tracking-widest text-slate-500 mb-2",children:"CPF"}),a.jsx("input",{type:"text",value:d.cpf,onChange:g=>f({...d,cpf:g.target.value}),className:"w-full bg-slate-800/50 border border-slate-700 rounded-xl px-4 py-3 text-white focus:ring-1 ring-cyan-500 outline-none transition-all"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-[10px] font-black uppercase tracking-widest text-slate-500 mb-2",children:"Telefone"}),a.jsx("input",{type:"text",value:d.telefone,onChange:g=>f({...d,telefone:g.target.value}),className:"w-full bg-slate-800/50 border border-slate-700 rounded-xl px-4 py-3 text-white focus:ring-1 ring-cyan-500 outline-none transition-all"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-[10px] font-black uppercase tracking-widest text-slate-500 mb-2",children:"E-mail"}),a.jsx("input",{type:"email",value:d.email,onChange:g=>f({...d,email:g.target.value}),className:"w-full bg-slate-800/50 border border-slate-700 rounded-xl px-4 py-3 text-white focus:ring-1 ring-cyan-500 outline-none transition-all"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-[10px] font-black uppercase tracking-widest text-slate-500 mb-2",children:"Origem do Cadastro"}),a.jsxs("select",{value:d.source,onChange:g=>f({...d,source:g.target.value}),className:"w-full bg-slate-800/50 border border-slate-700 rounded-xl px-4 py-3 text-white focus:ring-1 ring-cyan-500 outline-none transition-all appearance-none",children:[a.jsx("option",{className:"bg-slate-900 text-white",value:"hotspot",children:"WiFi Hotspot (Loja)"}),a.jsx("option",{className:"bg-slate-900 text-white",value:"web",children:"Web (Site)"}),a.jsx("option",{className:"bg-slate-900 text-white",value:"manual",children:"Manual (Balcão)"})]})]}),a.jsxs("button",{type:"submit",className:"w-full bg-cyan-500 hover:bg-cyan-400 text-slate-950 font-black py-4 rounded-2xl flex items-center justify-center gap-2 transition-all shadow-lg shadow-cyan-500/20 uppercase italic text-sm",children:[a.jsx(or,{size:20}),"Salvar Alterações"]})]})})]})}function x4({icon:e,title:t,subtitle:n,children:r}){return a.jsxs("div",{className:"bg-slate-900/50 border border-slate-800 rounded-3xl p-8 relative overflow-hidden",children:[a.jsxs("div",{className:"flex items-center gap-4 mb-8",children:[a.jsx("div",{className:"p-3 bg-cyan-500/10 text-cyan-400 rounded-2xl",children:a.jsx(e,{size:28})}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-xl font-bold text-white",children:t}),a.jsx("p",{className:"text-sm text-slate-500",children:n})]})]}),r,a.jsx("div",{className:"absolute -bottom-24 -right-24 w-64 h-64 bg-cyan-500/5 rounded-full blur-3xl pointer-events-none"})]})}function g4({saved:e}){return e?a.jsx("span",{className:"text-emerald-400 font-medium text-sm animate-in fade-in slide-in-from-left-4",children:"✅ Salvo com sucesso!"}):null}function jfe(){const[e,t]=b.useState(""),[n,r]=b.useState(!1),[s,i]=b.useState(!1),[o,l]=b.useState({primary_color:"#f59e0b",secondary_color:"#10b981",logo_url:"",favicon_url:"",contact_email:"",contact_phone:"",app_url:""}),[c,u]=b.useState(!1),[d,f]=b.useState(!1);b.useEffect(()=>{u4.getAsaasKey().then(x=>t(x.key||"")),$.get("/tenant/config").then(x=>{const y=x.data;l({primary_color:y.primary_color||"#f59e0b",secondary_color:y.secondary_color||"#10b981",logo_url:y.logo_url||"",favicon_url:y.favicon_url||"",contact_email:y.contact_email||"",contact_phone:y.contact_phone||"",app_url:y.app_url||""})}).catch(()=>{})},[]);const p=async x=>{x.preventDefault(),i(!0);try{await u4.saveAsaasKey(e),r(!0),setTimeout(()=>r(!1),3e3)}catch{alert("Erro ao salvar a chave Asaas")}finally{i(!1)}},h=async x=>{x.preventDefault(),u(!0);try{await $.put("/tenant/config",o),f(!0),setTimeout(()=>f(!1),3e3)}catch{alert("Erro ao salvar identidade visual")}finally{u(!1)}},m="w-full bg-slate-800 border border-slate-700 rounded-xl px-4 py-3 text-white placeholder:text-slate-600 focus:outline-none focus:ring-2 ring-cyan-500 transition-all",v="block text-sm font-semibold text-slate-400 mb-2";return a.jsxs("div",{className:"space-y-8 animate-in fade-in slide-in-from-bottom-4 duration-500",children:[a.jsxs("header",{children:[a.jsx("h2",{className:"text-3xl font-bold text-white",children:"Configurações"}),a.jsx("p",{className:"text-slate-400 mt-1",children:"Gerencie integrações, pagamentos e identidade visual do tenant."})]}),a.jsxs("div",{className:"max-w-2xl space-y-8",children:[a.jsx(x4,{icon:EI,title:"Identidade Visual",subtitle:"Cores e dados de exibição do tenant",children:a.jsxs("form",{onSubmit:h,className:"space-y-5",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:v,children:"Cor Primária"}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("input",{type:"color",value:o.primary_color,onChange:x=>l(y=>({...y,primary_color:x.target.value})),className:"w-12 h-12 rounded-xl cursor-pointer bg-slate-800 border border-slate-700 p-1"}),a.jsx("input",{type:"text",value:o.primary_color,onChange:x=>l(y=>({...y,primary_color:x.target.value})),className:m+" font-mono"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:v,children:"Cor Secundária"}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("input",{type:"color",value:o.secondary_color,onChange:x=>l(y=>({...y,secondary_color:x.target.value})),className:"w-12 h-12 rounded-xl cursor-pointer bg-slate-800 border border-slate-700 p-1"}),a.jsx("input",{type:"text",value:o.secondary_color,onChange:x=>l(y=>({...y,secondary_color:x.target.value})),className:m+" font-mono"})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:v,children:"URL do Logo"}),a.jsx("input",{type:"text",value:o.logo_url,placeholder:"https://...",onChange:x=>l(y=>({...y,logo_url:x.target.value})),className:m})]}),a.jsxs("div",{children:[a.jsx("label",{className:v,children:"URL do Favicon"}),a.jsx("input",{type:"text",value:o.favicon_url,placeholder:"https://...",onChange:x=>l(y=>({...y,favicon_url:x.target.value})),className:m})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:v,children:"E-mail de Contato"}),a.jsx("input",{type:"email",value:o.contact_email,placeholder:"contato@empresa.com",onChange:x=>l(y=>({...y,contact_email:x.target.value})),className:m})]}),a.jsxs("div",{children:[a.jsx("label",{className:v,children:"Telefone de Contato"}),a.jsx("input",{type:"text",value:o.contact_phone,placeholder:"(00) 00000-0000",onChange:x=>l(y=>({...y,contact_phone:x.target.value})),className:m})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:v,children:"URL Pública do App"}),a.jsx("input",{type:"text",value:o.app_url,placeholder:"https://alemaoconveniencias.com.br",onChange:x=>l(y=>({...y,app_url:x.target.value})),className:m}),a.jsxs("p",{className:"mt-2 text-xs text-slate-500 flex items-center gap-1.5",children:[a.jsx(Ar,{size:14}),"Usada nos links enviados por WhatsApp e e-mail."]})]}),a.jsxs("div",{className:"rounded-2xl border border-slate-700 p-4 flex items-center gap-4",children:[a.jsx("div",{className:"w-10 h-10 rounded-xl flex items-center justify-center text-white font-bold text-lg shrink-0",style:{background:o.primary_color},children:o.logo_url?a.jsx("img",{src:o.logo_url,className:"w-full h-full object-contain rounded-xl",alt:"logo"}):"A"}),a.jsxs("div",{children:[a.jsx("div",{className:"text-sm font-bold text-white",children:"Preview do Branding"}),a.jsxs("div",{className:"flex gap-2 mt-1",children:[a.jsx("span",{className:"w-4 h-4 rounded-full inline-block",style:{background:o.primary_color}}),a.jsx("span",{className:"w-4 h-4 rounded-full inline-block",style:{background:o.secondary_color}}),a.jsxs("span",{className:"text-xs text-slate-500",children:[o.primary_color," / ",o.secondary_color]})]})]})]}),a.jsxs("div",{className:"pt-2 flex items-center gap-4",children:[a.jsxs("button",{disabled:c,type:"submit",className:"bg-cyan-500 hover:bg-cyan-400 disabled:opacity-50 text-slate-950 font-bold px-6 py-3 rounded-xl flex items-center gap-2 transition-all shadow-lg shadow-cyan-500/20",children:[a.jsx(or,{size:18}),c?"Salvando...":"Salvar Identidade Visual"]}),a.jsx(g4,{saved:d})]})]})}),a.jsx(x4,{icon:Pi,title:"Gateway de Pagamento (Asaas)",subtitle:"Configuração de Cobranças PIX Automatizadas",children:a.jsxs("form",{onSubmit:p,className:"space-y-6",children:[a.jsxs("div",{children:[a.jsx("label",{className:v,children:"ASAAS API KEY"}),a.jsx("input",{type:"password",value:e,onChange:x=>t(x.target.value),placeholder:"Ex: $aact_...",className:m}),a.jsxs("p",{className:"mt-2 text-xs text-slate-500 flex items-center gap-1.5",children:[a.jsx(Ar,{size:14}),"Use ",a.jsx("b",{children:"sandbox_local"})," para testar sem cobrar dinheiro real."]})]}),a.jsxs("div",{className:"pt-2 flex items-center gap-4",children:[a.jsxs("button",{disabled:s,type:"submit",className:"bg-cyan-500 hover:bg-cyan-400 disabled:opacity-50 text-slate-950 font-bold px-6 py-3 rounded-xl flex items-center gap-2 transition-all shadow-lg shadow-cyan-500/20",children:[a.jsx(or,{size:18}),s?"Salvando...":"Salvar Alterações"]}),a.jsx(g4,{saved:n})]})]})})]})]})}function wfe(){var F;const[e,t]=b.useState([]),[n,r]=b.useState(!0),[s,i]=b.useState(!1),[o,l]=b.useState(!1),[c,u]=b.useState(null),[d,f]=b.useState(null),[p,h]=b.useState(!1),[m,v]=b.useState([]),[x,y]=b.useState(!1),[g,j]=b.useState(null),[N,w]=b.useState({discount_pct:15,duration_minutes:30,label:"Promoção Relâmpago"}),[S,k]=b.useState(!1),[C,_]=b.useState(Date.now()),[A,E]=b.useState(!1),[P,D]=b.useState(()=>{try{return JSON.parse(localStorage.getItem("raffle_type_suggestions")||"{}")}catch{return{}}}),[I,R]=b.useState(null),M=(z,q)=>{const ie={...P,[z]:q};D(ie),localStorage.setItem("raffle_type_suggestions",JSON.stringify(ie))},W=[{id:"tier_flash",icon:Mo,color:"orange",gradient:"from-orange-500/20 to-amber-500/10",border:"border-orange-500/30",iconBg:"bg-orange-500/20 text-orange-400",badge:"RECOMENDADO",badgeColor:"bg-orange-500/20 text-orange-400 border-orange-500/30",title:"Sorteio Relâmpago por Faixa",subtitle:"Prêmios proporcionais à quantidade comprada",description:"Cada faixa de compra (nível = quantos números a pessoa comprou) concorre a um sorteio separado com prêmio proporcional. Quem comprou 1 número disputa R$20, quem comprou 3 disputa R$40, quem comprou 5 disputa R$75 — e assim por diante. Os sorteios disparam quando a faixa acumula receita suficiente ou em horário agendado.",tiers:[{qty:"1 nº",prize:"R$ 20",ratio:"4x o valor investido"},{qty:"3 nºs",prize:"R$ 40",ratio:"2,7x o valor investido"},{qty:"5 nºs",prize:"R$ 75",ratio:"3x o valor investido"},{qty:"10 nºs",prize:"R$150",ratio:"3x o valor investido"},{qty:"20 nºs",prize:"R$300",ratio:"3x o valor investido"}],pros:["Incentiva quem comprou pouco a continuar participando","Aumenta o valor médio de compra sem forçar desconto","Cria múltiplos momentos de emoção por rifa","Processo automático já existe — baixo esforço técnico","Prêmio em crédito é juridicamente mais seguro que dinheiro"],cons:["Custos de prêmio se multiplicam — exige controle financeiro",'Pode confundir clientes sobre "em qual sorteio estou"',"Aviso no WhatsApp precisa ser claro e separado por faixa","Sorteios frequentes podem tirar a emoção do prêmio principal"]},{id:"multiplier",icon:Wi,color:"cyan",gradient:"from-cyan-500/20 to-blue-500/10",border:"border-cyan-500/30",iconBg:"bg-cyan-500/20 text-cyan-400",badge:"SIMPLES",badgeColor:"bg-cyan-500/20 text-cyan-400 border-cyan-500/30",title:"Multiplicador de Sorte",subtitle:"Mais chances no sorteio principal conforme compra",description:'Um único sorteio principal, mas quem compra mais bilhetes entra mais vezes na lista de participantes. 1 número = 1 entrada, 3 números = 4 entradas, 5 números = 8 entradas. A mensagem é simples: "compre 5 e tenha 8x mais chances de ganhar!"',tiers:[{qty:"1 nº",prize:"1 entrada",ratio:"1x"},{qty:"3 nºs",prize:"4 entradas",ratio:"1,3x por número"},{qty:"5 nºs",prize:"8 entradas",ratio:"1,6x por número"},{qty:"10 nºs",prize:"20 entradas",ratio:"2x por número"},{qty:"20 nºs",prize:"50 entradas",ratio:"2,5x por número"}],pros:['Conceito simples: "mais números = mais chances"',"Um único sorteio — fácil de comunicar e gerenciar","Sem custo extra de prêmios adicionais",'"5x mais chances!" é uma mensagem que converte bem'],cons:["O código matemático do sorteio (SHA256) precisa ser reescrito do zero","Menos transparente — clientes podem questionar a imparcialidade","Não recompensa quem comprou pouco (pode desmotivar)","Quem compra 1 número sente desvantagem clara"]},{id:"scheduled_tiers",icon:BI,color:"violet",gradient:"from-violet-500/20 to-purple-500/10",border:"border-violet-500/30",iconBg:"bg-violet-500/20 text-violet-400",badge:"AGENDADO",badgeColor:"bg-violet-500/20 text-violet-400 border-violet-500/30",title:"Sorteio Escalonado Agendado",subtitle:"Datas e horários fixos por faixa de compra",description:'Cada faixa de compra (nível de quantidade) tem seu próprio sorteio em data e hora anunciados com antecedência. "Quem comprou 1 número: segunda às 20h. Quem comprou 10 ou mais (VIP): sexta às 21h." Cria expectativa e motiva acompanhar as transmissões ao vivo.',tiers:[{qty:"1 nº",prize:"Seg 20h",ratio:"Sorteio Fiel"},{qty:"3 nºs",prize:"Qua 20h",ratio:"Sorteio Bronze"},{qty:"5 nºs",prize:"Sex 20h",ratio:"Sorteio Prata"},{qty:"10 nºs",prize:"Sáb 20h",ratio:"Sorteio Ouro"},{qty:"20 nºs",prize:"Dom 21h",ratio:"Sorteio VIP"}],pros:["Cria expectativa semanal recorrente","Fácil de comunicar no WhatsApp com dia/hora fixos","Clientes podem planejar quando acompanhar",'Sensação de "clube" com sorteios exclusivos por faixa'],cons:["Exige pontualidade — não pode atrasar nem cancelar","Se poucos compraram naquela faixa, o sorteio parece vazio","Gerenciar 5 datas diferentes por semana é trabalhoso","Prêmio fixo pode parecer pouco atrativo em semanas de baixa venda"]},{id:"revenue_trigger",icon:ys,color:"emerald",gradient:"from-emerald-500/20 to-green-500/10",border:"border-emerald-500/30",iconBg:"bg-emerald-500/20 text-emerald-400",badge:"INTELIGENTE",badgeColor:"bg-emerald-500/20 text-emerald-400 border-emerald-500/30",title:"Gatilho por Meta de Arrecadação",subtitle:"Sorteio dispara quando a faixa acumula receita suficiente",description:'Cada faixa de compra define uma meta de arrecadação. Quando o gráfico mostra que a faixa "1 número" acumulou R$200, o sorteio de R$20 dispara sozinho. Saudável financeiramente: o prêmio é sempre cerca de 10% do que foi arrecadado naquela faixa.',tiers:[{qty:"1 nº",prize:"Meta: R$200 → R$20",ratio:"10% do arrecadado"},{qty:"3 nºs",prize:"Meta: R$400 → R$40",ratio:"10% do arrecadado"},{qty:"5 nºs",prize:"Meta: R$750 → R$75",ratio:"10% do arrecadado"},{qty:"10 nºs",prize:"Meta: R$1500 → R$150",ratio:"10% do arrecadado"},{qty:"20 nºs",prize:"Meta: R$3000 → R$300",ratio:"10% do arrecadado"}],pros:["Financeiramente saudável — prêmio nunca supera a receita","O gráfico de arrecadação vira ferramenta de decisão real","Sorteios acontecem quando há volume suficiente de participantes","Processo automático verifica as metas a cada minuto","Cresce junto com as vendas — quanto mais vende, maior o prêmio"],cons:['Menos previsível para o cliente — "quando vai sortear?"','Exige comunicação ativa: "Faltam R$80 para o próximo sorteio!"',"Pode demorar muito em rifas com poucos compradores","Precisa de barra de progresso visível para manter interesse"]},{id:"badges",icon:iI,color:"rose",gradient:"from-rose-500/20 to-pink-500/10",border:"border-rose-500/30",iconBg:"bg-rose-500/20 text-rose-400",badge:"FIDELIZAÇÃO",badgeColor:"bg-rose-500/20 text-rose-400 border-rose-500/30",title:"Medalhas de Participação",subtitle:"Sistema de conquistas e recompensas por histórico de compras",description:'Selos (medalhas virtuais) acumulados ao longo de múltiplas rifas. Participante, Frequente, VIP, Diamante — cada medalha desbloqueia benefícios reais como desconto na próxima rifa, bilhete bônus ou sorteio exclusivo. Funciona como um "programa de pontos", mas sem precisar pagar dinheiro de volta.',tiers:[{qty:"Participante",prize:"1ª rifa",ratio:"Sem benefício extra"},{qty:"Frequente",prize:"5 rifas",ratio:"+5% desconto"},{qty:"VIP",prize:"10 nºs numa rifa",ratio:"+1 bilhete bônus"},{qty:"Diamante",prize:"Todas do mês",ratio:"Sorteio exclusivo"},{qty:"Lendário",prize:"3 meses seguidos",ratio:"Frete grátis + bônus"}],pros:['Cria identidade e pertencimento ("sou VIP aqui!")',"Incentiva o cliente a voltar sem precisar dar prêmio imediato","Clientes compartilham suas medalhas nas redes — divulgação gratuita","Programa de fidelidade sem precisar devolver dinheiro","Diferencial único frente a rifas concorrentes"],cons:["É o mais complexo de construir — exige novo sistema de medalhas","O valor que o cliente enxerga depende do tamanho da base de clientes","Medalha sem benefício concreto é ignorada rapidamente","Precisa de design visual cuidadoso no aplicativo do cliente","As regras podem ficar complexas demais com o tempo"]}],[T,V]=b.useState({titulo:"",descricao:"",preco_numero:"",total_numeros:"",start_at:"",end_at:"",status:"active"}),X=async()=>{r(!0);const z=await gr.list();t(z),r(!1)};b.useEffect(()=>{X()},[]);const U=z=>{var q,ie,oe;z?(u(z),V({titulo:z.name||z.titulo,descricao:z.description||z.descricao||"",preco_numero:((q=z.price_default)==null?void 0:q.toString())||((ie=z.preco_numero)==null?void 0:ie.toString())||"5.00",total_numeros:((oe=z.total_numeros)==null?void 0:oe.toString())||"500",start_at:z.start_at?new Date(z.start_at).toISOString().split("T")[0]:"",end_at:z.end_at?new Date(z.end_at).toISOString().split("T")[0]:"",status:z.status})):(u(null),V({titulo:"",descricao:"",preco_numero:"5.00",total_numeros:"500",start_at:new Date().toISOString().split("T")[0],end_at:new Date(Date.now()+7*24*60*60*1e3).toISOString().split("T")[0],status:"active"})),i(!0)};b.useEffect(()=>{if(!o||!g)return;const z=setInterval(()=>_(Date.now()),1e3);return()=>clearInterval(z)},[o,g]);const L=async z=>{r(!0);try{const[q,ie,oe]=await Promise.all([gr.getDetail(z),gr.getDiscounts(z).catch(()=>[]),gr.getFlashPromo(z).catch(()=>null)]);f(q),v(ie.map(we=>({min_qty:we.min_qty,discount_pct:Number(we.discount_pct)}))),j(oe),l(!0)}catch{alert("Erro ao carregar detalhes")}finally{r(!1)}},B=async()=>{if(d){y(!0);try{await gr.saveDiscounts(d.id,m),alert("Descontos salvos!")}catch{alert("Erro ao salvar descontos")}finally{y(!1)}}},ae=async()=>{if(d){k(!0);try{const z=await gr.createFlashPromo(d.id,N);j(z.promo),_(Date.now())}catch{alert("Erro ao ativar promoção relâmpago")}finally{k(!1)}}},se=async()=>{if(!(!d||!g))try{await gr.cancelFlashPromo(d.id,g.id),j(null)}catch{alert("Erro ao cancelar promoção")}};function xe(z){const q=Math.max(0,new Date(z).getTime()-C),ie=Math.floor(q/36e5),oe=Math.floor(q%36e5/6e4),we=Math.floor(q%6e4/1e3);return ie>0?`${ie}h ${String(oe).padStart(2,"0")}m ${String(we).padStart(2,"0")}s`:`${String(oe).padStart(2,"0")}:${String(we).padStart(2,"0")}`}const H=async z=>{var q,ie;if(confirm("Deseja executar o sorteio agora? O ganhador será selecionado aleatoriamente via SHA256 entre os bilhetes pagos.")){h(!0);try{const oe=await gr.draw(z);alert(`Sorteio realizado! Ganhador: ${oe.result.winner_name} (Bilhete #${oe.result.ticket_number})`),l(!1),X()}catch(oe){alert(((ie=(q=oe.response)==null?void 0:q.data)==null?void 0:ie.error)||"Erro ao realizar sorteio")}finally{h(!1)}}},le=async z=>{z.preventDefault();try{c?await gr.update(c.id,T):await gr.create(T),i(!1),X()}catch{alert("Erro ao salvar sorteio")}},Z=async z=>{if(confirm("Excluir este sorteio?"))try{await gr.delete(z),X()}catch{alert("Erro ao excluir")}};return a.jsxs("div",{className:"space-y-8 animate-in fade-in slide-in-from-bottom-4 duration-500",children:[a.jsxs("header",{className:"flex justify-between items-center",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-3xl font-black text-white tracking-tighter uppercase italic",children:"Sorteios Digitais"}),a.jsx("p",{className:"text-slate-400 mt-1 font-medium",children:"Gestão de prêmios, bilhetes e sorteio SHA256."})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs("button",{onClick:()=>E(!0),className:"bg-slate-800 hover:bg-slate-700 text-slate-300 hover:text-white border border-slate-700 hover:border-slate-600 font-black px-6 py-4 rounded-2xl flex items-center gap-2 transition-all active:scale-95 italic uppercase text-xs",children:[a.jsx(bI,{size:16,strokeWidth:2.5}),"Tipos de Sorteios"]}),a.jsxs("button",{onClick:()=>U(),className:"bg-cyan-500 hover:bg-cyan-400 text-slate-950 font-black px-8 py-4 rounded-2xl flex items-center gap-2 transition-all shadow-lg shadow-cyan-500/20 active:scale-95 italic uppercase text-xs",children:[a.jsx(Oe,{size:18,strokeWidth:3}),"Novo Sorteio"]})]})]}),a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8",children:n&&!o?[1,2,3].map(z=>a.jsx("div",{className:"bg-slate-900/40 border border-slate-800 h-72 rounded-[2rem] animate-pulse"},z)):e.map(z=>a.jsxs("div",{className:"bg-slate-900/40 backdrop-blur-md border border-slate-800 rounded-[2rem] overflow-hidden hover:border-cyan-500/30 transition-all group flex flex-col relative",children:[a.jsxs("div",{className:"p-8",children:[a.jsxs("div",{className:"flex justify-between items-start mb-6",children:[a.jsx("div",{className:`px-3 py-1 rounded-lg text-[10px] font-black uppercase tracking-widest border ${z.status==="active"?"bg-emerald-500/10 text-emerald-400 border-emerald-500/20":"bg-slate-800 text-slate-500 border-slate-700"}`,children:z.status}),a.jsxs("span",{className:"text-cyan-400 font-black text-2xl tabular-nums italic tracking-tighter",children:["R$ ",parseFloat(z.price_default||z.preco_numero).toFixed(2)]})]}),a.jsx("h3",{className:"text-xl font-black text-white mb-2 group-hover:text-cyan-400 transition-colors uppercase italic tracking-tight truncate",children:z.name||z.titulo}),a.jsx("div",{className:"flex items-center gap-4 mt-6 p-4 bg-slate-800/20 rounded-2xl border border-slate-800",children:a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:"flex justify-between text-[10px] font-black text-slate-500 uppercase mb-2",children:[a.jsx("span",{children:"Vendas"}),a.jsxs("span",{children:[z.vendas_count||0,"/",z.total_numeros]})]}),a.jsx("div",{className:"h-1.5 w-full bg-slate-800 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-gradient-to-r from-cyan-600 to-cyan-400 shadow-[0_0_8px_rgba(34,211,238,0.4)]",style:{width:`${Math.min(100,(z.vendas_count||0)/z.total_numeros*100)}%`}})})]})})]}),a.jsxs("div",{className:"mt-auto p-6 bg-slate-800/20 border-t border-slate-800 flex items-center justify-between group-hover:bg-slate-800/40 transition-all",children:[a.jsxs("button",{onClick:()=>L(z.id),className:"text-[10px] font-black text-cyan-500 hover:text-cyan-300 uppercase tracking-widest flex items-center gap-2",children:[a.jsx(yu,{size:14}),"Auditagem"]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:()=>U(z),className:"p-3 bg-slate-800 text-slate-400 hover:text-white rounded-xl transition-all border border-slate-700",children:a.jsx(vm,{size:16})}),a.jsx("button",{onClick:()=>Z(z.id),className:"p-3 bg-rose-500/10 text-rose-500 hover:bg-rose-500 hover:text-white rounded-xl transition-all border border-rose-500/10",children:a.jsx(Te,{size:16})})]})]})]},z.id))}),a.jsx(Cs,{isOpen:o,onClose:()=>l(!1),title:"Auditagem & Sorteio Digital",children:d&&a.jsxs("div",{className:"space-y-8",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{className:"p-6 bg-slate-800/30 rounded-3xl border border-slate-800",children:[a.jsx("span",{className:"text-[10px] font-black text-slate-500 uppercase block mb-1",children:"Números Vendidos"}),a.jsx("span",{className:"text-3xl font-black text-white italic",children:d.totalSold})]}),a.jsxs("div",{className:"p-6 bg-slate-800/30 rounded-3xl border border-slate-800",children:[a.jsx("span",{className:"text-[10px] font-black text-slate-500 uppercase block mb-1",children:"Disponíveis"}),a.jsx("span",{className:"text-3xl font-black text-cyan-400 italic",children:d.totalDisponivel})]})]}),a.jsxs("div",{className:"bg-slate-950 p-6 rounded-3xl border border-slate-800",children:[a.jsxs("h4",{className:"text-[10px] font-black text-slate-500 uppercase mb-4 flex items-center gap-2",children:[a.jsx(et,{size:14,className:"text-cyan-500"}),"Compradores Recentes"]}),a.jsx("div",{className:"max-h-40 overflow-y-auto space-y-2 pr-2 custom-scrollbar",children:((F=d.soldNumbers)==null?void 0:F.length)>0?d.soldNumbers.slice(0,10).map((z,q)=>a.jsxs("div",{className:"flex justify-between items-center text-xs p-3 bg-slate-900 rounded-xl border border-white/5",children:[a.jsxs("span",{className:"font-bold text-slate-300",children:["#",z.numero.toString().padStart(3,"0")]}),a.jsx("span",{className:"text-slate-500",children:z.usuario_nome||"Cliente"})]},q)):a.jsx("p",{className:"text-slate-600 text-xs italic",children:"Nenhum bilhete vendido ainda."})})]}),a.jsxs("div",{className:`p-6 rounded-3xl border ${g?"bg-orange-500/5 border-orange-500/20":"bg-slate-950 border-slate-800"}`,children:[a.jsxs("h4",{className:"text-[10px] font-black text-slate-500 uppercase mb-4 flex items-center gap-2",children:[a.jsx(ZP,{size:14,className:g?"text-orange-400":"text-cyan-500"}),"Promoção Relâmpago",g&&a.jsxs("span",{className:"ml-auto text-orange-400 font-black text-xs animate-pulse",children:["⚡ ",xe(g.ends_at)]})]}),g?a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between bg-orange-500/10 border border-orange-500/20 rounded-2xl px-4 py-3",children:[a.jsxs("div",{children:[a.jsxs("p",{className:"text-orange-300 font-black text-lg",children:[Number(g.discount_pct).toFixed(0),"% OFF"]}),a.jsx("p",{className:"text-slate-400 text-xs",children:g.label})]}),a.jsx("p",{className:"text-orange-400 font-black tabular-nums text-sm",children:xe(g.ends_at)})]}),a.jsxs("button",{onClick:se,className:"w-full py-2 rounded-xl bg-rose-500/10 hover:bg-rose-500/20 text-rose-400 text-xs font-black border border-rose-500/20 transition-all flex items-center justify-center gap-1.5",children:[a.jsx(Te,{size:12})," Cancelar Promoção"]})]}):a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-[10px] font-black text-slate-500 uppercase block mb-1",children:"Desconto %"}),a.jsx("input",{type:"number",min:1,max:100,step:1,value:N.discount_pct,onChange:z=>w(q=>({...q,discount_pct:Number(z.target.value)})),className:"w-full bg-slate-800/50 border border-slate-700 rounded-xl px-3 py-2 text-white text-sm font-black outline-none focus:border-orange-500/50"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-[10px] font-black text-slate-500 uppercase block mb-1",children:"Duração"}),a.jsxs("select",{value:N.duration_minutes,onChange:z=>w(q=>({...q,duration_minutes:Number(z.target.value)})),className:"w-full bg-slate-800/50 border border-slate-700 rounded-xl px-3 py-2 text-white text-sm font-black outline-none focus:border-orange-500/50",children:[a.jsx("option",{className:"bg-slate-900 text-white",value:10,children:"10 minutos"}),a.jsx("option",{className:"bg-slate-900 text-white",value:15,children:"15 minutos"}),a.jsx("option",{className:"bg-slate-900 text-white",value:30,children:"30 minutos"}),a.jsx("option",{className:"bg-slate-900 text-white",value:60,children:"1 hora"}),a.jsx("option",{className:"bg-slate-900 text-white",value:120,children:"2 horas"}),a.jsx("option",{className:"bg-slate-900 text-white",value:240,children:"4 horas"}),a.jsx("option",{className:"bg-slate-900 text-white",value:360,children:"6 horas"}),a.jsx("option",{className:"bg-slate-900 text-white",value:720,children:"12 horas"})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-[10px] font-black text-slate-500 uppercase block mb-1",children:"Título"}),a.jsx("input",{type:"text",value:N.label,onChange:z=>w(q=>({...q,label:z.target.value})),className:"w-full bg-slate-800/50 border border-slate-700 rounded-xl px-3 py-2 text-white text-sm outline-none focus:border-orange-500/50",placeholder:"Ex: Oferta de fim de semana!"})]}),a.jsxs("button",{disabled:S,onClick:ae,className:"w-full py-2.5 rounded-xl bg-gradient-to-r from-orange-500 to-rose-500 hover:from-orange-400 hover:to-rose-400 disabled:opacity-50 text-white text-xs font-black flex items-center justify-center gap-1.5 transition-all shadow-lg shadow-orange-500/20",children:[a.jsx(Mo,{size:12})," ",S?"Ativando…":"Ativar Promoção Relâmpago"]})]})]}),a.jsxs("div",{className:"bg-slate-950 p-6 rounded-3xl border border-slate-800",children:[a.jsxs("h4",{className:"text-[10px] font-black text-slate-500 uppercase mb-4 flex items-center gap-2",children:[a.jsx(Xo,{size:14,className:"text-cyan-500"}),"Descontos por Quantidade"]}),a.jsxs("div",{className:"space-y-2 mb-3",children:[m.length===0&&a.jsx("p",{className:"text-slate-600 text-xs italic",children:"Nenhuma faixa configurada."}),m.map((z,q)=>a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("div",{className:"flex-1 flex items-center gap-2 bg-slate-900 border border-slate-800 rounded-xl px-3 py-2",children:[a.jsx("span",{className:"text-[10px] text-slate-500 uppercase font-black shrink-0",children:"Min."}),a.jsx("input",{type:"number",min:2,value:z.min_qty,onChange:ie=>v(oe=>oe.map((we,Ee)=>Ee===q?{...we,min_qty:parseInt(ie.target.value)||2}:we)),className:"w-12 bg-transparent text-white text-sm font-black outline-none"}),a.jsx("span",{className:"text-[10px] text-slate-500 uppercase font-black shrink-0 ml-2",children:"%"}),a.jsx("input",{type:"number",min:1,max:100,step:.5,value:z.discount_pct,onChange:ie=>v(oe=>oe.map((we,Ee)=>Ee===q?{...we,discount_pct:parseFloat(ie.target.value)||0}:we)),className:"w-14 bg-transparent text-cyan-400 text-sm font-black outline-none"})]}),a.jsx("button",{onClick:()=>v(ie=>ie.filter((oe,we)=>we!==q)),className:"p-2 text-rose-500 hover:text-white hover:bg-rose-500/20 rounded-xl transition-all",children:a.jsx(Te,{size:14})})]},q))]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs("button",{onClick:()=>v(z=>[...z,{min_qty:3,discount_pct:10}]),className:"flex-1 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs font-black flex items-center justify-center gap-1.5 transition-all border border-slate-700",children:[a.jsx(Oe,{size:12})," Faixa"]}),a.jsxs("button",{disabled:x,onClick:B,className:"flex-1 py-2 rounded-xl bg-cyan-500 hover:bg-cyan-400 disabled:opacity-50 text-slate-950 text-xs font-black flex items-center justify-center gap-1.5 transition-all",children:[a.jsx(or,{size:12})," ",x?"Salvando…":"Salvar"]})]})]}),d.winner_id?a.jsxs("div",{className:"p-8 bg-emerald-500/10 border border-emerald-500/20 rounded-3xl text-center",children:[a.jsx(ym,{size:48,className:"text-yellow-400 mx-auto mb-4"}),a.jsx("h5",{className:"text-emerald-400 font-black uppercase italic tracking-tighter text-xl",children:"Sorteio Concluído!"}),a.jsx("p",{className:"text-slate-400 text-sm mt-2",children:"Este prêmio já possui um ganhador auditado."})]}):a.jsxs("button",{disabled:p||d.totalSold===0,onClick:()=>H(d.id),className:"w-full bg-gradient-to-r from-orange-500 to-rose-600 hover:from-orange-400 hover:to-rose-500 disabled:opacity-50 text-white font-black py-5 rounded-2xl flex items-center justify-center gap-3 transition-all shadow-xl shadow-rose-500/20 uppercase italic",children:[a.jsx(Mo,{size:20,className:p?"animate-spin":""}),p?"Processando SHA256...":"Executar Sorteio Digital"]})]})}),A&&Bi.createPortal(a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"fixed inset-0 z-[9999] bg-slate-950/95 backdrop-blur-xl flex flex-col animate-in fade-in duration-200",children:[a.jsxs("div",{className:"flex items-center justify-between px-8 py-6 border-b border-slate-800 shrink-0",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("div",{className:"p-3 bg-slate-800 rounded-2xl border border-slate-700",children:a.jsx(nf,{size:22,className:"text-amber-400"})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-2xl font-black text-white uppercase italic tracking-tighter",children:"Tipos de Sorteios"}),a.jsx("p",{className:"text-slate-500 text-sm font-medium mt-0.5",children:"Estratégias de gamificação — estude, anote e implemente um por vez"})]})]}),a.jsx("button",{onClick:()=>E(!1),className:"p-3 bg-slate-800 hover:bg-slate-700 text-slate-400 hover:text-white rounded-2xl border border-slate-700 transition-all active:scale-95",children:a.jsx(Ce,{size:20})})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto p-8",children:[a.jsx("div",{className:"max-w-7xl mx-auto grid grid-cols-1 lg:grid-cols-2 xl:grid-cols-3 gap-6",children:W.map(z=>{const q=z.icon;return a.jsxs("div",{className:`bg-gradient-to-br ${z.gradient} border ${z.border} rounded-3xl flex flex-col overflow-hidden`,children:[a.jsxs("div",{className:"p-6 pb-4",children:[a.jsxs("div",{className:"flex items-start justify-between mb-4",children:[a.jsx("div",{className:`p-3 rounded-2xl ${z.iconBg}`,children:a.jsx(q,{size:22,strokeWidth:2})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:`px-2.5 py-1 rounded-lg text-[9px] font-black uppercase tracking-widest border ${z.badgeColor}`,children:z.badge}),a.jsx("button",{onClick:()=>R(z.id),title:"Modo leitura A4",className:"p-2 rounded-xl bg-slate-800/60 hover:bg-white/10 text-slate-500 hover:text-white border border-slate-700/50 hover:border-white/20 transition-all active:scale-95",children:a.jsx(Ep,{size:14,strokeWidth:2})})]})]}),a.jsx("h3",{className:"text-lg font-black text-white uppercase italic tracking-tight leading-tight",children:z.title}),a.jsx("p",{className:"text-slate-400 text-xs font-medium mt-1",children:z.subtitle}),a.jsx("p",{className:"text-slate-500 text-xs mt-3 leading-relaxed",children:z.description})]}),a.jsxs("div",{className:"mx-6 mb-4 bg-slate-900/60 rounded-2xl border border-slate-800 overflow-hidden",children:[a.jsxs("div",{className:"grid grid-cols-3 px-3 py-2 border-b border-slate-800",children:[a.jsx("span",{className:"text-[9px] font-black text-slate-600 uppercase",children:"Faixa"}),a.jsx("span",{className:"text-[9px] font-black text-slate-600 uppercase",children:"Prêmio / Hora"}),a.jsx("span",{className:"text-[9px] font-black text-slate-600 uppercase text-right",children:"Retorno"})]}),z.tiers.map((ie,oe)=>a.jsxs("div",{className:`grid grid-cols-3 px-3 py-2 ${oe<z.tiers.length-1?"border-b border-slate-800/50":""}`,children:[a.jsx("span",{className:"text-[11px] font-black text-white",children:ie.qty}),a.jsx("span",{className:"text-[11px] font-bold text-slate-300",children:ie.prize}),a.jsx("span",{className:"text-[10px] text-slate-500 text-right font-medium",children:ie.ratio})]},oe))]}),a.jsxs("div",{className:"px-6 pb-4 grid grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsxs("p",{className:"text-[9px] font-black text-emerald-500 uppercase tracking-widest mb-2 flex items-center gap-1",children:[a.jsx(nn,{size:10})," Vantagens"]}),a.jsx("ul",{className:"space-y-1.5",children:z.pros.map((ie,oe)=>a.jsxs("li",{className:"text-[10px] text-slate-400 leading-tight flex gap-1.5",children:[a.jsx("span",{className:"text-emerald-500 mt-0.5 shrink-0",children:"+"}),ie]},oe))})]}),a.jsxs("div",{children:[a.jsxs("p",{className:"text-[9px] font-black text-rose-500 uppercase tracking-widest mb-2 flex items-center gap-1",children:[a.jsx(Ai,{size:10})," Desvantagens"]}),a.jsx("ul",{className:"space-y-1.5",children:z.cons.map((ie,oe)=>a.jsxs("li",{className:"text-[10px] text-slate-400 leading-tight flex gap-1.5",children:[a.jsx("span",{className:"text-rose-500 mt-0.5 shrink-0",children:""}),ie]},oe))})]})]}),a.jsxs("div",{className:"px-6 pb-6 mt-auto",children:[a.jsxs("label",{className:"text-[9px] font-black text-slate-600 uppercase tracking-widest mb-2 flex items-center gap-1",children:[a.jsx(nf,{size:9,className:"text-amber-500"}),"Minhas anotações / sugestões de melhoria"]}),a.jsx("textarea",{value:P[z.id]||"",onChange:ie=>M(z.id,ie.target.value),placeholder:"Ex: Usar crédito em vez de dinheiro para evitar lei 5768. Notificar via WhatsApp 1h antes do sorteio...",className:"w-full bg-slate-900/80 border border-slate-700 focus:border-amber-500/50 rounded-2xl px-4 py-3 text-white text-[11px] outline-none transition-all resize-none h-24 placeholder:text-slate-700 font-mono leading-relaxed"}),P[z.id]&&a.jsxs("p",{className:"text-[9px] text-slate-600 mt-1.5 flex items-center gap-1",children:[a.jsx(nn,{size:9,className:"text-emerald-600"}),"Salvo automaticamente"]})]})]},z.id)})}),a.jsxs("div",{className:"max-w-7xl mx-auto mt-8 p-6 bg-slate-900/40 border border-slate-800 rounded-3xl flex items-start gap-4",children:[a.jsx("div",{className:"p-3 bg-amber-500/10 rounded-2xl shrink-0",children:a.jsx(nf,{size:20,className:"text-amber-400"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-white font-black text-sm uppercase italic",children:"Como usar este painel"}),a.jsxs("p",{className:"text-slate-400 text-xs mt-1 leading-relaxed max-w-3xl",children:["Estude cada tipo, anote suas ideias no campo abaixo de cada card — as anotações são salvas automaticamente no navegador. Quando decidir qual estratégia implementar, abra uma conversa e mencione o tipo escolhido. A implementação de cada tipo leva de 1 a 5 dias dependendo da complexidade.",a.jsx("span",{className:"text-amber-400 font-black",children:' Recomendação: comece pelo "Sorteio Relâmpago por Tier" — tem o maior impacto com o menor esforço técnico.'})]})]})]})]})]}),I&&(()=>{const z=W.find(ie=>ie.id===I),q=z.icon;return a.jsxs("div",{className:"fixed inset-0 z-[10000] bg-slate-900/90 backdrop-blur-sm flex flex-col animate-in fade-in duration-150",children:[a.jsxs("div",{className:"flex items-center justify-between px-6 py-3 bg-slate-950/80 border-b border-slate-800 shrink-0 print:hidden",children:[a.jsxs("button",{onClick:()=>R(null),className:"flex items-center gap-2 text-slate-400 hover:text-white transition-colors text-sm font-bold",children:[a.jsx(Ui,{size:16}),"Voltar aos cards"]}),a.jsx("span",{className:"text-slate-500 text-xs font-black uppercase tracking-widest",children:"Modo Leitura"}),a.jsxs("button",{onClick:()=>window.print(),className:"flex items-center gap-2 text-slate-400 hover:text-white transition-colors text-sm font-bold print:hidden",children:[a.jsx(GP,{size:15}),"Imprimir / PDF"]})]}),a.jsx("div",{className:"flex-1 overflow-y-auto py-10 px-4 bg-slate-800/20",children:a.jsxs("div",{className:"mx-auto bg-white text-slate-900 shadow-2xl shadow-black/60",style:{width:"210mm",minHeight:"297mm",padding:"20mm 22mm"},children:[a.jsxs("div",{className:"flex items-start justify-between pb-6 border-b-2 border-slate-200 mb-8",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-[9px] font-black uppercase tracking-[0.2em] text-slate-400 mb-2",children:"Alemão Conveniências — Estratégia de Sorteios"}),a.jsx("h1",{className:"text-3xl font-black text-slate-900 leading-tight uppercase",children:z.title}),a.jsx("p",{className:"text-slate-500 text-sm font-medium mt-1",children:z.subtitle})]}),a.jsx("div",{className:`p-4 rounded-2xl shrink-0 ml-6 ${z.iconBg.replace("text-","text-").replace("/20","/15")}`,style:{background:"color-mix(in srgb, currentColor 8%, transparent)"},children:a.jsx(q,{size:32,className:z.iconBg.split(" ")[1],strokeWidth:1.5})})]}),a.jsx("div",{className:"flex items-center gap-3 mb-6",children:a.jsx("span",{className:"inline-block px-3 py-1 rounded-md text-[10px] font-black uppercase tracking-widest bg-slate-100 text-slate-600 border border-slate-200",children:z.badge})}),a.jsxs("section",{className:"mb-8",children:[a.jsx("h2",{className:"text-[10px] font-black uppercase tracking-[0.15em] text-slate-400 mb-3 border-b border-slate-100 pb-2",children:"Descrição"}),a.jsx("p",{className:"text-slate-700 text-sm leading-relaxed",children:z.description})]}),a.jsxs("section",{className:"mb-8",children:[a.jsx("h2",{className:"text-[10px] font-black uppercase tracking-[0.15em] text-slate-400 mb-3 border-b border-slate-100 pb-2",children:"Faixas de Compra (níveis por quantidade)"}),a.jsxs("table",{className:"w-full text-sm border-collapse",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"bg-slate-50",children:[a.jsx("th",{className:"text-left py-2.5 px-3 text-[10px] font-black uppercase tracking-wider text-slate-500 border border-slate-200",children:"Faixa / Qtd. comprada"}),a.jsx("th",{className:"text-left py-2.5 px-3 text-[10px] font-black uppercase tracking-wider text-slate-500 border border-slate-200",children:"Prêmio / Horário"}),a.jsx("th",{className:"text-left py-2.5 px-3 text-[10px] font-black uppercase tracking-wider text-slate-500 border border-slate-200",children:"Retorno / Categoria"})]})}),a.jsx("tbody",{children:z.tiers.map((ie,oe)=>a.jsxs("tr",{className:oe%2===0?"bg-white":"bg-slate-50/50",children:[a.jsx("td",{className:"py-2.5 px-3 font-black text-slate-800 border border-slate-200",children:ie.qty}),a.jsx("td",{className:"py-2.5 px-3 font-semibold text-slate-700 border border-slate-200",children:ie.prize}),a.jsx("td",{className:"py-2.5 px-3 text-slate-500 border border-slate-200 text-xs",children:ie.ratio})]},oe))})]})]}),a.jsxs("section",{className:"mb-8",children:[a.jsx("h2",{className:"text-[10px] font-black uppercase tracking-[0.15em] text-slate-400 mb-4 border-b border-slate-100 pb-2",children:"Análise de Viabilidade"}),a.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[a.jsxs("div",{children:[a.jsxs("p",{className:"text-[10px] font-black uppercase tracking-wider text-emerald-600 mb-3 flex items-center gap-1.5",children:[a.jsx(nn,{size:11})," Vantagens"]}),a.jsx("ul",{className:"space-y-2.5",children:z.pros.map((ie,oe)=>a.jsxs("li",{className:"flex gap-2 text-xs text-slate-700 leading-snug",children:[a.jsx("span",{className:"text-emerald-500 font-black shrink-0 mt-0.5",children:"+"}),ie]},oe))})]}),a.jsxs("div",{children:[a.jsxs("p",{className:"text-[10px] font-black uppercase tracking-wider text-rose-500 mb-3 flex items-center gap-1.5",children:[a.jsx(Ai,{size:11})," Desvantagens"]}),a.jsx("ul",{className:"space-y-2.5",children:z.cons.map((ie,oe)=>a.jsxs("li",{className:"flex gap-2 text-xs text-slate-700 leading-snug",children:[a.jsx("span",{className:"text-rose-500 font-black shrink-0 mt-0.5",children:""}),ie]},oe))})]})]})]}),a.jsxs("section",{children:[a.jsxs("h2",{className:"text-[10px] font-black uppercase tracking-[0.15em] text-slate-400 mb-3 border-b border-slate-100 pb-2 flex items-center gap-1.5",children:[a.jsx(nf,{size:11,className:"text-amber-500"}),"Minhas Anotações"]}),P[z.id]?a.jsx("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-4 text-xs text-slate-700 font-mono leading-relaxed whitespace-pre-wrap",children:P[z.id]}):a.jsx("p",{className:"text-slate-400 text-xs italic",children:"Nenhuma anotação registrada. Volte aos cards para adicionar sugestões."})]}),a.jsxs("div",{className:"mt-12 pt-4 border-t border-slate-200 flex items-center justify-between",children:[a.jsx("p",{className:"text-[9px] text-slate-400 uppercase tracking-widest",children:"alemaoconveniencias.local — Documento interno"}),a.jsxs("p",{className:"text-[9px] text-slate-400",children:["Gerado em ",new Date().toLocaleDateString("pt-BR",{day:"2-digit",month:"long",year:"numeric"})]})]})]})})]})})()]}),document.body),a.jsx(Cs,{isOpen:s,onClose:()=>i(!1),title:c?"Editar Sorteio":"Novo Sorteio",children:a.jsxs("form",{onSubmit:le,className:"space-y-6",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-[10px] font-black uppercase tracking-widest text-slate-500 mb-2",children:"Prêmio / Nome do Sorteio"}),a.jsx("input",{required:!0,type:"text",value:T.titulo,onChange:z=>V({...T,titulo:z.target.value}),className:"w-full bg-slate-800/50 border border-slate-700 rounded-xl px-4 py-3 text-white focus:ring-1 ring-cyan-500 outline-none transition-all"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-[10px] font-black uppercase tracking-widest text-slate-500 mb-2",children:"Descrição / Regras"}),a.jsx("textarea",{value:T.descricao,onChange:z=>V({...T,descricao:z.target.value}),className:"w-full bg-slate-800/50 border border-slate-700 rounded-xl px-4 py-3 text-white focus:ring-1 ring-cyan-500 outline-none transition-all h-24 resize-none",placeholder:"Descrição detalhada..."})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-[10px] font-black uppercase tracking-widest text-slate-500 mb-2",children:"Preço por Bilhete"}),a.jsx("input",{required:!0,type:"number",step:"0.01",value:T.preco_numero,onChange:z=>V({...T,preco_numero:z.target.value}),className:"w-full bg-slate-800/50 border border-slate-700 rounded-xl px-4 py-3 text-white focus:ring-1 ring-cyan-500 outline-none transition-all"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-[10px] font-black uppercase tracking-widest text-slate-500 mb-2",children:"Total de Cotas"}),a.jsx("input",{required:!0,type:"number",value:T.total_numeros,onChange:z=>V({...T,total_numeros:z.target.value}),className:"w-full bg-slate-800/50 border border-slate-700 rounded-xl px-4 py-3 text-white focus:ring-1 ring-cyan-500 outline-none transition-all"})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-[10px] font-black uppercase tracking-widest text-slate-500 mb-2",children:"Data de Início"}),a.jsx("input",{required:!0,type:"date",value:T.start_at,onChange:z=>V({...T,start_at:z.target.value}),className:"w-full bg-slate-800/50 border border-slate-700 rounded-xl px-4 py-3 text-white"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-[10px] font-black uppercase tracking-widest text-slate-500 mb-2",children:"Data de Término"}),a.jsx("input",{required:!0,type:"date",value:T.end_at,onChange:z=>V({...T,end_at:z.target.value}),className:"w-full bg-slate-800/50 border border-slate-700 rounded-xl px-4 py-3 text-white"})]})]}),a.jsxs("button",{type:"submit",className:"w-full bg-cyan-500 hover:bg-cyan-400 text-slate-950 font-black py-4 rounded-2xl flex items-center justify-center gap-2 transition-all shadow-lg shadow-cyan-500/20 uppercase italic text-sm",children:[a.jsx(or,{size:20}),c?"Salvar Alterações":"Criar Sorteio"]})]})})]})}function Nfe(){const[e,t]=b.useState([]),[n,r]=b.useState(!0),[s,i]=b.useState(!1),[o,l]=b.useState(null),[c,u]=b.useState(!1),d=b.useRef(null),[f,p]=b.useState({nome:"",descricao:"",preco_original:"",preco_promocional:"",imagem:"",ativo:!0}),h=async()=>{r(!0);const g=await yf.list();t(g),r(!1)};b.useEffect(()=>{h()},[]);const m=g=>{var j;g?(l(g),p({nome:g.nome,descricao:g.descricao||"",preco_original:((j=g.preco_original)==null?void 0:j.toString())||"",preco_promocional:g.preco_promocional.toString(),imagem:g.imagem||"",ativo:g.ativo!==!1})):(l(null),p({nome:"",descricao:"",preco_original:"",preco_promocional:"",imagem:"",ativo:!0})),i(!0)},v=async g=>{g.preventDefault();try{o?await yf.update(o.id,f):await yf.create(f),i(!1),h()}catch{alert("Erro ao salvar promoção")}},x=async g=>{var N;const j=(N=g.target.files)==null?void 0:N[0];if(j){u(!0);try{const w=new FormData;w.append("image",j);const S=await fetch("/api/promotions/upload",{method:"POST",credentials:"include",body:w}),k=await S.json();if(!S.ok)throw new Error(k.error||"Erro no upload");p(C=>({...C,imagem:k.path}))}catch(w){alert(w.message)}finally{u(!1)}}},y=async g=>{if(confirm("Tem certeza que deseja excluir esta promoção?"))try{await yf.delete(g),h()}catch{alert("Erro ao excluir")}};return a.jsxs("div",{className:"space-y-8 animate-in fade-in slide-in-from-bottom-4 duration-500",children:[a.jsxs("header",{className:"flex justify-between items-center",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-3xl font-bold text-white tracking-tighter uppercase italic",children:"Promoções"}),a.jsx("p",{className:"text-slate-400 mt-1 font-medium",children:"Produtos em oferta na landing page do Alemão."})]}),a.jsxs("button",{onClick:()=>m(),className:"bg-emerald-500 hover:bg-emerald-400 text-slate-950 font-black px-8 py-4 rounded-2xl flex items-center gap-2 transition-all shadow-lg shadow-emerald-500/20 active:scale-95 italic uppercase text-xs",children:[a.jsx(Oe,{size:18,strokeWidth:3}),"Nova Oferta"]})]}),a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8",children:n?[1,2,3].map(g=>a.jsx("div",{className:"bg-slate-900/40 border border-slate-800 h-64 rounded-[2rem] animate-pulse"},g)):e.map(g=>a.jsxs("div",{className:"bg-slate-900/40 backdrop-blur-md border border-slate-800 rounded-[2rem] overflow-hidden hover:border-emerald-500/30 transition-all group flex flex-col relative",children:[g.imagem?a.jsxs("div",{className:"h-40 w-full overflow-hidden relative",children:[a.jsx("img",{src:g.imagem,alt:g.nome,className:"w-full h-full object-cover opacity-60 group-hover:opacity-100 group-hover:scale-110 transition-all duration-700"}),a.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-slate-900 to-transparent"})]}):a.jsx("div",{className:"p-8",children:a.jsx("div",{className:"p-4 bg-emerald-500/10 text-emerald-400 rounded-2xl w-fit border border-emerald-500/20",children:a.jsx(Xo,{size:24})})}),a.jsxs("div",{className:"p-8 flex-1 flex flex-col",children:[a.jsx("h3",{className:"text-xl font-black text-white mb-2 group-hover:text-emerald-400 transition-colors uppercase italic tracking-tight",children:g.nome}),a.jsx("p",{className:"text-slate-500 text-sm line-clamp-2 mb-8 font-medium italic",children:g.descricao||"Produto em destaque na vitrine."}),a.jsxs("div",{className:"mt-auto pt-8 border-t border-slate-800/50 flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-[10px] text-slate-500 font-black uppercase tracking-[0.2em] block mb-1",children:"OFFER UNIT"}),a.jsxs("div",{className:"flex items-center gap-3",children:[g.preco_original&&a.jsxs("span",{className:"text-slate-600 line-through text-xs font-bold tabular-nums",children:["R$ ",parseFloat(g.preco_original).toFixed(2)]}),a.jsxs("span",{className:"text-emerald-400 font-black text-2xl tabular-nums italic tracking-tighter",children:["R$ ",parseFloat(g.preco_promocional).toFixed(2)]})]})]}),a.jsxs("div",{className:"flex gap-3 relative z-10",children:[a.jsx("button",{onClick:()=>m(g),className:"p-3 bg-slate-800 text-slate-400 hover:text-white hover:bg-slate-700 rounded-xl transition-all border border-slate-700",children:a.jsx(vm,{size:18})}),a.jsx("button",{onClick:()=>y(g.id),className:"p-3 bg-rose-500/10 text-rose-500 hover:bg-rose-500 hover:text-white rounded-xl transition-all border border-rose-500/10",children:a.jsx(Te,{size:18})})]})]})]})]},g.id))}),a.jsx(Cs,{isOpen:s,onClose:()=>i(!1),title:o?"Editar Promoção":"Nova Promoção",children:a.jsxs("form",{onSubmit:v,className:"space-y-6",children:[a.jsxs("div",{className:"grid grid-cols-1 gap-6",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-[10px] font-black uppercase tracking-widest text-slate-500 mb-2",children:"Nome do Produto"}),a.jsx("input",{required:!0,type:"text",value:f.nome,onChange:g=>p({...f,nome:g.target.value}),className:"w-full bg-slate-800/50 border border-slate-700 rounded-xl px-4 py-3 text-white focus:ring-1 ring-emerald-500 outline-none transition-all",placeholder:"Ex: Coca-Cola 2L"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-[10px] font-black uppercase tracking-widest text-slate-500 mb-2",children:"Descrição"}),a.jsx("textarea",{value:f.descricao,onChange:g=>p({...f,descricao:g.target.value}),className:"w-full bg-slate-800/50 border border-slate-700 rounded-xl px-4 py-3 text-white focus:ring-1 ring-emerald-500 outline-none transition-all h-24 resize-none",placeholder:"Breve descrição do produto..."})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-[10px] font-black uppercase tracking-widest text-slate-500 mb-2",children:"Preço Original"}),a.jsx("input",{type:"number",step:"0.01",value:f.preco_original,onChange:g=>p({...f,preco_original:g.target.value}),className:"w-full bg-slate-800/50 border border-slate-700 rounded-xl px-4 py-3 text-white focus:ring-1 ring-emerald-500 outline-none transition-all",placeholder:"0.00"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-[10px] font-black uppercase tracking-widest text-slate-500 mb-2",children:"Preço Promo (Oferta)"}),a.jsx("input",{required:!0,type:"number",step:"0.01",value:f.preco_promocional,onChange:g=>p({...f,preco_promocional:g.target.value}),className:"w-full bg-slate-800/50 border border-slate-700 rounded-xl px-4 py-3 text-white focus:ring-1 ring-emerald-500 outline-none transition-all",placeholder:"0.00"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-[10px] font-black uppercase tracking-widest text-slate-500 mb-2",children:"Foto do Produto"}),a.jsx("input",{ref:d,type:"file",accept:"image/*",onChange:x,className:"hidden"}),f.imagem?a.jsxs("div",{className:"relative rounded-xl overflow-hidden border border-slate-700 h-40",children:[a.jsx("img",{src:f.imagem,alt:"preview",className:"w-full h-full object-cover"}),a.jsx("button",{type:"button",onClick:()=>p(g=>({...g,imagem:""})),className:"absolute top-2 right-2 p-1.5 bg-black/70 text-white rounded-lg hover:bg-rose-500 transition-all",children:a.jsx(Ce,{size:14})})]}):a.jsxs("button",{type:"button",onClick:()=>{var g;return(g=d.current)==null?void 0:g.click()},disabled:c,className:"w-full h-32 border-2 border-dashed border-slate-700 hover:border-emerald-500/50 rounded-xl flex flex-col items-center justify-center gap-2 text-slate-500 hover:text-emerald-400 transition-all disabled:opacity-50",children:[a.jsx(BP,{size:28}),a.jsx("span",{className:"text-[11px] font-black uppercase tracking-widest",children:c?"Enviando...":"Clique para carregar foto"})]})]})]}),a.jsxs("button",{type:"submit",className:"w-full bg-emerald-500 hover:bg-emerald-400 text-slate-950 font-black py-4 rounded-2xl flex items-center justify-center gap-2 transition-all shadow-lg shadow-emerald-500/20 uppercase italic text-sm",children:[a.jsx(or,{size:20}),o?"Salvar Alterações":"Criar Promoção"]})]})})]})}const Sfe=[{value:"",label:"Todos"},{value:"purchase_confirmed",label:"Compra"},{value:"purchase_pending",label:"Pendente"},{value:"winner",label:"Ganhador"},{value:"welcome",label:"Boas-vindas"},{value:"security_login",label:"Segurança"},{value:"price_drop",label:"Preço"},{value:"last_hours",label:"Últ. Horas"},{value:"reservation_expiring",label:"Reserva"},{value:"club_welcome",label:"Clube: Boas-vindas"},{value:"club_payment_confirmed",label:"Clube: Pagamento"},{value:"club_payment_overdue",label:"Clube: Atraso"},{value:"club_payment_reminder",label:"Clube: Lembrete"},{value:"club_suspended",label:"Clube: Suspenso"},{value:"club_canceled",label:"Clube: Cancelado"}];function Tj(e){return new Date(e).toLocaleString("pt-BR",{day:"2-digit",month:"2-digit",year:"2-digit",hour:"2-digit",minute:"2-digit"})}function kfe(e){return e==="sent"?a.jsx(nn,{size:15,className:"text-emerald-400"}):e==="failed"?a.jsx(Ai,{size:15,className:"text-rose-400"}):a.jsx(hn,{size:15,className:"text-slate-500"})}function Cfe(e){return e==="sent"?"text-emerald-400":e==="failed"?"text-rose-400":"text-slate-500"}function _fe(){const[e,t]=b.useState([]),[n,r]=b.useState(!0),[s,i]=b.useState(""),o=async()=>{r(!0);try{const u=await $.get("/analytics/whatsapp-logs");t(u.data)}catch{}finally{r(!1)}};b.useEffect(()=>{o()},[]);const l=e.reduce((u,d)=>(u[d.status]=(u[d.status]||0)+1,u),{}),c=s?e.filter(u=>u.type===s):e;return a.jsxs("div",{className:"space-y-6",children:[a.jsx("div",{className:"flex gap-3 flex-wrap",children:[{key:"sent",label:"Enviados",color:"emerald"},{key:"retrying",label:"Tentando",color:"amber"},{key:"failed",label:"Falhas",color:"rose"},{key:"processing",label:"Processando",color:"cyan"}].map(u=>a.jsxs("div",{className:"bg-slate-900/40 border border-slate-800 rounded-2xl px-5 py-3 flex items-center gap-3",children:[a.jsx("span",{className:`text-2xl font-black tabular-nums text-${u.color}-400`,children:l[u.key]??0}),a.jsx("span",{className:"text-slate-500 text-xs font-bold uppercase tracking-widest",children:u.label})]},u.key))}),a.jsx("div",{className:"flex gap-1.5 flex-wrap",children:Sfe.map(u=>{const d=u.value?e.filter(f=>f.type===u.value).length:e.length;return a.jsxs("button",{onClick:()=>i(u.value),className:`px-3 py-1.5 rounded-xl text-xs font-bold transition-all border ${s===u.value?"text-cyan-400 bg-cyan-400/10 border-cyan-500/30":"text-slate-500 bg-slate-900 border-slate-800 hover:border-slate-700 hover:text-slate-300"}`,children:[u.label,d>0&&a.jsx("span",{className:"ml-1.5 text-[9px] bg-slate-700 text-slate-400 px-1.5 py-0.5 rounded-full",children:d})]},u.value)})}),a.jsx($j,{loading:n,empty:c.length===0,head:["Status","Telefone","Tipo","Payload","Data"],emptyMsg:"Nenhuma notificação registrada.",children:c.map(u=>{var d;return a.jsxs("tr",{className:"hover:bg-slate-800/20 transition-colors",children:[a.jsx("td",{className:"px-6 py-4",children:a.jsxs("div",{className:"flex items-center gap-2",children:[kfe(u.status),a.jsx("span",{className:`text-[10px] font-black uppercase tracking-widest ${Cfe(u.status)}`,children:u.status})]})}),a.jsx("td",{className:"px-6 py-4 text-sm text-slate-300 font-mono",children:u.phone??"—"}),a.jsx("td",{className:"px-6 py-4",children:a.jsx("span",{className:"bg-slate-800 text-slate-400 px-2 py-1 rounded text-[10px] font-bold uppercase tracking-tight",children:(d=u.type)==null?void 0:d.replace(/_/g," ")})}),a.jsx("td",{className:"px-6 py-4 text-xs text-slate-500 font-mono max-w-xs truncate",children:JSON.stringify(u.payload)}),a.jsx("td",{className:"px-6 py-4 text-[11px] text-slate-500 whitespace-nowrap",children:Tj(u.created_at)})]},u.id)})})]})}function Afe(){const[e,t]=b.useState({rows:[],total:0}),[n,r]=b.useState(!0),[s,i]=b.useState(""),o=async()=>{r(!0);try{const l=await $.get("/admin/notification-errors",{params:{phone:s||void 0,limit:100}});t(l.data)}catch{}finally{r(!1)}};return b.useEffect(()=>{o()},[]),a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex gap-3 items-center",children:[a.jsxs("div",{className:"bg-rose-500/10 border border-rose-500/20 rounded-2xl px-5 py-3 flex items-center gap-3",children:[a.jsx("span",{className:"text-2xl font-black text-rose-400",children:e.total}),a.jsx("span",{className:"text-slate-500 text-xs font-bold uppercase tracking-widest",children:"falhas definitivas"})]}),a.jsx("input",{value:s,onChange:l=>i(l.target.value),onKeyDown:l=>l.key==="Enter"&&o(),placeholder:"Filtrar por telefone…",className:"bg-slate-900 border border-slate-700 rounded-xl px-4 py-2.5 text-sm text-slate-300 focus:outline-none focus:border-slate-500 w-56"})]}),a.jsx($j,{loading:n,empty:e.rows.length===0,head:["Telefone","Erro","Payload","Job ID","Data"],emptyMsg:"Nenhuma falha definitiva registrada. ✅",children:e.rows.map(l=>a.jsxs("tr",{className:"hover:bg-slate-800/20 transition-colors",children:[a.jsx("td",{className:"px-6 py-4 text-sm text-rose-300 font-mono",children:l.phone??"—"}),a.jsx("td",{className:"px-6 py-4 text-xs text-slate-400 max-w-xs",children:l.error_message}),a.jsx("td",{className:"px-6 py-4 text-xs text-slate-500 font-mono max-w-xs truncate",children:JSON.stringify(l.payload)}),a.jsx("td",{className:"px-6 py-4 text-[10px] text-slate-600 font-mono",children:l.job_id}),a.jsx("td",{className:"px-6 py-4 text-[11px] text-slate-500 whitespace-nowrap",children:Tj(l.created_at)})]},l.id))})]})}function Pfe(){const[e,t]=b.useState({rows:[],total:0}),[n,r]=b.useState(!0),[s,i]=b.useState(""),[o,l]=b.useState(""),c=async()=>{r(!0);try{const d=await $.get("/admin/nw-events",{params:{event:s||void 0,direction:o||void 0,limit:100}});t(d.data)}catch{}finally{r(!1)}};b.useEffect(()=>{c()},[]);const u=d=>d==="in"?a.jsx(aI,{size:13,className:"text-emerald-400"}):a.jsx(sI,{size:13,className:"text-cyan-400"});return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex gap-2 flex-wrap items-center",children:[a.jsxs("div",{className:"bg-slate-900/40 border border-slate-800 rounded-2xl px-5 py-3 flex items-center gap-3",children:[a.jsx("span",{className:"text-2xl font-black text-slate-300",children:e.total}),a.jsx("span",{className:"text-slate-500 text-xs font-bold uppercase tracking-widest",children:"eventos"})]}),["","message.new","session.status"].map(d=>a.jsx("button",{onClick:()=>{i(d)},className:`px-3 py-1.5 rounded-xl text-xs font-bold border transition-all ${s===d?"text-cyan-400 bg-cyan-400/10 border-cyan-500/30":"text-slate-500 bg-slate-900 border-slate-800 hover:text-slate-300"}`,children:d||"Todos"},d)),["","in","out"].map(d=>a.jsx("button",{onClick:()=>l(d),className:`px-3 py-1.5 rounded-xl text-xs font-bold border transition-all ${o===d?"text-violet-400 bg-violet-400/10 border-violet-500/30":"text-slate-500 bg-slate-900 border-slate-800 hover:text-slate-300"}`,children:d===""?"Todos":d==="in"?"↙ Recebidos":"↗ Enviados"},d)),a.jsx("button",{onClick:c,className:"p-2 bg-slate-800 rounded-xl border border-slate-700 hover:bg-slate-700 transition-all",children:a.jsx(ke,{size:14,className:"text-slate-400"})})]}),a.jsx($j,{loading:n,empty:e.rows.length===0,head:["Direção","Evento","Instância","Chat ID","Tipo msg","Payload","Data"],emptyMsg:"Nenhum evento recebido ainda.",children:e.rows.map(d=>a.jsxs("tr",{className:"hover:bg-slate-800/20 transition-colors",children:[a.jsx("td",{className:"px-6 py-4",children:a.jsxs("div",{className:"flex items-center gap-1.5",children:[u(d.direction),a.jsx("span",{className:`text-[10px] font-black uppercase ${d.direction==="in"?"text-emerald-400":"text-cyan-400"}`,children:d.direction})]})}),a.jsx("td",{className:"px-6 py-4",children:a.jsx("span",{className:"bg-slate-800 text-slate-400 px-2 py-1 rounded text-[10px] font-bold",children:d.event})}),a.jsx("td",{className:"px-6 py-4 text-xs text-slate-400 font-mono",children:d.instance_id||"—"}),a.jsx("td",{className:"px-6 py-4 text-xs text-slate-500 font-mono max-w-[120px] truncate",children:d.chat_id||"—"}),a.jsx("td",{className:"px-6 py-4 text-[10px] text-slate-600 uppercase",children:d.msg_type||"—"}),a.jsx("td",{className:"px-6 py-4 text-xs text-slate-500 font-mono max-w-xs truncate",children:JSON.stringify(d.payload)}),a.jsx("td",{className:"px-6 py-4 text-[11px] text-slate-500 whitespace-nowrap",children:Tj(d.created_at)})]},d.id))})]})}function $j({loading:e,empty:t,head:n,emptyMsg:r,children:s}){return a.jsx("div",{className:"bg-slate-900/50 border border-slate-800 rounded-3xl overflow-hidden",children:a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-left",children:[a.jsx("thead",{children:a.jsx("tr",{className:"bg-slate-800/30 text-slate-500 text-[10px] uppercase tracking-widest font-bold",children:n.map(i=>a.jsx("th",{className:"px-6 py-4",children:i},i))})}),a.jsx("tbody",{className:"divide-y divide-slate-800",children:e?[1,2,3].map(i=>a.jsx("tr",{className:"animate-pulse",children:a.jsx("td",{colSpan:n.length,className:"px-6 py-6 bg-slate-800/10"})},i)):t?a.jsx("tr",{children:a.jsx("td",{colSpan:n.length,className:"px-6 py-20 text-center text-slate-500",children:a.jsxs("div",{className:"flex flex-col items-center gap-3",children:[a.jsx(rn,{size:36,className:"text-slate-800"}),a.jsx("p",{className:"text-sm",children:r})]})})}):s})]})})})}const Efe=[{key:"logs",label:"Logs de Saída",icon:a.jsx(rn,{size:14})},{key:"errors",label:"Falhas Definitivas",icon:a.jsx(Kt,{size:14})},{key:"inbox",label:"Inbox Recebidos",icon:a.jsx(Pr,{size:14})}];function Ofe(){const[e,t]=b.useState("logs"),[,n]=b.useState(0);return a.jsxs("div",{className:"space-y-6 animate-in fade-in slide-in-from-bottom-4 duration-500",children:[a.jsxs("header",{className:"flex justify-between items-center",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-3xl font-black text-white tracking-tighter uppercase italic",children:"Auditoria WhatsApp"}),a.jsx("p",{className:"text-slate-400 mt-1",children:"Logs de envio, falhas definitivas e mensagens recebidas."})]}),a.jsx("button",{onClick:()=>n(r=>r+1),className:"p-3 bg-slate-800 hover:bg-slate-700 text-slate-300 rounded-xl transition-all border border-slate-700",children:a.jsx(ke,{size:18})})]}),a.jsx("div",{className:"flex gap-1 bg-slate-900/60 border border-slate-800 rounded-2xl p-1 w-fit",children:Efe.map(r=>a.jsxs("button",{onClick:()=>t(r.key),className:`flex items-center gap-2 px-4 py-2 rounded-xl text-xs font-black uppercase tracking-wider transition-all ${e===r.key?"bg-slate-700 text-white":"text-slate-500 hover:text-slate-300"}`,children:[r.icon,r.label]},r.key))}),e==="logs"&&a.jsx(_fe,{},"logs"),e==="errors"&&a.jsx(Afe,{},"errors"),e==="inbox"&&a.jsx(Pfe,{},"inbox")]})}const Mj=b.createContext({});function Rj(e){const t=b.useRef(null);return t.current===null&&(t.current=e()),t.current}const Tfe=typeof window<"u",y6=Tfe?b.useLayoutEffect:b.useEffect,gx=b.createContext(null);function Dj(e,t){e.indexOf(t)===-1&&e.push(t)}function Bh(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}const la=(e,t,n)=>n>t?t:n<e?e:n;let Ij=()=>{};const _s={},b6=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function j6(e){return typeof e=="object"&&e!==null}const w6=e=>/^0[^.\s]+$/u.test(e);function N6(e){let t;return()=>(t===void 0&&(t=e()),t)}const lr=e=>e,$fe=(e,t)=>n=>t(e(n)),Td=(...e)=>e.reduce($fe),sd=(e,t,n)=>{const r=t-e;return r===0?1:(n-e)/r};class Lj{constructor(){this.subscriptions=[]}add(t){return Dj(this.subscriptions,t),()=>Bh(this.subscriptions,t)}notify(t,n,r){const s=this.subscriptions.length;if(s)if(s===1)this.subscriptions[0](t,n,r);else for(let i=0;i<s;i++){const o=this.subscriptions[i];o&&o(t,n,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const Bn=e=>e*1e3,sr=e=>e/1e3;function S6(e,t){return t?e*(1e3/t):0}const k6=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,Mfe=1e-7,Rfe=12;function Dfe(e,t,n,r,s){let i,o,l=0;do o=t+(n-t)/2,i=k6(o,r,s)-e,i>0?n=o:t=o;while(Math.abs(i)>Mfe&&++l<Rfe);return o}function $d(e,t,n,r){if(e===t&&n===r)return lr;const s=i=>Dfe(i,0,1,e,n);return i=>i===0||i===1?i:k6(s(i),t,r)}const C6=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,_6=e=>t=>1-e(1-t),A6=$d(.33,1.53,.69,.99),zj=_6(A6),P6=C6(zj),E6=e=>e>=1?1:(e*=2)<1?.5*zj(e):.5*(2-Math.pow(2,-10*(e-1))),Bj=e=>1-Math.sin(Math.acos(e)),O6=_6(Bj),T6=C6(Bj),Ife=$d(.42,0,1,1),Lfe=$d(0,0,.58,1),$6=$d(.42,0,.58,1),zfe=e=>Array.isArray(e)&&typeof e[0]!="number",M6=e=>Array.isArray(e)&&typeof e[0]=="number",Bfe={linear:lr,easeIn:Ife,easeInOut:$6,easeOut:Lfe,circIn:Bj,circInOut:T6,circOut:O6,backIn:zj,backInOut:P6,backOut:A6,anticipate:E6},Ffe=e=>typeof e=="string",v4=e=>{if(M6(e)){Ij(e.length===4);const[t,n,r,s]=e;return $d(t,n,r,s)}else if(Ffe(e))return Bfe[e];return e},jf=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function Vfe(e,t){let n=new Set,r=new Set,s=!1,i=!1;const o=new WeakSet;let l={delta:0,timestamp:0,isProcessing:!1};function c(d){o.has(d)&&(u.schedule(d),e()),d(l)}const u={schedule:(d,f=!1,p=!1)=>{const m=p&&s?n:r;return f&&o.add(d),m.add(d),d},cancel:d=>{r.delete(d),o.delete(d)},process:d=>{if(l=d,s){i=!0;return}s=!0;const f=n;n=r,r=f,n.forEach(c),n.clear(),s=!1,i&&(i=!1,u.process(d))}};return u}const Ufe=40;function R6(e,t){let n=!1,r=!0;const s={delta:0,timestamp:0,isProcessing:!1},i=()=>n=!0,o=jf.reduce((j,N)=>(j[N]=Vfe(i),j),{}),{setup:l,read:c,resolveKeyframes:u,preUpdate:d,update:f,preRender:p,render:h,postRender:m}=o,v=()=>{const j=_s.useManualTiming,N=j?s.timestamp:performance.now();n=!1,j||(s.delta=r?1e3/60:Math.max(Math.min(N-s.timestamp,Ufe),1)),s.timestamp=N,s.isProcessing=!0,l.process(s),c.process(s),u.process(s),d.process(s),f.process(s),p.process(s),h.process(s),m.process(s),s.isProcessing=!1,n&&t&&(r=!1,e(v))},x=()=>{n=!0,r=!0,s.isProcessing||e(v)};return{schedule:jf.reduce((j,N)=>{const w=o[N];return j[N]=(S,k=!1,C=!1)=>(n||x(),w.schedule(S,k,C)),j},{}),cancel:j=>{for(let N=0;N<jf.length;N++)o[jf[N]].cancel(j)},state:s,steps:o}}const{schedule:Ue,cancel:As,state:Vt,steps:$0}=R6(typeof requestAnimationFrame<"u"?requestAnimationFrame:lr,!0);let Xf;function Wfe(){Xf=void 0}const dn={now:()=>(Xf===void 0&&dn.set(Vt.isProcessing||_s.useManualTiming?Vt.timestamp:performance.now()),Xf),set:e=>{Xf=e,queueMicrotask(Wfe)}},D6=e=>t=>typeof t=="string"&&t.startsWith(e),I6=D6("--"),qfe=D6("var(--"),Fj=e=>qfe(e)?Hfe.test(e.split("/*")[0].trim()):!1,Hfe=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function y4(e){return typeof e!="string"?!1:e.split("/*")[0].includes("var(--")}const Kl={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},id={...Kl,transform:e=>la(0,1,e)},wf={...Kl,default:1},Xc=e=>Math.round(e*1e5)/1e5,Vj=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function Kfe(e){return e==null}const Gfe=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Uj=(e,t)=>n=>!!(typeof n=="string"&&Gfe.test(n)&&n.startsWith(e)||t&&!Kfe(n)&&Object.prototype.hasOwnProperty.call(n,t)),L6=(e,t,n)=>r=>{if(typeof r!="string")return r;const[s,i,o,l]=r.match(Vj);return{[e]:parseFloat(s),[t]:parseFloat(i),[n]:parseFloat(o),alpha:l!==void 0?parseFloat(l):1}},Xfe=e=>la(0,255,e),M0={...Kl,transform:e=>Math.round(Xfe(e))},fi={test:Uj("rgb","red"),parse:L6("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+M0.transform(e)+", "+M0.transform(t)+", "+M0.transform(n)+", "+Xc(id.transform(r))+")"};function Yfe(e){let t="",n="",r="",s="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),s=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),s=e.substring(4,5),t+=t,n+=n,r+=r,s+=s),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:s?parseInt(s,16)/255:1}}const zy={test:Uj("#"),parse:Yfe,transform:fi.transform},Md=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Wa=Md("deg"),ta=Md("%"),pe=Md("px"),Qfe=Md("vh"),Jfe=Md("vw"),b4={...ta,parse:e=>ta.parse(e)/100,transform:e=>ta.transform(e*100)},ko={test:Uj("hsl","hue"),parse:L6("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+ta.transform(Xc(t))+", "+ta.transform(Xc(n))+", "+Xc(id.transform(r))+")"},yt={test:e=>fi.test(e)||zy.test(e)||ko.test(e),parse:e=>fi.test(e)?fi.parse(e):ko.test(e)?ko.parse(e):zy.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?fi.transform(e):ko.transform(e),getAnimatableNone:e=>{const t=yt.parse(e);return t.alpha=0,yt.transform(t)}},Zfe=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function epe(e){var t,n;return isNaN(e)&&typeof e=="string"&&(((t=e.match(Vj))==null?void 0:t.length)||0)+(((n=e.match(Zfe))==null?void 0:n.length)||0)>0}const z6="number",B6="color",tpe="var",npe="var(",j4="${}",rpe=/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 Sl(e){const t=e.toString(),n=[],r={color:[],number:[],var:[]},s=[];let i=0;const l=t.replace(rpe,c=>(yt.test(c)?(r.color.push(i),s.push(B6),n.push(yt.parse(c))):c.startsWith(npe)?(r.var.push(i),s.push(tpe),n.push(c)):(r.number.push(i),s.push(z6),n.push(parseFloat(c))),++i,j4)).split(j4);return{values:n,split:l,indexes:r,types:s}}function ape(e){return Sl(e).values}function F6({split:e,types:t}){const n=e.length;return r=>{let s="";for(let i=0;i<n;i++)if(s+=e[i],r[i]!==void 0){const o=t[i];o===z6?s+=Xc(r[i]):o===B6?s+=yt.transform(r[i]):s+=r[i]}return s}}function spe(e){return F6(Sl(e))}const ipe=e=>typeof e=="number"?0:yt.test(e)?yt.getAnimatableNone(e):e,ope=(e,t)=>typeof e=="number"?t!=null&&t.trim().endsWith("/")?e:0:ipe(e);function lpe(e){const t=Sl(e);return F6(t)(t.values.map((r,s)=>ope(r,t.split[s])))}const Tr={test:epe,parse:ape,createTransformer:spe,getAnimatableNone:lpe};function R0(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function cpe({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let s=0,i=0,o=0;if(!t)s=i=o=n;else{const l=n<.5?n*(1+t):n+t-n*t,c=2*n-l;s=R0(c,l,e+1/3),i=R0(c,l,e),o=R0(c,l,e-1/3)}return{red:Math.round(s*255),green:Math.round(i*255),blue:Math.round(o*255),alpha:r}}function Fh(e,t){return n=>n>0?t:e}const Je=(e,t,n)=>e+(t-e)*n,D0=(e,t,n)=>{const r=e*e,s=n*(t*t-r)+r;return s<0?0:Math.sqrt(s)},upe=[zy,fi,ko],dpe=e=>upe.find(t=>t.test(e));function w4(e){const t=dpe(e);if(!t)return!1;let n=t.parse(e);return t===ko&&(n=cpe(n)),n}const N4=(e,t)=>{const n=w4(e),r=w4(t);if(!n||!r)return Fh(e,t);const s={...n};return i=>(s.red=D0(n.red,r.red,i),s.green=D0(n.green,r.green,i),s.blue=D0(n.blue,r.blue,i),s.alpha=Je(n.alpha,r.alpha,i),fi.transform(s))},By=new Set(["none","hidden"]);function fpe(e,t){return By.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function ppe(e,t){return n=>Je(e,t,n)}function Wj(e){return typeof e=="number"?ppe:typeof e=="string"?Fj(e)?Fh:yt.test(e)?N4:xpe:Array.isArray(e)?V6:typeof e=="object"?yt.test(e)?N4:hpe:Fh}function V6(e,t){const n=[...e],r=n.length,s=e.map((i,o)=>Wj(i)(i,t[o]));return i=>{for(let o=0;o<r;o++)n[o]=s[o](i);return n}}function hpe(e,t){const n={...e,...t},r={};for(const s in n)e[s]!==void 0&&t[s]!==void 0&&(r[s]=Wj(e[s])(e[s],t[s]));return s=>{for(const i in r)n[i]=r[i](s);return n}}function mpe(e,t){const n=[],r={color:0,var:0,number:0};for(let s=0;s<t.values.length;s++){const i=t.types[s],o=e.indexes[i][r[i]],l=e.values[o]??0;n[s]=l,r[i]++}return n}const xpe=(e,t)=>{const n=Tr.createTransformer(t),r=Sl(e),s=Sl(t);return r.indexes.var.length===s.indexes.var.length&&r.indexes.color.length===s.indexes.color.length&&r.indexes.number.length>=s.indexes.number.length?By.has(e)&&!s.values.length||By.has(t)&&!r.values.length?fpe(e,t):Td(V6(mpe(r,s),s.values),n):Fh(e,t)};function U6(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?Je(e,t,n):Wj(e)(e,t)}const gpe=e=>{const t=({timestamp:n})=>e(n);return{start:(n=!0)=>Ue.update(t,n),stop:()=>As(t),now:()=>Vt.isProcessing?Vt.timestamp:dn.now()}},W6=(e,t,n=10)=>{let r="";const s=Math.max(Math.round(t/n),2);for(let i=0;i<s;i++)r+=Math.round(e(i/(s-1))*1e4)/1e4+", ";return`linear(${r.substring(0,r.length-2)})`},Vh=2e4;function qj(e){let t=0;const n=50;let r=e.next(t);for(;!r.done&&t<Vh;)t+=n,r=e.next(t);return t>=Vh?1/0:t}function vpe(e,t=100,n){const r=n({...e,keyframes:[0,t]}),s=Math.min(qj(r),Vh);return{type:"keyframes",ease:i=>r.next(s*i).value/t,duration:sr(s)}}const ct={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1};function Fy(e,t){return e*Math.sqrt(1-t*t)}const ype=12;function bpe(e,t,n){let r=n;for(let s=1;s<ype;s++)r=r-e(r)/t(r);return r}const I0=.001;function jpe({duration:e=ct.duration,bounce:t=ct.bounce,velocity:n=ct.velocity,mass:r=ct.mass}){let s,i,o=1-t;o=la(ct.minDamping,ct.maxDamping,o),e=la(ct.minDuration,ct.maxDuration,sr(e)),o<1?(s=u=>{const d=u*o,f=d*e,p=d-n,h=Fy(u,o),m=Math.exp(-f);return I0-p/h*m},i=u=>{const f=u*o*e,p=f*n+n,h=Math.pow(o,2)*Math.pow(u,2)*e,m=Math.exp(-f),v=Fy(Math.pow(u,2),o);return(-s(u)+I0>0?-1:1)*((p-h)*m)/v}):(s=u=>{const d=Math.exp(-u*e),f=(u-n)*e+1;return-I0+d*f},i=u=>{const d=Math.exp(-u*e),f=(n-u)*(e*e);return d*f});const l=5/e,c=bpe(s,i,l);if(e=Bn(e),isNaN(c))return{stiffness:ct.stiffness,damping:ct.damping,duration:e};{const u=Math.pow(c,2)*r;return{stiffness:u,damping:o*2*Math.sqrt(r*u),duration:e}}}const wpe=["duration","bounce"],Npe=["stiffness","damping","mass"];function S4(e,t){return t.some(n=>e[n]!==void 0)}function Spe(e){let t={velocity:ct.velocity,stiffness:ct.stiffness,damping:ct.damping,mass:ct.mass,isResolvedFromDuration:!1,...e};if(!S4(e,Npe)&&S4(e,wpe))if(t.velocity=0,e.visualDuration){const n=e.visualDuration,r=2*Math.PI/(n*1.2),s=r*r,i=2*la(.05,1,1-(e.bounce||0))*Math.sqrt(s);t={...t,mass:ct.mass,stiffness:s,damping:i}}else{const n=jpe({...e,velocity:0});t={...t,...n,mass:ct.mass},t.isResolvedFromDuration=!0}return t}function Uh(e=ct.visualDuration,t=ct.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:r,restDelta:s}=n;const i=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],l={done:!1,value:i},{stiffness:c,damping:u,mass:d,duration:f,velocity:p,isResolvedFromDuration:h}=Spe({...n,velocity:-sr(n.velocity||0)}),m=p||0,v=u/(2*Math.sqrt(c*d)),x=o-i,y=sr(Math.sqrt(c/d)),g=Math.abs(x)<5;r||(r=g?ct.restSpeed.granular:ct.restSpeed.default),s||(s=g?ct.restDelta.granular:ct.restDelta.default);let j,N,w,S,k,C;if(v<1)w=Fy(y,v),S=(m+v*y*x)/w,j=A=>{const E=Math.exp(-v*y*A);return o-E*(S*Math.sin(w*A)+x*Math.cos(w*A))},k=v*y*S+x*w,C=v*y*x-S*w,N=A=>Math.exp(-v*y*A)*(k*Math.sin(w*A)+C*Math.cos(w*A));else if(v===1){j=E=>o-Math.exp(-y*E)*(x+(m+y*x)*E);const A=m+y*x;N=E=>Math.exp(-y*E)*(y*A*E-m)}else{const A=y*Math.sqrt(v*v-1);j=I=>{const R=Math.exp(-v*y*I),M=Math.min(A*I,300);return o-R*((m+v*y*x)*Math.sinh(M)+A*x*Math.cosh(M))/A};const E=(m+v*y*x)/A,P=v*y*E-x*A,D=v*y*x-E*A;N=I=>{const R=Math.exp(-v*y*I),M=Math.min(A*I,300);return R*(P*Math.sinh(M)+D*Math.cosh(M))}}const _={calculatedDuration:h&&f||null,velocity:A=>Bn(N(A)),next:A=>{if(!h&&v<1){const P=Math.exp(-v*y*A),D=Math.sin(w*A),I=Math.cos(w*A),R=o-P*(S*D+x*I),M=Bn(P*(k*D+C*I));return l.done=Math.abs(M)<=r&&Math.abs(o-R)<=s,l.value=l.done?o:R,l}const E=j(A);if(h)l.done=A>=f;else{const P=Bn(N(A));l.done=Math.abs(P)<=r&&Math.abs(o-E)<=s}return l.value=l.done?o:E,l},toString:()=>{const A=Math.min(qj(_),Vh),E=W6(P=>_.next(A*P).value,A,30);return A+"ms "+E},toTransition:()=>{}};return _}Uh.applyToOptions=e=>{const t=vpe(e,100,Uh);return e.ease=t.ease,e.duration=Bn(t.duration),e.type="keyframes",e};const kpe=5;function q6(e,t,n){const r=Math.max(t-kpe,0);return S6(n-e(r),t-r)}function Vy({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:s=10,bounceStiffness:i=500,modifyTarget:o,min:l,max:c,restDelta:u=.5,restSpeed:d}){const f=e[0],p={done:!1,value:f},h=C=>l!==void 0&&C<l||c!==void 0&&C>c,m=C=>l===void 0?c:c===void 0||Math.abs(l-C)<Math.abs(c-C)?l:c;let v=n*t;const x=f+v,y=o===void 0?x:o(x);y!==x&&(v=y-f);const g=C=>-v*Math.exp(-C/r),j=C=>y+g(C),N=C=>{const _=g(C),A=j(C);p.done=Math.abs(_)<=u,p.value=p.done?y:A};let w,S;const k=C=>{h(p.value)&&(w=C,S=Uh({keyframes:[p.value,m(p.value)],velocity:q6(j,C,p.value),damping:s,stiffness:i,restDelta:u,restSpeed:d}))};return k(0),{calculatedDuration:null,next:C=>{let _=!1;return!S&&w===void 0&&(_=!0,N(C),k(C)),w!==void 0&&C>=w?S.next(C-w):(!_&&N(C),p)}}}function Cpe(e,t,n){const r=[],s=n||_s.mix||U6,i=e.length-1;for(let o=0;o<i;o++){let l=s(e[o],e[o+1]);if(t){const c=Array.isArray(t)?t[o]||lr:t;l=Td(c,l)}r.push(l)}return r}function _pe(e,t,{clamp:n=!0,ease:r,mixer:s}={}){const i=e.length;if(Ij(i===t.length),i===1)return()=>t[0];if(i===2&&t[0]===t[1])return()=>t[1];const o=e[0]===e[1];e[0]>e[i-1]&&(e=[...e].reverse(),t=[...t].reverse());const l=Cpe(t,r,s),c=l.length,u=d=>{if(o&&d<e[0])return t[0];let f=0;if(c>1)for(;f<e.length-2&&!(d<e[f+1]);f++);const p=sd(e[f],e[f+1],d);return l[f](p)};return n?d=>u(la(e[0],e[i-1],d)):u}function Ape(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const s=sd(0,t,r);e.push(Je(n,1,s))}}function Ppe(e){const t=[0];return Ape(t,e.length-1),t}function Epe(e,t){return e.map(n=>n*t)}function Ope(e,t){return e.map(()=>t||$6).splice(0,e.length-1)}function Yc({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const s=zfe(r)?r.map(v4):v4(r),i={done:!1,value:t[0]},o=Epe(n&&n.length===t.length?n:Ppe(t),e),l=_pe(o,t,{ease:Array.isArray(s)?s:Ope(t,s)});return{calculatedDuration:e,next:c=>(i.value=l(c),i.done=c>=e,i)}}const Tpe=e=>e!==null;function vx(e,{repeat:t,repeatType:n="loop"},r,s=1){const i=e.filter(Tpe),l=s<0||t&&n!=="loop"&&t%2===1?0:i.length-1;return!l||r===void 0?i[l]:r}const $pe={decay:Vy,inertia:Vy,tween:Yc,keyframes:Yc,spring:Uh};function H6(e){typeof e.type=="string"&&(e.type=$pe[e.type])}class Hj{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(t=>{this.resolve=t})}notifyFinished(){this.resolve()}then(t,n){return this.finished.then(t,n)}}const Mpe=e=>e/100;class Wh extends Hj{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{var r,s;const{motionValue:n}=this.options;n&&n.updatedAt!==dn.now()&&this.tick(dn.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),(s=(r=this.options).onStop)==null||s.call(r))},this.options=t,this.initAnimation(),this.play(),t.autoplay===!1&&this.pause()}initAnimation(){const{options:t}=this;H6(t);const{type:n=Yc,repeat:r=0,repeatDelay:s=0,repeatType:i,velocity:o=0}=t;let{keyframes:l}=t;const c=n||Yc;c!==Yc&&typeof l[0]!="number"&&(this.mixKeyframes=Td(Mpe,U6(l[0],l[1])),l=[0,100]);const u=c({...t,keyframes:l});i==="mirror"&&(this.mirroredGenerator=c({...t,keyframes:[...l].reverse(),velocity:-o})),u.calculatedDuration===null&&(u.calculatedDuration=qj(u));const{calculatedDuration:d}=u;this.calculatedDuration=d,this.resolvedDuration=d+s,this.totalDuration=this.resolvedDuration*(r+1)-s,this.generator=u}updateTime(t){const n=Math.round(t-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(t,n=!1){const{generator:r,totalDuration:s,mixKeyframes:i,mirroredGenerator:o,resolvedDuration:l,calculatedDuration:c}=this;if(this.startTime===null)return r.next(0);const{delay:u=0,keyframes:d,repeat:f,repeatType:p,repeatDelay:h,type:m,onUpdate:v,finalKeyframe:x}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-s/this.speed,this.startTime)),n?this.currentTime=t:this.updateTime(t);const y=this.currentTime-u*(this.playbackSpeed>=0?1:-1),g=this.playbackSpeed>=0?y<0:y>s;this.currentTime=Math.max(y,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=s);let j=this.currentTime,N=r;if(f){const C=Math.min(this.currentTime,s)/l;let _=Math.floor(C),A=C%1;!A&&C>=1&&(A=1),A===1&&_--,_=Math.min(_,f+1),!!(_%2)&&(p==="reverse"?(A=1-A,h&&(A-=h/l)):p==="mirror"&&(N=o)),j=la(0,1,A)*l}let w;g?(this.delayState.value=d[0],w=this.delayState):w=N.next(j),i&&!g&&(w.value=i(w.value));let{done:S}=w;!g&&c!==null&&(S=this.playbackSpeed>=0?this.currentTime>=s:this.currentTime<=0);const k=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&S);return k&&m!==Vy&&(w.value=vx(d,this.options,x,this.speed)),v&&v(w.value),k&&this.finish(),w}then(t,n){return this.finished.then(t,n)}get duration(){return sr(this.calculatedDuration)}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+sr(t)}get time(){return sr(this.currentTime)}set time(t){t=Bn(t),this.currentTime=t,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=t,this.tick(t))}getGeneratorVelocity(){const t=this.currentTime;if(t<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(t);const n=this.generator.next(t).value;return q6(r=>this.generator.next(r).value,t,n)}get speed(){return this.playbackSpeed}set speed(t){const n=this.playbackSpeed!==t;n&&this.driver&&this.updateTime(dn.now()),this.playbackSpeed=t,n&&this.driver&&(this.time=sr(this.currentTime))}play(){var s,i;if(this.isStopped)return;const{driver:t=gpe,startTime:n}=this.options;this.driver||(this.driver=t(o=>this.tick(o))),(i=(s=this.options).onPlay)==null||i.call(s);const r=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=r):this.holdTime!==null?this.startTime=r-this.holdTime:this.startTime||(this.startTime=n??r),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(dn.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){var t,n;this.notifyFinished(),this.teardown(),this.state="finished",(n=(t=this.options).onComplete)==null||n.call(t)}cancel(){var t,n;this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),(n=(t=this.options).onCancel)==null||n.call(t)}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){var n;return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),(n=this.driver)==null||n.stop(),t.observe(this)}}function Rpe(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}const pi=e=>e*180/Math.PI,Uy=e=>{const t=pi(Math.atan2(e[1],e[0]));return Wy(t)},Dpe={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:Uy,rotateZ:Uy,skewX:e=>pi(Math.atan(e[1])),skewY:e=>pi(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},Wy=e=>(e=e%360,e<0&&(e+=360),e),k4=Uy,C4=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),_4=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),Ipe={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:C4,scaleY:_4,scale:e=>(C4(e)+_4(e))/2,rotateX:e=>Wy(pi(Math.atan2(e[6],e[5]))),rotateY:e=>Wy(pi(Math.atan2(-e[2],e[0]))),rotateZ:k4,rotate:k4,skewX:e=>pi(Math.atan(e[4])),skewY:e=>pi(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function qy(e){return e.includes("scale")?1:0}function Hy(e,t){if(!e||e==="none")return qy(t);const n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,s;if(n)r=Ipe,s=n;else{const l=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=Dpe,s=l}if(!s)return qy(t);const i=r[t],o=s[1].split(",").map(zpe);return typeof i=="function"?i(o):o[i]}const Lpe=(e,t)=>{const{transform:n="none"}=getComputedStyle(e);return Hy(n,t)};function zpe(e){return parseFloat(e.trim())}const Gl=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Xl=new Set(Gl),A4=e=>e===Kl||e===pe,Bpe=new Set(["x","y","z"]),Fpe=Gl.filter(e=>!Bpe.has(e));function Vpe(e){const t=[];return Fpe.forEach(n=>{const r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),t}const ss={width:({x:e},{paddingLeft:t="0",paddingRight:n="0",boxSizing:r})=>{const s=e.max-e.min;return r==="border-box"?s:s-parseFloat(t)-parseFloat(n)},height:({y:e},{paddingTop:t="0",paddingBottom:n="0",boxSizing:r})=>{const s=e.max-e.min;return r==="border-box"?s:s-parseFloat(t)-parseFloat(n)},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})=>Hy(t,"x"),y:(e,{transform:t})=>Hy(t,"y")};ss.translateX=ss.x;ss.translateY=ss.y;const ji=new Set;let Ky=!1,Gy=!1,Xy=!1;function K6(){if(Gy){const e=Array.from(ji).filter(r=>r.needsMeasurement),t=new Set(e.map(r=>r.element)),n=new Map;t.forEach(r=>{const s=Vpe(r);s.length&&(n.set(r,s),r.render())}),e.forEach(r=>r.measureInitialState()),t.forEach(r=>{r.render();const s=n.get(r);s&&s.forEach(([i,o])=>{var l;(l=r.getValue(i))==null||l.set(o)})}),e.forEach(r=>r.measureEndState()),e.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}Gy=!1,Ky=!1,ji.forEach(e=>e.complete(Xy)),ji.clear()}function G6(){ji.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(Gy=!0)})}function Upe(){Xy=!0,G6(),K6(),Xy=!1}class Kj{constructor(t,n,r,s,i,o=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=r,this.motionValue=s,this.element=i,this.isAsync=o}scheduleResolve(){this.state="scheduled",this.isAsync?(ji.add(this),Ky||(Ky=!0,Ue.read(G6),Ue.resolveKeyframes(K6))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:r,motionValue:s}=this;if(t[0]===null){const i=s==null?void 0:s.get(),o=t[t.length-1];if(i!==void 0)t[0]=i;else if(r&&n){const l=r.readValue(n,o);l!=null&&(t[0]=l)}t[0]===void 0&&(t[0]=o),s&&i===void 0&&s.set(t[0])}Rpe(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),ji.delete(this)}cancel(){this.state==="scheduled"&&(ji.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const Wpe=e=>e.startsWith("--");function X6(e,t,n){Wpe(t)?e.style.setProperty(t,n):e.style[t]=n}const qpe={};function Y6(e,t){const n=N6(e);return()=>qpe[t]??n()}const Hpe=Y6(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),Q6=Y6(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Pc=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,P4={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Pc([0,.65,.55,1]),circOut:Pc([.55,0,1,.45]),backIn:Pc([.31,.01,.66,-.59]),backOut:Pc([.33,1.53,.69,.99])};function J6(e,t){if(e)return typeof e=="function"?Q6()?W6(e,t):"ease-out":M6(e)?Pc(e):Array.isArray(e)?e.map(n=>J6(n,t)||P4.easeOut):P4[e]}function Kpe(e,t,n,{delay:r=0,duration:s=300,repeat:i=0,repeatType:o="loop",ease:l="easeOut",times:c}={},u=void 0){const d={[t]:n};c&&(d.offset=c);const f=J6(l,s);Array.isArray(f)&&(d.easing=f);const p={delay:r,duration:s,easing:Array.isArray(f)?"linear":f,fill:"both",iterations:i+1,direction:o==="reverse"?"alternate":"normal"};return u&&(p.pseudoElement=u),e.animate(d,p)}function Z6(e){return typeof e=="function"&&"applyToOptions"in e}function Gpe({type:e,...t}){return Z6(e)&&Q6()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class e$ extends Hj{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!t)return;const{element:n,name:r,keyframes:s,pseudoElement:i,allowFlatten:o=!1,finalKeyframe:l,onComplete:c}=t;this.isPseudoElement=!!i,this.allowFlatten=o,this.options=t,Ij(typeof t.type!="string");const u=Gpe(t);this.animation=Kpe(n,r,s,u,i),u.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){const d=vx(s,this.options,l,this.speed);this.updateMotionValue&&this.updateMotionValue(d),X6(n,r,d),this.animation.cancel()}c==null||c(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){var t,n;(n=(t=this.animation).finish)==null||n.call(t)}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;t==="idle"||t==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var n,r,s;const t=(n=this.options)==null?void 0:n.element;!this.isPseudoElement&&(t!=null&&t.isConnected)&&((s=(r=this.animation).commitStyles)==null||s.call(r))}get duration(){var n,r;const t=((r=(n=this.animation.effect)==null?void 0:n.getComputedTiming)==null?void 0:r.call(n).duration)||0;return sr(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+sr(t)}get time(){return sr(Number(this.animation.currentTime)||0)}set time(t){const n=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Bn(t),n&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(t){this.manualStartTime=this.animation.startTime=t}attachTimeline({timeline:t,rangeStart:n,rangeEnd:r,observe:s}){var i;return this.allowFlatten&&((i=this.animation.effect)==null||i.updateTiming({easing:"linear"})),this.animation.onfinish=null,t&&Hpe()?(this.animation.timeline=t,n&&(this.animation.rangeStart=n),r&&(this.animation.rangeEnd=r),lr):s(this)}}const t$={anticipate:E6,backInOut:P6,circInOut:T6};function Xpe(e){return e in t$}function Ype(e){typeof e.ease=="string"&&Xpe(e.ease)&&(e.ease=t$[e.ease])}const L0=10;class Qpe extends e${constructor(t){Ype(t),H6(t),super(t),t.startTime!==void 0&&t.autoplay!==!1&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:n,onUpdate:r,onComplete:s,element:i,...o}=this.options;if(!n)return;if(t!==void 0){n.set(t);return}const l=new Wh({...o,autoplay:!1}),c=Math.max(L0,dn.now()-this.startTime),u=la(0,L0,c-L0),d=l.sample(c).value,{name:f}=this.options;i&&f&&X6(i,f,d),n.setWithVelocity(l.sample(Math.max(0,c-u)).value,d,u),l.stop()}}const E4=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(Tr.test(e)||e==="0")&&!e.startsWith("url("));function Jpe(e){const t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function Zpe(e,t,n,r){const s=e[0];if(s===null)return!1;if(t==="display"||t==="visibility")return!0;const i=e[e.length-1],o=E4(s,t),l=E4(i,t);return!o||!l?!1:Jpe(e)||(n==="spring"||Z6(n))&&r}function Yy(e){e.duration=0,e.type="keyframes"}const n$=new Set(["opacity","clipPath","filter","transform"]),ehe=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function the(e){for(let t=0;t<e.length;t++)if(typeof e[t]=="string"&&ehe.test(e[t]))return!0;return!1}const nhe=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),rhe=N6(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function ahe(e){var f;const{motionValue:t,name:n,repeatDelay:r,repeatType:s,damping:i,type:o,keyframes:l}=e;if(!(((f=t==null?void 0:t.owner)==null?void 0:f.current)instanceof HTMLElement))return!1;const{onUpdate:u,transformTemplate:d}=t.owner.getProps();return rhe()&&n&&(n$.has(n)||nhe.has(n)&&the(l))&&(n!=="transform"||!d)&&!u&&!r&&s!=="mirror"&&i!==0&&o!=="inertia"}const she=40;class ihe extends Hj{constructor({autoplay:t=!0,delay:n=0,type:r="keyframes",repeat:s=0,repeatDelay:i=0,repeatType:o="loop",keyframes:l,name:c,motionValue:u,element:d,...f}){var m;super(),this.stop=()=>{var v,x;this._animation&&(this._animation.stop(),(v=this.stopTimeline)==null||v.call(this)),(x=this.keyframeResolver)==null||x.cancel()},this.createdAt=dn.now();const p={autoplay:t,delay:n,type:r,repeat:s,repeatDelay:i,repeatType:o,name:c,motionValue:u,element:d,...f},h=(d==null?void 0:d.KeyframeResolver)||Kj;this.keyframeResolver=new h(l,(v,x,y)=>this.onKeyframesResolved(v,x,p,!y),c,u,d),(m=this.keyframeResolver)==null||m.scheduleResolve()}onKeyframesResolved(t,n,r,s){var y,g;this.keyframeResolver=void 0;const{name:i,type:o,velocity:l,delay:c,isHandoff:u,onUpdate:d}=r;this.resolvedAt=dn.now();let f=!0;Zpe(t,i,o,l)||(f=!1,(_s.instantAnimations||!c)&&(d==null||d(vx(t,r,n))),t[0]=t[t.length-1],Yy(r),r.repeat=0);const h={startTime:s?this.resolvedAt?this.resolvedAt-this.createdAt>she?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...r,keyframes:t},m=f&&!u&&ahe(h),v=(g=(y=h.motionValue)==null?void 0:y.owner)==null?void 0:g.current;let x;if(m)try{x=new Qpe({...h,element:v})}catch{x=new Wh(h)}else x=new Wh(h);x.finished.then(()=>{this.notifyFinished()}).catch(lr),this.pendingTimeline&&(this.stopTimeline=x.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=x}get finished(){return this._animation?this.animation.finished:this._finished}then(t,n){return this.finished.finally(t).then(()=>{})}get animation(){var t;return this._animation||((t=this.keyframeResolver)==null||t.resume(),Upe()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){var t;this._animation&&this.animation.cancel(),(t=this.keyframeResolver)==null||t.cancel()}}function r$(e,t,n,r=0,s=1){const i=Array.from(e).sort((u,d)=>u.sortNodePosition(d)).indexOf(t),o=e.size,l=(o-1)*r;return typeof n=="function"?n(i,o):s===1?i*r:l-i*r}const ohe=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function lhe(e){const t=ohe.exec(e);if(!t)return[,];const[,n,r,s]=t;return[`--${n??r}`,s]}function a$(e,t,n=1){const[r,s]=lhe(e);if(!r)return;const i=window.getComputedStyle(t).getPropertyValue(r);if(i){const o=i.trim();return b6(o)?parseFloat(o):o}return Fj(s)?a$(s,t,n+1):s}const che={type:"spring",stiffness:500,damping:25,restSpeed:10},uhe=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),dhe={type:"keyframes",duration:.8},fhe={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},phe=(e,{keyframes:t})=>t.length>2?dhe:Xl.has(e)?e.startsWith("scale")?uhe(t[1]):che:fhe;function s$(e,t){if(e!=null&&e.inherit&&t){const{inherit:n,...r}=e;return{...t,...r}}return e}function Gj(e,t){const n=(e==null?void 0:e[t])??(e==null?void 0:e.default)??e;return n!==e?s$(n,e):n}const hhe=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);function mhe(e){for(const t in e)if(!hhe.has(t))return!0;return!1}const Xj=(e,t,n,r={},s,i)=>o=>{const l=Gj(r,e)||{},c=l.delay||r.delay||0;let{elapsed:u=0}=r;u=u-Bn(c);const d={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...l,delay:-u,onUpdate:p=>{t.set(p),l.onUpdate&&l.onUpdate(p)},onComplete:()=>{o(),l.onComplete&&l.onComplete()},name:e,motionValue:t,element:i?void 0:s};mhe(l)||Object.assign(d,phe(e,d)),d.duration&&(d.duration=Bn(d.duration)),d.repeatDelay&&(d.repeatDelay=Bn(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let f=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(Yy(d),d.delay===0&&(f=!0)),(_s.instantAnimations||_s.skipAnimations||s!=null&&s.shouldSkipAnimations)&&(f=!0,Yy(d),d.delay=0),d.allowFlatten=!l.type&&!l.ease,f&&!i&&t.get()!==void 0){const p=vx(d.keyframes,l);if(p!==void 0){Ue.update(()=>{d.onUpdate(p),d.onComplete()});return}}return l.isSync?new Wh(d):new ihe(d)};function O4(e){const t=[{},{}];return e==null||e.values.forEach((n,r)=>{t[0][r]=n.get(),t[1][r]=n.getVelocity()}),t}function Yj(e,t,n,r){if(typeof t=="function"){const[s,i]=O4(r);t=t(n!==void 0?n:e.custom,s,i)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[s,i]=O4(r);t=t(n!==void 0?n:e.custom,s,i)}return t}function wi(e,t,n){const r=e.getProps();return Yj(r,t,n!==void 0?n:r.custom,e)}const i$=new Set(["width","height","top","left","right","bottom",...Gl]),T4=30,xhe=e=>!isNaN(parseFloat(e));class ghe{constructor(t,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=r=>{var i;const s=dn.now();if(this.updatedAt!==s&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&((i=this.events.change)==null||i.notify(this.current),this.dependents))for(const o of this.dependents)o.dirty()},this.hasAnimated=!1,this.setCurrent(t),this.owner=n.owner}setCurrent(t){this.current=t,this.updatedAt=dn.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=xhe(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new Lj);const r=this.events[t].add(n);return t==="change"?()=>{r(),Ue.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t){this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t)}setWithVelocity(t,n,r){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-r}jump(t,n=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){var t;(t=this.events.change)==null||t.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=dn.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>T4)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,T4);return S6(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),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(){var t,n;(t=this.dependents)==null||t.clear(),(n=this.events.destroy)==null||n.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function kl(e,t){return new ghe(e,t)}const Qy=e=>Array.isArray(e);function vhe(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,kl(n))}function yhe(e){return Qy(e)?e[e.length-1]||0:e}function bhe(e,t){const n=wi(e,t);let{transitionEnd:r={},transition:s={},...i}=n||{};i={...i,...r};for(const o in i){const l=yhe(i[o]);vhe(e,o,l)}}const Wt=e=>!!(e&&e.getVelocity);function jhe(e){return!!(Wt(e)&&e.add)}function Jy(e,t){const n=e.getValue("willChange");if(jhe(n))return n.add(t);if(!n&&_s.WillChange){const r=new _s.WillChange("auto");e.addValue("willChange",r),r.add(t)}}function Qj(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}const whe="framerAppearId",o$="data-"+Qj(whe);function l$(e){return e.props[o$]}function Nhe({protectedKeys:e,needsAnimating:t},n){const r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function c$(e,t,{delay:n=0,transitionOverride:r,type:s}={}){let{transition:i,transitionEnd:o,...l}=t;const c=e.getDefaultTransition();i=i?s$(i,c):c;const u=i==null?void 0:i.reduceMotion;r&&(i=r);const d=[],f=s&&e.animationState&&e.animationState.getState()[s];for(const p in l){const h=e.getValue(p,e.latestValues[p]??null),m=l[p];if(m===void 0||f&&Nhe(f,p))continue;const v={delay:n,...Gj(i||{},p)},x=h.get();if(x!==void 0&&!h.isAnimating()&&!Array.isArray(m)&&m===x&&!v.velocity){Ue.update(()=>h.set(m));continue}let y=!1;if(window.MotionHandoffAnimation){const N=l$(e);if(N){const w=window.MotionHandoffAnimation(N,p,Ue);w!==null&&(v.startTime=w,y=!0)}}Jy(e,p);const g=u??e.shouldReduceMotion;h.start(Xj(p,h,m,g&&i$.has(p)?{type:!1}:v,e,y));const j=h.animation;j&&d.push(j)}if(o){const p=()=>Ue.update(()=>{o&&bhe(e,o)});d.length?Promise.all(d).then(p):p()}return d}function Zy(e,t,n={}){var c;const r=wi(e,t,n.type==="exit"?(c=e.presenceContext)==null?void 0:c.custom:void 0);let{transition:s=e.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(s=n.transitionOverride);const i=r?()=>Promise.all(c$(e,r,n)):()=>Promise.resolve(),o=e.variantChildren&&e.variantChildren.size?(u=0)=>{const{delayChildren:d=0,staggerChildren:f,staggerDirection:p}=s;return She(e,t,u,d,f,p,n)}:()=>Promise.resolve(),{when:l}=s;if(l){const[u,d]=l==="beforeChildren"?[i,o]:[o,i];return u().then(()=>d())}else return Promise.all([i(),o(n.delay)])}function She(e,t,n=0,r=0,s=0,i=1,o){const l=[];for(const c of e.variantChildren)c.notify("AnimationStart",t),l.push(Zy(c,t,{...o,delay:n+(typeof r=="function"?0:r)+r$(e.variantChildren,c,r,s,i)}).then(()=>c.notify("AnimationComplete",t)));return Promise.all(l)}function khe(e,t,n={}){e.notify("AnimationStart",t);let r;if(Array.isArray(t)){const s=t.map(i=>Zy(e,i,n));r=Promise.all(s)}else if(typeof t=="string")r=Zy(e,t,n);else{const s=typeof t=="function"?wi(e,t,n.custom):t;r=Promise.all(c$(e,s,n))}return r.then(()=>{e.notify("AnimationComplete",t)})}const Che={test:e=>e==="auto",parse:e=>e},u$=e=>t=>t.test(e),d$=[Kl,pe,ta,Wa,Jfe,Qfe,Che],$4=e=>d$.find(u$(e));function _he(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||w6(e):!0}const Ahe=new Set(["brightness","contrast","saturate","opacity"]);function Phe(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match(Vj)||[];if(!r)return e;const s=n.replace(r,"");let i=Ahe.has(t)?1:0;return r!==n&&(i*=100),t+"("+i+s+")"}const Ehe=/\b([a-z-]*)\(.*?\)/gu,eb={...Tr,getAnimatableNone:e=>{const t=e.match(Ehe);return t?t.map(Phe).join(" "):e}},tb={...Tr,getAnimatableNone:e=>{const t=Tr.parse(e);return Tr.createTransformer(e)(t.map(r=>typeof r=="number"?0:typeof r=="object"?{...r,alpha:1}:r))}},M4={...Kl,transform:Math.round},Ohe={rotate:Wa,rotateX:Wa,rotateY:Wa,rotateZ:Wa,scale:wf,scaleX:wf,scaleY:wf,scaleZ:wf,skew:Wa,skewX:Wa,skewY:Wa,distance:pe,translateX:pe,translateY:pe,translateZ:pe,x:pe,y:pe,z:pe,perspective:pe,transformPerspective:pe,opacity:id,originX:b4,originY:b4,originZ:pe},Jj={borderWidth:pe,borderTopWidth:pe,borderRightWidth:pe,borderBottomWidth:pe,borderLeftWidth:pe,borderRadius:pe,borderTopLeftRadius:pe,borderTopRightRadius:pe,borderBottomRightRadius:pe,borderBottomLeftRadius:pe,width:pe,maxWidth:pe,height:pe,maxHeight:pe,top:pe,right:pe,bottom:pe,left:pe,inset:pe,insetBlock:pe,insetBlockStart:pe,insetBlockEnd:pe,insetInline:pe,insetInlineStart:pe,insetInlineEnd:pe,padding:pe,paddingTop:pe,paddingRight:pe,paddingBottom:pe,paddingLeft:pe,paddingBlock:pe,paddingBlockStart:pe,paddingBlockEnd:pe,paddingInline:pe,paddingInlineStart:pe,paddingInlineEnd:pe,margin:pe,marginTop:pe,marginRight:pe,marginBottom:pe,marginLeft:pe,marginBlock:pe,marginBlockStart:pe,marginBlockEnd:pe,marginInline:pe,marginInlineStart:pe,marginInlineEnd:pe,fontSize:pe,backgroundPositionX:pe,backgroundPositionY:pe,...Ohe,zIndex:M4,fillOpacity:id,strokeOpacity:id,numOctaves:M4},The={...Jj,color:yt,backgroundColor:yt,outlineColor:yt,fill:yt,stroke:yt,borderColor:yt,borderTopColor:yt,borderRightColor:yt,borderBottomColor:yt,borderLeftColor:yt,filter:eb,WebkitFilter:eb,mask:tb,WebkitMask:tb},f$=e=>The[e],$he=new Set([eb,tb]);function p$(e,t){let n=f$(e);return $he.has(n)||(n=Tr),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const Mhe=new Set(["auto","none","0"]);function Rhe(e,t,n){let r=0,s;for(;r<e.length&&!s;){const i=e[r];typeof i=="string"&&!Mhe.has(i)&&Sl(i).values.length&&(s=e[r]),r++}if(s&&n)for(const i of t)e[i]=p$(n,s)}class Dhe extends Kj{constructor(t,n,r,s,i){super(t,n,r,s,i,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:n,name:r}=this;if(!n||!n.current)return;super.readKeyframes();for(let d=0;d<t.length;d++){let f=t[d];if(typeof f=="string"&&(f=f.trim(),Fj(f))){const p=a$(f,n.current);p!==void 0&&(t[d]=p),d===t.length-1&&(this.finalKeyframe=f)}}if(this.resolveNoneKeyframes(),!i$.has(r)||t.length!==2)return;const[s,i]=t,o=$4(s),l=$4(i),c=y4(s),u=y4(i);if(c!==u&&ss[r]){this.needsMeasurement=!0;return}if(o!==l)if(A4(o)&&A4(l))for(let d=0;d<t.length;d++){const f=t[d];typeof f=="string"&&(t[d]=parseFloat(f))}else ss[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:n}=this,r=[];for(let s=0;s<t.length;s++)(t[s]===null||_he(t[s]))&&r.push(s);r.length&&Rhe(t,r,n)}measureInitialState(){const{element:t,unresolvedKeyframes:n,name:r}=this;if(!t||!t.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=ss[r](t.measureViewportBox(),window.getComputedStyle(t.current)),n[0]=this.measuredOrigin;const s=n[n.length-1];s!==void 0&&t.getValue(r,s).jump(s,!1)}measureEndState(){var l;const{element:t,name:n,unresolvedKeyframes:r}=this;if(!t||!t.current)return;const s=t.getValue(n);s&&s.jump(this.measuredOrigin,!1);const i=r.length-1,o=r[i];r[i]=ss[n](t.measureViewportBox(),window.getComputedStyle(t.current)),o!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=o),(l=this.removedTransforms)!=null&&l.length&&this.removedTransforms.forEach(([c,u])=>{t.getValue(c).set(u)}),this.resolveNoneKeyframes()}}function h$(e,t,n){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e=="string"){let r=document;const s=(n==null?void 0:n[e])??r.querySelectorAll(e);return s?Array.from(s):[]}return Array.from(e).filter(r=>r!=null)}const m$=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function Yf(e){return j6(e)&&"offsetHeight"in e&&!("ownerSVGElement"in e)}const{schedule:Zj}=R6(queueMicrotask,!1),yr={x:!1,y:!1};function x$(){return yr.x||yr.y}function Ihe(e){return e==="x"||e==="y"?yr[e]?null:(yr[e]=!0,()=>{yr[e]=!1}):yr.x||yr.y?null:(yr.x=yr.y=!0,()=>{yr.x=yr.y=!1})}function g$(e,t){const n=h$(e),r=new AbortController,s={passive:!0,...t,signal:r.signal};return[n,s,()=>r.abort()]}function Lhe(e){return!(e.pointerType==="touch"||x$())}function zhe(e,t,n={}){const[r,s,i]=g$(e,n);return r.forEach(o=>{let l=!1,c=!1,u;const d=()=>{o.removeEventListener("pointerleave",m)},f=x=>{u&&(u(x),u=void 0),d()},p=x=>{l=!1,window.removeEventListener("pointerup",p),window.removeEventListener("pointercancel",p),c&&(c=!1,f(x))},h=()=>{l=!0,window.addEventListener("pointerup",p,s),window.addEventListener("pointercancel",p,s)},m=x=>{if(x.pointerType!=="touch"){if(l){c=!0;return}f(x)}},v=x=>{if(!Lhe(x))return;c=!1;const y=t(o,x);typeof y=="function"&&(u=y,o.addEventListener("pointerleave",m,s))};o.addEventListener("pointerenter",v,s),o.addEventListener("pointerdown",h,s)}),i}const v$=(e,t)=>t?e===t?!0:v$(e,t.parentElement):!1,ew=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,Bhe=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function Fhe(e){return Bhe.has(e.tagName)||e.isContentEditable===!0}const Vhe=new Set(["INPUT","SELECT","TEXTAREA"]);function Uhe(e){return Vhe.has(e.tagName)||e.isContentEditable===!0}const Qf=new WeakSet;function R4(e){return t=>{t.key==="Enter"&&e(t)}}function z0(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const Whe=(e,t)=>{const n=e.currentTarget;if(!n)return;const r=R4(()=>{if(Qf.has(n))return;z0(n,"down");const s=R4(()=>{z0(n,"up")}),i=()=>z0(n,"cancel");n.addEventListener("keyup",s,t),n.addEventListener("blur",i,t)});n.addEventListener("keydown",r,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),t)};function D4(e){return ew(e)&&!x$()}const I4=new WeakSet;function qhe(e,t,n={}){const[r,s,i]=g$(e,n),o=l=>{const c=l.currentTarget;if(!D4(l)||I4.has(l))return;Qf.add(c),n.stopPropagation&&I4.add(l);const u=t(c,l),d=(h,m)=>{window.removeEventListener("pointerup",f),window.removeEventListener("pointercancel",p),Qf.has(c)&&Qf.delete(c),D4(h)&&typeof u=="function"&&u(h,{success:m})},f=h=>{d(h,c===window||c===document||n.useGlobalTarget||v$(c,h.target))},p=h=>{d(h,!1)};window.addEventListener("pointerup",f,s),window.addEventListener("pointercancel",p,s)};return r.forEach(l=>{(n.useGlobalTarget?window:l).addEventListener("pointerdown",o,s),Yf(l)&&(l.addEventListener("focus",u=>Whe(u,s)),!Fhe(l)&&!l.hasAttribute("tabindex")&&(l.tabIndex=0))}),i}function tw(e){return j6(e)&&"ownerSVGElement"in e}const Jf=new WeakMap;let qa;const y$=(e,t,n)=>(r,s)=>s&&s[0]?s[0][e+"Size"]:tw(r)&&"getBBox"in r?r.getBBox()[t]:r[n],Hhe=y$("inline","width","offsetWidth"),Khe=y$("block","height","offsetHeight");function Ghe({target:e,borderBoxSize:t}){var n;(n=Jf.get(e))==null||n.forEach(r=>{r(e,{get width(){return Hhe(e,t)},get height(){return Khe(e,t)}})})}function Xhe(e){e.forEach(Ghe)}function Yhe(){typeof ResizeObserver>"u"||(qa=new ResizeObserver(Xhe))}function Qhe(e,t){qa||Yhe();const n=h$(e);return n.forEach(r=>{let s=Jf.get(r);s||(s=new Set,Jf.set(r,s)),s.add(t),qa==null||qa.observe(r)}),()=>{n.forEach(r=>{const s=Jf.get(r);s==null||s.delete(t),s!=null&&s.size||qa==null||qa.unobserve(r)})}}const Zf=new Set;let Co;function Jhe(){Co=()=>{const e={get width(){return window.innerWidth},get height(){return window.innerHeight}};Zf.forEach(t=>t(e))},window.addEventListener("resize",Co)}function Zhe(e){return Zf.add(e),Co||Jhe(),()=>{Zf.delete(e),!Zf.size&&typeof Co=="function"&&(window.removeEventListener("resize",Co),Co=void 0)}}function L4(e,t){return typeof e=="function"?Zhe(e):Qhe(e,t)}function eme(e){return tw(e)&&e.tagName==="svg"}const tme=[...d$,yt,Tr],nme=e=>tme.find(u$(e)),z4=()=>({translate:0,scale:1,origin:0,originPoint:0}),_o=()=>({x:z4(),y:z4()}),B4=()=>({min:0,max:0}),Ct=()=>({x:B4(),y:B4()}),rme=new WeakMap;function yx(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function od(e){return typeof e=="string"||Array.isArray(e)}const nw=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],rw=["initial",...nw];function bx(e){return yx(e.animate)||rw.some(t=>od(e[t]))}function b$(e){return!!(bx(e)||e.variants)}function ame(e,t,n){for(const r in t){const s=t[r],i=n[r];if(Wt(s))e.addValue(r,s);else if(Wt(i))e.addValue(r,kl(s,{owner:e}));else if(i!==s)if(e.hasValue(r)){const o=e.getValue(r);o.liveStyle===!0?o.jump(s):o.hasAnimated||o.set(s)}else{const o=e.getStaticValue(r);e.addValue(r,kl(o!==void 0?o:s,{owner:e}))}}for(const r in n)t[r]===void 0&&e.removeValue(r);return t}const nb={current:null},j$={current:!1},sme=typeof window<"u";function ime(){if(j$.current=!0,!!sme)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>nb.current=e.matches;e.addEventListener("change",t),t()}else nb.current=!1}const F4=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let qh={};function w$(e){qh=e}function ome(){return qh}class lme{scrapeMotionValuesFromProps(t,n,r){return{}}constructor({parent:t,props:n,presenceContext:r,reducedMotionConfig:s,skipAnimations:i,blockInitialAnimation:o,visualState:l},c={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=Kj,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,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=()=>{const h=dn.now();this.renderScheduledAt<h&&(this.renderScheduledAt=h,Ue.render(this.render,!1,!0))};const{latestValues:u,renderState:d}=l;this.latestValues=u,this.baseTarget={...u},this.initialValues=n.initial?{...u}:{},this.renderState=d,this.parent=t,this.props=n,this.presenceContext=r,this.depth=t?t.depth+1:0,this.reducedMotionConfig=s,this.skipAnimationsConfig=i,this.options=c,this.blockInitialAnimation=!!o,this.isControllingVariants=bx(n),this.isVariantNode=b$(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:f,...p}=this.scrapeMotionValuesFromProps(n,{},this);for(const h in p){const m=p[h];u[h]!==void 0&&Wt(m)&&m.set(u[h])}}mount(t){var n,r;if(this.hasBeenMounted)for(const s in this.initialValues)(n=this.values.get(s))==null||n.jump(this.initialValues[s]),this.latestValues[s]=this.initialValues[s];this.current=t,rme.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((s,i)=>this.bindToMotionValue(i,s)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(j$.current||ime(),this.shouldReduceMotion=nb.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,(r=this.parent)==null||r.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){var t;this.projection&&this.projection.unmount(),As(this.notifyUpdate),As(this.render),this.valueSubscriptions.forEach(n=>n()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),(t=this.parent)==null||t.removeChild(this);for(const n in this.events)this.events[n].clear();for(const n in this.features){const r=this.features[n];r&&(r.unmount(),r.isMounted=!1)}this.current=null}addChild(t){this.children.add(t),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(t)}removeChild(t){this.children.delete(t),this.enteringChildren&&this.enteringChildren.delete(t)}bindToMotionValue(t,n){if(this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)(),n.accelerate&&n$.has(t)&&this.current instanceof HTMLElement){const{factory:o,keyframes:l,times:c,ease:u,duration:d}=n.accelerate,f=new e$({element:this.current,name:t,keyframes:l,times:c,ease:u,duration:Bn(d)}),p=o(f);this.valueSubscriptions.set(t,()=>{p(),f.cancel()});return}const r=Xl.has(t);r&&this.onBindTransform&&this.onBindTransform();const s=n.on("change",o=>{this.latestValues[t]=o,this.props.onUpdate&&Ue.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let i;typeof window<"u"&&window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{s(),i&&i(),n.owner&&n.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in qh){const n=qh[t];if(!n)continue;const{isEnabled:r,Feature:s}=n;if(!this.features[t]&&s&&r(this.props)&&(this.features[t]=new s(this)),this.features[t]){const i=this.features[t];i.isMounted?i.update():(i.mount(),i.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Ct()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;r<F4.length;r++){const s=F4[r];this.propEventSubscriptions[s]&&(this.propEventSubscriptions[s](),delete this.propEventSubscriptions[s]);const i="on"+s,o=t[i];o&&(this.propEventSubscriptions[s]=this.on(s,o))}this.prevMotionValues=ame(this,this.scrapeMotionValuesFromProps(t,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]: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(t){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(t),()=>n.variantChildren.delete(t)}addValue(t,n){const r=this.values.get(t);n!==r&&(r&&this.removeValue(t),this.bindToMotionValue(t,n),this.values.set(t,n),this.latestValues[t]=n.get())}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let r=this.values.get(t);return r===void 0&&n!==void 0&&(r=kl(n===null?void 0:n,{owner:this}),this.addValue(t,r)),r}readValue(t,n){let r=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options);return r!=null&&(typeof r=="string"&&(b6(r)||w6(r))?r=parseFloat(r):!nme(r)&&Tr.test(n)&&(r=p$(t,n)),this.setBaseTarget(t,Wt(r)?r.get():r)),Wt(r)?r.get():r}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){var i;const{initial:n}=this.props;let r;if(typeof n=="string"||typeof n=="object"){const o=Yj(this.props,n,(i=this.presenceContext)==null?void 0:i.custom);o&&(r=o[t])}if(n&&r!==void 0)return r;const s=this.getBaseTargetFromProps(this.props,t);return s!==void 0&&!Wt(s)?s:this.initialValues[t]!==void 0&&r===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new Lj),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}scheduleRenderMicrotask(){Zj.render(this.render)}}class N$ extends lme{constructor(){super(...arguments),this.KeyframeResolver=Dhe}sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){const r=t.style;return r?r[n]:void 0}removeValueFromRenderState(t,{vars:n,style:r}){delete n[t],delete r[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;Wt(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}class Ls{constructor(t){this.isMounted=!1,this.node=t}update(){}}function S$({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function cme({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function ume(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function B0(e){return e===void 0||e===1}function rb({scale:e,scaleX:t,scaleY:n}){return!B0(e)||!B0(t)||!B0(n)}function Zs(e){return rb(e)||k$(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function k$(e){return V4(e.x)||V4(e.y)}function V4(e){return e&&e!=="0%"}function Hh(e,t,n){const r=e-n,s=t*r;return n+s}function U4(e,t,n,r,s){return s!==void 0&&(e=Hh(e,s,r)),Hh(e,n,r)+t}function ab(e,t=0,n=1,r,s){e.min=U4(e.min,t,n,r,s),e.max=U4(e.max,t,n,r,s)}function C$(e,{x:t,y:n}){ab(e.x,t.translate,t.scale,t.originPoint),ab(e.y,n.translate,n.scale,n.originPoint)}const W4=.999999999999,q4=1.0000000000001;function dme(e,t,n,r=!1){var l;const s=n.length;if(!s)return;t.x=t.y=1;let i,o;for(let c=0;c<s;c++){i=n[c],o=i.projectionDelta;const{visualElement:u}=i.options;u&&u.props.style&&u.props.style.display==="contents"||(r&&i.options.layoutScroll&&i.scroll&&i!==i.root&&(Wr(e.x,-i.scroll.offset.x),Wr(e.y,-i.scroll.offset.y)),o&&(t.x*=o.x.scale,t.y*=o.y.scale,C$(e,o)),r&&Zs(i.latestValues)&&ep(e,i.latestValues,(l=i.layout)==null?void 0:l.layoutBox))}t.x<q4&&t.x>W4&&(t.x=1),t.y<q4&&t.y>W4&&(t.y=1)}function Wr(e,t){e.min+=t,e.max+=t}function H4(e,t,n,r,s=.5){const i=Je(e.min,e.max,s);ab(e,t,n,i,r)}function K4(e,t){return typeof e=="string"?parseFloat(e)/100*(t.max-t.min):e}function ep(e,t,n){const r=n??e;H4(e.x,K4(t.x,r.x),t.scaleX,t.scale,t.originX),H4(e.y,K4(t.y,r.y),t.scaleY,t.scale,t.originY)}function _$(e,t){return S$(ume(e.getBoundingClientRect(),t))}function fme(e,t,n){const r=_$(e,n),{scroll:s}=t;return s&&(Wr(r.x,s.offset.x),Wr(r.y,s.offset.y)),r}const pme={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},hme=Gl.length;function mme(e,t,n){let r="",s=!0;for(let i=0;i<hme;i++){const o=Gl[i],l=e[o];if(l===void 0)continue;let c=!0;if(typeof l=="number")c=l===(o.startsWith("scale")?1:0);else{const u=parseFloat(l);c=o.startsWith("scale")?u===1:u===0}if(!c||n){const u=m$(l,Jj[o]);if(!c){s=!1;const d=pme[o]||o;r+=`${d}(${u}) `}n&&(t[o]=u)}}return r=r.trim(),n?r=n(t,s?"":r):s&&(r="none"),r}function aw(e,t,n){const{style:r,vars:s,transformOrigin:i}=e;let o=!1,l=!1;for(const c in t){const u=t[c];if(Xl.has(c)){o=!0;continue}else if(I6(c)){s[c]=u;continue}else{const d=m$(u,Jj[c]);c.startsWith("origin")?(l=!0,i[c]=d):r[c]=d}}if(t.transform||(o||n?r.transform=mme(t,e.transform,n):r.transform&&(r.transform="none")),l){const{originX:c="50%",originY:u="50%",originZ:d=0}=i;r.transformOrigin=`${c} ${u} ${d}`}}function A$(e,{style:t,vars:n},r,s){const i=e.style;let o;for(o in t)i[o]=t[o];s==null||s.applyProjectionStyles(i,r);for(o in n)i.setProperty(o,n[o])}function G4(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const bc={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(pe.test(e))e=parseFloat(e);else return e;const n=G4(e,t.target.x),r=G4(e,t.target.y);return`${n}% ${r}%`}},xme={correct:(e,{treeScale:t,projectionDelta:n})=>{const r=e,s=Tr.parse(e);if(s.length>5)return r;const i=Tr.createTransformer(e),o=typeof s[0]!="number"?1:0,l=n.x.scale*t.x,c=n.y.scale*t.y;s[0+o]/=l,s[1+o]/=c;const u=Je(l,c,.5);return typeof s[2+o]=="number"&&(s[2+o]/=u),typeof s[3+o]=="number"&&(s[3+o]/=u),i(s)}},sb={borderRadius:{...bc,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:bc,borderTopRightRadius:bc,borderBottomLeftRadius:bc,borderBottomRightRadius:bc,boxShadow:xme};function P$(e,{layout:t,layoutId:n}){return Xl.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!sb[e]||e==="opacity")}function sw(e,t,n){var o;const r=e.style,s=t==null?void 0:t.style,i={};if(!r)return i;for(const l in r)(Wt(r[l])||s&&Wt(s[l])||P$(l,e)||((o=n==null?void 0:n.getValue(l))==null?void 0:o.liveStyle)!==void 0)&&(i[l]=r[l]);return i}function gme(e){return window.getComputedStyle(e)}class vme extends N${constructor(){super(...arguments),this.type="html",this.renderInstance=A$}readValueFromInstance(t,n){var r;if(Xl.has(n))return(r=this.projection)!=null&&r.isProjecting?qy(n):Lpe(t,n);{const s=gme(t),i=(I6(n)?s.getPropertyValue(n):s[n])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(t,{transformPagePoint:n}){return _$(t,n)}build(t,n,r){aw(t,n,r.transformTemplate)}scrapeMotionValuesFromProps(t,n,r){return sw(t,n,r)}}const yme={offset:"stroke-dashoffset",array:"stroke-dasharray"},bme={offset:"strokeDashoffset",array:"strokeDasharray"};function jme(e,t,n=1,r=0,s=!0){e.pathLength=1;const i=s?yme:bme;e[i.offset]=`${-r}`,e[i.array]=`${t} ${n}`}const wme=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function E$(e,{attrX:t,attrY:n,attrScale:r,pathLength:s,pathSpacing:i=1,pathOffset:o=0,...l},c,u,d){if(aw(e,l,u),c){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:f,style:p}=e;f.transform&&(p.transform=f.transform,delete f.transform),(p.transform||f.transformOrigin)&&(p.transformOrigin=f.transformOrigin??"50% 50%",delete f.transformOrigin),p.transform&&(p.transformBox=(d==null?void 0:d.transformBox)??"fill-box",delete f.transformBox);for(const h of wme)f[h]!==void 0&&(p[h]=f[h],delete f[h]);t!==void 0&&(f.x=t),n!==void 0&&(f.y=n),r!==void 0&&(f.scale=r),s!==void 0&&jme(f,s,i,o,!1)}const O$=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"]),T$=e=>typeof e=="string"&&e.toLowerCase()==="svg";function Nme(e,t,n,r){A$(e,t,void 0,r);for(const s in t.attrs)e.setAttribute(O$.has(s)?s:Qj(s),t.attrs[s])}function $$(e,t,n){const r=sw(e,t,n);for(const s in e)if(Wt(e[s])||Wt(t[s])){const i=Gl.indexOf(s)!==-1?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s;r[i]=e[s]}return r}class Sme extends N${constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Ct}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(Xl.has(n)){const r=f$(n);return r&&r.default||0}return n=O$.has(n)?n:Qj(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,r){return $$(t,n,r)}build(t,n,r){E$(t,n,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(t,n,r,s){Nme(t,n,r,s)}mount(t){this.isSVGTag=T$(t.tagName),super.mount(t)}}const kme=rw.length;function M$(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?M$(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;n<kme;n++){const r=rw[n],s=e.props[r];(od(s)||s===!1)&&(t[r]=s)}return t}function R$(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}const Cme=[...nw].reverse(),_me=nw.length;function Ame(e){return t=>Promise.all(t.map(({animation:n,options:r})=>khe(e,n,r)))}function Pme(e){let t=Ame(e),n=X4(),r=!0,s=!1;const i=u=>(d,f)=>{var h;const p=wi(e,f,u==="exit"?(h=e.presenceContext)==null?void 0:h.custom:void 0);if(p){const{transition:m,transitionEnd:v,...x}=p;d={...d,...x,...v}}return d};function o(u){t=u(e)}function l(u){const{props:d}=e,f=M$(e.parent)||{},p=[],h=new Set;let m={},v=1/0;for(let y=0;y<_me;y++){const g=Cme[y],j=n[g],N=d[g]!==void 0?d[g]:f[g],w=od(N),S=g===u?j.isActive:null;S===!1&&(v=y);let k=N===f[g]&&N!==d[g]&&w;if(k&&(r||s)&&e.manuallyAnimateOnMount&&(k=!1),j.protectedKeys={...m},!j.isActive&&S===null||!N&&!j.prevProp||yx(N)||typeof N=="boolean")continue;if(g==="exit"&&j.isActive&&S!==!0){j.prevResolvedValues&&(m={...m,...j.prevResolvedValues});continue}const C=Eme(j.prevProp,N);let _=C||g===u&&j.isActive&&!k&&w||y>v&&w,A=!1;const E=Array.isArray(N)?N:[N];let P=E.reduce(i(g),{});S===!1&&(P={});const{prevResolvedValues:D={}}=j,I={...D,...P},R=T=>{_=!0,h.has(T)&&(A=!0,h.delete(T)),j.needsAnimating[T]=!0;const V=e.getValue(T);V&&(V.liveStyle=!1)};for(const T in I){const V=P[T],X=D[T];if(m.hasOwnProperty(T))continue;let U=!1;Qy(V)&&Qy(X)?U=!R$(V,X):U=V!==X,U?V!=null?R(T):h.add(T):V!==void 0&&h.has(T)?R(T):j.protectedKeys[T]=!0}j.prevProp=N,j.prevResolvedValues=P,j.isActive&&(m={...m,...P}),(r||s)&&e.blockInitialAnimation&&(_=!1);const M=k&&C;_&&(!M||A)&&p.push(...E.map(T=>{const V={type:g};if(typeof T=="string"&&(r||s)&&!M&&e.manuallyAnimateOnMount&&e.parent){const{parent:X}=e,U=wi(X,T);if(X.enteringChildren&&U){const{delayChildren:L}=U.transition||{};V.delay=r$(X.enteringChildren,e,L)}}return{animation:T,options:V}}))}if(h.size){const y={};if(typeof d.initial!="boolean"){const g=wi(e,Array.isArray(d.initial)?d.initial[0]:d.initial);g&&g.transition&&(y.transition=g.transition)}h.forEach(g=>{const j=e.getBaseTarget(g),N=e.getValue(g);N&&(N.liveStyle=!0),y[g]=j??null}),p.push({animation:y})}let x=!!p.length;return r&&(d.initial===!1||d.initial===d.animate)&&!e.manuallyAnimateOnMount&&(x=!1),r=!1,s=!1,x?t(p):Promise.resolve()}function c(u,d){var p;if(n[u].isActive===d)return Promise.resolve();(p=e.variantChildren)==null||p.forEach(h=>{var m;return(m=h.animationState)==null?void 0:m.setActive(u,d)}),n[u].isActive=d;const f=l(u);for(const h in n)n[h].protectedKeys={};return f}return{animateChanges:l,setActive:c,setAnimateFunction:o,getState:()=>n,reset:()=>{n=X4(),s=!0}}}function Eme(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!R$(t,e):!1}function Hs(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function X4(){return{animate:Hs(!0),whileInView:Hs(),whileHover:Hs(),whileTap:Hs(),whileDrag:Hs(),whileFocus:Hs(),exit:Hs()}}function ib(e,t){e.min=t.min,e.max=t.max}function vr(e,t){ib(e.x,t.x),ib(e.y,t.y)}function Y4(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}const D$=1e-4,Ome=1-D$,Tme=1+D$,I$=.01,$me=0-I$,Mme=0+I$;function fn(e){return e.max-e.min}function Rme(e,t,n){return Math.abs(e-t)<=n}function Q4(e,t,n,r=.5){e.origin=r,e.originPoint=Je(t.min,t.max,e.origin),e.scale=fn(n)/fn(t),e.translate=Je(n.min,n.max,e.origin)-e.originPoint,(e.scale>=Ome&&e.scale<=Tme||isNaN(e.scale))&&(e.scale=1),(e.translate>=$me&&e.translate<=Mme||isNaN(e.translate))&&(e.translate=0)}function Qc(e,t,n,r){Q4(e.x,t.x,n.x,r?r.originX:void 0),Q4(e.y,t.y,n.y,r?r.originY:void 0)}function J4(e,t,n,r=0){const s=r?Je(n.min,n.max,r):n.min;e.min=s+t.min,e.max=e.min+fn(t)}function Dme(e,t,n,r){J4(e.x,t.x,n.x,r==null?void 0:r.x),J4(e.y,t.y,n.y,r==null?void 0:r.y)}function Z4(e,t,n,r=0){const s=r?Je(n.min,n.max,r):n.min;e.min=t.min-s,e.max=e.min+fn(t)}function Kh(e,t,n,r){Z4(e.x,t.x,n.x,r==null?void 0:r.x),Z4(e.y,t.y,n.y,r==null?void 0:r.y)}function eC(e,t,n,r,s){return e-=t,e=Hh(e,1/n,r),s!==void 0&&(e=Hh(e,1/s,r)),e}function Ime(e,t=0,n=1,r=.5,s,i=e,o=e){if(ta.test(t)&&(t=parseFloat(t),t=Je(o.min,o.max,t/100)-o.min),typeof t!="number")return;let l=Je(i.min,i.max,r);e===i&&(l-=t),e.min=eC(e.min,t,n,l,s),e.max=eC(e.max,t,n,l,s)}function tC(e,t,[n,r,s],i,o){Ime(e,t[n],t[r],t[s],t.scale,i,o)}const Lme=["x","scaleX","originX"],zme=["y","scaleY","originY"];function nC(e,t,n,r){tC(e.x,t,Lme,n?n.x:void 0,r?r.x:void 0),tC(e.y,t,zme,n?n.y:void 0,r?r.y:void 0)}function rC(e){return e.translate===0&&e.scale===1}function L$(e){return rC(e.x)&&rC(e.y)}function aC(e,t){return e.min===t.min&&e.max===t.max}function Bme(e,t){return aC(e.x,t.x)&&aC(e.y,t.y)}function sC(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function z$(e,t){return sC(e.x,t.x)&&sC(e.y,t.y)}function iC(e){return fn(e.x)/fn(e.y)}function oC(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function Ur(e){return[e("x"),e("y")]}function Fme(e,t,n){let r="";const s=e.x.translate/t.x,i=e.y.translate/t.y,o=(n==null?void 0:n.z)||0;if((s||i||o)&&(r=`translate3d(${s}px, ${i}px, ${o}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:u,rotate:d,rotateX:f,rotateY:p,skewX:h,skewY:m}=n;u&&(r=`perspective(${u}px) ${r}`),d&&(r+=`rotate(${d}deg) `),f&&(r+=`rotateX(${f}deg) `),p&&(r+=`rotateY(${p}deg) `),h&&(r+=`skewX(${h}deg) `),m&&(r+=`skewY(${m}deg) `)}const l=e.x.scale*t.x,c=e.y.scale*t.y;return(l!==1||c!==1)&&(r+=`scale(${l}, ${c})`),r||"none"}const B$=["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"],Vme=B$.length,lC=e=>typeof e=="string"?parseFloat(e):e,cC=e=>typeof e=="number"||pe.test(e);function Ume(e,t,n,r,s,i){s?(e.opacity=Je(0,n.opacity??1,Wme(r)),e.opacityExit=Je(t.opacity??1,0,qme(r))):i&&(e.opacity=Je(t.opacity??1,n.opacity??1,r));for(let o=0;o<Vme;o++){const l=B$[o];let c=uC(t,l),u=uC(n,l);if(c===void 0&&u===void 0)continue;c||(c=0),u||(u=0),c===0||u===0||cC(c)===cC(u)?(e[l]=Math.max(Je(lC(c),lC(u),r),0),(ta.test(u)||ta.test(c))&&(e[l]+="%")):e[l]=u}(t.rotate||n.rotate)&&(e.rotate=Je(t.rotate||0,n.rotate||0,r))}function uC(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const Wme=F$(0,.5,O6),qme=F$(.5,.95,lr);function F$(e,t,n){return r=>r<e?0:r>t?1:n(sd(e,t,r))}function Hme(e,t,n){const r=Wt(e)?e:kl(e);return r.start(Xj("",r,t,n)),r.animation}function ld(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}const Kme=(e,t)=>e.depth-t.depth;class Gme{constructor(){this.children=[],this.isDirty=!1}add(t){Dj(this.children,t),this.isDirty=!0}remove(t){Bh(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(Kme),this.isDirty=!1,this.children.forEach(t)}}function Xme(e,t){const n=dn.now(),r=({timestamp:s})=>{const i=s-n;i>=t&&(As(r),e(i-t))};return Ue.setup(r,!0),()=>As(r)}function tp(e){return Wt(e)?e.get():e}class Yme{constructor(){this.members=[]}add(t){Dj(this.members,t);for(let n=this.members.length-1;n>=0;n--){const r=this.members[n];if(r===t||r===this.lead||r===this.prevLead)continue;const s=r.instance;(!s||s.isConnected===!1)&&!r.snapshot&&(Bh(this.members,r),r.unmount())}t.scheduleRender()}remove(t){if(Bh(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){var n;for(let r=this.members.indexOf(t)-1;r>=0;r--){const s=this.members[r];if(s.isPresent!==!1&&((n=s.instance)==null?void 0:n.isConnected)!==!1)return this.promote(s),!0}return!1}promote(t,n){var s;const r=this.lead;if(t!==r&&(this.prevLead=r,this.lead=t,t.show(),r)){r.updateSnapshot(),t.scheduleRender();const{layoutDependency:i}=r.options,{layoutDependency:o}=t.options;(i===void 0||i!==o)&&(t.resumeFrom=r,n&&(r.preserveOpacity=!0),r.snapshot&&(t.snapshot=r.snapshot,t.snapshot.latestValues=r.animationValues||r.latestValues),(s=t.root)!=null&&s.isUpdating&&(t.isLayoutDirty=!0)),t.options.crossfade===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(t=>{var n,r,s,i,o;(r=(n=t.options).onExitComplete)==null||r.call(n),(o=(s=t.resumingFrom)==null?void 0:(i=s.options).onExitComplete)==null||o.call(i)})}scheduleRender(){this.members.forEach(t=>t.instance&&t.scheduleRender(!1))}removeLeadSnapshot(){var t;(t=this.lead)!=null&&t.snapshot&&(this.lead.snapshot=void 0)}}const np={hasAnimatedSinceResize:!0,hasEverUpdated:!1},F0=["","X","Y","Z"],Qme=1e3;let Jme=0;function V0(e,t,n,r){const{latestValues:s}=t;s[e]&&(n[e]=s[e],t.setStaticValue(e,0),r&&(r[e]=0))}function V$(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=l$(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:s,layoutId:i}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",Ue,!(s||i))}const{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&V$(r)}function U$({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:s}){return class{constructor(o={},l=t==null?void 0:t()){this.id=Jme++,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(txe),this.nodes.forEach(oxe),this.nodes.forEach(lxe),this.nodes.forEach(nxe)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=l?l.root||l:this,this.path=l?[...l.path,l]:[],this.parent=l,this.depth=l?l.depth+1:0;for(let c=0;c<this.path.length;c++)this.path[c].shouldResetTransform=!0;this.root===this&&(this.nodes=new Gme)}addEventListener(o,l){return this.eventHandlers.has(o)||this.eventHandlers.set(o,new Lj),this.eventHandlers.get(o).add(l)}notifyListeners(o,...l){const c=this.eventHandlers.get(o);c&&c.notify(...l)}hasListeners(o){return this.eventHandlers.has(o)}mount(o){if(this.instance)return;this.isSVG=tw(o)&&!eme(o),this.instance=o;const{layoutId:l,layout:c,visualElement:u}=this.options;if(u&&!u.current&&u.mount(o),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(c||l)&&(this.isLayoutDirty=!0),e){let d,f=0;const p=()=>this.root.updateBlockedByResize=!1;Ue.read(()=>{f=window.innerWidth}),e(o,()=>{const h=window.innerWidth;h!==f&&(f=h,this.root.updateBlockedByResize=!0,d&&d(),d=Xme(p,250),np.hasAnimatedSinceResize&&(np.hasAnimatedSinceResize=!1,this.nodes.forEach(pC)))})}l&&this.root.registerSharedNode(l,this),this.options.animate!==!1&&u&&(l||c)&&this.addEventListener("didUpdate",({delta:d,hasLayoutChanged:f,hasRelativeLayoutChanged:p,layout:h})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const m=this.options.transition||u.getDefaultTransition()||pxe,{onLayoutAnimationStart:v,onLayoutAnimationComplete:x}=u.getProps(),y=!this.targetLayout||!z$(this.targetLayout,h),g=!f&&p;if(this.options.layoutRoot||this.resumeFrom||g||f&&(y||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const j={...Gj(m,"layout"),onPlay:v,onComplete:x};(u.shouldReduceMotion||this.options.layoutRoot)&&(j.delay=0,j.type=!1),this.startAnimation(j),this.setAnimationOrigin(d,g)}else f||pC(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=h})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),As(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(cxe),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&V$(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;d<this.path.length;d++){const f=this.path[d];f.shouldResetTransform=!0,(typeof f.latestValues.x=="string"||typeof f.latestValues.y=="string")&&(f.isLayoutDirty=!0),f.updateScroll("snapshot"),f.options.layoutRoot&&f.willUpdate(!1)}const{layoutId:l,layout:c}=this.options;if(l===void 0&&!c)return;const u=this.getTransformTemplate();this.prevTransformTemplateValue=u?u(this.latestValues,""):void 0,this.updateSnapshot(),o&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){const c=this.updateBlockedByResize;this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),c&&this.nodes.forEach(axe),this.nodes.forEach(dC);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(fC);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(sxe),this.nodes.forEach(ixe),this.nodes.forEach(Zme),this.nodes.forEach(exe)):this.nodes.forEach(fC),this.clearAllSnapshots();const l=dn.now();Vt.delta=la(0,1e3/60,l-Vt.timestamp),Vt.timestamp=l,Vt.isProcessing=!0,$0.update.process(Vt),$0.preRender.process(Vt),$0.render.process(Vt),Vt.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Zj.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(rxe),this.sharedNodes.forEach(uxe)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Ue.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Ue.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!fn(this.snapshot.measuredBox.x)&&!fn(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 c=0;c<this.path.length;c++)this.path[c].updateScroll();const o=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected||(this.layoutCorrected=Ct()),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:l}=this.options;l&&l.notify("LayoutMeasure",this.layout.layoutBox,o?o.layoutBox:void 0)}updateScroll(o="measure"){let l=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===o&&(l=!1),l&&this.instance){const c=r(this.instance);this.scroll={animationId:this.root.animationId,phase:o,isRoot:c,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:c}}}resetTransform(){if(!s)return;const o=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,l=this.projectionDelta&&!L$(this.projectionDelta),c=this.getTransformTemplate(),u=c?c(this.latestValues,""):void 0,d=u!==this.prevTransformTemplateValue;o&&this.instance&&(l||Zs(this.latestValues)||d)&&(s(this.instance,u),this.shouldResetTransform=!1,this.scheduleRender())}measure(o=!0){const l=this.measurePageBox();let c=this.removeElementScroll(l);return o&&(c=this.removeTransform(c)),hxe(c),{animationId:this.root.animationId,measuredBox:l,layoutBox:c,latestValues:{},source:this.id}}measurePageBox(){var u;const{visualElement:o}=this.options;if(!o)return Ct();const l=o.measureViewportBox();if(!(((u=this.scroll)==null?void 0:u.wasRoot)||this.path.some(mxe))){const{scroll:d}=this.root;d&&(Wr(l.x,d.offset.x),Wr(l.y,d.offset.y))}return l}removeElementScroll(o){var c;const l=Ct();if(vr(l,o),(c=this.scroll)!=null&&c.wasRoot)return l;for(let u=0;u<this.path.length;u++){const d=this.path[u],{scroll:f,options:p}=d;d!==this.root&&f&&p.layoutScroll&&(f.wasRoot&&vr(l,o),Wr(l.x,f.offset.x),Wr(l.y,f.offset.y))}return l}applyTransform(o,l=!1,c){var d,f;const u=c||Ct();vr(u,o);for(let p=0;p<this.path.length;p++){const h=this.path[p];!l&&h.options.layoutScroll&&h.scroll&&h!==h.root&&(Wr(u.x,-h.scroll.offset.x),Wr(u.y,-h.scroll.offset.y)),Zs(h.latestValues)&&ep(u,h.latestValues,(d=h.layout)==null?void 0:d.layoutBox)}return Zs(this.latestValues)&&ep(u,this.latestValues,(f=this.layout)==null?void 0:f.layoutBox),u}removeTransform(o){var c;const l=Ct();vr(l,o);for(let u=0;u<this.path.length;u++){const d=this.path[u];if(!Zs(d.latestValues))continue;let f;d.instance&&(rb(d.latestValues)&&d.updateSnapshot(),f=Ct(),vr(f,d.measurePageBox())),nC(l,d.latestValues,(c=d.snapshot)==null?void 0:c.layoutBox,f)}return Zs(this.latestValues)&&nC(l,this.latestValues),l}setTargetDelta(o){this.targetDelta=o,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(o){this.options={...this.options,...o,crossfade:o.crossfade!==void 0?o.crossfade:!0}}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!==Vt.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(o=!1){var h;const l=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=l.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=l.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=l.isSharedProjectionDirty);const c=!!this.resumingFrom||this!==l;if(!(o||c&&this.isSharedProjectionDirty||this.isProjectionDirty||(h=this.parent)!=null&&h.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:d,layoutId:f}=this.options;if(!this.layout||!(d||f))return;this.resolvedRelativeTargetAt=Vt.timestamp;const p=this.getClosestProjectingParent();p&&this.linkedParentVersion!==p.layoutVersion&&!p.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(this.options.layoutAnchor!==!1&&p&&p.layout?this.createRelativeTarget(p,this.layout.layoutBox,p.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=Ct(),this.targetWithTransforms=Ct()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),Dme(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):vr(this.target,this.layout.layoutBox),C$(this.target,this.targetDelta)):vr(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,this.options.layoutAnchor!==!1&&p&&!!p.resumingFrom==!!this.resumingFrom&&!p.options.layoutScroll&&p.target&&this.animationProgress!==1?this.createRelativeTarget(p,this.target,p.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||rb(this.parent.latestValues)||k$(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(o,l,c){this.relativeParent=o,this.linkedParentVersion=o.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Ct(),this.relativeTargetOrigin=Ct(),Kh(this.relativeTargetOrigin,l,c,this.options.layoutAnchor||void 0),vr(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){var m;const o=this.getLead(),l=!!this.resumingFrom||this!==o;let c=!0;if((this.isProjectionDirty||(m=this.parent)!=null&&m.isProjectionDirty)&&(c=!1),l&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(c=!1),this.resolvedRelativeTargetAt===Vt.timestamp&&(c=!1),c)return;const{layout:u,layoutId:d}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(u||d))return;vr(this.layoutCorrected,this.layout.layoutBox);const f=this.treeScale.x,p=this.treeScale.y;dme(this.layoutCorrected,this.treeScale,this.path,l),o.layout&&!o.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(o.target=o.layout.layoutBox,o.targetWithTransforms=Ct());const{target:h}=o;if(!h){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(Y4(this.prevProjectionDelta.x,this.projectionDelta.x),Y4(this.prevProjectionDelta.y,this.projectionDelta.y)),Qc(this.projectionDelta,this.layoutCorrected,h,this.latestValues),(this.treeScale.x!==f||this.treeScale.y!==p||!oC(this.projectionDelta.x,this.prevProjectionDelta.x)||!oC(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",h))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(o=!0){var l;if((l=this.options.visualElement)==null||l.scheduleRender(),o){const c=this.getStack();c&&c.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=_o(),this.projectionDelta=_o(),this.projectionDeltaWithTransform=_o()}setAnimationOrigin(o,l=!1){const c=this.snapshot,u=c?c.latestValues:{},d={...this.latestValues},f=_o();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!l;const p=Ct(),h=c?c.source:void 0,m=this.layout?this.layout.source:void 0,v=h!==m,x=this.getStack(),y=!x||x.members.length<=1,g=!!(v&&!y&&this.options.crossfade===!0&&!this.path.some(fxe));this.animationProgress=0;let j;this.mixTargetDelta=N=>{const w=N/1e3;hC(f.x,o.x,w),hC(f.y,o.y,w),this.setTargetDelta(f),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Kh(p,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),dxe(this.relativeTarget,this.relativeTargetOrigin,p,w),j&&Bme(this.relativeTarget,j)&&(this.isProjectionDirty=!1),j||(j=Ct()),vr(j,this.relativeTarget)),v&&(this.animationValues=d,Ume(d,u,this.latestValues,w,g,y)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=w},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){var l,c,u;this.notifyListeners("animationStart"),(l=this.currentAnimation)==null||l.stop(),(u=(c=this.resumingFrom)==null?void 0:c.currentAnimation)==null||u.stop(),this.pendingAnimation&&(As(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Ue.update(()=>{np.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=kl(0)),this.motionValue.jump(0,!1),this.currentAnimation=Hme(this.motionValue,[0,1e3],{...o,velocity:0,isSync:!0,onUpdate:d=>{this.mixTargetDelta(d),o.onUpdate&&o.onUpdate(d)},onStop:()=>{},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(Qme),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:l,target:c,layout:u,latestValues:d}=o;if(!(!l||!c||!u)){if(this!==o&&this.layout&&u&&W$(this.options.animationType,this.layout.layoutBox,u.layoutBox)){c=this.target||Ct();const f=fn(this.layout.layoutBox.x);c.x.min=o.target.x.min,c.x.max=c.x.min+f;const p=fn(this.layout.layoutBox.y);c.y.min=o.target.y.min,c.y.max=c.y.min+p}vr(l,c),ep(l,d),Qc(this.projectionDeltaWithTransform,this.layoutCorrected,l,d)}}registerSharedNode(o,l){this.sharedNodes.has(o)||this.sharedNodes.set(o,new Yme),this.sharedNodes.get(o).add(l);const u=l.options.initialPromotionConfig;l.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(l):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var l;const{layoutId:o}=this.options;return o?((l=this.getStack())==null?void 0:l.lead)||this:this}getPrevLead(){var l;const{layoutId:o}=this.options;return o?(l=this.getStack())==null?void 0:l.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:l,preserveFollowOpacity:c}={}){const u=this.getStack();u&&u.promote(this,c),o&&(this.projectionDelta=void 0,this.needsReset=!0),l&&this.setOptions({transition:l})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let l=!1;const{latestValues:c}=o;if((c.z||c.rotate||c.rotateX||c.rotateY||c.rotateZ||c.skewX||c.skewY)&&(l=!0),!l)return;const u={};c.z&&V0("z",o,u,this.animationValues);for(let d=0;d<F0.length;d++)V0(`rotate${F0[d]}`,o,u,this.animationValues),V0(`skew${F0[d]}`,o,u,this.animationValues);o.render();for(const d in u)o.setStaticValue(d,u[d]),this.animationValues&&(this.animationValues[d]=u[d]);o.scheduleRender()}applyProjectionStyles(o,l){if(!this.instance||this.isSVG)return;if(!this.isVisible){o.visibility="hidden";return}const c=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,o.visibility="",o.opacity="",o.pointerEvents=tp(l==null?void 0:l.pointerEvents)||"",o.transform=c?c(this.latestValues,""):"none";return}const u=this.getLead();if(!this.projectionDelta||!this.layout||!u.target){this.options.layoutId&&(o.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,o.pointerEvents=tp(l==null?void 0:l.pointerEvents)||""),this.hasProjected&&!Zs(this.latestValues)&&(o.transform=c?c({},""):"none",this.hasProjected=!1);return}o.visibility="";const d=u.animationValues||u.latestValues;this.applyTransformsToTarget();let f=Fme(this.projectionDeltaWithTransform,this.treeScale,d);c&&(f=c(d,f)),o.transform=f;const{x:p,y:h}=this.projectionDelta;o.transformOrigin=`${p.origin*100}% ${h.origin*100}% 0`,u.animationValues?o.opacity=u===this?d.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:d.opacityExit:o.opacity=u===this?d.opacity!==void 0?d.opacity:"":d.opacityExit!==void 0?d.opacityExit:0;for(const m in sb){if(d[m]===void 0)continue;const{correct:v,applyTo:x,isCSSVariable:y}=sb[m],g=f==="none"?d[m]:v(d[m],u);if(x){const j=x.length;for(let N=0;N<j;N++)o[x[N]]=g}else y?this.options.visualElement.renderState.vars[m]=g:o[m]=g}this.options.layoutId&&(o.pointerEvents=u===this?tp(l==null?void 0:l.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(o=>{var l;return(l=o.currentAnimation)==null?void 0:l.stop()}),this.root.nodes.forEach(dC),this.root.sharedNodes.clear()}}}function Zme(e){e.updateLayout()}function exe(e){var n;const t=((n=e.resumeFrom)==null?void 0:n.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:s}=e.layout,{animationType:i}=e.options,o=t.source!==e.layout.source;if(i==="size")Ur(f=>{const p=o?t.measuredBox[f]:t.layoutBox[f],h=fn(p);p.min=r[f].min,p.max=p.min+h});else if(i==="x"||i==="y"){const f=i==="x"?"y":"x";ib(o?t.measuredBox[f]:t.layoutBox[f],r[f])}else W$(i,t.layoutBox,r)&&Ur(f=>{const p=o?t.measuredBox[f]:t.layoutBox[f],h=fn(r[f]);p.max=p.min+h,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[f].max=e.relativeTarget[f].min+h)});const l=_o();Qc(l,r,t.layoutBox);const c=_o();o?Qc(c,e.applyTransform(s,!0),t.measuredBox):Qc(c,r,t.layoutBox);const u=!L$(l);let d=!1;if(!e.resumeFrom){const f=e.getClosestProjectingParent();if(f&&!f.resumeFrom){const{snapshot:p,layout:h}=f;if(p&&h){const m=e.options.layoutAnchor||void 0,v=Ct();Kh(v,t.layoutBox,p.layoutBox,m);const x=Ct();Kh(x,r,h.layoutBox,m),z$(v,x)||(d=!0),f.options.layoutRoot&&(e.relativeTarget=x,e.relativeTargetOrigin=v,e.relativeParent=f)}}}e.notifyListeners("didUpdate",{layout:r,snapshot:t,delta:c,layoutDelta:l,hasLayoutChanged:u,hasRelativeLayoutChanged:d})}else if(e.isLead()){const{onExitComplete:r}=e.options;r&&r()}e.options.transition=void 0}function txe(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 nxe(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function rxe(e){e.clearSnapshot()}function dC(e){e.clearMeasurements()}function axe(e){e.isLayoutDirty=!0,e.updateLayout()}function fC(e){e.isLayoutDirty=!1}function sxe(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function ixe(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function pC(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function oxe(e){e.resolveTargetDelta()}function lxe(e){e.calcProjection()}function cxe(e){e.resetSkewAndRotation()}function uxe(e){e.removeLeadSnapshot()}function hC(e,t,n){e.translate=Je(t.translate,0,n),e.scale=Je(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function mC(e,t,n,r){e.min=Je(t.min,n.min,r),e.max=Je(t.max,n.max,r)}function dxe(e,t,n,r){mC(e.x,t.x,n.x,r),mC(e.y,t.y,n.y,r)}function fxe(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const pxe={duration:.45,ease:[.4,0,.1,1]},xC=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),gC=xC("applewebkit/")&&!xC("chrome/")?Math.round:lr;function vC(e){e.min=gC(e.min),e.max=gC(e.max)}function hxe(e){vC(e.x),vC(e.y)}function W$(e,t,n){return e==="position"||e==="preserve-aspect"&&!Rme(iC(t),iC(n),.2)}function mxe(e){var t;return e!==e.root&&((t=e.scroll)==null?void 0:t.wasRoot)}const xxe=U$({attachResizeListener:(e,t)=>ld(e,"resize",t),measureScroll:()=>{var e,t;return{x:document.documentElement.scrollLeft||((e=document.body)==null?void 0:e.scrollLeft)||0,y:document.documentElement.scrollTop||((t=document.body)==null?void 0:t.scrollTop)||0}},checkIsScrollRoot:()=>!0}),U0={current:void 0},q$=U$({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!U0.current){const e=new xxe({});e.mount(window),e.setOptions({layoutScroll:!0}),U0.current=e}return U0.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),iw=b.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function yC(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function gxe(...e){return t=>{let n=!1;const r=e.map(s=>{const i=yC(s,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let s=0;s<r.length;s++){const i=r[s];typeof i=="function"?i():yC(e[s],null)}}}}function vxe(...e){return b.useCallback(gxe(...e),e)}class yxe extends b.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(Yf(n)&&t.isPresent&&!this.props.isPresent&&this.props.pop!==!1){const r=n.offsetParent,s=Yf(r)&&r.offsetWidth||0,i=Yf(r)&&r.offsetHeight||0,o=getComputedStyle(n),l=this.props.sizeRef.current;l.height=parseFloat(o.height),l.width=parseFloat(o.width),l.top=n.offsetTop,l.left=n.offsetLeft,l.right=s-l.width-l.left,l.bottom=i-l.height-l.top}return null}componentDidUpdate(){}render(){return this.props.children}}function bxe({children:e,isPresent:t,anchorX:n,anchorY:r,root:s,pop:i}){var p;const o=b.useId(),l=b.useRef(null),c=b.useRef({width:0,height:0,top:0,left:0,right:0,bottom:0}),{nonce:u}=b.useContext(iw),d=((p=e.props)==null?void 0:p.ref)??(e==null?void 0:e.ref),f=vxe(l,d);return b.useInsertionEffect(()=>{const{width:h,height:m,top:v,left:x,right:y,bottom:g}=c.current;if(t||i===!1||!l.current||!h||!m)return;const j=n==="left"?`left: ${x}`:`right: ${y}`,N=r==="bottom"?`bottom: ${g}`:`top: ${v}`;l.current.dataset.motionPopId=o;const w=document.createElement("style");u&&(w.nonce=u);const S=s??document.head;return S.appendChild(w),w.sheet&&w.sheet.insertRule(`
[data-motion-pop-id="${o}"] {
position: absolute !important;
width: ${h}px !important;
height: ${m}px !important;
${j}px !important;
${N}px !important;
}
`),()=>{var k;(k=l.current)==null||k.removeAttribute("data-motion-pop-id"),S.contains(w)&&S.removeChild(w)}},[t]),a.jsx(yxe,{isPresent:t,childRef:l,sizeRef:c,pop:i,children:i===!1?e:b.cloneElement(e,{ref:f})})}const jxe=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:s,presenceAffectsLayout:i,mode:o,anchorX:l,anchorY:c,root:u})=>{const d=Rj(wxe),f=b.useId();let p=!0,h=b.useMemo(()=>(p=!1,{id:f,initial:t,isPresent:n,custom:s,onExitComplete:m=>{d.set(m,!0);for(const v of d.values())if(!v)return;r&&r()},register:m=>(d.set(m,!1),()=>d.delete(m))}),[n,d,r]);return i&&p&&(h={...h}),b.useMemo(()=>{d.forEach((m,v)=>d.set(v,!1))},[n]),b.useEffect(()=>{!n&&!d.size&&r&&r()},[n]),e=a.jsx(bxe,{pop:o==="popLayout",isPresent:n,anchorX:l,anchorY:c,root:u,children:e}),a.jsx(gx.Provider,{value:h,children:e})};function wxe(){return new Map}function H$(e=!0){const t=b.useContext(gx);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:s}=t,i=b.useId();b.useEffect(()=>{if(e)return s(i)},[e]);const o=b.useCallback(()=>e&&r&&r(i),[i,r,e]);return!n&&r?[!1,o]:[!0]}const Nf=e=>e.key||"";function bC(e){const t=[];return b.Children.forEach(e,n=>{b.isValidElement(n)&&t.push(n)}),t}const cd=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:s=!0,mode:i="sync",propagate:o=!1,anchorX:l="left",anchorY:c="top",root:u})=>{const[d,f]=H$(o),p=b.useMemo(()=>bC(e),[e]),h=o&&!d?[]:p.map(Nf),m=b.useRef(!0),v=b.useRef(p),x=Rj(()=>new Map),y=b.useRef(new Set),[g,j]=b.useState(p),[N,w]=b.useState(p);y6(()=>{m.current=!1,v.current=p;for(let C=0;C<N.length;C++){const _=Nf(N[C]);h.includes(_)?(x.delete(_),y.current.delete(_)):x.get(_)!==!0&&x.set(_,!1)}},[N,h.length,h.join("-")]);const S=[];if(p!==g){let C=[...p];for(let _=0;_<N.length;_++){const A=N[_],E=Nf(A);h.includes(E)||(C.splice(_,0,A),S.push(A))}return i==="wait"&&S.length&&(C=S),w(bC(C)),j(p),null}const{forceRender:k}=b.useContext(Mj);return a.jsx(a.Fragment,{children:N.map(C=>{const _=Nf(C),A=o&&!d?!1:p===N||h.includes(_),E=()=>{if(y.current.has(_))return;if(x.has(_))y.current.add(_),x.set(_,!0);else return;let P=!0;x.forEach(D=>{D||(P=!1)}),P&&(k==null||k(),w(v.current),o&&(f==null||f()),r&&r())};return a.jsx(jxe,{isPresent:A,initial:!m.current||n?void 0:!1,custom:t,presenceAffectsLayout:s,mode:i,root:u,onExitComplete:A?void 0:E,anchorX:l,anchorY:c,children:C},_)})})},K$=b.createContext({strict:!1}),jC={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"]};let wC=!1;function Nxe(){if(wC)return;const e={};for(const t in jC)e[t]={isEnabled:n=>jC[t].some(r=>!!n[r])};w$(e),wC=!0}function G$(){return Nxe(),ome()}function Sxe(e){const t=G$();for(const n in e)t[n]={...t[n],...e[n]};w$(t)}const kxe=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","propagate","ignoreStrict","viewport"]);function Gh(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||kxe.has(e)}let X$=e=>!Gh(e);function Cxe(e){typeof e=="function"&&(X$=t=>t.startsWith("on")?!Gh(t):e(t))}try{Cxe(require("@emotion/is-prop-valid").default)}catch{}function _xe(e,t,n){const r={};for(const s in e)s==="values"&&typeof e.values=="object"||Wt(e[s])||(X$(s)||n===!0&&Gh(s)||!t&&!Gh(s)||e.draggable&&s.startsWith("onDrag"))&&(r[s]=e[s]);return r}const jx=b.createContext({});function Axe(e,t){if(bx(e)){const{initial:n,animate:r}=e;return{initial:n===!1||od(n)?n:void 0,animate:od(r)?r:void 0}}return e.inherit!==!1?t:{}}function Pxe(e){const{initial:t,animate:n}=Axe(e,b.useContext(jx));return b.useMemo(()=>({initial:t,animate:n}),[NC(t),NC(n)])}function NC(e){return Array.isArray(e)?e.join(" "):e}const ow=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function Y$(e,t,n){for(const r in t)!Wt(t[r])&&!P$(r,n)&&(e[r]=t[r])}function Exe({transformTemplate:e},t){return b.useMemo(()=>{const n=ow();return aw(n,t,e),Object.assign({},n.vars,n.style)},[t])}function Oxe(e,t){const n=e.style||{},r={};return Y$(r,n,e),Object.assign(r,Exe(e,t)),r}function Txe(e,t){const n={},r=Oxe(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}const Q$=()=>({...ow(),attrs:{}});function $xe(e,t,n,r){const s=b.useMemo(()=>{const i=Q$();return E$(i,t,T$(r),e.transformTemplate,e.style),{...i.attrs,style:{...i.style}}},[t]);if(e.style){const i={};Y$(i,e.style,e),s.style={...i,...s.style}}return s}const Mxe=["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 lw(e){return typeof e!="string"||e.includes("-")?!1:!!(Mxe.indexOf(e)>-1||/[A-Z]/u.test(e))}function Rxe(e,t,n,{latestValues:r},s,i=!1,o){const c=(o??lw(e)?$xe:Txe)(t,r,s,e),u=_xe(t,typeof e=="string",i),d=e!==b.Fragment?{...u,...c,ref:n}:{},{children:f}=t,p=b.useMemo(()=>Wt(f)?f.get():f,[f]);return b.createElement(e,{...d,children:p})}function Dxe({scrapeMotionValuesFromProps:e,createRenderState:t},n,r,s){return{latestValues:Ixe(n,r,s,e),renderState:t()}}function Ixe(e,t,n,r){const s={},i=r(e,{});for(const p in i)s[p]=tp(i[p]);let{initial:o,animate:l}=e;const c=bx(e),u=b$(e);t&&u&&!c&&e.inherit!==!1&&(o===void 0&&(o=t.initial),l===void 0&&(l=t.animate));let d=n?n.initial===!1:!1;d=d||o===!1;const f=d?l:o;if(f&&typeof f!="boolean"&&!yx(f)){const p=Array.isArray(f)?f:[f];for(let h=0;h<p.length;h++){const m=Yj(e,p[h]);if(m){const{transitionEnd:v,transition:x,...y}=m;for(const g in y){let j=y[g];if(Array.isArray(j)){const N=d?j.length-1:0;j=j[N]}j!==null&&(s[g]=j)}for(const g in v)s[g]=v[g]}}}return s}const J$=e=>(t,n)=>{const r=b.useContext(jx),s=b.useContext(gx),i=()=>Dxe(e,t,r,s);return n?i():Rj(i)},Lxe=J$({scrapeMotionValuesFromProps:sw,createRenderState:ow}),zxe=J$({scrapeMotionValuesFromProps:$$,createRenderState:Q$}),Bxe=Symbol.for("motionComponentSymbol");function Fxe(e,t,n){const r=b.useRef(n);b.useInsertionEffect(()=>{r.current=n});const s=b.useRef(null);return b.useCallback(i=>{var l;i&&((l=e.onMount)==null||l.call(e,i));const o=r.current;if(typeof o=="function")if(i){const c=o(i);typeof c=="function"&&(s.current=c)}else s.current?(s.current(),s.current=null):o(i);else o&&(o.current=i);t&&(i?t.mount(i):t.unmount())},[t])}const Z$=b.createContext({});function ao(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function Vxe(e,t,n,r,s,i){var j,N;const{visualElement:o}=b.useContext(jx),l=b.useContext(K$),c=b.useContext(gx),u=b.useContext(iw),d=u.reducedMotion,f=u.skipAnimations,p=b.useRef(null),h=b.useRef(!1);r=r||l.renderer,!p.current&&r&&(p.current=r(e,{visualState:t,parent:o,props:n,presenceContext:c,blockInitialAnimation:c?c.initial===!1:!1,reducedMotionConfig:d,skipAnimations:f,isSVG:i}),h.current&&p.current&&(p.current.manuallyAnimateOnMount=!0));const m=p.current,v=b.useContext(Z$);m&&!m.projection&&s&&(m.type==="html"||m.type==="svg")&&Uxe(p.current,n,s,v);const x=b.useRef(!1);b.useInsertionEffect(()=>{m&&x.current&&m.update(n,c)});const y=n[o$],g=b.useRef(!!y&&typeof window<"u"&&!((j=window.MotionHandoffIsComplete)!=null&&j.call(window,y))&&((N=window.MotionHasOptimisedAnimation)==null?void 0:N.call(window,y)));return y6(()=>{h.current=!0,m&&(x.current=!0,window.MotionIsMounted=!0,m.updateFeatures(),m.scheduleRenderMicrotask(),g.current&&m.animationState&&m.animationState.animateChanges())}),b.useEffect(()=>{m&&(!g.current&&m.animationState&&m.animationState.animateChanges(),g.current&&(queueMicrotask(()=>{var w;(w=window.MotionHandoffMarkAsComplete)==null||w.call(window,y)}),g.current=!1),m.enteringChildren=void 0)}),m}function Uxe(e,t,n,r){const{layoutId:s,layout:i,drag:o,dragConstraints:l,layoutScroll:c,layoutRoot:u,layoutAnchor:d,layoutCrossfade:f}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:e8(e.parent)),e.projection.setOptions({layoutId:s,layout:i,alwaysMeasureLayout:!!o||l&&ao(l),visualElement:e,animationType:typeof i=="string"?i:"both",initialPromotionConfig:r,crossfade:f,layoutScroll:c,layoutRoot:u,layoutAnchor:d})}function e8(e){if(e)return e.options.allowProjection!==!1?e.projection:e8(e.parent)}function W0(e,{forwardMotionProps:t=!1,type:n}={},r,s){r&&Sxe(r);const i=n?n==="svg":lw(e),o=i?zxe:Lxe;function l(u,d){let f;const p={...b.useContext(iw),...u,layoutId:Wxe(u)},{isStatic:h}=p,m=Pxe(u),v=o(u,h);if(!h&&typeof window<"u"){qxe();const x=Hxe(p);f=x.MeasureLayout,m.visualElement=Vxe(e,v,p,s,x.ProjectionNode,i)}return a.jsxs(jx.Provider,{value:m,children:[f&&m.visualElement?a.jsx(f,{visualElement:m.visualElement,...p}):null,Rxe(e,u,Fxe(v,m.visualElement,d),v,h,t,i)]})}l.displayName=`motion.${typeof e=="string"?e:`create(${e.displayName??e.name??""})`}`;const c=b.forwardRef(l);return c[Bxe]=e,c}function Wxe({layoutId:e}){const t=b.useContext(Mj).id;return t&&e!==void 0?t+"-"+e:e}function qxe(e,t){b.useContext(K$).strict}function Hxe(e){const t=G$(),{drag:n,layout:r}=t;if(!n&&!r)return{};const s={...n,...r};return{MeasureLayout:n!=null&&n.isEnabled(e)||r!=null&&r.isEnabled(e)?s.MeasureLayout:void 0,ProjectionNode:s.ProjectionNode}}function Kxe(e,t){if(typeof Proxy>"u")return W0;const n=new Map,r=(i,o)=>W0(i,o,e,t),s=(i,o)=>r(i,o);return new Proxy(s,{get:(i,o)=>o==="create"?r:(n.has(o)||n.set(o,W0(o,void 0,e,t)),n.get(o))})}const Gxe=(e,t)=>t.isSVG??lw(e)?new Sme(t):new vme(t,{allowProjection:e!==b.Fragment});class Xxe extends Ls{constructor(t){super(t),t.animationState||(t.animationState=Pme(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();yx(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),(t=this.unmountControls)==null||t.call(this)}}let Yxe=0;class Qxe extends Ls{constructor(){super(...arguments),this.id=Yxe++,this.isExitComplete=!1}update(){var i;if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===r)return;if(t&&r===!1){if(this.isExitComplete){const{initial:o,custom:l}=this.node.getProps();if(typeof o=="string"){const c=wi(this.node,o,l);if(c){const{transition:u,transitionEnd:d,...f}=c;for(const p in f)(i=this.node.getValue(p))==null||i.jump(f[p])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive("exit",!1);this.isExitComplete=!1;return}const s=this.node.animationState.setActive("exit",!t);n&&!t&&s.then(()=>{this.isExitComplete=!0,n(this.id)})}mount(){const{register:t,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),t&&(this.unmount=t(this.id))}unmount(){}}const Jxe={animation:{Feature:Xxe},exit:{Feature:Qxe}};function Rd(e){return{point:{x:e.pageX,y:e.pageY}}}const Zxe=e=>t=>ew(t)&&e(t,Rd(t));function Jc(e,t,n,r){return ld(e,t,Zxe(n),r)}const t8=({current:e})=>e?e.ownerDocument.defaultView:null,SC=(e,t)=>Math.abs(e-t);function e0e(e,t){const n=SC(e.x,t.x),r=SC(e.y,t.y);return Math.sqrt(n**2+r**2)}const kC=new Set(["auto","scroll"]);class n8{constructor(t,n,{transformPagePoint:r,contextWindow:s=window,dragSnapToOrigin:i=!1,distanceThreshold:o=3,element:l}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=h=>{this.handleScroll(h.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=Sf(this.lastRawMoveEventInfo,this.transformPagePoint));const h=q0(this.lastMoveEventInfo,this.history),m=this.startEvent!==null,v=e0e(h.offset,{x:0,y:0})>=this.distanceThreshold;if(!m&&!v)return;const{point:x}=h,{timestamp:y}=Vt;this.history.push({...x,timestamp:y});const{onStart:g,onMove:j}=this.handlers;m||(g&&g(this.lastMoveEvent,h),this.startEvent=this.lastMoveEvent),j&&j(this.lastMoveEvent,h)},this.handlePointerMove=(h,m)=>{this.lastMoveEvent=h,this.lastRawMoveEventInfo=m,this.lastMoveEventInfo=Sf(m,this.transformPagePoint),Ue.update(this.updatePoint,!0)},this.handlePointerUp=(h,m)=>{this.end();const{onEnd:v,onSessionEnd:x,resumeAnimation:y}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&y&&y(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const g=q0(h.type==="pointercancel"?this.lastMoveEventInfo:Sf(m,this.transformPagePoint),this.history);this.startEvent&&v&&v(h,g),x&&x(h,g)},!ew(t))return;this.dragSnapToOrigin=i,this.handlers=n,this.transformPagePoint=r,this.distanceThreshold=o,this.contextWindow=s||window;const c=Rd(t),u=Sf(c,this.transformPagePoint),{point:d}=u,{timestamp:f}=Vt;this.history=[{...d,timestamp:f}];const{onSessionStart:p}=n;p&&p(t,q0(u,this.history)),this.removeListeners=Td(Jc(this.contextWindow,"pointermove",this.handlePointerMove),Jc(this.contextWindow,"pointerup",this.handlePointerUp),Jc(this.contextWindow,"pointercancel",this.handlePointerUp)),l&&this.startScrollTracking(l)}startScrollTracking(t){let n=t.parentElement;for(;n;){const r=getComputedStyle(n);(kC.has(r.overflowX)||kC.has(r.overflowY))&&this.scrollPositions.set(n,{x:n.scrollLeft,y:n.scrollTop}),n=n.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(t){const n=this.scrollPositions.get(t);if(!n)return;const r=t===window,s=r?{x:window.scrollX,y:window.scrollY}:{x:t.scrollLeft,y:t.scrollTop},i={x:s.x-n.x,y:s.y-n.y};i.x===0&&i.y===0||(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(t,s),Ue.update(this.updatePoint,!0))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),As(this.updatePoint)}}function Sf(e,t){return t?{point:t(e.point)}:e}function CC(e,t){return{x:e.x-t.x,y:e.y-t.y}}function q0({point:e},t){return{point:e,delta:CC(e,r8(t)),offset:CC(e,t0e(t)),velocity:n0e(t,.1)}}function t0e(e){return e[0]}function r8(e){return e[e.length-1]}function n0e(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const s=r8(e);for(;n>=0&&(r=e[n],!(s.timestamp-r.timestamp>Bn(t)));)n--;if(!r)return{x:0,y:0};r===e[0]&&e.length>2&&s.timestamp-r.timestamp>Bn(t)*2&&(r=e[1]);const i=sr(s.timestamp-r.timestamp);if(i===0)return{x:0,y:0};const o={x:(s.x-r.x)/i,y:(s.y-r.y)/i};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function r0e(e,{min:t,max:n},r){return t!==void 0&&e<t?e=r?Je(t,e,r.min):Math.max(e,t):n!==void 0&&e>n&&(e=r?Je(n,e,r.max):Math.min(e,n)),e}function _C(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function a0e(e,{top:t,left:n,bottom:r,right:s}){return{x:_C(e.x,n,s),y:_C(e.y,t,r)}}function AC(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,r]=[r,n]),{min:n,max:r}}function s0e(e,t){return{x:AC(e.x,t.x),y:AC(e.y,t.y)}}function i0e(e,t){let n=.5;const r=fn(e),s=fn(t);return s>r?n=sd(t.min,t.max-r,e.min):r>s&&(n=sd(e.min,e.max-s,t.min)),la(0,1,n)}function o0e(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const ob=.35;function l0e(e=ob){return e===!1?e=0:e===!0&&(e=ob),{x:PC(e,"left","right"),y:PC(e,"top","bottom")}}function PC(e,t,n){return{min:EC(e,t),max:EC(e,n)}}function EC(e,t){return typeof e=="number"?e:e[t]||0}const c0e=new WeakMap;class u0e{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Ct(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=t}start(t,{snapToCursor:n=!1,distanceThreshold:r}={}){const{presenceContext:s}=this.visualElement;if(s&&s.isPresent===!1)return;const i=f=>{n&&this.snapToCursor(Rd(f).point),this.stopAnimation()},o=(f,p)=>{const{drag:h,dragPropagation:m,onDragStart:v}=this.getProps();if(h&&!m&&(this.openDragLock&&this.openDragLock(),this.openDragLock=Ihe(h),!this.openDragLock))return;this.latestPointerEvent=f,this.latestPanInfo=p,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Ur(y=>{let g=this.getAxisMotionValue(y).get()||0;if(ta.test(g)){const{projection:j}=this.visualElement;if(j&&j.layout){const N=j.layout.layoutBox[y];N&&(g=fn(N)*(parseFloat(g)/100))}}this.originPoint[y]=g}),v&&Ue.update(()=>v(f,p),!1,!0),Jy(this.visualElement,"transform");const{animationState:x}=this.visualElement;x&&x.setActive("whileDrag",!0)},l=(f,p)=>{this.latestPointerEvent=f,this.latestPanInfo=p;const{dragPropagation:h,dragDirectionLock:m,onDirectionLock:v,onDrag:x}=this.getProps();if(!h&&!this.openDragLock)return;const{offset:y}=p;if(m&&this.currentDirection===null){this.currentDirection=f0e(y),this.currentDirection!==null&&v&&v(this.currentDirection);return}this.updateAxis("x",p.point,y),this.updateAxis("y",p.point,y),this.visualElement.render(),x&&Ue.update(()=>x(f,p),!1,!0)},c=(f,p)=>{this.latestPointerEvent=f,this.latestPanInfo=p,this.stop(f,p),this.latestPointerEvent=null,this.latestPanInfo=null},u=()=>{const{dragSnapToOrigin:f}=this.getProps();(f||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:d}=this.getProps();this.panSession=new n8(t,{onSessionStart:i,onStart:o,onMove:l,onSessionEnd:c,resumeAnimation:u},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:d,distanceThreshold:r,contextWindow:t8(this.visualElement),element:this.visualElement.current})}stop(t,n){const r=t||this.latestPointerEvent,s=n||this.latestPanInfo,i=this.isDragging;if(this.cancel(),!i||!s||!r)return;const{velocity:o}=s;this.startAnimation(o);const{onDragEnd:l}=this.getProps();l&&Ue.postRender(()=>l(r,s))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(t,n,r){const{drag:s}=this.getProps();if(!r||!kf(t,s,this.currentDirection))return;const i=this.getAxisMotionValue(t);let o=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(o=r0e(o,this.constraints[t],this.elastic[t])),i.set(o)}resolveConstraints(){var i;const{dragConstraints:t,dragElastic:n}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(i=this.visualElement.projection)==null?void 0:i.layout,s=this.constraints;t&&ao(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&r?this.constraints=a0e(r.layoutBox,t):this.constraints=!1,this.elastic=l0e(n),s!==this.constraints&&!ao(t)&&r&&this.constraints&&!this.hasMutatedConstraints&&Ur(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=o0e(r.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!ao(t))return!1;const r=t.current,{projection:s}=this.visualElement;if(!s||!s.layout)return!1;const i=fme(r,s.root,this.visualElement.getTransformPagePoint());let o=s0e(s.layout.layoutBox,i);if(n){const l=n(cme(o));this.hasMutatedConstraints=!!l,l&&(o=S$(l))}return o}startAnimation(t){const{drag:n,dragMomentum:r,dragElastic:s,dragTransition:i,dragSnapToOrigin:o,onDragTransitionEnd:l}=this.getProps(),c=this.constraints||{},u=Ur(d=>{if(!kf(d,n,this.currentDirection))return;let f=c&&c[d]||{};(o===!0||o===d)&&(f={min:0,max:0});const p=s?200:1e6,h=s?40:1e7,m={type:"inertia",velocity:r?t[d]:0,bounceStiffness:p,bounceDamping:h,timeConstant:750,restDelta:1,restSpeed:10,...i,...f};return this.startAxisValueAnimation(d,m)});return Promise.all(u).then(l)}startAxisValueAnimation(t,n){const r=this.getAxisMotionValue(t);return Jy(this.visualElement,t),r.start(Xj(t,r,0,n,this.visualElement,!1))}stopAnimation(){Ur(t=>this.getAxisMotionValue(t).stop())}getAxisMotionValue(t){const n=`_drag${t.toUpperCase()}`,r=this.visualElement.getProps(),s=r[n];return s||this.visualElement.getValue(t,(r.initial?r.initial[t]:void 0)||0)}snapToCursor(t){Ur(n=>{const{drag:r}=this.getProps();if(!kf(n,r,this.currentDirection))return;const{projection:s}=this.visualElement,i=this.getAxisMotionValue(n);if(s&&s.layout){const{min:o,max:l}=s.layout.layoutBox[n],c=i.get()||0;i.set(t[n]-Je(o,l,.5)+c)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!ao(n)||!r||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};Ur(o=>{const l=this.getAxisMotionValue(o);if(l&&this.constraints!==!1){const c=l.get();s[o]=i0e({min:c,max:c},this.constraints[o])}});const{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.constraints=!1,this.resolveConstraints(),Ur(o=>{if(!kf(o,t,null))return;const l=this.getAxisMotionValue(o),{min:c,max:u}=this.constraints[o];l.set(Je(c,u,s[o]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;c0e.set(this.visualElement,this);const t=this.visualElement.current,n=Jc(t,"pointerdown",u=>{const{drag:d,dragListener:f=!0}=this.getProps(),p=u.target,h=p!==t&&Uhe(p);d&&f&&!h&&this.start(u)});let r;const s=()=>{const{dragConstraints:u}=this.getProps();ao(u)&&u.current&&(this.constraints=this.resolveRefConstraints(),r||(r=d0e(t,u.current,()=>this.scalePositionWithinConstraints())))},{projection:i}=this.visualElement,o=i.addEventListener("measure",s);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),Ue.read(s);const l=ld(window,"resize",()=>this.scalePositionWithinConstraints()),c=i.addEventListener("didUpdate",({delta:u,hasLayoutChanged:d})=>{this.isDragging&&d&&(Ur(f=>{const p=this.getAxisMotionValue(f);p&&(this.originPoint[f]+=u[f].translate,p.set(p.get()+u[f].translate))}),this.visualElement.render())});return()=>{l(),n(),o(),c&&c(),r&&r()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:s=!1,dragConstraints:i=!1,dragElastic:o=ob,dragMomentum:l=!0}=t;return{...t,drag:n,dragDirectionLock:r,dragPropagation:s,dragConstraints:i,dragElastic:o,dragMomentum:l}}}function OC(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function d0e(e,t,n){const r=L4(e,OC(n)),s=L4(t,OC(n));return()=>{r(),s()}}function kf(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function f0e(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class p0e extends Ls{constructor(t){super(t),this.removeGroupControls=lr,this.removeListeners=lr,this.controls=new u0e(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||lr}update(){const{dragControls:t}=this.node.getProps(),{dragControls:n}=this.node.prevProps||{};t!==n&&(this.removeGroupControls(),t&&(this.removeGroupControls=t.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const H0=e=>(t,n)=>{e&&Ue.update(()=>e(t,n),!1,!0)};class h0e extends Ls{constructor(){super(...arguments),this.removePointerDownListener=lr}onPointerDown(t){this.session=new n8(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:t8(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:r,onPanEnd:s}=this.node.getProps();return{onSessionStart:H0(t),onStart:H0(n),onMove:H0(r),onEnd:(i,o)=>{delete this.session,s&&Ue.postRender(()=>s(i,o))}}}mount(){this.removePointerDownListener=Jc(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let K0=!1;class m0e extends b.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r,layoutId:s}=this.props,{projection:i}=t;i&&(n.group&&n.group.add(i),r&&r.register&&s&&r.register(i),K0&&i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),np.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:r,drag:s,isPresent:i}=this.props,{projection:o}=r;return o&&(o.isPresent=i,t.layoutDependency!==n&&o.setOptions({...o.options,layoutDependency:n}),K0=!0,s||t.layoutDependency!==n||n===void 0||t.isPresent!==i?o.willUpdate():this.safeToRemove(),t.isPresent!==i&&(i?o.promote():o.relegate()||Ue.postRender(()=>{const l=o.getStack();(!l||!l.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{visualElement:t,layoutAnchor:n}=this.props,{projection:r}=t;r&&(r.options.layoutAnchor=n,r.root.didUpdate(),Zj.postRender(()=>{!r.currentAnimation&&r.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:s}=t;K0=!0,s&&(s.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(s),r&&r.deregister&&r.deregister(s))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function a8(e){const[t,n]=H$(),r=b.useContext(Mj);return a.jsx(m0e,{...e,layoutGroup:r,switchLayoutGroup:b.useContext(Z$),isPresent:t,safeToRemove:n})}const x0e={pan:{Feature:h0e},drag:{Feature:p0e,ProjectionNode:q$,MeasureLayout:a8}};function TC(e,t,n){const{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive("whileHover",n==="Start");const s="onHover"+n,i=r[s];i&&Ue.postRender(()=>i(t,Rd(t)))}class g0e extends Ls{mount(){const{current:t}=this.node;t&&(this.unmount=zhe(t,(n,r)=>(TC(this.node,r,"Start"),s=>TC(this.node,s,"End"))))}unmount(){}}class v0e extends Ls{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!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=Td(ld(this.node.current,"focus",()=>this.onFocus()),ld(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function $C(e,t,n){const{props:r}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&r.whileTap&&e.animationState.setActive("whileTap",n==="Start");const s="onTap"+(n==="End"?"":n),i=r[s];i&&Ue.postRender(()=>i(t,Rd(t)))}class y0e extends Ls{mount(){const{current:t}=this.node;if(!t)return;const{globalTapTarget:n,propagate:r}=this.node.props;this.unmount=qhe(t,(s,i)=>($C(this.node,i,"Start"),(o,{success:l})=>$C(this.node,o,l?"End":"Cancel")),{useGlobalTarget:n,stopPropagation:(r==null?void 0:r.tap)===!1})}unmount(){}}const lb=new WeakMap,G0=new WeakMap,b0e=e=>{const t=lb.get(e.target);t&&t(e)},j0e=e=>{e.forEach(b0e)};function w0e({root:e,...t}){const n=e||document;G0.has(n)||G0.set(n,{});const r=G0.get(n),s=JSON.stringify(t);return r[s]||(r[s]=new IntersectionObserver(j0e,{root:e,...t})),r[s]}function N0e(e,t,n){const r=w0e(t);return lb.set(e,n),r.observe(e),()=>{lb.delete(e),r.unobserve(e)}}const S0e={some:0,all:1};class k0e extends Ls{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){var c;(c=this.stopObserver)==null||c.call(this);const{viewport:t={}}=this.node.getProps(),{root:n,margin:r,amount:s="some",once:i}=t,o={root:n?n.current:void 0,rootMargin:r,threshold:typeof s=="number"?s:S0e[s]},l=u=>{const{isIntersecting:d}=u;if(this.isInView===d||(this.isInView=d,i&&!d&&this.hasEnteredView))return;d&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",d);const{onViewportEnter:f,onViewportLeave:p}=this.node.getProps(),h=d?f:p;h&&h(u)};this.stopObserver=N0e(this.node.current,o,l)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(C0e(t,n))&&this.startObserver()}unmount(){var t;(t=this.stopObserver)==null||t.call(this),this.hasEnteredView=!1,this.isInView=!1}}function C0e({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const _0e={inView:{Feature:k0e},tap:{Feature:y0e},focus:{Feature:v0e},hover:{Feature:g0e}},A0e={layout:{ProjectionNode:q$,MeasureLayout:a8}},P0e={...Jxe,..._0e,...x0e,...A0e},na=Kxe(P0e,Gxe),cw={owner:{label:"Dono",color:"bg-yellow-500/20 text-yellow-300 border-yellow-500/30",Icon:gd},manager:{label:"Gerente",color:"bg-purple-500/20 text-purple-300 border-purple-500/30",Icon:ws},supervisor:{label:"Supervisor",color:"bg-blue-500/20 text-blue-300 border-blue-500/30",Icon:$p},secretary:{label:"Secretária",color:"bg-cyan-500/20 text-cyan-300 border-cyan-500/30",Icon:bu},agent:{label:"Atendente",color:"bg-green-500/20 text-green-300 border-green-500/30",Icon:mI},viewer:{label:"Visualizador",color:"bg-slate-500/20 text-slate-300 border-slate-500/30",Icon:$p}},s8={online:"bg-green-400",busy:"bg-yellow-400",offline:"bg-slate-500"},X0={knowledge:"Conhecimento",rules:"Regras",escalation:"Escalação",persona:"Persona"},E0e={knowledge:"text-cyan-400 bg-cyan-500/10",rules:"text-yellow-400 bg-yellow-500/10",escalation:"text-red-400 bg-red-500/10",persona:"text-purple-400 bg-purple-500/10"};function i8({role:e}){const t=cw[e]||{label:e,color:"bg-slate-500/20 text-slate-300 border-slate-500/30",Icon:et},{Icon:n}=t;return a.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium border ${t.color}`,children:[a.jsx(n,{size:10}),t.label]})}function uw({title:e,onClose:t,children:n}){return a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4",children:a.jsxs("div",{className:"bg-slate-800 border border-slate-700 rounded-xl shadow-2xl w-full max-w-lg max-h-[90vh] overflow-y-auto",children:[a.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-slate-700",children:[a.jsx("h2",{className:"font-semibold text-white",children:e}),a.jsx("button",{onClick:t,className:"text-slate-400 hover:text-white",children:a.jsx(Ce,{size:18})})]}),a.jsx("div",{className:"p-5",children:n})]})})}function nr({label:e,children:t}){return a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-slate-400 mb-1",children:e}),t]})}function hi({...e}){return a.jsx("input",{...e,className:"w-full bg-slate-900 border border-slate-600 rounded-lg px-3 py-2 text-sm text-white placeholder-slate-500 focus:outline-none focus:border-cyan-500"})}function cb({...e}){return a.jsx("select",{...e,className:"w-full bg-slate-900 border border-slate-600 rounded-lg px-3 py-2 text-sm text-white focus:outline-none focus:border-cyan-500"})}function O0e({...e}){return a.jsx("textarea",{...e,className:"w-full bg-slate-900 border border-slate-600 rounded-lg px-3 py-2 text-sm text-white placeholder-slate-500 focus:outline-none focus:border-cyan-500 resize-none"})}function $r({onClick:e,variant:t="primary",children:n,disabled:r,className:s=""}){const i="inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-sm font-medium transition disabled:opacity-50 disabled:cursor-not-allowed",o={primary:"bg-cyan-600 hover:bg-cyan-500 text-white",ghost:"bg-slate-700 hover:bg-slate-600 text-slate-200",danger:"bg-red-600/20 hover:bg-red-600/40 text-red-400 border border-red-600/30"};return a.jsx("button",{onClick:e,disabled:r,className:`${i} ${o[t]} ${s}`,children:n})}function T0e(){const[e,t]=b.useState([]),[n,r]=b.useState(!0),[s,i]=b.useState(null),[o,l]=b.useState(null),[c,u]=b.useState({name:"",email:"",password:"",role:"agent",phone:""}),[d,f]=b.useState(!1),p=b.useCallback(async()=>{r(!0);try{t(await Zn.list())}finally{r(!1)}},[]);b.useEffect(()=>{p()},[p]);function h(){u({name:"",email:"",password:"",role:"agent",phone:""}),l(null),i("create")}function m(j){u({name:j.name,email:j.email||"",password:"",role:j.role,phone:j.phone||""}),l(j),i("edit")}async function v(){var j,N;f(!0);try{const w={name:c.name,email:c.email||void 0,role:c.role,phone:c.phone||void 0};c.password&&(w.password=c.password),o?await Zn.update(o.id,w):await Zn.create(w),i(null),p()}catch(w){alert(((N=(j=w.response)==null?void 0:j.data)==null?void 0:N.error)||"Erro ao salvar")}finally{f(!1)}}async function x(j){await Zn.update(j.id,{active:!j.active}),p()}async function y(j){const N=j.availability==="online"?"offline":"online";await Zn.update(j.id,{availability:N}),p()}async function g(j){confirm(`Excluir "${j.name}"?`)&&(await Zn.remove(j.id),p())}return n?a.jsx("div",{className:"flex items-center justify-center h-40 text-slate-400 text-sm",children:"Carregando..."}):a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("p",{className:"text-sm text-slate-400",children:[e.length," colaborador(es)"]}),a.jsxs($r,{onClick:h,children:[a.jsx(Oe,{size:14})," Nova Conta"]})]}),a.jsxs("div",{className:"grid gap-3",children:[e.map(j=>a.jsxs("div",{className:`flex items-center gap-3 p-3 rounded-xl border ${j.active?"bg-slate-800/60 border-slate-700":"bg-slate-900/40 border-slate-800 opacity-60"}`,children:[a.jsxs("div",{className:"relative flex-shrink-0",children:[j.avatar_url?a.jsx("img",{src:j.avatar_url,className:"w-10 h-10 rounded-full object-cover"}):a.jsx("div",{className:"w-10 h-10 rounded-full bg-slate-700 flex items-center justify-center text-slate-300 font-semibold text-sm",children:j.name.charAt(0).toUpperCase()}),a.jsx("span",{className:`absolute bottom-0 right-0 w-2.5 h-2.5 rounded-full border-2 border-slate-800 ${s8[j.availability]||"bg-slate-500"}`})]}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[a.jsx("span",{className:"text-sm font-medium text-white truncate",children:j.name}),a.jsx(i8,{role:j.role}),j.phone_connected&&a.jsxs("span",{className:"inline-flex items-center gap-0.5 text-[10px] text-green-400",children:[a.jsx(nE,{size:10}),"WA"]})]}),j.email&&a.jsx("p",{className:"text-xs text-slate-500 truncate",children:j.email}),j.sectors.length>0&&a.jsx("p",{className:"text-xs text-slate-500 truncate",children:j.sectors.map(N=>N.sector_name).join(", ")})]}),a.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[a.jsx("button",{onClick:()=>y(j),title:j.availability==="online"?"Online":"Offline",className:`p-1.5 rounded-lg transition ${j.availability==="online"?"text-green-400 hover:bg-green-500/10":"text-slate-500 hover:bg-slate-700"}`,children:j.availability==="online"?a.jsx(Ss,{size:16}):a.jsx(Ns,{size:16})}),a.jsx("button",{onClick:()=>m(j),className:"p-1.5 rounded-lg text-slate-400 hover:text-white hover:bg-slate-700 transition",children:a.jsx(Er,{size:14})}),a.jsx("button",{onClick:()=>x(j),className:"p-1.5 rounded-lg text-slate-400 hover:text-white hover:bg-slate-700 transition",title:j.active?"Suspender":"Ativar",children:j.active?a.jsx(jt,{size:14,className:"text-green-400"}):a.jsx(Ce,{size:14,className:"text-red-400"})}),a.jsx("button",{onClick:()=>g(j),className:"p-1.5 rounded-lg text-slate-400 hover:text-red-400 hover:bg-red-500/10 transition",children:a.jsx(Te,{size:14})})]})]},j.id)),e.length===0&&a.jsxs("div",{className:"text-center py-12 text-slate-500 text-sm",children:["Nenhum colaborador cadastrado.",a.jsx("br",{}),a.jsx("button",{onClick:h,className:"mt-2 text-cyan-400 hover:underline",children:"Criar primeiro"})]})]}),s&&a.jsx(uw,{title:s==="create"?"Nova Conta":"Editar Conta",onClose:()=>i(null),children:a.jsxs("div",{className:"space-y-4",children:[a.jsx(nr,{label:"Nome *",children:a.jsx(hi,{value:c.name,onChange:j=>u(N=>({...N,name:j.target.value})),placeholder:"Nome completo"})}),a.jsx(nr,{label:"E-mail (login)",children:a.jsx(hi,{type:"email",value:c.email,onChange:j=>u(N=>({...N,email:j.target.value})),placeholder:"email@empresa.com"})}),a.jsx(nr,{label:s==="edit"?"Nova senha (deixe em branco para manter)":"Senha",children:a.jsx(hi,{type:"password",value:c.password,onChange:j=>u(N=>({...N,password:j.target.value})),placeholder:"••••••••"})}),a.jsx(nr,{label:"WhatsApp pessoal",children:a.jsx(hi,{value:c.phone,onChange:j=>u(N=>({...N,phone:j.target.value})),placeholder:"5511999990000"})}),a.jsx(nr,{label:"Cargo",children:a.jsx(cb,{value:c.role,onChange:j=>u(N=>({...N,role:j.target.value})),children:Object.entries(cw).map(([j,N])=>a.jsx("option",{className:"bg-slate-900 text-white",value:j,children:N.label},j))})}),a.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[a.jsx($r,{variant:"ghost",onClick:()=>i(null),children:"Cancelar"}),a.jsx($r,{onClick:v,disabled:d||!c.name,children:d?"Salvando...":"Salvar"})]})]})})]})}const $0e=["#6366f1","#06b6d4","#10b981","#f59e0b","#ef4444","#ec4899","#8b5cf6","#f97316"];function M0e(){const[e,t]=b.useState([]),[n,r]=b.useState(!0),[s,i]=b.useState(null),[o,l]=b.useState(null),[c,u]=b.useState({name:"",description:"",icon:"Briefcase",color:"#6366f1",sla_minutes:60}),[d,f]=b.useState(!1),p=b.useCallback(async()=>{r(!0);try{t(await er.list())}finally{r(!1)}},[]);b.useEffect(()=>{p()},[p]);function h(){u({name:"",description:"",icon:"Briefcase",color:"#6366f1",sla_minutes:60}),l(null),i("create")}function m(y){u({name:y.name,description:y.description||"",icon:y.icon,color:y.color,sla_minutes:y.sla_minutes}),l(y),i("edit")}async function v(){var y,g;f(!0);try{o?await er.update(o.id,c):await er.create(c),i(null),p()}catch(j){alert(((g=(y=j.response)==null?void 0:y.data)==null?void 0:g.error)||"Erro ao salvar")}finally{f(!1)}}async function x(y){var g,j;if(confirm(`Excluir setor "${y.name}"? Membros vinculados serão desvinculados.`))try{await er.remove(y.id),p()}catch(N){alert(((j=(g=N.response)==null?void 0:g.data)==null?void 0:j.error)||"Erro ao excluir")}}return n?a.jsx("div",{className:"flex items-center justify-center h-40 text-slate-400 text-sm",children:"Carregando..."}):a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("p",{className:"text-sm text-slate-400",children:[e.length," setor(es)"]}),a.jsxs($r,{onClick:h,children:[a.jsx(Oe,{size:14})," Novo Setor"]})]}),a.jsxs("div",{className:"grid gap-3",children:[e.map(y=>a.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-xl border bg-slate-800/60 border-slate-700",children:[a.jsx("div",{className:"w-10 h-10 rounded-xl flex items-center justify-center flex-shrink-0",style:{background:y.color+"33"},children:a.jsx(mm,{size:18,style:{color:y.color}})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-sm font-medium text-white",children:y.name}),a.jsxs("span",{className:"text-xs text-slate-500",children:["SLA: ",y.sla_minutes," min"]})]}),y.description&&a.jsx("p",{className:"text-xs text-slate-500 line-clamp-2",children:y.description}),a.jsxs("p",{className:"text-xs text-slate-600",children:[y.member_count," membro(s)"]})]}),a.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[a.jsx("button",{onClick:()=>m(y),className:"p-1.5 rounded-lg text-slate-400 hover:text-white hover:bg-slate-700 transition",children:a.jsx(Er,{size:14})}),a.jsx("button",{onClick:()=>x(y),className:"p-1.5 rounded-lg text-slate-400 hover:text-red-400 hover:bg-red-500/10 transition",children:a.jsx(Te,{size:14})})]})]},y.id)),e.length===0&&a.jsxs("div",{className:"text-center py-12 text-slate-500 text-sm",children:["Nenhum setor cadastrado.",a.jsx("br",{}),a.jsx("button",{onClick:h,className:"mt-2 text-cyan-400 hover:underline",children:"Criar primeiro"})]})]}),s&&a.jsx(uw,{title:s==="create"?"Novo Setor":"Editar Setor",onClose:()=>i(null),children:a.jsxs("div",{className:"space-y-4",children:[a.jsx(nr,{label:"Nome *",children:a.jsx(hi,{value:c.name,onChange:y=>u(g=>({...g,name:y.target.value})),placeholder:"Ex: Financeiro"})}),a.jsx(nr,{label:"Descrição",children:a.jsx(O0e,{value:c.description,onChange:y=>u(g=>({...g,description:y.target.value})),rows:2,placeholder:"O que este setor atende..."})}),a.jsx(nr,{label:"SLA (minutos)",children:a.jsx(hi,{type:"number",value:c.sla_minutes,onChange:y=>u(g=>({...g,sla_minutes:Number(y.target.value)})),min:5})}),a.jsx(nr,{label:"Cor",children:a.jsxs("div",{className:"flex gap-2 flex-wrap",children:[$0e.map(y=>a.jsx("button",{onClick:()=>u(g=>({...g,color:y})),className:`w-7 h-7 rounded-full border-2 transition ${c.color===y?"border-white scale-110":"border-transparent"}`,style:{background:y}},y)),a.jsx("input",{type:"color",value:c.color,onChange:y=>u(g=>({...g,color:y.target.value})),className:"w-7 h-7 rounded-full border-0 cursor-pointer bg-transparent"})]})}),a.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[a.jsx($r,{variant:"ghost",onClick:()=>i(null),children:"Cancelar"}),a.jsx($r,{onClick:v,disabled:d||!c.name,children:d?"Salvando...":"Salvar"})]})]})})]})}function R0e(){const[e,t]=b.useState([]),[n,r]=b.useState([]),[s,i]=b.useState([]),[o,l]=b.useState(!0),[c,u]=b.useState(""),[d,f]=b.useState(!1),[p,h]=b.useState({account_id:"",sector_id:"",function:"",is_primary:!1}),[m,v]=b.useState(!1),x=b.useCallback(async()=>{l(!0);try{const[S,k,C]=await Promise.all([Js.list(c?{sector_id:Number(c)}:void 0),Zn.list(),er.list()]);t(S),r(k),i(C)}finally{l(!1)}},[c]);b.useEffect(()=>{x()},[x]);async function y(){var S,k;if(!(!p.account_id||!p.sector_id)){v(!0);try{await Js.add({account_id:Number(p.account_id),sector_id:Number(p.sector_id),function:p.function||void 0,is_primary:p.is_primary}),f(!1),x()}catch(C){alert(((k=(S=C.response)==null?void 0:S.data)==null?void 0:k.error)||"Erro ao vincular")}finally{v(!1)}}}async function g(S){await Js.update(S.id,{on_duty:!S.on_duty}),x()}async function j(S){await Js.update(S.id,{notify_escalation:!S.notify_escalation}),x()}async function N(S){await Js.update(S.id,{notify_human_api:!S.notify_human_api}),x()}async function w(S){confirm(`Desvincular ${S.account_name} do setor ${S.sector_name}?`)&&(await Js.remove(S.id),x())}return o?a.jsx("div",{className:"flex items-center justify-center h-40 text-slate-400 text-sm",children:"Carregando..."}):a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[a.jsxs("select",{value:c,onChange:S=>u(S.target.value),className:"bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-sm text-white focus:outline-none",children:[a.jsx("option",{className:"bg-slate-900 text-white",value:"",children:"Todos os setores"}),s.map(S=>a.jsx("option",{className:"bg-slate-900 text-white",value:S.id,children:S.name},S.id))]}),a.jsx("div",{className:"ml-auto",children:a.jsxs($r,{onClick:()=>f(!0),children:[a.jsx(Oe,{size:14})," Vincular Membro"]})})]}),a.jsx("div",{className:"overflow-x-auto rounded-xl border border-slate-700",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-slate-700 text-slate-400 text-xs",children:[a.jsx("th",{className:"text-left px-4 py-2.5",children:"Colaborador"}),a.jsx("th",{className:"text-left px-4 py-2.5",children:"Setor"}),a.jsx("th",{className:"text-left px-4 py-2.5",children:"Função"}),a.jsx("th",{className:"text-center px-3 py-2.5",children:"Turno"}),a.jsx("th",{className:"text-center px-3 py-2.5",children:"Escal."}),a.jsx("th",{className:"text-center px-3 py-2.5",children:"H.API"}),a.jsx("th",{className:"px-3 py-2.5"})]})}),a.jsxs("tbody",{children:[e.map(S=>a.jsxs("tr",{className:"border-b border-slate-800 hover:bg-slate-800/30 transition",children:[a.jsx("td",{className:"px-4 py-2.5",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("div",{className:"relative",children:[a.jsx("div",{className:"w-7 h-7 rounded-full bg-slate-700 flex items-center justify-center text-xs font-medium text-slate-300",children:S.account_name.charAt(0).toUpperCase()}),a.jsx("span",{className:`absolute -bottom-0.5 -right-0.5 w-2 h-2 rounded-full border border-slate-900 ${s8[S.availability]||"bg-slate-500"}`})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-white font-medium leading-tight",children:S.account_name}),a.jsx(i8,{role:S.account_role})]})]})}),a.jsx("td",{className:"px-4 py-2.5",children:a.jsxs("span",{className:"inline-flex items-center gap-1 text-slate-300",children:[a.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:S.sector_color}}),S.sector_name]})}),a.jsx("td",{className:"px-4 py-2.5 text-slate-400",children:S.function||"—"}),a.jsx("td",{className:"px-3 py-2.5 text-center",children:a.jsx("button",{onClick:()=>g(S),className:`text-xs px-2 py-0.5 rounded-full border transition ${S.on_duty?"border-green-500/40 text-green-400 bg-green-500/10":"border-slate-600 text-slate-500 bg-transparent"}`,children:S.on_duty?"On":"Off"})}),a.jsx("td",{className:"px-3 py-2.5 text-center",children:a.jsx("button",{onClick:()=>j(S),className:`transition ${S.notify_escalation?"text-yellow-400":"text-slate-600 hover:text-slate-400"}`,children:S.notify_escalation?a.jsx(Ss,{size:16}):a.jsx(Ns,{size:16})})}),a.jsx("td",{className:"px-3 py-2.5 text-center",children:a.jsx("button",{onClick:()=>N(S),className:`transition ${S.notify_human_api?"text-cyan-400":"text-slate-600 hover:text-slate-400"}`,children:S.notify_human_api?a.jsx(Ss,{size:16}):a.jsx(Ns,{size:16})})}),a.jsx("td",{className:"px-3 py-2.5",children:a.jsx("button",{onClick:()=>w(S),className:"p-1 rounded text-slate-500 hover:text-red-400 transition",children:a.jsx(Te,{size:13})})})]},S.id)),e.length===0&&a.jsx("tr",{children:a.jsx("td",{colSpan:7,className:"text-center py-10 text-slate-500",children:"Nenhum membro vinculado"})})]})]})}),d&&a.jsx(uw,{title:"Vincular Membro",onClose:()=>f(!1),children:a.jsxs("div",{className:"space-y-4",children:[a.jsx(nr,{label:"Colaborador *",children:a.jsxs(cb,{value:p.account_id,onChange:S=>h(k=>({...k,account_id:S.target.value})),children:[a.jsx("option",{className:"bg-slate-900 text-white",value:"",children:"Selecione..."}),n.map(S=>{var k;return a.jsxs("option",{className:"bg-slate-900 text-white",value:S.id,children:[S.name," — ",(k=cw[S.role])==null?void 0:k.label]},S.id)})]})}),a.jsx(nr,{label:"Setor *",children:a.jsxs(cb,{value:p.sector_id,onChange:S=>h(k=>({...k,sector_id:S.target.value})),children:[a.jsx("option",{className:"bg-slate-900 text-white",value:"",children:"Selecione..."}),s.map(S=>a.jsx("option",{className:"bg-slate-900 text-white",value:S.id,children:S.name},S.id))]})}),a.jsx(nr,{label:"Função no setor",children:a.jsx(hi,{value:p.function,onChange:S=>h(k=>({...k,function:S.target.value})),placeholder:"Ex: Encarregado, Especialista..."})}),a.jsxs("label",{className:"flex items-center gap-2 text-sm text-slate-300 cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:p.is_primary,onChange:S=>h(k=>({...k,is_primary:S.target.checked})),className:"rounded"}),"Setor principal deste colaborador"]}),a.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[a.jsx($r,{variant:"ghost",onClick:()=>f(!1),children:"Cancelar"}),a.jsx($r,{onClick:y,disabled:m||!p.account_id||!p.sector_id,children:m?"Vinculando...":"Vincular"})]})]})})]})}function D0e(){const[e,t]=b.useState([]),[n,r]=b.useState(null),[s,i]=b.useState([]),[o,l]=b.useState(!1),[c,u]=b.useState({type:"knowledge",content:""}),[d,f]=b.useState(null),[p,h]=b.useState(!1);b.useEffect(()=>{er.list().then(j=>{t(j),j.length>0&&!n&&r(j[0].id)})},[]),b.useEffect(()=>{n&&(l(!0),er.getBrain(n).then(j=>{i(j),l(!1)}))},[n]);async function m(){if(!(!n||!c.content.trim())){h(!0);try{const j=await er.createBrain(n,{type:c.type,content:c.content});i(N=>[...N,j]),u({type:"knowledge",content:""})}finally{h(!1)}}}async function v(){if(d){h(!0);try{const j=await er.updateBrain(d.id,{type:d.type,content:d.content,active:d.active});i(N=>N.map(w=>w.id===j.id?j:w)),f(null)}finally{h(!1)}}}async function x(j){const N=await er.updateBrain(j.id,{active:!j.active});i(w=>w.map(S=>S.id===N.id?N:S))}async function y(j){confirm("Excluir este node?")&&(await er.deleteBrain(j.id),i(N=>N.filter(w=>w.id!==j.id)))}const g=e.find(j=>j.id===n);return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex gap-2 flex-wrap",children:[e.map(j=>a.jsxs("button",{onClick:()=>r(j.id),className:`px-3 py-1.5 rounded-lg text-sm font-medium border transition ${n===j.id?"border-cyan-500 text-cyan-400 bg-cyan-500/10":"border-slate-700 text-slate-400 hover:text-white hover:border-slate-600"}`,children:[a.jsx("span",{className:"inline-block w-2 h-2 rounded-full mr-1.5",style:{background:j.color}}),j.name,a.jsx("span",{className:"ml-1.5 text-xs opacity-60",children:j.member_count})]},j.id)),e.length===0&&a.jsx("p",{className:"text-sm text-slate-500",children:'Crie setores primeiro na aba "Setores"'})]}),n&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"bg-slate-800/60 border border-slate-700 rounded-xl p-4 space-y-3",children:[a.jsxs("p",{className:"text-xs text-slate-400 font-medium",children:["Adicionar conhecimento ao setor ",a.jsx("span",{className:"text-white",children:g==null?void 0:g.name})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("select",{value:c.type,onChange:j=>u(N=>({...N,type:j.target.value})),className:"bg-slate-900 border border-slate-600 rounded-lg px-2 py-1.5 text-xs text-white focus:outline-none focus:border-cyan-500 flex-shrink-0",children:Object.entries(X0).map(([j,N])=>a.jsx("option",{className:"bg-slate-900 text-white",value:j,children:N},j))}),a.jsx("textarea",{value:c.content,onChange:j=>u(N=>({...N,content:j.target.value})),rows:2,placeholder:"Descreva o conhecimento, regra ou instrução...",className:"flex-1 bg-slate-900 border border-slate-600 rounded-lg px-3 py-2 text-sm text-white placeholder-slate-500 focus:outline-none focus:border-cyan-500 resize-none"}),a.jsx("button",{onClick:m,disabled:p||!c.content.trim(),className:"px-3 py-1.5 bg-cyan-600 hover:bg-cyan-500 disabled:opacity-50 text-white rounded-lg text-sm font-medium transition flex-shrink-0",children:a.jsx(Oe,{size:16})})]})]}),o?a.jsx("div",{className:"text-center py-8 text-slate-400 text-sm",children:"Carregando..."}):a.jsxs("div",{className:"space-y-2",children:[s.map(j=>a.jsx("div",{className:`rounded-xl border p-3 transition ${j.active?"bg-slate-800/60 border-slate-700":"bg-slate-900/40 border-slate-800 opacity-50"}`,children:(d==null?void 0:d.id)===j.id?a.jsxs("div",{className:"space-y-2",children:[a.jsx("select",{value:d.type,onChange:N=>f(w=>w&&{...w,type:N.target.value}),className:"bg-slate-900 border border-slate-600 rounded px-2 py-1 text-xs text-white focus:outline-none",children:Object.entries(X0).map(([N,w])=>a.jsx("option",{className:"bg-slate-900 text-white",value:N,children:w},N))}),a.jsx("textarea",{value:d.content,onChange:N=>f(w=>w&&{...w,content:N.target.value}),rows:3,className:"w-full bg-slate-900 border border-slate-600 rounded-lg px-3 py-2 text-sm text-white focus:outline-none focus:border-cyan-500 resize-none"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs($r,{onClick:v,disabled:p,children:[a.jsx(jt,{size:13})," Salvar"]}),a.jsxs($r,{variant:"ghost",onClick:()=>f(null),children:[a.jsx(Ce,{size:13})," Cancelar"]})]})]}):a.jsxs("div",{className:"flex gap-3",children:[a.jsx("span",{className:`text-[10px] font-medium px-2 py-0.5 rounded-full self-start flex-shrink-0 ${E0e[j.type]}`,children:X0[j.type]||j.type}),a.jsx("p",{className:"text-sm text-slate-300 flex-1 leading-relaxed whitespace-pre-wrap",children:j.content}),a.jsxs("div",{className:"flex items-start gap-1 flex-shrink-0",children:[a.jsx("button",{onClick:()=>f(j),className:"p-1 text-slate-500 hover:text-white transition",children:a.jsx(Er,{size:13})}),a.jsx("button",{onClick:()=>x(j),className:"p-1 text-slate-500 hover:text-yellow-400 transition",title:j.active?"Desativar":"Ativar",children:j.active?a.jsx(Ss,{size:13,className:"text-green-400"}):a.jsx(Ns,{size:13})}),a.jsx("button",{onClick:()=>y(j),className:"p-1 text-slate-500 hover:text-red-400 transition",children:a.jsx(Te,{size:13})})]})]})},j.id)),s.length===0&&a.jsxs("div",{className:"text-center py-8 text-slate-500 text-sm",children:["Nenhum conhecimento cadastrado para este setor.",a.jsx("br",{}),"Adicione acima."]})]})]})]})}function I0e(){return a.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center gap-3",children:[a.jsx(ys,{size:40,className:"text-slate-600"}),a.jsx("p",{className:"text-slate-400 text-sm font-medium",children:"Performance"}),a.jsx("p",{className:"text-slate-600 text-xs max-w-xs",children:"Métricas de tempo de resposta, taxa de resolução e satisfação serão exibidas aqui após a Human API entrar em operação."})]})}function L0e(){const[e,t]=b.useState([]),[n,r]=b.useState(null),[s,i]=b.useState(""),[o,l]=b.useState(!1),[c,u]=b.useState(!1);b.useEffect(()=>{Promise.all([Zn.list(),Hc.get()]).then(([f,p])=>{t(Array.isArray(f)?f:[]),p.linkedAccount&&(r(p.linkedAccount),i(String(p.linkedAccount.id)))}).catch(()=>{})},[]);async function d(){l(!0);try{await Hc.linkAccount(s?Number(s):null);const f=await Hc.get();r(f.linkedAccount??null),u(!0),setTimeout(()=>u(!1),2500)}catch{}finally{l(!1)}}return a.jsxs("div",{className:"max-w-md space-y-5",children:[a.jsxs("div",{className:"bg-slate-800 rounded-xl p-4 border border-slate-700",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[a.jsx(Go,{size:14,className:"text-cyan-400"}),a.jsx("h3",{className:"text-sm font-semibold text-white",children:"Identidade na Inbox Interna"})]}),a.jsx("p",{className:"text-xs text-slate-400 mb-4",children:"Vincule seu perfil de admin a uma conta de colaborador para receber e enviar mensagens na Inbox Interna sem fazer login duplo."}),n&&a.jsxs("div",{className:"flex items-center gap-2 mb-3 px-3 py-2 bg-cyan-900/30 border border-cyan-500/30 rounded-lg",children:[a.jsx(jt,{size:13,className:"text-cyan-400 flex-shrink-0"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-xs font-medium text-cyan-300",children:n.name}),a.jsxs("p",{className:"text-[11px] text-slate-400",children:[n.email," · ",n.role]})]})]}),a.jsx("label",{className:"block text-xs text-slate-400 mb-1",children:"Selecionar conta de colaborador"}),a.jsxs("select",{value:s,onChange:f=>i(f.target.value),className:"w-full bg-slate-900 border border-slate-600 rounded-lg px-3 py-2 text-sm text-white mb-3 outline-none focus:border-cyan-500",children:[a.jsx("option",{value:"",className:"bg-slate-900 text-white",children:"— Nenhum (desvinculado) —"}),e.map(f=>a.jsxs("option",{value:f.id,className:"bg-slate-900 text-white",children:[f.name," (",f.email,")"]},f.id))]}),a.jsxs("button",{onClick:d,disabled:o,className:"flex items-center gap-2 px-4 py-2 bg-cyan-600 hover:bg-cyan-700 disabled:opacity-50 text-white rounded-lg text-xs font-medium transition",children:[c?a.jsx(jt,{size:13}):a.jsx(Go,{size:13}),c?"Vinculado!":o?"Salvando...":"Salvar vínculo"]})]}),a.jsx("p",{className:"text-[11px] text-slate-500",children:"Após salvar, atualize a página. A Inbox Interna passará a usar sua identidade de colaborador automaticamente."})]})}const z0e=[{id:"contas",label:"Contas",Icon:et},{id:"setores",label:"Setores",Icon:AI},{id:"membros",label:"Membros",Icon:Tl},{id:"cerebros",label:"Cérebros",Icon:d1},{id:"performance",label:"Performance",Icon:ys},{id:"meu-perfil",label:"Meu Perfil",Icon:Go}];function B0e(){const[e,t]=b.useState("contas");return a.jsxs("div",{className:"flex flex-col h-full",children:[a.jsxs("div",{className:"flex-shrink-0 px-4 pt-4 pb-3 border-b border-slate-800",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[a.jsx(et,{size:16,className:"text-cyan-400"}),a.jsx("h2",{className:"text-sm font-semibold text-white",children:"Equipe"})]}),a.jsx("div",{className:"flex gap-1 overflow-x-auto pb-0.5",children:z0e.map(n=>a.jsxs("button",{onClick:()=>t(n.id),className:`flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg text-xs font-medium whitespace-nowrap transition flex-shrink-0
${e===n.id?"bg-cyan-600/20 text-cyan-400 border border-cyan-500/30":"text-slate-400 hover:text-white hover:bg-slate-800"}`,children:[a.jsx(n.Icon,{size:12}),n.label]},n.id))})]}),a.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto p-4",children:[e==="contas"&&a.jsx(T0e,{}),e==="setores"&&a.jsx(M0e,{}),e==="membros"&&a.jsx(R0e,{}),e==="cerebros"&&a.jsx(D0e,{}),e==="performance"&&a.jsx(I0e,{}),e==="meu-perfil"&&a.jsx(L0e,{})]})]})}function Dd(e={}){const{url:t="/api/sse",onConnected:n,onReconnecting:r}=e,s=b.useRef(null),i=b.useRef(new Map),o=b.useRef(1e3),l=b.useRef(null),c=b.useRef(!0),u=b.useCallback((h,m)=>{var v;(v=i.current.get(h))==null||v.forEach(x=>{try{x(m)}catch{}})},[]),d=b.useCallback(()=>{if(!c.current)return;s.current&&(s.current.close(),s.current=null);const h=new EventSource(t,{withCredentials:!0});s.current=h,h.addEventListener("connected",()=>{o.current=1e3,n==null||n()});const m=x=>{try{const y=JSON.parse(x.data);u(x.type,y)}catch{u(x.type,x.data)}};["dm.new","presence.change","human_api.new","human_api.timeout","human_api.answered","handoff.expired","sla.breach","thread.new"].forEach(x=>h.addEventListener(x,m)),h.onerror=()=>{if(h.close(),s.current=null,!c.current)return;r==null||r();const x=Math.min(o.current,3e4);o.current=Math.min(o.current*2,3e4),l.current=setTimeout(d,x)}},[t,n,r,u]);b.useEffect(()=>(c.current=!0,d(),()=>{var h;c.current=!1,l.current&&clearTimeout(l.current),(h=s.current)==null||h.close(),s.current=null}),[d]);const f=b.useCallback((h,m)=>{i.current.has(h)||i.current.set(h,new Set),i.current.get(h).add(m)},[]),p=b.useCallback((h,m)=>{var v;(v=i.current.get(h))==null||v.delete(m)},[]);return{addEventListener:f,removeEventListener:p}}const F0e={online:"bg-green-500",busy:"bg-yellow-500",offline:"bg-slate-300"},V0e={online:"Online",busy:"Ocupado",offline:"Offline"};function U0e({selected:e,onSelect:t,onStartDM:n,onNewDM:r}){const[s,i]=b.useState([]),[o,l]=b.useState(!0),[c,u]=b.useState(!1),[d,f]=b.useState(""),p=b.useRef([]);b.useEffect(()=>{p.current=s},[s]);const h=b.useCallback(async(g=!1)=>{g?u(!0):l(!0);try{const j=await Ac.getColleagues();i(Array.isArray(j)?j:[])}catch(j){console.error("Erro ao carregar colaboradores:",j)}finally{l(!1),u(!1)}},[]);b.useEffect(()=>{h()},[h]);const{addEventListener:m,removeEventListener:v}=Dd();b.useEffect(()=>{const g=N=>{const{accountId:w,availability:S}=N;i(k=>k.map(C=>C.id===Number(w)?{...C,availability:S}:C))},j=N=>{const{from:w}=N;i(S=>S.map(k=>k.id===w?{...k,unread_count:k.unread_count+1}:k)),r==null||r(w)};return m("presence.change",g),m("dm.new",j),()=>{v("presence.change",g),v("dm.new",j)}},[m,v,r]);const y=[...s.filter(g=>g.name.toLowerCase().includes(d.toLowerCase())||g.email.toLowerCase().includes(d.toLowerCase()))].sort((g,j)=>{const N={online:0,busy:1,offline:2},w=(N[g.availability]??2)-(N[j.availability]??2);return w!==0?w:g.name.localeCompare(j.name,"pt-BR")});return a.jsxs("div",{className:"flex flex-col flex-1 min-h-0 bg-white",children:[a.jsxs("div",{className:"flex-shrink-0 px-3 pt-3 pb-2 bg-[#f0f2f5] border-b border-[#e9edef]",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("h3",{className:"text-xs font-semibold text-[#667781] uppercase tracking-wide",children:"Colaboradores"}),a.jsx("button",{onClick:()=>h(!0),disabled:c,className:"p-1 rounded-full hover:bg-[#e9edef] transition text-[#8696a0] disabled:opacity-40",title:"Atualizar lista",children:a.jsx(ke,{size:11,className:c?"animate-spin":""})})]}),a.jsxs("div",{className:"relative",children:[a.jsx(Ir,{size:13,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-[#8696a0] pointer-events-none"}),a.jsx("input",{type:"text",placeholder:"Buscar...",value:d,onChange:g=>f(g.target.value),className:"w-full bg-white border border-[#d1d7db] rounded-lg pl-8 pr-2.5 py-1.5 text-[12px] text-[#111b21] placeholder:text-[#8696a0] focus:outline-none focus:ring-1 focus:ring-[#00a884]"})]})]}),a.jsx("div",{className:"flex-1 overflow-y-auto",children:o?a.jsx("div",{className:"text-center py-8 text-[#8696a0] text-[12px]",children:"Carregando..."}):y.length===0?a.jsx("div",{className:"text-center py-8 text-[#8696a0] text-[12px]",children:d?"Nenhum colaborador encontrado":"Nenhum colaborador"}):y.map(g=>a.jsxs("button",{onClick:()=>t(g),className:`w-full text-left flex items-center gap-2.5 px-3 py-2.5 border-b border-[#f0f2f5] hover:bg-[#f5f6f6] transition-colors
${e===g.id?"bg-[#e7f5ff] border-l-4 border-l-[#00a884]":""}`,children:[a.jsxs("div",{className:"relative flex-shrink-0",children:[g.avatar_url?a.jsx("img",{src:g.avatar_url,alt:g.name,className:"w-9 h-9 rounded-full object-cover"}):a.jsx("div",{className:"w-9 h-9 rounded-full bg-[#dfe5e7] flex items-center justify-center text-[#54656f] text-[12px] font-semibold",children:g.name.charAt(0).toUpperCase()}),a.jsx("span",{className:`absolute bottom-0 right-0 w-2.5 h-2.5 rounded-full border-2 border-white ${F0e[g.availability]??"bg-slate-300"}`})]}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center justify-between gap-1",children:[a.jsx("span",{className:"text-[13px] font-medium text-[#111b21] truncate leading-tight",children:g.name}),g.unread_count>0&&a.jsx("span",{className:"flex-shrink-0 bg-[#25d366] text-white text-[9px] font-bold min-w-[16px] h-4 px-0.5 rounded-full flex items-center justify-center",children:g.unread_count>9?"9+":g.unread_count})]}),a.jsx("p",{className:`text-[11px] truncate leading-tight ${g.availability==="online"?"text-green-600":g.availability==="busy"?"text-yellow-600":"text-[#8696a0]"}`,children:V0e[g.availability]})]}),a.jsx("button",{onClick:j=>{j.stopPropagation(),n(g)},className:"flex-shrink-0 p-1.5 rounded-lg text-[#8696a0] hover:bg-[#e9edef] hover:text-[#00a884] transition",title:"Enviar mensagem",children:a.jsx(rn,{size:13})})]},g.id))})]})}const W0e={online:"Online",busy:"Ocupado",away:"Ausente",offline:"Offline"};function MC({name:e,url:t,size:n=8}){const r=`w-${n} h-${n}`;if(t)return a.jsx("img",{src:t,className:`${r} rounded-full object-cover flex-shrink-0`});const s=e?e.charAt(0).toUpperCase():"?";return a.jsx("div",{className:`${r} rounded-full bg-[#dfe5e7] flex items-center justify-center text-[#54656f] text-xs font-semibold flex-shrink-0`,children:s})}function q0e(e){const t=new Date(e),r=(new Date().getTime()-t.getTime())/1e3;return r<60?"agora":r<3600?`${Math.floor(r/60)}m`:r<86400?t.toLocaleTimeString("pt-BR",{hour:"2-digit",minute:"2-digit"}):t.toLocaleDateString("pt-BR",{day:"2-digit",month:"2-digit"})}function H0e({colleague:e,accountId:t,onBack:n}){const[r,s]=b.useState([]),[i,o]=b.useState(!0),[l,c]=b.useState(""),[u,d]=b.useState(!1),f=b.useRef(null),{addEventListener:p,removeEventListener:h}=Dd(),m=b.useCallback(async()=>{o(!0);try{const x=await Ac.getConversation(e.id,50);if(s(x),x.length>0){const y=x.filter(g=>g.to_account===t&&!g.read_at);for(const g of y)await Ac.markAsRead(g.id)}}finally{o(!1)}},[e.id,t]);b.useEffect(()=>{m()},[]),b.useEffect(()=>{const x=y=>{const{id:g,from:j,to:N,content:w,created_at:S}=y;if(j!==e.id)return;const k={id:g,from_account:j,to_account:N,content:w,read_at:new Date().toISOString(),created_at:S};s(C=>[...C,k]),Ac.markAsRead(g).catch(()=>{})};return p("dm.new",x),()=>h("dm.new",x)},[p,h,e.id]),b.useEffect(()=>{var x;(x=f.current)==null||x.scrollIntoView({behavior:"smooth"})},[r]);async function v(){if(!l.trim())return;d(!0);const x=l.trim();c("");try{const y=await Ac.send(e.id,x);s(g=>[...g,y])}catch{c(x)}finally{d(!1)}}return a.jsxs("div",{className:"flex flex-col h-full bg-[#f0f2f5]",children:[a.jsxs("div",{className:"flex-shrink-0 px-3 py-3 bg-white border-b border-[#e9edef] flex items-center gap-2",children:[a.jsx("button",{onClick:n,className:"p-1 rounded-full hover:bg-[#e9edef] transition text-[#54656f]",children:a.jsx(Ui,{size:18})}),a.jsx(MC,{name:e.name,url:e.avatar_url,size:8}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-sm font-medium text-[#111b21] truncate",children:e.name}),a.jsx("p",{className:"text-[11px] text-[#8696a0]",children:W0e[e.availability]})]}),a.jsx("button",{onClick:m,className:"p-1.5 rounded-full hover:bg-[#e9edef] transition text-[#8696a0]",children:a.jsx(ke,{size:13,className:i?"animate-spin":""})})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto p-3 space-y-2",children:[i&&r.length===0?a.jsx("div",{className:"text-center py-8 text-[#8696a0] text-sm",children:"Carregando conversa..."}):r.length===0?a.jsx("div",{className:"text-center py-8 text-[#8696a0] text-sm",children:"Nenhuma mensagem ainda. Comece uma conversa!"}):r.map(x=>{const y=x.from_account===t;return a.jsxs("div",{className:`flex gap-2 ${y?"flex-row-reverse":""}`,children:[!y&&a.jsx(MC,{name:e.name,url:e.avatar_url,size:7}),a.jsxs("div",{className:`max-w-[82%] flex flex-col gap-0.5 ${y?"items-end":"items-start"}`,children:[a.jsx("div",{className:`px-3 py-2 rounded-2xl text-[13px] leading-relaxed whitespace-pre-wrap shadow-sm
${y?"bg-[#d9fdd3] text-[#111b21] rounded-tr-sm":"bg-white text-[#111b21] rounded-tl-sm"}`,children:x.content}),a.jsx("p",{className:"text-[10px] text-[#8696a0] px-1",children:q0e(x.created_at)})]})]},x.id)}),a.jsx("div",{ref:f})]}),a.jsx("div",{className:"flex-shrink-0 px-3 py-2 bg-white border-t border-[#e9edef]",children:a.jsxs("div",{className:"flex gap-2 items-end",children:[a.jsx("textarea",{value:l,onChange:x=>c(x.target.value),onKeyDown:x=>{x.key==="Enter"&&!x.shiftKey&&(x.preventDefault(),v())},rows:1,placeholder:"Digite uma mensagem",className:"flex-1 bg-[#f0f2f5] border-0 rounded-xl px-3 py-2.5 text-[13px] text-[#111b21] placeholder-[#8696a0] focus:outline-none resize-none",style:{minHeight:40,maxHeight:100}}),a.jsx("button",{onClick:v,disabled:u||!l.trim(),className:"p-2.5 bg-[#00a884] hover:bg-[#008f72] disabled:opacity-40 text-white rounded-full transition flex-shrink-0",children:a.jsx(Rr,{size:15})})]})})]})}function RC({name:e,url:t,size:n=7}){const r=`w-${n} h-${n}`;if(t)return a.jsx("img",{src:t,className:`${r} rounded-full object-cover flex-shrink-0`});const s=e?e.charAt(0).toUpperCase():"?";return a.jsx("div",{className:`${r} rounded-full bg-[#dfe5e7] flex items-center justify-center text-[#54656f] text-xs font-semibold flex-shrink-0`,children:s})}function K0e(e){const t=new Date(e),r=(new Date().getTime()-t.getTime())/1e3;return r<60?"agora":r<3600?`${Math.floor(r/60)}m`:r<86400?t.toLocaleTimeString("pt-BR",{hour:"2-digit",minute:"2-digit"}):t.toLocaleDateString("pt-BR",{day:"2-digit",month:"2-digit"})}function G0e({group:e,accountId:t,onBack:n}){const[r,s]=b.useState([]),[i,o]=b.useState(!0),[l,c]=b.useState(""),[u,d]=b.useState(!1),[f,p]=b.useState(!1),[h,m]=b.useState([]),v=b.useRef(null),{addEventListener:x,removeEventListener:y}=Dd(),g=b.useCallback(async()=>{o(!0);try{const S=await Kc.getMessages(e.id,50);s(S)}finally{o(!1)}},[e.id]);b.useEffect(()=>{g()},[g]),b.useEffect(()=>{const S=k=>{const C=k;if(C.group_chat_id!==e.id||C.from===t)return;const _={id:C.id,from_account:C.from,content:C.content,created_at:C.created_at,sender_name:null,sender_avatar:null};s(A=>[...A,_])};return x("group_message.new",S),()=>y("group_message.new",S)},[x,y,e.id,t]),b.useEffect(()=>{var S;(S=v.current)==null||S.scrollIntoView({behavior:"smooth"})},[r]);async function j(){if(!l.trim())return;d(!0);const S=l.trim();c("");try{const k=await Kc.sendMessage(e.id,S);s(C=>[...C,k])}catch{c(S)}finally{d(!1)}}async function N(){if(!f&&h.length===0){const S=await Kc.getMembers(e.id);m(S)}p(S=>!S)}const w={online:"bg-green-500",busy:"bg-yellow-500",offline:"bg-slate-300"};return a.jsxs("div",{className:"flex flex-col h-full bg-[#f0f2f5]",children:[a.jsxs("div",{className:"flex-shrink-0 px-3 py-3 bg-white border-b border-[#e9edef] flex items-center gap-2",children:[a.jsx("button",{onClick:n,className:"p-1 rounded-full hover:bg-[#e9edef] transition text-[#54656f]",children:a.jsx(Ui,{size:18})}),a.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-sm font-bold flex-shrink-0",style:{backgroundColor:e.color},children:e.name.charAt(0).toUpperCase()}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-sm font-medium text-[#111b21] truncate",children:e.name}),a.jsx("p",{className:"text-[11px] text-[#8696a0]",children:"Grupo · setor"})]}),a.jsx("button",{onClick:N,className:`p-1.5 rounded-full transition ${f?"bg-[#e9edef] text-[#00a884]":"hover:bg-[#e9edef] text-[#8696a0]"}`,title:"Ver membros",children:a.jsx(et,{size:15})})]}),f&&a.jsxs("div",{className:"flex-shrink-0 bg-white border-b border-[#e9edef] px-3 py-2",children:[a.jsx("p",{className:"text-[11px] font-semibold text-[#667781] uppercase mb-1.5",children:"Membros"}),a.jsxs("div",{className:"flex flex-wrap gap-2",children:[h.map(S=>a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsxs("div",{className:"relative",children:[a.jsx(RC,{name:S.name,url:S.avatar_url,size:6}),a.jsx("span",{className:`absolute bottom-0 right-0 w-2 h-2 rounded-full border border-white ${w[S.availability]??"bg-slate-300"}`})]}),a.jsx("span",{className:"text-[12px] text-[#111b21]",children:S.name})]},S.id)),h.length===0&&a.jsx("span",{className:"text-[12px] text-[#8696a0]",children:"Nenhum membro"})]})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto p-3 space-y-2",children:[i&&r.length===0?a.jsx("div",{className:"text-center py-8 text-[#8696a0] text-sm",children:"Carregando mensagens..."}):r.length===0?a.jsx("div",{className:"text-center py-8 text-[#8696a0] text-sm",children:"Nenhuma mensagem ainda. Inicie a conversa do setor!"}):r.map(S=>{const k=S.from_account===t;return a.jsxs("div",{className:`flex gap-2 ${k?"flex-row-reverse":""}`,children:[!k&&a.jsx(RC,{name:S.sender_name,url:S.sender_avatar,size:7}),a.jsxs("div",{className:`max-w-[82%] flex flex-col gap-0.5 ${k?"items-end":"items-start"}`,children:[!k&&S.sender_name&&a.jsx("p",{className:"text-[11px] font-semibold text-[#54656f] px-1",children:S.sender_name}),a.jsx("div",{className:`px-3 py-2 rounded-2xl text-[13px] leading-relaxed whitespace-pre-wrap shadow-sm
${k?"bg-[#d9fdd3] text-[#111b21] rounded-tr-sm":"bg-white text-[#111b21] rounded-tl-sm"}`,children:S.content}),a.jsx("p",{className:"text-[10px] text-[#8696a0] px-1",children:K0e(S.created_at)})]})]},S.id)}),a.jsx("div",{ref:v})]}),a.jsx("div",{className:"flex-shrink-0 px-3 py-2 bg-white border-t border-[#e9edef]",children:a.jsxs("div",{className:"flex gap-2 items-end",children:[a.jsx("textarea",{value:l,onChange:S=>c(S.target.value),onKeyDown:S=>{S.key==="Enter"&&!S.shiftKey&&(S.preventDefault(),j())},rows:1,placeholder:`Mensagem para ${e.name}`,className:"flex-1 bg-[#f0f2f5] border-0 rounded-xl px-3 py-2.5 text-[13px] text-[#111b21] placeholder-[#8696a0] focus:outline-none resize-none",style:{minHeight:40,maxHeight:100}}),a.jsx("button",{onClick:j,disabled:u||!l.trim(),className:"p-2.5 bg-[#00a884] hover:bg-[#008f72] disabled:opacity-40 text-white rounded-full transition flex-shrink-0",children:a.jsx(Rr,{size:15})})]})})]})}function X0e(e){const t=new Date(e),r=(new Date().getTime()-t.getTime())/1e3;return r<60?"agora":r<3600?`${Math.floor(r/60)}m atrás`:r<86400?t.toLocaleTimeString("pt-BR",{hour:"2-digit",minute:"2-digit"}):t.toLocaleDateString("pt-BR",{day:"2-digit",month:"2-digit",year:"2-digit"})}function Y0e({name:e,url:t}){if(t)return a.jsx("img",{src:t,className:"w-7 h-7 rounded-full object-cover flex-shrink-0"});const n=e?e.charAt(0).toUpperCase():"?";return a.jsx("div",{className:"w-7 h-7 rounded-full bg-amber-100 flex items-center justify-center text-amber-700 text-xs font-semibold flex-shrink-0",children:n})}function Q0e({accountId:e,role:t,onNewBroadcast:n,onSeen:r}){const[s,i]=b.useState([]),[o,l]=b.useState(!0),[c,u]=b.useState(""),[d,f]=b.useState(!1),[p,h]=b.useState(!1),m=b.useRef(null),{addEventListener:v,removeEventListener:x}=Dd(),y=t==="owner"||t==="manager";b.useEffect(()=>{r==null||r()},[]);const g=b.useCallback(async()=>{l(!0);try{const{items:N}=await Gf.list();i([...N].reverse()),Gf.markSeen().catch(()=>{})}finally{l(!1)}},[]);b.useEffect(()=>{g()},[g]),b.useEffect(()=>{var N;(N=m.current)==null||N.scrollIntoView({behavior:"smooth"})},[s]),b.useEffect(()=>{const N=w=>{const S=w;if(S.from===e)return;const k={id:S.id,from_account:S.from,content:S.content,created_at:S.created_at,sender_name:null,sender_avatar:null};i(C=>[...C,k]),n==null||n(S.content)};return v("broadcast.sent",N),()=>x("broadcast.sent",N)},[v,x,e,n]);async function j(){if(!c.trim()||!y)return;f(!0);const N=c.trim();u(""),h(!1);try{const w=await Gf.send(N);i(S=>[...S,w])}catch{u(N)}finally{f(!1)}}return a.jsxs("div",{className:"flex flex-col h-full bg-[#f0f2f5]",children:[a.jsxs("div",{className:"flex-shrink-0 px-4 py-3 bg-white border-b border-[#e9edef] flex items-center gap-2",children:[a.jsx("div",{className:"w-8 h-8 rounded-full bg-amber-100 flex items-center justify-center flex-shrink-0",children:a.jsx(ju,{size:16,className:"text-amber-600"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-sm font-medium text-[#111b21]",children:"Broadcast"}),a.jsx("p",{className:"text-[11px] text-[#8696a0]",children:"Avisos para toda a equipe"})]}),a.jsx("button",{onClick:g,className:"p-1.5 rounded-full hover:bg-[#e9edef] transition text-[#8696a0]",children:a.jsx(ke,{size:13,className:o?"animate-spin":""})})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-3",children:[o&&s.length===0?a.jsx("div",{className:"text-center py-8 text-[#8696a0] text-sm",children:"Carregando..."}):s.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-[#8696a0] gap-2",children:[a.jsx(ju,{size:28,className:"opacity-30"}),a.jsx("p",{className:"text-[13px]",children:"Nenhum aviso ainda."}),y&&a.jsx("p",{className:"text-[11px]",children:"Use o campo abaixo para enviar um aviso para toda a equipe."})]}):s.map(N=>a.jsxs("div",{className:"bg-white rounded-xl shadow-sm border border-amber-100 px-4 py-3 flex gap-3",children:[a.jsx(Y0e,{name:N.sender_name,url:N.sender_avatar}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2 mb-0.5",children:[a.jsx("p",{className:"text-[12px] font-semibold text-amber-700",children:N.sender_name??"Sistema"}),a.jsx("span",{className:"text-[10px] text-[#8696a0] flex-shrink-0",children:X0e(N.created_at)})]}),a.jsx("p",{className:"text-[13px] text-[#111b21] leading-relaxed whitespace-pre-wrap",children:N.content})]})]},N.id)),a.jsx("div",{ref:m})]}),y&&a.jsxs("div",{className:"flex-shrink-0 bg-white border-t border-[#e9edef] px-4 py-3 space-y-2",children:[p&&a.jsxs("div",{className:"flex items-center gap-2 bg-amber-50 border border-amber-200 rounded-lg px-3 py-2",children:[a.jsx(Kt,{size:13,className:"text-amber-600 flex-shrink-0"}),a.jsxs("p",{className:"text-[12px] text-amber-700 flex-1",children:["Isso enviará um aviso para ",a.jsx("strong",{children:"todos os colaboradores"}),". Confirmar?"]}),a.jsx("button",{onClick:j,disabled:d,className:"px-3 py-1 bg-amber-500 hover:bg-amber-600 disabled:opacity-40 text-white text-[11px] font-semibold rounded-lg transition",children:d?"Enviando...":"Enviar"}),a.jsx("button",{onClick:()=>h(!1),className:"px-2 py-1 text-[11px] text-[#54656f] hover:bg-[#e9edef] rounded-lg transition",children:"Cancelar"})]}),a.jsxs("div",{className:"flex gap-2 items-end",children:[a.jsx("textarea",{value:c,onChange:N=>u(N.target.value),onKeyDown:N=>{N.key==="Enter"&&!N.shiftKey&&(N.preventDefault(),c.trim()&&h(!0))},rows:1,placeholder:"Aviso para toda a equipe...",className:"flex-1 bg-[#f0f2f5] border-0 rounded-xl px-3 py-2.5 text-[13px] text-[#111b21] placeholder-[#8696a0] focus:outline-none resize-none",style:{minHeight:40,maxHeight:100}}),a.jsx("button",{onClick:()=>{c.trim()&&h(!0)},disabled:d||!c.trim(),className:"p-2.5 bg-amber-500 hover:bg-amber-600 disabled:opacity-40 text-white rounded-full transition flex-shrink-0",children:a.jsx(Rr,{size:15})})]})]})]})}const DC=[{id:"overview",icon:a.jsx(Pr,{size:28}),color:"from-[#00a884] to-[#008f72]",title:"Inbox Interna",subtitle:"Central de comunicação da equipe",content:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("p",{className:"text-[14px] text-[#3b4a50] leading-relaxed",children:["O ",a.jsx("strong",{children:"Inbox Interna"})," centraliza toda a comunicação operacional da equipe em um único lugar — sem precisar sair do sistema."]}),a.jsx("div",{className:"grid grid-cols-2 gap-3",children:[{icon:a.jsx(Pr,{size:16}),label:"Inbox",desc:"Escalações e pedidos de ajuda da IA",color:"bg-cyan-50 text-cyan-700 border-cyan-100"},{icon:a.jsx(et,{size:16}),label:"Equipe",desc:"Mensagens diretas entre colaboradores",color:"bg-green-50 text-green-700 border-green-100"},{icon:a.jsx(rn,{size:16}),label:"Grupos",desc:"Chat por setor operacional",color:"bg-indigo-50 text-indigo-700 border-indigo-100"},{icon:a.jsx(ju,{size:16}),label:"Avisos",desc:"Comunicados para toda a equipe",color:"bg-amber-50 text-amber-700 border-amber-100"}].map(e=>a.jsxs("div",{className:`flex flex-col gap-1.5 p-3 rounded-xl border ${e.color}`,children:[a.jsxs("div",{className:"flex items-center gap-2 font-semibold text-[13px]",children:[e.icon,e.label]}),a.jsx("p",{className:"text-[11px] opacity-80 leading-snug",children:e.desc})]},e.label))}),a.jsxs("div",{className:"flex items-start gap-2 bg-[#f0fdf4] border border-green-100 rounded-xl px-3 py-2.5",children:[a.jsx(Mo,{size:14,className:"text-green-600 flex-shrink-0 mt-0.5"}),a.jsx("p",{className:"text-[12px] text-green-800",children:"Tudo em tempo real — mensagens chegam instantaneamente sem precisar recarregar a página."})]})]})},{id:"inbox",icon:a.jsx(ra,{size:28}),color:"from-cyan-500 to-cyan-700",title:"Aba Inbox",subtitle:"Escalações e pedidos da IA",content:a.jsxs("div",{className:"space-y-4",children:[a.jsx("p",{className:"text-[14px] text-[#3b4a50] leading-relaxed",children:"O Inbox reúne situações que precisam de atenção humana — geradas automaticamente pela IA ou pelos próprios colaboradores."}),a.jsx("div",{className:"space-y-2.5",children:[{icon:a.jsx(Kt,{size:15,className:"text-amber-500"}),type:"Escalação",desc:"Cliente pediu para falar com um humano no WhatsApp. A IA pausa e aguarda você responder.",bg:"bg-amber-50 border-amber-100"},{icon:a.jsx(ra,{size:15,className:"text-cyan-500"}),type:"Human API",desc:"A IA não soube responder e pediu ajuda. Você responde aqui e ela continua a conversa com o cliente.",bg:"bg-cyan-50 border-cyan-100"},{icon:a.jsx(Ol,{size:15,className:"text-orange-500"}),type:"Pedido de Ajuda",desc:"Um colaborador abriu uma dúvida interna sobre um procedimento ou pedido.",bg:"bg-orange-50 border-orange-100"},{icon:a.jsx(x1,{size:15,className:"text-slate-500"}),type:"Mensagem / Sistema",desc:"Anotações de contexto sobre protocolos e avisos automáticos do sistema.",bg:"bg-slate-50 border-slate-100"}].map(e=>a.jsxs("div",{className:`flex gap-3 p-3 rounded-xl border ${e.bg}`,children:[a.jsx("div",{className:"mt-0.5 flex-shrink-0",children:e.icon}),a.jsxs("div",{children:[a.jsx("p",{className:"text-[12px] font-semibold text-[#111b21]",children:e.type}),a.jsx("p",{className:"text-[11px] text-[#54656f] leading-snug mt-0.5",children:e.desc})]})]},e.type))})]})},{id:"equipe",icon:a.jsx(et,{size:28}),color:"from-[#25d366] to-[#128c7e]",title:"Aba Equipe",subtitle:"Mensagens diretas entre colaboradores",content:a.jsxs("div",{className:"space-y-4",children:[a.jsx("p",{className:"text-[14px] text-[#3b4a50] leading-relaxed",children:"Converse diretamente com qualquer colega — como um WhatsApp interno. As mensagens chegam em tempo real com badge de não lidas."}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"bg-[#f0f2f5] rounded-2xl p-3 space-y-2",children:[a.jsxs("div",{className:"flex items-end gap-2",children:[a.jsx("div",{className:"w-6 h-6 rounded-full bg-indigo-400 flex items-center justify-center text-white text-[10px] font-bold flex-shrink-0",children:"M"}),a.jsx("div",{className:"bg-white rounded-2xl rounded-bl-sm px-3 py-1.5 text-[12px] text-[#111b21] shadow-sm max-w-[75%]",children:"Monique, o pedido #456 está separado?"})]}),a.jsxs("div",{className:"flex items-end justify-end gap-2",children:[a.jsx("div",{className:"bg-[#d9fdd3] rounded-2xl rounded-br-sm px-3 py-1.5 text-[12px] text-[#111b21] shadow-sm max-w-[75%]",children:"Sim! Já encaminhei para embalagem 👍"}),a.jsx("div",{className:"w-6 h-6 rounded-full bg-[#00a884] flex items-center justify-center text-white text-[10px] font-bold flex-shrink-0",children:"V"})]})]}),a.jsx("div",{className:"space-y-2",children:["Clique em um colaborador na coluna esquerda para abrir o chat","Badge verde mostra quantas mensagens não foram lidas","Indicador de presença: verde = online, amarelo = ocupado"].map((e,t)=>a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx(Ts,{size:13,className:"text-[#00a884] flex-shrink-0 mt-0.5"}),a.jsx("p",{className:"text-[12px] text-[#3b4a50]",children:e})]},t))})]})]})},{id:"grupos",icon:a.jsx(rn,{size:28}),color:"from-indigo-500 to-indigo-700",title:"Aba Grupos",subtitle:"Canal de comunicação por setor",content:a.jsxs("div",{className:"space-y-4",children:[a.jsx("p",{className:"text-[14px] text-[#3b4a50] leading-relaxed",children:"Cada setor operacional tem um grupo dedicado — criado automaticamente. É o canal do turno: dúvidas, alinhamentos e avisos do setor."}),a.jsxs("div",{className:"bg-indigo-50 border border-indigo-100 rounded-xl p-3 space-y-2",children:[a.jsx("p",{className:"text-[11px] font-semibold text-indigo-700 uppercase tracking-wide",children:"Grupos criados automaticamente"}),a.jsx("div",{className:"grid grid-cols-3 gap-1.5",children:["Cotação","Separação","Embalagem","Auditoria","Fiscal","Expedição"].map((e,t)=>{const n=["#6366f1","#f59e0b","#10b981","#ef4444","#8b5cf6","#3b82f6"];return a.jsxs("div",{className:"flex items-center gap-1.5 bg-white rounded-lg px-2 py-1.5 border border-indigo-100",children:[a.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-white text-[9px] font-bold flex-shrink-0",style:{backgroundColor:n[t]},children:e[0]}),a.jsx("span",{className:"text-[11px] text-[#111b21] font-medium truncate",children:e})]},e)})})]}),a.jsxs("div",{className:"flex items-start gap-2 bg-slate-50 border border-slate-100 rounded-xl px-3 py-2.5",children:[a.jsx(RP,{size:13,className:"text-indigo-500 flex-shrink-0 mt-0.5"}),a.jsx("p",{className:"text-[12px] text-[#3b4a50]",children:"Você só vê os grupos dos setores em que está cadastrado. Owners e managers veem todos."})]})]})},{id:"avisos",icon:a.jsx(ju,{size:28}),color:"from-amber-500 to-orange-600",title:"Aba Avisos",subtitle:"Comunicados para toda a equipe",content:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("p",{className:"text-[14px] text-[#3b4a50] leading-relaxed",children:["Avisos chegam para ",a.jsx("strong",{children:"todos os colaboradores"})," do sistema ao mesmo tempo — ideal para comunicados urgentes e alinhamentos gerais."]}),a.jsxs("div",{className:"space-y-2.5",children:[a.jsxs("div",{className:"bg-amber-50 border border-amber-200 rounded-xl p-3",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[a.jsx("div",{className:"w-6 h-6 rounded-full bg-amber-200 flex items-center justify-center text-amber-700 text-[10px] font-bold",children:"G"}),a.jsx("span",{className:"text-[11px] font-semibold text-amber-700",children:"Gerente · agora"})]}),a.jsx("p",{className:"text-[13px] text-[#111b21]",children:"Sistema entra em manutenção em 10 minutos. Finalizem os pedidos em andamento."})]}),a.jsx("div",{className:"space-y-2",children:[{label:"Quem pode enviar",desc:"Apenas Owner e Manager",icon:"🔒"},{label:"Quem recebe",desc:"Todos os colaboradores conectados",icon:"📡"},{label:"Confirmação",desc:"Sistema pede confirmação antes de enviar",icon:"✅"}].map(e=>a.jsxs("div",{className:"flex items-center gap-3 bg-white border border-[#e9edef] rounded-xl px-3 py-2",children:[a.jsx("span",{className:"text-[16px]",children:e.icon}),a.jsxs("div",{children:[a.jsx("p",{className:"text-[12px] font-semibold text-[#111b21]",children:e.label}),a.jsx("p",{className:"text-[11px] text-[#8696a0]",children:e.desc})]})]},e.label))})]})]})},{id:"diferenca",icon:a.jsx(YP,{size:28}),color:"from-violet-500 to-indigo-600",title:"Inbox Interna vs Inbox Interno",subtitle:"Quando usar cada um?",content:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("p",{className:"text-[13px] text-[#3b4a50] leading-relaxed",children:["Existem ",a.jsx("strong",{children:"duas inboxes"})," diferentes no sistema. Cada uma tem um propósito distinto:"]}),a.jsxs("div",{className:"bg-[#f0fdf4] border border-[#00a884]/30 rounded-xl p-3 space-y-1.5",children:[a.jsxs("p",{className:"text-[12px] font-bold text-[#00a884] flex items-center gap-1.5",children:[a.jsx(rn,{size:13})," Inbox Interna (você está aqui)"]}),a.jsxs("p",{className:"text-[11px] text-[#3b4a50] leading-snug",children:["Para ",a.jsx("strong",{children:"atendimento ao cliente via WhatsApp"})," e comunicação entre atendentes."]}),a.jsx("div",{className:"space-y-1 mt-1",children:['🤖 "IA escalou — cliente quer falar com um humano"','💬 "Ei, você pode assumir o protocolo #884?"','📣 "Gerente: turno da tarde começa às 14h hoje"'].map((e,t)=>a.jsx("p",{className:"text-[11px] text-[#00a884] bg-[#00a884]/5 rounded-lg px-2.5 py-1.5 leading-snug",children:e},t))})]}),a.jsxs("div",{className:"bg-amber-50 border border-amber-200 rounded-xl p-3 space-y-1.5",children:[a.jsxs("p",{className:"text-[12px] font-bold text-amber-700 flex items-center gap-1.5",children:[a.jsx(bs,{size:13})," Inbox Interno → menu lateral"]}),a.jsxs("p",{className:"text-[11px] text-[#3b4a50] leading-snug",children:["Para comunicação sobre o ",a.jsx("strong",{children:"fluxo de pedidos"})," entre setores operacionais."]}),a.jsx("div",{className:"space-y-1 mt-1",children:['📦 "Pedido #1055 com item faltando — verificar estoque"','🧾 "NF do pedido #1098 com divergência de CFOP"','🚚 "Carga do turno pronta para expedição"'].map((e,t)=>a.jsx("p",{className:"text-[11px] text-amber-700 bg-amber-500/5 rounded-lg px-2.5 py-1.5 leading-snug",children:e},t))})]}),a.jsx("p",{className:"text-[11px] text-[#8696a0] text-center",children:"Regra rápida: cliente/atendente → aqui · pedido/setor → Inbox Interno"})]})}];function J0e({total:e,current:t,onGo:n}){return a.jsx("div",{className:"flex items-center gap-1.5",children:Array.from({length:e}).map((r,s)=>a.jsx("button",{onClick:()=>n(s),className:`rounded-full transition-all duration-200 ${s===t?"w-5 h-2 bg-[#00a884]":"w-2 h-2 bg-[#d1d7db] hover:bg-[#8696a0]"}`},s))})}function Z0e({onClose:e}){const[t,n]=b.useState(0),r=DC.length,s=DC[t],i=b.useCallback(()=>n(l=>Math.min(l+1,r-1)),[r]),o=b.useCallback(()=>n(l=>Math.max(l-1,0)),[]);return b.useEffect(()=>{const l=c=>{c.key==="Escape"&&e(),c.key==="ArrowRight"&&i(),c.key==="ArrowLeft"&&o()};return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[e,i,o]),a.jsx("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center bg-black/40 backdrop-blur-sm p-4",onClick:l=>{l.target===l.currentTarget&&e()},children:a.jsxs("div",{className:"bg-white rounded-2xl shadow-2xl w-full max-w-md overflow-hidden flex flex-col",style:{maxHeight:"90vh"},children:[a.jsxs("div",{className:`bg-gradient-to-br ${s.color} px-6 pt-6 pb-5 relative flex-shrink-0`,children:[a.jsx("button",{onClick:e,className:"absolute top-4 right-4 p-1.5 rounded-full bg-white/20 hover:bg-white/30 text-white transition",children:a.jsx(Ce,{size:14})}),a.jsxs("div",{className:"flex items-start gap-4",children:[a.jsx("div",{className:"w-12 h-12 rounded-2xl bg-white/20 flex items-center justify-center text-white flex-shrink-0",children:s.icon}),a.jsxs("div",{className:"flex-1 min-w-0 pt-0.5",children:[a.jsxs("p",{className:"text-white/70 text-[11px] font-medium uppercase tracking-widest",children:[t+1," de ",r]}),a.jsx("h2",{className:"text-white text-[18px] font-bold leading-tight mt-0.5",children:s.title}),a.jsx("p",{className:"text-white/80 text-[12px] mt-0.5",children:s.subtitle})]})]})]}),a.jsx("div",{className:"flex-1 overflow-y-auto px-6 py-5 min-h-0",children:s.content}),a.jsxs("div",{className:"flex-shrink-0 flex items-center justify-between px-6 py-4 border-t border-[#e9edef] bg-[#f8f9fa]",children:[a.jsxs("button",{onClick:o,disabled:t===0,className:"flex items-center gap-1.5 px-4 py-2 rounded-xl text-[12px] font-medium text-[#54656f] hover:bg-[#e9edef] disabled:opacity-30 disabled:cursor-not-allowed transition",children:[a.jsx(xd,{size:15}),"Anterior"]}),a.jsx(J0e,{total:r,current:t,onGo:n}),t<r-1?a.jsxs("button",{onClick:i,className:"flex items-center gap-1.5 px-4 py-2 rounded-xl text-[12px] font-medium bg-[#00a884] hover:bg-[#008f72] text-white transition",children:["Próximo",a.jsx(Pa,{size:15})]}):a.jsxs("button",{onClick:e,className:"flex items-center gap-1.5 px-4 py-2 rounded-xl text-[12px] font-medium bg-[#00a884] hover:bg-[#008f72] text-white transition",children:[a.jsx(Ts,{size:14}),"Entendido"]})]})]})})}const IC={"dm.new":{Icon:rn,color:"bg-[#00a884]",border:"border-[#008f72]"},"human_api.new":{Icon:ra,color:"bg-cyan-500",border:"border-cyan-600"},"human_api.timeout":{Icon:ra,color:"bg-slate-500",border:"border-slate-600"},"sla.breach":{Icon:Kt,color:"bg-red-500",border:"border-red-600"},"handoff.expired":{Icon:Kt,color:"bg-amber-500",border:"border-amber-600"},generic:{Icon:Ol,color:"bg-[#54656f]",border:"border-[#3b4a50]"}},LC=5e3;function ege({notif:e,onDismiss:t}){const n=IC[e.type]||IC.generic,{Icon:r,color:s,border:i}=n,o=b.useRef(null);return b.useEffect(()=>{const l=o.current;l&&(l.style.transition="none",l.style.width="100%",l.offsetWidth,l.style.transition=`width ${LC}ms linear`,l.style.width="0%")},[]),b.useEffect(()=>{const l=setTimeout(t,LC);return()=>clearTimeout(l)},[t]),a.jsxs("div",{className:`relative flex items-start gap-3 w-80 bg-white rounded-xl shadow-xl border ${i} overflow-hidden`,style:{borderLeftWidth:4},children:[a.jsx("div",{ref:o,className:`absolute bottom-0 left-0 h-0.5 ${s}`,style:{width:"100%"}}),a.jsx("div",{className:`flex-shrink-0 flex items-center justify-center w-9 h-9 rounded-lg ${s} text-white ml-3 mt-3`,children:a.jsx(r,{size:16})}),a.jsxs("div",{className:"flex-1 min-w-0 py-3 pr-2",children:[a.jsx("p",{className:"text-[13px] font-semibold text-[#111b21] truncate",children:e.title}),a.jsx("p",{className:"text-[12px] text-[#667781] mt-0.5 line-clamp-2",children:e.body})]}),a.jsx("button",{onClick:t,className:"flex-shrink-0 p-1.5 mt-2 mr-2 text-[#8696a0] hover:text-[#111b21] hover:bg-[#f0f2f5] rounded-lg transition",children:a.jsx(Ce,{size:13})})]})}function tge({notifications:e,onDismiss:t}){return e.length===0?null:a.jsx("div",{className:"fixed bottom-4 right-4 z-[9999] flex flex-col gap-2 items-end",children:e.map(n=>a.jsx(ege,{notif:n,onDismiss:()=>t(n.id)},n.id))})}function nge(){const[e,t]=b.useState([]),n=b.useCallback(s=>{const i=`${Date.now()}-${Math.random().toString(36).slice(2,7)}`;t(o=>[...o.slice(-4),{...s,id:i,at:Date.now()}])},[]),r=b.useCallback(s=>{t(i=>i.filter(o=>o.id!==s))},[]);return{notifications:e,push:n,dismiss:r}}const Zc={human_api:{label:"Human API",Icon:ra,color:"text-cyan-500"},escalation:{label:"Escalação",Icon:Kt,color:"text-amber-500"},help_request:{label:"Ajuda",Icon:Ol,color:"text-orange-500"},collaboration:{label:"Mensagem",Icon:rn,color:"text-[#54656f]"},system:{label:"Sistema",Icon:v1,color:"text-[#8696a0]"}};function ub(e){const t=new Date(e),r=(new Date().getTime()-t.getTime())/1e3;return r<60?"agora":r<3600?`${Math.floor(r/60)}m`:r<86400?t.toLocaleTimeString("pt-BR",{hour:"2-digit",minute:"2-digit"}):t.toLocaleDateString("pt-BR",{day:"2-digit",month:"2-digit"})}function rge({name:e,url:t,size:n=8}){const r=`w-${n} h-${n}`;if(t)return a.jsx("img",{src:t,className:`${r} rounded-full object-cover flex-shrink-0`});const s=e?e.charAt(0).toUpperCase():"?";return a.jsx("div",{className:`${r} rounded-full bg-[#dfe5e7] flex items-center justify-center text-[#54656f] text-xs font-semibold flex-shrink-0`,children:s})}function age({thread:e,onClose:t,onDone:n}){const[r,s]=b.useState([]),[i,o]=b.useState(""),[l,c]=b.useState(""),[u,d]=b.useState(!1);b.useEffect(()=>{fetch("/api/admin/accounts",{credentials:"include"}).then(p=>p.json()).then(p=>s(Array.isArray(p)?p:p.accounts||[])).catch(()=>{})},[]);async function f(){if(i){d(!0);try{await v6.transfer({threadId:e.thread_id,toAccountId:Number(i),protocolNumber:e.ref_id||void 0,message:l.trim()||void 0}),n(),t()}catch{d(!1)}}}return a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",children:a.jsxs("div",{className:"bg-white rounded-2xl shadow-2xl w-[340px] p-6 flex flex-col gap-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h3",{className:"text-[14px] font-bold text-[#111b21]",children:"Transferir protocolo"}),a.jsx("button",{onClick:t,className:"text-[#8696a0] hover:text-[#111b21] transition",children:a.jsx(Ce,{size:16})})]}),e.ref_id&&a.jsxs("p",{className:"text-[12px] text-[#667781]",children:["Protocolo: ",a.jsxs("span",{className:"font-mono font-bold",children:["#",e.ref_id]})]}),a.jsxs("select",{value:i,onChange:p=>o(Number(p.target.value)),className:"w-full border border-[#d1d7db] rounded-xl px-3 py-2.5 text-[13px] text-[#111b21] outline-none focus:border-[#00a884]",children:[a.jsx("option",{value:"",children:"Selecione o atendente..."}),r.map(p=>a.jsxs("option",{value:p.id,children:[p.name," — ",p.email]},p.id))]}),a.jsx("textarea",{value:l,onChange:p=>c(p.target.value),placeholder:"Mensagem de contexto (opcional)",rows:3,className:"w-full border border-[#d1d7db] rounded-xl px-3 py-2 text-[13px] text-[#111b21] placeholder-[#8696a0] outline-none focus:border-[#00a884] resize-none"}),a.jsxs("button",{onClick:f,disabled:!i||u,className:"bg-[#00a884] hover:bg-[#008f72] disabled:opacity-40 text-white rounded-xl py-2.5 text-[13px] font-bold transition flex items-center justify-center gap-2",children:[a.jsx(h1,{size:15}),u?"Transferindo...":"Transferir"]})]})})}function sge({thread:e,accountId:t,onBack:n,onRefresh:r}){const[s,i]=b.useState([]),[o,l]=b.useState(!0),[c,u]=b.useState(""),[d,f]=b.useState(!1),[p,h]=b.useState(!1),[m,v]=b.useState(!1),[x,y]=b.useState(""),[g,j]=b.useState(!1),[N,w]=b.useState(!1),[S,k]=b.useState(!1),C=b.useRef(null),_=b.useCallback(async()=>{l(!0);try{const R=await Gc.getThread(e.thread_id);i(R),t&&await Gc.markRead(e.thread_id,t)}finally{l(!1)}},[e.thread_id,t]);b.useEffect(()=>{_()},[_]),b.useEffect(()=>{var R;(R=C.current)==null||R.scrollIntoView({behavior:"smooth"})},[s]);async function A(){if(c.trim()){f(!0);try{e.type==="human_api"&&e.ref_id?await vfe.answer(Number(e.ref_id),c.trim()):await Gc.postMessage({thread_id:e.thread_id,from_account:t||void 0,sector_id:e.sector_id||void 0,type:e.type,content:c.trim(),ref_id:e.ref_id||void 0}),u(""),_(),r()}finally{f(!1)}}}async function E(R){j(!0);try{await h4.flag({threadId:e.thread_id,type:R,note:x.trim()||void 0}),v(!1),y(""),_(),r()}finally{j(!1)}}async function P(R){if(R){w(!0);try{await h4.close({threadId:e.thread_id,chatId:R,protocolNumber:e.ref_id||void 0}),_(),r()}finally{w(!1)}}}async function D(){var W,T;const R=(W=s.find(V=>!V.from_account))==null?void 0:W.content,M=(T=s.filter(V=>V.from_account).pop())==null?void 0:T.content;if(M){k(!0);try{const V=await m4.save({question:R||e.ref_id||"Consulta",answer:M,sectorId:e.sector_id||void 0});window.confirm("Resposta salva! Promover para Base de Conhecimento do setor agora?")&&await m4.promote(V.id)}finally{k(!1)}}}const I=Zc[e.type]||Zc.collaboration;return a.jsxs("div",{className:"flex flex-col h-full bg-[#f0f2f5]",children:[a.jsxs("div",{className:"flex-shrink-0 px-3 py-3 bg-[#f0f2f5] border-b border-[#e9edef] flex items-center gap-2",children:[a.jsx("button",{onClick:n,className:"p-1 rounded-full hover:bg-[#e9edef] transition text-[#54656f]",children:a.jsx(Ui,{size:18})}),a.jsx(I.Icon,{size:15,className:I.color}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("p",{className:"text-sm font-medium text-[#111b21] truncate",children:[I.label,e.sector_name&&a.jsxs("span",{className:"text-[#8696a0]",children:[" · ",e.sector_name]})]}),e.ref_id&&a.jsxs("p",{className:"text-[10px] text-[#8696a0]",children:["#",e.ref_id]})]}),e.type==="human_api"&&a.jsx("button",{onClick:D,disabled:S,title:"Salvar resposta no Brain",className:"p-1.5 rounded-full hover:bg-[#e9edef] transition text-cyan-500 disabled:opacity-40",children:a.jsx(d1,{size:15})}),a.jsx("button",{onClick:()=>v(R=>!R),title:"Registrar flag",className:`p-1.5 rounded-full hover:bg-[#e9edef] transition ${m?"text-amber-500":"text-[#8696a0]"}`,children:a.jsx(ev,{size:15})}),a.jsx("button",{onClick:()=>h(!0),title:"Transferir protocolo",className:"p-1.5 rounded-full hover:bg-[#e9edef] transition text-[#8696a0]",children:a.jsx(h1,{size:15})}),a.jsx("button",{onClick:_,className:"p-1.5 rounded-full hover:bg-[#e9edef] transition text-[#8696a0]",children:a.jsx(ke,{size:13,className:o?"animate-spin":""})})]}),p&&a.jsx(age,{thread:e,onClose:()=>h(!1),onDone:()=>{_(),r()}}),m&&a.jsxs("div",{className:"flex-shrink-0 px-3 py-2 bg-amber-50 border-b border-amber-200",children:[a.jsxs("p",{className:"text-[11px] font-semibold text-amber-700 mb-1.5 flex items-center gap-1",children:[a.jsx(ev,{size:10})," Registrar flag neste protocolo"]}),a.jsx("input",{value:x,onChange:R=>y(R.target.value),placeholder:"Observação (opcional)",className:"w-full border border-amber-200 rounded-lg px-2.5 py-1.5 text-[12px] mb-1.5 outline-none focus:border-amber-400 bg-white"}),a.jsx("div",{className:"flex gap-1.5",children:[["complaint","🔴 Reclamação"],["suggestion","💡 Sugestão"],["compliment","⭐ Elogio"]].map(([R,M])=>a.jsx("button",{onClick:()=>E(R),disabled:g,className:"flex-1 text-[11px] font-medium py-1 rounded-lg border border-amber-200 bg-white hover:bg-amber-100 text-amber-800 disabled:opacity-40 transition",children:M},R))})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto p-3 space-y-2",children:[o&&s.length===0?a.jsx("div",{className:"text-center py-8 text-[#8696a0] text-sm",children:"Carregando..."}):s.map(R=>{const M=t&&R.from_account===t,W=!R.from_account;return a.jsxs("div",{className:`flex gap-2 ${M?"flex-row-reverse":""}`,children:[!M&&a.jsx(rge,{name:R.from_name,url:R.from_avatar,size:7}),a.jsxs("div",{className:`max-w-[82%] flex flex-col gap-0.5 ${M?"items-end":"items-start"}`,children:[!M&&!W&&a.jsx("p",{className:"text-[10px] text-[#8696a0] px-1",children:R.from_name||"Sistema"}),a.jsx("div",{className:`px-3 py-2 rounded-2xl text-[13px] leading-relaxed whitespace-pre-wrap shadow-sm
${W?"bg-[#fff3cd] border border-[#ffe69c] text-[#664d03] italic text-xs rounded-xl":M?"bg-[#d9fdd3] text-[#111b21] rounded-tr-sm":"bg-white text-[#111b21] rounded-tl-sm"}`,children:R.content}),a.jsx("p",{className:"text-[10px] text-[#8696a0] px-1",children:ub(R.created_at)})]})]},R.id)}),a.jsx("div",{ref:C})]}),a.jsxs("div",{className:"flex-shrink-0 px-3 py-2 bg-[#f0f2f5] border-t border-[#e9edef]",children:[e.type==="human_api"&&a.jsxs("p",{className:"text-[11px] text-cyan-600 mb-1.5 flex items-center gap-1",children:[a.jsx(ra,{size:11})," Sua resposta será entregue à IA para continuar o atendimento"]}),a.jsxs("div",{className:"flex gap-2 items-end",children:[a.jsx("textarea",{value:c,onChange:R=>u(R.target.value),onKeyDown:R=>{R.key==="Enter"&&!R.shiftKey&&(R.preventDefault(),A())},rows:1,placeholder:"Digite uma mensagem",className:"flex-1 bg-white border-0 rounded-xl px-3 py-2.5 text-[13px] text-[#111b21] placeholder-[#8696a0] focus:outline-none resize-none shadow-sm",style:{minHeight:40,maxHeight:100}}),a.jsx("button",{onClick:A,disabled:d||!c.trim(),className:"p-2.5 bg-[#00a884] hover:bg-[#008f72] disabled:opacity-40 text-white rounded-full transition flex-shrink-0",children:a.jsx(Rr,{size:15})})]}),e.type==="escalation"&&e.ref_id&&e.chat_id&&a.jsx("div",{className:"mt-1.5 flex justify-end",children:a.jsxs("button",{onClick:()=>P(e.chat_id),disabled:N,className:"flex items-center gap-1.5 px-3 py-1 text-[11px] font-medium text-[#54656f] hover:text-red-600 hover:bg-red-50 rounded-lg transition disabled:opacity-40",children:[a.jsx(Ts,{size:12}),N?"Encerrando...":"Encerrar protocolo"]})})]})]})}function ige({accountId:e,role:t="agent"}){const[n,r]=b.useState([]),[s,i]=b.useState(null),[o,l]=b.useState(null),[c,u]=b.useState([]),[d,f]=b.useState(null),[p,h]=b.useState(!1),[m,v]=b.useState(0),[x,y]=b.useState(!0),[g,j]=b.useState(""),[N,w]=b.useState("inbox"),[S,k]=b.useState(!1),{notifications:C,push:_,dismiss:A}=nge(),{addEventListener:E,removeEventListener:P}=Dd(),D=b.useRef(null),I=b.useRef(null),R=b.useRef(N);b.useEffect(()=>{D.current=o},[o]),b.useEffect(()=>{I.current=d},[d]),b.useEffect(()=>{R.current=N},[N]);const M=b.useCallback(async()=>{if(e){y(!0);try{const L=await Gc.listThreads(e);r(L)}finally{y(!1)}}},[e]),W=b.useCallback(async()=>{if(e){h(!0);try{const L=await Kc.list();u(L)}finally{h(!1)}}},[e]),T=b.useCallback(async()=>{if(e)try{const{unread_count:L}=await Gf.list();v(L)}catch{}},[e]);b.useEffect(()=>{M()},[M]),b.useEffect(()=>{W()},[W]),b.useEffect(()=>{T()},[T]),b.useEffect(()=>{const L=Z=>{var q;const{from:F,content:z}=Z;R.current==="colleagues"&&((q=D.current)==null?void 0:q.id)===F||_({type:"dm.new",title:"Nova mensagem",body:z})},B=Z=>{const{question:F}=Z;M(),_({type:"human_api.new",title:"IA precisa de ajuda",body:F||"Clique para responder"})},ae=()=>{_({type:"human_api.timeout",title:"Tempo esgotado",body:"IA retomou sem resposta humana"})},se=Z=>{const F=Z;_({type:"sla.breach",title:"SLA em risco!",body:F.protocol?`Protocolo #${F.protocol}`:"Protocolo urgente"})},xe=()=>{M(),_({type:"handoff.expired",title:"Handoff expirado",body:"Atendimento retornou para a IA"})},H=Z=>{const F=Z;F.from!==e&&R.current!=="broadcast"&&(v(z=>z+1),_({type:"dm.new",title:"Aviso da equipe",body:F.content}))},le=Z=>{var q;const F=Z,z=R.current==="groups"&&((q=I.current)==null?void 0:q.id)===F.group_chat_id;u(ie=>ie.map(oe=>oe.id===F.group_chat_id?{...oe,last_message:F.content,last_message_at:new Date().toISOString(),unread_count:z?oe.unread_count:(oe.unread_count??0)+1}:oe)),z||_({type:"dm.new",title:`Grupo: ${F.group_name}`,body:F.content})};return E("dm.new",L),E("human_api.new",B),E("human_api.timeout",ae),E("sla.breach",se),E("handoff.expired",xe),E("group_message.new",le),E("broadcast.sent",H),()=>{P("dm.new",L),P("human_api.new",B),P("human_api.timeout",ae),P("sla.breach",se),P("handoff.expired",xe),P("group_message.new",le),P("broadcast.sent",H)}},[E,P,M,_]);const V=g?n.filter(L=>L.type===g):n,X=n.reduce((L,B)=>L+B.unread,0),U=c.reduce((L,B)=>L+(B.unread_count??0),0);return e?a.jsxs("div",{className:"flex h-full bg-white",children:[a.jsx(tge,{notifications:C,onDismiss:A}),a.jsxs("div",{className:`flex flex-col h-full min-h-0 bg-white border-r border-[#d1d7db] ${o||s||d?"w-80 flex-shrink-0":"flex-1"} ${N==="broadcast"?"flex-1":""}`,children:[a.jsx("div",{className:"flex-shrink-0 px-3 pt-3 pb-0 bg-white border-b border-[#e9edef]",children:a.jsxs("div",{className:"flex gap-0 mb-0 overflow-x-auto",children:[a.jsxs("button",{onClick:()=>{w("inbox"),l(null),f(null)},className:`relative flex items-center gap-1 px-3 py-2 text-[12px] font-medium border-b-2 transition flex-shrink-0 ${N==="inbox"?"border-[#00a884] text-[#00a884]":"border-transparent text-[#8696a0] hover:text-[#54656f]"}`,children:[a.jsx(Pr,{size:13}),"Inbox",X>0&&a.jsx("span",{className:"bg-[#25d366] text-white text-[9px] font-bold min-w-[15px] h-[15px] px-0.5 rounded-full flex items-center justify-center",children:X>9?"9+":X})]}),a.jsxs("button",{onClick:()=>{w("colleagues"),i(null),f(null)},className:`relative flex items-center gap-1 px-3 py-2 text-[12px] font-medium border-b-2 transition flex-shrink-0 ${N==="colleagues"?"border-[#00a884] text-[#00a884]":"border-transparent text-[#8696a0] hover:text-[#54656f]"}`,children:[a.jsx(et,{size:13}),"Equipe"]}),a.jsxs("button",{onClick:()=>{w("groups"),i(null),l(null)},className:`relative flex items-center gap-1 px-3 py-2 text-[12px] font-medium border-b-2 transition flex-shrink-0 ${N==="groups"?"border-[#00a884] text-[#00a884]":"border-transparent text-[#8696a0] hover:text-[#54656f]"}`,children:[a.jsx(rn,{size:13}),"Grupos",U>0&&a.jsx("span",{className:"bg-[#25d366] text-white text-[9px] font-bold min-w-[15px] h-[15px] px-0.5 rounded-full flex items-center justify-center",children:U>9?"9+":U})]}),a.jsxs("button",{onClick:()=>{w("broadcast"),i(null),l(null),f(null)},className:`relative flex items-center gap-1 px-3 py-2 text-[12px] font-medium border-b-2 transition flex-shrink-0 ${N==="broadcast"?"border-amber-500 text-amber-600":"border-transparent text-[#8696a0] hover:text-[#54656f]"}`,children:[a.jsx(ju,{size:13}),"Avisos",m>0&&a.jsx("span",{className:"bg-amber-500 text-white text-[9px] font-bold min-w-[15px] h-[15px] px-0.5 rounded-full flex items-center justify-center",children:m>9?"9+":m})]}),a.jsx("button",{onClick:()=>k(!0),title:"Ajuda sobre o Inbox Interna",className:"ml-auto flex-shrink-0 self-center p-1.5 rounded-full text-[#8696a0] hover:text-[#00a884] hover:bg-[#e9edef] transition",children:a.jsx(gI,{size:14})})]})}),S&&a.jsx(Z0e,{onClose:()=>k(!1)}),N==="inbox"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex-shrink-0 px-4 pt-3 pb-2 bg-[#f0f2f5] border-b border-[#e9edef]",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx("h3",{className:"text-xs font-semibold text-[#667781] uppercase tracking-wide",children:"Mensagens"}),X>0&&a.jsx("span",{className:"ml-auto bg-[#25d366] text-white text-[10px] font-bold px-1.5 py-0.5 rounded-full",children:X}),a.jsx("button",{onClick:M,className:`${X>0?"":"ml-auto"} p-1 rounded-full hover:bg-[#e9edef] transition text-[#8696a0]`,children:a.jsx(ke,{size:13,className:x?"animate-spin":""})})]}),a.jsxs("div",{className:"flex gap-1 overflow-x-auto pb-0.5 -mx-1 px-1",children:[a.jsx("button",{onClick:()=>j(""),className:`px-2.5 py-0.5 rounded-full text-[11px] font-medium transition whitespace-nowrap
${g?"text-[#54656f] hover:bg-[#e9edef]":"bg-[#00a884] text-white"}`,children:"Todos"}),Object.entries(Zc).map(([L,B])=>a.jsxs("button",{onClick:()=>j(L),className:`flex items-center gap-1 px-2.5 py-0.5 rounded-full text-[11px] font-medium transition whitespace-nowrap
${g===L?"bg-[#00a884] text-white":"text-[#54656f] hover:bg-[#e9edef]"}`,children:[a.jsx(B.Icon,{size:9}),B.label]},L))]})]}),a.jsx("div",{className:"flex-1 overflow-y-auto",children:x?a.jsx("div",{className:"text-center py-8 text-[#8696a0] text-sm",children:"Carregando..."}):V.length===0?a.jsxs("div",{className:"text-center py-12 text-[#8696a0] text-xs px-4",children:[a.jsx(Pr,{size:28,className:"mx-auto mb-3 opacity-30 text-[#54656f]"}),"Nenhuma mensagem ainda.",a.jsx("br",{}),"Você receberá aqui consultas da IA e mensagens da equipe."]}):V.map(L=>{const B=Zc[L.type]||Zc.collaboration;return a.jsxs("button",{onClick:()=>i(L),className:`w-full text-left flex items-start gap-3 px-4 py-3 border-b border-[#e9edef] hover:bg-[#f5f6f6] transition-colors
${(s==null?void 0:s.thread_id)===L.thread_id?"bg-[#e7f5ff] border-l-4 border-l-[#00a884]":""}`,children:[a.jsx("div",{className:`mt-0.5 flex-shrink-0 ${B.color}`,children:a.jsx(B.Icon,{size:16})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center justify-between gap-1",children:[a.jsxs("span",{className:"text-[13px] font-medium text-[#111b21]",children:[B.label,L.sector_name&&a.jsxs("span",{className:"text-[#8696a0] font-normal",children:[" · ",L.sector_name]})]}),a.jsx("span",{className:`text-[11px] flex-shrink-0 ${L.unread>0?"text-[#25d366] font-medium":"text-[#8696a0]"}`,children:ub(L.last_at)})]}),a.jsx("p",{className:"text-[12px] text-[#667781] truncate mt-0.5",children:L.last_message}),L.ref_id&&a.jsxs("p",{className:"text-[11px] text-[#8696a0]",children:["#",L.ref_id]})]}),L.unread>0&&a.jsx("span",{className:"mt-1 flex-shrink-0 bg-[#25d366] text-white text-[10px] font-bold min-w-[18px] h-[18px] px-1 rounded-full flex items-center justify-center",children:L.unread})]},L.thread_id)})}),a.jsx("div",{className:"flex-shrink-0 p-3 border-t border-[#e9edef] bg-[#f0f2f5]",children:a.jsxs("button",{onClick:async()=>{const L=prompt("Descreva do que você precisa de ajuda:");if(!L)return;const B=await Gc.postMessage({from_account:e,type:"help_request",content:L});await M();const ae=n.find(se=>se.thread_id===B.thread_id)||{thread_id:B.thread_id,type:"help_request",sector_id:null,sector_name:null,last_message:L,last_at:B.created_at,ref_id:null,chat_id:null,unread:0};i(ae)},className:"w-full flex items-center justify-center gap-2 px-3 py-2 border border-dashed border-[#c8d0d4] rounded-xl text-[12px] text-[#54656f] hover:bg-[#e9edef] transition",children:[a.jsx(Ol,{size:13}),"Preciso de ajuda"]})})]}),N==="colleagues"&&a.jsx(U0e,{selected:(o==null?void 0:o.id)??null,onSelect:L=>l(L),onStartDM:L=>l(L),onNewDM:L=>{(o==null?void 0:o.id)!==L&&_({type:"dm.new",title:"Nova mensagem",body:"Clique em Equipe para ver"})}}),N==="groups"&&a.jsxs("div",{className:"flex flex-col flex-1 min-h-0",children:[a.jsxs("div",{className:"flex-shrink-0 px-3 pt-3 pb-2 bg-[#f0f2f5] border-b border-[#e9edef] flex items-center justify-between",children:[a.jsx("h3",{className:"text-xs font-semibold text-[#667781] uppercase tracking-wide",children:"Grupos por Setor"}),a.jsx("button",{onClick:W,className:"p-1 rounded-full hover:bg-[#e9edef] transition text-[#8696a0]",children:a.jsx(ke,{size:11,className:p?"animate-spin":""})})]}),a.jsx("div",{className:"flex-1 overflow-y-auto",children:p?a.jsx("div",{className:"text-center py-8 text-[#8696a0] text-[12px]",children:"Carregando..."}):c.length===0?a.jsx("div",{className:"text-center py-8 text-[#8696a0] text-[12px]",children:"Nenhum grupo encontrado"}):c.map(L=>{const B=(L.unread_count??0)>0;return a.jsxs("button",{onClick:()=>{f(L),u(ae=>ae.map(se=>se.id===L.id?{...se,unread_count:0}:se)),Kc.markRead(L.id).catch(()=>{})},className:`w-full text-left flex items-center gap-2.5 px-3 py-2.5 border-b border-[#f0f2f5] hover:bg-[#f5f6f6] transition-colors
${(d==null?void 0:d.id)===L.id?"bg-[#e7f5ff] border-l-4 border-l-[#00a884]":""}
${B?"bg-white":""}`,children:[a.jsx("div",{className:"w-9 h-9 rounded-full flex items-center justify-center text-white text-sm font-bold flex-shrink-0",style:{backgroundColor:L.color},children:L.name.charAt(0).toUpperCase()}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:`text-[13px] truncate ${B?"font-semibold text-[#111b21]":"font-medium text-[#111b21]"}`,children:L.name}),L.last_message&&a.jsx("p",{className:`text-[11px] truncate ${B?"text-[#111b21] font-medium":"text-[#8696a0]"}`,children:L.last_message})]}),a.jsxs("div",{className:"flex flex-col items-end gap-1 flex-shrink-0",children:[L.last_message_at&&a.jsx("span",{className:`text-[10px] ${B?"text-[#25d366] font-medium":"text-[#8696a0]"}`,children:ub(L.last_message_at)}),B&&a.jsx("span",{className:"bg-[#25d366] text-white text-[9px] font-bold min-w-[18px] h-[18px] px-1 rounded-full flex items-center justify-center",children:L.unread_count>9?"9+":L.unread_count})]})]},L.id)})})]}),N==="broadcast"&&e&&a.jsx(Q0e,{accountId:e,role:t,onNewBroadcast:L=>_({type:"dm.new",title:"Aviso da equipe",body:L}),onSeen:()=>v(0)})]}),(s||o||d)&&a.jsx("div",{className:"flex-1 flex flex-col",children:s&&!o&&!d?a.jsx(sge,{thread:s,accountId:e??null,onBack:()=>i(null),onRefresh:M}):o?a.jsx(H0e,{colleague:o,accountId:e,onBack:()=>l(null)}):d?a.jsx(G0e,{group:d,accountId:e,onBack:()=>f(null)}):null})]}):a.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-3 text-[#8696a0] px-6 text-center",children:[a.jsx(Pr,{size:32,className:"opacity-30"}),a.jsx("p",{className:"text-[13px]",children:"Inbox Interna disponível apenas para membros da equipe."}),a.jsx("p",{className:"text-[11px]",children:"Faça login como colaborador para acessar."})]})}function oge(){const[e,t]=b.useState([]),[n,r]=b.useState(0),[s,i]=b.useState(0),[o,l]=b.useState(""),[c,u]=b.useState(!1),d=15,f=b.useCallback(async(x,y)=>{u(!0);try{const g=new URLSearchParams({limit:String(d),offset:String(x*d)});y!==""&&g.set("rating",String(y));const N=await(await fetch(`/api/admin/metrics/ratings-history?${g}`,{credentials:"include"})).json();t(N.rows??[]),r(N.total??0)}catch{}finally{u(!1)}},[]);b.useEffect(()=>{f(s,o)},[s,o,f]);function p(x){return new Date(x).toLocaleString("pt-BR",{day:"2-digit",month:"2-digit",hour:"2-digit",minute:"2-digit"})}const h=x=>x?"★".repeat(x)+"☆".repeat(5-x):"—",m=x=>x?x>=4?"text-[#25d366]":x>=3?"text-amber-400":"text-red-400":"text-[#8696a0]",v=Math.ceil(n/d);return a.jsxs("div",{className:"bg-white rounded-2xl shadow-sm border border-[#e9edef] overflow-hidden",children:[a.jsxs("div",{className:"px-4 py-2.5 border-b border-[#e9edef] flex items-center gap-2 flex-wrap",children:[a.jsx(gd,{size:13,className:"text-amber-400 shrink-0"}),a.jsx("h3",{className:"text-[12px] font-semibold text-[#111b21] flex-1",children:"Histórico de Avaliações"}),a.jsxs("div",{className:"flex gap-1",children:[a.jsx("button",{onClick:()=>{l(""),i(0)},className:`px-2 py-0.5 rounded-full text-[10px] font-medium transition ${o===""?"bg-[#00a884] text-white":"text-[#8696a0] hover:bg-[#f0f2f5]"}`,children:"Todas"}),[5,4,3,2,1].map(x=>a.jsx("button",{onClick:()=>{l(x),i(0)},className:`px-2 py-0.5 rounded-full text-[10px] font-medium transition ${o===x?"bg-amber-400 text-white":"text-[#8696a0] hover:bg-[#f0f2f5]"}`,children:"★".repeat(x)},x))]})]}),c?a.jsxs("div",{className:"flex items-center justify-center py-8 text-[#8696a0] gap-2 text-[12px]",children:[a.jsx(ke,{size:12,className:"animate-spin"})," Carregando…"]}):e.length===0?a.jsx("p",{className:"text-center py-8 text-[#8696a0] text-[12px]",children:"Nenhuma avaliação encontrada"}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-[11px]",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-[#e9edef] text-[#8696a0] text-[10px] uppercase",children:[a.jsx("th",{className:"text-left px-4 py-2",children:"Chat"}),a.jsx("th",{className:"text-left px-3 py-2",children:"Atendente"}),a.jsx("th",{className:"text-center px-3 py-2",children:"Nota"}),a.jsx("th",{className:"text-center px-3 py-2",children:"Status"}),a.jsx("th",{className:"text-right px-4 py-2",children:"Enviado"})]})}),a.jsx("tbody",{children:e.map(x=>a.jsxs("tr",{className:"border-b border-[#f5f6f6] hover:bg-[#f5f6f6] transition",children:[a.jsx("td",{className:"px-4 py-2 font-mono text-[10px] text-[#54656f] max-w-[100px] truncate",children:x.chat_id.replace("@s.whatsapp.net","")}),a.jsx("td",{className:"px-3 py-2 text-[#111b21] max-w-[100px] truncate",children:x.account_name||"—"}),a.jsx("td",{className:`px-3 py-2 text-center font-bold text-[13px] ${m(x.rating)}`,children:h(x.rating)}),a.jsx("td",{className:"px-3 py-2 text-center",children:a.jsx("span",{className:`px-1.5 py-0.5 rounded-full text-[9px] font-bold ${x.status==="rated"?"bg-[#25d366]/10 text-[#25d366]":x.status==="expired"?"bg-slate-100 text-slate-400":"bg-amber-50 text-amber-500"}`,children:x.status==="rated"?"Avaliado":x.status==="expired"?"Expirado":"Pendente"})}),a.jsx("td",{className:"px-4 py-2 text-right text-[#8696a0]",children:p(x.sent_at)})]},x.id))})]})}),v>1&&a.jsxs("div",{className:"px-4 py-2 flex items-center justify-between text-[11px] text-[#8696a0] border-t border-[#f0f2f5]",children:[a.jsxs("span",{children:[n," avaliações"]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("button",{onClick:()=>i(x=>Math.max(0,x-1)),disabled:s===0,className:"p-1 rounded hover:bg-[#e9edef] disabled:opacity-30 transition",children:a.jsx(xd,{size:13})}),a.jsxs("span",{children:[s+1," / ",v]}),a.jsx("button",{onClick:()=>i(x=>Math.min(v-1,x+1)),disabled:s>=v-1,className:"p-1 rounded hover:bg-[#e9edef] disabled:opacity-30 transition",children:a.jsx(Pa,{size:13})})]})]})]})]})}function lge({data:e}){if(!e.length)return a.jsx("p",{className:"text-center py-6 text-[#8696a0] text-[12px]",children:"Sem escalações no período"});const t=Math.max(...e.map(n=>parseInt(n.count)));return a.jsx("div",{className:"flex items-end gap-1.5 h-[72px] px-2 pb-1",children:e.map(n=>{const r=t>0?Math.max(4,Math.round(parseInt(n.count)/t*64)):4;return a.jsxs("div",{className:"flex flex-col items-center gap-0.5 flex-1 min-w-0",children:[a.jsx("span",{className:"text-[9px] text-[#8696a0] font-medium",children:n.count}),a.jsx("div",{className:"w-full rounded-t-sm bg-[#00a884]",style:{height:r}}),a.jsx("span",{className:"text-[9px] text-[#8696a0] truncate w-full text-center",children:n.day})]},n.day)})})}function ro(e){return parseInt(e??"0",10)||0}function zC(e){return e?parseFloat(e).toFixed(1):"—"}function Cf({icon:e,label:t,value:n,sub:r,color:s="text-[#00a884]"}){return a.jsxs("div",{className:"bg-white rounded-2xl p-4 shadow-sm border border-[#e9edef] flex flex-col gap-1",children:[a.jsxs("div",{className:"flex items-center gap-2 text-[#8696a0] text-[11px] font-medium uppercase tracking-wide",children:[a.jsx(e,{size:12,className:s}),t]}),a.jsx("p",{className:`text-[28px] font-bold leading-none ${s}`,children:n}),r&&a.jsx("p",{className:"text-[11px] text-[#8696a0]",children:r})]})}function cge(){var d,f,p;const[e,t]=b.useState(null),[n,r]=b.useState("7d"),[s,i]=b.useState(!0),[o,l]=b.useState(null),c=b.useCallback(async()=>{i(!0),l(null);try{const h=await fetch(`/api/admin/metrics/attendance?period=${n}`,{credentials:"include"});if(!h.ok)throw new Error(`HTTP ${h.status}`);t(await h.json())}catch(h){l(h.message)}finally{i(!1)}},[n]);b.useEffect(()=>{c()},[c]);const u=[["today","Hoje"],["7d","7 dias"],["30d","30 dias"]];return a.jsxs("div",{className:"flex flex-col h-full bg-[#f0f2f5] overflow-y-auto",children:[a.jsxs("div",{className:"flex-shrink-0 px-4 pt-3 pb-2 bg-[#f0f2f5] border-b border-[#e9edef]",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(yu,{size:15,className:"text-[#54656f]"}),a.jsx("h2",{className:"text-sm font-semibold text-[#111b21] flex-1",children:"Métricas de Atendimento"}),a.jsx("button",{onClick:c,className:"p-1 rounded-full hover:bg-[#e9edef] transition text-[#8696a0]",children:a.jsx(ke,{size:13,className:s?"animate-spin":""})})]}),a.jsx("div",{className:"flex gap-1",children:u.map(([h,m])=>a.jsx("button",{onClick:()=>r(h),className:`px-3 py-1 rounded-full text-[11px] font-medium transition
${n===h?"bg-[#00a884] text-white":"text-[#54656f] hover:bg-[#e9edef]"}`,children:m},h))})]}),o&&a.jsx("div",{className:"m-4 p-3 bg-red-50 border border-red-200 text-red-700 text-[12px] rounded-xl",children:o}),e&&a.jsxs("div",{className:"p-4 flex flex-col gap-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsx(Cf,{icon:et,label:"Escalações assumidas",value:e.by_account.reduce((h,m)=>h+ro(m.escalations_assumed),0),sub:`nos últimos ${(d=u.find(h=>h[0]===n))==null?void 0:d[1]}`,color:"text-[#00a884]"}),a.jsx(Cf,{icon:ra,label:"Respostas IA",value:`${e.auto_replies.rate_pct}%`,sub:`${e.auto_replies.total_replied} de ${e.auto_replies.total_in} msgs`,color:"text-cyan-500"}),a.jsx(Cf,{icon:Ts,label:"Human API respondidas",value:`${e.human_api.rate_pct}%`,sub:`${e.human_api.answered} de ${e.human_api.total} pedidos`,color:"text-[#25d366]"}),a.jsx(Cf,{icon:Kt,label:"Timeouts Human API",value:e.human_api.timeout,sub:e.human_api.ignored>0?`+ ${e.human_api.ignored} ignorados`:"sem pedidos ignorados",color:"text-amber-500"})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{className:"bg-white rounded-2xl p-4 shadow-sm border border-[#e9edef] flex flex-col gap-1.5",children:[a.jsxs("div",{className:"flex items-center gap-2 text-[#8696a0] text-[11px] font-medium uppercase tracking-wide",children:[a.jsx(ev,{size:12,className:"text-amber-500"})," Flags do período"]}),a.jsxs("div",{className:"flex gap-3 mt-0.5",children:[a.jsxs("span",{className:"text-[12px]",children:[a.jsx("span",{className:"font-bold text-red-500",children:e.flags.complaints})," ",a.jsx("span",{className:"text-[#8696a0]",children:"reclam."})]}),a.jsxs("span",{className:"text-[12px]",children:[a.jsx("span",{className:"font-bold text-cyan-500",children:e.flags.suggestions})," ",a.jsx("span",{className:"text-[#8696a0]",children:"sugest."})]}),a.jsxs("span",{className:"text-[12px]",children:[a.jsx("span",{className:"font-bold text-[#25d366]",children:e.flags.compliments})," ",a.jsx("span",{className:"text-[#8696a0]",children:"elogios"})]})]})]}),a.jsxs("div",{className:"bg-white rounded-2xl p-4 shadow-sm border border-[#e9edef] flex flex-col gap-1",children:[a.jsxs("div",{className:"flex items-center gap-2 text-[#8696a0] text-[11px] font-medium uppercase tracking-wide",children:[a.jsx(gd,{size:12,className:"text-amber-400"})," Satisfação"]}),a.jsx("p",{className:"text-[28px] font-bold leading-none text-amber-400",children:e.ratings.avg_rating?`${e.ratings.avg_rating.toFixed(1)}★`:"—"}),a.jsxs("p",{className:"text-[11px] text-[#8696a0]",children:[e.ratings.total_rated," de ",e.ratings.total_sent," avaliaram"]})]}),a.jsxs("div",{className:"col-span-2 bg-white rounded-2xl p-4 shadow-sm border border-[#e9edef] flex items-center gap-4",children:[a.jsx("div",{className:"p-2.5 rounded-xl bg-[#00a884]/10 text-[#00a884]",children:a.jsx(ZP,{size:18})}),a.jsxs("div",{className:"flex-1",children:[a.jsx("p",{className:"text-[11px] font-medium text-[#8696a0] uppercase tracking-wide",children:"Tempo médio de resolução"}),a.jsx("p",{className:"text-[22px] font-bold text-[#111b21] leading-tight",children:((f=e.resolution)==null?void 0:f.avg_minutes)!=null?e.resolution.avg_minutes>=60?`${(e.resolution.avg_minutes/60).toFixed(1)}h`:`${e.resolution.avg_minutes.toFixed(0)} min`:"—"})]}),a.jsxs("div",{className:"text-right",children:[a.jsx("p",{className:"text-[10px] text-[#8696a0]",children:"protocolos encerrados"}),a.jsx("p",{className:"text-[18px] font-bold text-[#54656f]",children:((p=e.resolution)==null?void 0:p.total_resolved)??0})]})]})]}),a.jsxs("div",{className:"bg-white rounded-2xl shadow-sm border border-[#e9edef] overflow-hidden",children:[a.jsxs("div",{className:"px-4 py-2.5 border-b border-[#e9edef] flex items-center gap-2",children:[a.jsx(yu,{size:13,className:"text-[#54656f]"}),a.jsx("h3",{className:"text-[12px] font-semibold text-[#111b21]",children:"Escalações por dia"})]}),a.jsx("div",{className:"px-2 py-2",children:a.jsx(lge,{data:e.daily_escalations})})]}),a.jsxs("div",{className:"bg-white rounded-2xl shadow-sm border border-[#e9edef] overflow-hidden",children:[a.jsxs("div",{className:"px-4 py-2.5 border-b border-[#e9edef] flex items-center gap-2",children:[a.jsx(et,{size:13,className:"text-[#54656f]"}),a.jsx("h3",{className:"text-[12px] font-semibold text-[#111b21]",children:"Por Colaborador"})]}),e.by_account.length===0?a.jsx("p",{className:"text-center py-6 text-[#8696a0] text-[12px]",children:"Sem dados"}):a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-[12px]",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-[#e9edef] text-[#8696a0] text-[10px] uppercase",children:[a.jsx("th",{className:"text-left px-4 py-2",children:"Colaborador"}),a.jsx("th",{className:"text-center px-3 py-2",children:"Escalações"}),a.jsx("th",{className:"text-center px-3 py-2",children:"Msgs"}),a.jsx("th",{className:"text-center px-3 py-2",children:"Human API"}),a.jsx("th",{className:"text-center px-3 py-2",children:a.jsxs("span",{className:"flex items-center justify-center gap-1",children:[a.jsx(hn,{size:9}),"1ª resp."]})})]})}),a.jsx("tbody",{children:e.by_account.map(h=>a.jsxs("tr",{className:"border-b border-[#f5f6f6] hover:bg-[#f5f6f6] transition",children:[a.jsxs("td",{className:"px-4 py-2.5",children:[a.jsx("p",{className:"font-medium text-[#111b21] truncate max-w-[120px]",children:h.name}),a.jsx("p",{className:"text-[10px] text-[#8696a0] truncate max-w-[120px]",children:h.email})]}),a.jsx("td",{className:"text-center px-3 py-2 font-bold text-[#00a884]",children:ro(h.escalations_assumed)}),a.jsx("td",{className:"text-center px-3 py-2 text-[#54656f]",children:ro(h.messages_sent)}),a.jsx("td",{className:"text-center px-3 py-2 text-cyan-600",children:ro(h.human_api_answered)}),a.jsx("td",{className:"text-center px-3 py-2 text-[#8696a0]",children:h.avg_first_response_min?`${zC(h.avg_first_response_min)}m`:"—"})]},h.account_id))})]})})]}),a.jsxs("div",{className:"bg-white rounded-2xl shadow-sm border border-[#e9edef] overflow-hidden",children:[a.jsxs("div",{className:"px-4 py-2.5 border-b border-[#e9edef] flex items-center gap-2",children:[a.jsx(Wi,{size:13,className:"text-[#54656f]"}),a.jsx("h3",{className:"text-[12px] font-semibold text-[#111b21]",children:"Por Setor"})]}),e.by_sector.length===0?a.jsx("p",{className:"text-center py-6 text-[#8696a0] text-[12px]",children:"Sem dados"}):a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-[12px]",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-[#e9edef] text-[#8696a0] text-[10px] uppercase",children:[a.jsx("th",{className:"text-left px-4 py-2",children:"Setor"}),a.jsx("th",{className:"text-center px-3 py-2",children:"Escalações"}),a.jsx("th",{className:"text-center px-3 py-2",children:a.jsxs("span",{className:"flex items-center justify-center gap-1",children:[a.jsx(Ai,{size:9}),"SLA breach"]})}),a.jsx("th",{className:"text-center px-3 py-2",children:"SLA (min)"}),a.jsx("th",{className:"text-center px-3 py-2",children:a.jsxs("span",{className:"flex items-center justify-center gap-1",children:[a.jsx(hn,{size:9}),"Resp. média"]})})]})}),a.jsx("tbody",{children:e.by_sector.map(h=>{const m=ro(h.escalations_total),v=ro(h.sla_breaches),x=m>0&&v===0;return a.jsxs("tr",{className:"border-b border-[#f5f6f6] hover:bg-[#f5f6f6] transition",children:[a.jsxs("td",{className:"px-4 py-2.5 flex items-center gap-2",children:[a.jsx("span",{className:"w-2.5 h-2.5 rounded-full flex-shrink-0",style:{background:h.color||"#6366f1"}}),a.jsx("span",{className:"font-medium text-[#111b21]",children:h.name})]}),a.jsx("td",{className:"text-center px-3 py-2 font-bold text-[#00a884]",children:m}),a.jsx("td",{className:"text-center px-3 py-2",children:v>0?a.jsx("span",{className:"text-red-500 font-bold",children:v}):a.jsx("span",{className:m>0?"text-[#25d366]":"text-[#8696a0]",children:x?"✓":"—"})}),a.jsx("td",{className:"text-center px-3 py-2 text-[#8696a0]",children:h.sla_minutes??"—"}),a.jsx("td",{className:"text-center px-3 py-2 text-[#8696a0]",children:h.avg_response_min?`${zC(h.avg_response_min)}m`:"—"})]},h.sector_id)})})]})})]}),a.jsx(oge,{}),a.jsxs("p",{className:"text-center text-[10px] text-[#8696a0] pb-2",children:["Dados calculados em tempo real · ",new Date().toLocaleTimeString("pt-BR")]})]}),s&&!e&&a.jsxs("div",{className:"flex-1 flex items-center justify-center text-[#8696a0] text-sm gap-2",children:[a.jsx(ke,{size:14,className:"animate-spin"})," Carregando métricas..."]})]})}const Y0={text:"",btnText:"",btnFooter:"",buttons:[{id:"btn1",text:""}],ctaText:"",ctaFooter:"",ctaButtons:[{type:"url",text:"",extra:""}],listText:"",listButtonText:"Ver opções",listFooter:"",listSections:[{title:"Seção 1",rows:[{id:"r1",title:"",description:""}]}],pollName:"",pollSelectable:1,pollOptions:["",""],carouselText:"",carouselFooter:"",cards:[{title:"",body:"",footer:"",imageUrl:"",buttons:[{id:"cb1",text:""}]}]},BC=[{type:"TEXT",label:"Texto",icon:a.jsx(eE,{className:"w-4 h-4"}),color:"#667781"},{type:"BUTTONS",label:"Botões",icon:a.jsx(qP,{className:"w-4 h-4"}),color:"#0ea5e9"},{type:"INTERACTIVE",label:"CTA",icon:a.jsx(UP,{className:"w-4 h-4"}),color:"#8b5cf6"},{type:"LIST",label:"Lista",icon:a.jsx(WP,{className:"w-4 h-4"}),color:"#f59e0b"},{type:"POLL",label:"Enquete",icon:a.jsx(ys,{className:"w-4 h-4"}),color:"#10b981"},{type:"CAROUSEL",label:"Carrossel",icon:a.jsx(VP,{className:"w-4 h-4"}),color:"#ef4444"}];function ja(){return`id_${Date.now()}_${Math.random().toString(36).slice(2,7)}`}function uge(e,t){switch(e){case"TEXT":return{text:t.text??""};case"BUTTONS":{const n=t.nativeButtons??[];return{btnText:t.text??"",btnFooter:t.footer??"",buttons:n.length?n.map(r=>({id:r.id??ja(),text:r.text??""})):[{id:"btn1",text:""}]}}case"INTERACTIVE":{const n=t.nativeButtons??[];return{ctaText:t.text??"",ctaFooter:t.footer??"",ctaButtons:n.length?n.map(r=>({type:r.type==="copy"||r.type==="call"?r.type:"url",text:r.text??"",extra:r.url??r.copyText??r.phoneNumber??""})):[{type:"url",text:"",extra:""}]}}case"LIST":{const n=t.nativeList??{};return{listText:t.text??"",listFooter:t.footer??"",listButtonText:n.buttonText??"Ver opções",listSections:(n.sections??[]).length?n.sections.map(r=>({title:r.title??"",rows:(r.rows??[]).map(s=>({id:s.id??ja(),title:s.title??"",description:s.description??""}))})):[{title:"Seção 1",rows:[{id:"r1",title:"",description:""}]}]}}case"POLL":{const n=t.poll??{};return{pollName:n.name??"",pollOptions:(n.values??[]).length>=2?n.values:["",""],pollSelectable:n.selectableCount??1}}case"CAROUSEL":{const n=t.nativeCarousel??{};return{carouselText:t.text??"",carouselFooter:t.footer??"",cards:(n.cards??[]).length?n.cards.map(r=>{var s;return{title:r.title??"",body:r.body??"",footer:r.footer??"",imageUrl:((s=r.image)==null?void 0:s.url)??"",buttons:(r.buttons??[]).length?r.buttons.map(i=>({id:i.id??ja(),text:i.text??""})):[{id:ja(),text:""}]}}):[{title:"",body:"",footer:"",imageUrl:"",buttons:[{id:"cb1",text:""}]}]}}default:return{}}}function Q0(e,t){switch(e){case"TEXT":return{text:t.text};case"BUTTONS":return{text:t.btnText||void 0,footer:t.btnFooter||void 0,nativeButtons:t.buttons.filter(n=>n.id&&n.text).map(n=>({type:"reply",id:n.id,text:n.text}))};case"INTERACTIVE":return{text:t.ctaText||void 0,footer:t.ctaFooter||void 0,nativeButtons:t.ctaButtons.filter(n=>n.text&&n.extra).map(n=>n.type==="url"?{type:"url",text:n.text,url:n.extra}:n.type==="copy"?{type:"copy",text:n.text,copyText:n.extra}:{type:"call",text:n.text,phoneNumber:n.extra})};case"LIST":{const n=t.listSections.map(r=>({title:r.title,rows:r.rows.filter(s=>s.id&&s.title)})).filter(r=>r.rows.length>0);return{text:t.listText||void 0,footer:t.listFooter||void 0,nativeList:{buttonText:t.listButtonText||"Ver opções",sections:n}}}case"POLL":return{poll:{name:t.pollName||"Enquete",values:t.pollOptions.filter(Boolean),selectableCount:t.pollSelectable}};case"CAROUSEL":{const n=t.cards.map(r=>({title:r.title||void 0,body:r.body||void 0,footer:r.footer||void 0,image:r.imageUrl?{url:r.imageUrl}:void 0,buttons:r.buttons.filter(s=>s.id&&s.text).map(s=>({type:"reply",id:s.id,text:s.text}))}));return{text:t.carouselText||void 0,footer:t.carouselFooter||void 0,nativeCarousel:{cards:n}}}}}function dge({form:e,set:t}){return a.jsxs("div",{className:"space-y-3",children:[a.jsx("label",{className:"block text-xs font-semibold text-[#667781] uppercase tracking-wider",children:"Mensagem"}),a.jsx("textarea",{rows:5,className:"w-full rounded-xl border border-gray-200 bg-[#f8f9fa] px-3 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-[#00a884]/30 resize-none",placeholder:"Digite o texto da mensagem...",value:e.text,onChange:n=>t({text:n.target.value})})]})}function fge({form:e,set:t}){const n=()=>{e.buttons.length>=3||t({buttons:[...e.buttons,{id:ja(),text:""}]})},r=i=>t({buttons:e.buttons.filter((o,l)=>l!==i)}),s=(i,o,l)=>{const c=[...e.buttons];c[i]={...c[i],[o]:l},t({buttons:c})};return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{className:"block text-xs font-semibold text-[#667781] uppercase tracking-wider",children:"Texto"}),a.jsx("textarea",{rows:2,className:"w-full rounded-xl border border-gray-200 bg-[#f8f9fa] px-3 py-2 text-sm focus:outline-none resize-none",placeholder:"Corpo da mensagem",value:e.btnText,onChange:i=>t({btnText:i.target.value})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"block text-xs font-semibold text-[#667781] uppercase tracking-wider",children:"Botões (máx. 3)"}),e.buttons.map((i,o)=>a.jsxs("div",{className:"flex gap-2",children:[a.jsx("input",{className:"flex-1 rounded-xl border border-gray-200 bg-[#f8f9fa] px-3 py-2 text-sm focus:outline-none",placeholder:"ID do botão",value:i.id,onChange:l=>s(o,"id",l.target.value)}),a.jsx("input",{className:"flex-[2] rounded-xl border border-gray-200 bg-[#f8f9fa] px-3 py-2 text-sm focus:outline-none",placeholder:"Texto visível",value:i.text,onChange:l=>s(o,"text",l.target.value)}),a.jsx("button",{onClick:()=>r(o),disabled:e.buttons.length<=1,className:"p-2 rounded-full hover:bg-red-50 text-gray-400 hover:text-red-500 disabled:opacity-30",children:a.jsx(Te,{className:"w-4 h-4"})})]},i.id)),e.buttons.length<3&&a.jsxs("button",{onClick:n,className:"flex items-center gap-1 text-xs text-[#0ea5e9] hover:underline font-medium",children:[a.jsx(Oe,{className:"w-3.5 h-3.5"})," Adicionar botão"]})]})]})}function pge({form:e,set:t}){const n=()=>{e.ctaButtons.length>=3||t({ctaButtons:[...e.ctaButtons,{type:"url",text:"",extra:""}]})},r=l=>t({ctaButtons:e.ctaButtons.filter((c,u)=>u!==l)}),s=(l,c,u)=>{const d=[...e.ctaButtons];d[l]={...d[l],[c]:u},t({ctaButtons:d})},i={url:"https://...",copy:"Código do cupom",call:"5511999999999"},o={url:"URL",copy:"Código a copiar",call:"Número de telefone"};return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{className:"block text-xs font-semibold text-[#667781] uppercase tracking-wider",children:"Texto"}),a.jsx("textarea",{rows:2,className:"w-full rounded-xl border border-gray-200 bg-[#f8f9fa] px-3 py-2 text-sm focus:outline-none resize-none",placeholder:"Corpo da mensagem",value:e.ctaText,onChange:l=>t({ctaText:l.target.value})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"block text-xs font-semibold text-[#667781] uppercase tracking-wider",children:"Botões CTA (máx. 3)"}),e.ctaButtons.map((l,c)=>a.jsxs("div",{className:"rounded-xl border border-gray-200 bg-[#f8f9fa] p-3 space-y-2",children:[a.jsxs("div",{className:"flex gap-2 items-start",children:[a.jsxs("select",{value:l.type,onChange:u=>s(c,"type",u.target.value),className:"rounded-lg border border-gray-200 bg-white px-2 py-1.5 text-xs focus:outline-none",children:[a.jsx("option",{value:"url",children:"🌐 URL"}),a.jsx("option",{value:"copy",children:"📋 Copiar"}),a.jsx("option",{value:"call",children:"📞 Ligar"})]}),a.jsx("input",{className:"flex-1 rounded-lg border border-gray-200 bg-white px-2 py-1.5 text-xs focus:outline-none",placeholder:"Texto do botão",value:l.text,onChange:u=>s(c,"text",u.target.value)}),a.jsx("button",{onClick:()=>r(c),disabled:e.ctaButtons.length<=1,className:"p-1.5 rounded-full hover:bg-red-50 text-gray-400 hover:text-red-500 disabled:opacity-30",children:a.jsx(Te,{className:"w-3.5 h-3.5"})})]}),a.jsx("input",{className:"w-full rounded-lg border border-gray-200 bg-white px-2 py-1.5 text-xs focus:outline-none",placeholder:i[l.type],value:l.extra,onChange:u=>s(c,"extra",u.target.value)}),a.jsx("span",{className:"text-[10px] text-gray-400",children:o[l.type]})]},c)),e.ctaButtons.length<3&&a.jsxs("button",{onClick:n,className:"flex items-center gap-1 text-xs text-[#8b5cf6] hover:underline font-medium",children:[a.jsx(Oe,{className:"w-3.5 h-3.5"})," Adicionar botão CTA"]})]})]})}function hge({form:e,set:t}){const n=()=>t({listSections:[...e.listSections,{title:`Seção ${e.listSections.length+1}`,rows:[{id:ja(),title:"",description:""}]}]}),r=c=>t({listSections:e.listSections.filter((u,d)=>d!==c)}),s=(c,u)=>{const d=[...e.listSections];d[c]={...d[c],title:u},t({listSections:d})},i=c=>{const u=[...e.listSections];u[c]={...u[c],rows:[...u[c].rows,{id:ja(),title:"",description:""}]},t({listSections:u})},o=(c,u)=>{const d=[...e.listSections];d[c]={...d[c],rows:d[c].rows.filter((f,p)=>p!==u)},t({listSections:d})},l=(c,u,d,f)=>{const p=[...e.listSections],h=[...p[c].rows];h[u]={...h[u],[d]:f},p[c]={...p[c],rows:h},t({listSections:p})};return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{className:"block text-xs font-semibold text-[#667781] uppercase tracking-wider",children:"Texto"}),a.jsx("textarea",{rows:2,className:"w-full rounded-xl border border-gray-200 bg-[#f8f9fa] px-3 py-2 text-sm focus:outline-none resize-none",placeholder:"Corpo da mensagem",value:e.listText,onChange:c=>t({listText:c.target.value})})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{className:"block text-xs font-semibold text-[#667781] uppercase tracking-wider",children:"Texto do Botão"}),a.jsx("input",{className:"w-full rounded-xl border border-gray-200 bg-[#f8f9fa] px-3 py-2 text-sm focus:outline-none",placeholder:"Ver opções",value:e.listButtonText,onChange:c=>t({listButtonText:c.target.value})})]})]}),a.jsxs("div",{className:"space-y-3",children:[e.listSections.map((c,u)=>a.jsxs("div",{className:"rounded-xl border border-amber-100 bg-amber-50/50 p-3 space-y-2",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("input",{className:"flex-1 rounded-lg border border-amber-200 bg-white px-2 py-1.5 text-xs font-medium focus:outline-none",placeholder:"Título da seção",value:c.title,onChange:d=>s(u,d.target.value)}),a.jsx("button",{onClick:()=>r(u),disabled:e.listSections.length<=1,className:"p-1 rounded text-gray-400 hover:text-red-500 disabled:opacity-30",children:a.jsx(Te,{className:"w-3.5 h-3.5"})})]}),c.rows.map((d,f)=>a.jsxs("div",{className:"flex gap-2",children:[a.jsx("input",{className:"w-20 rounded-lg border border-gray-200 bg-white px-2 py-1.5 text-xs focus:outline-none",placeholder:"ID",value:d.id,onChange:p=>l(u,f,"id",p.target.value)}),a.jsx("input",{className:"flex-1 rounded-lg border border-gray-200 bg-white px-2 py-1.5 text-xs focus:outline-none",placeholder:"Título",value:d.title,onChange:p=>l(u,f,"title",p.target.value)}),a.jsx("input",{className:"flex-[2] rounded-lg border border-gray-200 bg-white px-2 py-1.5 text-xs focus:outline-none",placeholder:"Descrição",value:d.description,onChange:p=>l(u,f,"description",p.target.value)}),a.jsx("button",{onClick:()=>o(u,f),disabled:c.rows.length<=1,className:"p-1 rounded text-gray-400 hover:text-red-500 disabled:opacity-30",children:a.jsx(Te,{className:"w-3 h-3"})})]},f)),a.jsxs("button",{onClick:()=>i(u),className:"flex items-center gap-1 text-xs text-amber-600 hover:underline font-medium",children:[a.jsx(Oe,{className:"w-3 h-3"})," Adicionar item"]})]},u)),a.jsxs("button",{onClick:n,className:"flex items-center gap-1 text-xs text-amber-600 hover:underline font-medium",children:[a.jsx(Oe,{className:"w-3.5 h-3.5"})," Adicionar seção"]})]})]})}function mge({form:e,set:t}){const n=()=>t({pollOptions:[...e.pollOptions,""]}),r=i=>{e.pollOptions.length<=2||t({pollOptions:e.pollOptions.filter((o,l)=>l!==i)})},s=(i,o)=>{const l=[...e.pollOptions];l[i]=o,t({pollOptions:l})};return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{className:"block text-xs font-semibold text-[#667781] uppercase tracking-wider",children:"Pergunta"}),a.jsx("input",{className:"w-full rounded-xl border border-gray-200 bg-[#f8f9fa] px-3 py-2 text-sm focus:outline-none",placeholder:"Qual a sua preferência?",value:e.pollName,onChange:i=>t({pollName:i.target.value})})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{className:"block text-xs font-semibold text-[#667781] uppercase tracking-wider",children:"Máx. seleções"}),a.jsx("input",{type:"number",min:1,max:e.pollOptions.filter(Boolean).length||1,className:"w-24 rounded-xl border border-gray-200 bg-[#f8f9fa] px-3 py-2 text-sm focus:outline-none",value:e.pollSelectable,onChange:i=>t({pollSelectable:parseInt(i.target.value)||1})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"block text-xs font-semibold text-[#667781] uppercase tracking-wider",children:"Opções (mín. 2)"}),e.pollOptions.map((i,o)=>a.jsxs("div",{className:"flex gap-2",children:[a.jsx("input",{className:"flex-1 rounded-xl border border-gray-200 bg-[#f8f9fa] px-3 py-2 text-sm focus:outline-none",placeholder:`Opção ${o+1}`,value:i,onChange:l=>s(o,l.target.value)}),a.jsx("button",{onClick:()=>r(o),disabled:e.pollOptions.length<=2,className:"p-2 rounded-full hover:bg-red-50 text-gray-400 hover:text-red-500 disabled:opacity-30",children:a.jsx(Te,{className:"w-4 h-4"})})]},o)),e.pollOptions.length<12&&a.jsxs("button",{onClick:n,className:"flex items-center gap-1 text-xs text-[#10b981] hover:underline font-medium",children:[a.jsx(Oe,{className:"w-3.5 h-3.5"})," Adicionar opção"]})]})]})}function xge({form:e,set:t}){const n=()=>{e.cards.length>=10||t({cards:[...e.cards,{title:"",body:"",footer:"",imageUrl:"",buttons:[{id:ja(),text:""}]}]})},r=f=>t({cards:e.cards.filter((p,h)=>h!==f)}),s=(f,p,h)=>{const m=[...e.cards];m[f]={...m[f],[p]:h},t({cards:m})},i=f=>{const p=[...e.cards];p[f].buttons.push({id:ja(),text:""}),t({cards:p})},o=(f,p)=>{const h=[...e.cards];h[f].buttons=h[f].buttons.filter((m,v)=>v!==p),t({cards:h})},l=(f,p,h,m)=>{const v=[...e.cards];v[f].buttons[p]={...v[f].buttons[p],[h]:m},t({cards:v})},[c,u]=b.useState([0]),d=f=>u(p=>p.includes(f)?p.filter(h=>h!==f):[...p,f]);return a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{className:"block text-xs font-semibold text-[#667781] uppercase tracking-wider",children:"Texto acima"}),a.jsx("input",{className:"w-full rounded-xl border border-gray-200 bg-[#f8f9fa] px-3 py-2 text-sm focus:outline-none",placeholder:"Ofertas especiais",value:e.carouselText,onChange:f=>t({carouselText:f.target.value})})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{className:"block text-xs font-semibold text-[#667781] uppercase tracking-wider",children:"Rodapé"}),a.jsx("input",{className:"w-full rounded-xl border border-gray-200 bg-[#f8f9fa] px-3 py-2 text-sm focus:outline-none",placeholder:"Rodapé geral",value:e.carouselFooter,onChange:f=>t({carouselFooter:f.target.value})})]})]}),a.jsx("div",{className:"space-y-2 max-h-[320px] overflow-y-auto pr-1",children:e.cards.map((f,p)=>a.jsxs("div",{className:"rounded-xl border border-gray-200 bg-[#f8f9fa] overflow-hidden",children:[a.jsxs("button",{onClick:()=>d(p),className:"w-full flex items-center justify-between px-3 py-2.5 text-sm font-medium text-[#111b21] hover:bg-gray-100 transition-colors",children:[a.jsxs("span",{children:["Card ",p+1,f.title?` — ${f.title}`:""]}),a.jsxs("div",{className:"flex items-center gap-2",children:[e.cards.length>1&&a.jsx("button",{onClick:h=>{h.stopPropagation(),r(p)},className:"p-1 rounded-full hover:bg-red-50 text-gray-400 hover:text-red-500",children:a.jsx(Te,{className:"w-3.5 h-3.5"})}),c.includes(p)?a.jsx(p1,{className:"w-4 h-4 text-gray-400"}):a.jsx(aa,{className:"w-4 h-4 text-gray-400"})]})]}),c.includes(p)&&a.jsxs("div",{className:"px-3 pb-3 space-y-2 border-t border-gray-100 pt-2",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[a.jsx("input",{className:"rounded-lg border border-gray-200 bg-white px-2 py-1.5 text-xs focus:outline-none",placeholder:"Título",value:f.title,onChange:h=>s(p,"title",h.target.value)}),a.jsx("input",{className:"rounded-lg border border-gray-200 bg-white px-2 py-1.5 text-xs focus:outline-none",placeholder:"Rodapé",value:f.footer,onChange:h=>s(p,"footer",h.target.value)})]}),a.jsx("textarea",{rows:2,className:"w-full rounded-lg border border-gray-200 bg-white px-2 py-1.5 text-xs focus:outline-none resize-none",placeholder:"Descrição/corpo",value:f.body,onChange:h=>s(p,"body",h.target.value)}),a.jsx("input",{className:"w-full rounded-lg border border-gray-200 bg-white px-2 py-1.5 text-xs focus:outline-none",placeholder:"URL da imagem (opcional)",value:f.imageUrl,onChange:h=>s(p,"imageUrl",h.target.value)}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("span",{className:"text-[10px] font-semibold text-gray-400 uppercase",children:"Botões do card"}),f.buttons.map((h,m)=>a.jsxs("div",{className:"flex gap-1.5",children:[a.jsx("input",{className:"w-20 rounded-lg border border-gray-200 bg-white px-2 py-1 text-[11px] focus:outline-none",placeholder:"ID",value:h.id,onChange:v=>l(p,m,"id",v.target.value)}),a.jsx("input",{className:"flex-1 rounded-lg border border-gray-200 bg-white px-2 py-1 text-[11px] focus:outline-none",placeholder:"Texto",value:h.text,onChange:v=>l(p,m,"text",v.target.value)}),a.jsx("button",{onClick:()=>o(p,m),disabled:f.buttons.length<=1,className:"p-1 rounded text-gray-400 hover:text-red-500 disabled:opacity-30",children:a.jsx(Te,{className:"w-3 h-3"})})]},m)),a.jsxs("button",{onClick:()=>i(p),className:"flex items-center gap-1 text-[11px] text-red-500 hover:underline font-medium",children:[a.jsx(Oe,{className:"w-3 h-3"})," Botão no card"]})]})]})]},p))}),e.cards.length<10&&a.jsxs("button",{onClick:n,className:"flex items-center gap-1 text-xs text-[#ef4444] hover:underline font-medium",children:[a.jsx(Oe,{className:"w-3.5 h-3.5"})," Adicionar card"]})]})}function gge({isOpen:e,onClose:t,chatId:n,onSent:r,onSchedule:s,initialPayload:i,initialType:o="TEXT"}){const[l,c]=b.useState(o),[u,d]=b.useState(Y0),[f,p]=b.useState(!1),[h,m]=b.useState(null),[v,x]=b.useState(!1),[y,g]=b.useState(""),[j,N]=b.useState(!1),w=b.useCallback(A=>d(E=>({...E,...A})),[]);b.useEffect(()=>{if(e&&i){const A=o??"TEXT";c(A),d({...Y0,...uge(A,i)})}else e&&!i&&(c(o??"TEXT"),d(Y0))},[e,i,o]);const S=async()=>{var A,E;if(n){m(null),p(!0);try{const P=Q0(l,u);await he.sendRich(n,P),r==null||r(),t()}catch(P){m(((E=(A=P==null?void 0:P.response)==null?void 0:A.data)==null?void 0:E.error)??(P==null?void 0:P.message)??"Erro ao enviar")}finally{p(!1)}}},k=async()=>{if(!y.trim()){N(!0);return}x(!0);try{const A=Q0(l,u);await he.createTemplate({name:y.trim(),type:l,payload:A,tags:[]}),N(!1),g("")}finally{x(!1)}},C=()=>{const A=Q0(l,u);s==null||s(l,A)},_=BC.find(A=>A.type===l);return Bi.createPortal(a.jsx(cd,{children:e&&a.jsx(na.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-black/40 backdrop-blur-sm z-50 flex items-end sm:items-center justify-center p-4",onClick:A=>{A.target===A.currentTarget&&t()},children:a.jsxs(na.div,{initial:{opacity:0,y:40,scale:.97},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:40,scale:.97},transition:{type:"spring",stiffness:300,damping:30},className:"bg-white rounded-2xl shadow-2xl w-full max-w-xl max-h-[92vh] flex flex-col overflow-hidden",children:[a.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-gray-100 shrink-0",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-base font-semibold text-[#111b21]",children:"Mensagem Rica"}),a.jsx("p",{className:"text-xs text-[#667781] mt-0.5",children:"Compose um tipo avançado de mensagem WhatsApp"})]}),a.jsx("button",{onClick:t,className:"p-2 rounded-full hover:bg-gray-100 text-gray-400",children:a.jsx(Ce,{className:"w-5 h-5"})})]}),a.jsx("div",{className:"px-5 pt-3 pb-2 shrink-0",children:a.jsx("div",{className:"flex gap-1 bg-[#f0f2f5] rounded-xl p-1",children:BC.map(A=>a.jsxs("button",{onClick:()=>c(A.type),className:`flex-1 flex items-center justify-center gap-1.5 px-2 py-1.5 rounded-lg text-[11px] font-semibold transition-all ${l===A.type?"bg-white shadow-sm":"text-[#667781] hover:text-[#111b21]"}`,style:l===A.type?{color:A.color}:{},children:[A.icon,a.jsx("span",{className:"hidden sm:block",children:A.label})]},A.type))})}),a.jsxs("div",{className:"flex-1 overflow-y-auto px-5 py-3",children:[l==="TEXT"&&a.jsx(dge,{form:u,set:w}),l==="BUTTONS"&&a.jsx(fge,{form:u,set:w}),l==="INTERACTIVE"&&a.jsx(pge,{form:u,set:w}),l==="LIST"&&a.jsx(hge,{form:u,set:w}),l==="POLL"&&a.jsx(mge,{form:u,set:w}),l==="CAROUSEL"&&a.jsx(xge,{form:u,set:w})]}),a.jsx(cd,{children:j&&a.jsx(na.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"px-5 py-2 border-t border-gray-100 bg-[#f8f9fa] overflow-hidden shrink-0",children:a.jsxs("div",{className:"flex gap-2 items-center",children:[a.jsx("input",{autoFocus:!0,className:"flex-1 rounded-xl border border-gray-200 bg-white px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-[#00a884]/30",placeholder:"Nome do template...",value:y,onChange:A=>g(A.target.value),onKeyDown:A=>{A.key==="Enter"&&k(),A.key==="Escape"&&N(!1)}}),a.jsx("button",{onClick:k,disabled:!y.trim()||v,className:"px-3 py-2 bg-[#00a884] text-white rounded-xl text-sm font-medium disabled:opacity-50 hover:bg-[#008f72]",children:v?"...":"Salvar"}),a.jsx("button",{onClick:()=>N(!1),className:"p-2 rounded-full hover:bg-gray-200 text-gray-400",children:a.jsx(Ce,{className:"w-4 h-4"})})]})})}),h&&a.jsx("div",{className:"mx-5 mb-2 px-3 py-2 bg-red-50 border border-red-200 rounded-xl text-xs text-red-600",children:h}),a.jsxs("div",{className:"px-5 py-3 border-t border-gray-100 flex items-center justify-between shrink-0",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsxs("button",{onClick:()=>N(!j),title:"Salvar como template",className:"flex items-center gap-1.5 px-3 py-2 rounded-xl text-xs font-medium text-[#667781] hover:bg-gray-100",children:[a.jsx(lI,{className:"w-4 h-4"}),a.jsx("span",{className:"hidden sm:block",children:"Salvar template"})]}),s&&a.jsxs("button",{onClick:C,title:"Agendar envio",className:"flex items-center gap-1.5 px-3 py-2 rounded-xl text-xs font-medium text-[#667781] hover:bg-gray-100",children:[a.jsx(Op,{className:"w-4 h-4"}),a.jsx("span",{className:"hidden sm:block",children:"Agendar"})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{onClick:t,className:"px-4 py-2 rounded-xl text-sm font-medium text-[#667781] hover:bg-gray-100",children:"Cancelar"}),a.jsxs("button",{onClick:S,disabled:f||!n,className:"flex items-center gap-2 px-4 py-2 rounded-xl text-sm font-semibold text-white disabled:opacity-50 transition-all active:scale-95",style:{backgroundColor:_.color},children:[f?a.jsx("span",{className:"w-4 h-4 border-2 border-white/40 border-t-white rounded-full animate-spin"}):a.jsx(Rr,{className:"w-4 h-4"}),"Enviar"]})]})]})]})})}),document.body)}const o8={TEXT:{label:"Texto",icon:a.jsx(eE,{className:"w-3.5 h-3.5"}),color:"#667781",bg:"#f0f2f5"},BUTTONS:{label:"Botões",icon:a.jsx(qP,{className:"w-3.5 h-3.5"}),color:"#0ea5e9",bg:"#e0f2fe"},INTERACTIVE:{label:"CTA",icon:a.jsx(UP,{className:"w-3.5 h-3.5"}),color:"#8b5cf6",bg:"#ede9fe"},LIST:{label:"Lista",icon:a.jsx(WP,{className:"w-3.5 h-3.5"}),color:"#f59e0b",bg:"#fef3c7"},POLL:{label:"Enquete",icon:a.jsx(ys,{className:"w-3.5 h-3.5"}),color:"#10b981",bg:"#d1fae5"},CAROUSEL:{label:"Carrossel",icon:a.jsx(VP,{className:"w-3.5 h-3.5"}),color:"#ef4444",bg:"#fee2e2"}};function vge({type:e}){const t=o8[e];return a.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[11px] font-semibold",style:{color:t.color,backgroundColor:t.bg},children:[t.icon,t.label]})}function yge({template:e}){var n,r,s,i;const t=e.payload;return e.type==="TEXT"?a.jsx("span",{className:"line-clamp-2",children:t.text||"—"}):e.type==="BUTTONS"?a.jsxs("span",{className:"line-clamp-1",children:[t.text||""," [",(t.nativeButtons??[]).length," botões]"]}):e.type==="INTERACTIVE"?a.jsxs("span",{className:"line-clamp-1",children:[t.text||""," [",(t.nativeButtons??[]).length," CTAs]"]}):e.type==="LIST"?a.jsxs("span",{className:"line-clamp-1",children:[t.text||""," — ",(n=t.nativeList)==null?void 0:n.buttonText]}):e.type==="POLL"?a.jsxs("span",{className:"line-clamp-1",children:["📊 ",(r=t.poll)==null?void 0:r.name," (",(((s=t.poll)==null?void 0:s.values)??[]).length," opções)"]}):e.type==="CAROUSEL"?a.jsxs("span",{className:"line-clamp-1",children:["🎠 ",(((i=t.nativeCarousel)==null?void 0:i.cards)??[]).length," cards"]}):null}const J0="ALL";function bge({isOpen:e,onClose:t,onSelect:n}){const[r,s]=b.useState([]),[i,o]=b.useState(!1),[l,c]=b.useState(""),[u,d]=b.useState(J0),[f,p]=b.useState(null),[h,m]=b.useState(null),v=b.useCallback(async()=>{o(!0);try{const j=await he.listTemplates({...u!==J0?{type:u}:{},...l?{search:l}:{}});s(j)}finally{o(!1)}},[u,l]);b.useEffect(()=>{e&&v()},[e,v]);const x=async(j,N)=>{if(j.stopPropagation(),!!confirm("Remover este template?")){p(N);try{await he.deleteTemplate(N),s(w=>w.filter(S=>S.id!==N))}finally{p(null)}}},y=j=>{m(j.id),he.markTemplateUsed(j.id).catch(()=>{}),setTimeout(()=>{n(j),m(null),t()},200)},g=[{key:J0,label:"Todos"},...Object.entries(o8).map(([j,N])=>({key:j,label:N.label}))];return Bi.createPortal(a.jsx(cd,{children:e&&a.jsx(na.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-black/40 backdrop-blur-sm z-50 flex items-center justify-center p-4",onClick:j=>{j.target===j.currentTarget&&t()},children:a.jsxs(na.div,{initial:{opacity:0,y:30,scale:.97},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:30,scale:.97},transition:{type:"spring",stiffness:300,damping:30},className:"bg-white rounded-2xl shadow-2xl w-full max-w-2xl max-h-[85vh] flex flex-col overflow-hidden",children:[a.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-gray-100 shrink-0",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-9 h-9 rounded-xl bg-[#e0f2fe] flex items-center justify-center",children:a.jsx(Ep,{className:"w-5 h-5 text-[#0ea5e9]"})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-base font-semibold text-[#111b21]",children:"Biblioteca de Templates"}),a.jsxs("p",{className:"text-xs text-[#667781]",children:[r.length," template",r.length!==1?"s":""," salvos"]})]})]}),a.jsx("button",{onClick:t,className:"p-2 rounded-full hover:bg-gray-100 text-gray-400",children:a.jsx(Ce,{className:"w-5 h-5"})})]}),a.jsx("div",{className:"px-5 py-3 border-b border-gray-100 shrink-0",children:a.jsxs("div",{className:"relative",children:[a.jsx(Ir,{className:"absolute left-3 top-2.5 w-4 h-4 text-gray-400"}),a.jsx("input",{className:"w-full pl-9 pr-4 py-2 rounded-xl bg-[#f0f2f5] border-none text-sm focus:outline-none focus:ring-2 focus:ring-[#00a884]/30",placeholder:"Pesquisar templates...",value:l,onChange:j=>c(j.target.value)})]})}),a.jsx("div",{className:"px-5 py-2 flex gap-1.5 overflow-x-auto shrink-0 border-b border-gray-100 pb-2",children:g.map(j=>a.jsx("button",{onClick:()=>d(j.key),className:`px-3 py-1.5 rounded-full text-xs font-semibold whitespace-nowrap transition-all ${u===j.key?"bg-[#111b21] text-white":"bg-[#f0f2f5] text-[#667781] hover:bg-gray-200"}`,children:j.label},j.key))}),a.jsx("div",{className:"flex-1 overflow-y-auto p-5",children:i?a.jsx("div",{className:"flex items-center justify-center py-16",children:a.jsx("span",{className:"w-6 h-6 border-2 border-gray-200 border-t-[#00a884] rounded-full animate-spin"})}):r.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[a.jsx(Ep,{className:"w-12 h-12 text-gray-200 mb-3"}),a.jsx("p",{className:"text-sm font-medium text-[#667781]",children:"Nenhum template encontrado"}),a.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Crie um template no compositor de mensagens"})]}):a.jsx("div",{className:"space-y-2",children:r.map(j=>a.jsx(na.button,{layout:!0,onClick:()=>y(j),className:`w-full text-left rounded-xl border p-4 transition-all hover:shadow-md active:scale-[0.99] group ${h===j.id?"border-[#00a884] bg-[#e7f8f2]":"border-gray-200 hover:border-gray-300 bg-white"}`,children:a.jsxs("div",{className:"flex items-start justify-between gap-3",children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[a.jsx(vge,{type:j.type}),j.usageCount>0&&a.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-gray-400",children:[a.jsx(hn,{className:"w-3 h-3"}),j.usageCount,"x usado"]})]}),a.jsx("p",{className:"text-sm font-semibold text-[#111b21] truncate",children:j.name}),j.description&&a.jsx("p",{className:"text-xs text-[#667781] mt-0.5 line-clamp-1",children:j.description}),a.jsx("p",{className:"text-xs text-gray-400 mt-1.5 line-clamp-2",children:a.jsx(yge,{template:j})}),j.tags.length>0&&a.jsx("div",{className:"flex gap-1 mt-2 flex-wrap",children:j.tags.map(N=>a.jsxs("span",{className:"px-1.5 py-0.5 bg-gray-100 text-[10px] text-gray-500 rounded",children:["#",N]},N))})]}),a.jsx("div",{className:"flex items-center gap-1 shrink-0",children:h===j.id?a.jsx(nn,{className:"w-5 h-5 text-[#00a884]"}):a.jsx("button",{onClick:N=>x(N,j.id),disabled:f===j.id,className:"p-1.5 rounded-full opacity-0 group-hover:opacity-100 hover:bg-red-50 text-gray-400 hover:text-red-500 transition-all",children:f===j.id?a.jsx("span",{className:"w-3.5 h-3.5 border border-gray-300 border-t-gray-500 rounded-full animate-spin block"}):a.jsx(Te,{className:"w-3.5 h-3.5"})})})]})},j.id))})})]})})}),document.body)}const jge=[{label:"Diariamente às 8h",expr:"0 8 * * *"},{label:"Seg a Sex às 9h",expr:"0 9 * * 1-5"},{label:"Toda segunda às 10h",expr:"0 10 * * 1"},{label:"Quinzenal (1/15)",expr:"0 9 1,15 * *"},{label:"Mensal (dia 1)",expr:"0 9 1 * *"},{label:"Semanal dom 11h",expr:"0 11 * * 0"}];function FC(){return`k_${Date.now()}_${Math.random().toString(36).slice(2,6)}`}function wge({isOpen:e,onClose:t,payload:n,messageType:r,onSaved:s}){const[i,o]=b.useState(1),[l,c]=b.useState("ONCE"),[u,d]=b.useState(""),[f,p]=b.useState("0 9 * * 1-5"),[h,m]=b.useState("BIRTHDAY"),[v,x]=b.useState("30"),[y,g]=b.useState(""),[j,N]=b.useState(""),[w,S]=b.useState([]),[k,C]=b.useState([{_key:FC(),jid:"",name:"",birthday:"",anniversary:"",signupDate:""}]),[_,A]=b.useState(!1),[E,P]=b.useState(null),[D,I]=b.useState(!1);b.useEffect(()=>{e&&he.getSessions().then(B=>S(B)).catch(()=>{})},[e]);const R=()=>C(B=>[...B,{_key:FC(),jid:"",name:"",birthday:"",anniversary:"",signupDate:""}]),M=B=>C(ae=>ae.filter(se=>se._key!==B)),W=(B,ae,se)=>C(xe=>xe.map(H=>H._key===B?{...H,[ae]:se}:H)),T=()=>!(!y.trim()||!j||l==="ONCE"&&!u||l==="RECURRING"&&!f.trim()),V=k.filter(B=>B.jid.trim()),X=async()=>{var B,ae;A(!0),P(null);try{await he.createScheduled({instanceId:j,name:y.trim(),payload:n,recipients:V.map(({_key:se,...xe})=>({...xe,jid:xe.jid.includes("@")?xe.jid:`${xe.jid.replace(/\D/g,"")}@s.whatsapp.net`})),scheduleType:l,scheduledAt:l==="ONCE"?u:void 0,cronExpr:l==="RECURRING"?f:l==="EVENT"&&h==="SIGNUP_DAYS"?v:void 0,eventType:l==="EVENT"?h:void 0,timezone:"America/Sao_Paulo"}),I(!0),s==null||s(),setTimeout(()=>{I(!1),t(),o(1)},2e3)}catch(se){P(((ae=(B=se==null?void 0:se.response)==null?void 0:B.data)==null?void 0:ae.error)??(se==null?void 0:se.message)??"Erro ao salvar")}finally{A(!1)}},U={TEXT:"Texto",BUTTONS:"Botões",INTERACTIVE:"CTA",LIST:"Lista",POLL:"Enquete",CAROUSEL:"Carrossel"},L=new Date(Date.now()+6e4).toISOString().slice(0,16);return Bi.createPortal(a.jsx(cd,{children:e&&a.jsx(na.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-black/50 backdrop-blur-sm z-[60] flex items-center justify-center p-4",onClick:B=>{B.target===B.currentTarget&&t()},children:a.jsxs(na.div,{initial:{opacity:0,y:30,scale:.97},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:30,scale:.97},transition:{type:"spring",stiffness:300,damping:30},className:"bg-white rounded-2xl shadow-2xl w-full max-w-lg max-h-[90vh] flex flex-col overflow-hidden",children:[a.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-gray-100 shrink-0",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-9 h-9 rounded-xl bg-[#fef3c7] flex items-center justify-center",children:a.jsx(Op,{className:"w-5 h-5 text-[#f59e0b]"})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-base font-semibold text-[#111b21]",children:"Agendar Mensagem"}),a.jsxs("p",{className:"text-xs text-[#667781]",children:["Tipo: ",U[r]]})]})]}),a.jsx("button",{onClick:t,className:"p-2 rounded-full hover:bg-gray-100 text-gray-400",children:a.jsx(Ce,{className:"w-5 h-5"})})]}),a.jsxs("div",{className:"px-5 py-3 flex items-center gap-2 shrink-0 border-b border-gray-100",children:[[1,2,3].map(B=>a.jsxs(O.Fragment,{children:[a.jsx("button",{onClick:()=>B<i?o(B):void 0,className:`w-7 h-7 rounded-full text-xs font-bold flex items-center justify-center transition-all ${i===B?"bg-[#f59e0b] text-white shadow-md scale-105":i>B?"bg-[#10b981] text-white":"bg-gray-100 text-gray-400"}`,children:i>B?a.jsx(nn,{className:"w-4 h-4"}):B}),B<3&&a.jsx(Pa,{className:"w-4 h-4 text-gray-300"})]},B)),a.jsx("span",{className:"ml-2 text-xs text-[#667781]",children:i===1?"Configurar disparo":i===2?"Destinatários":"Confirmar"})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto px-5 py-4",children:[i===1&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{className:"block text-xs font-semibold text-[#667781] uppercase tracking-wider",children:"Nome do agendamento"}),a.jsx("input",{className:"w-full rounded-xl border border-gray-200 bg-[#f8f9fa] px-3 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-[#f59e0b]/30",placeholder:"Ex: Aniversários de Abril",value:y,onChange:B=>g(B.target.value)})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{className:"block text-xs font-semibold text-[#667781] uppercase tracking-wider",children:"Instância WhatsApp"}),a.jsxs("select",{className:"w-full rounded-xl border border-gray-200 bg-[#f8f9fa] px-3 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-[#f59e0b]/30",value:j,onChange:B=>N(B.target.value),children:[a.jsx("option",{value:"",children:"Selecionar instância..."}),w.map(B=>a.jsxs("option",{value:B.id,disabled:B.status!=="CONNECTED",children:[B.name," ",B.status!=="CONNECTED"?"(desconectada)":""]},B.id))]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"block text-xs font-semibold text-[#667781] uppercase tracking-wider",children:"Tipo de agendamento"}),a.jsx("div",{className:"grid grid-cols-3 gap-2",children:[{type:"ONCE",label:"Uma vez",icon:a.jsx(hn,{className:"w-4 h-4"}),color:"#0ea5e9"},{type:"RECURRING",label:"Recorrente",icon:a.jsx(MI,{className:"w-4 h-4"}),color:"#8b5cf6"},{type:"EVENT",label:"Evento",icon:a.jsx(zP,{className:"w-4 h-4"}),color:"#ef4444"}].map(B=>a.jsxs("button",{onClick:()=>c(B.type),className:`flex flex-col items-center gap-1.5 p-3 rounded-xl border-2 transition-all text-sm font-semibold ${l===B.type?"border-current shadow-sm":"border-gray-200 text-gray-400 hover:border-gray-300"}`,style:l===B.type?{borderColor:B.color,color:B.color,backgroundColor:B.color+"10"}:{},children:[B.icon,B.label]},B.type))})]}),l==="ONCE"&&a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{className:"block text-xs font-semibold text-[#667781] uppercase tracking-wider",children:"Data e hora"}),a.jsx("input",{type:"datetime-local",min:L,className:"w-full rounded-xl border border-gray-200 bg-[#f8f9fa] px-3 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-[#0ea5e9]/30",value:u,onChange:B=>d(B.target.value)})]}),l==="RECURRING"&&a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{className:"block text-xs font-semibold text-[#667781] uppercase tracking-wider",children:"Expressão Cron"}),a.jsx("input",{className:"w-full rounded-xl border border-gray-200 bg-[#f8f9fa] px-3 py-2.5 text-sm font-mono focus:outline-none focus:ring-2 focus:ring-[#8b5cf6]/30",placeholder:"0 9 * * 1-5",value:f,onChange:B=>p(B.target.value)})]}),a.jsx("div",{className:"flex flex-wrap gap-1.5",children:jge.map(B=>a.jsx("button",{onClick:()=>p(B.expr),className:`px-2.5 py-1 rounded-lg text-xs font-medium transition-all ${f===B.expr?"bg-[#8b5cf6] text-white":"bg-gray-100 text-gray-600 hover:bg-gray-200"}`,children:B.label},B.expr))})]}),l==="EVENT"&&a.jsxs("div",{className:"space-y-3",children:[a.jsx("div",{className:"grid grid-cols-3 gap-2",children:[{type:"BIRTHDAY",label:"🎂 Aniversário"},{type:"ANNIVERSARY",label:"💍 Data Esp."},{type:"SIGNUP_DAYS",label:"📅 X dias"}].map(B=>a.jsx("button",{onClick:()=>m(B.type),className:`py-2.5 px-2 rounded-xl border-2 text-xs font-semibold transition-all ${h===B.type?"border-[#ef4444] bg-[#fee2e2] text-[#ef4444]":"border-gray-200 text-gray-500 hover:border-gray-300"}`,children:B.label},B.type))}),h==="SIGNUP_DAYS"&&a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("label",{className:"text-xs font-semibold text-[#667781] uppercase tracking-wider whitespace-nowrap",children:"Dias após cadastro"}),a.jsx("input",{type:"number",min:"1",max:"365",className:"w-24 rounded-xl border border-gray-200 bg-[#f8f9fa] px-3 py-2 text-sm focus:outline-none",value:v,onChange:B=>x(B.target.value)})]}),a.jsxs("div",{className:"rounded-xl bg-amber-50 border border-amber-200 px-3 py-2.5 text-xs text-amber-700",children:[a.jsx("strong",{children:"Variáveis disponíveis:"})," ","{{name}}, {{birthday}}, {{anniversary}}",a.jsx("br",{}),"São substituídas automaticamente por contato no envio."]})]})]}),i===2&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(et,{className:"w-4 h-4 text-[#667781]"}),a.jsx("span",{className:"text-sm font-semibold text-[#111b21]",children:"Destinatários"}),a.jsxs("span",{className:"text-xs text-[#667781]",children:["(",V.length," válido",V.length!==1?"s":"",")"]})]}),a.jsxs("button",{onClick:R,className:"flex items-center gap-1 text-xs text-[#00a884] font-medium hover:underline",children:[a.jsx(Oe,{className:"w-3.5 h-3.5"})," Adicionar"]})]}),a.jsx("div",{className:"space-y-3 max-h-[380px] overflow-y-auto pr-1",children:k.map(B=>a.jsxs("div",{className:"rounded-xl border border-gray-200 bg-[#f8f9fa] p-3 space-y-2",children:[a.jsxs("div",{className:"flex gap-2 items-start",children:[a.jsx("input",{className:"flex-[2] rounded-lg border border-gray-200 bg-white px-2 py-1.5 text-xs focus:outline-none focus:ring-1 focus:ring-[#00a884]",placeholder:"Número ex: 5511999999999",value:B.jid,onChange:ae=>W(B._key,"jid",ae.target.value)}),a.jsx("input",{className:"flex-1 rounded-lg border border-gray-200 bg-white px-2 py-1.5 text-xs focus:outline-none focus:ring-1 focus:ring-[#00a884]",placeholder:"Nome ({{name}})",value:B.name,onChange:ae=>W(B._key,"name",ae.target.value)}),a.jsx("button",{onClick:()=>M(B._key),disabled:k.length<=1,className:"p-1.5 rounded-full hover:bg-red-50 text-gray-400 hover:text-red-500 disabled:opacity-30",children:a.jsx(Te,{className:"w-3.5 h-3.5"})})]}),l==="EVENT"&&a.jsxs("div",{className:"grid grid-cols-2 gap-1.5",children:[h==="BIRTHDAY"&&a.jsx("input",{type:"date",className:"rounded-lg border border-gray-200 bg-white px-2 py-1 text-[11px] focus:outline-none",placeholder:"Aniversário",value:B.birthday,onChange:ae=>W(B._key,"birthday",ae.target.value)}),h==="ANNIVERSARY"&&a.jsx("input",{type:"date",className:"rounded-lg border border-gray-200 bg-white px-2 py-1 text-[11px] focus:outline-none",placeholder:"Data esp.",value:B.anniversary,onChange:ae=>W(B._key,"anniversary",ae.target.value)}),h==="SIGNUP_DAYS"&&a.jsx("input",{type:"date",className:"rounded-lg border border-gray-200 bg-white px-2 py-1 text-[11px] focus:outline-none",placeholder:"Data cadastro",value:B.signupDate,onChange:ae=>W(B._key,"signupDate",ae.target.value)})]})]},B._key))})]}),i===3&&a.jsx("div",{className:"space-y-4",children:D?a.jsxs("div",{className:"flex flex-col items-center py-8 gap-3",children:[a.jsx(nn,{className:"w-12 h-12 text-[#10b981]"}),a.jsx("p",{className:"text-base font-semibold text-[#111b21]",children:"Agendamento criado!"})]}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"rounded-xl bg-[#f8f9fa] border border-gray-200 p-4 space-y-3",children:[a.jsx("p",{className:"text-sm font-semibold text-[#111b21]",children:y}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs text-[#667781]",children:[a.jsxs("span",{children:["Tipo: ",a.jsx("strong",{className:"text-[#111b21]",children:U[r]})]}),a.jsxs("span",{children:["Disparo: ",a.jsx("strong",{className:"text-[#111b21]",children:l==="ONCE"?"Uma vez":l==="RECURRING"?"Recorrente":"Evento"})]}),a.jsxs("span",{children:["Destinatários: ",a.jsx("strong",{className:"text-[#111b21]",children:V.length})]}),l==="ONCE"&&u&&a.jsxs("span",{children:["Em: ",a.jsx("strong",{className:"text-[#111b21]",children:new Date(u).toLocaleString("pt-BR")})]}),l==="RECURRING"&&a.jsxs("span",{children:["Cron: ",a.jsx("strong",{className:"text-[#111b21] font-mono",children:f})]})]})]}),E&&a.jsxs("div",{className:"flex items-start gap-2 px-3 py-2.5 bg-red-50 border border-red-200 rounded-xl text-xs text-red-600",children:[a.jsx(Kt,{className:"w-4 h-4 shrink-0 mt-0.5"}),E]})]})})]}),a.jsxs("div",{className:"px-5 py-3 border-t border-gray-100 flex items-center justify-between shrink-0",children:[a.jsx("button",{onClick:()=>i>1?o(B=>B-1):t(),className:"px-4 py-2 rounded-xl text-sm font-medium text-[#667781] hover:bg-gray-100",children:i===1?"Cancelar":"Voltar"}),i<3?a.jsxs("button",{onClick:()=>o(B=>B+1),disabled:i===1&&!T(),className:"flex items-center gap-2 px-4 py-2 rounded-xl text-sm font-semibold bg-[#f59e0b] text-white disabled:opacity-50 hover:bg-[#d97706] transition-colors",children:["Próximo ",a.jsx(Pa,{className:"w-4 h-4"})]}):!D&&a.jsxs("button",{onClick:X,disabled:_||V.length===0,className:"flex items-center gap-2 px-4 py-2 rounded-xl text-sm font-semibold bg-[#00a884] text-white disabled:opacity-50 hover:bg-[#008f72] transition-colors",children:[_?a.jsx("span",{className:"w-4 h-4 border-2 border-white/40 border-t-white rounded-full animate-spin"}):a.jsx(Op,{className:"w-4 h-4"}),"Agendar"]})]})]})})}),document.body)}const VC=["#00a884","#25d366","#128c7e","#34b7f1","#7b68ee","#ff6b6b","#f59e0b","#10b981"];function Nge(e){let t=0;for(let n=0;n<e.length;n++)t=e.charCodeAt(n)+((t<<5)-t);return VC[Math.abs(t)%VC.length]}function Sge(e){if(!e)return"?";const t=e.trim().split(/\s+/);return t.length>=2?(t[0][0]+t[t.length-1][0]).toUpperCase():e.trim().charAt(0).toUpperCase()}function kge(e){if(!e)return"";const t=new Date(e);if(isNaN(t.getTime()))return"";const n=new Date;n.setHours(0,0,0,0);const r=new Date(t);r.setHours(0,0,0,0);const s=Math.round((n.getTime()-r.getTime())/864e5);return s===0?t.toLocaleTimeString("pt-BR",{hour:"2-digit",minute:"2-digit"}):s===1?"Ontem":s<7?t.toLocaleDateString("pt-BR",{weekday:"short"}).replace(".","").replace(/^\w/,i=>i.toUpperCase()):t.toLocaleDateString("pt-BR",{day:"2-digit",month:"2-digit",year:"2-digit"})}function Cge(e){if(!e)return"";const t=new Date(e);return isNaN(t.getTime())?"":t.toLocaleTimeString("pt-BR",{hour:"2-digit",minute:"2-digit"})}function _ge(e){const t=new Date(e);if(isNaN(t.getTime()))return"";const n=new Date;n.setHours(0,0,0,0);const r=new Date(t);r.setHours(0,0,0,0);const s=Math.round((n.getTime()-r.getTime())/864e5);return s===0?"Hoje":s===1?"Ontem":t.toLocaleDateString("pt-BR",{day:"2-digit",month:"long",year:"numeric"})}function Age(e,t){const n=new Date(e),r=new Date(t);return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()&&n.getDate()===r.getDate()}function Bo({src:e,name:t,size:n=40,className:r=""}){const[s,i]=b.useState(!1);b.useEffect(()=>i(!1),[e]);const o=Nge(t||"?"),l=Sge(t);return a.jsx("div",{className:`rounded-full overflow-hidden flex-shrink-0 flex items-center justify-center border border-black/5 ${r}`,style:{width:n,height:n,backgroundColor:s||!e?o:"transparent"},children:e&&!s?a.jsx("img",{src:e,alt:t??"",className:"w-full h-full object-cover",onError:()=>i(!0)}):a.jsx("span",{className:"font-semibold text-white select-none",style:{fontSize:n*.38},children:l})})}const Xh={CONNECTED:{label:"Conectado",bg:"bg-[#00a884]/10 text-[#00a884] border-[#00a884]/20",dot:"bg-[#00a884] animate-pulse"},QR_PENDING:{label:"Aguard. QR",bg:"bg-amber-500/10 text-amber-600 border-amber-500/20",dot:"bg-amber-500 animate-pulse"},CONNECTING:{label:"Conectando",bg:"bg-blue-500/10 text-blue-600 border-blue-500/20",dot:"bg-blue-500 animate-pulse"},DISCONNECTED:{label:"Desconect.",bg:"bg-[#f0f2f5] text-[#667781] border-[#d1d7db]",dot:"bg-[#8696a0]"},BANNED:{label:"Banido",bg:"bg-red-50 text-red-600 border-red-200",dot:"bg-red-500"}};function l8({status:e}){const{label:t,bg:n,dot:r}=Xh[e]??Xh.DISCONNECTED;return a.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[11px] font-semibold border ${n}`,children:[a.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${r}`}),t]})}function c8({status:e,size:t=14}){return e==="READ"?a.jsx(Tp,{size:t,className:"text-[#53bdeb] flex-shrink-0"}):e==="DELIVERED"?a.jsx(Tp,{size:t,className:"text-[#8696a0] flex-shrink-0"}):e==="SENT"?a.jsx(jt,{size:t,className:"text-[#8696a0] flex-shrink-0"}):e==="PENDING"?a.jsx(hn,{size:t,className:"text-[#8696a0] flex-shrink-0"}):e==="FAILED"?a.jsx(Ar,{size:t,className:"text-red-500 flex-shrink-0"}):null}function Pge({chat:e}){const t=e.lastMessage;if(!t)return a.jsx("span",{className:"italic",children:"Sem mensagens"});const n=(()=>{var i;const s=(i=t.type)==null?void 0:i.toUpperCase();return s==="IMAGE"||s==="STICKER"?a.jsx(FP,{size:13,className:"text-[#8696a0] flex-shrink-0"}):s==="VIDEO"?a.jsx(tE,{size:13,className:"text-[#8696a0] flex-shrink-0"}):s==="AUDIO"||s==="PTT"?a.jsx(g1,{size:13,className:"text-[#8696a0] flex-shrink-0"}):s==="DOCUMENT"?a.jsx(Hr,{size:13,className:"text-[#8696a0] flex-shrink-0"}):null})(),r=t.body||(t.type!=="TEXT"?t.type:"");return a.jsxs("span",{className:"flex items-center gap-1 truncate",children:[n,r||a.jsx("span",{className:"italic text-[#8696a0]",children:"[mídia]"})]})}const UC=244,jc=224;function Ege({chat:e,isActive:t,onSelect:n,onArchive:r,onPin:s,onMarkRead:i,onDelete:o}){var x;const l=e.displayName??e.phone,[c,u]=b.useState(null),[d,f]=b.useState(!1),p=b.useRef(null),h=(y,g,j)=>{const N=j??g,S=window.innerHeight-N>=UC+8?N+4:g-UC,k=Math.min(y,window.innerWidth-jc-8);u({top:Math.max(8,S),left:Math.max(8,k)})},m=[{key:"favorite",label:d?"Remover favorito":"Favoritar",icon:d?a.jsx(LI,{size:15}):a.jsx(gd,{size:15})},{key:"archive",label:e.isArchived?"Desarquivar":"Arquivar",icon:e.isArchived?a.jsx(nI,{size:15}):a.jsx(rI,{size:15})},{key:"pin",label:e.isPinned?"Desafixar":"Fixar conversa",icon:e.isPinned?a.jsx(TI,{size:15}):a.jsx(H2,{size:15})},{key:"read",label:"Marcar como lida",icon:a.jsx(SI,{size:15})},{key:"delete",label:"Apagar conversa",icon:a.jsx(Te,{size:15}),danger:!0}],v=y=>{u(null),y==="favorite"&&f(g=>!g),y==="archive"&&r(!e.isArchived),y==="pin"&&s(!e.isPinned),y==="read"&&i(),y==="delete"&&o()};return a.jsxs(a.Fragment,{children:[a.jsxs("div",{role:"button",tabIndex:0,onClick:n,onKeyDown:y=>(y.key==="Enter"||y.key===" ")&&n(),onContextMenu:y=>{y.preventDefault();const j=window.innerWidth-y.clientX>=jc+8?y.clientX:y.clientX-jc;h(Math.max(8,j),y.clientY,y.clientY)},className:`w-full flex items-center gap-3 px-3 py-2.5 transition-all cursor-pointer select-none group
border-b border-[#f0f2f5] last:border-none focus:outline-none focus-visible:ring-2 focus-visible:ring-[#00a884]/40
${t?"bg-[#f0f2f5]":"hover:bg-[#f5f6f6]"}`,children:[a.jsx(Bo,{src:e.avatar,name:l,size:49}),a.jsxs("div",{className:"flex-1 min-w-0 flex flex-col justify-center py-0.5 pr-1",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h3",{className:"text-[16px] leading-[21px] font-normal text-[#111b21] truncate",children:l}),a.jsx("span",{className:`text-[12px] leading-[14px] flex-shrink-0 ml-2 ${e.unreadCount>0?"text-[#00a884] font-medium":"text-[#667781]"}`,children:kge(e.lastMessageAt)})]}),a.jsxs("div",{className:"flex items-center justify-between mt-1 h-5",children:[a.jsxs("div",{className:"flex items-center gap-1 flex-1 min-w-0 text-[13px] leading-5 text-[#667781] truncate",children:[((x=e.lastMessage)==null?void 0:x.fromMe)&&a.jsx(c8,{status:e.lastMessage.status,size:13}),a.jsx("span",{className:"truncate",children:a.jsx(Pge,{chat:e})})]}),a.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0 ml-1",children:[e.isPinned&&a.jsx(H2,{size:14,className:"text-[#8696a0]"}),e.unreadCount>0&&a.jsx("span",{className:"bg-[#00a884] text-white text-[12px] font-bold px-1.5 min-w-[20px] h-5 rounded-full flex items-center justify-center",children:e.unreadCount>99?"99+":e.unreadCount}),a.jsx("div",{className:"hidden group-hover:block",children:a.jsx("button",{ref:p,onClick:y=>{var j;y.stopPropagation();const g=(j=p.current)==null?void 0:j.getBoundingClientRect();g&&h(g.right-jc,g.top,g.bottom)},className:"p-1 rounded-full hover:bg-black/5",title:"Opções",children:a.jsx(aa,{size:16,className:"text-[#8696a0]"})})})]})]})]})]}),c&&typeof window<"u"&&YR.createPortal(a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"fixed inset-0 z-[1000]",onClick:()=>u(null)}),a.jsx("div",{className:"fixed bg-white py-1.5 rounded-lg shadow-xl border border-gray-100 z-[1001] flex flex-col",style:{top:c.top,left:c.left,width:jc},onClick:y=>y.stopPropagation(),children:m.map(y=>a.jsxs("button",{onClick:()=>v(y.key),className:`flex items-center gap-3 px-4 py-2.5 text-sm transition-colors text-left
${y.danger?"text-red-600 hover:bg-red-50":"text-[#3b4a54] hover:bg-[#f5f6f6]"}`,children:[a.jsx("span",{className:y.danger?"text-red-500":"text-[#8696a0]",children:y.icon}),y.label]},y.key))})]}),document.body)]})}function u8(e){return e.mediaUrl?`/api/nw/v1/media/${e.id}`:null}function Oge({msg:e,TimeEl:t,TimeRow:n,Spacer:r}){const[s,i]=b.useState(!1),[o,l]=b.useState(!1),c=u8(e);return!c||o?a.jsxs("div",{children:[a.jsx("div",{className:"flex items-center justify-center w-48 h-32 bg-black/5 rounded-lg",children:a.jsx(FP,{size:28,className:"text-[#8696a0]"})}),n]}):a.jsxs("div",{className:"rounded-lg overflow-hidden",children:[!s&&a.jsx("div",{className:"w-48 h-32 bg-black/5 animate-pulse rounded-lg"}),a.jsx("img",{src:c,alt:"Imagem",loading:"lazy",className:`max-w-full max-h-[300px] object-cover block cursor-pointer ${s?"":"hidden"}`,onLoad:()=>i(!0),onError:()=>l(!0),onClick:()=>window.open(c,"_blank")}),e.caption&&s&&a.jsxs("div",{className:"relative px-1 pt-1.5 pb-0.5",children:[a.jsxs("p",{className:"text-[14.2px] break-words whitespace-pre-wrap leading-[1.6] text-[#111b21]",children:[e.caption,r]}),a.jsx("div",{className:"absolute bottom-0.5 right-1",children:t})]}),!e.caption&&s&&a.jsx("div",{className:"px-1 pb-0.5",children:n})]})}function Tge({msg:e,showTail:t,showSender:n,senderName:r}){const s=e.fromMe,i=Cge(e.timestamp),o=s?62:42,l=a.jsx("span",{className:"inline-block pointer-events-none select-none opacity-0 align-bottom",style:{width:o,height:14},"aria-hidden":!0}),c=a.jsxs("span",{className:"inline-flex items-center gap-[3px] text-[11px] text-[#667781] leading-none select-none flex-shrink-0",children:[i,s&&a.jsx(c8,{status:e.status,size:12})]}),u=a.jsx("div",{className:"flex items-center justify-end gap-[3px] mt-1 pr-0.5",children:c}),d=()=>{var m,v,x;const f=(m=e.type)==null?void 0:m.toUpperCase(),p=u8(e);if(f==="IMAGE")return a.jsx(Oge,{msg:e,TimeEl:c,TimeRow:u,Spacer:l});if(f==="VIDEO")return a.jsxs("div",{children:[p?a.jsx("video",{src:p,controls:!0,preload:"metadata",className:"max-w-full max-h-[300px] rounded-lg block bg-black/10",style:{minWidth:240}}):a.jsx("div",{className:"flex items-center justify-center w-60 h-36 bg-black/10 rounded-lg",children:a.jsx(tE,{size:28,className:"text-[#8696a0]"})}),u]});if(f==="AUDIO"||f==="PTT")return a.jsxs("div",{className:"min-w-[220px]",children:[p?a.jsx("audio",{controls:!0,preload:"metadata",className:"w-full h-10 rounded-lg",children:a.jsx("source",{src:p,type:e.mimeType||"audio/ogg"})}):a.jsxs("div",{className:"flex items-center gap-2 text-[#667781] italic text-[13px]",children:[a.jsx(g1,{size:14})," Áudio indisponível"]}),u]});if(f==="DOCUMENT"){const y=((x=(v=e.mimeType)==null?void 0:v.split("/")[1])==null?void 0:x.toUpperCase())||"FILE";return a.jsxs("div",{children:[a.jsxs("a",{href:p??"#",download:e.fileName??"arquivo",target:"_blank",rel:"noreferrer",className:"flex items-center gap-3 bg-[#f0f2f5] p-3 rounded-xl border border-black/5 hover:bg-gray-200 transition-all no-underline",children:[a.jsx("div",{className:"w-10 h-10 bg-[#00a884]/10 rounded-lg flex items-center justify-center text-[#00a884] flex-shrink-0",children:a.jsx(Hr,{size:22})}),a.jsxs("div",{className:"flex flex-col min-w-0",children:[a.jsx("span",{className:"text-[14px] font-normal truncate text-[#111b21]",children:e.fileName||e.body||"Documento"}),a.jsx("span",{className:"text-[11px] text-[#667781] uppercase mt-0.5",children:y})]})]}),u]})}if(f==="STICKER")return a.jsxs("div",{children:[p?a.jsx("img",{src:p,alt:"Sticker",loading:"lazy",className:"max-w-[180px] max-h-[180px]"}):a.jsxs("div",{className:"flex items-center gap-2 text-[13px] text-[#667781] italic",children:[a.jsx(gd,{size:14})," Figurinha"]}),u]});const h=e.body||e.caption;return h?a.jsxs("p",{className:"text-[14.2px] break-words whitespace-pre-wrap leading-[1.6] text-[#111b21]",children:[h,a.jsx("span",{style:{float:"right",marginLeft:6,position:"relative",bottom:-3},children:c})]}):a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-2 text-[12px] text-[#8696a0] italic",children:[a.jsx(Ar,{size:12})," Mensagem não disponível"]}),u]})};return a.jsx("div",{className:`flex w-full mb-[2px] ${s?"justify-end pr-4":"justify-start pl-4"}`,children:a.jsxs("div",{className:"flex flex-col max-w-[75%] relative",children:[n&&r&&!s&&a.jsx("span",{className:"text-[11px] font-bold text-[#00a884] mb-1 ml-2 truncate",children:r}),a.jsxs("div",{className:`px-2 py-1.5 rounded-lg shadow-[0_1px_0.5px_rgba(11,20,26,0.13)] relative overflow-visible
${s?`bg-[#d9fdd3] ${t?"rounded-tr-none":""}`:`bg-white ${t?"rounded-tl-none":""}`}`,children:[t&&a.jsx("div",{className:"absolute top-0 pointer-events-none",style:{[s?"right":"left"]:-8,width:10,height:14,backgroundColor:s?"#d9fdd3":"#ffffff",clipPath:s?"polygon(0 0, 100% 0, 0 100%)":"polygon(100% 0, 0 0, 100% 100%)"}}),d()]})]})})}function $ge({label:e}){return a.jsx("div",{className:"flex items-center justify-center my-3",children:a.jsx("span",{className:"bg-[#e1f3fb] text-[#54656f] text-[12.5px] px-3 py-[3px] rounded-full shadow-sm border border-[#cde9f4]/60 select-none",children:e})})}function Mge(e){const t=e.replace(/\D/g,"");return t.startsWith("55")&&(t.length===12||t.length===13)?t:t.length===10||t.length===11?"55"+t:t}function Rge({sessionId:e,onClose:t,onSent:n}){const[r,s]=b.useState(""),[i,o]=b.useState(""),[l,c]=b.useState(!1),[u,d]=b.useState(!1),[f,p]=b.useState(""),h=b.useRef(null),m=b.useRef(null);b.useEffect(()=>{setTimeout(()=>{var x;return(x=h.current)==null?void 0:x.focus()},80)},[]);const v=async()=>{var y,g,j,N;const x=Mge(r);if(x.length<10){p("Número inválido. Ex: 67 99913-8794"),(y=h.current)==null||y.focus();return}if(!i.trim()){p("Escreva uma mensagem para iniciar"),(g=m.current)==null||g.focus();return}c(!0),p("");try{await he.startConversation(e,x,i.trim()),d(!0),setTimeout(()=>{n(),t()},1200)}catch(w){p(((N=(j=w==null?void 0:w.response)==null?void 0:j.data)==null?void 0:N.error)??w.message??"Erro ao enviar"),c(!1)}};return a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40 backdrop-blur-sm p-4",onClick:l?void 0:t,children:a.jsxs("div",{className:"bg-white rounded-2xl shadow-2xl w-full max-w-sm overflow-hidden",onClick:x=>x.stopPropagation(),children:[a.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-gray-100",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"w-8 h-8 rounded-full bg-[#00a884]/10 flex items-center justify-center",children:a.jsx(rn,{size:14,className:"text-[#00a884]"})}),a.jsx("h3",{className:"text-[15px] font-bold text-[#111b21]",children:"Nova Conversa"})]}),a.jsx("button",{onClick:t,disabled:l,className:"p-1.5 hover:bg-gray-100 rounded-full transition-colors",children:a.jsx(Ce,{size:18,className:"text-[#667781]"})})]}),a.jsxs("div",{className:"p-5 space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-[12px] font-semibold text-[#667781] mb-1.5 uppercase tracking-wide",children:"Número do WhatsApp"}),a.jsx("input",{ref:h,type:"text",value:r,onChange:x=>{s(x.target.value.replace(/[^\d\s\-()+]/g,"")),p("")},onKeyDown:x=>{var y;return x.key==="Enter"&&((y=m.current)==null?void 0:y.focus())},placeholder:"Ex: 67 99913-8794",disabled:l||u,className:"w-full px-3 py-2.5 text-[14px] text-[#111b21] border border-gray-200 rounded-xl outline-none focus:border-[#00a884] focus:ring-2 focus:ring-[#00a884]/10 transition-all disabled:opacity-50"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-[12px] font-semibold text-[#667781] mb-1.5 uppercase tracking-wide",children:"Primeira mensagem"}),a.jsx("textarea",{ref:m,value:i,onChange:x=>{o(x.target.value),p("")},onKeyDown:x=>{x.key==="Enter"&&(x.ctrlKey||x.metaKey)&&(x.preventDefault(),v())},rows:3,placeholder:"Olá! Tudo bem?",disabled:l||u,className:"w-full px-3 py-2.5 text-[14px] text-[#111b21] border border-gray-200 rounded-xl outline-none focus:border-[#00a884] focus:ring-2 focus:ring-[#00a884]/10 resize-none transition-all disabled:opacity-50"}),a.jsx("p",{className:"text-[11px] text-[#8696a0] mt-1",children:"Ctrl+Enter para enviar"})]}),f&&a.jsx("p",{className:"text-red-500 text-[13px] font-medium",children:f})]}),a.jsx("div",{className:"px-5 pb-5",children:a.jsx("button",{onClick:v,disabled:!r.trim()||!i.trim()||l||u,className:"w-full py-2.5 rounded-xl font-semibold text-[14px] transition-all bg-[#00a884] text-white hover:bg-[#008f6e] disabled:opacity-40 disabled:cursor-not-allowed flex items-center justify-center gap-2",children:u?a.jsxs(a.Fragment,{children:[a.jsx(jt,{size:16})," Enviado!"]}):l?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"w-4 h-4 border-2 border-white/40 border-t-white rounded-full animate-spin"})," Enviando…"]}):a.jsxs(a.Fragment,{children:[a.jsx(Rr,{size:15})," Iniciar Conversa"]})})})]})})}const dw={notificacoes:"Notificações",entregas:"Entregas",suporte:"Suporte",marketing:"Marketing",geral:"Geral"},WC={notificacoes:"bg-blue-100 text-blue-700 border-blue-200",entregas:"bg-orange-100 text-orange-700 border-orange-200",suporte:"bg-purple-100 text-purple-700 border-purple-200",marketing:"bg-pink-100 text-pink-700 border-pink-200",geral:"bg-gray-100 text-gray-600 border-gray-200"},fw={1:"Principal",2:"Fallback",3:"Terciário",4:"4º",5:"5º"};function Dge({role:e,priority:t}){const n=WC[e]??WC.geral,r=dw[e]??e,s=fw[t]??`P${t}`;return a.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[a.jsx("span",{className:`text-[10px] font-semibold px-1.5 py-0.5 rounded border ${n}`,children:r}),a.jsx("span",{className:"text-[10px] font-semibold px-1.5 py-0.5 rounded border bg-slate-100 text-slate-600 border-slate-200",children:s})]})}function Ige({onClose:e,onCreated:t}){const[n,r]=b.useState("form"),[s,i]=b.useState(""),[o,l]=b.useState("geral"),[c,u]=b.useState(""),[d,f]=b.useState(1),[p,h]=b.useState(""),[m,v]=b.useState(!1),[x,y]=b.useState(""),[g,j]=b.useState(""),[N,w]=b.useState(!1),S=async()=>{var C,_;if(!s.trim()){y("Informe um nome/apelido para o número.");return}v(!0),y("");try{const A=await he.createSession(s.trim());await he.saveNumber({instance_id:A.id,label:s.trim(),role:o,area:c.trim()||null,priority:d,notes:p.trim()||null}),r("qr"),w(!0);let E=0;const P=setInterval(async()=>{E++;try{const D=await he.getQr(A.id);j(D.qrBase64),clearInterval(P),w(!1)}catch{E>=15&&(clearInterval(P),w(!1))}},2e3)}catch(A){y(((_=(C=A==null?void 0:A.response)==null?void 0:C.data)==null?void 0:_.error)??A.message??"Erro ao criar sessão")}finally{v(!1)}},k=()=>{t(),e()};return a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40 backdrop-blur-sm p-4",children:a.jsxs("div",{className:"bg-white rounded-2xl shadow-2xl w-full max-w-md overflow-hidden",children:[a.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-gray-100",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"w-8 h-8 rounded-full bg-[#00a884]/10 flex items-center justify-center",children:n==="form"?a.jsx(Oe,{size:16,className:"text-[#00a884]"}):a.jsx(js,{size:16,className:"text-[#00a884]"})}),a.jsx("h3",{className:"text-[15px] font-bold text-[#111b21]",children:n==="form"?"Novo Número WhatsApp":"Escanear QR Code"})]}),a.jsx("button",{onClick:e,className:"p-1.5 hover:bg-gray-100 rounded-full transition-colors",children:a.jsx(Ce,{size:18,className:"text-[#667781]"})})]}),n==="form"?a.jsxs("div",{className:"p-5 space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-[12px] font-semibold text-[#667781] mb-1.5 uppercase tracking-wide",children:"Apelido / Nome"}),a.jsx("input",{type:"text",value:s,onChange:C=>i(C.target.value),placeholder:"Ex: Atendimento Principal, Entregas, Marketing…",className:"w-full px-3 py-2.5 text-[14px] text-[#111b21] border border-gray-200 rounded-xl outline-none focus:border-[#00a884] focus:ring-2 focus:ring-[#00a884]/10 transition-all"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-[12px] font-semibold text-[#667781] mb-1.5 uppercase tracking-wide",children:"Função"}),a.jsx("select",{value:o,onChange:C=>l(C.target.value),className:"w-full px-3 py-2.5 pr-8 text-[14px] text-[#111b21] border border-gray-200 rounded-xl outline-none focus:border-[#00a884] bg-white bg-[url('data:image/svg+xml;utf8,<svg xmlns=%22http://www.w3.org/2000/svg%22 width=%2212%22 height=%2212%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%238696a0%22 stroke-width=%222%22><polyline points=%226 9 12 15 18 9%22/></svg>')] bg-no-repeat bg-[right_12px_center] appearance-none cursor-pointer",children:Object.entries(dw).map(([C,_])=>a.jsx("option",{value:C,children:_},C))})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-[12px] font-semibold text-[#667781] mb-1.5 uppercase tracking-wide",children:"Prioridade"}),a.jsx("select",{value:d,onChange:C=>f(Number(C.target.value)),className:"w-full px-3 py-2.5 pr-8 text-[14px] text-[#111b21] border border-gray-200 rounded-xl outline-none focus:border-[#00a884] bg-white bg-[url('data:image/svg+xml;utf8,<svg xmlns=%22http://www.w3.org/2000/svg%22 width=%2212%22 height=%2212%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%238696a0%22 stroke-width=%222%22><polyline points=%226 9 12 15 18 9%22/></svg>')] bg-no-repeat bg-[right_12px_center] appearance-none cursor-pointer",children:[1,2,3,4,5].map(C=>a.jsx("option",{value:C,children:fw[C]??`P${C}`},C))})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-[12px] font-semibold text-[#667781] mb-1.5 uppercase tracking-wide",children:"Área (opcional)"}),a.jsx("input",{type:"text",value:c,onChange:C=>u(C.target.value),placeholder:"Ex: Campo Grande",className:"w-full px-3 py-2.5 text-[14px] text-[#111b21] border border-gray-200 rounded-xl outline-none focus:border-[#00a884] transition-all"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-[12px] font-semibold text-[#667781] mb-1.5 uppercase tracking-wide",children:"Observações (opcional)"}),a.jsx("textarea",{value:p,onChange:C=>h(C.target.value),rows:2,placeholder:"Ex: Fallback quando o principal cair",className:"w-full px-3 py-2.5 text-[14px] text-[#111b21] border border-gray-200 rounded-xl outline-none focus:border-[#00a884] resize-none transition-all"})]}),x&&a.jsx("p",{className:"text-red-500 text-[13px] font-medium",children:x}),a.jsxs("button",{onClick:S,disabled:m||!s.trim(),className:"w-full py-3 bg-[#00a884] hover:bg-[#017f67] disabled:opacity-50 text-white font-bold rounded-xl transition-all text-[14px] flex items-center justify-center gap-2",children:[m?a.jsx("span",{className:"w-4 h-4 border-2 border-white/40 border-t-white rounded-full animate-spin"}):a.jsx(js,{size:16}),m?"Criando sessão…":"Criar e gerar QR Code"]})]}):a.jsxs("div",{className:"p-5 flex flex-col items-center gap-4",children:[a.jsx("p",{className:"text-[13px] text-[#667781] text-center",children:"Abra o WhatsApp no celular → Menu → Aparelhos conectados → Conectar aparelho"}),N&&!g?a.jsxs("div",{className:"w-52 h-52 rounded-2xl bg-[#f0f2f5] flex flex-col items-center justify-center gap-3",children:[a.jsx("div",{className:"w-8 h-8 border-2 border-[#00a884] border-t-transparent rounded-full animate-spin"}),a.jsx("p",{className:"text-[12px] text-[#667781]",children:"Aguardando QR…"})]}):g?a.jsx("img",{src:g,alt:"QR Code",className:"w-52 h-52 rounded-2xl border-2 border-[#00a884]/20 bg-white p-2"}):a.jsx("div",{className:"w-52 h-52 rounded-2xl bg-[#f0f2f5] flex items-center justify-center text-[#667781] text-[13px] italic text-center px-4",children:"QR não disponível. Verifique a aba Sessões."}),a.jsx("p",{className:"text-[11px] text-[#8696a0] text-center",children:"O QR expira em 60 s. Após conectar, feche este modal."}),a.jsx("button",{onClick:k,className:"w-full py-2.5 bg-[#00a884] hover:bg-[#017f67] text-white font-bold rounded-xl transition-all text-[14px]",children:"Concluído"})]})]})})}function Lge({num:e,session:t,onClose:n,onSaved:r}){const[s,i]=b.useState((e==null?void 0:e.label)??(t==null?void 0:t.name)??""),[o,l]=b.useState((e==null?void 0:e.role)??"geral"),[c,u]=b.useState((e==null?void 0:e.area)??""),[d,f]=b.useState((e==null?void 0:e.priority)??1),[p,h]=b.useState((e==null?void 0:e.notes)??""),[m,v]=b.useState((e==null?void 0:e.active)??!0),[x,y]=b.useState(!1),[g,j]=b.useState(""),[N,w]=b.useState(!1),[S,k]=b.useState((t!=null&&t.id,"")),[C,_]=b.useState(!1),[A,E]=b.useState("");b.useEffect(()=>{(t==null?void 0:t.status)==="QR_PENDING"&&t.id&&P(t.id)},[]);async function P(M){_(!0),E("");let W=0;const T=setInterval(async()=>{W++;try{const V=await he.getQr(M);k(V.qrBase64),clearInterval(T),_(!1)}catch{W>=15&&(clearInterval(T),_(!1),E("QR não disponível. Tente novamente."))}},2e3)}const D=async()=>{t!=null&&t.id&&(k(""),E(""),await P(t.id))},I=async()=>{var M,W;if(!s.trim()){j("Apelido obrigatório.");return}y(!0),j("");try{if(e)await he.updateNumber(e.id,{label:s.trim(),role:o,area:c.trim()||null,priority:d,notes:p.trim()||null,active:m});else{if(!(t!=null&&t.id))throw new Error("Sessão não identificada");await he.saveNumber({instance_id:t.id,label:s.trim(),role:o,area:c.trim()||null,priority:d,notes:p.trim()||null})}w(!0),r(),setTimeout(()=>w(!1),2e3)}catch(T){j(((W=(M=T==null?void 0:T.response)==null?void 0:M.data)==null?void 0:W.error)??T.message??"Erro ao salvar")}finally{y(!1)}},R=t&&t.status!=="CONNECTED";return a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40 backdrop-blur-sm p-4",children:a.jsxs("div",{className:"bg-white rounded-2xl shadow-2xl w-full max-w-md overflow-hidden max-h-[90vh] flex flex-col",children:[a.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-gray-100 flex-shrink-0",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"w-8 h-8 rounded-full bg-[#00a884]/10 flex items-center justify-center",children:a.jsx(y1,{size:14,className:"text-[#00a884]"})}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-[15px] font-bold text-[#111b21] leading-tight",children:"Atualizar Número"}),t&&a.jsx("p",{className:"text-[11px] text-[#8696a0] leading-tight font-mono",children:t.phone??t.id})]})]}),a.jsx("button",{onClick:n,className:"p-1.5 hover:bg-gray-100 rounded-full transition-colors",children:a.jsx(Ce,{size:18,className:"text-[#667781]"})})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto p-5 space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-[12px] font-semibold text-[#667781] mb-1.5 uppercase tracking-wide",children:"Apelido / Nome"}),a.jsx("input",{type:"text",value:s,onChange:M=>i(M.target.value),placeholder:"Ex: Atendimento Principal, Entregas, Marketing…",className:"w-full px-3 py-2.5 text-[14px] text-[#111b21] border border-gray-200 rounded-xl outline-none focus:border-[#00a884] focus:ring-2 focus:ring-[#00a884]/10 transition-all"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-[12px] font-semibold text-[#667781] mb-1.5 uppercase tracking-wide",children:"Função"}),a.jsx("select",{value:o,onChange:M=>l(M.target.value),className:"w-full px-3 py-2.5 pr-8 text-[14px] text-[#111b21] border border-gray-200 rounded-xl outline-none focus:border-[#00a884] bg-white bg-[url('data:image/svg+xml;utf8,<svg xmlns=%22http://www.w3.org/2000/svg%22 width=%2212%22 height=%2212%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%238696a0%22 stroke-width=%222%22><polyline points=%226 9 12 15 18 9%22/></svg>')] bg-no-repeat bg-[right_12px_center] appearance-none cursor-pointer",children:Object.entries(dw).map(([M,W])=>a.jsx("option",{value:M,children:W},M))})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-[12px] font-semibold text-[#667781] mb-1.5 uppercase tracking-wide",children:"Prioridade"}),a.jsx("select",{value:d,onChange:M=>f(Number(M.target.value)),className:"w-full px-3 py-2.5 pr-8 text-[14px] text-[#111b21] border border-gray-200 rounded-xl outline-none focus:border-[#00a884] bg-white bg-[url('data:image/svg+xml;utf8,<svg xmlns=%22http://www.w3.org/2000/svg%22 width=%2212%22 height=%2212%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%238696a0%22 stroke-width=%222%22><polyline points=%226 9 12 15 18 9%22/></svg>')] bg-no-repeat bg-[right_12px_center] appearance-none cursor-pointer",children:[1,2,3,4,5].map(M=>a.jsx("option",{value:M,children:fw[M]??`P${M}`},M))})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-[12px] font-semibold text-[#667781] mb-1.5 uppercase tracking-wide",children:"Área (opcional)"}),a.jsx("input",{type:"text",value:c,onChange:M=>u(M.target.value),placeholder:"Ex: Campo Grande",className:"w-full px-3 py-2.5 text-[14px] text-[#111b21] border border-gray-200 rounded-xl outline-none focus:border-[#00a884] transition-all"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-[12px] font-semibold text-[#667781] mb-1.5 uppercase tracking-wide",children:"Observações (opcional)"}),a.jsx("textarea",{value:p,onChange:M=>h(M.target.value),rows:2,placeholder:"Ex: Fallback quando o principal cair",className:"w-full px-3 py-2.5 text-[14px] text-[#111b21] border border-gray-200 rounded-xl outline-none focus:border-[#00a884] resize-none transition-all"})]}),a.jsxs("label",{className:"flex items-center gap-3 cursor-pointer select-none",children:[a.jsx("div",{onClick:()=>v(M=>!M),className:`relative w-10 h-5 rounded-full transition-colors ${m?"bg-[#00a884]":"bg-gray-300"}`,children:a.jsx("div",{className:`absolute top-0.5 w-4 h-4 bg-white rounded-full shadow transition-transform ${m?"translate-x-5":"translate-x-0.5"}`})}),a.jsx("span",{className:"text-[13px] text-[#111b21]",children:m?"Ativo":"Inativo"})]}),g&&a.jsx("p",{className:"text-red-500 text-[13px] font-medium",children:g}),t&&a.jsxs("div",{className:`rounded-2xl border p-4 space-y-3 ${R?"border-amber-200 bg-amber-50":"border-gray-100 bg-[#f9fafb]"}`,children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(js,{size:15,className:R?"text-amber-500":"text-[#8696a0]"}),a.jsx("span",{className:"text-[13px] font-semibold text-[#111b21]",children:"Reconectar número"})]}),t.status&&a.jsx(l8,{status:t.status})]}),C?a.jsxs("div",{className:"flex flex-col items-center gap-2 py-4",children:[a.jsx("div",{className:"w-7 h-7 border-2 border-[#00a884] border-t-transparent rounded-full animate-spin"}),a.jsx("p",{className:"text-[12px] text-[#667781]",children:"Gerando QR Code…"})]}):S?a.jsxs("div",{className:"flex flex-col items-center gap-2",children:[a.jsx("img",{src:S,alt:"QR Code",className:"w-44 h-44 rounded-xl border-2 border-[#00a884]/20 bg-white p-2 mx-auto"}),a.jsx("p",{className:"text-[11px] text-[#8696a0] text-center",children:"Abra o WhatsApp → Menu → Aparelhos conectados → Conectar aparelho"}),a.jsx("p",{className:"text-[10px] text-amber-600 text-center font-semibold",children:'QR expira em ~60s — clique em "Novo QR" se expirar'})]}):A?a.jsx("p",{className:"text-[12px] text-red-500 text-center",children:A}):a.jsx("p",{className:"text-[12px] text-[#8696a0] text-center",children:R?"Sessão desconectada. Gere um QR para reconectar.":"Sessão conectada. Gere um novo QR só se precisar reconectar em outro celular."}),a.jsxs("button",{onClick:D,disabled:C,className:"w-full py-2 border border-[#00a884] text-[#00a884] hover:bg-[#00a884]/5 disabled:opacity-50 font-semibold rounded-xl transition-all text-[13px] flex items-center justify-center gap-2",children:[C?a.jsx("span",{className:"w-3.5 h-3.5 border border-[#00a884] border-t-transparent rounded-full animate-spin"}):a.jsx(js,{size:14}),S?"Novo QR":"Gerar QR Code"]})]})]}),a.jsx("div",{className:"px-5 pb-5 pt-3 border-t border-gray-100 flex-shrink-0",children:a.jsxs("button",{onClick:I,disabled:x||!s.trim(),className:`w-full py-3 font-bold rounded-xl transition-all text-[14px] flex items-center justify-center gap-2
${N?"bg-emerald-500 text-white":"bg-[#00a884] hover:bg-[#017f67] disabled:opacity-50 text-white"}`,children:[x?a.jsx("span",{className:"w-4 h-4 border-2 border-white/40 border-t-white rounded-full animate-spin"}):N?a.jsx(Pi,{size:16}):a.jsx(Pi,{size:16}),x?"Salvando…":N?"Salvo ✓":"Salvar alterações"]})})]})})}const zge=[{id:"agente",Icon:ks,label:"Agente"},{id:"cerebro",Icon:d1,label:"Cérebro"},{id:"agenda",Icon:DP,label:"Agenda"},{id:"conversas",Icon:_I,label:"Conversas"},{id:"testar",Icon:fI,label:"Testar"},{id:"config",Icon:vI,label:"Config"}],Bge=["persona","knowledge","rules","calendar","escalation"],Fge={persona:"bg-purple-100 text-purple-700",knowledge:"bg-blue-100 text-blue-700",rules:"bg-yellow-100 text-yellow-700",calendar:"bg-green-100 text-green-700",escalation:"bg-red-100 text-red-700"};function Vge(){const[e,t]=b.useState("agente"),[n,r]=b.useState(null),[s,i]=b.useState({name:"",model:"gpt-4o-mini",provider:"openai",temperature:.7,context_window:10}),[o,l]=b.useState(!1),[c,u]=b.useState(!1),[d,f]=b.useState([]),[p,h]=b.useState({type:"persona",title:"",content:""}),[m,v]=b.useState(null),[x,y]=b.useState(!1),[g,j]=b.useState([]),[N,w]=b.useState({date:"",time_start:"",time_end:"",attendee:"",notes:""}),[S,k]=b.useState(!1),[C,_]=b.useState([]),[A,E]=b.useState("all"),[P,D]=b.useState(!1),[I,R]=b.useState(null),[M,W]=b.useState([]),[T,V]=b.useState(!1),[X,U]=b.useState(!1),L=b.useRef(`test-${Date.now()}`),[B,ae]=b.useState(""),[se,xe]=b.useState([]),[H,le]=b.useState(!1),Z=b.useRef(null),[F,z]=b.useState({openai_key:"",gemini_key:"",anthropic_key:"",ollama_url:"",admin_notify_phone:""}),[q,ie]=b.useState("off"),[oe,we]=b.useState(!1),[Ee,ze]=b.useState(!1);b.useEffect(()=>{e==="agente"&&gn(),e==="cerebro"&&vn(),e==="agenda"&&yn(),e==="conversas"&&bn(),e==="config"&&jn()},[e]),b.useEffect(()=>{var Q;(Q=Z.current)==null||Q.scrollIntoView({behavior:"smooth"})},[se]);async function gn(){try{const Q=await he.secGetAgent();r(Q),Q&&i({name:Q.name,model:Q.model,provider:Q.provider,temperature:Q.temperature,context_window:Q.context_window})}catch{}}async function vn(){try{f(await he.secGetNodes())}catch{}}async function yn(){try{j(await he.secGetSlots())}catch{}}async function bn(){D(!0);try{_(await he.secGetConversations())}catch{}finally{D(!1)}}async function jn(){try{const[Q,ue]=await Promise.all([he.secGetKeys(),he.getAutoReplyMode()]);z(Q),ie(ue.mode)}catch{}}async function Wn(Q){R(Q),W([]),V(!0);try{W(await he.secGetConvMessages(Q.id))}catch{}finally{V(!1)}}async function ne(){if(I){U(!0);try{await he.secFinalizeConv(I.id),_(Q=>Q.map(ue=>ue.id===I.id?{...ue,status:"closed"}:ue)),R(null)}catch{}finally{U(!1)}}}async function Se(Q){Q==null||Q.preventDefault();const ue=B.trim();if(!(!ue||H)){ae(""),xe(We=>[...We,{role:"user",text:ue}]),le(!0);try{const hr=(await he.secTestAsk(L.current,ue)).reply??"(sem resposta)";xe(Bs=>[...Bs,{role:"ai",text:hr}])}catch(We){xe(hr=>[...hr,{role:"ai",text:`Erro: ${(We==null?void 0:We.message)??"falha"}`}])}finally{le(!1)}}}async function ft(Q){Q.preventDefault(),l(!0);try{const ue=n?await he.secUpdateAgent(n.id,s):await he.secCreateAgent(s);r(ue),u(!0),setTimeout(()=>u(!1),2e3)}catch{}finally{l(!1)}}async function Tt(Q){Q.preventDefault(),y(!0);try{if(m){const ue=await he.secUpdateNode(m.id,{type:m.type,title:m.title??"",content:m.content});f(We=>We.map(hr=>hr.id===ue.id?ue:hr))}else{const ue=await he.secCreateNode({type:p.type,title:p.title,content:p.content});f(We=>[...We,ue])}h({type:"persona",title:"",content:""}),v(null)}catch{}finally{y(!1)}}async function gt(Q){try{await he.secDeleteNode(Q),f(ue=>ue.filter(We=>We.id!==Q))}catch{}}async function Ba(Q){Q.preventDefault(),k(!0);try{const ue=await he.secCreateSlot(N);j(We=>[...We,ue]),w({date:"",time_start:"",time_end:"",attendee:"",notes:""})}catch{}finally{k(!1)}}async function Yl(Q){try{await he.secDeleteSlot(Q),j(ue=>ue.filter(We=>We.id!==Q))}catch{}}async function Fa(Q){Q.preventDefault(),we(!0);try{await he.secSaveKeys(F),ze(!0),setTimeout(()=>ze(!1),2e3)}catch{}finally{we(!1)}}async function Ql(){const Q=q==="off"?"automatico":"off";try{await he.setAutoReplyMode(Q),ie(Q)}catch{}}const $t="w-full border border-[#d1d7db] rounded-lg px-3 py-2 text-[13px] text-[#111b21] focus:outline-none focus:border-[#00a884] bg-white",Mt="block text-[11px] font-semibold text-[#667781] uppercase tracking-wide mb-1",zs="flex items-center gap-1.5 px-4 py-2 bg-[#00a884] text-white rounded-lg text-[13px] font-semibold hover:bg-[#008f72] transition-colors disabled:opacity-60";return a.jsxs("div",{className:"flex flex-col h-full bg-[#f0f2f5]",children:[a.jsxs("div",{className:"h-[60px] px-4 flex items-center gap-3 bg-[#f0f2f5] border-b border-[#d1d7db] flex-shrink-0",children:[a.jsx(ra,{size:22,className:"text-[#00a884]"}),a.jsx("h2",{className:"text-[16px] font-bold text-[#111b21]",children:"Secretária Virtual"})]}),a.jsx("div",{className:"flex bg-white border-b border-[#d1d7db] flex-shrink-0 overflow-x-auto",children:zge.map(({id:Q,Icon:ue,label:We})=>a.jsxs("button",{onClick:()=>t(Q),className:`flex items-center gap-1.5 px-4 py-3 text-[13px] font-medium whitespace-nowrap border-b-2 transition-colors
${e===Q?"border-[#00a884] text-[#00a884]":"border-transparent text-[#667781] hover:text-[#111b21] hover:bg-[#f5f6f6]"}`,children:[a.jsx(ue,{size:15})," ",We]},Q))}),a.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[e==="agente"&&a.jsxs("form",{onSubmit:ft,className:"flex flex-col gap-4",children:[a.jsx("p",{className:"text-[12px] text-[#667781]",children:"Configure a identidade e o modelo de IA da secretária."}),a.jsxs("div",{children:[a.jsx("label",{className:Mt,children:"Nome do agente"}),a.jsx("input",{className:$t,value:s.name,onChange:Q=>i(ue=>({...ue,name:Q.target.value})),placeholder:"Ex: Secretária Alemão",required:!0})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx("label",{className:Mt,children:"Provider"}),a.jsxs("select",{className:$t,value:s.provider,onChange:Q=>i(ue=>({...ue,provider:Q.target.value})),children:[a.jsx("option",{value:"openai",children:"OpenAI"}),a.jsx("option",{value:"gemini",children:"Gemini"}),a.jsx("option",{value:"anthropic",children:"Anthropic"}),a.jsx("option",{value:"ollama",children:"Ollama"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:Mt,children:"Modelo"}),a.jsx("input",{className:$t,value:s.model,onChange:Q=>i(ue=>({...ue,model:Q.target.value})),placeholder:"gpt-4o-mini"})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsxs("label",{className:Mt,children:["Temperatura (",s.temperature,")"]}),a.jsx("input",{type:"range",min:"0",max:"1",step:"0.1",value:s.temperature,onChange:Q=>i(ue=>({...ue,temperature:parseFloat(Q.target.value)})),className:"w-full accent-[#00a884]"})]}),a.jsxs("div",{children:[a.jsx("label",{className:Mt,children:"Janela de contexto"}),a.jsx("input",{type:"number",min:"5",max:"50",className:$t,value:s.context_window,onChange:Q=>i(ue=>({...ue,context_window:parseInt(Q.target.value)}))})]})]}),a.jsxs("button",{type:"submit",className:zs,disabled:o,children:[o?a.jsx(Vr,{size:14,className:"animate-spin"}):a.jsx(or,{size:14}),c?"Salvo ✓":"Salvar agente"]})]}),e==="cerebro"&&a.jsxs("div",{className:"flex flex-col gap-4",children:[a.jsx("p",{className:"text-[12px] text-[#667781]",children:"Nodes de conhecimento que moldam as respostas da secretária."}),a.jsxs("form",{onSubmit:Tt,className:"bg-white rounded-xl border border-[#d1d7db] p-4 flex flex-col gap-3",children:[a.jsx("div",{className:"flex gap-2",children:a.jsxs("div",{className:"flex-1",children:[a.jsx("label",{className:Mt,children:"Tipo"}),a.jsx("select",{className:$t,value:m?m.type:p.type,onChange:Q=>m?v(ue=>({...ue,type:Q.target.value})):h(ue=>({...ue,type:Q.target.value})),children:Bge.map(Q=>a.jsx("option",{value:Q,children:Q},Q))})]})}),a.jsxs("div",{children:[a.jsx("label",{className:Mt,children:"Título"}),a.jsx("input",{type:"text",className:$t,value:m?m.title??"":p.title,onChange:Q=>m?v(ue=>({...ue,title:Q.target.value})):h(ue=>({...ue,title:Q.target.value})),placeholder:"Ex: Política de Troca, Horário de Funcionamento...",required:!0})]}),a.jsxs("div",{children:[a.jsx("label",{className:Mt,children:"Conteúdo"}),a.jsx("textarea",{rows:4,className:`${$t} resize-none`,value:m?m.content:p.content,onChange:Q=>m?v(ue=>({...ue,content:Q.target.value})):h(ue=>({...ue,content:Q.target.value})),placeholder:"Descreva o comportamento, conhecimento ou regra...",required:!0})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs("button",{type:"submit",className:zs,disabled:x,children:[x?a.jsx(Vr,{size:14,className:"animate-spin"}):a.jsx(or,{size:14}),m?"Atualizar":"Adicionar node"]}),m&&a.jsx("button",{type:"button",onClick:()=>{v(null),h({type:"persona",title:"",content:""})},className:"px-4 py-2 border border-[#d1d7db] rounded-lg text-[13px] text-[#667781] hover:bg-[#f5f6f6]",children:"Cancelar"})]})]}),a.jsxs("div",{className:"flex flex-col gap-2",children:[d.length===0&&a.jsx("p",{className:"text-[12px] text-[#667781] text-center py-4",children:"Nenhum node configurado."}),d.map(Q=>a.jsxs("div",{className:"bg-white rounded-xl border border-[#d1d7db] p-3 flex gap-3",children:[a.jsx("span",{className:`text-[10px] font-bold px-2 py-0.5 rounded-full self-start mt-0.5 ${Fge[Q.type]??"bg-gray-100 text-gray-600"}`,children:Q.type}),a.jsx("p",{className:"flex-1 text-[13px] text-[#111b21] whitespace-pre-wrap line-clamp-3",children:Q.content}),a.jsxs("div",{className:"flex flex-col gap-1",children:[a.jsx("button",{onClick:()=>{v({...Q})},className:"p-1 hover:bg-[#f0f2f5] rounded",children:a.jsx(Er,{size:13,className:"text-[#667781]"})}),a.jsx("button",{onClick:()=>gt(Q.id),className:"p-1 hover:bg-red-50 rounded",children:a.jsx(Te,{size:13,className:"text-red-500"})})]})]},Q.id))]})]}),e==="agenda"&&a.jsxs("div",{className:"flex flex-col gap-4",children:[a.jsx("p",{className:"text-[12px] text-[#667781]",children:"Slots de atendimento disponíveis para agendamento."}),a.jsxs("form",{onSubmit:Ba,className:"bg-white rounded-xl border border-[#d1d7db] p-4 flex flex-col gap-3",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx("label",{className:Mt,children:"Data"}),a.jsx("input",{type:"date",className:$t,value:N.date,onChange:Q=>w(ue=>({...ue,date:Q.target.value})),required:!0})]}),a.jsxs("div",{children:[a.jsx("label",{className:Mt,children:"Responsável"}),a.jsx("input",{className:$t,value:N.attendee,onChange:Q=>w(ue=>({...ue,attendee:Q.target.value})),placeholder:"Nome ou setor"})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx("label",{className:Mt,children:"Início"}),a.jsx("input",{type:"time",className:$t,value:N.time_start,onChange:Q=>w(ue=>({...ue,time_start:Q.target.value})),required:!0})]}),a.jsxs("div",{children:[a.jsx("label",{className:Mt,children:"Fim"}),a.jsx("input",{type:"time",className:$t,value:N.time_end,onChange:Q=>w(ue=>({...ue,time_end:Q.target.value})),required:!0})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:Mt,children:"Observações"}),a.jsx("input",{className:$t,value:N.notes,onChange:Q=>w(ue=>({...ue,notes:Q.target.value})),placeholder:"Opcional"})]}),a.jsxs("button",{type:"submit",className:zs,disabled:S,children:[S?a.jsx(Vr,{size:14,className:"animate-spin"}):a.jsx(Oe,{size:14}),"Adicionar slot"]})]}),a.jsxs("div",{className:"flex flex-col gap-2",children:[g.length===0&&a.jsx("p",{className:"text-[12px] text-[#667781] text-center py-4",children:"Nenhum slot cadastrado."}),g.map(Q=>a.jsxs("div",{className:"bg-white rounded-xl border border-[#d1d7db] px-4 py-3 flex items-center gap-3",children:[a.jsx(DP,{size:18,className:"text-[#00a884] flex-shrink-0"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("p",{className:"text-[13px] font-semibold text-[#111b21]",children:[Q.date," · ",Q.time_start,"",Q.time_end]}),Q.attendee&&a.jsx("p",{className:"text-[12px] text-[#667781] truncate",children:Q.attendee})]}),a.jsx("span",{className:`text-[10px] font-bold px-2 py-0.5 rounded-full ${Q.status==="booked"?"bg-red-100 text-red-600":"bg-green-100 text-green-700"}`,children:Q.status==="booked"?"Ocupado":"Livre"}),a.jsx("button",{onClick:()=>Yl(Q.id),className:"p-1 hover:bg-red-50 rounded",children:a.jsx(Te,{size:13,className:"text-red-500"})})]},Q.id))]})]}),e==="conversas"&&a.jsxs("div",{className:"flex flex-col gap-3",children:[a.jsxs("div",{className:"flex gap-2",children:[["all","active","closed"].map(Q=>a.jsx("button",{onClick:()=>E(Q),className:`px-3 py-1.5 rounded-full text-[12px] font-medium transition-colors
${A===Q?"bg-[#00a884] text-white":"bg-white border border-[#d1d7db] text-[#667781] hover:bg-[#f5f6f6]"}`,children:Q==="all"?"Todas":Q==="active"?"Ativas":"Encerradas"},Q)),a.jsx("button",{onClick:bn,className:"ml-auto p-1.5 hover:bg-[#f0f2f5] rounded-full transition-colors",children:a.jsx(ke,{size:14,className:`text-[#667781] ${P?"animate-spin":""}`})})]}),P&&a.jsx("div",{className:"flex justify-center py-8",children:a.jsx(Vr,{size:24,className:"animate-spin text-[#00a884]"})}),!P&&C.length===0&&a.jsx("p",{className:"text-[12px] text-[#667781] text-center py-8",children:"Nenhuma conversa registrada."}),a.jsx("div",{className:"flex flex-col gap-2",children:C.filter(Q=>A==="all"||Q.status===(A==="active"?"active":"closed")).map(Q=>a.jsxs("button",{onClick:()=>Wn(Q),className:"bg-white rounded-xl border border-[#d1d7db] px-4 py-3 text-left hover:border-[#00a884] hover:shadow-sm transition-all",children:[a.jsxs("div",{className:"flex items-center justify-between mb-1 gap-2 flex-wrap",children:[a.jsx("span",{className:"text-[12px] font-bold text-[#667781] font-mono",children:Q.protocol_number??Q.id}),a.jsxs("div",{className:"flex items-center gap-1.5",children:[Q.handoff_mode==="humano"&&a.jsxs("span",{className:"text-[10px] font-bold px-2 py-0.5 rounded-full bg-orange-100 text-orange-600 flex items-center gap-1",children:[a.jsx(Tl,{size:9})," Humano"]}),Q.status==="escalated"&&a.jsxs("span",{className:"text-[10px] font-bold px-2 py-0.5 rounded-full bg-red-100 text-red-600 flex items-center gap-1",children:[a.jsx(Kt,{size:9})," Escalada"]}),a.jsx("span",{className:`text-[10px] font-bold px-2 py-0.5 rounded-full ${Q.status==="active"?"bg-green-100 text-green-700":"bg-gray-100 text-gray-500"}`,children:Q.status==="active"?"Ativa":"Encerrada"})]})]}),Q.summary&&a.jsx("p",{className:"text-[12px] text-[#111b21] line-clamp-2",children:Q.summary}),Q.created_at&&a.jsx("p",{className:"text-[11px] text-[#8696a0] mt-1",children:new Date(Q.created_at).toLocaleString("pt-BR")})]},Q.id))})]}),e==="testar"&&a.jsxs("div",{className:"flex flex-col h-full gap-0",style:{minHeight:"400px"},children:[a.jsx("p",{className:"text-[12px] text-[#667781] mb-3",children:"Teste a secretária sem precisar de celular conectado. Cada sessão é isolada."}),a.jsxs("div",{className:"flex-1 bg-white rounded-xl border border-[#d1d7db] p-3 overflow-y-auto flex flex-col gap-2 mb-3",style:{minHeight:"280px",maxHeight:"380px"},children:[se.length===0&&a.jsx("p",{className:"text-[12px] text-[#8696a0] text-center m-auto",children:"Digite uma mensagem para começar o teste."}),se.map((Q,ue)=>a.jsx("div",{className:`flex ${Q.role==="user"?"justify-end":"justify-start"}`,children:a.jsx("div",{className:`max-w-[85%] px-3 py-2 rounded-xl text-[13px] whitespace-pre-wrap leading-[1.4]
${Q.role==="user"?"bg-[#d9fdd3] text-[#111b21]":"bg-white border border-[#d1d7db] text-[#111b21]"}`,children:Q.text})},ue)),H&&a.jsx("div",{className:"flex justify-start",children:a.jsxs("div",{className:"px-4 py-2 bg-white border border-[#d1d7db] rounded-xl flex items-center gap-1.5",children:[a.jsx(Vr,{size:12,className:"animate-spin text-[#00a884]"}),a.jsx("span",{className:"text-[12px] text-[#667781]",children:"Secretária digitando…"})]})}),a.jsx("div",{ref:Z})]}),a.jsxs("form",{onSubmit:Se,className:"flex gap-2",children:[a.jsx("input",{className:"flex-1 border border-[#d1d7db] rounded-lg px-3 py-2 text-[13px] text-[#111b21] focus:outline-none focus:border-[#00a884] bg-white",value:B,onChange:Q=>ae(Q.target.value),placeholder:"Mensagem de teste...",disabled:H}),a.jsx("button",{type:"submit",disabled:H||!B.trim(),className:"flex items-center gap-1.5 px-4 py-2 bg-[#00a884] text-white rounded-lg text-[13px] font-semibold hover:bg-[#008f72] transition-colors disabled:opacity-60",children:a.jsx(Rr,{size:14})}),a.jsx("button",{type:"button",onClick:()=>{xe([]),L.current=`test-${Date.now()}`},className:"px-3 py-2 border border-[#d1d7db] rounded-lg text-[12px] text-[#667781] hover:bg-[#f5f6f6] transition-colors",title:"Reiniciar sessão",children:a.jsx(ke,{size:14})})]})]}),e==="config"&&a.jsxs("form",{onSubmit:Fa,className:"flex flex-col gap-4",children:[a.jsx("p",{className:"text-[12px] text-[#667781]",children:"Chaves de API e modo de resposta automática."}),a.jsxs("div",{className:"bg-white rounded-xl border border-[#d1d7db] p-4 flex flex-col gap-3",children:[a.jsx("p",{className:"text-[12px] font-semibold text-[#111b21]",children:"Provedores de IA"}),[["openai_key","OpenAI API Key","sk-..."],["gemini_key","Gemini API Key","AIza..."],["anthropic_key","Anthropic API Key","sk-ant-..."],["ollama_url","Ollama URL","http://localhost:11434"]].map(([Q,ue,We])=>{const hr=F[Q],Bs=hr.endsWith("****");return a.jsxs("div",{children:[a.jsxs("label",{className:Mt,children:[ue,Bs&&a.jsx("span",{className:"ml-2 text-[10px] font-normal text-green-600 normal-case tracking-normal",children:"já configurado"})]}),a.jsx("input",{type:Q==="ollama_url"?"url":"password",className:$t,value:Bs?"":hr,placeholder:Bs?"•••••••• (deixe em branco para manter)":We,onChange:Yi=>z(Id=>({...Id,[Q]:Yi.target.value}))})]},Q)})]}),a.jsxs("div",{className:"bg-white rounded-xl border border-[#d1d7db] p-4 flex flex-col gap-3",children:[a.jsx("p",{className:"text-[12px] font-semibold text-[#111b21]",children:"Notificação de escalação"}),a.jsxs("div",{children:[a.jsxs("label",{className:Mt,children:["WhatsApp do administrador ",a.jsx("span",{className:"normal-case text-[#667781] font-normal",children:"(sem +55, ex: 67999001122)"})]}),a.jsx("input",{type:"tel",className:$t,value:F.admin_notify_phone,placeholder:"67999001122",onChange:Q=>z(ue=>({...ue,admin_notify_phone:Q.target.value.replace(/\D/g,"")}))}),a.jsx("p",{className:"text-[11px] text-[#8696a0] mt-1",children:"Quando a IA escalar um cliente, este número receberá uma mensagem WA de alerta."})]})]}),a.jsxs("div",{className:"bg-white rounded-xl border border-[#d1d7db] p-4 flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-[13px] font-semibold text-[#111b21]",children:"Resposta automática"}),a.jsx("p",{className:"text-[11px] text-[#667781]",children:"Secretária responde automaticamente às mensagens recebidas"})]}),a.jsx("button",{type:"button",onClick:Ql,className:"flex-shrink-0 ml-4",children:q==="automatico"?a.jsx(Ss,{size:36,className:"text-[#00a884]"}):a.jsx(Ns,{size:36,className:"text-[#8696a0]"})})]}),a.jsxs("button",{type:"submit",className:zs,disabled:oe,children:[oe?a.jsx(Vr,{size:14,className:"animate-spin"}):a.jsx(or,{size:14}),Ee?"Salvo ✓":"Salvar configurações"]})]})]}),I&&a.jsxs("div",{className:"absolute inset-0 z-40 flex",children:[a.jsx("div",{className:"flex-1 bg-black/30",onClick:()=>R(null)}),a.jsxs("div",{className:"w-[380px] max-w-full h-full bg-white flex flex-col shadow-2xl",children:[a.jsxs("div",{className:"h-[60px] px-4 flex items-center gap-3 border-b border-[#d1d7db] flex-shrink-0",children:[a.jsx("button",{onClick:()=>R(null),className:"p-1.5 hover:bg-[#f0f2f5] rounded-full transition-colors",children:a.jsx(Ce,{size:18,className:"text-[#54656f]"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-[13px] font-bold text-[#111b21] font-mono truncate",children:I.protocol_number??I.id}),a.jsx("p",{className:"text-[11px] text-[#667781]",children:new Date(I.created_at).toLocaleString("pt-BR")})]}),I.status==="active"&&a.jsxs("button",{onClick:ne,disabled:X,className:"flex items-center gap-1.5 px-3 py-1.5 bg-red-500 text-white rounded-lg text-[12px] font-semibold hover:bg-red-600 transition-colors disabled:opacity-60",children:[X?a.jsx(Vr,{size:12,className:"animate-spin"}):a.jsx(Ce,{size:12}),"Finalizar"]})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto p-4 flex flex-col gap-3",children:[T&&a.jsx("div",{className:"flex justify-center py-8",children:a.jsx(Vr,{size:24,className:"animate-spin text-[#00a884]"})}),!T&&M.length===0&&a.jsx("p",{className:"text-[12px] text-[#8696a0] text-center py-8",children:"Nenhuma mensagem neste protocolo."}),M.map((Q,ue)=>a.jsxs("div",{className:`flex flex-col gap-0.5 ${Q.role==="user"?"items-start":"items-end"}`,children:[a.jsx("span",{className:"text-[10px] text-[#8696a0] px-1",children:Q.role==="user"?"Cliente":"Secretária"}),a.jsx("div",{className:`max-w-[88%] px-3 py-2 rounded-xl text-[13px] leading-[1.4] whitespace-pre-wrap
${Q.role==="user"?"bg-[#f0f2f5] text-[#111b21]":"bg-[#d9fdd3] text-[#111b21]"}`,children:Q.content}),Q.created_at&&a.jsx("span",{className:"text-[10px] text-[#8696a0] px-1",children:new Date(Q.created_at).toLocaleTimeString("pt-BR",{hour:"2-digit",minute:"2-digit"})})]},Q.id??ue))]})]})]})]})}function Uge({activeTab:e,setActiveTab:t,session:n,inboxUnread:r,teamAccount:s,onTeamLogout:i}){const o=(n==null?void 0:n.status)==="CONNECTED",l=(s==null?void 0:s.role)||"owner",[c,u]=b.useState(null),[d,f]=b.useState(!1);b.useEffect(()=>{s&&fetch("/api/team/me",{credentials:"include"}).then(v=>v.json()).then(v=>{var g;const y=(((g=v==null?void 0:v.account)==null?void 0:g.sectors)||[]).find(j=>j.on_duty!=null);y&&u(y.on_duty)}).catch(()=>{})},[s==null?void 0:s.id]);async function p(){if(!(c===null||d)){f(!0);try{const v=!c;await fetch("/api/team/me/duty",{method:"PATCH",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({on_duty:v})}),u(v)}catch{}finally{f(!1)}}}const m=[["chats",x1,"Conversas"],["sessions",y1,"Sessões"],["secretaria",ra,"Secretária Virtual"],["equipe",et,"Equipe"],["inbox-interna",Pr,"Inbox Interna"],["metricas",yu,"Métricas"]].filter(([v])=>v==="sessions"?!s:v==="secretaria"?!s||["owner","manager","supervisor"].includes(l):v==="equipe"?!s||Kge.has(l):v==="metricas"?!s||["owner","manager","supervisor"].includes(l):!0);return a.jsxs("div",{className:"w-[60px] h-full bg-[#f0f2f5] border-r border-[#d1d7db] flex flex-col items-center py-4 flex-shrink-0 z-30",children:[a.jsx("div",{className:"flex-1 w-full flex flex-col items-center gap-1",children:m.map(([v,x,y])=>a.jsxs("button",{title:y,onClick:()=>t(v),className:`relative w-10 h-10 rounded-full flex items-center justify-center transition-colors
${e===v?"bg-[#d9dbdf]":"hover:bg-[#d9dbdf]/60"}`,children:[a.jsx(x,{size:22,className:e===v?"text-[#111b21]":"text-[#54656f]",fill:e===v?"currentColor":"none"}),v==="inbox-interna"&&r&&r>0?a.jsx("span",{className:"absolute top-0.5 right-0.5 bg-red-500 text-white text-[9px] font-bold w-4 h-4 rounded-full flex items-center justify-center",children:r>9?"9+":r}):null]},v))}),a.jsx("div",{className:"w-full flex flex-col items-center gap-1 pb-1",children:s?a.jsxs("div",{className:"flex flex-col items-center gap-1",children:[c!==null&&a.jsx("button",{onClick:p,disabled:d,title:c?"De plantão — clique para sair":"Fora de plantão — clique para entrar",className:`w-8 h-8 rounded-full flex items-center justify-center transition-colors border-2 ${c?"bg-emerald-500/20 border-emerald-500/60 text-emerald-500 hover:bg-emerald-500/30":"bg-slate-300/40 border-slate-400/40 text-slate-500 hover:bg-slate-300/60"} ${d?"opacity-50 cursor-wait":""}`,children:c?a.jsx(Ss,{size:16}):a.jsx(Ns,{size:16})}),a.jsx("div",{className:"w-9 h-9 rounded-full bg-purple-600 flex items-center justify-center text-white text-sm font-bold cursor-default",title:`${s.name} (${s.role})`,children:s.name.charAt(0).toUpperCase()}),i&&a.jsx("button",{onClick:i,title:"Sair",className:"w-8 h-8 rounded-full flex items-center justify-center hover:bg-red-100 text-red-400 transition-colors",children:a.jsx(Ce,{size:14})})]}):a.jsxs(a.Fragment,{children:[a.jsx("button",{title:"Configurações",className:"w-10 h-10 rounded-full flex items-center justify-center hover:bg-[#d9dbdf]/60 transition-colors",children:a.jsx(v1,{size:22,className:"text-[#54656f]",fill:"none"})}),a.jsxs("div",{className:"relative mt-1 p-1 cursor-pointer",children:[a.jsx(Bo,{src:n==null?void 0:n.avatar,name:n==null?void 0:n.name,size:32}),a.jsx("div",{className:`absolute bottom-0.5 right-0.5 w-3 h-3 rounded-full border-2 border-[#f0f2f5]
${o?"bg-emerald-500":"bg-red-500"}`,title:o?"Conectado":"Desconectado"})]})]})})]})}function Wge({chat:e,onBack:t,isMobile:n,onArchive:r}){const[s,i]=b.useState(!1),o=b.useRef(null);return b.useEffect(()=>{const l=c=>{o.current&&!o.current.contains(c.target)&&i(!1)};return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[]),a.jsxs("header",{className:"h-[60px] px-4 bg-[#f0f2f5] flex items-center justify-between border-b border-[#d1d7db] shrink-0 z-20",children:[a.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[n&&a.jsx("button",{onClick:t,className:"p-1 -ml-1 mr-1 hover:bg-black/5 rounded-full transition-colors",children:a.jsx(Ui,{size:24,className:"text-[#54656f]"})}),a.jsxs("div",{className:"flex items-center gap-3 min-w-0 cursor-pointer group hover:bg-black/5 px-2 py-1 -ml-2 rounded-md transition-all",children:[a.jsx(Bo,{src:e.avatar,name:e.displayName??e.phone,size:40}),a.jsxs("div",{className:"flex flex-col min-w-0",children:[a.jsx("h3",{className:"text-[16px] leading-[21px] font-bold text-[#111b21] truncate group-hover:text-[#00a884] transition-colors",children:e.displayName??e.phone}),a.jsxs("span",{className:"text-[12.5px] text-[#667781] truncate flex items-center gap-1 font-normal",children:[a.jsx(wu,{size:10}),e.phone]})]})]})]}),a.jsxs("div",{className:"flex items-center gap-1",ref:o,children:[a.jsx("button",{className:"p-2 hover:bg-black/5 rounded-full transition-all text-[#54656f]",children:a.jsx(Ir,{size:20})}),a.jsxs("div",{className:"relative",children:[a.jsx("button",{onClick:()=>i(l=>!l),className:`p-2 rounded-full transition-all ${s?"bg-black/10 text-[#111b21]":"hover:bg-black/5 text-[#54656f]"}`,children:a.jsx(uI,{size:20})}),s&&a.jsx("div",{className:"absolute right-0 top-12 w-56 bg-white rounded-lg shadow-2xl border border-gray-100 py-2 z-50",children:a.jsxs("button",{className:"w-full flex items-center gap-3 px-4 py-2.5 text-[14px] text-[#111b21] hover:bg-[#f5f6f6] transition-colors",onClick:()=>{i(!1),r()},children:[a.jsx(ke,{size:15})," Arquivar conversa"]})})]})]})]})}function qge({chat:e,autoReplyGlobal:t,refreshKey:n=0}){const[r,s]=b.useState("ia"),[i,o]=b.useState(null),[l,c]=b.useState(!1),[u,d]=b.useState(0);if(b.useEffect(()=>{let m=!1;return he.getHandoffMode(e.id).then(v=>{m||(s(v.mode),o(v.handoffHumanAt?new Date(v.handoffHumanAt):null))}).catch(()=>{}),()=>{m=!0}},[e.id,n]),b.useEffect(()=>{if(r!=="humano"||!i){d(0);return}const m=()=>{const x=Math.max(0,Math.floor((i.getTime()-Date.now())/1e3));d(x)};m();const v=setInterval(m,1e3);return()=>clearInterval(v)},[r,i]),t==="off")return null;async function f(){c(!0);const m=r==="ia"?"humano":"ia";try{await he.setHandoffMode(e.id,m),s(m),o(m==="humano"?new Date:null)}catch{}finally{c(!1)}}const p=m=>`${String(Math.floor(m/60)).padStart(2,"0")}:${String(m%60).padStart(2,"0")}`,h=r==="humano";return a.jsxs("button",{onClick:f,disabled:l,title:h?`Devolver à IA (${p(u)} restantes)`:"Assumir atendimento manualmente",className:`absolute bottom-[76px] right-4 z-20 flex items-center gap-2 px-3 py-2 rounded-full shadow-lg text-[12px] font-semibold transition-all select-none
${h?"bg-orange-500 text-white animate-pulse hover:animate-none hover:bg-orange-600":"bg-[#00a884] text-white hover:bg-[#008f72]"}
${l?"opacity-60 cursor-wait":"cursor-pointer"}`,children:[h?a.jsx(Tl,{size:14}):a.jsx(ra,{size:14}),h?u>0?`Você (${p(u)})`:"Você":"IA"]})}function Hge({value:e,onChange:t,onSend:n,sending:r,onAskAi:s,askingAi:i,chatId:o}){const l=b.useRef(null),c=b.useRef(null),u=b.useRef(null),[d,f]=b.useState(!1),[p,h]=b.useState(!1),[m,v]=b.useState(!1),[x,y]=b.useState(!1),[g,j]=b.useState({}),[N,w]=b.useState("TEXT"),[S,k]=b.useState(),[C,_]=b.useState("TEXT"),A=()=>{const D=l.current;D&&(D.style.height="auto",D.style.height=Math.min(D.scrollHeight,150)+"px")};b.useEffect(()=>{const D=I=>{u.current&&!u.current.contains(I.target)&&f(!1)};return document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[]);const E=D=>{k(D.payload),_(D.type),v(!1),h(!0)},P=(D,I)=>{w(D),j(I),h(!1),y(!0)};return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"min-h-[62px] px-4 py-[8px] bg-[#f0f2f5] border-t border-[#d1d7db] flex items-end gap-3",children:[a.jsx("div",{className:"pb-[7px]",children:a.jsx("button",{className:"p-2 hover:bg-black/5 rounded-full transition-colors text-[#54656f]",title:"Emoji",children:a.jsx(II,{size:24})})}),a.jsxs("div",{ref:u,className:"relative pb-[7px]",children:[a.jsx(na.button,{onClick:()=>f(D=>!D),className:"p-2 hover:bg-black/5 rounded-full transition-colors text-[#54656f]",title:"Mais opções",animate:{rotate:d?45:0},transition:{duration:.2},children:a.jsx(Oe,{size:22})}),a.jsx(cd,{children:d&&a.jsxs(na.div,{initial:{opacity:0,y:8,scale:.92},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:8,scale:.92},transition:{type:"spring",stiffness:400,damping:28},className:"absolute bottom-full left-0 mb-2 flex flex-col gap-1 bg-white rounded-2xl shadow-xl border border-gray-100 p-2 z-30",children:[a.jsxs("div",{className:"group relative flex items-center",children:[a.jsx("button",{onClick:()=>{var D;(D=c.current)==null||D.click(),f(!1)},className:"p-2.5 rounded-xl hover:bg-[#f0f2f5] text-[#54656f] transition-colors",title:"Anexar arquivo",children:a.jsx(OI,{size:20})}),a.jsx("span",{className:"absolute left-full ml-2 px-2 py-1 text-[11px] font-medium bg-[#111b21] text-white rounded-lg opacity-0 group-hover:opacity-100 transition-opacity whitespace-nowrap pointer-events-none",children:"Anexar arquivo"})]}),a.jsxs("div",{className:"group relative flex items-center",children:[a.jsx("button",{onClick:()=>{v(!0),f(!1)},className:"p-2.5 rounded-xl hover:bg-[#e0f2fe] text-[#0ea5e9] transition-colors",title:"Biblioteca de templates",children:a.jsx(Ep,{size:20})}),a.jsx("span",{className:"absolute left-full ml-2 px-2 py-1 text-[11px] font-medium bg-[#111b21] text-white rounded-lg opacity-0 group-hover:opacity-100 transition-opacity whitespace-nowrap pointer-events-none",children:"Templates salvos"})]}),a.jsxs("div",{className:"group relative flex items-center",children:[a.jsx("button",{onClick:()=>{k(void 0),_("TEXT"),h(!0),f(!1)},className:"p-2.5 rounded-xl hover:bg-[#ede9fe] text-[#8b5cf6] transition-colors",title:"Mensagem rica",children:a.jsx(jI,{size:20})}),a.jsx("span",{className:"absolute left-full ml-2 px-2 py-1 text-[11px] font-medium bg-[#111b21] text-white rounded-lg opacity-0 group-hover:opacity-100 transition-opacity whitespace-nowrap pointer-events-none",children:"Mensagem rica"})]})]})}),a.jsx("input",{type:"file",ref:c,className:"hidden"})]}),a.jsx("div",{className:"flex-1 bg-white rounded-lg shadow-sm overflow-hidden",children:a.jsx("textarea",{ref:l,value:e,onChange:D=>{t(D.target.value),A()},onKeyDown:D=>{D.key==="Enter"&&!D.shiftKey&&(D.preventDefault(),n())},placeholder:"Mensagem",rows:1,className:"w-full px-4 py-[9px] text-[15px] text-[#111b21] placeholder:text-[#8696a0] outline-none resize-none bg-transparent leading-[1.5]",style:{minHeight:42,maxHeight:150}})}),a.jsxs("div",{className:"pb-[7px] flex items-center gap-2",children:[e.trim()&&a.jsx("button",{onClick:s,disabled:i||r,title:"Gerar resposta com Secretária IA",className:"w-10 h-10 bg-[#7c3aed] hover:bg-[#6d28d9] disabled:opacity-50 text-white rounded-full flex items-center justify-center transition-all active:scale-95 shadow-md",children:i?a.jsx("span",{className:"w-4 h-4 border-2 border-white/40 border-t-white rounded-full animate-spin"}):a.jsx(rv,{size:16})}),e.trim()?a.jsx("button",{onClick:n,disabled:r,className:"w-10 h-10 bg-[#00a884] hover:bg-[#017f67] disabled:opacity-50 text-white rounded-full flex items-center justify-center transition-all active:scale-95 shadow-md",children:a.jsx(Rr,{size:18})}):a.jsx("button",{className:"w-10 h-10 text-[#54656f] hover:bg-black/5 rounded-full flex items-center justify-center transition-colors",children:a.jsx(g1,{size:24})})]})]}),a.jsx(gge,{isOpen:p,onClose:()=>h(!1),chatId:o,initialPayload:S,initialType:C,onSchedule:P}),a.jsx(bge,{isOpen:m,onClose:()=>v(!1),onSelect:E}),a.jsx(wge,{isOpen:x,onClose:()=>y(!1),payload:g,messageType:N})]})}const Kge=new Set(["owner","manager","supervisor"]);function qC({teamAccount:e,onTeamLogout:t}={}){var gw;const[n,r]=b.useState([]),[s,i]=b.useState(null),[o,l]=b.useState({}),[c,u]=b.useState([]),[d,f]=b.useState(null),[p,h]=b.useState([]),[m,v]=b.useState(""),[x,y]=b.useState(""),[g,j]=b.useState(!1),[N,w]=b.useState(!1),[S,k]=b.useState(!0),[C,_]=b.useState(!1),[A,E]=b.useState(!1),[P,D]=b.useState(!1),[I,R]=b.useState(!1),[M,W]=b.useState("connecting"),[T,V]=b.useState("chats"),[X,U]=b.useState(!1),[L,B]=b.useState(!1),[ae,se]=b.useState(null);b.useEffect(()=>{e||Hc.get().then(K=>se(K.linkedAccount??null)).catch(()=>{})},[e]);const xe=(e==null?void 0:e.id)??(ae==null?void 0:ae.id)??void 0,[H,le]=b.useState(0);b.useEffect(()=>{if(!xe)return;const K=()=>{fetch("/api/cotacoes/admin/inbox/contadores",{credentials:"include"}).then(ce=>ce.ok?ce.json():null).then(ce=>{(ce==null?void 0:ce.total)!=null&&le(Number(ce.total))}).catch(()=>{})};K();const re=setInterval(K,3e4);return()=>clearInterval(re)},[xe]);const[Z,F]=b.useState("off"),[z,q]=b.useState(0),[ie,oe]=b.useState([]),we=b.useRef(0),Ee=b.useCallback(K=>oe(re=>re.filter(ce=>ce.id!==K)),[]),ze=b.useCallback((K,re="info",ce)=>{const ye=++we.current;oe(Fe=>[...Fe,{id:ye,msg:K,type:re,action:ce}]),ce||setTimeout(()=>Ee(ye),6e3)},[Ee]),[gn,vn]=b.useState(!1),[yn,bn]=b.useState([]),[jn,Wn]=b.useState(!1),[ne,Se]=b.useState(null),[ft,Tt]=b.useState(null),[gt,Ba]=b.useState(!1),[Yl,Fa]=b.useState(!1),Ql=b.useRef(null),$t=b.useRef(null),Mt=b.useRef(null),zs=b.useRef(null),Q=b.useRef(null);b.useEffect(()=>{const K=()=>B(window.innerWidth<768);return window.addEventListener("resize",K),K(),()=>window.removeEventListener("resize",K)},[]),b.useEffect(()=>{const K=re=>{Q.current&&!Q.current.contains(re.target)&&U(!1)};return document.addEventListener("mousedown",K),()=>document.removeEventListener("mousedown",K)},[]);const ue=b.useCallback(async()=>{k(!0);try{const K=await he.getSessions();if(r(K),!s&&K.length>0){const re=localStorage.getItem("wa_selected_session"),ce=re?K.find(ye=>ye.id===re):null;i(ce??K[0])}}catch{}finally{k(!1)}},[s]),We=b.useCallback(async()=>{try{const K=await he.getNumbers();bn(K)}catch{}},[]);b.useEffect(()=>{ue(),We(),he.getAutoReplyMode().then(K=>F(K.mode)).catch(()=>{})},[]),b.useEffect(()=>{const K=new EventSource("/api/sse",{withCredentials:!0});return K.addEventListener("handoff.expired",re=>{try{const{chatId:ce}=JSON.parse(re.data);f(ye=>((ye==null?void 0:ye.id)===ce&&(ze("IA retomou o atendimento automaticamente (15 min sem resposta)","info"),q(Fe=>Fe+1)),ye))}catch{}}),K.addEventListener("human_api.new",re=>{try{const{question:ce,sectorName:ye}=JSON.parse(re.data),Fe=ye?`[${ye}]`:"";ze(`🤖 IA precisa de ajuda ${Fe}: "${String(ce).slice(0,60)}"`,"warning",{label:"Ver Inbox",onClick:()=>V("inbox-interna")})}catch{}}),K.addEventListener("sla.breach",re=>{try{const{sectorName:ce,elapsedMins:ye,slaMins:Fe}=JSON.parse(re.data);ze(`⚠ SLA estourado — ${ce}: ${ye}min (limite ${Fe}min)`,"warning",{label:"Ver Inbox",onClick:()=>V("inbox-interna")})}catch{}}),K.addEventListener("human_api.answered",()=>{}),()=>K.close()},[ze]);const hr=b.useCallback(async K=>{if(window.confirm("Remover este número? A sessão será desconectada e os dados apagados.")){Tt(K);try{const re=yn.find(ce=>ce.instance_id===K);await he.deleteSession(K),re&&await he.deleteNumber(re.id).catch(()=>{}),(s==null?void 0:s.id)===K&&i(null),await ue(),await We()}catch{alert("Erro ao remover sessão.")}finally{Tt(null)}}},[yn,s,ue,We]),Bs=b.useCallback(async()=>{Ba(!0),Fa(!1);try{await fetch("/api/admin/nw/sync-knowledge",{method:"POST",credentials:"include"}),Fa(!0),setTimeout(()=>Fa(!1),3e3)}catch{alert("Erro ao sincronizar base de conhecimento.")}finally{Ba(!1)}},[]);b.useEffect(()=>{!s||s.status!=="QR_PENDING"||he.getQr(s.id).then(K=>l(re=>({...re,[s.id]:K.qrBase64}))).catch(()=>{})},[s==null?void 0:s.id,s==null?void 0:s.status]),b.useEffect(()=>{if(!s||s.status!=="CONNECTED"){u([]);return}_(!0),he.getInbox(s.id,void 0,60).then(u).catch(()=>{}).finally(()=>_(!1))},[s==null?void 0:s.id,s==null?void 0:s.status]);const Yi=50;b.useEffect(()=>{if(!d){h([]),R(!1);return}E(!0),he.getMessages(d.id,Yi).then(K=>{h(K),R(K.length===Yi)}).catch(()=>{}).finally(()=>E(!1))},[d==null?void 0:d.id]);const Id=b.useCallback(async()=>{if(!d||P||!I||p.length===0)return;const K=p[0].timestamp;D(!0);try{const re=await he.getMessages(d.id,Yi,K);if(re.length===0){R(!1);return}R(re.length===Yi);const ce=zs.current,ye=(ce==null?void 0:ce.scrollHeight)??0;h(Fe=>[...re,...Fe]),requestAnimationFrame(()=>{ce&&(ce.scrollTop=ce.scrollHeight-ye)})}catch{}finally{D(!1)}},[d,P,I,p]),pw=b.useRef(null);b.useEffect(()=>{var K,re;d&&(pw.current!==d.id?(pw.current=d.id,(K=$t.current)==null||K.scrollIntoView({behavior:"instant"})):(re=$t.current)==null||re.scrollIntoView({behavior:"smooth"}))},[p]),b.useEffect(()=>{const K=Mt.current;if(!K)return;const re=new IntersectionObserver(ce=>{ce[0].isIntersecting&&Id()},{threshold:.1});return re.observe(K),()=>re.disconnect()},[Id]),b.useEffect(()=>{const K=`${window.location.protocol==="https:"?"wss":"ws"}://${window.location.host}/api/nw/v1/stream`;let re,ce,ye=!1,Fe=3e3;function Fs(){ye||(re=new WebSocket(K),Ql.current=re,W("connecting"),re.onopen=()=>{Fe=3e3,W("open")},re.onmessage=Sx=>{let vw;try{vw=JSON.parse(Sx.data)}catch{return}const{event:Qi,data:_e}=vw;if(Qi==="session.qr"&&(l(at=>({...at,[_e.instanceId]:_e.qrBase64})),r(at=>at.map(tt=>tt.id===_e.instanceId?{...tt,status:"QR_PENDING"}:tt)),i(at=>(at==null?void 0:at.id)===_e.instanceId?{...at,status:"QR_PENDING"}:at)),Qi==="session.status"){const at=_e.status==="connected"?"CONNECTED":"DISCONNECTED";r(tt=>tt.map(da=>da.id===_e.instanceId?{...da,status:at}:da)),i(tt=>(tt==null?void 0:tt.id)===_e.instanceId?{...tt,status:at}:tt),_e.status==="connected"&&he.getInbox(_e.instanceId,void 0,60).then(u).catch(()=>{})}if(Qi==="message.update"&&h(at=>at.map(tt=>tt.messageId===_e.messageId?{...tt,status:_e.status}:tt)),Qi==="conversation.handoff"&&_e.mode==="ia"&&_e.reason==="timeout"&&ze("Secretária retomou o atendimento automaticamente (15 min sem resposta)","info"),Qi==="conversation.escalated"){const at=_e.protocolNumber?` #${_e.protocolNumber}`:"",tt=_e.motivo?` — ${_e.motivo}`:"";ze(`Escalação${at}${tt}: cliente aguarda atendimento humano`,"warning",{label:"Assumir",onClick:async()=>{try{await v6.assume({chatId:_e.chatId||"",protocolNumber:_e.protocolNumber,chatName:_e.chatName}),V("inbox-interna")}catch{}}})}Qi==="message.new"&&(u(at=>at.map(tt=>{var da,Jl,Zl,ec;return tt.id===_e.chatId?{...tt,unreadCount:tt.unreadCount+((da=_e.message)!=null&&da.fromMe?0:1),lastMessageAt:new Date().toISOString(),lastMessage:{body:(Jl=_e.message)==null?void 0:Jl.body,type:((Zl=_e.message)==null?void 0:Zl.type)||"TEXT",fromMe:!!((ec=_e.message)!=null&&ec.fromMe),status:"SENT",timestamp:new Date().toISOString()}}:tt})),f(at=>((at==null?void 0:at.id)===_e.chatId&&h(tt=>{var da,Jl,Zl,ec,yw,bw,jw,ww,Nw,Sw,kw;return[...tt,{id:((da=_e.message)==null?void 0:da.id)||`tmp-${Date.now()}`,messageId:((Jl=_e.message)==null?void 0:Jl.messageId)||"",fromMe:((Zl=_e.message)==null?void 0:Zl.fromMe)??!1,type:((ec=_e.message)==null?void 0:ec.type)||"TEXT",body:((yw=_e.message)==null?void 0:yw.body)??null,caption:((bw=_e.message)==null?void 0:bw.caption)??null,mediaUrl:((jw=_e.message)==null?void 0:jw.mediaUrl)??null,mimeType:((ww=_e.message)==null?void 0:ww.mimeType)??null,fileName:((Nw=_e.message)==null?void 0:Nw.fileName)??null,status:"DELIVERED",timestamp:new Date().toISOString(),pushName:((Sw=_e.message)==null?void 0:Sw.pushName)??null,senderJid:((kw=_e.message)==null?void 0:kw.senderJid)??null}]}),at)))},re.onclose=()=>{W("closed"),ye||(ce=setTimeout(Fs,Fe),Fe=Math.min(Fe*2,6e4))},re.onerror=()=>{re.close()})}return Fs(),()=>{ye=!0,clearTimeout(ce),re==null||re.close()}},[]);const g8=b.useCallback(async()=>{if(d)try{await he.archive(d.id,!0),u(K=>K.filter(re=>re.id!==d.id)),f(null)}catch{}},[d]),v8=async()=>{if(!d||!x.trim()||g)return;const K=x.trim(),re=e!=null&&e.name?`*${e.name}:*
${K}`:K;y(""),j(!0);const ce={id:`opt-${Date.now()}`,messageId:"",fromMe:!0,type:"TEXT",body:re,caption:null,mediaUrl:null,mimeType:null,fileName:null,status:"PENDING",timestamp:new Date().toISOString(),pushName:null,senderJid:null};h(ye=>[...ye,ce]);try{await he.send(d.id,re),Z==="automatico"&&(await he.setHandoffMode(d.id,"humano").catch(()=>{}),q(ye=>ye+1))}catch{h(ye=>ye.filter(Fe=>Fe.id!==ce.id)),y(K)}finally{j(!1)}},y8=async()=>{var re,ce;if(!d||!x.trim()||N)return;const K=x.trim();w(!0);try{const ye=d.displayName??d.phone,Fe=await he.secretariaAsk(d.id,K,ye);y(Fe.reply)}catch(ye){alert(`Erro ao consultar Secretária IA: ${((ce=(re=ye==null?void 0:ye.response)==null?void 0:re.data)==null?void 0:ce.error)??ye.message}`)}finally{w(!1)}},hw=b.useMemo(()=>{if(!m)return c;const K=m.toLowerCase();return c.filter(re=>(re.displayName??re.phone).toLowerCase().includes(K))},[c,m]),Nx=b.useMemo(()=>c.reduce((K,re)=>K+re.unreadCount,0),[c]),mw=b.useMemo(()=>{var K;return((K=d==null?void 0:d.jid)==null?void 0:K.endsWith("@g.us"))??!1},[d]),b8=b.useMemo(()=>p.map((K,re)=>{const ce=p[re-1],ye=!ce||ce.fromMe!==K.fromMe,Fe=!ce||!Age(ce.timestamp,K.timestamp),Fs=Fe?_ge(K.timestamp):"",Sx=mw&&!K.fromMe&&(ye||(ce==null?void 0:ce.senderJid)!==K.senderJid);return{msg:K,showTail:ye,showSeparator:Fe,separatorLabel:Fs,showSender:Sx}}),[p,mw]),xw=T==="secretaria"||T==="equipe"||T==="inbox-interna"||T==="metricas",j8=!L||!d,w8=!xw&&(!L||!!d);return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"fixed top-4 right-4 z-[9999] flex flex-col gap-2 pointer-events-none",children:ie.map(K=>a.jsxs("div",{className:`flex flex-col gap-2 px-4 py-3 rounded-xl shadow-xl text-[13px] font-medium max-w-[360px] pointer-events-auto
${K.type==="warning"?"bg-orange-500 text-white":"bg-[#111b21] text-white"}`,children:[a.jsxs("div",{className:"flex items-start gap-2",children:[K.type==="warning"&&a.jsx(DI,{size:15,className:"flex-shrink-0 mt-0.5 animate-pulse"}),a.jsx("span",{className:"flex-1",children:K.msg}),a.jsx("button",{onClick:()=>Ee(K.id),className:"ml-1 opacity-70 hover:opacity-100 flex-shrink-0",children:a.jsx(Ce,{size:13})})]}),K.action&&a.jsxs("button",{onClick:()=>{K.action.onClick(),Ee(K.id)},className:"self-end px-3 py-1 bg-white/20 hover:bg-white/30 rounded-lg text-[12px] font-bold transition-colors flex items-center gap-1.5",children:[a.jsx(h1,{size:12}),K.action.label]})]},K.id))}),a.jsxs("div",{className:"flex h-screen w-full bg-[#f0f2f5] overflow-hidden select-none font-sans text-[#111b21]",children:[a.jsx(Uge,{activeTab:T,setActiveTab:K=>{K==="inbox-interna"&&le(0),V(K)},session:s,inboxUnread:H,teamAccount:e,onTeamLogout:t}),j8&&a.jsxs("div",{className:`${xw?"flex-1":L?"w-full":"w-[400px]"} flex flex-col bg-white border-r border-[#d1d7db] flex-shrink-0 z-20`,children:[T==="sessions"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"px-3 py-2 bg-[#f0f2f5] border-b border-[#d1d7db] flex-shrink-0",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h2",{className:"text-[16px] font-bold text-[#111b21]",children:"Sessões WhatsApp"}),a.jsxs("div",{className:"flex items-center gap-1",children:[M==="open"?a.jsx(nE,{size:13,className:"text-[#00a884]"}):a.jsx(K2,{size:13,className:"text-red-500"}),a.jsx("button",{onClick:ue,className:"p-1.5 hover:bg-black/5 rounded-full transition-colors",title:"Atualizar",children:a.jsx(ke,{size:14,className:`text-[#54656f] ${S?"animate-spin":""}`})})]})]}),a.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[a.jsxs("button",{onClick:()=>Wn(!0),className:"flex-1 flex items-center justify-center gap-1.5 py-1.5 bg-[#00a884] hover:bg-[#017f67] text-white text-[12px] font-semibold rounded-lg transition-all",children:[a.jsx(Oe,{size:13})," Novo Número"]}),a.jsx("button",{onClick:Bs,disabled:gt,title:"Sincronizar base de conhecimento da IA com dados do banco",className:`flex-1 flex items-center justify-center gap-1.5 py-1.5 text-[12px] font-semibold rounded-lg border transition-all
${Yl?"bg-emerald-50 border-emerald-300 text-emerald-700":"bg-white border-[#d1d7db] text-[#54656f] hover:border-[#00a884] hover:text-[#00a884]"} disabled:opacity-50`,children:gt?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"w-3 h-3 border border-current border-t-transparent rounded-full animate-spin"})," Sincronizando…"]}):Yl?a.jsxs(a.Fragment,{children:[a.jsx(rv,{size:13})," IA Atualizada ✓"]}):a.jsxs(a.Fragment,{children:[a.jsx(rv,{size:13})," Sincronizar IA"]})})]})]}),a.jsx("div",{className:"flex-1 overflow-y-auto",children:S?[1,2].map(K=>a.jsx("div",{className:"m-3 h-28 rounded-2xl bg-[#f0f2f5] animate-pulse"},K)):n.length===0?a.jsxs("div",{className:"flex flex-col items-center gap-3 py-16 px-6 text-center",children:[a.jsx("div",{className:"w-14 h-14 rounded-full bg-[#f0f2f5] flex items-center justify-center",children:a.jsx(y1,{size:24,className:"text-[#8696a0]"})}),a.jsx("p",{className:"text-[#667781] text-sm",children:"Nenhum número cadastrado."}),a.jsxs("button",{onClick:()=>Wn(!0),className:"text-[#00a884] text-sm font-semibold hover:underline flex items-center gap-1",children:[a.jsx(Oe,{size:14})," Adicionar primeiro número"]})]}):n.slice().sort((K,re)=>{const ce=yn.find(Fe=>Fe.instance_id===K.id),ye=yn.find(Fe=>Fe.instance_id===re.id);return((ce==null?void 0:ce.priority)??99)-((ye==null?void 0:ye.priority)??99)}).map(K=>{const re=yn.find(ce=>ce.instance_id===K.id);return a.jsxs("div",{className:`m-3 p-4 rounded-2xl border transition-all
${(s==null?void 0:s.id)===K.id?"bg-[#00a884]/5 border-[#00a884]/30":"bg-white border-[#d1d7db] hover:border-[#c0c8cf]"}`,children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsxs("div",{className:"cursor-pointer flex-1 flex items-center gap-3 min-w-0",onClick:()=>{i(K),localStorage.setItem("wa_selected_session",K.id),V("chats")},children:[a.jsx(Bo,{src:K.avatar,name:K.name,size:42}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-[15px] font-semibold text-[#111b21] truncate",children:K.name}),a.jsx("p",{className:"text-[12px] text-[#667781] font-mono",children:K.phone??"—"}),(re==null?void 0:re.area)&&a.jsx("p",{className:"text-[11px] text-[#8696a0] truncate",children:re.area})]})]}),a.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[a.jsx("button",{onClick:ce=>{ce.stopPropagation(),Se({num:re??null,session:K})},className:"p-1.5 hover:bg-black/5 rounded-full transition-colors text-[#8696a0] hover:text-[#54656f]",title:"Editar / Reconectar",children:a.jsx(Er,{size:14})}),a.jsx("button",{onClick:ce=>{ce.stopPropagation(),hr(K.id)},disabled:ft===K.id,className:"p-1.5 hover:bg-red-50 rounded-full transition-colors text-[#8696a0] hover:text-red-500 disabled:opacity-40",title:"Remover número",children:ft===K.id?a.jsx("span",{className:"w-3.5 h-3.5 border border-red-400 border-t-transparent rounded-full animate-spin block"}):a.jsx(Te,{size:14})})]})]}),a.jsxs("div",{className:"mt-3 flex items-center gap-2 flex-wrap",children:[a.jsx(l8,{status:K.status}),re&&a.jsx(Dge,{role:re.role,priority:re.priority}),!re&&a.jsx("span",{className:"text-[10px] text-[#8696a0] italic",children:"sem categoria"})]}),(re==null?void 0:re.notes)&&a.jsx("p",{className:"mt-2 text-[11px] text-[#8696a0] italic truncate",children:re.notes}),K.status==="QR_PENDING"&&o[K.id]&&a.jsxs("div",{className:"mt-3 flex flex-col items-center gap-2",children:[a.jsx("img",{src:o[K.id],alt:"QR Code",className:"w-44 h-44 rounded-xl border-2 border-amber-400/30 bg-white p-1.5"}),a.jsx("p",{className:"text-[11px] text-amber-600 font-bold uppercase tracking-wide text-center",children:"Escaneie com o WhatsApp"})]}),K.status==="QR_PENDING"&&!o[K.id]&&a.jsxs("div",{className:"mt-3 flex items-center justify-center gap-2 py-3 bg-amber-50 rounded-xl border border-amber-200",children:[a.jsx(js,{size:15,className:"text-amber-500 animate-pulse"}),a.jsx("span",{className:"text-[11px] text-amber-600 font-semibold",children:"Aguardando QR..."})]})]},K.id)})})]}),T==="chats"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"h-[60px] px-4 flex items-center justify-between bg-[#f0f2f5] border-b border-[#d1d7db] flex-shrink-0",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[L&&d&&a.jsx("button",{onClick:()=>f(null),className:"p-2 hover:bg-black/5 rounded-full",children:a.jsx(Ui,{size:20,className:"text-[#54656f]"})}),a.jsxs("div",{className:"relative",ref:Q,children:[a.jsxs("div",{onClick:()=>n.length>1&&U(K=>!K),className:`flex items-center gap-2 p-1 rounded-md transition-all ${n.length>1?"cursor-pointer hover:bg-black/5":""}`,children:[a.jsx(Bo,{src:s==null?void 0:s.avatar,name:s==null?void 0:s.name,size:38}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"text-[15px] font-semibold text-[#111b21] truncate max-w-[120px] leading-tight",children:(s==null?void 0:s.name)??"Instância"}),s&&a.jsx("p",{className:"text-[11px] text-[#667781] leading-tight",children:((gw=Xh[s.status])==null?void 0:gw.label)??s.status})]}),n.length>1&&a.jsx(aa,{size:16,className:`text-[#54656f] transition-transform ${X?"rotate-180":""}`})]}),X&&a.jsx("div",{className:"absolute left-0 top-full mt-1 bg-white shadow-2xl rounded-xl border border-gray-100 w-72 z-50 py-2",children:n.map(K=>{var re;return a.jsxs("button",{onClick:()=>{i(K),localStorage.setItem("wa_selected_session",K.id),f(null),U(!1)},className:"w-full px-4 py-3 hover:bg-[#f5f6f6] flex items-center gap-3 transition-colors",children:[a.jsx(Bo,{src:K.avatar,name:K.name,size:34}),a.jsxs("div",{className:"text-left flex-1 min-w-0",children:[a.jsx("p",{className:"text-[14px] font-semibold text-[#111b21] truncate",children:K.name}),a.jsx("p",{className:`text-[12px] ${K.status==="CONNECTED"?"text-[#00a884]":"text-[#667781]"}`,children:((re=Xh[K.status])==null?void 0:re.label)??K.status})]})]},K.id)})})]})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[Nx>0&&a.jsx("span",{className:"bg-[#00a884] text-white text-[11px] font-bold px-1.5 py-0.5 rounded-full min-w-[20px] h-5 flex items-center justify-center",children:Nx>99?"99+":Nx}),(s==null?void 0:s.status)==="CONNECTED"&&a.jsx("button",{onClick:()=>vn(!0),className:"p-2 hover:bg-black/5 rounded-full transition-colors",title:"Nova conversa",children:a.jsx(Er,{size:16,className:"text-[#54656f]"})}),a.jsx("button",{onClick:()=>{s&&(_(!0),he.getInbox(s.id,void 0,60).then(u).catch(()=>{}).finally(()=>_(!1)))},className:"p-2 hover:bg-black/5 rounded-full transition-colors",title:"Atualizar chats",children:a.jsx(ke,{size:16,className:`text-[#54656f] ${C?"animate-spin":""}`})})]})]}),a.jsx("div",{className:"px-4 py-2 bg-white",children:a.jsxs("div",{className:"relative",children:[a.jsx(Ir,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-[#8696a0]"}),a.jsx("input",{type:"text",value:m,onChange:K=>v(K.target.value),placeholder:"Pesquisar ou começar nova conversa",className:"w-full bg-[#f0f2f5] h-[35px] pl-9 pr-3 rounded-lg text-[14px] text-[#111b21] placeholder:text-[#8696a0] border-none focus:ring-0 outline-none"}),m&&a.jsx("button",{onClick:()=>v(""),className:"absolute right-2 top-1/2 -translate-y-1/2",children:a.jsx(Ce,{size:14,className:"text-[#8696a0]"})})]})}),a.jsx("div",{className:"flex-1 overflow-y-auto",children:s?s.status!=="CONNECTED"?a.jsx("div",{className:"flex flex-col items-center justify-center h-full gap-4 text-[#667781]",children:s.status==="QR_PENDING"?a.jsxs(a.Fragment,{children:[a.jsx(js,{size:36,className:"opacity-40"}),a.jsx("p",{className:"text-sm italic text-center px-8",children:"Escaneie o QR na aba Sessões para conectar"}),a.jsx("button",{onClick:()=>V("sessions"),className:"text-[#00a884] text-sm font-semibold hover:underline",children:"Ver sessões"})]}):a.jsxs(a.Fragment,{children:[a.jsx(K2,{size:36,className:"opacity-40"}),a.jsx("p",{className:"text-sm italic",children:"Sessão desconectada"})]})}):C?Array.from({length:8}).map((K,re)=>a.jsxs("div",{className:"flex items-center gap-3 px-3 py-[10px] border-b border-[#f0f2f5] animate-pulse",children:[a.jsx("div",{className:"w-[49px] h-[49px] rounded-full bg-[#f0f2f5] flex-shrink-0"}),a.jsxs("div",{className:"flex-1 space-y-2",children:[a.jsx("div",{className:"h-[14px] bg-[#f0f2f5] rounded w-3/4"}),a.jsx("div",{className:"h-[12px] bg-[#f0f2f5] rounded w-1/2"})]})]},re)):hw.length===0?a.jsx("p",{className:"text-[#667781] text-sm italic text-center py-16 px-6",children:m?"Nenhuma conversa encontrada.":"Nenhuma conversa ainda."}):hw.map(K=>a.jsx(Ege,{chat:K,isActive:(d==null?void 0:d.id)===K.id,onSelect:()=>{f(K),K.unreadCount>0&&(he.markRead(K.id).catch(()=>{}),u(re=>re.map(ce=>ce.id===K.id?{...ce,unreadCount:0}:ce)))},onPin:re=>{he.pin(K.id,re).catch(()=>{}),u(ce=>ce.map(ye=>ye.id===K.id?{...ye,isPinned:re}:ye))},onArchive:re=>{he.archive(K.id,re).catch(()=>{}),u(ce=>ce.filter(ye=>ye.id!==K.id)),(d==null?void 0:d.id)===K.id&&f(null)},onMarkRead:()=>{he.markRead(K.id).catch(()=>{}),u(re=>re.map(ce=>ce.id===K.id?{...ce,unreadCount:0}:ce))},onDelete:()=>{he.deleteChat(K.id).catch(()=>{}),u(re=>re.filter(ce=>ce.id!==K.id)),(d==null?void 0:d.id)===K.id&&f(null)}},K.id)):a.jsx("p",{className:"text-[#667781] text-sm italic text-center py-16 px-6",children:"Selecione uma sessão"})})]}),T==="secretaria"&&a.jsx(Vge,{}),T==="equipe"&&a.jsx("div",{className:"flex-1 min-h-0 overflow-hidden bg-slate-900 flex flex-col",children:a.jsx(B0e,{})}),T==="inbox-interna"&&a.jsx("div",{className:"flex-1 min-h-0 overflow-hidden bg-slate-900 flex flex-col",children:a.jsx(ige,{accountId:xe,role:(e==null?void 0:e.role)??(ae==null?void 0:ae.role)??"agent"})}),T==="metricas"&&a.jsx("div",{className:"flex-1 min-h-0 overflow-hidden flex flex-col",children:a.jsx(cge,{})})]}),w8&&a.jsx("div",{className:"flex-1 flex h-full min-w-0 overflow-hidden relative",children:d?a.jsxs("div",{className:"flex-1 flex flex-col h-full overflow-hidden",children:[a.jsx(Wge,{chat:d,isMobile:L,onBack:()=>f(null),onArchive:g8}),a.jsxs("div",{ref:zs,className:"flex-1 overflow-y-auto pt-3 pb-2",style:{backgroundColor:"#efeae2"},children:[A?a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsx("div",{className:"w-7 h-7 border-[3px] border-[#00a884] border-t-transparent rounded-full animate-spin"})}):p.length===0?a.jsx("p",{className:"text-[#667781] text-sm italic text-center py-16",children:"Nenhuma mensagem."}):a.jsxs(a.Fragment,{children:[a.jsx("div",{ref:Mt,className:"h-px"}),P&&a.jsx("div",{className:"flex justify-center py-2",children:a.jsx("div",{className:"w-5 h-5 border-2 border-[#00a884] border-t-transparent rounded-full animate-spin"})}),b8.map(({msg:K,showTail:re,showSeparator:ce,separatorLabel:ye,showSender:Fe})=>{var Fs;return a.jsxs("div",{children:[ce&&a.jsx($ge,{label:ye}),a.jsx(Tge,{msg:K,showTail:re,showSender:Fe,senderName:K.pushName??((Fs=K.senderJid)==null?void 0:Fs.split("@")[0])??void 0})]},K.id)})]}),a.jsx("div",{ref:$t})]}),a.jsx(qge,{chat:d,autoReplyGlobal:Z,refreshKey:z}),a.jsx(Hge,{value:x,onChange:y,onSend:v8,sending:g,onAskAi:y8,askingAi:N,chatId:(d==null?void 0:d.id)??null})]}):a.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-6",style:{backgroundColor:"#f0f2f5"},children:[a.jsxs("div",{className:"flex flex-col items-center gap-4 text-[#41525d]",children:[a.jsx("div",{className:"w-[220px] h-[220px] rounded-full bg-[#dfe5e7]/50 flex items-center justify-center",children:a.jsx(rn,{size:80,className:"opacity-20"})}),a.jsxs("div",{className:"text-center",children:[a.jsx("h1",{className:"text-[32px] font-light text-[#41525d] mb-3",children:"WhatsApp Inbox"}),a.jsx("p",{className:"text-[15px] text-[#667781] max-w-[320px] leading-relaxed",children:"Envie e receba mensagens sem manter o celular conectado. Use o WhatsApp no computador."})]})]}),a.jsxs("div",{className:"flex items-center gap-2 text-[12px] text-[#8696a0]",children:[a.jsx("div",{className:"w-1 h-1 rounded-full bg-[#8696a0]"}),"Suas mensagens pessoais são protegidas com a criptografia de ponta a ponta",a.jsx("div",{className:"w-1 h-1 rounded-full bg-[#8696a0]"})]})]})})]}),jn&&a.jsx(Ige,{onClose:()=>Wn(!1),onCreated:async()=>{await ue(),await We()}}),ne&&a.jsx(Lge,{num:ne.num,session:ne.session,onClose:()=>Se(null),onSaved:async()=>{await We()}}),gn&&s&&a.jsx(Rge,{sessionId:s.id,onClose:()=>vn(!1),onSent:()=>{vn(!1),s&&he.getInbox(s.id,void 0,60).then(u).catch(()=>{})}})]})}const Gge=[{id:"message.new",label:"Nova mensagem",desc:"Disparado a cada mensagem recebida ou enviada"},{id:"session.status",label:"Status da sessão",desc:"Disparado quando uma instância conecta ou desconecta"}];function Xge(e){return new Date(e).toLocaleString("pt-BR",{day:"2-digit",month:"2-digit",year:"2-digit",hour:"2-digit",minute:"2-digit"})}function HC({text:e}){const[t,n]=b.useState(!1),r=()=>{navigator.clipboard.writeText(e).then(()=>{n(!0),setTimeout(()=>n(!1),1500)})};return a.jsx("button",{onClick:r,className:"p-1 rounded hover:bg-black/5 transition-colors text-[#8696a0] hover:text-[#54656f]",title:"Copiar",children:t?a.jsx(jt,{size:13,className:"text-[#00a884]"}):a.jsx(cI,{size:13})})}function Yge({event:e}){const t={"message.new":"bg-[#00a884]/10 text-[#00a884] border-[#00a884]/20","session.status":"bg-blue-500/10 text-blue-600 border-blue-500/20"},n={"message.new":"message.new","session.status":"session.status"};return a.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded-full text-[11px] font-semibold border ${t[e]??"bg-gray-100 text-gray-600 border-gray-200"}`,children:n[e]??e})}function Qge({hook:e,onDelete:t,onToggle:n}){const[r,s]=b.useState(!1),[i,o]=b.useState(!1),[l,c]=b.useState(!1),[u,d]=b.useState(!1),f=async()=>{if(!u){d(!0),setTimeout(()=>d(!1),3e3);return}o(!0);try{await he.deleteWebhook(e.id),t(e.id)}catch{}finally{o(!1)}},p=async()=>{c(!0);try{await he.toggleWebhook(e.id,!e.active),n(e.id,!e.active)}catch{}finally{c(!1)}};return a.jsxs("div",{className:`bg-white rounded-xl border transition-all ${e.active?"border-[#d1d7db]":"border-[#d1d7db] opacity-60"}`,children:[a.jsxs("div",{className:"flex items-center gap-3 px-4 py-3",children:[a.jsx("div",{className:`w-2.5 h-2.5 rounded-full flex-shrink-0 ${e.active?"bg-[#00a884] animate-pulse":"bg-[#8696a0]"}`}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("span",{className:"text-[14px] font-mono text-[#111b21] truncate",children:e.url}),a.jsx(HC,{text:e.url})]}),a.jsxs("div",{className:"flex items-center gap-1.5 mt-1 flex-wrap",children:[e.events.map(h=>a.jsx(Yge,{event:h},h)),a.jsx("span",{className:"text-[11px] text-[#8696a0] ml-1",children:Xge(e.createdAt)})]})]}),a.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[a.jsx("button",{onClick:p,disabled:l,title:e.active?"Desativar":"Ativar",className:"p-2 rounded-full hover:bg-black/5 transition-colors disabled:opacity-40",children:e.active?a.jsx(KP,{size:16,className:"text-[#00a884]"}):a.jsx($I,{size:16,className:"text-[#8696a0]"})}),a.jsx("button",{onClick:f,disabled:i,title:u?"Clique novamente para confirmar":"Remover",className:`p-2 rounded-full transition-colors disabled:opacity-40 ${u?"bg-red-50 text-red-500":"hover:bg-black/5 text-[#8696a0] hover:text-red-500"}`,children:a.jsx(Te,{size:16})}),a.jsx("button",{onClick:()=>s(h=>!h),className:"p-2 rounded-full hover:bg-black/5 transition-colors text-[#8696a0]",children:r?a.jsx(p1,{size:16}):a.jsx(aa,{size:16})})]})]}),r&&a.jsxs("div",{className:"border-t border-[#f0f2f5] px-4 py-3 bg-[#f9fafb] rounded-b-xl space-y-3",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-[11px] font-semibold text-[#667781] uppercase tracking-wide mb-1",children:"Como validar a assinatura"}),a.jsx("pre",{className:"text-[12px] bg-white border border-[#d1d7db] rounded-lg p-3 overflow-x-auto text-[#111b21] leading-relaxed whitespace-pre-wrap",children:`// Node.js
const crypto = require('crypto');
const sig = req.headers['x-nw-signature'];
const expected = 'sha256=' + crypto
.createHmac('sha256', '<seu-secret>')
.update(JSON.stringify(req.body))
.digest('hex');
if (sig !== expected) return res.status(401).end();`})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-[11px] font-semibold text-[#667781] uppercase tracking-wide mb-1",children:"ID do webhook"}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("code",{className:"text-[12px] text-[#54656f] font-mono",children:e.id}),a.jsx(HC,{text:e.id})]})]})]})]})}function Jge({onCreated:e}){const[t,n]=b.useState(""),[r,s]=b.useState(""),[i,o]=b.useState(["message.new"]),[l,c]=b.useState(!1),[u,d]=b.useState(null),f=m=>o(v=>v.includes(m)?v.filter(x=>x!==m):[...v,m]),p=()=>{const m=new Uint8Array(24);crypto.getRandomValues(m),s(Array.from(m).map(v=>v.toString(16).padStart(2,"0")).join(""))},h=async m=>{var v,x;m.preventDefault(),d(null),c(!0);try{const y=await he.createWebhook({url:t,events:i,secret:r});e(y),n(""),s(""),o(["message.new"])}catch(y){d(((x=(v=y.response)==null?void 0:v.data)==null?void 0:x.error)??"Erro ao criar webhook")}finally{c(!1)}};return a.jsxs("form",{onSubmit:h,className:"bg-white rounded-xl border border-[#d1d7db] p-5 space-y-4",children:[a.jsxs("h3",{className:"text-[15px] font-semibold text-[#111b21] flex items-center gap-2",children:[a.jsx(Oe,{size:16,className:"text-[#00a884]"})," Novo webhook"]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-[12px] font-semibold text-[#667781] uppercase tracking-wide mb-1",children:"URL de destino"}),a.jsx("input",{type:"url",value:t,onChange:m=>n(m.target.value),placeholder:"https://meu-sistema.com/webhook/whatsapp",required:!0,className:"w-full bg-[#f0f2f5] rounded-lg px-3 py-2 text-[14px] text-[#111b21] placeholder:text-[#8696a0] outline-none focus:ring-2 focus:ring-[#00a884]/30 border border-transparent focus:border-[#00a884]/30"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-[12px] font-semibold text-[#667781] uppercase tracking-wide mb-2",children:"Eventos"}),a.jsx("div",{className:"flex flex-wrap gap-2",children:Gge.map(m=>a.jsxs("button",{type:"button",onClick:()=>f(m.id),className:`flex flex-col items-start px-3 py-2 rounded-lg border text-left transition-all ${i.includes(m.id)?"bg-[#00a884]/5 border-[#00a884]/40 text-[#00a884]":"bg-[#f0f2f5] border-transparent text-[#54656f] hover:border-[#d1d7db]"}`,children:[a.jsx("span",{className:"text-[13px] font-semibold font-mono",children:m.id}),a.jsx("span",{className:"text-[11px] opacity-80 mt-0.5",children:m.desc})]},m.id))})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"block text-[12px] font-semibold text-[#667781] uppercase tracking-wide mb-1",children:["Secret ",a.jsx("span",{className:"font-normal normal-case",children:"(mínimo 16 caracteres)"})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("input",{type:"text",value:r,onChange:m=>s(m.target.value),placeholder:"sua-chave-secreta-hmac",required:!0,minLength:16,className:"flex-1 bg-[#f0f2f5] rounded-lg px-3 py-2 text-[14px] font-mono text-[#111b21] placeholder:text-[#8696a0] outline-none focus:ring-2 focus:ring-[#00a884]/30 border border-transparent focus:border-[#00a884]/30"}),a.jsxs("button",{type:"button",onClick:p,className:"px-3 py-2 bg-[#f0f2f5] rounded-lg text-[13px] text-[#54656f] hover:bg-[#e9edef] transition-colors flex items-center gap-1.5 font-medium flex-shrink-0",children:[a.jsx(ws,{size:13})," Gerar"]})]}),a.jsxs("p",{className:"text-[11px] text-[#8696a0] mt-1 flex items-center gap-1",children:[a.jsx(ws,{size:10})," Guarde este secret — ele não será exibido novamente após a criação."]})]}),u&&a.jsxs("div",{className:"flex items-center gap-2 text-red-600 text-[13px] bg-red-50 px-3 py-2 rounded-lg border border-red-100",children:[a.jsx(Ar,{size:14})," ",u]}),a.jsx("div",{className:"flex justify-end",children:a.jsxs("button",{type:"submit",disabled:l||i.length===0,className:"px-5 py-2 bg-[#00a884] hover:bg-[#017f67] disabled:opacity-50 text-white text-[14px] font-semibold rounded-lg transition-colors flex items-center gap-2",children:[l?a.jsx(ke,{size:14,className:"animate-spin"}):a.jsx(Oe,{size:14}),"Registrar webhook"]})})]})}function Zge(){const[e,t]=b.useState([]),[n,r]=b.useState(!0),[s,i]=b.useState(!1),o=b.useCallback(async()=>{r(!0);try{t(await he.getWebhooks())}catch{}finally{r(!1)}},[]);b.useEffect(()=>{o()},[o]);const l=d=>{t(f=>[d,...f]),i(!1)},c=d=>t(f=>f.filter(p=>p.id!==d)),u=(d,f)=>t(p=>p.map(h=>h.id===d?{...h,active:f}:h));return a.jsxs("div",{className:"max-w-3xl mx-auto px-4 py-8 space-y-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-10 h-10 bg-[#00a884]/10 rounded-xl flex items-center justify-center",children:a.jsx(sv,{size:20,className:"text-[#00a884]"})}),a.jsxs("div",{children:[a.jsx("h1",{className:"text-[20px] font-bold text-[#111b21]",children:"Webhooks"}),a.jsx("p",{className:"text-[13px] text-[#667781]",children:"Push de eventos WhatsApp para sistemas externos"})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{onClick:o,className:"p-2 hover:bg-black/5 rounded-full transition-colors",title:"Atualizar",children:a.jsx(ke,{size:16,className:`text-[#54656f] ${n?"animate-spin":""}`})}),a.jsxs("button",{onClick:()=>i(d=>!d),className:"flex items-center gap-2 px-4 py-2 bg-[#00a884] hover:bg-[#017f67] text-white text-[14px] font-semibold rounded-lg transition-colors",children:[a.jsx(Oe,{size:16})," Novo webhook"]})]})]}),s&&a.jsx(Jge,{onCreated:l}),n?a.jsx("div",{className:"space-y-3",children:[1,2].map(d=>a.jsx("div",{className:"h-16 bg-white rounded-xl border border-[#d1d7db] animate-pulse"},d))}):e.length===0?a.jsxs("div",{className:"bg-white rounded-xl border border-[#d1d7db] py-16 flex flex-col items-center gap-4 text-[#8696a0]",children:[a.jsx(sv,{size:40,className:"opacity-30"}),a.jsxs("div",{className:"text-center",children:[a.jsx("p",{className:"text-[15px] font-medium text-[#54656f]",children:"Nenhum webhook registrado"}),a.jsx("p",{className:"text-[13px] mt-1",children:'Clique em "Novo webhook" para começar.'})]})]}):a.jsx("div",{className:"space-y-3",children:e.map(d=>a.jsx(Qge,{hook:d,onDelete:c,onToggle:u},d.id))}),a.jsxs("div",{className:"bg-blue-50 border border-blue-100 rounded-xl p-4 text-[13px] text-blue-700 space-y-1",children:[a.jsxs("p",{className:"font-semibold flex items-center gap-1.5",children:[a.jsx(ws,{size:13})," Assinatura HMAC-SHA256"]}),a.jsxs("p",{children:["Cada requisição inclui o header ",a.jsx("code",{className:"bg-blue-100 px-1 rounded font-mono text-[12px]",children:"x-nw-signature: sha256=<hmac>"}),"."]}),a.jsxs("p",{children:["Valide com ",a.jsx("code",{className:"bg-blue-100 px-1 rounded font-mono text-[12px]",children:"HMAC-SHA256(secret, JSON.stringify(body))"})," antes de processar o payload."]})]})]})}function eve(){var X;const e=hm(),[t,n]=b.useState([]),[r,s]=b.useState(!0),[i,o]=b.useState(!1),[l,c]=b.useState(null),[u,d]=b.useState({}),[f,p]=b.useState(!1),[h,m]=b.useState(!1),[v,x]=b.useState(1),[y,g]=b.useState(""),[j,N]=b.useState(""),[w,S]=b.useState(""),[k,C]=b.useState(!1),[_,A]=b.useState(""),[E,P]=b.useState(""),D=async()=>{s(!0);try{const U=await qs.list();n(U)}catch{}finally{s(!1)}};b.useEffect(()=>{D()},[]);const I=async U=>{var B,ae;const L=U.active?"Desativar":"Ativar";if(confirm(`Deseja ${L} o plugin ${U.name}?`))try{U.active?await qs.deactivate(U.id):await qs.activate(U.id),D()}catch(se){alert(((ae=(B=se.response)==null?void 0:B.data)==null?void 0:ae.error)||`Erro ao ${L} plugin`)}},R=async U=>{c(U);try{const L=await qs.getConfig(U.id);d(L||{}),o(!0)}catch{alert("Erro ao carregar configurações")}},M=async U=>{var L,B;if(U.preventDefault(),!!l){p(!0);try{await qs.setConfig(l.id,u),o(!1),alert("Configuração salva com sucesso!")}catch(ae){alert(((B=(L=ae.response)==null?void 0:L.data)==null?void 0:B.error)||"Erro ao salvar")}finally{p(!1)}}},W=async U=>{x(1),g(""),S(""),A(""),P("");try{const L=await qs.getConfig(U.id);N((L==null?void 0:L.newwhats_url)||(L==null?void 0:L.motor_url)||"")}catch{N("")}m(!0)},T=async()=>{if(!y||!j){A("Preencha a URL e o e-mail.");return}C(!0),A("");try{const U=await p4.request(y,j.replace(/\/$/,""));U.dev_code&&(S(U.dev_code),P(U.dev_code)),x(2)}catch(U){A(U.message)}finally{C(!1)}},V=async()=>{if(w.length!==6){A("Digite o código de 6 dígitos.");return}C(!0),A("");try{const U=await p4.confirm(y,w,j.replace(/\/$/,""));await qs.setConfig("newwhats",{integration_key:U.integration_key,newwhats_url:j}),x(3),D()}catch(U){A(U.message)}finally{C(!1)}};return a.jsxs("div",{className:"space-y-8 animate-in fade-in slide-in-from-bottom-4 duration-500",children:[a.jsxs("header",{children:[a.jsx("h2",{className:"text-3xl font-black text-white tracking-tighter uppercase italic",children:"Integrações & Plugins"}),a.jsx("p",{className:"text-slate-400 mt-1 font-medium",children:"Gerencie conexões do sistema, como Automação IA no WhatsApp."})]}),a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8",children:r?[1,2].map(U=>a.jsx("div",{className:"bg-slate-900/40 border border-slate-800 h-64 rounded-[2rem] animate-pulse"},U)):t.length===0?a.jsx("div",{className:"col-span-full py-20 text-center text-slate-500 italic bg-slate-900/40 rounded-[2rem] border border-slate-800",children:"Nenhum plugin instalado no servidor."}):t.map(U=>{var L;return a.jsxs("div",{className:`bg-slate-900/40 backdrop-blur-md border rounded-[2rem] overflow-hidden transition-all group flex flex-col relative ${U.active?"border-cyan-500/30":"border-slate-800"}`,children:[a.jsxs("div",{className:"p-8 flex flex-col gap-5",children:[a.jsxs("div",{className:"flex justify-between items-start",children:[a.jsx("div",{className:`p-4 rounded-2xl flex items-center justify-center border transition-all ${U.active?"bg-cyan-500/10 text-cyan-400 border-cyan-500/20":"bg-slate-800/50 text-slate-500 border-white/5 grayscale"}`,children:a.jsx(XP,{size:32})}),a.jsx("div",{className:`px-3 py-1 rounded-lg text-[10px] font-black uppercase tracking-widest border ${U.active?"bg-emerald-500/10 text-emerald-400 border-emerald-500/20":"bg-slate-800 text-slate-500 border-slate-700"}`,children:U.active?"Ativo":"Desativado"})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-xl font-black text-white group-hover:text-cyan-400 transition-colors tracking-tight",children:U.name}),a.jsxs("span",{className:"text-[11px] text-slate-600 font-bold",children:["v",U.version]})]}),a.jsx("p",{className:"text-slate-500 text-sm line-clamp-2 font-medium italic leading-relaxed",children:U.description}),((L=U.features)==null?void 0:L.length)>0&&a.jsx("div",{className:"flex flex-wrap gap-1.5",children:U.features.map(B=>a.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-lg text-[10px] font-semibold bg-slate-800 text-slate-400 border border-slate-700",children:[a.jsx(Mo,{size:9,className:"text-cyan-500"}),B]},B))}),a.jsxs("div",{className:"flex flex-col gap-2 pt-1",children:[U.ui_path&&U.active&&a.jsxs("button",{onClick:()=>e(U.ui_path),className:"w-full py-3 px-4 rounded-xl font-black text-xs uppercase tracking-widest border border-emerald-500/30 bg-emerald-500/10 text-emerald-400 hover:bg-emerald-500/20 transition-all flex items-center justify-center gap-2",children:[a.jsx(LP,{size:14}),"Abrir Inbox"]}),U.id==="newwhats"&&a.jsxs("button",{onClick:()=>W(U),className:"w-full py-3 px-4 rounded-xl font-black text-xs uppercase tracking-widest border border-cyan-500/30 bg-cyan-500/10 text-cyan-400 hover:bg-cyan-500/20 transition-all flex items-center justify-center gap-2",children:[a.jsx(Go,{size:14}),"Parear com NewWhats"]})]})]}),a.jsxs("div",{className:"mt-auto p-6 bg-slate-800/20 border-t border-slate-800 flex items-center gap-3 group-hover:bg-slate-800/40 transition-all",children:[a.jsxs("button",{onClick:()=>I(U),className:`flex-1 py-3 px-4 rounded-xl font-black text-xs uppercase tracking-widest transition-all flex items-center justify-center gap-2 ${U.active?"bg-rose-500/10 text-rose-500 hover:bg-rose-500 hover:text-white border border-rose-500/20":"bg-emerald-500/10 text-emerald-400 hover:bg-emerald-500 hover:text-white border border-emerald-500/20"}`,children:[a.jsx(KP,{size:14}),U.active?"Desativar":"Ativar"]}),a.jsx("button",{onClick:()=>R(U),className:"p-3 bg-slate-800 text-slate-400 hover:text-white hover:bg-slate-700 rounded-xl transition-all border border-slate-700",title:"Configurações",children:a.jsx(RI,{size:16})})]})]},U.id)})}),a.jsx(Cs,{isOpen:i,onClose:()=>o(!1),title:`Setup: ${l==null?void 0:l.name}`,children:a.jsxs("form",{onSubmit:M,className:"space-y-6",children:[a.jsx("p",{className:"text-sm text-slate-400 font-medium italic mb-6",children:"Preencha os campos de acordo com a documentação da integração."}),(X=l==null?void 0:l.config_schema)==null?void 0:X.map(U=>a.jsxs("div",{className:"space-y-2",children:[a.jsxs("label",{className:"block text-[10px] font-black uppercase tracking-widest text-slate-400",children:[U.label," ",U.required&&a.jsx("span",{className:"text-rose-500",children:"*"})]}),a.jsx("input",{required:U.required,type:U.type==="password"?"password":"text",value:u[U.key]||"",onChange:L=>d({...u,[U.key]:L.target.value}),className:"w-full bg-slate-800/50 border border-slate-700 rounded-xl px-4 py-3 text-white focus:ring-1 ring-cyan-500 outline-none transition-all"}),U.help&&a.jsx("p",{className:"text-[11px] text-slate-500 italic",children:U.help})]},U.key)),a.jsxs("button",{type:"submit",disabled:f,className:"w-full bg-cyan-500 hover:bg-cyan-400 disabled:opacity-50 text-slate-950 font-black py-4 rounded-2xl flex items-center justify-center gap-2 transition-all shadow-lg shadow-cyan-500/20 uppercase italic text-sm mt-8",children:[a.jsx(or,{size:20}),f?"Salvando...":"Salvar Chaves"]})]})}),a.jsx(Cs,{isOpen:h,onClose:()=>m(!1),title:"Parear com NewWhats",children:a.jsxs("div",{className:"space-y-6",children:[v===1&&a.jsxs("div",{className:"space-y-5",children:[a.jsx("p",{className:"text-sm text-slate-400 font-medium",children:"Informe o servidor NewWhats e o e-mail da sua conta. Um código de confirmação será enviado."}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-[10px] font-black uppercase tracking-widest text-slate-500 mb-2",children:"URL do servidor NewWhats"}),a.jsx("input",{type:"text",value:j,onChange:U=>N(U.target.value),placeholder:"http://newwhats.local:8008",className:"w-full bg-slate-800/50 border border-slate-700 rounded-xl px-4 py-3 text-white focus:ring-1 ring-cyan-500 outline-none transition-all"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-[10px] font-black uppercase tracking-widest text-slate-500 mb-2",children:"E-mail da conta NewWhats"}),a.jsx("input",{type:"email",value:y,onChange:U=>g(U.target.value),placeholder:"seu@email.com",className:"w-full bg-slate-800/50 border border-slate-700 rounded-xl px-4 py-3 text-white focus:ring-1 ring-cyan-500 outline-none transition-all"})]}),_&&a.jsx("p",{className:"text-rose-400 text-sm font-medium",children:_}),a.jsx("button",{onClick:T,disabled:k,className:"w-full bg-cyan-500 hover:bg-cyan-400 disabled:opacity-50 text-slate-950 font-black py-4 rounded-2xl flex items-center justify-center gap-2 transition-all shadow-lg shadow-cyan-500/20 uppercase italic text-sm",children:k?"Enviando...":"Enviar Código →"})]}),v===2&&a.jsxs("div",{className:"space-y-5",children:[E?a.jsxs("div",{className:"flex items-start gap-3 p-4 bg-amber-500/10 border border-amber-500/20 rounded-xl",children:[a.jsx(Kt,{size:18,className:"text-amber-400 shrink-0 mt-0.5"}),a.jsxs("p",{className:"text-amber-400 text-sm font-medium",children:["SMTP não configurado — código gerado localmente e preenchido automaticamente. Clique em ",a.jsx("strong",{children:"Confirmar"})," para continuar."]})]}):a.jsxs("p",{className:"text-sm text-slate-400 font-medium",children:["Código enviado para ",a.jsx("strong",{className:"text-white",children:y}),". Digite abaixo:"]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-[10px] font-black uppercase tracking-widest text-slate-500 mb-2",children:"Código de Confirmação"}),a.jsx("input",{type:"text",value:w,onChange:U=>S(U.target.value.replace(/\D/g,"").slice(0,6)),placeholder:"000000",maxLength:6,className:"w-full bg-slate-800/50 border border-slate-700 rounded-xl px-4 py-4 text-white focus:ring-1 ring-cyan-500 outline-none transition-all text-center text-2xl font-black tracking-[0.4em]"})]}),_&&a.jsx("p",{className:"text-rose-400 text-sm font-medium",children:_}),a.jsx("button",{onClick:V,disabled:k,className:"w-full bg-cyan-500 hover:bg-cyan-400 disabled:opacity-50 text-slate-950 font-black py-4 rounded-2xl flex items-center justify-center gap-2 transition-all shadow-lg shadow-cyan-500/20 uppercase italic text-sm",children:k?"Confirmando...":"Confirmar ✓"})]}),v===3&&a.jsxs("div",{className:"text-center space-y-4 py-4",children:[a.jsx("div",{className:"w-16 h-16 bg-emerald-500/10 border border-emerald-500/20 rounded-2xl flex items-center justify-center mx-auto",children:a.jsx(nn,{size:40,className:"text-emerald-400"})}),a.jsx("h3",{className:"text-xl font-black text-white",children:"Pareamento Concluído!"}),a.jsx("p",{className:"text-slate-400 text-sm",children:"A chave de integração foi salva automaticamente no plugin."}),a.jsx("button",{onClick:()=>m(!1),className:"mx-auto px-8 py-3 bg-slate-800 hover:bg-slate-700 text-white font-black rounded-xl transition-all text-sm uppercase tracking-widest",children:"Fechar"})]})]})})]})}function tve(){const[e,t]=b.useState([]),[n,r]=b.useState(!0),[s,i]=b.useState(!1),[o,l]=b.useState(!1),[c,u]=b.useState(null),[d,f]=b.useState({username:"",password:"",passwordConfirm:""}),[p,h]=b.useState({username:"",nome:"",email:"",telefone:"",password:"",passwordConfirm:""}),[m,v]=b.useState(!1),[x,y]=b.useState(""),[g,j]=b.useState(""),N=async()=>{r(!0);try{const _=await bf.list();t(_)}catch{}finally{r(!1)}};b.useEffect(()=>{N()},[]);const w=async _=>{var A,E;if(_.preventDefault(),y(""),d.password!==d.passwordConfirm){y("As senhas não coincidem");return}if(d.password.length<4){y("Senha deve ter no mínimo 4 caracteres");return}v(!0);try{await bf.create({username:d.username,password:d.password}),i(!1),f({username:"",password:"",passwordConfirm:""}),N()}catch(P){y(((E=(A=P.response)==null?void 0:A.data)==null?void 0:E.error)||"Erro ao criar administrador")}finally{v(!1)}},S=_=>{u(_),h({username:_.username,nome:_.nome||"",email:_.email||"",telefone:_.telefone||"",password:"",passwordConfirm:""}),j(""),l(!0)},k=async _=>{var A,E;if(_.preventDefault(),j(""),p.password&&p.password!==p.passwordConfirm){j("As senhas não coincidem");return}if(p.password&&p.password.length<4){j("Senha deve ter no mínimo 4 caracteres");return}if(c){v(!0);try{const P={username:p.username,nome:p.nome,email:p.email,telefone:p.telefone};p.password&&(P.password=p.password),await bf.update(c.id,P),l(!1),N()}catch(P){j(((E=(A=P.response)==null?void 0:A.data)==null?void 0:E.error)||"Erro ao atualizar")}finally{v(!1)}}},C=async _=>{var A,E;if(confirm(`Remover o administrador "${_.username}"?`))try{await bf.delete(_.id),N()}catch(P){alert(((E=(A=P.response)==null?void 0:A.data)==null?void 0:E.error)||"Erro ao remover")}};return a.jsxs("div",{className:"space-y-8 animate-in fade-in slide-in-from-bottom-4 duration-500",children:[a.jsxs("header",{className:"flex justify-between items-end",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-3xl font-black text-white tracking-tighter uppercase italic",children:"Administradores"}),a.jsx("p",{className:"text-slate-400 mt-1 font-medium",children:"Usuários com acesso ao painel administrativo."})]}),a.jsxs("button",{onClick:()=>{y(""),f({username:"",password:"",passwordConfirm:""}),i(!0)},className:"flex items-center gap-2 px-6 py-3 bg-cyan-500 hover:bg-cyan-400 text-slate-950 font-black rounded-2xl transition-all shadow-lg shadow-cyan-500/20 uppercase italic text-xs active:scale-95",children:[a.jsx(UI,{size:18}),"Novo Admin"]})]}),a.jsx("div",{className:"bg-slate-900/40 backdrop-blur-md border border-slate-800 rounded-[2.5rem] overflow-hidden",children:a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-left",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"bg-slate-800/30 text-slate-500 text-[10px] uppercase tracking-widest font-black",children:[a.jsx("th",{className:"px-8 py-5",children:"Administrador"}),a.jsx("th",{className:"px-8 py-5",children:"Contato"}),a.jsx("th",{className:"px-8 py-5",children:"Status"}),a.jsx("th",{className:"px-8 py-5 text-right",children:"Ações"})]})}),a.jsx("tbody",{className:"divide-y divide-slate-800/50",children:n?[1,2,3].map(_=>a.jsx("tr",{className:"animate-pulse",children:a.jsx("td",{colSpan:4,className:"px-8 py-8 bg-slate-800/5"})},_)):e.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:4,className:"px-8 py-20 text-center text-slate-500 font-medium italic",children:"Nenhum administrador encontrado."})}):e.map(_=>a.jsxs("tr",{className:"hover:bg-cyan-500/[0.02] transition-colors group",children:[a.jsx("td",{className:"px-8 py-6",children:a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("div",{className:"w-12 h-12 rounded-2xl bg-gradient-to-br from-cyan-500/20 to-blue-600/20 border border-cyan-500/20 flex items-center justify-center text-cyan-400 font-black text-lg group-hover:scale-110 transition-transform",children:(_.nome||_.username).charAt(0).toUpperCase()}),a.jsxs("div",{children:[a.jsx("div",{className:"text-white font-black text-sm uppercase tracking-tight",children:_.nome||_.username}),a.jsxs("div",{className:"text-slate-500 text-[11px] font-bold",children:["@",_.username]})]})]})}),a.jsx("td",{className:"px-8 py-6",children:a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:"text-xs text-slate-300 font-bold",children:_.email||"—"}),a.jsx("div",{className:"text-xs text-slate-500 font-medium",children:_.telefone||"—"})]})}),a.jsx("td",{className:"px-8 py-6",children:a.jsx("span",{className:"px-3 py-1 rounded-lg text-[10px] font-black uppercase tracking-widest bg-emerald-500/10 text-emerald-400 border border-emerald-500/20",children:"Ativo"})}),a.jsx("td",{className:"px-8 py-6 text-right",children:a.jsxs("div",{className:"flex justify-end gap-3 translate-x-4 opacity-0 group-hover:opacity-100 group-hover:translate-x-0 transition-all",children:[a.jsx("button",{onClick:()=>S(_),className:"p-3 bg-slate-800 text-slate-400 hover:text-white hover:bg-slate-700 rounded-xl transition-all border border-slate-700",children:a.jsx(vm,{size:16})}),a.jsx("button",{onClick:()=>C(_),className:"p-3 bg-rose-500/10 text-rose-500 hover:bg-rose-500 hover:text-white rounded-xl transition-all border border-rose-500/10",children:a.jsx(Te,{size:16})})]})})]},_.id))})]})})}),a.jsx(Cs,{isOpen:s,onClose:()=>i(!1),title:"Novo Administrador",children:a.jsxs("form",{onSubmit:w,className:"space-y-5",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-[10px] font-black uppercase tracking-widest text-slate-500 mb-2",children:"Usuário *"}),a.jsx("input",{required:!0,minLength:3,type:"text",value:d.username,onChange:_=>f({...d,username:_.target.value}),placeholder:"Ex: joao123",className:"w-full bg-slate-800/50 border border-slate-700 rounded-xl px-4 py-3 text-white focus:ring-1 ring-cyan-500 outline-none transition-all"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-[10px] font-black uppercase tracking-widest text-slate-500 mb-2",children:"Senha *"}),a.jsx("input",{required:!0,minLength:4,type:"password",value:d.password,onChange:_=>f({...d,password:_.target.value}),placeholder:"Mínimo 4 caracteres",className:"w-full bg-slate-800/50 border border-slate-700 rounded-xl px-4 py-3 text-white focus:ring-1 ring-cyan-500 outline-none transition-all"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-[10px] font-black uppercase tracking-widest text-slate-500 mb-2",children:"Confirmar Senha *"}),a.jsx("input",{required:!0,type:"password",value:d.passwordConfirm,onChange:_=>f({...d,passwordConfirm:_.target.value}),placeholder:"Repita a senha",className:"w-full bg-slate-800/50 border border-slate-700 rounded-xl px-4 py-3 text-white focus:ring-1 ring-cyan-500 outline-none transition-all"})]}),x&&a.jsx("p",{className:"text-rose-400 text-sm font-medium",children:x}),a.jsxs("button",{type:"submit",disabled:m,className:"w-full bg-cyan-500 hover:bg-cyan-400 disabled:opacity-50 text-slate-950 font-black py-4 rounded-2xl flex items-center justify-center gap-2 transition-all shadow-lg shadow-cyan-500/20 uppercase italic text-sm mt-4",children:[a.jsx(or,{size:20}),m?"Criando...":"Criar Administrador"]})]})}),a.jsx(Cs,{isOpen:o,onClose:()=>l(!1),title:"Editar Administrador",children:a.jsxs("form",{onSubmit:k,className:"space-y-5",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-[10px] font-black uppercase tracking-widest text-slate-500 mb-2",children:"Usuário *"}),a.jsx("input",{required:!0,type:"text",value:p.username,onChange:_=>h({...p,username:_.target.value}),className:"w-full bg-slate-800/50 border border-slate-700 rounded-xl px-4 py-3 text-white focus:ring-1 ring-cyan-500 outline-none transition-all"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-[10px] font-black uppercase tracking-widest text-slate-500 mb-2",children:"Nome"}),a.jsx("input",{type:"text",value:p.nome,onChange:_=>h({...p,nome:_.target.value}),className:"w-full bg-slate-800/50 border border-slate-700 rounded-xl px-4 py-3 text-white focus:ring-1 ring-cyan-500 outline-none transition-all"})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-[10px] font-black uppercase tracking-widest text-slate-500 mb-2",children:"E-mail"}),a.jsx("input",{type:"email",value:p.email,onChange:_=>h({...p,email:_.target.value}),className:"w-full bg-slate-800/50 border border-slate-700 rounded-xl px-4 py-3 text-white focus:ring-1 ring-cyan-500 outline-none transition-all"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-[10px] font-black uppercase tracking-widest text-slate-500 mb-2",children:"Telefone"}),a.jsx("input",{type:"text",value:p.telefone,onChange:_=>h({...p,telefone:_.target.value}),className:"w-full bg-slate-800/50 border border-slate-700 rounded-xl px-4 py-3 text-white focus:ring-1 ring-cyan-500 outline-none transition-all"})]})]}),a.jsxs("div",{className:"border-t border-slate-800 pt-5",children:[a.jsxs("p",{className:"text-[10px] font-black uppercase tracking-widest text-slate-500 mb-4 flex items-center gap-2",children:[a.jsx(yI,{size:12})," Alterar Senha (opcional)"]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-[10px] font-black uppercase tracking-widest text-slate-500 mb-2",children:"Nova Senha"}),a.jsx("input",{type:"password",value:p.password,onChange:_=>h({...p,password:_.target.value}),placeholder:"Deixe vazio para manter",className:"w-full bg-slate-800/50 border border-slate-700 rounded-xl px-4 py-3 text-white focus:ring-1 ring-cyan-500 outline-none transition-all"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-[10px] font-black uppercase tracking-widest text-slate-500 mb-2",children:"Confirmar"}),a.jsx("input",{type:"password",value:p.passwordConfirm,onChange:_=>h({...p,passwordConfirm:_.target.value}),placeholder:"Repita a nova senha",className:"w-full bg-slate-800/50 border border-slate-700 rounded-xl px-4 py-3 text-white focus:ring-1 ring-cyan-500 outline-none transition-all"})]})]})]}),g&&a.jsx("p",{className:"text-rose-400 text-sm font-medium",children:g}),a.jsxs("button",{type:"submit",disabled:m,className:"w-full bg-cyan-500 hover:bg-cyan-400 disabled:opacity-50 text-slate-950 font-black py-4 rounded-2xl flex items-center justify-center gap-2 transition-all shadow-lg shadow-cyan-500/20 uppercase italic text-sm mt-2",children:[a.jsx(or,{size:20}),m?"Salvando...":"Salvar Alterações"]})]})})]})}function nve({onLogin:e}){const[t,n]=b.useState(""),[r,s]=b.useState(""),[i,o]=b.useState(!1),[l,c]=b.useState(""),u=t.includes("@"),d=async f=>{f.preventDefault(),o(!0),c("");try{if(u){const p=await fetch("/api/team/login",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({email:t,password:r})}),h=await p.json();p.ok?e("team",h.account):c(h.error||"Credenciais inválidas")}else{const h=await(await fetch("/admin/login",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({username:t,password:r})})).json();h.success?e("admin"):c(h.error||"Credenciais inválidas")}}catch{c("Erro de conexão com o servidor")}finally{o(!1)}};return a.jsxs("div",{className:"min-h-screen bg-black flex items-center justify-center p-4 relative",children:[a.jsx("div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[600px] h-[600px] bg-cyan-500/5 rounded-full blur-3xl pointer-events-none"}),a.jsx("div",{className:"relative w-full max-w-md animate-in fade-in slide-in-from-bottom-4 duration-500",children:a.jsxs("div",{className:"bg-slate-900/80 backdrop-blur-xl border border-slate-800 rounded-[2rem] p-10 shadow-2xl",children:[a.jsxs("div",{className:"flex flex-col items-center mb-10",children:[a.jsx("div",{className:"w-16 h-16 bg-gradient-to-br from-cyan-400 to-blue-600 rounded-2xl flex items-center justify-center shadow-lg shadow-cyan-500/20 mb-4",children:a.jsx(nv,{className:"text-white",size:32})}),a.jsx("h1",{className:"text-2xl font-black text-white tracking-tighter",children:"ALEMÃO"}),a.jsx("p",{className:"text-[11px] text-cyan-500 font-black uppercase tracking-widest mt-1",children:"Admin Cloud v2"})]}),t&&a.jsx("div",{className:`flex items-center justify-center gap-1.5 text-[11px] font-medium mb-4 px-3 py-1.5 rounded-full border w-fit mx-auto transition-all
${u?"text-purple-400 border-purple-500/30 bg-purple-500/10":"text-cyan-400 border-cyan-500/30 bg-cyan-500/10"}`,children:u?a.jsxs(a.Fragment,{children:[a.jsx(et,{size:11})," Acesso de funcionário"]}):a.jsxs(a.Fragment,{children:[a.jsx(ws,{size:11})," Acesso administrativo"]})}),a.jsxs("form",{onSubmit:d,className:"space-y-5",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-[10px] font-black uppercase tracking-widest text-slate-500 mb-2",children:u?"E-mail":"Usuário ou e-mail"}),a.jsx("input",{required:!0,type:"text",value:t,onChange:f=>n(f.target.value),placeholder:"admin ou seu@email.com",autoComplete:"username",className:"w-full bg-slate-800/50 border border-slate-700 rounded-xl px-4 py-3 text-white placeholder:text-slate-600 focus:ring-1 ring-cyan-500 outline-none transition-all"}),a.jsx("p",{className:"text-[10px] text-slate-600 mt-1 pl-1",children:"Admin: use seu nome de usuário  ·  Funcionário: use seu e-mail"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-[10px] font-black uppercase tracking-widest text-slate-500 mb-2",children:"Senha"}),a.jsx("input",{required:!0,type:"password",value:r,onChange:f=>s(f.target.value),placeholder:"••••••••",autoComplete:"current-password",className:"w-full bg-slate-800/50 border border-slate-700 rounded-xl px-4 py-3 text-white placeholder:text-slate-600 focus:ring-1 ring-cyan-500 outline-none transition-all"})]}),l&&a.jsxs("div",{className:"flex items-center gap-2 p-4 bg-rose-500/10 border border-rose-500/20 rounded-xl text-rose-400 text-sm font-medium animate-in fade-in slide-in-from-top-2",children:[a.jsx(Ar,{size:16,className:"shrink-0"}),l]}),a.jsxs("button",{type:"submit",disabled:i,className:"w-full bg-cyan-500 hover:bg-cyan-400 disabled:opacity-50 text-slate-950 font-black py-4 rounded-2xl flex items-center justify-center gap-2 transition-all shadow-lg shadow-cyan-500/20 uppercase tracking-widest text-xs mt-2 active:scale-95",children:[a.jsx(wI,{size:18}),i?"Entrando...":"Entrar"]})]})]})})]})}const db=[{value:"",label:"Todos",color:"text-slate-400",bg:"bg-slate-800"},{value:"pending",label:"Pendente",color:"text-yellow-400",bg:"bg-yellow-400/10"},{value:"paid",label:"Pago",color:"text-emerald-400",bg:"bg-emerald-400/10"},{value:"canceled",label:"Cancelado",color:"text-rose-400",bg:"bg-rose-400/10"},{value:"expired",label:"Expirado",color:"text-slate-500",bg:"bg-slate-700/40"}];function rve({status:e}){const t=db.find(r=>r.value===e)??db[0],n={pending:a.jsx(hn,{size:12}),paid:a.jsx(nn,{size:12}),canceled:a.jsx(Ai,{size:12}),expired:a.jsx(Ar,{size:12})};return a.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-1 rounded-lg text-[10px] font-black uppercase tracking-widest ${t.color} ${t.bg}`,children:[n[e]??null,t.label]})}function ave(){const[e,t]=b.useState([]),[n,r]=b.useState(!0),[s,i]=b.useState(""),[o,l]=b.useState(""),[c,u]=b.useState(""),d=async()=>{r(!0);try{const p={};s&&(p.status=s),o&&(p.from=o),c&&(p.to=c);const h=await gfe.list(p);t(h)}catch(p){console.error(p)}finally{r(!1)}};b.useEffect(()=>{d()},[s,o,c]);const f=e.reduce((p,h)=>(p[h.status]=(p[h.status]||0)+1,h.status==="paid"&&(p.revenue+=parseFloat(h.total_amount||0)),p),{pending:0,paid:0,canceled:0,expired:0,revenue:0});return a.jsxs("div",{className:"space-y-8 animate-in fade-in slide-in-from-bottom-4 duration-500",children:[a.jsxs("header",{className:"flex justify-between items-start",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-3xl font-bold text-white",children:"Pedidos & Pagamentos"}),a.jsx("p",{className:"text-slate-400 mt-1",children:"Histórico de transações e status de pagamentos."})]}),a.jsx("button",{onClick:d,className:"p-3 bg-slate-800 hover:bg-slate-700 text-slate-300 rounded-xl transition-all border border-slate-700 active:rotate-180 duration-500",children:a.jsx(ke,{size:20})})]}),a.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[{label:"Receita (pago)",value:`R$ ${f.revenue.toFixed(2)}`,color:"emerald"},{label:"Pendentes",value:f.pending,color:"yellow"},{label:"Cancelados",value:f.canceled,color:"rose"},{label:"Expirados",value:f.expired,color:"slate"}].map(p=>a.jsxs("div",{className:"bg-slate-900/40 border border-slate-800 rounded-2xl p-5",children:[a.jsx("p",{className:"text-slate-500 text-[10px] font-bold uppercase tracking-widest mb-1",children:p.label}),a.jsx("p",{className:`text-2xl font-black tabular-nums text-${p.color}-400`,children:p.value})]},p.label))}),a.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[a.jsx("div",{className:"flex gap-2 flex-wrap",children:db.map(p=>a.jsx("button",{onClick:()=>i(p.value),className:`px-4 py-2 rounded-xl text-xs font-bold uppercase tracking-wide transition-all border ${s===p.value?`${p.color} ${p.bg} border-current`:"text-slate-500 bg-slate-900 border-slate-800 hover:border-slate-700"}`,children:p.label},p.value))}),a.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[a.jsx("input",{type:"date",value:o,onChange:p=>l(p.target.value),className:"bg-slate-900 border border-slate-800 text-slate-300 text-xs rounded-xl px-3 py-2 focus:outline-none focus:border-cyan-500"}),a.jsx("span",{className:"text-slate-600",children:"→"}),a.jsx("input",{type:"date",value:c,onChange:p=>u(p.target.value),className:"bg-slate-900 border border-slate-800 text-slate-300 text-xs rounded-xl px-3 py-2 focus:outline-none focus:border-cyan-500"})]})]}),a.jsx("div",{className:"bg-slate-900/50 border border-slate-800 rounded-3xl overflow-hidden",children:a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-left",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"bg-slate-800/30 text-slate-500 text-[10px] uppercase tracking-widest font-bold",children:[a.jsx("th",{className:"px-6 py-4",children:"Referência"}),a.jsx("th",{className:"px-6 py-4",children:"Status"}),a.jsx("th",{className:"px-6 py-4",children:"Cliente"}),a.jsx("th",{className:"px-6 py-4",children:"Tickets"}),a.jsx("th",{className:"px-6 py-4",children:"Valor"}),a.jsx("th",{className:"px-6 py-4",children:"Pagamento"}),a.jsx("th",{className:"px-6 py-4",children:"Data"})]})}),a.jsx("tbody",{className:"divide-y divide-slate-800",children:n?[1,2,3,4].map(p=>a.jsx("tr",{className:"animate-pulse",children:a.jsx("td",{colSpan:7,className:"px-6 py-5 bg-slate-800/10"})},p)):e.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:7,className:"px-6 py-20 text-center text-slate-500",children:a.jsxs("div",{className:"flex flex-col items-center gap-3",children:[a.jsx(JP,{size:40,className:"text-slate-800"}),a.jsx("p",{children:"Nenhum pedido encontrado."})]})})}):e.map(p=>a.jsxs("tr",{className:"hover:bg-slate-800/20 transition-colors",children:[a.jsx("td",{className:"px-6 py-4",title:`ID completo: ${p.id}`,children:a.jsxs("span",{className:"font-mono text-sm font-black text-white tracking-widest",children:["#",p.id.slice(-6).toUpperCase()]})}),a.jsx("td",{className:"px-6 py-4",children:a.jsx(rve,{status:p.status})}),a.jsxs("td",{className:"px-6 py-4",children:[a.jsx("div",{className:"text-sm font-bold text-white",children:p.user_nome||"—"}),a.jsx("div",{className:"text-[10px] text-slate-500 font-mono",children:p.user_cpf})]}),a.jsx("td",{className:"px-6 py-4 text-sm text-slate-300 tabular-nums font-bold",children:p.ticket_count??0}),a.jsxs("td",{className:"px-6 py-4 text-sm font-black text-emerald-400 tabular-nums",children:["R$ ",parseFloat(p.total_amount||0).toFixed(2)]}),a.jsx("td",{className:"px-6 py-4",children:a.jsx("span",{className:"text-[10px] text-slate-500 uppercase tracking-widest font-bold",children:p.payment_method||"PIX"})}),a.jsx("td",{className:"px-6 py-4 text-[11px] text-slate-500 font-medium whitespace-nowrap tabular-nums",children:new Date(p.created_at).toLocaleString("pt-BR")})]},p.id))})]})})})]})}const KC=[{key:"pending",label:"Pendente",color:"text-yellow-400",border:"border-yellow-500/20",badge:"bg-yellow-400/10 text-yellow-400"},{key:"approved",label:"Aprovado",color:"text-cyan-400",border:"border-cyan-500/20",badge:"bg-cyan-400/10 text-cyan-400"},{key:"delivered",label:"Entregue",color:"text-emerald-400",border:"border-emerald-500/20",badge:"bg-emerald-400/10 text-emerald-400"}];function sve({claim:e,onDragStart:t}){return a.jsxs("div",{draggable:!0,onDragStart:n=>t(n,e.id),className:"bg-slate-900 border border-slate-800 rounded-2xl p-4 cursor-grab active:cursor-grabbing hover:border-slate-700 transition-all select-none",children:[a.jsxs("div",{className:"flex items-start justify-between gap-2 mb-3",children:[a.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[a.jsx(ym,{size:14,className:"text-yellow-400 shrink-0"}),a.jsx("span",{className:"text-xs font-black text-white truncate",children:e.raffle_titulo})]}),a.jsxs("span",{className:"text-[10px] font-bold text-slate-500 tabular-nums shrink-0",children:["#",e.ticket_numero]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-slate-400",children:[a.jsx(ks,{size:11,className:"shrink-0"}),a.jsx("span",{className:"truncate",children:e.user_nome||"—"})]}),e.user_telefone&&a.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-slate-500",children:[a.jsx(wu,{size:11,className:"shrink-0"}),a.jsx("span",{className:"font-mono",children:e.user_telefone})]}),e.delivery_address&&a.jsxs("div",{className:"flex items-start gap-1.5 text-xs text-slate-500",children:[a.jsx(bs,{size:11,className:"shrink-0 mt-0.5"}),a.jsx("span",{className:"line-clamp-2",children:e.delivery_address})]})]}),a.jsx("div",{className:"mt-3 pt-3 border-t border-slate-800 text-[10px] text-slate-600 tabular-nums",children:new Date(e.claimed_at).toLocaleString("pt-BR")})]})}function ive({col:e,claims:t,onDragStart:n,onDrop:r,onDragOver:s}){const[i,o]=b.useState(!1);return a.jsxs("div",{onDragOver:l=>{s(l),o(!0)},onDragLeave:()=>o(!1),onDrop:l=>{r(l,e.key),o(!1)},className:`flex-1 min-w-[260px] bg-slate-950/60 border rounded-3xl p-5 transition-all ${i?`${e.border} shadow-lg`:"border-slate-900"}`,children:[a.jsxs("div",{className:"flex items-center justify-between mb-5",children:[a.jsx("h3",{className:`text-sm font-black uppercase tracking-widest ${e.color}`,children:e.label}),a.jsx("span",{className:`text-[10px] font-black px-2 py-1 rounded-lg ${e.badge}`,children:t.length})]}),a.jsx("div",{className:"space-y-3 min-h-[80px]",children:t.length===0?a.jsx("div",{className:"flex items-center justify-center h-20 text-slate-700 text-xs italic border border-dashed border-slate-800 rounded-xl",children:"Arraste para cá"}):t.map(l=>a.jsx(sve,{claim:l,onDragStart:n},l.id))})]})}function ove(){const[e,t]=b.useState([]),[n,r]=b.useState(!0),s=b.useRef(null),i=async()=>{r(!0);try{const d=await d4.list();t(d)}catch(d){console.error(d)}finally{r(!1)}};b.useEffect(()=>{i()},[]);const o=(d,f)=>{s.current=f,d.dataTransfer.effectAllowed="move"},l=d=>{d.preventDefault(),d.dataTransfer.dropEffect="move"},c=async(d,f)=>{d.preventDefault();const p=s.current;if(p===null)return;const h=e.find(m=>m.id===p);if(!(!h||h.status===f)){t(m=>m.map(v=>v.id===p?{...v,status:f}:v));try{await d4.updateStatus(p,f)}catch{t(m=>m.map(v=>v.id===p?{...v,status:h.status}:v)),alert("Erro ao atualizar status. Tente novamente.")}s.current=null}},u=d=>e.filter(f=>f.status===d);return a.jsxs("div",{className:"space-y-8 animate-in fade-in slide-in-from-bottom-4 duration-500",children:[a.jsxs("header",{className:"flex justify-between items-start",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-3xl font-bold text-white",children:"Resgates de Prêmios"}),a.jsx("p",{className:"text-slate-400 mt-1",children:"Gerencie os resgates dos ganhadores. Arraste os cards entre colunas para atualizar o status."})]}),a.jsx("button",{onClick:i,className:"p-3 bg-slate-800 hover:bg-slate-700 text-slate-300 rounded-xl transition-all border border-slate-700 active:rotate-180 duration-500",children:a.jsx(ke,{size:20})})]}),n?a.jsx("div",{className:"flex gap-6",children:KC.map(d=>a.jsxs("div",{className:"flex-1 min-w-[260px] bg-slate-950/60 border border-slate-900 rounded-3xl p-5 animate-pulse",children:[a.jsx("div",{className:"h-4 bg-slate-800 rounded w-24 mb-5"}),[1,2].map(f=>a.jsx("div",{className:"h-32 bg-slate-800/40 rounded-2xl mb-3"},f))]},d.key))}):a.jsx("div",{className:"flex gap-6 overflow-x-auto pb-4",children:KC.map(d=>a.jsx(ive,{col:d,claims:u(d.key),onDragStart:o,onDrop:c,onDragOver:l},d.key))})]})}const d8={active:"Ativo",suspended:"Suspenso",canceled:"Cancelado",pending_payment:"Aguard. Pgto"},lve={active:"bg-emerald-500/10 text-emerald-400 border-emerald-500/20",suspended:"bg-amber-500/10 text-amber-400 border-amber-500/20",canceled:"bg-rose-500/10 text-rose-400 border-rose-500/20",pending_payment:"bg-slate-500/10 text-slate-400 border-slate-500/20"};function cve({status:e}){return a.jsx("span",{className:`text-[10px] font-bold px-2 py-0.5 rounded border ${lve[e]||"bg-slate-700 text-slate-400"}`,children:d8[e]||e})}function GC(e){return`R$ ${Number(e).toFixed(2).replace(".",",")}`}function XC(e){return e?new Date(e).toLocaleDateString("pt-BR"):"—"}function uve(e){return e.replace(/(\d{3})(\d{3})(\d{3})(\d{2})/,"$1.$2.$3-$4")}function dve({clubId:e,partner:t,onClose:n,onSaved:r}){const[s,i]=b.useState({name:(t==null?void 0:t.name)||"",specialty:(t==null?void 0:t.specialty)||"",phone:(t==null?void 0:t.phone)||"",address:(t==null?void 0:t.address)||"",discount_percent:(t==null?void 0:t.discount_percent)??0,notes:(t==null?void 0:t.notes)||"",active:(t==null?void 0:t.active)??!0}),[o,l]=b.useState(!1);async function c(u){u.preventDefault(),l(!0);try{t?await Ut.updatePartner(t.id,s):await Ut.createPartner({...s,club_id:e}),r(),n()}catch{alert("Erro ao salvar parceiro")}finally{l(!1)}}return a.jsx("div",{className:"fixed inset-0 bg-black/70 backdrop-blur-sm z-50 flex items-center justify-center p-4",children:a.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-3xl w-full max-w-md",children:[a.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-slate-800",children:[a.jsx("h3",{className:"text-lg font-black text-white",children:t?"Editar Parceiro":"Novo Parceiro"}),a.jsx("button",{onClick:n,className:"text-slate-500 hover:text-white transition-colors",children:a.jsx(Ce,{size:20})})]}),a.jsxs("form",{onSubmit:c,className:"p-6 space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-bold text-slate-400 uppercase tracking-wider",children:"Nome *"}),a.jsx("input",{required:!0,value:s.name,onChange:u=>i(d=>({...d,name:u.target.value})),className:"mt-1 w-full bg-slate-800 border border-slate-700 rounded-xl px-3 py-2 text-sm text-white focus:outline-none focus:border-cyan-500"})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-bold text-slate-400 uppercase tracking-wider",children:"Especialidade"}),a.jsx("input",{value:s.specialty,onChange:u=>i(d=>({...d,specialty:u.target.value})),className:"mt-1 w-full bg-slate-800 border border-slate-700 rounded-xl px-3 py-2 text-sm text-white focus:outline-none focus:border-cyan-500"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-bold text-slate-400 uppercase tracking-wider",children:"Desconto %"}),a.jsx("input",{type:"number",min:0,max:100,value:s.discount_percent,onChange:u=>i(d=>({...d,discount_percent:Number(u.target.value)})),className:"mt-1 w-full bg-slate-800 border border-slate-700 rounded-xl px-3 py-2 text-sm text-white focus:outline-none focus:border-cyan-500"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-bold text-slate-400 uppercase tracking-wider",children:"Telefone"}),a.jsx("input",{value:s.phone,onChange:u=>i(d=>({...d,phone:u.target.value})),className:"mt-1 w-full bg-slate-800 border border-slate-700 rounded-xl px-3 py-2 text-sm text-white focus:outline-none focus:border-cyan-500"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-bold text-slate-400 uppercase tracking-wider",children:"Endereço"}),a.jsx("input",{value:s.address,onChange:u=>i(d=>({...d,address:u.target.value})),className:"mt-1 w-full bg-slate-800 border border-slate-700 rounded-xl px-3 py-2 text-sm text-white focus:outline-none focus:border-cyan-500"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-bold text-slate-400 uppercase tracking-wider",children:"Observações"}),a.jsx("textarea",{value:s.notes,rows:2,onChange:u=>i(d=>({...d,notes:u.target.value})),className:"mt-1 w-full bg-slate-800 border border-slate-700 rounded-xl px-3 py-2 text-sm text-white focus:outline-none focus:border-cyan-500 resize-none"})]}),t&&a.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:s.active,onChange:u=>i(d=>({...d,active:u.target.checked})),className:"accent-cyan-500"}),a.jsx("span",{className:"text-sm text-slate-300",children:"Parceiro ativo"})]}),a.jsxs("div",{className:"flex gap-3 pt-2",children:[a.jsx("button",{type:"button",onClick:n,className:"flex-1 py-2.5 rounded-xl border border-slate-700 text-slate-400 hover:text-white text-sm font-bold transition-colors",children:"Cancelar"}),a.jsx("button",{type:"submit",disabled:o,className:"flex-1 py-2.5 rounded-xl bg-cyan-500 hover:bg-cyan-400 text-black text-sm font-black transition-colors disabled:opacity-50",children:o?"Salvando…":"Salvar"})]})]})]})})}function fve({clubId:e,plan:t,onClose:n,onSaved:r}){const[s,i]=b.useState({name:(t==null?void 0:t.name)||"",description:(t==null?void 0:t.description)||"",price_monthly:(t==null?void 0:t.price_monthly)??0,max_dependents:(t==null?void 0:t.max_dependents)??0,features:t!=null&&t.features?[...t.features]:[""],active:(t==null?void 0:t.active)??!0}),[o,l]=b.useState(!1);function c(){i(p=>({...p,features:[...p.features,""]}))}function u(p){i(h=>({...h,features:h.features.filter((m,v)=>v!==p)}))}function d(p,h){i(m=>{const v=[...m.features];return v[p]=h,{...m,features:v}})}async function f(p){p.preventDefault(),l(!0);try{const h={...s,club_id:e,features:s.features.filter(m=>m.trim())};t?await Ut.updatePlan(t.id,h):await Ut.createPlan(h),r(),n()}catch{alert("Erro ao salvar plano")}finally{l(!1)}}return a.jsx("div",{className:"fixed inset-0 bg-black/70 backdrop-blur-sm z-50 flex items-center justify-center p-4",children:a.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-3xl w-full max-w-lg max-h-[90vh] overflow-y-auto",children:[a.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-slate-800 sticky top-0 bg-slate-900 z-10",children:[a.jsx("h3",{className:"text-lg font-black text-white",children:t?"Editar Plano":"Novo Plano"}),a.jsx("button",{onClick:n,className:"text-slate-500 hover:text-white transition-colors",children:a.jsx(Ce,{size:20})})]}),a.jsxs("form",{onSubmit:f,className:"p-6 space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{className:"col-span-2",children:[a.jsx("label",{className:"text-xs font-bold text-slate-400 uppercase tracking-wider",children:"Nome do Plano *"}),a.jsx("input",{required:!0,value:s.name,onChange:p=>i(h=>({...h,name:p.target.value})),placeholder:"Ex: Pessoal, Família...",className:"mt-1 w-full bg-slate-800 border border-slate-700 rounded-xl px-3 py-2 text-sm text-white focus:outline-none focus:border-cyan-500"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-bold text-slate-400 uppercase tracking-wider",children:"Preço Mensal (R$) *"}),a.jsx("input",{required:!0,type:"number",min:0,step:"0.01",value:s.price_monthly,onChange:p=>i(h=>({...h,price_monthly:Number(p.target.value)})),className:"mt-1 w-full bg-slate-800 border border-slate-700 rounded-xl px-3 py-2 text-sm text-white focus:outline-none focus:border-cyan-500"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-bold text-slate-400 uppercase tracking-wider",children:"Máx. Dependentes"}),a.jsx("input",{type:"number",min:0,value:s.max_dependents,onChange:p=>i(h=>({...h,max_dependents:Number(p.target.value)})),className:"mt-1 w-full bg-slate-800 border border-slate-700 rounded-xl px-3 py-2 text-sm text-white focus:outline-none focus:border-cyan-500"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-bold text-slate-400 uppercase tracking-wider",children:"Descrição"}),a.jsx("input",{value:s.description,onChange:p=>i(h=>({...h,description:p.target.value})),placeholder:"Breve descrição do plano...",className:"mt-1 w-full bg-slate-800 border border-slate-700 rounded-xl px-3 py-2 text-sm text-white focus:outline-none focus:border-cyan-500"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("label",{className:"text-xs font-bold text-slate-400 uppercase tracking-wider",children:"Benefícios incluídos"}),a.jsxs("button",{type:"button",onClick:c,className:"text-xs font-black text-cyan-400 hover:text-cyan-300 flex items-center gap-1",children:[a.jsx(Oe,{size:12})," Adicionar"]})]}),a.jsx("div",{className:"space-y-2",children:s.features.map((p,h)=>a.jsxs("div",{className:"flex gap-2 items-center",children:[a.jsx(hI,{size:14,className:"text-slate-600 shrink-0"}),a.jsx("input",{value:p,onChange:m=>d(h,m.target.value),placeholder:`Benefício ${h+1}`,className:"flex-1 bg-slate-800 border border-slate-700 rounded-xl px-3 py-2 text-sm text-white focus:outline-none focus:border-cyan-500"}),a.jsx("button",{type:"button",onClick:()=>u(h),className:"p-1.5 rounded-lg hover:bg-rose-500/10 text-slate-500 hover:text-rose-400 transition-colors",children:a.jsx(Ce,{size:14})})]},h))})]}),t&&a.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:s.active,onChange:p=>i(h=>({...h,active:p.target.checked})),className:"accent-cyan-500"}),a.jsx("span",{className:"text-sm text-slate-300",children:"Plano ativo"})]}),a.jsxs("div",{className:"flex gap-3 pt-2",children:[a.jsx("button",{type:"button",onClick:n,className:"flex-1 py-2.5 rounded-xl border border-slate-700 text-slate-400 hover:text-white text-sm font-bold transition-colors",children:"Cancelar"}),a.jsx("button",{type:"submit",disabled:o,className:"flex-1 py-2.5 rounded-xl bg-cyan-500 hover:bg-cyan-400 text-black text-sm font-black transition-colors disabled:opacity-50",children:o?"Salvando…":"Salvar"})]})]})]})})}function pve({clubId:e,faq:t,onClose:n,onSaved:r}){const[s,i]=b.useState({question:(t==null?void 0:t.question)||"",answer:(t==null?void 0:t.answer)||"",sort_order:(t==null?void 0:t.sort_order)??0,active:(t==null?void 0:t.active)??!0}),[o,l]=b.useState(!1);async function c(u){u.preventDefault(),l(!0);try{t?await Ut.updateFaq(t.id,s):await Ut.createFaq({...s,club_id:e}),r(),n()}catch{alert("Erro ao salvar FAQ")}finally{l(!1)}}return a.jsx("div",{className:"fixed inset-0 bg-black/70 backdrop-blur-sm z-50 flex items-center justify-center p-4",children:a.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-3xl w-full max-w-lg",children:[a.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-slate-800",children:[a.jsx("h3",{className:"text-lg font-black text-white",children:t?"Editar FAQ":"Nova FAQ"}),a.jsx("button",{onClick:n,className:"text-slate-500 hover:text-white transition-colors",children:a.jsx(Ce,{size:20})})]}),a.jsxs("form",{onSubmit:c,className:"p-6 space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-bold text-slate-400 uppercase tracking-wider",children:"Pergunta *"}),a.jsx("input",{required:!0,value:s.question,onChange:u=>i(d=>({...d,question:u.target.value})),placeholder:"Ex: Como funciona o pagamento?",className:"mt-1 w-full bg-slate-800 border border-slate-700 rounded-xl px-3 py-2 text-sm text-white focus:outline-none focus:border-cyan-500"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-bold text-slate-400 uppercase tracking-wider",children:"Resposta *"}),a.jsx("textarea",{required:!0,value:s.answer,rows:4,onChange:u=>i(d=>({...d,answer:u.target.value})),placeholder:"Resposta detalhada...",className:"mt-1 w-full bg-slate-800 border border-slate-700 rounded-xl px-3 py-2 text-sm text-white focus:outline-none focus:border-cyan-500 resize-none"})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-bold text-slate-400 uppercase tracking-wider",children:"Ordem"}),a.jsx("input",{type:"number",min:0,value:s.sort_order,onChange:u=>i(d=>({...d,sort_order:Number(u.target.value)})),className:"mt-1 w-full bg-slate-800 border border-slate-700 rounded-xl px-3 py-2 text-sm text-white focus:outline-none focus:border-cyan-500"})]}),a.jsx("div",{className:"flex items-end pb-2",children:a.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:s.active,onChange:u=>i(d=>({...d,active:u.target.checked})),className:"accent-cyan-500"}),a.jsx("span",{className:"text-sm text-slate-300",children:"Ativo"})]})})]}),a.jsxs("div",{className:"flex gap-3 pt-2",children:[a.jsx("button",{type:"button",onClick:n,className:"flex-1 py-2.5 rounded-xl border border-slate-700 text-slate-400 hover:text-white text-sm font-bold transition-colors",children:"Cancelar"}),a.jsx("button",{type:"submit",disabled:o,className:"flex-1 py-2.5 rounded-xl bg-cyan-500 hover:bg-cyan-400 text-black text-sm font-black transition-colors disabled:opacity-50",children:o?"Salvando…":"Salvar"})]})]})]})})}function hve({member:e,onChanged:t}){const[n,r]=b.useState(!1),[s,i]=b.useState(!1);async function o(l){r(!1),i(!0);try{await Ut.updateMemberStatus(e.id,l),t()}catch{alert("Erro ao atualizar status")}finally{i(!1)}}return a.jsxs("div",{className:"relative",children:[a.jsxs("button",{disabled:s,onClick:()=>r(l=>!l),className:"text-xs font-bold px-3 py-1.5 rounded-lg bg-slate-800 hover:bg-slate-700 text-slate-300 flex items-center gap-1 transition-colors disabled:opacity-50",children:["Ações ",a.jsx(aa,{size:12})]}),n&&a.jsxs("div",{className:"absolute right-0 top-full mt-1 bg-slate-800 border border-slate-700 rounded-xl shadow-xl z-10 min-w-[160px] overflow-hidden",children:[e.status!=="active"&&a.jsxs("button",{onClick:()=>o("active"),className:"w-full text-left px-4 py-2.5 text-sm text-emerald-400 hover:bg-slate-700 flex items-center gap-2",children:[a.jsx(Ts,{size:14})," Ativar"]}),e.status==="active"&&a.jsxs("button",{onClick:()=>o("suspended"),className:"w-full text-left px-4 py-2.5 text-sm text-amber-400 hover:bg-slate-700 flex items-center gap-2",children:[a.jsx(IP,{size:14})," Suspender"]}),e.status!=="canceled"&&a.jsxs("button",{onClick:()=>{confirm("Cancelar assinatura deste membro?")&&o("canceled")},className:"w-full text-left px-4 py-2.5 text-sm text-rose-400 hover:bg-slate-700 flex items-center gap-2",children:[a.jsx(Ai,{size:14})," Cancelar"]})]})]})}const mve=[{id:"members",label:"Membros",icon:et},{id:"partners",label:"Parceiros",icon:Xo},{id:"plans",label:"Planos & Preços",icon:xm},{id:"content",label:"Condições & Regras",icon:Hr},{id:"faq",label:"FAQ / Sanfona",icon:Ol}];function f8({clubId:e,clubName:t,clubSlug:n,accentColor:r}){const[s,i]=b.useState([]),[o,l]=b.useState([]),[c,u]=b.useState([]),[d,f]=b.useState([]),[p,h]=b.useState({conditions:"",rules:""}),[m,v]=b.useState(!1),[x,y]=b.useState(""),[g,j]=b.useState(""),[N,w]=b.useState("members"),[S,k]=b.useState(null),[C,_]=b.useState(null),[A,E]=b.useState(null),[P,D]=b.useState(!0),I=r,R=b.useCallback(async()=>{D(!0);try{const F=await Ut.listMembers(e,{status:g||void 0,limit:200});i(F||[])}catch{i([])}finally{D(!1)}},[e,g]),M=b.useCallback(async()=>{try{const F=await Ut.listPartners(e);l(F||[])}catch{l([])}},[e]),W=b.useCallback(async()=>{try{const F=await Ut.listPlans(e);u(F||[])}catch{u([])}},[e]),T=b.useCallback(async()=>{try{const F=await Ut.listFaqs(e);f(F||[])}catch{f([])}},[e]);b.useEffect(()=>{R()},[R]),b.useEffect(()=>{M()},[M]),b.useEffect(()=>{W()},[W]),b.useEffect(()=>{T()},[T]),b.useEffect(()=>{n&&fetch(`/api/clubs/${n}`).then(F=>F.json()).then(F=>{h({conditions:F.conditions||"",rules:F.rules||""})}).catch(()=>{})},[n]);const V=s.filter(F=>F.status==="active").length,X=s.filter(F=>F.status==="suspended").length,U=s.filter(F=>F.status==="pending_payment").length,L=s.filter(F=>F.status==="active").reduce((F,z)=>F+Number(z.price_monthly),0),B=(()=>{const F=new Date;return Array.from({length:6},(z,q)=>{const ie=new Date(F.getFullYear(),F.getMonth()-(5-q),1),oe=ie.toLocaleDateString("pt-BR",{month:"short",year:"2-digit"}),we=s.filter(Ee=>new Date(Ee.started_at)<=new Date(ie.getFullYear(),ie.getMonth()+1,0)).length;return{label:oe,count:we}})})(),ae=g?s.filter(F=>F.status===g):s;async function se(F){confirm("Desativar este parceiro?")&&(await Ut.deletePartner(F),M())}async function xe(F){var z,q;if(confirm("Excluir este plano?"))try{await Ut.deletePlan(F),W()}catch(ie){alert(((q=(z=ie.response)==null?void 0:z.data)==null?void 0:q.error)||"Erro ao excluir plano")}}async function H(F){confirm("Excluir esta FAQ?")&&(await Ut.deleteFaq(F),T())}async function le(F){F.preventDefault(),v(!0),y("");try{await Ut.saveContent(e,p),y("Salvo com sucesso!"),setTimeout(()=>y(""),3e3)}catch{y("Erro ao salvar.")}finally{v(!1)}}async function Z(F,z){const q=d.indexOf(F),ie=z==="up"?q-1:q+1;if(ie<0||ie>=d.length)return;const oe=d[ie];await Promise.all([Ut.updateFaq(F.id,{...F,sort_order:oe.sort_order}),Ut.updateFaq(oe.id,{...oe,sort_order:F.sort_order})]),T()}return a.jsxs("div",{className:"space-y-10 animate-in fade-in slide-in-from-bottom-4 duration-700",children:[a.jsxs("header",{children:[a.jsx("h2",{className:"text-4xl font-black text-white tracking-tighter",children:t}),a.jsx("p",{className:"text-slate-400 mt-1",children:"Gestão de membros, planos, parceiros e conteúdo."})]}),a.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:[{label:"Membros Ativos",value:V,icon:et,color:"emerald"},{label:"MRR",value:GC(L),icon:xm,color:I},{label:"Inadimplentes",value:X,icon:Kt,color:"amber"},{label:"Aguard. Pgto",value:U,icon:IP,color:"slate"}].map(({label:F,value:z,icon:q,color:ie})=>a.jsxs("div",{className:"bg-slate-900/40 border border-slate-800 rounded-3xl p-6 hover:border-slate-700 transition-all",children:[a.jsx("div",{className:`p-3 rounded-2xl bg-slate-800 border border-white/5 text-${ie}-400 w-fit mb-4`,children:a.jsx(q,{size:22})}),a.jsx("p",{className:"text-slate-500 text-xs font-bold uppercase tracking-widest mb-1",children:F}),a.jsx("h3",{className:"text-3xl font-black text-white tabular-nums tracking-tighter",children:z})]},F))}),a.jsxs("div",{className:"bg-slate-900/40 border border-slate-800 rounded-3xl p-8",children:[a.jsx("h3",{className:"text-base font-black text-white uppercase tracking-wider mb-6",children:"Evolução de Membros (6 meses)"}),a.jsx("div",{className:"h-48",children:a.jsx(Do,{width:"100%",height:"100%",children:a.jsxs(GT,{data:B,children:[a.jsx("defs",{children:a.jsxs("linearGradient",{id:"gradClub",x1:"0",y1:"0",x2:"0",y2:"1",children:[a.jsx("stop",{offset:"5%",stopColor:"#06b6d4",stopOpacity:.3}),a.jsx("stop",{offset:"95%",stopColor:"#06b6d4",stopOpacity:0})]})}),a.jsx(xl,{strokeDasharray:"3 3",stroke:"rgba(255,255,255,0.05)"}),a.jsx(ia,{dataKey:"label",stroke:"#475569",tick:{fontSize:11}}),a.jsx(oa,{stroke:"#475569",tick:{fontSize:11},allowDecimals:!1}),a.jsx(on,{contentStyle:{background:"#0f172a",border:"1px solid rgba(255,255,255,0.08)",borderRadius:"12px",color:"#f1f5f9",fontSize:"12px"},formatter:F=>[F,"Membros"]}),a.jsx(za,{type:"monotone",dataKey:"count",stroke:"#06b6d4",strokeWidth:2,fill:"url(#gradClub)"})]})})})]}),a.jsx("div",{className:"flex gap-1 border-b border-slate-800 overflow-x-auto",children:mve.map(({id:F,label:z,icon:q})=>a.jsxs("button",{onClick:()=>w(F),className:`flex items-center gap-2 px-4 py-3 text-xs font-black uppercase tracking-wider border-b-2 whitespace-nowrap transition-all ${N===F?"border-cyan-400 text-cyan-400":"border-transparent text-slate-500 hover:text-slate-300"}`,children:[a.jsx(q,{size:14})," ",z]},F))}),N==="members"&&a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{className:"flex gap-2 flex-wrap",children:["","active","suspended","pending_payment","canceled"].map(F=>a.jsx("button",{onClick:()=>j(F),className:`px-4 py-2 rounded-xl text-xs font-black uppercase tracking-wider border transition-all ${g===F?"bg-cyan-500/10 border-cyan-500/30 text-cyan-400":"border-slate-700 text-slate-500 hover:text-slate-300"}`,children:F?d8[F]:"Todos"},F))}),P?a.jsx("div",{className:"flex justify-center py-16",children:a.jsx("div",{className:"w-8 h-8 border-2 border-cyan-500 border-t-transparent rounded-full animate-spin"})}):a.jsx("div",{className:"bg-slate-900/40 border border-slate-800 rounded-3xl overflow-hidden overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsx("tr",{className:"border-b border-slate-800",children:["Nome","CPF","Plano","Próx. Cobrança","Início","Status",""].map(F=>a.jsx("th",{className:"text-left px-5 py-4 text-[10px] font-black uppercase tracking-widest text-slate-500 whitespace-nowrap",children:F},F))})}),a.jsxs("tbody",{children:[ae.length===0&&a.jsx("tr",{children:a.jsx("td",{colSpan:7,className:"text-center py-12 text-slate-600 italic",children:"Nenhum membro encontrado"})}),ae.map(F=>a.jsxs("tr",{className:"border-b border-slate-800/50 hover:bg-slate-800/30 transition-colors",children:[a.jsx("td",{className:"px-5 py-3.5 font-semibold text-white whitespace-nowrap",children:F.user_nome}),a.jsx("td",{className:"px-5 py-3.5 text-slate-400 font-mono text-xs",children:uve(F.user_cpf)}),a.jsx("td",{className:"px-5 py-3.5 text-slate-300 whitespace-nowrap",children:F.plan_name}),a.jsx("td",{className:"px-5 py-3.5 text-slate-400 whitespace-nowrap",children:XC(F.next_billing_at)}),a.jsx("td",{className:"px-5 py-3.5 text-slate-400 whitespace-nowrap",children:XC(F.started_at)}),a.jsx("td",{className:"px-5 py-3.5",children:a.jsx(cve,{status:F.status})}),a.jsx("td",{className:"px-5 py-3.5",children:a.jsx(hve,{member:F,onChanged:R})})]},F.id))]})]})})]}),N==="partners"&&a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{className:"flex justify-end",children:a.jsxs("button",{onClick:()=>k("new"),className:"flex items-center gap-2 px-5 py-2.5 bg-cyan-500 hover:bg-cyan-400 text-black font-black text-sm rounded-xl transition-colors",children:[a.jsx(Oe,{size:16})," Novo Parceiro"]})}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4",children:[o.length===0&&a.jsx("p",{className:"text-slate-600 italic col-span-3 py-8 text-center",children:"Nenhum parceiro cadastrado"}),o.map(F=>a.jsxs("div",{className:"bg-slate-900/40 border border-slate-800 rounded-2xl p-5 hover:border-slate-700 transition-all",children:[a.jsxs("div",{className:"flex items-start justify-between gap-2 mb-2",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-black text-white",children:F.name}),F.specialty&&a.jsx("p",{className:"text-xs text-slate-400 mt-0.5",children:F.specialty})]}),a.jsxs("div",{className:"flex gap-1",children:[a.jsx("button",{onClick:()=>k(F),className:"p-1.5 rounded-lg hover:bg-slate-700 text-slate-400 hover:text-white transition-colors",children:a.jsx(Er,{size:14})}),a.jsx("button",{onClick:()=>se(F.id),className:"p-1.5 rounded-lg hover:bg-rose-500/10 text-slate-400 hover:text-rose-400 transition-colors",children:a.jsx(Te,{size:14})})]})]}),F.discount_percent>0&&a.jsxs("span",{className:"text-xs font-black text-cyan-400 bg-cyan-500/10 border border-cyan-500/20 px-2 py-0.5 rounded",children:[F.discount_percent,"% desconto"]}),F.phone&&a.jsx("p",{className:"text-xs text-slate-500 mt-2",children:F.phone}),F.address&&a.jsx("p",{className:"text-xs text-slate-500",children:F.address}),F.notes&&a.jsx("p",{className:"text-xs text-slate-600 mt-2 italic",children:F.notes})]},F.id))]})]}),N==="plans"&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("p",{className:"text-slate-400 text-sm",children:"Planos disponíveis para assinatura neste clube."}),a.jsxs("button",{onClick:()=>_("new"),className:"flex items-center gap-2 px-5 py-2.5 bg-cyan-500 hover:bg-cyan-400 text-black font-black text-sm rounded-xl transition-colors",children:[a.jsx(Oe,{size:16})," Novo Plano"]})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4",children:[c.length===0&&a.jsx("p",{className:"text-slate-600 italic col-span-3 py-8 text-center",children:"Nenhum plano cadastrado"}),c.map(F=>{var z;return a.jsxs("div",{className:`relative bg-slate-900/40 border rounded-3xl p-6 hover:border-slate-700 transition-all ${F.active?"border-slate-800":"border-slate-800/40 opacity-60"}`,children:[!F.active&&a.jsx("span",{className:"absolute top-3 right-3 text-[10px] font-black px-2 py-0.5 rounded bg-slate-700 text-slate-400",children:"INATIVO"}),a.jsxs("div",{className:"flex items-start justify-between gap-2 mb-3",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-black text-white text-lg",children:F.name}),F.description&&a.jsx("p",{className:"text-xs text-slate-500 mt-0.5",children:F.description})]}),a.jsxs("div",{className:"flex gap-1 shrink-0",children:[a.jsx("button",{onClick:()=>_(F),className:"p-1.5 rounded-lg hover:bg-slate-700 text-slate-400 hover:text-white transition-colors",children:a.jsx(Er,{size:14})}),a.jsx("button",{onClick:()=>xe(F.id),className:"p-1.5 rounded-lg hover:bg-rose-500/10 text-slate-400 hover:text-rose-400 transition-colors",children:a.jsx(Te,{size:14})})]})]}),a.jsxs("p",{className:"text-3xl font-black text-cyan-400 mb-1",children:[GC(F.price_monthly),a.jsx("span",{className:"text-sm text-slate-500 font-medium",children:"/mês"})]}),F.max_dependents>0&&a.jsxs("p",{className:"text-xs text-slate-500 mb-3",children:["Até ",F.max_dependents," dependente(s)"]}),((z=F.features)==null?void 0:z.length)>0&&a.jsx("ul",{className:"space-y-1.5 mt-3 pt-3 border-t border-slate-800",children:F.features.map((q,ie)=>a.jsxs("li",{className:"flex items-center gap-2 text-xs text-slate-300",children:[a.jsx(Ts,{size:12,className:"text-emerald-400 shrink-0"})," ",q]},ie))})]},F.id)})]})]}),N==="content"&&a.jsxs("form",{onSubmit:le,className:"space-y-6 max-w-3xl",children:[a.jsxs("p",{className:"text-slate-400 text-sm",children:["Defina as condições de adesão e regras de uso específicas para ",a.jsx("strong",{className:"text-white",children:t}),". O conteúdo é exibido na página pública do clube."]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-black text-slate-400 uppercase tracking-wider block mb-2",children:"Condições de Adesão"}),a.jsx("textarea",{rows:8,value:p.conditions,onChange:F=>h(z=>({...z,conditions:F.target.value})),placeholder:"Descreva as condições para adesão ao clube...",className:"w-full bg-slate-900 border border-slate-800 rounded-2xl px-4 py-3 text-sm text-white focus:outline-none focus:border-cyan-500 resize-y"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-black text-slate-400 uppercase tracking-wider block mb-2",children:"Regras de Uso"}),a.jsx("textarea",{rows:8,value:p.rules,onChange:F=>h(z=>({...z,rules:F.target.value})),placeholder:"Descreva as regras de utilização do clube...",className:"w-full bg-slate-900 border border-slate-800 rounded-2xl px-4 py-3 text-sm text-white focus:outline-none focus:border-cyan-500 resize-y"})]}),(p.conditions||p.rules)&&a.jsxs("div",{className:"bg-slate-900/40 border border-slate-800 rounded-2xl p-5 space-y-4",children:[a.jsx("p",{className:"text-xs font-black text-slate-500 uppercase tracking-wider",children:"Pré-visualização"}),p.conditions&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-black text-white mb-1",children:"Condições de Adesão"}),a.jsx("p",{className:"text-slate-400 text-xs whitespace-pre-line",children:p.conditions})]}),p.rules&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-black text-white mb-1",children:"Regras de Uso"}),a.jsx("p",{className:"text-slate-400 text-xs whitespace-pre-line",children:p.rules})]})]}),a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("button",{type:"submit",disabled:m,className:"px-8 py-3 bg-cyan-500 hover:bg-cyan-400 text-black font-black text-sm rounded-xl transition-colors disabled:opacity-50",children:m?"Salvando…":"Salvar Conteúdo"}),x&&a.jsx("p",{className:`text-sm font-bold ${x.includes("sucesso")?"text-emerald-400":"text-rose-400"}`,children:x})]})]}),N==="faq"&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("p",{className:"text-slate-400 text-sm",children:["Perguntas e respostas exibidas na página pública (",d.length," FAQ",d.length!==1?"s":"",")."]}),a.jsxs("button",{onClick:()=>E("new"),className:"flex items-center gap-2 px-5 py-2.5 bg-cyan-500 hover:bg-cyan-400 text-black font-black text-sm rounded-xl transition-colors",children:[a.jsx(Oe,{size:16})," Nova FAQ"]})]}),a.jsxs("div",{className:"space-y-3",children:[d.length===0&&a.jsx("p",{className:"text-slate-600 italic py-8 text-center",children:"Nenhuma FAQ cadastrada"}),d.map((F,z)=>a.jsx("div",{className:`bg-slate-900/40 border rounded-2xl p-5 transition-all ${F.active?"border-slate-800":"border-slate-800/40 opacity-60"}`,children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsxs("div",{className:"flex flex-col gap-1 mt-0.5 shrink-0",children:[a.jsx("button",{onClick:()=>Z(F,"up"),disabled:z===0,className:"text-slate-600 hover:text-slate-300 disabled:opacity-20 transition-colors",children:"▲"}),a.jsx("button",{onClick:()=>Z(F,"down"),disabled:z===d.length-1,className:"text-slate-600 hover:text-slate-300 disabled:opacity-20 transition-colors",children:"▼"})]}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsx("p",{className:"font-bold text-white text-sm",children:F.question}),a.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[F.active?a.jsx(Ss,{size:18,className:"text-emerald-400"}):a.jsx(Ns,{size:18,className:"text-slate-600"}),a.jsx("button",{onClick:()=>E(F),className:"p-1.5 rounded-lg hover:bg-slate-700 text-slate-400 hover:text-white transition-colors",children:a.jsx(Er,{size:14})}),a.jsx("button",{onClick:()=>H(F.id),className:"p-1.5 rounded-lg hover:bg-rose-500/10 text-slate-400 hover:text-rose-400 transition-colors",children:a.jsx(Te,{size:14})})]})]}),a.jsx("p",{className:"text-slate-400 text-xs mt-1 line-clamp-2",children:F.answer}),a.jsxs("p",{className:"text-slate-700 text-[10px] mt-2",children:["Ordem: ",F.sort_order]})]})]})},F.id))]})]}),S!==null&&a.jsx(dve,{clubId:e,partner:S==="new"?null:S,onClose:()=>k(null),onSaved:M}),C!==null&&a.jsx(fve,{clubId:e,plan:C==="new"?null:C,onClose:()=>_(null),onSaved:W}),A!==null&&a.jsx(pve,{clubId:e,faq:A==="new"?null:A,onClose:()=>E(null),onSaved:T})]})}function xve(){return a.jsx(f8,{clubId:1,clubName:"Clube Odonto",clubSlug:"odonto",accentColor:"cyan"})}function gve(){return a.jsx(f8,{clubId:2,clubName:"Clube Médico",clubSlug:"medico",accentColor:"violet"})}const YC=["#06b6d4","#8b5cf6","#10b981","#f59e0b","#ef4444"],Z0={contentStyle:{background:"#0f172a",border:"1px solid rgba(255,255,255,0.08)",borderRadius:"12px",color:"#f1f5f9",fontSize:"12px"}};function QC(e){return`R$ ${Number(e||0).toFixed(2).replace(".",",")}`}function vve(e,t){if(!e.length)return;const n=Object.keys(e[0]).join(","),r=e.map(l=>Object.values(l).map(c=>`"${String(c??"").replace(/"/g,'""')}"`).join(",")).join(`
`),s=new Blob([`${n}
${r}`],{type:"text/csv;charset=utf-8;"}),i=URL.createObjectURL(s),o=document.createElement("a");o.href=i,o.download=t,o.click(),URL.revokeObjectURL(i)}function yve(){const[e,t]=b.useState(null),[n,r]=b.useState(!0),[s,i]=b.useState(!1);b.useEffect(()=>{f4.get().then(t).catch(()=>t(null)).finally(()=>r(!1))},[]);const o=(()=>{const x={};return((e==null?void 0:e.growth)||[]).forEach(y=>{x[y.month]={month:y.month,new_members:Number(y.new_members),canceled:0}}),((e==null?void 0:e.churn)||[]).forEach(y=>{x[y.month]||(x[y.month]={month:y.month,new_members:0,canceled:0}),x[y.month].canceled=Number(y.canceled)}),Object.values(x).sort((y,g)=>y.month.localeCompare(g.month))})(),l=(()=>{const x={};return((e==null?void 0:e.mrr)||[]).forEach(y=>{x[y.month]=(x[y.month]||0)+Number(y.mrr)}),Object.entries(x).sort(([y],[g])=>y.localeCompare(g)).map(([y,g])=>({month:y,mrr:g}))})(),c=l.length>0?l[l.length-1].mrr:0,u=l.length>1?l[l.length-2].mrr:0,d=u?((c-u)/u*100).toFixed(1):null,f=((e==null?void 0:e.overdue)||[]).reduce((x,y)=>x+Number(y.active),0),p=((e==null?void 0:e.overdue)||[]).reduce((x,y)=>x+Number(y.suspended),0),h=f+p>0?(p/(f+p)*100).toFixed(1):"0",m=((e==null?void 0:e.planDist)||[]).map(x=>({name:`${x.club_name} — ${x.plan_name}`,value:Number(x.total)}));async function v(){i(!0);try{const x=await f4.exportCsv();vve(x,`membros-clubes-${new Date().toISOString().slice(0,10)}.csv`)}catch{alert("Erro ao exportar")}finally{i(!1)}}return n?a.jsx("div",{className:"flex justify-center py-24",children:a.jsx("div",{className:"w-8 h-8 border-2 border-cyan-500 border-t-transparent rounded-full animate-spin"})}):a.jsxs("div",{className:"space-y-10 animate-in fade-in slide-in-from-bottom-4 duration-700",children:[a.jsxs("header",{className:"flex items-start justify-between",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-4xl font-black text-white tracking-tighter",children:"Relatórios do Clube"}),a.jsx("p",{className:"text-slate-400 mt-1",children:"MRR, churn, crescimento e distribuição de planos."})]}),a.jsxs("button",{onClick:v,disabled:s,className:"flex items-center gap-2 px-5 py-2.5 bg-cyan-500 hover:bg-cyan-400 text-black font-black text-sm rounded-xl transition-colors disabled:opacity-50",children:[a.jsx(m1,{size:16}),s?"Exportando…":"Exportar CSV"]})]}),a.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:[a.jsxs("div",{className:"bg-slate-900/40 border border-slate-800 rounded-3xl p-6",children:[a.jsx("div",{className:"p-3 rounded-2xl bg-slate-800 text-cyan-400 w-fit mb-4",children:a.jsx(xm,{size:22})}),a.jsx("p",{className:"text-slate-500 text-xs font-bold uppercase tracking-widest mb-1",children:"MRR Atual"}),a.jsx("h3",{className:"text-3xl font-black text-white tabular-nums",children:QC(c)}),d!==null&&a.jsxs("p",{className:`text-xs font-bold mt-1 ${Number(d)>=0?"text-emerald-400":"text-rose-400"}`,children:[Number(d)>=0?"▲":"▼"," ",Math.abs(Number(d)),"% vs mês ant."]})]}),a.jsxs("div",{className:"bg-slate-900/40 border border-slate-800 rounded-3xl p-6",children:[a.jsx("div",{className:"p-3 rounded-2xl bg-slate-800 text-emerald-400 w-fit mb-4",children:a.jsx(Wi,{size:22})}),a.jsx("p",{className:"text-slate-500 text-xs font-bold uppercase tracking-widest mb-1",children:"Membros Ativos"}),a.jsx("h3",{className:"text-3xl font-black text-white tabular-nums",children:f})]}),a.jsxs("div",{className:"bg-slate-900/40 border border-slate-800 rounded-3xl p-6",children:[a.jsx("div",{className:"p-3 rounded-2xl bg-slate-800 text-amber-400 w-fit mb-4",children:a.jsx(Kt,{size:22})}),a.jsx("p",{className:"text-slate-500 text-xs font-bold uppercase tracking-widest mb-1",children:"Taxa Inadimpl."}),a.jsxs("h3",{className:"text-3xl font-black text-white tabular-nums",children:[h,"%"]}),a.jsxs("p",{className:"text-xs text-slate-500 mt-1",children:[p," suspenso(s)"]})]}),a.jsxs("div",{className:"bg-slate-900/40 border border-slate-800 rounded-3xl p-6",children:[a.jsx("div",{className:"p-3 rounded-2xl bg-slate-800 text-rose-400 w-fit mb-4",children:a.jsx(FI,{size:22})}),a.jsx("p",{className:"text-slate-500 text-xs font-bold uppercase tracking-widest mb-1",children:"Cancelamentos"}),a.jsx("h3",{className:"text-3xl font-black text-white tabular-nums",children:((e==null?void 0:e.churn)||[]).reduce((x,y)=>x+Number(y.canceled),0)}),a.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"últimos 12 meses"})]})]}),a.jsxs("div",{className:"bg-slate-900/40 border border-slate-800 rounded-3xl p-8",children:[a.jsx("h3",{className:"text-base font-black text-white uppercase tracking-wider mb-6",children:"MRR — Receita Recorrente Mensal"}),a.jsx("div",{className:"h-52",children:l.length>0?a.jsx(Do,{width:"100%",height:"100%",children:a.jsxs(Mue,{data:l,children:[a.jsx(xl,{strokeDasharray:"3 3",stroke:"rgba(255,255,255,0.05)"}),a.jsx(ia,{dataKey:"month",stroke:"#475569",tick:{fontSize:11}}),a.jsx(oa,{stroke:"#475569",tick:{fontSize:11},tickFormatter:x=>`R$${x}`}),a.jsx(on,{...Z0,formatter:x=>[QC(x),"MRR"]}),a.jsx(Cd,{type:"monotone",dataKey:"mrr",stroke:"#06b6d4",strokeWidth:2.5,dot:{fill:"#06b6d4",r:4}})]})}):a.jsx("div",{className:"h-full flex items-center justify-center text-slate-600 italic text-sm",children:"Sem dados"})})]}),a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"bg-slate-900/40 border border-slate-800 rounded-3xl p-8",children:[a.jsx("h3",{className:"text-base font-black text-white uppercase tracking-wider mb-6",children:"Novos vs Cancelamentos"}),a.jsx("div",{className:"h-52",children:o.length>0?a.jsx(Do,{width:"100%",height:"100%",children:a.jsxs(KT,{data:o,children:[a.jsx(xl,{strokeDasharray:"3 3",stroke:"rgba(255,255,255,0.05)"}),a.jsx(ia,{dataKey:"month",stroke:"#475569",tick:{fontSize:10}}),a.jsx(oa,{stroke:"#475569",tick:{fontSize:10},allowDecimals:!1}),a.jsx(on,{...Z0}),a.jsx(ms,{wrapperStyle:{fontSize:11,color:"#94a3b8"}}),a.jsx($a,{dataKey:"new_members",name:"Novos",fill:"#10b981",radius:[4,4,0,0]}),a.jsx($a,{dataKey:"canceled",name:"Cancelados",fill:"#ef4444",radius:[4,4,0,0]})]})}):a.jsx("div",{className:"h-full flex items-center justify-center text-slate-600 italic text-sm",children:"Sem dados"})})]}),a.jsxs("div",{className:"bg-slate-900/40 border border-slate-800 rounded-3xl p-8",children:[a.jsx("h3",{className:"text-base font-black text-white uppercase tracking-wider mb-6",children:"Distribuição de Planos"}),a.jsx("div",{className:"h-52 flex items-center",children:m.length>0?a.jsx(Do,{width:"100%",height:"100%",children:a.jsxs(Rue,{children:[a.jsx(La,{data:m,cx:"40%",cy:"50%",innerRadius:50,outerRadius:80,dataKey:"value",label:({percent:x})=>`${(x*100).toFixed(0)}%`,labelLine:!1,children:m.map((x,y)=>a.jsx(Vm,{fill:YC[y%YC.length]},y))}),a.jsx(on,{...Z0,formatter:x=>[x,"Membros"]}),a.jsx(ms,{layout:"vertical",align:"right",verticalAlign:"middle",wrapperStyle:{fontSize:11,color:"#94a3b8",maxWidth:"45%"}})]})}):a.jsx("div",{className:"w-full flex items-center justify-center text-slate-600 italic text-sm",children:"Sem dados"})})]})]}),a.jsxs("div",{className:"bg-slate-900/40 border border-slate-800 rounded-3xl p-8",children:[a.jsx("h3",{className:"text-base font-black text-white uppercase tracking-wider mb-6",children:"Inadimplência por Clube"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[((e==null?void 0:e.overdue)||[]).map(x=>{const y=Number(x.active)+Number(x.suspended),g=y>0?Math.round(Number(x.suspended)/y*100):0;return a.jsxs("div",{className:"bg-slate-800/50 rounded-2xl p-5",children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsx("span",{className:"font-black text-white",children:x.club_name}),a.jsxs("span",{className:`text-sm font-black ${g>10?"text-rose-400":"text-emerald-400"}`,children:[g,"%"]})]}),a.jsx("div",{className:"w-full h-2 bg-slate-700 rounded-full overflow-hidden",children:a.jsx("div",{className:`h-full rounded-full ${g>10?"bg-rose-500":"bg-emerald-500"}`,style:{width:`${g}%`}})}),a.jsxs("div",{className:"flex justify-between mt-2 text-xs text-slate-500",children:[a.jsxs("span",{children:[x.active," ativo(s)"]}),a.jsxs("span",{children:[x.suspended," suspenso(s)"]})]})]},x.club_name)}),(!(e!=null&&e.overdue)||e.overdue.length===0)&&a.jsx("p",{className:"text-slate-600 italic col-span-2",children:"Sem dados de inadimplência"})]})]})]})}function wx(e){return e?new Date(e).toLocaleDateString("pt-BR"):"—"}function bve(e,t,n){if(n||!e&&!t)return"A combinar";const r=s=>`R$ ${Number(s).toLocaleString("pt-BR",{minimumFractionDigits:0})}`;return e&&t?`${r(e)} ${r(t)}`:e?`A partir de ${r(e)}`:`Até ${r(t)}`}function p8(e){const t=Date.now()-new Date(e).getTime(),n=Math.floor(t/864e5);return n===0?"Hoje":n===1?"Ontem":n<7?`${n} dias atrás`:n<30?`${Math.floor(n/7)} sem. atrás`:wx(e)}const jve={presencial:"Presencial",hibrido:"Híbrido",remoto:"Remoto"},wve={clt:"CLT",pj:"PJ",freelance:"Freelance",estagio:"Estágio",temporario:"Temporário"},rp={novo:"Novo",em_analise:"Em Análise",aprovado:"Aprovado",reprovado:"Reprovado",contratado:"Contratado"},h8={novo:"bg-slate-700 text-slate-300",em_analise:"bg-blue-500/10 text-blue-400 border-blue-500/20",aprovado:"bg-emerald-500/10 text-emerald-400 border-emerald-500/20",reprovado:"bg-rose-500/10 text-rose-400 border-rose-500/20",contratado:"bg-violet-500/10 text-violet-400 border-violet-500/20"},Nve={presencial:"bg-amber-500/10 text-amber-400 border-amber-500/20",hibrido:"bg-blue-500/10 text-blue-400 border-blue-500/20",remoto:"bg-emerald-500/10 text-emerald-400 border-emerald-500/20"};function eg({label:e,color:t}){return a.jsx("span",{className:`text-[10px] font-black px-2 py-0.5 rounded border ${t}`,children:e})}const Sve={title:"",description:"",requirements:"",benefits:"",location:"",work_mode:"presencial",job_type:"clt",category:"",salary_min:"",salary_max:"",salary_hide:!1,slots:1,active:!0,expires_at:""};function kve({job:e,onClose:t,onSaved:n}){const[r,s]=b.useState(e?{...e,salary_min:e.salary_min??"",salary_max:e.salary_max??"",expires_at:e.expires_at?e.expires_at.slice(0,10):"",requirements:e.requirements||"",benefits:e.benefits||"",location:e.location||"",category:e.category||""}:Sve),[i,o]=b.useState(!1);function l(f,p){s(h=>({...h,[f]:p}))}async function c(f){f.preventDefault(),o(!0);try{const p={...r,salary_min:r.salary_min===""?null:Number(r.salary_min),salary_max:r.salary_max===""?null:Number(r.salary_max),expires_at:r.expires_at||null};e?await Xr.update(e.id,p):await Xr.create(p),n(),t()}catch{alert("Erro ao salvar vaga")}finally{o(!1)}}const u="w-full bg-slate-800 border border-slate-700 rounded-xl px-3 py-2 text-sm text-white focus:outline-none focus:border-cyan-500",d="text-xs font-bold text-slate-400 uppercase tracking-wider";return a.jsx("div",{className:"fixed inset-0 bg-black/70 backdrop-blur-sm z-50 flex items-center justify-center p-4",children:a.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-3xl w-full max-w-2xl max-h-[92vh] overflow-y-auto",children:[a.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-slate-800 sticky top-0 bg-slate-900 z-10",children:[a.jsx("h3",{className:"text-lg font-black text-white",children:e?"Editar Vaga":"Nova Vaga"}),a.jsx("button",{onClick:t,className:"text-slate-500 hover:text-white",children:a.jsx(Ce,{size:20})})]}),a.jsxs("form",{onSubmit:c,className:"p-6 space-y-5",children:[a.jsxs("div",{children:[a.jsx("label",{className:d,children:"Título da Vaga *"}),a.jsx("input",{required:!0,value:r.title,onChange:f=>l("title",f.target.value),placeholder:"Ex: Desenvolvedor Full Stack",className:`mt-1 ${u}`})]}),a.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[a.jsxs("div",{children:[a.jsx("label",{className:d,children:"Modo"}),a.jsxs("select",{value:r.work_mode,onChange:f=>l("work_mode",f.target.value),className:`mt-1 ${u}`,children:[a.jsx("option",{className:"bg-slate-900 text-white",value:"presencial",children:"Presencial"}),a.jsx("option",{className:"bg-slate-900 text-white",value:"hibrido",children:"Híbrido"}),a.jsx("option",{className:"bg-slate-900 text-white",value:"remoto",children:"Remoto"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:d,children:"Contrato"}),a.jsxs("select",{value:r.job_type,onChange:f=>l("job_type",f.target.value),className:`mt-1 ${u}`,children:[a.jsx("option",{className:"bg-slate-900 text-white",value:"clt",children:"CLT"}),a.jsx("option",{className:"bg-slate-900 text-white",value:"pj",children:"PJ"}),a.jsx("option",{className:"bg-slate-900 text-white",value:"freelance",children:"Freelance"}),a.jsx("option",{className:"bg-slate-900 text-white",value:"estagio",children:"Estágio"}),a.jsx("option",{className:"bg-slate-900 text-white",value:"temporario",children:"Temporário"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:d,children:"Categoria"}),a.jsx("input",{value:r.category,onChange:f=>l("category",f.target.value),placeholder:"Ex: TI, Saúde...",className:`mt-1 ${u}`})]})]}),a.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[a.jsxs("div",{className:"col-span-1",children:[a.jsx("label",{className:d,children:"Localização"}),a.jsx("input",{value:r.location,onChange:f=>l("location",f.target.value),placeholder:"Cidade / UF",className:`mt-1 ${u}`})]}),a.jsxs("div",{children:[a.jsx("label",{className:d,children:"Nº de Vagas"}),a.jsx("input",{type:"number",min:1,value:r.slots,onChange:f=>l("slots",+f.target.value),className:`mt-1 ${u}`})]}),a.jsxs("div",{children:[a.jsx("label",{className:d,children:"Expira em"}),a.jsx("input",{type:"date",value:r.expires_at,onChange:f=>l("expires_at",f.target.value),className:`mt-1 ${u}`})]})]}),a.jsxs("div",{className:"grid grid-cols-3 gap-3 items-end",children:[a.jsxs("div",{children:[a.jsx("label",{className:d,children:"Salário Mín (R$)"}),a.jsx("input",{type:"number",min:0,value:r.salary_min,onChange:f=>l("salary_min",f.target.value),disabled:r.salary_hide,placeholder:"0,00",className:`mt-1 ${u} disabled:opacity-40`})]}),a.jsxs("div",{children:[a.jsx("label",{className:d,children:"Salário Máx (R$)"}),a.jsx("input",{type:"number",min:0,value:r.salary_max,onChange:f=>l("salary_max",f.target.value),disabled:r.salary_hide,placeholder:"0,00",className:`mt-1 ${u} disabled:opacity-40`})]}),a.jsxs("label",{className:"flex items-center gap-2 cursor-pointer pb-2",children:[a.jsx("input",{type:"checkbox",checked:r.salary_hide,onChange:f=>l("salary_hide",f.target.checked),className:"accent-cyan-500"}),a.jsx("span",{className:"text-sm text-slate-300",children:"A combinar"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:d,children:"Descrição *"}),a.jsx("textarea",{required:!0,rows:5,value:r.description,onChange:f=>l("description",f.target.value),placeholder:"Descreva as responsabilidades e o dia a dia da função...",className:`mt-1 ${u} resize-y`})]}),a.jsxs("div",{children:[a.jsx("label",{className:d,children:"Requisitos"}),a.jsx("textarea",{rows:3,value:r.requirements,onChange:f=>l("requirements",f.target.value),placeholder:"Experiência, formação, habilidades exigidas...",className:`mt-1 ${u} resize-y`})]}),a.jsxs("div",{children:[a.jsx("label",{className:d,children:"Benefícios"}),a.jsx("textarea",{rows:3,value:r.benefits,onChange:f=>l("benefits",f.target.value),placeholder:"VT, VR, Plano de saúde, home office...",className:`mt-1 ${u} resize-y`})]}),e&&a.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:r.active,onChange:f=>l("active",f.target.checked),className:"accent-cyan-500"}),a.jsx("span",{className:"text-sm text-slate-300",children:"Vaga ativa"})]}),a.jsxs("div",{className:"flex gap-3 pt-2",children:[a.jsx("button",{type:"button",onClick:t,className:"flex-1 py-2.5 rounded-xl border border-slate-700 text-slate-400 hover:text-white text-sm font-bold",children:"Cancelar"}),a.jsx("button",{type:"submit",disabled:i,className:"flex-1 py-2.5 rounded-xl bg-cyan-500 hover:bg-cyan-400 text-black text-sm font-black disabled:opacity-50",children:i?"Salvando…":e?"Atualizar Vaga":"Publicar Vaga"})]})]})]})})}function m8({app:e,onClose:t,onUpdated:n}){var d,f,p;const[r,s]=b.useState(e.status),[i,o]=b.useState(e.admin_notes||""),[l,c]=b.useState(!1);async function u(){c(!0);try{await Xr.updateApplication(e.id,{status:r,admin_notes:i}),n(),t()}catch{alert("Erro ao atualizar")}finally{c(!1)}}return a.jsx("div",{className:"fixed inset-0 bg-black/80 backdrop-blur-sm z-50 flex items-end md:items-center justify-center p-4",children:a.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-t-3xl md:rounded-3xl w-full max-w-2xl max-h-[90vh] overflow-y-auto",children:[a.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-slate-800 sticky top-0 bg-slate-900 z-10",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-black text-white",children:e.applicant_nome}),a.jsxs("p",{className:"text-slate-500 text-xs mt-0.5",children:["Candidatado em ",wx(e.applied_at)]})]}),a.jsx("button",{onClick:t,className:"text-slate-500 hover:text-white",children:a.jsx(Ce,{size:20})})]}),a.jsxs("div",{className:"p-6 space-y-6",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-slate-500 text-xs",children:"CPF"}),a.jsx("p",{className:"text-white font-mono",children:e.applicant_cpf})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-slate-500 text-xs",children:"Telefone"}),a.jsx("p",{className:"text-white",children:e.applicant_phone||"—"})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-slate-500 text-xs",children:"Email"}),a.jsx("p",{className:"text-white",children:e.applicant_email||"—"})]}),e.linkedin&&a.jsxs("div",{children:[a.jsx("p",{className:"text-slate-500 text-xs",children:"LinkedIn"}),a.jsx("a",{href:e.linkedin,target:"_blank",className:"text-cyan-400 underline text-xs",children:"Perfil"})]})]}),e.cover_letter&&a.jsxs("div",{children:[a.jsx("p",{className:"text-xs font-black text-slate-400 uppercase tracking-wider mb-2",children:"Carta de Apresentação"}),a.jsx("p",{className:"text-slate-300 text-sm bg-slate-800/40 border border-slate-800 rounded-2xl p-4 whitespace-pre-line",children:e.cover_letter})]}),e.about&&a.jsxs("div",{children:[a.jsx("p",{className:"text-xs font-black text-slate-400 uppercase tracking-wider mb-2",children:"Sobre o Candidato"}),a.jsx("p",{className:"text-slate-300 text-sm whitespace-pre-line",children:e.about})]}),((d=e.experience)==null?void 0:d.length)>0&&a.jsxs("div",{children:[a.jsx("p",{className:"text-xs font-black text-slate-400 uppercase tracking-wider mb-3",children:"Experiências"}),a.jsx("div",{className:"space-y-3",children:e.experience.map((h,m)=>a.jsxs("div",{className:"border-l-2 border-cyan-500/30 pl-4",children:[a.jsxs("p",{className:"font-black text-white text-sm",children:[h.role," ",a.jsxs("span",{className:"font-normal text-slate-400",children:["@ ",h.company]})]}),a.jsxs("p",{className:"text-slate-500 text-xs",children:[h.start," ",h.current?"Atual":h.end]}),h.description&&a.jsx("p",{className:"text-slate-400 text-xs mt-1",children:h.description})]},m))})]}),((f=e.education)==null?void 0:f.length)>0&&a.jsxs("div",{children:[a.jsx("p",{className:"text-xs font-black text-slate-400 uppercase tracking-wider mb-3",children:"Formação"}),a.jsx("div",{className:"space-y-2",children:e.education.map((h,m)=>a.jsxs("div",{className:"border-l-2 border-violet-500/30 pl-4",children:[a.jsxs("p",{className:"font-black text-white text-sm",children:[h.degree," em ",h.course]}),a.jsxs("p",{className:"text-slate-500 text-xs",children:[h.institution," · ",h.start," ",h.current?"Atual":h.end]})]},m))})]}),((p=e.skills)==null?void 0:p.length)>0&&a.jsxs("div",{children:[a.jsx("p",{className:"text-xs font-black text-slate-400 uppercase tracking-wider mb-2",children:"Habilidades"}),a.jsx("div",{className:"flex flex-wrap gap-2",children:e.skills.map((h,m)=>a.jsxs("span",{className:"text-xs font-bold px-2.5 py-1 rounded-full bg-slate-800 border border-slate-700 text-slate-300",children:[h.name," ",a.jsxs("span",{className:"text-slate-500",children:["· ",h.level]})]},m))})]}),e.file_url&&a.jsxs("a",{href:e.file_url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 px-4 py-2.5 rounded-xl bg-slate-800 border border-slate-700 hover:border-cyan-500/30 text-slate-300 hover:text-white text-sm font-bold transition-all w-fit",children:[a.jsx(m1,{size:14})," Baixar Currículo PDF"]}),a.jsxs("div",{className:"space-y-3 pt-3 border-t border-slate-800",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-black text-slate-400 uppercase tracking-wider block mb-2",children:"Status"}),a.jsx("div",{className:"flex flex-wrap gap-2",children:Object.entries(rp).map(([h,m])=>a.jsx("button",{onClick:()=>s(h),className:`text-xs font-black px-3 py-1.5 rounded-lg border transition-all ${r===h?h8[h]:"bg-slate-800 border-slate-700 text-slate-400 hover:text-white"}`,children:m},h))})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-black text-slate-400 uppercase tracking-wider block mb-1",children:"Notas Internas"}),a.jsx("textarea",{rows:3,value:i,onChange:h=>o(h.target.value),placeholder:"Observações internas sobre o candidato...",className:"w-full bg-slate-800 border border-slate-700 rounded-xl px-3 py-2 text-sm text-white focus:outline-none focus:border-cyan-500 resize-none"})]}),a.jsx("button",{onClick:u,disabled:l,className:"w-full py-3 rounded-xl bg-cyan-500 hover:bg-cyan-400 text-black font-black text-sm disabled:opacity-50",children:l?"Salvando…":"Salvar Status e Notas"})]})]})]})})}function Cve({job:e,onClose:t}){const[n,r]=b.useState([]),[s,i]=b.useState(!0),[o,l]=b.useState(""),[c,u]=b.useState(null),d=b.useCallback(async()=>{i(!0);try{const f=await Xr.getApplications(e.id,{status:o||void 0});r(f||[])}catch{r([])}finally{i(!1)}},[e.id,o]);return b.useEffect(()=>{d()},[d]),a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"fixed inset-0 bg-black/60 z-40",onClick:t}),a.jsxs("aside",{className:"fixed right-0 top-0 h-full w-full max-w-xl bg-slate-900 border-l border-slate-800 z-50 flex flex-col shadow-2xl",children:[a.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-slate-800",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-black text-white",children:e.title}),a.jsxs("p",{className:"text-slate-500 text-xs mt-0.5",children:[n.length," candidatos"]})]}),a.jsx("button",{onClick:t,className:"text-slate-500 hover:text-white",children:a.jsx(Ce,{size:20})})]}),a.jsx("div",{className:"flex gap-1.5 p-4 border-b border-slate-800 flex-wrap",children:["",...Object.keys(rp)].map(f=>a.jsx("button",{onClick:()=>l(f),className:`text-[10px] font-black px-2.5 py-1 rounded-lg border transition-all ${o===f?"bg-cyan-500/10 border-cyan-500/30 text-cyan-400":"border-slate-700 text-slate-500 hover:text-slate-300"}`,children:f?rp[f]:"Todos"},f||"all"))}),a.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-3",children:[s&&a.jsx("div",{className:"flex justify-center py-12",children:a.jsx("div",{className:"w-7 h-7 border-2 border-cyan-500 border-t-transparent rounded-full animate-spin"})}),!s&&n.length===0&&a.jsx("p",{className:"text-slate-600 italic text-center py-12",children:"Nenhum candidato"}),n.map(f=>a.jsxs("div",{onClick:()=>u(f),className:"bg-slate-800/40 border border-slate-800 hover:border-slate-700 rounded-2xl p-4 cursor-pointer transition-all hover:bg-slate-800/60",children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{children:[a.jsx("p",{className:"font-bold text-white text-sm",children:f.applicant_nome}),a.jsx("p",{className:"text-slate-500 text-xs font-mono",children:f.applicant_cpf})]}),a.jsx("span",{className:`text-[10px] font-black px-2 py-0.5 rounded border shrink-0 ${h8[f.status]}`,children:rp[f.status]})]}),a.jsx("p",{className:"text-slate-500 text-xs mt-2",children:p8(f.applied_at)}),f.cover_letter&&a.jsxs("p",{className:"text-slate-500 text-xs mt-1 line-clamp-1 italic",children:['"',f.cover_letter,'"']})]},f.id))]})]}),c&&a.jsx(m8,{app:c,onClose:()=>u(null),onUpdated:d})]})}function _ve({onBack:e}){const[t,n]=b.useState([]),[r,s]=b.useState(""),[i,o]=b.useState(!1),[l,c]=b.useState(null),u=b.useCallback(async()=>{o(!0);try{const f=await Xr.searchResumes({search:r||void 0,limit:100});n(f||[])}catch{n([])}finally{o(!1)}},[r]);b.useEffect(()=>{const f=setTimeout(u,300);return()=>clearTimeout(f)},[u]);function d(f){return f.replace(/(\d{3})(\d{3})(\d{3})(\d{2})/,"$1.$2.$3-$4")}return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("button",{onClick:e,className:"text-slate-400 hover:text-white",children:a.jsx(Ui,{size:20})}),a.jsx("h3",{className:"text-2xl font-black text-white",children:"Banco de Currículos"})]}),a.jsxs("div",{className:"relative",children:[a.jsx(Ir,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),a.jsx("input",{value:r,onChange:f=>s(f.target.value),placeholder:"Buscar por nome ou CPF...",className:"w-full pl-9 pr-4 py-2.5 bg-slate-900 border border-slate-800 rounded-xl text-sm text-white focus:outline-none focus:border-cyan-500"})]}),a.jsx("div",{className:"bg-slate-900/40 border border-slate-800 rounded-3xl overflow-hidden",children:i?a.jsx("div",{className:"flex justify-center py-12",children:a.jsx("div",{className:"w-7 h-7 border-2 border-cyan-500 border-t-transparent rounded-full animate-spin"})}):a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsx("tr",{className:"border-b border-slate-800",children:["Nome","CPF","E-mail","Telefone","Candidaturas","Atualizado",""].map(f=>a.jsx("th",{className:"text-left px-5 py-4 text-[10px] font-black uppercase tracking-widest text-slate-500 whitespace-nowrap",children:f},f))})}),a.jsxs("tbody",{children:[t.length===0&&a.jsx("tr",{children:a.jsx("td",{colSpan:7,className:"text-center py-12 text-slate-600 italic",children:"Nenhum currículo encontrado"})}),t.map(f=>a.jsxs("tr",{className:"border-b border-slate-800/50 hover:bg-slate-800/30 transition-colors",children:[a.jsx("td",{className:"px-5 py-3.5 font-bold text-white",children:f.user_nome}),a.jsx("td",{className:"px-5 py-3.5 text-slate-400 font-mono text-xs",children:d(f.user_cpf)}),a.jsx("td",{className:"px-5 py-3.5 text-slate-400 text-xs",children:f.email||"—"}),a.jsx("td",{className:"px-5 py-3.5 text-slate-400 text-xs",children:f.phone||"—"}),a.jsx("td",{className:"px-5 py-3.5 text-center",children:a.jsx("span",{className:"text-xs font-black text-cyan-400 bg-cyan-500/10 px-2 py-0.5 rounded",children:f.applications_count})}),a.jsx("td",{className:"px-5 py-3.5 text-slate-500 text-xs",children:wx(f.updated_at)}),a.jsx("td",{className:"px-5 py-3.5",children:a.jsxs("button",{onClick:()=>{Xr.getResume(f.user_cpf).then(p=>c(p))},className:"text-xs font-bold px-3 py-1.5 rounded-lg bg-slate-800 hover:bg-slate-700 text-slate-300 flex items-center gap-1",children:[a.jsx($p,{size:12})," Ver"]})})]},f.id))]})]})}),l&&a.jsx(m8,{app:{...l,id:0,applicant_nome:l.user_nome,applicant_cpf:l.user_cpf,applicant_email:l.email,applicant_phone:l.phone,cover_letter:null,status:"novo",applied_at:l.created_at,admin_notes:null},onClose:()=>c(null),onUpdated:()=>{}})]})}function Ave(){const[e,t]=b.useState("jobs"),[n,r]=b.useState([]),[s,i]=b.useState(0),[o,l]=b.useState({active:0,inactive:0,total_applications:0,hired:0}),[c,u]=b.useState(!0),[d,f]=b.useState(null),[p,h]=b.useState(null),[m,v]=b.useState(""),[x,y]=b.useState(""),[g,j]=b.useState(""),N=b.useCallback(async()=>{u(!0);try{const[k,C]=await Promise.all([Xr.list({search:m||void 0,work_mode:x||void 0,active:g===""?void 0:g,limit:50}),Xr.kpi()]);r(k.jobs||[]),i(k.total||0),l(C)}catch{r([])}finally{u(!1)}},[m,x,g]);b.useEffect(()=>{const k=setTimeout(N,300);return()=>clearTimeout(k)},[N]);async function w(k){await Xr.toggle(k.id),N()}async function S(k){const C=`Excluir a vaga "${k.title}"?
Se houver candidaturas ela será desativada em vez de excluída.`;if(!confirm(C))return;(await Xr.remove(k.id)).deactivated&&alert("Vaga desativada pois possui candidaturas."),N()}return e==="resumes"?a.jsx(_ve,{onBack:()=>t("jobs")}):a.jsxs("div",{className:"space-y-8 animate-in fade-in slide-in-from-bottom-4 duration-700",children:[a.jsxs("header",{className:"flex flex-wrap items-start justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-4xl font-black text-white tracking-tighter",children:"Vagas & Talentos"}),a.jsx("p",{className:"text-slate-400 mt-1",children:"Gestão completa de vagas, candidatos e currículos."})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs("button",{onClick:()=>t("resumes"),className:"flex items-center gap-2 px-4 py-2.5 border border-slate-700 hover:border-slate-600 text-slate-400 hover:text-white rounded-xl text-sm font-bold transition-all",children:[a.jsx(Hr,{size:15})," Currículos"]}),a.jsxs("button",{onClick:()=>f("new"),className:"flex items-center gap-2 px-5 py-2.5 bg-cyan-500 hover:bg-cyan-400 text-black font-black text-sm rounded-xl transition-colors",children:[a.jsx(Oe,{size:16})," Nova Vaga"]})]})]}),a.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:[{label:"Vagas Ativas",value:o.active,icon:mm,color:"cyan"},{label:"Vagas Encerradas",value:o.inactive,icon:Xo,color:"slate"},{label:"Total Candidatos",value:o.total_applications,icon:et,color:"violet"},{label:"Contratações",value:o.hired,icon:Tl,color:"emerald"}].map(({label:k,value:C,icon:_,color:A})=>a.jsxs("div",{className:"bg-slate-900/40 border border-slate-800 rounded-3xl p-6 hover:border-slate-700 transition-all",children:[a.jsx("div",{className:`p-3 rounded-2xl bg-slate-800 border border-white/5 text-${A}-400 w-fit mb-4`,children:a.jsx(_,{size:22})}),a.jsx("p",{className:"text-slate-500 text-xs font-bold uppercase tracking-widest mb-1",children:k}),a.jsx("h3",{className:"text-3xl font-black text-white tabular-nums tracking-tighter",children:C})]},k))}),a.jsxs("div",{className:"flex flex-wrap gap-3",children:[a.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[a.jsx(Ir,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),a.jsx("input",{value:m,onChange:k=>v(k.target.value),placeholder:"Buscar por título...",className:"w-full pl-9 pr-4 py-2.5 bg-slate-900 border border-slate-800 rounded-xl text-sm text-white focus:outline-none focus:border-cyan-500"})]}),a.jsxs("select",{value:x,onChange:k=>y(k.target.value),className:"bg-slate-900 border border-slate-800 rounded-xl px-3 py-2.5 text-sm text-white focus:outline-none focus:border-cyan-500",children:[a.jsx("option",{className:"bg-slate-900 text-white",value:"",children:"Todos os modos"}),a.jsx("option",{className:"bg-slate-900 text-white",value:"presencial",children:"Presencial"}),a.jsx("option",{className:"bg-slate-900 text-white",value:"hibrido",children:"Híbrido"}),a.jsx("option",{className:"bg-slate-900 text-white",value:"remoto",children:"Remoto"})]}),a.jsxs("select",{value:g,onChange:k=>j(k.target.value),className:"bg-slate-900 border border-slate-800 rounded-xl px-3 py-2.5 text-sm text-white focus:outline-none focus:border-cyan-500",children:[a.jsx("option",{className:"bg-slate-900 text-white",value:"",children:"Ativas e inativas"}),a.jsx("option",{className:"bg-slate-900 text-white",value:"true",children:"Somente ativas"}),a.jsx("option",{className:"bg-slate-900 text-white",value:"false",children:"Somente inativas"})]})]}),a.jsxs("div",{className:"bg-slate-900/40 border border-slate-800 rounded-3xl overflow-hidden overflow-x-auto",children:[c?a.jsx("div",{className:"flex justify-center py-16",children:a.jsx("div",{className:"w-8 h-8 border-2 border-cyan-500 border-t-transparent rounded-full animate-spin"})}):a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsx("tr",{className:"border-b border-slate-800",children:["Título","Modo","Tipo","Salário","Publicado","Expira","Candidatos","Status",""].map(k=>a.jsx("th",{className:"text-left px-4 py-4 text-[10px] font-black uppercase tracking-widest text-slate-500 whitespace-nowrap",children:k},k))})}),a.jsxs("tbody",{children:[n.length===0&&a.jsx("tr",{children:a.jsx("td",{colSpan:9,className:"text-center py-16 text-slate-600 italic",children:"Nenhuma vaga encontrada"})}),n.map(k=>a.jsxs("tr",{className:"border-b border-slate-800/50 hover:bg-slate-800/20 transition-colors",children:[a.jsxs("td",{className:"px-4 py-3.5",children:[a.jsx("p",{className:"font-bold text-white",children:k.title}),k.location&&a.jsxs("p",{className:"text-slate-500 text-xs flex items-center gap-1 mt-0.5",children:[a.jsx(gm,{size:10})," ",k.location]}),k.category&&a.jsx("p",{className:"text-slate-600 text-xs",children:k.category})]}),a.jsx("td",{className:"px-4 py-3.5",children:a.jsx(eg,{label:jve[k.work_mode]||k.work_mode,color:Nve[k.work_mode]||"bg-slate-700 text-slate-300"})}),a.jsx("td",{className:"px-4 py-3.5 text-slate-400 text-xs whitespace-nowrap",children:wve[k.job_type]||k.job_type}),a.jsx("td",{className:"px-4 py-3.5 text-slate-400 text-xs whitespace-nowrap",children:bve(k.salary_min,k.salary_max,k.salary_hide)}),a.jsx("td",{className:"px-4 py-3.5 text-slate-500 text-xs whitespace-nowrap",children:p8(k.published_at)}),a.jsx("td",{className:"px-4 py-3.5 text-slate-500 text-xs whitespace-nowrap",children:k.expires_at?wx(k.expires_at):"—"}),a.jsx("td",{className:"px-4 py-3.5",children:a.jsxs("button",{onClick:()=>h(k),className:"flex items-center gap-1.5 text-xs font-black text-cyan-400 hover:text-cyan-300 bg-cyan-500/10 border border-cyan-500/20 px-2.5 py-1 rounded-lg transition-all",children:[a.jsx(et,{size:11})," ",k.applicants_count]})}),a.jsx("td",{className:"px-4 py-3.5",children:k.active?a.jsx(eg,{label:"Ativa",color:"bg-emerald-500/10 text-emerald-400 border-emerald-500/20"}):a.jsx(eg,{label:"Inativa",color:"bg-slate-700 text-slate-400 border-slate-600"})}),a.jsx("td",{className:"px-4 py-3.5",children:a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("button",{onClick:()=>f(k),title:"Editar",className:"p-1.5 rounded-lg hover:bg-slate-700 text-slate-400 hover:text-white transition-colors",children:a.jsx(Er,{size:13})}),a.jsx("button",{onClick:()=>w(k),title:k.active?"Desativar":"Ativar",className:"p-1.5 rounded-lg hover:bg-slate-700 text-slate-400 hover:text-white transition-colors",children:k.active?a.jsx(Ss,{size:15,className:"text-emerald-400"}):a.jsx(Ns,{size:15})}),a.jsx("button",{onClick:()=>S(k),title:"Excluir",className:"p-1.5 rounded-lg hover:bg-rose-500/10 text-slate-400 hover:text-rose-400 transition-colors",children:a.jsx(Te,{size:13})})]})})]},k.id))]})]}),s>50&&a.jsxs("div",{className:"px-5 py-3 border-t border-slate-800 text-xs text-slate-500",children:["Mostrando 50 de ",s," vagas"]})]}),d!==null&&a.jsx(kve,{job:d==="new"?null:d,onClose:()=>f(null),onSaved:N}),p&&a.jsx(Cve,{job:p,onClose:()=>h(null)})]})}const tg=e=>Number(e).toLocaleString("pt-BR",{style:"currency",currency:"BRL"});function JC({children:e,color:t="slate"}){const n={emerald:"bg-emerald-400/10 text-emerald-400",rose:"bg-rose-400/10 text-rose-400",slate:"bg-slate-700 text-slate-400",cyan:"bg-cyan-400/10 text-cyan-400"};return a.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded-lg text-[10px] font-black uppercase tracking-widest ${n[t]||n.slate}`,children:e})}function Pve({produto:e,categorias:t,onClose:n,onSave:r}){const s=!!e,[i,o]=b.useState({sku:(e==null?void 0:e.sku)||"",nome:(e==null?void 0:e.nome)||"",descricao:(e==null?void 0:e.descricao)||"",unidade:(e==null?void 0:e.unidade)||"un",preco:(e==null?void 0:e.preco)??"",preco_promocional:(e==null?void 0:e.preco_promocional)??"",estoque:(e==null?void 0:e.estoque)??"",categoria:(e==null?void 0:e.categoria)||"",ativo:(e==null?void 0:e.ativo)!==!1}),[l,c]=b.useState(!1),[u,d]=b.useState(""),f=h=>m=>o(v=>({...v,[h]:m.target.value}));async function p(){var h,m;if(d(""),!i.nome.trim())return d("Nome é obrigatório");if(i.preco===""||isNaN(Number(i.preco)))return d("Preço inválido");c(!0);try{const v={...i,preco:Number(i.preco),preco_promocional:i.preco_promocional!==""?Number(i.preco_promocional):null,estoque:Number(i.estoque)||0};s?await zo.update(e.id,v):await zo.create(v),r()}catch(v){d(((m=(h=v.response)==null?void 0:h.data)==null?void 0:m.error)||"Erro ao salvar")}finally{c(!1)}}return a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/70 backdrop-blur-sm",children:a.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-3xl w-full max-w-lg shadow-2xl",children:[a.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-slate-800",children:[a.jsx("h3",{className:"text-lg font-black text-white",children:s?"Editar Produto":"Novo Produto"}),a.jsx("button",{onClick:n,className:"text-slate-500 hover:text-white transition-colors",children:a.jsx(Ce,{size:20})})]}),a.jsxs("div",{className:"p-6 space-y-4 max-h-[70vh] overflow-y-auto",children:[u&&a.jsx("p",{className:"text-rose-400 text-sm bg-rose-400/10 px-3 py-2 rounded-xl",children:u}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-black text-slate-400 uppercase tracking-widest mb-1",children:"SKU"}),a.jsx("input",{value:i.sku,onChange:f("sku"),placeholder:"ex: ARROZ-5KG",className:"w-full bg-slate-800 border border-slate-700 rounded-xl px-3 py-2 text-sm text-white focus:outline-none focus:border-cyan-500"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-black text-slate-400 uppercase tracking-widest mb-1",children:"Unidade"}),a.jsx("select",{value:i.unidade,onChange:f("unidade"),className:"w-full bg-slate-800 border border-slate-700 rounded-xl px-3 py-2 text-sm text-white focus:outline-none focus:border-cyan-500",children:["un","kg","lt","cx","pct","fdo","dz"].map(h=>a.jsx("option",{className:"bg-slate-900 text-white",children:h},h))})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-black text-slate-400 uppercase tracking-widest mb-1",children:"Nome *"}),a.jsx("input",{value:i.nome,onChange:f("nome"),placeholder:"Nome do produto",className:"w-full bg-slate-800 border border-slate-700 rounded-xl px-3 py-2 text-sm text-white focus:outline-none focus:border-cyan-500"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-black text-slate-400 uppercase tracking-widest mb-1",children:"Descrição"}),a.jsx("textarea",{value:i.descricao,onChange:f("descricao"),rows:2,className:"w-full bg-slate-800 border border-slate-700 rounded-xl px-3 py-2 text-sm text-white focus:outline-none focus:border-cyan-500 resize-none"})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-black text-slate-400 uppercase tracking-widest mb-1",children:"Preço *"}),a.jsx("input",{type:"number",step:"0.01",value:i.preco,onChange:f("preco"),placeholder:"0,00",className:"w-full bg-slate-800 border border-slate-700 rounded-xl px-3 py-2 text-sm text-white focus:outline-none focus:border-cyan-500"})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"block text-xs font-black text-slate-400 uppercase tracking-widest mb-1",children:["Preço Promo ",a.jsx("span",{className:"text-slate-600 normal-case font-normal",children:"(opcional)"})]}),a.jsx("input",{type:"number",step:"0.01",value:i.preco_promocional,onChange:f("preco_promocional"),placeholder:"—",className:"w-full bg-slate-800 border border-slate-700 rounded-xl px-3 py-2 text-sm text-white focus:outline-none focus:border-emerald-500"})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-black text-slate-400 uppercase tracking-widest mb-1",children:"Estoque"}),a.jsx("input",{type:"number",step:"0.001",value:i.estoque,onChange:f("estoque"),placeholder:"0",className:"w-full bg-slate-800 border border-slate-700 rounded-xl px-3 py-2 text-sm text-white focus:outline-none focus:border-cyan-500"})]}),a.jsx("div",{className:"flex items-end pb-2",children:i.preco_promocional!==""&&Number(i.preco_promocional)>0&&Number(i.preco)>0&&a.jsxs("p",{className:"text-xs text-emerald-400 font-bold",children:[Math.round((1-Number(i.preco_promocional)/Number(i.preco))*100),"% de desconto"]})})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-black text-slate-400 uppercase tracking-widest mb-1",children:"Categoria"}),a.jsx("input",{value:i.categoria,onChange:f("categoria"),list:"cats",placeholder:"ex: Bebidas",className:"w-full bg-slate-800 border border-slate-700 rounded-xl px-3 py-2 text-sm text-white focus:outline-none focus:border-cyan-500"}),a.jsx("datalist",{id:"cats",children:t.map(h=>a.jsx("option",{className:"bg-slate-900 text-white",value:h},h))})]}),s&&a.jsxs("label",{className:"flex items-center gap-3 cursor-pointer",children:[a.jsx("div",{className:`w-10 h-6 rounded-full transition-colors ${i.ativo?"bg-emerald-500":"bg-slate-700"}`,onClick:()=>o(h=>({...h,ativo:!h.ativo})),children:a.jsx("div",{className:`w-4 h-4 bg-white rounded-full mt-1 transition-all ${i.ativo?"ml-5":"ml-1"}`})}),a.jsx("span",{className:"text-sm text-slate-300 font-medium",children:"Produto ativo"})]})]}),a.jsxs("div",{className:"p-6 border-t border-slate-800 flex gap-3 justify-end",children:[a.jsx("button",{onClick:n,className:"px-4 py-2 text-slate-400 hover:text-white transition-colors text-sm font-bold",children:"Cancelar"}),a.jsxs("button",{onClick:p,disabled:l,className:"px-6 py-2 bg-cyan-500 hover:bg-cyan-400 disabled:opacity-50 rounded-xl text-black font-black text-sm transition-colors flex items-center gap-2",children:[l?a.jsx(ke,{size:14,className:"animate-spin"}):a.jsx(jt,{size:14}),s?"Salvar":"Criar"]})]})]})})}function Eve({onClose:e,onDone:t}){var m;const[n,r]=b.useState(""),[s,i]=b.useState(null),[o,l]=b.useState(!1),[c,u]=b.useState(""),d=b.useRef(null);function f(v){const x=v.trim().split(`
`),y=x[0].split(";").map(g=>g.trim().toLowerCase().replace(/"/g,""));return x.slice(1).map(g=>{const j=g.split(";").map(w=>w.trim().replace(/"/g,"")),N={};return y.forEach((w,S)=>{N[w]=j[S]||""}),N}).filter(g=>g.nome||g.sku)}async function p(){var x,y;if(u(""),i(null),!n.trim())return u("Cole o conteúdo CSV ou carregue um arquivo");const v=f(n);if(!v.length)return u("Nenhum produto válido encontrado no CSV");l(!0);try{const g=await zo.importar(v.map(j=>({sku:j.sku||j.codigo,nome:j.nome||j.descricao,descricao:j.observacao||"",unidade:j.unidade||"un",preco:parseFloat((j.preco||"0").replace(",",".")),estoque:parseFloat((j.estoque||j.quantidade||"0").replace(",",".")),categoria:j.categoria||j.grupo||""})));i(g)}catch(g){u(((y=(x=g.response)==null?void 0:x.data)==null?void 0:y.error)||"Erro na importação")}finally{l(!1)}}function h(v){var g;const x=(g=v.target.files)==null?void 0:g[0];if(!x)return;const y=new FileReader;y.onload=j=>{var N;return r(((N=j.target)==null?void 0:N.result)||"")},y.readAsText(x,"utf-8")}return a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/70 backdrop-blur-sm",children:a.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-3xl w-full max-w-2xl shadow-2xl",children:[a.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-slate-800",children:[a.jsxs("h3",{className:"text-lg font-black text-white flex items-center gap-2",children:[a.jsx(Uf,{size:18,className:"text-cyan-400"})," Importar CSV"]}),a.jsx("button",{onClick:e,className:"text-slate-500 hover:text-white",children:a.jsx(Ce,{size:20})})]}),a.jsxs("div",{className:"p-6 space-y-4",children:[a.jsxs("p",{className:"text-slate-400 text-sm",children:["Colunas esperadas (separadas por ",a.jsx("code",{className:"text-cyan-400 text-xs",children:";"}),"):"]}),a.jsx("code",{className:"block bg-slate-800 rounded-xl px-4 py-3 text-xs text-slate-300",children:"sku;nome;descricao;unidade;preco;estoque;categoria"}),a.jsxs("div",{className:"flex gap-3",children:[a.jsxs("button",{onClick:()=>{var v;return(v=d.current)==null?void 0:v.click()},className:"flex items-center gap-2 px-4 py-2 bg-slate-800 hover:bg-slate-700 rounded-xl text-sm text-slate-300 font-bold transition-colors",children:[a.jsx(Uf,{size:14})," Carregar arquivo"]}),a.jsx("input",{ref:d,type:"file",accept:".csv,.txt",className:"hidden",onChange:h})]}),a.jsx("textarea",{value:n,onChange:v=>r(v.target.value),rows:8,placeholder:"Ou cole o CSV aqui...",className:"w-full bg-slate-800 border border-slate-700 rounded-xl px-3 py-2 text-xs text-slate-300 font-mono focus:outline-none focus:border-cyan-500 resize-none"}),c&&a.jsx("p",{className:"text-rose-400 text-sm bg-rose-400/10 px-3 py-2 rounded-xl",children:c}),s&&a.jsxs("div",{className:"bg-slate-800 rounded-xl p-4 space-y-1 text-sm",children:[a.jsxs("p",{className:"text-emerald-400 font-bold",children:["Inseridos: ",s.inseridos]}),a.jsxs("p",{className:"text-cyan-400 font-bold",children:["Atualizados: ",s.atualizados]}),((m=s.erros)==null?void 0:m.length)>0&&a.jsxs("div",{className:"text-rose-400",children:[a.jsxs("p",{className:"font-bold",children:["Erros (",s.erros.length,"):"]}),a.jsx("ul",{className:"list-disc list-inside text-xs mt-1 space-y-0.5",children:s.erros.map((v,x)=>a.jsxs("li",{children:[v.sku,": ",v.erro]},x))})]})]})]}),a.jsx("div",{className:"p-6 border-t border-slate-800 flex gap-3 justify-end",children:s?a.jsx("button",{onClick:()=>{t(),e()},className:"px-6 py-2 bg-emerald-500 hover:bg-emerald-400 rounded-xl text-black font-black text-sm transition-colors",children:"Concluído"}):a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:e,className:"px-4 py-2 text-slate-400 hover:text-white transition-colors text-sm font-bold",children:"Cancelar"}),a.jsxs("button",{onClick:p,disabled:o,className:"px-6 py-2 bg-cyan-500 hover:bg-cyan-400 disabled:opacity-50 rounded-xl text-black font-black text-sm transition-colors flex items-center gap-2",children:[o?a.jsx(ke,{size:14,className:"animate-spin"}):a.jsx(Uf,{size:14}),"Importar"]})]})})]})})}function Ove(){const[e,t]=b.useState([]),[n,r]=b.useState([]),[s,i]=b.useState(!0),[o,l]=b.useState(""),[c,u]=b.useState(""),[d,f]=b.useState(null),[p,h]=b.useState(null);async function m(){i(!0);try{const[g,j]=await Promise.all([zo.list({search:o||void 0,categoria:c||void 0}),zo.categorias()]);t(g),r(j)}catch(g){console.error(g)}finally{i(!1)}}b.useEffect(()=>{m()},[o,c]);async function v(g){confirm("Remover produto?")&&(await zo.delete(g),m())}const x=e.filter(g=>g.ativo).length,y=e.filter(g=>Number(g.estoque)<=0).length;return a.jsxs("div",{className:"space-y-8 animate-in fade-in slide-in-from-bottom-4 duration-700",children:[a.jsxs("header",{className:"flex flex-wrap justify-between items-start gap-4",children:[a.jsxs("div",{children:[a.jsxs("h2",{className:"text-3xl font-black text-white tracking-tighter flex items-center gap-3",children:[a.jsx(bs,{className:"text-cyan-400",size:28})," Catálogo de Produtos"]}),a.jsxs("p",{className:"text-slate-400 mt-1 font-medium",children:[e.length," produtos · ",x," ativos · ",y," sem estoque"]})]}),a.jsxs("div",{className:"flex gap-3 flex-wrap",children:[a.jsxs("button",{onClick:()=>f("import"),className:"flex items-center gap-2 px-4 py-2 bg-slate-800 hover:bg-slate-700 border border-slate-700 rounded-xl text-sm text-slate-300 font-bold transition-colors",children:[a.jsx(Uf,{size:16})," Importar CSV"]}),a.jsxs("button",{onClick:()=>{h(null),f("new")},className:"flex items-center gap-2 px-4 py-2 bg-cyan-500 hover:bg-cyan-400 rounded-xl text-black font-black text-sm transition-colors",children:[a.jsx(Oe,{size:16})," Novo Produto"]})]})]}),a.jsxs("div",{className:"flex gap-3 flex-wrap",children:[a.jsxs("div",{className:"relative flex-1 min-w-48",children:[a.jsx(Ir,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),a.jsx("input",{value:o,onChange:g=>l(g.target.value),placeholder:"Buscar por nome, SKU...",className:"w-full bg-slate-900 border border-slate-800 rounded-xl pl-9 pr-3 py-2 text-sm text-white focus:outline-none focus:border-cyan-500"})]}),a.jsxs("div",{className:"relative",children:[a.jsx(Xo,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),a.jsxs("select",{value:c,onChange:g=>u(g.target.value),className:"bg-slate-900 border border-slate-800 rounded-xl pl-9 pr-8 py-2 text-sm text-slate-300 focus:outline-none focus:border-cyan-500 appearance-none cursor-pointer",children:[a.jsx("option",{className:"bg-slate-900 text-white",value:"",children:"Todas as categorias"}),n.map(g=>a.jsx("option",{className:"bg-slate-900 text-white",value:g,children:g},g))]}),a.jsx(aa,{size:14,className:"absolute right-3 top-1/2 -translate-y-1/2 text-slate-500 pointer-events-none"})]}),a.jsx("button",{onClick:m,className:"p-2 bg-slate-900 border border-slate-800 rounded-xl text-slate-400 hover:text-white transition-colors",children:a.jsx(ke,{size:16,className:s?"animate-spin":""})})]}),a.jsx("div",{className:"bg-slate-900/40 border border-slate-800 rounded-3xl overflow-hidden",children:a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-slate-800 text-left",children:[a.jsx("th",{className:"px-6 py-4 text-xs font-black text-slate-500 uppercase tracking-widest",children:"Produto"}),a.jsx("th",{className:"px-4 py-4 text-xs font-black text-slate-500 uppercase tracking-widest",children:"SKU"}),a.jsx("th",{className:"px-4 py-4 text-xs font-black text-slate-500 uppercase tracking-widest",children:"Categoria"}),a.jsx("th",{className:"px-4 py-4 text-xs font-black text-slate-500 uppercase tracking-widest text-right",children:"Preço"}),a.jsx("th",{className:"px-4 py-4 text-xs font-black text-slate-500 uppercase tracking-widest text-right",children:"Estoque"}),a.jsx("th",{className:"px-4 py-4 text-xs font-black text-slate-500 uppercase tracking-widest",children:"Status"}),a.jsx("th",{className:"px-4 py-4"})]})}),a.jsx("tbody",{children:s?[...Array(5)].map((g,j)=>a.jsx("tr",{className:"border-b border-slate-800/50 animate-pulse",children:[...Array(7)].map((N,w)=>a.jsx("td",{className:"px-4 py-4",children:a.jsx("div",{className:"h-4 bg-slate-800 rounded w-full"})},w))},j)):e.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:7,className:"px-6 py-16 text-center text-slate-600 text-sm italic",children:"Nenhum produto encontrado. Importe um CSV ou crie manualmente."})}):e.map(g=>a.jsxs("tr",{className:"border-b border-slate-800/50 hover:bg-slate-800/20 transition-colors group",children:[a.jsx("td",{className:"px-6 py-4",children:a.jsxs("div",{children:[a.jsx("p",{className:"font-bold text-white",children:g.nome}),g.descricao&&a.jsx("p",{className:"text-xs text-slate-500 truncate max-w-48",children:g.descricao})]})}),a.jsx("td",{className:"px-4 py-4 text-slate-400 font-mono text-xs",children:g.sku||"—"}),a.jsx("td",{className:"px-4 py-4",children:g.categoria?a.jsx(JC,{color:"cyan",children:g.categoria}):a.jsx("span",{className:"text-slate-600 text-xs",children:"—"})}),a.jsx("td",{className:"px-4 py-4 text-right tabular-nums",children:g.preco_promocional?a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"text-xs text-slate-500 line-through",children:tg(g.preco)}),a.jsx("p",{className:"font-bold text-emerald-400",children:tg(g.preco_promocional)})]}):a.jsx("span",{className:"font-bold text-white",children:tg(g.preco)})}),a.jsx("td",{className:"px-4 py-4 text-right tabular-nums",children:a.jsxs("span",{className:`font-bold ${Number(g.estoque)<=0?"text-rose-400":Number(g.estoque)<5?"text-yellow-400":"text-slate-300"}`,children:[Number(g.estoque).toLocaleString("pt-BR")," ",g.unidade]})}),a.jsx("td",{className:"px-4 py-4",children:a.jsx(JC,{color:g.ativo?"emerald":"rose",children:g.ativo?"Ativo":"Inativo"})}),a.jsx("td",{className:"px-4 py-4",children:a.jsxs("div",{className:"flex gap-2 opacity-0 group-hover:opacity-100 transition-opacity justify-end",children:[a.jsx("button",{onClick:()=>{h(g),f("edit")},className:"p-2 rounded-lg bg-slate-800 hover:bg-slate-700 text-slate-400 hover:text-white transition-colors",children:a.jsx(HP,{size:14})}),a.jsx("button",{onClick:()=>v(g.id),className:"p-2 rounded-lg bg-slate-800 hover:bg-rose-500/20 text-slate-400 hover:text-rose-400 transition-colors",children:a.jsx(Te,{size:14})})]})})]},g.id))})]})})}),!s&&e.length>0&&a.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[{label:"Total",value:e.length,icon:bs,color:"text-cyan-400"},{label:"Ativos",value:x,icon:jt,color:"text-emerald-400"},{label:"Sem estoque",value:y,icon:yu,color:"text-rose-400"},{label:"Categorias",value:n.length,icon:Xo,color:"text-purple-400"}].map(g=>a.jsxs("div",{className:"bg-slate-900/40 border border-slate-800 rounded-2xl p-4 flex items-center gap-3",children:[a.jsx(g.icon,{size:20,className:g.color}),a.jsxs("div",{children:[a.jsx("p",{className:"text-xs font-black text-slate-500 uppercase tracking-widest",children:g.label}),a.jsx("p",{className:"text-xl font-black text-white tabular-nums",children:g.value})]})]},g.label))}),(d==="new"||d==="edit")&&a.jsx(Pve,{produto:d==="edit"?p:null,categorias:n,onClose:()=>f(null),onSave:()=>{f(null),m()}}),d==="import"&&a.jsx(Eve,{onClose:()=>f(null),onDone:m})]})}function Xa({children:e,color:t="slate"}){const n={emerald:"bg-emerald-400/10 text-emerald-400 border-emerald-400/20",rose:"bg-rose-400/10 text-rose-400 border-rose-400/20",cyan:"bg-cyan-400/10 text-cyan-400 border-cyan-400/20",purple:"bg-purple-400/10 text-purple-400 border-purple-400/20",slate:"bg-slate-800 text-slate-400 border-slate-700"};return a.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded-lg text-[10px] font-black uppercase tracking-widest border ${n[t]||n.slate}`,children:e})}function Yt({label:e,...t}){return a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-black text-slate-500 uppercase tracking-widest mb-1",children:e}),a.jsx("input",{...t,className:"w-full bg-slate-800 border border-slate-700 rounded-xl px-3 py-2 text-sm text-white focus:outline-none focus:border-cyan-500 placeholder:text-slate-600 disabled:opacity-50"})]})}function ng({label:e,children:t,...n}){return a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-black text-slate-500 uppercase tracking-widest mb-1",children:e}),a.jsx("select",{...n,className:"w-full bg-slate-800 border border-slate-700 rounded-xl px-3 py-2 text-sm text-white focus:outline-none focus:border-cyan-500 appearance-none cursor-pointer",children:t})]})}const Tve=e=>e.replace(/\D/g,"").slice(0,11).replace(/(\d{3})(\d)/,"$1.$2").replace(/(\d{3})(\d)/,"$1.$2").replace(/(\d{3})(\d{1,2})$/,"$1-$2"),$ve=e=>e.replace(/\D/g,"").slice(0,14).replace(/(\d{2})(\d)/,"$1.$2").replace(/(\d{3})(\d)/,"$1.$2").replace(/(\d{3})(\d)/,"$1/$2").replace(/(\d{4})(\d{1,2})$/,"$1-$2");async function Mve(e){const t=e.replace(/\D/g,"");if(t.length!==8)return null;try{const r=await(await fetch(`https://viacep.com.br/ws/${t}/json/`)).json();return r.erro?null:r}catch{return null}}function Rve({cliente:e,onClose:t,onSave:n}){const r=!!e,[s,i]=b.useState("dados"),[o,l]=b.useState(!1),[c,u]=b.useState(""),[d,f]=b.useState((e==null?void 0:e.tipo)||"PF"),[p,h]=b.useState((e==null?void 0:e.nome)||""),[m,v]=b.useState((e==null?void 0:e.cpf_cnpj)||""),[x,y]=b.useState((e==null?void 0:e.email)||""),[g,j]=b.useState((e==null?void 0:e.status)||"ativo"),[N,w]=b.useState([]),[S,k]=b.useState(!1),[C,_]=b.useState({tipo:"entrega",cep:"",rua:"",numero:"",complemento:"",bairro:"",cidade:"",estado:"",referencia:"",principal:!1}),[A,E]=b.useState([]),[P,D]=b.useState({tipo:"celular",numero:"",ramal:"",aceita_whatsapp:!1,principal:!1}),[I,R]=b.useState([]),[M,W]=b.useState({nome:"",cargo:"",setor:"",email:"",permissao:""});b.useEffect(()=>{!r||!(e!=null&&e.id)||(s==="enderecos"&&N.length===0&&(k(!0),Qt.listEnderecos(e.id).then(w).finally(()=>k(!1))),s==="telefones"&&A.length===0&&Qt.listTelefones(e.id).then(E),s==="responsaveis"&&I.length===0&&Qt.listResponsaveis(e.id).then(R))},[s]);async function T(){var H,le;if(u(""),!p.trim())return u("Nome é obrigatório");if(!m.trim())return u("CPF/CNPJ é obrigatório");l(!0);try{const Z={tipo:d,nome:p.trim(),cpf_cnpj:m.replace(/\D/g,""),email:x,status:g};r?await Qt.update(e.id,Z):await Qt.create(Z),n()}catch(Z){u(((le=(H=Z.response)==null?void 0:H.data)==null?void 0:le.error)||"Erro ao salvar")}finally{l(!1)}}async function V(){const H=await Mve(C.cep);H&&_(le=>({...le,rua:H.logradouro,bairro:H.bairro,cidade:H.localidade,estado:H.uf}))}async function X(){if(!C.rua)return;await Qt.addEndereco(e.id,C);const H=await Qt.listEnderecos(e.id);w(H),_({tipo:"entrega",cep:"",rua:"",numero:"",complemento:"",bairro:"",cidade:"",estado:"",referencia:"",principal:!1})}async function U(H){await Qt.deleteEndereco(e.id,H),w(le=>le.filter(Z=>Z.id!==H))}async function L(){if(!P.numero)return;await Qt.addTelefone(e.id,P);const H=await Qt.listTelefones(e.id);E(H),D({tipo:"celular",numero:"",ramal:"",aceita_whatsapp:!1,principal:!1})}async function B(H){await Qt.deleteTelefone(e.id,H),E(le=>le.filter(Z=>Z.id!==H))}async function ae(){if(!M.nome)return;await Qt.addResponsavel(e.id,M);const H=await Qt.listResponsaveis(e.id);R(H),W({nome:"",cargo:"",setor:"",email:"",permissao:""})}async function se(H){await Qt.deleteResponsavel(e.id,H),R(le=>le.filter(Z=>Z.id!==H))}const xe=[{id:"dados",label:"Dados Gerais",icon:ks},{id:"enderecos",label:"Endereços",icon:gm,disabled:!r},{id:"telefones",label:"Telefones",icon:wu,disabled:!r},{id:"responsaveis",label:"Responsáveis",icon:Tl,disabled:!r}];return a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/70 backdrop-blur-sm",children:a.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-3xl w-full max-w-2xl shadow-2xl flex flex-col max-h-[90vh]",children:[a.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-slate-800 shrink-0",children:[a.jsx("h3",{className:"text-lg font-black text-white",children:r?"Editar Cliente":"Novo Cliente"}),a.jsx("button",{onClick:t,className:"text-slate-500 hover:text-white transition-colors",children:a.jsx(Ce,{size:20})})]}),a.jsx("div",{className:"flex border-b border-slate-800 px-6 shrink-0 overflow-x-auto",children:xe.map(H=>a.jsxs("button",{onClick:()=>!H.disabled&&i(H.id),disabled:H.disabled,className:`flex items-center gap-2 px-4 py-3 text-xs font-black uppercase tracking-widest border-b-2 transition-colors whitespace-nowrap
${s===H.id?"border-cyan-500 text-cyan-400":H.disabled?"border-transparent text-slate-700 cursor-not-allowed":"border-transparent text-slate-500 hover:text-slate-300"}`,children:[a.jsx(H.icon,{size:14}),H.label,H.disabled&&a.jsx("span",{className:"text-[9px] text-slate-700",children:"(salve primeiro)"})]},H.id))}),a.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:[c&&a.jsx("p",{className:"text-rose-400 text-sm bg-rose-400/10 px-3 py-2 rounded-xl",children:c}),s==="dados"&&a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{className:"flex gap-3",children:["PF","PJ"].map(H=>a.jsxs("button",{onClick:()=>f(H),className:`flex-1 flex items-center justify-center gap-2 py-3 rounded-xl border font-black text-sm transition-colors
${d===H?"border-cyan-500 bg-cyan-500/10 text-cyan-400":"border-slate-700 text-slate-500 hover:border-slate-600"}`,children:[H==="PF"?a.jsx(ks,{size:16}):a.jsx(f1,{size:16}),H==="PF"?"Pessoa Física":"Pessoa Jurídica"]},H))}),a.jsx(Yt,{label:d==="PF"?"Nome completo *":"Razão Social *",value:p,onChange:H=>h(H.target.value),placeholder:d==="PF"?"João da Silva":"Empresa Ltda"}),a.jsx(Yt,{label:d==="PF"?"CPF *":"CNPJ *",value:d==="PF"?Tve(m):$ve(m),onChange:H=>v(H.target.value),placeholder:d==="PF"?"000.000.000-00":"00.000.000/0000-00"}),a.jsx(Yt,{label:"E-mail",type:"email",value:x,onChange:H=>y(H.target.value),placeholder:"email@exemplo.com"}),r&&a.jsxs(ng,{label:"Status",value:g,onChange:H=>j(H.target.value),children:[a.jsx("option",{className:"bg-slate-900 text-white",value:"ativo",children:"Ativo"}),a.jsx("option",{className:"bg-slate-900 text-white",value:"inativo",children:"Inativo"})]})]}),s==="enderecos"&&a.jsx("div",{className:"space-y-4",children:S?a.jsx("p",{className:"text-slate-500 text-sm",children:"Carregando..."}):a.jsxs(a.Fragment,{children:[N.map(H=>a.jsxs("div",{className:"bg-slate-800/60 border border-slate-700 rounded-xl p-4 flex items-start justify-between gap-3",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[a.jsx(Xa,{color:"cyan",children:H.tipo}),H.principal&&a.jsx(Xa,{color:"emerald",children:"Principal"})]}),a.jsxs("p",{className:"text-sm text-white font-medium",children:[H.rua,", ",H.numero," ",H.complemento||""]}),a.jsxs("p",{className:"text-xs text-slate-400",children:[H.bairro," — ",H.cidade,"/",H.estado," · CEP ",H.cep]}),H.referencia&&a.jsxs("p",{className:"text-xs text-slate-500 mt-0.5",children:["Ref: ",H.referencia]})]}),a.jsx("button",{onClick:()=>U(H.id),className:"p-1.5 text-slate-600 hover:text-rose-400 transition-colors shrink-0",children:a.jsx(Te,{size:14})})]},H.id)),a.jsxs("div",{className:"bg-slate-800/30 border border-dashed border-slate-700 rounded-xl p-4 space-y-3",children:[a.jsx("p",{className:"text-xs font-black text-slate-500 uppercase tracking-widest",children:"Adicionar endereço"}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsx(ng,{label:"Tipo",value:C.tipo,onChange:H=>_(le=>({...le,tipo:H.target.value})),children:["entrega","cobranca","retirada","matriz","filial"].map(H=>a.jsx("option",{className:"bg-slate-900 text-white",children:H},H))}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-black text-slate-500 uppercase tracking-widest mb-1",children:"CEP"}),a.jsx("div",{className:"flex gap-2",children:a.jsx("input",{value:C.cep,onChange:H=>_(le=>({...le,cep:H.target.value})),onBlur:V,placeholder:"00000-000",className:"flex-1 bg-slate-800 border border-slate-700 rounded-xl px-3 py-2 text-sm text-white focus:outline-none focus:border-cyan-500"})})]})]}),a.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[a.jsx("div",{className:"col-span-2",children:a.jsx(Yt,{label:"Rua",value:C.rua,onChange:H=>_(le=>({...le,rua:H.target.value})),placeholder:"Rua..."})}),a.jsx(Yt,{label:"Número",value:C.numero,onChange:H=>_(le=>({...le,numero:H.target.value})),placeholder:"123"})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsx(Yt,{label:"Bairro",value:C.bairro,onChange:H=>_(le=>({...le,bairro:H.target.value})),placeholder:"Bairro"}),a.jsx(Yt,{label:"Cidade",value:C.cidade,onChange:H=>_(le=>({...le,cidade:H.target.value})),placeholder:"Cidade"})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsx(Yt,{label:"Estado (UF)",value:C.estado,onChange:H=>_(le=>({...le,estado:H.target.value.toUpperCase().slice(0,2)})),placeholder:"SP"}),a.jsx(Yt,{label:"Complemento",value:C.complemento,onChange:H=>_(le=>({...le,complemento:H.target.value})),placeholder:"Apto, bloco..."})]}),a.jsx(Yt,{label:"Referência",value:C.referencia,onChange:H=>_(le=>({...le,referencia:H.target.value})),placeholder:"Próximo ao mercado..."}),a.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:C.principal,onChange:H=>_(le=>({...le,principal:H.target.checked})),className:"accent-cyan-500"}),a.jsx("span",{className:"text-sm text-slate-300",children:"Definir como endereço principal"})]}),a.jsxs("button",{onClick:X,className:"px-4 py-2 bg-cyan-500 hover:bg-cyan-400 rounded-xl text-black font-black text-sm transition-colors flex items-center gap-2",children:[a.jsx(Oe,{size:14})," Adicionar"]})]})]})}),s==="telefones"&&a.jsxs("div",{className:"space-y-4",children:[A.map(H=>a.jsxs("div",{className:"bg-slate-800/60 border border-slate-700 rounded-xl p-4 flex items-center justify-between gap-3",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(wu,{size:16,className:"text-slate-500"}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Xa,{color:"cyan",children:H.tipo}),H.principal&&a.jsx(Xa,{color:"emerald",children:"Principal"}),H.aceita_whatsapp&&a.jsx(Xa,{color:"purple",children:"WhatsApp"})]}),a.jsxs("p",{className:"text-sm text-white font-medium mt-1",children:[H.numero,H.ramal?` · Ramal ${H.ramal}`:""]})]})]}),a.jsx("button",{onClick:()=>B(H.id),className:"p-1.5 text-slate-600 hover:text-rose-400 transition-colors",children:a.jsx(Te,{size:14})})]},H.id)),a.jsxs("div",{className:"bg-slate-800/30 border border-dashed border-slate-700 rounded-xl p-4 space-y-3",children:[a.jsx("p",{className:"text-xs font-black text-slate-500 uppercase tracking-widest",children:"Adicionar telefone"}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsx(ng,{label:"Tipo",value:P.tipo,onChange:H=>D(le=>({...le,tipo:H.target.value})),children:["celular","comercial","whatsapp","financeiro","compras"].map(H=>a.jsx("option",{className:"bg-slate-900 text-white",children:H},H))}),a.jsx(Yt,{label:"Número",value:P.numero,onChange:H=>D(le=>({...le,numero:H.target.value})),placeholder:"(11) 99999-9999"})]}),a.jsxs("div",{className:"flex gap-4",children:[a.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:P.aceita_whatsapp,onChange:H=>D(le=>({...le,aceita_whatsapp:H.target.checked})),className:"accent-cyan-500"}),a.jsx("span",{className:"text-sm text-slate-300",children:"Aceita WhatsApp"})]}),a.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:P.principal,onChange:H=>D(le=>({...le,principal:H.target.checked})),className:"accent-cyan-500"}),a.jsx("span",{className:"text-sm text-slate-300",children:"Principal"})]})]}),a.jsxs("button",{onClick:L,className:"px-4 py-2 bg-cyan-500 hover:bg-cyan-400 rounded-xl text-black font-black text-sm transition-colors flex items-center gap-2",children:[a.jsx(Oe,{size:14})," Adicionar"]})]})]}),s==="responsaveis"&&a.jsxs("div",{className:"space-y-4",children:[d==="PF"&&a.jsx("p",{className:"text-slate-500 text-xs italic",children:"PF normalmente tem 1 responsável (o próprio titular)."}),I.map(H=>a.jsxs("div",{className:"bg-slate-800/60 border border-slate-700 rounded-xl p-4 flex items-start justify-between gap-3",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-bold text-white",children:H.nome}),a.jsx("p",{className:"text-xs text-slate-400",children:[H.cargo,H.setor].filter(Boolean).join(" · ")}),H.email&&a.jsx("p",{className:"text-xs text-slate-500",children:H.email}),H.permissao&&a.jsx(Xa,{color:"purple",children:H.permissao})]}),a.jsx("button",{onClick:()=>se(H.id),className:"p-1.5 text-slate-600 hover:text-rose-400 transition-colors shrink-0",children:a.jsx(Te,{size:14})})]},H.id)),a.jsxs("div",{className:"bg-slate-800/30 border border-dashed border-slate-700 rounded-xl p-4 space-y-3",children:[a.jsx("p",{className:"text-xs font-black text-slate-500 uppercase tracking-widest",children:"Adicionar responsável"}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsx(Yt,{label:"Nome *",value:M.nome,onChange:H=>W(le=>({...le,nome:H.target.value})),placeholder:"Nome do responsável"}),a.jsx(Yt,{label:"Cargo",value:M.cargo,onChange:H=>W(le=>({...le,cargo:H.target.value})),placeholder:"Gerente, Comprador..."})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsx(Yt,{label:"Setor",value:M.setor,onChange:H=>W(le=>({...le,setor:H.target.value})),placeholder:"Financeiro, Compras..."}),a.jsx(Yt,{label:"E-mail",type:"email",value:M.email,onChange:H=>W(le=>({...le,email:H.target.value})),placeholder:"email@empresa.com"})]}),a.jsx(Yt,{label:"Permissão",value:M.permissao,onChange:H=>W(le=>({...le,permissao:H.target.value})),placeholder:"compras, financeiro, recebimento..."}),a.jsxs("button",{onClick:ae,className:"px-4 py-2 bg-cyan-500 hover:bg-cyan-400 rounded-xl text-black font-black text-sm transition-colors flex items-center gap-2",children:[a.jsx(Oe,{size:14})," Adicionar"]})]})]})]}),a.jsxs("div",{className:"p-6 border-t border-slate-800 flex gap-3 justify-end shrink-0",children:[a.jsx("button",{onClick:t,className:"px-4 py-2 text-slate-400 hover:text-white transition-colors text-sm font-bold",children:"Fechar"}),s==="dados"&&a.jsxs("button",{onClick:T,disabled:o,className:"px-6 py-2 bg-cyan-500 hover:bg-cyan-400 disabled:opacity-50 rounded-xl text-black font-black text-sm transition-colors flex items-center gap-2",children:[o?a.jsx(ke,{size:14,className:"animate-spin"}):a.jsx(jt,{size:14}),r?"Salvar":"Criar e continuar"]})]})]})})}function Dve(){const[e,t]=b.useState([]),[n,r]=b.useState(!0),[s,i]=b.useState(""),[o,l]=b.useState(""),[c,u]=b.useState("ativo"),[d,f]=b.useState(null),[p,h]=b.useState(null),[m,v]=b.useState(0),x=50;async function y(){r(!0);try{const j=await Qt.list({search:s||void 0,tipo:o||void 0,status:c||void 0,limit:x,offset:m*x});t(j)}catch(j){console.error(j)}finally{r(!1)}}b.useEffect(()=>{y()},[s,o,c,m]);async function g(j){confirm("Remover cliente?")&&(await Qt.delete(j),y())}return a.jsxs("div",{className:"space-y-8 animate-in fade-in slide-in-from-bottom-4 duration-700",children:[a.jsxs("header",{className:"flex flex-wrap justify-between items-start gap-4",children:[a.jsxs("div",{children:[a.jsxs("h2",{className:"text-3xl font-black text-white tracking-tighter flex items-center gap-3",children:[a.jsx(et,{className:"text-cyan-400",size:28})," Clientes"]}),a.jsx("p",{className:"text-slate-400 mt-1 font-medium",children:"Cadastro PF e PJ · endereços · telefones · responsáveis"})]}),a.jsxs("button",{onClick:()=>{h(null),f("new")},className:"flex items-center gap-2 px-4 py-2 bg-cyan-500 hover:bg-cyan-400 rounded-xl text-black font-black text-sm transition-colors",children:[a.jsx(Oe,{size:16})," Novo Cliente"]})]}),a.jsxs("div",{className:"flex gap-3 flex-wrap",children:[a.jsxs("div",{className:"relative flex-1 min-w-48",children:[a.jsx(Ir,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),a.jsx("input",{value:s,onChange:j=>{i(j.target.value),v(0)},placeholder:"Buscar por nome, CPF, CNPJ, e-mail...",className:"w-full bg-slate-900 border border-slate-800 rounded-xl pl-9 pr-3 py-2 text-sm text-white focus:outline-none focus:border-cyan-500"})]}),a.jsxs("div",{className:"relative",children:[a.jsxs("select",{value:o,onChange:j=>{l(j.target.value),v(0)},className:"bg-slate-900 border border-slate-800 rounded-xl px-3 py-2 text-sm text-slate-300 focus:outline-none focus:border-cyan-500 appearance-none cursor-pointer pr-8",children:[a.jsx("option",{className:"bg-slate-900 text-white",value:"",children:"PF + PJ"}),a.jsx("option",{className:"bg-slate-900 text-white",value:"PF",children:"Pessoa Física"}),a.jsx("option",{className:"bg-slate-900 text-white",value:"PJ",children:"Pessoa Jurídica"})]}),a.jsx(aa,{size:14,className:"absolute right-2 top-1/2 -translate-y-1/2 text-slate-500 pointer-events-none"})]}),a.jsxs("div",{className:"relative",children:[a.jsxs("select",{value:c,onChange:j=>{u(j.target.value),v(0)},className:"bg-slate-900 border border-slate-800 rounded-xl px-3 py-2 text-sm text-slate-300 focus:outline-none focus:border-cyan-500 appearance-none cursor-pointer pr-8",children:[a.jsx("option",{className:"bg-slate-900 text-white",value:"",children:"Todos"}),a.jsx("option",{className:"bg-slate-900 text-white",value:"ativo",children:"Ativos"}),a.jsx("option",{className:"bg-slate-900 text-white",value:"inativo",children:"Inativos"})]}),a.jsx(aa,{size:14,className:"absolute right-2 top-1/2 -translate-y-1/2 text-slate-500 pointer-events-none"})]}),a.jsx("button",{onClick:y,className:"p-2 bg-slate-900 border border-slate-800 rounded-xl text-slate-400 hover:text-white transition-colors",children:a.jsx(ke,{size:16,className:n?"animate-spin":""})})]}),a.jsxs("div",{className:"bg-slate-900/40 border border-slate-800 rounded-3xl overflow-hidden",children:[a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-slate-800 text-left",children:[a.jsx("th",{className:"px-6 py-4 text-xs font-black text-slate-500 uppercase tracking-widest",children:"Cliente"}),a.jsx("th",{className:"px-4 py-4 text-xs font-black text-slate-500 uppercase tracking-widest",children:"Tipo"}),a.jsx("th",{className:"px-4 py-4 text-xs font-black text-slate-500 uppercase tracking-widest",children:"CPF / CNPJ"}),a.jsx("th",{className:"px-4 py-4 text-xs font-black text-slate-500 uppercase tracking-widest",children:"E-mail"}),a.jsx("th",{className:"px-4 py-4 text-xs font-black text-slate-500 uppercase tracking-widest",children:"Status"}),a.jsx("th",{className:"px-4 py-4"})]})}),a.jsx("tbody",{children:n?[...Array(6)].map((j,N)=>a.jsx("tr",{className:"border-b border-slate-800/50 animate-pulse",children:[...Array(6)].map((w,S)=>a.jsx("td",{className:"px-4 py-4",children:a.jsx("div",{className:"h-4 bg-slate-800 rounded w-full"})},S))},N)):e.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:6,className:"px-6 py-16 text-center text-slate-600 text-sm italic",children:"Nenhum cliente encontrado."})}):e.map(j=>a.jsxs("tr",{className:"border-b border-slate-800/50 hover:bg-slate-800/20 transition-colors group",children:[a.jsx("td",{className:"px-6 py-4",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:`w-9 h-9 rounded-xl flex items-center justify-center shrink-0 ${j.tipo==="PJ"?"bg-purple-400/10 text-purple-400":"bg-cyan-400/10 text-cyan-400"}`,children:j.tipo==="PJ"?a.jsx(f1,{size:16}):a.jsx(ks,{size:16})}),a.jsx("span",{className:"font-bold text-white",children:j.nome})]})}),a.jsx("td",{className:"px-4 py-4",children:a.jsx(Xa,{color:j.tipo==="PJ"?"purple":"cyan",children:j.tipo})}),a.jsx("td",{className:"px-4 py-4 font-mono text-xs text-slate-400",children:j.cpf_cnpj}),a.jsx("td",{className:"px-4 py-4 text-slate-400 text-xs",children:j.email||"—"}),a.jsx("td",{className:"px-4 py-4",children:a.jsx(Xa,{color:j.status==="ativo"?"emerald":"rose",children:j.status})}),a.jsx("td",{className:"px-4 py-4",children:a.jsxs("div",{className:"flex gap-2 opacity-0 group-hover:opacity-100 transition-opacity justify-end",children:[a.jsx("button",{onClick:()=>{h(j),f("edit")},className:"p-2 rounded-lg bg-slate-800 hover:bg-slate-700 text-slate-400 hover:text-white transition-colors",title:"Editar",children:a.jsx(HP,{size:14})}),a.jsx("button",{onClick:()=>g(j.id),className:"p-2 rounded-lg bg-slate-800 hover:bg-rose-500/20 text-slate-400 hover:text-rose-400 transition-colors",title:"Remover",children:a.jsx(Te,{size:14})})]})})]},j.id))})]})}),e.length>0&&a.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-t border-slate-800",children:[a.jsxs("span",{className:"text-xs text-slate-500",children:[m*x+1,"",m*x+e.length]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:()=>v(j=>Math.max(0,j-1)),disabled:m===0,className:"p-2 rounded-lg bg-slate-800 disabled:opacity-30 text-slate-400 hover:text-white transition-colors",children:a.jsx(xd,{size:16})}),a.jsx("button",{onClick:()=>v(j=>j+1),disabled:e.length<x,className:"p-2 rounded-lg bg-slate-800 disabled:opacity-30 text-slate-400 hover:text-white transition-colors",children:a.jsx(Pa,{size:16})})]})]})]}),(d==="new"||d==="edit")&&a.jsx(Rve,{cliente:d==="edit"?p:null,onClose:()=>f(null),onSave:()=>{d==="new"&&f(null),y()}})]})}const ZC={online:"bg-emerald-400",busy:"bg-amber-400",offline:"bg-slate-600"},e_={online:"Disponível",busy:"Ocupado",offline:"Offline"};function t_(e){const t=e.availability==="online"?0:e.availability==="busy"?2:4,n=e.on_duty?0:1;return t+n}function Ive(e){if(!e)return"";const t=Math.floor((Date.now()-new Date(e).getTime())/6e4);if(t<1)return"agora";if(t<60)return`há ${t}min`;const n=Math.floor(t/60);return n<24?`há ${n}h`:`há ${Math.floor(n/24)}d`}function wc({funcao:e,value:t,onChange:n,allowSelf:r,accentColor:s="cyan"}){const[i,o]=b.useState(null),[l,c]=b.useState(!0),[u,d]=b.useState(""),[f,p]=b.useState(!1);b.useEffect(()=>{let y=!0;return c(!0),pt.listColaboradores(e).then(g=>{y&&o(g)}).catch(()=>{y&&o({configurado:!1,colaboradores:[]})}).finally(()=>{y&&c(!1)}),()=>{y=!1}},[e]);const h=b.useMemo(()=>{const y=((i==null?void 0:i.colaboradores)||[]).slice().sort((j,N)=>{const w=t_(j)-t_(N);return w!==0?w:j.pedidos_ativos-N.pedidos_ativos});if(!u.trim())return y;const g=u.toLowerCase();return y.filter(j=>j.name.toLowerCase().includes(g)||(j.email||"").toLowerCase().includes(g))},[i,u]),m=(i==null?void 0:i.colaboradores.find(y=>y.id===t))||null,x={cyan:{ring:"focus:border-cyan-500",bg:"bg-cyan-500/10",text:"text-cyan-400",border:"border-cyan-500/30"},purple:{ring:"focus:border-purple-500",bg:"bg-purple-500/10",text:"text-purple-400",border:"border-purple-500/30"},orange:{ring:"focus:border-orange-500",bg:"bg-orange-500/10",text:"text-orange-400",border:"border-orange-500/30"},teal:{ring:"focus:border-teal-500",bg:"bg-teal-500/10",text:"text-teal-400",border:"border-teal-500/30"},emerald:{ring:"focus:border-emerald-500",bg:"bg-emerald-500/10",text:"text-emerald-400",border:"border-emerald-500/30"}}[s];return!l&&i&&i.colaboradores.length===0?a.jsx("div",{className:"bg-amber-500/10 border border-amber-500/30 rounded-2xl p-4 space-y-2",children:a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx(Kt,{size:14,className:"text-amber-400 shrink-0 mt-0.5"}),a.jsxs("div",{className:"flex-1",children:[a.jsxs("p",{className:"text-xs font-black text-amber-400 uppercase tracking-widest",children:['Nenhum colaborador para "',e,'"']}),a.jsxs("p",{className:"text-xs text-amber-400/80 mt-1",children:["Vincule colaboradores ao setor correspondente em ",a.jsx("strong",{children:"Equipe → editar colaborador"}),"."]}),i.setores_aceitos&&a.jsxs("p",{className:"text-xs text-amber-400/60 mt-1",children:["Setores aceitos: ",a.jsx("strong",{children:i.setores_aceitos.join(", ")})]})]})]})}):a.jsxs("div",{className:"space-y-2",children:[a.jsx("button",{type:"button",onClick:()=>p(y=>!y),className:`w-full bg-slate-800 border border-slate-700 rounded-xl px-3 py-2.5 text-left transition-colors hover:border-slate-600 ${x.ring}`,children:m?a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsxs("div",{className:"relative shrink-0",children:[m.avatar_url?a.jsx("img",{src:m.avatar_url,alt:"",className:"w-8 h-8 rounded-full object-cover"}):a.jsx("div",{className:"w-8 h-8 rounded-full bg-slate-700 flex items-center justify-center",children:a.jsx(Jx,{size:20,className:"text-slate-500"})}),a.jsx("span",{className:`absolute -bottom-0.5 -right-0.5 w-2.5 h-2.5 rounded-full ring-2 ring-slate-800 ${ZC[m.availability]}`})]}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-sm font-bold text-white truncate",children:m.name}),a.jsxs("p",{className:"text-[10px] text-slate-500",children:[e_[m.availability]," · ",m.pedidos_ativos," ativos"]})]}),a.jsx(jt,{size:14,className:x.text})]}):a.jsxs("div",{className:"flex items-center gap-2 text-slate-500",children:[a.jsx(Jx,{size:18}),a.jsx("span",{className:"text-sm",children:"Selecionar colaborador…"})]})}),r&&!m&&a.jsx("button",{type:"button",onClick:()=>n(r.id,r.nome),className:`w-full text-xs font-bold py-2 rounded-xl border ${x.bg} ${x.text} ${x.border} hover:opacity-80 transition-opacity`,children:"Atribuir a mim mesmo"}),f&&a.jsxs("div",{className:"bg-slate-900 border border-slate-700 rounded-xl overflow-hidden",children:[a.jsx("div",{className:"p-2 border-b border-slate-800",children:a.jsxs("div",{className:"relative",children:[a.jsx(Ir,{size:12,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-slate-500"}),a.jsx("input",{value:u,onChange:y=>d(y.target.value),placeholder:"Buscar por nome ou email…",className:"w-full bg-slate-800 border border-slate-700 rounded-lg pl-7 pr-2 py-1.5 text-xs text-white focus:outline-none focus:border-slate-500",autoFocus:!0})]})}),l?a.jsx("div",{className:"py-6 text-center text-xs text-slate-500",children:"Carregando…"}):h.length===0?a.jsx("div",{className:"py-6 text-center text-xs text-slate-500",children:u?"Nenhum colaborador encontrado":"Nenhum colaborador na equipe"}):a.jsx("ul",{className:"max-h-64 overflow-y-auto",children:h.map(y=>{const g=t===y.id;return a.jsx("li",{children:a.jsxs("button",{type:"button",onClick:()=>{n(y.id,y.name),p(!1),d("")},className:`w-full flex items-center gap-2.5 px-3 py-2 text-left transition-colors hover:bg-slate-800/60 ${g?"bg-slate-800":""}`,children:[a.jsxs("div",{className:"relative shrink-0",children:[y.avatar_url?a.jsx("img",{src:y.avatar_url,alt:"",className:"w-7 h-7 rounded-full object-cover"}):a.jsx("div",{className:"w-7 h-7 rounded-full bg-slate-700 flex items-center justify-center",children:a.jsx(Jx,{size:16,className:"text-slate-500"})}),a.jsx("span",{className:`absolute -bottom-0.5 -right-0.5 w-2 h-2 rounded-full ring-2 ring-slate-900 ${ZC[y.availability]}`})]}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("p",{className:"text-xs font-bold text-white truncate",children:y.name}),y.on_duty&&a.jsx("span",{className:"text-[9px] font-black text-emerald-400 bg-emerald-500/10 px-1 rounded",children:"PLANTÃO"})]}),a.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-slate-500 mt-0.5",children:[a.jsx("span",{children:e_[y.availability]}),a.jsx("span",{children:"·"}),a.jsxs("span",{className:y.pedidos_ativos>0?"text-amber-400":"",children:[y.pedidos_ativos," ativos"]}),y.ultimo_pedido_em&&a.jsxs(a.Fragment,{children:[a.jsx("span",{children:"·"}),a.jsxs("span",{className:"flex items-center gap-0.5",children:[a.jsx(hn,{size:8}),Ive(y.ultimo_pedido_em)]})]})]})]}),g&&a.jsx(jt,{size:14,className:x.text})]})},y.id)})}),m&&a.jsx("div",{className:"p-2 border-t border-slate-800",children:a.jsx("button",{type:"button",onClick:()=>{n(null),p(!1)},className:"w-full text-[11px] text-slate-500 hover:text-rose-400 transition-colors py-1",children:"Limpar seleção"})})]})]})}const Xn=[{id:"aguardando",label:"Aguardando",icon:hn,color:"yellow"},{id:"separacao",label:"Separação",icon:bu,color:"blue"},{id:"embalagem",label:"Embalagem",icon:Mp,color:"purple"},{id:"auditoria",label:"Auditoria",icon:Pi,color:"orange"},{id:"fiscal",label:"Fiscal",icon:Hr,color:"cyan"},{id:"expedicao",label:"Expedição",icon:Nu,color:"teal"},{id:"entregue",label:"Entregue",icon:nn,color:"emerald"},{id:"cancelado",label:"Cancelado",icon:Ar,color:"rose"}],Yn={yellow:{badge:"bg-yellow-400/10 text-yellow-400",bg:"bg-yellow-400/5",border:"border-yellow-400/20",text:"text-yellow-400"},blue:{badge:"bg-blue-400/10 text-blue-400",bg:"bg-blue-400/5",border:"border-blue-400/20",text:"text-blue-400"},purple:{badge:"bg-purple-400/10 text-purple-400",bg:"bg-purple-400/5",border:"border-purple-400/20",text:"text-purple-400"},orange:{badge:"bg-orange-400/10 text-orange-400",bg:"bg-orange-400/5",border:"border-orange-400/20",text:"text-orange-400"},cyan:{badge:"bg-cyan-400/10 text-cyan-400",bg:"bg-cyan-400/5",border:"border-cyan-400/20",text:"text-cyan-400"},teal:{badge:"bg-teal-400/10 text-teal-400",bg:"bg-teal-400/5",border:"border-teal-400/20",text:"text-teal-400"},emerald:{badge:"bg-emerald-400/10 text-emerald-400",bg:"bg-emerald-400/5",border:"border-emerald-400/20",text:"text-emerald-400"},rose:{badge:"bg-rose-400/10 text-rose-400",bg:"bg-rose-400/5",border:"border-rose-400/20",text:"text-rose-400"},slate:{badge:"bg-slate-700 text-slate-400",bg:"bg-slate-800/40",border:"border-slate-700",text:"text-slate-400"}},ei=e=>Number(e).toLocaleString("pt-BR",{style:"currency",currency:"BRL"}),so=e=>e?new Date(e).toLocaleString("pt-BR",{day:"2-digit",month:"2-digit",hour:"2-digit",minute:"2-digit"}):"—",Lve={pix:"PIX",cartao:"Cartão",faturado:"Faturado",na_retirada:"Na Retirada",na_entrega:"Na Entrega"};function x8({value:e,compact:t=!1}){if(!e)return a.jsx("span",{className:"text-slate-600",children:"—"});const n=Lve[e]??e;return e==="na_entrega"?t?a.jsxs("span",{className:"text-amber-400 text-xs font-bold",children:[n," ⚠️"]}):a.jsxs("span",{className:"inline-flex items-center gap-1 text-amber-400 font-bold",children:[n,a.jsx("span",{className:"text-[10px] bg-amber-500/15 border border-amber-500/30 text-amber-400 px-1.5 py-0.5 rounded-md font-black uppercase tracking-wide",children:"A avaliar"})]}):a.jsx("span",{className:"font-bold text-white",children:n})}function fb({status:e}){const t=Xn.find(r=>r.id===e);if(!t)return null;const n=Yn[t.color];return a.jsxs("span",{className:`inline-flex items-center gap-1.5 px-2.5 py-1 rounded-lg text-[10px] font-black uppercase tracking-widest border ${n.badge} ${n.border}`,children:[a.jsx(t.icon,{size:11})," ",t.label]})}const zve={aguardando:"Aguardando aprovação",separacao:"Lista de Separação — confira cada item e marque ao retirar",embalagem:"Embalagem — confira itens, embale e lacre",auditoria:"Auditoria — verifique código de barras, qtd. e validade",fiscal:"Fiscal — verifique dados do cliente e totais",expedicao:"Expedição — pedido pronto para saída",entregue:"Pedido entregue",cancelado:"Pedido cancelado"};function Bve(e,t){var v;const n=x=>Number(x).toLocaleString("pt-BR",{style:"currency",currency:"BRL"}),r=x=>x?new Date(x).toLocaleString("pt-BR"):"—",s=e.protocolo||`Pedido #${e.id}`,i=(((v=Xn.find(x=>x.id===e.status))==null?void 0:v.label)??e.status).toUpperCase(),o=zve[e.status]??"",l=["separacao","embalagem","auditoria"].includes(e.status),c=t.map(x=>`
<tr>
${l?`<td style="padding:6px 4px 6px 0;border-bottom:1px dashed #ccc;width:20px;">
<div style="width:14px;height:14px;border:1.5px solid #555;border-radius:3px;display:inline-block;"></div>
</td>`:""}
<td style="padding:6px 0;border-bottom:1px dashed #ccc;">
<strong>${x.nome_produto}</strong>
${x.sku?`<br/><span style="color:#777;font-size:10px;">SKU: ${x.sku}</span>`:""}
</td>
<td style="padding:6px 0;border-bottom:1px dashed #ccc;text-align:center;font-size:15px;font-weight:bold;white-space:nowrap;">
${Number(x.quantidade).toLocaleString("pt-BR")} un
</td>
<td style="padding:6px 0;border-bottom:1px dashed #ccc;text-align:right;font-weight:bold;">
${n(x.subtotal)}
</td>
</tr>`).join(""),u=e.rua?`
<hr class="divider"/>
<p class="section-title">Endereço de Entrega</p>
<div style="font-size:12px;">${e.rua}, ${e.end_numero}</div>
<div style="font-size:11px;color:#555;">${e.bairro} · ${e.cidade}/${e.estado} · CEP ${e.cep}</div>
`:"",d=e.observacao?`
<hr class="divider"/>
<p class="section-title">Observação</p>
<div style="font-size:12px;">${e.observacao}</div>
`:"",p={separacao:e.separador_nome,embalagem:e.embalador_nome,auditoria:e.auditor_nome,fiscal:e.fiscal_nome,expedicao:e.expedidor_nome}[e.status],h=`<!DOCTYPE html>
<html lang="pt-BR">
<head>
<meta charset="UTF-8"/>
<title>${i} — ${s}</title>
<style>
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Courier New', monospace; font-size: 13px; color: #111; background: #fff;
width: 80mm; max-width: 80mm; margin: 0 auto; padding: 8px; }
h1 { font-size: 16px; text-align: center; text-transform: uppercase; letter-spacing: 2px; margin-bottom: 2px; }
.etapa { text-align: center; font-size: 11px; font-weight: bold; background: #111; color: #fff;
padding: 3px 0; border-radius: 4px; margin: 6px 0 2px; letter-spacing: 1px; }
.instrucao { text-align: center; font-size: 10px; color: #555; margin-bottom: 6px; }
.divider { border: none; border-top: 1px dashed #999; margin: 7px 0; }
.section-title { font-size: 10px; text-transform: uppercase; letter-spacing: 1px;
color: #888; margin: 5px 0 3px; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { font-size: 10px; text-transform: uppercase; color: #888; text-align: left;
padding-bottom: 4px; border-bottom: 1px solid #aaa; }
th:last-child { text-align: right; }
.total-row td { font-size: 14px; font-weight: bold; padding-top: 6px; }
.assinatura { border-top: 1px solid #aaa; margin-top: 30px; padding-top: 4px;
font-size: 10px; color: #888; text-align: center; }
@media print {
@page { margin: 4mm; size: 80mm auto; }
body { padding: 0; }
}
</style>
</head>
<body>
<h1>Alemão Conveniências</h1>
<div class="etapa">${i}</div>
<p class="instrucao">${o}</p>
<hr class="divider"/>
<p class="section-title">Pedido</p>
<div style="font-size:14px;font-weight:bold;">${s}</div>
<div style="font-size:11px;color:#555;">${r(e.created_at)}</div>
<hr class="divider"/>
<p class="section-title">Cliente</p>
<div style="font-size:13px;font-weight:bold;">${e.cliente_nome||"Consumidor"}</div>
${e.cpf_cnpj?`<div style="font-size:11px;color:#555;">${e.cpf_cnpj}</div>`:""}
<div style="font-size:11px;margin-top:2px;">
${e.tipo_entrega?`<strong>${String(e.tipo_entrega).toUpperCase()}</strong> · `:""}
${{pix:"PIX",cartao:"Cartão",faturado:"Faturado",na_retirada:"Na Retirada",na_entrega:"NA ENTREGA ⚠"}[e.forma_pagto]||e.forma_pagto||""}
</div>
${u}
${d}
<hr class="divider"/>
<p class="section-title">Itens (${t.length})</p>
<table>
<thead><tr>
${l?'<th style="width:20px;"></th>':""}
<th>Produto</th>
<th style="text-align:center;">Qtd</th>
<th style="text-align:right;">Total</th>
</tr></thead>
<tbody>${c}</tbody>
</table>
<hr class="divider"/>
<table>
${e.desconto>0?`
<tr>
<td style="font-size:11px;color:#555;" colspan="${l?2:1}">Desconto</td>
<td style="text-align:right;font-size:11px;color:#059669;" colspan="2">-${n(e.desconto)}</td>
</tr>`:""}
<tr class="total-row">
<td colspan="${l?2:1}">TOTAL</td>
<td style="text-align:right;" colspan="2">${n(e.total)}</td>
</tr>
</table>
${p?`
<hr class="divider"/>
<p class="section-title">Responsável — ${i}</p>
<div style="font-size:13px;font-weight:bold;">${p}</div>
`:""}
${e.expedidor_nome&&e.expedidor_saida_em?`
<hr class="divider"/>
<div style="font-size:11px;color:#0d9488;font-weight:bold;">
↗ Saída: ${r(e.expedidor_saida_em)} · ${e.expedidor_nome}
</div>`:""}
<div class="assinatura">
${p?"Assinatura: ____________________":"&nbsp;"}
</div>
<p style="text-align:center;font-size:9px;color:#bbb;margin-top:8px;">
Documento interno · ${new Date().toLocaleString("pt-BR")}
</p>
</body>
</html>`,m=window.open("","_blank","width=420,height=720");if(!m){alert("Permita pop-ups para imprimir.");return}m.document.write(h),m.document.close(),m.focus(),setTimeout(()=>{m.print(),m.close()},350)}const _f=["Resumo","Itens","Ações"];function Fve({pedido:e,onClose:t,onUpdate:n}){var jn,Wn;const[r,s]=b.useState(e),[i,o]=b.useState([]),[l,c]=b.useState(!0),[u,d]=b.useState(!1),[f,p]=b.useState(""),[h,m]=b.useState(0),[v,x]=b.useState(""),[y,g]=b.useState(""),[j,N]=b.useState(null),[w,S]=b.useState(null),[k,C]=b.useState(null),[_,A]=b.useState(null),[E,P]=b.useState(null),[D,I]=b.useState(!1),[R,M]=b.useState(""),[W,T]=b.useState(""),[V,X]=b.useState(!1);async function U(){var ft,Tt;const ne=R.trim(),Se=W.replace(/\D/g,"");if(!ne&&!Se){alert("Informe o número do cupom ou a chave de acesso (44 dígitos).");return}if(Se&&Se.length!==44){alert("Chave de acesso NFC-e deve ter 44 dígitos.");return}X(!0);try{const gt=await pt.registrarCupom(r.id,{numero:ne||void 0,chave:Se||void 0});s(Ba=>({...Ba,cupom_numero:gt.cupom_numero,cupom_chave:gt.cupom_chave,cupom_emitido_em:gt.cupom_emitido_em,cupom_emitido_por:gt.cupom_emitido_por,cupom_emitido_por_nome:gt.cupom_emitido_por_nome})),I(!1),M(""),T(""),n()}catch(gt){alert(((Tt=(ft=gt==null?void 0:gt.response)==null?void 0:ft.data)==null?void 0:Tt.error)||"Erro ao registrar cupom fiscal")}finally{X(!1)}}b.useEffect(()=>{pt.getPedido(r.id).then(ne=>{s(ne),o(ne.itens||[])}).finally(()=>c(!1))},[r.id]),b.useEffect(()=>{const ne=Se=>{Se.key==="Escape"&&t()};return document.addEventListener("keydown",ne),()=>document.removeEventListener("keydown",ne)},[t]);const L=Xn.find(ne=>ne.id===r.status),B=L?Yn[L.color]:Yn.slate,ae=Xn.findIndex(ne=>ne.id===r.status),se=Xn[ae+1],xe=i.length>0&&i.every(ne=>ne.separado);async function H(){if(!(!se||se.id==="cancelado")){if(se.id==="embalagem"){await le();return}d(!0);try{r.status==="separacao"&&w?await pt.setResponsavel(r.id,"separador",w):r.status==="auditoria"&&k?await pt.setResponsavel(r.id,"auditor",k):r.status==="fiscal"&&_&&await pt.setResponsavel(r.id,"fiscal",_),se.id==="entregue"?E?await pt.marcarEntreguePorId(r.id,E):await pt.marcarEntregue(r.id,v||void 0):await pt.updateStatus(r.id,se.id),s(ne=>({...ne,status:se.id})),n()}finally{d(!1)}}}async function le(){if(!j&&!y.trim()){alert("Selecione o embalador antes de avançar.");return}d(!0);try{j?await pt.marcarEmbaladoPorId(r.id,j):await pt.marcarEmbalado(r.id,y),s(ne=>({...ne,status:"embalagem"})),n()}finally{d(!1)}}async function Z(){d(!0);try{await pt.updateStatus(r.id,"separacao"),s(ne=>({...ne,status:"separacao"})),p(""),n()}finally{d(!1)}}async function F(){if(confirm("Cancelar pedido?")){d(!0);try{await pt.updateStatus(r.id,"cancelado"),s(ne=>({...ne,status:"cancelado"})),n()}finally{d(!1)}}}async function z(ne){const Se=!ne.separado;await pt.marcarSeparado(ne.id,Se),o(ft=>ft.map(Tt=>Tt.id===ne.id?{...Tt,separado:Se}:Tt))}const q=se&&se.id!=="cancelado"&&r.status!=="entregue"&&r.status!=="cancelado",ie=r.status==="separacao"&&i.length>0&&!xe,oe=(se==null?void 0:se.id)==="embalagem"&&!j&&!y.trim(),we=r.status==="expedicao"&&(se==null?void 0:se.id)==="entregue"&&!E&&!v.trim(),Ee=ie||oe||we,ze=ie?"separe todos os itens":oe?"selecione o embalador":we?"selecione o entregador":"",gn=a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[a.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-2xl p-4 col-span-2 md:col-span-1",children:[a.jsx("p",{className:"text-xs font-black text-slate-500 uppercase tracking-widest mb-2",children:"Cliente"}),a.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.cliente_tipo==="PJ"?a.jsx(f1,{size:15,className:"text-purple-400 shrink-0"}):a.jsx(ks,{size:15,className:"text-cyan-400 shrink-0"}),a.jsx("span",{className:"text-sm font-bold text-white leading-tight",children:r.cliente_nome||"Sem cadastro"})]}),r.cpf_cnpj&&a.jsx("p",{className:"text-xs text-slate-500 font-mono mt-0.5",children:r.cpf_cnpj})]}),a.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-2xl p-4",children:[a.jsx("p",{className:"text-xs font-black text-slate-500 uppercase tracking-widest mb-2",children:"Total"}),a.jsx("p",{className:"text-2xl font-black text-white tabular-nums",children:ei(r.total)}),r.desconto>0&&a.jsxs("p",{className:"text-xs text-emerald-400 mt-0.5",children:["Desc: ",ei(r.desconto)]})]}),a.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-2xl p-4",children:[a.jsx("p",{className:"text-xs font-black text-slate-500 uppercase tracking-widest mb-2",children:"Pagamento"}),a.jsx(x8,{value:r.forma_pagto})]}),a.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-2xl p-4",children:[a.jsx("p",{className:"text-xs font-black text-slate-500 uppercase tracking-widest mb-2",children:"Modalidade"}),a.jsx("p",{className:"text-sm font-bold text-white capitalize",children:r.tipo_entrega||"—"})]})]}),r.rua&&a.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-2xl p-4",children:[a.jsxs("p",{className:"text-xs font-black text-slate-500 uppercase tracking-widest mb-2 flex items-center gap-1.5",children:[a.jsx(gm,{size:11})," Endereço de Entrega"]}),a.jsxs("p",{className:"text-sm text-white font-bold",children:[r.rua,", ",r.end_numero]}),a.jsxs("p",{className:"text-xs text-slate-400 mt-0.5",children:[r.bairro," · ",r.cidade,"/",r.estado," · CEP ",r.cep]})]}),r.observacao&&a.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-2xl p-4",children:[a.jsx("p",{className:"text-xs font-black text-slate-500 uppercase tracking-widest mb-2",children:"Observação"}),a.jsx("p",{className:"text-sm text-slate-300",children:r.observacao})]}),r.forma_pagto==="na_entrega"&&r.status==="aguardando"&&a.jsxs("div",{className:"bg-amber-500/10 border border-amber-500/30 rounded-2xl p-4 flex items-start gap-3",children:[a.jsx(Ar,{size:18,className:"text-amber-400 shrink-0 mt-0.5"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-xs font-black text-amber-400 uppercase tracking-widest",children:"Pagamento na entrega — avaliar"}),a.jsx("p",{className:"text-xs text-amber-400/70 mt-1",children:"Avalie antes de avançar para separação. Confirme apenas se aprovado pela equipe."})]})]}),r.status!=="separacao"&&r.embalador&&a.jsxs("div",{className:"bg-slate-900 border border-purple-400/10 rounded-2xl p-3 flex items-center gap-2",children:[a.jsx(Mp,{size:13,className:"text-purple-400 shrink-0"}),a.jsxs("span",{className:"text-xs text-slate-400",children:["Embalado por: ",a.jsx("strong",{className:"text-white",children:r.embalador})]})]}),Array.isArray(r.historico_responsaveis)&&r.historico_responsaveis.length>0&&a.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-2xl p-4",children:[a.jsxs("p",{className:"text-xs font-black text-slate-500 uppercase tracking-widest mb-4 flex items-center gap-1.5",children:[a.jsx(hn,{size:11})," Linha do Tempo"]}),a.jsx("div",{className:"space-y-0",children:r.historico_responsaveis.map((ne,Se)=>{const ft=Xn.find(Ql=>Ql.id===ne.status),Tt=ft?Yn[ft.color]:Yn.slate,gt=Se===r.historico_responsaveis.length-1,Ba=ne.status==="expedicao"&&r.expedidor_saida_em,Fa={separacao:r.separador_nome,embalagem:r.embalador_nome,auditoria:r.auditor_nome,fiscal:r.fiscal_nome,expedicao:r.expedidor_nome}[ne.status]||ne.account_name||null;return a.jsxs("div",{className:"flex gap-3",children:[a.jsxs("div",{className:"flex flex-col items-center w-7 shrink-0",children:[a.jsx("div",{className:`w-7 h-7 rounded-xl flex items-center justify-center border ${Tt.bg} ${Tt.border}`,children:ft?a.jsx(ft.icon,{size:11,className:Tt.text}):a.jsx(jt,{size:11,className:"text-slate-400"})}),!gt&&a.jsx("div",{className:"w-px flex-1 min-h-[20px] bg-slate-800 my-1"})]}),a.jsxs("div",{className:`flex-1 min-w-0 ${gt?"":"pb-4"}`,children:[a.jsxs("div",{className:"flex items-baseline gap-2 flex-wrap",children:[a.jsx("span",{className:`text-xs font-black uppercase tracking-widest ${Tt.text}`,children:(ft==null?void 0:ft.label)??ne.status}),a.jsx("span",{className:"text-[10px] text-slate-600 tabular-nums shrink-0",children:so(ne.feito_em)})]}),Fa&&a.jsxs("p",{className:"text-xs text-slate-400 mt-0.5 flex items-center gap-1",children:[a.jsx(ks,{size:10,className:"shrink-0"})," ",Fa]}),Ba&&a.jsxs("p",{className:"text-[11px] text-teal-400 font-bold mt-1 flex items-center gap-1",children:[a.jsx(Nu,{size:10,className:"shrink-0"}),"Saiu para entrega às ",so(r.expedidor_saida_em)]}),(ne.status==="fiscal"||ne.status==="expedicao")&&r.cupom_emitido_em&&a.jsxs("p",{className:"text-[11px] text-cyan-400 mt-1 flex items-center gap-1",children:[a.jsx(Hr,{size:10,className:"shrink-0"}),"Cupom ",r.cupom_numero?`#${r.cupom_numero}`:"registrado"," ","· ",so(r.cupom_emitido_em),r.cupom_emitido_por_nome&&` · ${r.cupom_emitido_por_nome}`]})]})]},ne.id??Se)})})]})]}),vn=a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("p",{className:"text-xs font-black text-slate-500 uppercase tracking-widest flex items-center gap-1.5",children:[a.jsx(bu,{size:11})," ",i.length," ",i.length===1?"item":"itens"]}),["separacao","embalagem"].includes(r.status)&&i.length>0&&a.jsxs("span",{className:`text-xs font-bold ${xe?"text-emerald-400":"text-slate-500"}`,children:[i.filter(ne=>ne.separado).length,"/",i.length," separados",xe&&" ✓"]})]}),a.jsx("div",{className:"space-y-2",children:i.map(ne=>a.jsxs("div",{className:`flex items-center gap-3 p-4 rounded-2xl border transition-colors
${ne.separado?"border-emerald-400/20 bg-emerald-400/5":"border-slate-800 bg-slate-900"}`,children:[["separacao","embalagem"].includes(r.status)&&a.jsx("button",{onClick:()=>z(ne),className:`w-7 h-7 rounded-xl border-2 flex items-center justify-center shrink-0 transition-colors
${ne.separado?"border-emerald-500 bg-emerald-500":"border-slate-600 hover:border-emerald-500"}`,children:ne.separado&&a.jsx(jt,{size:13,className:"text-black"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:`text-sm font-bold truncate ${ne.separado?"text-slate-400 line-through":"text-white"}`,children:ne.nome_produto}),a.jsxs("p",{className:"text-xs text-slate-500 mt-0.5",children:[ne.sku||""," · ",Number(ne.quantidade).toLocaleString("pt-BR"),"x · ",ei(ne.preco_unitario)]})]}),a.jsx("p",{className:"text-sm font-black text-white tabular-nums shrink-0",children:ei(ne.subtotal)})]},ne.id))}),a.jsxs("div",{className:"flex justify-between items-center pt-2 border-t border-slate-800",children:[a.jsx("span",{className:"text-xs font-black text-slate-500 uppercase tracking-widest",children:"Total"}),a.jsx("span",{className:"text-xl font-black text-white tabular-nums",children:ei(r.total)})]})]}),yn=a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:`rounded-2xl p-4 border ${B.bg} ${B.border}`,children:[a.jsx("p",{className:"text-xs font-black text-slate-500 uppercase tracking-widest mb-2",children:"Status atual"}),a.jsx(fb,{status:r.status}),r.status==="entregue"&&a.jsx("p",{className:"text-xs text-emerald-400 mt-2 font-bold",children:"✓ Pedido finalizado com sucesso"}),r.status==="cancelado"&&a.jsx("p",{className:"text-xs text-rose-400 mt-2 font-bold",children:"✗ Pedido cancelado"})]}),r.status==="fiscal"&&a.jsxs("div",{className:"bg-slate-900 border border-cyan-400/20 rounded-2xl p-4 space-y-3",children:[a.jsxs("p",{className:"text-xs font-black text-cyan-400 uppercase tracking-widest flex items-center gap-1.5",children:[a.jsx(Hr,{size:11})," Dados Fiscais do Cliente"]}),a.jsx("div",{className:"text-sm space-y-2",children:[["CPF/CNPJ",r.cpf_cnpj||"—"],["Cliente",r.cliente_nome||"—"],["Total",ei(r.total)]].map(([ne,Se])=>a.jsxs("div",{className:"flex justify-between",children:[a.jsx("span",{className:"text-slate-400",children:ne}),a.jsx("span",{className:"font-bold text-white font-mono",children:Se})]},ne))})]}),!["aguardando","cancelado"].includes(r.status)&&a.jsxs("div",{className:"bg-slate-900 border border-cyan-400/20 rounded-2xl p-4 space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("p",{className:"text-xs font-black text-cyan-400 uppercase tracking-widest flex items-center gap-1.5",children:[a.jsx(Hr,{size:11})," Cupom Fiscal"]}),r.cupom_emitido_em&&a.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] text-emerald-400 font-black uppercase",children:[a.jsx(jt,{size:10})," Emitido"]})]}),r.cupom_emitido_em&&!D?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"text-sm space-y-1.5",children:[r.cupom_numero&&a.jsxs("div",{className:"flex justify-between",children:[a.jsx("span",{className:"text-slate-400",children:"Número"}),a.jsx("span",{className:"font-bold text-white font-mono",children:r.cupom_numero})]}),r.cupom_chave&&a.jsxs("div",{className:"flex justify-between gap-2",children:[a.jsx("span",{className:"text-slate-400",children:"Chave"}),a.jsx("span",{className:"font-mono text-[11px] text-white break-all text-right",children:r.cupom_chave})]}),a.jsxs("div",{className:"flex justify-between",children:[a.jsx("span",{className:"text-slate-400",children:"Emitido em"}),a.jsx("span",{className:"font-bold text-white",children:so(r.cupom_emitido_em)})]}),r.cupom_emitido_por_nome&&a.jsxs("div",{className:"flex justify-between",children:[a.jsx("span",{className:"text-slate-400",children:"Por"}),a.jsx("span",{className:"font-bold text-white",children:r.cupom_emitido_por_nome})]})]}),a.jsx("button",{onClick:()=>{I(!0),M(r.cupom_numero||""),T(r.cupom_chave||"")},className:"w-full py-2 bg-slate-800 hover:bg-slate-700 border border-slate-700 rounded-xl text-slate-300 font-bold text-xs transition-colors",children:"Re-emitir / Corrigir"})]}):D?a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-[10px] font-black text-slate-500 uppercase tracking-widest mb-1",children:"Número do cupom"}),a.jsx("input",{type:"text",value:R,onChange:ne=>M(ne.target.value),disabled:V,placeholder:"Ex.: COO 000123",className:"w-full bg-slate-800 border border-slate-700 rounded-xl px-3 py-2 text-sm text-white font-mono focus:outline-none focus:border-cyan-500"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-[10px] font-black text-slate-500 uppercase tracking-widest mb-1",children:"Chave de acesso NFC-e (44 dígitos)"}),a.jsx("input",{type:"text",value:W,onChange:ne=>T(ne.target.value),disabled:V,maxLength:56,placeholder:"00000000000000000000000000000000000000000000",className:"w-full bg-slate-800 border border-slate-700 rounded-xl px-3 py-2 text-xs text-white font-mono focus:outline-none focus:border-cyan-500"}),a.jsxs("p",{className:"text-[10px] text-slate-500 mt-1",children:[W.replace(/\D/g,"").length,"/44 dígitos"]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[a.jsx("button",{onClick:()=>{I(!1),M(""),T("")},disabled:V,className:"py-2.5 bg-slate-800 hover:bg-slate-700 border border-slate-700 rounded-xl text-slate-400 font-black text-xs transition-colors",children:"Cancelar"}),a.jsxs("button",{onClick:U,disabled:V,className:"py-2.5 bg-cyan-500/20 hover:bg-cyan-500/30 border border-cyan-500/40 rounded-xl text-cyan-300 font-black text-xs transition-colors flex items-center justify-center gap-1.5 disabled:opacity-40",children:[V?a.jsx(ke,{size:12,className:"animate-spin"}):a.jsx(jt,{size:12})," Registrar"]})]})]}):a.jsxs("button",{onClick:()=>I(!0),className:"w-full py-2.5 bg-cyan-500/10 hover:bg-cyan-500/20 border border-cyan-500/30 rounded-xl text-cyan-400 font-black text-xs transition-colors flex items-center justify-center gap-1.5",children:[a.jsx(Hr,{size:12})," Emitir Cupom Fiscal"]}),a.jsx("p",{className:"text-[10px] text-slate-500 leading-relaxed",children:"Registro do cupom emitido no PDV/ECF — sem integração SEFAZ. Pode ser feito em qualquer fase pós-pagamento."})]}),r.status==="separacao"&&a.jsxs("div",{className:"bg-slate-900 border border-blue-400/20 rounded-2xl p-4 space-y-3",children:[a.jsxs("p",{className:"text-xs font-black text-blue-400 uppercase tracking-widest flex items-center gap-1.5",children:[a.jsx(bu,{size:11})," Separador Responsável"]}),a.jsx(wc,{funcao:"separador",value:w,onChange:S,accentColor:"cyan"}),a.jsx("p",{className:"text-xs text-slate-500",children:"Será registrado ao avançar para Embalagem."})]}),(se==null?void 0:se.id)==="embalagem"&&r.status==="separacao"&&a.jsxs("div",{className:"bg-slate-900 border border-purple-400/20 rounded-2xl p-4 space-y-3",children:[a.jsxs("p",{className:"text-xs font-black text-purple-400 uppercase tracking-widest flex items-center gap-1.5",children:[a.jsx(Mp,{size:11})," Embalador Responsável"]}),a.jsx(wc,{funcao:"embalador",value:j,onChange:(ne,Se)=>{N(ne),g(Se||"")},accentColor:"purple"}),a.jsx("p",{className:"text-xs text-slate-500",children:"Selecione o colaborador antes de avançar."})]}),r.status==="auditoria"&&a.jsxs("div",{className:"bg-slate-900 border border-orange-400/20 rounded-2xl p-4 space-y-3",children:[a.jsxs("p",{className:"text-xs font-black text-orange-400 uppercase tracking-widest flex items-center gap-1.5",children:[a.jsx(Pi,{size:11})," Auditor Responsável"]}),a.jsx(wc,{funcao:"auditor",value:k,onChange:C,accentColor:"orange"})]}),r.status==="fiscal"&&a.jsxs("div",{className:"bg-slate-900 border border-cyan-400/20 rounded-2xl p-4 space-y-3",children:[a.jsxs("p",{className:"text-xs font-black text-cyan-400 uppercase tracking-widest flex items-center gap-1.5",children:[a.jsx(Hr,{size:11})," Fiscal Responsável"]}),a.jsx(wc,{funcao:"fiscal",value:_,onChange:A,accentColor:"cyan"})]}),r.status==="expedicao"&&a.jsxs("div",{className:"bg-slate-900 border border-teal-400/20 rounded-2xl p-4 space-y-3",children:[a.jsxs("p",{className:"text-xs font-black text-teal-400 uppercase tracking-widest flex items-center gap-1.5",children:[a.jsx(Nu,{size:11})," Expedidor / Entregador"]}),a.jsx(wc,{funcao:"expedidor",value:E,onChange:(ne,Se)=>{P(ne),x(Se||"")},accentColor:"teal"}),a.jsxs("p",{className:"text-xs text-slate-500",children:["Modalidade: ",a.jsx("span",{className:"font-bold text-white capitalize",children:r.tipo_entrega})]})]}),r.status==="auditoria"&&a.jsxs("div",{className:"bg-slate-900 border border-orange-400/20 rounded-2xl p-4 space-y-3",children:[a.jsx("p",{className:"text-xs font-black text-orange-400 uppercase tracking-widest",children:"Auditoria Final"}),a.jsx("p",{className:"text-xs text-slate-400",children:"Confira código de barras, quantidades e validade antes de aprovar."}),a.jsx("textarea",{value:f,onChange:ne=>p(ne.target.value),rows:3,placeholder:"Motivo da reprovação (opcional)...",className:"w-full bg-slate-800 border border-slate-700 rounded-xl px-3 py-2 text-sm text-white focus:outline-none focus:border-orange-500 resize-none"}),a.jsxs("button",{onClick:Z,disabled:u,className:"w-full py-3 bg-rose-500/20 hover:bg-rose-500/30 border border-rose-500/30 rounded-xl text-rose-400 font-black text-sm transition-colors flex items-center justify-center gap-2",children:[a.jsx(Ar,{size:14})," Reprovar — Voltar à Separação"]})]}),r.status!=="cancelado"&&r.status!=="entregue"&&a.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-2xl p-4",children:[a.jsx("p",{className:"text-xs font-black text-slate-500 uppercase tracking-widest mb-3",children:"Zona de Risco"}),a.jsxs("button",{onClick:F,disabled:u,className:"w-full py-3 bg-rose-500/10 hover:bg-rose-500/20 border border-rose-500/20 rounded-xl text-rose-400 font-black text-sm transition-colors flex items-center justify-center gap-2",children:[a.jsx(Ar,{size:14})," Cancelar Pedido"]})]})]}),bn=[gn,vn,yn];return Bi.createPortal(a.jsxs("div",{className:"fixed inset-0 z-[100] bg-slate-950 flex flex-col overflow-hidden",style:{width:"100vw",height:"100vh"},children:[a.jsx("div",{className:`px-6 pt-5 pb-4 border-b border-slate-800 ${B.bg} shrink-0`,children:a.jsxs("div",{className:"max-w-5xl mx-auto w-full",children:[a.jsxs("div",{className:"flex items-start justify-between gap-3 mb-3",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-xl font-black text-white tracking-tight",children:r.protocolo||`Pedido #${r.id}`}),a.jsx("p",{className:"text-xs text-slate-500 mt-0.5",children:so(r.created_at)})]}),a.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[a.jsx(fb,{status:r.status}),a.jsx("button",{onClick:()=>Bve(r,i),title:"Imprimir cupom do pedido",className:"p-1.5 text-slate-500 hover:text-white hover:bg-slate-800 rounded-xl transition-colors",children:a.jsx(GP,{size:18})}),a.jsx("button",{onClick:t,className:"p-1.5 text-slate-500 hover:text-white hover:bg-slate-800 rounded-xl transition-colors",children:a.jsx(Ce,{size:18})})]})]}),a.jsx("div",{className:"flex gap-1 overflow-x-auto scrollbar-hide mt-3",children:Xn.filter(ne=>ne.id!=="cancelado").map((ne,Se)=>{const ft=ae>Se,Tt=ae===Se,gt=Yn[ne.color];return a.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[a.jsxs("div",{className:`flex items-center gap-1 px-2 py-1 rounded-lg text-[10px] font-black transition-all
${Tt?`${gt.badge} ${gt.border} border`:ft?"text-emerald-400":"text-slate-700"}`,children:[ft?a.jsx(jt,{size:9}):a.jsx(ne.icon,{size:9}),a.jsx("span",{children:ne.label})]}),Se<Xn.length-2&&a.jsx("div",{className:`w-2 h-px ${ft?"bg-emerald-700":"bg-slate-800"}`})]},ne.id)})})]})}),a.jsx("div",{className:"flex border-b border-slate-800 shrink-0",children:_f.map((ne,Se)=>a.jsxs("button",{onClick:()=>m(Se),className:`flex-1 py-3 text-xs font-black uppercase tracking-widest transition-colors
${h===Se?"text-white border-b-2 border-cyan-400":"text-slate-600 hover:text-slate-400"}`,children:[ne,Se===1&&i.length>0&&a.jsx("span",{className:`ml-1.5 px-1.5 py-0.5 rounded-full text-[10px] ${h===Se?"bg-cyan-400/20 text-cyan-400":"bg-slate-800 text-slate-500"}`,children:i.length})]},Se))}),a.jsx("div",{className:"flex-1 overflow-y-auto p-6 max-w-5xl w-full mx-auto",children:l?a.jsx("div",{className:"space-y-3 animate-pulse",children:[...Array(4)].map((ne,Se)=>a.jsx("div",{className:"h-20 bg-slate-800 rounded-2xl"},Se))}):bn[h]}),a.jsx("div",{className:"shrink-0 border-t border-slate-800 px-6 py-4 bg-slate-950/95 backdrop-blur-sm",children:a.jsxs("div",{className:"flex items-center gap-3 max-w-5xl mx-auto w-full",children:[a.jsx("button",{onClick:()=>m(ne=>Math.max(0,ne-1)),disabled:h===0,className:"px-4 py-2.5 bg-slate-900 border border-slate-800 rounded-xl text-sm font-black text-slate-400 hover:text-white disabled:opacity-30 transition-colors shrink-0",children:"← Anterior"}),a.jsx("div",{className:"flex gap-1.5 flex-1 justify-center",children:_f.map((ne,Se)=>a.jsx("button",{onClick:()=>m(Se),className:`h-1.5 rounded-full transition-all ${Se===h?"w-6 bg-cyan-400":"w-1.5 bg-slate-700 hover:bg-slate-600"}`},Se))}),q?a.jsxs("button",{onClick:H,disabled:u||Ee,title:Ee?`Antes de avançar, ${ze}.`:"",className:`flex-1 max-w-xs py-2.5 rounded-xl font-black text-sm transition-colors flex items-center justify-center gap-2 disabled:opacity-40
${Yn[((jn=Xn.find(ne=>ne.id===se.id))==null?void 0:jn.color)||"slate"].badge}
border ${Yn[((Wn=Xn.find(ne=>ne.id===se.id))==null?void 0:Wn.color)||"slate"].border}`,children:[u?a.jsx(ke,{size:15,className:"animate-spin"}):se&&a.jsx(se.icon,{size:15}),"Avançar para ",se==null?void 0:se.label,Ee&&a.jsxs("span",{className:"text-[10px] opacity-60",children:["(",ze,")"]})]}):a.jsx("button",{onClick:()=>m(ne=>Math.min(_f.length-1,ne+1)),disabled:h===_f.length-1,className:"px-4 py-2.5 bg-slate-900 border border-slate-800 rounded-xl text-sm font-black text-slate-400 hover:text-white disabled:opacity-30 transition-colors shrink-0",children:"Próximo →"})]})})]}),document.body)}function Vve({label:e,value:t,icon:n,color:r,onClick:s,active:i}){const o=Yn[r]||Yn.slate;return a.jsxs("button",{onClick:s,className:`flex-1 min-w-28 p-4 rounded-2xl border transition-all text-left ${i?`${o.bg} ${o.border}`:"bg-slate-900/40 border-slate-800 hover:border-slate-700"}`,children:[a.jsx("div",{className:`mb-2 ${i?o.text:"text-slate-500"}`,children:a.jsx(n,{size:18})}),a.jsx("p",{className:"text-2xl font-black text-white tabular-nums",children:t}),a.jsx("p",{className:`text-[10px] font-black uppercase tracking-widest mt-0.5 ${i?o.text:"text-slate-600"}`,children:e})]})}function Uve(){const[e,t]=b.useState([]),[n,r]=b.useState({}),[s,i]=b.useState(!0),[o,l]=b.useState("aguardando"),[c,u]=b.useState(null),[d,f]=b.useState("hoje"),p=b.useCallback(async()=>{i(!0);try{const m={status:o||void 0};if(d==="hoje")m.from=new Date().toISOString().slice(0,10),m.to=m.from;else if(d==="7d"){const y=new Date;y.setDate(y.getDate()-7),m.from=y.toISOString().slice(0,10)}else if(d==="30d"){const y=new Date;y.setDate(y.getDate()-30),m.from=y.toISOString().slice(0,10)}const[v,x]=await Promise.all([pt.listPedidos(m),pt.contadores()]);t(v),r(x)}catch(m){console.error(m)}finally{i(!1)}},[o,d]);b.useEffect(()=>{p()},[p]),b.useEffect(()=>{const m=setInterval(p,3e4);return()=>clearInterval(m)},[p]);const h=[{id:"aguardando",label:"Aguardando",icon:hn,color:"yellow",value:n.aguardando??0},{id:"separacao",label:"Separação",icon:bu,color:"blue",value:n.em_separacao??0},{id:"embalagem",label:"Embalagem",icon:Mp,color:"purple",value:n.em_embalagem??0},{id:"auditoria",label:"Auditoria",icon:Pi,color:"orange",value:n.em_auditoria??0},{id:"expedicao",label:"Expedição",icon:Nu,color:"teal",value:n.prontos??0},{id:"entregue",label:"Entregues",icon:nn,color:"emerald",value:n.entregues??0}];return a.jsxs("div",{className:"space-y-8 animate-in fade-in slide-in-from-bottom-4 duration-700",children:[a.jsxs("header",{className:"flex flex-wrap justify-between items-start gap-4",children:[a.jsxs("div",{children:[a.jsxs("h2",{className:"text-3xl font-black text-white tracking-tighter flex items-center gap-3",children:[a.jsx(QP,{className:"text-cyan-400",size:28})," Pedidos"]}),a.jsx("p",{className:"text-slate-400 mt-1 font-medium",children:"Fluxo operacional · separação · embalagem · auditoria · expedição"})]}),a.jsx("button",{onClick:p,className:"flex items-center gap-2 p-2 bg-slate-900 border border-slate-800 rounded-xl text-slate-400 hover:text-white transition-colors",children:a.jsx(ke,{size:16,className:s?"animate-spin":""})})]}),a.jsx("div",{className:"flex gap-3 overflow-x-auto pb-1",children:h.map(m=>a.jsx(Vve,{label:m.label,value:m.value,icon:m.icon,color:m.color,active:o===m.id,onClick:()=>l(m.id)},m.id))}),a.jsxs("div",{className:"flex gap-3 items-center flex-wrap",children:[a.jsxs("div",{className:"relative",children:[a.jsxs("select",{value:o,onChange:m=>l(m.target.value),className:"bg-slate-900 border border-slate-800 rounded-xl px-3 py-2 text-sm text-slate-300 focus:outline-none focus:border-cyan-500 appearance-none cursor-pointer pr-8",children:[a.jsx("option",{value:"",style:{background:"#0f172a",color:"#cbd5e1"},children:"Todos os status"}),Xn.map(m=>a.jsx("option",{value:m.id,style:{background:"#0f172a",color:"#cbd5e1"},children:m.label},m.id))]}),a.jsx(aa,{size:14,className:"absolute right-2 top-1/2 -translate-y-1/2 text-slate-500 pointer-events-none"})]}),a.jsx("div",{className:"flex bg-slate-900 border border-slate-800 rounded-xl overflow-hidden",children:[["hoje","Hoje"],["7d","7 dias"],["30d","30 dias"],["","Todos"]].map(([m,v])=>a.jsx("button",{onClick:()=>f(m),className:`px-3 py-2 text-xs font-black transition-colors ${d===m?"bg-cyan-500/20 text-cyan-400":"text-slate-500 hover:text-slate-300"}`,children:v},m))}),a.jsxs("span",{className:"text-xs text-slate-600",children:[e.length," pedido",e.length!==1?"s":""]})]}),a.jsx("div",{className:"space-y-3",children:s?[...Array(5)].map((m,v)=>a.jsxs("div",{className:"bg-slate-900/40 border border-slate-800 rounded-2xl p-5 animate-pulse flex gap-4",children:[a.jsx("div",{className:"h-10 w-10 bg-slate-800 rounded-xl"}),a.jsxs("div",{className:"flex-1 space-y-2",children:[a.jsx("div",{className:"h-4 w-32 bg-slate-800 rounded"}),a.jsx("div",{className:"h-3 w-48 bg-slate-800/60 rounded"})]})]},v)):e.length===0?a.jsxs("div",{className:"bg-slate-900/40 border border-slate-800 rounded-3xl p-16 text-center",children:[a.jsx(nn,{size:40,className:"text-slate-700 mx-auto mb-3"}),a.jsx("p",{className:"text-slate-600 text-sm italic",children:"Nenhum pedido neste status."})]}):e.map(m=>{const v=Xn.find(y=>y.id===m.status),x=v?Yn[v.color]:Yn.slate;return a.jsxs("button",{onClick:()=>u(m),className:`w-full text-left bg-slate-900/40 border rounded-2xl p-5 hover:border-slate-600 transition-all group flex items-center gap-4 ${x.border}`,children:[a.jsx("div",{className:`w-11 h-11 rounded-xl flex items-center justify-center shrink-0 ${x.bg} border ${x.border}`,children:v&&a.jsx(v.icon,{size:18,className:x.text})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-1 flex-wrap",children:[a.jsx("span",{className:"font-black text-white",children:m.protocolo||`Pedido #${m.id}`}),a.jsx(fb,{status:m.status}),m.cliente_tipo&&a.jsx("span",{className:`text-[10px] font-black uppercase ${m.cliente_tipo==="PJ"?"text-purple-400":"text-cyan-400"}`,children:m.cliente_tipo})]}),a.jsx("p",{className:"text-sm text-slate-400 truncate",children:m.cliente_nome||"Sem cadastro"}),a.jsxs("p",{className:"text-xs text-slate-600 mt-0.5",children:[so(m.created_at)," · ",m.tipo_entrega]})]}),a.jsxs("div",{className:"text-right shrink-0",children:[a.jsx("p",{className:"font-black text-white tabular-nums text-lg",children:ei(m.total)}),a.jsx(x8,{value:m.forma_pagto,compact:!0})]})]},m.id)})}),c&&a.jsx(Fve,{pedido:c,onClose:()=>u(null),onUpdate:p})]})}const n_=[{id:"overview",icon:a.jsx(Pr,{size:28}),gradient:"from-amber-500 to-orange-600",title:"Inbox Interno",subtitle:"Comunicação entre setores operacionais",content:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("p",{className:"text-[14px] text-slate-300 leading-relaxed",children:["O ",a.jsx("strong",{className:"text-white",children:"Inbox Interno"})," é o canal de comunicação entre os setores que processam pedidos — cotação, separação, embalagem, auditoria, expedição e mais."]}),a.jsxs("div",{className:"bg-slate-900 border border-amber-500/20 rounded-xl p-3 space-y-2",children:[a.jsx("p",{className:"text-[11px] font-bold text-amber-400 uppercase tracking-widest mb-2",children:"Exemplos de uso"}),[{emoji:"📦",msg:"Pedido #1042 separado. Aguardando auditoria.",from:"Separação → Auditoria"},{emoji:"🧾",msg:"NF do pedido #1098 com divergência de valor. Preciso checar.",from:"Fiscal → Cotação"},{emoji:"🚚",msg:"Transportadora atrasou. Pedidos #1110 e #1111 postergados.",from:"Expedição → Geral"}].map((e,t)=>a.jsxs("div",{className:"flex gap-2.5 bg-slate-950/50 rounded-lg px-2.5 py-2",children:[a.jsx("span",{className:"text-base leading-none flex-shrink-0",children:e.emoji}),a.jsxs("div",{children:[a.jsxs("p",{className:"text-[11px] text-white leading-snug",children:['"',e.msg,'"']}),a.jsx("p",{className:"text-[10px] text-slate-600 mt-0.5",children:e.from})]})]},t))]}),a.jsxs("div",{className:"flex items-start gap-2 bg-amber-500/10 border border-amber-500/20 rounded-xl px-3 py-2.5",children:[a.jsx(Mo,{size:13,className:"text-amber-400 flex-shrink-0 mt-0.5"}),a.jsxs("p",{className:"text-[12px] text-amber-200",children:["Tudo gira em torno de ",a.jsx("strong",{children:"pedidos"}),". Mensagens podem ser vinculadas a um número de pedido para rastreio."]})]})]})},{id:"setores",icon:a.jsx(dI,{size:28}),gradient:"from-slate-600 to-slate-800",title:"Setores",subtitle:"Navegação e badges na sidebar",content:a.jsxs("div",{className:"space-y-4",children:[a.jsx("p",{className:"text-[14px] text-slate-300 leading-relaxed",children:"A sidebar esquerda lista todos os setores operacionais. Clique em um setor para ver suas mensagens — o setor ativo fica destacado em âmbar."}),a.jsxs("div",{className:"bg-slate-900 border border-white/10 rounded-xl overflow-hidden",children:[a.jsx("div",{className:"px-3 py-2 border-b border-white/5",children:a.jsx("p",{className:"text-[10px] text-slate-500 font-bold uppercase tracking-widest",children:"Setores disponíveis"})}),a.jsx("div",{className:"divide-y divide-white/5",children:[{emoji:"💬",label:"Geral",desc:"Avisos sem setor específico"},{emoji:"📋",label:"Cotação",desc:"Pedidos e cotações de produtos"},{emoji:"📦",label:"Separação",desc:"Processo de separação de itens"},{emoji:"🚚",label:"Expedição",desc:"Despacho e entrega de pedidos",badge:!0}].map(e=>a.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2",children:[a.jsx("span",{className:"text-base leading-none",children:e.emoji}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-[12px] text-white font-medium",children:e.label}),a.jsx("p",{className:"text-[10px] text-slate-500",children:e.desc})]}),e.badge&&a.jsx("span",{className:"bg-rose-500 text-white text-[10px] font-black px-1.5 py-0.5 rounded-full",children:"3"})]},e.label))})]}),a.jsxs("div",{className:"flex items-start gap-2 bg-rose-500/10 border border-rose-500/20 rounded-xl px-3 py-2.5",children:[a.jsx(RP,{size:13,className:"text-rose-400 flex-shrink-0 mt-0.5"}),a.jsx("p",{className:"text-[12px] text-rose-200",children:"O badge vermelho indica mensagens não lidas naquele setor — some ao marcar como lidas."})]})]})},{id:"mensagens",icon:a.jsx(rn,{size:28}),gradient:"from-blue-600 to-blue-800",title:"Mensagens",subtitle:"Leitura, filtros e marcação",content:a.jsxs("div",{className:"space-y-4",children:[a.jsx("p",{className:"text-[14px] text-slate-300 leading-relaxed",children:"Mensagens não lidas ficam destacadas com um ponto âmbar. Lidas aparecem com opacidade reduzida."}),a.jsxs("div",{className:"bg-slate-900 border border-white/10 rounded-xl overflow-hidden divide-y divide-white/5",children:[a.jsxs("div",{className:"flex gap-3 px-3 py-2.5 bg-amber-500/5",children:[a.jsx("div",{className:"w-2 h-2 rounded-full bg-amber-400 mt-1.5 shrink-0"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-baseline gap-2 mb-0.5",children:[a.jsx("span",{className:"text-[12px] font-bold text-white",children:"Ana Silva"}),a.jsxs("span",{className:"text-[10px] text-slate-500 flex items-center gap-0.5",children:[a.jsx(bs,{size:9})," #1042"]}),a.jsx("span",{className:"ml-auto text-[10px] text-slate-600",children:"2min"})]}),a.jsx("p",{className:"text-[11px] text-slate-300",children:"Pedido separado, aguardando auditoria."})]})]}),a.jsxs("div",{className:"flex gap-3 px-3 py-2.5 opacity-50",children:[a.jsx("div",{className:"w-2 h-2 rounded-full bg-slate-700 mt-1.5 shrink-0"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-baseline gap-2 mb-0.5",children:[a.jsx("span",{className:"text-[12px] font-bold text-white",children:"Carlos"}),a.jsx("span",{className:"ml-auto text-[10px] text-slate-600",children:"10min"})]}),a.jsx("p",{className:"text-[11px] text-slate-300",children:"Embalagem finalizada."})]})]})]}),a.jsx("div",{className:"space-y-2",children:[{icon:"✅",tip:"Clique no ✓ para marcar uma mensagem como lida individualmente"},{icon:"☑️",tip:'"Marcar todas lidas" limpa todas as não lidas do setor ativo de uma vez'},{icon:"🔍",tip:'"Só não lidas" filtra e exibe apenas mensagens pendentes de leitura'}].map((e,t)=>a.jsxs("div",{className:"flex items-start gap-2.5",children:[a.jsx("span",{className:"text-[14px] mt-0.5 flex-shrink-0",children:e.icon}),a.jsx("p",{className:"text-[12px] text-slate-300",children:e.tip})]},t))})]})},{id:"enviar",icon:a.jsx(Rr,{size:28}),gradient:"from-emerald-600 to-teal-700",title:"Enviar Mensagem",subtitle:"Compose e atalhos",content:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("p",{className:"text-[14px] text-slate-300 leading-relaxed",children:["O painel de envio fica fixo no rodapé. A mensagem vai para o ",a.jsx("strong",{className:"text-white",children:"setor selecionado"})," na sidebar."]}),a.jsxs("div",{className:"bg-slate-950/50 border border-white/10 rounded-xl p-3 space-y-2",children:[a.jsxs("div",{className:"flex gap-2",children:[a.jsx("div",{className:"w-32 bg-slate-900 border border-white/10 rounded-lg px-2.5 py-1.5 text-[11px] text-slate-500",children:"Pedido # (opcional)"}),a.jsx("p",{className:"text-[10px] text-slate-600 self-center",children:"Ctrl+Enter para enviar"})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("div",{className:"flex-1 bg-slate-900 border border-white/10 rounded-xl px-3 py-2 text-[11px] text-slate-500 min-h-[40px]",children:"Mensagem para Cotação..."}),a.jsxs("button",{className:"self-end px-3 py-1.5 bg-amber-500 text-black font-bold rounded-xl text-[11px] flex items-center gap-1",children:[a.jsx(Rr,{size:11})," Enviar"]})]})]}),a.jsx("div",{className:"space-y-2",children:[{label:"Pedido #",desc:"Vincule a mensagem a um pedido específico para rastreio"},{label:"Ctrl+Enter",desc:"Atalho para enviar sem tirar as mãos do teclado"},{label:"Setor destino",desc:"Mude o setor na sidebar antes de escrever"}].map(e=>a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(Ts,{size:13,className:"text-emerald-400 flex-shrink-0 mt-0.5"}),a.jsxs("div",{children:[a.jsxs("span",{className:"text-[12px] font-semibold text-emerald-300",children:[e.label," — "]}),a.jsx("span",{className:"text-[12px] text-slate-400",children:e.desc})]})]},e.label))}),a.jsxs("div",{className:"flex items-start gap-2 bg-emerald-500/10 border border-emerald-500/20 rounded-xl px-3 py-2.5",children:[a.jsx(Tp,{size:13,className:"text-emerald-400 flex-shrink-0 mt-0.5"}),a.jsx("p",{className:"text-[12px] text-emerald-200",children:"Após enviar, a lista recarrega automaticamente para refletir a nova mensagem."})]})]})},{id:"diferenca",icon:a.jsx(YP,{size:28}),gradient:"from-violet-600 to-indigo-700",title:"Inbox Interno vs WhatsApp Inbox",subtitle:"Quando usar cada um?",content:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("p",{className:"text-[13px] text-slate-300 leading-relaxed",children:["Existem ",a.jsx("strong",{className:"text-white",children:"duas inboxes"})," diferentes no sistema. Cada uma tem um propósito distinto:"]}),a.jsxs("div",{className:"bg-amber-500/10 border border-amber-500/25 rounded-xl p-3 space-y-1.5",children:[a.jsxs("p",{className:"text-[12px] font-bold text-amber-300 flex items-center gap-1.5",children:[a.jsx(Pr,{size:13})," Inbox Interno (você está aqui)"]}),a.jsxs("p",{className:"text-[11px] text-slate-400 leading-snug",children:["Para comunicação sobre o ",a.jsx("strong",{className:"text-white",children:"fluxo de pedidos"})," entre setores. Usado por gestores e operadores."]}),a.jsx("div",{className:"space-y-1 mt-1",children:['📦 "Pedido #1055 com item faltando, verificar estoque"','🧾 "NF do pedido #1098 com divergência de CFOP"','🚚 "Carga do turno pronta para expedição"'].map((e,t)=>a.jsx("p",{className:"text-[11px] text-amber-200/80 bg-amber-500/5 rounded-lg px-2.5 py-1.5 leading-snug",children:e},t))})]}),a.jsxs("div",{className:"bg-[#00a884]/10 border border-[#00a884]/25 rounded-xl p-3 space-y-1.5",children:[a.jsxs("p",{className:"text-[12px] font-bold text-[#25d366] flex items-center gap-1.5",children:[a.jsx(rn,{size:13})," WhatsApp Inbox → menu lateral"]}),a.jsxs("p",{className:"text-[11px] text-slate-400 leading-snug",children:["Para ",a.jsx("strong",{className:"text-white",children:"atendimento ao cliente via WhatsApp"})," e comunicação da equipe de atendentes."]}),a.jsx("div",{className:"space-y-1 mt-1",children:['🤖 "IA escalou cliente que quer falar com humano"','💬 "DM para colega: você atendeu o protocolo #884?"','📣 "Aviso do gerente para toda equipe de atendimento"'].map((e,t)=>a.jsx("p",{className:"text-[11px] text-[#25d366]/80 bg-[#00a884]/5 rounded-lg px-2.5 py-1.5 leading-snug",children:e},t))})]}),a.jsx("p",{className:"text-[11px] text-slate-500 text-center",children:"Regra rápida: pedido → Inbox Interno · cliente/atendente → WhatsApp Inbox"})]})}];function Wve({total:e,current:t,onGo:n}){return a.jsx("div",{className:"flex items-center gap-1.5",children:Array.from({length:e}).map((r,s)=>a.jsx("button",{onClick:()=>n(s),className:`rounded-full transition-all duration-200 ${s===t?"w-5 h-2 bg-amber-400":"w-2 h-2 bg-slate-700 hover:bg-slate-500"}`},s))})}function qve({onClose:e}){const[t,n]=b.useState(0),r=n_.length,s=n_[t],i=b.useCallback(()=>n(l=>Math.min(l+1,r-1)),[r]),o=b.useCallback(()=>n(l=>Math.max(l-1,0)),[]);return b.useEffect(()=>{const l=c=>{c.key==="Escape"&&e(),c.key==="ArrowRight"&&i(),c.key==="ArrowLeft"&&o()};return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[e,i,o]),a.jsx("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center bg-black/60 backdrop-blur-sm p-4",onClick:l=>{l.target===l.currentTarget&&e()},children:a.jsxs("div",{className:"bg-slate-900 border border-white/10 rounded-2xl shadow-2xl w-full max-w-md overflow-hidden flex flex-col",style:{maxHeight:"90vh"},children:[a.jsxs("div",{className:`bg-gradient-to-br ${s.gradient} px-6 pt-6 pb-5 relative flex-shrink-0`,children:[a.jsx("button",{onClick:e,className:"absolute top-4 right-4 p-1.5 rounded-full bg-black/20 hover:bg-black/40 text-white transition",children:a.jsx(Ce,{size:14})}),a.jsxs("div",{className:"flex items-start gap-4",children:[a.jsx("div",{className:"w-12 h-12 rounded-2xl bg-black/20 flex items-center justify-center text-white flex-shrink-0",children:s.icon}),a.jsxs("div",{className:"flex-1 min-w-0 pt-0.5",children:[a.jsxs("p",{className:"text-white/60 text-[11px] font-medium uppercase tracking-widest",children:[t+1," de ",r]}),a.jsx("h2",{className:"text-white text-[18px] font-bold leading-tight mt-0.5",children:s.title}),a.jsx("p",{className:"text-white/70 text-[12px] mt-0.5",children:s.subtitle})]})]})]}),a.jsx("div",{className:"flex-1 overflow-y-auto px-6 py-5 min-h-0",children:s.content}),a.jsxs("div",{className:"flex-shrink-0 flex items-center justify-between px-6 py-4 border-t border-white/10 bg-slate-950/60",children:[a.jsxs("button",{onClick:o,disabled:t===0,className:"flex items-center gap-1.5 px-4 py-2 rounded-xl text-[12px] font-medium text-slate-400 hover:bg-white/5 disabled:opacity-30 disabled:cursor-not-allowed transition",children:[a.jsx(xd,{size:15}),"Anterior"]}),a.jsx(Wve,{total:r,current:t,onGo:n}),t<r-1?a.jsxs("button",{onClick:i,className:"flex items-center gap-1.5 px-4 py-2 rounded-xl text-[12px] font-medium bg-amber-500 hover:bg-amber-400 text-black font-bold transition",children:["Próximo",a.jsx(Pa,{size:15})]}):a.jsxs("button",{onClick:e,className:"flex items-center gap-1.5 px-4 py-2 rounded-xl text-[12px] font-medium bg-amber-500 hover:bg-amber-400 text-black font-bold transition",children:[a.jsx(Ts,{size:14}),"Entendido"]})]})]})})}function Hve(){const[e,t]=b.useState([]),[n,r]=b.useState(!1),[s,i]=b.useState(!1);async function o(){i(!0);try{const u=await pt.wppSemResposta();t(u)}catch{}finally{i(!1)}}if(b.useEffect(()=>{o();const u=setInterval(o,6e4);return()=>clearInterval(u)},[]),!e.length)return null;const l=u=>u.replace("@s.whatsapp.net","").replace("@c.us",""),c=u=>u>=60?`${Math.floor(u/60)}h${u%60>0?String(u%60).padStart(2,"0")+"min":""}`:`${u}min`;return a.jsxs("div",{className:"border-b border-amber-500/30 bg-amber-500/5",children:[a.jsxs("button",{onClick:()=>r(u=>!u),className:"w-full flex items-center gap-3 px-4 py-2.5 text-left hover:bg-amber-500/5 transition-colors",children:[a.jsx(Kt,{size:14,className:"text-amber-400 shrink-0 animate-pulse"}),a.jsxs("span",{className:"text-amber-400 font-black text-xs flex-1",children:[e.length," chat",e.length>1?"s":""," sem resposta da IA"]}),a.jsx("button",{onClick:u=>{u.stopPropagation(),o()},className:"p-1 text-amber-600 hover:text-amber-400 transition-colors",children:a.jsx(ke,{size:11,className:s?"animate-spin":""})}),a.jsx("span",{className:"text-amber-600 text-[10px]",children:n?"▲":"▼"})]}),n&&a.jsx("div",{className:"max-h-52 overflow-y-auto border-t border-amber-500/20",children:e.map((u,d)=>a.jsxs("div",{className:"flex items-start gap-3 px-4 py-2.5 border-b border-white/5 last:border-0",children:[a.jsx(x1,{size:13,className:"text-amber-500 shrink-0 mt-0.5"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-xs font-bold text-white truncate",children:l(u.chat_id)}),a.jsxs("p",{className:"text-[11px] text-slate-400 truncate",children:['"',u.ultima_msg||"—",'"']}),u.ultima_reply_status==="failed"&&a.jsx("p",{className:"text-[10px] text-rose-400 font-bold mt-0.5",children:"IA falhou na última tentativa"})]}),a.jsxs("div",{className:"flex items-center gap-1 shrink-0 text-amber-400",children:[a.jsx(hn,{size:10}),a.jsx("span",{className:"text-[10px] font-bold",children:c(Number(u.minutos_aguardando))})]})]},d))})]})}const ap=[{id:"geral",label:"Geral",emoji:"💬"},{id:"atendimento",label:"Atendimento",emoji:"🎧"},{id:"cotacao",label:"Cotação",emoji:"📋"},{id:"separacao",label:"Separação",emoji:"📦"},{id:"embalagem",label:"Embalagem",emoji:"🎁"},{id:"auditoria",label:"Auditoria",emoji:"🔍"},{id:"fiscal",label:"Fiscal",emoji:"🧾"},{id:"expedicao",label:"Expedição",emoji:"🚚"},{id:"financeiro",label:"Financeiro",emoji:"💰"},{id:"suporte",label:"Suporte",emoji:"🛠"}];function Kve(e){const t=new Date(e),n=Date.now()-t.getTime();return n<6e4?"agora":n<36e5?`${Math.floor(n/6e4)}min`:n<864e5?t.toLocaleTimeString("pt-BR",{hour:"2-digit",minute:"2-digit"}):t.toLocaleDateString("pt-BR")}function Gve({msg:e,onLer:t}){return a.jsxs("div",{className:`flex gap-3 p-4 border-b border-white/5 transition-colors
${e.lida?"opacity-60":"bg-amber-500/3 hover:bg-white/3"}`,children:[a.jsx("div",{className:`w-2 h-2 rounded-full mt-1.5 shrink-0 ${e.lida?"bg-slate-700":"bg-amber-400"}`}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-baseline gap-2 mb-0.5",children:[a.jsx("span",{className:"text-sm font-semibold text-white",children:e.remetente}),e.pedido_id&&a.jsxs("span",{className:"text-[10px] text-slate-500 flex items-center gap-0.5",children:[a.jsx(bs,{size:9})," #",e.pedido_id]}),a.jsx("span",{className:"ml-auto text-[10px] text-slate-600 shrink-0",children:Kve(e.created_at)})]}),a.jsx("p",{className:"text-sm text-slate-300 leading-snug",children:e.mensagem})]}),!e.lida&&a.jsx("button",{onClick:()=>t(e.id),title:"Marcar como lida",className:"text-slate-600 hover:text-emerald-400 transition-colors shrink-0 mt-0.5",children:a.jsx(jt,{size:14})})]})}function Xve({setorAtivo:e,onSent:t}){var p;const[n,r]=b.useState(""),[s,i]=b.useState(""),[o,l]=b.useState(!1),[c,u]=b.useState("");async function d(){var h,m;if(n.trim()){l(!0),u("");try{await So.enviar({setor:e,mensagem:n.trim(),pedido_id:s?Number(s):void 0}),r(""),i(""),t()}catch(v){u(((m=(h=v==null?void 0:v.response)==null?void 0:h.data)==null?void 0:m.error)??"Erro ao enviar")}finally{l(!1)}}}function f(h){h.key==="Enter"&&(h.ctrlKey||h.metaKey)&&d()}return a.jsxs("div",{className:"border-t border-white/10 p-4 bg-slate-950/50",children:[c&&a.jsxs("p",{className:"text-xs text-rose-400 mb-2 flex items-center gap-1",children:[a.jsx(Ce,{size:12})," ",c]}),a.jsxs("div",{className:"flex gap-2 mb-2",children:[a.jsx("input",{type:"number",value:s,onChange:h=>i(h.target.value),placeholder:"Pedido # (opcional)",className:"w-32 bg-slate-900 border border-white/10 rounded-lg px-3 py-1.5 text-sm text-white placeholder:text-slate-600 focus:outline-none focus:border-amber-500/50"}),a.jsx("span",{className:"text-xs text-slate-600 self-center",children:"Ctrl+Enter para enviar"})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("textarea",{value:n,onChange:h=>r(h.target.value),onKeyDown:f,placeholder:`Mensagem para ${((p=ap.find(h=>h.id===e))==null?void 0:p.label)??e}...`,rows:2,className:"flex-1 bg-slate-900 border border-white/10 rounded-xl px-3 py-2 text-sm text-white placeholder:text-slate-600 resize-none focus:outline-none focus:border-amber-500/50"}),a.jsxs("button",{onClick:d,disabled:o||!n.trim(),className:"self-end px-4 py-2 bg-amber-500 text-black font-bold rounded-xl hover:bg-amber-400 disabled:opacity-50 transition-colors flex items-center gap-1.5",children:[o?a.jsx(ke,{size:14,className:"animate-spin"}):a.jsx(Rr,{size:14}),"Enviar"]})]})]})}function r_(){var j,N;const[e,t]=b.useState("geral"),[n,r]=b.useState([]),[s,i]=b.useState(!1),[o,l]=b.useState({}),[c,u]=b.useState(!1),[d,f]=b.useState(!1),p=b.useRef(null);async function h(){try{const{por_setor:w}=await So.contadores(),S={};for(const k of w)S[k.setor]=Number(k.total);l(S)}catch{}}async function m(w,S){i(!0);try{const k=await So.listBySetor(w,S||void 0);r(k)}catch{}finally{i(!1)}}b.useEffect(()=>{h(),m(e,c);const w=setInterval(h,3e4);return()=>clearInterval(w)},[]),b.useEffect(()=>{m(e,c)},[e,c]);async function v(w){await So.marcarLida(w),r(S=>S.map(k=>k.id===w?{...k,lida:!0}:k)),h()}async function x(){await So.marcarTodasSetor(e),r(w=>w.map(S=>({...S,lida:!0}))),h()}function y(){m(e,c)}const g=n.filter(w=>!w.lida).length;return a.jsxs("div",{className:"flex h-screen bg-black overflow-hidden",children:[d&&a.jsx(qve,{onClose:()=>f(!1)}),a.jsxs("div",{className:"w-52 shrink-0 bg-slate-950 border-r border-white/10 flex flex-col",children:[a.jsx(Hve,{}),a.jsxs("div",{className:"px-4 py-3 border-b border-white/10 flex items-center gap-2",children:[a.jsxs("h2",{className:"text-sm font-black text-white flex items-center gap-2 flex-1",children:[a.jsx(Pr,{size:15,className:"text-amber-400"})," Inbox"]}),a.jsx("button",{onClick:()=>f(!0),title:"Ajuda",className:"p-1 rounded-full text-slate-600 hover:text-amber-400 hover:bg-white/5 transition-colors",children:a.jsx(Ol,{size:14})})]}),a.jsx("div",{className:"flex-1 overflow-y-auto py-2",children:ap.map(w=>a.jsxs("button",{onClick:()=>t(w.id),className:`w-full flex items-center gap-2.5 px-4 py-2.5 text-left transition-colors
${e===w.id?"bg-amber-500/10 text-amber-400":"text-slate-400 hover:text-white hover:bg-white/3"}`,children:[a.jsx("span",{className:"text-base leading-none",children:w.emoji}),a.jsx("span",{className:"text-sm font-medium flex-1",children:w.label}),o[w.id]>0&&a.jsx("span",{className:"bg-rose-500 text-white text-[10px] font-black px-1.5 py-0.5 rounded-full leading-none",children:o[w.id]}),e===w.id&&a.jsx(Pa,{size:12,className:"shrink-0"})]},w.id))})]}),a.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[a.jsxs("div",{className:"flex items-center justify-between gap-3 px-5 py-3 border-b border-white/10 bg-slate-950/60",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-lg leading-none",children:(j=ap.find(w=>w.id===e))==null?void 0:j.emoji}),a.jsx("span",{className:"font-bold text-white",children:(N=ap.find(w=>w.id===e))==null?void 0:N.label}),o[e]>0&&a.jsxs("span",{className:"bg-rose-500/10 text-rose-400 border border-rose-500/20 text-xs px-2 py-0.5 rounded-full font-bold",children:[o[e]," não lida",o[e]>1?"s":""]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("label",{className:"flex items-center gap-1.5 text-xs text-slate-400 cursor-pointer select-none",children:[a.jsx("input",{type:"checkbox",checked:c,onChange:w=>u(w.target.checked),className:"accent-amber-500"}),"Só não lidas"]}),g>0&&a.jsxs("button",{onClick:x,className:"flex items-center gap-1.5 text-xs text-emerald-400 hover:text-emerald-300 transition-colors",children:[a.jsx(Tp,{size:13})," Marcar todas lidas"]}),a.jsx("button",{onClick:()=>m(e,c),className:"p-1.5 text-slate-500 hover:text-white rounded-lg hover:bg-white/5 transition-colors",children:a.jsx(ke,{size:13})})]})]}),a.jsx("div",{ref:p,className:"flex-1 overflow-y-auto",children:s?a.jsx("div",{className:"flex items-center justify-center py-20",children:a.jsx("div",{className:"w-6 h-6 border-2 border-amber-500 border-t-transparent rounded-full animate-spin"})}):n.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center py-20 gap-3 text-slate-600",children:[a.jsx(rn,{size:36,className:"opacity-30"}),a.jsxs("p",{className:"text-sm",children:["Nenhuma mensagem",c?" não lida":""," neste setor."]})]}):n.map(w=>a.jsx(Gve,{msg:w,onLer:v},w.id))}),a.jsx(Xve,{setorAtivo:e,onSent:y})]})]})}const Af=e=>e!=null?`R$ ${Number(e).toFixed(2).replace(".",",")}`:"—",Ya=e=>e!=null?Number(e).toLocaleString("pt-BR"):"—";function ti(){return new Date().toISOString().slice(0,10)}function pb(e){const t=new Date;return t.setDate(t.getDate()-e),t.toISOString().slice(0,10)}function Yve({from:e,to:t}){const[n,r]=b.useState([]),[s,i]=b.useState(!1);return b.useEffect(()=>{i(!0),$.get("/cotacoes/admin/relatorio/ranking",{params:{from:e,to:t}}).then(o=>r(o.data??[])).catch(()=>{}).finally(()=>i(!1))},[e,t]),s?a.jsx("div",{className:"flex items-center justify-center py-16",children:a.jsx(ke,{size:20,className:"animate-spin text-amber-400"})}):n.length?a.jsx("div",{className:"flex flex-col gap-3",children:n.map((o,l)=>a.jsxs("div",{className:"bg-slate-900 border border-white/10 rounded-2xl p-4 flex items-center gap-4",children:[a.jsx("div",{className:"w-10 h-10 rounded-xl flex items-center justify-center text-lg font-black shrink-0",style:{background:l===0?"#f59e0b22":l===1?"#94a3b822":"#475569/10",color:l===0?"#f59e0b":l===1?"#94a3b8":"#64748b"},children:l===0?"🥇":l===1?"🥈":l===2?"🥉":`#${l+1}`}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("p",{className:"text-sm font-bold text-white",children:["Equipe ",o.equipe_id]}),a.jsxs("div",{className:"flex flex-wrap gap-x-4 gap-y-0.5 mt-0.5 text-xs text-slate-400",children:[a.jsxs("span",{children:["✅ ",Ya(o.pedidos_entregues)," entregues"]}),a.jsxs("span",{children:["📦 ",Ya(o.pedidos_processados)," processados"]}),o.media_horas_entrega!=null&&a.jsxs("span",{children:["⏱ ",o.media_horas_entrega,"h média"]})]})]})]},o.equipe_id))}):a.jsx("div",{className:"text-center py-16 text-slate-500 text-sm",children:"Nenhum dado encontrado para o período selecionado."})}const Qve={aguardando:"Aguardando",separacao:"Separação",embalagem:"Embalagem",auditoria:"Auditoria",fiscal:"Fiscal",expedicao:"Expedição",entregue:"Entregue",cancelado:"Cancelado"};function Jve({from:e,to:t}){var f,p;const[n,r]=b.useState(null),[s,i]=b.useState(!1);if(b.useEffect(()=>{i(!0),$.get("/cotacoes/admin/relatorio/setor",{params:{from:e,to:t}}).then(h=>r(h.data)).catch(()=>{}).finally(()=>i(!1))},[e,t]),s)return a.jsx("div",{className:"flex items-center justify-center py-16",children:a.jsx(ke,{size:20,className:"animate-spin text-amber-400"})});if(!n)return null;const{volume_por_status:o=[],volume_por_dia:l=[],top_clientes:c=[]}=n,u=o.reduce((h,m)=>h+Number(m.total),0),d=o.reduce((h,m)=>h+Number(m.receita||0),0);return a.jsxs("div",{className:"flex flex-col gap-6",children:[a.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4",children:[{label:"Total de Pedidos",value:Ya(u),icon:bs,color:"#f59e0b"},{label:"Receita Total",value:Af(d),icon:Wi,color:"#10b981"},{label:"Entregues",value:Ya(((f=o.find(h=>h.status==="entregue"))==null?void 0:f.total)??0),icon:ym,color:"#06b6d4"},{label:"Cancelados",value:Ya(((p=o.find(h=>h.status==="cancelado"))==null?void 0:p.total)??0),icon:et,color:"#f43f5e"}].map(h=>{const m=h.icon;return a.jsxs("div",{className:"bg-slate-900 border border-white/10 rounded-2xl p-4",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(m,{size:14,style:{color:h.color}}),a.jsx("p",{className:"text-xs text-slate-400",children:h.label})]}),a.jsx("p",{className:"text-xl font-black text-white",children:h.value})]},h.label)})}),a.jsxs("div",{className:"bg-slate-900 border border-white/10 rounded-2xl p-4",children:[a.jsx("p",{className:"text-sm font-bold text-white mb-3",children:"Volume por Status"}),a.jsx("div",{className:"flex flex-col gap-2",children:o.map(h=>{const m=u>0?Number(h.total)/u*100:0;return a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("span",{className:"text-xs text-slate-400 w-24 shrink-0",children:Qve[h.status]??h.status}),a.jsx("div",{className:"flex-1 bg-slate-800 rounded-full h-1.5",children:a.jsx("div",{className:"h-1.5 rounded-full bg-amber-500",style:{width:`${m}%`}})}),a.jsx("span",{className:"text-xs text-white font-bold w-6 text-right",children:Ya(h.total)}),a.jsx("span",{className:"text-xs text-slate-500 w-24 text-right",children:Af(h.receita)})]},h.status)})})]}),l.length>0&&a.jsxs("div",{className:"bg-slate-900 border border-white/10 rounded-2xl p-4 overflow-x-auto",children:[a.jsxs("p",{className:"text-sm font-bold text-white mb-3",children:["Volume por Dia (últimos ",l.length," dias)"]}),a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"text-slate-500 border-b border-white/10",children:[a.jsx("th",{className:"text-left py-1 pr-4",children:"Data"}),a.jsx("th",{className:"text-right py-1 pr-4",children:"Pedidos"}),a.jsx("th",{className:"text-right py-1",children:"Receita"})]})}),a.jsx("tbody",{children:l.map(h=>a.jsxs("tr",{className:"border-b border-white/5 hover:bg-white/3",children:[a.jsx("td",{className:"py-1.5 pr-4 text-slate-300",children:new Date(h.dia).toLocaleDateString("pt-BR")}),a.jsx("td",{className:"py-1.5 pr-4 text-right font-bold text-white",children:Ya(h.pedidos)}),a.jsx("td",{className:"py-1.5 text-right text-emerald-400",children:Af(h.receita)})]},h.dia))})]})]}),c.length>0&&a.jsxs("div",{className:"bg-slate-900 border border-white/10 rounded-2xl p-4",children:[a.jsx("p",{className:"text-sm font-bold text-white mb-3",children:"Top 10 Clientes"}),a.jsx("div",{className:"flex flex-col gap-2",children:c.map((h,m)=>a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs("span",{className:"text-xs text-slate-500 w-4 text-right shrink-0",children:[m+1,"."]}),a.jsx("span",{className:"text-xs text-white flex-1 truncate",children:h.cliente??"—"}),a.jsxs("span",{className:"text-xs text-slate-400",children:[Ya(h.pedidos)," ped."]}),a.jsx("span",{className:"text-xs font-bold text-amber-400 w-24 text-right",children:Af(h.gasto)})]},m))})]})]})}const Zve=[{label:"Hoje",from:()=>ti(),to:()=>ti()},{label:"7 dias",from:()=>pb(7),to:()=>ti()},{label:"30 dias",from:()=>pb(30),to:()=>ti()},{label:"Mês",from:()=>ti().slice(0,7)+"-01",to:()=>ti()}];function eye(){const[e,t]=b.useState("performance"),[n,r]=b.useState(pb(30)),[s,i]=b.useState(ti());return a.jsxs("div",{className:"max-w-4xl mx-auto",children:[a.jsx("div",{className:"flex flex-wrap items-center justify-between gap-4 mb-8",children:a.jsxs("div",{children:[a.jsxs("h1",{className:"text-2xl font-black text-white flex items-center gap-2",children:[a.jsx(ys,{size:22,className:"text-amber-400"})," Relatórios"]}),a.jsx("p",{className:"text-slate-400 text-sm mt-0.5",children:"Performance operacional e ranking de equipes"})]})}),a.jsxs("div",{className:"flex flex-wrap gap-2 mb-5",children:[Zve.map(o=>a.jsx("button",{onClick:()=>{r(o.from()),i(o.to())},className:`px-3 py-1.5 rounded-lg text-xs font-semibold transition-colors
${n===o.from()&&s===o.to()?"bg-amber-500 text-black":"bg-slate-800 text-slate-400 hover:text-white"}`,children:o.label},o.label)),a.jsxs("div",{className:"flex items-center gap-1 ml-auto",children:[a.jsx(Op,{size:13,className:"text-slate-500"}),a.jsx("input",{type:"date",value:n,onChange:o=>r(o.target.value),className:"bg-slate-900 border border-white/10 rounded-lg px-2 py-1 text-xs text-white"}),a.jsx("span",{className:"text-slate-500 text-xs",children:"até"}),a.jsx("input",{type:"date",value:s,onChange:o=>i(o.target.value),className:"bg-slate-900 border border-white/10 rounded-lg px-2 py-1 text-xs text-white"})]})]}),a.jsx("div",{className:"flex gap-1 bg-slate-900 rounded-xl p-1 mb-6 w-fit",children:[{id:"performance",label:"Performance",icon:Wi},{id:"ranking",label:"Ranking Equipes",icon:ym}].map(o=>{const l=o.icon;return a.jsxs("button",{onClick:()=>t(o.id),className:`flex items-center gap-1.5 px-4 py-2 rounded-lg text-sm font-semibold transition-colors
${e===o.id?"bg-amber-500 text-black":"text-slate-400 hover:text-white"}`,children:[a.jsx(l,{size:14})," ",o.label]},o.id)})}),e==="performance"&&a.jsx(Jve,{from:n,to:s}),e==="ranking"&&a.jsx(Yve,{from:n,to:s})]})}function tye(e){return`R$ ${Number(e||0).toFixed(2).replace(".",",")}`}function a_(e){try{const t=new AudioContext,n=t.createOscillator(),r=t.createGain();n.connect(r),r.connect(t.destination),n.frequency.value=e?880:330,n.type="sine",r.gain.setValueAtTime(.4,t.currentTime),r.gain.exponentialRampToValueAtTime(.001,t.currentTime+.18),n.start(t.currentTime),n.stop(t.currentTime+.18)}catch{}}function s_(e){var t;try{(t=navigator.vibrate)==null||t.call(navigator,e?[50]:[80,40,80])}catch{}}function nye({pedido:e,onClick:t}){return a.jsxs("button",{onClick:t,className:"w-full text-left bg-slate-900 border border-white/10 rounded-2xl p-4 hover:border-amber-500/30 transition-all active:scale-[.98]",children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-white font-bold text-sm",children:e.protocolo||`#${e.id}`}),a.jsx("p",{className:"text-slate-400 text-xs mt-0.5 truncate",children:e.cliente_nome||"—"})]}),a.jsx("span",{className:"text-xs font-black text-amber-400 shrink-0",children:tye(e.total)})]}),a.jsx("div",{className:"mt-3 flex items-center gap-2",children:a.jsx("span",{className:"text-[10px] font-black uppercase tracking-widest bg-blue-500/10 text-blue-400 border border-blue-500/20 px-2 py-0.5 rounded-full",children:"Separação"})})]})}const i_=[{id:"falta",label:"🚫 Falta",cor:"border-rose-500/40 text-rose-400 bg-rose-500/10"},{id:"marca_diferente",label:"🔄 Marca diferente",cor:"border-amber-500/40 text-amber-400 bg-amber-500/10"},{id:"substituicao",label:"📸 Substituição",cor:"border-blue-500/40 text-blue-400 bg-blue-500/10"}];function rye({item:e,onSeparado:t,onAlerta:n}){const[r,s]=b.useState(!1),[i,o]=b.useState(e.alerta_tipo||""),[l,c]=b.useState(e.alerta_obs||""),[u,d]=b.useState(e.alerta_foto||""),[f,p]=b.useState(!1);async function h(){if(i){p(!0);try{await $.patch(`/cotacoes/admin/pedidos/itens/${e.id}/alerta`,{tipo:i,obs:l,foto:u||null}),n(e.id,{alerta_tipo:i,alerta_obs:l,alerta_foto:u||null,alerta_confirmado:!1}),s(!1)}catch{}finally{p(!1)}}}async function m(){p(!0);try{await $.delete(`/cotacoes/admin/pedidos/itens/${e.id}/alerta`),n(e.id,{alerta_tipo:null,alerta_obs:null,alerta_foto:null,alerta_confirmado:!1}),o(""),c(""),d("")}catch{}finally{p(!1)}}const v=i_.find(x=>x.id===e.alerta_tipo);return a.jsxs("div",{className:`rounded-xl border transition-all ${e.separado?"bg-emerald-500/5 border-emerald-500/20":e.alerta_tipo?"bg-slate-900 border-rose-500/30":"bg-slate-900 border-white/8"}`,children:[a.jsxs("div",{className:"flex items-center gap-3 p-3",children:[a.jsx("button",{onClick:()=>t(e.id,!e.separado),className:`w-7 h-7 rounded-lg flex items-center justify-center shrink-0 border-2 transition-all ${e.separado?"bg-emerald-500 border-emerald-500 text-white":"border-slate-600 hover:border-amber-400"}`,children:e.separado&&a.jsx(jt,{size:14})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:`text-sm font-bold truncate ${e.separado?"text-slate-500 line-through":"text-white"}`,children:e.nome_produto}),a.jsxs("p",{className:"text-xs text-slate-600",children:[e.sku&&a.jsxs("span",{className:"text-slate-500 font-mono",children:[e.sku," · "]}),"Qtd: ",e.quantidade]}),e.observacao&&!e.separado&&a.jsxs("div",{className:"mt-1.5 flex items-start gap-1.5 bg-amber-500/10 border border-amber-500/30 rounded-lg px-2 py-1",children:[a.jsx(Kt,{size:12,className:"text-amber-400 shrink-0 mt-0.5"}),a.jsx("p",{className:"text-xs text-amber-300 font-semibold leading-tight",children:e.observacao})]}),e.alerta_tipo&&!r&&a.jsxs("div",{className:`mt-1.5 flex items-center gap-1.5 rounded-lg px-2 py-1 border text-xs font-bold ${(v==null?void 0:v.cor)??""}`,children:[a.jsx("span",{className:"flex-1",children:(v==null?void 0:v.label)??e.alerta_tipo}),e.alerta_confirmado&&a.jsx("span",{className:"text-emerald-400 text-[10px]",children:"✓ Confirmado"})]})]}),!e.separado&&a.jsx("button",{onClick:()=>{o(e.alerta_tipo||""),c(e.alerta_obs||""),d(e.alerta_foto||""),s(x=>!x)},title:"Sinalizar problema",className:`w-8 h-8 rounded-lg flex items-center justify-center shrink-0 border transition-all ${e.alerta_tipo?"bg-rose-500/20 border-rose-500/40 text-rose-400":"border-slate-700 text-slate-500 hover:text-amber-400 hover:border-amber-500/40"}`,children:e.alerta_tipo?a.jsx(oI,{size:14}):a.jsx(Vf,{size:14})})]}),r&&a.jsxs("div",{className:"border-t border-white/8 px-3 pb-3 pt-2 space-y-2",children:[a.jsx("p",{className:"text-[10px] font-black uppercase tracking-widest text-slate-500",children:"Sinalizar problema"}),a.jsx("div",{className:"flex gap-1.5 flex-wrap",children:i_.map(x=>a.jsx("button",{onClick:()=>o(x.id),className:`text-xs px-2.5 py-1 rounded-full border font-semibold transition-all ${i===x.id?x.cor:"border-slate-700 text-slate-500 hover:border-slate-500"}`,children:x.label},x.id))}),a.jsx("input",{value:l,onChange:x=>c(x.target.value),placeholder:"Observação (opcional)",className:"w-full bg-slate-800 border border-white/10 rounded-lg px-2.5 py-1.5 text-xs text-white placeholder:text-slate-600 focus:outline-none focus:border-amber-500/40"}),a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(BP,{size:14,className:"text-slate-500 shrink-0"}),a.jsx("input",{value:u,onChange:x=>d(x.target.value),placeholder:"URL da foto (opcional)",className:"flex-1 bg-slate-800 border border-white/10 rounded-lg px-2.5 py-1.5 text-xs text-white placeholder:text-slate-600 focus:outline-none focus:border-amber-500/40"})]}),a.jsxs("div",{className:"flex gap-2 pt-1",children:[a.jsx("button",{onClick:h,disabled:!i||f,className:"flex-1 bg-amber-500 text-black text-xs font-black py-1.5 rounded-lg disabled:opacity-40",children:f?"…":"Salvar alerta"}),e.alerta_tipo&&a.jsx("button",{onClick:m,disabled:f,className:"px-3 py-1.5 rounded-lg border border-rose-500/30 text-rose-400 text-xs font-bold",children:a.jsx(Ce,{size:12})}),a.jsx("button",{onClick:()=>s(!1),className:"px-3 py-1.5 rounded-lg border border-white/10 text-slate-400 text-xs",children:"Cancelar"})]})]})]})}function aye({pedido:e,onBack:t}){const[n,r]=b.useState(e.itens||[]),[s,i]=b.useState(""),[o,l]=b.useState(null),[c,u]=b.useState(""),[d,f]=b.useState(!1),[p,h]=b.useState(""),m=b.useRef(null),v=b.useRef(null),x=b.useRef(!1),y=b.useRef(null),g=n.filter(A=>A.separado).length,j=n.length,N=g===j&&j>0,w=b.useCallback(async(A,E)=>{await $.patch(`/cotacoes/admin/pedidos/itens/${A}/separado`,{separado:E}),r(P=>P.map(D=>D.id===A?{...D,separado:E}:D))},[]),S=b.useCallback(async A=>{const E=A.trim().toUpperCase();if(!E)return;const P=n.find(D=>{var I;return!D.separado&&((I=D.sku)==null?void 0:I.toUpperCase())===E});P?(a_(!0),s_(!0),l("ok"),u(`✓ ${P.nome_produto}`),await w(P.id,!0)):n.find(I=>{var R;return I.separado&&((R=I.sku)==null?void 0:R.toUpperCase())===E})?(l("err"),u("Já separado")):(a_(!1),s_(!1),l("err"),u(`SKU não encontrado: ${E}`)),setTimeout(()=>l(null),1800)},[n,w]),k=b.useCallback(async()=>{h("");try{const A=await navigator.mediaDevices.getUserMedia({video:{facingMode:"environment"}});v.current=A,m.current&&(m.current.srcObject=A,await m.current.play()),"BarcodeDetector"in window&&(y.current=new BarcodeDetector({formats:["ean_13","ean_8","code_128","code_39","qr_code"]})),f(!0),x.current=!0;const E=async()=>{if(x.current){if(y.current&&m.current&&m.current.readyState>=2)try{const P=await y.current.detect(m.current);if(P.length>0){const D=P[0].rawValue;x.current=!1,await S(D),setTimeout(()=>{x.current=!0,requestAnimationFrame(E)},1900);return}}catch{}requestAnimationFrame(E)}};requestAnimationFrame(E)}catch(A){h((A==null?void 0:A.message)||"Câmera indisponível")}},[S]),C=b.useCallback(()=>{var A;x.current=!1,(A=v.current)==null||A.getTracks().forEach(E=>E.stop()),v.current=null,f(!1)},[]);b.useEffect(()=>()=>{var A;x.current=!1,(A=v.current)==null||A.getTracks().forEach(E=>E.stop())},[]);async function _(A){A.preventDefault(),await S(s),i("")}return a.jsxs("div",{className:"flex flex-col min-h-screen bg-slate-950",children:[a.jsxs("div",{className:"flex items-center gap-3 px-4 py-4 border-b border-white/5",children:[a.jsx("button",{onClick:t,className:"text-slate-400 hover:text-white transition-colors",children:a.jsx(xd,{size:22})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-white font-black text-sm truncate",children:e.protocolo||`Pedido #${e.id}`}),a.jsx("p",{className:"text-slate-500 text-xs truncate",children:e.cliente_nome})]}),a.jsxs("div",{className:"text-right shrink-0",children:[a.jsxs("p",{className:"text-sm font-black",style:{color:N?"#10b981":"#f59e0b"},children:[g,"/",j]}),a.jsx("p",{className:"text-[10px] text-slate-500",children:"itens"})]})]}),a.jsx("div",{className:"h-1 bg-slate-800",children:a.jsx("div",{className:"h-1 transition-all duration-500",style:{width:j>0?`${g/j*100}%`:"0%",background:N?"#10b981":"#f59e0b"}})}),o&&a.jsxs("div",{className:`mx-4 mt-4 px-4 py-3 rounded-2xl flex items-center gap-2 text-sm font-bold transition-all ${o==="ok"?"bg-emerald-500/10 border border-emerald-500/30 text-emerald-400":"bg-rose-500/10 border border-rose-500/30 text-rose-400"}`,children:[o==="ok"?a.jsx(nn,{size:18}):a.jsx(Kt,{size:18}),c]}),a.jsxs("div",{className:"relative mx-4 mt-4 rounded-2xl overflow-hidden bg-slate-900 border border-white/10",style:{height:220},children:[a.jsx("video",{ref:m,className:"w-full h-full object-cover",playsInline:!0,muted:!0,style:{display:d?"block":"none"}}),!d&&a.jsx("div",{className:"absolute inset-0 flex flex-col items-center justify-center gap-2 text-slate-500",children:p?a.jsxs(a.Fragment,{children:[a.jsx(W2,{size:32}),a.jsx("p",{className:"text-xs text-center px-4",children:p})]}):a.jsxs(a.Fragment,{children:[a.jsx(q2,{size:32}),a.jsx("p",{className:"text-xs",children:"Toque para ativar a câmera"})]})}),d&&a.jsx("div",{className:"absolute inset-0 pointer-events-none flex items-center justify-center",children:a.jsx("div",{className:"w-48 h-24 border-2 border-amber-400/60 rounded-lg"})}),a.jsx("button",{onClick:d?C:k,className:`absolute bottom-3 right-3 p-2 rounded-xl text-sm font-bold transition-all ${d?"bg-rose-500/20 text-rose-400":"bg-amber-500/20 text-amber-400"}`,children:d?a.jsx(W2,{size:18}):a.jsx(q2,{size:18})})]}),a.jsxs("form",{onSubmit:_,className:"mx-4 mt-3 flex gap-2",children:[a.jsxs("div",{className:"flex-1 flex items-center bg-slate-900 border border-white/10 rounded-xl px-3 gap-2",children:[a.jsx(Ir,{size:16,className:"text-slate-500 shrink-0"}),a.jsx("input",{type:"text",value:s,onChange:A=>i(A.target.value),placeholder:"Digitar SKU manualmente…",className:"flex-1 bg-transparent py-2.5 text-sm text-white placeholder-slate-600 focus:outline-none"})]}),a.jsx("button",{type:"submit",className:"px-4 py-2.5 bg-amber-500 text-black rounded-xl font-black text-sm shrink-0",children:"OK"})]}),N?a.jsxs("div",{className:"flex flex-col items-center justify-center py-8 gap-2 text-emerald-400",children:[a.jsx(nn,{size:40}),a.jsx("p",{className:"font-black text-lg",children:"Separação completa!"}),a.jsx("p",{className:"text-slate-500 text-sm",children:"Todos os itens foram separados"}),a.jsx("button",{onClick:t,className:"mt-3 px-6 py-2 bg-emerald-500 text-black rounded-xl font-black text-sm",children:"Voltar à lista"})]}):a.jsx("div",{className:"flex-1 overflow-y-auto px-4 py-3 space-y-2",children:n.map(A=>a.jsx(rye,{item:A,onSeparado:(E,P)=>w(E,P),onAlerta:(E,P)=>r(D=>D.map(I=>I.id===E?{...I,...P}:I))},A.id))})]})}function sye(){const[e,t]=b.useState([]),[n,r]=b.useState(!0),[s,i]=b.useState(null),[o,l]=b.useState(!1);async function c(){r(!0);try{const d=await $.get("/cotacoes/admin/pedidos",{params:{status:"separacao",limit:50}}).then(f=>f.data);t(Array.isArray(d)?d:d.pedidos??[])}catch{}finally{r(!1)}}b.useEffect(()=>{c()},[]);async function u(d){l(!0);try{const f=await $.get(`/cotacoes/admin/pedidos/${d.id}`).then(p=>p.data);i(f)}catch{i(d)}finally{l(!1)}}return s?a.jsx(aye,{pedido:s,onBack:()=>{i(null),c()}}):a.jsxs("div",{className:"max-w-lg mx-auto",children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"text-2xl font-black text-white flex items-center gap-2",children:[a.jsx(js,{size:22,className:"text-amber-400"})," Separador"]}),a.jsx("p",{className:"text-slate-400 text-sm mt-0.5",children:"Pedidos aguardando separação"})]}),a.jsx("button",{onClick:c,disabled:n,className:"p-2 rounded-xl bg-slate-800 text-slate-400 hover:text-white transition-colors disabled:opacity-40",children:a.jsx(ke,{size:16,className:n?"animate-spin":""})})]}),o&&a.jsx("div",{className:"fixed inset-0 bg-black/60 flex items-center justify-center z-50",children:a.jsx(Vr,{size:36,className:"animate-spin text-amber-400"})}),n?a.jsx("div",{className:"flex items-center justify-center py-20",children:a.jsx(Vr,{size:28,className:"animate-spin text-amber-400"})}):e.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center py-20 gap-3 text-slate-500",children:[a.jsx(bs,{size:40}),a.jsx("p",{className:"text-sm font-bold",children:"Nenhum pedido em separação"}),a.jsx("button",{onClick:c,className:"text-xs text-amber-400 hover:text-amber-300",children:"Atualizar"})]}):a.jsx("div",{className:"space-y-3",children:e.map(d=>a.jsx(nye,{pedido:d,onClick:()=>u(d)},d.id))})]})}const iye=e=>Number(e).toLocaleString("pt-BR",{style:"currency",currency:"BRL"}),o_=e=>e?new Date(e).toLocaleString("pt-BR",{day:"2-digit",month:"2-digit",hour:"2-digit",minute:"2-digit"}):"—";function oye({s:e}){return e==="aprovado"?a.jsx("span",{className:"bg-emerald-500/10 border border-emerald-500/30 text-emerald-400 text-[10px] font-black uppercase px-2 py-0.5 rounded-full",children:"Aprovado"}):e==="rejeitado"?a.jsx("span",{className:"bg-rose-500/10 border border-rose-500/30 text-rose-400 text-[10px] font-black uppercase px-2 py-0.5 rounded-full",children:"Rejeitado"}):a.jsx("span",{className:"bg-amber-500/10 border border-amber-500/30 text-amber-400 text-[10px] font-black uppercase px-2 py-0.5 rounded-full",children:"Pendente"})}function lye({pedido:e,onDecisao:t}){const[n,r]=b.useState(!1),[s,i]=b.useState(!1),[o,l]=b.useState(""),[c,u]=b.useState("");async function d(p){var h,m;i(!0),u("");try{await pt.financeiroDecisao(e.id,p,o||void 0),t()}catch(v){u(((m=(h=v==null?void 0:v.response)==null?void 0:h.data)==null?void 0:m.error)??"Erro ao processar decisão")}finally{i(!1)}}const f=[e.rua,e.end_numero,e.bairro,e.cidade,e.estado].filter(Boolean).join(", ");return a.jsxs("div",{className:"bg-slate-900/50 border border-amber-500/20 rounded-2xl overflow-hidden",children:[a.jsxs("div",{className:"p-5 flex items-start gap-4",children:[a.jsx("div",{className:"w-11 h-11 rounded-xl bg-amber-500/10 border border-amber-500/20 flex items-center justify-center shrink-0",children:a.jsx(Nu,{size:18,className:"text-amber-400"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-3 flex-wrap mb-1",children:[a.jsxs("span",{className:"font-black text-white",children:["Pedido #",e.id]}),a.jsx(oye,{s:e.financeiro_status}),e.cliente_tipo&&a.jsx("span",{className:`text-[10px] font-black uppercase ${e.cliente_tipo==="PJ"?"text-purple-400":"text-cyan-400"}`,children:e.cliente_tipo})]}),a.jsxs("div",{className:"flex items-center gap-1.5 text-sm text-slate-400",children:[a.jsx(ks,{size:12,className:"shrink-0"}),a.jsx("span",{children:e.cliente_nome||"Cliente não identificado"}),e.cpf_cnpj&&a.jsxs("span",{className:"text-slate-600",children:["· ",e.cpf_cnpj]})]}),f&&a.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-slate-500 mt-0.5",children:[a.jsx(gm,{size:11,className:"shrink-0"}),a.jsx("span",{children:f})]}),a.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-slate-600 mt-0.5",children:[a.jsx(hn,{size:11,className:"shrink-0"}),a.jsx("span",{children:o_(e.created_at)})]})]}),a.jsxs("div",{className:"text-right shrink-0",children:[a.jsx("p",{className:"font-black text-white text-lg tabular-nums",children:iye(e.total)}),a.jsx("button",{onClick:()=>r(p=>!p),className:"text-slate-500 hover:text-white transition-colors mt-1",children:n?a.jsx(p1,{size:16}):a.jsx(aa,{size:16})})]})]}),n&&e.financeiro_status==="pendente"&&a.jsxs("div",{className:"border-t border-white/5 p-5 flex flex-col gap-3",children:[a.jsxs("p",{className:"text-xs text-slate-400",children:["O cliente solicitou ",a.jsx("strong",{className:"text-amber-400",children:"pagamento na entrega"}),". Avalie o histórico e decida se libera ou recusa."]}),a.jsx("textarea",{value:o,onChange:p=>l(p.target.value),placeholder:"Observação interna (opcional)...",rows:2,className:"w-full bg-slate-800/60 border border-white/10 rounded-xl px-3 py-2 text-sm text-white placeholder:text-slate-600 resize-none focus:outline-none focus:border-amber-500/50"}),c&&a.jsxs("div",{className:"flex items-center gap-2 text-rose-400 text-xs",children:[a.jsx(Kt,{size:13})," ",c]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("button",{disabled:s,onClick:()=>d("rejeitar"),className:"flex items-center justify-center gap-2 py-2.5 rounded-xl border border-rose-500/30 bg-rose-500/10 text-rose-400 hover:bg-rose-500/20 font-black text-sm transition-colors disabled:opacity-50",children:[a.jsx(Ai,{size:16})," Rejeitar"]}),a.jsxs("button",{disabled:s,onClick:()=>d("aprovar"),className:"flex items-center justify-center gap-2 py-2.5 rounded-xl border border-emerald-500/30 bg-emerald-500/10 text-emerald-400 hover:bg-emerald-500/20 font-black text-sm transition-colors disabled:opacity-50",children:[s?a.jsx(ke,{size:14,className:"animate-spin"}):a.jsx(nn,{size:16}),"Aprovar"]})]})]}),n&&e.financeiro_status!=="pendente"&&a.jsx("div",{className:"border-t border-white/5 p-5",children:a.jsxs("p",{className:"text-xs text-slate-500",children:["Decisão registrada em ",o_(e.financeiro_em),".",e.financeiro_obs&&a.jsxs("span",{className:"block mt-1 text-slate-400 italic",children:['"',e.financeiro_obs,'"']})]})})]})}function cye(){const[e,t]=b.useState([]),[n,r]=b.useState(!0),[s,i]=b.useState("pendente"),o=b.useCallback(async()=>{r(!0);try{const u=await pt.listFinanceiro();t(u)}catch{t([])}finally{r(!1)}},[]);b.useEffect(()=>{o()},[o]);const l=e.filter(u=>u.financeiro_status==="pendente"),c=s==="pendente"?l:e;return a.jsxs("div",{className:"space-y-8 animate-in fade-in slide-in-from-bottom-4 duration-500",children:[a.jsxs("header",{className:"flex justify-between items-center flex-wrap gap-4",children:[a.jsxs("div",{children:[a.jsxs("h2",{className:"text-3xl font-bold text-white tracking-tighter uppercase italic flex items-center gap-3",children:[a.jsx(tv,{size:28,className:"text-amber-400"}),"Financeiro"]}),a.jsx("p",{className:"text-slate-400 mt-1 font-medium",children:"Aprovação de pagamentos na entrega."})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-1 flex gap-1",children:["pendente","todos"].map(u=>a.jsx("button",{onClick:()=>i(u),className:`px-4 py-1.5 rounded-lg text-xs font-black uppercase transition-colors ${s===u?"bg-amber-500 text-black":"text-slate-400 hover:text-white"}`,children:u==="pendente"?`Pendentes (${l.length})`:`Todos (${e.length})`},u))}),a.jsx("button",{onClick:o,disabled:n,className:"p-2.5 bg-slate-800 border border-slate-700 rounded-xl text-slate-400 hover:text-white transition-colors disabled:opacity-50",children:a.jsx(ke,{size:16,className:n?"animate-spin":""})})]})]}),!n&&l.length===0&&s==="pendente"&&a.jsxs("div",{className:"bg-emerald-500/5 border border-emerald-500/20 rounded-2xl p-10 text-center",children:[a.jsx(nn,{size:36,className:"text-emerald-500/40 mx-auto mb-3"}),a.jsx("p",{className:"text-slate-500 font-medium",children:"Nenhuma solicitação pendente."}),a.jsx("p",{className:"text-slate-600 text-sm mt-1",children:"Todos os pedidos de pagamento na entrega foram avaliados."})]}),n?a.jsx("div",{className:"space-y-4",children:[1,2,3].map(u=>a.jsx("div",{className:"h-28 bg-slate-900/40 border border-slate-800 rounded-2xl animate-pulse"},u))}):a.jsx("div",{className:"space-y-4",children:c.map(u=>a.jsx(lye,{pedido:u,onDecisao:o},u.id))}),!n&&c.length===0&&s==="todos"&&a.jsxs("div",{className:"bg-slate-900/40 border border-slate-800 rounded-2xl p-10 text-center",children:[a.jsx(tv,{size:36,className:"text-slate-700 mx-auto mb-3"}),a.jsx("p",{className:"text-slate-600 text-sm",children:"Nenhum registro de pagamento na entrega ainda."})]})]})}const Yh=[{value:"owner",label:"Owner",icon:ws},{value:"manager",label:"Gerente",icon:ws},{value:"supervisor",label:"Supervisor",icon:Tl},{value:"secretary",label:"Secretária",icon:mm},{value:"agent",label:"Agente",icon:et},{value:"viewer",label:"Visualizador",icon:$p}],l_={online:"bg-emerald-500",busy:"bg-yellow-500",offline:"bg-slate-500"},uye={online:"Online",busy:"Ocupado",offline:"Offline"};function dye({role:e}){const t=Yh.find(r=>r.value===e)||Yh[4],n={owner:"bg-violet-500/20 text-violet-300 border-violet-500/30",manager:"bg-blue-500/20 text-blue-300 border-blue-500/30",supervisor:"bg-cyan-500/20 text-cyan-300 border-cyan-500/30",secretary:"bg-teal-500/20 text-teal-300 border-teal-500/30",agent:"bg-slate-700 text-slate-300 border-slate-600",viewer:"bg-slate-800 text-slate-400 border-slate-700"};return a.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full border font-medium ${n[e]||n.agent}`,children:t.label})}function fye({account:e,sectors:t,nwSectors:n,onClose:r,onSave:s}){const i=!!e,[o,l]=b.useState({name:(e==null?void 0:e.name)||"",email:(e==null?void 0:e.email)||"",password:"",role:(e==null?void 0:e.role)||"agent",phone:(e==null?void 0:e.phone)||"",avatar_url:(e==null?void 0:e.avatar_url)||"",active:(e==null?void 0:e.active)!==!1,nw_sector_id:(e==null?void 0:e.nw_sector_id)||"",nw_team_id:(e==null?void 0:e.nw_team_id)||"",sector_id:"",sector_function:""}),[c,u]=b.useState(!1),[d,f]=b.useState(""),p=n.find(m=>m.id===o.nw_sector_id);async function h(m){var v,x;if(m.preventDefault(),!o.name.trim()){f("Nome é obrigatório");return}u(!0),f("");try{const y={name:o.name.trim(),email:o.email||void 0,role:o.role,phone:o.phone||void 0,avatar_url:o.avatar_url||void 0,active:o.active,nw_sector_id:o.nw_sector_id||null,nw_team_id:o.nw_team_id||null};if((!i||o.password)&&(y.password=o.password||void 0),i)await Zn.update(e.id,y);else{if(!o.password){f("Senha é obrigatória para novo colaborador"),u(!1);return}const g=await Zn.create({...y,password:o.password});o.sector_id&&await Js.add({account_id:g.id,sector_id:parseInt(o.sector_id),function:o.sector_function||void 0})}s()}catch(y){f(((x=(v=y==null?void 0:y.response)==null?void 0:v.data)==null?void 0:x.error)||"Erro ao salvar")}finally{u(!1)}}return a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4",children:a.jsxs("div",{className:"bg-slate-900 border border-slate-700 rounded-2xl w-full max-w-lg shadow-2xl",children:[a.jsxs("div",{className:"flex items-center justify-between p-5 border-b border-slate-800",children:[a.jsx("h2",{className:"text-white font-semibold text-lg",children:i?"Editar Colaborador":"Novo Colaborador"}),a.jsx("button",{onClick:r,className:"text-slate-400 hover:text-white",children:a.jsx(Ce,{size:20})})]}),a.jsxs("form",{onSubmit:h,className:"p-5 space-y-4 max-h-[75vh] overflow-y-auto",children:[d&&a.jsx("div",{className:"bg-red-500/10 border border-red-500/30 text-red-400 text-sm px-3 py-2 rounded-lg",children:d}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{className:"col-span-2",children:[a.jsx("label",{className:"text-xs text-slate-400 mb-1 block",children:"Nome *"}),a.jsx("input",{value:o.name,onChange:m=>l(v=>({...v,name:m.target.value})),className:"w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white text-sm focus:outline-none focus:border-cyan-500",placeholder:"Nome completo"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs text-slate-400 mb-1 block",children:"E-mail"}),a.jsx("input",{value:o.email,onChange:m=>l(v=>({...v,email:m.target.value})),className:"w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white text-sm focus:outline-none focus:border-cyan-500",placeholder:"email@exemplo.com"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs text-slate-400 mb-1 block",children:i?"Nova senha (deixe vazio para manter)":"Senha *"}),a.jsx("input",{type:"password",value:o.password,onChange:m=>l(v=>({...v,password:m.target.value})),className:"w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white text-sm focus:outline-none focus:border-cyan-500",placeholder:"••••••••"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs text-slate-400 mb-1 block",children:"Função / Role"}),a.jsx("select",{value:o.role,onChange:m=>l(v=>({...v,role:m.target.value})),className:"w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white text-sm focus:outline-none focus:border-cyan-500",children:Yh.map(m=>a.jsx("option",{className:"bg-slate-900 text-white",value:m.value,children:m.label},m.value))})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs text-slate-400 mb-1 block",children:"Telefone"}),a.jsx("input",{value:o.phone,onChange:m=>l(v=>({...v,phone:m.target.value})),className:"w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white text-sm focus:outline-none focus:border-cyan-500",placeholder:"(67) 9 9999-9999"})]})]}),!i&&t.length>0&&a.jsxs("div",{className:"border-t border-slate-800 pt-4",children:[a.jsx("label",{className:"text-xs text-slate-400 mb-2 block font-medium",children:"Atribuir ao Setor Interno (opcional)"}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("select",{value:o.sector_id,onChange:m=>l(v=>({...v,sector_id:m.target.value})),className:"w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white text-sm focus:outline-none focus:border-cyan-500",children:[a.jsx("option",{className:"bg-slate-900 text-white",value:"",children:"Nenhum setor"}),t.map(m=>a.jsx("option",{className:"bg-slate-900 text-white",value:m.id,children:m.name},m.id))]}),a.jsx("input",{value:o.sector_function,onChange:m=>l(v=>({...v,sector_function:m.target.value})),className:"w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white text-sm focus:outline-none focus:border-cyan-500",placeholder:"Função no setor"})]})]}),n.length>0&&a.jsxs("div",{className:"border-t border-slate-800 pt-4",children:[a.jsxs("label",{className:"text-xs text-slate-400 mb-2 flex items-center gap-1.5 font-medium",children:[a.jsx(Go,{size:12})," Vincular à Equipe WA-Inbox (opcional)"]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("select",{value:o.nw_sector_id,onChange:m=>l(v=>({...v,nw_sector_id:m.target.value,nw_team_id:""})),className:"w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white text-sm focus:outline-none focus:border-cyan-500",children:[a.jsx("option",{className:"bg-slate-900 text-white",value:"",children:"Setor WA-Inbox"}),n.map(m=>a.jsx("option",{className:"bg-slate-900 text-white",value:m.id,children:m.name},m.id))]}),a.jsxs("select",{value:o.nw_team_id,onChange:m=>l(v=>({...v,nw_team_id:m.target.value})),className:"w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white text-sm focus:outline-none focus:border-cyan-500",disabled:!p,children:[a.jsx("option",{className:"bg-slate-900 text-white",value:"",children:"Equipe WA-Inbox"}),((p==null?void 0:p.teams)||[]).map(m=>a.jsx("option",{className:"bg-slate-900 text-white",value:m.id,children:m.name},m.id))]})]})]}),i&&a.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[a.jsx("input",{type:"checkbox",id:"active-toggle",checked:o.active,onChange:m=>l(v=>({...v,active:m.target.checked})),className:"w-4 h-4 accent-cyan-500"}),a.jsx("label",{htmlFor:"active-toggle",className:"text-sm text-slate-300",children:"Conta ativa"})]}),a.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[a.jsx("button",{type:"button",onClick:r,className:"px-4 py-2 rounded-lg border border-slate-700 text-slate-300 text-sm hover:bg-slate-800",children:"Cancelar"}),a.jsxs("button",{type:"submit",disabled:c,className:"px-4 py-2 rounded-lg bg-cyan-600 hover:bg-cyan-500 text-white text-sm font-medium flex items-center gap-2 disabled:opacity-50",children:[c?a.jsx(ke,{size:14,className:"animate-spin"}):a.jsx(jt,{size:14}),i?"Salvar":"Criar"]})]})]})]})})}function pye(){const[e,t]=b.useState([]),[n,r]=b.useState([]),[s,i]=b.useState([]),[o,l]=b.useState(!0),[c,u]=b.useState(""),[d,f]=b.useState(""),[p,h]=b.useState(!1),[m,v]=b.useState(null),x=b.useCallback(async()=>{l(!0);try{const[N,w,S]=await Promise.all([Zn.list(),er.list(),yfe.list().catch(()=>[])]);t(N),r(w),i(S)}finally{l(!1)}},[]);b.useEffect(()=>{x()},[x]);async function y(N){if(confirm("Remover este colaborador? Esta ação não pode ser desfeita.")){v(N);try{await Zn.remove(N),t(w=>w.filter(S=>S.id!==N))}finally{v(null)}}}const g=e.filter(N=>{const w=!c||N.name.toLowerCase().includes(c.toLowerCase())||(N.email||"").toLowerCase().includes(c.toLowerCase()),S=!d||N.role===d;return w&&S});function j(N){if(!N.nw_team_id&&!N.nw_sector_id)return null;const w=s.find(k=>k.id===N.nw_sector_id),S=w==null?void 0:w.teams.find(k=>k.id===N.nw_team_id);return w&&S?`${w.name} ${S.name}`:w?w.name:null}return a.jsxs("div",{className:"p-6 max-w-6xl mx-auto space-y-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[a.jsx(et,{size:24,className:"text-cyan-400"})," Equipe"]}),a.jsxs("p",{className:"text-slate-400 text-sm mt-0.5",children:[e.length," colaborador",e.length!==1?"es":""," cadastrado",e.length!==1?"s":""]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{onClick:x,className:"p-2 rounded-lg border border-slate-700 text-slate-400 hover:text-white hover:bg-slate-800",children:a.jsx(ke,{size:16,className:o?"animate-spin":""})}),a.jsxs("button",{onClick:()=>h(null),className:"flex items-center gap-2 px-4 py-2 bg-cyan-600 hover:bg-cyan-500 text-white rounded-lg text-sm font-medium",children:[a.jsx(Oe,{size:16})," Novo Colaborador"]})]})]}),a.jsxs("div",{className:"flex flex-wrap gap-3",children:[a.jsx("input",{value:c,onChange:N=>u(N.target.value),placeholder:"Buscar por nome ou e-mail...",className:"flex-1 min-w-48 bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white text-sm focus:outline-none focus:border-cyan-500"}),a.jsxs("select",{value:d,onChange:N=>f(N.target.value),className:"bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white text-sm focus:outline-none focus:border-cyan-500",children:[a.jsx("option",{className:"bg-slate-900 text-white",value:"",children:"Todas as funções"}),Yh.map(N=>a.jsx("option",{className:"bg-slate-900 text-white",value:N.value,children:N.label},N.value))]})]}),o?a.jsxs("div",{className:"flex items-center justify-center py-16 text-slate-400",children:[a.jsx(ke,{size:24,className:"animate-spin mr-3"})," Carregando..."]}):g.length===0?a.jsxs("div",{className:"text-center py-16 text-slate-500",children:[a.jsx(et,{size:40,className:"mx-auto mb-3 opacity-30"}),a.jsx("p",{children:"Nenhum colaborador encontrado."})]}):a.jsx("div",{className:"bg-slate-900 border border-slate-800 rounded-2xl overflow-hidden",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-slate-800 text-slate-400 text-xs uppercase tracking-wider",children:[a.jsx("th",{className:"text-left px-5 py-3",children:"Colaborador"}),a.jsx("th",{className:"text-left px-4 py-3",children:"Função"}),a.jsx("th",{className:"text-left px-4 py-3",children:"Setores"}),a.jsx("th",{className:"text-left px-4 py-3 hidden lg:table-cell",children:"WA-Inbox"}),a.jsx("th",{className:"text-left px-4 py-3 hidden md:table-cell",children:"Status"}),a.jsx("th",{className:"px-4 py-3"})]})}),a.jsx("tbody",{className:"divide-y divide-slate-800/60",children:g.map(N=>{const w=N.name.split(" ").map(k=>k[0]).slice(0,2).join("").toUpperCase(),S=j(N);return a.jsxs("tr",{className:`hover:bg-slate-800/40 transition-colors ${N.active?"":"opacity-50"}`,children:[a.jsx("td",{className:"px-5 py-3",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs("div",{className:"relative",children:[N.avatar_url?a.jsx("img",{src:N.avatar_url,className:"w-9 h-9 rounded-full object-cover"}):a.jsx("div",{className:"w-9 h-9 rounded-full bg-slate-700 flex items-center justify-center text-slate-300 font-semibold text-xs",children:w}),a.jsx("span",{className:`absolute -bottom-0.5 -right-0.5 w-2.5 h-2.5 rounded-full border-2 border-slate-900 ${l_[N.availability]||l_.offline}`})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-white font-medium leading-tight",children:N.name}),N.email&&a.jsxs("p",{className:"text-slate-500 text-xs flex items-center gap-1",children:[a.jsx(kI,{size:10}),N.email]}),N.phone&&a.jsxs("p",{className:"text-slate-500 text-xs flex items-center gap-1",children:[a.jsx(wu,{size:10}),N.phone]})]})]})}),a.jsx("td",{className:"px-4 py-3",children:a.jsx(dye,{role:N.role})}),a.jsx("td",{className:"px-4 py-3",children:a.jsxs("div",{className:"flex flex-wrap gap-1",children:[(N.sectors||[]).slice(0,2).map(k=>a.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full border ${k.on_duty?"bg-emerald-500/10 text-emerald-400 border-emerald-500/30":"bg-slate-800 text-slate-400 border-slate-700"}`,children:k.sector_name},k.sector_id)),(N.sectors||[]).length>2&&a.jsxs("span",{className:"text-xs text-slate-500",children:["+",N.sectors.length-2]}),(N.sectors||[]).length===0&&a.jsx("span",{className:"text-xs text-slate-600 italic",children:"Sem setor"})]})}),a.jsx("td",{className:"px-4 py-3 hidden lg:table-cell",children:S?a.jsxs("span",{className:"text-xs text-cyan-400 flex items-center gap-1",children:[a.jsx(Go,{size:10}),S]}):a.jsx("span",{className:"text-xs text-slate-600 italic",children:"—"})}),a.jsx("td",{className:"px-4 py-3 hidden md:table-cell",children:a.jsx("span",{className:"text-xs text-slate-400",children:uye[N.availability]||"Offline"})}),a.jsx("td",{className:"px-4 py-3",children:a.jsxs("div",{className:"flex items-center gap-1 justify-end",children:[a.jsx("button",{onClick:()=>h(N),className:"p-1.5 rounded-lg text-slate-400 hover:text-cyan-400 hover:bg-slate-800",children:a.jsx(Er,{size:14})}),a.jsx("button",{onClick:()=>y(N.id),disabled:m===N.id,className:"p-1.5 rounded-lg text-slate-400 hover:text-red-400 hover:bg-slate-800 disabled:opacity-40",children:a.jsx(Te,{size:14})})]})})]},N.id)})})]})}),p!==!1&&a.jsx(fye,{account:p,sectors:n,nwSectors:s,onClose:()=>h(!1),onSave:()=>{h(!1),x()}})]})}function hye(e){const t=new Date(e),n=Date.now()-t.getTime();return n<6e4?"agora":n<36e5?`${Math.floor(n/6e4)}min atrás`:n<864e5?`${Math.floor(n/36e5)}h atrás`:t.toLocaleDateString("pt-BR")}const mye={aguardando:"bg-slate-600",separacao:"bg-blue-500",embalagem:"bg-violet-500",auditoria:"bg-amber-500",fiscal:"bg-cyan-500",expedicao:"bg-orange-500",entregue:"bg-emerald-500",cancelado:"bg-rose-500"};function xye(){const[e,t]=b.useState(!1),[n,r]=b.useState([]),[s,i]=b.useState(0),[o,l]=b.useState(0),c=b.useRef(null);async function u(){try{const[d,f]=await Promise.all([pt.notificacoes(1440),So.contadores()]),p=new Date;p.setHours(0,0,0,0);const h=d.filter(m=>new Date(m.created_at)>=p);r(h.slice(0,10)),i(f.total),l(h.length+f.total)}catch{}}return b.useEffect(()=>{u();const d=setInterval(u,3e4);return()=>clearInterval(d)},[]),b.useEffect(()=>{function d(f){c.current&&!c.current.contains(f.target)&&t(!1)}return e&&document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[e]),a.jsxs("div",{className:"relative",ref:c,children:[a.jsxs("button",{onClick:()=>t(d=>!d),className:"relative p-2 rounded-lg text-slate-400 hover:text-white hover:bg-white/5 transition-colors",title:"Notificações",children:[a.jsx(Vf,{size:18}),o>0&&a.jsx("span",{className:"absolute -top-0.5 -right-0.5 bg-rose-500 text-white text-[10px] font-black w-4 h-4 rounded-full flex items-center justify-center leading-none",children:o>9?"9+":o})]}),e&&a.jsxs("div",{className:"absolute right-0 top-full mt-2 w-80 bg-slate-900 border border-white/10 rounded-xl shadow-2xl z-50 overflow-hidden",children:[a.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-white/10",children:[a.jsxs("span",{className:"text-sm font-bold text-white flex items-center gap-2",children:[a.jsx(Vf,{size:14,className:"text-amber-400"})," Notificações"]}),a.jsx("button",{onClick:()=>t(!1),className:"text-slate-500 hover:text-white",children:a.jsx(Ce,{size:14})})]}),a.jsxs("div",{className:"max-h-96 overflow-y-auto",children:[s>0&&a.jsxs("div",{className:"px-4 py-2.5 border-b border-white/5 flex items-center gap-3 bg-amber-500/5",children:[a.jsx("div",{className:"w-7 h-7 rounded-full bg-amber-500/20 flex items-center justify-center shrink-0",children:a.jsx(Vf,{size:13,className:"text-amber-400"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-xs font-semibold text-white",children:"Inbox interno"}),a.jsxs("p",{className:"text-[11px] text-amber-400",children:[s," mensagen",s!==1?"s":""," não lida",s!==1?"s":""]})]})]}),n.length===0&&s===0?a.jsx("div",{className:"px-4 py-8 text-center text-slate-500 text-sm",children:"Nenhuma notificação nova"}):n.map(d=>a.jsxs("div",{className:"px-4 py-2.5 border-b border-white/5 flex items-center gap-3 hover:bg-white/3 transition-colors",children:[a.jsx("div",{className:`w-2 h-2 rounded-full shrink-0 ${mye[d.status]??"bg-slate-600"}`}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("p",{className:"text-xs font-semibold text-white truncate",children:["Pedido #",d.id,d.total?` — R$ ${Number(d.total).toFixed(2).replace(".",",")}`:""]}),a.jsxs("p",{className:"text-[11px] text-slate-500 flex items-center gap-1",children:[a.jsx(hn,{size:10})," ",hye(d.created_at),a.jsx("span",{className:"ml-1 capitalize",children:d.status})]})]}),a.jsx(QP,{size:13,className:"text-slate-600 shrink-0"})]},d.id))]}),(n.length>0||s>0)&&a.jsx("div",{className:"px-4 py-2 border-t border-white/10",children:a.jsx("button",{onClick:()=>{t(!1),u()},className:"text-xs text-amber-400 hover:text-amber-300 transition-colors",children:"Atualizar"})})]})]})}function gye({icon:e,label:t,href:n,active:r,accentColor:s}){const i=s||"#06b6d4";return a.jsxs($P,{to:n,className:`flex items-center gap-3 px-4 py-3 rounded-xl transition-all duration-200 group ${r?"border":"text-slate-400 hover:bg-slate-800 hover:text-slate-200 border border-transparent"}`,style:r?{background:`${i}15`,borderColor:`${i}30`,color:i}:{},children:[a.jsx(e,{size:20,style:r?{color:i}:{},className:r?"":"text-slate-500 group-hover:text-slate-300"}),a.jsx("span",{className:"font-medium",children:t}),r&&a.jsx("div",{className:"ml-auto w-1.5 h-1.5 rounded-full",style:{background:i,boxShadow:`0 0 8px ${i}99`}})]})}function vye({tenant:e,adminInfo:t,isOpen:n,onClose:r,collapsed:s,onToggleCollapse:i}){const l=El().pathname,c=(e==null?void 0:e.primary_color)||"#06b6d4",u=s?"w-16":"w-72",d=[{icon:nv,label:"Dashboard",href:"/"},{icon:av,label:"Sorteios",href:"/raffles"},{icon:Wi,label:"Promoções",href:"/promotions"},{icon:av,label:"Pedidos Sorteio",href:"/orders"},{icon:zP,label:"Resgates",href:"/claims"},{icon:et,label:"Clientes",href:"/users"},{icon:JP,label:"Cotação — Pedidos",href:"/cotacao/pedidos"},{icon:tv,label:"Financeiro",href:"/cotacao/financeiro"},{icon:PI,label:"Catálogo",href:"/cotacao/catalogo"},{icon:WI,label:"Clientes Cotação",href:"/cotacao/clientes"},{icon:js,label:"Separador PWA",href:"/cotacao/separador"},{icon:rn,label:"Inbox Interno",href:"/cotacao/inbox"},{icon:VI,label:"Equipe",href:"/equipe"},{icon:ys,label:"Relatórios Op.",href:"/cotacao/relatorios"},{icon:Pr,label:"WhatsApp Inbox",href:"/wa-inbox"},{icon:sv,label:"WA Webhooks",href:"/wa-webhooks"},{icon:rn,label:"WhatsApp (Logs)",href:"/whatsapp"},{icon:XP,label:"Integrações",href:"/plugins"},{icon:zI,label:"Clube Odonto",href:"/clubs/odonto"},{icon:xI,label:"Clube Médico",href:"/clubs/medico"},{icon:ys,label:"Relatórios Clube",href:"/clubs/reports"},{icon:mm,label:"Vagas & Talentos",href:"/jobs"},{icon:Pi,label:"Administradores",href:"/admins"},{icon:v1,label:"Configurações",href:"/settings"}],f=(t==null?void 0:t.nome)||(t==null?void 0:t.username)||(t==null?void 0:t.email)||"Admin",p=f.split(" ").map(h=>h[0]).slice(0,2).join("").toUpperCase();return a.jsxs(a.Fragment,{children:[n&&a.jsx("div",{className:"fixed inset-0 bg-black/60 z-30 md:hidden",onClick:r}),a.jsxs("aside",{className:`fixed md:sticky top-0 left-0 z-40 ${u} bg-slate-950 border-r border-slate-900 flex flex-col h-screen overflow-hidden transition-all duration-300 ease-in-out ${n?"translate-x-0":"-translate-x-full md:translate-x-0"}`,children:[a.jsx("div",{className:"absolute top-0 left-0 w-full h-32 bg-gradient-to-b from-cyan-500/5 to-transparent pointer-events-none"}),a.jsxs("div",{className:`relative z-10 border-b border-slate-900 flex items-center gap-3 ${s?"p-2 justify-center h-16":"p-4"}`,children:[!s&&a.jsxs(a.Fragment,{children:[e!=null&&e.logo_url?a.jsx("img",{src:e.logo_url,alt:e.name,className:"h-9 object-contain shrink-0"}):a.jsx("div",{className:"w-9 h-9 rounded-xl flex items-center justify-center shadow-lg shrink-0",style:{background:`linear-gradient(135deg, ${c}, ${c}88)`},children:a.jsx(nv,{className:"text-white",size:18})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("h1",{className:"text-sm font-black text-white tracking-tight leading-tight truncate",children:(e==null?void 0:e.name)||"Admin"}),a.jsx("p",{className:"text-[10px] font-black uppercase tracking-widest leading-none mt-0.5",style:{color:c},children:"Cloud Admin v2"})]})]}),a.jsx("button",{onClick:i,className:"hidden md:flex w-8 h-8 items-center justify-center rounded-lg text-slate-500 hover:text-white hover:bg-slate-800 transition-colors shrink-0",title:s?"Expandir menu":"Recolher menu",children:a.jsx(Pa,{size:16,className:`transition-transform duration-300 ${s?"":"rotate-180"}`})}),a.jsx("button",{onClick:r,className:"md:hidden text-slate-500 hover:text-white transition-colors shrink-0",children:a.jsx(Ce,{size:18})})]}),a.jsx("nav",{className:`flex-1 py-2 flex flex-col relative z-10 overflow-y-auto ${s?"px-1 gap-1 items-center":"px-3 gap-0.5"}`,children:d.map(({icon:h,label:m,href:v})=>{const x=l===v;return s?a.jsx($P,{to:v,title:m,className:`flex items-center justify-center w-10 h-10 rounded-xl transition-all shrink-0 ${x?"border":"text-slate-500 hover:bg-slate-800 hover:text-slate-200 border border-transparent"}`,style:x?{background:`${c}15`,borderColor:`${c}30`,color:c}:{},children:a.jsx(h,{size:18,style:x?{color:c}:{}})},v):a.jsx(gye,{icon:h,label:m,href:v,active:x,accentColor:c},v)})}),a.jsxs("div",{className:`mt-auto border-t border-slate-900 relative z-10 bg-slate-950/80 backdrop-blur-sm ${s?"p-1 flex flex-col items-center gap-1":"p-3"}`,children:[!s&&t&&a.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2.5 mb-2 bg-slate-900/60 rounded-xl border border-slate-800",children:[a.jsx("div",{className:"w-8 h-8 rounded-lg flex items-center justify-center text-xs font-black text-white shrink-0",style:{background:`linear-gradient(135deg, ${c}, ${c}88)`},children:p}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-xs font-bold text-white truncate leading-tight",children:f}),t.email&&a.jsx("p",{className:"text-[10px] text-slate-500 truncate",children:t.email})]})]}),s&&t&&a.jsx("div",{className:"w-10 h-10 rounded-xl flex items-center justify-center text-xs font-black text-white",style:{background:`linear-gradient(135deg, ${c}, ${c}88)`},title:f,children:p}),!s&&a.jsxs("a",{href:"/",target:"_blank",className:"flex items-center gap-3 px-3 py-2 text-slate-400 hover:text-white transition-colors group rounded-xl hover:bg-slate-800 mb-1",children:[a.jsx(LP,{size:16,className:"group-hover:translate-x-0.5 group-hover:-translate-y-0.5 transition-transform shrink-0"}),a.jsx("span",{className:"text-xs font-medium",children:"Ver Site Público"})]}),a.jsxs("button",{onClick:()=>{window.location.href="/admin/logout"},className:`flex items-center gap-3 text-rose-400 hover:bg-rose-500/10 rounded-xl transition-all group ${s?"w-10 h-10 justify-center":"w-full px-3 py-2"}`,title:"Encerrar Sessão",children:[a.jsx(NI,{size:16,className:"group-hover:-translate-x-0.5 transition-transform shrink-0"}),!s&&a.jsx("span",{className:"text-xs font-medium",children:"Encerrar Sessão"})]})]})]})]})}function Pf({label:e,value:t,icon:n,trend:r,color:s}){return a.jsxs("div",{className:"bg-slate-900/40 backdrop-blur-sm border border-slate-800 p-6 rounded-3xl hover:border-slate-700 transition-all group",children:[a.jsxs("div",{className:"flex justify-between items-start mb-4",children:[a.jsx("div",{className:`p-3 rounded-2xl bg-slate-800 border border-white/5 text-${s}-400 group-hover:scale-110 transition-transform`,children:a.jsx(n,{size:24})}),r&&a.jsx("span",{className:"text-xs font-black text-emerald-400 bg-emerald-400/10 px-2 py-1 rounded-lg tracking-tighter",children:r})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-slate-500 text-xs font-bold uppercase tracking-widest mb-1",children:e}),a.jsx("h3",{className:"text-3xl font-black text-white tabular-nums tracking-tighter",children:t})]})]})}const c_={contentStyle:{background:"#0f172a",border:"1px solid rgba(255,255,255,0.08)",borderRadius:"12px",color:"#f1f5f9",fontSize:"12px"}},rg=e=>e.toLocaleString("pt-BR",{style:"currency",currency:"BRL"});function yye(){return a.jsxs("div",{className:"space-y-10 animate-pulse",children:[a.jsxs("div",{className:"flex flex-wrap justify-between items-start gap-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx("div",{className:"h-9 w-56 bg-slate-800 rounded-xl"}),a.jsx("div",{className:"h-4 w-80 bg-slate-800/60 rounded-lg"})]}),a.jsx("div",{className:"h-10 w-36 bg-slate-800 rounded-2xl"})]}),a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6",children:[...Array(4)].map((e,t)=>a.jsxs("div",{className:"bg-slate-900/40 border border-slate-800 p-6 rounded-3xl space-y-4",children:[a.jsx("div",{className:"h-10 w-10 bg-slate-800 rounded-2xl"}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("div",{className:"h-3 w-24 bg-slate-800 rounded"}),a.jsx("div",{className:"h-8 w-20 bg-slate-800 rounded-lg"})]})]},t))}),a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-8",children:[a.jsx("div",{className:"lg:col-span-2 bg-slate-900/40 border border-slate-800 rounded-[2.5rem] p-10 h-96"}),a.jsx("div",{className:"bg-slate-900/40 border border-slate-800 rounded-[2.5rem] p-10 h-96"})]})]})}function bye(){var u,d,f,p,h;const e=hm(),[t,n]=b.useState(null),[r,s]=b.useState(null),[i,o]=b.useState(!0);if(b.useEffect(()=>{Promise.all([xfe.getDashboard().catch(()=>null),pt.contadores().catch(()=>null)]).then(([m,v])=>{n(m),s(v)}).finally(()=>o(!1))},[]),i)return a.jsx(yye,{});const l=((t==null?void 0:t.salesByDay)||[]).map(m=>({...m,revenue:parseFloat(m.revenue||0),label:m.date?new Date(m.date).toLocaleDateString("pt-BR",{day:"2-digit",month:"2-digit"}):m.date})),c=((t==null?void 0:t.salesByHour)||[]).map(m=>({...m,tickets_sold:parseInt(m.tickets_sold||0)}));return a.jsxs("div",{className:"space-y-10 animate-in fade-in slide-in-from-bottom-4 duration-700",children:[a.jsxs("header",{className:"flex flex-wrap justify-between items-start gap-4",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-3xl md:text-4xl font-black text-white tracking-tighter",children:"Resumo Geral"}),a.jsx("p",{className:"text-slate-400 mt-1 font-medium",children:"Monitoramento em tempo real do ecossistema Alemão."})]}),a.jsxs("div",{className:"bg-slate-900 border border-slate-800 p-2 rounded-2xl flex items-center gap-2 shrink-0",children:[a.jsx("div",{className:"w-2 h-2 rounded-full bg-emerald-500 animate-pulse"}),a.jsx("span",{className:"text-[10px] font-black uppercase tracking-widest text-slate-400 pr-2",children:"Sistema Online"})]})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6",children:[a.jsx(Pf,{label:"Receita Total",value:rg(parseFloat(((u=t==null?void 0:t.revenueStats)==null?void 0:u.total_revenue)||0)),icon:xm,color:"cyan"}),a.jsx(Pf,{label:"Tickets Vendidos",value:String(((d=t==null?void 0:t.revenueStats)==null?void 0:d.total_tickets_sold)??0),icon:av,color:"blue"}),a.jsx(Pf,{label:"Base Clientes",value:String(((f=t==null?void 0:t.revenueStats)==null?void 0:f.total_users)??0),icon:et,color:"purple"}),a.jsx(Pf,{label:"Tickets Ativos",value:String(((p=t==null?void 0:t.revenueStats)==null?void 0:p.active_tickets)??0),icon:hn,color:"orange"})]}),r&&a.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[{label:"Pedidos Hoje",value:r.hoje??0,color:"text-cyan-400",href:"/cotacao/pedidos"},{label:"Em Separação",value:r.em_separacao??0,color:"text-blue-400",href:"/cotacao/pedidos"},{label:"Em Auditoria",value:r.em_auditoria??0,color:"text-orange-400",href:"/cotacao/pedidos"},{label:"Promos Ativas",value:r.promocoes_ativas??0,color:"text-emerald-400",href:"/promotions"}].map(m=>a.jsxs("button",{onClick:()=>e(m.href),className:"bg-slate-900/40 border border-slate-800 hover:border-slate-700 rounded-2xl p-4 text-left transition-all group",children:[a.jsx("p",{className:`text-3xl font-black tabular-nums group-hover:scale-105 transition-transform inline-block ${m.color}`,children:m.value}),a.jsx("p",{className:"text-[10px] font-black uppercase tracking-widest text-slate-500 mt-1",children:m.label})]},m.label))}),a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-8",children:[a.jsxs("div",{className:"lg:col-span-2 bg-slate-900/40 border border-slate-800 rounded-[2.5rem] p-5 md:p-10 relative overflow-hidden group",children:[a.jsx("div",{className:"absolute top-0 right-0 w-64 h-64 bg-cyan-500/5 blur-3xl rounded-full"}),a.jsx("div",{className:"flex items-center justify-between mb-8 relative z-10",children:a.jsxs("h3",{className:"text-2xl font-black text-white flex items-center gap-3 tracking-tight",children:[a.jsx(Wi,{className:"text-cyan-400",size:24}),"Performance de Mercado"]})}),a.jsxs("div",{className:"h-56 w-full mb-8 relative z-10",children:[a.jsx("p",{className:"text-[10px] font-black uppercase tracking-widest text-slate-500 mb-3",children:"Receita por Dia (Últimos 30 Dias)"}),l.length>0?a.jsx(Do,{width:"100%",height:"100%",children:a.jsxs(GT,{data:l,children:[a.jsx("defs",{children:a.jsxs("linearGradient",{id:"gradRevenue",x1:"0",y1:"0",x2:"0",y2:"1",children:[a.jsx("stop",{offset:"5%",stopColor:"#06b6d4",stopOpacity:.3}),a.jsx("stop",{offset:"95%",stopColor:"#06b6d4",stopOpacity:0})]})}),a.jsx(xl,{strokeDasharray:"3 3",stroke:"rgba(255,255,255,0.05)"}),a.jsx(ia,{dataKey:"label",stroke:"#475569",tick:{fontSize:10}}),a.jsx(oa,{stroke:"#475569",tick:{fontSize:10},tickFormatter:m=>`R$${m}`}),a.jsx(on,{...c_,formatter:m=>[rg(Number(m)),"Receita"]}),a.jsx(za,{type:"monotone",dataKey:"revenue",stroke:"#06b6d4",strokeWidth:2,fill:"url(#gradRevenue)"})]})}):a.jsx("div",{className:"h-full flex items-center justify-center text-slate-600 text-sm italic",children:"Sem dados disponíveis"})]}),a.jsxs("div",{className:"h-40 w-full relative z-10",children:[a.jsx("p",{className:"text-[10px] font-black uppercase tracking-widest text-slate-500 mb-3",children:"Picos de Venda por Horário"}),c.length>0?a.jsx(Do,{width:"100%",height:"100%",children:a.jsxs(KT,{data:c,children:[a.jsx(xl,{strokeDasharray:"3 3",stroke:"rgba(255,255,255,0.05)"}),a.jsx(ia,{dataKey:"hour_of_day",stroke:"#475569",tick:{fontSize:10},tickFormatter:m=>`${m}h`}),a.jsx(oa,{stroke:"#475569",tick:{fontSize:10}}),a.jsx(on,{...c_,formatter:m=>[m,"Tickets"]}),a.jsx($a,{dataKey:"tickets_sold",fill:"#10b981",radius:[4,4,0,0]})]})}):a.jsx("div",{className:"h-full flex items-center justify-center text-slate-600 text-sm italic",children:"Sem dados disponíveis"})]})]}),a.jsxs("div",{className:"bg-slate-900/40 border border-slate-800 rounded-[2.5rem] p-5 md:p-10 flex flex-col relative overflow-hidden group",children:[a.jsx("h3",{className:"text-2xl font-black text-white mb-8 tracking-tight relative z-10",children:"Sorteios Quentes"}),a.jsxs("div",{className:"space-y-4 relative z-10 flex-1",children:[(h=t==null?void 0:t.salesByRaffle)==null?void 0:h.slice(0,4).map(m=>{const v=m.total_numeros>0?Math.min(100,Math.round(m.tickets_sold/m.total_numeros*100)):0;return a.jsxs("div",{className:"flex items-center gap-4 p-5 rounded-[1.5rem] bg-slate-800/40 border border-slate-800 hover:border-cyan-500/30 hover:bg-slate-800/60 transition-all cursor-pointer group/item",onClick:()=>e("/raffles"),children:[a.jsx("div",{className:"w-12 h-12 bg-gradient-to-br from-slate-700 to-slate-800 rounded-2xl flex items-center justify-center text-xl font-bold border border-white/5 shadow-lg",children:"🍀"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("h4",{className:"text-sm font-black text-white truncate uppercase tracking-tight",children:m.raffle_name}),a.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[a.jsx("div",{className:"flex-1 h-1 bg-slate-700 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-cyan-400 transition-all duration-500",style:{width:`${v}%`}})}),a.jsxs("span",{className:"text-[10px] text-slate-500 font-bold tabular-nums",children:[v,"%"]})]}),a.jsxs("p",{className:"text-[10px] text-slate-600 mt-1 tabular-nums",children:[m.tickets_sold," / ",m.total_numeros," bilhetes · ",rg(parseFloat(m.revenue||0))]})]}),a.jsx(Pa,{className:"text-slate-600 group-hover/item:text-cyan-400 group-hover/item:translate-x-1 transition-all",size:20})]},m.raffle_id)}),(!(t!=null&&t.salesByRaffle)||t.salesByRaffle.length===0)&&a.jsx("p",{className:"text-slate-600 text-sm italic text-center py-8",children:"Nenhum sorteio ativo"})]}),a.jsx("button",{onClick:()=>e("/raffles"),className:"mt-6 w-full py-5 text-sm font-black text-slate-400 hover:text-cyan-400 hover:bg-cyan-500/5 rounded-2xl transition-all border border-slate-800 hover:border-cyan-500/20",children:"Auditagem de Bilhetes"})]})]})]})}function jye({authState:e,setAuthState:t,teamAccount:n,setTeamAccount:r}){const s=hm(),i=El(),[o,l]=b.useState(null),[c,u]=b.useState(null),[d,f]=b.useState(!1),[p,h]=b.useState(!1);return b.useEffect(()=>{e==="admin"&&Hc.get().then(m=>{l(m.tenant),u(m.admin)}).catch(()=>{})},[e]),b.useEffect(()=>{f(!1)},[i.pathname]),e==="login"?a.jsx(nve,{onLogin:(m,v)=>{m==="team"&&v?(r(v),t("team"),s("/wa-inbox")):(r(null),t("admin"),s("/"))}}):e==="team"?a.jsx(qC,{teamAccount:n,onTeamLogout:async()=>{await fetch("/api/team/logout",{method:"POST",credentials:"include"}),r(null),t("login")}}):i.pathname==="/wa-inbox"?a.jsx(qC,{}):i.pathname==="/wa-webhooks"?a.jsx(Zge,{}):i.pathname==="/cotacao/inbox"?a.jsx(r_,{}):a.jsxs("div",{className:"flex min-h-screen bg-black font-sans text-slate-200 selection:bg-cyan-500/30 selection:text-cyan-200",children:[a.jsx(vye,{tenant:o,adminInfo:c,isOpen:d,onClose:()=>f(!1),collapsed:p,onToggleCollapse:()=>h(m=>!m)}),a.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[a.jsxs("header",{className:"md:hidden flex items-center gap-4 px-4 h-14 bg-slate-950 border-b border-slate-900 sticky top-0 z-20",children:[a.jsx("button",{onClick:()=>f(!0),className:"text-slate-400 hover:text-white",children:a.jsx(CI,{size:22})}),a.jsx("span",{className:"font-black text-white text-sm truncate flex-1",children:(o==null?void 0:o.name)||"Admin"}),a.jsx(xye,{})]}),a.jsxs("main",{className:"flex-1 p-4 sm:p-8 md:p-16 overflow-y-auto relative",children:[a.jsx("div",{className:"fixed inset-0 opacity-[0.03] pointer-events-none bg-[url('https://www.transparenttextures.com/patterns/carbon-fibre.png')]"}),a.jsx("div",{className:"max-w-7xl mx-auto",children:a.jsxs(VD,{children:[a.jsx(st,{path:"/",element:a.jsx(bye,{})}),a.jsx(st,{path:"/raffles",element:a.jsx(wfe,{})}),a.jsx(st,{path:"/promotions",element:a.jsx(Nfe,{})}),a.jsx(st,{path:"/orders",element:a.jsx(ave,{})}),a.jsx(st,{path:"/claims",element:a.jsx(ove,{})}),a.jsx(st,{path:"/clubs/odonto",element:a.jsx(xve,{})}),a.jsx(st,{path:"/clubs/medico",element:a.jsx(gve,{})}),a.jsx(st,{path:"/clubs/reports",element:a.jsx(yve,{})}),a.jsx(st,{path:"/jobs",element:a.jsx(Ave,{})}),a.jsx(st,{path:"/users",element:a.jsx(bfe,{})}),a.jsx(st,{path:"/whatsapp",element:a.jsx(Ofe,{})}),a.jsx(st,{path:"/plugins",element:a.jsx(eve,{})}),a.jsx(st,{path:"/admins",element:a.jsx(tve,{})}),a.jsx(st,{path:"/settings",element:a.jsx(jfe,{})}),a.jsx(st,{path:"/cotacao/pedidos",element:a.jsx(Uve,{})}),a.jsx(st,{path:"/cotacao/financeiro",element:a.jsx(cye,{})}),a.jsx(st,{path:"/cotacao/catalogo",element:a.jsx(Ove,{})}),a.jsx(st,{path:"/cotacao/clientes",element:a.jsx(Dve,{})}),a.jsx(st,{path:"/cotacao/inbox",element:a.jsx(r_,{})}),a.jsx(st,{path:"/cotacao/relatorios",element:a.jsx(eye,{})}),a.jsx(st,{path:"/cotacao/separador",element:a.jsx(sye,{})}),a.jsx(st,{path:"/equipe",element:a.jsx(pye,{})})]})})]})]})]})}function wye(){const[e,t]=b.useState("checking"),[n,r]=b.useState(null);return b.useEffect(()=>{fetch("/api/admin/me",{credentials:"include",headers:{Accept:"application/json"}}).then(async i=>{if(i.ok){t("admin");return}const o=await fetch("/api/team/me",{credentials:"include",headers:{Accept:"application/json"}});if(o.ok){const l=await o.json();r(l.account),t("team")}else t("login")}).catch(()=>t("login"));const s=()=>t("login");return window.addEventListener("auth:logout",s),()=>window.removeEventListener("auth:logout",s)},[]),e==="checking"?a.jsx("div",{className:"min-h-screen bg-black flex items-center justify-center",children:a.jsx("div",{className:"w-8 h-8 border-2 border-cyan-500 border-t-transparent rounded-full animate-spin"})}):a.jsx(XD,{basename:"/admin-v2",children:a.jsx(jye,{authState:e,setAuthState:t,teamAccount:n,setTeamAccount:r})})}ag.createRoot(document.getElementById("root")).render(a.jsx(O.StrictMode,{children:a.jsx(wye,{})}));