diff --git a/frontend/dist/assets/index-TpSq-kLx.js b/frontend/dist/assets/index-B8stM7ei.js similarity index 53% rename from frontend/dist/assets/index-TpSq-kLx.js rename to frontend/dist/assets/index-B8stM7ei.js index ad5095c9..d8e8a0c6 100644 --- a/frontend/dist/assets/index-TpSq-kLx.js +++ b/frontend/dist/assets/index-B8stM7ei.js @@ -6,7 +6,7 @@ var Pk=Object.defineProperty;var _k=(e,t,r)=>t in e?Pk(e,t,{enumerable:!0,config * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Ks=Symbol.for("react.element"),Ak=Symbol.for("react.portal"),Ok=Symbol.for("react.fragment"),Ek=Symbol.for("react.strict_mode"),Dk=Symbol.for("react.profiler"),Tk=Symbol.for("react.provider"),Mk=Symbol.for("react.context"),Ik=Symbol.for("react.forward_ref"),$k=Symbol.for("react.suspense"),Lk=Symbol.for("react.memo"),zk=Symbol.for("react.lazy"),dg=Symbol.iterator;function Rk(e){return e===null||typeof e!="object"?null:(e=dg&&e[dg]||e["@@iterator"],typeof e=="function"?e:null)}var kv={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Pv=Object.assign,_v={};function va(e,t,r){this.props=e,this.context=t,this.refs=_v,this.updater=r||kv}va.prototype.isReactComponent={};va.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")};va.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Cv(){}Cv.prototype=va.prototype;function Pp(e,t,r){this.props=e,this.context=t,this.refs=_v,this.updater=r||kv}var _p=Pp.prototype=new Cv;_p.constructor=Pp;Pv(_p,va.prototype);_p.isPureReactComponent=!0;var fg=Array.isArray,Av=Object.prototype.hasOwnProperty,Cp={current:null},Ov={key:!0,ref:!0,__self:!0,__source:!0};function Ev(e,t,r){var n,i={},s=null,o=null;if(t!=null)for(n in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(s=""+t.key),t)Av.call(t,n)&&!Ov.hasOwnProperty(n)&&(i[n]=t[n]);var l=arguments.length-2;if(l===1)i.children=r;else if(1t in e?Pk(e,t,{enumerable:!0,config * * 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(O,k){var L=O.length;O.push(k);e:for(;0>>1,H=O[U];if(0>>1;Ui(we,L))Ai(J,we)?(O[U]=J,O[A]=L,U=A):(O[U]=we,O[re]=L,U=re);else if(Ai(J,L))O[U]=J,O[A]=L,U=A;else break e}}return k}function i(O,k){var L=O.sortIndex-k.sortIndex;return L!==0?L:O.id-k.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var o=Date,l=o.now();e.unstable_now=function(){return o.now()-l}}var c=[],d=[],u=1,f=null,p=3,m=!1,x=!1,g=!1,b=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,j=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function y(O){for(var k=r(d);k!==null;){if(k.callback===null)n(d);else if(k.startTime<=O)n(d),k.sortIndex=k.expirationTime,t(c,k);else break;k=r(d)}}function w(O){if(g=!1,y(O),!x)if(r(c)!==null)x=!0,E(S);else{var k=r(d);k!==null&&D(w,k.startTime-O)}}function S(O,k){x=!1,g&&(g=!1,v(_),_=-1),m=!0;var L=p;try{for(y(k),f=r(c);f!==null&&(!(f.expirationTime>k)||O&&!M());){var U=f.callback;if(typeof U=="function"){f.callback=null,p=f.priorityLevel;var H=U(f.expirationTime<=k);k=e.unstable_now(),typeof H=="function"?f.callback=H:f===r(c)&&n(c),y(k)}else n(c);f=r(c)}if(f!==null)var te=!0;else{var re=r(d);re!==null&&D(w,re.startTime-k),te=!1}return te}finally{f=null,p=L,m=!1}}var N=!1,P=null,_=-1,T=5,$=-1;function M(){return!(e.unstable_now()-$O||125U?(O.sortIndex=L,t(d,O),r(c)===null&&O===r(d)&&(g?(v(_),_=-1):g=!0,D(w,L-U))):(O.sortIndex=H,t(c,O),x||m||(x=!0,E(S))),O},e.unstable_shouldYield=M,e.unstable_wrapCallback=function(O){var k=p;return function(){var L=p;p=k;try{return O.apply(this,arguments)}finally{p=L}}}})(Lv);$v.exports=Lv;var Zk=$v.exports;/** + */(function(e){function t(O,k){var L=O.length;O.push(k);e:for(;0>>1,H=O[F];if(0>>1;Fi(we,L))Ai(J,we)?(O[F]=J,O[A]=L,F=A):(O[F]=we,O[re]=L,F=re);else if(Ai(J,L))O[F]=J,O[A]=L,F=A;else break e}}return k}function i(O,k){var L=O.sortIndex-k.sortIndex;return L!==0?L:O.id-k.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var o=Date,l=o.now();e.unstable_now=function(){return o.now()-l}}var c=[],d=[],u=1,f=null,p=3,m=!1,x=!1,g=!1,b=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,j=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function y(O){for(var k=r(d);k!==null;){if(k.callback===null)n(d);else if(k.startTime<=O)n(d),k.sortIndex=k.expirationTime,t(c,k);else break;k=r(d)}}function w(O){if(g=!1,y(O),!x)if(r(c)!==null)x=!0,E(S);else{var k=r(d);k!==null&&D(w,k.startTime-O)}}function S(O,k){x=!1,g&&(g=!1,v(_),_=-1),m=!0;var L=p;try{for(y(k),f=r(c);f!==null&&(!(f.expirationTime>k)||O&&!M());){var F=f.callback;if(typeof F=="function"){f.callback=null,p=f.priorityLevel;var H=F(f.expirationTime<=k);k=e.unstable_now(),typeof H=="function"?f.callback=H:f===r(c)&&n(c),y(k)}else n(c);f=r(c)}if(f!==null)var te=!0;else{var re=r(d);re!==null&&D(w,re.startTime-k),te=!1}return te}finally{f=null,p=L,m=!1}}var N=!1,P=null,_=-1,T=5,$=-1;function M(){return!(e.unstable_now()-$O||125F?(O.sortIndex=L,t(d,O),r(c)===null&&O===r(d)&&(g?(v(_),_=-1):g=!0,D(w,L-F))):(O.sortIndex=H,t(c,O),x||m||(x=!0,E(S))),O},e.unstable_shouldYield=M,e.unstable_wrapCallback=function(O){var k=p;return function(){var L=p;p=k;try{return O.apply(this,arguments)}finally{p=L}}}})(Lv);$v.exports=Lv;var Zk=$v.exports;/** * @license React * react-dom.production.min.js * @@ -30,14 +30,14 @@ var Pk=Object.defineProperty;var _k=(e,t,r)=>t in e?Pk(e,t,{enumerable:!0,config * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Xk=h,Ft=Zk;function F(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,r=1;r"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ed=Object.prototype.hasOwnProperty,Jk=/^[: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]*$/,hg={},mg={};function Qk(e){return Ed.call(mg,e)?!0:Ed.call(hg,e)?!1:Jk.test(e)?mg[e]=!0:(hg[e]=!0,!1)}function eP(e,t,r,n){if(r!==null&&r.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return n?!1:r!==null?!r.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function tP(e,t,r,n){if(t===null||typeof t>"u"||eP(e,t,r,n))return!0;if(n)return!1;if(r!==null)switch(r.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 yt(e,t,r,n,i,s,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=n,this.attributeNamespace=i,this.mustUseProperty=r,this.propertyName=e,this.type=t,this.sanitizeURL=s,this.removeEmptyString=o}var tt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){tt[e]=new yt(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];tt[t]=new yt(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){tt[e]=new yt(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){tt[e]=new yt(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){tt[e]=new yt(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){tt[e]=new yt(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){tt[e]=new yt(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){tt[e]=new yt(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){tt[e]=new yt(e,5,!1,e.toLowerCase(),null,!1,!1)});var Op=/[\-:]([a-z])/g;function Ep(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(Op,Ep);tt[t]=new yt(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(Op,Ep);tt[t]=new yt(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(Op,Ep);tt[t]=new yt(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){tt[e]=new yt(e,1,!1,e.toLowerCase(),null,!1,!1)});tt.xlinkHref=new yt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){tt[e]=new yt(e,1,!1,e.toLowerCase(),null,!0,!0)});function Dp(e,t,r,n){var i=tt.hasOwnProperty(t)?tt[t]:null;(i!==null?i.type!==0:n||!(2"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ed=Object.prototype.hasOwnProperty,Jk=/^[: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]*$/,hg={},mg={};function Qk(e){return Ed.call(mg,e)?!0:Ed.call(hg,e)?!1:Jk.test(e)?mg[e]=!0:(hg[e]=!0,!1)}function eP(e,t,r,n){if(r!==null&&r.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return n?!1:r!==null?!r.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function tP(e,t,r,n){if(t===null||typeof t>"u"||eP(e,t,r,n))return!0;if(n)return!1;if(r!==null)switch(r.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 yt(e,t,r,n,i,s,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=n,this.attributeNamespace=i,this.mustUseProperty=r,this.propertyName=e,this.type=t,this.sanitizeURL=s,this.removeEmptyString=o}var tt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){tt[e]=new yt(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];tt[t]=new yt(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){tt[e]=new yt(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){tt[e]=new yt(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){tt[e]=new yt(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){tt[e]=new yt(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){tt[e]=new yt(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){tt[e]=new yt(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){tt[e]=new yt(e,5,!1,e.toLowerCase(),null,!1,!1)});var Op=/[\-:]([a-z])/g;function Ep(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(Op,Ep);tt[t]=new yt(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(Op,Ep);tt[t]=new yt(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(Op,Ep);tt[t]=new yt(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){tt[e]=new yt(e,1,!1,e.toLowerCase(),null,!1,!1)});tt.xlinkHref=new yt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){tt[e]=new yt(e,1,!1,e.toLowerCase(),null,!0,!0)});function Dp(e,t,r,n){var i=tt.hasOwnProperty(t)?tt[t]:null;(i!==null?i.type!==0:n||!(2l||i[o]!==s[l]){var c=` -`+i[o].replace(" at new "," at ");return e.displayName&&c.includes("")&&(c=c.replace("",e.displayName)),c}while(1<=o&&0<=l);break}}}finally{Lu=!1,Error.prepareStackTrace=r}return(e=e?e.displayName||e.name:"")?Ga(e):""}function rP(e){switch(e.tag){case 5:return Ga(e.type);case 16:return Ga("Lazy");case 13:return Ga("Suspense");case 19:return Ga("SuspenseList");case 0:case 2:case 15:return e=zu(e.type,!1),e;case 11:return e=zu(e.type.render,!1),e;case 1:return e=zu(e.type,!0),e;default:return""}}function Id(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 Li:return"Fragment";case $i:return"Portal";case Dd:return"Profiler";case Tp:return"StrictMode";case Td:return"Suspense";case Md:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Bv:return(e.displayName||"Context")+".Consumer";case Rv:return(e._context.displayName||"Context")+".Provider";case Mp:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Ip:return t=e.displayName||null,t!==null?t:Id(e.type)||"Memo";case mn:t=e._payload,e=e._init;try{return Id(e(t))}catch{}}return null}function nP(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 Id(t);case 8:return t===Tp?"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 In(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Wv(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function iP(e){var t=Wv(e)?"checked":"value",r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),n=""+e[t];if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var i=r.get,s=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(o){n=""+o,s.call(this,o)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(o){n=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function xo(e){e._valueTracker||(e._valueTracker=iP(e))}function Uv(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),n="";return e&&(n=Wv(e)?e.checked?"true":"false":e.value),e=n,e!==r?(t.setValue(e),!0):!1}function ul(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 $d(e,t){var r=t.checked;return ke({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??e._wrapperState.initialChecked})}function xg(e,t){var r=t.defaultValue==null?"":t.defaultValue,n=t.checked!=null?t.checked:t.defaultChecked;r=In(t.value!=null?t.value:r),e._wrapperState={initialChecked:n,initialValue:r,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function qv(e,t){t=t.checked,t!=null&&Dp(e,"checked",t,!1)}function Ld(e,t){qv(e,t);var r=In(t.value),n=t.type;if(r!=null)n==="number"?(r===0&&e.value===""||e.value!=r)&&(e.value=""+r):e.value!==""+r&&(e.value=""+r);else if(n==="submit"||n==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?zd(e,t.type,r):t.hasOwnProperty("defaultValue")&&zd(e,t.type,In(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function yg(e,t,r){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var n=t.type;if(!(n!=="submit"&&n!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,r||t===e.value||(e.value=t),e.defaultValue=t}r=e.name,r!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,r!==""&&(e.name=r)}function zd(e,t,r){(t!=="number"||ul(e.ownerDocument)!==e)&&(r==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+r&&(e.defaultValue=""+r))}var Za=Array.isArray;function Xi(e,t,r,n){if(e=e.options,t){t={};for(var i=0;i"+t.valueOf().toString()+"",t=yo.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function hs(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=t;return}}e.textContent=t}var ts={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},aP=["Webkit","ms","Moz","O"];Object.keys(ts).forEach(function(e){aP.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),ts[t]=ts[e]})});function Yv(e,t,r){return t==null||typeof t=="boolean"||t===""?"":r||typeof t!="number"||t===0||ts.hasOwnProperty(e)&&ts[e]?(""+t).trim():t+"px"}function Gv(e,t){e=e.style;for(var r in t)if(t.hasOwnProperty(r)){var n=r.indexOf("--")===0,i=Yv(r,t[r],n);r==="float"&&(r="cssFloat"),n?e.setProperty(r,i):e[r]=i}}var sP=ke({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 Fd(e,t){if(t){if(sP[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(F(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(F(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(F(61))}if(t.style!=null&&typeof t.style!="object")throw Error(F(62))}}function Wd(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 Ud=null;function $p(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var qd=null,Ji=null,Qi=null;function jg(e){if(e=Gs(e)){if(typeof qd!="function")throw Error(F(280));var t=e.stateNode;t&&(t=Oc(t),qd(e.stateNode,e.type,t))}}function Zv(e){Ji?Qi?Qi.push(e):Qi=[e]:Ji=e}function Xv(){if(Ji){var e=Ji,t=Qi;if(Qi=Ji=null,jg(e),t)for(e=0;e>>=0,e===0?32:31-(xP(e)/yP|0)|0}var vo=64,bo=4194304;function Xa(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 hl(e,t){var r=e.pendingLanes;if(r===0)return 0;var n=0,i=e.suspendedLanes,s=e.pingedLanes,o=r&268435455;if(o!==0){var l=o&~i;l!==0?n=Xa(l):(s&=o,s!==0&&(n=Xa(s)))}else o=r&~i,o!==0?n=Xa(o):s!==0&&(n=Xa(s));if(n===0)return 0;if(t!==0&&t!==n&&!(t&i)&&(i=n&-n,s=t&-t,i>=s||i===16&&(s&4194240)!==0))return t;if(n&4&&(n|=r&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=n;0r;r++)t.push(e);return t}function Vs(e,t,r){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-hr(t),e[t]=r}function wP(e,t){var r=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 n=e.eventTimes;for(e=e.expirationTimes;0=ns),Og=" ",Eg=!1;function xb(e,t){switch(e){case"keyup":return ZP.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function yb(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var zi=!1;function JP(e,t){switch(e){case"compositionend":return yb(t);case"keypress":return t.which!==32?null:(Eg=!0,Og);case"textInput":return e=t.data,e===Og&&Eg?null:e;default:return null}}function QP(e,t){if(zi)return e==="compositionend"||!qp&&xb(e,t)?(e=mb(),Xo=Fp=wn=null,zi=!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)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=Ig(r)}}function wb(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?wb(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Sb(){for(var e=window,t=ul();t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href=="string"}catch{r=!1}if(r)e=t.contentWindow;else break;t=ul(e.document)}return t}function Hp(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 l_(e){var t=Sb(),r=e.focusedElem,n=e.selectionRange;if(t!==r&&r&&r.ownerDocument&&wb(r.ownerDocument.documentElement,r)){if(n!==null&&Hp(r)){if(t=n.start,e=n.end,e===void 0&&(e=t),"selectionStart"in r)r.selectionStart=t,r.selectionEnd=Math.min(e,r.value.length);else if(e=(t=r.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=r.textContent.length,s=Math.min(n.start,i);n=n.end===void 0?s:Math.min(n.end,i),!e.extend&&s>n&&(i=n,n=s,s=i),i=$g(r,s);var o=$g(r,n);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),s>n?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=r;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r=document.documentMode,Ri=null,Zd=null,as=null,Xd=!1;function Lg(e,t,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;Xd||Ri==null||Ri!==ul(n)||(n=Ri,"selectionStart"in n&&Hp(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),as&&bs(as,n)||(as=n,n=xl(Zd,"onSelect"),0Wi||(e.current=nf[Wi],nf[Wi]=null,Wi--)}function me(e,t){Wi++,nf[Wi]=e.current,e.current=t}var $n={},ct=Fn($n),kt=Fn(!1),pi=$n;function sa(e,t){var r=e.type.contextTypes;if(!r)return $n;var n=e.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===t)return n.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in r)i[s]=t[s];return n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function Pt(e){return e=e.childContextTypes,e!=null}function vl(){ye(kt),ye(ct)}function qg(e,t,r){if(ct.current!==$n)throw Error(F(168));me(ct,t),me(kt,r)}function Db(e,t,r){var n=e.stateNode;if(t=t.childContextTypes,typeof n.getChildContext!="function")return r;n=n.getChildContext();for(var i in n)if(!(i in t))throw Error(F(108,nP(e)||"Unknown",i));return ke({},r,n)}function bl(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||$n,pi=ct.current,me(ct,e),me(kt,kt.current),!0}function Hg(e,t,r){var n=e.stateNode;if(!n)throw Error(F(169));r?(e=Db(e,t,pi),n.__reactInternalMemoizedMergedChildContext=e,ye(kt),ye(ct),me(ct,e)):ye(kt),me(kt,r)}var Lr=null,Ec=!1,Ju=!1;function Tb(e){Lr===null?Lr=[e]:Lr.push(e)}function b_(e){Ec=!0,Tb(e)}function Wn(){if(!Ju&&Lr!==null){Ju=!0;var e=0,t=le;try{var r=Lr;for(le=1;e>=o,i-=o,Br=1<<32-hr(t)+i|r<_?(T=P,P=null):T=P.sibling;var $=p(v,P,y[_],w);if($===null){P===null&&(P=T);break}e&&P&&$.alternate===null&&t(v,P),j=s($,j,_),N===null?S=$:N.sibling=$,N=$,P=T}if(_===y.length)return r(v,P),be&&Gn(v,_),S;if(P===null){for(;__?(T=P,P=null):T=P.sibling;var M=p(v,P,$.value,w);if(M===null){P===null&&(P=T);break}e&&P&&M.alternate===null&&t(v,P),j=s(M,j,_),N===null?S=M:N.sibling=M,N=M,P=T}if($.done)return r(v,P),be&&Gn(v,_),S;if(P===null){for(;!$.done;_++,$=y.next())$=f(v,$.value,w),$!==null&&(j=s($,j,_),N===null?S=$:N.sibling=$,N=$);return be&&Gn(v,_),S}for(P=n(v,P);!$.done;_++,$=y.next())$=m(P,v,_,$.value,w),$!==null&&(e&&$.alternate!==null&&P.delete($.key===null?_:$.key),j=s($,j,_),N===null?S=$:N.sibling=$,N=$);return e&&P.forEach(function(C){return t(v,C)}),be&&Gn(v,_),S}function b(v,j,y,w){if(typeof y=="object"&&y!==null&&y.type===Li&&y.key===null&&(y=y.props.children),typeof y=="object"&&y!==null){switch(y.$$typeof){case go:e:{for(var S=y.key,N=j;N!==null;){if(N.key===S){if(S=y.type,S===Li){if(N.tag===7){r(v,N.sibling),j=i(N,y.props.children),j.return=v,v=j;break e}}else if(N.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===mn&&Yg(S)===N.type){r(v,N.sibling),j=i(N,y.props),j.ref=Ra(v,N,y),j.return=v,v=j;break e}r(v,N);break}else t(v,N);N=N.sibling}y.type===Li?(j=oi(y.props.children,v.mode,w,y.key),j.return=v,v=j):(w=al(y.type,y.key,y.props,null,v.mode,w),w.ref=Ra(v,j,y),w.return=v,v=w)}return o(v);case $i:e:{for(N=y.key;j!==null;){if(j.key===N)if(j.tag===4&&j.stateNode.containerInfo===y.containerInfo&&j.stateNode.implementation===y.implementation){r(v,j.sibling),j=i(j,y.children||[]),j.return=v,v=j;break e}else{r(v,j);break}else t(v,j);j=j.sibling}j=sd(y,v.mode,w),j.return=v,v=j}return o(v);case mn:return N=y._init,b(v,j,N(y._payload),w)}if(Za(y))return x(v,j,y,w);if(Ma(y))return g(v,j,y,w);_o(v,y)}return typeof y=="string"&&y!==""||typeof y=="number"?(y=""+y,j!==null&&j.tag===6?(r(v,j.sibling),j=i(j,y),j.return=v,v=j):(r(v,j),j=ad(y,v.mode,w),j.return=v,v=j),o(v)):r(v,j)}return b}var la=Lb(!0),zb=Lb(!1),Sl=Fn(null),Nl=null,Hi=null,Gp=null;function Zp(){Gp=Hi=Nl=null}function Xp(e){var t=Sl.current;ye(Sl),e._currentValue=t}function of(e,t,r){for(;e!==null;){var n=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,n!==null&&(n.childLanes|=t)):n!==null&&(n.childLanes&t)!==t&&(n.childLanes|=t),e===r)break;e=e.return}}function ta(e,t){Nl=e,Gp=Hi=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(St=!0),e.firstContext=null)}function tr(e){var t=e._currentValue;if(Gp!==e)if(e={context:e,memoizedValue:t,next:null},Hi===null){if(Nl===null)throw Error(F(308));Hi=e,Nl.dependencies={lanes:0,firstContext:e}}else Hi=Hi.next=e;return t}var ti=null;function Jp(e){ti===null?ti=[e]:ti.push(e)}function Rb(e,t,r,n){var i=t.interleaved;return i===null?(r.next=r,Jp(t)):(r.next=i.next,i.next=r),t.interleaved=r,Zr(e,n)}function Zr(e,t){e.lanes|=t;var r=e.alternate;for(r!==null&&(r.lanes|=t),r=e,e=e.return;e!==null;)e.childLanes|=t,r=e.alternate,r!==null&&(r.childLanes|=t),r=e,e=e.return;return r.tag===3?r.stateNode:null}var gn=!1;function Qp(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Bb(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 qr(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function An(e,t,r){var n=e.updateQueue;if(n===null)return null;if(n=n.shared,ae&2){var i=n.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),n.pending=t,Zr(e,r)}return i=n.interleaved,i===null?(t.next=t,Jp(n)):(t.next=i.next,i.next=t),n.interleaved=t,Zr(e,r)}function Qo(e,t,r){if(t=t.updateQueue,t!==null&&(t=t.shared,(r&4194240)!==0)){var n=t.lanes;n&=e.pendingLanes,r|=n,t.lanes=r,zp(e,r)}}function Gg(e,t){var r=e.updateQueue,n=e.alternate;if(n!==null&&(n=n.updateQueue,r===n)){var i=null,s=null;if(r=r.firstBaseUpdate,r!==null){do{var o={eventTime:r.eventTime,lane:r.lane,tag:r.tag,payload:r.payload,callback:r.callback,next:null};s===null?i=s=o:s=s.next=o,r=r.next}while(r!==null);s===null?i=s=t:s=s.next=t}else i=s=t;r={baseState:n.baseState,firstBaseUpdate:i,lastBaseUpdate:s,shared:n.shared,effects:n.effects},e.updateQueue=r;return}e=r.lastBaseUpdate,e===null?r.firstBaseUpdate=t:e.next=t,r.lastBaseUpdate=t}function kl(e,t,r,n){var i=e.updateQueue;gn=!1;var s=i.firstBaseUpdate,o=i.lastBaseUpdate,l=i.shared.pending;if(l!==null){i.shared.pending=null;var c=l,d=c.next;c.next=null,o===null?s=d:o.next=d,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,l=u.lastBaseUpdate,l!==o&&(l===null?u.firstBaseUpdate=d:l.next=d,u.lastBaseUpdate=c))}if(s!==null){var f=i.baseState;o=0,u=d=c=null,l=s;do{var p=l.lane,m=l.eventTime;if((n&p)===p){u!==null&&(u=u.next={eventTime:m,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var x=e,g=l;switch(p=t,m=r,g.tag){case 1:if(x=g.payload,typeof x=="function"){f=x.call(m,f,p);break e}f=x;break e;case 3:x.flags=x.flags&-65537|128;case 0:if(x=g.payload,p=typeof x=="function"?x.call(m,f,p):x,p==null)break e;f=ke({},f,p);break e;case 2:gn=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,p=i.effects,p===null?i.effects=[l]:p.push(l))}else m={eventTime:m,lane:p,tag:l.tag,payload:l.payload,callback:l.callback,next:null},u===null?(d=u=m,c=f):u=u.next=m,o|=p;if(l=l.next,l===null){if(l=i.shared.pending,l===null)break;p=l,l=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(!0);if(u===null&&(c=f),i.baseState=c,i.firstBaseUpdate=d,i.lastBaseUpdate=u,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else s===null&&(i.shared.lanes=0);gi|=o,e.lanes=o,e.memoizedState=f}}function Zg(e,t,r){if(e=t.effects,t.effects=null,e!==null)for(t=0;tr?r:4,e(!0);var n=ed.transition;ed.transition={};try{e(!1),t()}finally{le=r,ed.transition=n}}function n1(){return rr().memoizedState}function N_(e,t,r){var n=En(e);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},i1(e))a1(t,r);else if(r=Rb(e,t,r,n),r!==null){var i=gt();mr(r,e,n,i),s1(r,t,n)}}function k_(e,t,r){var n=En(e),i={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(i1(e))a1(t,i);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var o=t.lastRenderedState,l=s(o,r);if(i.hasEagerState=!0,i.eagerState=l,gr(l,o)){var c=t.interleaved;c===null?(i.next=i,Jp(t)):(i.next=c.next,c.next=i),t.interleaved=i;return}}catch{}finally{}r=Rb(e,t,i,n),r!==null&&(i=gt(),mr(r,e,n,i),s1(r,t,n))}}function i1(e){var t=e.alternate;return e===Ne||t!==null&&t===Ne}function a1(e,t){ss=_l=!0;var r=e.pending;r===null?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function s1(e,t,r){if(r&4194240){var n=t.lanes;n&=e.pendingLanes,r|=n,t.lanes=r,zp(e,r)}}var Cl={readContext:tr,useCallback:nt,useContext:nt,useEffect:nt,useImperativeHandle:nt,useInsertionEffect:nt,useLayoutEffect:nt,useMemo:nt,useReducer:nt,useRef:nt,useState:nt,useDebugValue:nt,useDeferredValue:nt,useTransition:nt,useMutableSource:nt,useSyncExternalStore:nt,useId:nt,unstable_isNewReconciler:!1},P_={readContext:tr,useCallback:function(e,t){return jr().memoizedState=[e,t===void 0?null:t],e},useContext:tr,useEffect:Jg,useImperativeHandle:function(e,t,r){return r=r!=null?r.concat([e]):null,tl(4194308,4,Jb.bind(null,t,e),r)},useLayoutEffect:function(e,t){return tl(4194308,4,e,t)},useInsertionEffect:function(e,t){return tl(4,2,e,t)},useMemo:function(e,t){var r=jr();return t=t===void 0?null:t,e=e(),r.memoizedState=[e,t],e},useReducer:function(e,t,r){var n=jr();return t=r!==void 0?r(t):t,n.memoizedState=n.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},n.queue=e,e=e.dispatch=N_.bind(null,Ne,e),[n.memoizedState,e]},useRef:function(e){var t=jr();return e={current:e},t.memoizedState=e},useState:Xg,useDebugValue:oh,useDeferredValue:function(e){return jr().memoizedState=e},useTransition:function(){var e=Xg(!1),t=e[0];return e=S_.bind(null,e[1]),jr().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,r){var n=Ne,i=jr();if(be){if(r===void 0)throw Error(F(407));r=r()}else{if(r=t(),Ke===null)throw Error(F(349));mi&30||qb(n,t,r)}i.memoizedState=r;var s={value:r,getSnapshot:t};return i.queue=s,Jg(Kb.bind(null,n,s,e),[e]),n.flags|=2048,Cs(9,Hb.bind(null,n,s,r,t),void 0,null),r},useId:function(){var e=jr(),t=Ke.identifierPrefix;if(be){var r=Fr,n=Br;r=(n&~(1<<32-hr(n)-1)).toString(32)+r,t=":"+t+"R"+r,r=Ps++,0")&&(c=c.replace("",e.displayName)),c}while(1<=o&&0<=l);break}}}finally{Lu=!1,Error.prepareStackTrace=r}return(e=e?e.displayName||e.name:"")?Za(e):""}function rP(e){switch(e.tag){case 5:return Za(e.type);case 16:return Za("Lazy");case 13:return Za("Suspense");case 19:return Za("SuspenseList");case 0:case 2:case 15:return e=zu(e.type,!1),e;case 11:return e=zu(e.type.render,!1),e;case 1:return e=zu(e.type,!0),e;default:return""}}function Id(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 Li:return"Fragment";case $i:return"Portal";case Dd:return"Profiler";case Tp:return"StrictMode";case Td:return"Suspense";case Md:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Bv:return(e.displayName||"Context")+".Consumer";case Rv:return(e._context.displayName||"Context")+".Provider";case Mp:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Ip:return t=e.displayName||null,t!==null?t:Id(e.type)||"Memo";case mn:t=e._payload,e=e._init;try{return Id(e(t))}catch{}}return null}function nP(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 Id(t);case 8:return t===Tp?"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 In(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Wv(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function iP(e){var t=Wv(e)?"checked":"value",r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),n=""+e[t];if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var i=r.get,s=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(o){n=""+o,s.call(this,o)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(o){n=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function xo(e){e._valueTracker||(e._valueTracker=iP(e))}function Uv(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),n="";return e&&(n=Wv(e)?e.checked?"true":"false":e.value),e=n,e!==r?(t.setValue(e),!0):!1}function ul(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 $d(e,t){var r=t.checked;return ke({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??e._wrapperState.initialChecked})}function xg(e,t){var r=t.defaultValue==null?"":t.defaultValue,n=t.checked!=null?t.checked:t.defaultChecked;r=In(t.value!=null?t.value:r),e._wrapperState={initialChecked:n,initialValue:r,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function qv(e,t){t=t.checked,t!=null&&Dp(e,"checked",t,!1)}function Ld(e,t){qv(e,t);var r=In(t.value),n=t.type;if(r!=null)n==="number"?(r===0&&e.value===""||e.value!=r)&&(e.value=""+r):e.value!==""+r&&(e.value=""+r);else if(n==="submit"||n==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?zd(e,t.type,r):t.hasOwnProperty("defaultValue")&&zd(e,t.type,In(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function yg(e,t,r){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var n=t.type;if(!(n!=="submit"&&n!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,r||t===e.value||(e.value=t),e.defaultValue=t}r=e.name,r!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,r!==""&&(e.name=r)}function zd(e,t,r){(t!=="number"||ul(e.ownerDocument)!==e)&&(r==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+r&&(e.defaultValue=""+r))}var Xa=Array.isArray;function Xi(e,t,r,n){if(e=e.options,t){t={};for(var i=0;i"+t.valueOf().toString()+"",t=yo.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function ms(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=t;return}}e.textContent=t}var rs={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},aP=["Webkit","ms","Moz","O"];Object.keys(rs).forEach(function(e){aP.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),rs[t]=rs[e]})});function Yv(e,t,r){return t==null||typeof t=="boolean"||t===""?"":r||typeof t!="number"||t===0||rs.hasOwnProperty(e)&&rs[e]?(""+t).trim():t+"px"}function Gv(e,t){e=e.style;for(var r in t)if(t.hasOwnProperty(r)){var n=r.indexOf("--")===0,i=Yv(r,t[r],n);r==="float"&&(r="cssFloat"),n?e.setProperty(r,i):e[r]=i}}var sP=ke({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 Fd(e,t){if(t){if(sP[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(W(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(W(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(W(61))}if(t.style!=null&&typeof t.style!="object")throw Error(W(62))}}function Wd(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 Ud=null;function $p(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var qd=null,Ji=null,Qi=null;function jg(e){if(e=Gs(e)){if(typeof qd!="function")throw Error(W(280));var t=e.stateNode;t&&(t=Oc(t),qd(e.stateNode,e.type,t))}}function Zv(e){Ji?Qi?Qi.push(e):Qi=[e]:Ji=e}function Xv(){if(Ji){var e=Ji,t=Qi;if(Qi=Ji=null,jg(e),t)for(e=0;e>>=0,e===0?32:31-(xP(e)/yP|0)|0}var vo=64,bo=4194304;function Ja(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 hl(e,t){var r=e.pendingLanes;if(r===0)return 0;var n=0,i=e.suspendedLanes,s=e.pingedLanes,o=r&268435455;if(o!==0){var l=o&~i;l!==0?n=Ja(l):(s&=o,s!==0&&(n=Ja(s)))}else o=r&~i,o!==0?n=Ja(o):s!==0&&(n=Ja(s));if(n===0)return 0;if(t!==0&&t!==n&&!(t&i)&&(i=n&-n,s=t&-t,i>=s||i===16&&(s&4194240)!==0))return t;if(n&4&&(n|=r&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=n;0r;r++)t.push(e);return t}function Vs(e,t,r){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-hr(t),e[t]=r}function wP(e,t){var r=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 n=e.eventTimes;for(e=e.expirationTimes;0=is),Og=" ",Eg=!1;function xb(e,t){switch(e){case"keyup":return ZP.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function yb(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var zi=!1;function JP(e,t){switch(e){case"compositionend":return yb(t);case"keypress":return t.which!==32?null:(Eg=!0,Og);case"textInput":return e=t.data,e===Og&&Eg?null:e;default:return null}}function QP(e,t){if(zi)return e==="compositionend"||!qp&&xb(e,t)?(e=mb(),Xo=Fp=wn=null,zi=!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)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=Ig(r)}}function wb(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?wb(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Sb(){for(var e=window,t=ul();t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href=="string"}catch{r=!1}if(r)e=t.contentWindow;else break;t=ul(e.document)}return t}function Hp(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 l_(e){var t=Sb(),r=e.focusedElem,n=e.selectionRange;if(t!==r&&r&&r.ownerDocument&&wb(r.ownerDocument.documentElement,r)){if(n!==null&&Hp(r)){if(t=n.start,e=n.end,e===void 0&&(e=t),"selectionStart"in r)r.selectionStart=t,r.selectionEnd=Math.min(e,r.value.length);else if(e=(t=r.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=r.textContent.length,s=Math.min(n.start,i);n=n.end===void 0?s:Math.min(n.end,i),!e.extend&&s>n&&(i=n,n=s,s=i),i=$g(r,s);var o=$g(r,n);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),s>n?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=r;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r=document.documentMode,Ri=null,Zd=null,ss=null,Xd=!1;function Lg(e,t,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;Xd||Ri==null||Ri!==ul(n)||(n=Ri,"selectionStart"in n&&Hp(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),ss&&js(ss,n)||(ss=n,n=xl(Zd,"onSelect"),0Wi||(e.current=nf[Wi],nf[Wi]=null,Wi--)}function me(e,t){Wi++,nf[Wi]=e.current,e.current=t}var $n={},ct=Fn($n),kt=Fn(!1),pi=$n;function oa(e,t){var r=e.type.contextTypes;if(!r)return $n;var n=e.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===t)return n.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in r)i[s]=t[s];return n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function Pt(e){return e=e.childContextTypes,e!=null}function vl(){ye(kt),ye(ct)}function qg(e,t,r){if(ct.current!==$n)throw Error(W(168));me(ct,t),me(kt,r)}function Db(e,t,r){var n=e.stateNode;if(t=t.childContextTypes,typeof n.getChildContext!="function")return r;n=n.getChildContext();for(var i in n)if(!(i in t))throw Error(W(108,nP(e)||"Unknown",i));return ke({},r,n)}function bl(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||$n,pi=ct.current,me(ct,e),me(kt,kt.current),!0}function Hg(e,t,r){var n=e.stateNode;if(!n)throw Error(W(169));r?(e=Db(e,t,pi),n.__reactInternalMemoizedMergedChildContext=e,ye(kt),ye(ct),me(ct,e)):ye(kt),me(kt,r)}var Lr=null,Ec=!1,Ju=!1;function Tb(e){Lr===null?Lr=[e]:Lr.push(e)}function b_(e){Ec=!0,Tb(e)}function Wn(){if(!Ju&&Lr!==null){Ju=!0;var e=0,t=le;try{var r=Lr;for(le=1;e>=o,i-=o,Br=1<<32-hr(t)+i|r<_?(T=P,P=null):T=P.sibling;var $=p(v,P,y[_],w);if($===null){P===null&&(P=T);break}e&&P&&$.alternate===null&&t(v,P),j=s($,j,_),N===null?S=$:N.sibling=$,N=$,P=T}if(_===y.length)return r(v,P),be&&Gn(v,_),S;if(P===null){for(;__?(T=P,P=null):T=P.sibling;var M=p(v,P,$.value,w);if(M===null){P===null&&(P=T);break}e&&P&&M.alternate===null&&t(v,P),j=s(M,j,_),N===null?S=M:N.sibling=M,N=M,P=T}if($.done)return r(v,P),be&&Gn(v,_),S;if(P===null){for(;!$.done;_++,$=y.next())$=f(v,$.value,w),$!==null&&(j=s($,j,_),N===null?S=$:N.sibling=$,N=$);return be&&Gn(v,_),S}for(P=n(v,P);!$.done;_++,$=y.next())$=m(P,v,_,$.value,w),$!==null&&(e&&$.alternate!==null&&P.delete($.key===null?_:$.key),j=s($,j,_),N===null?S=$:N.sibling=$,N=$);return e&&P.forEach(function(C){return t(v,C)}),be&&Gn(v,_),S}function b(v,j,y,w){if(typeof y=="object"&&y!==null&&y.type===Li&&y.key===null&&(y=y.props.children),typeof y=="object"&&y!==null){switch(y.$$typeof){case go:e:{for(var S=y.key,N=j;N!==null;){if(N.key===S){if(S=y.type,S===Li){if(N.tag===7){r(v,N.sibling),j=i(N,y.props.children),j.return=v,v=j;break e}}else if(N.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===mn&&Yg(S)===N.type){r(v,N.sibling),j=i(N,y.props),j.ref=Ba(v,N,y),j.return=v,v=j;break e}r(v,N);break}else t(v,N);N=N.sibling}y.type===Li?(j=oi(y.props.children,v.mode,w,y.key),j.return=v,v=j):(w=al(y.type,y.key,y.props,null,v.mode,w),w.ref=Ba(v,j,y),w.return=v,v=w)}return o(v);case $i:e:{for(N=y.key;j!==null;){if(j.key===N)if(j.tag===4&&j.stateNode.containerInfo===y.containerInfo&&j.stateNode.implementation===y.implementation){r(v,j.sibling),j=i(j,y.children||[]),j.return=v,v=j;break e}else{r(v,j);break}else t(v,j);j=j.sibling}j=sd(y,v.mode,w),j.return=v,v=j}return o(v);case mn:return N=y._init,b(v,j,N(y._payload),w)}if(Xa(y))return x(v,j,y,w);if(Ia(y))return g(v,j,y,w);_o(v,y)}return typeof y=="string"&&y!==""||typeof y=="number"?(y=""+y,j!==null&&j.tag===6?(r(v,j.sibling),j=i(j,y),j.return=v,v=j):(r(v,j),j=ad(y,v.mode,w),j.return=v,v=j),o(v)):r(v,j)}return b}var ca=Lb(!0),zb=Lb(!1),Sl=Fn(null),Nl=null,Hi=null,Gp=null;function Zp(){Gp=Hi=Nl=null}function Xp(e){var t=Sl.current;ye(Sl),e._currentValue=t}function of(e,t,r){for(;e!==null;){var n=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,n!==null&&(n.childLanes|=t)):n!==null&&(n.childLanes&t)!==t&&(n.childLanes|=t),e===r)break;e=e.return}}function ta(e,t){Nl=e,Gp=Hi=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(St=!0),e.firstContext=null)}function tr(e){var t=e._currentValue;if(Gp!==e)if(e={context:e,memoizedValue:t,next:null},Hi===null){if(Nl===null)throw Error(W(308));Hi=e,Nl.dependencies={lanes:0,firstContext:e}}else Hi=Hi.next=e;return t}var ti=null;function Jp(e){ti===null?ti=[e]:ti.push(e)}function Rb(e,t,r,n){var i=t.interleaved;return i===null?(r.next=r,Jp(t)):(r.next=i.next,i.next=r),t.interleaved=r,Zr(e,n)}function Zr(e,t){e.lanes|=t;var r=e.alternate;for(r!==null&&(r.lanes|=t),r=e,e=e.return;e!==null;)e.childLanes|=t,r=e.alternate,r!==null&&(r.childLanes|=t),r=e,e=e.return;return r.tag===3?r.stateNode:null}var gn=!1;function Qp(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Bb(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 qr(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function An(e,t,r){var n=e.updateQueue;if(n===null)return null;if(n=n.shared,ae&2){var i=n.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),n.pending=t,Zr(e,r)}return i=n.interleaved,i===null?(t.next=t,Jp(n)):(t.next=i.next,i.next=t),n.interleaved=t,Zr(e,r)}function Qo(e,t,r){if(t=t.updateQueue,t!==null&&(t=t.shared,(r&4194240)!==0)){var n=t.lanes;n&=e.pendingLanes,r|=n,t.lanes=r,zp(e,r)}}function Gg(e,t){var r=e.updateQueue,n=e.alternate;if(n!==null&&(n=n.updateQueue,r===n)){var i=null,s=null;if(r=r.firstBaseUpdate,r!==null){do{var o={eventTime:r.eventTime,lane:r.lane,tag:r.tag,payload:r.payload,callback:r.callback,next:null};s===null?i=s=o:s=s.next=o,r=r.next}while(r!==null);s===null?i=s=t:s=s.next=t}else i=s=t;r={baseState:n.baseState,firstBaseUpdate:i,lastBaseUpdate:s,shared:n.shared,effects:n.effects},e.updateQueue=r;return}e=r.lastBaseUpdate,e===null?r.firstBaseUpdate=t:e.next=t,r.lastBaseUpdate=t}function kl(e,t,r,n){var i=e.updateQueue;gn=!1;var s=i.firstBaseUpdate,o=i.lastBaseUpdate,l=i.shared.pending;if(l!==null){i.shared.pending=null;var c=l,d=c.next;c.next=null,o===null?s=d:o.next=d,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,l=u.lastBaseUpdate,l!==o&&(l===null?u.firstBaseUpdate=d:l.next=d,u.lastBaseUpdate=c))}if(s!==null){var f=i.baseState;o=0,u=d=c=null,l=s;do{var p=l.lane,m=l.eventTime;if((n&p)===p){u!==null&&(u=u.next={eventTime:m,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var x=e,g=l;switch(p=t,m=r,g.tag){case 1:if(x=g.payload,typeof x=="function"){f=x.call(m,f,p);break e}f=x;break e;case 3:x.flags=x.flags&-65537|128;case 0:if(x=g.payload,p=typeof x=="function"?x.call(m,f,p):x,p==null)break e;f=ke({},f,p);break e;case 2:gn=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,p=i.effects,p===null?i.effects=[l]:p.push(l))}else m={eventTime:m,lane:p,tag:l.tag,payload:l.payload,callback:l.callback,next:null},u===null?(d=u=m,c=f):u=u.next=m,o|=p;if(l=l.next,l===null){if(l=i.shared.pending,l===null)break;p=l,l=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(!0);if(u===null&&(c=f),i.baseState=c,i.firstBaseUpdate=d,i.lastBaseUpdate=u,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else s===null&&(i.shared.lanes=0);gi|=o,e.lanes=o,e.memoizedState=f}}function Zg(e,t,r){if(e=t.effects,t.effects=null,e!==null)for(t=0;tr?r:4,e(!0);var n=ed.transition;ed.transition={};try{e(!1),t()}finally{le=r,ed.transition=n}}function n1(){return rr().memoizedState}function N_(e,t,r){var n=En(e);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},i1(e))a1(t,r);else if(r=Rb(e,t,r,n),r!==null){var i=gt();mr(r,e,n,i),s1(r,t,n)}}function k_(e,t,r){var n=En(e),i={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(i1(e))a1(t,i);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var o=t.lastRenderedState,l=s(o,r);if(i.hasEagerState=!0,i.eagerState=l,gr(l,o)){var c=t.interleaved;c===null?(i.next=i,Jp(t)):(i.next=c.next,c.next=i),t.interleaved=i;return}}catch{}finally{}r=Rb(e,t,i,n),r!==null&&(i=gt(),mr(r,e,n,i),s1(r,t,n))}}function i1(e){var t=e.alternate;return e===Ne||t!==null&&t===Ne}function a1(e,t){os=_l=!0;var r=e.pending;r===null?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function s1(e,t,r){if(r&4194240){var n=t.lanes;n&=e.pendingLanes,r|=n,t.lanes=r,zp(e,r)}}var Cl={readContext:tr,useCallback:nt,useContext:nt,useEffect:nt,useImperativeHandle:nt,useInsertionEffect:nt,useLayoutEffect:nt,useMemo:nt,useReducer:nt,useRef:nt,useState:nt,useDebugValue:nt,useDeferredValue:nt,useTransition:nt,useMutableSource:nt,useSyncExternalStore:nt,useId:nt,unstable_isNewReconciler:!1},P_={readContext:tr,useCallback:function(e,t){return jr().memoizedState=[e,t===void 0?null:t],e},useContext:tr,useEffect:Jg,useImperativeHandle:function(e,t,r){return r=r!=null?r.concat([e]):null,tl(4194308,4,Jb.bind(null,t,e),r)},useLayoutEffect:function(e,t){return tl(4194308,4,e,t)},useInsertionEffect:function(e,t){return tl(4,2,e,t)},useMemo:function(e,t){var r=jr();return t=t===void 0?null:t,e=e(),r.memoizedState=[e,t],e},useReducer:function(e,t,r){var n=jr();return t=r!==void 0?r(t):t,n.memoizedState=n.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},n.queue=e,e=e.dispatch=N_.bind(null,Ne,e),[n.memoizedState,e]},useRef:function(e){var t=jr();return e={current:e},t.memoizedState=e},useState:Xg,useDebugValue:oh,useDeferredValue:function(e){return jr().memoizedState=e},useTransition:function(){var e=Xg(!1),t=e[0];return e=S_.bind(null,e[1]),jr().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,r){var n=Ne,i=jr();if(be){if(r===void 0)throw Error(W(407));r=r()}else{if(r=t(),Ke===null)throw Error(W(349));mi&30||qb(n,t,r)}i.memoizedState=r;var s={value:r,getSnapshot:t};return i.queue=s,Jg(Kb.bind(null,n,s,e),[e]),n.flags|=2048,As(9,Hb.bind(null,n,s,r,t),void 0,null),r},useId:function(){var e=jr(),t=Ke.identifierPrefix;if(be){var r=Fr,n=Br;r=(n&~(1<<32-hr(n)-1)).toString(32)+r,t=":"+t+"R"+r,r=_s++,0<\/script>",e=e.removeChild(e.firstChild)):typeof n.is=="string"?e=o.createElement(r,{is:n.is}):(e=o.createElement(r),r==="select"&&(o=e,n.multiple?o.multiple=!0:n.size&&(o.size=n.size))):e=o.createElementNS(e,r),e[Sr]=t,e[Ss]=n,g1(e,t,!1,!1),t.stateNode=e;e:{switch(o=Wd(r,n),r){case"dialog":ge("cancel",e),ge("close",e),i=n;break;case"iframe":case"object":case"embed":ge("load",e),i=n;break;case"video":case"audio":for(i=0;ida&&(t.flags|=128,n=!0,Ba(s,!1),t.lanes=4194304)}else{if(!n)if(e=Pl(o),e!==null){if(t.flags|=128,n=!0,r=e.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),Ba(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!be)return it(t),null}else 2*Ae()-s.renderingStartTime>da&&r!==1073741824&&(t.flags|=128,n=!0,Ba(s,!1),t.lanes=4194304);s.isBackwards?(o.sibling=t.child,t.child=o):(r=s.last,r!==null?r.sibling=o:t.child=o,s.last=o)}return s.tail!==null?(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=Ae(),t.sibling=null,r=Se.current,me(Se,n?r&1|2:r&1),t):(it(t),null);case 22:case 23:return ph(),n=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==n&&(t.flags|=8192),n&&t.mode&1?It&1073741824&&(it(t),t.subtreeFlags&6&&(t.flags|=8192)):it(t),null;case 24:return null;case 25:return null}throw Error(F(156,t.tag))}function M_(e,t){switch(Vp(t),t.tag){case 1:return Pt(t.type)&&vl(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ca(),ye(kt),ye(ct),rh(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return th(t),null;case 13:if(ye(Se),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(F(340));oa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ye(Se),null;case 4:return ca(),null;case 10:return Xp(t.type._context),null;case 22:case 23:return ph(),null;case 24:return null;default:return null}}var Ao=!1,st=!1,I_=typeof WeakSet=="function"?WeakSet:Set,K=null;function Ki(e,t){var r=e.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){Pe(e,t,n)}else r.current=null}function gf(e,t,r){try{r()}catch(n){Pe(e,t,n)}}var cx=!1;function $_(e,t){if(Jd=ml,e=Sb(),Hp(e)){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{r=(r=e.ownerDocument)&&r.defaultView||window;var n=r.getSelection&&r.getSelection();if(n&&n.rangeCount!==0){r=n.anchorNode;var i=n.anchorOffset,s=n.focusNode;n=n.focusOffset;try{r.nodeType,s.nodeType}catch{r=null;break e}var o=0,l=-1,c=-1,d=0,u=0,f=e,p=null;t:for(;;){for(var m;f!==r||i!==0&&f.nodeType!==3||(l=o+i),f!==s||n!==0&&f.nodeType!==3||(c=o+n),f.nodeType===3&&(o+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break t;if(p===r&&++d===i&&(l=o),p===s&&++u===n&&(c=o),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}r=l===-1||c===-1?null:{start:l,end:c}}else r=null}r=r||{start:0,end:0}}else r=null;for(Qd={focusedElem:e,selectionRange:r},ml=!1,K=t;K!==null;)if(t=K,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,K=e;else for(;K!==null;){t=K;try{var x=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(x!==null){var g=x.memoizedProps,b=x.memoizedState,v=t.stateNode,j=v.getSnapshotBeforeUpdate(t.elementType===t.type?g:cr(t.type,g),b);v.__reactInternalSnapshotBeforeUpdate=j}break;case 3:var y=t.stateNode.containerInfo;y.nodeType===1?y.textContent="":y.nodeType===9&&y.documentElement&&y.removeChild(y.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(F(163))}}catch(w){Pe(t,t.return,w)}if(e=t.sibling,e!==null){e.return=t.return,K=e;break}K=t.return}return x=cx,cx=!1,x}function os(e,t,r){var n=t.updateQueue;if(n=n!==null?n.lastEffect:null,n!==null){var i=n=n.next;do{if((i.tag&e)===e){var s=i.destroy;i.destroy=void 0,s!==void 0&&gf(t,r,s)}i=i.next}while(i!==n)}}function Mc(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var r=t=t.next;do{if((r.tag&e)===e){var n=r.create;r.destroy=n()}r=r.next}while(r!==t)}}function xf(e){var t=e.ref;if(t!==null){var r=e.stateNode;switch(e.tag){case 5:e=r;break;default:e=r}typeof t=="function"?t(e):t.current=e}}function v1(e){var t=e.alternate;t!==null&&(e.alternate=null,v1(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Sr],delete t[Ss],delete t[rf],delete t[y_],delete t[v_])),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 b1(e){return e.tag===5||e.tag===3||e.tag===4}function ux(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||b1(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 yf(e,t,r){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?r.nodeType===8?r.parentNode.insertBefore(e,t):r.insertBefore(e,t):(r.nodeType===8?(t=r.parentNode,t.insertBefore(e,r)):(t=r,t.appendChild(e)),r=r._reactRootContainer,r!=null||t.onclick!==null||(t.onclick=yl));else if(n!==4&&(e=e.child,e!==null))for(yf(e,t,r),e=e.sibling;e!==null;)yf(e,t,r),e=e.sibling}function vf(e,t,r){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?r.insertBefore(e,t):r.appendChild(e);else if(n!==4&&(e=e.child,e!==null))for(vf(e,t,r),e=e.sibling;e!==null;)vf(e,t,r),e=e.sibling}var Xe=null,ur=!1;function hn(e,t,r){for(r=r.child;r!==null;)j1(e,t,r),r=r.sibling}function j1(e,t,r){if(kr&&typeof kr.onCommitFiberUnmount=="function")try{kr.onCommitFiberUnmount(Pc,r)}catch{}switch(r.tag){case 5:st||Ki(r,t);case 6:var n=Xe,i=ur;Xe=null,hn(e,t,r),Xe=n,ur=i,Xe!==null&&(ur?(e=Xe,r=r.stateNode,e.nodeType===8?e.parentNode.removeChild(r):e.removeChild(r)):Xe.removeChild(r.stateNode));break;case 18:Xe!==null&&(ur?(e=Xe,r=r.stateNode,e.nodeType===8?Xu(e.parentNode,r):e.nodeType===1&&Xu(e,r),ys(e)):Xu(Xe,r.stateNode));break;case 4:n=Xe,i=ur,Xe=r.stateNode.containerInfo,ur=!0,hn(e,t,r),Xe=n,ur=i;break;case 0:case 11:case 14:case 15:if(!st&&(n=r.updateQueue,n!==null&&(n=n.lastEffect,n!==null))){i=n=n.next;do{var s=i,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&gf(r,t,o),i=i.next}while(i!==n)}hn(e,t,r);break;case 1:if(!st&&(Ki(r,t),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(l){Pe(r,t,l)}hn(e,t,r);break;case 21:hn(e,t,r);break;case 22:r.mode&1?(st=(n=st)||r.memoizedState!==null,hn(e,t,r),st=n):hn(e,t,r);break;default:hn(e,t,r)}}function dx(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var r=e.stateNode;r===null&&(r=e.stateNode=new I_),t.forEach(function(n){var i=H_.bind(null,e,n);r.has(n)||(r.add(n),n.then(i,i))})}}function lr(e,t){var r=t.deletions;if(r!==null)for(var n=0;ni&&(i=o),n&=~s}if(n=i,n=Ae()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*z_(n/1960))-n,10e?16:e,Sn===null)var n=!1;else{if(e=Sn,Sn=null,El=0,ae&6)throw Error(F(331));var i=ae;for(ae|=4,K=e.current;K!==null;){var s=K,o=s.child;if(K.flags&16){var l=s.deletions;if(l!==null){for(var c=0;cAe()-dh?si(e,0):uh|=r),_t(e,t)}function A1(e,t){t===0&&(e.mode&1?(t=bo,bo<<=1,!(bo&130023424)&&(bo=4194304)):t=1);var r=gt();e=Zr(e,t),e!==null&&(Vs(e,t,r),_t(e,r))}function q_(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),A1(e,r)}function H_(e,t){var r=0;switch(e.tag){case 13:var n=e.stateNode,i=e.memoizedState;i!==null&&(r=i.retryLane);break;case 19:n=e.stateNode;break;default:throw Error(F(314))}n!==null&&n.delete(t),A1(e,r)}var O1;O1=function(e,t,r){if(e!==null)if(e.memoizedProps!==t.pendingProps||kt.current)St=!0;else{if(!(e.lanes&r)&&!(t.flags&128))return St=!1,D_(e,t,r);St=!!(e.flags&131072)}else St=!1,be&&t.flags&1048576&&Mb(t,wl,t.index);switch(t.lanes=0,t.tag){case 2:var n=t.type;rl(e,t),e=t.pendingProps;var i=sa(t,ct.current);ta(t,r),i=ih(null,t,n,e,i,r);var s=ah();return t.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Pt(n)?(s=!0,bl(t)):s=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,Qp(t),i.updater=Tc,t.stateNode=i,i._reactInternals=t,cf(t,n,e,r),t=ff(null,t,n,!0,s,r)):(t.tag=0,be&&s&&Kp(t),ht(null,t,i,r),t=t.child),t;case 16:n=t.elementType;e:{switch(rl(e,t),e=t.pendingProps,i=n._init,n=i(n._payload),t.type=n,i=t.tag=V_(n),e=cr(n,e),i){case 0:t=df(null,t,n,e,r);break e;case 1:t=sx(null,t,n,e,r);break e;case 11:t=ix(null,t,n,e,r);break e;case 14:t=ax(null,t,n,cr(n.type,e),r);break e}throw Error(F(306,n,""))}return t;case 0:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:cr(n,i),df(e,t,n,i,r);case 1:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:cr(n,i),sx(e,t,n,i,r);case 3:e:{if(p1(t),e===null)throw Error(F(387));n=t.pendingProps,s=t.memoizedState,i=s.element,Bb(e,t),kl(t,n,null,r);var o=t.memoizedState;if(n=o.element,s.isDehydrated)if(s={element:n,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=s,t.memoizedState=s,t.flags&256){i=ua(Error(F(423)),t),t=ox(e,t,n,r,i);break e}else if(n!==i){i=ua(Error(F(424)),t),t=ox(e,t,n,r,i);break e}else for(zt=Cn(t.stateNode.containerInfo.firstChild),Rt=t,be=!0,dr=null,r=zb(t,null,n,r),t.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(oa(),n===i){t=Xr(e,t,r);break e}ht(e,t,n,r)}t=t.child}return t;case 5:return Fb(t),e===null&&sf(t),n=t.type,i=t.pendingProps,s=e!==null?e.memoizedProps:null,o=i.children,ef(n,i)?o=null:s!==null&&ef(n,s)&&(t.flags|=32),f1(e,t),ht(e,t,o,r),t.child;case 6:return e===null&&sf(t),null;case 13:return h1(e,t,r);case 4:return eh(t,t.stateNode.containerInfo),n=t.pendingProps,e===null?t.child=la(t,null,n,r):ht(e,t,n,r),t.child;case 11:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:cr(n,i),ix(e,t,n,i,r);case 7:return ht(e,t,t.pendingProps,r),t.child;case 8:return ht(e,t,t.pendingProps.children,r),t.child;case 12:return ht(e,t,t.pendingProps.children,r),t.child;case 10:e:{if(n=t.type._context,i=t.pendingProps,s=t.memoizedProps,o=i.value,me(Sl,n._currentValue),n._currentValue=o,s!==null)if(gr(s.value,o)){if(s.children===i.children&&!kt.current){t=Xr(e,t,r);break e}}else for(s=t.child,s!==null&&(s.return=t);s!==null;){var l=s.dependencies;if(l!==null){o=s.child;for(var c=l.firstContext;c!==null;){if(c.context===n){if(s.tag===1){c=qr(-1,r&-r),c.tag=2;var d=s.updateQueue;if(d!==null){d=d.shared;var u=d.pending;u===null?c.next=c:(c.next=u.next,u.next=c),d.pending=c}}s.lanes|=r,c=s.alternate,c!==null&&(c.lanes|=r),of(s.return,r,t),l.lanes|=r;break}c=c.next}}else if(s.tag===10)o=s.type===t.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(F(341));o.lanes|=r,l=o.alternate,l!==null&&(l.lanes|=r),of(o,r,t),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===t){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}ht(e,t,i.children,r),t=t.child}return t;case 9:return i=t.type,n=t.pendingProps.children,ta(t,r),i=tr(i),n=n(i),t.flags|=1,ht(e,t,n,r),t.child;case 14:return n=t.type,i=cr(n,t.pendingProps),i=cr(n.type,i),ax(e,t,n,i,r);case 15:return u1(e,t,t.type,t.pendingProps,r);case 17:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:cr(n,i),rl(e,t),t.tag=1,Pt(n)?(e=!0,bl(t)):e=!1,ta(t,r),o1(t,n,i),cf(t,n,i,r),ff(null,t,n,!0,e,r);case 19:return m1(e,t,r);case 22:return d1(e,t,r)}throw Error(F(156,t.tag))};function E1(e,t){return ib(e,t)}function K_(e,t,r,n){this.tag=e,this.key=r,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=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Zt(e,t,r,n){return new K_(e,t,r,n)}function mh(e){return e=e.prototype,!(!e||!e.isReactComponent)}function V_(e){if(typeof e=="function")return mh(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Mp)return 11;if(e===Ip)return 14}return 2}function Dn(e,t){var r=e.alternate;return r===null?(r=Zt(e.tag,t,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=t,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&14680064,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,t=e.dependencies,r.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r}function al(e,t,r,n,i,s){var o=2;if(n=e,typeof e=="function")mh(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case Li:return oi(r.children,i,s,t);case Tp:o=8,i|=8;break;case Dd:return e=Zt(12,r,t,i|2),e.elementType=Dd,e.lanes=s,e;case Td:return e=Zt(13,r,t,i),e.elementType=Td,e.lanes=s,e;case Md:return e=Zt(19,r,t,i),e.elementType=Md,e.lanes=s,e;case Fv:return $c(r,i,s,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Rv:o=10;break e;case Bv:o=9;break e;case Mp:o=11;break e;case Ip:o=14;break e;case mn:o=16,n=null;break e}throw Error(F(130,e==null?e:typeof e,""))}return t=Zt(o,r,t,i),t.elementType=e,t.type=n,t.lanes=s,t}function oi(e,t,r,n){return e=Zt(7,e,n,t),e.lanes=r,e}function $c(e,t,r,n){return e=Zt(22,e,n,t),e.elementType=Fv,e.lanes=r,e.stateNode={isHidden:!1},e}function ad(e,t,r){return e=Zt(6,e,null,t),e.lanes=r,e}function sd(e,t,r){return t=Zt(4,e.children!==null?e.children:[],e.key,t),t.lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Y_(e,t,r,n,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Bu(0),this.expirationTimes=Bu(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Bu(0),this.identifierPrefix=n,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function gh(e,t,r,n,i,s,o,l,c){return e=new Y_(e,t,r,l,c),t===1?(t=1,s===!0&&(t|=8)):t=0,s=Zt(3,null,null,t),e.current=s,s.stateNode=e,s.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},Qp(s),e}function G_(e,t,r){var n=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(I1)}catch(e){console.error(e)}}I1(),Iv.exports=Ut;var bh=Iv.exports,vx=bh;Od.createRoot=vx.createRoot,Od.hydrateRoot=vx.hydrateRoot;/** +`+s.stack}return{value:e,source:t,stack:i,digest:null}}function nd(e,t,r){return{value:e,source:null,stack:r??null,digest:t??null}}function uf(e,t){try{console.error(t.value)}catch(r){setTimeout(function(){throw r})}}var A_=typeof WeakMap=="function"?WeakMap:Map;function l1(e,t,r){r=qr(-1,r),r.tag=3,r.payload={element:null};var n=t.value;return r.callback=function(){Ol||(Ol=!0,bf=n),uf(e,t)},r}function c1(e,t,r){r=qr(-1,r),r.tag=3;var n=e.type.getDerivedStateFromError;if(typeof n=="function"){var i=t.value;r.payload=function(){return n(i)},r.callback=function(){uf(e,t)}}var s=e.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(r.callback=function(){uf(e,t),typeof n!="function"&&(On===null?On=new Set([this]):On.add(this));var o=t.stack;this.componentDidCatch(t.value,{componentStack:o!==null?o:""})}),r}function tx(e,t,r){var n=e.pingCache;if(n===null){n=e.pingCache=new A_;var i=new Set;n.set(t,i)}else i=n.get(t),i===void 0&&(i=new Set,n.set(t,i));i.has(r)||(i.add(r),e=U_.bind(null,e,t,r),t.then(e,e))}function rx(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 nx(e,t,r,n,i){return e.mode&1?(e.flags|=65536,e.lanes=i,e):(e===t?e.flags|=65536:(e.flags|=128,r.flags|=131072,r.flags&=-52805,r.tag===1&&(r.alternate===null?r.tag=17:(t=qr(-1,1),t.tag=2,An(r,t,1))),r.lanes|=1),e)}var O_=sn.ReactCurrentOwner,St=!1;function ht(e,t,r,n){t.child=e===null?zb(t,null,r,n):ca(t,e.child,r,n)}function ix(e,t,r,n,i){r=r.render;var s=t.ref;return ta(t,i),n=ih(e,t,r,n,s,i),r=ah(),e!==null&&!St?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,Xr(e,t,i)):(be&&r&&Kp(t),t.flags|=1,ht(e,t,n,i),t.child)}function ax(e,t,r,n,i){if(e===null){var s=r.type;return typeof s=="function"&&!mh(s)&&s.defaultProps===void 0&&r.compare===null&&r.defaultProps===void 0?(t.tag=15,t.type=s,u1(e,t,s,n,i)):(e=al(r.type,null,n,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(s=e.child,!(e.lanes&i)){var o=s.memoizedProps;if(r=r.compare,r=r!==null?r:js,r(o,n)&&e.ref===t.ref)return Xr(e,t,i)}return t.flags|=1,e=Dn(s,n),e.ref=t.ref,e.return=t,t.child=e}function u1(e,t,r,n,i){if(e!==null){var s=e.memoizedProps;if(js(s,n)&&e.ref===t.ref)if(St=!1,t.pendingProps=n=s,(e.lanes&i)!==0)e.flags&131072&&(St=!0);else return t.lanes=e.lanes,Xr(e,t,i)}return df(e,t,r,n,i)}function d1(e,t,r){var n=t.pendingProps,i=n.children,s=e!==null?e.memoizedState:null;if(n.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},me(Vi,It),It|=r;else{if(!(r&1073741824))return e=s!==null?s.baseLanes|r:r,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,me(Vi,It),It|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},n=s!==null?s.baseLanes:r,me(Vi,It),It|=n}else s!==null?(n=s.baseLanes|r,t.memoizedState=null):n=r,me(Vi,It),It|=n;return ht(e,t,i,r),t.child}function f1(e,t){var r=t.ref;(e===null&&r!==null||e!==null&&e.ref!==r)&&(t.flags|=512,t.flags|=2097152)}function df(e,t,r,n,i){var s=Pt(r)?pi:ct.current;return s=oa(t,s),ta(t,i),r=ih(e,t,r,n,s,i),n=ah(),e!==null&&!St?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,Xr(e,t,i)):(be&&n&&Kp(t),t.flags|=1,ht(e,t,r,i),t.child)}function sx(e,t,r,n,i){if(Pt(r)){var s=!0;bl(t)}else s=!1;if(ta(t,i),t.stateNode===null)rl(e,t),o1(t,r,n),cf(t,r,n,i),n=!0;else if(e===null){var o=t.stateNode,l=t.memoizedProps;o.props=l;var c=o.context,d=r.contextType;typeof d=="object"&&d!==null?d=tr(d):(d=Pt(r)?pi:ct.current,d=oa(t,d));var u=r.getDerivedStateFromProps,f=typeof u=="function"||typeof o.getSnapshotBeforeUpdate=="function";f||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==n||c!==d)&&ex(t,o,n,d),gn=!1;var p=t.memoizedState;o.state=p,kl(t,n,o,i),c=t.memoizedState,l!==n||p!==c||kt.current||gn?(typeof u=="function"&&(lf(t,r,u,n),c=t.memoizedState),(l=gn||Qg(t,r,l,n,p,c,d))?(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=n,t.memoizedState=c),o.props=n,o.state=c,o.context=d,n=l):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),n=!1)}else{o=t.stateNode,Bb(e,t),l=t.memoizedProps,d=t.type===t.elementType?l:cr(t.type,l),o.props=d,f=t.pendingProps,p=o.context,c=r.contextType,typeof c=="object"&&c!==null?c=tr(c):(c=Pt(r)?pi:ct.current,c=oa(t,c));var m=r.getDerivedStateFromProps;(u=typeof m=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==f||p!==c)&&ex(t,o,n,c),gn=!1,p=t.memoizedState,o.state=p,kl(t,n,o,i);var x=t.memoizedState;l!==f||p!==x||kt.current||gn?(typeof m=="function"&&(lf(t,r,m,n),x=t.memoizedState),(d=gn||Qg(t,r,d,n,p,x,c)||!1)?(u||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(n,x,c),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(n,x,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=n,t.memoizedState=x),o.props=n,o.state=x,o.context=c,n=d):(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),n=!1)}return ff(e,t,r,n,s,i)}function ff(e,t,r,n,i,s){f1(e,t);var o=(t.flags&128)!==0;if(!n&&!o)return i&&Hg(t,r,!1),Xr(e,t,s);n=t.stateNode,O_.current=t;var l=o&&typeof r.getDerivedStateFromError!="function"?null:n.render();return t.flags|=1,e!==null&&o?(t.child=ca(t,e.child,null,s),t.child=ca(t,null,l,s)):ht(e,t,l,s),t.memoizedState=n.state,i&&Hg(t,r,!0),t.child}function p1(e){var t=e.stateNode;t.pendingContext?qg(e,t.pendingContext,t.pendingContext!==t.context):t.context&&qg(e,t.context,!1),eh(e,t.containerInfo)}function ox(e,t,r,n,i){return la(),Yp(i),t.flags|=256,ht(e,t,r,n),t.child}var pf={dehydrated:null,treeContext:null,retryLane:0};function hf(e){return{baseLanes:e,cachePool:null,transitions:null}}function h1(e,t,r){var n=t.pendingProps,i=Se.current,s=!1,o=(t.flags&128)!==0,l;if((l=o)||(l=e!==null&&e.memoizedState===null?!1:(i&2)!==0),l?(s=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(i|=1),me(Se,i&1),e===null)return sf(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=n.children,e=n.fallback,s?(n=t.mode,s=t.child,o={mode:"hidden",children:o},!(n&1)&&s!==null?(s.childLanes=0,s.pendingProps=o):s=$c(o,n,0,null),e=oi(e,n,r,null),s.return=t,e.return=t,s.sibling=e,t.child=s,t.child.memoizedState=hf(r),t.memoizedState=pf,e):lh(t,o));if(i=e.memoizedState,i!==null&&(l=i.dehydrated,l!==null))return E_(e,t,o,n,l,i,r);if(s){s=n.fallback,o=t.mode,i=e.child,l=i.sibling;var c={mode:"hidden",children:n.children};return!(o&1)&&t.child!==i?(n=t.child,n.childLanes=0,n.pendingProps=c,t.deletions=null):(n=Dn(i,c),n.subtreeFlags=i.subtreeFlags&14680064),l!==null?s=Dn(l,s):(s=oi(s,o,r,null),s.flags|=2),s.return=t,n.return=t,n.sibling=s,t.child=n,n=s,s=t.child,o=e.child.memoizedState,o=o===null?hf(r):{baseLanes:o.baseLanes|r,cachePool:null,transitions:o.transitions},s.memoizedState=o,s.childLanes=e.childLanes&~r,t.memoizedState=pf,n}return s=e.child,e=s.sibling,n=Dn(s,{mode:"visible",children:n.children}),!(t.mode&1)&&(n.lanes=r),n.return=t,n.sibling=null,e!==null&&(r=t.deletions,r===null?(t.deletions=[e],t.flags|=16):r.push(e)),t.child=n,t.memoizedState=null,n}function lh(e,t){return t=$c({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Co(e,t,r,n){return n!==null&&Yp(n),ca(t,e.child,null,r),e=lh(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function E_(e,t,r,n,i,s,o){if(r)return t.flags&256?(t.flags&=-257,n=nd(Error(W(422))),Co(e,t,o,n)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(s=n.fallback,i=t.mode,n=$c({mode:"visible",children:n.children},i,0,null),s=oi(s,i,o,null),s.flags|=2,n.return=t,s.return=t,n.sibling=s,t.child=n,t.mode&1&&ca(t,e.child,null,o),t.child.memoizedState=hf(o),t.memoizedState=pf,s);if(!(t.mode&1))return Co(e,t,o,null);if(i.data==="$!"){if(n=i.nextSibling&&i.nextSibling.dataset,n)var l=n.dgst;return n=l,s=Error(W(419)),n=nd(s,n,void 0),Co(e,t,o,n)}if(l=(o&e.childLanes)!==0,St||l){if(n=Ke,n!==null){switch(o&-o){case 4:i=2;break;case 16:i=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:i=32;break;case 536870912:i=268435456;break;default:i=0}i=i&(n.suspendedLanes|o)?0:i,i!==0&&i!==s.retryLane&&(s.retryLane=i,Zr(e,i),mr(n,e,i,-1))}return hh(),n=nd(Error(W(421))),Co(e,t,o,n)}return i.data==="$?"?(t.flags|=128,t.child=e.child,t=q_.bind(null,e),i._reactRetry=t,null):(e=s.treeContext,zt=Cn(i.nextSibling),Rt=t,be=!0,dr=null,e!==null&&(Yt[Gt++]=Br,Yt[Gt++]=Fr,Yt[Gt++]=hi,Br=e.id,Fr=e.overflow,hi=t),t=lh(t,n.children),t.flags|=4096,t)}function lx(e,t,r){e.lanes|=t;var n=e.alternate;n!==null&&(n.lanes|=t),of(e.return,t,r)}function id(e,t,r,n,i){var s=e.memoizedState;s===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:n,tail:r,tailMode:i}:(s.isBackwards=t,s.rendering=null,s.renderingStartTime=0,s.last=n,s.tail=r,s.tailMode=i)}function m1(e,t,r){var n=t.pendingProps,i=n.revealOrder,s=n.tail;if(ht(e,t,n.children,r),n=Se.current,n&2)n=n&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&&lx(e,r,t);else if(e.tag===19)lx(e,r,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}n&=1}if(me(Se,n),!(t.mode&1))t.memoizedState=null;else switch(i){case"forwards":for(r=t.child,i=null;r!==null;)e=r.alternate,e!==null&&Pl(e)===null&&(i=r),r=r.sibling;r=i,r===null?(i=t.child,t.child=null):(i=r.sibling,r.sibling=null),id(t,!1,i,r,s);break;case"backwards":for(r=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&Pl(e)===null){t.child=i;break}e=i.sibling,i.sibling=r,r=i,i=e}id(t,!0,r,null,s);break;case"together":id(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function rl(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Xr(e,t,r){if(e!==null&&(t.dependencies=e.dependencies),gi|=t.lanes,!(r&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(W(153));if(t.child!==null){for(e=t.child,r=Dn(e,e.pendingProps),t.child=r,r.return=t;e.sibling!==null;)e=e.sibling,r=r.sibling=Dn(e,e.pendingProps),r.return=t;r.sibling=null}return t.child}function D_(e,t,r){switch(t.tag){case 3:p1(t),la();break;case 5:Fb(t);break;case 1:Pt(t.type)&&bl(t);break;case 4:eh(t,t.stateNode.containerInfo);break;case 10:var n=t.type._context,i=t.memoizedProps.value;me(Sl,n._currentValue),n._currentValue=i;break;case 13:if(n=t.memoizedState,n!==null)return n.dehydrated!==null?(me(Se,Se.current&1),t.flags|=128,null):r&t.child.childLanes?h1(e,t,r):(me(Se,Se.current&1),e=Xr(e,t,r),e!==null?e.sibling:null);me(Se,Se.current&1);break;case 19:if(n=(r&t.childLanes)!==0,e.flags&128){if(n)return m1(e,t,r);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),me(Se,Se.current),n)break;return null;case 22:case 23:return t.lanes=0,d1(e,t,r)}return Xr(e,t,r)}var g1,mf,x1,y1;g1=function(e,t){for(var r=t.child;r!==null;){if(r.tag===5||r.tag===6)e.appendChild(r.stateNode);else if(r.tag!==4&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===t)break;for(;r.sibling===null;){if(r.return===null||r.return===t)return;r=r.return}r.sibling.return=r.return,r=r.sibling}};mf=function(){};x1=function(e,t,r,n){var i=e.memoizedProps;if(i!==n){e=t.stateNode,ri(Pr.current);var s=null;switch(r){case"input":i=$d(e,i),n=$d(e,n),s=[];break;case"select":i=ke({},i,{value:void 0}),n=ke({},n,{value:void 0}),s=[];break;case"textarea":i=Rd(e,i),n=Rd(e,n),s=[];break;default:typeof i.onClick!="function"&&typeof n.onClick=="function"&&(e.onclick=yl)}Fd(r,n);var o;r=null;for(d in i)if(!n.hasOwnProperty(d)&&i.hasOwnProperty(d)&&i[d]!=null)if(d==="style"){var l=i[d];for(o in l)l.hasOwnProperty(o)&&(r||(r={}),r[o]="")}else d!=="dangerouslySetInnerHTML"&&d!=="children"&&d!=="suppressContentEditableWarning"&&d!=="suppressHydrationWarning"&&d!=="autoFocus"&&(hs.hasOwnProperty(d)?s||(s=[]):(s=s||[]).push(d,null));for(d in n){var c=n[d];if(l=i!=null?i[d]:void 0,n.hasOwnProperty(d)&&c!==l&&(c!=null||l!=null))if(d==="style")if(l){for(o in l)!l.hasOwnProperty(o)||c&&c.hasOwnProperty(o)||(r||(r={}),r[o]="");for(o in c)c.hasOwnProperty(o)&&l[o]!==c[o]&&(r||(r={}),r[o]=c[o])}else r||(s||(s=[]),s.push(d,r)),r=c;else d==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,l=l?l.__html:void 0,c!=null&&l!==c&&(s=s||[]).push(d,c)):d==="children"?typeof c!="string"&&typeof c!="number"||(s=s||[]).push(d,""+c):d!=="suppressContentEditableWarning"&&d!=="suppressHydrationWarning"&&(hs.hasOwnProperty(d)?(c!=null&&d==="onScroll"&&ge("scroll",e),s||l===c||(s=[])):(s=s||[]).push(d,c))}r&&(s=s||[]).push("style",r);var d=s;(t.updateQueue=d)&&(t.flags|=4)}};y1=function(e,t,r,n){r!==n&&(t.flags|=4)};function Fa(e,t){if(!be)switch(e.tailMode){case"hidden":t=e.tail;for(var r=null;t!==null;)t.alternate!==null&&(r=t),t=t.sibling;r===null?e.tail=null:r.sibling=null;break;case"collapsed":r=e.tail;for(var n=null;r!==null;)r.alternate!==null&&(n=r),r=r.sibling;n===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:n.sibling=null}}function it(e){var t=e.alternate!==null&&e.alternate.child===e.child,r=0,n=0;if(t)for(var i=e.child;i!==null;)r|=i.lanes|i.childLanes,n|=i.subtreeFlags&14680064,n|=i.flags&14680064,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)r|=i.lanes|i.childLanes,n|=i.subtreeFlags,n|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=n,e.childLanes=r,t}function T_(e,t,r){var n=t.pendingProps;switch(Vp(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return it(t),null;case 1:return Pt(t.type)&&vl(),it(t),null;case 3:return n=t.stateNode,ua(),ye(kt),ye(ct),rh(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Po(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,dr!==null&&(Sf(dr),dr=null))),mf(e,t),it(t),null;case 5:th(t);var i=ri(Ps.current);if(r=t.type,e!==null&&t.stateNode!=null)x1(e,t,r,n,i),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!n){if(t.stateNode===null)throw Error(W(166));return it(t),null}if(e=ri(Pr.current),Po(t)){n=t.stateNode,r=t.type;var s=t.memoizedProps;switch(n[Sr]=t,n[Ns]=s,e=(t.mode&1)!==0,r){case"dialog":ge("cancel",n),ge("close",n);break;case"iframe":case"object":case"embed":ge("load",n);break;case"video":case"audio":for(i=0;i<\/script>",e=e.removeChild(e.firstChild)):typeof n.is=="string"?e=o.createElement(r,{is:n.is}):(e=o.createElement(r),r==="select"&&(o=e,n.multiple?o.multiple=!0:n.size&&(o.size=n.size))):e=o.createElementNS(e,r),e[Sr]=t,e[Ns]=n,g1(e,t,!1,!1),t.stateNode=e;e:{switch(o=Wd(r,n),r){case"dialog":ge("cancel",e),ge("close",e),i=n;break;case"iframe":case"object":case"embed":ge("load",e),i=n;break;case"video":case"audio":for(i=0;ifa&&(t.flags|=128,n=!0,Fa(s,!1),t.lanes=4194304)}else{if(!n)if(e=Pl(o),e!==null){if(t.flags|=128,n=!0,r=e.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),Fa(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!be)return it(t),null}else 2*Ae()-s.renderingStartTime>fa&&r!==1073741824&&(t.flags|=128,n=!0,Fa(s,!1),t.lanes=4194304);s.isBackwards?(o.sibling=t.child,t.child=o):(r=s.last,r!==null?r.sibling=o:t.child=o,s.last=o)}return s.tail!==null?(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=Ae(),t.sibling=null,r=Se.current,me(Se,n?r&1|2:r&1),t):(it(t),null);case 22:case 23:return ph(),n=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==n&&(t.flags|=8192),n&&t.mode&1?It&1073741824&&(it(t),t.subtreeFlags&6&&(t.flags|=8192)):it(t),null;case 24:return null;case 25:return null}throw Error(W(156,t.tag))}function M_(e,t){switch(Vp(t),t.tag){case 1:return Pt(t.type)&&vl(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ua(),ye(kt),ye(ct),rh(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return th(t),null;case 13:if(ye(Se),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(W(340));la()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ye(Se),null;case 4:return ua(),null;case 10:return Xp(t.type._context),null;case 22:case 23:return ph(),null;case 24:return null;default:return null}}var Ao=!1,st=!1,I_=typeof WeakSet=="function"?WeakSet:Set,K=null;function Ki(e,t){var r=e.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){Pe(e,t,n)}else r.current=null}function gf(e,t,r){try{r()}catch(n){Pe(e,t,n)}}var cx=!1;function $_(e,t){if(Jd=ml,e=Sb(),Hp(e)){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{r=(r=e.ownerDocument)&&r.defaultView||window;var n=r.getSelection&&r.getSelection();if(n&&n.rangeCount!==0){r=n.anchorNode;var i=n.anchorOffset,s=n.focusNode;n=n.focusOffset;try{r.nodeType,s.nodeType}catch{r=null;break e}var o=0,l=-1,c=-1,d=0,u=0,f=e,p=null;t:for(;;){for(var m;f!==r||i!==0&&f.nodeType!==3||(l=o+i),f!==s||n!==0&&f.nodeType!==3||(c=o+n),f.nodeType===3&&(o+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break t;if(p===r&&++d===i&&(l=o),p===s&&++u===n&&(c=o),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}r=l===-1||c===-1?null:{start:l,end:c}}else r=null}r=r||{start:0,end:0}}else r=null;for(Qd={focusedElem:e,selectionRange:r},ml=!1,K=t;K!==null;)if(t=K,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,K=e;else for(;K!==null;){t=K;try{var x=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(x!==null){var g=x.memoizedProps,b=x.memoizedState,v=t.stateNode,j=v.getSnapshotBeforeUpdate(t.elementType===t.type?g:cr(t.type,g),b);v.__reactInternalSnapshotBeforeUpdate=j}break;case 3:var y=t.stateNode.containerInfo;y.nodeType===1?y.textContent="":y.nodeType===9&&y.documentElement&&y.removeChild(y.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(W(163))}}catch(w){Pe(t,t.return,w)}if(e=t.sibling,e!==null){e.return=t.return,K=e;break}K=t.return}return x=cx,cx=!1,x}function ls(e,t,r){var n=t.updateQueue;if(n=n!==null?n.lastEffect:null,n!==null){var i=n=n.next;do{if((i.tag&e)===e){var s=i.destroy;i.destroy=void 0,s!==void 0&&gf(t,r,s)}i=i.next}while(i!==n)}}function Mc(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var r=t=t.next;do{if((r.tag&e)===e){var n=r.create;r.destroy=n()}r=r.next}while(r!==t)}}function xf(e){var t=e.ref;if(t!==null){var r=e.stateNode;switch(e.tag){case 5:e=r;break;default:e=r}typeof t=="function"?t(e):t.current=e}}function v1(e){var t=e.alternate;t!==null&&(e.alternate=null,v1(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Sr],delete t[Ns],delete t[rf],delete t[y_],delete t[v_])),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 b1(e){return e.tag===5||e.tag===3||e.tag===4}function ux(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||b1(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 yf(e,t,r){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?r.nodeType===8?r.parentNode.insertBefore(e,t):r.insertBefore(e,t):(r.nodeType===8?(t=r.parentNode,t.insertBefore(e,r)):(t=r,t.appendChild(e)),r=r._reactRootContainer,r!=null||t.onclick!==null||(t.onclick=yl));else if(n!==4&&(e=e.child,e!==null))for(yf(e,t,r),e=e.sibling;e!==null;)yf(e,t,r),e=e.sibling}function vf(e,t,r){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?r.insertBefore(e,t):r.appendChild(e);else if(n!==4&&(e=e.child,e!==null))for(vf(e,t,r),e=e.sibling;e!==null;)vf(e,t,r),e=e.sibling}var Xe=null,ur=!1;function hn(e,t,r){for(r=r.child;r!==null;)j1(e,t,r),r=r.sibling}function j1(e,t,r){if(kr&&typeof kr.onCommitFiberUnmount=="function")try{kr.onCommitFiberUnmount(Pc,r)}catch{}switch(r.tag){case 5:st||Ki(r,t);case 6:var n=Xe,i=ur;Xe=null,hn(e,t,r),Xe=n,ur=i,Xe!==null&&(ur?(e=Xe,r=r.stateNode,e.nodeType===8?e.parentNode.removeChild(r):e.removeChild(r)):Xe.removeChild(r.stateNode));break;case 18:Xe!==null&&(ur?(e=Xe,r=r.stateNode,e.nodeType===8?Xu(e.parentNode,r):e.nodeType===1&&Xu(e,r),vs(e)):Xu(Xe,r.stateNode));break;case 4:n=Xe,i=ur,Xe=r.stateNode.containerInfo,ur=!0,hn(e,t,r),Xe=n,ur=i;break;case 0:case 11:case 14:case 15:if(!st&&(n=r.updateQueue,n!==null&&(n=n.lastEffect,n!==null))){i=n=n.next;do{var s=i,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&gf(r,t,o),i=i.next}while(i!==n)}hn(e,t,r);break;case 1:if(!st&&(Ki(r,t),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(l){Pe(r,t,l)}hn(e,t,r);break;case 21:hn(e,t,r);break;case 22:r.mode&1?(st=(n=st)||r.memoizedState!==null,hn(e,t,r),st=n):hn(e,t,r);break;default:hn(e,t,r)}}function dx(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var r=e.stateNode;r===null&&(r=e.stateNode=new I_),t.forEach(function(n){var i=H_.bind(null,e,n);r.has(n)||(r.add(n),n.then(i,i))})}}function lr(e,t){var r=t.deletions;if(r!==null)for(var n=0;ni&&(i=o),n&=~s}if(n=i,n=Ae()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*z_(n/1960))-n,10e?16:e,Sn===null)var n=!1;else{if(e=Sn,Sn=null,El=0,ae&6)throw Error(W(331));var i=ae;for(ae|=4,K=e.current;K!==null;){var s=K,o=s.child;if(K.flags&16){var l=s.deletions;if(l!==null){for(var c=0;cAe()-dh?si(e,0):uh|=r),_t(e,t)}function A1(e,t){t===0&&(e.mode&1?(t=bo,bo<<=1,!(bo&130023424)&&(bo=4194304)):t=1);var r=gt();e=Zr(e,t),e!==null&&(Vs(e,t,r),_t(e,r))}function q_(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),A1(e,r)}function H_(e,t){var r=0;switch(e.tag){case 13:var n=e.stateNode,i=e.memoizedState;i!==null&&(r=i.retryLane);break;case 19:n=e.stateNode;break;default:throw Error(W(314))}n!==null&&n.delete(t),A1(e,r)}var O1;O1=function(e,t,r){if(e!==null)if(e.memoizedProps!==t.pendingProps||kt.current)St=!0;else{if(!(e.lanes&r)&&!(t.flags&128))return St=!1,D_(e,t,r);St=!!(e.flags&131072)}else St=!1,be&&t.flags&1048576&&Mb(t,wl,t.index);switch(t.lanes=0,t.tag){case 2:var n=t.type;rl(e,t),e=t.pendingProps;var i=oa(t,ct.current);ta(t,r),i=ih(null,t,n,e,i,r);var s=ah();return t.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Pt(n)?(s=!0,bl(t)):s=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,Qp(t),i.updater=Tc,t.stateNode=i,i._reactInternals=t,cf(t,n,e,r),t=ff(null,t,n,!0,s,r)):(t.tag=0,be&&s&&Kp(t),ht(null,t,i,r),t=t.child),t;case 16:n=t.elementType;e:{switch(rl(e,t),e=t.pendingProps,i=n._init,n=i(n._payload),t.type=n,i=t.tag=V_(n),e=cr(n,e),i){case 0:t=df(null,t,n,e,r);break e;case 1:t=sx(null,t,n,e,r);break e;case 11:t=ix(null,t,n,e,r);break e;case 14:t=ax(null,t,n,cr(n.type,e),r);break e}throw Error(W(306,n,""))}return t;case 0:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:cr(n,i),df(e,t,n,i,r);case 1:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:cr(n,i),sx(e,t,n,i,r);case 3:e:{if(p1(t),e===null)throw Error(W(387));n=t.pendingProps,s=t.memoizedState,i=s.element,Bb(e,t),kl(t,n,null,r);var o=t.memoizedState;if(n=o.element,s.isDehydrated)if(s={element:n,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=s,t.memoizedState=s,t.flags&256){i=da(Error(W(423)),t),t=ox(e,t,n,r,i);break e}else if(n!==i){i=da(Error(W(424)),t),t=ox(e,t,n,r,i);break e}else for(zt=Cn(t.stateNode.containerInfo.firstChild),Rt=t,be=!0,dr=null,r=zb(t,null,n,r),t.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(la(),n===i){t=Xr(e,t,r);break e}ht(e,t,n,r)}t=t.child}return t;case 5:return Fb(t),e===null&&sf(t),n=t.type,i=t.pendingProps,s=e!==null?e.memoizedProps:null,o=i.children,ef(n,i)?o=null:s!==null&&ef(n,s)&&(t.flags|=32),f1(e,t),ht(e,t,o,r),t.child;case 6:return e===null&&sf(t),null;case 13:return h1(e,t,r);case 4:return eh(t,t.stateNode.containerInfo),n=t.pendingProps,e===null?t.child=ca(t,null,n,r):ht(e,t,n,r),t.child;case 11:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:cr(n,i),ix(e,t,n,i,r);case 7:return ht(e,t,t.pendingProps,r),t.child;case 8:return ht(e,t,t.pendingProps.children,r),t.child;case 12:return ht(e,t,t.pendingProps.children,r),t.child;case 10:e:{if(n=t.type._context,i=t.pendingProps,s=t.memoizedProps,o=i.value,me(Sl,n._currentValue),n._currentValue=o,s!==null)if(gr(s.value,o)){if(s.children===i.children&&!kt.current){t=Xr(e,t,r);break e}}else for(s=t.child,s!==null&&(s.return=t);s!==null;){var l=s.dependencies;if(l!==null){o=s.child;for(var c=l.firstContext;c!==null;){if(c.context===n){if(s.tag===1){c=qr(-1,r&-r),c.tag=2;var d=s.updateQueue;if(d!==null){d=d.shared;var u=d.pending;u===null?c.next=c:(c.next=u.next,u.next=c),d.pending=c}}s.lanes|=r,c=s.alternate,c!==null&&(c.lanes|=r),of(s.return,r,t),l.lanes|=r;break}c=c.next}}else if(s.tag===10)o=s.type===t.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(W(341));o.lanes|=r,l=o.alternate,l!==null&&(l.lanes|=r),of(o,r,t),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===t){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}ht(e,t,i.children,r),t=t.child}return t;case 9:return i=t.type,n=t.pendingProps.children,ta(t,r),i=tr(i),n=n(i),t.flags|=1,ht(e,t,n,r),t.child;case 14:return n=t.type,i=cr(n,t.pendingProps),i=cr(n.type,i),ax(e,t,n,i,r);case 15:return u1(e,t,t.type,t.pendingProps,r);case 17:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:cr(n,i),rl(e,t),t.tag=1,Pt(n)?(e=!0,bl(t)):e=!1,ta(t,r),o1(t,n,i),cf(t,n,i,r),ff(null,t,n,!0,e,r);case 19:return m1(e,t,r);case 22:return d1(e,t,r)}throw Error(W(156,t.tag))};function E1(e,t){return ib(e,t)}function K_(e,t,r,n){this.tag=e,this.key=r,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=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Zt(e,t,r,n){return new K_(e,t,r,n)}function mh(e){return e=e.prototype,!(!e||!e.isReactComponent)}function V_(e){if(typeof e=="function")return mh(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Mp)return 11;if(e===Ip)return 14}return 2}function Dn(e,t){var r=e.alternate;return r===null?(r=Zt(e.tag,t,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=t,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&14680064,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,t=e.dependencies,r.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r}function al(e,t,r,n,i,s){var o=2;if(n=e,typeof e=="function")mh(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case Li:return oi(r.children,i,s,t);case Tp:o=8,i|=8;break;case Dd:return e=Zt(12,r,t,i|2),e.elementType=Dd,e.lanes=s,e;case Td:return e=Zt(13,r,t,i),e.elementType=Td,e.lanes=s,e;case Md:return e=Zt(19,r,t,i),e.elementType=Md,e.lanes=s,e;case Fv:return $c(r,i,s,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Rv:o=10;break e;case Bv:o=9;break e;case Mp:o=11;break e;case Ip:o=14;break e;case mn:o=16,n=null;break e}throw Error(W(130,e==null?e:typeof e,""))}return t=Zt(o,r,t,i),t.elementType=e,t.type=n,t.lanes=s,t}function oi(e,t,r,n){return e=Zt(7,e,n,t),e.lanes=r,e}function $c(e,t,r,n){return e=Zt(22,e,n,t),e.elementType=Fv,e.lanes=r,e.stateNode={isHidden:!1},e}function ad(e,t,r){return e=Zt(6,e,null,t),e.lanes=r,e}function sd(e,t,r){return t=Zt(4,e.children!==null?e.children:[],e.key,t),t.lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Y_(e,t,r,n,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Bu(0),this.expirationTimes=Bu(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Bu(0),this.identifierPrefix=n,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function gh(e,t,r,n,i,s,o,l,c){return e=new Y_(e,t,r,l,c),t===1?(t=1,s===!0&&(t|=8)):t=0,s=Zt(3,null,null,t),e.current=s,s.stateNode=e,s.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},Qp(s),e}function G_(e,t,r){var n=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(I1)}catch(e){console.error(e)}}I1(),Iv.exports=Ut;var bh=Iv.exports,vx=bh;Od.createRoot=vx.createRoot,Od.hydrateRoot=vx.hydrateRoot;/** * @remix-run/router v1.23.1 * * Copyright (c) Remix Software Inc. @@ -46,7 +46,7 @@ Error generating stack: `+s.message+` * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function Os(){return Os=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u")throw new Error(t)}function jh(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function tC(){return Math.random().toString(36).substr(2,8)}function jx(e,t){return{usr:e.state,key:e.key,idx:t}}function Nf(e,t,r,n){return r===void 0&&(r=null),Os({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?wa(t):t,{state:r,key:t&&t.key||n||tC()})}function Ml(e){let{pathname:t="/",search:r="",hash:n=""}=e;return r&&r!=="?"&&(t+=r.charAt(0)==="?"?r:"?"+r),n&&n!=="#"&&(t+=n.charAt(0)==="#"?n:"#"+n),t}function wa(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substr(r),e=e.substr(0,r));let n=e.indexOf("?");n>=0&&(t.search=e.substr(n),e=e.substr(0,n)),e&&(t.pathname=e)}return t}function rC(e,t,r,n){n===void 0&&(n={});let{window:i=document.defaultView,v5Compat:s=!1}=n,o=i.history,l=Nn.Pop,c=null,d=u();d==null&&(d=0,o.replaceState(Os({},o.state,{idx:d}),""));function u(){return(o.state||{idx:null}).idx}function f(){l=Nn.Pop;let b=u(),v=b==null?null:b-d;d=b,c&&c({action:l,location:g.location,delta:v})}function p(b,v){l=Nn.Push;let j=Nf(g.location,b,v);d=u()+1;let y=jx(j,d),w=g.createHref(j);try{o.pushState(y,"",w)}catch(S){if(S instanceof DOMException&&S.name==="DataCloneError")throw S;i.location.assign(w)}s&&c&&c({action:l,location:g.location,delta:1})}function m(b,v){l=Nn.Replace;let j=Nf(g.location,b,v);d=u();let y=jx(j,d),w=g.createHref(j);o.replaceState(y,"",w),s&&c&&c({action:l,location:g.location,delta:0})}function x(b){let v=i.location.origin!=="null"?i.location.origin:i.location.href,j=typeof b=="string"?b:Ml(b);return j=j.replace(/ $/,"%20"),Oe(v,"No window.location.(origin|href) available to create URL for href: "+j),new URL(j,v)}let g={get action(){return l},get location(){return e(i,o)},listen(b){if(c)throw new Error("A history only accepts one active listener");return i.addEventListener(bx,f),c=b,()=>{i.removeEventListener(bx,f),c=null}},createHref(b){return t(i,b)},createURL:x,encodeLocation(b){let v=x(b);return{pathname:v.pathname,search:v.search,hash:v.hash}},push:p,replace:m,go(b){return o.go(b)}};return g}var wx;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(wx||(wx={}));function nC(e,t,r){return r===void 0&&(r="/"),iC(e,t,r)}function iC(e,t,r,n){let i=typeof t=="string"?wa(t):t,s=wh(i.pathname||"/",r);if(s==null)return null;let o=$1(e);aC(o);let l=null;for(let c=0;l==null&&c{let c={relativePath:l===void 0?s.path||"":l,caseSensitive:s.caseSensitive===!0,childrenIndex:o,route:s};c.relativePath.startsWith("/")&&(Oe(c.relativePath.startsWith(n),'Absolute route path "'+c.relativePath+'" nested under path '+('"'+n+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),c.relativePath=c.relativePath.slice(n.length));let d=Tn([n,c.relativePath]),u=r.concat(c);s.children&&s.children.length>0&&(Oe(s.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+d+'".')),$1(s.children,t,u,d)),!(s.path==null&&!s.index)&&t.push({path:d,score:fC(d,s.index),routesMeta:u})};return e.forEach((s,o)=>{var l;if(s.path===""||!((l=s.path)!=null&&l.includes("?")))i(s,o);else for(let c of L1(s.path))i(s,o,c)}),t}function L1(e){let t=e.split("/");if(t.length===0)return[];let[r,...n]=t,i=r.endsWith("?"),s=r.replace(/\?$/,"");if(n.length===0)return i?[s,""]:[s];let o=L1(n.join("/")),l=[];return l.push(...o.map(c=>c===""?s:[s,c].join("/"))),i&&l.push(...o),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function aC(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:pC(t.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}const sC=/^:[\w-]+$/,oC=3,lC=2,cC=1,uC=10,dC=-2,Sx=e=>e==="*";function fC(e,t){let r=e.split("/"),n=r.length;return r.some(Sx)&&(n+=dC),t&&(n+=lC),r.filter(i=>!Sx(i)).reduce((i,s)=>i+(sC.test(s)?oC:s===""?cC:uC),n)}function pC(e,t){return e.length===t.length&&e.slice(0,-1).every((n,i)=>n===t[i])?e[e.length-1]-t[t.length-1]:0}function hC(e,t,r){let{routesMeta:n}=e,i={},s="/",o=[];for(let l=0;l{let{paramName:p,isOptional:m}=u;if(p==="*"){let g=l[f]||"";o=s.slice(0,s.length-g.length).replace(/(.)\/+$/,"$1")}const x=l[f];return m&&!x?d[p]=void 0:d[p]=(x||"").replace(/%2F/g,"/"),d},{}),pathname:s,pathnameBase:o,pattern:e}}function gC(e,t,r){t===void 0&&(t=!1),r===void 0&&(r=!0),jh(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 n=[],i="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,l,c)=>(n.push({paramName:l,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(n.push({paramName:"*"}),i+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?i+="\\/*$":e!==""&&e!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,t?void 0:"i"),n]}function xC(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return jh(!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 wh(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,n=e.charAt(r);return n&&n!=="/"?null:e.slice(r)||"/"}const yC=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,vC=e=>yC.test(e);function bC(e,t){t===void 0&&(t="/");let{pathname:r,search:n="",hash:i=""}=typeof e=="string"?wa(e):e,s;if(r)if(vC(r))s=r;else{if(r.includes("//")){let o=r;r=r.replace(/\/\/+/g,"/"),jh(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+r))}r.startsWith("/")?s=Nx(r.substring(1),"/"):s=Nx(r,t)}else s=t;return{pathname:s,search:SC(n),hash:NC(i)}}function Nx(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(i=>{i===".."?r.length>1&&r.pop():i!=="."&&r.push(i)}),r.length>1?r.join("/"):"/"}function od(e,t,r,n){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(n)+"]. Please separate it out to the ")+("`to."+r+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function jC(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function Sh(e,t){let r=jC(e);return t?r.map((n,i)=>i===r.length-1?n.pathname:n.pathnameBase):r.map(n=>n.pathnameBase)}function Nh(e,t,r,n){n===void 0&&(n=!1);let i;typeof e=="string"?i=wa(e):(i=Os({},e),Oe(!i.pathname||!i.pathname.includes("?"),od("?","pathname","search",i)),Oe(!i.pathname||!i.pathname.includes("#"),od("#","pathname","hash",i)),Oe(!i.search||!i.search.includes("#"),od("#","search","hash",i)));let s=e===""||i.pathname==="",o=s?"/":i.pathname,l;if(o==null)l=r;else{let f=t.length-1;if(!n&&o.startsWith("..")){let p=o.split("/");for(;p[0]==="..";)p.shift(),f-=1;i.pathname=p.join("/")}l=f>=0?t[f]:"/"}let c=bC(i,l),d=o&&o!=="/"&&o.endsWith("/"),u=(s||o===".")&&r.endsWith("/");return!c.pathname.endsWith("/")&&(d||u)&&(c.pathname+="/"),c}const Tn=e=>e.join("/").replace(/\/\/+/g,"/"),wC=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),SC=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,NC=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function kC(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const z1=["post","put","patch","delete"];new Set(z1);const PC=["get",...z1];new Set(PC);/** + */function Es(){return Es=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u")throw new Error(t)}function jh(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function tC(){return Math.random().toString(36).substr(2,8)}function jx(e,t){return{usr:e.state,key:e.key,idx:t}}function Nf(e,t,r,n){return r===void 0&&(r=null),Es({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?Sa(t):t,{state:r,key:t&&t.key||n||tC()})}function Ml(e){let{pathname:t="/",search:r="",hash:n=""}=e;return r&&r!=="?"&&(t+=r.charAt(0)==="?"?r:"?"+r),n&&n!=="#"&&(t+=n.charAt(0)==="#"?n:"#"+n),t}function Sa(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substr(r),e=e.substr(0,r));let n=e.indexOf("?");n>=0&&(t.search=e.substr(n),e=e.substr(0,n)),e&&(t.pathname=e)}return t}function rC(e,t,r,n){n===void 0&&(n={});let{window:i=document.defaultView,v5Compat:s=!1}=n,o=i.history,l=Nn.Pop,c=null,d=u();d==null&&(d=0,o.replaceState(Es({},o.state,{idx:d}),""));function u(){return(o.state||{idx:null}).idx}function f(){l=Nn.Pop;let b=u(),v=b==null?null:b-d;d=b,c&&c({action:l,location:g.location,delta:v})}function p(b,v){l=Nn.Push;let j=Nf(g.location,b,v);d=u()+1;let y=jx(j,d),w=g.createHref(j);try{o.pushState(y,"",w)}catch(S){if(S instanceof DOMException&&S.name==="DataCloneError")throw S;i.location.assign(w)}s&&c&&c({action:l,location:g.location,delta:1})}function m(b,v){l=Nn.Replace;let j=Nf(g.location,b,v);d=u();let y=jx(j,d),w=g.createHref(j);o.replaceState(y,"",w),s&&c&&c({action:l,location:g.location,delta:0})}function x(b){let v=i.location.origin!=="null"?i.location.origin:i.location.href,j=typeof b=="string"?b:Ml(b);return j=j.replace(/ $/,"%20"),Oe(v,"No window.location.(origin|href) available to create URL for href: "+j),new URL(j,v)}let g={get action(){return l},get location(){return e(i,o)},listen(b){if(c)throw new Error("A history only accepts one active listener");return i.addEventListener(bx,f),c=b,()=>{i.removeEventListener(bx,f),c=null}},createHref(b){return t(i,b)},createURL:x,encodeLocation(b){let v=x(b);return{pathname:v.pathname,search:v.search,hash:v.hash}},push:p,replace:m,go(b){return o.go(b)}};return g}var wx;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(wx||(wx={}));function nC(e,t,r){return r===void 0&&(r="/"),iC(e,t,r)}function iC(e,t,r,n){let i=typeof t=="string"?Sa(t):t,s=wh(i.pathname||"/",r);if(s==null)return null;let o=$1(e);aC(o);let l=null;for(let c=0;l==null&&c{let c={relativePath:l===void 0?s.path||"":l,caseSensitive:s.caseSensitive===!0,childrenIndex:o,route:s};c.relativePath.startsWith("/")&&(Oe(c.relativePath.startsWith(n),'Absolute route path "'+c.relativePath+'" nested under path '+('"'+n+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),c.relativePath=c.relativePath.slice(n.length));let d=Tn([n,c.relativePath]),u=r.concat(c);s.children&&s.children.length>0&&(Oe(s.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+d+'".')),$1(s.children,t,u,d)),!(s.path==null&&!s.index)&&t.push({path:d,score:fC(d,s.index),routesMeta:u})};return e.forEach((s,o)=>{var l;if(s.path===""||!((l=s.path)!=null&&l.includes("?")))i(s,o);else for(let c of L1(s.path))i(s,o,c)}),t}function L1(e){let t=e.split("/");if(t.length===0)return[];let[r,...n]=t,i=r.endsWith("?"),s=r.replace(/\?$/,"");if(n.length===0)return i?[s,""]:[s];let o=L1(n.join("/")),l=[];return l.push(...o.map(c=>c===""?s:[s,c].join("/"))),i&&l.push(...o),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function aC(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:pC(t.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}const sC=/^:[\w-]+$/,oC=3,lC=2,cC=1,uC=10,dC=-2,Sx=e=>e==="*";function fC(e,t){let r=e.split("/"),n=r.length;return r.some(Sx)&&(n+=dC),t&&(n+=lC),r.filter(i=>!Sx(i)).reduce((i,s)=>i+(sC.test(s)?oC:s===""?cC:uC),n)}function pC(e,t){return e.length===t.length&&e.slice(0,-1).every((n,i)=>n===t[i])?e[e.length-1]-t[t.length-1]:0}function hC(e,t,r){let{routesMeta:n}=e,i={},s="/",o=[];for(let l=0;l{let{paramName:p,isOptional:m}=u;if(p==="*"){let g=l[f]||"";o=s.slice(0,s.length-g.length).replace(/(.)\/+$/,"$1")}const x=l[f];return m&&!x?d[p]=void 0:d[p]=(x||"").replace(/%2F/g,"/"),d},{}),pathname:s,pathnameBase:o,pattern:e}}function gC(e,t,r){t===void 0&&(t=!1),r===void 0&&(r=!0),jh(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 n=[],i="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,l,c)=>(n.push({paramName:l,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(n.push({paramName:"*"}),i+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?i+="\\/*$":e!==""&&e!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,t?void 0:"i"),n]}function xC(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return jh(!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 wh(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,n=e.charAt(r);return n&&n!=="/"?null:e.slice(r)||"/"}const yC=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,vC=e=>yC.test(e);function bC(e,t){t===void 0&&(t="/");let{pathname:r,search:n="",hash:i=""}=typeof e=="string"?Sa(e):e,s;if(r)if(vC(r))s=r;else{if(r.includes("//")){let o=r;r=r.replace(/\/\/+/g,"/"),jh(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+r))}r.startsWith("/")?s=Nx(r.substring(1),"/"):s=Nx(r,t)}else s=t;return{pathname:s,search:SC(n),hash:NC(i)}}function Nx(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(i=>{i===".."?r.length>1&&r.pop():i!=="."&&r.push(i)}),r.length>1?r.join("/"):"/"}function od(e,t,r,n){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(n)+"]. Please separate it out to the ")+("`to."+r+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function jC(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function Sh(e,t){let r=jC(e);return t?r.map((n,i)=>i===r.length-1?n.pathname:n.pathnameBase):r.map(n=>n.pathnameBase)}function Nh(e,t,r,n){n===void 0&&(n=!1);let i;typeof e=="string"?i=Sa(e):(i=Es({},e),Oe(!i.pathname||!i.pathname.includes("?"),od("?","pathname","search",i)),Oe(!i.pathname||!i.pathname.includes("#"),od("#","pathname","hash",i)),Oe(!i.search||!i.search.includes("#"),od("#","search","hash",i)));let s=e===""||i.pathname==="",o=s?"/":i.pathname,l;if(o==null)l=r;else{let f=t.length-1;if(!n&&o.startsWith("..")){let p=o.split("/");for(;p[0]==="..";)p.shift(),f-=1;i.pathname=p.join("/")}l=f>=0?t[f]:"/"}let c=bC(i,l),d=o&&o!=="/"&&o.endsWith("/"),u=(s||o===".")&&r.endsWith("/");return!c.pathname.endsWith("/")&&(d||u)&&(c.pathname+="/"),c}const Tn=e=>e.join("/").replace(/\/\/+/g,"/"),wC=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),SC=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,NC=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function kC(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const z1=["post","put","patch","delete"];new Set(z1);const PC=["get",...z1];new Set(PC);/** * React Router v6.30.2 * * Copyright (c) Remix Software Inc. @@ -55,7 +55,7 @@ Error generating stack: `+s.message+` * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function Es(){return Es=Object.assign?Object.assign.bind():function(e){for(var t=1;t{l.current=!0}),h.useCallback(function(d,u){if(u===void 0&&(u={}),!l.current)return;if(typeof d=="number"){n.go(d);return}let f=Nh(d,JSON.parse(o),s,u.relative==="path");e==null&&t!=="/"&&(f.pathname=f.pathname==="/"?t:Tn([t,f.pathname])),(u.replace?n.replace:n.push)(f,u.state,u)},[t,n,o,s,e])}function Na(){let{matches:e}=h.useContext(on),t=e[e.length-1];return t?t.params:{}}function F1(e,t){let{relative:r}=t===void 0?{}:t,{future:n}=h.useContext(Un),{matches:i}=h.useContext(on),{pathname:s}=_i(),o=JSON.stringify(Sh(i,n.v7_relativeSplatPath));return h.useMemo(()=>Nh(e,JSON.parse(o),s,r==="path"),[e,o,s,r])}function OC(e,t){return EC(e,t)}function EC(e,t,r,n){Sa()||Oe(!1);let{navigator:i}=h.useContext(Un),{matches:s}=h.useContext(on),o=s[s.length-1],l=o?o.params:{};o&&o.pathname;let c=o?o.pathnameBase:"/";o&&o.route;let d=_i(),u;if(t){var f;let b=typeof t=="string"?wa(t):t;c==="/"||(f=b.pathname)!=null&&f.startsWith(c)||Oe(!1),u=b}else u=d;let p=u.pathname||"/",m=p;if(c!=="/"){let b=c.replace(/^\//,"").split("/");m="/"+p.replace(/^\//,"").split("/").slice(b.length).join("/")}let x=nC(e,{pathname:m}),g=$C(x&&x.map(b=>Object.assign({},b,{params:Object.assign({},l,b.params),pathname:Tn([c,i.encodeLocation?i.encodeLocation(b.pathname).pathname:b.pathname]),pathnameBase:b.pathnameBase==="/"?c:Tn([c,i.encodeLocation?i.encodeLocation(b.pathnameBase).pathname:b.pathnameBase])})),s,r,n);return t&&g?h.createElement(Fc.Provider,{value:{location:Es({pathname:"/",search:"",hash:"",state:null,key:"default"},u),navigationType:Nn.Pop}},g):g}function DC(){let e=BC(),t=kC(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return h.createElement(h.Fragment,null,h.createElement("h2",null,"Unexpected Application Error!"),h.createElement("h3",{style:{fontStyle:"italic"}},t),r?h.createElement("pre",{style:i},r):null,null)}const TC=h.createElement(DC,null);class MC extends h.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,r){return r.location!==t.location||r.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:r.error,location:r.location,revalidation:t.revalidation||r.revalidation}}componentDidCatch(t,r){console.error("React Router caught the following error during render",t,r)}render(){return this.state.error!==void 0?h.createElement(on.Provider,{value:this.props.routeContext},h.createElement(R1.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function IC(e){let{routeContext:t,match:r,children:n}=e,i=h.useContext(kh);return i&&i.static&&i.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=r.route.id),h.createElement(on.Provider,{value:t},n)}function $C(e,t,r,n){var i;if(t===void 0&&(t=[]),r===void 0&&(r=null),n===void 0&&(n=null),e==null){var s;if(!r)return null;if(r.errors)e=r.matches;else if((s=n)!=null&&s.v7_partialHydration&&t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let o=e,l=(i=r)==null?void 0:i.errors;if(l!=null){let u=o.findIndex(f=>f.route.id&&(l==null?void 0:l[f.route.id])!==void 0);u>=0||Oe(!1),o=o.slice(0,Math.min(o.length,u+1))}let c=!1,d=-1;if(r&&n&&n.v7_partialHydration)for(let u=0;u=0?o=o.slice(0,d+1):o=[o[0]];break}}}return o.reduceRight((u,f,p)=>{let m,x=!1,g=null,b=null;r&&(m=l&&f.route.id?l[f.route.id]:void 0,g=f.route.errorElement||TC,c&&(d<0&&p===0?(WC("route-fallback"),x=!0,b=null):d===p&&(x=!0,b=f.route.hydrateFallbackElement||null)));let v=t.concat(o.slice(0,p+1)),j=()=>{let y;return m?y=g:x?y=b:f.route.Component?y=h.createElement(f.route.Component,null):f.route.element?y=f.route.element:y=u,h.createElement(IC,{match:f,routeContext:{outlet:u,matches:v,isDataRoute:r!=null},children:y})};return r&&(f.route.ErrorBoundary||f.route.errorElement||p===0)?h.createElement(MC,{location:r.location,revalidation:r.revalidation,component:g,error:m,children:j(),routeContext:{outlet:null,matches:v,isDataRoute:!0}}):j()},null)}var W1=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(W1||{}),U1=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}(U1||{});function LC(e){let t=h.useContext(kh);return t||Oe(!1),t}function zC(e){let t=h.useContext(_C);return t||Oe(!1),t}function RC(e){let t=h.useContext(on);return t||Oe(!1),t}function q1(e){let t=RC(),r=t.matches[t.matches.length-1];return r.route.id||Oe(!1),r.route.id}function BC(){var e;let t=h.useContext(R1),r=zC(),n=q1();return t!==void 0?t:(e=r.errors)==null?void 0:e[n]}function FC(){let{router:e}=LC(W1.UseNavigateStable),t=q1(U1.UseNavigateStable),r=h.useRef(!1);return B1(()=>{r.current=!0}),h.useCallback(function(i,s){s===void 0&&(s={}),r.current&&(typeof i=="number"?e.navigate(i):e.navigate(i,Es({fromRouteId:t},s)))},[e,t])}const kx={};function WC(e,t,r){kx[e]||(kx[e]=!0)}function UC(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function H1(e){let{to:t,replace:r,state:n,relative:i}=e;Sa()||Oe(!1);let{future:s,static:o}=h.useContext(Un),{matches:l}=h.useContext(on),{pathname:c}=_i(),d=dt(),u=Nh(t,Sh(l,s.v7_relativeSplatPath),c,i==="path"),f=JSON.stringify(u);return h.useEffect(()=>d(JSON.parse(f),{replace:r,state:n,relative:i}),[d,f,i,r,n]),null}function de(e){Oe(!1)}function qC(e){let{basename:t="/",children:r=null,location:n,navigationType:i=Nn.Pop,navigator:s,static:o=!1,future:l}=e;Sa()&&Oe(!1);let c=t.replace(/^\/*/,"/"),d=h.useMemo(()=>({basename:c,navigator:s,static:o,future:Es({v7_relativeSplatPath:!1},l)}),[c,l,s,o]);typeof n=="string"&&(n=wa(n));let{pathname:u="/",search:f="",hash:p="",state:m=null,key:x="default"}=n,g=h.useMemo(()=>{let b=wh(u,c);return b==null?null:{location:{pathname:b,search:f,hash:p,state:m,key:x},navigationType:i}},[c,u,f,p,m,x,i]);return g==null?null:h.createElement(Un.Provider,{value:d},h.createElement(Fc.Provider,{children:r,value:g}))}function HC(e){let{children:t,location:r}=e;return OC(kf(t),r)}new Promise(()=>{});function kf(e,t){t===void 0&&(t=[]);let r=[];return h.Children.forEach(e,(n,i)=>{if(!h.isValidElement(n))return;let s=[...t,i];if(n.type===h.Fragment){r.push.apply(r,kf(n.props.children,s));return}n.type!==de&&Oe(!1),!n.props.index||!n.props.children||Oe(!1);let o={id:n.props.id||s.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,Component:n.props.Component,index:n.props.index,path:n.props.path,loader:n.props.loader,action:n.props.action,errorElement:n.props.errorElement,ErrorBoundary:n.props.ErrorBoundary,hasErrorBoundary:n.props.ErrorBoundary!=null||n.props.errorElement!=null,shouldRevalidate:n.props.shouldRevalidate,handle:n.props.handle,lazy:n.props.lazy};n.props.children&&(o.children=kf(n.props.children,s)),r.push(o)}),r}/** + */function Ds(){return Ds=Object.assign?Object.assign.bind():function(e){for(var t=1;t{l.current=!0}),h.useCallback(function(d,u){if(u===void 0&&(u={}),!l.current)return;if(typeof d=="number"){n.go(d);return}let f=Nh(d,JSON.parse(o),s,u.relative==="path");e==null&&t!=="/"&&(f.pathname=f.pathname==="/"?t:Tn([t,f.pathname])),(u.replace?n.replace:n.push)(f,u.state,u)},[t,n,o,s,e])}function ka(){let{matches:e}=h.useContext(on),t=e[e.length-1];return t?t.params:{}}function F1(e,t){let{relative:r}=t===void 0?{}:t,{future:n}=h.useContext(Un),{matches:i}=h.useContext(on),{pathname:s}=_i(),o=JSON.stringify(Sh(i,n.v7_relativeSplatPath));return h.useMemo(()=>Nh(e,JSON.parse(o),s,r==="path"),[e,o,s,r])}function OC(e,t){return EC(e,t)}function EC(e,t,r,n){Na()||Oe(!1);let{navigator:i}=h.useContext(Un),{matches:s}=h.useContext(on),o=s[s.length-1],l=o?o.params:{};o&&o.pathname;let c=o?o.pathnameBase:"/";o&&o.route;let d=_i(),u;if(t){var f;let b=typeof t=="string"?Sa(t):t;c==="/"||(f=b.pathname)!=null&&f.startsWith(c)||Oe(!1),u=b}else u=d;let p=u.pathname||"/",m=p;if(c!=="/"){let b=c.replace(/^\//,"").split("/");m="/"+p.replace(/^\//,"").split("/").slice(b.length).join("/")}let x=nC(e,{pathname:m}),g=$C(x&&x.map(b=>Object.assign({},b,{params:Object.assign({},l,b.params),pathname:Tn([c,i.encodeLocation?i.encodeLocation(b.pathname).pathname:b.pathname]),pathnameBase:b.pathnameBase==="/"?c:Tn([c,i.encodeLocation?i.encodeLocation(b.pathnameBase).pathname:b.pathnameBase])})),s,r,n);return t&&g?h.createElement(Fc.Provider,{value:{location:Ds({pathname:"/",search:"",hash:"",state:null,key:"default"},u),navigationType:Nn.Pop}},g):g}function DC(){let e=BC(),t=kC(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return h.createElement(h.Fragment,null,h.createElement("h2",null,"Unexpected Application Error!"),h.createElement("h3",{style:{fontStyle:"italic"}},t),r?h.createElement("pre",{style:i},r):null,null)}const TC=h.createElement(DC,null);class MC extends h.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,r){return r.location!==t.location||r.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:r.error,location:r.location,revalidation:t.revalidation||r.revalidation}}componentDidCatch(t,r){console.error("React Router caught the following error during render",t,r)}render(){return this.state.error!==void 0?h.createElement(on.Provider,{value:this.props.routeContext},h.createElement(R1.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function IC(e){let{routeContext:t,match:r,children:n}=e,i=h.useContext(kh);return i&&i.static&&i.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=r.route.id),h.createElement(on.Provider,{value:t},n)}function $C(e,t,r,n){var i;if(t===void 0&&(t=[]),r===void 0&&(r=null),n===void 0&&(n=null),e==null){var s;if(!r)return null;if(r.errors)e=r.matches;else if((s=n)!=null&&s.v7_partialHydration&&t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let o=e,l=(i=r)==null?void 0:i.errors;if(l!=null){let u=o.findIndex(f=>f.route.id&&(l==null?void 0:l[f.route.id])!==void 0);u>=0||Oe(!1),o=o.slice(0,Math.min(o.length,u+1))}let c=!1,d=-1;if(r&&n&&n.v7_partialHydration)for(let u=0;u=0?o=o.slice(0,d+1):o=[o[0]];break}}}return o.reduceRight((u,f,p)=>{let m,x=!1,g=null,b=null;r&&(m=l&&f.route.id?l[f.route.id]:void 0,g=f.route.errorElement||TC,c&&(d<0&&p===0?(WC("route-fallback"),x=!0,b=null):d===p&&(x=!0,b=f.route.hydrateFallbackElement||null)));let v=t.concat(o.slice(0,p+1)),j=()=>{let y;return m?y=g:x?y=b:f.route.Component?y=h.createElement(f.route.Component,null):f.route.element?y=f.route.element:y=u,h.createElement(IC,{match:f,routeContext:{outlet:u,matches:v,isDataRoute:r!=null},children:y})};return r&&(f.route.ErrorBoundary||f.route.errorElement||p===0)?h.createElement(MC,{location:r.location,revalidation:r.revalidation,component:g,error:m,children:j(),routeContext:{outlet:null,matches:v,isDataRoute:!0}}):j()},null)}var W1=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(W1||{}),U1=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}(U1||{});function LC(e){let t=h.useContext(kh);return t||Oe(!1),t}function zC(e){let t=h.useContext(_C);return t||Oe(!1),t}function RC(e){let t=h.useContext(on);return t||Oe(!1),t}function q1(e){let t=RC(),r=t.matches[t.matches.length-1];return r.route.id||Oe(!1),r.route.id}function BC(){var e;let t=h.useContext(R1),r=zC(),n=q1();return t!==void 0?t:(e=r.errors)==null?void 0:e[n]}function FC(){let{router:e}=LC(W1.UseNavigateStable),t=q1(U1.UseNavigateStable),r=h.useRef(!1);return B1(()=>{r.current=!0}),h.useCallback(function(i,s){s===void 0&&(s={}),r.current&&(typeof i=="number"?e.navigate(i):e.navigate(i,Ds({fromRouteId:t},s)))},[e,t])}const kx={};function WC(e,t,r){kx[e]||(kx[e]=!0)}function UC(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function H1(e){let{to:t,replace:r,state:n,relative:i}=e;Na()||Oe(!1);let{future:s,static:o}=h.useContext(Un),{matches:l}=h.useContext(on),{pathname:c}=_i(),d=dt(),u=Nh(t,Sh(l,s.v7_relativeSplatPath),c,i==="path"),f=JSON.stringify(u);return h.useEffect(()=>d(JSON.parse(f),{replace:r,state:n,relative:i}),[d,f,i,r,n]),null}function de(e){Oe(!1)}function qC(e){let{basename:t="/",children:r=null,location:n,navigationType:i=Nn.Pop,navigator:s,static:o=!1,future:l}=e;Na()&&Oe(!1);let c=t.replace(/^\/*/,"/"),d=h.useMemo(()=>({basename:c,navigator:s,static:o,future:Ds({v7_relativeSplatPath:!1},l)}),[c,l,s,o]);typeof n=="string"&&(n=Sa(n));let{pathname:u="/",search:f="",hash:p="",state:m=null,key:x="default"}=n,g=h.useMemo(()=>{let b=wh(u,c);return b==null?null:{location:{pathname:b,search:f,hash:p,state:m,key:x},navigationType:i}},[c,u,f,p,m,x,i]);return g==null?null:h.createElement(Un.Provider,{value:d},h.createElement(Fc.Provider,{children:r,value:g}))}function HC(e){let{children:t,location:r}=e;return OC(kf(t),r)}new Promise(()=>{});function kf(e,t){t===void 0&&(t=[]);let r=[];return h.Children.forEach(e,(n,i)=>{if(!h.isValidElement(n))return;let s=[...t,i];if(n.type===h.Fragment){r.push.apply(r,kf(n.props.children,s));return}n.type!==de&&Oe(!1),!n.props.index||!n.props.children||Oe(!1);let o={id:n.props.id||s.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,Component:n.props.Component,index:n.props.index,path:n.props.path,loader:n.props.loader,action:n.props.action,errorElement:n.props.errorElement,ErrorBoundary:n.props.ErrorBoundary,hasErrorBoundary:n.props.ErrorBoundary!=null||n.props.errorElement!=null,shouldRevalidate:n.props.shouldRevalidate,handle:n.props.handle,lazy:n.props.lazy};n.props.children&&(o.children=kf(n.props.children,s)),r.push(o)}),r}/** * React Router DOM v6.30.2 * * Copyright (c) Remix Software Inc. @@ -72,7 +72,7 @@ Error generating stack: `+s.message+` * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var fa=h;function sA(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var oA=typeof Object.is=="function"?Object.is:sA,lA=fa.useState,cA=fa.useEffect,uA=fa.useLayoutEffect,dA=fa.useDebugValue;function fA(e,t){var r=t(),n=lA({inst:{value:r,getSnapshot:t}}),i=n[0].inst,s=n[1];return uA(function(){i.value=r,i.getSnapshot=t,ld(i)&&s({inst:i})},[e,r,t]),cA(function(){return ld(i)&&s({inst:i}),e(function(){ld(i)&&s({inst:i})})},[e]),dA(r),r}function ld(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!oA(e,r)}catch{return!0}}function pA(e,t){return t()}var hA=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?pA:fA;Z1.useSyncExternalStore=fa.useSyncExternalStore!==void 0?fa.useSyncExternalStore:hA;G1.exports=Z1;var mA=G1.exports;/** + */var pa=h;function sA(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var oA=typeof Object.is=="function"?Object.is:sA,lA=pa.useState,cA=pa.useEffect,uA=pa.useLayoutEffect,dA=pa.useDebugValue;function fA(e,t){var r=t(),n=lA({inst:{value:r,getSnapshot:t}}),i=n[0].inst,s=n[1];return uA(function(){i.value=r,i.getSnapshot=t,ld(i)&&s({inst:i})},[e,r,t]),cA(function(){return ld(i)&&s({inst:i}),e(function(){ld(i)&&s({inst:i})})},[e]),dA(r),r}function ld(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!oA(e,r)}catch{return!0}}function pA(e,t){return t()}var hA=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?pA:fA;Z1.useSyncExternalStore=pa.useSyncExternalStore!==void 0?pa.useSyncExternalStore:hA;G1.exports=Z1;var mA=G1.exports;/** * @license React * use-sync-external-store-shim/with-selector.production.js * @@ -80,7 +80,7 @@ Error generating stack: `+s.message+` * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Wc=h,gA=mA;function xA(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var yA=typeof Object.is=="function"?Object.is:xA,vA=gA.useSyncExternalStore,bA=Wc.useRef,jA=Wc.useEffect,wA=Wc.useMemo,SA=Wc.useDebugValue;Y1.useSyncExternalStoreWithSelector=function(e,t,r,n,i){var s=bA(null);if(s.current===null){var o={hasValue:!1,value:null};s.current=o}else o=s.current;s=wA(function(){function c(m){if(!d){if(d=!0,u=m,m=n(m),i!==void 0&&o.hasValue){var x=o.value;if(i(x,m))return f=x}return f=m}if(x=f,yA(u,m))return x;var g=n(m);return i!==void 0&&i(x,g)?(u=m,x):(u=m,f=g)}var d=!1,u,f,p=r===void 0?null:r;return[function(){return c(t())},p===null?void 0:function(){return c(p())}]},[t,r,n,i]);var l=vA(e,s[0],s[1]);return jA(function(){o.hasValue=!0,o.value=l},[l]),SA(l),l};V1.exports=Y1;var X1=V1.exports;const NA=Tr(X1),J1={},{useDebugValue:kA}=fs,{useSyncExternalStoreWithSelector:PA}=NA;let Ox=!1;const _A=e=>e;function CA(e,t=_A,r){(J1?"production":void 0)!=="production"&&r&&!Ox&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),Ox=!0);const n=PA(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,r);return kA(n),n}const Ex=e=>{(J1?"production":void 0)!=="production"&&typeof e!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const t=typeof e=="function"?aA(e):e,r=(n,i)=>CA(t,n,i);return Object.assign(r,t),r},AA=e=>e?Ex(e):Ex,OA="https://dispos.crawlsy.com";class EA{constructor(t){ho(this,"baseUrl");this.baseUrl=t}getHeaders(){const t=localStorage.getItem("token");return{"Content-Type":"application/json",...t?{Authorization:`Bearer ${t}`}:{}}}async request(t,r){const n=`${this.baseUrl}${t}`,i=await fetch(n,{...r,headers:{...this.getHeaders(),...r==null?void 0:r.headers}});if(!i.ok){const s=await i.json().catch(()=>({error:"Request failed"}));throw new Error(s.error||`HTTP ${i.status}`)}return i.json()}async login(t,r){return this.request("/api/auth/login",{method:"POST",body:JSON.stringify({email:t,password:r})})}async getMe(){return this.request("/api/auth/me")}async getDashboardStats(){return this.request("/api/dashboard/stats")}async getDashboardActivity(){return this.request("/api/dashboard/activity")}async getStores(){return this.request("/api/stores")}async getStore(t){return this.request(`/api/stores/${t}`)}async createStore(t){return this.request("/api/stores",{method:"POST",body:JSON.stringify(t)})}async updateStore(t,r){return this.request(`/api/stores/${t}`,{method:"PUT",body:JSON.stringify(r)})}async getDispensaries(){return this.request("/api/dispensaries")}async getDispensary(t){return this.request(`/api/dispensaries/${t}`)}async updateDispensary(t,r){return this.request(`/api/dispensaries/${t}`,{method:"PUT",body:JSON.stringify(r)})}async deleteStore(t){return this.request(`/api/stores/${t}`,{method:"DELETE"})}async scrapeStore(t,r,n){return this.request(`/api/stores/${t}/scrape`,{method:"POST",body:JSON.stringify({parallel:r,userAgent:n})})}async downloadStoreImages(t){return this.request(`/api/stores/${t}/download-images`,{method:"POST"})}async discoverStoreCategories(t){return this.request(`/api/stores/${t}/discover-categories`,{method:"POST"})}async debugScrapeStore(t){return this.request(`/api/stores/${t}/debug-scrape`,{method:"POST"})}async getStoreBrands(t){return this.request(`/api/stores/${t}/brands`)}async getStoreSpecials(t,r){const n=r?`?date=${r}`:"";return this.request(`/api/stores/${t}/specials${n}`)}async getCategories(t){const r=t?`?store_id=${t}`:"";return this.request(`/api/categories${r}`)}async getCategoryTree(t){return this.request(`/api/categories/tree?store_id=${t}`)}async getProducts(t){const r=new URLSearchParams(t).toString();return this.request(`/api/products${r?`?${r}`:""}`)}async getProduct(t){return this.request(`/api/products/${t}`)}async getCampaigns(){return this.request("/api/campaigns")}async getCampaign(t){return this.request(`/api/campaigns/${t}`)}async createCampaign(t){return this.request("/api/campaigns",{method:"POST",body:JSON.stringify(t)})}async updateCampaign(t,r){return this.request(`/api/campaigns/${t}`,{method:"PUT",body:JSON.stringify(r)})}async deleteCampaign(t){return this.request(`/api/campaigns/${t}`,{method:"DELETE"})}async addProductToCampaign(t,r,n){return this.request(`/api/campaigns/${t}/products`,{method:"POST",body:JSON.stringify({product_id:r,display_order:n})})}async removeProductFromCampaign(t,r){return this.request(`/api/campaigns/${t}/products/${r}`,{method:"DELETE"})}async getAnalyticsOverview(t){return this.request(`/api/analytics/overview${t?`?days=${t}`:""}`)}async getProductAnalytics(t,r){return this.request(`/api/analytics/products/${t}${r?`?days=${r}`:""}`)}async getCampaignAnalytics(t,r){return this.request(`/api/analytics/campaigns/${t}${r?`?days=${r}`:""}`)}async getSettings(){return this.request("/api/settings")}async updateSetting(t,r){return this.request(`/api/settings/${t}`,{method:"PUT",body:JSON.stringify({value:r})})}async updateSettings(t){return this.request("/api/settings",{method:"PUT",body:JSON.stringify({settings:t})})}async getProxies(){return this.request("/api/proxies")}async getProxy(t){return this.request(`/api/proxies/${t}`)}async addProxy(t){return this.request("/api/proxies",{method:"POST",body:JSON.stringify(t)})}async addProxiesBulk(t){return this.request("/api/proxies/bulk",{method:"POST",body:JSON.stringify({proxies:t})})}async testProxy(t){return this.request(`/api/proxies/${t}/test`,{method:"POST"})}async testAllProxies(){return this.request("/api/proxies/test-all",{method:"POST"})}async getProxyTestJob(t){return this.request(`/api/proxies/test-job/${t}`)}async getActiveProxyTestJob(){return this.request("/api/proxies/test-job")}async cancelProxyTestJob(t){return this.request(`/api/proxies/test-job/${t}/cancel`,{method:"POST"})}async updateProxy(t,r){return this.request(`/api/proxies/${t}`,{method:"PUT",body:JSON.stringify(r)})}async deleteProxy(t){return this.request(`/api/proxies/${t}`,{method:"DELETE"})}async updateProxyLocations(){return this.request("/api/proxies/update-locations",{method:"POST"})}async getLogs(t,r,n){const i=new URLSearchParams;return t&&i.append("limit",t.toString()),r&&i.append("level",r),n&&i.append("category",n),this.request(`/api/logs?${i.toString()}`)}async clearLogs(){return this.request("/api/logs",{method:"DELETE"})}async getActiveScrapers(){return this.request("/api/scraper-monitor/active")}async getScraperHistory(t){const r=t?`?store_id=${t}`:"";return this.request(`/api/scraper-monitor/history${r}`)}async getJobStats(t){const r=t?`?dispensary_id=${t}`:"";return this.request(`/api/scraper-monitor/jobs/stats${r}`)}async getActiveJobs(t){const r=t?`?dispensary_id=${t}`:"";return this.request(`/api/scraper-monitor/jobs/active${r}`)}async getRecentJobs(t){const r=new URLSearchParams;t!=null&&t.limit&&r.append("limit",t.limit.toString()),t!=null&&t.dispensaryId&&r.append("dispensary_id",t.dispensaryId.toString()),t!=null&&t.status&&r.append("status",t.status);const n=r.toString()?`?${r.toString()}`:"";return this.request(`/api/scraper-monitor/jobs/recent${n}`)}async getWorkerStats(t){const r=t?`?dispensary_id=${t}`:"";return this.request(`/api/scraper-monitor/jobs/workers${r}`)}async getAZMonitorActiveJobs(){return this.request("/api/az/monitor/active-jobs")}async getAZMonitorRecentJobs(t){const r=t?`?limit=${t}`:"";return this.request(`/api/az/monitor/recent-jobs${r}`)}async getAZMonitorErrors(t){const r=new URLSearchParams;t!=null&&t.limit&&r.append("limit",t.limit.toString()),t!=null&&t.hours&&r.append("hours",t.hours.toString());const n=r.toString()?`?${r.toString()}`:"";return this.request(`/api/az/monitor/errors${n}`)}async getAZMonitorSummary(){return this.request("/api/az/monitor/summary")}async getChanges(t){const r=t?`?status=${t}`:"";return this.request(`/api/changes${r}`)}async getChangeStats(){return this.request("/api/changes/stats")}async approveChange(t){return this.request(`/api/changes/${t}/approve`,{method:"POST"})}async rejectChange(t,r){return this.request(`/api/changes/${t}/reject`,{method:"POST",body:JSON.stringify({reason:r})})}async getDispensaryProducts(t,r){const n=r?`?category=${r}`:"";return this.request(`/api/dispensaries/${t}/products${n}`)}async getDispensaryBrands(t){return this.request(`/api/dispensaries/${t}/brands`)}async getDispensarySpecials(t){return this.request(`/api/dispensaries/${t}/specials`)}async getApiPermissions(){return this.request("/api/api-permissions")}async getApiPermissionDispensaries(){return this.request("/api/api-permissions/dispensaries")}async createApiPermission(t){return this.request("/api/api-permissions",{method:"POST",body:JSON.stringify(t)})}async updateApiPermission(t,r){return this.request(`/api/api-permissions/${t}`,{method:"PUT",body:JSON.stringify(r)})}async toggleApiPermission(t){return this.request(`/api/api-permissions/${t}/toggle`,{method:"PATCH"})}async deleteApiPermission(t){return this.request(`/api/api-permissions/${t}`,{method:"DELETE"})}async getGlobalSchedule(){return this.request("/api/schedule/global")}async updateGlobalSchedule(t,r){return this.request(`/api/schedule/global/${t}`,{method:"PUT",body:JSON.stringify(r)})}async getStoreSchedules(){return this.request("/api/schedule/stores")}async getStoreSchedule(t){return this.request(`/api/schedule/stores/${t}`)}async updateStoreSchedule(t,r){return this.request(`/api/schedule/stores/${t}`,{method:"PUT",body:JSON.stringify(r)})}async getDispensarySchedules(t){const r=new URLSearchParams;t!=null&&t.state&&r.append("state",t.state),t!=null&&t.search&&r.append("search",t.search);const n=r.toString();return this.request(`/api/schedule/dispensaries${n?`?${n}`:""}`)}async getDispensarySchedule(t){return this.request(`/api/schedule/dispensaries/${t}`)}async updateDispensarySchedule(t,r){return this.request(`/api/schedule/dispensaries/${t}`,{method:"PUT",body:JSON.stringify(r)})}async getDispensaryCrawlJobs(t){const r=t?`?limit=${t}`:"";return this.request(`/api/schedule/dispensary-jobs${r}`)}async triggerDispensaryCrawl(t){return this.request(`/api/schedule/trigger/dispensary/${t}`,{method:"POST"})}async resolvePlatformId(t){return this.request(`/api/schedule/dispensaries/${t}/resolve-platform-id`,{method:"POST"})}async detectMenuType(t){return this.request(`/api/schedule/dispensaries/${t}/detect-menu-type`,{method:"POST"})}async refreshDetection(t){return this.request(`/api/schedule/dispensaries/${t}/refresh-detection`,{method:"POST"})}async toggleDispensarySchedule(t,r){return this.request(`/api/schedule/dispensaries/${t}/toggle-active`,{method:"PUT",body:JSON.stringify({is_active:r})})}async deleteDispensarySchedule(t){return this.request(`/api/schedule/dispensaries/${t}/schedule`,{method:"DELETE"})}async getCrawlJobs(t){const r=t?`?limit=${t}`:"";return this.request(`/api/schedule/jobs${r}`)}async getStoreCrawlJobs(t,r){const n=r?`?limit=${r}`:"";return this.request(`/api/schedule/jobs/store/${t}${n}`)}async cancelCrawlJob(t){return this.request(`/api/schedule/jobs/${t}/cancel`,{method:"POST"})}async triggerStoreCrawl(t){return this.request(`/api/schedule/trigger/store/${t}`,{method:"POST"})}async triggerAllCrawls(){return this.request("/api/schedule/trigger/all",{method:"POST"})}async restartScheduler(){return this.request("/api/schedule/restart",{method:"POST"})}async getVersion(){return this.request("/api/version")}async getDutchieAZDashboard(){return this.request("/api/az/dashboard")}async getDutchieAZSchedules(){return this.request("/api/az/admin/schedules")}async getDutchieAZSchedule(t){return this.request(`/api/az/admin/schedules/${t}`)}async createDutchieAZSchedule(t){return this.request("/api/az/admin/schedules",{method:"POST",body:JSON.stringify(t)})}async updateDutchieAZSchedule(t,r){return this.request(`/api/az/admin/schedules/${t}`,{method:"PUT",body:JSON.stringify(r)})}async deleteDutchieAZSchedule(t){return this.request(`/api/az/admin/schedules/${t}`,{method:"DELETE"})}async triggerDutchieAZSchedule(t){return this.request(`/api/az/admin/schedules/${t}/trigger`,{method:"POST"})}async initDutchieAZSchedules(){return this.request("/api/az/admin/schedules/init",{method:"POST"})}async getDutchieAZScheduleLogs(t,r,n){const i=new URLSearchParams;r&&i.append("limit",r.toString()),n&&i.append("offset",n.toString());const s=i.toString()?`?${i.toString()}`:"";return this.request(`/api/az/admin/schedules/${t}/logs${s}`)}async getDutchieAZRunLogs(t){const r=new URLSearchParams;t!=null&&t.scheduleId&&r.append("scheduleId",t.scheduleId.toString()),t!=null&&t.jobName&&r.append("jobName",t.jobName),t!=null&&t.limit&&r.append("limit",t.limit.toString()),t!=null&&t.offset&&r.append("offset",t.offset.toString());const n=r.toString()?`?${r.toString()}`:"";return this.request(`/api/az/admin/run-logs${n}`)}async getDutchieAZSchedulerStatus(){return this.request("/api/az/admin/scheduler/status")}async startDutchieAZScheduler(){return this.request("/api/az/admin/scheduler/start",{method:"POST"})}async stopDutchieAZScheduler(){return this.request("/api/az/admin/scheduler/stop",{method:"POST"})}async triggerDutchieAZImmediateCrawl(){return this.request("/api/az/admin/scheduler/trigger",{method:"POST"})}async getDutchieAZStores(t){const r=new URLSearchParams;t!=null&&t.city&&r.append("city",t.city),(t==null?void 0:t.hasPlatformId)!==void 0&&r.append("hasPlatformId",String(t.hasPlatformId)),t!=null&&t.limit&&r.append("limit",t.limit.toString()),t!=null&&t.offset&&r.append("offset",t.offset.toString());const n=r.toString()?`?${r.toString()}`:"";return this.request(`/api/az/stores${n}`)}async getDutchieAZStore(t){return this.request(`/api/az/stores/${t}`)}async getDutchieAZStoreSummary(t){return this.request(`/api/az/stores/${t}/summary`)}async getDutchieAZStoreProducts(t,r){const n=new URLSearchParams;r!=null&&r.stockStatus&&n.append("stockStatus",r.stockStatus),r!=null&&r.type&&n.append("type",r.type),r!=null&&r.subcategory&&n.append("subcategory",r.subcategory),r!=null&&r.brandName&&n.append("brandName",r.brandName),r!=null&&r.search&&n.append("search",r.search),r!=null&&r.limit&&n.append("limit",r.limit.toString()),r!=null&&r.offset&&n.append("offset",r.offset.toString());const i=n.toString()?`?${n.toString()}`:"";return this.request(`/api/az/stores/${t}/products${i}`)}async getDutchieAZStoreBrands(t){return this.request(`/api/az/stores/${t}/brands`)}async getDutchieAZStoreCategories(t){return this.request(`/api/az/stores/${t}/categories`)}async getDutchieAZBrands(t){const r=new URLSearchParams;t!=null&&t.limit&&r.append("limit",t.limit.toString()),t!=null&&t.offset&&r.append("offset",t.offset.toString());const n=r.toString()?`?${r.toString()}`:"";return this.request(`/api/az/brands${n}`)}async getDutchieAZCategories(){return this.request("/api/az/categories")}async getDutchieAZDebugSummary(){return this.request("/api/az/debug/summary")}async getDutchieAZDebugStore(t){return this.request(`/api/az/debug/store/${t}`)}async triggerDutchieAZCrawl(t,r){return this.request(`/api/az/admin/crawl/${t}`,{method:"POST",body:JSON.stringify(r||{})})}async getDetectionStats(){return this.request("/api/az/admin/detection/stats")}async getDispensariesNeedingDetection(t){const r=new URLSearchParams;t!=null&&t.state&&r.append("state",t.state),t!=null&&t.limit&&r.append("limit",t.limit.toString());const n=r.toString()?`?${r.toString()}`:"";return this.request(`/api/az/admin/detection/pending${n}`)}async detectDispensary(t){return this.request(`/api/az/admin/detection/detect/${t}`,{method:"POST"})}async detectAllDispensaries(t){return this.request("/api/az/admin/detection/detect-all",{method:"POST",body:JSON.stringify(t||{})})}async triggerMenuDetectionJob(){return this.request("/api/az/admin/detection/trigger",{method:"POST"})}}const B=new EA(OA),Ph=AA(e=>({user:null,token:localStorage.getItem("token"),isAuthenticated:!!localStorage.getItem("token"),login:async(t,r)=>{const n=await B.login(t,r);localStorage.setItem("token",n.token),e({user:n.user,token:n.token,isAuthenticated:!0})},logout:()=>{localStorage.removeItem("token"),e({user:null,token:null,isAuthenticated:!1})},checkAuth:async()=>{try{const t=await B.getMe();e({user:t.user,isAuthenticated:!0})}catch{localStorage.removeItem("token"),e({user:null,token:null,isAuthenticated:!1})}}}));function DA(){const[e,t]=h.useState("admin@example.com"),[r,n]=h.useState("password"),[i,s]=h.useState(""),[o,l]=h.useState(!1),c=dt(),d=Ph(f=>f.login),u=async f=>{f.preventDefault(),s(""),l(!0);try{await d(e,r),c("/")}catch(p){s(p.message||"Login failed")}finally{l(!1)}};return a.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:"100vh",background:"linear-gradient(135deg, #667eea 0%, #764ba2 100%)"},children:a.jsxs("div",{style:{background:"white",padding:"40px",borderRadius:"12px",boxShadow:"0 10px 40px rgba(0,0,0,0.2)",width:"100%",maxWidth:"400px"},children:[a.jsx("h1",{style:{marginBottom:"10px",fontSize:"28px"},children:"Dutchie Menus"}),a.jsx("p",{style:{color:"#666",marginBottom:"30px"},children:"Admin Dashboard"}),i&&a.jsx("div",{style:{background:"#fee",color:"#c33",padding:"12px",borderRadius:"6px",marginBottom:"20px",fontSize:"14px"},children:i}),a.jsxs("form",{onSubmit:u,children:[a.jsxs("div",{style:{marginBottom:"20px"},children:[a.jsx("label",{style:{display:"block",marginBottom:"8px",fontWeight:"500"},children:"Email"}),a.jsx("input",{type:"email",value:e,onChange:f=>t(f.target.value),required:!0,style:{width:"100%",padding:"12px",border:"1px solid #ddd",borderRadius:"6px",fontSize:"14px"}})]}),a.jsxs("div",{style:{marginBottom:"25px"},children:[a.jsx("label",{style:{display:"block",marginBottom:"8px",fontWeight:"500"},children:"Password"}),a.jsx("input",{type:"password",value:r,onChange:f=>n(f.target.value),required:!0,style:{width:"100%",padding:"12px",border:"1px solid #ddd",borderRadius:"6px",fontSize:"14px"}})]}),a.jsx("button",{type:"submit",disabled:o,style:{width:"100%",padding:"14px",background:o?"#999":"#667eea",color:"white",border:"none",borderRadius:"6px",cursor:o?"not-allowed":"pointer",fontSize:"16px",fontWeight:"500",transition:"background 0.2s"},children:o?"Logging in...":"Login"})]})]})})}/** + */var Wc=h,gA=mA;function xA(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var yA=typeof Object.is=="function"?Object.is:xA,vA=gA.useSyncExternalStore,bA=Wc.useRef,jA=Wc.useEffect,wA=Wc.useMemo,SA=Wc.useDebugValue;Y1.useSyncExternalStoreWithSelector=function(e,t,r,n,i){var s=bA(null);if(s.current===null){var o={hasValue:!1,value:null};s.current=o}else o=s.current;s=wA(function(){function c(m){if(!d){if(d=!0,u=m,m=n(m),i!==void 0&&o.hasValue){var x=o.value;if(i(x,m))return f=x}return f=m}if(x=f,yA(u,m))return x;var g=n(m);return i!==void 0&&i(x,g)?(u=m,x):(u=m,f=g)}var d=!1,u,f,p=r===void 0?null:r;return[function(){return c(t())},p===null?void 0:function(){return c(p())}]},[t,r,n,i]);var l=vA(e,s[0],s[1]);return jA(function(){o.hasValue=!0,o.value=l},[l]),SA(l),l};V1.exports=Y1;var X1=V1.exports;const NA=Tr(X1),J1={},{useDebugValue:kA}=ps,{useSyncExternalStoreWithSelector:PA}=NA;let Ox=!1;const _A=e=>e;function CA(e,t=_A,r){(J1?"production":void 0)!=="production"&&r&&!Ox&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),Ox=!0);const n=PA(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,r);return kA(n),n}const Ex=e=>{(J1?"production":void 0)!=="production"&&typeof e!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const t=typeof e=="function"?aA(e):e,r=(n,i)=>CA(t,n,i);return Object.assign(r,t),r},AA=e=>e?Ex(e):Ex,OA="http://localhost:3010";class EA{constructor(t){ho(this,"baseUrl");this.baseUrl=t}getHeaders(){const t=localStorage.getItem("token");return{"Content-Type":"application/json",...t?{Authorization:`Bearer ${t}`}:{}}}async request(t,r){const n=`${this.baseUrl}${t}`,i=await fetch(n,{...r,headers:{...this.getHeaders(),...r==null?void 0:r.headers}});if(!i.ok){const s=await i.json().catch(()=>({error:"Request failed"}));throw new Error(s.error||`HTTP ${i.status}`)}return i.json()}async login(t,r){return this.request("/api/auth/login",{method:"POST",body:JSON.stringify({email:t,password:r})})}async getMe(){return this.request("/api/auth/me")}async getDashboardStats(){return this.request("/api/dashboard/stats")}async getDashboardActivity(){return this.request("/api/dashboard/activity")}async getStores(){return this.request("/api/stores")}async getStore(t){return this.request(`/api/stores/${t}`)}async createStore(t){return this.request("/api/stores",{method:"POST",body:JSON.stringify(t)})}async updateStore(t,r){return this.request(`/api/stores/${t}`,{method:"PUT",body:JSON.stringify(r)})}async getDispensaries(){return this.request("/api/dispensaries")}async getDispensary(t){return this.request(`/api/dispensaries/${t}`)}async updateDispensary(t,r){return this.request(`/api/dispensaries/${t}`,{method:"PUT",body:JSON.stringify(r)})}async deleteStore(t){return this.request(`/api/stores/${t}`,{method:"DELETE"})}async scrapeStore(t,r,n){return this.request(`/api/stores/${t}/scrape`,{method:"POST",body:JSON.stringify({parallel:r,userAgent:n})})}async downloadStoreImages(t){return this.request(`/api/stores/${t}/download-images`,{method:"POST"})}async discoverStoreCategories(t){return this.request(`/api/stores/${t}/discover-categories`,{method:"POST"})}async debugScrapeStore(t){return this.request(`/api/stores/${t}/debug-scrape`,{method:"POST"})}async getStoreBrands(t){return this.request(`/api/stores/${t}/brands`)}async getStoreSpecials(t,r){const n=r?`?date=${r}`:"";return this.request(`/api/stores/${t}/specials${n}`)}async getCategories(t){const r=t?`?store_id=${t}`:"";return this.request(`/api/categories${r}`)}async getCategoryTree(t){return this.request(`/api/categories/tree?store_id=${t}`)}async getProducts(t){const r=new URLSearchParams(t).toString();return this.request(`/api/products${r?`?${r}`:""}`)}async getProduct(t){return this.request(`/api/products/${t}`)}async getCampaigns(){return this.request("/api/campaigns")}async getCampaign(t){return this.request(`/api/campaigns/${t}`)}async createCampaign(t){return this.request("/api/campaigns",{method:"POST",body:JSON.stringify(t)})}async updateCampaign(t,r){return this.request(`/api/campaigns/${t}`,{method:"PUT",body:JSON.stringify(r)})}async deleteCampaign(t){return this.request(`/api/campaigns/${t}`,{method:"DELETE"})}async addProductToCampaign(t,r,n){return this.request(`/api/campaigns/${t}/products`,{method:"POST",body:JSON.stringify({product_id:r,display_order:n})})}async removeProductFromCampaign(t,r){return this.request(`/api/campaigns/${t}/products/${r}`,{method:"DELETE"})}async getAnalyticsOverview(t){return this.request(`/api/analytics/overview${t?`?days=${t}`:""}`)}async getProductAnalytics(t,r){return this.request(`/api/analytics/products/${t}${r?`?days=${r}`:""}`)}async getCampaignAnalytics(t,r){return this.request(`/api/analytics/campaigns/${t}${r?`?days=${r}`:""}`)}async getSettings(){return this.request("/api/settings")}async updateSetting(t,r){return this.request(`/api/settings/${t}`,{method:"PUT",body:JSON.stringify({value:r})})}async updateSettings(t){return this.request("/api/settings",{method:"PUT",body:JSON.stringify({settings:t})})}async getProxies(){return this.request("/api/proxies")}async getProxy(t){return this.request(`/api/proxies/${t}`)}async addProxy(t){return this.request("/api/proxies",{method:"POST",body:JSON.stringify(t)})}async addProxiesBulk(t){return this.request("/api/proxies/bulk",{method:"POST",body:JSON.stringify({proxies:t})})}async testProxy(t){return this.request(`/api/proxies/${t}/test`,{method:"POST"})}async testAllProxies(){return this.request("/api/proxies/test-all",{method:"POST"})}async getProxyTestJob(t){return this.request(`/api/proxies/test-job/${t}`)}async getActiveProxyTestJob(){return this.request("/api/proxies/test-job")}async cancelProxyTestJob(t){return this.request(`/api/proxies/test-job/${t}/cancel`,{method:"POST"})}async updateProxy(t,r){return this.request(`/api/proxies/${t}`,{method:"PUT",body:JSON.stringify(r)})}async deleteProxy(t){return this.request(`/api/proxies/${t}`,{method:"DELETE"})}async updateProxyLocations(){return this.request("/api/proxies/update-locations",{method:"POST"})}async getLogs(t,r,n){const i=new URLSearchParams;return t&&i.append("limit",t.toString()),r&&i.append("level",r),n&&i.append("category",n),this.request(`/api/logs?${i.toString()}`)}async clearLogs(){return this.request("/api/logs",{method:"DELETE"})}async getActiveScrapers(){return this.request("/api/scraper-monitor/active")}async getScraperHistory(t){const r=t?`?store_id=${t}`:"";return this.request(`/api/scraper-monitor/history${r}`)}async getJobStats(t){const r=t?`?dispensary_id=${t}`:"";return this.request(`/api/scraper-monitor/jobs/stats${r}`)}async getActiveJobs(t){const r=t?`?dispensary_id=${t}`:"";return this.request(`/api/scraper-monitor/jobs/active${r}`)}async getRecentJobs(t){const r=new URLSearchParams;t!=null&&t.limit&&r.append("limit",t.limit.toString()),t!=null&&t.dispensaryId&&r.append("dispensary_id",t.dispensaryId.toString()),t!=null&&t.status&&r.append("status",t.status);const n=r.toString()?`?${r.toString()}`:"";return this.request(`/api/scraper-monitor/jobs/recent${n}`)}async getWorkerStats(t){const r=t?`?dispensary_id=${t}`:"";return this.request(`/api/scraper-monitor/jobs/workers${r}`)}async getAZMonitorActiveJobs(){return this.request("/api/az/monitor/active-jobs")}async getAZMonitorRecentJobs(t){const r=t?`?limit=${t}`:"";return this.request(`/api/az/monitor/recent-jobs${r}`)}async getAZMonitorErrors(t){const r=new URLSearchParams;t!=null&&t.limit&&r.append("limit",t.limit.toString()),t!=null&&t.hours&&r.append("hours",t.hours.toString());const n=r.toString()?`?${r.toString()}`:"";return this.request(`/api/az/monitor/errors${n}`)}async getAZMonitorSummary(){return this.request("/api/az/monitor/summary")}async getChanges(t){const r=t?`?status=${t}`:"";return this.request(`/api/changes${r}`)}async getChangeStats(){return this.request("/api/changes/stats")}async approveChange(t){return this.request(`/api/changes/${t}/approve`,{method:"POST"})}async rejectChange(t,r){return this.request(`/api/changes/${t}/reject`,{method:"POST",body:JSON.stringify({reason:r})})}async getDispensaryProducts(t,r){const n=r?`?category=${r}`:"";return this.request(`/api/dispensaries/${t}/products${n}`)}async getDispensaryBrands(t){return this.request(`/api/dispensaries/${t}/brands`)}async getDispensarySpecials(t){return this.request(`/api/dispensaries/${t}/specials`)}async getApiPermissions(){return this.request("/api/api-permissions")}async getApiPermissionDispensaries(){return this.request("/api/api-permissions/dispensaries")}async createApiPermission(t){return this.request("/api/api-permissions",{method:"POST",body:JSON.stringify(t)})}async updateApiPermission(t,r){return this.request(`/api/api-permissions/${t}`,{method:"PUT",body:JSON.stringify(r)})}async toggleApiPermission(t){return this.request(`/api/api-permissions/${t}/toggle`,{method:"PATCH"})}async deleteApiPermission(t){return this.request(`/api/api-permissions/${t}`,{method:"DELETE"})}async getGlobalSchedule(){return this.request("/api/schedule/global")}async updateGlobalSchedule(t,r){return this.request(`/api/schedule/global/${t}`,{method:"PUT",body:JSON.stringify(r)})}async getStoreSchedules(){return this.request("/api/schedule/stores")}async getStoreSchedule(t){return this.request(`/api/schedule/stores/${t}`)}async updateStoreSchedule(t,r){return this.request(`/api/schedule/stores/${t}`,{method:"PUT",body:JSON.stringify(r)})}async getDispensarySchedules(t){const r=new URLSearchParams;t!=null&&t.state&&r.append("state",t.state),t!=null&&t.search&&r.append("search",t.search);const n=r.toString();return this.request(`/api/schedule/dispensaries${n?`?${n}`:""}`)}async getDispensarySchedule(t){return this.request(`/api/schedule/dispensaries/${t}`)}async updateDispensarySchedule(t,r){return this.request(`/api/schedule/dispensaries/${t}`,{method:"PUT",body:JSON.stringify(r)})}async getDispensaryCrawlJobs(t){const r=t?`?limit=${t}`:"";return this.request(`/api/schedule/dispensary-jobs${r}`)}async triggerDispensaryCrawl(t){return this.request(`/api/schedule/trigger/dispensary/${t}`,{method:"POST"})}async resolvePlatformId(t){return this.request(`/api/schedule/dispensaries/${t}/resolve-platform-id`,{method:"POST"})}async detectMenuType(t){return this.request(`/api/schedule/dispensaries/${t}/detect-menu-type`,{method:"POST"})}async refreshDetection(t){return this.request(`/api/schedule/dispensaries/${t}/refresh-detection`,{method:"POST"})}async toggleDispensarySchedule(t,r){return this.request(`/api/schedule/dispensaries/${t}/toggle-active`,{method:"PUT",body:JSON.stringify({is_active:r})})}async deleteDispensarySchedule(t){return this.request(`/api/schedule/dispensaries/${t}/schedule`,{method:"DELETE"})}async getCrawlJobs(t){const r=t?`?limit=${t}`:"";return this.request(`/api/schedule/jobs${r}`)}async getStoreCrawlJobs(t,r){const n=r?`?limit=${r}`:"";return this.request(`/api/schedule/jobs/store/${t}${n}`)}async cancelCrawlJob(t){return this.request(`/api/schedule/jobs/${t}/cancel`,{method:"POST"})}async triggerStoreCrawl(t){return this.request(`/api/schedule/trigger/store/${t}`,{method:"POST"})}async triggerAllCrawls(){return this.request("/api/schedule/trigger/all",{method:"POST"})}async restartScheduler(){return this.request("/api/schedule/restart",{method:"POST"})}async getVersion(){return this.request("/api/version")}async getDutchieAZDashboard(){return this.request("/api/az/dashboard")}async getDutchieAZSchedules(){return this.request("/api/az/admin/schedules")}async getDutchieAZSchedule(t){return this.request(`/api/az/admin/schedules/${t}`)}async createDutchieAZSchedule(t){return this.request("/api/az/admin/schedules",{method:"POST",body:JSON.stringify(t)})}async updateDutchieAZSchedule(t,r){return this.request(`/api/az/admin/schedules/${t}`,{method:"PUT",body:JSON.stringify(r)})}async deleteDutchieAZSchedule(t){return this.request(`/api/az/admin/schedules/${t}`,{method:"DELETE"})}async triggerDutchieAZSchedule(t){return this.request(`/api/az/admin/schedules/${t}/trigger`,{method:"POST"})}async initDutchieAZSchedules(){return this.request("/api/az/admin/schedules/init",{method:"POST"})}async getDutchieAZScheduleLogs(t,r,n){const i=new URLSearchParams;r&&i.append("limit",r.toString()),n&&i.append("offset",n.toString());const s=i.toString()?`?${i.toString()}`:"";return this.request(`/api/az/admin/schedules/${t}/logs${s}`)}async getDutchieAZRunLogs(t){const r=new URLSearchParams;t!=null&&t.scheduleId&&r.append("scheduleId",t.scheduleId.toString()),t!=null&&t.jobName&&r.append("jobName",t.jobName),t!=null&&t.limit&&r.append("limit",t.limit.toString()),t!=null&&t.offset&&r.append("offset",t.offset.toString());const n=r.toString()?`?${r.toString()}`:"";return this.request(`/api/az/admin/run-logs${n}`)}async getDutchieAZSchedulerStatus(){return this.request("/api/az/admin/scheduler/status")}async startDutchieAZScheduler(){return this.request("/api/az/admin/scheduler/start",{method:"POST"})}async stopDutchieAZScheduler(){return this.request("/api/az/admin/scheduler/stop",{method:"POST"})}async triggerDutchieAZImmediateCrawl(){return this.request("/api/az/admin/scheduler/trigger",{method:"POST"})}async getDutchieAZStores(t){const r=new URLSearchParams;t!=null&&t.city&&r.append("city",t.city),(t==null?void 0:t.hasPlatformId)!==void 0&&r.append("hasPlatformId",String(t.hasPlatformId)),t!=null&&t.limit&&r.append("limit",t.limit.toString()),t!=null&&t.offset&&r.append("offset",t.offset.toString());const n=r.toString()?`?${r.toString()}`:"";return this.request(`/api/az/stores${n}`)}async getDutchieAZStore(t){return this.request(`/api/az/stores/${t}`)}async getDutchieAZStoreSummary(t){return this.request(`/api/az/stores/${t}/summary`)}async getDutchieAZStoreProducts(t,r){const n=new URLSearchParams;r!=null&&r.stockStatus&&n.append("stockStatus",r.stockStatus),r!=null&&r.type&&n.append("type",r.type),r!=null&&r.subcategory&&n.append("subcategory",r.subcategory),r!=null&&r.brandName&&n.append("brandName",r.brandName),r!=null&&r.search&&n.append("search",r.search),r!=null&&r.limit&&n.append("limit",r.limit.toString()),r!=null&&r.offset&&n.append("offset",r.offset.toString());const i=n.toString()?`?${n.toString()}`:"";return this.request(`/api/az/stores/${t}/products${i}`)}async getDutchieAZStoreBrands(t){return this.request(`/api/az/stores/${t}/brands`)}async getDutchieAZStoreCategories(t){return this.request(`/api/az/stores/${t}/categories`)}async getDutchieAZBrands(t){const r=new URLSearchParams;t!=null&&t.limit&&r.append("limit",t.limit.toString()),t!=null&&t.offset&&r.append("offset",t.offset.toString());const n=r.toString()?`?${r.toString()}`:"";return this.request(`/api/az/brands${n}`)}async getDutchieAZCategories(){return this.request("/api/az/categories")}async getDutchieAZDebugSummary(){return this.request("/api/az/debug/summary")}async getDutchieAZDebugStore(t){return this.request(`/api/az/debug/store/${t}`)}async triggerDutchieAZCrawl(t,r){return this.request(`/api/az/admin/crawl/${t}`,{method:"POST",body:JSON.stringify(r||{})})}async getDetectionStats(){return this.request("/api/az/admin/detection/stats")}async getDispensariesNeedingDetection(t){const r=new URLSearchParams;t!=null&&t.state&&r.append("state",t.state),t!=null&&t.limit&&r.append("limit",t.limit.toString());const n=r.toString()?`?${r.toString()}`:"";return this.request(`/api/az/admin/detection/pending${n}`)}async detectDispensary(t){return this.request(`/api/az/admin/detection/detect/${t}`,{method:"POST"})}async detectAllDispensaries(t){return this.request("/api/az/admin/detection/detect-all",{method:"POST",body:JSON.stringify(t||{})})}async triggerMenuDetectionJob(){return this.request("/api/az/admin/detection/trigger",{method:"POST"})}}const B=new EA(OA),Ph=AA(e=>({user:null,token:localStorage.getItem("token"),isAuthenticated:!!localStorage.getItem("token"),login:async(t,r)=>{const n=await B.login(t,r);localStorage.setItem("token",n.token),e({user:n.user,token:n.token,isAuthenticated:!0})},logout:()=>{localStorage.removeItem("token"),e({user:null,token:null,isAuthenticated:!1})},checkAuth:async()=>{try{const t=await B.getMe();e({user:t.user,isAuthenticated:!0})}catch{localStorage.removeItem("token"),e({user:null,token:null,isAuthenticated:!1})}}}));function DA(){const[e,t]=h.useState("admin@example.com"),[r,n]=h.useState("password"),[i,s]=h.useState(""),[o,l]=h.useState(!1),c=dt(),d=Ph(f=>f.login),u=async f=>{f.preventDefault(),s(""),l(!0);try{await d(e,r),c("/")}catch(p){s(p.message||"Login failed")}finally{l(!1)}};return a.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:"100vh",background:"linear-gradient(135deg, #667eea 0%, #764ba2 100%)"},children:a.jsxs("div",{style:{background:"white",padding:"40px",borderRadius:"12px",boxShadow:"0 10px 40px rgba(0,0,0,0.2)",width:"100%",maxWidth:"400px"},children:[a.jsx("h1",{style:{marginBottom:"10px",fontSize:"28px"},children:"Dutchie Menus"}),a.jsx("p",{style:{color:"#666",marginBottom:"30px"},children:"Admin Dashboard"}),i&&a.jsx("div",{style:{background:"#fee",color:"#c33",padding:"12px",borderRadius:"6px",marginBottom:"20px",fontSize:"14px"},children:i}),a.jsxs("form",{onSubmit:u,children:[a.jsxs("div",{style:{marginBottom:"20px"},children:[a.jsx("label",{style:{display:"block",marginBottom:"8px",fontWeight:"500"},children:"Email"}),a.jsx("input",{type:"email",value:e,onChange:f=>t(f.target.value),required:!0,style:{width:"100%",padding:"12px",border:"1px solid #ddd",borderRadius:"6px",fontSize:"14px"}})]}),a.jsxs("div",{style:{marginBottom:"25px"},children:[a.jsx("label",{style:{display:"block",marginBottom:"8px",fontWeight:"500"},children:"Password"}),a.jsx("input",{type:"password",value:r,onChange:f=>n(f.target.value),required:!0,style:{width:"100%",padding:"12px",border:"1px solid #ddd",borderRadius:"6px",fontSize:"14px"}})]}),a.jsx("button",{type:"submit",disabled:o,style:{width:"100%",padding:"14px",background:o?"#999":"#667eea",color:"white",border:"none",borderRadius:"6px",cursor:o?"not-allowed":"pointer",fontSize:"16px",fontWeight:"500",transition:"background 0.2s"},children:o?"Logging in...":"Login"})]})]})})}/** * @license lucide-react v0.553.0 - ISC * * This source code is licensed under the ISC license. @@ -100,245 +100,240 @@ Error generating stack: `+s.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Q=(e,t)=>{const r=h.forwardRef(({className:n,...i},s)=>h.createElement(LA,{ref:s,iconNode:t,className:Q1(`lucide-${TA(Dx(e))}`,`lucide-${e}`,n),...i}));return r.displayName=Dx(e),r};/** + */const ee=(e,t)=>{const r=h.forwardRef(({className:n,...i},s)=>h.createElement(LA,{ref:s,iconNode:t,className:Q1(`lucide-${TA(Dx(e))}`,`lucide-${e}`,n),...i}));return r.displayName=Dx(e),r};/** * @license lucide-react v0.553.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const zA=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],Ds=Q("activity",zA);/** + */const zA=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],na=ee("activity",zA);/** * @license lucide-react v0.553.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=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],_h=Q("arrow-left",RA);/** + */const RA=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],_h=ee("arrow-left",RA);/** * @license lucide-react v0.553.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const BA=[["path",{d:"M10 12h4",key:"a56b0p"}],["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M14 21v-3a2 2 0 0 0-4 0v3",key:"1rgiei"}],["path",{d:"M6 10H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-2",key:"secmi2"}],["path",{d:"M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16",key:"16ra0t"}]],Ln=Q("building-2",BA);/** + */const BA=[["path",{d:"M10 12h4",key:"a56b0p"}],["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M14 21v-3a2 2 0 0 0-4 0v3",key:"1rgiei"}],["path",{d:"M6 10H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-2",key:"secmi2"}],["path",{d:"M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16",key:"16ra0t"}]],Ln=ee("building-2",BA);/** * @license lucide-react v0.553.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const FA=[["path",{d:"M12 10h.01",key:"1nrarc"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M12 6h.01",key:"1vi96p"}],["path",{d:"M16 10h.01",key:"1m94wz"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M16 6h.01",key:"1x0f13"}],["path",{d:"M8 10h.01",key:"19clt8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M8 6h.01",key:"1dz90k"}],["path",{d:"M9 22v-3a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v3",key:"cabbwy"}],["rect",{x:"4",y:"2",width:"16",height:"20",rx:"2",key:"1uxh74"}]],WA=Q("building",FA);/** + */const FA=[["path",{d:"M12 10h.01",key:"1nrarc"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M12 6h.01",key:"1vi96p"}],["path",{d:"M16 10h.01",key:"1m94wz"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M16 6h.01",key:"1x0f13"}],["path",{d:"M8 10h.01",key:"19clt8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M8 6h.01",key:"1dz90k"}],["path",{d:"M9 22v-3a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v3",key:"cabbwy"}],["rect",{x:"4",y:"2",width:"16",height:"20",rx:"2",key:"1uxh74"}]],WA=ee("building",FA);/** * @license lucide-react v0.553.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const UA=[["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"}]],Ch=Q("calendar",UA);/** + */const UA=[["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"}]],Ch=ee("calendar",UA);/** * @license lucide-react v0.553.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const qA=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],HA=Q("chart-column",qA);/** + */const qA=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],HA=ee("chart-column",qA);/** * @license lucide-react v0.553.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const KA=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],ej=Q("chevron-down",KA);/** + */const KA=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],ej=ee("chevron-down",KA);/** * @license lucide-react v0.553.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const VA=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Cf=Q("chevron-right",VA);/** + */const VA=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Cf=ee("chevron-right",VA);/** * @license lucide-react v0.553.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const YA=[["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"}]],Uc=Q("circle-alert",YA);/** + */const YA=[["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"}]],Uc=ee("circle-alert",YA);/** * @license lucide-react v0.553.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const GA=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],_r=Q("circle-check-big",GA);/** + */const GA=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],_r=ee("circle-check-big",GA);/** * @license lucide-react v0.553.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const ZA=[["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"}]],Hr=Q("circle-x",ZA);/** + */const ZA=[["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"}]],Hr=ee("circle-x",ZA);/** * @license lucide-react v0.553.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const XA=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],xr=Q("clock",XA);/** + */const XA=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],xr=ee("clock",XA);/** * @license lucide-react v0.553.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const JA=[["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"}]],QA=Q("dollar-sign",JA);/** + */const JA=[["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"}]],QA=ee("dollar-sign",JA);/** * @license lucide-react v0.553.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const eO=[["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"}]],Jr=Q("external-link",eO);/** + */const eO=[["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"}]],Jr=ee("external-link",eO);/** * @license lucide-react v0.553.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const tO=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],rO=Q("eye",tO);/** + */const tO=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],rO=ee("eye",tO);/** * @license lucide-react v0.553.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const nO=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],iO=Q("file-text",nO);/** + */const nO=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],iO=ee("file-text",nO);/** * @license lucide-react v0.553.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const aO=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],sO=Q("folder-open",aO);/** + */const aO=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],sO=ee("folder-open",aO);/** * @license lucide-react v0.553.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const oO=[["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"}]],lO=Q("image",oO);/** + */const oO=[["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"}]],lO=ee("image",oO);/** * @license lucide-react v0.553.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const cO=[["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"}]],uO=Q("key",cO);/** + */const cO=[["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"}]],uO=ee("key",cO);/** * @license lucide-react v0.553.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const dO=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],Tx=Q("layers",dO);/** + */const dO=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],Tx=ee("layers",dO);/** * @license lucide-react v0.553.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const fO=[["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"}]],pO=Q("layout-dashboard",fO);/** + */const fO=[["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"}]],pO=ee("layout-dashboard",fO);/** * @license lucide-react v0.553.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const hO=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],mO=Q("log-out",hO);/** + */const hO=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],mO=ee("log-out",hO);/** * @license lucide-react v0.553.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=[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]],tj=Q("mail",gO);/** + */const gO=[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]],tj=ee("mail",gO);/** * @license lucide-react v0.553.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=[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]],yi=Q("map-pin",xO);/** + */const xO=[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]],yi=ee("map-pin",xO);/** * @license lucide-react v0.553.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const yO=[["path",{d:"M12.586 12.586 19 19",key:"ea5xo7"}],["path",{d:"M3.688 3.037a.497.497 0 0 0-.651.651l6.5 15.999a.501.501 0 0 0 .947-.062l1.569-6.083a2 2 0 0 1 1.448-1.479l6.124-1.579a.5.5 0 0 0 .063-.947z",key:"277e5u"}]],vO=Q("mouse-pointer",yO);/** + */const yO=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 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.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],Ct=ee("package",yO);/** * @license lucide-react v0.553.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const bO=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 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.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],Ct=Q("package",bO);/** + */const vO=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],bO=ee("pencil",vO);/** * @license lucide-react v0.553.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const jO=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],wO=Q("pencil",jO);/** + */const jO=[["path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384",key:"9njp5v"}]],Ah=ee("phone",jO);/** * @license lucide-react v0.553.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const SO=[["path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384",key:"9njp5v"}]],Ah=Q("phone",SO);/** + */const wO=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Af=ee("plus",wO);/** * @license lucide-react v0.553.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const NO=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Af=Q("plus",NO);/** + */const SO=[["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"}]],Xt=ee("refresh-cw",SO);/** * @license lucide-react v0.553.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const kO=[["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"}]],Xt=Q("refresh-cw",kO);/** + */const NO=[["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"}]],kO=ee("save",NO);/** * @license lucide-react v0.553.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const PO=[["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"}]],_O=Q("save",PO);/** + */const PO=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],_O=ee("search",PO);/** * @license lucide-react v0.553.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const CO=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],AO=Q("search",CO);/** + */const CO=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],AO=ee("settings",CO);/** * @license lucide-react v0.553.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const OO=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],EO=Q("settings",OO);/** + */const OO=[["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"}]],sl=ee("shield",OO);/** * @license lucide-react v0.553.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const DO=[["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"}]],sl=Q("shield",DO);/** + */const EO=[["path",{d:"M15 21v-5a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v5",key:"slp6dd"}],["path",{d:"M17.774 10.31a1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.451 0 1.12 1.12 0 0 0-1.548 0 2.5 2.5 0 0 1-3.452 0 1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.77-3.248l2.889-4.184A2 2 0 0 1 7 2h10a2 2 0 0 1 1.653.873l2.895 4.192a2.5 2.5 0 0 1-3.774 3.244",key:"o0xfot"}],["path",{d:"M4 10.95V19a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8.05",key:"wn3emo"}]],Il=ee("store",EO);/** * @license lucide-react v0.553.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const TO=[["path",{d:"M15 21v-5a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v5",key:"slp6dd"}],["path",{d:"M17.774 10.31a1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.451 0 1.12 1.12 0 0 0-1.548 0 2.5 2.5 0 0 1-3.452 0 1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.77-3.248l2.889-4.184A2 2 0 0 1 7 2h10a2 2 0 0 1 1.653.873l2.895 4.192a2.5 2.5 0 0 1-3.774 3.244",key:"o0xfot"}],["path",{d:"M4 10.95V19a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8.05",key:"wn3emo"}]],Il=Q("store",TO);/** + */const DO=[["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"}]],Cr=ee("tag",DO);/** * @license lucide-react v0.553.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=[["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"}]],Cr=Q("tag",MO);/** + */const TO=[["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"}]],rj=ee("target",TO);/** * @license lucide-react v0.553.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const IO=[["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"}]],rj=Q("target",IO);/** + */const MO=[["circle",{cx:"9",cy:"12",r:"3",key:"u3jwor"}],["rect",{width:"20",height:"14",x:"2",y:"5",rx:"7",key:"g7kal2"}]],Mx=ee("toggle-left",MO);/** * @license lucide-react v0.553.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const $O=[["circle",{cx:"9",cy:"12",r:"3",key:"u3jwor"}],["rect",{width:"20",height:"14",x:"2",y:"5",rx:"7",key:"g7kal2"}]],Mx=Q("toggle-left",$O);/** + */const IO=[["circle",{cx:"15",cy:"12",r:"3",key:"1afu0r"}],["rect",{width:"20",height:"14",x:"2",y:"5",rx:"7",key:"g7kal2"}]],Ix=ee("toggle-right",IO);/** * @license lucide-react v0.553.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const LO=[["circle",{cx:"15",cy:"12",r:"3",key:"1afu0r"}],["rect",{width:"20",height:"14",x:"2",y:"5",rx:"7",key:"g7kal2"}]],Ix=Q("toggle-right",LO);/** + */const $O=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],LO=ee("trash-2",$O);/** * @license lucide-react v0.553.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const zO=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],RO=Q("trash-2",zO);/** + */const zO=[["path",{d:"M16 17h6v-6",key:"t6n2it"}],["path",{d:"m22 17-8.5-8.5-5 5L2 7",key:"x473p"}]],RO=ee("trending-down",zO);/** * @license lucide-react v0.553.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const BO=[["path",{d:"M16 17h6v-6",key:"t6n2it"}],["path",{d:"m22 17-8.5-8.5-5 5L2 7",key:"x473p"}]],FO=Q("trending-down",BO);/** + */const BO=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],zn=ee("trending-up",BO);/** * @license lucide-react v0.553.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const WO=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],zn=Q("trending-up",WO);/** + */const FO=[["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"}]],nj=ee("triangle-alert",FO);/** * @license lucide-react v0.553.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const UO=[["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"}]],nj=Q("triangle-alert",UO);/** + */const WO=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],UO=ee("upload",WO);/** * @license lucide-react v0.553.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const qO=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],HO=Q("upload",qO);/** + */const qO=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],HO=ee("wrench",qO);/** * @license lucide-react v0.553.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const KO=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],VO=Q("wrench",KO);/** + */const KO=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],ij=ee("x",KO);/** * @license lucide-react v0.553.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const YO=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],ij=Q("x",YO);/** - * @license lucide-react v0.553.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=[["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"}]],$x=Q("zap",GO);function Ge({to:e,icon:t,label:r,isActive:n}){return a.jsxs("a",{href:e,className:`flex items-center gap-3 px-3 py-2 rounded-lg text-sm font-medium transition-colors ${n?"bg-blue-50 text-blue-600":"text-gray-700 hover:bg-gray-50"}`,children:[a.jsx("span",{className:"flex-shrink-0",children:t}),a.jsx("span",{children:r})]})}function Do({title:e,children:t}){return a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:"px-3 mb-2",children:a.jsx("h3",{className:"text-xs font-semibold text-gray-400 uppercase tracking-wider",children:e})}),t]})}function X({children:e}){const t=dt(),r=_i(),{user:n,logout:i}=Ph(),[s,o]=h.useState(null);h.useEffect(()=>{(async()=>{try{const u=await B.getVersion();o(u)}catch(u){console.error("Failed to fetch version info:",u)}})()},[]);const l=()=>{i(),t("/login")},c=(d,u=!0)=>u?r.pathname===d:r.pathname.startsWith(d);return a.jsxs("div",{className:"flex min-h-screen bg-gray-50",children:[a.jsxs("div",{className:"w-64 bg-white border-r border-gray-200 flex flex-col",style:{position:"sticky",top:0,height:"100vh",overflowY:"auto"},children:[a.jsxs("div",{className:"px-6 py-5 border-b border-gray-200",children:[a.jsx("h1",{className:"text-lg font-semibold text-gray-900",children:"Dutchie Analytics"}),a.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:n==null?void 0:n.email})]}),a.jsxs("nav",{className:"flex-1 px-3 py-4 space-y-6",children:[a.jsxs(Do,{title:"Main",children:[a.jsx(Ge,{to:"/",icon:a.jsx(pO,{className:"w-4 h-4"}),label:"Dashboard",isActive:c("/",!0)}),a.jsx(Ge,{to:"/dispensaries",icon:a.jsx(Ln,{className:"w-4 h-4"}),label:"Dispensaries",isActive:c("/dispensaries")}),a.jsx(Ge,{to:"/categories",icon:a.jsx(sO,{className:"w-4 h-4"}),label:"Categories",isActive:c("/categories")}),a.jsx(Ge,{to:"/products",icon:a.jsx(Ct,{className:"w-4 h-4"}),label:"Products",isActive:c("/products")}),a.jsx(Ge,{to:"/campaigns",icon:a.jsx(rj,{className:"w-4 h-4"}),label:"Campaigns",isActive:c("/campaigns")}),a.jsx(Ge,{to:"/analytics",icon:a.jsx(zn,{className:"w-4 h-4"}),label:"Analytics",isActive:c("/analytics")})]}),a.jsxs(Do,{title:"AZ Data",children:[a.jsx(Ge,{to:"/wholesale-analytics",icon:a.jsx(zn,{className:"w-4 h-4"}),label:"Wholesale Analytics",isActive:c("/wholesale-analytics")}),a.jsx(Ge,{to:"/az",icon:a.jsx(Il,{className:"w-4 h-4"}),label:"AZ Stores",isActive:c("/az",!1)}),a.jsx(Ge,{to:"/az-schedule",icon:a.jsx(Ch,{className:"w-4 h-4"}),label:"AZ Schedule",isActive:c("/az-schedule")})]}),a.jsxs(Do,{title:"Scraper",children:[a.jsx(Ge,{to:"/scraper-tools",icon:a.jsx(VO,{className:"w-4 h-4"}),label:"Tools",isActive:c("/scraper-tools")}),a.jsx(Ge,{to:"/scraper-schedule",icon:a.jsx(xr,{className:"w-4 h-4"}),label:"Schedule",isActive:c("/scraper-schedule")}),a.jsx(Ge,{to:"/scraper-monitor",icon:a.jsx(Ds,{className:"w-4 h-4"}),label:"Monitor",isActive:c("/scraper-monitor")})]}),a.jsxs(Do,{title:"System",children:[a.jsx(Ge,{to:"/changes",icon:a.jsx(_r,{className:"w-4 h-4"}),label:"Change Approval",isActive:c("/changes")}),a.jsx(Ge,{to:"/api-permissions",icon:a.jsx(uO,{className:"w-4 h-4"}),label:"API Permissions",isActive:c("/api-permissions")}),a.jsx(Ge,{to:"/proxies",icon:a.jsx(sl,{className:"w-4 h-4"}),label:"Proxies",isActive:c("/proxies")}),a.jsx(Ge,{to:"/logs",icon:a.jsx(iO,{className:"w-4 h-4"}),label:"Logs",isActive:c("/logs")}),a.jsx(Ge,{to:"/settings",icon:a.jsx(EO,{className:"w-4 h-4"}),label:"Settings",isActive:c("/settings")})]})]}),a.jsx("div",{className:"px-3 py-4 border-t border-gray-200",children:a.jsxs("button",{onClick:l,className:"w-full flex items-center gap-3 px-3 py-2 rounded-lg text-sm font-medium text-red-600 hover:bg-red-50 transition-colors",children:[a.jsx(mO,{className:"w-4 h-4"}),a.jsx("span",{children:"Logout"})]})}),s&&a.jsxs("div",{className:"px-3 py-2 border-t border-gray-200 bg-gray-50",children:[a.jsxs("p",{className:"text-xs text-gray-500 text-center",children:[s.build_version," (",s.git_sha.slice(0,7),")"]}),a.jsx("p",{className:"text-xs text-gray-400 text-center mt-0.5",children:s.image_tag})]})]}),a.jsx("div",{className:"flex-1 overflow-y-auto",children:a.jsx("div",{className:"max-w-7xl mx-auto px-8 py-8",children:e})})]})}function aj(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t{var[n]=r;return sj(n)||oj(n)});return Object.fromEntries(t)}function qc(e){if(e==null)return null;if(h.isValidElement(e)&&typeof e.props=="object"&&e.props!==null){var t=e.props;return nr(t)}return typeof e=="object"&&!Array.isArray(e)?nr(e):null}function ut(e){var t=Object.entries(e).filter(r=>{var[n]=r;return sj(n)||oj(n)||Oh(n)});return Object.fromEntries(t)}function JO(e){return e==null?null:h.isValidElement(e)?ut(e.props):typeof e=="object"&&!Array.isArray(e)?ut(e):null}var QO=["children","width","height","viewBox","className","style","title","desc"];function Of(){return Of=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{children:r,width:n,height:i,viewBox:s,className:o,style:l,title:c,desc:d}=e,u=e6(e,QO),f=s||{width:n,height:i,x:0,y:0},p=ce("recharts-surface",o);return h.createElement("svg",Of({},ut(u),{className:p,width:n,height:i,style:l,viewBox:"".concat(f.x," ").concat(f.y," ").concat(f.width," ").concat(f.height),ref:t}),h.createElement("title",null,c),h.createElement("desc",null,d),r)}),r6=["children","className"];function Ef(){return Ef=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{children:r,className:n}=e,i=n6(e,r6),s=ce("recharts-layer",n);return h.createElement("g",Ef({className:s},ut(i),{ref:t}),r)}),a6=h.createContext(null);function he(e){return function(){return e}}const cj=Math.cos,$l=Math.sin,vr=Math.sqrt,Ll=Math.PI,Hc=2*Ll,Df=Math.PI,Tf=2*Df,Xn=1e-6,s6=Tf-Xn;function uj(e){this._+=e[0];for(let t=1,r=e.length;t=0))throw new Error(`invalid digits: ${e}`);if(t>15)return uj;const r=10**t;return function(n){this._+=n[0];for(let i=1,s=n.length;iXn)if(!(Math.abs(f*c-d*u)>Xn)||!s)this._append`L${this._x1=t},${this._y1=r}`;else{let m=n-o,x=i-l,g=c*c+d*d,b=m*m+x*x,v=Math.sqrt(g),j=Math.sqrt(p),y=s*Math.tan((Df-Math.acos((g+p-b)/(2*v*j)))/2),w=y/j,S=y/v;Math.abs(w-1)>Xn&&this._append`L${t+w*u},${r+w*f}`,this._append`A${s},${s},0,0,${+(f*m>u*x)},${this._x1=t+S*c},${this._y1=r+S*d}`}}arc(t,r,n,i,s,o){if(t=+t,r=+r,n=+n,o=!!o,n<0)throw new Error(`negative radius: ${n}`);let l=n*Math.cos(i),c=n*Math.sin(i),d=t+l,u=r+c,f=1^o,p=o?i-s:s-i;this._x1===null?this._append`M${d},${u}`:(Math.abs(this._x1-d)>Xn||Math.abs(this._y1-u)>Xn)&&this._append`L${d},${u}`,n&&(p<0&&(p=p%Tf+Tf),p>s6?this._append`A${n},${n},0,1,${f},${t-l},${r-c}A${n},${n},0,1,${f},${this._x1=d},${this._y1=u}`:p>Xn&&this._append`A${n},${n},0,${+(p>=Df)},${f},${this._x1=t+n*Math.cos(s)},${this._y1=r+n*Math.sin(s)}`)}rect(t,r,n,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}h${n=+n}v${+i}h${-n}Z`}toString(){return this._}}function Eh(e){let t=3;return e.digits=function(r){if(!arguments.length)return t;if(r==null)t=null;else{const n=Math.floor(r);if(!(n>=0))throw new RangeError(`invalid digits: ${r}`);t=n}return e},()=>new l6(t)}function Dh(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function dj(e){this._context=e}dj.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 Kc(e){return new dj(e)}function fj(e){return e[0]}function pj(e){return e[1]}function hj(e,t){var r=he(!0),n=null,i=Kc,s=null,o=Eh(l);e=typeof e=="function"?e:e===void 0?fj:he(e),t=typeof t=="function"?t:t===void 0?pj:he(t);function l(c){var d,u=(c=Dh(c)).length,f,p=!1,m;for(n==null&&(s=i(m=o())),d=0;d<=u;++d)!(d=m;--x)l.point(y[x],w[x]);l.lineEnd(),l.areaEnd()}v&&(y[p]=+e(b,p,f),w[p]=+t(b,p,f),l.point(n?+n(b,p,f):y[p],r?+r(b,p,f):w[p]))}if(j)return l=null,j+""||null}function u(){return hj().defined(i).curve(o).context(s)}return d.x=function(f){return arguments.length?(e=typeof f=="function"?f:he(+f),n=null,d):e},d.x0=function(f){return arguments.length?(e=typeof f=="function"?f:he(+f),d):e},d.x1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:he(+f),d):n},d.y=function(f){return arguments.length?(t=typeof f=="function"?f:he(+f),r=null,d):t},d.y0=function(f){return arguments.length?(t=typeof f=="function"?f:he(+f),d):t},d.y1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:he(+f),d):r},d.lineX0=d.lineY0=function(){return u().x(e).y(t)},d.lineY1=function(){return u().x(e).y(r)},d.lineX1=function(){return u().x(n).y(t)},d.defined=function(f){return arguments.length?(i=typeof f=="function"?f:he(!!f),d):i},d.curve=function(f){return arguments.length?(o=f,s!=null&&(l=o(s)),d):o},d.context=function(f){return arguments.length?(f==null?s=l=null:l=o(s=f),d):s},d}class mj{constructor(t,r){this._context=t,this._x=r}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,r){switch(t=+t,r=+r,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,r,t,r):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+r)/2,t,this._y0,t,r);break}}this._x0=t,this._y0=r}}function c6(e){return new mj(e,!0)}function u6(e){return new mj(e,!1)}const Th={draw(e,t){const r=vr(t/Ll);e.moveTo(r,0),e.arc(0,0,r,0,Hc)}},d6={draw(e,t){const r=vr(t/5)/2;e.moveTo(-3*r,-r),e.lineTo(-r,-r),e.lineTo(-r,-3*r),e.lineTo(r,-3*r),e.lineTo(r,-r),e.lineTo(3*r,-r),e.lineTo(3*r,r),e.lineTo(r,r),e.lineTo(r,3*r),e.lineTo(-r,3*r),e.lineTo(-r,r),e.lineTo(-3*r,r),e.closePath()}},gj=vr(1/3),f6=gj*2,p6={draw(e,t){const r=vr(t/f6),n=r*gj;e.moveTo(0,-r),e.lineTo(n,0),e.lineTo(0,r),e.lineTo(-n,0),e.closePath()}},h6={draw(e,t){const r=vr(t),n=-r/2;e.rect(n,n,r,r)}},m6=.8908130915292852,xj=$l(Ll/10)/$l(7*Ll/10),g6=$l(Hc/10)*xj,x6=-cj(Hc/10)*xj,y6={draw(e,t){const r=vr(t*m6),n=g6*r,i=x6*r;e.moveTo(0,-r),e.lineTo(n,i);for(let s=1;s<5;++s){const o=Hc*s/5,l=cj(o),c=$l(o);e.lineTo(c*r,-l*r),e.lineTo(l*n-c*i,c*n+l*i)}e.closePath()}},cd=vr(3),v6={draw(e,t){const r=-vr(t/(cd*3));e.moveTo(0,r*2),e.lineTo(-cd*r,-r),e.lineTo(cd*r,-r),e.closePath()}},Ht=-.5,Kt=vr(3)/2,Mf=1/vr(12),b6=(Mf/2+1)*3,j6={draw(e,t){const r=vr(t/b6),n=r/2,i=r*Mf,s=n,o=r*Mf+r,l=-s,c=o;e.moveTo(n,i),e.lineTo(s,o),e.lineTo(l,c),e.lineTo(Ht*n-Kt*i,Kt*n+Ht*i),e.lineTo(Ht*s-Kt*o,Kt*s+Ht*o),e.lineTo(Ht*l-Kt*c,Kt*l+Ht*c),e.lineTo(Ht*n+Kt*i,Ht*i-Kt*n),e.lineTo(Ht*s+Kt*o,Ht*o-Kt*s),e.lineTo(Ht*l+Kt*c,Ht*c-Kt*l),e.closePath()}};function w6(e,t){let r=null,n=Eh(i);e=typeof e=="function"?e:he(e||Th),t=typeof t=="function"?t:he(t===void 0?64:+t);function i(){let s;if(r||(r=s=n()),e.apply(this,arguments).draw(r,+t.apply(this,arguments)),s)return r=null,s+""||null}return i.type=function(s){return arguments.length?(e=typeof s=="function"?s:he(s),i):e},i.size=function(s){return arguments.length?(t=typeof s=="function"?s:he(+s),i):t},i.context=function(s){return arguments.length?(r=s??null,i):r},i}function zl(){}function Rl(e,t,r){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+r)/6)}function yj(e){this._context=e}yj.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:Rl(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:Rl(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function S6(e){return new yj(e)}function vj(e){this._context=e}vj.prototype={areaStart:zl,areaEnd:zl,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:Rl(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function N6(e){return new vj(e)}function bj(e){this._context=e}bj.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 r=(this._x0+4*this._x1+e)/6,n=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:Rl(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function k6(e){return new bj(e)}function jj(e){this._context=e}jj.prototype={areaStart:zl,areaEnd:zl,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 P6(e){return new jj(e)}function Lx(e){return e<0?-1:1}function zx(e,t,r){var n=e._x1-e._x0,i=t-e._x1,s=(e._y1-e._y0)/(n||i<0&&-0),o=(r-e._y1)/(i||n<0&&-0),l=(s*i+o*n)/(n+i);return(Lx(s)+Lx(o))*Math.min(Math.abs(s),Math.abs(o),.5*Math.abs(l))||0}function Rx(e,t){var r=e._x1-e._x0;return r?(3*(e._y1-e._y0)/r-t)/2:t}function ud(e,t,r){var n=e._x0,i=e._y0,s=e._x1,o=e._y1,l=(s-n)/3;e._context.bezierCurveTo(n+l,i+l*t,s-l,o-l*r,s,o)}function Bl(e){this._context=e}Bl.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:ud(this,this._t0,Rx(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 r=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,ud(this,Rx(this,r=zx(this,e,t)),r);break;default:ud(this,this._t0,r=zx(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=r}}};function wj(e){this._context=new Sj(e)}(wj.prototype=Object.create(Bl.prototype)).point=function(e,t){Bl.prototype.point.call(this,t,e)};function Sj(e){this._context=e}Sj.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,r,n,i,s){this._context.bezierCurveTo(t,e,n,r,s,i)}};function _6(e){return new Bl(e)}function C6(e){return new wj(e)}function Nj(e){this._context=e}Nj.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,r=e.length;if(r)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),r===2)this._context.lineTo(e[1],t[1]);else for(var n=Bx(e),i=Bx(t),s=0,o=1;o=0;--t)i[t]=(o[t]-i[t+1])/s[t];for(s[r-1]=(e[r]+i[r-1])/2,t=0;t=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 r=this._x*(1-this._t)+e*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,t)}break}}this._x=e,this._y=t}};function O6(e){return new Vc(e,.5)}function E6(e){return new Vc(e,0)}function D6(e){return new Vc(e,1)}function pa(e,t){if((o=e.length)>1)for(var r=1,n,i,s=e[t[0]],o,l=s.length;r=0;)r[t]=t;return r}function T6(e,t){return e[t]}function M6(e){const t=[];return t.key=e,t}function I6(){var e=he([]),t=If,r=pa,n=T6;function i(s){var o=Array.from(e.apply(this,arguments),M6),l,c=o.length,d=-1,u;for(const f of s)for(l=0,++d;l0){for(var r,n,i=0,s=e[0].length,o;i0){for(var r=0,n=e[t[0]],i,s=n.length;r0)||!((s=(i=e[t[0]]).length)>0))){for(var r=0,n=1,i,s,o;ne===0?0:e>0?1:-1,yr=e=>typeof e=="number"&&e!=+e,Qr=e=>typeof e=="string"&&e.indexOf("%")===e.length-1,Y=e=>(typeof e=="number"||e instanceof Number)&&!yr(e),Or=e=>Y(e)||typeof e=="string",B6=0,Ts=e=>{var t=++B6;return"".concat(e||"").concat(t)},Rn=function(t,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!Y(t)&&typeof t!="string")return n;var s;if(Qr(t)){if(r==null)return n;var o=t.indexOf("%");s=r*parseFloat(t.slice(0,o))/100}else s=+t;return yr(s)&&(s=n),i&&r!=null&&s>r&&(s=r),s},_j=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,r={},n=0;nn&&(typeof t=="function"?t(n):Xc(n,t))===r)}var Re=e=>e===null||typeof e>"u",Xs=e=>Re(e)?e:"".concat(e.charAt(0).toUpperCase()).concat(e.slice(1));function F6(e){return e!=null}function ka(){}var W6=["type","size","sizeType"];function $f(){return $f=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var t="symbol".concat(Xs(e));return Aj[t]||Th},Z6=(e,t,r)=>{if(t==="area")return e;switch(r){case"cross":return 5*e*e/9;case"diamond":return .5*e*e/Math.sqrt(3);case"square":return e*e;case"star":{var n=18*Y6;return 1.25*e*e*(Math.tan(n)-Math.tan(n*2)*Math.tan(n)**2)}case"triangle":return Math.sqrt(3)*e*e/4;case"wye":return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},X6=(e,t)=>{Aj["symbol".concat(Xs(e))]=t},Oj=e=>{var{type:t="circle",size:r=64,sizeType:n="area"}=e,i=K6(e,W6),s=Wx(Wx({},i),{},{type:t,size:r,sizeType:n}),o="circle";typeof t=="string"&&(o=t);var l=()=>{var p=G6(o),m=w6().type(p).size(Z6(r,n,o)),x=m();if(x!==null)return x},{className:c,cx:d,cy:u}=s,f=ut(s);return Y(d)&&Y(u)&&Y(r)?h.createElement("path",$f({},f,{className:ce("recharts-symbols",c),transform:"translate(".concat(d,", ").concat(u,")"),d:l()})):null};Oj.registerSymbol=X6;var Ej=e=>"radius"in e&&"startAngle"in e&&"endAngle"in e,Ih=(e,t)=>{if(!e||typeof e=="function"||typeof e=="boolean")return null;var r=e;if(h.isValidElement(e)&&(r=e.props),typeof r!="object"&&typeof r!="function")return null;var n={};return Object.keys(r).forEach(i=>{Oh(i)&&(n[i]=s=>r[i](r,s))}),n},J6=(e,t,r)=>n=>(e(t,r,n),null),Q6=(e,t,r)=>{if(e===null||typeof e!="object"&&typeof e!="function")return null;var n=null;return Object.keys(e).forEach(i=>{var s=e[i];Oh(i)&&typeof s=="function"&&(n||(n={}),n[i]=J6(s,t,r))}),n};function Ux(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function e4(e){for(var t=1;t(o[l]===void 0&&n[l]!==void 0&&(o[l]=n[l]),o),r);return s}var Dj={},Tj={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r,n){const i=new Map;for(let s=0;s=0}e.isLength=t})(Ij);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Ij;function r(n){return n!=null&&typeof n!="function"&&t.isLength(n.length)}e.isArrayLike=r})(Jc);var $j={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return typeof r=="object"&&r!==null}e.isObjectLike=t})($j);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Jc,r=$j;function n(i){return r.isObjectLike(i)&&t.isArrayLike(i)}e.isArrayLikeObject=n})(Mj);var Lj={},zj={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Yc;function r(n){return function(i){return t.get(i,n)}}e.property=r})(zj);var Rj={},Lh={},Bj={},zh={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return r!==null&&(typeof r=="object"||typeof r=="function")}e.isObject=t})(zh);var Rh={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return r==null||typeof r!="object"&&typeof r!="function"}e.isPrimitive=t})(Rh);var Bh={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r,n){return r===n||Number.isNaN(r)&&Number.isNaN(n)}e.eq=t})(Bh);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=zh,r=Rh,n=Bh;function i(u,f,p){return typeof p!="function"?i(u,f,()=>{}):s(u,f,function m(x,g,b,v,j,y){const w=p(x,g,b,v,j,y);return w!==void 0?!!w:s(x,g,m,y)},new Map)}function s(u,f,p,m){if(f===u)return!0;switch(typeof f){case"object":return o(u,f,p,m);case"function":return Object.keys(f).length>0?s(u,{...f},p,m):n.eq(u,f);default:return t.isObject(u)?typeof f=="string"?f==="":!0:n.eq(u,f)}}function o(u,f,p,m){if(f==null)return!0;if(Array.isArray(f))return c(u,f,p,m);if(f instanceof Map)return l(u,f,p,m);if(f instanceof Set)return d(u,f,p,m);const x=Object.keys(f);if(u==null)return x.length===0;if(x.length===0)return!0;if(m!=null&&m.has(f))return m.get(f)===u;m==null||m.set(f,u);try{for(let g=0;g{})}e.isMatch=r})(Lh);var Fj={},Fh={},Wj={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return Object.getOwnPropertySymbols(r).filter(n=>Object.prototype.propertyIsEnumerable.call(r,n))}e.getSymbols=t})(Wj);var Wh={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return r==null?r===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(r)}e.getTag=t})(Wh);var Uh={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t="[object RegExp]",r="[object String]",n="[object Number]",i="[object Boolean]",s="[object Arguments]",o="[object Symbol]",l="[object Date]",c="[object Map]",d="[object Set]",u="[object Array]",f="[object Function]",p="[object ArrayBuffer]",m="[object Object]",x="[object Error]",g="[object DataView]",b="[object Uint8Array]",v="[object Uint8ClampedArray]",j="[object Uint16Array]",y="[object Uint32Array]",w="[object BigUint64Array]",S="[object Int8Array]",N="[object Int16Array]",P="[object Int32Array]",_="[object BigInt64Array]",T="[object Float32Array]",$="[object Float64Array]";e.argumentsTag=s,e.arrayBufferTag=p,e.arrayTag=u,e.bigInt64ArrayTag=_,e.bigUint64ArrayTag=w,e.booleanTag=i,e.dataViewTag=g,e.dateTag=l,e.errorTag=x,e.float32ArrayTag=T,e.float64ArrayTag=$,e.functionTag=f,e.int16ArrayTag=N,e.int32ArrayTag=P,e.int8ArrayTag=S,e.mapTag=c,e.numberTag=n,e.objectTag=m,e.regexpTag=t,e.setTag=d,e.stringTag=r,e.symbolTag=o,e.uint16ArrayTag=j,e.uint32ArrayTag=y,e.uint8ArrayTag=b,e.uint8ClampedArrayTag=v})(Uh);var Uj={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}e.isTypedArray=t})(Uj);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Wj,r=Wh,n=Uh,i=Rh,s=Uj;function o(u,f){return l(u,void 0,u,new Map,f)}function l(u,f,p,m=new Map,x=void 0){const g=x==null?void 0:x(u,f,p,m);if(g!==void 0)return g;if(i.isPrimitive(u))return u;if(m.has(u))return m.get(u);if(Array.isArray(u)){const b=new Array(u.length);m.set(u,b);for(let v=0;vt.isMatch(s,i)}e.matches=n})(Rj);var qj={},Hj={},Kj={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Fh,r=Uh;function n(i,s){return t.cloneDeepWith(i,(o,l,c,d)=>{const u=s==null?void 0:s(o,l,c,d);if(u!==void 0)return u;if(typeof i=="object")switch(Object.prototype.toString.call(i)){case r.numberTag:case r.stringTag:case r.booleanTag:{const f=new i.constructor(i==null?void 0:i.valueOf());return t.copyProperties(f,i),f}case r.argumentsTag:{const f={};return t.copyProperties(f,i),f.length=i.length,f[Symbol.iterator]=i[Symbol.iterator],f}default:return}})}e.cloneDeepWith=n})(Kj);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Kj;function r(n){return t.cloneDeepWith(n)}e.cloneDeep=r})(Hj);var Vj={},qh={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=/^(?:0|[1-9]\d*)$/;function r(n,i=Number.MAX_SAFE_INTEGER){switch(typeof n){case"number":return Number.isInteger(n)&&n>=0&&ne,Ve=()=>{var e=h.useContext(Hh);return e?e.store.dispatch:s4},ol=()=>{},o4=()=>ol,l4=(e,t)=>e===t;function G(e){var t=h.useContext(Hh);return X1.useSyncExternalStoreWithSelector(t?t.subscription.addNestedSub:o4,t?t.store.getState:ol,t?t.store.getState:ol,t?e:ol,l4)}function c4(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function u4(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function d4(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(r=>typeof r=="function")){const r=e.map(n=>typeof n=="function"?`function ${n.name||"unnamed"}()`:typeof n).join(", ");throw new TypeError(`${t}[${r}]`)}}var Hx=e=>Array.isArray(e)?e:[e];function f4(e){const t=Array.isArray(e[0])?e[0]:e;return d4(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function p4(e,t){const r=[],{length:n}=e;for(let i=0;i{r=Mo(),o.resetResultsCount()},o.resultsCount=()=>s,o.resetResultsCount=()=>{s=0},o}function x4(e,...t){const r=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,n=(...i)=>{let s=0,o=0,l,c={},d=i.pop();typeof d=="object"&&(c=d,d=i.pop()),c4(d,`createSelector expects an output function after the inputs, but received: [${typeof d}]`);const u={...r,...c},{memoize:f,memoizeOptions:p=[],argsMemoize:m=Gj,argsMemoizeOptions:x=[]}=u,g=Hx(p),b=Hx(x),v=f4(i),j=f(function(){return s++,d.apply(null,arguments)},...g),y=m(function(){o++;const S=p4(v,arguments);return l=j.apply(null,S),l},...b);return Object.assign(y,{resultFunc:d,memoizedResultFunc:j,dependencies:v,dependencyRecomputations:()=>o,resetDependencyRecomputations:()=>{o=0},lastResult:()=>l,recomputations:()=>s,resetRecomputations:()=>{s=0},memoize:f,argsMemoize:m})};return Object.assign(n,{withTypes:()=>n}),n}var I=x4(Gj),y4=Object.assign((e,t=I)=>{u4(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);const r=Object.keys(e),n=r.map(s=>e[s]);return t(n,(...s)=>s.reduce((o,l,c)=>(o[r[c]]=l,o),{}))},{withTypes:()=>y4}),Zj={},Xj={},Jj={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return typeof n=="symbol"?1:n===null?2:n===void 0?3:n!==n?4:0}const r=(n,i,s)=>{if(n!==i){const o=t(n),l=t(i);if(o===l&&o===0){if(ni)return s==="desc"?-1:1}return s==="desc"?l-o:o-l}return 0};e.compareValues=r})(Jj);var Qj={},Kh={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return typeof r=="symbol"||r instanceof Symbol}e.isSymbol=t})(Kh);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Kh,r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function i(s,o){return Array.isArray(s)?!1:typeof s=="number"||typeof s=="boolean"||s==null||t.isSymbol(s)?!0:typeof s=="string"&&(n.test(s)||!r.test(s))||o!=null&&Object.hasOwn(o,s)}e.isKey=i})(Qj);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Jj,r=Qj,n=Zc;function i(s,o,l,c){if(s==null)return[];l=c?void 0:l,Array.isArray(s)||(s=Object.values(s)),Array.isArray(o)||(o=o==null?[null]:[o]),o.length===0&&(o=[null]),Array.isArray(l)||(l=l==null?[]:[l]),l=l.map(m=>String(m));const d=(m,x)=>{let g=m;for(let b=0;bx==null||m==null?x:typeof m=="object"&&"key"in m?Object.hasOwn(x,m.key)?x[m.key]:d(x,m.path):typeof m=="function"?m(x):Array.isArray(m)?d(x,m):typeof x=="object"?x[m]:x,f=o.map(m=>(Array.isArray(m)&&m.length===1&&(m=m[0]),m==null||typeof m=="function"||Array.isArray(m)||r.isKey(m)?m:{key:m,path:n.toPath(m)}));return s.map(m=>({original:m,criteria:f.map(x=>u(x,m))})).slice().sort((m,x)=>{for(let g=0;gm.original)}e.orderBy=i})(Xj);var ew={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r,n=1){const i=[],s=Math.floor(n),o=(l,c)=>{for(let d=0;d1&&n.isIterateeCall(s,o[0],o[1])?o=[]:l>2&&n.isIterateeCall(o[0],o[1],o[2])&&(o=[o[0]]),t.orderBy(s,r.flatten(o),["asc"])}e.sortBy=i})(Zj);var v4=Zj.sortBy;const Qc=Tr(v4);var tw=e=>e.legend.settings,b4=e=>e.legend.size,j4=e=>e.legend.payload;I([j4,tw],(e,t)=>{var{itemSorter:r}=t,n=e.flat(1);return r?Qc(n,r):n});var Io=1;function w4(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],[t,r]=h.useState({height:0,left:0,top:0,width:0}),n=h.useCallback(i=>{if(i!=null){var s=i.getBoundingClientRect(),o={height:s.height,left:s.left,top:s.top,width:s.width};(Math.abs(o.height-t.height)>Io||Math.abs(o.left-t.left)>Io||Math.abs(o.top-t.top)>Io||Math.abs(o.width-t.width)>Io)&&r({height:o.height,left:o.left,top:o.top,width:o.width})}},[t.width,t.height,t.top,t.left,...e]);return[t,n]}function Ze(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var S4=typeof Symbol=="function"&&Symbol.observable||"@@observable",Vx=S4,dd=()=>Math.random().toString(36).substring(7).split("").join("."),N4={INIT:`@@redux/INIT${dd()}`,REPLACE:`@@redux/REPLACE${dd()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${dd()}`},Fl=N4;function Yh(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function rw(e,t,r){if(typeof e!="function")throw new Error(Ze(2));if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(Ze(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(Ze(1));return r(rw)(e,t)}let n=e,i=t,s=new Map,o=s,l=0,c=!1;function d(){o===s&&(o=new Map,s.forEach((b,v)=>{o.set(v,b)}))}function u(){if(c)throw new Error(Ze(3));return i}function f(b){if(typeof b!="function")throw new Error(Ze(4));if(c)throw new Error(Ze(5));let v=!0;d();const j=l++;return o.set(j,b),function(){if(v){if(c)throw new Error(Ze(6));v=!1,d(),o.delete(j),s=null}}}function p(b){if(!Yh(b))throw new Error(Ze(7));if(typeof b.type>"u")throw new Error(Ze(8));if(typeof b.type!="string")throw new Error(Ze(17));if(c)throw new Error(Ze(9));try{c=!0,i=n(i,b)}finally{c=!1}return(s=o).forEach(j=>{j()}),b}function m(b){if(typeof b!="function")throw new Error(Ze(10));n=b,p({type:Fl.REPLACE})}function x(){const b=f;return{subscribe(v){if(typeof v!="object"||v===null)throw new Error(Ze(11));function j(){const w=v;w.next&&w.next(u())}return j(),{unsubscribe:b(j)}},[Vx](){return this}}}return p({type:Fl.INIT}),{dispatch:p,subscribe:f,getState:u,replaceReducer:m,[Vx]:x}}function k4(e){Object.keys(e).forEach(t=>{const r=e[t];if(typeof r(void 0,{type:Fl.INIT})>"u")throw new Error(Ze(12));if(typeof r(void 0,{type:Fl.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Ze(13))})}function nw(e){const t=Object.keys(e),r={};for(let s=0;s"u")throw l&&l.type,new Error(Ze(14));d[f]=x,c=c||x!==m}return c=c||n.length!==Object.keys(o).length,c?d:o}}function Wl(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function P4(...e){return t=>(r,n)=>{const i=t(r,n);let s=()=>{throw new Error(Ze(15))};const o={getState:i.getState,dispatch:(c,...d)=>s(c,...d)},l=e.map(c=>c(o));return s=Wl(...l)(i.dispatch),{...i,dispatch:s}}}function iw(e){return Yh(e)&&"type"in e&&typeof e.type=="string"}var aw=Symbol.for("immer-nothing"),Yx=Symbol.for("immer-draftable"),Wt=Symbol.for("immer-state");function fr(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Ms=Object.getPrototypeOf;function vi(e){return!!e&&!!e[Wt]}function en(e){var t;return e?sw(e)||Array.isArray(e)||!!e[Yx]||!!((t=e.constructor)!=null&&t[Yx])||Js(e)||tu(e):!1}var _4=Object.prototype.constructor.toString(),Gx=new WeakMap;function sw(e){if(!e||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);if(t===null||t===Object.prototype)return!0;const r=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;if(r===Object)return!0;if(typeof r!="function")return!1;let n=Gx.get(r);return n===void 0&&(n=Function.toString.call(r),Gx.set(r,n)),n===_4}function Ul(e,t,r=!0){eu(e)===0?(r?Reflect.ownKeys(e):Object.keys(e)).forEach(i=>{t(i,e[i],e)}):e.forEach((n,i)=>t(i,n,e))}function eu(e){const t=e[Wt];return t?t.type_:Array.isArray(e)?1:Js(e)?2:tu(e)?3:0}function Lf(e,t){return eu(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function ow(e,t,r){const n=eu(e);n===2?e.set(t,r):n===3?e.add(r):e[t]=r}function C4(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Js(e){return e instanceof Map}function tu(e){return e instanceof Set}function Jn(e){return e.copy_||e.base_}function zf(e,t){if(Js(e))return new Map(e);if(tu(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const r=sw(e);if(t===!0||t==="class_only"&&!r){const n=Object.getOwnPropertyDescriptors(e);delete n[Wt];let i=Reflect.ownKeys(n);for(let s=0;s1&&Object.defineProperties(e,{set:$o,add:$o,clear:$o,delete:$o}),Object.freeze(e),t&&Object.values(e).forEach(r=>Gh(r,!0))),e}function A4(){fr(2)}var $o={value:A4};function ru(e){return e===null||typeof e!="object"?!0:Object.isFrozen(e)}var O4={};function bi(e){const t=O4[e];return t||fr(0,e),t}var Is;function lw(){return Is}function E4(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Zx(e,t){t&&(bi("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Rf(e){Bf(e),e.drafts_.forEach(D4),e.drafts_=null}function Bf(e){e===Is&&(Is=e.parent_)}function Xx(e){return Is=E4(Is,e)}function D4(e){const t=e[Wt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Jx(e,t){t.unfinalizedDrafts_=t.drafts_.length;const r=t.drafts_[0];return e!==void 0&&e!==r?(r[Wt].modified_&&(Rf(t),fr(4)),en(e)&&(e=ql(t,e),t.parent_||Hl(t,e)),t.patches_&&bi("Patches").generateReplacementPatches_(r[Wt].base_,e,t.patches_,t.inversePatches_)):e=ql(t,r,[]),Rf(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==aw?e:void 0}function ql(e,t,r){if(ru(t))return t;const n=e.immer_.shouldUseStrictIteration(),i=t[Wt];if(!i)return Ul(t,(s,o)=>Qx(e,i,t,s,o,r),n),t;if(i.scope_!==e)return t;if(!i.modified_)return Hl(e,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;const s=i.copy_;let o=s,l=!1;i.type_===3&&(o=new Set(s),s.clear(),l=!0),Ul(o,(c,d)=>Qx(e,i,s,c,d,r,l),n),Hl(e,s,!1),r&&e.patches_&&bi("Patches").generatePatches_(i,r,e.patches_,e.inversePatches_)}return i.copy_}function Qx(e,t,r,n,i,s,o){if(i==null||typeof i!="object"&&!o)return;const l=ru(i);if(!(l&&!o)){if(vi(i)){const c=s&&t&&t.type_!==3&&!Lf(t.assigned_,n)?s.concat(n):void 0,d=ql(e,i,c);if(ow(r,n,d),vi(d))e.canAutoFreeze_=!1;else return}else o&&r.add(i);if(en(i)&&!l){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1||t&&t.base_&&t.base_[n]===i&&l)return;ql(e,i),(!t||!t.scope_.parent_)&&typeof n!="symbol"&&(Js(r)?r.has(n):Object.prototype.propertyIsEnumerable.call(r,n))&&Hl(e,i)}}}function Hl(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Gh(t,r)}function T4(e,t){const r=Array.isArray(e),n={type_:r?1:0,scope_:t?t.scope_:lw(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=n,s=Zh;r&&(i=[n],s=$s);const{revoke:o,proxy:l}=Proxy.revocable(i,s);return n.draft_=l,n.revoke_=o,l}var Zh={get(e,t){if(t===Wt)return e;const r=Jn(e);if(!Lf(r,t))return M4(e,r,t);const n=r[t];return e.finalized_||!en(n)?n:n===fd(e.base_,t)?(pd(e),e.copy_[t]=Wf(n,e)):n},has(e,t){return t in Jn(e)},ownKeys(e){return Reflect.ownKeys(Jn(e))},set(e,t,r){const n=cw(Jn(e),t);if(n!=null&&n.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){const i=fd(Jn(e),t),s=i==null?void 0:i[Wt];if(s&&s.base_===r)return e.copy_[t]=r,e.assigned_[t]=!1,!0;if(C4(r,i)&&(r!==void 0||Lf(e.base_,t)))return!0;pd(e),Ff(e)}return e.copy_[t]===r&&(r!==void 0||t in e.copy_)||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_[t]=!0),!0},deleteProperty(e,t){return fd(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,pd(e),Ff(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const r=Jn(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:n.enumerable,value:r[t]}},defineProperty(){fr(11)},getPrototypeOf(e){return Ms(e.base_)},setPrototypeOf(){fr(12)}},$s={};Ul(Zh,(e,t)=>{$s[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});$s.deleteProperty=function(e,t){return $s.set.call(this,e,t,void 0)};$s.set=function(e,t,r){return Zh.set.call(this,e[0],t,r,e[0])};function fd(e,t){const r=e[Wt];return(r?Jn(r):e)[t]}function M4(e,t,r){var i;const n=cw(t,r);return n?"value"in n?n.value:(i=n.get)==null?void 0:i.call(e.draft_):void 0}function cw(e,t){if(!(t in e))return;let r=Ms(e);for(;r;){const n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=Ms(r)}}function Ff(e){e.modified_||(e.modified_=!0,e.parent_&&Ff(e.parent_))}function pd(e){e.copy_||(e.copy_=zf(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var I4=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(t,r,n)=>{if(typeof t=="function"&&typeof r!="function"){const s=r;r=t;const o=this;return function(c=s,...d){return o.produce(c,u=>r.call(this,u,...d))}}typeof r!="function"&&fr(6),n!==void 0&&typeof n!="function"&&fr(7);let i;if(en(t)){const s=Xx(this),o=Wf(t,void 0);let l=!0;try{i=r(o),l=!1}finally{l?Rf(s):Bf(s)}return Zx(s,n),Jx(i,s)}else if(!t||typeof t!="object"){if(i=r(t),i===void 0&&(i=t),i===aw&&(i=void 0),this.autoFreeze_&&Gh(i,!0),n){const s=[],o=[];bi("Patches").generateReplacementPatches_(t,i,s,o),n(s,o)}return i}else fr(1,t)},this.produceWithPatches=(t,r)=>{if(typeof t=="function")return(o,...l)=>this.produceWithPatches(o,c=>t(c,...l));let n,i;return[this.produce(t,r,(o,l)=>{n=o,i=l}),n,i]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),typeof(e==null?void 0:e.useStrictIteration)=="boolean"&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){en(e)||fr(8),vi(e)&&(e=Kr(e));const t=Xx(this),r=Wf(e,void 0);return r[Wt].isManual_=!0,Bf(t),r}finishDraft(e,t){const r=e&&e[Wt];(!r||!r.isManual_)&&fr(9);const{scope_:n}=r;return Zx(n,t),Jx(void 0,n)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let r;for(r=t.length-1;r>=0;r--){const i=t[r];if(i.path.length===0&&i.op==="replace"){e=i.value;break}}r>-1&&(t=t.slice(r+1));const n=bi("Patches").applyPatches_;return vi(e)?n(e,t):this.produce(e,i=>n(i,t))}};function Wf(e,t){const r=Js(e)?bi("MapSet").proxyMap_(e,t):tu(e)?bi("MapSet").proxySet_(e,t):T4(e,t);return(t?t.scope_:lw()).drafts_.push(r),r}function Kr(e){return vi(e)||fr(10,e),uw(e)}function uw(e){if(!en(e)||ru(e))return e;const t=e[Wt];let r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=zf(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=zf(e,!0);return Ul(r,(i,s)=>{ow(r,i,uw(s))},n),t&&(t.finalized_=!1),r}var Uf=new I4,dw=Uf.produce,$4=Uf.setUseStrictIteration.bind(Uf);function fw(e){return({dispatch:r,getState:n})=>i=>s=>typeof s=="function"?s(r,n,e):i(s)}var L4=fw(),z4=fw,R4=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?Wl:Wl.apply(null,arguments)};function ar(e,t){function r(...n){if(t){let i=t(...n);if(!i)throw new Error(Bt(0));return{type:e,payload:i.payload,..."meta"in i&&{meta:i.meta},..."error"in i&&{error:i.error}}}return{type:e,payload:n[0]}}return r.toString=()=>`${e}`,r.type=e,r.match=n=>iw(n)&&n.type===e,r}var pw=class Qa extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,Qa.prototype)}static get[Symbol.species](){return Qa}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new Qa(...t[0].concat(this)):new Qa(...t.concat(this))}};function e0(e){return en(e)?dw(e,()=>{}):e}function Lo(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}function B4(e){return typeof e=="boolean"}var F4=()=>function(t){const{thunk:r=!0,immutableCheck:n=!0,serializableCheck:i=!0,actionCreatorCheck:s=!0}=t??{};let o=new pw;return r&&(B4(r)?o.push(L4):o.push(z4(r.extraArgument))),o},hw="RTK_autoBatch",Le=()=>e=>({payload:e,meta:{[hw]:!0}}),t0=e=>t=>{setTimeout(t,e)},mw=(e={type:"raf"})=>t=>(...r)=>{const n=t(...r);let i=!0,s=!1,o=!1;const l=new Set,c=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:t0(10):e.type==="callback"?e.queueNotification:t0(e.timeout),d=()=>{o=!1,s&&(s=!1,l.forEach(u=>u()))};return Object.assign({},n,{subscribe(u){const f=()=>i&&u(),p=n.subscribe(f);return l.add(u),()=>{p(),l.delete(u)}},dispatch(u){var f;try{return i=!((f=u==null?void 0:u.meta)!=null&&f[hw]),s=!i,s&&(o||(o=!0,c(d))),n.dispatch(u)}finally{i=!0}}})},W4=e=>function(r){const{autoBatch:n=!0}=r??{};let i=new pw(e);return n&&i.push(mw(typeof n=="object"?n:void 0)),i};function U4(e){const t=F4(),{reducer:r=void 0,middleware:n,devTools:i=!0,preloadedState:s=void 0,enhancers:o=void 0}=e||{};let l;if(typeof r=="function")l=r;else if(Yh(r))l=nw(r);else throw new Error(Bt(1));let c;typeof n=="function"?c=n(t):c=t();let d=Wl;i&&(d=R4({trace:!1,...typeof i=="object"&&i}));const u=P4(...c),f=W4(u);let p=typeof o=="function"?o(f):f();const m=d(...p);return rw(l,s,m)}function gw(e){const t={},r=[];let n;const i={addCase(s,o){const l=typeof s=="string"?s:s.type;if(!l)throw new Error(Bt(28));if(l in t)throw new Error(Bt(29));return t[l]=o,i},addAsyncThunk(s,o){return o.pending&&(t[s.pending.type]=o.pending),o.rejected&&(t[s.rejected.type]=o.rejected),o.fulfilled&&(t[s.fulfilled.type]=o.fulfilled),o.settled&&r.push({matcher:s.settled,reducer:o.settled}),i},addMatcher(s,o){return r.push({matcher:s,reducer:o}),i},addDefaultCase(s){return n=s,i}};return e(i),[t,r,n]}$4(!1);function q4(e){return typeof e=="function"}function H4(e,t){let[r,n,i]=gw(t),s;if(q4(e))s=()=>e0(e());else{const l=e0(e);s=()=>l}function o(l=s(),c){let d=[r[c.type],...n.filter(({matcher:u})=>u(c)).map(({reducer:u})=>u)];return d.filter(u=>!!u).length===0&&(d=[i]),d.reduce((u,f)=>{if(f)if(vi(u)){const m=f(u,c);return m===void 0?u:m}else{if(en(u))return dw(u,p=>f(p,c));{const p=f(u,c);if(p===void 0){if(u===null)return u;throw Error("A case reducer on a non-draftable value must not return undefined")}return p}}return u},l)}return o.getInitialState=s,o}var K4="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",V4=(e=21)=>{let t="",r=e;for(;r--;)t+=K4[Math.random()*64|0];return t},Y4=Symbol.for("rtk-slice-createasyncthunk");function G4(e,t){return`${e}/${t}`}function Z4({creators:e}={}){var r;const t=(r=e==null?void 0:e.asyncThunk)==null?void 0:r[Y4];return function(i){const{name:s,reducerPath:o=s}=i;if(!s)throw new Error(Bt(11));const l=(typeof i.reducers=="function"?i.reducers(J4()):i.reducers)||{},c=Object.keys(l),d={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},u={addCase(w,S){const N=typeof w=="string"?w:w.type;if(!N)throw new Error(Bt(12));if(N in d.sliceCaseReducersByType)throw new Error(Bt(13));return d.sliceCaseReducersByType[N]=S,u},addMatcher(w,S){return d.sliceMatchers.push({matcher:w,reducer:S}),u},exposeAction(w,S){return d.actionCreators[w]=S,u},exposeCaseReducer(w,S){return d.sliceCaseReducersByName[w]=S,u}};c.forEach(w=>{const S=l[w],N={reducerName:w,type:G4(s,w),createNotation:typeof i.reducers=="function"};eE(S)?rE(N,S,u,t):Q4(N,S,u)});function f(){const[w={},S=[],N=void 0]=typeof i.extraReducers=="function"?gw(i.extraReducers):[i.extraReducers],P={...w,...d.sliceCaseReducersByType};return H4(i.initialState,_=>{for(let T in P)_.addCase(T,P[T]);for(let T of d.sliceMatchers)_.addMatcher(T.matcher,T.reducer);for(let T of S)_.addMatcher(T.matcher,T.reducer);N&&_.addDefaultCase(N)})}const p=w=>w,m=new Map,x=new WeakMap;let g;function b(w,S){return g||(g=f()),g(w,S)}function v(){return g||(g=f()),g.getInitialState()}function j(w,S=!1){function N(_){let T=_[w];return typeof T>"u"&&S&&(T=Lo(x,N,v)),T}function P(_=p){const T=Lo(m,S,()=>new WeakMap);return Lo(T,_,()=>{const $={};for(const[M,C]of Object.entries(i.selectors??{}))$[M]=X4(C,_,()=>Lo(x,_,v),S);return $})}return{reducerPath:w,getSelectors:P,get selectors(){return P(N)},selectSlice:N}}const y={name:s,reducer:b,actions:d.actionCreators,caseReducers:d.sliceCaseReducersByName,getInitialState:v,...j(o),injectInto(w,{reducerPath:S,...N}={}){const P=S??o;return w.inject({reducerPath:P,reducer:b},N),{...y,...j(P,!0)}}};return y}}function X4(e,t,r,n){function i(s,...o){let l=t(s);return typeof l>"u"&&n&&(l=r()),e(l,...o)}return i.unwrapped=e,i}var At=Z4();function J4(){function e(t,r){return{_reducerDefinitionType:"asyncThunk",payloadCreator:t,...r}}return e.withTypes=()=>e,{reducer(t){return Object.assign({[t.name](...r){return t(...r)}}[t.name],{_reducerDefinitionType:"reducer"})},preparedReducer(t,r){return{_reducerDefinitionType:"reducerWithPrepare",prepare:t,reducer:r}},asyncThunk:e}}function Q4({type:e,reducerName:t,createNotation:r},n,i){let s,o;if("reducer"in n){if(r&&!tE(n))throw new Error(Bt(17));s=n.reducer,o=n.prepare}else s=n;i.addCase(e,s).exposeCaseReducer(t,s).exposeAction(t,o?ar(e,o):ar(e))}function eE(e){return e._reducerDefinitionType==="asyncThunk"}function tE(e){return e._reducerDefinitionType==="reducerWithPrepare"}function rE({type:e,reducerName:t},r,n,i){if(!i)throw new Error(Bt(18));const{payloadCreator:s,fulfilled:o,pending:l,rejected:c,settled:d,options:u}=r,f=i(e,s,u);n.exposeAction(t,f),o&&n.addCase(f.fulfilled,o),l&&n.addCase(f.pending,l),c&&n.addCase(f.rejected,c),d&&n.addMatcher(f.settled,d),n.exposeCaseReducer(t,{fulfilled:o||zo,pending:l||zo,rejected:c||zo,settled:d||zo})}function zo(){}var nE="task",xw="listener",yw="completed",Xh="cancelled",iE=`task-${Xh}`,aE=`task-${yw}`,qf=`${xw}-${Xh}`,sE=`${xw}-${yw}`,nu=class{constructor(e){ho(this,"name","TaskAbortError");ho(this,"message");this.code=e,this.message=`${nE} ${Xh} (reason: ${e})`}},Jh=(e,t)=>{if(typeof e!="function")throw new TypeError(Bt(32))},Kl=()=>{},vw=(e,t=Kl)=>(e.catch(t),e),bw=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),li=(e,t)=>{const r=e.signal;r.aborted||("reason"in r||Object.defineProperty(r,"reason",{enumerable:!0,value:t,configurable:!0,writable:!0}),e.abort(t))},ci=e=>{if(e.aborted){const{reason:t}=e;throw new nu(t)}};function jw(e,t){let r=Kl;return new Promise((n,i)=>{const s=()=>i(new nu(e.reason));if(e.aborted){s();return}r=bw(e,s),t.finally(()=>r()).then(n,i)}).finally(()=>{r=Kl})}var oE=async(e,t)=>{try{return await Promise.resolve(),{status:"ok",value:await e()}}catch(r){return{status:r instanceof nu?"cancelled":"rejected",error:r}}finally{t==null||t()}},Vl=e=>t=>vw(jw(e,t).then(r=>(ci(e),r))),ww=e=>{const t=Vl(e);return r=>t(new Promise(n=>setTimeout(n,r)))},{assign:na}=Object,r0={},iu="listenerMiddleware",lE=(e,t)=>{const r=n=>bw(e,()=>li(n,e.reason));return(n,i)=>{Jh(n);const s=new AbortController;r(s);const o=oE(async()=>{ci(e),ci(s.signal);const l=await n({pause:Vl(s.signal),delay:ww(s.signal),signal:s.signal});return ci(s.signal),l},()=>li(s,aE));return i!=null&&i.autoJoin&&t.push(o.catch(Kl)),{result:Vl(e)(o),cancel(){li(s,iE)}}}},cE=(e,t)=>{const r=async(n,i)=>{ci(t);let s=()=>{};const l=[new Promise((c,d)=>{let u=e({predicate:n,effect:(f,p)=>{p.unsubscribe(),c([f,p.getState(),p.getOriginalState()])}});s=()=>{u(),d()}})];i!=null&&l.push(new Promise(c=>setTimeout(c,i,null)));try{const c=await jw(t,Promise.race(l));return ci(t),c}finally{s()}};return(n,i)=>vw(r(n,i))},Sw=e=>{let{type:t,actionCreator:r,matcher:n,predicate:i,effect:s}=e;if(t)i=ar(t).match;else if(r)t=r.type,i=r.match;else if(n)i=n;else if(!i)throw new Error(Bt(21));return Jh(s),{predicate:i,type:t,effect:s}},Nw=na(e=>{const{type:t,predicate:r,effect:n}=Sw(e);return{id:V4(),effect:n,type:t,predicate:r,pending:new Set,unsubscribe:()=>{throw new Error(Bt(22))}}},{withTypes:()=>Nw}),n0=(e,t)=>{const{type:r,effect:n,predicate:i}=Sw(t);return Array.from(e.values()).find(s=>(typeof r=="string"?s.type===r:s.predicate===i)&&s.effect===n)},Hf=e=>{e.pending.forEach(t=>{li(t,qf)})},uE=(e,t)=>()=>{for(const r of t.keys())Hf(r);e.clear()},i0=(e,t,r)=>{try{e(t,r)}catch(n){setTimeout(()=>{throw n},0)}},kw=na(ar(`${iu}/add`),{withTypes:()=>kw}),dE=ar(`${iu}/removeAll`),Pw=na(ar(`${iu}/remove`),{withTypes:()=>Pw}),fE=(...e)=>{console.error(`${iu}/error`,...e)},Qs=(e={})=>{const t=new Map,r=new Map,n=m=>{const x=r.get(m)??0;r.set(m,x+1)},i=m=>{const x=r.get(m)??1;x===1?r.delete(m):r.set(m,x-1)},{extra:s,onError:o=fE}=e;Jh(o);const l=m=>(m.unsubscribe=()=>t.delete(m.id),t.set(m.id,m),x=>{m.unsubscribe(),x!=null&&x.cancelActive&&Hf(m)}),c=m=>{const x=n0(t,m)??Nw(m);return l(x)};na(c,{withTypes:()=>c});const d=m=>{const x=n0(t,m);return x&&(x.unsubscribe(),m.cancelActive&&Hf(x)),!!x};na(d,{withTypes:()=>d});const u=async(m,x,g,b)=>{const v=new AbortController,j=cE(c,v.signal),y=[];try{m.pending.add(v),n(m),await Promise.resolve(m.effect(x,na({},g,{getOriginalState:b,condition:(w,S)=>j(w,S).then(Boolean),take:j,delay:ww(v.signal),pause:Vl(v.signal),extra:s,signal:v.signal,fork:lE(v.signal,y),unsubscribe:m.unsubscribe,subscribe:()=>{t.set(m.id,m)},cancelActiveListeners:()=>{m.pending.forEach((w,S,N)=>{w!==v&&(li(w,qf),N.delete(w))})},cancel:()=>{li(v,qf),m.pending.delete(v)},throwIfCancelled:()=>{ci(v.signal)}})))}catch(w){w instanceof nu||i0(o,w,{raisedBy:"effect"})}finally{await Promise.all(y),li(v,sE),i(m),m.pending.delete(v)}},f=uE(t,r);return{middleware:m=>x=>g=>{if(!iw(g))return x(g);if(kw.match(g))return c(g.payload);if(dE.match(g)){f();return}if(Pw.match(g))return d(g.payload);let b=m.getState();const v=()=>{if(b===r0)throw new Error(Bt(23));return b};let j;try{if(j=x(g),t.size>0){const y=m.getState(),w=Array.from(t.values());for(const S of w){let N=!1;try{N=S.predicate(g,y,b)}catch(P){N=!1,i0(o,P,{raisedBy:"predicate"})}N&&u(S,g,m,v)}}}finally{b=r0}return j},startListening:c,stopListening:d,clearListeners:f}};function Bt(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var pE={layoutType:"horizontal",width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},_w=At({name:"chartLayout",initialState:pE,reducers:{setLayout(e,t){e.layoutType=t.payload},setChartSize(e,t){e.width=t.payload.width,e.height=t.payload.height},setMargin(e,t){var r,n,i,s;e.margin.top=(r=t.payload.top)!==null&&r!==void 0?r:0,e.margin.right=(n=t.payload.right)!==null&&n!==void 0?n:0,e.margin.bottom=(i=t.payload.bottom)!==null&&i!==void 0?i:0,e.margin.left=(s=t.payload.left)!==null&&s!==void 0?s:0},setScale(e,t){e.scale=t.payload}}}),{setMargin:hE,setLayout:mE,setChartSize:gE,setScale:xE}=_w.actions,yE=_w.reducer;function Cw(e,t,r){return Array.isArray(e)&&e&&t+r!==0?e.slice(t,r+1):e}function a0(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Yi(e){for(var t=1;t{if(t&&r){var{width:n,height:i}=r,{align:s,verticalAlign:o,layout:l}=t;if((l==="vertical"||l==="horizontal"&&o==="middle")&&s!=="center"&&Y(e[s]))return Yi(Yi({},e),{},{[s]:e[s]+(n||0)});if((l==="horizontal"||l==="vertical"&&s==="center")&&o!=="middle"&&Y(e[o]))return Yi(Yi({},e),{},{[o]:e[o]+(i||0)})}return e},Mr=(e,t)=>e==="horizontal"&&t==="xAxis"||e==="vertical"&&t==="yAxis"||e==="centric"&&t==="angleAxis"||e==="radial"&&t==="radiusAxis",Aw=(e,t,r,n)=>{if(n)return e.map(l=>l.coordinate);var i,s,o=e.map(l=>(l.coordinate===t&&(i=!0),l.coordinate===r&&(s=!0),l.coordinate));return i||o.push(t),s||o.push(r),o},Ow=(e,t,r)=>{if(!e)return null;var{duplicateDomain:n,type:i,range:s,scale:o,realScaleType:l,isCategorical:c,categoricalDomain:d,tickCount:u,ticks:f,niceTicks:p,axisType:m}=e;if(!o)return null;var x=l==="scaleBand"&&o.bandwidth?o.bandwidth()/2:2,g=i==="category"&&o.bandwidth?o.bandwidth()/x:0;if(g=m==="angleAxis"&&s&&s.length>=2?Jt(s[0]-s[1])*2*g:g,f||p){var b=(f||p||[]).map((v,j)=>{var y=n?n.indexOf(v):v;return{coordinate:o(y)+g,value:v,offset:g,index:j}});return b.filter(v=>!yr(v.coordinate))}return c&&d?d.map((v,j)=>({coordinate:o(v)+g,value:v,index:j,offset:g})):o.ticks&&u!=null?o.ticks(u).map((v,j)=>({coordinate:o(v)+g,value:v,offset:g,index:j})):o.domain().map((v,j)=>({coordinate:o(v)+g,value:n?n[v]:v,index:j,offset:g}))},s0=1e-4,SE=e=>{var t=e.domain();if(!(!t||t.length<=2)){var r=t.length,n=e.range(),i=Math.min(n[0],n[1])-s0,s=Math.max(n[0],n[1])+s0,o=e(t[0]),l=e(t[r-1]);(os||ls)&&e.domain([t[0],t[r-1]])}},NE=e=>{var t=e.length;if(!(t<=0))for(var r=0,n=e[0].length;r=0?(e[o][r][0]=i,e[o][r][1]=i+l,i=e[o][r][1]):(e[o][r][0]=s,e[o][r][1]=s+l,s=e[o][r][1])}},kE=e=>{var t=e.length;if(!(t<=0))for(var r=0,n=e[0].length;r=0?(e[s][r][0]=i,e[s][r][1]=i+o,i=e[s][r][1]):(e[s][r][0]=0,e[s][r][1]=0)}},PE={sign:NE,expand:$6,none:pa,silhouette:L6,wiggle:z6,positive:kE},_E=(e,t,r)=>{var n=PE[r],i=I6().keys(t).value((s,o)=>Number(et(s,o,0))).order(If).offset(n);return i(e)};function CE(e){return e==null?void 0:String(e)}function Yl(e){var{axis:t,ticks:r,bandSize:n,entry:i,index:s,dataKey:o}=e;if(t.type==="category"){if(!t.allowDuplicatedCategory&&t.dataKey&&!Re(i[t.dataKey])){var l=Cj(r,"value",i[t.dataKey]);if(l)return l.coordinate+n/2}return r[s]?r[s].coordinate+n/2:null}var c=et(i,Re(o)?t.dataKey:o);return Re(c)?null:t.scale(c)}var AE=e=>{var t=e.flat(2).filter(Y);return[Math.min(...t),Math.max(...t)]},OE=e=>[e[0]===1/0?0:e[0],e[1]===-1/0?0:e[1]],EE=(e,t,r)=>{if(e!=null)return OE(Object.keys(e).reduce((n,i)=>{var s=e[i],{stackedData:o}=s,l=o.reduce((c,d)=>{var u=Cw(d,t,r),f=AE(u);return[Math.min(c[0],f[0]),Math.max(c[1],f[1])]},[1/0,-1/0]);return[Math.min(l[0],n[0]),Math.max(l[1],n[1])]},[1/0,-1/0]))},o0=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,l0=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,ha=(e,t,r)=>{if(e&&e.scale&&e.scale.bandwidth){var n=e.scale.bandwidth();if(!r||n>0)return n}if(e&&t&&t.length>=2){for(var i=Qc(t,u=>u.coordinate),s=1/0,o=1,l=i.length;o{if(t==="horizontal")return e.chartX;if(t==="vertical")return e.chartY},TE=(e,t)=>t==="centric"?e.angle:e.radius,ln=e=>e.layout.width,cn=e=>e.layout.height,ME=e=>e.layout.scale,Ew=e=>e.layout.margin,su=I(e=>e.cartesianAxis.xAxis,e=>Object.values(e)),ou=I(e=>e.cartesianAxis.yAxis,e=>Object.values(e)),IE="data-recharts-item-index",$E="data-recharts-item-data-key",eo=60;function u0(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Ro(e){for(var t=1;te.brush.height;function FE(e){var t=ou(e);return t.reduce((r,n)=>{if(n.orientation==="left"&&!n.mirror&&!n.hide){var i=typeof n.width=="number"?n.width:eo;return r+i}return r},0)}function WE(e){var t=ou(e);return t.reduce((r,n)=>{if(n.orientation==="right"&&!n.mirror&&!n.hide){var i=typeof n.width=="number"?n.width:eo;return r+i}return r},0)}function UE(e){var t=su(e);return t.reduce((r,n)=>n.orientation==="top"&&!n.mirror&&!n.hide?r+n.height:r,0)}function qE(e){var t=su(e);return t.reduce((r,n)=>n.orientation==="bottom"&&!n.mirror&&!n.hide?r+n.height:r,0)}var rt=I([ln,cn,Ew,BE,FE,WE,UE,qE,tw,b4],(e,t,r,n,i,s,o,l,c,d)=>{var u={left:(r.left||0)+i,right:(r.right||0)+s},f={top:(r.top||0)+o,bottom:(r.bottom||0)+l},p=Ro(Ro({},f),u),m=p.bottom;p.bottom+=n,p=wE(p,c,d);var x=e-p.left-p.right,g=t-p.top-p.bottom;return Ro(Ro({brushBottom:m},p),{},{width:Math.max(x,0),height:Math.max(g,0)})}),HE=I(rt,e=>({x:e.left,y:e.top,width:e.width,height:e.height})),Dw=I(ln,cn,(e,t)=>({x:0,y:0,width:e,height:t})),KE=h.createContext(null),pt=()=>h.useContext(KE)!=null,lu=e=>e.brush,cu=I([lu,rt,Ew],(e,t,r)=>({height:e.height,x:Y(e.x)?e.x:t.left,y:Y(e.y)?e.y:t.top+t.height+t.brushBottom-((r==null?void 0:r.bottom)||0),width:Y(e.width)?e.width:t.width})),Tw={},Mw={},Iw={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r,n,{signal:i,edges:s}={}){let o,l=null;const c=s!=null&&s.includes("leading"),d=s==null||s.includes("trailing"),u=()=>{l!==null&&(r.apply(o,l),o=void 0,l=null)},f=()=>{d&&u(),g()};let p=null;const m=()=>{p!=null&&clearTimeout(p),p=setTimeout(()=>{p=null,f()},n)},x=()=>{p!==null&&(clearTimeout(p),p=null)},g=()=>{x(),o=void 0,l=null},b=()=>{u()},v=function(...j){if(i!=null&&i.aborted)return;o=this,l=j;const y=p==null;m(),c&&y&&u()};return v.schedule=m,v.cancel=g,v.flush=b,i==null||i.addEventListener("abort",g,{once:!0}),v}e.debounce=t})(Iw);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Iw;function r(n,i=0,s={}){typeof s!="object"&&(s={});const{leading:o=!1,trailing:l=!0,maxWait:c}=s,d=Array(2);o&&(d[0]="leading"),l&&(d[1]="trailing");let u,f=null;const p=t.debounce(function(...g){u=n.apply(this,g),f=null},i,{edges:d}),m=function(...g){return c!=null&&(f===null&&(f=Date.now()),Date.now()-f>=c)?(u=n.apply(this,g),f=Date.now(),p.cancel(),p.schedule(),u):(p.apply(this,g),u)},x=()=>(p.flush(),u);return m.cancel=p.cancel,m.flush=x,m}e.debounce=r})(Mw);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Mw;function r(n,i=0,s={}){const{leading:o=!0,trailing:l=!0}=s;return t.debounce(n,i,{leading:o,maxWait:i,trailing:l})}e.throttle=r})(Tw);var VE=Tw.throttle;const YE=Tr(VE);var Gl=function(t,r){for(var n=arguments.length,i=new Array(n>2?n-2:0),s=2;s{var{width:n="100%",height:i="100%",aspect:s,maxHeight:o}=r,l=Qr(n)?e:Number(n),c=Qr(i)?t:Number(i);return s&&s>0&&(l?c=l/s:c&&(l=c*s),o&&c!=null&&c>o&&(c=o)),{calculatedWidth:l,calculatedHeight:c}},GE={width:0,height:0,overflow:"visible"},ZE={width:0,overflowX:"visible"},XE={height:0,overflowY:"visible"},JE={},QE=e=>{var{width:t,height:r}=e,n=Qr(t),i=Qr(r);return n&&i?GE:n?ZE:i?XE:JE};function e3(e){var{width:t,height:r,aspect:n}=e,i=t,s=r;return i===void 0&&s===void 0?(i="100%",s="100%"):i===void 0?i=n&&n>0?void 0:"100%":s===void 0&&(s=n&&n>0?void 0:"100%"),{width:i,height:s}}function _e(e){return Number.isFinite(e)}function Er(e){return typeof e=="number"&&e>0&&Number.isFinite(e)}function Kf(){return Kf=Object.assign?Object.assign.bind():function(e){for(var t=1;t({width:r,height:n}),[r,n]);return i3(i)?h.createElement(Lw.Provider,{value:i},t):null}var Qh=()=>h.useContext(Lw),a3=h.forwardRef((e,t)=>{var{aspect:r,initialDimension:n={width:-1,height:-1},width:i,height:s,minWidth:o=0,minHeight:l,maxHeight:c,children:d,debounce:u=0,id:f,className:p,onResize:m,style:x={}}=e,g=h.useRef(null),b=h.useRef();b.current=m,h.useImperativeHandle(t,()=>g.current);var[v,j]=h.useState({containerWidth:n.width,containerHeight:n.height}),y=h.useCallback((_,T)=>{j($=>{var M=Math.round(_),C=Math.round(T);return $.containerWidth===M&&$.containerHeight===C?$:{containerWidth:M,containerHeight:C}})},[]);h.useEffect(()=>{if(g.current==null||typeof ResizeObserver>"u")return ka;var _=C=>{var R,{width:q,height:Z}=C[0].contentRect;y(q,Z),(R=b.current)===null||R===void 0||R.call(b,q,Z)};u>0&&(_=YE(_,u,{trailing:!0,leading:!1}));var T=new ResizeObserver(_),{width:$,height:M}=g.current.getBoundingClientRect();return y($,M),T.observe(g.current),()=>{T.disconnect()}},[y,u]);var{containerWidth:w,containerHeight:S}=v;Gl(!r||r>0,"The aspect(%s) must be greater than zero.",r);var{calculatedWidth:N,calculatedHeight:P}=$w(w,S,{width:i,height:s,aspect:r,maxHeight:c});return Gl(N!=null&&N>0||P!=null&&P>0,`The width(%s) and height(%s) of chart should be greater than 0, + */const VO=[["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"}]],$x=ee("zap",VO);function Ge({to:e,icon:t,label:r,isActive:n}){return a.jsxs("a",{href:e,className:`flex items-center gap-3 px-3 py-2 rounded-lg text-sm font-medium transition-colors ${n?"bg-blue-50 text-blue-600":"text-gray-700 hover:bg-gray-50"}`,children:[a.jsx("span",{className:"flex-shrink-0",children:t}),a.jsx("span",{children:r})]})}function Do({title:e,children:t}){return a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:"px-3 mb-2",children:a.jsx("h3",{className:"text-xs font-semibold text-gray-400 uppercase tracking-wider",children:e})}),t]})}function X({children:e}){const t=dt(),r=_i(),{user:n,logout:i}=Ph(),[s,o]=h.useState(null);h.useEffect(()=>{(async()=>{try{const u=await B.getVersion();o(u)}catch(u){console.error("Failed to fetch version info:",u)}})()},[]);const l=()=>{i(),t("/login")},c=(d,u=!0)=>u?r.pathname===d:r.pathname.startsWith(d);return a.jsxs("div",{className:"flex min-h-screen bg-gray-50",children:[a.jsxs("div",{className:"w-64 bg-white border-r border-gray-200 flex flex-col",style:{position:"sticky",top:0,height:"100vh",overflowY:"auto"},children:[a.jsxs("div",{className:"px-6 py-5 border-b border-gray-200",children:[a.jsx("h1",{className:"text-lg font-semibold text-gray-900",children:"Dutchie Analytics"}),a.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:n==null?void 0:n.email})]}),a.jsxs("nav",{className:"flex-1 px-3 py-4 space-y-6",children:[a.jsxs(Do,{title:"Main",children:[a.jsx(Ge,{to:"/",icon:a.jsx(pO,{className:"w-4 h-4"}),label:"Dashboard",isActive:c("/",!0)}),a.jsx(Ge,{to:"/dispensaries",icon:a.jsx(Ln,{className:"w-4 h-4"}),label:"Dispensaries",isActive:c("/dispensaries")}),a.jsx(Ge,{to:"/categories",icon:a.jsx(sO,{className:"w-4 h-4"}),label:"Categories",isActive:c("/categories")}),a.jsx(Ge,{to:"/products",icon:a.jsx(Ct,{className:"w-4 h-4"}),label:"Products",isActive:c("/products")}),a.jsx(Ge,{to:"/campaigns",icon:a.jsx(rj,{className:"w-4 h-4"}),label:"Campaigns",isActive:c("/campaigns")}),a.jsx(Ge,{to:"/analytics",icon:a.jsx(zn,{className:"w-4 h-4"}),label:"Analytics",isActive:c("/analytics")})]}),a.jsxs(Do,{title:"AZ Data",children:[a.jsx(Ge,{to:"/wholesale-analytics",icon:a.jsx(zn,{className:"w-4 h-4"}),label:"Wholesale Analytics",isActive:c("/wholesale-analytics")}),a.jsx(Ge,{to:"/az",icon:a.jsx(Il,{className:"w-4 h-4"}),label:"AZ Stores",isActive:c("/az",!1)}),a.jsx(Ge,{to:"/az-schedule",icon:a.jsx(Ch,{className:"w-4 h-4"}),label:"AZ Schedule",isActive:c("/az-schedule")})]}),a.jsxs(Do,{title:"Scraper",children:[a.jsx(Ge,{to:"/scraper-tools",icon:a.jsx(HO,{className:"w-4 h-4"}),label:"Tools",isActive:c("/scraper-tools")}),a.jsx(Ge,{to:"/scraper-schedule",icon:a.jsx(xr,{className:"w-4 h-4"}),label:"Schedule",isActive:c("/scraper-schedule")}),a.jsx(Ge,{to:"/scraper-monitor",icon:a.jsx(na,{className:"w-4 h-4"}),label:"Monitor",isActive:c("/scraper-monitor")})]}),a.jsxs(Do,{title:"System",children:[a.jsx(Ge,{to:"/changes",icon:a.jsx(_r,{className:"w-4 h-4"}),label:"Change Approval",isActive:c("/changes")}),a.jsx(Ge,{to:"/api-permissions",icon:a.jsx(uO,{className:"w-4 h-4"}),label:"API Permissions",isActive:c("/api-permissions")}),a.jsx(Ge,{to:"/proxies",icon:a.jsx(sl,{className:"w-4 h-4"}),label:"Proxies",isActive:c("/proxies")}),a.jsx(Ge,{to:"/logs",icon:a.jsx(iO,{className:"w-4 h-4"}),label:"Logs",isActive:c("/logs")}),a.jsx(Ge,{to:"/settings",icon:a.jsx(AO,{className:"w-4 h-4"}),label:"Settings",isActive:c("/settings")})]})]}),a.jsx("div",{className:"px-3 py-4 border-t border-gray-200",children:a.jsxs("button",{onClick:l,className:"w-full flex items-center gap-3 px-3 py-2 rounded-lg text-sm font-medium text-red-600 hover:bg-red-50 transition-colors",children:[a.jsx(mO,{className:"w-4 h-4"}),a.jsx("span",{children:"Logout"})]})}),s&&a.jsxs("div",{className:"px-3 py-2 border-t border-gray-200 bg-gray-50",children:[a.jsxs("p",{className:"text-xs text-gray-500 text-center",children:[s.build_version," (",s.git_sha.slice(0,7),")"]}),a.jsx("p",{className:"text-xs text-gray-400 text-center mt-0.5",children:s.image_tag})]})]}),a.jsx("div",{className:"flex-1 overflow-y-auto",children:a.jsx("div",{className:"max-w-7xl mx-auto px-8 py-8",children:e})})]})}function aj(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t{var[n]=r;return sj(n)||oj(n)});return Object.fromEntries(t)}function qc(e){if(e==null)return null;if(h.isValidElement(e)&&typeof e.props=="object"&&e.props!==null){var t=e.props;return nr(t)}return typeof e=="object"&&!Array.isArray(e)?nr(e):null}function ut(e){var t=Object.entries(e).filter(r=>{var[n]=r;return sj(n)||oj(n)||Oh(n)});return Object.fromEntries(t)}function ZO(e){return e==null?null:h.isValidElement(e)?ut(e.props):typeof e=="object"&&!Array.isArray(e)?ut(e):null}var XO=["children","width","height","viewBox","className","style","title","desc"];function Of(){return Of=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{children:r,width:n,height:i,viewBox:s,className:o,style:l,title:c,desc:d}=e,u=JO(e,XO),f=s||{width:n,height:i,x:0,y:0},p=ce("recharts-surface",o);return h.createElement("svg",Of({},ut(u),{className:p,width:n,height:i,style:l,viewBox:"".concat(f.x," ").concat(f.y," ").concat(f.width," ").concat(f.height),ref:t}),h.createElement("title",null,c),h.createElement("desc",null,d),r)}),e6=["children","className"];function Ef(){return Ef=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{children:r,className:n}=e,i=t6(e,e6),s=ce("recharts-layer",n);return h.createElement("g",Ef({className:s},ut(i),{ref:t}),r)}),n6=h.createContext(null);function he(e){return function(){return e}}const cj=Math.cos,$l=Math.sin,vr=Math.sqrt,Ll=Math.PI,Hc=2*Ll,Df=Math.PI,Tf=2*Df,Xn=1e-6,i6=Tf-Xn;function uj(e){this._+=e[0];for(let t=1,r=e.length;t=0))throw new Error(`invalid digits: ${e}`);if(t>15)return uj;const r=10**t;return function(n){this._+=n[0];for(let i=1,s=n.length;iXn)if(!(Math.abs(f*c-d*u)>Xn)||!s)this._append`L${this._x1=t},${this._y1=r}`;else{let m=n-o,x=i-l,g=c*c+d*d,b=m*m+x*x,v=Math.sqrt(g),j=Math.sqrt(p),y=s*Math.tan((Df-Math.acos((g+p-b)/(2*v*j)))/2),w=y/j,S=y/v;Math.abs(w-1)>Xn&&this._append`L${t+w*u},${r+w*f}`,this._append`A${s},${s},0,0,${+(f*m>u*x)},${this._x1=t+S*c},${this._y1=r+S*d}`}}arc(t,r,n,i,s,o){if(t=+t,r=+r,n=+n,o=!!o,n<0)throw new Error(`negative radius: ${n}`);let l=n*Math.cos(i),c=n*Math.sin(i),d=t+l,u=r+c,f=1^o,p=o?i-s:s-i;this._x1===null?this._append`M${d},${u}`:(Math.abs(this._x1-d)>Xn||Math.abs(this._y1-u)>Xn)&&this._append`L${d},${u}`,n&&(p<0&&(p=p%Tf+Tf),p>i6?this._append`A${n},${n},0,1,${f},${t-l},${r-c}A${n},${n},0,1,${f},${this._x1=d},${this._y1=u}`:p>Xn&&this._append`A${n},${n},0,${+(p>=Df)},${f},${this._x1=t+n*Math.cos(s)},${this._y1=r+n*Math.sin(s)}`)}rect(t,r,n,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}h${n=+n}v${+i}h${-n}Z`}toString(){return this._}}function Eh(e){let t=3;return e.digits=function(r){if(!arguments.length)return t;if(r==null)t=null;else{const n=Math.floor(r);if(!(n>=0))throw new RangeError(`invalid digits: ${r}`);t=n}return e},()=>new s6(t)}function Dh(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function dj(e){this._context=e}dj.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 Kc(e){return new dj(e)}function fj(e){return e[0]}function pj(e){return e[1]}function hj(e,t){var r=he(!0),n=null,i=Kc,s=null,o=Eh(l);e=typeof e=="function"?e:e===void 0?fj:he(e),t=typeof t=="function"?t:t===void 0?pj:he(t);function l(c){var d,u=(c=Dh(c)).length,f,p=!1,m;for(n==null&&(s=i(m=o())),d=0;d<=u;++d)!(d=m;--x)l.point(y[x],w[x]);l.lineEnd(),l.areaEnd()}v&&(y[p]=+e(b,p,f),w[p]=+t(b,p,f),l.point(n?+n(b,p,f):y[p],r?+r(b,p,f):w[p]))}if(j)return l=null,j+""||null}function u(){return hj().defined(i).curve(o).context(s)}return d.x=function(f){return arguments.length?(e=typeof f=="function"?f:he(+f),n=null,d):e},d.x0=function(f){return arguments.length?(e=typeof f=="function"?f:he(+f),d):e},d.x1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:he(+f),d):n},d.y=function(f){return arguments.length?(t=typeof f=="function"?f:he(+f),r=null,d):t},d.y0=function(f){return arguments.length?(t=typeof f=="function"?f:he(+f),d):t},d.y1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:he(+f),d):r},d.lineX0=d.lineY0=function(){return u().x(e).y(t)},d.lineY1=function(){return u().x(e).y(r)},d.lineX1=function(){return u().x(n).y(t)},d.defined=function(f){return arguments.length?(i=typeof f=="function"?f:he(!!f),d):i},d.curve=function(f){return arguments.length?(o=f,s!=null&&(l=o(s)),d):o},d.context=function(f){return arguments.length?(f==null?s=l=null:l=o(s=f),d):s},d}class mj{constructor(t,r){this._context=t,this._x=r}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,r){switch(t=+t,r=+r,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,r,t,r):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+r)/2,t,this._y0,t,r);break}}this._x0=t,this._y0=r}}function o6(e){return new mj(e,!0)}function l6(e){return new mj(e,!1)}const Th={draw(e,t){const r=vr(t/Ll);e.moveTo(r,0),e.arc(0,0,r,0,Hc)}},c6={draw(e,t){const r=vr(t/5)/2;e.moveTo(-3*r,-r),e.lineTo(-r,-r),e.lineTo(-r,-3*r),e.lineTo(r,-3*r),e.lineTo(r,-r),e.lineTo(3*r,-r),e.lineTo(3*r,r),e.lineTo(r,r),e.lineTo(r,3*r),e.lineTo(-r,3*r),e.lineTo(-r,r),e.lineTo(-3*r,r),e.closePath()}},gj=vr(1/3),u6=gj*2,d6={draw(e,t){const r=vr(t/u6),n=r*gj;e.moveTo(0,-r),e.lineTo(n,0),e.lineTo(0,r),e.lineTo(-n,0),e.closePath()}},f6={draw(e,t){const r=vr(t),n=-r/2;e.rect(n,n,r,r)}},p6=.8908130915292852,xj=$l(Ll/10)/$l(7*Ll/10),h6=$l(Hc/10)*xj,m6=-cj(Hc/10)*xj,g6={draw(e,t){const r=vr(t*p6),n=h6*r,i=m6*r;e.moveTo(0,-r),e.lineTo(n,i);for(let s=1;s<5;++s){const o=Hc*s/5,l=cj(o),c=$l(o);e.lineTo(c*r,-l*r),e.lineTo(l*n-c*i,c*n+l*i)}e.closePath()}},cd=vr(3),x6={draw(e,t){const r=-vr(t/(cd*3));e.moveTo(0,r*2),e.lineTo(-cd*r,-r),e.lineTo(cd*r,-r),e.closePath()}},Ht=-.5,Kt=vr(3)/2,Mf=1/vr(12),y6=(Mf/2+1)*3,v6={draw(e,t){const r=vr(t/y6),n=r/2,i=r*Mf,s=n,o=r*Mf+r,l=-s,c=o;e.moveTo(n,i),e.lineTo(s,o),e.lineTo(l,c),e.lineTo(Ht*n-Kt*i,Kt*n+Ht*i),e.lineTo(Ht*s-Kt*o,Kt*s+Ht*o),e.lineTo(Ht*l-Kt*c,Kt*l+Ht*c),e.lineTo(Ht*n+Kt*i,Ht*i-Kt*n),e.lineTo(Ht*s+Kt*o,Ht*o-Kt*s),e.lineTo(Ht*l+Kt*c,Ht*c-Kt*l),e.closePath()}};function b6(e,t){let r=null,n=Eh(i);e=typeof e=="function"?e:he(e||Th),t=typeof t=="function"?t:he(t===void 0?64:+t);function i(){let s;if(r||(r=s=n()),e.apply(this,arguments).draw(r,+t.apply(this,arguments)),s)return r=null,s+""||null}return i.type=function(s){return arguments.length?(e=typeof s=="function"?s:he(s),i):e},i.size=function(s){return arguments.length?(t=typeof s=="function"?s:he(+s),i):t},i.context=function(s){return arguments.length?(r=s??null,i):r},i}function zl(){}function Rl(e,t,r){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+r)/6)}function yj(e){this._context=e}yj.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:Rl(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:Rl(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function j6(e){return new yj(e)}function vj(e){this._context=e}vj.prototype={areaStart:zl,areaEnd:zl,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:Rl(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function w6(e){return new vj(e)}function bj(e){this._context=e}bj.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 r=(this._x0+4*this._x1+e)/6,n=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:Rl(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function S6(e){return new bj(e)}function jj(e){this._context=e}jj.prototype={areaStart:zl,areaEnd:zl,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 N6(e){return new jj(e)}function Lx(e){return e<0?-1:1}function zx(e,t,r){var n=e._x1-e._x0,i=t-e._x1,s=(e._y1-e._y0)/(n||i<0&&-0),o=(r-e._y1)/(i||n<0&&-0),l=(s*i+o*n)/(n+i);return(Lx(s)+Lx(o))*Math.min(Math.abs(s),Math.abs(o),.5*Math.abs(l))||0}function Rx(e,t){var r=e._x1-e._x0;return r?(3*(e._y1-e._y0)/r-t)/2:t}function ud(e,t,r){var n=e._x0,i=e._y0,s=e._x1,o=e._y1,l=(s-n)/3;e._context.bezierCurveTo(n+l,i+l*t,s-l,o-l*r,s,o)}function Bl(e){this._context=e}Bl.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:ud(this,this._t0,Rx(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 r=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,ud(this,Rx(this,r=zx(this,e,t)),r);break;default:ud(this,this._t0,r=zx(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=r}}};function wj(e){this._context=new Sj(e)}(wj.prototype=Object.create(Bl.prototype)).point=function(e,t){Bl.prototype.point.call(this,t,e)};function Sj(e){this._context=e}Sj.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,r,n,i,s){this._context.bezierCurveTo(t,e,n,r,s,i)}};function k6(e){return new Bl(e)}function P6(e){return new wj(e)}function Nj(e){this._context=e}Nj.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,r=e.length;if(r)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),r===2)this._context.lineTo(e[1],t[1]);else for(var n=Bx(e),i=Bx(t),s=0,o=1;o=0;--t)i[t]=(o[t]-i[t+1])/s[t];for(s[r-1]=(e[r]+i[r-1])/2,t=0;t=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 r=this._x*(1-this._t)+e*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,t)}break}}this._x=e,this._y=t}};function C6(e){return new Vc(e,.5)}function A6(e){return new Vc(e,0)}function O6(e){return new Vc(e,1)}function ha(e,t){if((o=e.length)>1)for(var r=1,n,i,s=e[t[0]],o,l=s.length;r=0;)r[t]=t;return r}function E6(e,t){return e[t]}function D6(e){const t=[];return t.key=e,t}function T6(){var e=he([]),t=If,r=ha,n=E6;function i(s){var o=Array.from(e.apply(this,arguments),D6),l,c=o.length,d=-1,u;for(const f of s)for(l=0,++d;l0){for(var r,n,i=0,s=e[0].length,o;i0){for(var r=0,n=e[t[0]],i,s=n.length;r0)||!((s=(i=e[t[0]]).length)>0))){for(var r=0,n=1,i,s,o;ne===0?0:e>0?1:-1,yr=e=>typeof e=="number"&&e!=+e,Qr=e=>typeof e=="string"&&e.indexOf("%")===e.length-1,Y=e=>(typeof e=="number"||e instanceof Number)&&!yr(e),Or=e=>Y(e)||typeof e=="string",z6=0,Ts=e=>{var t=++z6;return"".concat(e||"").concat(t)},Rn=function(t,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!Y(t)&&typeof t!="string")return n;var s;if(Qr(t)){if(r==null)return n;var o=t.indexOf("%");s=r*parseFloat(t.slice(0,o))/100}else s=+t;return yr(s)&&(s=n),i&&r!=null&&s>r&&(s=r),s},_j=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,r={},n=0;nn&&(typeof t=="function"?t(n):Xc(n,t))===r)}var Re=e=>e===null||typeof e>"u",Xs=e=>Re(e)?e:"".concat(e.charAt(0).toUpperCase()).concat(e.slice(1));function R6(e){return e!=null}function Pa(){}var B6=["type","size","sizeType"];function $f(){return $f=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var t="symbol".concat(Xs(e));return Aj[t]||Th},Y6=(e,t,r)=>{if(t==="area")return e;switch(r){case"cross":return 5*e*e/9;case"diamond":return .5*e*e/Math.sqrt(3);case"square":return e*e;case"star":{var n=18*K6;return 1.25*e*e*(Math.tan(n)-Math.tan(n*2)*Math.tan(n)**2)}case"triangle":return Math.sqrt(3)*e*e/4;case"wye":return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},G6=(e,t)=>{Aj["symbol".concat(Xs(e))]=t},Oj=e=>{var{type:t="circle",size:r=64,sizeType:n="area"}=e,i=q6(e,B6),s=Wx(Wx({},i),{},{type:t,size:r,sizeType:n}),o="circle";typeof t=="string"&&(o=t);var l=()=>{var p=V6(o),m=b6().type(p).size(Y6(r,n,o)),x=m();if(x!==null)return x},{className:c,cx:d,cy:u}=s,f=ut(s);return Y(d)&&Y(u)&&Y(r)?h.createElement("path",$f({},f,{className:ce("recharts-symbols",c),transform:"translate(".concat(d,", ").concat(u,")"),d:l()})):null};Oj.registerSymbol=G6;var Ej=e=>"radius"in e&&"startAngle"in e&&"endAngle"in e,Ih=(e,t)=>{if(!e||typeof e=="function"||typeof e=="boolean")return null;var r=e;if(h.isValidElement(e)&&(r=e.props),typeof r!="object"&&typeof r!="function")return null;var n={};return Object.keys(r).forEach(i=>{Oh(i)&&(n[i]=s=>r[i](r,s))}),n},Z6=(e,t,r)=>n=>(e(t,r,n),null),X6=(e,t,r)=>{if(e===null||typeof e!="object"&&typeof e!="function")return null;var n=null;return Object.keys(e).forEach(i=>{var s=e[i];Oh(i)&&typeof s=="function"&&(n||(n={}),n[i]=Z6(s,t,r))}),n};function Ux(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function J6(e){for(var t=1;t(o[l]===void 0&&n[l]!==void 0&&(o[l]=n[l]),o),r);return s}var Dj={},Tj={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r,n){const i=new Map;for(let s=0;s=0}e.isLength=t})(Ij);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Ij;function r(n){return n!=null&&typeof n!="function"&&t.isLength(n.length)}e.isArrayLike=r})(Jc);var $j={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return typeof r=="object"&&r!==null}e.isObjectLike=t})($j);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Jc,r=$j;function n(i){return r.isObjectLike(i)&&t.isArrayLike(i)}e.isArrayLikeObject=n})(Mj);var Lj={},zj={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Yc;function r(n){return function(i){return t.get(i,n)}}e.property=r})(zj);var Rj={},Lh={},Bj={},zh={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return r!==null&&(typeof r=="object"||typeof r=="function")}e.isObject=t})(zh);var Rh={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return r==null||typeof r!="object"&&typeof r!="function"}e.isPrimitive=t})(Rh);var Bh={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r,n){return r===n||Number.isNaN(r)&&Number.isNaN(n)}e.eq=t})(Bh);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=zh,r=Rh,n=Bh;function i(u,f,p){return typeof p!="function"?i(u,f,()=>{}):s(u,f,function m(x,g,b,v,j,y){const w=p(x,g,b,v,j,y);return w!==void 0?!!w:s(x,g,m,y)},new Map)}function s(u,f,p,m){if(f===u)return!0;switch(typeof f){case"object":return o(u,f,p,m);case"function":return Object.keys(f).length>0?s(u,{...f},p,m):n.eq(u,f);default:return t.isObject(u)?typeof f=="string"?f==="":!0:n.eq(u,f)}}function o(u,f,p,m){if(f==null)return!0;if(Array.isArray(f))return c(u,f,p,m);if(f instanceof Map)return l(u,f,p,m);if(f instanceof Set)return d(u,f,p,m);const x=Object.keys(f);if(u==null)return x.length===0;if(x.length===0)return!0;if(m!=null&&m.has(f))return m.get(f)===u;m==null||m.set(f,u);try{for(let g=0;g{})}e.isMatch=r})(Lh);var Fj={},Fh={},Wj={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return Object.getOwnPropertySymbols(r).filter(n=>Object.prototype.propertyIsEnumerable.call(r,n))}e.getSymbols=t})(Wj);var Wh={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return r==null?r===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(r)}e.getTag=t})(Wh);var Uh={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t="[object RegExp]",r="[object String]",n="[object Number]",i="[object Boolean]",s="[object Arguments]",o="[object Symbol]",l="[object Date]",c="[object Map]",d="[object Set]",u="[object Array]",f="[object Function]",p="[object ArrayBuffer]",m="[object Object]",x="[object Error]",g="[object DataView]",b="[object Uint8Array]",v="[object Uint8ClampedArray]",j="[object Uint16Array]",y="[object Uint32Array]",w="[object BigUint64Array]",S="[object Int8Array]",N="[object Int16Array]",P="[object Int32Array]",_="[object BigInt64Array]",T="[object Float32Array]",$="[object Float64Array]";e.argumentsTag=s,e.arrayBufferTag=p,e.arrayTag=u,e.bigInt64ArrayTag=_,e.bigUint64ArrayTag=w,e.booleanTag=i,e.dataViewTag=g,e.dateTag=l,e.errorTag=x,e.float32ArrayTag=T,e.float64ArrayTag=$,e.functionTag=f,e.int16ArrayTag=N,e.int32ArrayTag=P,e.int8ArrayTag=S,e.mapTag=c,e.numberTag=n,e.objectTag=m,e.regexpTag=t,e.setTag=d,e.stringTag=r,e.symbolTag=o,e.uint16ArrayTag=j,e.uint32ArrayTag=y,e.uint8ArrayTag=b,e.uint8ClampedArrayTag=v})(Uh);var Uj={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}e.isTypedArray=t})(Uj);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Wj,r=Wh,n=Uh,i=Rh,s=Uj;function o(u,f){return l(u,void 0,u,new Map,f)}function l(u,f,p,m=new Map,x=void 0){const g=x==null?void 0:x(u,f,p,m);if(g!==void 0)return g;if(i.isPrimitive(u))return u;if(m.has(u))return m.get(u);if(Array.isArray(u)){const b=new Array(u.length);m.set(u,b);for(let v=0;vt.isMatch(s,i)}e.matches=n})(Rj);var qj={},Hj={},Kj={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Fh,r=Uh;function n(i,s){return t.cloneDeepWith(i,(o,l,c,d)=>{const u=s==null?void 0:s(o,l,c,d);if(u!==void 0)return u;if(typeof i=="object")switch(Object.prototype.toString.call(i)){case r.numberTag:case r.stringTag:case r.booleanTag:{const f=new i.constructor(i==null?void 0:i.valueOf());return t.copyProperties(f,i),f}case r.argumentsTag:{const f={};return t.copyProperties(f,i),f.length=i.length,f[Symbol.iterator]=i[Symbol.iterator],f}default:return}})}e.cloneDeepWith=n})(Kj);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Kj;function r(n){return t.cloneDeepWith(n)}e.cloneDeep=r})(Hj);var Vj={},qh={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=/^(?:0|[1-9]\d*)$/;function r(n,i=Number.MAX_SAFE_INTEGER){switch(typeof n){case"number":return Number.isInteger(n)&&n>=0&&ne,Ve=()=>{var e=h.useContext(Hh);return e?e.store.dispatch:i4},ol=()=>{},a4=()=>ol,s4=(e,t)=>e===t;function G(e){var t=h.useContext(Hh);return X1.useSyncExternalStoreWithSelector(t?t.subscription.addNestedSub:a4,t?t.store.getState:ol,t?t.store.getState:ol,t?e:ol,s4)}function o4(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function l4(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function c4(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(r=>typeof r=="function")){const r=e.map(n=>typeof n=="function"?`function ${n.name||"unnamed"}()`:typeof n).join(", ");throw new TypeError(`${t}[${r}]`)}}var Hx=e=>Array.isArray(e)?e:[e];function u4(e){const t=Array.isArray(e[0])?e[0]:e;return c4(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function d4(e,t){const r=[],{length:n}=e;for(let i=0;i{r=Mo(),o.resetResultsCount()},o.resultsCount=()=>s,o.resetResultsCount=()=>{s=0},o}function m4(e,...t){const r=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,n=(...i)=>{let s=0,o=0,l,c={},d=i.pop();typeof d=="object"&&(c=d,d=i.pop()),o4(d,`createSelector expects an output function after the inputs, but received: [${typeof d}]`);const u={...r,...c},{memoize:f,memoizeOptions:p=[],argsMemoize:m=Gj,argsMemoizeOptions:x=[]}=u,g=Hx(p),b=Hx(x),v=u4(i),j=f(function(){return s++,d.apply(null,arguments)},...g),y=m(function(){o++;const S=d4(v,arguments);return l=j.apply(null,S),l},...b);return Object.assign(y,{resultFunc:d,memoizedResultFunc:j,dependencies:v,dependencyRecomputations:()=>o,resetDependencyRecomputations:()=>{o=0},lastResult:()=>l,recomputations:()=>s,resetRecomputations:()=>{s=0},memoize:f,argsMemoize:m})};return Object.assign(n,{withTypes:()=>n}),n}var I=m4(Gj),g4=Object.assign((e,t=I)=>{l4(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);const r=Object.keys(e),n=r.map(s=>e[s]);return t(n,(...s)=>s.reduce((o,l,c)=>(o[r[c]]=l,o),{}))},{withTypes:()=>g4}),Zj={},Xj={},Jj={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return typeof n=="symbol"?1:n===null?2:n===void 0?3:n!==n?4:0}const r=(n,i,s)=>{if(n!==i){const o=t(n),l=t(i);if(o===l&&o===0){if(ni)return s==="desc"?-1:1}return s==="desc"?l-o:o-l}return 0};e.compareValues=r})(Jj);var Qj={},Kh={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return typeof r=="symbol"||r instanceof Symbol}e.isSymbol=t})(Kh);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Kh,r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function i(s,o){return Array.isArray(s)?!1:typeof s=="number"||typeof s=="boolean"||s==null||t.isSymbol(s)?!0:typeof s=="string"&&(n.test(s)||!r.test(s))||o!=null&&Object.hasOwn(o,s)}e.isKey=i})(Qj);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Jj,r=Qj,n=Zc;function i(s,o,l,c){if(s==null)return[];l=c?void 0:l,Array.isArray(s)||(s=Object.values(s)),Array.isArray(o)||(o=o==null?[null]:[o]),o.length===0&&(o=[null]),Array.isArray(l)||(l=l==null?[]:[l]),l=l.map(m=>String(m));const d=(m,x)=>{let g=m;for(let b=0;bx==null||m==null?x:typeof m=="object"&&"key"in m?Object.hasOwn(x,m.key)?x[m.key]:d(x,m.path):typeof m=="function"?m(x):Array.isArray(m)?d(x,m):typeof x=="object"?x[m]:x,f=o.map(m=>(Array.isArray(m)&&m.length===1&&(m=m[0]),m==null||typeof m=="function"||Array.isArray(m)||r.isKey(m)?m:{key:m,path:n.toPath(m)}));return s.map(m=>({original:m,criteria:f.map(x=>u(x,m))})).slice().sort((m,x)=>{for(let g=0;gm.original)}e.orderBy=i})(Xj);var ew={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r,n=1){const i=[],s=Math.floor(n),o=(l,c)=>{for(let d=0;d1&&n.isIterateeCall(s,o[0],o[1])?o=[]:l>2&&n.isIterateeCall(o[0],o[1],o[2])&&(o=[o[0]]),t.orderBy(s,r.flatten(o),["asc"])}e.sortBy=i})(Zj);var x4=Zj.sortBy;const Qc=Tr(x4);var tw=e=>e.legend.settings,y4=e=>e.legend.size,v4=e=>e.legend.payload;I([v4,tw],(e,t)=>{var{itemSorter:r}=t,n=e.flat(1);return r?Qc(n,r):n});var Io=1;function b4(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],[t,r]=h.useState({height:0,left:0,top:0,width:0}),n=h.useCallback(i=>{if(i!=null){var s=i.getBoundingClientRect(),o={height:s.height,left:s.left,top:s.top,width:s.width};(Math.abs(o.height-t.height)>Io||Math.abs(o.left-t.left)>Io||Math.abs(o.top-t.top)>Io||Math.abs(o.width-t.width)>Io)&&r({height:o.height,left:o.left,top:o.top,width:o.width})}},[t.width,t.height,t.top,t.left,...e]);return[t,n]}function Ze(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var j4=typeof Symbol=="function"&&Symbol.observable||"@@observable",Vx=j4,dd=()=>Math.random().toString(36).substring(7).split("").join("."),w4={INIT:`@@redux/INIT${dd()}`,REPLACE:`@@redux/REPLACE${dd()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${dd()}`},Fl=w4;function Yh(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function rw(e,t,r){if(typeof e!="function")throw new Error(Ze(2));if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(Ze(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(Ze(1));return r(rw)(e,t)}let n=e,i=t,s=new Map,o=s,l=0,c=!1;function d(){o===s&&(o=new Map,s.forEach((b,v)=>{o.set(v,b)}))}function u(){if(c)throw new Error(Ze(3));return i}function f(b){if(typeof b!="function")throw new Error(Ze(4));if(c)throw new Error(Ze(5));let v=!0;d();const j=l++;return o.set(j,b),function(){if(v){if(c)throw new Error(Ze(6));v=!1,d(),o.delete(j),s=null}}}function p(b){if(!Yh(b))throw new Error(Ze(7));if(typeof b.type>"u")throw new Error(Ze(8));if(typeof b.type!="string")throw new Error(Ze(17));if(c)throw new Error(Ze(9));try{c=!0,i=n(i,b)}finally{c=!1}return(s=o).forEach(j=>{j()}),b}function m(b){if(typeof b!="function")throw new Error(Ze(10));n=b,p({type:Fl.REPLACE})}function x(){const b=f;return{subscribe(v){if(typeof v!="object"||v===null)throw new Error(Ze(11));function j(){const w=v;w.next&&w.next(u())}return j(),{unsubscribe:b(j)}},[Vx](){return this}}}return p({type:Fl.INIT}),{dispatch:p,subscribe:f,getState:u,replaceReducer:m,[Vx]:x}}function S4(e){Object.keys(e).forEach(t=>{const r=e[t];if(typeof r(void 0,{type:Fl.INIT})>"u")throw new Error(Ze(12));if(typeof r(void 0,{type:Fl.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Ze(13))})}function nw(e){const t=Object.keys(e),r={};for(let s=0;s"u")throw l&&l.type,new Error(Ze(14));d[f]=x,c=c||x!==m}return c=c||n.length!==Object.keys(o).length,c?d:o}}function Wl(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function N4(...e){return t=>(r,n)=>{const i=t(r,n);let s=()=>{throw new Error(Ze(15))};const o={getState:i.getState,dispatch:(c,...d)=>s(c,...d)},l=e.map(c=>c(o));return s=Wl(...l)(i.dispatch),{...i,dispatch:s}}}function iw(e){return Yh(e)&&"type"in e&&typeof e.type=="string"}var aw=Symbol.for("immer-nothing"),Yx=Symbol.for("immer-draftable"),Wt=Symbol.for("immer-state");function fr(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Ms=Object.getPrototypeOf;function vi(e){return!!e&&!!e[Wt]}function en(e){var t;return e?sw(e)||Array.isArray(e)||!!e[Yx]||!!((t=e.constructor)!=null&&t[Yx])||Js(e)||tu(e):!1}var k4=Object.prototype.constructor.toString(),Gx=new WeakMap;function sw(e){if(!e||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);if(t===null||t===Object.prototype)return!0;const r=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;if(r===Object)return!0;if(typeof r!="function")return!1;let n=Gx.get(r);return n===void 0&&(n=Function.toString.call(r),Gx.set(r,n)),n===k4}function Ul(e,t,r=!0){eu(e)===0?(r?Reflect.ownKeys(e):Object.keys(e)).forEach(i=>{t(i,e[i],e)}):e.forEach((n,i)=>t(i,n,e))}function eu(e){const t=e[Wt];return t?t.type_:Array.isArray(e)?1:Js(e)?2:tu(e)?3:0}function Lf(e,t){return eu(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function ow(e,t,r){const n=eu(e);n===2?e.set(t,r):n===3?e.add(r):e[t]=r}function P4(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Js(e){return e instanceof Map}function tu(e){return e instanceof Set}function Jn(e){return e.copy_||e.base_}function zf(e,t){if(Js(e))return new Map(e);if(tu(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const r=sw(e);if(t===!0||t==="class_only"&&!r){const n=Object.getOwnPropertyDescriptors(e);delete n[Wt];let i=Reflect.ownKeys(n);for(let s=0;s1&&Object.defineProperties(e,{set:$o,add:$o,clear:$o,delete:$o}),Object.freeze(e),t&&Object.values(e).forEach(r=>Gh(r,!0))),e}function _4(){fr(2)}var $o={value:_4};function ru(e){return e===null||typeof e!="object"?!0:Object.isFrozen(e)}var C4={};function bi(e){const t=C4[e];return t||fr(0,e),t}var Is;function lw(){return Is}function A4(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Zx(e,t){t&&(bi("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Rf(e){Bf(e),e.drafts_.forEach(O4),e.drafts_=null}function Bf(e){e===Is&&(Is=e.parent_)}function Xx(e){return Is=A4(Is,e)}function O4(e){const t=e[Wt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Jx(e,t){t.unfinalizedDrafts_=t.drafts_.length;const r=t.drafts_[0];return e!==void 0&&e!==r?(r[Wt].modified_&&(Rf(t),fr(4)),en(e)&&(e=ql(t,e),t.parent_||Hl(t,e)),t.patches_&&bi("Patches").generateReplacementPatches_(r[Wt].base_,e,t.patches_,t.inversePatches_)):e=ql(t,r,[]),Rf(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==aw?e:void 0}function ql(e,t,r){if(ru(t))return t;const n=e.immer_.shouldUseStrictIteration(),i=t[Wt];if(!i)return Ul(t,(s,o)=>Qx(e,i,t,s,o,r),n),t;if(i.scope_!==e)return t;if(!i.modified_)return Hl(e,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;const s=i.copy_;let o=s,l=!1;i.type_===3&&(o=new Set(s),s.clear(),l=!0),Ul(o,(c,d)=>Qx(e,i,s,c,d,r,l),n),Hl(e,s,!1),r&&e.patches_&&bi("Patches").generatePatches_(i,r,e.patches_,e.inversePatches_)}return i.copy_}function Qx(e,t,r,n,i,s,o){if(i==null||typeof i!="object"&&!o)return;const l=ru(i);if(!(l&&!o)){if(vi(i)){const c=s&&t&&t.type_!==3&&!Lf(t.assigned_,n)?s.concat(n):void 0,d=ql(e,i,c);if(ow(r,n,d),vi(d))e.canAutoFreeze_=!1;else return}else o&&r.add(i);if(en(i)&&!l){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1||t&&t.base_&&t.base_[n]===i&&l)return;ql(e,i),(!t||!t.scope_.parent_)&&typeof n!="symbol"&&(Js(r)?r.has(n):Object.prototype.propertyIsEnumerable.call(r,n))&&Hl(e,i)}}}function Hl(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Gh(t,r)}function E4(e,t){const r=Array.isArray(e),n={type_:r?1:0,scope_:t?t.scope_:lw(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=n,s=Zh;r&&(i=[n],s=$s);const{revoke:o,proxy:l}=Proxy.revocable(i,s);return n.draft_=l,n.revoke_=o,l}var Zh={get(e,t){if(t===Wt)return e;const r=Jn(e);if(!Lf(r,t))return D4(e,r,t);const n=r[t];return e.finalized_||!en(n)?n:n===fd(e.base_,t)?(pd(e),e.copy_[t]=Wf(n,e)):n},has(e,t){return t in Jn(e)},ownKeys(e){return Reflect.ownKeys(Jn(e))},set(e,t,r){const n=cw(Jn(e),t);if(n!=null&&n.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){const i=fd(Jn(e),t),s=i==null?void 0:i[Wt];if(s&&s.base_===r)return e.copy_[t]=r,e.assigned_[t]=!1,!0;if(P4(r,i)&&(r!==void 0||Lf(e.base_,t)))return!0;pd(e),Ff(e)}return e.copy_[t]===r&&(r!==void 0||t in e.copy_)||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_[t]=!0),!0},deleteProperty(e,t){return fd(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,pd(e),Ff(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const r=Jn(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:n.enumerable,value:r[t]}},defineProperty(){fr(11)},getPrototypeOf(e){return Ms(e.base_)},setPrototypeOf(){fr(12)}},$s={};Ul(Zh,(e,t)=>{$s[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});$s.deleteProperty=function(e,t){return $s.set.call(this,e,t,void 0)};$s.set=function(e,t,r){return Zh.set.call(this,e[0],t,r,e[0])};function fd(e,t){const r=e[Wt];return(r?Jn(r):e)[t]}function D4(e,t,r){var i;const n=cw(t,r);return n?"value"in n?n.value:(i=n.get)==null?void 0:i.call(e.draft_):void 0}function cw(e,t){if(!(t in e))return;let r=Ms(e);for(;r;){const n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=Ms(r)}}function Ff(e){e.modified_||(e.modified_=!0,e.parent_&&Ff(e.parent_))}function pd(e){e.copy_||(e.copy_=zf(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var T4=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(t,r,n)=>{if(typeof t=="function"&&typeof r!="function"){const s=r;r=t;const o=this;return function(c=s,...d){return o.produce(c,u=>r.call(this,u,...d))}}typeof r!="function"&&fr(6),n!==void 0&&typeof n!="function"&&fr(7);let i;if(en(t)){const s=Xx(this),o=Wf(t,void 0);let l=!0;try{i=r(o),l=!1}finally{l?Rf(s):Bf(s)}return Zx(s,n),Jx(i,s)}else if(!t||typeof t!="object"){if(i=r(t),i===void 0&&(i=t),i===aw&&(i=void 0),this.autoFreeze_&&Gh(i,!0),n){const s=[],o=[];bi("Patches").generateReplacementPatches_(t,i,s,o),n(s,o)}return i}else fr(1,t)},this.produceWithPatches=(t,r)=>{if(typeof t=="function")return(o,...l)=>this.produceWithPatches(o,c=>t(c,...l));let n,i;return[this.produce(t,r,(o,l)=>{n=o,i=l}),n,i]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),typeof(e==null?void 0:e.useStrictIteration)=="boolean"&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){en(e)||fr(8),vi(e)&&(e=Kr(e));const t=Xx(this),r=Wf(e,void 0);return r[Wt].isManual_=!0,Bf(t),r}finishDraft(e,t){const r=e&&e[Wt];(!r||!r.isManual_)&&fr(9);const{scope_:n}=r;return Zx(n,t),Jx(void 0,n)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let r;for(r=t.length-1;r>=0;r--){const i=t[r];if(i.path.length===0&&i.op==="replace"){e=i.value;break}}r>-1&&(t=t.slice(r+1));const n=bi("Patches").applyPatches_;return vi(e)?n(e,t):this.produce(e,i=>n(i,t))}};function Wf(e,t){const r=Js(e)?bi("MapSet").proxyMap_(e,t):tu(e)?bi("MapSet").proxySet_(e,t):E4(e,t);return(t?t.scope_:lw()).drafts_.push(r),r}function Kr(e){return vi(e)||fr(10,e),uw(e)}function uw(e){if(!en(e)||ru(e))return e;const t=e[Wt];let r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=zf(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=zf(e,!0);return Ul(r,(i,s)=>{ow(r,i,uw(s))},n),t&&(t.finalized_=!1),r}var Uf=new T4,dw=Uf.produce,M4=Uf.setUseStrictIteration.bind(Uf);function fw(e){return({dispatch:r,getState:n})=>i=>s=>typeof s=="function"?s(r,n,e):i(s)}var I4=fw(),$4=fw,L4=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?Wl:Wl.apply(null,arguments)};function ar(e,t){function r(...n){if(t){let i=t(...n);if(!i)throw new Error(Bt(0));return{type:e,payload:i.payload,..."meta"in i&&{meta:i.meta},..."error"in i&&{error:i.error}}}return{type:e,payload:n[0]}}return r.toString=()=>`${e}`,r.type=e,r.match=n=>iw(n)&&n.type===e,r}var pw=class es extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,es.prototype)}static get[Symbol.species](){return es}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new es(...t[0].concat(this)):new es(...t.concat(this))}};function e0(e){return en(e)?dw(e,()=>{}):e}function Lo(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}function z4(e){return typeof e=="boolean"}var R4=()=>function(t){const{thunk:r=!0,immutableCheck:n=!0,serializableCheck:i=!0,actionCreatorCheck:s=!0}=t??{};let o=new pw;return r&&(z4(r)?o.push(I4):o.push($4(r.extraArgument))),o},hw="RTK_autoBatch",Le=()=>e=>({payload:e,meta:{[hw]:!0}}),t0=e=>t=>{setTimeout(t,e)},mw=(e={type:"raf"})=>t=>(...r)=>{const n=t(...r);let i=!0,s=!1,o=!1;const l=new Set,c=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:t0(10):e.type==="callback"?e.queueNotification:t0(e.timeout),d=()=>{o=!1,s&&(s=!1,l.forEach(u=>u()))};return Object.assign({},n,{subscribe(u){const f=()=>i&&u(),p=n.subscribe(f);return l.add(u),()=>{p(),l.delete(u)}},dispatch(u){var f;try{return i=!((f=u==null?void 0:u.meta)!=null&&f[hw]),s=!i,s&&(o||(o=!0,c(d))),n.dispatch(u)}finally{i=!0}}})},B4=e=>function(r){const{autoBatch:n=!0}=r??{};let i=new pw(e);return n&&i.push(mw(typeof n=="object"?n:void 0)),i};function F4(e){const t=R4(),{reducer:r=void 0,middleware:n,devTools:i=!0,preloadedState:s=void 0,enhancers:o=void 0}=e||{};let l;if(typeof r=="function")l=r;else if(Yh(r))l=nw(r);else throw new Error(Bt(1));let c;typeof n=="function"?c=n(t):c=t();let d=Wl;i&&(d=L4({trace:!1,...typeof i=="object"&&i}));const u=N4(...c),f=B4(u);let p=typeof o=="function"?o(f):f();const m=d(...p);return rw(l,s,m)}function gw(e){const t={},r=[];let n;const i={addCase(s,o){const l=typeof s=="string"?s:s.type;if(!l)throw new Error(Bt(28));if(l in t)throw new Error(Bt(29));return t[l]=o,i},addAsyncThunk(s,o){return o.pending&&(t[s.pending.type]=o.pending),o.rejected&&(t[s.rejected.type]=o.rejected),o.fulfilled&&(t[s.fulfilled.type]=o.fulfilled),o.settled&&r.push({matcher:s.settled,reducer:o.settled}),i},addMatcher(s,o){return r.push({matcher:s,reducer:o}),i},addDefaultCase(s){return n=s,i}};return e(i),[t,r,n]}M4(!1);function W4(e){return typeof e=="function"}function U4(e,t){let[r,n,i]=gw(t),s;if(W4(e))s=()=>e0(e());else{const l=e0(e);s=()=>l}function o(l=s(),c){let d=[r[c.type],...n.filter(({matcher:u})=>u(c)).map(({reducer:u})=>u)];return d.filter(u=>!!u).length===0&&(d=[i]),d.reduce((u,f)=>{if(f)if(vi(u)){const m=f(u,c);return m===void 0?u:m}else{if(en(u))return dw(u,p=>f(p,c));{const p=f(u,c);if(p===void 0){if(u===null)return u;throw Error("A case reducer on a non-draftable value must not return undefined")}return p}}return u},l)}return o.getInitialState=s,o}var q4="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",H4=(e=21)=>{let t="",r=e;for(;r--;)t+=q4[Math.random()*64|0];return t},K4=Symbol.for("rtk-slice-createasyncthunk");function V4(e,t){return`${e}/${t}`}function Y4({creators:e}={}){var r;const t=(r=e==null?void 0:e.asyncThunk)==null?void 0:r[K4];return function(i){const{name:s,reducerPath:o=s}=i;if(!s)throw new Error(Bt(11));const l=(typeof i.reducers=="function"?i.reducers(Z4()):i.reducers)||{},c=Object.keys(l),d={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},u={addCase(w,S){const N=typeof w=="string"?w:w.type;if(!N)throw new Error(Bt(12));if(N in d.sliceCaseReducersByType)throw new Error(Bt(13));return d.sliceCaseReducersByType[N]=S,u},addMatcher(w,S){return d.sliceMatchers.push({matcher:w,reducer:S}),u},exposeAction(w,S){return d.actionCreators[w]=S,u},exposeCaseReducer(w,S){return d.sliceCaseReducersByName[w]=S,u}};c.forEach(w=>{const S=l[w],N={reducerName:w,type:V4(s,w),createNotation:typeof i.reducers=="function"};J4(S)?eE(N,S,u,t):X4(N,S,u)});function f(){const[w={},S=[],N=void 0]=typeof i.extraReducers=="function"?gw(i.extraReducers):[i.extraReducers],P={...w,...d.sliceCaseReducersByType};return U4(i.initialState,_=>{for(let T in P)_.addCase(T,P[T]);for(let T of d.sliceMatchers)_.addMatcher(T.matcher,T.reducer);for(let T of S)_.addMatcher(T.matcher,T.reducer);N&&_.addDefaultCase(N)})}const p=w=>w,m=new Map,x=new WeakMap;let g;function b(w,S){return g||(g=f()),g(w,S)}function v(){return g||(g=f()),g.getInitialState()}function j(w,S=!1){function N(_){let T=_[w];return typeof T>"u"&&S&&(T=Lo(x,N,v)),T}function P(_=p){const T=Lo(m,S,()=>new WeakMap);return Lo(T,_,()=>{const $={};for(const[M,C]of Object.entries(i.selectors??{}))$[M]=G4(C,_,()=>Lo(x,_,v),S);return $})}return{reducerPath:w,getSelectors:P,get selectors(){return P(N)},selectSlice:N}}const y={name:s,reducer:b,actions:d.actionCreators,caseReducers:d.sliceCaseReducersByName,getInitialState:v,...j(o),injectInto(w,{reducerPath:S,...N}={}){const P=S??o;return w.inject({reducerPath:P,reducer:b},N),{...y,...j(P,!0)}}};return y}}function G4(e,t,r,n){function i(s,...o){let l=t(s);return typeof l>"u"&&n&&(l=r()),e(l,...o)}return i.unwrapped=e,i}var At=Y4();function Z4(){function e(t,r){return{_reducerDefinitionType:"asyncThunk",payloadCreator:t,...r}}return e.withTypes=()=>e,{reducer(t){return Object.assign({[t.name](...r){return t(...r)}}[t.name],{_reducerDefinitionType:"reducer"})},preparedReducer(t,r){return{_reducerDefinitionType:"reducerWithPrepare",prepare:t,reducer:r}},asyncThunk:e}}function X4({type:e,reducerName:t,createNotation:r},n,i){let s,o;if("reducer"in n){if(r&&!Q4(n))throw new Error(Bt(17));s=n.reducer,o=n.prepare}else s=n;i.addCase(e,s).exposeCaseReducer(t,s).exposeAction(t,o?ar(e,o):ar(e))}function J4(e){return e._reducerDefinitionType==="asyncThunk"}function Q4(e){return e._reducerDefinitionType==="reducerWithPrepare"}function eE({type:e,reducerName:t},r,n,i){if(!i)throw new Error(Bt(18));const{payloadCreator:s,fulfilled:o,pending:l,rejected:c,settled:d,options:u}=r,f=i(e,s,u);n.exposeAction(t,f),o&&n.addCase(f.fulfilled,o),l&&n.addCase(f.pending,l),c&&n.addCase(f.rejected,c),d&&n.addMatcher(f.settled,d),n.exposeCaseReducer(t,{fulfilled:o||zo,pending:l||zo,rejected:c||zo,settled:d||zo})}function zo(){}var tE="task",xw="listener",yw="completed",Xh="cancelled",rE=`task-${Xh}`,nE=`task-${yw}`,qf=`${xw}-${Xh}`,iE=`${xw}-${yw}`,nu=class{constructor(e){ho(this,"name","TaskAbortError");ho(this,"message");this.code=e,this.message=`${tE} ${Xh} (reason: ${e})`}},Jh=(e,t)=>{if(typeof e!="function")throw new TypeError(Bt(32))},Kl=()=>{},vw=(e,t=Kl)=>(e.catch(t),e),bw=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),li=(e,t)=>{const r=e.signal;r.aborted||("reason"in r||Object.defineProperty(r,"reason",{enumerable:!0,value:t,configurable:!0,writable:!0}),e.abort(t))},ci=e=>{if(e.aborted){const{reason:t}=e;throw new nu(t)}};function jw(e,t){let r=Kl;return new Promise((n,i)=>{const s=()=>i(new nu(e.reason));if(e.aborted){s();return}r=bw(e,s),t.finally(()=>r()).then(n,i)}).finally(()=>{r=Kl})}var aE=async(e,t)=>{try{return await Promise.resolve(),{status:"ok",value:await e()}}catch(r){return{status:r instanceof nu?"cancelled":"rejected",error:r}}finally{t==null||t()}},Vl=e=>t=>vw(jw(e,t).then(r=>(ci(e),r))),ww=e=>{const t=Vl(e);return r=>t(new Promise(n=>setTimeout(n,r)))},{assign:ia}=Object,r0={},iu="listenerMiddleware",sE=(e,t)=>{const r=n=>bw(e,()=>li(n,e.reason));return(n,i)=>{Jh(n);const s=new AbortController;r(s);const o=aE(async()=>{ci(e),ci(s.signal);const l=await n({pause:Vl(s.signal),delay:ww(s.signal),signal:s.signal});return ci(s.signal),l},()=>li(s,nE));return i!=null&&i.autoJoin&&t.push(o.catch(Kl)),{result:Vl(e)(o),cancel(){li(s,rE)}}}},oE=(e,t)=>{const r=async(n,i)=>{ci(t);let s=()=>{};const l=[new Promise((c,d)=>{let u=e({predicate:n,effect:(f,p)=>{p.unsubscribe(),c([f,p.getState(),p.getOriginalState()])}});s=()=>{u(),d()}})];i!=null&&l.push(new Promise(c=>setTimeout(c,i,null)));try{const c=await jw(t,Promise.race(l));return ci(t),c}finally{s()}};return(n,i)=>vw(r(n,i))},Sw=e=>{let{type:t,actionCreator:r,matcher:n,predicate:i,effect:s}=e;if(t)i=ar(t).match;else if(r)t=r.type,i=r.match;else if(n)i=n;else if(!i)throw new Error(Bt(21));return Jh(s),{predicate:i,type:t,effect:s}},Nw=ia(e=>{const{type:t,predicate:r,effect:n}=Sw(e);return{id:H4(),effect:n,type:t,predicate:r,pending:new Set,unsubscribe:()=>{throw new Error(Bt(22))}}},{withTypes:()=>Nw}),n0=(e,t)=>{const{type:r,effect:n,predicate:i}=Sw(t);return Array.from(e.values()).find(s=>(typeof r=="string"?s.type===r:s.predicate===i)&&s.effect===n)},Hf=e=>{e.pending.forEach(t=>{li(t,qf)})},lE=(e,t)=>()=>{for(const r of t.keys())Hf(r);e.clear()},i0=(e,t,r)=>{try{e(t,r)}catch(n){setTimeout(()=>{throw n},0)}},kw=ia(ar(`${iu}/add`),{withTypes:()=>kw}),cE=ar(`${iu}/removeAll`),Pw=ia(ar(`${iu}/remove`),{withTypes:()=>Pw}),uE=(...e)=>{console.error(`${iu}/error`,...e)},Qs=(e={})=>{const t=new Map,r=new Map,n=m=>{const x=r.get(m)??0;r.set(m,x+1)},i=m=>{const x=r.get(m)??1;x===1?r.delete(m):r.set(m,x-1)},{extra:s,onError:o=uE}=e;Jh(o);const l=m=>(m.unsubscribe=()=>t.delete(m.id),t.set(m.id,m),x=>{m.unsubscribe(),x!=null&&x.cancelActive&&Hf(m)}),c=m=>{const x=n0(t,m)??Nw(m);return l(x)};ia(c,{withTypes:()=>c});const d=m=>{const x=n0(t,m);return x&&(x.unsubscribe(),m.cancelActive&&Hf(x)),!!x};ia(d,{withTypes:()=>d});const u=async(m,x,g,b)=>{const v=new AbortController,j=oE(c,v.signal),y=[];try{m.pending.add(v),n(m),await Promise.resolve(m.effect(x,ia({},g,{getOriginalState:b,condition:(w,S)=>j(w,S).then(Boolean),take:j,delay:ww(v.signal),pause:Vl(v.signal),extra:s,signal:v.signal,fork:sE(v.signal,y),unsubscribe:m.unsubscribe,subscribe:()=>{t.set(m.id,m)},cancelActiveListeners:()=>{m.pending.forEach((w,S,N)=>{w!==v&&(li(w,qf),N.delete(w))})},cancel:()=>{li(v,qf),m.pending.delete(v)},throwIfCancelled:()=>{ci(v.signal)}})))}catch(w){w instanceof nu||i0(o,w,{raisedBy:"effect"})}finally{await Promise.all(y),li(v,iE),i(m),m.pending.delete(v)}},f=lE(t,r);return{middleware:m=>x=>g=>{if(!iw(g))return x(g);if(kw.match(g))return c(g.payload);if(cE.match(g)){f();return}if(Pw.match(g))return d(g.payload);let b=m.getState();const v=()=>{if(b===r0)throw new Error(Bt(23));return b};let j;try{if(j=x(g),t.size>0){const y=m.getState(),w=Array.from(t.values());for(const S of w){let N=!1;try{N=S.predicate(g,y,b)}catch(P){N=!1,i0(o,P,{raisedBy:"predicate"})}N&&u(S,g,m,v)}}}finally{b=r0}return j},startListening:c,stopListening:d,clearListeners:f}};function Bt(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var dE={layoutType:"horizontal",width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},_w=At({name:"chartLayout",initialState:dE,reducers:{setLayout(e,t){e.layoutType=t.payload},setChartSize(e,t){e.width=t.payload.width,e.height=t.payload.height},setMargin(e,t){var r,n,i,s;e.margin.top=(r=t.payload.top)!==null&&r!==void 0?r:0,e.margin.right=(n=t.payload.right)!==null&&n!==void 0?n:0,e.margin.bottom=(i=t.payload.bottom)!==null&&i!==void 0?i:0,e.margin.left=(s=t.payload.left)!==null&&s!==void 0?s:0},setScale(e,t){e.scale=t.payload}}}),{setMargin:fE,setLayout:pE,setChartSize:hE,setScale:mE}=_w.actions,gE=_w.reducer;function Cw(e,t,r){return Array.isArray(e)&&e&&t+r!==0?e.slice(t,r+1):e}function a0(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Yi(e){for(var t=1;t{if(t&&r){var{width:n,height:i}=r,{align:s,verticalAlign:o,layout:l}=t;if((l==="vertical"||l==="horizontal"&&o==="middle")&&s!=="center"&&Y(e[s]))return Yi(Yi({},e),{},{[s]:e[s]+(n||0)});if((l==="horizontal"||l==="vertical"&&s==="center")&&o!=="middle"&&Y(e[o]))return Yi(Yi({},e),{},{[o]:e[o]+(i||0)})}return e},Mr=(e,t)=>e==="horizontal"&&t==="xAxis"||e==="vertical"&&t==="yAxis"||e==="centric"&&t==="angleAxis"||e==="radial"&&t==="radiusAxis",Aw=(e,t,r,n)=>{if(n)return e.map(l=>l.coordinate);var i,s,o=e.map(l=>(l.coordinate===t&&(i=!0),l.coordinate===r&&(s=!0),l.coordinate));return i||o.push(t),s||o.push(r),o},Ow=(e,t,r)=>{if(!e)return null;var{duplicateDomain:n,type:i,range:s,scale:o,realScaleType:l,isCategorical:c,categoricalDomain:d,tickCount:u,ticks:f,niceTicks:p,axisType:m}=e;if(!o)return null;var x=l==="scaleBand"&&o.bandwidth?o.bandwidth()/2:2,g=i==="category"&&o.bandwidth?o.bandwidth()/x:0;if(g=m==="angleAxis"&&s&&s.length>=2?Jt(s[0]-s[1])*2*g:g,f||p){var b=(f||p||[]).map((v,j)=>{var y=n?n.indexOf(v):v;return{coordinate:o(y)+g,value:v,offset:g,index:j}});return b.filter(v=>!yr(v.coordinate))}return c&&d?d.map((v,j)=>({coordinate:o(v)+g,value:v,index:j,offset:g})):o.ticks&&u!=null?o.ticks(u).map((v,j)=>({coordinate:o(v)+g,value:v,offset:g,index:j})):o.domain().map((v,j)=>({coordinate:o(v)+g,value:n?n[v]:v,index:j,offset:g}))},s0=1e-4,jE=e=>{var t=e.domain();if(!(!t||t.length<=2)){var r=t.length,n=e.range(),i=Math.min(n[0],n[1])-s0,s=Math.max(n[0],n[1])+s0,o=e(t[0]),l=e(t[r-1]);(os||ls)&&e.domain([t[0],t[r-1]])}},wE=e=>{var t=e.length;if(!(t<=0))for(var r=0,n=e[0].length;r=0?(e[o][r][0]=i,e[o][r][1]=i+l,i=e[o][r][1]):(e[o][r][0]=s,e[o][r][1]=s+l,s=e[o][r][1])}},SE=e=>{var t=e.length;if(!(t<=0))for(var r=0,n=e[0].length;r=0?(e[s][r][0]=i,e[s][r][1]=i+o,i=e[s][r][1]):(e[s][r][0]=0,e[s][r][1]=0)}},NE={sign:wE,expand:M6,none:ha,silhouette:I6,wiggle:$6,positive:SE},kE=(e,t,r)=>{var n=NE[r],i=T6().keys(t).value((s,o)=>Number(et(s,o,0))).order(If).offset(n);return i(e)};function PE(e){return e==null?void 0:String(e)}function Yl(e){var{axis:t,ticks:r,bandSize:n,entry:i,index:s,dataKey:o}=e;if(t.type==="category"){if(!t.allowDuplicatedCategory&&t.dataKey&&!Re(i[t.dataKey])){var l=Cj(r,"value",i[t.dataKey]);if(l)return l.coordinate+n/2}return r[s]?r[s].coordinate+n/2:null}var c=et(i,Re(o)?t.dataKey:o);return Re(c)?null:t.scale(c)}var _E=e=>{var t=e.flat(2).filter(Y);return[Math.min(...t),Math.max(...t)]},CE=e=>[e[0]===1/0?0:e[0],e[1]===-1/0?0:e[1]],AE=(e,t,r)=>{if(e!=null)return CE(Object.keys(e).reduce((n,i)=>{var s=e[i],{stackedData:o}=s,l=o.reduce((c,d)=>{var u=Cw(d,t,r),f=_E(u);return[Math.min(c[0],f[0]),Math.max(c[1],f[1])]},[1/0,-1/0]);return[Math.min(l[0],n[0]),Math.max(l[1],n[1])]},[1/0,-1/0]))},o0=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,l0=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,ma=(e,t,r)=>{if(e&&e.scale&&e.scale.bandwidth){var n=e.scale.bandwidth();if(!r||n>0)return n}if(e&&t&&t.length>=2){for(var i=Qc(t,u=>u.coordinate),s=1/0,o=1,l=i.length;o{if(t==="horizontal")return e.chartX;if(t==="vertical")return e.chartY},EE=(e,t)=>t==="centric"?e.angle:e.radius,ln=e=>e.layout.width,cn=e=>e.layout.height,DE=e=>e.layout.scale,Ew=e=>e.layout.margin,su=I(e=>e.cartesianAxis.xAxis,e=>Object.values(e)),ou=I(e=>e.cartesianAxis.yAxis,e=>Object.values(e)),TE="data-recharts-item-index",ME="data-recharts-item-data-key",eo=60;function u0(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Ro(e){for(var t=1;te.brush.height;function RE(e){var t=ou(e);return t.reduce((r,n)=>{if(n.orientation==="left"&&!n.mirror&&!n.hide){var i=typeof n.width=="number"?n.width:eo;return r+i}return r},0)}function BE(e){var t=ou(e);return t.reduce((r,n)=>{if(n.orientation==="right"&&!n.mirror&&!n.hide){var i=typeof n.width=="number"?n.width:eo;return r+i}return r},0)}function FE(e){var t=su(e);return t.reduce((r,n)=>n.orientation==="top"&&!n.mirror&&!n.hide?r+n.height:r,0)}function WE(e){var t=su(e);return t.reduce((r,n)=>n.orientation==="bottom"&&!n.mirror&&!n.hide?r+n.height:r,0)}var rt=I([ln,cn,Ew,zE,RE,BE,FE,WE,tw,y4],(e,t,r,n,i,s,o,l,c,d)=>{var u={left:(r.left||0)+i,right:(r.right||0)+s},f={top:(r.top||0)+o,bottom:(r.bottom||0)+l},p=Ro(Ro({},f),u),m=p.bottom;p.bottom+=n,p=bE(p,c,d);var x=e-p.left-p.right,g=t-p.top-p.bottom;return Ro(Ro({brushBottom:m},p),{},{width:Math.max(x,0),height:Math.max(g,0)})}),UE=I(rt,e=>({x:e.left,y:e.top,width:e.width,height:e.height})),Dw=I(ln,cn,(e,t)=>({x:0,y:0,width:e,height:t})),qE=h.createContext(null),pt=()=>h.useContext(qE)!=null,lu=e=>e.brush,cu=I([lu,rt,Ew],(e,t,r)=>({height:e.height,x:Y(e.x)?e.x:t.left,y:Y(e.y)?e.y:t.top+t.height+t.brushBottom-((r==null?void 0:r.bottom)||0),width:Y(e.width)?e.width:t.width})),Tw={},Mw={},Iw={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r,n,{signal:i,edges:s}={}){let o,l=null;const c=s!=null&&s.includes("leading"),d=s==null||s.includes("trailing"),u=()=>{l!==null&&(r.apply(o,l),o=void 0,l=null)},f=()=>{d&&u(),g()};let p=null;const m=()=>{p!=null&&clearTimeout(p),p=setTimeout(()=>{p=null,f()},n)},x=()=>{p!==null&&(clearTimeout(p),p=null)},g=()=>{x(),o=void 0,l=null},b=()=>{u()},v=function(...j){if(i!=null&&i.aborted)return;o=this,l=j;const y=p==null;m(),c&&y&&u()};return v.schedule=m,v.cancel=g,v.flush=b,i==null||i.addEventListener("abort",g,{once:!0}),v}e.debounce=t})(Iw);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Iw;function r(n,i=0,s={}){typeof s!="object"&&(s={});const{leading:o=!1,trailing:l=!0,maxWait:c}=s,d=Array(2);o&&(d[0]="leading"),l&&(d[1]="trailing");let u,f=null;const p=t.debounce(function(...g){u=n.apply(this,g),f=null},i,{edges:d}),m=function(...g){return c!=null&&(f===null&&(f=Date.now()),Date.now()-f>=c)?(u=n.apply(this,g),f=Date.now(),p.cancel(),p.schedule(),u):(p.apply(this,g),u)},x=()=>(p.flush(),u);return m.cancel=p.cancel,m.flush=x,m}e.debounce=r})(Mw);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Mw;function r(n,i=0,s={}){const{leading:o=!0,trailing:l=!0}=s;return t.debounce(n,i,{leading:o,maxWait:i,trailing:l})}e.throttle=r})(Tw);var HE=Tw.throttle;const KE=Tr(HE);var Gl=function(t,r){for(var n=arguments.length,i=new Array(n>2?n-2:0),s=2;s{var{width:n="100%",height:i="100%",aspect:s,maxHeight:o}=r,l=Qr(n)?e:Number(n),c=Qr(i)?t:Number(i);return s&&s>0&&(l?c=l/s:c&&(l=c*s),o&&c!=null&&c>o&&(c=o)),{calculatedWidth:l,calculatedHeight:c}},VE={width:0,height:0,overflow:"visible"},YE={width:0,overflowX:"visible"},GE={height:0,overflowY:"visible"},ZE={},XE=e=>{var{width:t,height:r}=e,n=Qr(t),i=Qr(r);return n&&i?VE:n?YE:i?GE:ZE};function JE(e){var{width:t,height:r,aspect:n}=e,i=t,s=r;return i===void 0&&s===void 0?(i="100%",s="100%"):i===void 0?i=n&&n>0?void 0:"100%":s===void 0&&(s=n&&n>0?void 0:"100%"),{width:i,height:s}}function _e(e){return Number.isFinite(e)}function Er(e){return typeof e=="number"&&e>0&&Number.isFinite(e)}function Kf(){return Kf=Object.assign?Object.assign.bind():function(e){for(var t=1;t({width:r,height:n}),[r,n]);return r3(i)?h.createElement(Lw.Provider,{value:i},t):null}var Qh=()=>h.useContext(Lw),n3=h.forwardRef((e,t)=>{var{aspect:r,initialDimension:n={width:-1,height:-1},width:i,height:s,minWidth:o=0,minHeight:l,maxHeight:c,children:d,debounce:u=0,id:f,className:p,onResize:m,style:x={}}=e,g=h.useRef(null),b=h.useRef();b.current=m,h.useImperativeHandle(t,()=>g.current);var[v,j]=h.useState({containerWidth:n.width,containerHeight:n.height}),y=h.useCallback((_,T)=>{j($=>{var M=Math.round(_),C=Math.round(T);return $.containerWidth===M&&$.containerHeight===C?$:{containerWidth:M,containerHeight:C}})},[]);h.useEffect(()=>{if(g.current==null||typeof ResizeObserver>"u")return Pa;var _=C=>{var R,{width:q,height:Z}=C[0].contentRect;y(q,Z),(R=b.current)===null||R===void 0||R.call(b,q,Z)};u>0&&(_=KE(_,u,{trailing:!0,leading:!1}));var T=new ResizeObserver(_),{width:$,height:M}=g.current.getBoundingClientRect();return y($,M),T.observe(g.current),()=>{T.disconnect()}},[y,u]);var{containerWidth:w,containerHeight:S}=v;Gl(!r||r>0,"The aspect(%s) must be greater than zero.",r);var{calculatedWidth:N,calculatedHeight:P}=$w(w,S,{width:i,height:s,aspect:r,maxHeight:c});return Gl(N!=null&&N>0||P!=null&&P>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.`,N,P,i,s,o,l,r),h.createElement("div",{id:f?"".concat(f):void 0,className:ce("recharts-responsive-container",p),style:f0(f0({},x),{},{width:i,height:s,minWidth:o,minHeight:l,maxHeight:c}),ref:g},h.createElement("div",{style:QE({width:i,height:s})},h.createElement(zw,{width:N,height:P},d)))}),p0=h.forwardRef((e,t)=>{var r=Qh();if(Er(r.width)&&Er(r.height))return e.children;var{width:n,height:i}=e3({width:e.width,height:e.height,aspect:e.aspect}),{calculatedWidth:s,calculatedHeight:o}=$w(void 0,void 0,{width:n,height:i,aspect:e.aspect,maxHeight:e.maxHeight});return Y(s)&&Y(o)?h.createElement(zw,{width:s,height:o},e.children):h.createElement(a3,Kf({},e,{width:n,height:i,ref:t}))});function Rw(e){if(e)return{x:e.x,y:e.y,upperWidth:"upperWidth"in e?e.upperWidth:e.width,lowerWidth:"lowerWidth"in e?e.lowerWidth:e.width,width:e.width,height:e.height}}var uu=()=>{var e,t=pt(),r=G(HE),n=G(cu),i=(e=G(lu))===null||e===void 0?void 0:e.padding;return!t||!n||!i?r:{width:n.width-i.left-i.right,height:n.height-i.top-i.bottom,x:i.left,y:i.top}},s3={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},Bw=()=>{var e;return(e=G(rt))!==null&&e!==void 0?e:s3},Fw=()=>G(ln),Ww=()=>G(cn),ue=e=>e.layout.layoutType,to=()=>G(ue),o3=()=>{var e=to();return e!==void 0},du=e=>{var t=Ve(),r=pt(),{width:n,height:i}=e,s=Qh(),o=n,l=i;return s&&(o=s.width>0?s.width:n,l=s.height>0?s.height:i),h.useEffect(()=>{!r&&Er(o)&&Er(l)&&t(gE({width:o,height:l}))},[t,r,o,l]),null},l3={settings:{layout:"horizontal",align:"center",verticalAlign:"middle",itemSorter:"value"},size:{width:0,height:0},payload:[]},Uw=At({name:"legend",initialState:l3,reducers:{setLegendSize(e,t){e.size.width=t.payload.width,e.size.height=t.payload.height},setLegendSettings(e,t){e.settings.align=t.payload.align,e.settings.layout=t.payload.layout,e.settings.verticalAlign=t.payload.verticalAlign,e.settings.itemSorter=t.payload.itemSorter},addLegendPayload:{reducer(e,t){e.payload.push(t.payload)},prepare:Le()},removeLegendPayload:{reducer(e,t){var r=Kr(e).payload.indexOf(t.payload);r>-1&&e.payload.splice(r,1)},prepare:Le()}}}),{setLegendSize:_7,setLegendSettings:C7,addLegendPayload:c3,removeLegendPayload:u3}=Uw.actions,d3=Uw.reducer;function Vf(){return Vf=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{separator:t=" : ",contentStyle:r={},itemStyle:n={},labelStyle:i={},payload:s,formatter:o,itemSorter:l,wrapperClassName:c,labelClassName:d,label:u,labelFormatter:f,accessibilityLayer:p=!1}=e,m=()=>{if(s&&s.length){var S={padding:0,margin:0},N=(l?Qc(s,l):s).map((P,_)=>{if(P.type==="none")return null;var T=P.formatter||o||m3,{value:$,name:M}=P,C=$,R=M;if(T){var q=T($,M,P,_,s);if(Array.isArray(q))[C,R]=q;else if(q!=null)C=q;else return null}var Z=hd({display:"block",paddingTop:4,paddingBottom:4,color:P.color||"#000"},n);return h.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(_),style:Z},Or(R)?h.createElement("span",{className:"recharts-tooltip-item-name"},R):null,Or(R)?h.createElement("span",{className:"recharts-tooltip-item-separator"},t):null,h.createElement("span",{className:"recharts-tooltip-item-value"},C),h.createElement("span",{className:"recharts-tooltip-item-unit"},P.unit||""))});return h.createElement("ul",{className:"recharts-tooltip-item-list",style:S},N)}return null},x=hd({margin:0,padding:10,backgroundColor:"#fff",border:"1px solid #ccc",whiteSpace:"nowrap"},r),g=hd({margin:0},i),b=!Re(u),v=b?u:"",j=ce("recharts-default-tooltip",c),y=ce("recharts-tooltip-label",d);b&&f&&s!==void 0&&s!==null&&(v=f(u,s));var w=p?{role:"status","aria-live":"assertive"}:{};return h.createElement("div",Vf({className:j,style:x},w),h.createElement("p",{className:y,style:g},h.isValidElement(v)?v:"".concat(v)),m())},Wa="recharts-tooltip-wrapper",x3={visibility:"hidden"};function y3(e){var{coordinate:t,translateX:r,translateY:n}=e;return ce(Wa,{["".concat(Wa,"-right")]:Y(r)&&t&&Y(t.x)&&r>=t.x,["".concat(Wa,"-left")]:Y(r)&&t&&Y(t.x)&&r=t.y,["".concat(Wa,"-top")]:Y(n)&&t&&Y(t.y)&&n0?i:0),f=r[n]+i;if(t[n])return o[n]?u:f;var p=c[n];if(p==null)return 0;if(o[n]){var m=u,x=p;return mb?Math.max(u,p):Math.max(f,p)}function v3(e){var{translateX:t,translateY:r,useTranslate3d:n}=e;return{transform:n?"translate3d(".concat(t,"px, ").concat(r,"px, 0)"):"translate(".concat(t,"px, ").concat(r,"px)")}}function b3(e){var{allowEscapeViewBox:t,coordinate:r,offsetTopLeft:n,position:i,reverseDirection:s,tooltipBox:o,useTranslate3d:l,viewBox:c}=e,d,u,f;return o.height>0&&o.width>0&&r?(u=m0({allowEscapeViewBox:t,coordinate:r,key:"x",offsetTopLeft:n,position:i,reverseDirection:s,tooltipDimension:o.width,viewBox:c,viewBoxDimension:c.width}),f=m0({allowEscapeViewBox:t,coordinate:r,key:"y",offsetTopLeft:n,position:i,reverseDirection:s,tooltipDimension:o.height,viewBox:c,viewBoxDimension:c.height}),d=v3({translateX:u,translateY:f,useTranslate3d:l})):d=x3,{cssProperties:d,cssClasses:y3({translateX:u,translateY:f,coordinate:r})}}function g0(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Bo(e){for(var t=1;t{if(t.key==="Escape"){var r,n,i,s;this.setState({dismissed:!0,dismissedAtCoordinate:{x:(r=(n=this.props.coordinate)===null||n===void 0?void 0:n.x)!==null&&r!==void 0?r:0,y:(i=(s=this.props.coordinate)===null||s===void 0?void 0:s.y)!==null&&i!==void 0?i:0}})}})}componentDidMount(){document.addEventListener("keydown",this.handleKeyDown)}componentWillUnmount(){document.removeEventListener("keydown",this.handleKeyDown)}componentDidUpdate(){var t,r;this.state.dismissed&&(((t=this.props.coordinate)===null||t===void 0?void 0:t.x)!==this.state.dismissedAtCoordinate.x||((r=this.props.coordinate)===null||r===void 0?void 0:r.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}render(){var{active:t,allowEscapeViewBox:r,animationDuration:n,animationEasing:i,children:s,coordinate:o,hasPayload:l,isAnimationActive:c,offset:d,position:u,reverseDirection:f,useTranslate3d:p,viewBox:m,wrapperStyle:x,lastBoundingBox:g,innerRef:b,hasPortalFromProps:v}=this.props,{cssClasses:j,cssProperties:y}=b3({allowEscapeViewBox:r,coordinate:o,offsetTopLeft:d,position:u,reverseDirection:f,tooltipBox:{height:g.height,width:g.width},useTranslate3d:p,viewBox:m}),w=v?{}:Bo(Bo({transition:c&&t?"transform ".concat(n,"ms ").concat(i):void 0},y),{},{pointerEvents:"none",visibility:!this.state.dismissed&&t&&l?"visible":"hidden",position:"absolute",top:0,left:0}),S=Bo(Bo({},w),{},{visibility:!this.state.dismissed&&t&&l?"visible":"hidden"},x);return h.createElement("div",{xmlns:"http://www.w3.org/1999/xhtml",tabIndex:-1,className:j,style:S,ref:b},s)}}var N3=()=>!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout),Ci={devToolsEnabled:!1,isSsr:N3()},qw=()=>{var e;return(e=G(t=>t.rootProps.accessibilityLayer))!==null&&e!==void 0?e:!0};function Gf(){return Gf=Object.assign?Object.assign.bind():function(e){for(var t=1;t_e(e.x)&&_e(e.y),b0=e=>e.base!=null&&Zl(e.base)&&Zl(e),Ua=e=>e.x,qa=e=>e.y,C3=(e,t)=>{if(typeof e=="function")return e;var r="curve".concat(Xs(e));return(r==="curveMonotone"||r==="curveBump")&&t?v0["".concat(r).concat(t==="vertical"?"Y":"X")]:v0[r]||Kc},A3=e=>{var{type:t="linear",points:r=[],baseLine:n,layout:i,connectNulls:s=!1}=e,o=C3(t,i),l=s?r.filter(Zl):r,c;if(Array.isArray(n)){var d=r.map((m,x)=>y0(y0({},m),{},{base:n[x]}));i==="vertical"?c=To().y(qa).x1(Ua).x0(m=>m.base.x):c=To().x(Ua).y1(qa).y0(m=>m.base.y);var u=c.defined(b0).curve(o),f=s?d.filter(b0):d;return u(f)}i==="vertical"&&Y(n)?c=To().y(qa).x1(Ua).x0(n):Y(n)?c=To().x(Ua).y1(qa).y0(n):c=hj().x(Ua).y(qa);var p=c.defined(Zl).curve(o);return p(l)},us=e=>{var{className:t,points:r,path:n,pathRef:i}=e;if((!r||!r.length)&&!n)return null;var s=r&&r.length?A3(e):n;return h.createElement("path",Gf({},nr(e),Ih(e),{className:ce("recharts-curve",t),d:s===null?void 0:s,ref:i}))},O3=["x","y","top","left","width","height","className"];function Zf(){return Zf=Object.assign?Object.assign.bind():function(e){for(var t=1;t"M".concat(e,",").concat(i,"v").concat(n,"M").concat(s,",").concat(t,"h").concat(r),z3=e=>{var{x:t=0,y:r=0,top:n=0,left:i=0,width:s=0,height:o=0,className:l}=e,c=I3(e,O3),d=E3({x:t,y:r,top:n,left:i,width:s,height:o},c);return!Y(t)||!Y(r)||!Y(s)||!Y(o)||!Y(n)||!Y(i)?null:h.createElement("path",Zf({},ut(d),{className:ce("recharts-cross",l),d:L3(t,r,s,o,n,i)}))};function R3(e,t,r,n){var i=n/2;return{stroke:"none",fill:"#ccc",x:e==="horizontal"?t.x-i:r.left+.5,y:e==="horizontal"?r.top+.5:t.y-i,width:e==="horizontal"?n:r.width-1,height:e==="horizontal"?r.height-1:n}}function w0(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function S0(e){for(var t=1;te.replace(/([A-Z])/g,t=>"-".concat(t.toLowerCase())),Hw=(e,t,r)=>e.map(n=>"".concat(U3(n)," ").concat(t,"ms ").concat(r)).join(","),q3=(e,t)=>[Object.keys(e),Object.keys(t)].reduce((r,n)=>r.filter(i=>n.includes(i))),Ls=(e,t)=>Object.keys(t).reduce((r,n)=>S0(S0({},r),{},{[n]:e(n,t[n])}),{});function N0(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function $e(e){for(var t=1;te+(t-e)*r,Xf=e=>{var{from:t,to:r}=e;return t!==r},Kw=(e,t,r)=>{var n=Ls((i,s)=>{if(Xf(s)){var[o,l]=e(s.from,s.to,s.velocity);return $e($e({},s),{},{from:o,velocity:l})}return s},t);return r<1?Ls((i,s)=>Xf(s)?$e($e({},s),{},{velocity:Xl(s.velocity,n[i].velocity,r),from:Xl(s.from,n[i].from,r)}):s,t):Kw(e,n,r-1)};function Y3(e,t,r,n,i,s){var o,l=n.reduce((p,m)=>$e($e({},p),{},{[m]:{from:e[m],velocity:0,to:t[m]}}),{}),c=()=>Ls((p,m)=>m.from,l),d=()=>!Object.values(l).filter(Xf).length,u=null,f=p=>{o||(o=p);var m=p-o,x=m/r.dt;l=Kw(r,l,x),i($e($e($e({},e),t),c())),o=p,d()||(u=s.setTimeout(f))};return()=>(u=s.setTimeout(f),()=>{var p;(p=u)===null||p===void 0||p()})}function G3(e,t,r,n,i,s,o){var l=null,c=i.reduce((f,p)=>$e($e({},f),{},{[p]:[e[p],t[p]]}),{}),d,u=f=>{d||(d=f);var p=(f-d)/n,m=Ls((g,b)=>Xl(...b,r(p)),c);if(s($e($e($e({},e),t),m)),p<1)l=o.setTimeout(u);else{var x=Ls((g,b)=>Xl(...b,r(1)),c);s($e($e($e({},e),t),x))}};return()=>(l=o.setTimeout(u),()=>{var f;(f=l)===null||f===void 0||f()})}const Z3=(e,t,r,n,i,s)=>{var o=q3(e,t);return r==null?()=>(i($e($e({},e),t)),()=>{}):r.isStepper===!0?Y3(e,t,r,o,i,s):G3(e,t,r,n,o,i,s)};var Jl=1e-4,Vw=(e,t)=>[0,3*e,3*t-6*e,3*e-3*t+1],Yw=(e,t)=>e.map((r,n)=>r*t**n).reduce((r,n)=>r+n),k0=(e,t)=>r=>{var n=Vw(e,t);return Yw(n,r)},X3=(e,t)=>r=>{var n=Vw(e,t),i=[...n.map((s,o)=>s*o).slice(1),0];return Yw(i,r)},J3=function(){for(var t=arguments.length,r=new Array(t),n=0;nparseFloat(l));return[o[0],o[1],o[2],o[3]]}}}return r.length===4?r:[0,0,1,1]},Q3=(e,t,r,n)=>{var i=k0(e,r),s=k0(t,n),o=X3(e,r),l=d=>d>1?1:d<0?0:d,c=d=>{for(var u=d>1?1:d,f=u,p=0;p<8;++p){var m=i(f)-u,x=o(f);if(Math.abs(m-u)0&&arguments[0]!==void 0?arguments[0]:{},{stiff:r=100,damping:n=8,dt:i=17}=t,s=(o,l,c)=>{var d=-(o-l)*r,u=c*n,f=c+(d-u)*i/1e3,p=c*i/1e3+o;return Math.abs(p-l){if(typeof e=="string")switch(e){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return P0(e);case"spring":return eD();default:if(e.split("(")[0]==="cubic-bezier")return P0(e)}return typeof e=="function"?e:null};function rD(e){var t,r=()=>null,n=!1,i=null,s=o=>{if(!n){if(Array.isArray(o)){if(!o.length)return;var l=o,[c,...d]=l;if(typeof c=="number"){i=e.setTimeout(s.bind(null,d),c);return}s(c),i=e.setTimeout(s.bind(null,d));return}typeof o=="string"&&(t=o,r(t)),typeof o=="object"&&(t=o,r(t)),typeof o=="function"&&o()}};return{stop:()=>{n=!0},start:o=>{n=!1,i&&(i(),i=null),s(o)},subscribe:o=>(r=o,()=>{r=()=>null}),getTimeoutController:()=>e}}class nD{setTimeout(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=performance.now(),i=null,s=o=>{o-n>=r?t(o):typeof requestAnimationFrame=="function"&&(i=requestAnimationFrame(s))};return i=requestAnimationFrame(s),()=>{i!=null&&cancelAnimationFrame(i)}}}function iD(){return rD(new nD)}var aD=h.createContext(iD);function sD(e,t){var r=h.useContext(aD);return h.useMemo(()=>t??r(e),[e,t,r])}var oD={begin:0,duration:1e3,easing:"ease",isActive:!0,canBegin:!0,onAnimationEnd:()=>{},onAnimationStart:()=>{}},_0={t:0},md={t:1};function fu(e){var t=ft(e,oD),{isActive:r,canBegin:n,duration:i,easing:s,begin:o,onAnimationEnd:l,onAnimationStart:c,children:d}=t,u=sD(t.animationId,t.animationManager),[f,p]=h.useState(r?_0:md),m=h.useRef(null);return h.useEffect(()=>{r||p(md)},[r]),h.useEffect(()=>{if(!r||!n)return ka;var x=Z3(_0,md,tD(s),i,p,u.getTimeoutController()),g=()=>{m.current=x()};return u.start([c,o,g,i,l]),()=>{u.stop(),m.current&&m.current(),l()}},[r,n,i,s,o,c,l,u]),d(f.t)}function pu(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"animation-",r=h.useRef(Ts(t)),n=h.useRef(e);return n.current!==e&&(r.current=Ts(t),n.current=e),r.current}var lD=["radius"],cD=["radius"];function C0(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function A0(e){for(var t=1;t{var s=Math.min(Math.abs(r)/2,Math.abs(n)/2),o=n>=0?1:-1,l=r>=0?1:-1,c=n>=0&&r>=0||n<0&&r<0?1:0,d;if(s>0&&i instanceof Array){for(var u=[0,0,0,0],f=0,p=4;fs?s:i[f];d="M".concat(e,",").concat(t+o*u[0]),u[0]>0&&(d+="A ".concat(u[0],",").concat(u[0],",0,0,").concat(c,",").concat(e+l*u[0],",").concat(t)),d+="L ".concat(e+r-l*u[1],",").concat(t),u[1]>0&&(d+="A ".concat(u[1],",").concat(u[1],",0,0,").concat(c,`, + height and width.`,N,P,i,s,o,l,r),h.createElement("div",{id:f?"".concat(f):void 0,className:ce("recharts-responsive-container",p),style:f0(f0({},x),{},{width:i,height:s,minWidth:o,minHeight:l,maxHeight:c}),ref:g},h.createElement("div",{style:XE({width:i,height:s})},h.createElement(zw,{width:N,height:P},d)))}),p0=h.forwardRef((e,t)=>{var r=Qh();if(Er(r.width)&&Er(r.height))return e.children;var{width:n,height:i}=JE({width:e.width,height:e.height,aspect:e.aspect}),{calculatedWidth:s,calculatedHeight:o}=$w(void 0,void 0,{width:n,height:i,aspect:e.aspect,maxHeight:e.maxHeight});return Y(s)&&Y(o)?h.createElement(zw,{width:s,height:o},e.children):h.createElement(n3,Kf({},e,{width:n,height:i,ref:t}))});function Rw(e){if(e)return{x:e.x,y:e.y,upperWidth:"upperWidth"in e?e.upperWidth:e.width,lowerWidth:"lowerWidth"in e?e.lowerWidth:e.width,width:e.width,height:e.height}}var uu=()=>{var e,t=pt(),r=G(UE),n=G(cu),i=(e=G(lu))===null||e===void 0?void 0:e.padding;return!t||!n||!i?r:{width:n.width-i.left-i.right,height:n.height-i.top-i.bottom,x:i.left,y:i.top}},i3={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},Bw=()=>{var e;return(e=G(rt))!==null&&e!==void 0?e:i3},Fw=()=>G(ln),Ww=()=>G(cn),ue=e=>e.layout.layoutType,to=()=>G(ue),a3=()=>{var e=to();return e!==void 0},du=e=>{var t=Ve(),r=pt(),{width:n,height:i}=e,s=Qh(),o=n,l=i;return s&&(o=s.width>0?s.width:n,l=s.height>0?s.height:i),h.useEffect(()=>{!r&&Er(o)&&Er(l)&&t(hE({width:o,height:l}))},[t,r,o,l]),null},s3={settings:{layout:"horizontal",align:"center",verticalAlign:"middle",itemSorter:"value"},size:{width:0,height:0},payload:[]},Uw=At({name:"legend",initialState:s3,reducers:{setLegendSize(e,t){e.size.width=t.payload.width,e.size.height=t.payload.height},setLegendSettings(e,t){e.settings.align=t.payload.align,e.settings.layout=t.payload.layout,e.settings.verticalAlign=t.payload.verticalAlign,e.settings.itemSorter=t.payload.itemSorter},addLegendPayload:{reducer(e,t){e.payload.push(t.payload)},prepare:Le()},removeLegendPayload:{reducer(e,t){var r=Kr(e).payload.indexOf(t.payload);r>-1&&e.payload.splice(r,1)},prepare:Le()}}}),{setLegendSize:kF,setLegendSettings:PF,addLegendPayload:o3,removeLegendPayload:l3}=Uw.actions,c3=Uw.reducer;function Vf(){return Vf=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{separator:t=" : ",contentStyle:r={},itemStyle:n={},labelStyle:i={},payload:s,formatter:o,itemSorter:l,wrapperClassName:c,labelClassName:d,label:u,labelFormatter:f,accessibilityLayer:p=!1}=e,m=()=>{if(s&&s.length){var S={padding:0,margin:0},N=(l?Qc(s,l):s).map((P,_)=>{if(P.type==="none")return null;var T=P.formatter||o||p3,{value:$,name:M}=P,C=$,R=M;if(T){var q=T($,M,P,_,s);if(Array.isArray(q))[C,R]=q;else if(q!=null)C=q;else return null}var Z=hd({display:"block",paddingTop:4,paddingBottom:4,color:P.color||"#000"},n);return h.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(_),style:Z},Or(R)?h.createElement("span",{className:"recharts-tooltip-item-name"},R):null,Or(R)?h.createElement("span",{className:"recharts-tooltip-item-separator"},t):null,h.createElement("span",{className:"recharts-tooltip-item-value"},C),h.createElement("span",{className:"recharts-tooltip-item-unit"},P.unit||""))});return h.createElement("ul",{className:"recharts-tooltip-item-list",style:S},N)}return null},x=hd({margin:0,padding:10,backgroundColor:"#fff",border:"1px solid #ccc",whiteSpace:"nowrap"},r),g=hd({margin:0},i),b=!Re(u),v=b?u:"",j=ce("recharts-default-tooltip",c),y=ce("recharts-tooltip-label",d);b&&f&&s!==void 0&&s!==null&&(v=f(u,s));var w=p?{role:"status","aria-live":"assertive"}:{};return h.createElement("div",Vf({className:j,style:x},w),h.createElement("p",{className:y,style:g},h.isValidElement(v)?v:"".concat(v)),m())},Ua="recharts-tooltip-wrapper",m3={visibility:"hidden"};function g3(e){var{coordinate:t,translateX:r,translateY:n}=e;return ce(Ua,{["".concat(Ua,"-right")]:Y(r)&&t&&Y(t.x)&&r>=t.x,["".concat(Ua,"-left")]:Y(r)&&t&&Y(t.x)&&r=t.y,["".concat(Ua,"-top")]:Y(n)&&t&&Y(t.y)&&n0?i:0),f=r[n]+i;if(t[n])return o[n]?u:f;var p=c[n];if(p==null)return 0;if(o[n]){var m=u,x=p;return mb?Math.max(u,p):Math.max(f,p)}function x3(e){var{translateX:t,translateY:r,useTranslate3d:n}=e;return{transform:n?"translate3d(".concat(t,"px, ").concat(r,"px, 0)"):"translate(".concat(t,"px, ").concat(r,"px)")}}function y3(e){var{allowEscapeViewBox:t,coordinate:r,offsetTopLeft:n,position:i,reverseDirection:s,tooltipBox:o,useTranslate3d:l,viewBox:c}=e,d,u,f;return o.height>0&&o.width>0&&r?(u=m0({allowEscapeViewBox:t,coordinate:r,key:"x",offsetTopLeft:n,position:i,reverseDirection:s,tooltipDimension:o.width,viewBox:c,viewBoxDimension:c.width}),f=m0({allowEscapeViewBox:t,coordinate:r,key:"y",offsetTopLeft:n,position:i,reverseDirection:s,tooltipDimension:o.height,viewBox:c,viewBoxDimension:c.height}),d=x3({translateX:u,translateY:f,useTranslate3d:l})):d=m3,{cssProperties:d,cssClasses:g3({translateX:u,translateY:f,coordinate:r})}}function g0(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Bo(e){for(var t=1;t{if(t.key==="Escape"){var r,n,i,s;this.setState({dismissed:!0,dismissedAtCoordinate:{x:(r=(n=this.props.coordinate)===null||n===void 0?void 0:n.x)!==null&&r!==void 0?r:0,y:(i=(s=this.props.coordinate)===null||s===void 0?void 0:s.y)!==null&&i!==void 0?i:0}})}})}componentDidMount(){document.addEventListener("keydown",this.handleKeyDown)}componentWillUnmount(){document.removeEventListener("keydown",this.handleKeyDown)}componentDidUpdate(){var t,r;this.state.dismissed&&(((t=this.props.coordinate)===null||t===void 0?void 0:t.x)!==this.state.dismissedAtCoordinate.x||((r=this.props.coordinate)===null||r===void 0?void 0:r.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}render(){var{active:t,allowEscapeViewBox:r,animationDuration:n,animationEasing:i,children:s,coordinate:o,hasPayload:l,isAnimationActive:c,offset:d,position:u,reverseDirection:f,useTranslate3d:p,viewBox:m,wrapperStyle:x,lastBoundingBox:g,innerRef:b,hasPortalFromProps:v}=this.props,{cssClasses:j,cssProperties:y}=y3({allowEscapeViewBox:r,coordinate:o,offsetTopLeft:d,position:u,reverseDirection:f,tooltipBox:{height:g.height,width:g.width},useTranslate3d:p,viewBox:m}),w=v?{}:Bo(Bo({transition:c&&t?"transform ".concat(n,"ms ").concat(i):void 0},y),{},{pointerEvents:"none",visibility:!this.state.dismissed&&t&&l?"visible":"hidden",position:"absolute",top:0,left:0}),S=Bo(Bo({},w),{},{visibility:!this.state.dismissed&&t&&l?"visible":"hidden"},x);return h.createElement("div",{xmlns:"http://www.w3.org/1999/xhtml",tabIndex:-1,className:j,style:S,ref:b},s)}}var w3=()=>!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout),Ci={devToolsEnabled:!1,isSsr:w3()},qw=()=>{var e;return(e=G(t=>t.rootProps.accessibilityLayer))!==null&&e!==void 0?e:!0};function Gf(){return Gf=Object.assign?Object.assign.bind():function(e){for(var t=1;t_e(e.x)&&_e(e.y),b0=e=>e.base!=null&&Zl(e.base)&&Zl(e),qa=e=>e.x,Ha=e=>e.y,P3=(e,t)=>{if(typeof e=="function")return e;var r="curve".concat(Xs(e));return(r==="curveMonotone"||r==="curveBump")&&t?v0["".concat(r).concat(t==="vertical"?"Y":"X")]:v0[r]||Kc},_3=e=>{var{type:t="linear",points:r=[],baseLine:n,layout:i,connectNulls:s=!1}=e,o=P3(t,i),l=s?r.filter(Zl):r,c;if(Array.isArray(n)){var d=r.map((m,x)=>y0(y0({},m),{},{base:n[x]}));i==="vertical"?c=To().y(Ha).x1(qa).x0(m=>m.base.x):c=To().x(qa).y1(Ha).y0(m=>m.base.y);var u=c.defined(b0).curve(o),f=s?d.filter(b0):d;return u(f)}i==="vertical"&&Y(n)?c=To().y(Ha).x1(qa).x0(n):Y(n)?c=To().x(qa).y1(Ha).y0(n):c=hj().x(qa).y(Ha);var p=c.defined(Zl).curve(o);return p(l)},ds=e=>{var{className:t,points:r,path:n,pathRef:i}=e;if((!r||!r.length)&&!n)return null;var s=r&&r.length?_3(e):n;return h.createElement("path",Gf({},nr(e),Ih(e),{className:ce("recharts-curve",t),d:s===null?void 0:s,ref:i}))},C3=["x","y","top","left","width","height","className"];function Zf(){return Zf=Object.assign?Object.assign.bind():function(e){for(var t=1;t"M".concat(e,",").concat(i,"v").concat(n,"M").concat(s,",").concat(t,"h").concat(r),$3=e=>{var{x:t=0,y:r=0,top:n=0,left:i=0,width:s=0,height:o=0,className:l}=e,c=T3(e,C3),d=A3({x:t,y:r,top:n,left:i,width:s,height:o},c);return!Y(t)||!Y(r)||!Y(s)||!Y(o)||!Y(n)||!Y(i)?null:h.createElement("path",Zf({},ut(d),{className:ce("recharts-cross",l),d:I3(t,r,s,o,n,i)}))};function L3(e,t,r,n){var i=n/2;return{stroke:"none",fill:"#ccc",x:e==="horizontal"?t.x-i:r.left+.5,y:e==="horizontal"?r.top+.5:t.y-i,width:e==="horizontal"?n:r.width-1,height:e==="horizontal"?r.height-1:n}}function w0(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function S0(e){for(var t=1;te.replace(/([A-Z])/g,t=>"-".concat(t.toLowerCase())),Hw=(e,t,r)=>e.map(n=>"".concat(F3(n)," ").concat(t,"ms ").concat(r)).join(","),W3=(e,t)=>[Object.keys(e),Object.keys(t)].reduce((r,n)=>r.filter(i=>n.includes(i))),Ls=(e,t)=>Object.keys(t).reduce((r,n)=>S0(S0({},r),{},{[n]:e(n,t[n])}),{});function N0(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function $e(e){for(var t=1;te+(t-e)*r,Xf=e=>{var{from:t,to:r}=e;return t!==r},Kw=(e,t,r)=>{var n=Ls((i,s)=>{if(Xf(s)){var[o,l]=e(s.from,s.to,s.velocity);return $e($e({},s),{},{from:o,velocity:l})}return s},t);return r<1?Ls((i,s)=>Xf(s)?$e($e({},s),{},{velocity:Xl(s.velocity,n[i].velocity,r),from:Xl(s.from,n[i].from,r)}):s,t):Kw(e,n,r-1)};function K3(e,t,r,n,i,s){var o,l=n.reduce((p,m)=>$e($e({},p),{},{[m]:{from:e[m],velocity:0,to:t[m]}}),{}),c=()=>Ls((p,m)=>m.from,l),d=()=>!Object.values(l).filter(Xf).length,u=null,f=p=>{o||(o=p);var m=p-o,x=m/r.dt;l=Kw(r,l,x),i($e($e($e({},e),t),c())),o=p,d()||(u=s.setTimeout(f))};return()=>(u=s.setTimeout(f),()=>{var p;(p=u)===null||p===void 0||p()})}function V3(e,t,r,n,i,s,o){var l=null,c=i.reduce((f,p)=>$e($e({},f),{},{[p]:[e[p],t[p]]}),{}),d,u=f=>{d||(d=f);var p=(f-d)/n,m=Ls((g,b)=>Xl(...b,r(p)),c);if(s($e($e($e({},e),t),m)),p<1)l=o.setTimeout(u);else{var x=Ls((g,b)=>Xl(...b,r(1)),c);s($e($e($e({},e),t),x))}};return()=>(l=o.setTimeout(u),()=>{var f;(f=l)===null||f===void 0||f()})}const Y3=(e,t,r,n,i,s)=>{var o=W3(e,t);return r==null?()=>(i($e($e({},e),t)),()=>{}):r.isStepper===!0?K3(e,t,r,o,i,s):V3(e,t,r,n,o,i,s)};var Jl=1e-4,Vw=(e,t)=>[0,3*e,3*t-6*e,3*e-3*t+1],Yw=(e,t)=>e.map((r,n)=>r*t**n).reduce((r,n)=>r+n),k0=(e,t)=>r=>{var n=Vw(e,t);return Yw(n,r)},G3=(e,t)=>r=>{var n=Vw(e,t),i=[...n.map((s,o)=>s*o).slice(1),0];return Yw(i,r)},Z3=function(){for(var t=arguments.length,r=new Array(t),n=0;nparseFloat(l));return[o[0],o[1],o[2],o[3]]}}}return r.length===4?r:[0,0,1,1]},X3=(e,t,r,n)=>{var i=k0(e,r),s=k0(t,n),o=G3(e,r),l=d=>d>1?1:d<0?0:d,c=d=>{for(var u=d>1?1:d,f=u,p=0;p<8;++p){var m=i(f)-u,x=o(f);if(Math.abs(m-u)0&&arguments[0]!==void 0?arguments[0]:{},{stiff:r=100,damping:n=8,dt:i=17}=t,s=(o,l,c)=>{var d=-(o-l)*r,u=c*n,f=c+(d-u)*i/1e3,p=c*i/1e3+o;return Math.abs(p-l){if(typeof e=="string")switch(e){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return P0(e);case"spring":return J3();default:if(e.split("(")[0]==="cubic-bezier")return P0(e)}return typeof e=="function"?e:null};function eD(e){var t,r=()=>null,n=!1,i=null,s=o=>{if(!n){if(Array.isArray(o)){if(!o.length)return;var l=o,[c,...d]=l;if(typeof c=="number"){i=e.setTimeout(s.bind(null,d),c);return}s(c),i=e.setTimeout(s.bind(null,d));return}typeof o=="string"&&(t=o,r(t)),typeof o=="object"&&(t=o,r(t)),typeof o=="function"&&o()}};return{stop:()=>{n=!0},start:o=>{n=!1,i&&(i(),i=null),s(o)},subscribe:o=>(r=o,()=>{r=()=>null}),getTimeoutController:()=>e}}class tD{setTimeout(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=performance.now(),i=null,s=o=>{o-n>=r?t(o):typeof requestAnimationFrame=="function"&&(i=requestAnimationFrame(s))};return i=requestAnimationFrame(s),()=>{i!=null&&cancelAnimationFrame(i)}}}function rD(){return eD(new tD)}var nD=h.createContext(rD);function iD(e,t){var r=h.useContext(nD);return h.useMemo(()=>t??r(e),[e,t,r])}var aD={begin:0,duration:1e3,easing:"ease",isActive:!0,canBegin:!0,onAnimationEnd:()=>{},onAnimationStart:()=>{}},_0={t:0},md={t:1};function fu(e){var t=ft(e,aD),{isActive:r,canBegin:n,duration:i,easing:s,begin:o,onAnimationEnd:l,onAnimationStart:c,children:d}=t,u=iD(t.animationId,t.animationManager),[f,p]=h.useState(r?_0:md),m=h.useRef(null);return h.useEffect(()=>{r||p(md)},[r]),h.useEffect(()=>{if(!r||!n)return Pa;var x=Y3(_0,md,Q3(s),i,p,u.getTimeoutController()),g=()=>{m.current=x()};return u.start([c,o,g,i,l]),()=>{u.stop(),m.current&&m.current(),l()}},[r,n,i,s,o,c,l,u]),d(f.t)}function pu(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"animation-",r=h.useRef(Ts(t)),n=h.useRef(e);return n.current!==e&&(r.current=Ts(t),n.current=e),r.current}var sD=["radius"],oD=["radius"];function C0(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function A0(e){for(var t=1;t{var s=Math.min(Math.abs(r)/2,Math.abs(n)/2),o=n>=0?1:-1,l=r>=0?1:-1,c=n>=0&&r>=0||n<0&&r<0?1:0,d;if(s>0&&i instanceof Array){for(var u=[0,0,0,0],f=0,p=4;fs?s:i[f];d="M".concat(e,",").concat(t+o*u[0]),u[0]>0&&(d+="A ".concat(u[0],",").concat(u[0],",0,0,").concat(c,",").concat(e+l*u[0],",").concat(t)),d+="L ".concat(e+r-l*u[1],",").concat(t),u[1]>0&&(d+="A ".concat(u[1],",").concat(u[1],",0,0,").concat(c,`, `).concat(e+r,",").concat(t+o*u[1])),d+="L ".concat(e+r,",").concat(t+n-o*u[2]),u[2]>0&&(d+="A ".concat(u[2],",").concat(u[2],",0,0,").concat(c,`, `).concat(e+r-l*u[2],",").concat(t+n)),d+="L ".concat(e+l*u[3],",").concat(t+n),u[3]>0&&(d+="A ".concat(u[3],",").concat(u[3],",0,0,").concat(c,`, `).concat(e,",").concat(t+n-o*u[3])),d+="Z"}else if(s>0&&i===+i&&i>0){var m=Math.min(s,i);d="M ".concat(e,",").concat(t+o*m,` @@ -348,14 +343,14 @@ Error generating stack: `+s.message+` L `).concat(e+r,",").concat(t+n-o*m,` A `).concat(m,",").concat(m,",0,0,").concat(c,",").concat(e+r-l*m,",").concat(t+n,` L `).concat(e+l*m,",").concat(t+n,` - A `).concat(m,",").concat(m,",0,0,").concat(c,",").concat(e,",").concat(t+n-o*m," Z")}else d="M ".concat(e,",").concat(t," h ").concat(r," v ").concat(n," h ").concat(-r," Z");return d},D0={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},Gw=e=>{var t=ft(e,D0),r=h.useRef(null),[n,i]=h.useState(-1);h.useEffect(()=>{if(r.current&&r.current.getTotalLength)try{var D=r.current.getTotalLength();D&&i(D)}catch{}},[]);var{x:s,y:o,width:l,height:c,radius:d,className:u}=t,{animationEasing:f,animationDuration:p,animationBegin:m,isAnimationActive:x,isUpdateAnimationActive:g}=t,b=h.useRef(l),v=h.useRef(c),j=h.useRef(s),y=h.useRef(o),w=h.useMemo(()=>({x:s,y:o,width:l,height:c,radius:d}),[s,o,l,c,d]),S=pu(w,"rectangle-");if(s!==+s||o!==+o||l!==+l||c!==+c||l===0||c===0)return null;var N=ce("recharts-rectangle",u);if(!g){var P=ut(t),{radius:_}=P,T=O0(P,lD);return h.createElement("path",Ql({},T,{radius:typeof d=="number"?d:void 0,className:N,d:E0(s,o,l,c,d)}))}var $=b.current,M=v.current,C=j.current,R=y.current,q="0px ".concat(n===-1?1:n,"px"),Z="".concat(n,"px 0px"),E=Hw(["strokeDasharray"],p,typeof f=="string"?f:D0.animationEasing);return h.createElement(fu,{animationId:S,key:S,canBegin:n>0,duration:p,easing:f,isActive:g,begin:m},D=>{var O=De($,l,D),k=De(M,c,D),L=De(C,s,D),U=De(R,o,D);r.current&&(b.current=O,v.current=k,j.current=L,y.current=U);var H;x?D>0?H={transition:E,strokeDasharray:Z}:H={strokeDasharray:q}:H={strokeDasharray:Z};var te=ut(t),{radius:re}=te,we=O0(te,cD);return h.createElement("path",Ql({},we,{radius:typeof d=="number"?d:void 0,className:N,d:E0(L,U,O,k,d),ref:r,style:A0(A0({},H),t.style)}))})};function T0(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function M0(e){for(var t=1;te*180/Math.PI,Je=(e,t,r,n)=>({x:e+Math.cos(-ec*n)*r,y:t+Math.sin(-ec*n)*r}),yD=function(t,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(t-(n.left||0)-(n.right||0)),Math.abs(r-(n.top||0)-(n.bottom||0)))/2},vD=(e,t)=>{var{x:r,y:n}=e,{x:i,y:s}=t;return Math.sqrt((r-i)**2+(n-s)**2)},bD=(e,t)=>{var{x:r,y:n}=e,{cx:i,cy:s}=t,o=vD({x:r,y:n},{x:i,y:s});if(o<=0)return{radius:o,angle:0};var l=(r-i)/o,c=Math.acos(l);return n>s&&(c=2*Math.PI-c),{radius:o,angle:xD(c),angleInRadian:c}},jD=e=>{var{startAngle:t,endAngle:r}=e,n=Math.floor(t/360),i=Math.floor(r/360),s=Math.min(n,i);return{startAngle:t-s*360,endAngle:r-s*360}},wD=(e,t)=>{var{startAngle:r,endAngle:n}=t,i=Math.floor(r/360),s=Math.floor(n/360),o=Math.min(i,s);return e+o*360},SD=(e,t)=>{var{chartX:r,chartY:n}=e,{radius:i,angle:s}=bD({x:r,y:n},t),{innerRadius:o,outerRadius:l}=t;if(il||i===0)return null;var{startAngle:c,endAngle:d}=jD(t),u=s,f;if(c<=d){for(;u>d;)u-=360;for(;u=c&&u<=d}else{for(;u>c;)u-=360;for(;u=d&&u<=c}return f?M0(M0({},t),{},{radius:i,angle:wD(u,t)}):null};function Zw(e){var{cx:t,cy:r,radius:n,startAngle:i,endAngle:s}=e,o=Je(t,r,n,i),l=Je(t,r,n,s);return{points:[o,l],cx:t,cy:r,radius:n,startAngle:i,endAngle:s}}function Jf(){return Jf=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var r=Jt(t-e),n=Math.min(Math.abs(t-e),359.999);return r*n},Fo=e=>{var{cx:t,cy:r,radius:n,angle:i,sign:s,isExternal:o,cornerRadius:l,cornerIsExternal:c}=e,d=l*(o?1:-1)+n,u=Math.asin(l/d)/ec,f=c?i:i+s*u,p=Je(t,r,d,f),m=Je(t,r,n,f),x=c?i-s*u:i,g=Je(t,r,d*Math.cos(u*ec),x);return{center:p,circleTangency:m,lineTangency:g,theta:u}},Xw=e=>{var{cx:t,cy:r,innerRadius:n,outerRadius:i,startAngle:s,endAngle:o}=e,l=ND(s,o),c=s+l,d=Je(t,r,i,s),u=Je(t,r,i,c),f="M ".concat(d.x,",").concat(d.y,` + A `).concat(m,",").concat(m,",0,0,").concat(c,",").concat(e,",").concat(t+n-o*m," Z")}else d="M ".concat(e,",").concat(t," h ").concat(r," v ").concat(n," h ").concat(-r," Z");return d},D0={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},Gw=e=>{var t=ft(e,D0),r=h.useRef(null),[n,i]=h.useState(-1);h.useEffect(()=>{if(r.current&&r.current.getTotalLength)try{var D=r.current.getTotalLength();D&&i(D)}catch{}},[]);var{x:s,y:o,width:l,height:c,radius:d,className:u}=t,{animationEasing:f,animationDuration:p,animationBegin:m,isAnimationActive:x,isUpdateAnimationActive:g}=t,b=h.useRef(l),v=h.useRef(c),j=h.useRef(s),y=h.useRef(o),w=h.useMemo(()=>({x:s,y:o,width:l,height:c,radius:d}),[s,o,l,c,d]),S=pu(w,"rectangle-");if(s!==+s||o!==+o||l!==+l||c!==+c||l===0||c===0)return null;var N=ce("recharts-rectangle",u);if(!g){var P=ut(t),{radius:_}=P,T=O0(P,sD);return h.createElement("path",Ql({},T,{radius:typeof d=="number"?d:void 0,className:N,d:E0(s,o,l,c,d)}))}var $=b.current,M=v.current,C=j.current,R=y.current,q="0px ".concat(n===-1?1:n,"px"),Z="".concat(n,"px 0px"),E=Hw(["strokeDasharray"],p,typeof f=="string"?f:D0.animationEasing);return h.createElement(fu,{animationId:S,key:S,canBegin:n>0,duration:p,easing:f,isActive:g,begin:m},D=>{var O=De($,l,D),k=De(M,c,D),L=De(C,s,D),F=De(R,o,D);r.current&&(b.current=O,v.current=k,j.current=L,y.current=F);var H;x?D>0?H={transition:E,strokeDasharray:Z}:H={strokeDasharray:q}:H={strokeDasharray:Z};var te=ut(t),{radius:re}=te,we=O0(te,oD);return h.createElement("path",Ql({},we,{radius:typeof d=="number"?d:void 0,className:N,d:E0(L,F,O,k,d),ref:r,style:A0(A0({},H),t.style)}))})};function T0(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function M0(e){for(var t=1;te*180/Math.PI,Je=(e,t,r,n)=>({x:e+Math.cos(-ec*n)*r,y:t+Math.sin(-ec*n)*r}),gD=function(t,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(t-(n.left||0)-(n.right||0)),Math.abs(r-(n.top||0)-(n.bottom||0)))/2},xD=(e,t)=>{var{x:r,y:n}=e,{x:i,y:s}=t;return Math.sqrt((r-i)**2+(n-s)**2)},yD=(e,t)=>{var{x:r,y:n}=e,{cx:i,cy:s}=t,o=xD({x:r,y:n},{x:i,y:s});if(o<=0)return{radius:o,angle:0};var l=(r-i)/o,c=Math.acos(l);return n>s&&(c=2*Math.PI-c),{radius:o,angle:mD(c),angleInRadian:c}},vD=e=>{var{startAngle:t,endAngle:r}=e,n=Math.floor(t/360),i=Math.floor(r/360),s=Math.min(n,i);return{startAngle:t-s*360,endAngle:r-s*360}},bD=(e,t)=>{var{startAngle:r,endAngle:n}=t,i=Math.floor(r/360),s=Math.floor(n/360),o=Math.min(i,s);return e+o*360},jD=(e,t)=>{var{chartX:r,chartY:n}=e,{radius:i,angle:s}=yD({x:r,y:n},t),{innerRadius:o,outerRadius:l}=t;if(il||i===0)return null;var{startAngle:c,endAngle:d}=vD(t),u=s,f;if(c<=d){for(;u>d;)u-=360;for(;u=c&&u<=d}else{for(;u>c;)u-=360;for(;u=d&&u<=c}return f?M0(M0({},t),{},{radius:i,angle:bD(u,t)}):null};function Zw(e){var{cx:t,cy:r,radius:n,startAngle:i,endAngle:s}=e,o=Je(t,r,n,i),l=Je(t,r,n,s);return{points:[o,l],cx:t,cy:r,radius:n,startAngle:i,endAngle:s}}function Jf(){return Jf=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var r=Jt(t-e),n=Math.min(Math.abs(t-e),359.999);return r*n},Fo=e=>{var{cx:t,cy:r,radius:n,angle:i,sign:s,isExternal:o,cornerRadius:l,cornerIsExternal:c}=e,d=l*(o?1:-1)+n,u=Math.asin(l/d)/ec,f=c?i:i+s*u,p=Je(t,r,d,f),m=Je(t,r,n,f),x=c?i-s*u:i,g=Je(t,r,d*Math.cos(u*ec),x);return{center:p,circleTangency:m,lineTangency:g,theta:u}},Xw=e=>{var{cx:t,cy:r,innerRadius:n,outerRadius:i,startAngle:s,endAngle:o}=e,l=wD(s,o),c=s+l,d=Je(t,r,i,s),u=Je(t,r,i,c),f="M ".concat(d.x,",").concat(d.y,` A `).concat(i,",").concat(i,`,0, `).concat(+(Math.abs(l)>180),",").concat(+(s>c),`, `).concat(u.x,",").concat(u.y,` `);if(n>0){var p=Je(t,r,n,s),m=Je(t,r,n,c);f+="L ".concat(m.x,",").concat(m.y,` A `).concat(n,",").concat(n,`,0, `).concat(+(Math.abs(l)>180),",").concat(+(s<=c),`, - `).concat(p.x,",").concat(p.y," Z")}else f+="L ".concat(t,",").concat(r," Z");return f},kD=e=>{var{cx:t,cy:r,innerRadius:n,outerRadius:i,cornerRadius:s,forceCornerRadius:o,cornerIsExternal:l,startAngle:c,endAngle:d}=e,u=Jt(d-c),{circleTangency:f,lineTangency:p,theta:m}=Fo({cx:t,cy:r,radius:i,angle:c,sign:u,cornerRadius:s,cornerIsExternal:l}),{circleTangency:x,lineTangency:g,theta:b}=Fo({cx:t,cy:r,radius:i,angle:d,sign:-u,cornerRadius:s,cornerIsExternal:l}),v=l?Math.abs(c-d):Math.abs(c-d)-m-b;if(v<0)return o?"M ".concat(p.x,",").concat(p.y,` + `).concat(p.x,",").concat(p.y," Z")}else f+="L ".concat(t,",").concat(r," Z");return f},SD=e=>{var{cx:t,cy:r,innerRadius:n,outerRadius:i,cornerRadius:s,forceCornerRadius:o,cornerIsExternal:l,startAngle:c,endAngle:d}=e,u=Jt(d-c),{circleTangency:f,lineTangency:p,theta:m}=Fo({cx:t,cy:r,radius:i,angle:c,sign:u,cornerRadius:s,cornerIsExternal:l}),{circleTangency:x,lineTangency:g,theta:b}=Fo({cx:t,cy:r,radius:i,angle:d,sign:-u,cornerRadius:s,cornerIsExternal:l}),v=l?Math.abs(c-d):Math.abs(c-d)-m-b;if(v<0)return o?"M ".concat(p.x,",").concat(p.y,` a`).concat(s,",").concat(s,",0,0,1,").concat(s*2,`,0 a`).concat(s,",").concat(s,",0,0,1,").concat(-s*2,`,0 `):Xw({cx:t,cy:r,innerRadius:n,outerRadius:i,startAngle:c,endAngle:d});var j="M ".concat(p.x,",").concat(p.y,` @@ -365,9 +360,9 @@ Error generating stack: `+s.message+` `);if(n>0){var{circleTangency:y,lineTangency:w,theta:S}=Fo({cx:t,cy:r,radius:n,angle:c,sign:u,isExternal:!0,cornerRadius:s,cornerIsExternal:l}),{circleTangency:N,lineTangency:P,theta:_}=Fo({cx:t,cy:r,radius:n,angle:d,sign:-u,isExternal:!0,cornerRadius:s,cornerIsExternal:l}),T=l?Math.abs(c-d):Math.abs(c-d)-S-_;if(T<0&&s===0)return"".concat(j,"L").concat(t,",").concat(r,"Z");j+="L".concat(P.x,",").concat(P.y,` A`).concat(s,",").concat(s,",0,0,").concat(+(u<0),",").concat(N.x,",").concat(N.y,` A`).concat(n,",").concat(n,",0,").concat(+(T>180),",").concat(+(u>0),",").concat(y.x,",").concat(y.y,` - A`).concat(s,",").concat(s,",0,0,").concat(+(u<0),",").concat(w.x,",").concat(w.y,"Z")}else j+="L".concat(t,",").concat(r,"Z");return j},PD={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},Jw=e=>{var t=ft(e,PD),{cx:r,cy:n,innerRadius:i,outerRadius:s,cornerRadius:o,forceCornerRadius:l,cornerIsExternal:c,startAngle:d,endAngle:u,className:f}=t;if(s0&&Math.abs(d-u)<360?g=kD({cx:r,cy:n,innerRadius:i,outerRadius:s,cornerRadius:Math.min(x,m/2),forceCornerRadius:l,cornerIsExternal:c,startAngle:d,endAngle:u}):g=Xw({cx:r,cy:n,innerRadius:i,outerRadius:s,startAngle:d,endAngle:u}),h.createElement("path",Jf({},ut(t),{className:p,d:g}))};function _D(e,t,r){if(e==="horizontal")return[{x:t.x,y:r.top},{x:t.x,y:r.top+r.height}];if(e==="vertical")return[{x:r.left,y:t.y},{x:r.left+r.width,y:t.y}];if(Ej(t)){if(e==="centric"){var{cx:n,cy:i,innerRadius:s,outerRadius:o,angle:l}=t,c=Je(n,i,s,l),d=Je(n,i,o,l);return[{x:c.x,y:c.y},{x:d.x,y:d.y}]}return Zw(t)}}var Qw={},eS={},tS={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Kh;function r(n){return t.isSymbol(n)?NaN:Number(n)}e.toNumber=r})(tS);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=tS;function r(n){return n?(n=t.toNumber(n),n===1/0||n===-1/0?(n<0?-1:1)*Number.MAX_VALUE:n===n?n:0):n===0?n:0}e.toFinite=r})(eS);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Vh,r=eS;function n(i,s,o){o&&typeof o!="number"&&t.isIterateeCall(i,s,o)&&(s=o=void 0),i=r.toFinite(i),s===void 0?(s=i,i=0):s=r.toFinite(s),o=o===void 0?it?1:e>=t?0:NaN}function AD(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function em(e){let t,r,n;e.length!==2?(t=Mn,r=(l,c)=>Mn(e(l),c),n=(l,c)=>e(l)-c):(t=e===Mn||e===AD?e:OD,r=e,n=e);function i(l,c,d=0,u=l.length){if(d>>1;r(l[f],c)<0?d=f+1:u=f}while(d>>1;r(l[f],c)<=0?d=f+1:u=f}while(dd&&n(l[f-1],c)>-n(l[f],c)?f-1:f}return{left:i,center:o,right:s}}function OD(){return 0}function nS(e){return e===null?NaN:+e}function*ED(e,t){for(let r of e)r!=null&&(r=+r)>=r&&(yield r)}const DD=em(Mn),ro=DD.right;em(nS).center;class I0 extends Map{constructor(t,r=ID){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),t!=null)for(const[n,i]of t)this.set(n,i)}get(t){return super.get($0(this,t))}has(t){return super.has($0(this,t))}set(t,r){return super.set(TD(this,t),r)}delete(t){return super.delete(MD(this,t))}}function $0({_intern:e,_key:t},r){const n=t(r);return e.has(n)?e.get(n):r}function TD({_intern:e,_key:t},r){const n=t(r);return e.has(n)?e.get(n):(e.set(n,r),r)}function MD({_intern:e,_key:t},r){const n=t(r);return e.has(n)&&(r=e.get(n),e.delete(n)),r}function ID(e){return e!==null&&typeof e=="object"?e.valueOf():e}function $D(e=Mn){if(e===Mn)return iS;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,r)=>{const n=e(t,r);return n||n===0?n:(e(r,r)===0)-(e(t,t)===0)}}function iS(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et?1:0)}const LD=Math.sqrt(50),zD=Math.sqrt(10),RD=Math.sqrt(2);function tc(e,t,r){const n=(t-e)/Math.max(0,r),i=Math.floor(Math.log10(n)),s=n/Math.pow(10,i),o=s>=LD?10:s>=zD?5:s>=RD?2:1;let l,c,d;return i<0?(d=Math.pow(10,-i)/o,l=Math.round(e*d),c=Math.round(t*d),l/dt&&--c,d=-d):(d=Math.pow(10,i)*o,l=Math.round(e/d),c=Math.round(t/d),l*dt&&--c),c0))return[];if(e===t)return[e];const n=t=i))return[];const l=s-i+1,c=new Array(l);if(n)if(o<0)for(let d=0;d=n)&&(r=n);return r}function z0(e,t){let r;for(const n of e)n!=null&&(r>n||r===void 0&&n>=n)&&(r=n);return r}function aS(e,t,r=0,n=1/0,i){if(t=Math.floor(t),r=Math.floor(Math.max(0,r)),n=Math.floor(Math.min(e.length-1,n)),!(r<=t&&t<=n))return e;for(i=i===void 0?iS:$D(i);n>r;){if(n-r>600){const c=n-r+1,d=t-r+1,u=Math.log(c),f=.5*Math.exp(2*u/3),p=.5*Math.sqrt(u*f*(c-f)/c)*(d-c/2<0?-1:1),m=Math.max(r,Math.floor(t-d*f/c+p)),x=Math.min(n,Math.floor(t+(c-d)*f/c+p));aS(e,t,m,x,i)}const s=e[t];let o=r,l=n;for(Ha(e,r,t),i(e[n],s)>0&&Ha(e,r,n);o0;)--l}i(e[r],s)===0?Ha(e,r,l):(++l,Ha(e,l,n)),l<=t&&(r=l+1),t<=l&&(n=l-1)}return e}function Ha(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function BD(e,t,r){if(e=Float64Array.from(ED(e)),!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return z0(e);if(t>=1)return L0(e);var n,i=(n-1)*t,s=Math.floor(i),o=L0(aS(e,s).subarray(0,s+1)),l=z0(e.subarray(s+1));return o+(l-o)*(i-s)}}function FD(e,t,r=nS){if(!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return+r(e[0],0,e);if(t>=1)return+r(e[n-1],n-1,e);var n,i=(n-1)*t,s=Math.floor(i),o=+r(e[s],s,e),l=+r(e[s+1],s+1,e);return o+(l-o)*(i-s)}}function WD(e,t,r){e=+e,t=+t,r=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+r;for(var n=-1,i=Math.max(0,Math.ceil((t-e)/r))|0,s=new Array(i);++n>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):r===8?Wo(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):r===4?Wo(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=HD.exec(e))?new Nt(t[1],t[2],t[3],1):(t=KD.exec(e))?new Nt(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=VD.exec(e))?Wo(t[1],t[2],t[3],t[4]):(t=YD.exec(e))?Wo(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=GD.exec(e))?H0(t[1],t[2]/100,t[3]/100,1):(t=ZD.exec(e))?H0(t[1],t[2]/100,t[3]/100,t[4]):R0.hasOwnProperty(e)?W0(R0[e]):e==="transparent"?new Nt(NaN,NaN,NaN,0):null}function W0(e){return new Nt(e>>16&255,e>>8&255,e&255,1)}function Wo(e,t,r,n){return n<=0&&(e=t=r=NaN),new Nt(e,t,r,n)}function QD(e){return e instanceof no||(e=Bs(e)),e?(e=e.rgb(),new Nt(e.r,e.g,e.b,e.opacity)):new Nt}function np(e,t,r,n){return arguments.length===1?QD(e):new Nt(e,t,r,n??1)}function Nt(e,t,r,n){this.r=+e,this.g=+t,this.b=+r,this.opacity=+n}nm(Nt,np,oS(no,{brighter(e){return e=e==null?rc:Math.pow(rc,e),new Nt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?zs:Math.pow(zs,e),new Nt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Nt(ui(this.r),ui(this.g),ui(this.b),nc(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:U0,formatHex:U0,formatHex8:e5,formatRgb:q0,toString:q0}));function U0(){return`#${ni(this.r)}${ni(this.g)}${ni(this.b)}`}function e5(){return`#${ni(this.r)}${ni(this.g)}${ni(this.b)}${ni((isNaN(this.opacity)?1:this.opacity)*255)}`}function q0(){const e=nc(this.opacity);return`${e===1?"rgb(":"rgba("}${ui(this.r)}, ${ui(this.g)}, ${ui(this.b)}${e===1?")":`, ${e})`}`}function nc(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ui(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ni(e){return e=ui(e),(e<16?"0":"")+e.toString(16)}function H0(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new pr(e,t,r,n)}function lS(e){if(e instanceof pr)return new pr(e.h,e.s,e.l,e.opacity);if(e instanceof no||(e=Bs(e)),!e)return new pr;if(e instanceof pr)return e;e=e.rgb();var t=e.r/255,r=e.g/255,n=e.b/255,i=Math.min(t,r,n),s=Math.max(t,r,n),o=NaN,l=s-i,c=(s+i)/2;return l?(t===s?o=(r-n)/l+(r0&&c<1?0:o,new pr(o,l,c,e.opacity)}function t5(e,t,r,n){return arguments.length===1?lS(e):new pr(e,t,r,n??1)}function pr(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}nm(pr,t5,oS(no,{brighter(e){return e=e==null?rc:Math.pow(rc,e),new pr(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?zs:Math.pow(zs,e),new pr(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,r=this.l,n=r+(r<.5?r:1-r)*t,i=2*r-n;return new Nt(gd(e>=240?e-240:e+120,i,n),gd(e,i,n),gd(e<120?e+240:e-120,i,n),this.opacity)},clamp(){return new pr(K0(this.h),Uo(this.s),Uo(this.l),nc(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=nc(this.opacity);return`${e===1?"hsl(":"hsla("}${K0(this.h)}, ${Uo(this.s)*100}%, ${Uo(this.l)*100}%${e===1?")":`, ${e})`}`}}));function K0(e){return e=(e||0)%360,e<0?e+360:e}function Uo(e){return Math.max(0,Math.min(1,e||0))}function gd(e,t,r){return(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)*255}const im=e=>()=>e;function r5(e,t){return function(r){return e+r*t}}function n5(e,t,r){return e=Math.pow(e,r),t=Math.pow(t,r)-e,r=1/r,function(n){return Math.pow(e+n*t,r)}}function i5(e){return(e=+e)==1?cS:function(t,r){return r-t?n5(t,r,e):im(isNaN(t)?r:t)}}function cS(e,t){var r=t-e;return r?r5(e,r):im(isNaN(e)?t:e)}const V0=function e(t){var r=i5(t);function n(i,s){var o=r((i=np(i)).r,(s=np(s)).r),l=r(i.g,s.g),c=r(i.b,s.b),d=cS(i.opacity,s.opacity);return function(u){return i.r=o(u),i.g=l(u),i.b=c(u),i.opacity=d(u),i+""}}return n.gamma=e,n}(1);function a5(e,t){t||(t=[]);var r=e?Math.min(t.length,e.length):0,n=t.slice(),i;return function(s){for(i=0;ir&&(s=t.slice(r,s),l[o]?l[o]+=s:l[++o]=s),(n=n[0])===(i=i[0])?l[o]?l[o]+=i:l[++o]=i:(l[++o]=null,c.push({i:o,x:ic(n,i)})),r=xd.lastIndex;return rt&&(r=e,e=t,t=r),function(n){return Math.max(e,Math.min(t,n))}}function g5(e,t,r){var n=e[0],i=e[1],s=t[0],o=t[1];return i2?x5:g5,c=d=null,f}function f(p){return p==null||isNaN(p=+p)?s:(c||(c=l(e.map(n),t,r)))(n(o(p)))}return f.invert=function(p){return o(i((d||(d=l(t,e.map(n),ic)))(p)))},f.domain=function(p){return arguments.length?(e=Array.from(p,ac),u()):e.slice()},f.range=function(p){return arguments.length?(t=Array.from(p),u()):t.slice()},f.rangeRound=function(p){return t=Array.from(p),r=am,u()},f.clamp=function(p){return arguments.length?(o=p?!0:mt,u()):o!==mt},f.interpolate=function(p){return arguments.length?(r=p,u()):r},f.unknown=function(p){return arguments.length?(s=p,f):s},function(p,m){return n=p,i=m,u()}}function sm(){return hu()(mt,mt)}function y5(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function sc(e,t){if((r=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var r,n=e.slice(0,r);return[n.length>1?n[0]+n.slice(2):n,+e.slice(r+1)]}function ma(e){return e=sc(Math.abs(e)),e?e[1]:NaN}function v5(e,t){return function(r,n){for(var i=r.length,s=[],o=0,l=e[0],c=0;i>0&&l>0&&(c+l+1>n&&(l=Math.max(1,n-c)),s.push(r.substring(i-=l,i+l)),!((c+=l+1)>n));)l=e[o=(o+1)%e.length];return s.reverse().join(t)}}function b5(e){return function(t){return t.replace(/[0-9]/g,function(r){return e[+r]})}}var j5=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Fs(e){if(!(t=j5.exec(e)))throw new Error("invalid format: "+e);var t;return new om({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]})}Fs.prototype=om.prototype;function om(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+""}om.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 w5(e){e:for(var t=e.length,r=1,n=-1,i;r0&&(n=0);break}return n>0?e.slice(0,n)+e.slice(i+1):e}var uS;function S5(e,t){var r=sc(e,t);if(!r)return e+"";var n=r[0],i=r[1],s=i-(uS=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=n.length;return s===o?n:s>o?n+new Array(s-o+1).join("0"):s>0?n.slice(0,s)+"."+n.slice(s):"0."+new Array(1-s).join("0")+sc(e,Math.max(0,t+s-1))[0]}function G0(e,t){var r=sc(e,t);if(!r)return e+"";var n=r[0],i=r[1];return i<0?"0."+new Array(-i).join("0")+n:n.length>i+1?n.slice(0,i+1)+"."+n.slice(i+1):n+new Array(i-n.length+2).join("0")}const Z0={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:y5,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)=>G0(e*100,t),r:G0,s:S5,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function X0(e){return e}var J0=Array.prototype.map,Q0=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function N5(e){var t=e.grouping===void 0||e.thousands===void 0?X0:v5(J0.call(e.grouping,Number),e.thousands+""),r=e.currency===void 0?"":e.currency[0]+"",n=e.currency===void 0?"":e.currency[1]+"",i=e.decimal===void 0?".":e.decimal+"",s=e.numerals===void 0?X0:b5(J0.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 d(f){f=Fs(f);var p=f.fill,m=f.align,x=f.sign,g=f.symbol,b=f.zero,v=f.width,j=f.comma,y=f.precision,w=f.trim,S=f.type;S==="n"?(j=!0,S="g"):Z0[S]||(y===void 0&&(y=12),w=!0,S="g"),(b||p==="0"&&m==="=")&&(b=!0,p="0",m="=");var N=g==="$"?r:g==="#"&&/[boxX]/.test(S)?"0"+S.toLowerCase():"",P=g==="$"?n:/[%p]/.test(S)?o:"",_=Z0[S],T=/[defgprs%]/.test(S);y=y===void 0?6:/[gprs]/.test(S)?Math.max(1,Math.min(21,y)):Math.max(0,Math.min(20,y));function $(M){var C=N,R=P,q,Z,E;if(S==="c")R=_(M)+R,M="";else{M=+M;var D=M<0||1/M<0;if(M=isNaN(M)?c:_(Math.abs(M),y),w&&(M=w5(M)),D&&+M==0&&x!=="+"&&(D=!1),C=(D?x==="("?x:l:x==="-"||x==="("?"":x)+C,R=(S==="s"?Q0[8+uS/3]:"")+R+(D&&x==="("?")":""),T){for(q=-1,Z=M.length;++qE||E>57){R=(E===46?i+M.slice(q+1):M.slice(q))+R,M=M.slice(0,q);break}}}j&&!b&&(M=t(M,1/0));var O=C.length+M.length+R.length,k=O>1)+C+M+R+k.slice(O);break;default:M=k+C+M+R;break}return s(M)}return $.toString=function(){return f+""},$}function u(f,p){var m=d((f=Fs(f),f.type="f",f)),x=Math.max(-8,Math.min(8,Math.floor(ma(p)/3)))*3,g=Math.pow(10,-x),b=Q0[8+x/3];return function(v){return m(g*v)+b}}return{format:d,formatPrefix:u}}var qo,lm,dS;k5({thousands:",",grouping:[3],currency:["$",""]});function k5(e){return qo=N5(e),lm=qo.format,dS=qo.formatPrefix,qo}function P5(e){return Math.max(0,-ma(Math.abs(e)))}function _5(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(ma(t)/3)))*3-ma(Math.abs(e)))}function C5(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,ma(t)-ma(e))+1}function fS(e,t,r,n){var i=tp(e,t,r),s;switch(n=Fs(n??",f"),n.type){case"s":{var o=Math.max(Math.abs(e),Math.abs(t));return n.precision==null&&!isNaN(s=_5(i,o))&&(n.precision=s),dS(n,o)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(s=C5(i,Math.max(Math.abs(e),Math.abs(t))))&&(n.precision=s-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(s=P5(i))&&(n.precision=s-(n.type==="%")*2);break}}return lm(n)}function qn(e){var t=e.domain;return e.ticks=function(r){var n=t();return Qf(n[0],n[n.length-1],r??10)},e.tickFormat=function(r,n){var i=t();return fS(i[0],i[i.length-1],r??10,n)},e.nice=function(r){r==null&&(r=10);var n=t(),i=0,s=n.length-1,o=n[i],l=n[s],c,d,u=10;for(l0;){if(d=ep(o,l,r),d===c)return n[i]=o,n[s]=l,t(n);if(d>0)o=Math.floor(o/d)*d,l=Math.ceil(l/d)*d;else if(d<0)o=Math.ceil(o*d)/d,l=Math.floor(l*d)/d;else break;c=d}return e},e}function pS(){var e=sm();return e.copy=function(){return io(e,pS())},or.apply(e,arguments),qn(e)}function hS(e){var t;function r(n){return n==null||isNaN(n=+n)?t:n}return r.invert=r,r.domain=r.range=function(n){return arguments.length?(e=Array.from(n,ac),r):e.slice()},r.unknown=function(n){return arguments.length?(t=n,r):t},r.copy=function(){return hS(e).unknown(t)},e=arguments.length?Array.from(e,ac):[0,1],qn(r)}function mS(e,t){e=e.slice();var r=0,n=e.length-1,i=e[r],s=e[n],o;return sMath.pow(e,t)}function T5(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 ry(e){return(t,r)=>-e(-t,r)}function cm(e){const t=e(ey,ty),r=t.domain;let n=10,i,s;function o(){return i=T5(n),s=D5(n),r()[0]<0?(i=ry(i),s=ry(s),e(A5,O5)):e(ey,ty),t}return t.base=function(l){return arguments.length?(n=+l,o()):n},t.domain=function(l){return arguments.length?(r(l),o()):r()},t.ticks=l=>{const c=r();let d=c[0],u=c[c.length-1];const f=u0){for(;p<=m;++p)for(x=1;xu)break;v.push(g)}}else for(;p<=m;++p)for(x=n-1;x>=1;--x)if(g=p>0?x/s(-p):x*s(p),!(gu)break;v.push(g)}v.length*2{if(l==null&&(l=10),c==null&&(c=n===10?"s":","),typeof c!="function"&&(!(n%1)&&(c=Fs(c)).precision==null&&(c.trim=!0),c=lm(c)),l===1/0)return c;const d=Math.max(1,n*l/t.ticks().length);return u=>{let f=u/s(Math.round(i(u)));return f*nr(mS(r(),{floor:l=>s(Math.floor(i(l))),ceil:l=>s(Math.ceil(i(l)))})),t}function gS(){const e=cm(hu()).domain([1,10]);return e.copy=()=>io(e,gS()).base(e.base()),or.apply(e,arguments),e}function ny(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function iy(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function um(e){var t=1,r=e(ny(t),iy(t));return r.constant=function(n){return arguments.length?e(ny(t=+n),iy(t)):t},qn(r)}function xS(){var e=um(hu());return e.copy=function(){return io(e,xS()).constant(e.constant())},or.apply(e,arguments)}function ay(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function M5(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function I5(e){return e<0?-e*e:e*e}function dm(e){var t=e(mt,mt),r=1;function n(){return r===1?e(mt,mt):r===.5?e(M5,I5):e(ay(r),ay(1/r))}return t.exponent=function(i){return arguments.length?(r=+i,n()):r},qn(t)}function fm(){var e=dm(hu());return e.copy=function(){return io(e,fm()).exponent(e.exponent())},or.apply(e,arguments),e}function $5(){return fm.apply(null,arguments).exponent(.5)}function sy(e){return Math.sign(e)*e*e}function L5(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function yS(){var e=sm(),t=[0,1],r=!1,n;function i(s){var o=L5(e(s));return isNaN(o)?n:r?Math.round(o):o}return i.invert=function(s){return e.invert(sy(s))},i.domain=function(s){return arguments.length?(e.domain(s),i):e.domain()},i.range=function(s){return arguments.length?(e.range((t=Array.from(s,ac)).map(sy)),i):t.slice()},i.rangeRound=function(s){return i.range(s).round(!0)},i.round=function(s){return arguments.length?(r=!!s,i):r},i.clamp=function(s){return arguments.length?(e.clamp(s),i):e.clamp()},i.unknown=function(s){return arguments.length?(n=s,i):n},i.copy=function(){return yS(e.domain(),t).round(r).clamp(e.clamp()).unknown(n)},or.apply(i,arguments),qn(i)}function vS(){var e=[],t=[],r=[],n;function i(){var o=0,l=Math.max(1,t.length);for(r=new Array(l-1);++o0?r[l-1]:e[0],l=r?[n[r-1],t]:[n[d-1],n[d]]},o.unknown=function(c){return arguments.length&&(s=c),o},o.thresholds=function(){return n.slice()},o.copy=function(){return bS().domain([e,t]).range(i).unknown(s)},or.apply(qn(o),arguments)}function jS(){var e=[.5],t=[0,1],r,n=1;function i(s){return s!=null&&s<=s?t[ro(e,s,0,n)]:r}return i.domain=function(s){return arguments.length?(e=Array.from(s),n=Math.min(e.length,t.length-1),i):e.slice()},i.range=function(s){return arguments.length?(t=Array.from(s),n=Math.min(e.length,t.length-1),i):t.slice()},i.invertExtent=function(s){var o=t.indexOf(s);return[e[o-1],e[o]]},i.unknown=function(s){return arguments.length?(r=s,i):r},i.copy=function(){return jS().domain(e).range(t).unknown(r)},or.apply(i,arguments)}const yd=new Date,vd=new Date;function Be(e,t,r,n){function i(s){return e(s=arguments.length===0?new Date:new Date(+s)),s}return i.floor=s=>(e(s=new Date(+s)),s),i.ceil=s=>(e(s=new Date(s-1)),t(s,1),e(s),s),i.round=s=>{const o=i(s),l=i.ceil(s);return s-o(t(s=new Date(+s),o==null?1:Math.floor(o)),s),i.range=(s,o,l)=>{const c=[];if(s=i.ceil(s),l=l==null?1:Math.floor(l),!(s0))return c;let d;do c.push(d=new Date(+s)),t(s,l),e(s);while(dBe(o=>{if(o>=o)for(;e(o),!s(o);)o.setTime(o-1)},(o,l)=>{if(o>=o)if(l<0)for(;++l<=0;)for(;t(o,-1),!s(o););else for(;--l>=0;)for(;t(o,1),!s(o););}),r&&(i.count=(s,o)=>(yd.setTime(+s),vd.setTime(+o),e(yd),e(vd),Math.floor(r(yd,vd))),i.every=s=>(s=Math.floor(s),!isFinite(s)||!(s>0)?null:s>1?i.filter(n?o=>n(o)%s===0:o=>i.count(0,o)%s===0):i)),i}const oc=Be(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);oc.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?Be(t=>{t.setTime(Math.floor(t/e)*e)},(t,r)=>{t.setTime(+t+r*e)},(t,r)=>(r-t)/e):oc);oc.range;const Wr=1e3,Qt=Wr*60,Ur=Qt*60,tn=Ur*24,pm=tn*7,oy=tn*30,bd=tn*365,ii=Be(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*Wr)},(e,t)=>(t-e)/Wr,e=>e.getUTCSeconds());ii.range;const hm=Be(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Wr)},(e,t)=>{e.setTime(+e+t*Qt)},(e,t)=>(t-e)/Qt,e=>e.getMinutes());hm.range;const mm=Be(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*Qt)},(e,t)=>(t-e)/Qt,e=>e.getUTCMinutes());mm.range;const gm=Be(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Wr-e.getMinutes()*Qt)},(e,t)=>{e.setTime(+e+t*Ur)},(e,t)=>(t-e)/Ur,e=>e.getHours());gm.range;const xm=Be(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*Ur)},(e,t)=>(t-e)/Ur,e=>e.getUTCHours());xm.range;const ao=Be(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Qt)/tn,e=>e.getDate()-1);ao.range;const mu=Be(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/tn,e=>e.getUTCDate()-1);mu.range;const wS=Be(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/tn,e=>Math.floor(e/tn));wS.range;function Ai(e){return Be(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,r)=>{t.setDate(t.getDate()+r*7)},(t,r)=>(r-t-(r.getTimezoneOffset()-t.getTimezoneOffset())*Qt)/pm)}const gu=Ai(0),lc=Ai(1),z5=Ai(2),R5=Ai(3),ga=Ai(4),B5=Ai(5),F5=Ai(6);gu.range;lc.range;z5.range;R5.range;ga.range;B5.range;F5.range;function Oi(e){return Be(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCDate(t.getUTCDate()+r*7)},(t,r)=>(r-t)/pm)}const xu=Oi(0),cc=Oi(1),W5=Oi(2),U5=Oi(3),xa=Oi(4),q5=Oi(5),H5=Oi(6);xu.range;cc.range;W5.range;U5.range;xa.range;q5.range;H5.range;const ym=Be(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());ym.range;const vm=Be(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());vm.range;const rn=Be(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());rn.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Be(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,r)=>{t.setFullYear(t.getFullYear()+r*e)});rn.range;const nn=Be(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());nn.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Be(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCFullYear(t.getUTCFullYear()+r*e)});nn.range;function SS(e,t,r,n,i,s){const o=[[ii,1,Wr],[ii,5,5*Wr],[ii,15,15*Wr],[ii,30,30*Wr],[s,1,Qt],[s,5,5*Qt],[s,15,15*Qt],[s,30,30*Qt],[i,1,Ur],[i,3,3*Ur],[i,6,6*Ur],[i,12,12*Ur],[n,1,tn],[n,2,2*tn],[r,1,pm],[t,1,oy],[t,3,3*oy],[e,1,bd]];function l(d,u,f){const p=ub).right(o,p);if(m===o.length)return e.every(tp(d/bd,u/bd,f));if(m===0)return oc.every(Math.max(tp(d,u,f),1));const[x,g]=o[p/o[m-1][2]53)return null;"w"in W||(W.w=1),"Z"in W?(pe=wd(Ka(W.y,0,1)),Et=pe.getUTCDay(),pe=Et>4||Et===0?cc.ceil(pe):cc(pe),pe=mu.offset(pe,(W.V-1)*7),W.y=pe.getUTCFullYear(),W.m=pe.getUTCMonth(),W.d=pe.getUTCDate()+(W.w+6)%7):(pe=jd(Ka(W.y,0,1)),Et=pe.getDay(),pe=Et>4||Et===0?lc.ceil(pe):lc(pe),pe=ao.offset(pe,(W.V-1)*7),W.y=pe.getFullYear(),W.m=pe.getMonth(),W.d=pe.getDate()+(W.w+6)%7)}else("W"in W||"U"in W)&&("w"in W||(W.w="u"in W?W.u%7:"W"in W?1:0),Et="Z"in W?wd(Ka(W.y,0,1)).getUTCDay():jd(Ka(W.y,0,1)).getDay(),W.m=0,W.d="W"in W?(W.w+6)%7+W.W*7-(Et+5)%7:W.w+W.U*7-(Et+6)%7);return"Z"in W?(W.H+=W.Z/100|0,W.M+=W.Z%100,wd(W)):jd(W)}}function _(z,ee,ne,W){for(var bt=0,pe=ee.length,Et=ne.length,Dt,Yn;bt=Et)return-1;if(Dt=ee.charCodeAt(bt++),Dt===37){if(Dt=ee.charAt(bt++),Yn=S[Dt in ly?ee.charAt(bt++):Dt],!Yn||(W=Yn(z,ne,W))<0)return-1}else if(Dt!=ne.charCodeAt(W++))return-1}return W}function T(z,ee,ne){var W=d.exec(ee.slice(ne));return W?(z.p=u.get(W[0].toLowerCase()),ne+W[0].length):-1}function $(z,ee,ne){var W=m.exec(ee.slice(ne));return W?(z.w=x.get(W[0].toLowerCase()),ne+W[0].length):-1}function M(z,ee,ne){var W=f.exec(ee.slice(ne));return W?(z.w=p.get(W[0].toLowerCase()),ne+W[0].length):-1}function C(z,ee,ne){var W=v.exec(ee.slice(ne));return W?(z.m=j.get(W[0].toLowerCase()),ne+W[0].length):-1}function R(z,ee,ne){var W=g.exec(ee.slice(ne));return W?(z.m=b.get(W[0].toLowerCase()),ne+W[0].length):-1}function q(z,ee,ne){return _(z,t,ee,ne)}function Z(z,ee,ne){return _(z,r,ee,ne)}function E(z,ee,ne){return _(z,n,ee,ne)}function D(z){return o[z.getDay()]}function O(z){return s[z.getDay()]}function k(z){return c[z.getMonth()]}function L(z){return l[z.getMonth()]}function U(z){return i[+(z.getHours()>=12)]}function H(z){return 1+~~(z.getMonth()/3)}function te(z){return o[z.getUTCDay()]}function re(z){return s[z.getUTCDay()]}function we(z){return c[z.getUTCMonth()]}function A(z){return l[z.getUTCMonth()]}function J(z){return i[+(z.getUTCHours()>=12)]}function Ot(z){return 1+~~(z.getUTCMonth()/3)}return{format:function(z){var ee=N(z+="",y);return ee.toString=function(){return z},ee},parse:function(z){var ee=P(z+="",!1);return ee.toString=function(){return z},ee},utcFormat:function(z){var ee=N(z+="",w);return ee.toString=function(){return z},ee},utcParse:function(z){var ee=P(z+="",!0);return ee.toString=function(){return z},ee}}}var ly={"-":"",_:" ",0:"0"},Ye=/^\s*\d+/,X5=/^%/,J5=/[\\^$*+?|[\]().{}]/g;function se(e,t,r){var n=e<0?"-":"",i=(n?-e:e)+"",s=i.length;return n+(s[t.toLowerCase(),r]))}function eT(e,t,r){var n=Ye.exec(t.slice(r,r+1));return n?(e.w=+n[0],r+n[0].length):-1}function tT(e,t,r){var n=Ye.exec(t.slice(r,r+1));return n?(e.u=+n[0],r+n[0].length):-1}function rT(e,t,r){var n=Ye.exec(t.slice(r,r+2));return n?(e.U=+n[0],r+n[0].length):-1}function nT(e,t,r){var n=Ye.exec(t.slice(r,r+2));return n?(e.V=+n[0],r+n[0].length):-1}function iT(e,t,r){var n=Ye.exec(t.slice(r,r+2));return n?(e.W=+n[0],r+n[0].length):-1}function cy(e,t,r){var n=Ye.exec(t.slice(r,r+4));return n?(e.y=+n[0],r+n[0].length):-1}function uy(e,t,r){var n=Ye.exec(t.slice(r,r+2));return n?(e.y=+n[0]+(+n[0]>68?1900:2e3),r+n[0].length):-1}function aT(e,t,r){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(r,r+6));return n?(e.Z=n[1]?0:-(n[2]+(n[3]||"00")),r+n[0].length):-1}function sT(e,t,r){var n=Ye.exec(t.slice(r,r+1));return n?(e.q=n[0]*3-3,r+n[0].length):-1}function oT(e,t,r){var n=Ye.exec(t.slice(r,r+2));return n?(e.m=n[0]-1,r+n[0].length):-1}function dy(e,t,r){var n=Ye.exec(t.slice(r,r+2));return n?(e.d=+n[0],r+n[0].length):-1}function lT(e,t,r){var n=Ye.exec(t.slice(r,r+3));return n?(e.m=0,e.d=+n[0],r+n[0].length):-1}function fy(e,t,r){var n=Ye.exec(t.slice(r,r+2));return n?(e.H=+n[0],r+n[0].length):-1}function cT(e,t,r){var n=Ye.exec(t.slice(r,r+2));return n?(e.M=+n[0],r+n[0].length):-1}function uT(e,t,r){var n=Ye.exec(t.slice(r,r+2));return n?(e.S=+n[0],r+n[0].length):-1}function dT(e,t,r){var n=Ye.exec(t.slice(r,r+3));return n?(e.L=+n[0],r+n[0].length):-1}function fT(e,t,r){var n=Ye.exec(t.slice(r,r+6));return n?(e.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function pT(e,t,r){var n=X5.exec(t.slice(r,r+1));return n?r+n[0].length:-1}function hT(e,t,r){var n=Ye.exec(t.slice(r));return n?(e.Q=+n[0],r+n[0].length):-1}function mT(e,t,r){var n=Ye.exec(t.slice(r));return n?(e.s=+n[0],r+n[0].length):-1}function py(e,t){return se(e.getDate(),t,2)}function gT(e,t){return se(e.getHours(),t,2)}function xT(e,t){return se(e.getHours()%12||12,t,2)}function yT(e,t){return se(1+ao.count(rn(e),e),t,3)}function NS(e,t){return se(e.getMilliseconds(),t,3)}function vT(e,t){return NS(e,t)+"000"}function bT(e,t){return se(e.getMonth()+1,t,2)}function jT(e,t){return se(e.getMinutes(),t,2)}function wT(e,t){return se(e.getSeconds(),t,2)}function ST(e){var t=e.getDay();return t===0?7:t}function NT(e,t){return se(gu.count(rn(e)-1,e),t,2)}function kS(e){var t=e.getDay();return t>=4||t===0?ga(e):ga.ceil(e)}function kT(e,t){return e=kS(e),se(ga.count(rn(e),e)+(rn(e).getDay()===4),t,2)}function PT(e){return e.getDay()}function _T(e,t){return se(lc.count(rn(e)-1,e),t,2)}function CT(e,t){return se(e.getFullYear()%100,t,2)}function AT(e,t){return e=kS(e),se(e.getFullYear()%100,t,2)}function OT(e,t){return se(e.getFullYear()%1e4,t,4)}function ET(e,t){var r=e.getDay();return e=r>=4||r===0?ga(e):ga.ceil(e),se(e.getFullYear()%1e4,t,4)}function DT(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+se(t/60|0,"0",2)+se(t%60,"0",2)}function hy(e,t){return se(e.getUTCDate(),t,2)}function TT(e,t){return se(e.getUTCHours(),t,2)}function MT(e,t){return se(e.getUTCHours()%12||12,t,2)}function IT(e,t){return se(1+mu.count(nn(e),e),t,3)}function PS(e,t){return se(e.getUTCMilliseconds(),t,3)}function $T(e,t){return PS(e,t)+"000"}function LT(e,t){return se(e.getUTCMonth()+1,t,2)}function zT(e,t){return se(e.getUTCMinutes(),t,2)}function RT(e,t){return se(e.getUTCSeconds(),t,2)}function BT(e){var t=e.getUTCDay();return t===0?7:t}function FT(e,t){return se(xu.count(nn(e)-1,e),t,2)}function _S(e){var t=e.getUTCDay();return t>=4||t===0?xa(e):xa.ceil(e)}function WT(e,t){return e=_S(e),se(xa.count(nn(e),e)+(nn(e).getUTCDay()===4),t,2)}function UT(e){return e.getUTCDay()}function qT(e,t){return se(cc.count(nn(e)-1,e),t,2)}function HT(e,t){return se(e.getUTCFullYear()%100,t,2)}function KT(e,t){return e=_S(e),se(e.getUTCFullYear()%100,t,2)}function VT(e,t){return se(e.getUTCFullYear()%1e4,t,4)}function YT(e,t){var r=e.getUTCDay();return e=r>=4||r===0?xa(e):xa.ceil(e),se(e.getUTCFullYear()%1e4,t,4)}function GT(){return"+0000"}function my(){return"%"}function gy(e){return+e}function xy(e){return Math.floor(+e/1e3)}var Di,CS,AS;ZT({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 ZT(e){return Di=Z5(e),CS=Di.format,Di.parse,AS=Di.utcFormat,Di.utcParse,Di}function XT(e){return new Date(e)}function JT(e){return e instanceof Date?+e:+new Date(+e)}function bm(e,t,r,n,i,s,o,l,c,d){var u=sm(),f=u.invert,p=u.domain,m=d(".%L"),x=d(":%S"),g=d("%I:%M"),b=d("%I %p"),v=d("%a %d"),j=d("%b %d"),y=d("%B"),w=d("%Y");function S(N){return(c(N)t(i/(e.length-1)))},r.quantiles=function(n){return Array.from({length:n+1},(i,s)=>BD(e,s/n))},r.copy=function(){return TS(t).domain(e)},un.apply(r,arguments)}function vu(){var e=0,t=.5,r=1,n=1,i,s,o,l,c,d=mt,u,f=!1,p;function m(g){return isNaN(g=+g)?p:(g=.5+((g=+u(g))-s)*(n*ge.chartData,nM=I([Kn],e=>{var t=e.chartData!=null?e.chartData.length-1:0;return{chartData:e.chartData,computedData:e.computedData,dataEndIndex:t,dataStartIndex:0}}),bu=(e,t,r,n)=>n?nM(e):Kn(e);function ji(e){if(Array.isArray(e)&&e.length===2){var[t,r]=e;if(_e(t)&&_e(r))return!0}return!1}function yy(e,t,r){return r?e:[Math.min(e[0],t[0]),Math.max(e[1],t[1])]}function LS(e,t){if(t&&typeof e!="function"&&Array.isArray(e)&&e.length===2){var[r,n]=e,i,s;if(_e(r))i=r;else if(typeof r=="function")return;if(_e(n))s=n;else if(typeof n=="function")return;var o=[i,s];if(ji(o))return o}}function iM(e,t,r){if(!(!r&&t==null)){if(typeof e=="function"&&t!=null)try{var n=e(t,r);if(ji(n))return yy(n,t,r)}catch{}if(Array.isArray(e)&&e.length===2){var[i,s]=e,o,l;if(i==="auto")t!=null&&(o=Math.min(...t));else if(Y(i))o=i;else if(typeof i=="function")try{t!=null&&(o=i(t==null?void 0:t[0]))}catch{}else if(typeof i=="string"&&o0.test(i)){var c=o0.exec(i);if(c==null||t==null)o=void 0;else{var d=+c[1];o=t[0]-d}}else o=t==null?void 0:t[0];if(s==="auto")t!=null&&(l=Math.max(...t));else if(Y(s))l=s;else if(typeof s=="function")try{t!=null&&(l=s(t==null?void 0:t[1]))}catch{}else if(typeof s=="string"&&l0.test(s)){var u=l0.exec(s);if(u==null||t==null)l=void 0;else{var f=+u[1];l=t[1]+f}}else l=t==null?void 0:t[1];var p=[o,l];if(ji(p))return t==null?p:yy(p,t,r)}}}var _a=1e9,aM={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},Nm,je=!0,sr="[DecimalError] ",di=sr+"Invalid argument: ",Sm=sr+"Exponent out of range: ",Ca=Math.floor,Qn=Math.pow,sM=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Lt,qe=1e7,xe=7,zS=9007199254740991,uc=Ca(zS/xe),V={};V.absoluteValue=V.abs=function(){var e=new this.constructor(this);return e.s&&(e.s=1),e};V.comparedTo=V.cmp=function(e){var t,r,n,i,s=this;if(e=new s.constructor(e),s.s!==e.s)return s.s||-e.s;if(s.e!==e.e)return s.e>e.e^s.s<0?1:-1;for(n=s.d.length,i=e.d.length,t=0,r=ne.d[t]^s.s<0?1:-1;return n===i?0:n>i^s.s<0?1:-1};V.decimalPlaces=V.dp=function(){var e=this,t=e.d.length-1,r=(t-e.e)*xe;if(t=e.d[t],t)for(;t%10==0;t/=10)r--;return r<0?0:r};V.dividedBy=V.div=function(e){return Vr(this,new this.constructor(e))};V.dividedToIntegerBy=V.idiv=function(e){var t=this,r=t.constructor;return fe(Vr(t,new r(e),0,1),r.precision)};V.equals=V.eq=function(e){return!this.cmp(e)};V.exponent=function(){return Me(this)};V.greaterThan=V.gt=function(e){return this.cmp(e)>0};V.greaterThanOrEqualTo=V.gte=function(e){return this.cmp(e)>=0};V.isInteger=V.isint=function(){return this.e>this.d.length-2};V.isNegative=V.isneg=function(){return this.s<0};V.isPositive=V.ispos=function(){return this.s>0};V.isZero=function(){return this.s===0};V.lessThan=V.lt=function(e){return this.cmp(e)<0};V.lessThanOrEqualTo=V.lte=function(e){return this.cmp(e)<1};V.logarithm=V.log=function(e){var t,r=this,n=r.constructor,i=n.precision,s=i+5;if(e===void 0)e=new n(10);else if(e=new n(e),e.s<1||e.eq(Lt))throw Error(sr+"NaN");if(r.s<1)throw Error(sr+(r.s?"NaN":"-Infinity"));return r.eq(Lt)?new n(0):(je=!1,t=Vr(Ws(r,s),Ws(e,s),s),je=!0,fe(t,i))};V.minus=V.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?FS(t,e):RS(t,(e.s=-e.s,e))};V.modulo=V.mod=function(e){var t,r=this,n=r.constructor,i=n.precision;if(e=new n(e),!e.s)throw Error(sr+"NaN");return r.s?(je=!1,t=Vr(r,e,0,1).times(e),je=!0,r.minus(t)):fe(new n(r),i)};V.naturalExponential=V.exp=function(){return BS(this)};V.naturalLogarithm=V.ln=function(){return Ws(this)};V.negated=V.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};V.plus=V.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?RS(t,e):FS(t,(e.s=-e.s,e))};V.precision=V.sd=function(e){var t,r,n,i=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(di+e);if(t=Me(i)+1,n=i.d.length-1,r=n*xe+1,n=i.d[n],n){for(;n%10==0;n/=10)r--;for(n=i.d[0];n>=10;n/=10)r++}return e&&t>r?t:r};V.squareRoot=V.sqrt=function(){var e,t,r,n,i,s,o,l=this,c=l.constructor;if(l.s<1){if(!l.s)return new c(0);throw Error(sr+"NaN")}for(e=Me(l),je=!1,i=Math.sqrt(+l),i==0||i==1/0?(t=Nr(l.d),(t.length+e)%2==0&&(t+="0"),i=Math.sqrt(t),e=Ca((e+1)/2)-(e<0||e%2),i==1/0?t="5e"+e:(t=i.toExponential(),t=t.slice(0,t.indexOf("e")+1)+e),n=new c(t)):n=new c(i.toString()),r=c.precision,i=o=r+3;;)if(s=n,n=s.plus(Vr(l,s,o+2)).times(.5),Nr(s.d).slice(0,o)===(t=Nr(n.d)).slice(0,o)){if(t=t.slice(o-3,o+1),i==o&&t=="4999"){if(fe(s,r+1,0),s.times(s).eq(l)){n=s;break}}else if(t!="9999")break;o+=4}return je=!0,fe(n,r)};V.times=V.mul=function(e){var t,r,n,i,s,o,l,c,d,u=this,f=u.constructor,p=u.d,m=(e=new f(e)).d;if(!u.s||!e.s)return new f(0);for(e.s*=u.s,r=u.e+e.e,c=p.length,d=m.length,c=0;){for(t=0,i=c+n;i>n;)l=s[i]+m[n]*p[i-n-1]+t,s[i--]=l%qe|0,t=l/qe|0;s[i]=(s[i]+t)%qe|0}for(;!s[--o];)s.pop();return t?++r:s.shift(),e.d=s,e.e=r,je?fe(e,f.precision):e};V.toDecimalPlaces=V.todp=function(e,t){var r=this,n=r.constructor;return r=new n(r),e===void 0?r:(Dr(e,0,_a),t===void 0?t=n.rounding:Dr(t,0,8),fe(r,e+Me(r)+1,t))};V.toExponential=function(e,t){var r,n=this,i=n.constructor;return e===void 0?r=wi(n,!0):(Dr(e,0,_a),t===void 0?t=i.rounding:Dr(t,0,8),n=fe(new i(n),e+1,t),r=wi(n,!0,e+1)),r};V.toFixed=function(e,t){var r,n,i=this,s=i.constructor;return e===void 0?wi(i):(Dr(e,0,_a),t===void 0?t=s.rounding:Dr(t,0,8),n=fe(new s(i),e+Me(i)+1,t),r=wi(n.abs(),!1,e+Me(n)+1),i.isneg()&&!i.isZero()?"-"+r:r)};V.toInteger=V.toint=function(){var e=this,t=e.constructor;return fe(new t(e),Me(e)+1,t.rounding)};V.toNumber=function(){return+this};V.toPower=V.pow=function(e){var t,r,n,i,s,o,l=this,c=l.constructor,d=12,u=+(e=new c(e));if(!e.s)return new c(Lt);if(l=new c(l),!l.s){if(e.s<1)throw Error(sr+"Infinity");return l}if(l.eq(Lt))return l;if(n=c.precision,e.eq(Lt))return fe(l,n);if(t=e.e,r=e.d.length-1,o=t>=r,s=l.s,o){if((r=u<0?-u:u)<=zS){for(i=new c(Lt),t=Math.ceil(n/xe+4),je=!1;r%2&&(i=i.times(l),by(i.d,t)),r=Ca(r/2),r!==0;)l=l.times(l),by(l.d,t);return je=!0,e.s<0?new c(Lt).div(i):fe(i,n)}}else if(s<0)throw Error(sr+"NaN");return s=s<0&&e.d[Math.max(t,r)]&1?-1:1,l.s=1,je=!1,i=e.times(Ws(l,n+d)),je=!0,i=BS(i),i.s=s,i};V.toPrecision=function(e,t){var r,n,i=this,s=i.constructor;return e===void 0?(r=Me(i),n=wi(i,r<=s.toExpNeg||r>=s.toExpPos)):(Dr(e,1,_a),t===void 0?t=s.rounding:Dr(t,0,8),i=fe(new s(i),e,t),r=Me(i),n=wi(i,e<=r||r<=s.toExpNeg,e)),n};V.toSignificantDigits=V.tosd=function(e,t){var r=this,n=r.constructor;return e===void 0?(e=n.precision,t=n.rounding):(Dr(e,1,_a),t===void 0?t=n.rounding:Dr(t,0,8)),fe(new n(r),e,t)};V.toString=V.valueOf=V.val=V.toJSON=V[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,t=Me(e),r=e.constructor;return wi(e,t<=r.toExpNeg||t>=r.toExpPos)};function RS(e,t){var r,n,i,s,o,l,c,d,u=e.constructor,f=u.precision;if(!e.s||!t.s)return t.s||(t=new u(e)),je?fe(t,f):t;if(c=e.d,d=t.d,o=e.e,i=t.e,c=c.slice(),s=o-i,s){for(s<0?(n=c,s=-s,l=d.length):(n=d,i=o,l=c.length),o=Math.ceil(f/xe),l=o>l?o+1:l+1,s>l&&(s=l,n.length=1),n.reverse();s--;)n.push(0);n.reverse()}for(l=c.length,s=d.length,l-s<0&&(s=l,n=d,d=c,c=n),r=0;s;)r=(c[--s]=c[s]+d[s]+r)/qe|0,c[s]%=qe;for(r&&(c.unshift(r),++i),l=c.length;c[--l]==0;)c.pop();return t.d=c,t.e=i,je?fe(t,f):t}function Dr(e,t,r){if(e!==~~e||er)throw Error(di+e)}function Nr(e){var t,r,n,i=e.length-1,s="",o=e[0];if(i>0){for(s+=o,t=1;to?1:-1;else for(l=c=0;li[l]?1:-1;break}return c}function r(n,i,s){for(var o=0;s--;)n[s]-=o,o=n[s]1;)n.shift()}return function(n,i,s,o){var l,c,d,u,f,p,m,x,g,b,v,j,y,w,S,N,P,_,T=n.constructor,$=n.s==i.s?1:-1,M=n.d,C=i.d;if(!n.s)return new T(n);if(!i.s)throw Error(sr+"Division by zero");for(c=n.e-i.e,P=C.length,S=M.length,m=new T($),x=m.d=[],d=0;C[d]==(M[d]||0);)++d;if(C[d]>(M[d]||0)&&--c,s==null?j=s=T.precision:o?j=s+(Me(n)-Me(i))+1:j=s,j<0)return new T(0);if(j=j/xe+2|0,d=0,P==1)for(u=0,C=C[0],j++;(d1&&(C=e(C,u),M=e(M,u),P=C.length,S=M.length),w=P,g=M.slice(0,P),b=g.length;b=qe/2&&++N;do u=0,l=t(C,g,P,b),l<0?(v=g[0],P!=b&&(v=v*qe+(g[1]||0)),u=v/N|0,u>1?(u>=qe&&(u=qe-1),f=e(C,u),p=f.length,b=g.length,l=t(f,g,p,b),l==1&&(u--,r(f,P16)throw Error(Sm+Me(e));if(!e.s)return new u(Lt);for(je=!1,l=f,o=new u(.03125);e.abs().gte(.1);)e=e.times(o),d+=5;for(n=Math.log(Qn(2,d))/Math.LN10*2+5|0,l+=n,r=i=s=new u(Lt),u.precision=l;;){if(i=fe(i.times(e),l),r=r.times(++c),o=s.plus(Vr(i,r,l)),Nr(o.d).slice(0,l)===Nr(s.d).slice(0,l)){for(;d--;)s=fe(s.times(s),l);return u.precision=f,t==null?(je=!0,fe(s,f)):s}s=o}}function Me(e){for(var t=e.e*xe,r=e.d[0];r>=10;r/=10)t++;return t}function Sd(e,t,r){if(t>e.LN10.sd())throw je=!0,r&&(e.precision=r),Error(sr+"LN10 precision limit exceeded");return fe(new e(e.LN10),t)}function xn(e){for(var t="";e--;)t+="0";return t}function Ws(e,t){var r,n,i,s,o,l,c,d,u,f=1,p=10,m=e,x=m.d,g=m.constructor,b=g.precision;if(m.s<1)throw Error(sr+(m.s?"NaN":"-Infinity"));if(m.eq(Lt))return new g(0);if(t==null?(je=!1,d=b):d=t,m.eq(10))return t==null&&(je=!0),Sd(g,d);if(d+=p,g.precision=d,r=Nr(x),n=r.charAt(0),s=Me(m),Math.abs(s)<15e14){for(;n<7&&n!=1||n==1&&r.charAt(1)>3;)m=m.times(e),r=Nr(m.d),n=r.charAt(0),f++;s=Me(m),n>1?(m=new g("0."+r),s++):m=new g(n+"."+r.slice(1))}else return c=Sd(g,d+2,b).times(s+""),m=Ws(new g(n+"."+r.slice(1)),d-p).plus(c),g.precision=b,t==null?(je=!0,fe(m,b)):m;for(l=o=m=Vr(m.minus(Lt),m.plus(Lt),d),u=fe(m.times(m),d),i=3;;){if(o=fe(o.times(u),d),c=l.plus(Vr(o,new g(i),d)),Nr(c.d).slice(0,d)===Nr(l.d).slice(0,d))return l=l.times(2),s!==0&&(l=l.plus(Sd(g,d+2,b).times(s+""))),l=Vr(l,new g(f),d),g.precision=b,t==null?(je=!0,fe(l,b)):l;l=c,i+=2}}function vy(e,t){var r,n,i;for((r=t.indexOf("."))>-1&&(t=t.replace(".","")),(n=t.search(/e/i))>0?(r<0&&(r=n),r+=+t.slice(n+1),t=t.substring(0,n)):r<0&&(r=t.length),n=0;t.charCodeAt(n)===48;)++n;for(i=t.length;t.charCodeAt(i-1)===48;)--i;if(t=t.slice(n,i),t){if(i-=n,r=r-n-1,e.e=Ca(r/xe),e.d=[],n=(r+1)%xe,r<0&&(n+=xe),nuc||e.e<-uc))throw Error(Sm+r)}else e.s=0,e.e=0,e.d=[0];return e}function fe(e,t,r){var n,i,s,o,l,c,d,u,f=e.d;for(o=1,s=f[0];s>=10;s/=10)o++;if(n=t-o,n<0)n+=xe,i=t,d=f[u=0];else{if(u=Math.ceil((n+1)/xe),s=f.length,u>=s)return e;for(d=s=f[u],o=1;s>=10;s/=10)o++;n%=xe,i=n-xe+o}if(r!==void 0&&(s=Qn(10,o-i-1),l=d/s%10|0,c=t<0||f[u+1]!==void 0||d%s,c=r<4?(l||c)&&(r==0||r==(e.s<0?3:2)):l>5||l==5&&(r==4||c||r==6&&(n>0?i>0?d/Qn(10,o-i):0:f[u-1])%10&1||r==(e.s<0?8:7))),t<1||!f[0])return c?(s=Me(e),f.length=1,t=t-s-1,f[0]=Qn(10,(xe-t%xe)%xe),e.e=Ca(-t/xe)||0):(f.length=1,f[0]=e.e=e.s=0),e;if(n==0?(f.length=u,s=1,u--):(f.length=u+1,s=Qn(10,xe-n),f[u]=i>0?(d/Qn(10,o-i)%Qn(10,i)|0)*s:0),c)for(;;)if(u==0){(f[0]+=s)==qe&&(f[0]=1,++e.e);break}else{if(f[u]+=s,f[u]!=qe)break;f[u--]=0,s=1}for(n=f.length;f[--n]===0;)f.pop();if(je&&(e.e>uc||e.e<-uc))throw Error(Sm+Me(e));return e}function FS(e,t){var r,n,i,s,o,l,c,d,u,f,p=e.constructor,m=p.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new p(e),je?fe(t,m):t;if(c=e.d,f=t.d,n=t.e,d=e.e,c=c.slice(),o=d-n,o){for(u=o<0,u?(r=c,o=-o,l=f.length):(r=f,n=d,l=c.length),i=Math.max(Math.ceil(m/xe),l)+2,o>i&&(o=i,r.length=1),r.reverse(),i=o;i--;)r.push(0);r.reverse()}else{for(i=c.length,l=f.length,u=i0;--i)c[l++]=0;for(i=f.length;i>o;){if(c[--i]0?s=s.charAt(0)+"."+s.slice(1)+xn(n):o>1&&(s=s.charAt(0)+"."+s.slice(1)),s=s+(i<0?"e":"e+")+i):i<0?(s="0."+xn(-i-1)+s,r&&(n=r-o)>0&&(s+=xn(n))):i>=o?(s+=xn(i+1-o),r&&(n=r-i-1)>0&&(s=s+"."+xn(n))):((n=i+1)0&&(i+1===o&&(s+="."),s+=xn(n))),e.s<0?"-"+s:s}function by(e,t){if(e.length>t)return e.length=t,!0}function WS(e){var t,r,n;function i(s){var o=this;if(!(o instanceof i))return new i(s);if(o.constructor=i,s instanceof i){o.s=s.s,o.e=s.e,o.d=(s=s.d)?s.slice():s;return}if(typeof s=="number"){if(s*0!==0)throw Error(di+s);if(s>0)o.s=1;else if(s<0)s=-s,o.s=-1;else{o.s=0,o.e=0,o.d=[0];return}if(s===~~s&&s<1e7){o.e=0,o.d=[s];return}return vy(o,s.toString())}else if(typeof s!="string")throw Error(di+s);if(s.charCodeAt(0)===45?(s=s.slice(1),o.s=-1):o.s=1,sM.test(s))vy(o,s);else throw Error(di+s)}if(i.prototype=V,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.clone=WS,i.config=i.set=oM,e===void 0&&(e={}),e)for(n=["precision","rounding","toExpNeg","toExpPos","LN10"],t=0;t=i[t+1]&&n<=i[t+2])this[r]=n;else throw Error(di+r+": "+n);if((n=e[r="LN10"])!==void 0)if(n==Math.LN10)this[r]=new this(n);else throw Error(di+r+": "+n);return this}var Nm=WS(aM);Lt=new Nm(1);const oe=Nm;var lM=e=>e,US={},qS=e=>e===US,jy=e=>function t(){return arguments.length===0||arguments.length===1&&qS(arguments.length<=0?void 0:arguments[0])?t:e(...arguments)},HS=(e,t)=>e===1?t:jy(function(){for(var r=arguments.length,n=new Array(r),i=0;io!==US).length;return s>=e?t(...n):HS(e-s,jy(function(){for(var o=arguments.length,l=new Array(o),c=0;cqS(u)?l.shift():u);return t(...d,...l)}))}),ju=e=>HS(e.length,e),sp=(e,t)=>{for(var r=[],n=e;nArray.isArray(t)?t.map(e):Object.keys(t).map(r=>t[r]).map(e)),uM=function(){for(var t=arguments.length,r=new Array(t),n=0;nc(l),s(...arguments))}},op=e=>Array.isArray(e)?e.reverse():e.split("").reverse().join(""),KS=e=>{var t=null,r=null;return function(){for(var n=arguments.length,i=new Array(n),s=0;s{var c;return o===((c=t)===null||c===void 0?void 0:c[l])})||(t=i,r=e(...i)),r}};function VS(e){var t;return e===0?t=1:t=Math.floor(new oe(e).abs().log(10).toNumber())+1,t}function YS(e,t,r){for(var n=new oe(e),i=0,s=[];n.lt(t)&&i<1e5;)s.push(n.toNumber()),n=n.add(r),i++;return s}ju((e,t,r)=>{var n=+e,i=+t;return n+r*(i-n)});ju((e,t,r)=>{var n=t-+e;return n=n||1/0,(r-e)/n});ju((e,t,r)=>{var n=t-+e;return n=n||1/0,Math.max(0,Math.min(1,(r-e)/n))});var GS=e=>{var[t,r]=e,[n,i]=[t,r];return t>r&&([n,i]=[r,t]),[n,i]},ZS=(e,t,r)=>{if(e.lte(0))return new oe(0);var n=VS(e.toNumber()),i=new oe(10).pow(n),s=e.div(i),o=n!==1?.05:.1,l=new oe(Math.ceil(s.div(o).toNumber())).add(r).mul(o),c=l.mul(i);return t?new oe(c.toNumber()):new oe(Math.ceil(c.toNumber()))},dM=(e,t,r)=>{var n=new oe(1),i=new oe(e);if(!i.isint()&&r){var s=Math.abs(e);s<1?(n=new oe(10).pow(VS(e)-1),i=new oe(Math.floor(i.div(n).toNumber())).mul(n)):s>1&&(i=new oe(Math.floor(e)))}else e===0?i=new oe(Math.floor((t-1)/2)):r||(i=new oe(Math.floor(e)));var o=Math.floor((t-1)/2),l=uM(cM(c=>i.add(new oe(c-o).mul(n)).toNumber()),sp);return l(0,t)},XS=function(t,r,n,i){var s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((r-t)/(n-1)))return{step:new oe(0),tickMin:new oe(0),tickMax:new oe(0)};var o=ZS(new oe(r).sub(t).div(n-1),i,s),l;t<=0&&r>=0?l=new oe(0):(l=new oe(t).add(r).div(2),l=l.sub(new oe(l).mod(o)));var c=Math.ceil(l.sub(t).div(o).toNumber()),d=Math.ceil(new oe(r).sub(l).div(o).toNumber()),u=c+d+1;return u>n?XS(t,r,n,i,s+1):(u0?d+(n-u):d,c=r>0?c:c+(n-u)),{step:o,tickMin:l.sub(new oe(c).mul(o)),tickMax:l.add(new oe(d).mul(o))})};function fM(e){var[t,r]=e,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,s=Math.max(n,2),[o,l]=GS([t,r]);if(o===-1/0||l===1/0){var c=l===1/0?[o,...sp(0,n-1).map(()=>1/0)]:[...sp(0,n-1).map(()=>-1/0),l];return t>r?op(c):c}if(o===l)return dM(o,n,i);var{step:d,tickMin:u,tickMax:f}=XS(o,l,s,i,0),p=YS(u,f.add(new oe(.1).mul(d)),d);return t>r?op(p):p}function pM(e,t){var[r,n]=e,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,[s,o]=GS([r,n]);if(s===-1/0||o===1/0)return[r,n];if(s===o)return[s];var l=Math.max(t,2),c=ZS(new oe(o).sub(s).div(l-1),i,0),d=[...YS(new oe(s),new oe(o),c),o];return i===!1&&(d=d.map(u=>Math.round(u))),r>n?op(d):d}var hM=KS(fM),mM=KS(pM),gM=e=>e.rootProps.barCategoryGap,wu=e=>e.rootProps.stackOffset,km=e=>e.options.chartName,Pm=e=>e.rootProps.syncId,JS=e=>e.rootProps.syncMethod,_m=e=>e.options.eventEmitter,xM=e=>e.rootProps.baseValue,lt={grid:-100,barBackground:-50,area:100,cursorRectangle:200,bar:300,line:400,axis:500,scatter:600,activeBar:1e3,cursorLine:1100,activeDot:1200,label:2e3},zr={allowDuplicatedCategory:!0,angleAxisId:0,reversed:!1,scale:"auto",tick:!0,type:"category"},$t={allowDataOverflow:!1,allowDuplicatedCategory:!0,radiusAxisId:0,scale:"auto",tick:!0,tickCount:5,type:"number"},Su=(e,t)=>{if(!(!e||!t))return e!=null&&e.reversed?[t[1],t[0]]:t},yM={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:!1,dataKey:void 0,domain:void 0,id:zr.angleAxisId,includeHidden:!1,name:void 0,reversed:zr.reversed,scale:zr.scale,tick:zr.tick,tickCount:void 0,ticks:void 0,type:zr.type,unit:void 0},vM={allowDataOverflow:$t.allowDataOverflow,allowDecimals:!1,allowDuplicatedCategory:$t.allowDuplicatedCategory,dataKey:void 0,domain:void 0,id:$t.radiusAxisId,includeHidden:!1,name:void 0,reversed:!1,scale:$t.scale,tick:$t.tick,tickCount:$t.tickCount,ticks:void 0,type:$t.type,unit:void 0},bM={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:zr.allowDuplicatedCategory,dataKey:void 0,domain:void 0,id:zr.angleAxisId,includeHidden:!1,name:void 0,reversed:!1,scale:zr.scale,tick:zr.tick,tickCount:void 0,ticks:void 0,type:"number",unit:void 0},jM={allowDataOverflow:$t.allowDataOverflow,allowDecimals:!1,allowDuplicatedCategory:$t.allowDuplicatedCategory,dataKey:void 0,domain:void 0,id:$t.radiusAxisId,includeHidden:!1,name:void 0,reversed:!1,scale:$t.scale,tick:$t.tick,tickCount:$t.tickCount,ticks:void 0,type:"category",unit:void 0},Cm=(e,t)=>e.polarAxis.angleAxis[t]!=null?e.polarAxis.angleAxis[t]:e.layout.layoutType==="radial"?bM:yM,Am=(e,t)=>e.polarAxis.radiusAxis[t]!=null?e.polarAxis.radiusAxis[t]:e.layout.layoutType==="radial"?jM:vM,Nu=e=>e.polarOptions,Om=I([ln,cn,rt],yD),QS=I([Nu,Om],(e,t)=>{if(e!=null)return Rn(e.innerRadius,t,0)}),e2=I([Nu,Om],(e,t)=>{if(e!=null)return Rn(e.outerRadius,t,t*.8)}),wM=e=>{if(e==null)return[0,0];var{startAngle:t,endAngle:r}=e;return[t,r]},t2=I([Nu],wM);I([Cm,t2],Su);var r2=I([Om,QS,e2],(e,t,r)=>{if(!(e==null||t==null||r==null))return[t,r]});I([Am,r2],Su);var n2=I([ue,Nu,QS,e2,ln,cn],(e,t,r,n,i,s)=>{if(!(e!=="centric"&&e!=="radial"||t==null||r==null||n==null)){var{cx:o,cy:l,startAngle:c,endAngle:d}=t;return{cx:Rn(o,i,i/2),cy:Rn(l,s,s/2),innerRadius:r,outerRadius:n,startAngle:c,endAngle:d,clockWise:!1}}}),Fe=(e,t)=>t,ku=(e,t,r)=>r;function Em(e){return e==null?void 0:e.id}function i2(e,t,r){var{chartData:n=[]}=t,{allowDuplicatedCategory:i,dataKey:s}=r,o=new Map;return e.forEach(l=>{var c,d=(c=l.data)!==null&&c!==void 0?c:n;if(!(d==null||d.length===0)){var u=Em(l);d.forEach((f,p)=>{var m=s==null||i?p:String(et(f,s,null)),x=et(f,l.dataKey,0),g;o.has(m)?g=o.get(m):g={},Object.assign(g,{[u]:x}),o.set(m,g)})}}),Array.from(o.values())}function Dm(e){return e.stackId!=null&&e.dataKey!=null}var Pu=(e,t)=>e===t?!0:e==null||t==null?!1:e[0]===t[0]&&e[1]===t[1];function _u(e,t){return Array.isArray(e)&&Array.isArray(t)&&e.length===0&&t.length===0?!0:e===t}function SM(e,t){if(e.length===t.length){for(var r=0;r{var t=ue(e);return t==="horizontal"?"xAxis":t==="vertical"?"yAxis":t==="centric"?"angleAxis":"radiusAxis"},Aa=e=>e.tooltip.settings.axisId;function wy(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function dc(e){for(var t=1;te.cartesianAxis.xAxis[t],dn=(e,t)=>{var r=a2(e,t);return r??Tt},Mt={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:lp,hide:!0,id:0,includeHidden:!1,interval:"preserveEnd",minTickGap:5,mirror:!1,name:void 0,orientation:"left",padding:{top:0,bottom:0},reversed:!1,scale:"auto",tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:"number",unit:void 0,width:eo},s2=(e,t)=>e.cartesianAxis.yAxis[t],fn=(e,t)=>{var r=s2(e,t);return r??Mt},_M={domain:[0,"auto"],includeHidden:!1,reversed:!1,allowDataOverflow:!1,allowDuplicatedCategory:!1,dataKey:void 0,id:0,name:"",range:[64,64],scale:"auto",type:"number",unit:""},Tm=(e,t)=>{var r=e.cartesianAxis.zAxis[t];return r??_M},vt=(e,t,r)=>{switch(t){case"xAxis":return dn(e,r);case"yAxis":return fn(e,r);case"zAxis":return Tm(e,r);case"angleAxis":return Cm(e,r);case"radiusAxis":return Am(e,r);default:throw new Error("Unexpected axis type: ".concat(t))}},CM=(e,t,r)=>{switch(t){case"xAxis":return dn(e,r);case"yAxis":return fn(e,r);default:throw new Error("Unexpected axis type: ".concat(t))}},so=(e,t,r)=>{switch(t){case"xAxis":return dn(e,r);case"yAxis":return fn(e,r);case"angleAxis":return Cm(e,r);case"radiusAxis":return Am(e,r);default:throw new Error("Unexpected axis type: ".concat(t))}},o2=e=>e.graphicalItems.cartesianItems.some(t=>t.type==="bar")||e.graphicalItems.polarItems.some(t=>t.type==="radialBar");function l2(e,t){return r=>{switch(e){case"xAxis":return"xAxisId"in r&&r.xAxisId===t;case"yAxis":return"yAxisId"in r&&r.yAxisId===t;case"zAxis":return"zAxisId"in r&&r.zAxisId===t;case"angleAxis":return"angleAxisId"in r&&r.angleAxisId===t;case"radiusAxis":return"radiusAxisId"in r&&r.radiusAxisId===t;default:return!1}}}var Mm=e=>e.graphicalItems.cartesianItems,AM=I([Fe,ku],l2),c2=(e,t,r)=>e.filter(r).filter(n=>(t==null?void 0:t.includeHidden)===!0?!0:!n.hide),oo=I([Mm,vt,AM],c2,{memoizeOptions:{resultEqualityCheck:_u}}),u2=I([oo],e=>e.filter(t=>t.type==="area"||t.type==="bar").filter(Dm)),d2=e=>e.filter(t=>!("stackId"in t)||t.stackId===void 0),OM=I([oo],d2),f2=e=>e.map(t=>t.data).filter(Boolean).flat(1),EM=I([oo],f2,{memoizeOptions:{resultEqualityCheck:_u}}),p2=(e,t)=>{var{chartData:r=[],dataStartIndex:n,dataEndIndex:i}=t;return e.length>0?e:r.slice(n,i+1)},Im=I([EM,bu],p2),h2=(e,t,r)=>(t==null?void 0:t.dataKey)!=null?e.map(n=>({value:et(n,t.dataKey)})):r.length>0?r.map(n=>n.dataKey).flatMap(n=>e.map(i=>({value:et(i,n)}))):e.map(n=>({value:n})),Cu=I([Im,vt,oo],h2);function m2(e,t){switch(e){case"xAxis":return t.direction==="x";case"yAxis":return t.direction==="y";default:return!1}}function ll(e){if(Or(e)||e instanceof Date){var t=Number(e);if(_e(t))return t}}function Sy(e){if(Array.isArray(e)){var t=[ll(e[0]),ll(e[1])];return ji(t)?t:void 0}var r=ll(e);if(r!=null)return[r,r]}function an(e){return e.map(ll).filter(F6)}function DM(e,t,r){return!r||typeof t!="number"||yr(t)?[]:r.length?an(r.flatMap(n=>{var i=et(e,n.dataKey),s,o;if(Array.isArray(i)?[s,o]=i:s=o=i,!(!_e(s)||!_e(o)))return[t-s,t+o]})):[]}var Ue=e=>{var t=We(e),r=Aa(e);return so(e,t,r)},g2=I([Ue],e=>e==null?void 0:e.dataKey),TM=I([u2,bu,Ue],i2),x2=(e,t,r)=>{var n={},i=t.reduce((s,o)=>(o.stackId==null||(s[o.stackId]==null&&(s[o.stackId]=[]),s[o.stackId].push(o)),s),n);return Object.fromEntries(Object.entries(i).map(s=>{var[o,l]=s,c=l.map(Em);return[o,{stackedData:_E(e,c,r),graphicalItems:l}]}))},cp=I([TM,u2,wu],x2),y2=(e,t,r,n)=>{var{dataStartIndex:i,dataEndIndex:s}=t;if(n==null&&r!=="zAxis"){var o=EE(e,i,s);if(!(o!=null&&o[0]===0&&o[1]===0))return o}},MM=I([vt],e=>e.allowDataOverflow),$m=e=>{var t;if(e==null||!("domain"in e))return lp;if(e.domain!=null)return e.domain;if(e.ticks!=null){if(e.type==="number"){var r=an(e.ticks);return[Math.min(...r),Math.max(...r)]}if(e.type==="category")return e.ticks.map(String)}return(t=e==null?void 0:e.domain)!==null&&t!==void 0?t:lp},v2=I([vt],$m),b2=I([v2,MM],LS),IM=I([cp,Kn,Fe,b2],y2,{memoizeOptions:{resultEqualityCheck:Pu}}),Lm=e=>e.errorBars,$M=(e,t,r)=>e.flatMap(n=>t[n.id]).filter(Boolean).filter(n=>m2(r,n)),fc=function(){for(var t=arguments.length,r=new Array(t),n=0;n{var s,o;if(r.length>0&&e.forEach(l=>{r.forEach(c=>{var d,u,f=(d=n[c.id])===null||d===void 0?void 0:d.filter(v=>m2(i,v)),p=et(l,(u=t.dataKey)!==null&&u!==void 0?u:c.dataKey),m=DM(l,p,f);if(m.length>=2){var x=Math.min(...m),g=Math.max(...m);(s==null||xo)&&(o=g)}var b=Sy(p);b!=null&&(s=s==null?b[0]:Math.min(s,b[0]),o=o==null?b[1]:Math.max(o,b[1]))})}),(t==null?void 0:t.dataKey)!=null&&e.forEach(l=>{var c=Sy(et(l,t.dataKey));c!=null&&(s=s==null?c[0]:Math.min(s,c[0]),o=o==null?c[1]:Math.max(o,c[1]))}),_e(s)&&_e(o))return[s,o]},LM=I([Im,vt,OM,Lm,Fe],j2,{memoizeOptions:{resultEqualityCheck:Pu}});function zM(e){var{value:t}=e;if(Or(t)||t instanceof Date)return t}var RM=(e,t,r)=>{var n=e.map(zM).filter(i=>i!=null);return r&&(t.dataKey==null||t.allowDuplicatedCategory&&_j(n))?rS(0,e.length):t.allowDuplicatedCategory?n:Array.from(new Set(n))},w2=e=>e.referenceElements.dots,Oa=(e,t,r)=>e.filter(n=>n.ifOverflow==="extendDomain").filter(n=>t==="xAxis"?n.xAxisId===r:n.yAxisId===r),BM=I([w2,Fe,ku],Oa),S2=e=>e.referenceElements.areas,FM=I([S2,Fe,ku],Oa),N2=e=>e.referenceElements.lines,WM=I([N2,Fe,ku],Oa),k2=(e,t)=>{var r=an(e.map(n=>t==="xAxis"?n.x:n.y));if(r.length!==0)return[Math.min(...r),Math.max(...r)]},UM=I(BM,Fe,k2),P2=(e,t)=>{var r=an(e.flatMap(n=>[t==="xAxis"?n.x1:n.y1,t==="xAxis"?n.x2:n.y2]));if(r.length!==0)return[Math.min(...r),Math.max(...r)]},qM=I([FM,Fe],P2);function HM(e){var t;if(e.x!=null)return an([e.x]);var r=(t=e.segment)===null||t===void 0?void 0:t.map(n=>n.x);return r==null||r.length===0?[]:an(r)}function KM(e){var t;if(e.y!=null)return an([e.y]);var r=(t=e.segment)===null||t===void 0?void 0:t.map(n=>n.y);return r==null||r.length===0?[]:an(r)}var _2=(e,t)=>{var r=e.flatMap(n=>t==="xAxis"?HM(n):KM(n));if(r.length!==0)return[Math.min(...r),Math.max(...r)]},VM=I([WM,Fe],_2),YM=I(UM,VM,qM,(e,t,r)=>fc(e,r,t)),C2=(e,t,r,n,i,s,o,l)=>{if(r!=null)return r;var c=o==="vertical"&&l==="xAxis"||o==="horizontal"&&l==="yAxis",d=c?fc(n,s,i):fc(s,i);return iM(t,d,e.allowDataOverflow)},GM=I([vt,v2,b2,IM,LM,YM,ue,Fe],C2,{memoizeOptions:{resultEqualityCheck:Pu}}),ZM=[0,1],A2=(e,t,r,n,i,s,o)=>{if(!((e==null||r==null||r.length===0)&&o===void 0)){var{dataKey:l,type:c}=e,d=Mr(t,s);if(d&&l==null){var u;return rS(0,(u=r==null?void 0:r.length)!==null&&u!==void 0?u:0)}return c==="category"?RM(n,e,d):i==="expand"?ZM:o}},zm=I([vt,ue,Im,Cu,wu,Fe,GM],A2),O2=(e,t,r,n,i)=>{if(e!=null){var{scale:s,type:o}=e;if(s==="auto")return t==="radial"&&i==="radiusAxis"?"band":t==="radial"&&i==="angleAxis"?"linear":o==="category"&&n&&(n.indexOf("LineChart")>=0||n.indexOf("AreaChart")>=0||n.indexOf("ComposedChart")>=0&&!r)?"point":o==="category"?"band":"linear";if(typeof s=="string"){var l="scale".concat(Xs(s));return l in es?l:"point"}}},lo=I([vt,ue,o2,km,Fe],O2);function XM(e){if(e!=null){if(e in es)return es[e]();var t="scale".concat(Xs(e));if(t in es)return es[t]()}}function Rm(e,t,r,n){if(!(r==null||n==null)){if(typeof e.scale=="function")return e.scale.copy().domain(r).range(n);var i=XM(t);if(i!=null){var s=i.domain(r).range(n);return SE(s),s}}}var E2=(e,t,r)=>{var n=$m(t);if(!(r!=="auto"&&r!=="linear")){if(t!=null&&t.tickCount&&Array.isArray(n)&&(n[0]==="auto"||n[1]==="auto")&&ji(e))return hM(e,t.tickCount,t.allowDecimals);if(t!=null&&t.tickCount&&t.type==="number"&&ji(e))return mM(e,t.tickCount,t.allowDecimals)}},Bm=I([zm,so,lo],E2),D2=(e,t,r,n)=>{if(n!=="angleAxis"&&(e==null?void 0:e.type)==="number"&&ji(t)&&Array.isArray(r)&&r.length>0){var i=t[0],s=r[0],o=t[1],l=r[r.length-1];return[Math.min(i,s),Math.max(o,l)]}return t},JM=I([vt,zm,Bm,Fe],D2),QM=I(Cu,vt,(e,t)=>{if(!(!t||t.type!=="number")){var r=1/0,n=Array.from(an(e.map(l=>l.value))).sort((l,c)=>l-c);if(n.length<2)return 1/0;var i=n[n.length-1]-n[0];if(i===0)return 1/0;for(var s=0;sn,(e,t,r,n,i)=>{if(!_e(e))return 0;var s=t==="vertical"?n.height:n.width;if(i==="gap")return e*s/2;if(i==="no-gap"){var o=Rn(r,e*s),l=e*s/2;return l-o-(l-o)/s*o}return 0}),eI=(e,t)=>{var r=dn(e,t);return r==null||typeof r.padding!="string"?0:T2(e,"xAxis",t,r.padding)},tI=(e,t)=>{var r=fn(e,t);return r==null||typeof r.padding!="string"?0:T2(e,"yAxis",t,r.padding)},rI=I(dn,eI,(e,t)=>{var r,n;if(e==null)return{left:0,right:0};var{padding:i}=e;return typeof i=="string"?{left:t,right:t}:{left:((r=i.left)!==null&&r!==void 0?r:0)+t,right:((n=i.right)!==null&&n!==void 0?n:0)+t}}),nI=I(fn,tI,(e,t)=>{var r,n;if(e==null)return{top:0,bottom:0};var{padding:i}=e;return typeof i=="string"?{top:t,bottom:t}:{top:((r=i.top)!==null&&r!==void 0?r:0)+t,bottom:((n=i.bottom)!==null&&n!==void 0?n:0)+t}}),iI=I([rt,rI,cu,lu,(e,t,r)=>r],(e,t,r,n,i)=>{var{padding:s}=n;return i?[s.left,r.width-s.right]:[e.left+t.left,e.left+e.width-t.right]}),aI=I([rt,ue,nI,cu,lu,(e,t,r)=>r],(e,t,r,n,i,s)=>{var{padding:o}=i;return s?[n.height-o.bottom,o.top]:t==="horizontal"?[e.top+e.height-r.bottom,e.top+r.top]:[e.top+r.top,e.top+e.height-r.bottom]}),co=(e,t,r,n)=>{var i;switch(t){case"xAxis":return iI(e,r,n);case"yAxis":return aI(e,r,n);case"zAxis":return(i=Tm(e,r))===null||i===void 0?void 0:i.range;case"angleAxis":return t2(e);case"radiusAxis":return r2(e,r);default:return}},M2=I([vt,co],Su),Ea=I([vt,lo,JM,M2],Rm);I([oo,Lm,Fe],$M);function I2(e,t){return e.idt.id?1:0}var Au=(e,t)=>t,Ou=(e,t,r)=>r,sI=I(su,Au,Ou,(e,t,r)=>e.filter(n=>n.orientation===t).filter(n=>n.mirror===r).sort(I2)),oI=I(ou,Au,Ou,(e,t,r)=>e.filter(n=>n.orientation===t).filter(n=>n.mirror===r).sort(I2)),$2=(e,t)=>({width:e.width,height:t.height}),lI=(e,t)=>{var r=typeof t.width=="number"?t.width:eo;return{width:r,height:e.height}},cI=I(rt,dn,$2),uI=(e,t,r)=>{switch(t){case"top":return e.top;case"bottom":return r-e.bottom;default:return 0}},dI=(e,t,r)=>{switch(t){case"left":return e.left;case"right":return r-e.right;default:return 0}},fI=I(cn,rt,sI,Au,Ou,(e,t,r,n,i)=>{var s={},o;return r.forEach(l=>{var c=$2(t,l);o==null&&(o=uI(t,n,e));var d=n==="top"&&!i||n==="bottom"&&i;s[l.id]=o-Number(d)*c.height,o+=(d?-1:1)*c.height}),s}),pI=I(ln,rt,oI,Au,Ou,(e,t,r,n,i)=>{var s={},o;return r.forEach(l=>{var c=lI(t,l);o==null&&(o=dI(t,n,e));var d=n==="left"&&!i||n==="right"&&i;s[l.id]=o-Number(d)*c.width,o+=(d?-1:1)*c.width}),s}),hI=(e,t)=>{var r=dn(e,t);if(r!=null)return fI(e,r.orientation,r.mirror)},mI=I([rt,dn,hI,(e,t)=>t],(e,t,r,n)=>{if(t!=null){var i=r==null?void 0:r[n];return i==null?{x:e.left,y:0}:{x:e.left,y:i}}}),gI=(e,t)=>{var r=fn(e,t);if(r!=null)return pI(e,r.orientation,r.mirror)},xI=I([rt,fn,gI,(e,t)=>t],(e,t,r,n)=>{if(t!=null){var i=r==null?void 0:r[n];return i==null?{x:0,y:e.top}:{x:i,y:e.top}}}),yI=I(rt,fn,(e,t)=>{var r=typeof t.width=="number"?t.width:eo;return{width:r,height:e.height}}),L2=(e,t,r,n)=>{if(r!=null){var{allowDuplicatedCategory:i,type:s,dataKey:o}=r,l=Mr(e,n),c=t.map(d=>d.value);if(o&&l&&s==="category"&&i&&_j(c))return c}},Fm=I([ue,Cu,vt,Fe],L2),z2=(e,t,r,n)=>{if(!(r==null||r.dataKey==null)){var{type:i,scale:s}=r,o=Mr(e,n);if(o&&(i==="number"||s!=="auto"))return t.map(l=>l.value)}},Wm=I([ue,Cu,so,Fe],z2),Ny=I([ue,CM,lo,Ea,Fm,Wm,co,Bm,Fe],(e,t,r,n,i,s,o,l,c)=>{if(t!=null){var d=Mr(e,c);return{angle:t.angle,interval:t.interval,minTickGap:t.minTickGap,orientation:t.orientation,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit,axisType:c,categoricalDomain:s,duplicateDomain:i,isCategorical:d,niceTicks:l,range:o,realScaleType:r,scale:n}}}),vI=(e,t,r,n,i,s,o,l,c)=>{if(!(t==null||n==null)){var d=Mr(e,c),{type:u,ticks:f,tickCount:p}=t,m=r==="scaleBand"&&typeof n.bandwidth=="function"?n.bandwidth()/2:2,x=u==="category"&&n.bandwidth?n.bandwidth()/m:0;x=c==="angleAxis"&&s!=null&&s.length>=2?Jt(s[0]-s[1])*2*x:x;var g=f||i;if(g){var b=g.map((v,j)=>{var y=o?o.indexOf(v):v;return{index:j,coordinate:n(y)+x,value:v,offset:x}});return b.filter(v=>_e(v.coordinate))}return d&&l?l.map((v,j)=>({coordinate:n(v)+x,value:v,index:j,offset:x})).filter(v=>_e(v.coordinate)):n.ticks?n.ticks(p).map(v=>({coordinate:n(v)+x,value:v,offset:x})):n.domain().map((v,j)=>({coordinate:n(v)+x,value:o?o[v]:v,index:j,offset:x}))}},R2=I([ue,so,lo,Ea,Bm,co,Fm,Wm,Fe],vI),bI=(e,t,r,n,i,s,o)=>{if(!(t==null||r==null||n==null||n[0]===n[1])){var l=Mr(e,o),{tickCount:c}=t,d=0;return d=o==="angleAxis"&&(n==null?void 0:n.length)>=2?Jt(n[0]-n[1])*2*d:d,l&&s?s.map((u,f)=>({coordinate:r(u)+d,value:u,index:f,offset:d})):r.ticks?r.ticks(c).map(u=>({coordinate:r(u)+d,value:u,offset:d})):r.domain().map((u,f)=>({coordinate:r(u)+d,value:i?i[u]:u,index:f,offset:d}))}},Eu=I([ue,so,Ea,co,Fm,Wm,Fe],bI),Du=I(vt,Ea,(e,t)=>{if(!(e==null||t==null))return dc(dc({},e),{},{scale:t})}),jI=I([vt,lo,zm,M2],Rm);I((e,t,r)=>Tm(e,r),jI,(e,t)=>{if(!(e==null||t==null))return dc(dc({},e),{},{scale:t})});var wI=I([ue,su,ou],(e,t,r)=>{switch(e){case"horizontal":return t.some(n=>n.reversed)?"right-to-left":"left-to-right";case"vertical":return r.some(n=>n.reversed)?"bottom-to-top":"top-to-bottom";case"centric":case"radial":return"left-to-right";default:return}}),B2=e=>e.options.defaultTooltipEventType,F2=e=>e.options.validateTooltipEventTypes;function W2(e,t,r){if(e==null)return t;var n=e?"axis":"item";return r==null?t:r.includes(n)?n:t}function Um(e,t){var r=B2(e),n=F2(e);return W2(t,r,n)}function SI(e){return G(t=>Um(t,e))}var U2=(e,t)=>{var r,n=Number(t);if(!(yr(n)||t==null))return n>=0?e==null||(r=e[n])===null||r===void 0?void 0:r.value:void 0},NI=e=>e.tooltip.settings,jn={active:!1,index:null,dataKey:void 0,coordinate:void 0},kI={itemInteraction:{click:jn,hover:jn},axisInteraction:{click:jn,hover:jn},keyboardInteraction:jn,syncInteraction:{active:!1,index:null,dataKey:void 0,label:void 0,coordinate:void 0,sourceViewBox:void 0},tooltipItemPayloads:[],settings:{shared:void 0,trigger:"hover",axisId:0,active:!1,defaultIndex:void 0}},q2=At({name:"tooltip",initialState:kI,reducers:{addTooltipEntrySettings:{reducer(e,t){e.tooltipItemPayloads.push(t.payload)},prepare:Le()},removeTooltipEntrySettings:{reducer(e,t){var r=Kr(e).tooltipItemPayloads.indexOf(t.payload);r>-1&&e.tooltipItemPayloads.splice(r,1)},prepare:Le()},setTooltipSettingsState(e,t){e.settings=t.payload},setActiveMouseOverItemIndex(e,t){e.syncInteraction.active=!1,e.keyboardInteraction.active=!1,e.itemInteraction.hover.active=!0,e.itemInteraction.hover.index=t.payload.activeIndex,e.itemInteraction.hover.dataKey=t.payload.activeDataKey,e.itemInteraction.hover.coordinate=t.payload.activeCoordinate},mouseLeaveChart(e){e.itemInteraction.hover.active=!1,e.axisInteraction.hover.active=!1},mouseLeaveItem(e){e.itemInteraction.hover.active=!1},setActiveClickItemIndex(e,t){e.syncInteraction.active=!1,e.itemInteraction.click.active=!0,e.keyboardInteraction.active=!1,e.itemInteraction.click.index=t.payload.activeIndex,e.itemInteraction.click.dataKey=t.payload.activeDataKey,e.itemInteraction.click.coordinate=t.payload.activeCoordinate},setMouseOverAxisIndex(e,t){e.syncInteraction.active=!1,e.axisInteraction.hover.active=!0,e.keyboardInteraction.active=!1,e.axisInteraction.hover.index=t.payload.activeIndex,e.axisInteraction.hover.dataKey=t.payload.activeDataKey,e.axisInteraction.hover.coordinate=t.payload.activeCoordinate},setMouseClickAxisIndex(e,t){e.syncInteraction.active=!1,e.keyboardInteraction.active=!1,e.axisInteraction.click.active=!0,e.axisInteraction.click.index=t.payload.activeIndex,e.axisInteraction.click.dataKey=t.payload.activeDataKey,e.axisInteraction.click.coordinate=t.payload.activeCoordinate},setSyncInteraction(e,t){e.syncInteraction=t.payload},setKeyboardInteraction(e,t){e.keyboardInteraction.active=t.payload.active,e.keyboardInteraction.index=t.payload.activeIndex,e.keyboardInteraction.coordinate=t.payload.activeCoordinate,e.keyboardInteraction.dataKey=t.payload.activeDataKey}}}),{addTooltipEntrySettings:PI,removeTooltipEntrySettings:_I,setTooltipSettingsState:CI,setActiveMouseOverItemIndex:AI,mouseLeaveItem:A7,mouseLeaveChart:H2,setActiveClickItemIndex:O7,setMouseOverAxisIndex:K2,setMouseClickAxisIndex:OI,setSyncInteraction:up,setKeyboardInteraction:dp}=q2.actions,EI=q2.reducer;function ky(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Ho(e){for(var t=1;t{if(t==null)return jn;var i=II(e,t,r);if(i==null)return jn;if(i.active)return i;if(e.keyboardInteraction.active)return e.keyboardInteraction;if(e.syncInteraction.active&&e.syncInteraction.index!=null)return e.syncInteraction;var s=e.settings.active===!0;if($I(i)){if(s)return Ho(Ho({},i),{},{active:!0})}else if(n!=null)return{active:!0,coordinate:void 0,dataKey:void 0,index:n};return Ho(Ho({},jn),{},{coordinate:i.coordinate})},qm=(e,t)=>{var r=e==null?void 0:e.index;if(r==null)return null;var n=Number(r);if(!_e(n))return r;var i=0,s=1/0;return t.length>0&&(s=t.length-1),String(Math.max(i,Math.min(n,s)))},Y2=(e,t,r,n,i,s,o,l)=>{if(!(s==null||l==null)){var c=o[0],d=c==null?void 0:l(c.positions,s);if(d!=null)return d;var u=i==null?void 0:i[Number(s)];if(u)switch(r){case"horizontal":return{x:u.coordinate,y:(n.top+t)/2};default:return{x:(n.left+e)/2,y:u.coordinate}}}},G2=(e,t,r,n)=>{if(t==="axis")return e.tooltipItemPayloads;if(e.tooltipItemPayloads.length===0)return[];var i;return r==="hover"?i=e.itemInteraction.hover.dataKey:i=e.itemInteraction.click.dataKey,i==null&&n!=null?[e.tooltipItemPayloads[0]]:e.tooltipItemPayloads.filter(s=>{var o;return((o=s.settings)===null||o===void 0?void 0:o.dataKey)===i})},uo=e=>e.options.tooltipPayloadSearcher,Da=e=>e.tooltip;function Py(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function _y(e){for(var t=1;t{if(!(t==null||s==null)){var{chartData:l,computedData:c,dataStartIndex:d,dataEndIndex:u}=r,f=[];return e.reduce((p,m)=>{var x,{dataDefinedOnItem:g,settings:b}=m,v=BI(g,l),j=Array.isArray(v)?Cw(v,d,u):v,y=(x=b==null?void 0:b.dataKey)!==null&&x!==void 0?x:n,w=b==null?void 0:b.nameKey,S;if(n&&Array.isArray(j)&&!Array.isArray(j[0])&&o==="axis"?S=Cj(j,n,i):S=s(j,t,c,w),Array.isArray(S))S.forEach(P=>{var _=_y(_y({},b),{},{name:P.name,unit:P.unit,color:void 0,fill:void 0});p.push(c0({tooltipEntrySettings:_,dataKey:P.dataKey,payload:P.payload,value:et(P.payload,P.dataKey),name:P.name}))});else{var N;p.push(c0({tooltipEntrySettings:b,dataKey:y,payload:S,value:et(S,y),name:(N=et(S,w))!==null&&N!==void 0?N:b==null?void 0:b.name}))}return p},f)}},Hm=I([Ue,ue,o2,km,We],O2),FI=I([e=>e.graphicalItems.cartesianItems,e=>e.graphicalItems.polarItems],(e,t)=>[...e,...t]),WI=I([We,Aa],l2),fo=I([FI,Ue,WI],c2,{memoizeOptions:{resultEqualityCheck:_u}}),UI=I([fo],e=>e.filter(Dm)),qI=I([fo],f2,{memoizeOptions:{resultEqualityCheck:_u}}),Ta=I([qI,Kn],p2),HI=I([UI,Kn,Ue],i2),Km=I([Ta,Ue,fo],h2),X2=I([Ue],$m),KI=I([Ue],e=>e.allowDataOverflow),J2=I([X2,KI],LS),VI=I([fo],e=>e.filter(Dm)),YI=I([HI,VI,wu],x2),GI=I([YI,Kn,We,J2],y2),ZI=I([fo],d2),XI=I([Ta,Ue,ZI,Lm,We],j2,{memoizeOptions:{resultEqualityCheck:Pu}}),JI=I([w2,We,Aa],Oa),QI=I([JI,We],k2),e$=I([S2,We,Aa],Oa),t$=I([e$,We],P2),r$=I([N2,We,Aa],Oa),n$=I([r$,We],_2),i$=I([QI,n$,t$],fc),a$=I([Ue,X2,J2,GI,XI,i$,ue,We],C2),Q2=I([Ue,ue,Ta,Km,wu,We,a$],A2),s$=I([Q2,Ue,Hm],E2),o$=I([Ue,Q2,s$,We],D2),eN=e=>{var t=We(e),r=Aa(e),n=!1;return co(e,t,r,n)},tN=I([Ue,eN],Su),rN=I([Ue,Hm,o$,tN],Rm),l$=I([ue,Km,Ue,We],L2),c$=I([ue,Km,Ue,We],z2),u$=(e,t,r,n,i,s,o,l)=>{if(t){var{type:c}=t,d=Mr(e,l);if(n){var u=r==="scaleBand"&&n.bandwidth?n.bandwidth()/2:2,f=c==="category"&&n.bandwidth?n.bandwidth()/u:0;return f=l==="angleAxis"&&i!=null&&(i==null?void 0:i.length)>=2?Jt(i[0]-i[1])*2*f:f,d&&o?o.map((p,m)=>({coordinate:n(p)+f,value:p,index:m,offset:f})):n.domain().map((p,m)=>({coordinate:n(p)+f,value:s?s[p]:p,index:m,offset:f}))}}},pn=I([ue,Ue,Hm,rN,eN,l$,c$,We],u$),Vm=I([B2,F2,NI],(e,t,r)=>W2(r.shared,e,t)),nN=e=>e.tooltip.settings.trigger,Ym=e=>e.tooltip.settings.defaultIndex,Tu=I([Da,Vm,nN,Ym],V2),Us=I([Tu,Ta],qm),iN=I([pn,Us],U2),d$=I([Tu],e=>{if(e)return e.dataKey}),aN=I([Da,Vm,nN,Ym],G2),f$=I([ln,cn,ue,rt,pn,Ym,aN,uo],Y2),p$=I([Tu,f$],(e,t)=>e!=null&&e.coordinate?e.coordinate:t),h$=I([Tu],e=>e.active),m$=I([aN,Us,Kn,g2,iN,uo,Vm],Z2),g$=I([m$],e=>{if(e!=null){var t=e.map(r=>r.payload).filter(r=>r!=null);return Array.from(new Set(t))}});function Cy(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Ay(e){for(var t=1;tG(Ue),j$=()=>{var e=b$(),t=G(pn),r=G(rN);return ha(!e||!r?void 0:Ay(Ay({},e),{},{scale:r}),t)};function Oy(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Ti(e){for(var t=1;t{var i=t.find(s=>s&&s.index===r);if(i){if(e==="horizontal")return{x:i.coordinate,y:n.chartY};if(e==="vertical")return{x:n.chartX,y:i.coordinate}}return{x:0,y:0}},P$=(e,t,r,n)=>{var i=t.find(d=>d&&d.index===r);if(i){if(e==="centric"){var s=i.coordinate,{radius:o}=n;return Ti(Ti(Ti({},n),Je(n.cx,n.cy,o,s)),{},{angle:s,radius:o})}var l=i.coordinate,{angle:c}=n;return Ti(Ti(Ti({},n),Je(n.cx,n.cy,l,c)),{},{angle:c,radius:l})}return{angle:0,clockWise:!1,cx:0,cy:0,endAngle:0,innerRadius:0,outerRadius:0,radius:0,startAngle:0,x:0,y:0}};function _$(e,t){var{chartX:r,chartY:n}=e;return r>=t.left&&r<=t.left+t.width&&n>=t.top&&n<=t.top+t.height}var sN=(e,t,r,n,i)=>{var s,o=-1,l=(s=t==null?void 0:t.length)!==null&&s!==void 0?s:0;if(l<=1||e==null)return 0;if(n==="angleAxis"&&i!=null&&Math.abs(Math.abs(i[1]-i[0])-360)<=1e-6)for(var c=0;c0?r[c-1].coordinate:r[l-1].coordinate,u=r[c].coordinate,f=c>=l-1?r[0].coordinate:r[c+1].coordinate,p=void 0;if(Jt(u-d)!==Jt(f-u)){var m=[];if(Jt(f-u)===Jt(i[1]-i[0])){p=f;var x=u+i[1]-i[0];m[0]=Math.min(x,(x+d)/2),m[1]=Math.max(x,(x+d)/2)}else{p=d;var g=f+i[1]-i[0];m[0]=Math.min(u,(g+u)/2),m[1]=Math.max(u,(g+u)/2)}var b=[Math.min(u,(p+u)/2),Math.max(u,(p+u)/2)];if(e>b[0]&&e<=b[1]||e>=m[0]&&e<=m[1]){({index:o}=r[c]);break}}else{var v=Math.min(d,f),j=Math.max(d,f);if(e>(v+u)/2&&e<=(j+u)/2){({index:o}=r[c]);break}}}else if(t){for(var y=0;y0&&y(t[y].coordinate+t[y-1].coordinate)/2&&e<=(t[y].coordinate+t[y+1].coordinate)/2||y===l-1&&e>(t[y].coordinate+t[y-1].coordinate)/2){({index:o}=t[y]);break}}return o},oN=()=>G(km),Gm=(e,t)=>t,lN=(e,t,r)=>r,Zm=(e,t,r,n)=>n,C$=I(pn,e=>Qc(e,t=>t.coordinate)),Xm=I([Da,Gm,lN,Zm],V2),cN=I([Xm,Ta],qm),A$=(e,t,r)=>{if(t!=null){var n=Da(e);return t==="axis"?r==="hover"?n.axisInteraction.hover.dataKey:n.axisInteraction.click.dataKey:r==="hover"?n.itemInteraction.hover.dataKey:n.itemInteraction.click.dataKey}},uN=I([Da,Gm,lN,Zm],G2),pc=I([ln,cn,ue,rt,pn,Zm,uN,uo],Y2),O$=I([Xm,pc],(e,t)=>{var r;return(r=e.coordinate)!==null&&r!==void 0?r:t}),dN=I([pn,cN],U2),E$=I([uN,cN,Kn,g2,dN,uo,Gm],Z2),D$=I([Xm],e=>({isActive:e.active,activeIndex:e.index})),T$=(e,t,r,n,i,s,o)=>{if(!(!e||!r||!n||!i)&&_$(e,o)){var l=DE(e,t),c=sN(l,s,i,r,n),d=k$(t,i,c,e);return{activeIndex:String(c),activeCoordinate:d}}},M$=(e,t,r,n,i,s,o)=>{if(!(!e||!n||!i||!s||!r)){var l=SD(e,r);if(l){var c=TE(l,t),d=sN(c,o,s,n,i),u=P$(t,s,d,l);return{activeIndex:String(d),activeCoordinate:u}}}},I$=(e,t,r,n,i,s,o,l)=>{if(!(!e||!t||!n||!i||!s))return t==="horizontal"||t==="vertical"?T$(e,t,n,i,s,o,l):M$(e,t,r,n,i,s,o)},$$=I(e=>e.zIndex.zIndexMap,(e,t)=>t,(e,t,r)=>r,(e,t,r)=>{if(t!=null){var n=e[t];if(n!=null)return r?n.panoramaElementId:n.elementId}}),L$=I(e=>e.zIndex.zIndexMap,e=>{var t=Object.keys(e).map(n=>parseInt(n,10)).concat(Object.values(lt)),r=Array.from(new Set(t));return r.sort((n,i)=>n-i)},{memoizeOptions:{resultEqualityCheck:SM}});function Ey(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Dy(e){for(var t=1;tDy(Dy({},e),{},{[t]:{elementId:void 0,panoramaElementId:void 0,consumers:0}}),F$)},U$=new Set(Object.values(lt));function q$(e){return U$.has(e)}var fN=At({name:"zIndex",initialState:W$,reducers:{registerZIndexPortal:{reducer:(e,t)=>{var{zIndex:r}=t.payload;e.zIndexMap[r]?e.zIndexMap[r].consumers+=1:e.zIndexMap[r]={consumers:1,elementId:void 0,panoramaElementId:void 0}},prepare:Le()},unregisterZIndexPortal:{reducer:(e,t)=>{var{zIndex:r}=t.payload;e.zIndexMap[r]&&(e.zIndexMap[r].consumers-=1,e.zIndexMap[r].consumers<=0&&!q$(r)&&delete e.zIndexMap[r])},prepare:Le()},registerZIndexPortalId:{reducer:(e,t)=>{var{zIndex:r,elementId:n,isPanorama:i}=t.payload;e.zIndexMap[r]?i?e.zIndexMap[r].panoramaElementId=n:e.zIndexMap[r].elementId=n:e.zIndexMap[r]={consumers:0,elementId:i?void 0:n,panoramaElementId:i?n:void 0}},prepare:Le()},unregisterZIndexPortalId:{reducer:(e,t)=>{var{zIndex:r}=t.payload;e.zIndexMap[r]&&(t.payload.isPanorama?e.zIndexMap[r].panoramaElementId=void 0:e.zIndexMap[r].elementId=void 0)},prepare:Le()}}}),{registerZIndexPortal:H$,unregisterZIndexPortal:K$,registerZIndexPortalId:V$,unregisterZIndexPortalId:Y$}=fN.actions,G$=fN.reducer;function Ir(e){var{zIndex:t,children:r}=e,n=o3(),i=n&&t!==void 0&&t!==0,s=pt(),o=Ve();h.useLayoutEffect(()=>i?(o(H$({zIndex:t})),()=>{o(K$({zIndex:t}))}):ka,[o,t,i]);var l=G(d=>$$(d,t,s));if(!i)return r;if(!l)return null;var c=document.getElementById(l);return c?bh.createPortal(r,c):null}function fp(){return fp=Object.assign?Object.assign.bind():function(e){for(var t=1;th.useContext(pN),hN={exports:{}};(function(e){var t=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function i(c,d,u){this.fn=c,this.context=d,this.once=u||!1}function s(c,d,u,f,p){if(typeof u!="function")throw new TypeError("The listener must be a function");var m=new i(u,f||c,p),x=r?r+d:d;return c._events[x]?c._events[x].fn?c._events[x]=[c._events[x],m]:c._events[x].push(m):(c._events[x]=m,c._eventsCount++),c}function o(c,d){--c._eventsCount===0?c._events=new n:delete c._events[d]}function l(){this._events=new n,this._eventsCount=0}l.prototype.eventNames=function(){var d=[],u,f;if(this._eventsCount===0)return d;for(f in u=this._events)t.call(u,f)&&d.push(r?f.slice(1):f);return Object.getOwnPropertySymbols?d.concat(Object.getOwnPropertySymbols(u)):d},l.prototype.listeners=function(d){var u=r?r+d:d,f=this._events[u];if(!f)return[];if(f.fn)return[f.fn];for(var p=0,m=f.length,x=new Array(m);p{e.eventEmitter==null&&(e.eventEmitter=Symbol("rechartsEventEmitter"))}}}),sL=gN.reducer,{createEventEmitter:oL}=gN.actions;function lL(e){return e.tooltip.syncInteraction}var cL={chartData:void 0,computedData:void 0,dataStartIndex:0,dataEndIndex:0},xN=At({name:"chartData",initialState:cL,reducers:{setChartData(e,t){if(e.chartData=t.payload,t.payload==null){e.dataStartIndex=0,e.dataEndIndex=0;return}t.payload.length>0&&e.dataEndIndex!==t.payload.length-1&&(e.dataEndIndex=t.payload.length-1)},setComputedData(e,t){e.computedData=t.payload},setDataStartEndIndexes(e,t){var{startIndex:r,endIndex:n}=t.payload;r!=null&&(e.dataStartIndex=r),n!=null&&(e.dataEndIndex=n)}}}),{setChartData:Iy,setDataStartEndIndexes:uL,setComputedData:E7}=xN.actions,dL=xN.reducer,fL=["x","y"];function $y(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Mi(e){for(var t=1;tc.rootProps.className);h.useEffect(()=>{if(e==null)return ka;var c=(d,u,f)=>{if(t!==f&&e===d){if(n==="index"){var p;if(o&&u!==null&&u!==void 0&&(p=u.payload)!==null&&p!==void 0&&p.coordinate&&u.payload.sourceViewBox){var m=u.payload.coordinate,{x,y:g}=m,b=gL(m,fL),{x:v,y:j,width:y,height:w}=u.payload.sourceViewBox,S=Mi(Mi({},b),{},{x:o.x+(y?(x-v)/y:0)*o.width,y:o.y+(w?(g-j)/w:0)*o.height});r(Mi(Mi({},u),{},{payload:Mi(Mi({},u.payload),{},{coordinate:S})}))}else r(u);return}if(i!=null){var N;if(typeof n=="function"){var P={activeTooltipIndex:u.payload.index==null?void 0:Number(u.payload.index),isTooltipActive:u.payload.active,activeIndex:u.payload.index==null?void 0:Number(u.payload.index),activeLabel:u.payload.label,activeDataKey:u.payload.dataKey,activeCoordinate:u.payload.coordinate},_=n(i,P);N=i[_]}else n==="value"&&(N=i.find(E=>String(E.value)===u.payload.label));var{coordinate:T}=u.payload;if(N==null||u.payload.active===!1||T==null||o==null){r(up({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0}));return}var{x:$,y:M}=T,C=Math.min($,o.x+o.width),R=Math.min(M,o.y+o.height),q={x:s==="horizontal"?N.coordinate:C,y:s==="horizontal"?R:N.coordinate},Z=up({active:u.payload.active,coordinate:q,dataKey:u.payload.dataKey,index:String(N.index),label:u.payload.label,sourceViewBox:u.payload.sourceViewBox});r(Z)}}};return qs.on(pp,c),()=>{qs.off(pp,c)}},[l,r,t,e,n,i,s,o])}function vL(){var e=G(Pm),t=G(_m),r=Ve();h.useEffect(()=>{if(e==null)return ka;var n=(i,s,o)=>{t!==o&&e===i&&r(uL(s))};return qs.on(My,n),()=>{qs.off(My,n)}},[r,t,e])}function bL(){var e=Ve();h.useEffect(()=>{e(oL())},[e]),yL(),vL()}function jL(e,t,r,n,i,s){var o=G(m=>A$(m,e,t)),l=G(_m),c=G(Pm),d=G(JS),u=G(lL),f=u==null?void 0:u.active,p=uu();h.useEffect(()=>{if(!f&&c!=null&&l!=null){var m=up({active:s,coordinate:r,dataKey:o,index:i,label:typeof n=="number"?String(n):n,sourceViewBox:p});qs.emit(pp,c,m,l)}},[f,r,o,i,n,l,c,d,s,p])}function Ly(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function zy(e){for(var t=1;t{P(CI({shared:j,trigger:y,axisId:N,active:i,defaultIndex:_}))},[P,j,y,N,i,_]);var T=uu(),$=qw(),M=SI(j),{activeIndex:C,isActive:R}=(t=G(J=>D$(J,M,y,_)))!==null&&t!==void 0?t:{},q=G(J=>E$(J,M,y,_)),Z=G(J=>dN(J,M,y,_)),E=G(J=>O$(J,M,y,_)),D=q,O=rL(),k=(r=i??R)!==null&&r!==void 0?r:!1,[L,U]=w4([D,k]),H=M==="axis"?Z:void 0;jL(M,y,E,H,C,k);var te=S??O;if(te==null||T==null||M==null)return null;var re=D??Ry;k||(re=Ry),d&&re.length&&(re=a4(re.filter(J=>J.value!=null&&(J.hide!==!0||n.includeHidden)),p,kL));var we=re.length>0,A=h.createElement(S3,{allowEscapeViewBox:s,animationDuration:o,animationEasing:l,isAnimationActive:u,active:k,coordinate:E,hasPayload:we,offset:f,position:m,reverseDirection:x,useTranslate3d:g,viewBox:T,wrapperStyle:b,lastBoundingBox:L,innerRef:U,hasPortalFromProps:!!S},PL(c,zy(zy({},n),{},{payload:re,label:H,active:k,activeIndex:C,coordinate:E,accessibilityLayer:$})));return h.createElement(h.Fragment,null,bh.createPortal(A,te),k&&h.createElement(tL,{cursor:v,tooltipEventType:M,coordinate:E,payload:re,index:C}))}function CL(e,t,r){return(t=AL(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function AL(e){var t=OL(e,"string");return typeof t=="symbol"?t:t+""}function OL(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}class EL{constructor(t){CL(this,"cache",new Map),this.maxSize=t}get(t){var r=this.cache.get(t);return r!==void 0&&(this.cache.delete(t),this.cache.set(t,r)),r}set(t,r){if(this.cache.has(t))this.cache.delete(t);else if(this.cache.size>=this.maxSize){var n=this.cache.keys().next().value;this.cache.delete(n)}this.cache.set(t,r)}clear(){this.cache.clear()}size(){return this.cache.size}}function Fy(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function DL(e){for(var t=1;t{try{var r=document.getElementById(Uy);r||(r=document.createElement("span"),r.setAttribute("id",Uy),r.setAttribute("aria-hidden","true"),document.body.appendChild(r)),Object.assign(r.style,LL,t),r.textContent="".concat(e);var n=r.getBoundingClientRect();return{width:n.width,height:n.height}}catch{return{width:0,height:0}}},ds=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(t==null||Ci.isSsr)return{width:0,height:0};if(!yN.enableCache)return qy(t,r);var n=zL(t,r),i=Wy.get(n);if(i)return i;var s=qy(t,r);return Wy.set(n,s),s},Hy=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,Ky=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,RL=/^px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q$/,BL=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,vN={cm:96/2.54,mm:96/25.4,pt:96/72,pc:96/6,in:96,Q:96/(2.54*40),px:1},FL=Object.keys(vN),Gi="NaN";function WL(e,t){return e*vN[t]}class jt{static parse(t){var r,[,n,i]=(r=BL.exec(t))!==null&&r!==void 0?r:[];return new jt(parseFloat(n),i??"")}constructor(t,r){this.num=t,this.unit=r,this.num=t,this.unit=r,yr(t)&&(this.unit=""),r!==""&&!RL.test(r)&&(this.num=NaN,this.unit=""),FL.includes(r)&&(this.num=WL(t,r),this.unit="px")}add(t){return this.unit!==t.unit?new jt(NaN,""):new jt(this.num+t.num,this.unit)}subtract(t){return this.unit!==t.unit?new jt(NaN,""):new jt(this.num-t.num,this.unit)}multiply(t){return this.unit!==""&&t.unit!==""&&this.unit!==t.unit?new jt(NaN,""):new jt(this.num*t.num,this.unit||t.unit)}divide(t){return this.unit!==""&&t.unit!==""&&this.unit!==t.unit?new jt(NaN,""):new jt(this.num/t.num,this.unit||t.unit)}toString(){return"".concat(this.num).concat(this.unit)}isNaN(){return yr(this.num)}}function bN(e){if(e.includes(Gi))return Gi;for(var t=e;t.includes("*")||t.includes("/");){var r,[,n,i,s]=(r=Hy.exec(t))!==null&&r!==void 0?r:[],o=jt.parse(n??""),l=jt.parse(s??""),c=i==="*"?o.multiply(l):o.divide(l);if(c.isNaN())return Gi;t=t.replace(Hy,c.toString())}for(;t.includes("+")||/.-\d+(?:\.\d+)?/.test(t);){var d,[,u,f,p]=(d=Ky.exec(t))!==null&&d!==void 0?d:[],m=jt.parse(u??""),x=jt.parse(p??""),g=f==="+"?m.add(x):m.subtract(x);if(g.isNaN())return Gi;t=t.replace(Ky,g.toString())}return t}var Vy=/\(([^()]*)\)/;function UL(e){for(var t=e,r;(r=Vy.exec(t))!=null;){var[,n]=r;t=t.replace(Vy,bN(n))}return t}function qL(e){var t=e.replace(/\s+/g,"");return t=UL(t),t=bN(t),t}function HL(e){try{return qL(e)}catch{return Gi}}function Nd(e){var t=HL(e.slice(5,-1));return t===Gi?"":t}var KL=["x","y","lineHeight","capHeight","fill","scaleToFit","textAnchor","verticalAnchor"],VL=["dx","dy","angle","className","breakAll"];function hp(){return hp=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{children:t,breakAll:r,style:n}=e;try{var i=[];Re(t)||(r?i=t.toString().split(""):i=t.toString().split(jN));var s=i.map(l=>({word:l,width:ds(l,n).width})),o=r?0:ds(" ",n).width;return{wordsWithComputedWidth:s,spaceWidth:o}}catch{return null}};function GL(e){return e==="start"||e==="middle"||e==="end"||e==="inherit"}var SN=(e,t,r,n)=>e.reduce((i,s)=>{var{word:o,width:l}=s,c=i[i.length-1];if(c&&l!=null&&(t==null||n||c.width+l+re.reduce((t,r)=>t.width>r.width?t:r),ZL="…",Gy=(e,t,r,n,i,s,o,l)=>{var c=e.slice(0,t),d=wN({breakAll:r,style:n,children:c+ZL});if(!d)return[!1,[]];var u=SN(d.wordsWithComputedWidth,s,o,l),f=u.length>i||NN(u).width>Number(s);return[f,u]},XL=(e,t,r,n,i)=>{var{maxLines:s,children:o,style:l,breakAll:c}=e,d=Y(s),u=String(o),f=SN(t,n,r,i);if(!d||i)return f;var p=f.length>s||NN(f).width>Number(n);if(!p)return f;for(var m=0,x=u.length-1,g=0,b;m<=x&&g<=u.length-1;){var v=Math.floor((m+x)/2),j=v-1,[y,w]=Gy(u,j,c,l,s,n,r,i),[S]=Gy(u,v,c,l,s,n,r,i);if(!y&&!S&&(m=v+1),y&&S&&(x=v-1),!y&&S){b=w;break}g++}return b||f},Zy=e=>{var t=Re(e)?[]:e.toString().split(jN);return[{words:t,width:void 0}]},JL=e=>{var{width:t,scaleToFit:r,children:n,style:i,breakAll:s,maxLines:o}=e;if((t||r)&&!Ci.isSsr){var l,c,d=wN({breakAll:s,children:n,style:i});if(d){var{wordsWithComputedWidth:u,spaceWidth:f}=d;l=u,c=f}else return Zy(n);return XL({breakAll:s,children:n,maxLines:o,style:i},l,c,t,!!r)}return Zy(n)},kN="#808080",QL={breakAll:!1,capHeight:"0.71em",fill:kN,lineHeight:"1em",scaleToFit:!1,textAnchor:"start",verticalAnchor:"end",x:0,y:0},Jm=h.forwardRef((e,t)=>{var r=ft(e,QL),{x:n,y:i,lineHeight:s,capHeight:o,fill:l,scaleToFit:c,textAnchor:d,verticalAnchor:u}=r,f=Yy(r,KL),p=h.useMemo(()=>JL({breakAll:f.breakAll,children:f.children,maxLines:f.maxLines,scaleToFit:c,style:f.style,width:f.width}),[f.breakAll,f.children,f.maxLines,c,f.style,f.width]),{dx:m,dy:x,angle:g,className:b,breakAll:v}=f,j=Yy(f,VL);if(!Or(n)||!Or(i)||p.length===0)return null;var y=Number(n)+(Y(m)?m:0),w=Number(i)+(Y(x)?x:0);if(!_e(y)||!_e(w))return null;var S;switch(u){case"start":S=Nd("calc(".concat(o,")"));break;case"middle":S=Nd("calc(".concat((p.length-1)/2," * -").concat(s," + (").concat(o," / 2))"));break;default:S=Nd("calc(".concat(p.length-1," * -").concat(s,")"));break}var N=[];if(c){var P=p[0].width,{width:_}=f;N.push("scale(".concat(Y(_)&&Y(P)?_/P:1,")"))}return g&&N.push("rotate(".concat(g,", ").concat(y,", ").concat(w,")")),N.length&&(j.transform=N.join(" ")),h.createElement("text",hp({},ut(j),{ref:t,x:y,y:w,className:ce("recharts-text",b),textAnchor:d,fill:l.includes("url")?kN:l}),p.map((T,$)=>{var M=T.words.join(v?"":" ");return h.createElement("tspan",{x:y,dy:$===0?S:s,key:"".concat(M,"-").concat($)},M)}))});Jm.displayName="Text";var e8=["labelRef"];function t8(e,t){if(e==null)return{};var r,n,i=r8(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n{var{x:t,y:r,upperWidth:n,lowerWidth:i,width:s,height:o,children:l}=e,c=h.useMemo(()=>({x:t,y:r,upperWidth:n,lowerWidth:i,width:s,height:o}),[t,r,n,i,s,o]);return h.createElement(PN.Provider,{value:c},l)},_N=()=>{var e=h.useContext(PN),t=uu();return e||Rw(t)},o8=h.createContext(null),l8=()=>{var e=h.useContext(o8),t=G(n2);return e||t},c8=e=>{var{value:t,formatter:r}=e,n=Re(e.children)?t:e.children;return typeof r=="function"?r(n):n},Qm=e=>e!=null&&typeof e=="function",u8=(e,t)=>{var r=Jt(t-e),n=Math.min(Math.abs(t-e),360);return r*n},d8=(e,t,r,n,i)=>{var{offset:s,className:o}=e,{cx:l,cy:c,innerRadius:d,outerRadius:u,startAngle:f,endAngle:p,clockWise:m}=i,x=(d+u)/2,g=u8(f,p),b=g>=0?1:-1,v,j;switch(t){case"insideStart":v=f+b*s,j=m;break;case"insideEnd":v=p-b*s,j=!m;break;case"end":v=p+b*s,j=m;break;default:throw new Error("Unsupported position ".concat(t))}j=g<=0?j:!j;var y=Je(l,c,x,v),w=Je(l,c,x,v+(j?1:-1)*359),S="M".concat(y.x,",").concat(y.y,` + A`).concat(s,",").concat(s,",0,0,").concat(+(u<0),",").concat(w.x,",").concat(w.y,"Z")}else j+="L".concat(t,",").concat(r,"Z");return j},ND={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},Jw=e=>{var t=ft(e,ND),{cx:r,cy:n,innerRadius:i,outerRadius:s,cornerRadius:o,forceCornerRadius:l,cornerIsExternal:c,startAngle:d,endAngle:u,className:f}=t;if(s0&&Math.abs(d-u)<360?g=SD({cx:r,cy:n,innerRadius:i,outerRadius:s,cornerRadius:Math.min(x,m/2),forceCornerRadius:l,cornerIsExternal:c,startAngle:d,endAngle:u}):g=Xw({cx:r,cy:n,innerRadius:i,outerRadius:s,startAngle:d,endAngle:u}),h.createElement("path",Jf({},ut(t),{className:p,d:g}))};function kD(e,t,r){if(e==="horizontal")return[{x:t.x,y:r.top},{x:t.x,y:r.top+r.height}];if(e==="vertical")return[{x:r.left,y:t.y},{x:r.left+r.width,y:t.y}];if(Ej(t)){if(e==="centric"){var{cx:n,cy:i,innerRadius:s,outerRadius:o,angle:l}=t,c=Je(n,i,s,l),d=Je(n,i,o,l);return[{x:c.x,y:c.y},{x:d.x,y:d.y}]}return Zw(t)}}var Qw={},eS={},tS={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Kh;function r(n){return t.isSymbol(n)?NaN:Number(n)}e.toNumber=r})(tS);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=tS;function r(n){return n?(n=t.toNumber(n),n===1/0||n===-1/0?(n<0?-1:1)*Number.MAX_VALUE:n===n?n:0):n===0?n:0}e.toFinite=r})(eS);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Vh,r=eS;function n(i,s,o){o&&typeof o!="number"&&t.isIterateeCall(i,s,o)&&(s=o=void 0),i=r.toFinite(i),s===void 0?(s=i,i=0):s=r.toFinite(s),o=o===void 0?it?1:e>=t?0:NaN}function _D(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function em(e){let t,r,n;e.length!==2?(t=Mn,r=(l,c)=>Mn(e(l),c),n=(l,c)=>e(l)-c):(t=e===Mn||e===_D?e:CD,r=e,n=e);function i(l,c,d=0,u=l.length){if(d>>1;r(l[f],c)<0?d=f+1:u=f}while(d>>1;r(l[f],c)<=0?d=f+1:u=f}while(dd&&n(l[f-1],c)>-n(l[f],c)?f-1:f}return{left:i,center:o,right:s}}function CD(){return 0}function nS(e){return e===null?NaN:+e}function*AD(e,t){for(let r of e)r!=null&&(r=+r)>=r&&(yield r)}const OD=em(Mn),ro=OD.right;em(nS).center;class I0 extends Map{constructor(t,r=TD){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),t!=null)for(const[n,i]of t)this.set(n,i)}get(t){return super.get($0(this,t))}has(t){return super.has($0(this,t))}set(t,r){return super.set(ED(this,t),r)}delete(t){return super.delete(DD(this,t))}}function $0({_intern:e,_key:t},r){const n=t(r);return e.has(n)?e.get(n):r}function ED({_intern:e,_key:t},r){const n=t(r);return e.has(n)?e.get(n):(e.set(n,r),r)}function DD({_intern:e,_key:t},r){const n=t(r);return e.has(n)&&(r=e.get(n),e.delete(n)),r}function TD(e){return e!==null&&typeof e=="object"?e.valueOf():e}function MD(e=Mn){if(e===Mn)return iS;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,r)=>{const n=e(t,r);return n||n===0?n:(e(r,r)===0)-(e(t,t)===0)}}function iS(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et?1:0)}const ID=Math.sqrt(50),$D=Math.sqrt(10),LD=Math.sqrt(2);function tc(e,t,r){const n=(t-e)/Math.max(0,r),i=Math.floor(Math.log10(n)),s=n/Math.pow(10,i),o=s>=ID?10:s>=$D?5:s>=LD?2:1;let l,c,d;return i<0?(d=Math.pow(10,-i)/o,l=Math.round(e*d),c=Math.round(t*d),l/dt&&--c,d=-d):(d=Math.pow(10,i)*o,l=Math.round(e/d),c=Math.round(t/d),l*dt&&--c),c0))return[];if(e===t)return[e];const n=t=i))return[];const l=s-i+1,c=new Array(l);if(n)if(o<0)for(let d=0;d=n)&&(r=n);return r}function z0(e,t){let r;for(const n of e)n!=null&&(r>n||r===void 0&&n>=n)&&(r=n);return r}function aS(e,t,r=0,n=1/0,i){if(t=Math.floor(t),r=Math.floor(Math.max(0,r)),n=Math.floor(Math.min(e.length-1,n)),!(r<=t&&t<=n))return e;for(i=i===void 0?iS:MD(i);n>r;){if(n-r>600){const c=n-r+1,d=t-r+1,u=Math.log(c),f=.5*Math.exp(2*u/3),p=.5*Math.sqrt(u*f*(c-f)/c)*(d-c/2<0?-1:1),m=Math.max(r,Math.floor(t-d*f/c+p)),x=Math.min(n,Math.floor(t+(c-d)*f/c+p));aS(e,t,m,x,i)}const s=e[t];let o=r,l=n;for(Ka(e,r,t),i(e[n],s)>0&&Ka(e,r,n);o0;)--l}i(e[r],s)===0?Ka(e,r,l):(++l,Ka(e,l,n)),l<=t&&(r=l+1),t<=l&&(n=l-1)}return e}function Ka(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function zD(e,t,r){if(e=Float64Array.from(AD(e)),!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return z0(e);if(t>=1)return L0(e);var n,i=(n-1)*t,s=Math.floor(i),o=L0(aS(e,s).subarray(0,s+1)),l=z0(e.subarray(s+1));return o+(l-o)*(i-s)}}function RD(e,t,r=nS){if(!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return+r(e[0],0,e);if(t>=1)return+r(e[n-1],n-1,e);var n,i=(n-1)*t,s=Math.floor(i),o=+r(e[s],s,e),l=+r(e[s+1],s+1,e);return o+(l-o)*(i-s)}}function BD(e,t,r){e=+e,t=+t,r=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+r;for(var n=-1,i=Math.max(0,Math.ceil((t-e)/r))|0,s=new Array(i);++n>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):r===8?Wo(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):r===4?Wo(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=UD.exec(e))?new Nt(t[1],t[2],t[3],1):(t=qD.exec(e))?new Nt(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=HD.exec(e))?Wo(t[1],t[2],t[3],t[4]):(t=KD.exec(e))?Wo(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=VD.exec(e))?H0(t[1],t[2]/100,t[3]/100,1):(t=YD.exec(e))?H0(t[1],t[2]/100,t[3]/100,t[4]):R0.hasOwnProperty(e)?W0(R0[e]):e==="transparent"?new Nt(NaN,NaN,NaN,0):null}function W0(e){return new Nt(e>>16&255,e>>8&255,e&255,1)}function Wo(e,t,r,n){return n<=0&&(e=t=r=NaN),new Nt(e,t,r,n)}function XD(e){return e instanceof no||(e=Bs(e)),e?(e=e.rgb(),new Nt(e.r,e.g,e.b,e.opacity)):new Nt}function np(e,t,r,n){return arguments.length===1?XD(e):new Nt(e,t,r,n??1)}function Nt(e,t,r,n){this.r=+e,this.g=+t,this.b=+r,this.opacity=+n}nm(Nt,np,oS(no,{brighter(e){return e=e==null?rc:Math.pow(rc,e),new Nt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?zs:Math.pow(zs,e),new Nt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Nt(ui(this.r),ui(this.g),ui(this.b),nc(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:U0,formatHex:U0,formatHex8:JD,formatRgb:q0,toString:q0}));function U0(){return`#${ni(this.r)}${ni(this.g)}${ni(this.b)}`}function JD(){return`#${ni(this.r)}${ni(this.g)}${ni(this.b)}${ni((isNaN(this.opacity)?1:this.opacity)*255)}`}function q0(){const e=nc(this.opacity);return`${e===1?"rgb(":"rgba("}${ui(this.r)}, ${ui(this.g)}, ${ui(this.b)}${e===1?")":`, ${e})`}`}function nc(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ui(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ni(e){return e=ui(e),(e<16?"0":"")+e.toString(16)}function H0(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new pr(e,t,r,n)}function lS(e){if(e instanceof pr)return new pr(e.h,e.s,e.l,e.opacity);if(e instanceof no||(e=Bs(e)),!e)return new pr;if(e instanceof pr)return e;e=e.rgb();var t=e.r/255,r=e.g/255,n=e.b/255,i=Math.min(t,r,n),s=Math.max(t,r,n),o=NaN,l=s-i,c=(s+i)/2;return l?(t===s?o=(r-n)/l+(r0&&c<1?0:o,new pr(o,l,c,e.opacity)}function QD(e,t,r,n){return arguments.length===1?lS(e):new pr(e,t,r,n??1)}function pr(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}nm(pr,QD,oS(no,{brighter(e){return e=e==null?rc:Math.pow(rc,e),new pr(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?zs:Math.pow(zs,e),new pr(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,r=this.l,n=r+(r<.5?r:1-r)*t,i=2*r-n;return new Nt(gd(e>=240?e-240:e+120,i,n),gd(e,i,n),gd(e<120?e+240:e-120,i,n),this.opacity)},clamp(){return new pr(K0(this.h),Uo(this.s),Uo(this.l),nc(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=nc(this.opacity);return`${e===1?"hsl(":"hsla("}${K0(this.h)}, ${Uo(this.s)*100}%, ${Uo(this.l)*100}%${e===1?")":`, ${e})`}`}}));function K0(e){return e=(e||0)%360,e<0?e+360:e}function Uo(e){return Math.max(0,Math.min(1,e||0))}function gd(e,t,r){return(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)*255}const im=e=>()=>e;function e5(e,t){return function(r){return e+r*t}}function t5(e,t,r){return e=Math.pow(e,r),t=Math.pow(t,r)-e,r=1/r,function(n){return Math.pow(e+n*t,r)}}function r5(e){return(e=+e)==1?cS:function(t,r){return r-t?t5(t,r,e):im(isNaN(t)?r:t)}}function cS(e,t){var r=t-e;return r?e5(e,r):im(isNaN(e)?t:e)}const V0=function e(t){var r=r5(t);function n(i,s){var o=r((i=np(i)).r,(s=np(s)).r),l=r(i.g,s.g),c=r(i.b,s.b),d=cS(i.opacity,s.opacity);return function(u){return i.r=o(u),i.g=l(u),i.b=c(u),i.opacity=d(u),i+""}}return n.gamma=e,n}(1);function n5(e,t){t||(t=[]);var r=e?Math.min(t.length,e.length):0,n=t.slice(),i;return function(s){for(i=0;ir&&(s=t.slice(r,s),l[o]?l[o]+=s:l[++o]=s),(n=n[0])===(i=i[0])?l[o]?l[o]+=i:l[++o]=i:(l[++o]=null,c.push({i:o,x:ic(n,i)})),r=xd.lastIndex;return rt&&(r=e,e=t,t=r),function(n){return Math.max(e,Math.min(t,n))}}function h5(e,t,r){var n=e[0],i=e[1],s=t[0],o=t[1];return i2?m5:h5,c=d=null,f}function f(p){return p==null||isNaN(p=+p)?s:(c||(c=l(e.map(n),t,r)))(n(o(p)))}return f.invert=function(p){return o(i((d||(d=l(t,e.map(n),ic)))(p)))},f.domain=function(p){return arguments.length?(e=Array.from(p,ac),u()):e.slice()},f.range=function(p){return arguments.length?(t=Array.from(p),u()):t.slice()},f.rangeRound=function(p){return t=Array.from(p),r=am,u()},f.clamp=function(p){return arguments.length?(o=p?!0:mt,u()):o!==mt},f.interpolate=function(p){return arguments.length?(r=p,u()):r},f.unknown=function(p){return arguments.length?(s=p,f):s},function(p,m){return n=p,i=m,u()}}function sm(){return hu()(mt,mt)}function g5(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function sc(e,t){if((r=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var r,n=e.slice(0,r);return[n.length>1?n[0]+n.slice(2):n,+e.slice(r+1)]}function ga(e){return e=sc(Math.abs(e)),e?e[1]:NaN}function x5(e,t){return function(r,n){for(var i=r.length,s=[],o=0,l=e[0],c=0;i>0&&l>0&&(c+l+1>n&&(l=Math.max(1,n-c)),s.push(r.substring(i-=l,i+l)),!((c+=l+1)>n));)l=e[o=(o+1)%e.length];return s.reverse().join(t)}}function y5(e){return function(t){return t.replace(/[0-9]/g,function(r){return e[+r]})}}var v5=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Fs(e){if(!(t=v5.exec(e)))throw new Error("invalid format: "+e);var t;return new om({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]})}Fs.prototype=om.prototype;function om(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+""}om.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 b5(e){e:for(var t=e.length,r=1,n=-1,i;r0&&(n=0);break}return n>0?e.slice(0,n)+e.slice(i+1):e}var uS;function j5(e,t){var r=sc(e,t);if(!r)return e+"";var n=r[0],i=r[1],s=i-(uS=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=n.length;return s===o?n:s>o?n+new Array(s-o+1).join("0"):s>0?n.slice(0,s)+"."+n.slice(s):"0."+new Array(1-s).join("0")+sc(e,Math.max(0,t+s-1))[0]}function G0(e,t){var r=sc(e,t);if(!r)return e+"";var n=r[0],i=r[1];return i<0?"0."+new Array(-i).join("0")+n:n.length>i+1?n.slice(0,i+1)+"."+n.slice(i+1):n+new Array(i-n.length+2).join("0")}const Z0={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:g5,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)=>G0(e*100,t),r:G0,s:j5,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function X0(e){return e}var J0=Array.prototype.map,Q0=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function w5(e){var t=e.grouping===void 0||e.thousands===void 0?X0:x5(J0.call(e.grouping,Number),e.thousands+""),r=e.currency===void 0?"":e.currency[0]+"",n=e.currency===void 0?"":e.currency[1]+"",i=e.decimal===void 0?".":e.decimal+"",s=e.numerals===void 0?X0:y5(J0.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 d(f){f=Fs(f);var p=f.fill,m=f.align,x=f.sign,g=f.symbol,b=f.zero,v=f.width,j=f.comma,y=f.precision,w=f.trim,S=f.type;S==="n"?(j=!0,S="g"):Z0[S]||(y===void 0&&(y=12),w=!0,S="g"),(b||p==="0"&&m==="=")&&(b=!0,p="0",m="=");var N=g==="$"?r:g==="#"&&/[boxX]/.test(S)?"0"+S.toLowerCase():"",P=g==="$"?n:/[%p]/.test(S)?o:"",_=Z0[S],T=/[defgprs%]/.test(S);y=y===void 0?6:/[gprs]/.test(S)?Math.max(1,Math.min(21,y)):Math.max(0,Math.min(20,y));function $(M){var C=N,R=P,q,Z,E;if(S==="c")R=_(M)+R,M="";else{M=+M;var D=M<0||1/M<0;if(M=isNaN(M)?c:_(Math.abs(M),y),w&&(M=b5(M)),D&&+M==0&&x!=="+"&&(D=!1),C=(D?x==="("?x:l:x==="-"||x==="("?"":x)+C,R=(S==="s"?Q0[8+uS/3]:"")+R+(D&&x==="("?")":""),T){for(q=-1,Z=M.length;++qE||E>57){R=(E===46?i+M.slice(q+1):M.slice(q))+R,M=M.slice(0,q);break}}}j&&!b&&(M=t(M,1/0));var O=C.length+M.length+R.length,k=O>1)+C+M+R+k.slice(O);break;default:M=k+C+M+R;break}return s(M)}return $.toString=function(){return f+""},$}function u(f,p){var m=d((f=Fs(f),f.type="f",f)),x=Math.max(-8,Math.min(8,Math.floor(ga(p)/3)))*3,g=Math.pow(10,-x),b=Q0[8+x/3];return function(v){return m(g*v)+b}}return{format:d,formatPrefix:u}}var qo,lm,dS;S5({thousands:",",grouping:[3],currency:["$",""]});function S5(e){return qo=w5(e),lm=qo.format,dS=qo.formatPrefix,qo}function N5(e){return Math.max(0,-ga(Math.abs(e)))}function k5(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(ga(t)/3)))*3-ga(Math.abs(e)))}function P5(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,ga(t)-ga(e))+1}function fS(e,t,r,n){var i=tp(e,t,r),s;switch(n=Fs(n??",f"),n.type){case"s":{var o=Math.max(Math.abs(e),Math.abs(t));return n.precision==null&&!isNaN(s=k5(i,o))&&(n.precision=s),dS(n,o)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(s=P5(i,Math.max(Math.abs(e),Math.abs(t))))&&(n.precision=s-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(s=N5(i))&&(n.precision=s-(n.type==="%")*2);break}}return lm(n)}function qn(e){var t=e.domain;return e.ticks=function(r){var n=t();return Qf(n[0],n[n.length-1],r??10)},e.tickFormat=function(r,n){var i=t();return fS(i[0],i[i.length-1],r??10,n)},e.nice=function(r){r==null&&(r=10);var n=t(),i=0,s=n.length-1,o=n[i],l=n[s],c,d,u=10;for(l0;){if(d=ep(o,l,r),d===c)return n[i]=o,n[s]=l,t(n);if(d>0)o=Math.floor(o/d)*d,l=Math.ceil(l/d)*d;else if(d<0)o=Math.ceil(o*d)/d,l=Math.floor(l*d)/d;else break;c=d}return e},e}function pS(){var e=sm();return e.copy=function(){return io(e,pS())},or.apply(e,arguments),qn(e)}function hS(e){var t;function r(n){return n==null||isNaN(n=+n)?t:n}return r.invert=r,r.domain=r.range=function(n){return arguments.length?(e=Array.from(n,ac),r):e.slice()},r.unknown=function(n){return arguments.length?(t=n,r):t},r.copy=function(){return hS(e).unknown(t)},e=arguments.length?Array.from(e,ac):[0,1],qn(r)}function mS(e,t){e=e.slice();var r=0,n=e.length-1,i=e[r],s=e[n],o;return sMath.pow(e,t)}function E5(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 ry(e){return(t,r)=>-e(-t,r)}function cm(e){const t=e(ey,ty),r=t.domain;let n=10,i,s;function o(){return i=E5(n),s=O5(n),r()[0]<0?(i=ry(i),s=ry(s),e(_5,C5)):e(ey,ty),t}return t.base=function(l){return arguments.length?(n=+l,o()):n},t.domain=function(l){return arguments.length?(r(l),o()):r()},t.ticks=l=>{const c=r();let d=c[0],u=c[c.length-1];const f=u0){for(;p<=m;++p)for(x=1;xu)break;v.push(g)}}else for(;p<=m;++p)for(x=n-1;x>=1;--x)if(g=p>0?x/s(-p):x*s(p),!(gu)break;v.push(g)}v.length*2{if(l==null&&(l=10),c==null&&(c=n===10?"s":","),typeof c!="function"&&(!(n%1)&&(c=Fs(c)).precision==null&&(c.trim=!0),c=lm(c)),l===1/0)return c;const d=Math.max(1,n*l/t.ticks().length);return u=>{let f=u/s(Math.round(i(u)));return f*nr(mS(r(),{floor:l=>s(Math.floor(i(l))),ceil:l=>s(Math.ceil(i(l)))})),t}function gS(){const e=cm(hu()).domain([1,10]);return e.copy=()=>io(e,gS()).base(e.base()),or.apply(e,arguments),e}function ny(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function iy(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function um(e){var t=1,r=e(ny(t),iy(t));return r.constant=function(n){return arguments.length?e(ny(t=+n),iy(t)):t},qn(r)}function xS(){var e=um(hu());return e.copy=function(){return io(e,xS()).constant(e.constant())},or.apply(e,arguments)}function ay(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function D5(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function T5(e){return e<0?-e*e:e*e}function dm(e){var t=e(mt,mt),r=1;function n(){return r===1?e(mt,mt):r===.5?e(D5,T5):e(ay(r),ay(1/r))}return t.exponent=function(i){return arguments.length?(r=+i,n()):r},qn(t)}function fm(){var e=dm(hu());return e.copy=function(){return io(e,fm()).exponent(e.exponent())},or.apply(e,arguments),e}function M5(){return fm.apply(null,arguments).exponent(.5)}function sy(e){return Math.sign(e)*e*e}function I5(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function yS(){var e=sm(),t=[0,1],r=!1,n;function i(s){var o=I5(e(s));return isNaN(o)?n:r?Math.round(o):o}return i.invert=function(s){return e.invert(sy(s))},i.domain=function(s){return arguments.length?(e.domain(s),i):e.domain()},i.range=function(s){return arguments.length?(e.range((t=Array.from(s,ac)).map(sy)),i):t.slice()},i.rangeRound=function(s){return i.range(s).round(!0)},i.round=function(s){return arguments.length?(r=!!s,i):r},i.clamp=function(s){return arguments.length?(e.clamp(s),i):e.clamp()},i.unknown=function(s){return arguments.length?(n=s,i):n},i.copy=function(){return yS(e.domain(),t).round(r).clamp(e.clamp()).unknown(n)},or.apply(i,arguments),qn(i)}function vS(){var e=[],t=[],r=[],n;function i(){var o=0,l=Math.max(1,t.length);for(r=new Array(l-1);++o0?r[l-1]:e[0],l=r?[n[r-1],t]:[n[d-1],n[d]]},o.unknown=function(c){return arguments.length&&(s=c),o},o.thresholds=function(){return n.slice()},o.copy=function(){return bS().domain([e,t]).range(i).unknown(s)},or.apply(qn(o),arguments)}function jS(){var e=[.5],t=[0,1],r,n=1;function i(s){return s!=null&&s<=s?t[ro(e,s,0,n)]:r}return i.domain=function(s){return arguments.length?(e=Array.from(s),n=Math.min(e.length,t.length-1),i):e.slice()},i.range=function(s){return arguments.length?(t=Array.from(s),n=Math.min(e.length,t.length-1),i):t.slice()},i.invertExtent=function(s){var o=t.indexOf(s);return[e[o-1],e[o]]},i.unknown=function(s){return arguments.length?(r=s,i):r},i.copy=function(){return jS().domain(e).range(t).unknown(r)},or.apply(i,arguments)}const yd=new Date,vd=new Date;function Be(e,t,r,n){function i(s){return e(s=arguments.length===0?new Date:new Date(+s)),s}return i.floor=s=>(e(s=new Date(+s)),s),i.ceil=s=>(e(s=new Date(s-1)),t(s,1),e(s),s),i.round=s=>{const o=i(s),l=i.ceil(s);return s-o(t(s=new Date(+s),o==null?1:Math.floor(o)),s),i.range=(s,o,l)=>{const c=[];if(s=i.ceil(s),l=l==null?1:Math.floor(l),!(s0))return c;let d;do c.push(d=new Date(+s)),t(s,l),e(s);while(dBe(o=>{if(o>=o)for(;e(o),!s(o);)o.setTime(o-1)},(o,l)=>{if(o>=o)if(l<0)for(;++l<=0;)for(;t(o,-1),!s(o););else for(;--l>=0;)for(;t(o,1),!s(o););}),r&&(i.count=(s,o)=>(yd.setTime(+s),vd.setTime(+o),e(yd),e(vd),Math.floor(r(yd,vd))),i.every=s=>(s=Math.floor(s),!isFinite(s)||!(s>0)?null:s>1?i.filter(n?o=>n(o)%s===0:o=>i.count(0,o)%s===0):i)),i}const oc=Be(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);oc.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?Be(t=>{t.setTime(Math.floor(t/e)*e)},(t,r)=>{t.setTime(+t+r*e)},(t,r)=>(r-t)/e):oc);oc.range;const Wr=1e3,Qt=Wr*60,Ur=Qt*60,tn=Ur*24,pm=tn*7,oy=tn*30,bd=tn*365,ii=Be(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*Wr)},(e,t)=>(t-e)/Wr,e=>e.getUTCSeconds());ii.range;const hm=Be(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Wr)},(e,t)=>{e.setTime(+e+t*Qt)},(e,t)=>(t-e)/Qt,e=>e.getMinutes());hm.range;const mm=Be(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*Qt)},(e,t)=>(t-e)/Qt,e=>e.getUTCMinutes());mm.range;const gm=Be(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Wr-e.getMinutes()*Qt)},(e,t)=>{e.setTime(+e+t*Ur)},(e,t)=>(t-e)/Ur,e=>e.getHours());gm.range;const xm=Be(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*Ur)},(e,t)=>(t-e)/Ur,e=>e.getUTCHours());xm.range;const ao=Be(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Qt)/tn,e=>e.getDate()-1);ao.range;const mu=Be(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/tn,e=>e.getUTCDate()-1);mu.range;const wS=Be(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/tn,e=>Math.floor(e/tn));wS.range;function Ai(e){return Be(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,r)=>{t.setDate(t.getDate()+r*7)},(t,r)=>(r-t-(r.getTimezoneOffset()-t.getTimezoneOffset())*Qt)/pm)}const gu=Ai(0),lc=Ai(1),$5=Ai(2),L5=Ai(3),xa=Ai(4),z5=Ai(5),R5=Ai(6);gu.range;lc.range;$5.range;L5.range;xa.range;z5.range;R5.range;function Oi(e){return Be(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCDate(t.getUTCDate()+r*7)},(t,r)=>(r-t)/pm)}const xu=Oi(0),cc=Oi(1),B5=Oi(2),F5=Oi(3),ya=Oi(4),W5=Oi(5),U5=Oi(6);xu.range;cc.range;B5.range;F5.range;ya.range;W5.range;U5.range;const ym=Be(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());ym.range;const vm=Be(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());vm.range;const rn=Be(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());rn.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Be(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,r)=>{t.setFullYear(t.getFullYear()+r*e)});rn.range;const nn=Be(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());nn.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Be(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCFullYear(t.getUTCFullYear()+r*e)});nn.range;function SS(e,t,r,n,i,s){const o=[[ii,1,Wr],[ii,5,5*Wr],[ii,15,15*Wr],[ii,30,30*Wr],[s,1,Qt],[s,5,5*Qt],[s,15,15*Qt],[s,30,30*Qt],[i,1,Ur],[i,3,3*Ur],[i,6,6*Ur],[i,12,12*Ur],[n,1,tn],[n,2,2*tn],[r,1,pm],[t,1,oy],[t,3,3*oy],[e,1,bd]];function l(d,u,f){const p=ub).right(o,p);if(m===o.length)return e.every(tp(d/bd,u/bd,f));if(m===0)return oc.every(Math.max(tp(d,u,f),1));const[x,g]=o[p/o[m-1][2]53)return null;"w"in U||(U.w=1),"Z"in U?(pe=wd(Va(U.y,0,1)),Et=pe.getUTCDay(),pe=Et>4||Et===0?cc.ceil(pe):cc(pe),pe=mu.offset(pe,(U.V-1)*7),U.y=pe.getUTCFullYear(),U.m=pe.getUTCMonth(),U.d=pe.getUTCDate()+(U.w+6)%7):(pe=jd(Va(U.y,0,1)),Et=pe.getDay(),pe=Et>4||Et===0?lc.ceil(pe):lc(pe),pe=ao.offset(pe,(U.V-1)*7),U.y=pe.getFullYear(),U.m=pe.getMonth(),U.d=pe.getDate()+(U.w+6)%7)}else("W"in U||"U"in U)&&("w"in U||(U.w="u"in U?U.u%7:"W"in U?1:0),Et="Z"in U?wd(Va(U.y,0,1)).getUTCDay():jd(Va(U.y,0,1)).getDay(),U.m=0,U.d="W"in U?(U.w+6)%7+U.W*7-(Et+5)%7:U.w+U.U*7-(Et+6)%7);return"Z"in U?(U.H+=U.Z/100|0,U.M+=U.Z%100,wd(U)):jd(U)}}function _(z,Q,ne,U){for(var bt=0,pe=Q.length,Et=ne.length,Dt,Yn;bt=Et)return-1;if(Dt=Q.charCodeAt(bt++),Dt===37){if(Dt=Q.charAt(bt++),Yn=S[Dt in ly?Q.charAt(bt++):Dt],!Yn||(U=Yn(z,ne,U))<0)return-1}else if(Dt!=ne.charCodeAt(U++))return-1}return U}function T(z,Q,ne){var U=d.exec(Q.slice(ne));return U?(z.p=u.get(U[0].toLowerCase()),ne+U[0].length):-1}function $(z,Q,ne){var U=m.exec(Q.slice(ne));return U?(z.w=x.get(U[0].toLowerCase()),ne+U[0].length):-1}function M(z,Q,ne){var U=f.exec(Q.slice(ne));return U?(z.w=p.get(U[0].toLowerCase()),ne+U[0].length):-1}function C(z,Q,ne){var U=v.exec(Q.slice(ne));return U?(z.m=j.get(U[0].toLowerCase()),ne+U[0].length):-1}function R(z,Q,ne){var U=g.exec(Q.slice(ne));return U?(z.m=b.get(U[0].toLowerCase()),ne+U[0].length):-1}function q(z,Q,ne){return _(z,t,Q,ne)}function Z(z,Q,ne){return _(z,r,Q,ne)}function E(z,Q,ne){return _(z,n,Q,ne)}function D(z){return o[z.getDay()]}function O(z){return s[z.getDay()]}function k(z){return c[z.getMonth()]}function L(z){return l[z.getMonth()]}function F(z){return i[+(z.getHours()>=12)]}function H(z){return 1+~~(z.getMonth()/3)}function te(z){return o[z.getUTCDay()]}function re(z){return s[z.getUTCDay()]}function we(z){return c[z.getUTCMonth()]}function A(z){return l[z.getUTCMonth()]}function J(z){return i[+(z.getUTCHours()>=12)]}function Ot(z){return 1+~~(z.getUTCMonth()/3)}return{format:function(z){var Q=N(z+="",y);return Q.toString=function(){return z},Q},parse:function(z){var Q=P(z+="",!1);return Q.toString=function(){return z},Q},utcFormat:function(z){var Q=N(z+="",w);return Q.toString=function(){return z},Q},utcParse:function(z){var Q=P(z+="",!0);return Q.toString=function(){return z},Q}}}var ly={"-":"",_:" ",0:"0"},Ye=/^\s*\d+/,G5=/^%/,Z5=/[\\^$*+?|[\]().{}]/g;function se(e,t,r){var n=e<0?"-":"",i=(n?-e:e)+"",s=i.length;return n+(s[t.toLowerCase(),r]))}function J5(e,t,r){var n=Ye.exec(t.slice(r,r+1));return n?(e.w=+n[0],r+n[0].length):-1}function Q5(e,t,r){var n=Ye.exec(t.slice(r,r+1));return n?(e.u=+n[0],r+n[0].length):-1}function eT(e,t,r){var n=Ye.exec(t.slice(r,r+2));return n?(e.U=+n[0],r+n[0].length):-1}function tT(e,t,r){var n=Ye.exec(t.slice(r,r+2));return n?(e.V=+n[0],r+n[0].length):-1}function rT(e,t,r){var n=Ye.exec(t.slice(r,r+2));return n?(e.W=+n[0],r+n[0].length):-1}function cy(e,t,r){var n=Ye.exec(t.slice(r,r+4));return n?(e.y=+n[0],r+n[0].length):-1}function uy(e,t,r){var n=Ye.exec(t.slice(r,r+2));return n?(e.y=+n[0]+(+n[0]>68?1900:2e3),r+n[0].length):-1}function nT(e,t,r){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(r,r+6));return n?(e.Z=n[1]?0:-(n[2]+(n[3]||"00")),r+n[0].length):-1}function iT(e,t,r){var n=Ye.exec(t.slice(r,r+1));return n?(e.q=n[0]*3-3,r+n[0].length):-1}function aT(e,t,r){var n=Ye.exec(t.slice(r,r+2));return n?(e.m=n[0]-1,r+n[0].length):-1}function dy(e,t,r){var n=Ye.exec(t.slice(r,r+2));return n?(e.d=+n[0],r+n[0].length):-1}function sT(e,t,r){var n=Ye.exec(t.slice(r,r+3));return n?(e.m=0,e.d=+n[0],r+n[0].length):-1}function fy(e,t,r){var n=Ye.exec(t.slice(r,r+2));return n?(e.H=+n[0],r+n[0].length):-1}function oT(e,t,r){var n=Ye.exec(t.slice(r,r+2));return n?(e.M=+n[0],r+n[0].length):-1}function lT(e,t,r){var n=Ye.exec(t.slice(r,r+2));return n?(e.S=+n[0],r+n[0].length):-1}function cT(e,t,r){var n=Ye.exec(t.slice(r,r+3));return n?(e.L=+n[0],r+n[0].length):-1}function uT(e,t,r){var n=Ye.exec(t.slice(r,r+6));return n?(e.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function dT(e,t,r){var n=G5.exec(t.slice(r,r+1));return n?r+n[0].length:-1}function fT(e,t,r){var n=Ye.exec(t.slice(r));return n?(e.Q=+n[0],r+n[0].length):-1}function pT(e,t,r){var n=Ye.exec(t.slice(r));return n?(e.s=+n[0],r+n[0].length):-1}function py(e,t){return se(e.getDate(),t,2)}function hT(e,t){return se(e.getHours(),t,2)}function mT(e,t){return se(e.getHours()%12||12,t,2)}function gT(e,t){return se(1+ao.count(rn(e),e),t,3)}function NS(e,t){return se(e.getMilliseconds(),t,3)}function xT(e,t){return NS(e,t)+"000"}function yT(e,t){return se(e.getMonth()+1,t,2)}function vT(e,t){return se(e.getMinutes(),t,2)}function bT(e,t){return se(e.getSeconds(),t,2)}function jT(e){var t=e.getDay();return t===0?7:t}function wT(e,t){return se(gu.count(rn(e)-1,e),t,2)}function kS(e){var t=e.getDay();return t>=4||t===0?xa(e):xa.ceil(e)}function ST(e,t){return e=kS(e),se(xa.count(rn(e),e)+(rn(e).getDay()===4),t,2)}function NT(e){return e.getDay()}function kT(e,t){return se(lc.count(rn(e)-1,e),t,2)}function PT(e,t){return se(e.getFullYear()%100,t,2)}function _T(e,t){return e=kS(e),se(e.getFullYear()%100,t,2)}function CT(e,t){return se(e.getFullYear()%1e4,t,4)}function AT(e,t){var r=e.getDay();return e=r>=4||r===0?xa(e):xa.ceil(e),se(e.getFullYear()%1e4,t,4)}function OT(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+se(t/60|0,"0",2)+se(t%60,"0",2)}function hy(e,t){return se(e.getUTCDate(),t,2)}function ET(e,t){return se(e.getUTCHours(),t,2)}function DT(e,t){return se(e.getUTCHours()%12||12,t,2)}function TT(e,t){return se(1+mu.count(nn(e),e),t,3)}function PS(e,t){return se(e.getUTCMilliseconds(),t,3)}function MT(e,t){return PS(e,t)+"000"}function IT(e,t){return se(e.getUTCMonth()+1,t,2)}function $T(e,t){return se(e.getUTCMinutes(),t,2)}function LT(e,t){return se(e.getUTCSeconds(),t,2)}function zT(e){var t=e.getUTCDay();return t===0?7:t}function RT(e,t){return se(xu.count(nn(e)-1,e),t,2)}function _S(e){var t=e.getUTCDay();return t>=4||t===0?ya(e):ya.ceil(e)}function BT(e,t){return e=_S(e),se(ya.count(nn(e),e)+(nn(e).getUTCDay()===4),t,2)}function FT(e){return e.getUTCDay()}function WT(e,t){return se(cc.count(nn(e)-1,e),t,2)}function UT(e,t){return se(e.getUTCFullYear()%100,t,2)}function qT(e,t){return e=_S(e),se(e.getUTCFullYear()%100,t,2)}function HT(e,t){return se(e.getUTCFullYear()%1e4,t,4)}function KT(e,t){var r=e.getUTCDay();return e=r>=4||r===0?ya(e):ya.ceil(e),se(e.getUTCFullYear()%1e4,t,4)}function VT(){return"+0000"}function my(){return"%"}function gy(e){return+e}function xy(e){return Math.floor(+e/1e3)}var Di,CS,AS;YT({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 YT(e){return Di=Y5(e),CS=Di.format,Di.parse,AS=Di.utcFormat,Di.utcParse,Di}function GT(e){return new Date(e)}function ZT(e){return e instanceof Date?+e:+new Date(+e)}function bm(e,t,r,n,i,s,o,l,c,d){var u=sm(),f=u.invert,p=u.domain,m=d(".%L"),x=d(":%S"),g=d("%I:%M"),b=d("%I %p"),v=d("%a %d"),j=d("%b %d"),y=d("%B"),w=d("%Y");function S(N){return(c(N)t(i/(e.length-1)))},r.quantiles=function(n){return Array.from({length:n+1},(i,s)=>zD(e,s/n))},r.copy=function(){return TS(t).domain(e)},un.apply(r,arguments)}function vu(){var e=0,t=.5,r=1,n=1,i,s,o,l,c,d=mt,u,f=!1,p;function m(g){return isNaN(g=+g)?p:(g=.5+((g=+u(g))-s)*(n*ge.chartData,tM=I([Kn],e=>{var t=e.chartData!=null?e.chartData.length-1:0;return{chartData:e.chartData,computedData:e.computedData,dataEndIndex:t,dataStartIndex:0}}),bu=(e,t,r,n)=>n?tM(e):Kn(e);function ji(e){if(Array.isArray(e)&&e.length===2){var[t,r]=e;if(_e(t)&&_e(r))return!0}return!1}function yy(e,t,r){return r?e:[Math.min(e[0],t[0]),Math.max(e[1],t[1])]}function LS(e,t){if(t&&typeof e!="function"&&Array.isArray(e)&&e.length===2){var[r,n]=e,i,s;if(_e(r))i=r;else if(typeof r=="function")return;if(_e(n))s=n;else if(typeof n=="function")return;var o=[i,s];if(ji(o))return o}}function rM(e,t,r){if(!(!r&&t==null)){if(typeof e=="function"&&t!=null)try{var n=e(t,r);if(ji(n))return yy(n,t,r)}catch{}if(Array.isArray(e)&&e.length===2){var[i,s]=e,o,l;if(i==="auto")t!=null&&(o=Math.min(...t));else if(Y(i))o=i;else if(typeof i=="function")try{t!=null&&(o=i(t==null?void 0:t[0]))}catch{}else if(typeof i=="string"&&o0.test(i)){var c=o0.exec(i);if(c==null||t==null)o=void 0;else{var d=+c[1];o=t[0]-d}}else o=t==null?void 0:t[0];if(s==="auto")t!=null&&(l=Math.max(...t));else if(Y(s))l=s;else if(typeof s=="function")try{t!=null&&(l=s(t==null?void 0:t[1]))}catch{}else if(typeof s=="string"&&l0.test(s)){var u=l0.exec(s);if(u==null||t==null)l=void 0;else{var f=+u[1];l=t[1]+f}}else l=t==null?void 0:t[1];var p=[o,l];if(ji(p))return t==null?p:yy(p,t,r)}}}var Ca=1e9,nM={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},Nm,je=!0,sr="[DecimalError] ",di=sr+"Invalid argument: ",Sm=sr+"Exponent out of range: ",Aa=Math.floor,Qn=Math.pow,iM=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Lt,qe=1e7,xe=7,zS=9007199254740991,uc=Aa(zS/xe),V={};V.absoluteValue=V.abs=function(){var e=new this.constructor(this);return e.s&&(e.s=1),e};V.comparedTo=V.cmp=function(e){var t,r,n,i,s=this;if(e=new s.constructor(e),s.s!==e.s)return s.s||-e.s;if(s.e!==e.e)return s.e>e.e^s.s<0?1:-1;for(n=s.d.length,i=e.d.length,t=0,r=ne.d[t]^s.s<0?1:-1;return n===i?0:n>i^s.s<0?1:-1};V.decimalPlaces=V.dp=function(){var e=this,t=e.d.length-1,r=(t-e.e)*xe;if(t=e.d[t],t)for(;t%10==0;t/=10)r--;return r<0?0:r};V.dividedBy=V.div=function(e){return Vr(this,new this.constructor(e))};V.dividedToIntegerBy=V.idiv=function(e){var t=this,r=t.constructor;return fe(Vr(t,new r(e),0,1),r.precision)};V.equals=V.eq=function(e){return!this.cmp(e)};V.exponent=function(){return Me(this)};V.greaterThan=V.gt=function(e){return this.cmp(e)>0};V.greaterThanOrEqualTo=V.gte=function(e){return this.cmp(e)>=0};V.isInteger=V.isint=function(){return this.e>this.d.length-2};V.isNegative=V.isneg=function(){return this.s<0};V.isPositive=V.ispos=function(){return this.s>0};V.isZero=function(){return this.s===0};V.lessThan=V.lt=function(e){return this.cmp(e)<0};V.lessThanOrEqualTo=V.lte=function(e){return this.cmp(e)<1};V.logarithm=V.log=function(e){var t,r=this,n=r.constructor,i=n.precision,s=i+5;if(e===void 0)e=new n(10);else if(e=new n(e),e.s<1||e.eq(Lt))throw Error(sr+"NaN");if(r.s<1)throw Error(sr+(r.s?"NaN":"-Infinity"));return r.eq(Lt)?new n(0):(je=!1,t=Vr(Ws(r,s),Ws(e,s),s),je=!0,fe(t,i))};V.minus=V.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?FS(t,e):RS(t,(e.s=-e.s,e))};V.modulo=V.mod=function(e){var t,r=this,n=r.constructor,i=n.precision;if(e=new n(e),!e.s)throw Error(sr+"NaN");return r.s?(je=!1,t=Vr(r,e,0,1).times(e),je=!0,r.minus(t)):fe(new n(r),i)};V.naturalExponential=V.exp=function(){return BS(this)};V.naturalLogarithm=V.ln=function(){return Ws(this)};V.negated=V.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};V.plus=V.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?RS(t,e):FS(t,(e.s=-e.s,e))};V.precision=V.sd=function(e){var t,r,n,i=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(di+e);if(t=Me(i)+1,n=i.d.length-1,r=n*xe+1,n=i.d[n],n){for(;n%10==0;n/=10)r--;for(n=i.d[0];n>=10;n/=10)r++}return e&&t>r?t:r};V.squareRoot=V.sqrt=function(){var e,t,r,n,i,s,o,l=this,c=l.constructor;if(l.s<1){if(!l.s)return new c(0);throw Error(sr+"NaN")}for(e=Me(l),je=!1,i=Math.sqrt(+l),i==0||i==1/0?(t=Nr(l.d),(t.length+e)%2==0&&(t+="0"),i=Math.sqrt(t),e=Aa((e+1)/2)-(e<0||e%2),i==1/0?t="5e"+e:(t=i.toExponential(),t=t.slice(0,t.indexOf("e")+1)+e),n=new c(t)):n=new c(i.toString()),r=c.precision,i=o=r+3;;)if(s=n,n=s.plus(Vr(l,s,o+2)).times(.5),Nr(s.d).slice(0,o)===(t=Nr(n.d)).slice(0,o)){if(t=t.slice(o-3,o+1),i==o&&t=="4999"){if(fe(s,r+1,0),s.times(s).eq(l)){n=s;break}}else if(t!="9999")break;o+=4}return je=!0,fe(n,r)};V.times=V.mul=function(e){var t,r,n,i,s,o,l,c,d,u=this,f=u.constructor,p=u.d,m=(e=new f(e)).d;if(!u.s||!e.s)return new f(0);for(e.s*=u.s,r=u.e+e.e,c=p.length,d=m.length,c=0;){for(t=0,i=c+n;i>n;)l=s[i]+m[n]*p[i-n-1]+t,s[i--]=l%qe|0,t=l/qe|0;s[i]=(s[i]+t)%qe|0}for(;!s[--o];)s.pop();return t?++r:s.shift(),e.d=s,e.e=r,je?fe(e,f.precision):e};V.toDecimalPlaces=V.todp=function(e,t){var r=this,n=r.constructor;return r=new n(r),e===void 0?r:(Dr(e,0,Ca),t===void 0?t=n.rounding:Dr(t,0,8),fe(r,e+Me(r)+1,t))};V.toExponential=function(e,t){var r,n=this,i=n.constructor;return e===void 0?r=wi(n,!0):(Dr(e,0,Ca),t===void 0?t=i.rounding:Dr(t,0,8),n=fe(new i(n),e+1,t),r=wi(n,!0,e+1)),r};V.toFixed=function(e,t){var r,n,i=this,s=i.constructor;return e===void 0?wi(i):(Dr(e,0,Ca),t===void 0?t=s.rounding:Dr(t,0,8),n=fe(new s(i),e+Me(i)+1,t),r=wi(n.abs(),!1,e+Me(n)+1),i.isneg()&&!i.isZero()?"-"+r:r)};V.toInteger=V.toint=function(){var e=this,t=e.constructor;return fe(new t(e),Me(e)+1,t.rounding)};V.toNumber=function(){return+this};V.toPower=V.pow=function(e){var t,r,n,i,s,o,l=this,c=l.constructor,d=12,u=+(e=new c(e));if(!e.s)return new c(Lt);if(l=new c(l),!l.s){if(e.s<1)throw Error(sr+"Infinity");return l}if(l.eq(Lt))return l;if(n=c.precision,e.eq(Lt))return fe(l,n);if(t=e.e,r=e.d.length-1,o=t>=r,s=l.s,o){if((r=u<0?-u:u)<=zS){for(i=new c(Lt),t=Math.ceil(n/xe+4),je=!1;r%2&&(i=i.times(l),by(i.d,t)),r=Aa(r/2),r!==0;)l=l.times(l),by(l.d,t);return je=!0,e.s<0?new c(Lt).div(i):fe(i,n)}}else if(s<0)throw Error(sr+"NaN");return s=s<0&&e.d[Math.max(t,r)]&1?-1:1,l.s=1,je=!1,i=e.times(Ws(l,n+d)),je=!0,i=BS(i),i.s=s,i};V.toPrecision=function(e,t){var r,n,i=this,s=i.constructor;return e===void 0?(r=Me(i),n=wi(i,r<=s.toExpNeg||r>=s.toExpPos)):(Dr(e,1,Ca),t===void 0?t=s.rounding:Dr(t,0,8),i=fe(new s(i),e,t),r=Me(i),n=wi(i,e<=r||r<=s.toExpNeg,e)),n};V.toSignificantDigits=V.tosd=function(e,t){var r=this,n=r.constructor;return e===void 0?(e=n.precision,t=n.rounding):(Dr(e,1,Ca),t===void 0?t=n.rounding:Dr(t,0,8)),fe(new n(r),e,t)};V.toString=V.valueOf=V.val=V.toJSON=V[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,t=Me(e),r=e.constructor;return wi(e,t<=r.toExpNeg||t>=r.toExpPos)};function RS(e,t){var r,n,i,s,o,l,c,d,u=e.constructor,f=u.precision;if(!e.s||!t.s)return t.s||(t=new u(e)),je?fe(t,f):t;if(c=e.d,d=t.d,o=e.e,i=t.e,c=c.slice(),s=o-i,s){for(s<0?(n=c,s=-s,l=d.length):(n=d,i=o,l=c.length),o=Math.ceil(f/xe),l=o>l?o+1:l+1,s>l&&(s=l,n.length=1),n.reverse();s--;)n.push(0);n.reverse()}for(l=c.length,s=d.length,l-s<0&&(s=l,n=d,d=c,c=n),r=0;s;)r=(c[--s]=c[s]+d[s]+r)/qe|0,c[s]%=qe;for(r&&(c.unshift(r),++i),l=c.length;c[--l]==0;)c.pop();return t.d=c,t.e=i,je?fe(t,f):t}function Dr(e,t,r){if(e!==~~e||er)throw Error(di+e)}function Nr(e){var t,r,n,i=e.length-1,s="",o=e[0];if(i>0){for(s+=o,t=1;to?1:-1;else for(l=c=0;li[l]?1:-1;break}return c}function r(n,i,s){for(var o=0;s--;)n[s]-=o,o=n[s]1;)n.shift()}return function(n,i,s,o){var l,c,d,u,f,p,m,x,g,b,v,j,y,w,S,N,P,_,T=n.constructor,$=n.s==i.s?1:-1,M=n.d,C=i.d;if(!n.s)return new T(n);if(!i.s)throw Error(sr+"Division by zero");for(c=n.e-i.e,P=C.length,S=M.length,m=new T($),x=m.d=[],d=0;C[d]==(M[d]||0);)++d;if(C[d]>(M[d]||0)&&--c,s==null?j=s=T.precision:o?j=s+(Me(n)-Me(i))+1:j=s,j<0)return new T(0);if(j=j/xe+2|0,d=0,P==1)for(u=0,C=C[0],j++;(d1&&(C=e(C,u),M=e(M,u),P=C.length,S=M.length),w=P,g=M.slice(0,P),b=g.length;b=qe/2&&++N;do u=0,l=t(C,g,P,b),l<0?(v=g[0],P!=b&&(v=v*qe+(g[1]||0)),u=v/N|0,u>1?(u>=qe&&(u=qe-1),f=e(C,u),p=f.length,b=g.length,l=t(f,g,p,b),l==1&&(u--,r(f,P16)throw Error(Sm+Me(e));if(!e.s)return new u(Lt);for(je=!1,l=f,o=new u(.03125);e.abs().gte(.1);)e=e.times(o),d+=5;for(n=Math.log(Qn(2,d))/Math.LN10*2+5|0,l+=n,r=i=s=new u(Lt),u.precision=l;;){if(i=fe(i.times(e),l),r=r.times(++c),o=s.plus(Vr(i,r,l)),Nr(o.d).slice(0,l)===Nr(s.d).slice(0,l)){for(;d--;)s=fe(s.times(s),l);return u.precision=f,t==null?(je=!0,fe(s,f)):s}s=o}}function Me(e){for(var t=e.e*xe,r=e.d[0];r>=10;r/=10)t++;return t}function Sd(e,t,r){if(t>e.LN10.sd())throw je=!0,r&&(e.precision=r),Error(sr+"LN10 precision limit exceeded");return fe(new e(e.LN10),t)}function xn(e){for(var t="";e--;)t+="0";return t}function Ws(e,t){var r,n,i,s,o,l,c,d,u,f=1,p=10,m=e,x=m.d,g=m.constructor,b=g.precision;if(m.s<1)throw Error(sr+(m.s?"NaN":"-Infinity"));if(m.eq(Lt))return new g(0);if(t==null?(je=!1,d=b):d=t,m.eq(10))return t==null&&(je=!0),Sd(g,d);if(d+=p,g.precision=d,r=Nr(x),n=r.charAt(0),s=Me(m),Math.abs(s)<15e14){for(;n<7&&n!=1||n==1&&r.charAt(1)>3;)m=m.times(e),r=Nr(m.d),n=r.charAt(0),f++;s=Me(m),n>1?(m=new g("0."+r),s++):m=new g(n+"."+r.slice(1))}else return c=Sd(g,d+2,b).times(s+""),m=Ws(new g(n+"."+r.slice(1)),d-p).plus(c),g.precision=b,t==null?(je=!0,fe(m,b)):m;for(l=o=m=Vr(m.minus(Lt),m.plus(Lt),d),u=fe(m.times(m),d),i=3;;){if(o=fe(o.times(u),d),c=l.plus(Vr(o,new g(i),d)),Nr(c.d).slice(0,d)===Nr(l.d).slice(0,d))return l=l.times(2),s!==0&&(l=l.plus(Sd(g,d+2,b).times(s+""))),l=Vr(l,new g(f),d),g.precision=b,t==null?(je=!0,fe(l,b)):l;l=c,i+=2}}function vy(e,t){var r,n,i;for((r=t.indexOf("."))>-1&&(t=t.replace(".","")),(n=t.search(/e/i))>0?(r<0&&(r=n),r+=+t.slice(n+1),t=t.substring(0,n)):r<0&&(r=t.length),n=0;t.charCodeAt(n)===48;)++n;for(i=t.length;t.charCodeAt(i-1)===48;)--i;if(t=t.slice(n,i),t){if(i-=n,r=r-n-1,e.e=Aa(r/xe),e.d=[],n=(r+1)%xe,r<0&&(n+=xe),nuc||e.e<-uc))throw Error(Sm+r)}else e.s=0,e.e=0,e.d=[0];return e}function fe(e,t,r){var n,i,s,o,l,c,d,u,f=e.d;for(o=1,s=f[0];s>=10;s/=10)o++;if(n=t-o,n<0)n+=xe,i=t,d=f[u=0];else{if(u=Math.ceil((n+1)/xe),s=f.length,u>=s)return e;for(d=s=f[u],o=1;s>=10;s/=10)o++;n%=xe,i=n-xe+o}if(r!==void 0&&(s=Qn(10,o-i-1),l=d/s%10|0,c=t<0||f[u+1]!==void 0||d%s,c=r<4?(l||c)&&(r==0||r==(e.s<0?3:2)):l>5||l==5&&(r==4||c||r==6&&(n>0?i>0?d/Qn(10,o-i):0:f[u-1])%10&1||r==(e.s<0?8:7))),t<1||!f[0])return c?(s=Me(e),f.length=1,t=t-s-1,f[0]=Qn(10,(xe-t%xe)%xe),e.e=Aa(-t/xe)||0):(f.length=1,f[0]=e.e=e.s=0),e;if(n==0?(f.length=u,s=1,u--):(f.length=u+1,s=Qn(10,xe-n),f[u]=i>0?(d/Qn(10,o-i)%Qn(10,i)|0)*s:0),c)for(;;)if(u==0){(f[0]+=s)==qe&&(f[0]=1,++e.e);break}else{if(f[u]+=s,f[u]!=qe)break;f[u--]=0,s=1}for(n=f.length;f[--n]===0;)f.pop();if(je&&(e.e>uc||e.e<-uc))throw Error(Sm+Me(e));return e}function FS(e,t){var r,n,i,s,o,l,c,d,u,f,p=e.constructor,m=p.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new p(e),je?fe(t,m):t;if(c=e.d,f=t.d,n=t.e,d=e.e,c=c.slice(),o=d-n,o){for(u=o<0,u?(r=c,o=-o,l=f.length):(r=f,n=d,l=c.length),i=Math.max(Math.ceil(m/xe),l)+2,o>i&&(o=i,r.length=1),r.reverse(),i=o;i--;)r.push(0);r.reverse()}else{for(i=c.length,l=f.length,u=i0;--i)c[l++]=0;for(i=f.length;i>o;){if(c[--i]0?s=s.charAt(0)+"."+s.slice(1)+xn(n):o>1&&(s=s.charAt(0)+"."+s.slice(1)),s=s+(i<0?"e":"e+")+i):i<0?(s="0."+xn(-i-1)+s,r&&(n=r-o)>0&&(s+=xn(n))):i>=o?(s+=xn(i+1-o),r&&(n=r-i-1)>0&&(s=s+"."+xn(n))):((n=i+1)0&&(i+1===o&&(s+="."),s+=xn(n))),e.s<0?"-"+s:s}function by(e,t){if(e.length>t)return e.length=t,!0}function WS(e){var t,r,n;function i(s){var o=this;if(!(o instanceof i))return new i(s);if(o.constructor=i,s instanceof i){o.s=s.s,o.e=s.e,o.d=(s=s.d)?s.slice():s;return}if(typeof s=="number"){if(s*0!==0)throw Error(di+s);if(s>0)o.s=1;else if(s<0)s=-s,o.s=-1;else{o.s=0,o.e=0,o.d=[0];return}if(s===~~s&&s<1e7){o.e=0,o.d=[s];return}return vy(o,s.toString())}else if(typeof s!="string")throw Error(di+s);if(s.charCodeAt(0)===45?(s=s.slice(1),o.s=-1):o.s=1,iM.test(s))vy(o,s);else throw Error(di+s)}if(i.prototype=V,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.clone=WS,i.config=i.set=aM,e===void 0&&(e={}),e)for(n=["precision","rounding","toExpNeg","toExpPos","LN10"],t=0;t=i[t+1]&&n<=i[t+2])this[r]=n;else throw Error(di+r+": "+n);if((n=e[r="LN10"])!==void 0)if(n==Math.LN10)this[r]=new this(n);else throw Error(di+r+": "+n);return this}var Nm=WS(nM);Lt=new Nm(1);const oe=Nm;var sM=e=>e,US={},qS=e=>e===US,jy=e=>function t(){return arguments.length===0||arguments.length===1&&qS(arguments.length<=0?void 0:arguments[0])?t:e(...arguments)},HS=(e,t)=>e===1?t:jy(function(){for(var r=arguments.length,n=new Array(r),i=0;io!==US).length;return s>=e?t(...n):HS(e-s,jy(function(){for(var o=arguments.length,l=new Array(o),c=0;cqS(u)?l.shift():u);return t(...d,...l)}))}),ju=e=>HS(e.length,e),sp=(e,t)=>{for(var r=[],n=e;nArray.isArray(t)?t.map(e):Object.keys(t).map(r=>t[r]).map(e)),lM=function(){for(var t=arguments.length,r=new Array(t),n=0;nc(l),s(...arguments))}},op=e=>Array.isArray(e)?e.reverse():e.split("").reverse().join(""),KS=e=>{var t=null,r=null;return function(){for(var n=arguments.length,i=new Array(n),s=0;s{var c;return o===((c=t)===null||c===void 0?void 0:c[l])})||(t=i,r=e(...i)),r}};function VS(e){var t;return e===0?t=1:t=Math.floor(new oe(e).abs().log(10).toNumber())+1,t}function YS(e,t,r){for(var n=new oe(e),i=0,s=[];n.lt(t)&&i<1e5;)s.push(n.toNumber()),n=n.add(r),i++;return s}ju((e,t,r)=>{var n=+e,i=+t;return n+r*(i-n)});ju((e,t,r)=>{var n=t-+e;return n=n||1/0,(r-e)/n});ju((e,t,r)=>{var n=t-+e;return n=n||1/0,Math.max(0,Math.min(1,(r-e)/n))});var GS=e=>{var[t,r]=e,[n,i]=[t,r];return t>r&&([n,i]=[r,t]),[n,i]},ZS=(e,t,r)=>{if(e.lte(0))return new oe(0);var n=VS(e.toNumber()),i=new oe(10).pow(n),s=e.div(i),o=n!==1?.05:.1,l=new oe(Math.ceil(s.div(o).toNumber())).add(r).mul(o),c=l.mul(i);return t?new oe(c.toNumber()):new oe(Math.ceil(c.toNumber()))},cM=(e,t,r)=>{var n=new oe(1),i=new oe(e);if(!i.isint()&&r){var s=Math.abs(e);s<1?(n=new oe(10).pow(VS(e)-1),i=new oe(Math.floor(i.div(n).toNumber())).mul(n)):s>1&&(i=new oe(Math.floor(e)))}else e===0?i=new oe(Math.floor((t-1)/2)):r||(i=new oe(Math.floor(e)));var o=Math.floor((t-1)/2),l=lM(oM(c=>i.add(new oe(c-o).mul(n)).toNumber()),sp);return l(0,t)},XS=function(t,r,n,i){var s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((r-t)/(n-1)))return{step:new oe(0),tickMin:new oe(0),tickMax:new oe(0)};var o=ZS(new oe(r).sub(t).div(n-1),i,s),l;t<=0&&r>=0?l=new oe(0):(l=new oe(t).add(r).div(2),l=l.sub(new oe(l).mod(o)));var c=Math.ceil(l.sub(t).div(o).toNumber()),d=Math.ceil(new oe(r).sub(l).div(o).toNumber()),u=c+d+1;return u>n?XS(t,r,n,i,s+1):(u0?d+(n-u):d,c=r>0?c:c+(n-u)),{step:o,tickMin:l.sub(new oe(c).mul(o)),tickMax:l.add(new oe(d).mul(o))})};function uM(e){var[t,r]=e,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,s=Math.max(n,2),[o,l]=GS([t,r]);if(o===-1/0||l===1/0){var c=l===1/0?[o,...sp(0,n-1).map(()=>1/0)]:[...sp(0,n-1).map(()=>-1/0),l];return t>r?op(c):c}if(o===l)return cM(o,n,i);var{step:d,tickMin:u,tickMax:f}=XS(o,l,s,i,0),p=YS(u,f.add(new oe(.1).mul(d)),d);return t>r?op(p):p}function dM(e,t){var[r,n]=e,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,[s,o]=GS([r,n]);if(s===-1/0||o===1/0)return[r,n];if(s===o)return[s];var l=Math.max(t,2),c=ZS(new oe(o).sub(s).div(l-1),i,0),d=[...YS(new oe(s),new oe(o),c),o];return i===!1&&(d=d.map(u=>Math.round(u))),r>n?op(d):d}var fM=KS(uM),pM=KS(dM),hM=e=>e.rootProps.barCategoryGap,wu=e=>e.rootProps.stackOffset,km=e=>e.options.chartName,Pm=e=>e.rootProps.syncId,JS=e=>e.rootProps.syncMethod,_m=e=>e.options.eventEmitter,mM=e=>e.rootProps.baseValue,lt={grid:-100,barBackground:-50,area:100,cursorRectangle:200,bar:300,line:400,axis:500,scatter:600,activeBar:1e3,cursorLine:1100,activeDot:1200,label:2e3},zr={allowDuplicatedCategory:!0,angleAxisId:0,reversed:!1,scale:"auto",tick:!0,type:"category"},$t={allowDataOverflow:!1,allowDuplicatedCategory:!0,radiusAxisId:0,scale:"auto",tick:!0,tickCount:5,type:"number"},Su=(e,t)=>{if(!(!e||!t))return e!=null&&e.reversed?[t[1],t[0]]:t},gM={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:!1,dataKey:void 0,domain:void 0,id:zr.angleAxisId,includeHidden:!1,name:void 0,reversed:zr.reversed,scale:zr.scale,tick:zr.tick,tickCount:void 0,ticks:void 0,type:zr.type,unit:void 0},xM={allowDataOverflow:$t.allowDataOverflow,allowDecimals:!1,allowDuplicatedCategory:$t.allowDuplicatedCategory,dataKey:void 0,domain:void 0,id:$t.radiusAxisId,includeHidden:!1,name:void 0,reversed:!1,scale:$t.scale,tick:$t.tick,tickCount:$t.tickCount,ticks:void 0,type:$t.type,unit:void 0},yM={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:zr.allowDuplicatedCategory,dataKey:void 0,domain:void 0,id:zr.angleAxisId,includeHidden:!1,name:void 0,reversed:!1,scale:zr.scale,tick:zr.tick,tickCount:void 0,ticks:void 0,type:"number",unit:void 0},vM={allowDataOverflow:$t.allowDataOverflow,allowDecimals:!1,allowDuplicatedCategory:$t.allowDuplicatedCategory,dataKey:void 0,domain:void 0,id:$t.radiusAxisId,includeHidden:!1,name:void 0,reversed:!1,scale:$t.scale,tick:$t.tick,tickCount:$t.tickCount,ticks:void 0,type:"category",unit:void 0},Cm=(e,t)=>e.polarAxis.angleAxis[t]!=null?e.polarAxis.angleAxis[t]:e.layout.layoutType==="radial"?yM:gM,Am=(e,t)=>e.polarAxis.radiusAxis[t]!=null?e.polarAxis.radiusAxis[t]:e.layout.layoutType==="radial"?vM:xM,Nu=e=>e.polarOptions,Om=I([ln,cn,rt],gD),QS=I([Nu,Om],(e,t)=>{if(e!=null)return Rn(e.innerRadius,t,0)}),e2=I([Nu,Om],(e,t)=>{if(e!=null)return Rn(e.outerRadius,t,t*.8)}),bM=e=>{if(e==null)return[0,0];var{startAngle:t,endAngle:r}=e;return[t,r]},t2=I([Nu],bM);I([Cm,t2],Su);var r2=I([Om,QS,e2],(e,t,r)=>{if(!(e==null||t==null||r==null))return[t,r]});I([Am,r2],Su);var n2=I([ue,Nu,QS,e2,ln,cn],(e,t,r,n,i,s)=>{if(!(e!=="centric"&&e!=="radial"||t==null||r==null||n==null)){var{cx:o,cy:l,startAngle:c,endAngle:d}=t;return{cx:Rn(o,i,i/2),cy:Rn(l,s,s/2),innerRadius:r,outerRadius:n,startAngle:c,endAngle:d,clockWise:!1}}}),Fe=(e,t)=>t,ku=(e,t,r)=>r;function Em(e){return e==null?void 0:e.id}function i2(e,t,r){var{chartData:n=[]}=t,{allowDuplicatedCategory:i,dataKey:s}=r,o=new Map;return e.forEach(l=>{var c,d=(c=l.data)!==null&&c!==void 0?c:n;if(!(d==null||d.length===0)){var u=Em(l);d.forEach((f,p)=>{var m=s==null||i?p:String(et(f,s,null)),x=et(f,l.dataKey,0),g;o.has(m)?g=o.get(m):g={},Object.assign(g,{[u]:x}),o.set(m,g)})}}),Array.from(o.values())}function Dm(e){return e.stackId!=null&&e.dataKey!=null}var Pu=(e,t)=>e===t?!0:e==null||t==null?!1:e[0]===t[0]&&e[1]===t[1];function _u(e,t){return Array.isArray(e)&&Array.isArray(t)&&e.length===0&&t.length===0?!0:e===t}function jM(e,t){if(e.length===t.length){for(var r=0;r{var t=ue(e);return t==="horizontal"?"xAxis":t==="vertical"?"yAxis":t==="centric"?"angleAxis":"radiusAxis"},Oa=e=>e.tooltip.settings.axisId;function wy(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function dc(e){for(var t=1;te.cartesianAxis.xAxis[t],dn=(e,t)=>{var r=a2(e,t);return r??Tt},Mt={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:lp,hide:!0,id:0,includeHidden:!1,interval:"preserveEnd",minTickGap:5,mirror:!1,name:void 0,orientation:"left",padding:{top:0,bottom:0},reversed:!1,scale:"auto",tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:"number",unit:void 0,width:eo},s2=(e,t)=>e.cartesianAxis.yAxis[t],fn=(e,t)=>{var r=s2(e,t);return r??Mt},kM={domain:[0,"auto"],includeHidden:!1,reversed:!1,allowDataOverflow:!1,allowDuplicatedCategory:!1,dataKey:void 0,id:0,name:"",range:[64,64],scale:"auto",type:"number",unit:""},Tm=(e,t)=>{var r=e.cartesianAxis.zAxis[t];return r??kM},vt=(e,t,r)=>{switch(t){case"xAxis":return dn(e,r);case"yAxis":return fn(e,r);case"zAxis":return Tm(e,r);case"angleAxis":return Cm(e,r);case"radiusAxis":return Am(e,r);default:throw new Error("Unexpected axis type: ".concat(t))}},PM=(e,t,r)=>{switch(t){case"xAxis":return dn(e,r);case"yAxis":return fn(e,r);default:throw new Error("Unexpected axis type: ".concat(t))}},so=(e,t,r)=>{switch(t){case"xAxis":return dn(e,r);case"yAxis":return fn(e,r);case"angleAxis":return Cm(e,r);case"radiusAxis":return Am(e,r);default:throw new Error("Unexpected axis type: ".concat(t))}},o2=e=>e.graphicalItems.cartesianItems.some(t=>t.type==="bar")||e.graphicalItems.polarItems.some(t=>t.type==="radialBar");function l2(e,t){return r=>{switch(e){case"xAxis":return"xAxisId"in r&&r.xAxisId===t;case"yAxis":return"yAxisId"in r&&r.yAxisId===t;case"zAxis":return"zAxisId"in r&&r.zAxisId===t;case"angleAxis":return"angleAxisId"in r&&r.angleAxisId===t;case"radiusAxis":return"radiusAxisId"in r&&r.radiusAxisId===t;default:return!1}}}var Mm=e=>e.graphicalItems.cartesianItems,_M=I([Fe,ku],l2),c2=(e,t,r)=>e.filter(r).filter(n=>(t==null?void 0:t.includeHidden)===!0?!0:!n.hide),oo=I([Mm,vt,_M],c2,{memoizeOptions:{resultEqualityCheck:_u}}),u2=I([oo],e=>e.filter(t=>t.type==="area"||t.type==="bar").filter(Dm)),d2=e=>e.filter(t=>!("stackId"in t)||t.stackId===void 0),CM=I([oo],d2),f2=e=>e.map(t=>t.data).filter(Boolean).flat(1),AM=I([oo],f2,{memoizeOptions:{resultEqualityCheck:_u}}),p2=(e,t)=>{var{chartData:r=[],dataStartIndex:n,dataEndIndex:i}=t;return e.length>0?e:r.slice(n,i+1)},Im=I([AM,bu],p2),h2=(e,t,r)=>(t==null?void 0:t.dataKey)!=null?e.map(n=>({value:et(n,t.dataKey)})):r.length>0?r.map(n=>n.dataKey).flatMap(n=>e.map(i=>({value:et(i,n)}))):e.map(n=>({value:n})),Cu=I([Im,vt,oo],h2);function m2(e,t){switch(e){case"xAxis":return t.direction==="x";case"yAxis":return t.direction==="y";default:return!1}}function ll(e){if(Or(e)||e instanceof Date){var t=Number(e);if(_e(t))return t}}function Sy(e){if(Array.isArray(e)){var t=[ll(e[0]),ll(e[1])];return ji(t)?t:void 0}var r=ll(e);if(r!=null)return[r,r]}function an(e){return e.map(ll).filter(R6)}function OM(e,t,r){return!r||typeof t!="number"||yr(t)?[]:r.length?an(r.flatMap(n=>{var i=et(e,n.dataKey),s,o;if(Array.isArray(i)?[s,o]=i:s=o=i,!(!_e(s)||!_e(o)))return[t-s,t+o]})):[]}var Ue=e=>{var t=We(e),r=Oa(e);return so(e,t,r)},g2=I([Ue],e=>e==null?void 0:e.dataKey),EM=I([u2,bu,Ue],i2),x2=(e,t,r)=>{var n={},i=t.reduce((s,o)=>(o.stackId==null||(s[o.stackId]==null&&(s[o.stackId]=[]),s[o.stackId].push(o)),s),n);return Object.fromEntries(Object.entries(i).map(s=>{var[o,l]=s,c=l.map(Em);return[o,{stackedData:kE(e,c,r),graphicalItems:l}]}))},cp=I([EM,u2,wu],x2),y2=(e,t,r,n)=>{var{dataStartIndex:i,dataEndIndex:s}=t;if(n==null&&r!=="zAxis"){var o=AE(e,i,s);if(!(o!=null&&o[0]===0&&o[1]===0))return o}},DM=I([vt],e=>e.allowDataOverflow),$m=e=>{var t;if(e==null||!("domain"in e))return lp;if(e.domain!=null)return e.domain;if(e.ticks!=null){if(e.type==="number"){var r=an(e.ticks);return[Math.min(...r),Math.max(...r)]}if(e.type==="category")return e.ticks.map(String)}return(t=e==null?void 0:e.domain)!==null&&t!==void 0?t:lp},v2=I([vt],$m),b2=I([v2,DM],LS),TM=I([cp,Kn,Fe,b2],y2,{memoizeOptions:{resultEqualityCheck:Pu}}),Lm=e=>e.errorBars,MM=(e,t,r)=>e.flatMap(n=>t[n.id]).filter(Boolean).filter(n=>m2(r,n)),fc=function(){for(var t=arguments.length,r=new Array(t),n=0;n{var s,o;if(r.length>0&&e.forEach(l=>{r.forEach(c=>{var d,u,f=(d=n[c.id])===null||d===void 0?void 0:d.filter(v=>m2(i,v)),p=et(l,(u=t.dataKey)!==null&&u!==void 0?u:c.dataKey),m=OM(l,p,f);if(m.length>=2){var x=Math.min(...m),g=Math.max(...m);(s==null||xo)&&(o=g)}var b=Sy(p);b!=null&&(s=s==null?b[0]:Math.min(s,b[0]),o=o==null?b[1]:Math.max(o,b[1]))})}),(t==null?void 0:t.dataKey)!=null&&e.forEach(l=>{var c=Sy(et(l,t.dataKey));c!=null&&(s=s==null?c[0]:Math.min(s,c[0]),o=o==null?c[1]:Math.max(o,c[1]))}),_e(s)&&_e(o))return[s,o]},IM=I([Im,vt,CM,Lm,Fe],j2,{memoizeOptions:{resultEqualityCheck:Pu}});function $M(e){var{value:t}=e;if(Or(t)||t instanceof Date)return t}var LM=(e,t,r)=>{var n=e.map($M).filter(i=>i!=null);return r&&(t.dataKey==null||t.allowDuplicatedCategory&&_j(n))?rS(0,e.length):t.allowDuplicatedCategory?n:Array.from(new Set(n))},w2=e=>e.referenceElements.dots,Ea=(e,t,r)=>e.filter(n=>n.ifOverflow==="extendDomain").filter(n=>t==="xAxis"?n.xAxisId===r:n.yAxisId===r),zM=I([w2,Fe,ku],Ea),S2=e=>e.referenceElements.areas,RM=I([S2,Fe,ku],Ea),N2=e=>e.referenceElements.lines,BM=I([N2,Fe,ku],Ea),k2=(e,t)=>{var r=an(e.map(n=>t==="xAxis"?n.x:n.y));if(r.length!==0)return[Math.min(...r),Math.max(...r)]},FM=I(zM,Fe,k2),P2=(e,t)=>{var r=an(e.flatMap(n=>[t==="xAxis"?n.x1:n.y1,t==="xAxis"?n.x2:n.y2]));if(r.length!==0)return[Math.min(...r),Math.max(...r)]},WM=I([RM,Fe],P2);function UM(e){var t;if(e.x!=null)return an([e.x]);var r=(t=e.segment)===null||t===void 0?void 0:t.map(n=>n.x);return r==null||r.length===0?[]:an(r)}function qM(e){var t;if(e.y!=null)return an([e.y]);var r=(t=e.segment)===null||t===void 0?void 0:t.map(n=>n.y);return r==null||r.length===0?[]:an(r)}var _2=(e,t)=>{var r=e.flatMap(n=>t==="xAxis"?UM(n):qM(n));if(r.length!==0)return[Math.min(...r),Math.max(...r)]},HM=I([BM,Fe],_2),KM=I(FM,HM,WM,(e,t,r)=>fc(e,r,t)),C2=(e,t,r,n,i,s,o,l)=>{if(r!=null)return r;var c=o==="vertical"&&l==="xAxis"||o==="horizontal"&&l==="yAxis",d=c?fc(n,s,i):fc(s,i);return rM(t,d,e.allowDataOverflow)},VM=I([vt,v2,b2,TM,IM,KM,ue,Fe],C2,{memoizeOptions:{resultEqualityCheck:Pu}}),YM=[0,1],A2=(e,t,r,n,i,s,o)=>{if(!((e==null||r==null||r.length===0)&&o===void 0)){var{dataKey:l,type:c}=e,d=Mr(t,s);if(d&&l==null){var u;return rS(0,(u=r==null?void 0:r.length)!==null&&u!==void 0?u:0)}return c==="category"?LM(n,e,d):i==="expand"?YM:o}},zm=I([vt,ue,Im,Cu,wu,Fe,VM],A2),O2=(e,t,r,n,i)=>{if(e!=null){var{scale:s,type:o}=e;if(s==="auto")return t==="radial"&&i==="radiusAxis"?"band":t==="radial"&&i==="angleAxis"?"linear":o==="category"&&n&&(n.indexOf("LineChart")>=0||n.indexOf("AreaChart")>=0||n.indexOf("ComposedChart")>=0&&!r)?"point":o==="category"?"band":"linear";if(typeof s=="string"){var l="scale".concat(Xs(s));return l in ts?l:"point"}}},lo=I([vt,ue,o2,km,Fe],O2);function GM(e){if(e!=null){if(e in ts)return ts[e]();var t="scale".concat(Xs(e));if(t in ts)return ts[t]()}}function Rm(e,t,r,n){if(!(r==null||n==null)){if(typeof e.scale=="function")return e.scale.copy().domain(r).range(n);var i=GM(t);if(i!=null){var s=i.domain(r).range(n);return jE(s),s}}}var E2=(e,t,r)=>{var n=$m(t);if(!(r!=="auto"&&r!=="linear")){if(t!=null&&t.tickCount&&Array.isArray(n)&&(n[0]==="auto"||n[1]==="auto")&&ji(e))return fM(e,t.tickCount,t.allowDecimals);if(t!=null&&t.tickCount&&t.type==="number"&&ji(e))return pM(e,t.tickCount,t.allowDecimals)}},Bm=I([zm,so,lo],E2),D2=(e,t,r,n)=>{if(n!=="angleAxis"&&(e==null?void 0:e.type)==="number"&&ji(t)&&Array.isArray(r)&&r.length>0){var i=t[0],s=r[0],o=t[1],l=r[r.length-1];return[Math.min(i,s),Math.max(o,l)]}return t},ZM=I([vt,zm,Bm,Fe],D2),XM=I(Cu,vt,(e,t)=>{if(!(!t||t.type!=="number")){var r=1/0,n=Array.from(an(e.map(l=>l.value))).sort((l,c)=>l-c);if(n.length<2)return 1/0;var i=n[n.length-1]-n[0];if(i===0)return 1/0;for(var s=0;sn,(e,t,r,n,i)=>{if(!_e(e))return 0;var s=t==="vertical"?n.height:n.width;if(i==="gap")return e*s/2;if(i==="no-gap"){var o=Rn(r,e*s),l=e*s/2;return l-o-(l-o)/s*o}return 0}),JM=(e,t)=>{var r=dn(e,t);return r==null||typeof r.padding!="string"?0:T2(e,"xAxis",t,r.padding)},QM=(e,t)=>{var r=fn(e,t);return r==null||typeof r.padding!="string"?0:T2(e,"yAxis",t,r.padding)},eI=I(dn,JM,(e,t)=>{var r,n;if(e==null)return{left:0,right:0};var{padding:i}=e;return typeof i=="string"?{left:t,right:t}:{left:((r=i.left)!==null&&r!==void 0?r:0)+t,right:((n=i.right)!==null&&n!==void 0?n:0)+t}}),tI=I(fn,QM,(e,t)=>{var r,n;if(e==null)return{top:0,bottom:0};var{padding:i}=e;return typeof i=="string"?{top:t,bottom:t}:{top:((r=i.top)!==null&&r!==void 0?r:0)+t,bottom:((n=i.bottom)!==null&&n!==void 0?n:0)+t}}),rI=I([rt,eI,cu,lu,(e,t,r)=>r],(e,t,r,n,i)=>{var{padding:s}=n;return i?[s.left,r.width-s.right]:[e.left+t.left,e.left+e.width-t.right]}),nI=I([rt,ue,tI,cu,lu,(e,t,r)=>r],(e,t,r,n,i,s)=>{var{padding:o}=i;return s?[n.height-o.bottom,o.top]:t==="horizontal"?[e.top+e.height-r.bottom,e.top+r.top]:[e.top+r.top,e.top+e.height-r.bottom]}),co=(e,t,r,n)=>{var i;switch(t){case"xAxis":return rI(e,r,n);case"yAxis":return nI(e,r,n);case"zAxis":return(i=Tm(e,r))===null||i===void 0?void 0:i.range;case"angleAxis":return t2(e);case"radiusAxis":return r2(e,r);default:return}},M2=I([vt,co],Su),Da=I([vt,lo,ZM,M2],Rm);I([oo,Lm,Fe],MM);function I2(e,t){return e.idt.id?1:0}var Au=(e,t)=>t,Ou=(e,t,r)=>r,iI=I(su,Au,Ou,(e,t,r)=>e.filter(n=>n.orientation===t).filter(n=>n.mirror===r).sort(I2)),aI=I(ou,Au,Ou,(e,t,r)=>e.filter(n=>n.orientation===t).filter(n=>n.mirror===r).sort(I2)),$2=(e,t)=>({width:e.width,height:t.height}),sI=(e,t)=>{var r=typeof t.width=="number"?t.width:eo;return{width:r,height:e.height}},oI=I(rt,dn,$2),lI=(e,t,r)=>{switch(t){case"top":return e.top;case"bottom":return r-e.bottom;default:return 0}},cI=(e,t,r)=>{switch(t){case"left":return e.left;case"right":return r-e.right;default:return 0}},uI=I(cn,rt,iI,Au,Ou,(e,t,r,n,i)=>{var s={},o;return r.forEach(l=>{var c=$2(t,l);o==null&&(o=lI(t,n,e));var d=n==="top"&&!i||n==="bottom"&&i;s[l.id]=o-Number(d)*c.height,o+=(d?-1:1)*c.height}),s}),dI=I(ln,rt,aI,Au,Ou,(e,t,r,n,i)=>{var s={},o;return r.forEach(l=>{var c=sI(t,l);o==null&&(o=cI(t,n,e));var d=n==="left"&&!i||n==="right"&&i;s[l.id]=o-Number(d)*c.width,o+=(d?-1:1)*c.width}),s}),fI=(e,t)=>{var r=dn(e,t);if(r!=null)return uI(e,r.orientation,r.mirror)},pI=I([rt,dn,fI,(e,t)=>t],(e,t,r,n)=>{if(t!=null){var i=r==null?void 0:r[n];return i==null?{x:e.left,y:0}:{x:e.left,y:i}}}),hI=(e,t)=>{var r=fn(e,t);if(r!=null)return dI(e,r.orientation,r.mirror)},mI=I([rt,fn,hI,(e,t)=>t],(e,t,r,n)=>{if(t!=null){var i=r==null?void 0:r[n];return i==null?{x:0,y:e.top}:{x:i,y:e.top}}}),gI=I(rt,fn,(e,t)=>{var r=typeof t.width=="number"?t.width:eo;return{width:r,height:e.height}}),L2=(e,t,r,n)=>{if(r!=null){var{allowDuplicatedCategory:i,type:s,dataKey:o}=r,l=Mr(e,n),c=t.map(d=>d.value);if(o&&l&&s==="category"&&i&&_j(c))return c}},Fm=I([ue,Cu,vt,Fe],L2),z2=(e,t,r,n)=>{if(!(r==null||r.dataKey==null)){var{type:i,scale:s}=r,o=Mr(e,n);if(o&&(i==="number"||s!=="auto"))return t.map(l=>l.value)}},Wm=I([ue,Cu,so,Fe],z2),Ny=I([ue,PM,lo,Da,Fm,Wm,co,Bm,Fe],(e,t,r,n,i,s,o,l,c)=>{if(t!=null){var d=Mr(e,c);return{angle:t.angle,interval:t.interval,minTickGap:t.minTickGap,orientation:t.orientation,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit,axisType:c,categoricalDomain:s,duplicateDomain:i,isCategorical:d,niceTicks:l,range:o,realScaleType:r,scale:n}}}),xI=(e,t,r,n,i,s,o,l,c)=>{if(!(t==null||n==null)){var d=Mr(e,c),{type:u,ticks:f,tickCount:p}=t,m=r==="scaleBand"&&typeof n.bandwidth=="function"?n.bandwidth()/2:2,x=u==="category"&&n.bandwidth?n.bandwidth()/m:0;x=c==="angleAxis"&&s!=null&&s.length>=2?Jt(s[0]-s[1])*2*x:x;var g=f||i;if(g){var b=g.map((v,j)=>{var y=o?o.indexOf(v):v;return{index:j,coordinate:n(y)+x,value:v,offset:x}});return b.filter(v=>_e(v.coordinate))}return d&&l?l.map((v,j)=>({coordinate:n(v)+x,value:v,index:j,offset:x})).filter(v=>_e(v.coordinate)):n.ticks?n.ticks(p).map(v=>({coordinate:n(v)+x,value:v,offset:x})):n.domain().map((v,j)=>({coordinate:n(v)+x,value:o?o[v]:v,index:j,offset:x}))}},R2=I([ue,so,lo,Da,Bm,co,Fm,Wm,Fe],xI),yI=(e,t,r,n,i,s,o)=>{if(!(t==null||r==null||n==null||n[0]===n[1])){var l=Mr(e,o),{tickCount:c}=t,d=0;return d=o==="angleAxis"&&(n==null?void 0:n.length)>=2?Jt(n[0]-n[1])*2*d:d,l&&s?s.map((u,f)=>({coordinate:r(u)+d,value:u,index:f,offset:d})):r.ticks?r.ticks(c).map(u=>({coordinate:r(u)+d,value:u,offset:d})):r.domain().map((u,f)=>({coordinate:r(u)+d,value:i?i[u]:u,index:f,offset:d}))}},Eu=I([ue,so,Da,co,Fm,Wm,Fe],yI),Du=I(vt,Da,(e,t)=>{if(!(e==null||t==null))return dc(dc({},e),{},{scale:t})}),vI=I([vt,lo,zm,M2],Rm);I((e,t,r)=>Tm(e,r),vI,(e,t)=>{if(!(e==null||t==null))return dc(dc({},e),{},{scale:t})});var bI=I([ue,su,ou],(e,t,r)=>{switch(e){case"horizontal":return t.some(n=>n.reversed)?"right-to-left":"left-to-right";case"vertical":return r.some(n=>n.reversed)?"bottom-to-top":"top-to-bottom";case"centric":case"radial":return"left-to-right";default:return}}),B2=e=>e.options.defaultTooltipEventType,F2=e=>e.options.validateTooltipEventTypes;function W2(e,t,r){if(e==null)return t;var n=e?"axis":"item";return r==null?t:r.includes(n)?n:t}function Um(e,t){var r=B2(e),n=F2(e);return W2(t,r,n)}function jI(e){return G(t=>Um(t,e))}var U2=(e,t)=>{var r,n=Number(t);if(!(yr(n)||t==null))return n>=0?e==null||(r=e[n])===null||r===void 0?void 0:r.value:void 0},wI=e=>e.tooltip.settings,jn={active:!1,index:null,dataKey:void 0,coordinate:void 0},SI={itemInteraction:{click:jn,hover:jn},axisInteraction:{click:jn,hover:jn},keyboardInteraction:jn,syncInteraction:{active:!1,index:null,dataKey:void 0,label:void 0,coordinate:void 0,sourceViewBox:void 0},tooltipItemPayloads:[],settings:{shared:void 0,trigger:"hover",axisId:0,active:!1,defaultIndex:void 0}},q2=At({name:"tooltip",initialState:SI,reducers:{addTooltipEntrySettings:{reducer(e,t){e.tooltipItemPayloads.push(t.payload)},prepare:Le()},removeTooltipEntrySettings:{reducer(e,t){var r=Kr(e).tooltipItemPayloads.indexOf(t.payload);r>-1&&e.tooltipItemPayloads.splice(r,1)},prepare:Le()},setTooltipSettingsState(e,t){e.settings=t.payload},setActiveMouseOverItemIndex(e,t){e.syncInteraction.active=!1,e.keyboardInteraction.active=!1,e.itemInteraction.hover.active=!0,e.itemInteraction.hover.index=t.payload.activeIndex,e.itemInteraction.hover.dataKey=t.payload.activeDataKey,e.itemInteraction.hover.coordinate=t.payload.activeCoordinate},mouseLeaveChart(e){e.itemInteraction.hover.active=!1,e.axisInteraction.hover.active=!1},mouseLeaveItem(e){e.itemInteraction.hover.active=!1},setActiveClickItemIndex(e,t){e.syncInteraction.active=!1,e.itemInteraction.click.active=!0,e.keyboardInteraction.active=!1,e.itemInteraction.click.index=t.payload.activeIndex,e.itemInteraction.click.dataKey=t.payload.activeDataKey,e.itemInteraction.click.coordinate=t.payload.activeCoordinate},setMouseOverAxisIndex(e,t){e.syncInteraction.active=!1,e.axisInteraction.hover.active=!0,e.keyboardInteraction.active=!1,e.axisInteraction.hover.index=t.payload.activeIndex,e.axisInteraction.hover.dataKey=t.payload.activeDataKey,e.axisInteraction.hover.coordinate=t.payload.activeCoordinate},setMouseClickAxisIndex(e,t){e.syncInteraction.active=!1,e.keyboardInteraction.active=!1,e.axisInteraction.click.active=!0,e.axisInteraction.click.index=t.payload.activeIndex,e.axisInteraction.click.dataKey=t.payload.activeDataKey,e.axisInteraction.click.coordinate=t.payload.activeCoordinate},setSyncInteraction(e,t){e.syncInteraction=t.payload},setKeyboardInteraction(e,t){e.keyboardInteraction.active=t.payload.active,e.keyboardInteraction.index=t.payload.activeIndex,e.keyboardInteraction.coordinate=t.payload.activeCoordinate,e.keyboardInteraction.dataKey=t.payload.activeDataKey}}}),{addTooltipEntrySettings:NI,removeTooltipEntrySettings:kI,setTooltipSettingsState:PI,setActiveMouseOverItemIndex:_I,mouseLeaveItem:_F,mouseLeaveChart:H2,setActiveClickItemIndex:CF,setMouseOverAxisIndex:K2,setMouseClickAxisIndex:CI,setSyncInteraction:up,setKeyboardInteraction:dp}=q2.actions,AI=q2.reducer;function ky(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Ho(e){for(var t=1;t{if(t==null)return jn;var i=TI(e,t,r);if(i==null)return jn;if(i.active)return i;if(e.keyboardInteraction.active)return e.keyboardInteraction;if(e.syncInteraction.active&&e.syncInteraction.index!=null)return e.syncInteraction;var s=e.settings.active===!0;if(MI(i)){if(s)return Ho(Ho({},i),{},{active:!0})}else if(n!=null)return{active:!0,coordinate:void 0,dataKey:void 0,index:n};return Ho(Ho({},jn),{},{coordinate:i.coordinate})},qm=(e,t)=>{var r=e==null?void 0:e.index;if(r==null)return null;var n=Number(r);if(!_e(n))return r;var i=0,s=1/0;return t.length>0&&(s=t.length-1),String(Math.max(i,Math.min(n,s)))},Y2=(e,t,r,n,i,s,o,l)=>{if(!(s==null||l==null)){var c=o[0],d=c==null?void 0:l(c.positions,s);if(d!=null)return d;var u=i==null?void 0:i[Number(s)];if(u)switch(r){case"horizontal":return{x:u.coordinate,y:(n.top+t)/2};default:return{x:(n.left+e)/2,y:u.coordinate}}}},G2=(e,t,r,n)=>{if(t==="axis")return e.tooltipItemPayloads;if(e.tooltipItemPayloads.length===0)return[];var i;return r==="hover"?i=e.itemInteraction.hover.dataKey:i=e.itemInteraction.click.dataKey,i==null&&n!=null?[e.tooltipItemPayloads[0]]:e.tooltipItemPayloads.filter(s=>{var o;return((o=s.settings)===null||o===void 0?void 0:o.dataKey)===i})},uo=e=>e.options.tooltipPayloadSearcher,Ta=e=>e.tooltip;function Py(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function _y(e){for(var t=1;t{if(!(t==null||s==null)){var{chartData:l,computedData:c,dataStartIndex:d,dataEndIndex:u}=r,f=[];return e.reduce((p,m)=>{var x,{dataDefinedOnItem:g,settings:b}=m,v=zI(g,l),j=Array.isArray(v)?Cw(v,d,u):v,y=(x=b==null?void 0:b.dataKey)!==null&&x!==void 0?x:n,w=b==null?void 0:b.nameKey,S;if(n&&Array.isArray(j)&&!Array.isArray(j[0])&&o==="axis"?S=Cj(j,n,i):S=s(j,t,c,w),Array.isArray(S))S.forEach(P=>{var _=_y(_y({},b),{},{name:P.name,unit:P.unit,color:void 0,fill:void 0});p.push(c0({tooltipEntrySettings:_,dataKey:P.dataKey,payload:P.payload,value:et(P.payload,P.dataKey),name:P.name}))});else{var N;p.push(c0({tooltipEntrySettings:b,dataKey:y,payload:S,value:et(S,y),name:(N=et(S,w))!==null&&N!==void 0?N:b==null?void 0:b.name}))}return p},f)}},Hm=I([Ue,ue,o2,km,We],O2),RI=I([e=>e.graphicalItems.cartesianItems,e=>e.graphicalItems.polarItems],(e,t)=>[...e,...t]),BI=I([We,Oa],l2),fo=I([RI,Ue,BI],c2,{memoizeOptions:{resultEqualityCheck:_u}}),FI=I([fo],e=>e.filter(Dm)),WI=I([fo],f2,{memoizeOptions:{resultEqualityCheck:_u}}),Ma=I([WI,Kn],p2),UI=I([FI,Kn,Ue],i2),Km=I([Ma,Ue,fo],h2),X2=I([Ue],$m),qI=I([Ue],e=>e.allowDataOverflow),J2=I([X2,qI],LS),HI=I([fo],e=>e.filter(Dm)),KI=I([UI,HI,wu],x2),VI=I([KI,Kn,We,J2],y2),YI=I([fo],d2),GI=I([Ma,Ue,YI,Lm,We],j2,{memoizeOptions:{resultEqualityCheck:Pu}}),ZI=I([w2,We,Oa],Ea),XI=I([ZI,We],k2),JI=I([S2,We,Oa],Ea),QI=I([JI,We],P2),e$=I([N2,We,Oa],Ea),t$=I([e$,We],_2),r$=I([XI,t$,QI],fc),n$=I([Ue,X2,J2,VI,GI,r$,ue,We],C2),Q2=I([Ue,ue,Ma,Km,wu,We,n$],A2),i$=I([Q2,Ue,Hm],E2),a$=I([Ue,Q2,i$,We],D2),eN=e=>{var t=We(e),r=Oa(e),n=!1;return co(e,t,r,n)},tN=I([Ue,eN],Su),rN=I([Ue,Hm,a$,tN],Rm),s$=I([ue,Km,Ue,We],L2),o$=I([ue,Km,Ue,We],z2),l$=(e,t,r,n,i,s,o,l)=>{if(t){var{type:c}=t,d=Mr(e,l);if(n){var u=r==="scaleBand"&&n.bandwidth?n.bandwidth()/2:2,f=c==="category"&&n.bandwidth?n.bandwidth()/u:0;return f=l==="angleAxis"&&i!=null&&(i==null?void 0:i.length)>=2?Jt(i[0]-i[1])*2*f:f,d&&o?o.map((p,m)=>({coordinate:n(p)+f,value:p,index:m,offset:f})):n.domain().map((p,m)=>({coordinate:n(p)+f,value:s?s[p]:p,index:m,offset:f}))}}},pn=I([ue,Ue,Hm,rN,eN,s$,o$,We],l$),Vm=I([B2,F2,wI],(e,t,r)=>W2(r.shared,e,t)),nN=e=>e.tooltip.settings.trigger,Ym=e=>e.tooltip.settings.defaultIndex,Tu=I([Ta,Vm,nN,Ym],V2),Us=I([Tu,Ma],qm),iN=I([pn,Us],U2),c$=I([Tu],e=>{if(e)return e.dataKey}),aN=I([Ta,Vm,nN,Ym],G2),u$=I([ln,cn,ue,rt,pn,Ym,aN,uo],Y2),d$=I([Tu,u$],(e,t)=>e!=null&&e.coordinate?e.coordinate:t),f$=I([Tu],e=>e.active),p$=I([aN,Us,Kn,g2,iN,uo,Vm],Z2),h$=I([p$],e=>{if(e!=null){var t=e.map(r=>r.payload).filter(r=>r!=null);return Array.from(new Set(t))}});function Cy(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Ay(e){for(var t=1;tG(Ue),v$=()=>{var e=y$(),t=G(pn),r=G(rN);return ma(!e||!r?void 0:Ay(Ay({},e),{},{scale:r}),t)};function Oy(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Ti(e){for(var t=1;t{var i=t.find(s=>s&&s.index===r);if(i){if(e==="horizontal")return{x:i.coordinate,y:n.chartY};if(e==="vertical")return{x:n.chartX,y:i.coordinate}}return{x:0,y:0}},N$=(e,t,r,n)=>{var i=t.find(d=>d&&d.index===r);if(i){if(e==="centric"){var s=i.coordinate,{radius:o}=n;return Ti(Ti(Ti({},n),Je(n.cx,n.cy,o,s)),{},{angle:s,radius:o})}var l=i.coordinate,{angle:c}=n;return Ti(Ti(Ti({},n),Je(n.cx,n.cy,l,c)),{},{angle:c,radius:l})}return{angle:0,clockWise:!1,cx:0,cy:0,endAngle:0,innerRadius:0,outerRadius:0,radius:0,startAngle:0,x:0,y:0}};function k$(e,t){var{chartX:r,chartY:n}=e;return r>=t.left&&r<=t.left+t.width&&n>=t.top&&n<=t.top+t.height}var sN=(e,t,r,n,i)=>{var s,o=-1,l=(s=t==null?void 0:t.length)!==null&&s!==void 0?s:0;if(l<=1||e==null)return 0;if(n==="angleAxis"&&i!=null&&Math.abs(Math.abs(i[1]-i[0])-360)<=1e-6)for(var c=0;c0?r[c-1].coordinate:r[l-1].coordinate,u=r[c].coordinate,f=c>=l-1?r[0].coordinate:r[c+1].coordinate,p=void 0;if(Jt(u-d)!==Jt(f-u)){var m=[];if(Jt(f-u)===Jt(i[1]-i[0])){p=f;var x=u+i[1]-i[0];m[0]=Math.min(x,(x+d)/2),m[1]=Math.max(x,(x+d)/2)}else{p=d;var g=f+i[1]-i[0];m[0]=Math.min(u,(g+u)/2),m[1]=Math.max(u,(g+u)/2)}var b=[Math.min(u,(p+u)/2),Math.max(u,(p+u)/2)];if(e>b[0]&&e<=b[1]||e>=m[0]&&e<=m[1]){({index:o}=r[c]);break}}else{var v=Math.min(d,f),j=Math.max(d,f);if(e>(v+u)/2&&e<=(j+u)/2){({index:o}=r[c]);break}}}else if(t){for(var y=0;y0&&y(t[y].coordinate+t[y-1].coordinate)/2&&e<=(t[y].coordinate+t[y+1].coordinate)/2||y===l-1&&e>(t[y].coordinate+t[y-1].coordinate)/2){({index:o}=t[y]);break}}return o},oN=()=>G(km),Gm=(e,t)=>t,lN=(e,t,r)=>r,Zm=(e,t,r,n)=>n,P$=I(pn,e=>Qc(e,t=>t.coordinate)),Xm=I([Ta,Gm,lN,Zm],V2),cN=I([Xm,Ma],qm),_$=(e,t,r)=>{if(t!=null){var n=Ta(e);return t==="axis"?r==="hover"?n.axisInteraction.hover.dataKey:n.axisInteraction.click.dataKey:r==="hover"?n.itemInteraction.hover.dataKey:n.itemInteraction.click.dataKey}},uN=I([Ta,Gm,lN,Zm],G2),pc=I([ln,cn,ue,rt,pn,Zm,uN,uo],Y2),C$=I([Xm,pc],(e,t)=>{var r;return(r=e.coordinate)!==null&&r!==void 0?r:t}),dN=I([pn,cN],U2),A$=I([uN,cN,Kn,g2,dN,uo,Gm],Z2),O$=I([Xm],e=>({isActive:e.active,activeIndex:e.index})),E$=(e,t,r,n,i,s,o)=>{if(!(!e||!r||!n||!i)&&k$(e,o)){var l=OE(e,t),c=sN(l,s,i,r,n),d=S$(t,i,c,e);return{activeIndex:String(c),activeCoordinate:d}}},D$=(e,t,r,n,i,s,o)=>{if(!(!e||!n||!i||!s||!r)){var l=jD(e,r);if(l){var c=EE(l,t),d=sN(c,o,s,n,i),u=N$(t,s,d,l);return{activeIndex:String(d),activeCoordinate:u}}}},T$=(e,t,r,n,i,s,o,l)=>{if(!(!e||!t||!n||!i||!s))return t==="horizontal"||t==="vertical"?E$(e,t,n,i,s,o,l):D$(e,t,r,n,i,s,o)},M$=I(e=>e.zIndex.zIndexMap,(e,t)=>t,(e,t,r)=>r,(e,t,r)=>{if(t!=null){var n=e[t];if(n!=null)return r?n.panoramaElementId:n.elementId}}),I$=I(e=>e.zIndex.zIndexMap,e=>{var t=Object.keys(e).map(n=>parseInt(n,10)).concat(Object.values(lt)),r=Array.from(new Set(t));return r.sort((n,i)=>n-i)},{memoizeOptions:{resultEqualityCheck:jM}});function Ey(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Dy(e){for(var t=1;tDy(Dy({},e),{},{[t]:{elementId:void 0,panoramaElementId:void 0,consumers:0}}),R$)},F$=new Set(Object.values(lt));function W$(e){return F$.has(e)}var fN=At({name:"zIndex",initialState:B$,reducers:{registerZIndexPortal:{reducer:(e,t)=>{var{zIndex:r}=t.payload;e.zIndexMap[r]?e.zIndexMap[r].consumers+=1:e.zIndexMap[r]={consumers:1,elementId:void 0,panoramaElementId:void 0}},prepare:Le()},unregisterZIndexPortal:{reducer:(e,t)=>{var{zIndex:r}=t.payload;e.zIndexMap[r]&&(e.zIndexMap[r].consumers-=1,e.zIndexMap[r].consumers<=0&&!W$(r)&&delete e.zIndexMap[r])},prepare:Le()},registerZIndexPortalId:{reducer:(e,t)=>{var{zIndex:r,elementId:n,isPanorama:i}=t.payload;e.zIndexMap[r]?i?e.zIndexMap[r].panoramaElementId=n:e.zIndexMap[r].elementId=n:e.zIndexMap[r]={consumers:0,elementId:i?void 0:n,panoramaElementId:i?n:void 0}},prepare:Le()},unregisterZIndexPortalId:{reducer:(e,t)=>{var{zIndex:r}=t.payload;e.zIndexMap[r]&&(t.payload.isPanorama?e.zIndexMap[r].panoramaElementId=void 0:e.zIndexMap[r].elementId=void 0)},prepare:Le()}}}),{registerZIndexPortal:U$,unregisterZIndexPortal:q$,registerZIndexPortalId:H$,unregisterZIndexPortalId:K$}=fN.actions,V$=fN.reducer;function Ir(e){var{zIndex:t,children:r}=e,n=a3(),i=n&&t!==void 0&&t!==0,s=pt(),o=Ve();h.useLayoutEffect(()=>i?(o(U$({zIndex:t})),()=>{o(q$({zIndex:t}))}):Pa,[o,t,i]);var l=G(d=>M$(d,t,s));if(!i)return r;if(!l)return null;var c=document.getElementById(l);return c?bh.createPortal(r,c):null}function fp(){return fp=Object.assign?Object.assign.bind():function(e){for(var t=1;th.useContext(pN),hN={exports:{}};(function(e){var t=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function i(c,d,u){this.fn=c,this.context=d,this.once=u||!1}function s(c,d,u,f,p){if(typeof u!="function")throw new TypeError("The listener must be a function");var m=new i(u,f||c,p),x=r?r+d:d;return c._events[x]?c._events[x].fn?c._events[x]=[c._events[x],m]:c._events[x].push(m):(c._events[x]=m,c._eventsCount++),c}function o(c,d){--c._eventsCount===0?c._events=new n:delete c._events[d]}function l(){this._events=new n,this._eventsCount=0}l.prototype.eventNames=function(){var d=[],u,f;if(this._eventsCount===0)return d;for(f in u=this._events)t.call(u,f)&&d.push(r?f.slice(1):f);return Object.getOwnPropertySymbols?d.concat(Object.getOwnPropertySymbols(u)):d},l.prototype.listeners=function(d){var u=r?r+d:d,f=this._events[u];if(!f)return[];if(f.fn)return[f.fn];for(var p=0,m=f.length,x=new Array(m);p{e.eventEmitter==null&&(e.eventEmitter=Symbol("rechartsEventEmitter"))}}}),iL=gN.reducer,{createEventEmitter:aL}=gN.actions;function sL(e){return e.tooltip.syncInteraction}var oL={chartData:void 0,computedData:void 0,dataStartIndex:0,dataEndIndex:0},xN=At({name:"chartData",initialState:oL,reducers:{setChartData(e,t){if(e.chartData=t.payload,t.payload==null){e.dataStartIndex=0,e.dataEndIndex=0;return}t.payload.length>0&&e.dataEndIndex!==t.payload.length-1&&(e.dataEndIndex=t.payload.length-1)},setComputedData(e,t){e.computedData=t.payload},setDataStartEndIndexes(e,t){var{startIndex:r,endIndex:n}=t.payload;r!=null&&(e.dataStartIndex=r),n!=null&&(e.dataEndIndex=n)}}}),{setChartData:Iy,setDataStartEndIndexes:lL,setComputedData:AF}=xN.actions,cL=xN.reducer,uL=["x","y"];function $y(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Mi(e){for(var t=1;tc.rootProps.className);h.useEffect(()=>{if(e==null)return Pa;var c=(d,u,f)=>{if(t!==f&&e===d){if(n==="index"){var p;if(o&&u!==null&&u!==void 0&&(p=u.payload)!==null&&p!==void 0&&p.coordinate&&u.payload.sourceViewBox){var m=u.payload.coordinate,{x,y:g}=m,b=hL(m,uL),{x:v,y:j,width:y,height:w}=u.payload.sourceViewBox,S=Mi(Mi({},b),{},{x:o.x+(y?(x-v)/y:0)*o.width,y:o.y+(w?(g-j)/w:0)*o.height});r(Mi(Mi({},u),{},{payload:Mi(Mi({},u.payload),{},{coordinate:S})}))}else r(u);return}if(i!=null){var N;if(typeof n=="function"){var P={activeTooltipIndex:u.payload.index==null?void 0:Number(u.payload.index),isTooltipActive:u.payload.active,activeIndex:u.payload.index==null?void 0:Number(u.payload.index),activeLabel:u.payload.label,activeDataKey:u.payload.dataKey,activeCoordinate:u.payload.coordinate},_=n(i,P);N=i[_]}else n==="value"&&(N=i.find(E=>String(E.value)===u.payload.label));var{coordinate:T}=u.payload;if(N==null||u.payload.active===!1||T==null||o==null){r(up({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0}));return}var{x:$,y:M}=T,C=Math.min($,o.x+o.width),R=Math.min(M,o.y+o.height),q={x:s==="horizontal"?N.coordinate:C,y:s==="horizontal"?R:N.coordinate},Z=up({active:u.payload.active,coordinate:q,dataKey:u.payload.dataKey,index:String(N.index),label:u.payload.label,sourceViewBox:u.payload.sourceViewBox});r(Z)}}};return qs.on(pp,c),()=>{qs.off(pp,c)}},[l,r,t,e,n,i,s,o])}function xL(){var e=G(Pm),t=G(_m),r=Ve();h.useEffect(()=>{if(e==null)return Pa;var n=(i,s,o)=>{t!==o&&e===i&&r(lL(s))};return qs.on(My,n),()=>{qs.off(My,n)}},[r,t,e])}function yL(){var e=Ve();h.useEffect(()=>{e(aL())},[e]),gL(),xL()}function vL(e,t,r,n,i,s){var o=G(m=>_$(m,e,t)),l=G(_m),c=G(Pm),d=G(JS),u=G(sL),f=u==null?void 0:u.active,p=uu();h.useEffect(()=>{if(!f&&c!=null&&l!=null){var m=up({active:s,coordinate:r,dataKey:o,index:i,label:typeof n=="number"?String(n):n,sourceViewBox:p});qs.emit(pp,c,m,l)}},[f,r,o,i,n,l,c,d,s,p])}function Ly(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function zy(e){for(var t=1;t{P(PI({shared:j,trigger:y,axisId:N,active:i,defaultIndex:_}))},[P,j,y,N,i,_]);var T=uu(),$=qw(),M=jI(j),{activeIndex:C,isActive:R}=(t=G(J=>O$(J,M,y,_)))!==null&&t!==void 0?t:{},q=G(J=>A$(J,M,y,_)),Z=G(J=>dN(J,M,y,_)),E=G(J=>C$(J,M,y,_)),D=q,O=eL(),k=(r=i??R)!==null&&r!==void 0?r:!1,[L,F]=b4([D,k]),H=M==="axis"?Z:void 0;vL(M,y,E,H,C,k);var te=S??O;if(te==null||T==null||M==null)return null;var re=D??Ry;k||(re=Ry),d&&re.length&&(re=n4(re.filter(J=>J.value!=null&&(J.hide!==!0||n.includeHidden)),p,SL));var we=re.length>0,A=h.createElement(j3,{allowEscapeViewBox:s,animationDuration:o,animationEasing:l,isAnimationActive:u,active:k,coordinate:E,hasPayload:we,offset:f,position:m,reverseDirection:x,useTranslate3d:g,viewBox:T,wrapperStyle:b,lastBoundingBox:L,innerRef:F,hasPortalFromProps:!!S},NL(c,zy(zy({},n),{},{payload:re,label:H,active:k,activeIndex:C,coordinate:E,accessibilityLayer:$})));return h.createElement(h.Fragment,null,bh.createPortal(A,te),k&&h.createElement(Q$,{cursor:v,tooltipEventType:M,coordinate:E,payload:re,index:C}))}function PL(e,t,r){return(t=_L(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _L(e){var t=CL(e,"string");return typeof t=="symbol"?t:t+""}function CL(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}class AL{constructor(t){PL(this,"cache",new Map),this.maxSize=t}get(t){var r=this.cache.get(t);return r!==void 0&&(this.cache.delete(t),this.cache.set(t,r)),r}set(t,r){if(this.cache.has(t))this.cache.delete(t);else if(this.cache.size>=this.maxSize){var n=this.cache.keys().next().value;this.cache.delete(n)}this.cache.set(t,r)}clear(){this.cache.clear()}size(){return this.cache.size}}function Fy(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function OL(e){for(var t=1;t{try{var r=document.getElementById(Uy);r||(r=document.createElement("span"),r.setAttribute("id",Uy),r.setAttribute("aria-hidden","true"),document.body.appendChild(r)),Object.assign(r.style,IL,t),r.textContent="".concat(e);var n=r.getBoundingClientRect();return{width:n.width,height:n.height}}catch{return{width:0,height:0}}},fs=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(t==null||Ci.isSsr)return{width:0,height:0};if(!yN.enableCache)return qy(t,r);var n=$L(t,r),i=Wy.get(n);if(i)return i;var s=qy(t,r);return Wy.set(n,s),s},Hy=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,Ky=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,LL=/^px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q$/,zL=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,vN={cm:96/2.54,mm:96/25.4,pt:96/72,pc:96/6,in:96,Q:96/(2.54*40),px:1},RL=Object.keys(vN),Gi="NaN";function BL(e,t){return e*vN[t]}class jt{static parse(t){var r,[,n,i]=(r=zL.exec(t))!==null&&r!==void 0?r:[];return new jt(parseFloat(n),i??"")}constructor(t,r){this.num=t,this.unit=r,this.num=t,this.unit=r,yr(t)&&(this.unit=""),r!==""&&!LL.test(r)&&(this.num=NaN,this.unit=""),RL.includes(r)&&(this.num=BL(t,r),this.unit="px")}add(t){return this.unit!==t.unit?new jt(NaN,""):new jt(this.num+t.num,this.unit)}subtract(t){return this.unit!==t.unit?new jt(NaN,""):new jt(this.num-t.num,this.unit)}multiply(t){return this.unit!==""&&t.unit!==""&&this.unit!==t.unit?new jt(NaN,""):new jt(this.num*t.num,this.unit||t.unit)}divide(t){return this.unit!==""&&t.unit!==""&&this.unit!==t.unit?new jt(NaN,""):new jt(this.num/t.num,this.unit||t.unit)}toString(){return"".concat(this.num).concat(this.unit)}isNaN(){return yr(this.num)}}function bN(e){if(e.includes(Gi))return Gi;for(var t=e;t.includes("*")||t.includes("/");){var r,[,n,i,s]=(r=Hy.exec(t))!==null&&r!==void 0?r:[],o=jt.parse(n??""),l=jt.parse(s??""),c=i==="*"?o.multiply(l):o.divide(l);if(c.isNaN())return Gi;t=t.replace(Hy,c.toString())}for(;t.includes("+")||/.-\d+(?:\.\d+)?/.test(t);){var d,[,u,f,p]=(d=Ky.exec(t))!==null&&d!==void 0?d:[],m=jt.parse(u??""),x=jt.parse(p??""),g=f==="+"?m.add(x):m.subtract(x);if(g.isNaN())return Gi;t=t.replace(Ky,g.toString())}return t}var Vy=/\(([^()]*)\)/;function FL(e){for(var t=e,r;(r=Vy.exec(t))!=null;){var[,n]=r;t=t.replace(Vy,bN(n))}return t}function WL(e){var t=e.replace(/\s+/g,"");return t=FL(t),t=bN(t),t}function UL(e){try{return WL(e)}catch{return Gi}}function Nd(e){var t=UL(e.slice(5,-1));return t===Gi?"":t}var qL=["x","y","lineHeight","capHeight","fill","scaleToFit","textAnchor","verticalAnchor"],HL=["dx","dy","angle","className","breakAll"];function hp(){return hp=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{children:t,breakAll:r,style:n}=e;try{var i=[];Re(t)||(r?i=t.toString().split(""):i=t.toString().split(jN));var s=i.map(l=>({word:l,width:fs(l,n).width})),o=r?0:fs(" ",n).width;return{wordsWithComputedWidth:s,spaceWidth:o}}catch{return null}};function VL(e){return e==="start"||e==="middle"||e==="end"||e==="inherit"}var SN=(e,t,r,n)=>e.reduce((i,s)=>{var{word:o,width:l}=s,c=i[i.length-1];if(c&&l!=null&&(t==null||n||c.width+l+re.reduce((t,r)=>t.width>r.width?t:r),YL="…",Gy=(e,t,r,n,i,s,o,l)=>{var c=e.slice(0,t),d=wN({breakAll:r,style:n,children:c+YL});if(!d)return[!1,[]];var u=SN(d.wordsWithComputedWidth,s,o,l),f=u.length>i||NN(u).width>Number(s);return[f,u]},GL=(e,t,r,n,i)=>{var{maxLines:s,children:o,style:l,breakAll:c}=e,d=Y(s),u=String(o),f=SN(t,n,r,i);if(!d||i)return f;var p=f.length>s||NN(f).width>Number(n);if(!p)return f;for(var m=0,x=u.length-1,g=0,b;m<=x&&g<=u.length-1;){var v=Math.floor((m+x)/2),j=v-1,[y,w]=Gy(u,j,c,l,s,n,r,i),[S]=Gy(u,v,c,l,s,n,r,i);if(!y&&!S&&(m=v+1),y&&S&&(x=v-1),!y&&S){b=w;break}g++}return b||f},Zy=e=>{var t=Re(e)?[]:e.toString().split(jN);return[{words:t,width:void 0}]},ZL=e=>{var{width:t,scaleToFit:r,children:n,style:i,breakAll:s,maxLines:o}=e;if((t||r)&&!Ci.isSsr){var l,c,d=wN({breakAll:s,children:n,style:i});if(d){var{wordsWithComputedWidth:u,spaceWidth:f}=d;l=u,c=f}else return Zy(n);return GL({breakAll:s,children:n,maxLines:o,style:i},l,c,t,!!r)}return Zy(n)},kN="#808080",XL={breakAll:!1,capHeight:"0.71em",fill:kN,lineHeight:"1em",scaleToFit:!1,textAnchor:"start",verticalAnchor:"end",x:0,y:0},Jm=h.forwardRef((e,t)=>{var r=ft(e,XL),{x:n,y:i,lineHeight:s,capHeight:o,fill:l,scaleToFit:c,textAnchor:d,verticalAnchor:u}=r,f=Yy(r,qL),p=h.useMemo(()=>ZL({breakAll:f.breakAll,children:f.children,maxLines:f.maxLines,scaleToFit:c,style:f.style,width:f.width}),[f.breakAll,f.children,f.maxLines,c,f.style,f.width]),{dx:m,dy:x,angle:g,className:b,breakAll:v}=f,j=Yy(f,HL);if(!Or(n)||!Or(i)||p.length===0)return null;var y=Number(n)+(Y(m)?m:0),w=Number(i)+(Y(x)?x:0);if(!_e(y)||!_e(w))return null;var S;switch(u){case"start":S=Nd("calc(".concat(o,")"));break;case"middle":S=Nd("calc(".concat((p.length-1)/2," * -").concat(s," + (").concat(o," / 2))"));break;default:S=Nd("calc(".concat(p.length-1," * -").concat(s,")"));break}var N=[];if(c){var P=p[0].width,{width:_}=f;N.push("scale(".concat(Y(_)&&Y(P)?_/P:1,")"))}return g&&N.push("rotate(".concat(g,", ").concat(y,", ").concat(w,")")),N.length&&(j.transform=N.join(" ")),h.createElement("text",hp({},ut(j),{ref:t,x:y,y:w,className:ce("recharts-text",b),textAnchor:d,fill:l.includes("url")?kN:l}),p.map((T,$)=>{var M=T.words.join(v?"":" ");return h.createElement("tspan",{x:y,dy:$===0?S:s,key:"".concat(M,"-").concat($)},M)}))});Jm.displayName="Text";var JL=["labelRef"];function QL(e,t){if(e==null)return{};var r,n,i=e8(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n{var{x:t,y:r,upperWidth:n,lowerWidth:i,width:s,height:o,children:l}=e,c=h.useMemo(()=>({x:t,y:r,upperWidth:n,lowerWidth:i,width:s,height:o}),[t,r,n,i,s,o]);return h.createElement(PN.Provider,{value:c},l)},_N=()=>{var e=h.useContext(PN),t=uu();return e||Rw(t)},a8=h.createContext(null),s8=()=>{var e=h.useContext(a8),t=G(n2);return e||t},o8=e=>{var{value:t,formatter:r}=e,n=Re(e.children)?t:e.children;return typeof r=="function"?r(n):n},Qm=e=>e!=null&&typeof e=="function",l8=(e,t)=>{var r=Jt(t-e),n=Math.min(Math.abs(t-e),360);return r*n},c8=(e,t,r,n,i)=>{var{offset:s,className:o}=e,{cx:l,cy:c,innerRadius:d,outerRadius:u,startAngle:f,endAngle:p,clockWise:m}=i,x=(d+u)/2,g=l8(f,p),b=g>=0?1:-1,v,j;switch(t){case"insideStart":v=f+b*s,j=m;break;case"insideEnd":v=p-b*s,j=!m;break;case"end":v=p+b*s,j=m;break;default:throw new Error("Unsupported position ".concat(t))}j=g<=0?j:!j;var y=Je(l,c,x,v),w=Je(l,c,x,v+(j?1:-1)*359),S="M".concat(y.x,",").concat(y.y,` A`).concat(x,",").concat(x,",0,1,").concat(j?0:1,`, - `).concat(w.x,",").concat(w.y),N=Re(e.id)?Ts("recharts-radial-line-"):e.id;return h.createElement("text",Rr({},n,{dominantBaseline:"central",className:ce("recharts-radial-bar-label",o)}),h.createElement("defs",null,h.createElement("path",{id:N,d:S})),h.createElement("textPath",{xlinkHref:"#".concat(N)},r))},f8=(e,t,r)=>{var{cx:n,cy:i,innerRadius:s,outerRadius:o,startAngle:l,endAngle:c}=e,d=(l+c)/2;if(r==="outside"){var{x:u,y:f}=Je(n,i,o+t,d);return{x:u,y:f,textAnchor:u>=n?"start":"end",verticalAnchor:"middle"}}if(r==="center")return{x:n,y:i,textAnchor:"middle",verticalAnchor:"middle"};if(r==="centerTop")return{x:n,y:i,textAnchor:"middle",verticalAnchor:"start"};if(r==="centerBottom")return{x:n,y:i,textAnchor:"middle",verticalAnchor:"end"};var p=(s+o)/2,{x:m,y:x}=Je(n,i,p,d);return{x:m,y:x,textAnchor:"middle",verticalAnchor:"middle"}},mp=e=>"cx"in e&&Y(e.cx),p8=(e,t)=>{var{parentViewBox:r,offset:n,position:i}=e,s;r!=null&&!mp(r)&&(s=r);var{x:o,y:l,upperWidth:c,lowerWidth:d,height:u}=t,f=o,p=o+(c-d)/2,m=(f+p)/2,x=(c+d)/2,g=f+c/2,b=u>=0?1:-1,v=b*n,j=b>0?"end":"start",y=b>0?"start":"end",w=c>=0?1:-1,S=w*n,N=w>0?"end":"start",P=w>0?"start":"end";if(i==="top"){var _={x:f+c/2,y:l-v,textAnchor:"middle",verticalAnchor:j};return Ce(Ce({},_),s?{height:Math.max(l-s.y,0),width:c}:{})}if(i==="bottom"){var T={x:p+d/2,y:l+u+v,textAnchor:"middle",verticalAnchor:y};return Ce(Ce({},T),s?{height:Math.max(s.y+s.height-(l+u),0),width:d}:{})}if(i==="left"){var $={x:m-S,y:l+u/2,textAnchor:N,verticalAnchor:"middle"};return Ce(Ce({},$),s?{width:Math.max($.x-s.x,0),height:u}:{})}if(i==="right"){var M={x:m+x+S,y:l+u/2,textAnchor:P,verticalAnchor:"middle"};return Ce(Ce({},M),s?{width:Math.max(s.x+s.width-M.x,0),height:u}:{})}var C=s?{width:x,height:u}:{};return i==="insideLeft"?Ce({x:m+S,y:l+u/2,textAnchor:P,verticalAnchor:"middle"},C):i==="insideRight"?Ce({x:m+x-S,y:l+u/2,textAnchor:N,verticalAnchor:"middle"},C):i==="insideTop"?Ce({x:f+c/2,y:l+v,textAnchor:"middle",verticalAnchor:y},C):i==="insideBottom"?Ce({x:p+d/2,y:l+u-v,textAnchor:"middle",verticalAnchor:j},C):i==="insideTopLeft"?Ce({x:f+S,y:l+v,textAnchor:P,verticalAnchor:y},C):i==="insideTopRight"?Ce({x:f+c-S,y:l+v,textAnchor:N,verticalAnchor:y},C):i==="insideBottomLeft"?Ce({x:p+S,y:l+u-v,textAnchor:P,verticalAnchor:j},C):i==="insideBottomRight"?Ce({x:p+d-S,y:l+u-v,textAnchor:N,verticalAnchor:j},C):i&&typeof i=="object"&&(Y(i.x)||Qr(i.x))&&(Y(i.y)||Qr(i.y))?Ce({x:o+Rn(i.x,x),y:l+Rn(i.y,u),textAnchor:"end",verticalAnchor:"end"},C):Ce({x:g,y:l+u/2,textAnchor:"middle",verticalAnchor:"middle"},C)},h8={offset:5,zIndex:lt.label};function yn(e){var t=ft(e,h8),{viewBox:r,position:n,value:i,children:s,content:o,className:l="",textBreakAll:c,labelRef:d}=t,u=l8(),f=_N(),p=n==="center"?f:u??f,m,x,g;if(r==null?m=p:mp(r)?m=r:m=Rw(r),!m||Re(i)&&Re(s)&&!h.isValidElement(o)&&typeof o!="function")return null;var b=Ce(Ce({},t),{},{viewBox:m});if(h.isValidElement(o)){var{labelRef:v}=b,j=t8(b,e8);return h.cloneElement(o,j)}if(typeof o=="function"){if(x=h.createElement(o,b),h.isValidElement(x))return x}else x=c8(t);var y=ut(t);if(mp(m)){if(n==="insideStart"||n==="insideEnd"||n==="end")return d8(t,n,x,y,m);g=f8(m,t.offset,t.position)}else g=p8(t,m);return h.createElement(Ir,{zIndex:t.zIndex},h.createElement(Jm,Rr({ref:d,className:ce("recharts-label",l)},y,g,{textAnchor:GL(y.textAnchor)?y.textAnchor:g.textAnchor,breakAll:c}),x))}yn.displayName="Label";var m8=(e,t,r)=>{if(!e)return null;var n={viewBox:t,labelRef:r};return e===!0?h.createElement(yn,Rr({key:"label-implicit"},n)):Or(e)?h.createElement(yn,Rr({key:"label-implicit",value:e},n)):h.isValidElement(e)?e.type===yn?h.cloneElement(e,Ce({key:"label-implicit"},n)):h.createElement(yn,Rr({key:"label-implicit",content:e},n)):Qm(e)?h.createElement(yn,Rr({key:"label-implicit",content:e},n)):e&&typeof e=="object"?h.createElement(yn,Rr({},e,{key:"label-implicit"},n)):null};function g8(e){var{label:t,labelRef:r}=e,n=_N();return m8(t,n,r)||null}var CN={},AN={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return r[r.length-1]}e.last=t})(AN);var ON={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return Array.isArray(r)?r:Array.from(r)}e.toArray=t})(ON);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=AN,r=ON,n=Jc;function i(s){if(n.isArrayLike(s))return t.last(r.toArray(s))}e.last=i})(CN);var x8=CN.last;const y8=Tr(x8);var v8=["valueAccessor"],b8=["dataKey","clockWise","id","textBreakAll","zIndex"];function hc(){return hc=Object.assign?Object.assign.bind():function(e){for(var t=1;tArray.isArray(e.value)?y8(e.value):e.value,EN=h.createContext(void 0),DN=EN.Provider,TN=h.createContext(void 0);TN.Provider;function S8(){return h.useContext(EN)}function N8(){return h.useContext(TN)}function cl(e){var{valueAccessor:t=w8}=e,r=Jy(e,v8),{dataKey:n,clockWise:i,id:s,textBreakAll:o,zIndex:l}=r,c=Jy(r,b8),d=S8(),u=N8(),f=d||u;return!f||!f.length?null:h.createElement(Ir,{zIndex:l??lt.label},h.createElement(ir,{className:"recharts-label-list"},f.map((p,m)=>{var x,g=Re(n)?t(p,m):et(p&&p.payload,n),b=Re(s)?{}:{id:"".concat(s,"-").concat(m)};return h.createElement(yn,hc({key:"label-".concat(m)},ut(p),c,b,{fill:(x=r.fill)!==null&&x!==void 0?x:p.fill,parentViewBox:p.parentViewBox,value:g,textBreakAll:o,viewBox:p.viewBox,index:m,zIndex:0}))})))}cl.displayName="LabelList";function MN(e){var{label:t}=e;return t?t===!0?h.createElement(cl,{key:"labelList-implicit"}):h.isValidElement(t)||Qm(t)?h.createElement(cl,{key:"labelList-implicit",content:t}):typeof t=="object"?h.createElement(cl,hc({key:"labelList-implicit"},t,{type:String(t.type)})):null:null}function gp(){return gp=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{cx:t,cy:r,r:n,className:i}=e,s=ce("recharts-dot",i);return Y(t)&&Y(r)&&Y(n)?h.createElement("circle",gp({},nr(e),Ih(e),{className:s,cx:t,cy:r,r:n})):null},k8={radiusAxis:{},angleAxis:{}},$N=At({name:"polarAxis",initialState:k8,reducers:{addRadiusAxis(e,t){e.radiusAxis[t.payload.id]=t.payload},removeRadiusAxis(e,t){delete e.radiusAxis[t.payload.id]},addAngleAxis(e,t){e.angleAxis[t.payload.id]=t.payload},removeAngleAxis(e,t){delete e.angleAxis[t.payload.id]}}}),{addRadiusAxis:D7,removeRadiusAxis:T7,addAngleAxis:M7,removeAngleAxis:I7}=$N.actions,P8=$N.reducer,eg=e=>e&&typeof e=="object"&&"clipDot"in e?!!e.clipDot:!0,LN={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){var i;if(typeof r!="object"||r==null)return!1;if(Object.getPrototypeOf(r)===null)return!0;if(Object.prototype.toString.call(r)!=="[object Object]"){const s=r[Symbol.toStringTag];return s==null||!((i=Object.getOwnPropertyDescriptor(r,Symbol.toStringTag))!=null&&i.writable)?!1:r.toString()===`[object ${s}]`}let n=r;for(;Object.getPrototypeOf(n)!==null;)n=Object.getPrototypeOf(n);return Object.getPrototypeOf(r)===n}e.isPlainObject=t})(LN);var _8=LN.isPlainObject;const C8=Tr(_8);function Qy(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function ev(e){for(var t=1;t{var s=r-n,o;return o="M ".concat(e,",").concat(t),o+="L ".concat(e+r,",").concat(t),o+="L ".concat(e+r-s/2,",").concat(t+i),o+="L ".concat(e+r-s/2-n,",").concat(t+i),o+="L ".concat(e,",").concat(t," Z"),o},D8={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},T8=e=>{var t=ft(e,D8),{x:r,y:n,upperWidth:i,lowerWidth:s,height:o,className:l}=t,{animationEasing:c,animationDuration:d,animationBegin:u,isUpdateAnimationActive:f}=t,p=h.useRef(null),[m,x]=h.useState(-1),g=h.useRef(i),b=h.useRef(s),v=h.useRef(o),j=h.useRef(r),y=h.useRef(n),w=pu(e,"trapezoid-");if(h.useEffect(()=>{if(p.current&&p.current.getTotalLength)try{var q=p.current.getTotalLength();q&&x(q)}catch{}},[]),r!==+r||n!==+n||i!==+i||s!==+s||o!==+o||i===0&&s===0||o===0)return null;var S=ce("recharts-trapezoid",l);if(!f)return h.createElement("g",null,h.createElement("path",mc({},ut(t),{className:S,d:tv(r,n,i,s,o)})));var N=g.current,P=b.current,_=v.current,T=j.current,$=y.current,M="0px ".concat(m===-1?1:m,"px"),C="".concat(m,"px 0px"),R=Hw(["strokeDasharray"],d,c);return h.createElement(fu,{animationId:w,key:w,canBegin:m>0,duration:d,easing:c,isActive:f,begin:u},q=>{var Z=De(N,i,q),E=De(P,s,q),D=De(_,o,q),O=De(T,r,q),k=De($,n,q);p.current&&(g.current=Z,b.current=E,v.current=D,j.current=O,y.current=k);var L=q>0?{transition:R,strokeDasharray:C}:{strokeDasharray:M};return h.createElement("path",mc({},ut(t),{className:S,d:tv(O,k,Z,E,D),ref:p,style:ev(ev({},L),t.style)}))})},M8=["option","shapeType","propTransformer","activeClassName","isActive"];function I8(e,t){if(e==null)return{};var r,n,i=$8(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n{if(!i){var s=t(r);return n(PI(s)),()=>{n(_I(s))}}},[t,r,n,i]),null}function RN(e){var{legendPayload:t}=e,r=Ve(),n=pt();return h.useLayoutEffect(()=>n?ka:(r(c3(t)),()=>{r(u3(t))}),[r,n,t]),null}var kd,q8=()=>{var[e]=h.useState(()=>Ts("uid-"));return e},H8=(kd=Tv.useId)!==null&&kd!==void 0?kd:q8;function BN(e,t){var r=H8();return t||(e?"".concat(e,"-").concat(r):r)}var K8=h.createContext(void 0),FN=e=>{var{id:t,type:r,children:n}=e,i=BN("recharts-".concat(r),t);return h.createElement(K8.Provider,{value:i},n(i))},V8={cartesianItems:[],polarItems:[]},WN=At({name:"graphicalItems",initialState:V8,reducers:{addCartesianGraphicalItem:{reducer(e,t){e.cartesianItems.push(t.payload)},prepare:Le()},replaceCartesianGraphicalItem:{reducer(e,t){var{prev:r,next:n}=t.payload,i=Kr(e).cartesianItems.indexOf(r);i>-1&&(e.cartesianItems[i]=n)},prepare:Le()},removeCartesianGraphicalItem:{reducer(e,t){var r=Kr(e).cartesianItems.indexOf(t.payload);r>-1&&e.cartesianItems.splice(r,1)},prepare:Le()},addPolarGraphicalItem:{reducer(e,t){e.polarItems.push(t.payload)},prepare:Le()},removePolarGraphicalItem:{reducer(e,t){var r=Kr(e).polarItems.indexOf(t.payload);r>-1&&e.polarItems.splice(r,1)},prepare:Le()}}}),{addCartesianGraphicalItem:Y8,replaceCartesianGraphicalItem:G8,removeCartesianGraphicalItem:Z8,addPolarGraphicalItem:$7,removePolarGraphicalItem:L7}=WN.actions,X8=WN.reducer;function UN(e){var t=Ve(),r=h.useRef(null);return h.useLayoutEffect(()=>{r.current===null?t(Y8(e)):r.current!==e&&t(G8({prev:r.current,next:e})),r.current=e},[t,e]),h.useLayoutEffect(()=>()=>{r.current&&(t(Z8(r.current)),r.current=null)},[t]),null}var J8=["points"];function iv(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Pd(e){for(var t=1;t{var b,v,j=Pd(Pd(Pd({r:3},o),f),{},{index:g,cx:(b=x.x)!==null&&b!==void 0?b:void 0,cy:(v=x.y)!==null&&v!==void 0?v:void 0,dataKey:s,value:x.value,payload:x.payload,points:t});return h.createElement(iz,{key:"dot-".concat(g),option:r,dotProps:j,className:i})}),m={};return l&&c!=null&&(m.clipPath="url(#clipPath-".concat(u?"":"dots-").concat(c,")")),h.createElement(Ir,{zIndex:d},h.createElement(ir,xc({className:n},m),p))}function av(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function sv(e){for(var t=1;t({top:e.top,bottom:e.bottom,left:e.left,right:e.right})),xz=I([gz,ln,cn],(e,t,r)=>{if(!(!e||t==null||r==null))return{x:e.left,y:e.top,width:Math.max(0,t-e.left-e.right),height:Math.max(0,r-e.top-e.bottom)}}),Mu=()=>G(xz),yz=()=>G(g$);function ov(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function _d(e){for(var t=1;t{var{point:t,childIndex:r,mainColor:n,activeDot:i,dataKey:s}=e;if(i===!1||t.x==null||t.y==null)return null;var o={index:r,dataKey:s,cx:t.x,cy:t.y,r:4,fill:n??"none",strokeWidth:2,stroke:"#fff",payload:t.payload,value:t.value},l=_d(_d(_d({},o),qc(i)),Ih(i)),c;return h.isValidElement(i)?c=h.cloneElement(i,l):typeof i=="function"?c=i(l):c=h.createElement(IN,l),h.createElement(ir,{className:"recharts-active-dot"},c)};function xp(e){var{points:t,mainColor:r,activeDot:n,itemDataKey:i,zIndex:s=lt.activeDot}=e,o=G(Us),l=yz();if(t==null||l==null)return null;var c=t.find(d=>l.includes(d.payload));return Re(c)?null:h.createElement(Ir,{zIndex:s},h.createElement(wz,{point:c,childIndex:Number(o),mainColor:r,dataKey:i,activeDot:n}))}var Sz={},KN=At({name:"errorBars",initialState:Sz,reducers:{addErrorBar:(e,t)=>{var{itemId:r,errorBar:n}=t.payload;e[r]||(e[r]=[]),e[r].push(n)},replaceErrorBar:(e,t)=>{var{itemId:r,prev:n,next:i}=t.payload;e[r]&&(e[r]=e[r].map(s=>s.dataKey===n.dataKey&&s.direction===n.direction?i:s))},removeErrorBar:(e,t)=>{var{itemId:r,errorBar:n}=t.payload;e[r]&&(e[r]=e[r].filter(i=>i.dataKey!==n.dataKey||i.direction!==n.direction))}}}),{addErrorBar:B7,replaceErrorBar:F7,removeErrorBar:W7}=KN.actions,Nz=KN.reducer,kz=["children"];function Pz(e,t){if(e==null)return{};var r,n,i=_z(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n({x:0,y:0,value:0}),errorBarOffset:0},Az=h.createContext(Cz);function Oz(e){var{children:t}=e,r=Pz(e,kz);return h.createElement(Az.Provider,{value:r},t)}function tg(e,t){var r,n,i=G(d=>dn(d,e)),s=G(d=>fn(d,t)),o=(r=i==null?void 0:i.allowDataOverflow)!==null&&r!==void 0?r:Tt.allowDataOverflow,l=(n=s==null?void 0:s.allowDataOverflow)!==null&&n!==void 0?n:Mt.allowDataOverflow,c=o||l;return{needClip:c,needClipX:o,needClipY:l}}function VN(e){var{xAxisId:t,yAxisId:r,clipPathId:n}=e,i=Mu(),{needClipX:s,needClipY:o,needClip:l}=tg(t,r);if(!l||!i)return null;var{x:c,y:d,width:u,height:f}=i;return h.createElement("clipPath",{id:"clipPath-".concat(n)},h.createElement("rect",{x:s?c:c-u/2,y:o?d:d-f/2,width:s?u:u*2,height:o?f:f*2}))}var Ez=e=>{var{chartData:t}=e,r=Ve(),n=pt();return h.useEffect(()=>n?()=>{}:(r(Iy(t)),()=>{r(Iy(void 0))}),[t,r,n]),null},lv={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},YN=At({name:"brush",initialState:lv,reducers:{setBrushSettings(e,t){return t.payload==null?lv:t.payload}}}),{setBrushSettings:U7}=YN.actions,Dz=YN.reducer;function Tz(e,t,r){return(t=Mz(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Mz(e){var t=Iz(e,"string");return typeof t=="symbol"?t:t+""}function Iz(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}class rg{static create(t){return new rg(t)}constructor(t){this.scale=t}get domain(){return this.scale.domain}get range(){return this.scale.range}get rangeMin(){return this.range()[0]}get rangeMax(){return this.range()[1]}get bandwidth(){return this.scale.bandwidth}apply(t){var{bandAware:r,position:n}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(t!==void 0){if(n)switch(n){case"start":return this.scale(t);case"middle":{var i=this.bandwidth?this.bandwidth()/2:0;return this.scale(t)+i}case"end":{var s=this.bandwidth?this.bandwidth():0;return this.scale(t)+s}default:return this.scale(t)}if(r){var o=this.bandwidth?this.bandwidth()/2:0;return this.scale(t)+o}return this.scale(t)}}isInRange(t){var r=this.range(),n=r[0],i=r[r.length-1];return n<=i?t>=n&&t<=i:t>=i&&t<=n}}Tz(rg,"EPS",1e-4);function $z(e){return(e%180+180)%180}var Lz=function(t){var{width:r,height:n}=t,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,s=$z(i),o=s*Math.PI/180,l=Math.atan(n/r),c=o>l&&o{e.dots.push(t.payload)},removeDot:(e,t)=>{var r=Kr(e).dots.findIndex(n=>n===t.payload);r!==-1&&e.dots.splice(r,1)},addArea:(e,t)=>{e.areas.push(t.payload)},removeArea:(e,t)=>{var r=Kr(e).areas.findIndex(n=>n===t.payload);r!==-1&&e.areas.splice(r,1)},addLine:(e,t)=>{e.lines.push(t.payload)},removeLine:(e,t)=>{var r=Kr(e).lines.findIndex(n=>n===t.payload);r!==-1&&e.lines.splice(r,1)}}}),{addDot:q7,removeDot:H7,addArea:K7,removeArea:V7,addLine:Y7,removeLine:G7}=GN.actions,Rz=GN.reducer,Bz=h.createContext(void 0),Fz=e=>{var{children:t}=e,[r]=h.useState("".concat(Ts("recharts"),"-clip")),n=Mu();if(n==null)return null;var{x:i,y:s,width:o,height:l}=n;return h.createElement(Bz.Provider,{value:r},h.createElement("defs",null,h.createElement("clipPath",{id:r},h.createElement("rect",{x:i,y:s,height:l,width:o}))),t)};function ya(e,t){for(var r in e)if({}.hasOwnProperty.call(e,r)&&(!{}.hasOwnProperty.call(t,r)||e[r]!==t[r]))return!1;for(var n in t)if({}.hasOwnProperty.call(t,n)&&!{}.hasOwnProperty.call(e,n))return!1;return!0}function ZN(e,t){if(t<1)return[];if(t===1)return e;for(var r=[],n=0;ne*i)return!1;var s=r();return e*(t-e*s/2-n)>=0&&e*(t+e*s/2-i)<=0}function qz(e,t){return ZN(e,t+1)}function Hz(e,t,r,n,i){for(var s=(n||[]).slice(),{start:o,end:l}=t,c=0,d=1,u=o,f=function(){var x=n==null?void 0:n[c];if(x===void 0)return{v:ZN(n,d)};var g=c,b,v=()=>(b===void 0&&(b=r(x,g)),b),j=x.coordinate,y=c===0||yc(e,j,v,u,l);y||(c=0,u=o,d+=1),y&&(u=j+e*(v()/2+i),c+=d)},p;d<=s.length;)if(p=f(),p)return p.v;return[]}function cv(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function at(e){for(var t=1;t(x===void 0&&(x=r(m,p)),x);if(p===o-1){var b=e*(m.coordinate+e*g()/2-c);s[p]=m=at(at({},m),{},{tickCoord:b>0?m.coordinate-b*e:m.coordinate})}else s[p]=m=at(at({},m),{},{tickCoord:m.coordinate});if(m.tickCoord!=null){var v=yc(e,m.tickCoord,g,l,c);v&&(c=m.tickCoord-e*(g()/2+i),s[p]=at(at({},m),{},{isShow:!0}))}},u=o-1;u>=0;u--)d(u);return s}function Zz(e,t,r,n,i,s){var o=(n||[]).slice(),l=o.length,{start:c,end:d}=t;if(s){var u=n[l-1],f=r(u,l-1),p=e*(u.coordinate+e*f/2-d);if(o[l-1]=u=at(at({},u),{},{tickCoord:p>0?u.coordinate-p*e:u.coordinate}),u.tickCoord!=null){var m=yc(e,u.tickCoord,()=>f,c,d);m&&(d=u.tickCoord-e*(f/2+i),o[l-1]=at(at({},u),{},{isShow:!0}))}}for(var x=s?l-1:l,g=function(j){var y=o[j],w,S=()=>(w===void 0&&(w=r(y,j)),w);if(j===0){var N=e*(y.coordinate-e*S()/2-c);o[j]=y=at(at({},y),{},{tickCoord:N<0?y.coordinate-N*e:y.coordinate})}else o[j]=y=at(at({},y),{},{tickCoord:y.coordinate});if(y.tickCoord!=null){var P=yc(e,y.tickCoord,S,c,d);P&&(c=y.tickCoord+e*(S()/2+i),o[j]=at(at({},y),{},{isShow:!0}))}},b=0;b{var S=typeof d=="function"?d(y.value,w):y.value;return x==="width"?Wz(ds(S,{fontSize:t,letterSpacing:r}),g,f):ds(S,{fontSize:t,letterSpacing:r})[x]},v=i.length>=2?Jt(i[1].coordinate-i[0].coordinate):1,j=Uz(s,v,x);return c==="equidistantPreserveStart"?Hz(v,j,b,i,o):(c==="preserveStart"||c==="preserveStartEnd"?m=Zz(v,j,b,i,o,c==="preserveStartEnd"):m=Gz(v,j,b,i,o),m.filter(y=>y.isShow))}var Xz=e=>{var{ticks:t,label:r,labelGapWithTick:n=5,tickSize:i=0,tickMargin:s=0}=e,o=0;if(t){Array.from(t).forEach(u=>{if(u){var f=u.getBoundingClientRect();f.width>o&&(o=f.width)}});var l=r?r.getBoundingClientRect().width:0,c=i+s,d=o+c+l+(r?n:0);return Math.round(d)}return 0},Jz=["axisLine","width","height","className","hide","ticks","axisType"],Qz=["viewBox"],eR=["viewBox"];function yp(e,t){if(e==null)return{};var r,n,i=tR(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n{var{ticks:r=[],tick:n,tickLine:i,stroke:s,tickFormatter:o,unit:l,padding:c,tickTextProps:d,orientation:u,mirror:f,x:p,y:m,width:x,height:g,tickSize:b,tickMargin:v,fontSize:j,letterSpacing:y,getTicksConfig:w,events:S,axisType:N}=e,P=ng(Ee(Ee({},w),{},{ticks:r}),j,y),_=oR(u,f),T=lR(u,f),$=nr(w),M=qc(n),C={};typeof i=="object"&&(C=i);var R=Ee(Ee({},$),{},{fill:"none"},C),q=P.map(D=>Ee({entry:D},sR(D,p,m,x,g,u,b,f,v))),Z=q.map(D=>{var{entry:O,line:k}=D;return h.createElement(ir,{className:"recharts-cartesian-axis-tick",key:"tick-".concat(O.value,"-").concat(O.coordinate,"-").concat(O.tickCoord)},i&&h.createElement("line",Si({},R,k,{className:ce("recharts-cartesian-axis-tick-line",Xc(i,"className"))})))}),E=q.map((D,O)=>{var{entry:k,tick:L}=D,U=Ee(Ee(Ee(Ee({textAnchor:_,verticalAnchor:T},$),{},{stroke:"none",fill:s},M),L),{},{index:O,payload:k,visibleTicksCount:P.length,tickFormatter:o,padding:c},d);return h.createElement(ir,Si({className:"recharts-cartesian-axis-tick-label",key:"tick-label-".concat(k.value,"-").concat(k.coordinate,"-").concat(k.tickCoord)},Q6(S,k,O)),n&&h.createElement(cR,{option:n,tickProps:U,value:"".concat(typeof o=="function"?o(k.value,O):k.value).concat(l||"")}))});return h.createElement("g",{className:"recharts-cartesian-axis-ticks recharts-".concat(N,"-ticks")},E.length>0&&h.createElement(Ir,{zIndex:lt.label},h.createElement("g",{className:"recharts-cartesian-axis-tick-labels recharts-".concat(N,"-tick-labels"),ref:t},E)),Z.length>0&&h.createElement("g",{className:"recharts-cartesian-axis-tick-lines recharts-".concat(N,"-tick-lines")},Z))}),dR=h.forwardRef((e,t)=>{var{axisLine:r,width:n,height:i,className:s,hide:o,ticks:l,axisType:c}=e,d=yp(e,Jz),[u,f]=h.useState(""),[p,m]=h.useState(""),x=h.useRef(null);h.useImperativeHandle(t,()=>({getCalculatedWidth:()=>{var b;return Xz({ticks:x.current,label:(b=e.labelRef)===null||b===void 0?void 0:b.current,labelGapWithTick:5,tickSize:e.tickSize,tickMargin:e.tickMargin})}}));var g=h.useCallback(b=>{if(b){var v=b.getElementsByClassName("recharts-cartesian-axis-tick-value");x.current=v;var j=v[0];if(j){var y=window.getComputedStyle(j),w=y.fontSize,S=y.letterSpacing;(w!==u||S!==p)&&(f(w),m(S))}}},[u,p]);return o||n!=null&&n<=0||i!=null&&i<=0?null:h.createElement(Ir,{zIndex:e.zIndex},h.createElement(ir,{className:ce("recharts-cartesian-axis",s)},h.createElement(aR,{x:e.x,y:e.y,width:n,height:i,orientation:e.orientation,mirror:e.mirror,axisLine:r,otherSvgProps:nr(e)}),h.createElement(uR,{ref:g,axisType:c,events:d,fontSize:u,getTicksConfig:e,height:e.height,letterSpacing:p,mirror:e.mirror,orientation:e.orientation,padding:e.padding,stroke:e.stroke,tick:e.tick,tickFormatter:e.tickFormatter,tickLine:e.tickLine,tickMargin:e.tickMargin,tickSize:e.tickSize,tickTextProps:e.tickTextProps,ticks:l,unit:e.unit,width:e.width,x:e.x,y:e.y}),h.createElement(s8,{x:e.x,y:e.y,width:e.width,height:e.height,lowerWidth:e.width,upperWidth:e.width},h.createElement(g8,{label:e.label,labelRef:e.labelRef}),e.children)))}),fR=h.memo(dR,(e,t)=>{var{viewBox:r}=e,n=yp(e,Qz),{viewBox:i}=t,s=yp(t,eR);return ya(r,i)&&ya(n,s)}),ag=h.forwardRef((e,t)=>{var r=ft(e,ig);return h.createElement(fR,Si({},r,{ref:t}))});ag.displayName="CartesianAxis";var pR=["x1","y1","x2","y2","key"],hR=["offset"],mR=["xAxisId","yAxisId"],gR=["xAxisId","yAxisId"];function dv(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function ot(e){for(var t=1;t{var{fill:t}=e;if(!t||t==="none")return null;var{fillOpacity:r,x:n,y:i,width:s,height:o,ry:l}=e;return h.createElement("rect",{x:n,y:i,ry:l,width:s,height:o,stroke:"none",fill:t,fillOpacity:r,className:"recharts-cartesian-grid-bg"})};function XN(e){var{option:t,lineItemProps:r}=e,n;if(h.isValidElement(t))n=h.cloneElement(t,r);else if(typeof t=="function")n=t(r);else{var i,{x1:s,y1:o,x2:l,y2:c,key:d}=r,u=vc(r,pR),f=(i=nr(u))!==null&&i!==void 0?i:{},{offset:p}=f,m=vc(f,hR);n=h.createElement("line",ai({},m,{x1:s,y1:o,x2:l,y2:c,fill:"none",key:d}))}return n}function wR(e){var{x:t,width:r,horizontal:n=!0,horizontalPoints:i}=e;if(!n||!i||!i.length)return null;var{xAxisId:s,yAxisId:o}=e,l=vc(e,mR),c=i.map((d,u)=>{var f=ot(ot({},l),{},{x1:t,y1:d,x2:t+r,y2:d,key:"line-".concat(u),index:u});return h.createElement(XN,{key:"line-".concat(u),option:n,lineItemProps:f})});return h.createElement("g",{className:"recharts-cartesian-grid-horizontal"},c)}function SR(e){var{y:t,height:r,vertical:n=!0,verticalPoints:i}=e;if(!n||!i||!i.length)return null;var{xAxisId:s,yAxisId:o}=e,l=vc(e,gR),c=i.map((d,u)=>{var f=ot(ot({},l),{},{x1:d,y1:t,x2:d,y2:t+r,key:"line-".concat(u),index:u});return h.createElement(XN,{option:n,lineItemProps:f,key:"line-".concat(u)})});return h.createElement("g",{className:"recharts-cartesian-grid-vertical"},c)}function NR(e){var{horizontalFill:t,fillOpacity:r,x:n,y:i,width:s,height:o,horizontalPoints:l,horizontal:c=!0}=e;if(!c||!t||!t.length||l==null)return null;var d=l.map(f=>Math.round(f+i-i)).sort((f,p)=>f-p);i!==d[0]&&d.unshift(0);var u=d.map((f,p)=>{var m=!d[p+1],x=m?i+o-f:d[p+1]-f;if(x<=0)return null;var g=p%t.length;return h.createElement("rect",{key:"react-".concat(p),y:f,x:n,height:x,width:s,stroke:"none",fill:t[g],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return h.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},u)}function kR(e){var{vertical:t=!0,verticalFill:r,fillOpacity:n,x:i,y:s,width:o,height:l,verticalPoints:c}=e;if(!t||!r||!r.length)return null;var d=c.map(f=>Math.round(f+i-i)).sort((f,p)=>f-p);i!==d[0]&&d.unshift(0);var u=d.map((f,p)=>{var m=!d[p+1],x=m?i+o-f:d[p+1]-f;if(x<=0)return null;var g=p%r.length;return h.createElement("rect",{key:"react-".concat(p),x:f,y:s,width:x,height:l,stroke:"none",fill:r[g],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return h.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},u)}var PR=(e,t)=>{var{xAxis:r,width:n,height:i,offset:s}=e;return Aw(ng(ot(ot(ot({},ig),r),{},{ticks:Ow(r),viewBox:{x:0,y:0,width:n,height:i}})),s.left,s.left+s.width,t)},_R=(e,t)=>{var{yAxis:r,width:n,height:i,offset:s}=e;return Aw(ng(ot(ot(ot({},ig),r),{},{ticks:Ow(r),viewBox:{x:0,y:0,width:n,height:i}})),s.top,s.top+s.height,t)},CR={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:lt.grid};function vp(e){var t=Fw(),r=Ww(),n=Bw(),i=ot(ot({},ft(e,CR)),{},{x:Y(e.x)?e.x:n.left,y:Y(e.y)?e.y:n.top,width:Y(e.width)?e.width:n.width,height:Y(e.height)?e.height:n.height}),{xAxisId:s,yAxisId:o,x:l,y:c,width:d,height:u,syncWithTicks:f,horizontalValues:p,verticalValues:m}=i,x=pt(),g=G(T=>Ny(T,"xAxis",s,x)),b=G(T=>Ny(T,"yAxis",o,x));if(!Er(d)||!Er(u)||!Y(l)||!Y(c))return null;var v=i.verticalCoordinatesGenerator||PR,j=i.horizontalCoordinatesGenerator||_R,{horizontalPoints:y,verticalPoints:w}=i;if((!y||!y.length)&&typeof j=="function"){var S=p&&p.length,N=j({yAxis:b?ot(ot({},b),{},{ticks:S?p:b.ticks}):void 0,width:t??d,height:r??u,offset:n},S?!0:f);Gl(Array.isArray(N),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(typeof N,"]")),Array.isArray(N)&&(y=N)}if((!w||!w.length)&&typeof v=="function"){var P=m&&m.length,_=v({xAxis:g?ot(ot({},g),{},{ticks:P?m:g.ticks}):void 0,width:t??d,height:r??u,offset:n},P?!0:f);Gl(Array.isArray(_),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(typeof _,"]")),Array.isArray(_)&&(w=_)}return h.createElement(Ir,{zIndex:i.zIndex},h.createElement("g",{className:"recharts-cartesian-grid"},h.createElement(jR,{fill:i.fill,fillOpacity:i.fillOpacity,x:i.x,y:i.y,width:i.width,height:i.height,ry:i.ry}),h.createElement(NR,ai({},i,{horizontalPoints:y})),h.createElement(kR,ai({},i,{verticalPoints:w})),h.createElement(wR,ai({},i,{offset:n,horizontalPoints:y,xAxis:g,yAxis:b})),h.createElement(SR,ai({},i,{offset:n,verticalPoints:w,xAxis:g,yAxis:b}))))}vp.displayName="CartesianGrid";var JN=(e,t,r,n)=>Du(e,"xAxis",t,n),QN=(e,t,r,n)=>Eu(e,"xAxis",t,n),ek=(e,t,r,n)=>Du(e,"yAxis",r,n),tk=(e,t,r,n)=>Eu(e,"yAxis",r,n),AR=I([ue,JN,ek,QN,tk],(e,t,r,n,i)=>Mr(e,"xAxis")?ha(t,n,!1):ha(r,i,!1)),OR=(e,t,r,n,i)=>i;function ER(e){return e.type==="line"}var DR=I([Mm,OR],(e,t)=>e.filter(ER).find(r=>r.id===t)),TR=I([ue,JN,ek,QN,tk,DR,AR,bu],(e,t,r,n,i,s,o,l)=>{var{chartData:c,dataStartIndex:d,dataEndIndex:u}=l;if(!(s==null||t==null||r==null||n==null||i==null||n.length===0||i.length===0||o==null)){var{dataKey:f,data:p}=s,m;if(p!=null&&p.length>0?m=p:m=c==null?void 0:c.slice(d,u+1),m!=null)return QR({layout:e,xAxis:t,yAxis:r,xAxisTicks:n,yAxisTicks:i,dataKey:f,bandSize:o,displayedData:m})}});function rk(e){var t=qc(e),r=3,n=2;if(t!=null){var{r:i,strokeWidth:s}=t,o=Number(i),l=Number(s);return(Number.isNaN(o)||o<0)&&(o=r),(Number.isNaN(l)||l<0)&&(l=n),{r:o,strokeWidth:l}}return{r,strokeWidth:n}}var MR=["id"],IR=["type","layout","connectNulls","needClip","shape"],$R=["activeDot","animateNewValues","animationBegin","animationDuration","animationEasing","connectNulls","dot","hide","isAnimationActive","label","legendType","xAxisId","yAxisId","id"];function Hs(){return Hs=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{dataKey:t,name:r,stroke:n,legendType:i,hide:s}=e;return[{inactive:s,dataKey:t,type:i,color:n,value:au(r,t),payload:e}]};function WR(e){var{dataKey:t,data:r,stroke:n,strokeWidth:i,fill:s,name:o,hide:l,unit:c}=e;return{dataDefinedOnItem:r,positions:void 0,settings:{stroke:n,strokeWidth:i,fill:s,dataKey:t,nameKey:void 0,name:au(o,t),hide:l,type:e.tooltipType,color:e.stroke,unit:c}}}var nk=(e,t)=>"".concat(t,"px ").concat(e-t,"px");function UR(e,t){for(var r=e.length%2!==0?[...e,0]:e,n=[],i=0;i{var n=r.reduce((f,p)=>f+p);if(!n)return nk(t,e);for(var i=Math.floor(e/n),s=e%n,o=t-e,l=[],c=0,d=0;cs){l=[...r.slice(0,c),s-d];break}var u=l.length%2===0?[0,o]:[o];return[...UR(r,i),...l,...u].map(f=>"".concat(f,"px")).join(", ")};function HR(e){var{clipPathId:t,points:r,props:n}=e,{dot:i,dataKey:s,needClip:o}=n,{id:l}=n,c=sg(n,MR),d=nr(c);return h.createElement(qN,{points:r,dot:i,className:"recharts-line-dots",dotClassName:"recharts-line-dot",dataKey:s,baseProps:d,needClip:o,clipPathId:t})}function KR(e){var{showLabels:t,children:r,points:n}=e,i=h.useMemo(()=>n==null?void 0:n.map(s=>{var o,l,c={x:(o=s.x)!==null&&o!==void 0?o:0,y:(l=s.y)!==null&&l!==void 0?l:0,width:0,lowerWidth:0,upperWidth:0,height:0};return wr(wr({},c),{},{value:s.value,payload:s.payload,viewBox:c,parentViewBox:void 0,fill:void 0})}),[n]);return h.createElement(DN,{value:t?i:void 0},r)}function pv(e){var{clipPathId:t,pathRef:r,points:n,strokeDasharray:i,props:s}=e,{type:o,layout:l,connectNulls:c,needClip:d,shape:u}=s,f=sg(s,IR),p=wr(wr({},ut(f)),{},{fill:"none",className:"recharts-line-curve",clipPath:d?"url(#clipPath-".concat(t,")"):void 0,points:n,type:o,layout:l,connectNulls:c,strokeDasharray:i??s.strokeDasharray});return h.createElement(h.Fragment,null,(n==null?void 0:n.length)>1&&h.createElement(U8,Hs({shapeType:"curve",option:u},p,{pathRef:r})),h.createElement(HR,{points:n,clipPathId:t,props:s}))}function VR(e){try{return e&&e.getTotalLength&&e.getTotalLength()||0}catch{return 0}}function YR(e){var{clipPathId:t,props:r,pathRef:n,previousPointsRef:i,longestAnimatedLengthRef:s}=e,{points:o,strokeDasharray:l,isAnimationActive:c,animationBegin:d,animationDuration:u,animationEasing:f,animateNewValues:p,width:m,height:x,onAnimationEnd:g,onAnimationStart:b}=r,v=i.current,j=pu(r,"recharts-line-"),[y,w]=h.useState(!1),S=!y,N=h.useCallback(()=>{typeof g=="function"&&g(),w(!1)},[g]),P=h.useCallback(()=>{typeof b=="function"&&b(),w(!0)},[b]),_=VR(n.current),T=s.current;return h.createElement(KR,{points:o,showLabels:S},r.children,h.createElement(fu,{animationId:j,begin:d,duration:u,isActive:c,easing:f,onAnimationEnd:N,onAnimationStart:P,key:j},$=>{var M=De(T,_+T,$),C=Math.min(M,_),R;if(c)if(l){var q="".concat(l).split(/[,\s]+/gim).map(D=>parseFloat(D));R=qR(C,_,q)}else R=nk(_,C);else R=l==null?void 0:String(l);if(v){var Z=v.length/o.length,E=$===1?o:o.map((D,O)=>{var k=Math.floor(O*Z);if(v[k]){var L=v[k];return wr(wr({},D),{},{x:De(L.x,D.x,$),y:De(L.y,D.y,$)})}return p?wr(wr({},D),{},{x:De(m*2,D.x,$),y:De(x/2,D.y,$)}):wr(wr({},D),{},{x:D.x,y:D.y})});return i.current=E,h.createElement(pv,{props:r,points:E,clipPathId:t,pathRef:n,strokeDasharray:R})}return $>0&&_>0&&(i.current=o,s.current=C),h.createElement(pv,{props:r,points:o,clipPathId:t,pathRef:n,strokeDasharray:R})}),h.createElement(MN,{label:r.label}))}function GR(e){var{clipPathId:t,props:r}=e,n=h.useRef(null),i=h.useRef(0),s=h.useRef(null);return h.createElement(YR,{props:r,clipPathId:t,previousPointsRef:n,longestAnimatedLengthRef:i,pathRef:s})}var ZR=(e,t)=>{var r,n;return{x:(r=e.x)!==null&&r!==void 0?r:void 0,y:(n=e.y)!==null&&n!==void 0?n:void 0,value:e.value,errorVal:et(e.payload,t)}};class XR extends h.Component{render(){var{hide:t,dot:r,points:n,className:i,xAxisId:s,yAxisId:o,top:l,left:c,width:d,height:u,id:f,needClip:p,zIndex:m}=this.props;if(t)return null;var x=ce("recharts-line",i),g=f,{r:b,strokeWidth:v}=rk(r),j=eg(r),y=b*2+v;return h.createElement(Ir,{zIndex:m},h.createElement(ir,{className:x},p&&h.createElement("defs",null,h.createElement(VN,{clipPathId:g,xAxisId:s,yAxisId:o}),!j&&h.createElement("clipPath",{id:"clipPath-dots-".concat(g)},h.createElement("rect",{x:c-y/2,y:l-y/2,width:d+y,height:u+y}))),h.createElement(Oz,{xAxisId:s,yAxisId:o,data:n,dataPointFormatter:ZR,errorBarOffset:0},h.createElement(GR,{props:this.props,clipPathId:g}))),h.createElement(xp,{activeDot:this.props.activeDot,points:n,mainColor:this.props.stroke,itemDataKey:this.props.dataKey}))}}var ik={activeDot:!0,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",connectNulls:!1,dot:!0,fill:"#fff",hide:!1,isAnimationActive:!Ci.isSsr,label:!1,legendType:"line",stroke:"#3182bd",strokeWidth:1,xAxisId:0,yAxisId:0,zIndex:lt.line};function JR(e){var t=ft(e,ik),{activeDot:r,animateNewValues:n,animationBegin:i,animationDuration:s,animationEasing:o,connectNulls:l,dot:c,hide:d,isAnimationActive:u,label:f,legendType:p,xAxisId:m,yAxisId:x,id:g}=t,b=sg(t,$R),{needClip:v}=tg(m,x),j=Mu(),y=to(),w=pt(),S=G($=>TR($,m,x,w,g));if(y!=="horizontal"&&y!=="vertical"||S==null||j==null)return null;var{height:N,width:P,x:_,y:T}=j;return h.createElement(XR,Hs({},b,{id:g,connectNulls:l,dot:c,activeDot:r,animateNewValues:n,animationBegin:i,animationDuration:s,animationEasing:o,isAnimationActive:u,hide:d,label:f,legendType:p,xAxisId:m,yAxisId:x,points:S,layout:y,height:N,width:P,left:_,top:T,needClip:v}))}function QR(e){var{layout:t,xAxis:r,yAxis:n,xAxisTicks:i,yAxisTicks:s,dataKey:o,bandSize:l,displayedData:c}=e;return c.map((d,u)=>{var f=et(d,o);if(t==="horizontal"){var p=Yl({axis:r,ticks:i,bandSize:l,entry:d,index:u}),m=Re(f)?null:n.scale(f);return{x:p,y:m,value:f,payload:d}}var x=Re(f)?null:r.scale(f),g=Yl({axis:n,ticks:s,bandSize:l,entry:d,index:u});return x==null||g==null?null:{x,y:g,value:f,payload:d}}).filter(Boolean)}function e9(e){var t=ft(e,ik),r=pt();return h.createElement(FN,{id:t.id,type:"line"},n=>h.createElement(h.Fragment,null,h.createElement(RN,{legendPayload:FR(t)}),h.createElement(zN,{fn:WR,args:t}),h.createElement(UN,{type:"line",id:n,data:t.data,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,hide:t.hide,isPanorama:r}),h.createElement(JR,Hs({},t,{id:n}))))}var ak=h.memo(e9);ak.displayName="Line";var sk=(e,t,r,n)=>Du(e,"xAxis",t,n),ok=(e,t,r,n)=>Eu(e,"xAxis",t,n),lk=(e,t,r,n)=>Du(e,"yAxis",r,n),ck=(e,t,r,n)=>Eu(e,"yAxis",r,n),t9=I([ue,sk,lk,ok,ck],(e,t,r,n,i)=>Mr(e,"xAxis")?ha(t,n,!1):ha(r,i,!1)),r9=(e,t,r,n,i)=>i,uk=I([Mm,r9],(e,t)=>e.filter(r=>r.type==="area").find(r=>r.id===t)),n9=(e,t,r,n,i)=>{var s,o=uk(e,t,r,n,i);if(o!=null){var l=ue(e),c=Mr(l,"xAxis"),d;if(c?d=cp(e,"yAxis",r,n):d=cp(e,"xAxis",t,n),d!=null){var{stackId:u}=o,f=Em(o);if(!(u==null||f==null)){var p=(s=d[u])===null||s===void 0?void 0:s.stackedData;return p==null?void 0:p.find(m=>m.key===f)}}}},i9=I([ue,sk,lk,ok,ck,n9,bu,t9,uk,xM],(e,t,r,n,i,s,o,l,c,d)=>{var{chartData:u,dataStartIndex:f,dataEndIndex:p}=o;if(!(c==null||e!=="horizontal"&&e!=="vertical"||t==null||r==null||n==null||i==null||n.length===0||i.length===0||l==null)){var{data:m}=c,x;if(m&&m.length>0?x=m:x=u==null?void 0:u.slice(f,p+1),x!=null)return S9({layout:e,xAxis:t,yAxis:r,xAxisTicks:n,yAxisTicks:i,dataStartIndex:f,areaSettings:c,stackedData:s,displayedData:x,chartBaseValue:d,bandSize:l})}}),a9=["id"],s9=["activeDot","animationBegin","animationDuration","animationEasing","connectNulls","dot","fill","fillOpacity","hide","isAnimationActive","legendType","stroke","xAxisId","yAxisId"];function fi(){return fi=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{dataKey:t,name:r,stroke:n,fill:i,legendType:s,hide:o}=e;return[{inactive:o,dataKey:t,type:s,color:bc(n,i),value:au(r,t),payload:e}]};function f9(e){var{dataKey:t,data:r,stroke:n,strokeWidth:i,fill:s,name:o,hide:l,unit:c}=e;return{dataDefinedOnItem:r,positions:void 0,settings:{stroke:n,strokeWidth:i,fill:s,dataKey:t,nameKey:void 0,name:au(o,t),hide:l,type:e.tooltipType,color:bc(n,s),unit:c}}}function p9(e){var{clipPathId:t,points:r,props:n}=e,{needClip:i,dot:s,dataKey:o}=n,l=nr(n);return h.createElement(qN,{points:r,dot:s,className:"recharts-area-dots",dotClassName:"recharts-area-dot",dataKey:o,baseProps:l,needClip:i,clipPathId:t})}function h9(e){var{showLabels:t,children:r,points:n}=e,i=n.map(s=>{var o,l,c={x:(o=s.x)!==null&&o!==void 0?o:0,y:(l=s.y)!==null&&l!==void 0?l:0,width:0,lowerWidth:0,upperWidth:0,height:0};return Zi(Zi({},c),{},{value:s.value,payload:s.payload,parentViewBox:void 0,viewBox:c,fill:void 0})});return h.createElement(DN,{value:t?i:void 0},r)}function mv(e){var{points:t,baseLine:r,needClip:n,clipPathId:i,props:s}=e,{layout:o,type:l,stroke:c,connectNulls:d,isRange:u}=s,{id:f}=s,p=dk(s,a9),m=nr(p),x=ut(p);return h.createElement(h.Fragment,null,(t==null?void 0:t.length)>1&&h.createElement(ir,{clipPath:n?"url(#clipPath-".concat(i,")"):void 0},h.createElement(us,fi({},x,{id:f,points:t,connectNulls:d,type:l,baseLine:r,layout:o,stroke:"none",className:"recharts-area-area"})),c!=="none"&&h.createElement(us,fi({},m,{className:"recharts-area-curve",layout:o,type:l,connectNulls:d,fill:"none",points:t})),c!=="none"&&u&&h.createElement(us,fi({},m,{className:"recharts-area-curve",layout:o,type:l,connectNulls:d,fill:"none",points:r}))),h.createElement(p9,{points:t,props:p,clipPathId:i}))}function m9(e){var{alpha:t,baseLine:r,points:n,strokeWidth:i}=e,s=n[0].y,o=n[n.length-1].y;if(!_e(s)||!_e(o))return null;var l=t*Math.abs(s-o),c=Math.max(...n.map(d=>d.x||0));return Y(r)?c=Math.max(r,c):r&&Array.isArray(r)&&r.length&&(c=Math.max(...r.map(d=>d.x||0),c)),Y(c)?h.createElement("rect",{x:0,y:sd.y||0));return Y(r)?c=Math.max(r,c):r&&Array.isArray(r)&&r.length&&(c=Math.max(...r.map(d=>d.y||0),c)),Y(c)?h.createElement("rect",{x:s{typeof m=="function"&&m(),b(!1)},[m]),y=h.useCallback(()=>{typeof p=="function"&&p(),b(!0)},[p]),w=i.current,S=s.current;return h.createElement(h9,{showLabels:v,points:o},n.children,h.createElement(fu,{animationId:x,begin:d,duration:u,isActive:c,easing:f,onAnimationEnd:j,onAnimationStart:y,key:x},N=>{if(w){var P=w.length/o.length,_=N===1?o:o.map(($,M)=>{var C=Math.floor(M*P);if(w[C]){var R=w[C];return Zi(Zi({},$),{},{x:De(R.x,$.x,N),y:De(R.y,$.y,N)})}return $}),T;return Y(l)?T=De(S,l,N):Re(l)||yr(l)?T=De(S,0,N):T=l.map(($,M)=>{var C=Math.floor(M*P);if(Array.isArray(S)&&S[C]){var R=S[C];return Zi(Zi({},$),{},{x:De(R.x,$.x,N),y:De(R.y,$.y,N)})}return $}),N>0&&(i.current=_,s.current=T),h.createElement(mv,{points:_,baseLine:T,needClip:t,clipPathId:r,props:n})}return N>0&&(i.current=o,s.current=l),h.createElement(ir,null,c&&h.createElement("defs",null,h.createElement("clipPath",{id:"animationClipPath-".concat(r)},h.createElement(x9,{alpha:N,points:o,baseLine:l,layout:n.layout,strokeWidth:n.strokeWidth}))),h.createElement(ir,{clipPath:"url(#animationClipPath-".concat(r,")")},h.createElement(mv,{points:o,baseLine:l,needClip:t,clipPathId:r,props:n})))}),h.createElement(MN,{label:n.label}))}function v9(e){var{needClip:t,clipPathId:r,props:n}=e,i=h.useRef(null),s=h.useRef();return h.createElement(y9,{needClip:t,clipPathId:r,props:n,previousPointsRef:i,previousBaselineRef:s})}class b9 extends h.PureComponent{render(){var{hide:t,dot:r,points:n,className:i,top:s,left:o,needClip:l,xAxisId:c,yAxisId:d,width:u,height:f,id:p,baseLine:m,zIndex:x}=this.props;if(t)return null;var g=ce("recharts-area",i),b=p,{r:v,strokeWidth:j}=rk(r),y=eg(r),w=v*2+j;return h.createElement(Ir,{zIndex:x},h.createElement(ir,{className:g},l&&h.createElement("defs",null,h.createElement(VN,{clipPathId:b,xAxisId:c,yAxisId:d}),!y&&h.createElement("clipPath",{id:"clipPath-dots-".concat(b)},h.createElement("rect",{x:o-w/2,y:s-w/2,width:u+w,height:f+w}))),h.createElement(v9,{needClip:l,clipPathId:b,props:this.props})),h.createElement(xp,{points:n,mainColor:bc(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot}),this.props.isRange&&Array.isArray(m)&&h.createElement(xp,{points:m,mainColor:bc(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot}))}}var fk={activeDot:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",connectNulls:!1,dot:!1,fill:"#3182bd",fillOpacity:.6,hide:!1,isAnimationActive:!Ci.isSsr,legendType:"line",stroke:"#3182bd",xAxisId:0,yAxisId:0,zIndex:lt.area};function j9(e){var t,r=ft(e,fk),{activeDot:n,animationBegin:i,animationDuration:s,animationEasing:o,connectNulls:l,dot:c,fill:d,fillOpacity:u,hide:f,isAnimationActive:p,legendType:m,stroke:x,xAxisId:g,yAxisId:b}=r,v=dk(r,s9),j=to(),y=oN(),{needClip:w}=tg(g,b),S=pt(),{points:N,isRange:P,baseLine:_}=(t=G(q=>i9(q,g,b,S,e.id)))!==null&&t!==void 0?t:{},T=Mu();if(j!=="horizontal"&&j!=="vertical"||T==null||y!=="AreaChart"&&y!=="ComposedChart")return null;var{height:$,width:M,x:C,y:R}=T;return!N||!N.length?null:h.createElement(b9,fi({},v,{activeDot:n,animationBegin:i,animationDuration:s,animationEasing:o,baseLine:_,connectNulls:l,dot:c,fill:d,fillOpacity:u,height:$,hide:f,layout:j,isAnimationActive:p,isRange:P,legendType:m,needClip:w,points:N,stroke:x,width:M,left:C,top:R,xAxisId:g,yAxisId:b}))}var w9=(e,t,r,n,i)=>{var s=r??t;if(Y(s))return s;var o=e==="horizontal"?i:n,l=o.scale.domain();if(o.type==="number"){var c=Math.max(l[0],l[1]),d=Math.min(l[0],l[1]);return s==="dataMin"?d:s==="dataMax"||c<0?c:Math.max(Math.min(l[0],l[1]),0)}return s==="dataMin"?l[0]:s==="dataMax"?l[1]:l[0]};function S9(e){var{areaSettings:{connectNulls:t,baseValue:r,dataKey:n},stackedData:i,layout:s,chartBaseValue:o,xAxis:l,yAxis:c,displayedData:d,dataStartIndex:u,xAxisTicks:f,yAxisTicks:p,bandSize:m}=e,x=i&&i.length,g=w9(s,o,r,l,c),b=s==="horizontal",v=!1,j=d.map((w,S)=>{var N;x?N=i[u+S]:(N=et(w,n),Array.isArray(N)?v=!0:N=[g,N]);var P=N[1]==null||x&&!t&&et(w,n)==null;return b?{x:Yl({axis:l,ticks:f,bandSize:m,entry:w,index:S}),y:P?null:c.scale(N[1]),value:N,payload:w}:{x:P?null:l.scale(N[1]),y:Yl({axis:c,ticks:p,bandSize:m,entry:w,index:S}),value:N,payload:w}}),y;return x||v?y=j.map(w=>{var S=Array.isArray(w.value)?w.value[0]:null;return b?{x:w.x,y:S!=null&&w.y!=null?c.scale(S):null,payload:w.payload}:{x:S!=null?l.scale(S):null,y:w.y,payload:w.payload}}):y=b?c.scale(g):l.scale(g),{points:j,baseLine:y,isRange:v}}function N9(e){var t=ft(e,fk),r=pt();return h.createElement(FN,{id:t.id,type:"area"},n=>h.createElement(h.Fragment,null,h.createElement(RN,{legendPayload:d9(t)}),h.createElement(zN,{fn:f9,args:t}),h.createElement(UN,{type:"area",id:n,data:t.data,dataKey:t.dataKey,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,stackId:CE(t.stackId),hide:t.hide,barSize:void 0,baseValue:t.baseValue,isPanorama:r,connectNulls:t.connectNulls}),h.createElement(j9,fi({},t,{id:n}))))}var pk=h.memo(N9);pk.displayName="Area";var k9=["dangerouslySetInnerHTML","ticks"],P9=["id"],_9=["domain"],C9=["domain"];function bp(){return bp=Object.assign?Object.assign.bind():function(e){for(var t=1;t(t(uz(e)),()=>{t(dz(e))}),[e,t]),null}var E9=e=>{var{xAxisId:t,className:r}=e,n=G(Dw),i=pt(),s="xAxis",o=G(b=>Ea(b,s,t,i)),l=G(b=>R2(b,s,t,i)),c=G(b=>cI(b,t)),d=G(b=>mI(b,t)),u=G(b=>a2(b,t));if(c==null||d==null||u==null)return null;var{dangerouslySetInnerHTML:f,ticks:p}=e,m=jc(e,k9),{id:x}=u,g=jc(u,P9);return h.createElement(ag,bp({},m,g,{scale:o,x:d.x,y:d.y,width:c.width,height:c.height,className:ce("recharts-".concat(s," ").concat(s),r),viewBox:n,ticks:l,axisType:s}))},D9={allowDataOverflow:Tt.allowDataOverflow,allowDecimals:Tt.allowDecimals,allowDuplicatedCategory:Tt.allowDuplicatedCategory,height:Tt.height,hide:!1,mirror:Tt.mirror,orientation:Tt.orientation,padding:Tt.padding,reversed:Tt.reversed,scale:Tt.scale,tickCount:Tt.tickCount,type:Tt.type,xAxisId:0},T9=e=>{var t,r,n,i,s,o=ft(e,D9);return h.createElement(h.Fragment,null,h.createElement(O9,{interval:(t=o.interval)!==null&&t!==void 0?t:"preserveEnd",id:o.xAxisId,scale:o.scale,type:o.type,padding:o.padding,allowDataOverflow:o.allowDataOverflow,domain:o.domain,dataKey:o.dataKey,allowDuplicatedCategory:o.allowDuplicatedCategory,allowDecimals:o.allowDecimals,tickCount:o.tickCount,includeHidden:(r=o.includeHidden)!==null&&r!==void 0?r:!1,reversed:o.reversed,ticks:o.ticks,height:o.height,orientation:o.orientation,mirror:o.mirror,hide:o.hide,unit:o.unit,name:o.name,angle:(n=o.angle)!==null&&n!==void 0?n:0,minTickGap:(i=o.minTickGap)!==null&&i!==void 0?i:5,tick:(s=o.tick)!==null&&s!==void 0?s:!0,tickFormatter:o.tickFormatter}),h.createElement(E9,o))},M9=(e,t)=>{var{domain:r}=e,n=jc(e,_9),{domain:i}=t,s=jc(t,C9);return ya(n,s)?Array.isArray(r)&&r.length===2&&Array.isArray(i)&&i.length===2?r[0]===i[0]&&r[1]===i[1]:ya({domain:r},{domain:i}):!1},jp=h.memo(T9,M9);jp.displayName="XAxis";var I9=["dangerouslySetInnerHTML","ticks"],$9=["id"],L9=["domain"],z9=["domain"];function wp(){return wp=Object.assign?Object.assign.bind():function(e){for(var t=1;t(t(fz(e)),()=>{t(pz(e))}),[e,t]),null}var F9=e=>{var{yAxisId:t,className:r,width:n,label:i}=e,s=h.useRef(null),o=h.useRef(null),l=G(Dw),c=pt(),d=Ve(),u="yAxis",f=G(S=>Ea(S,u,t,c)),p=G(S=>yI(S,t)),m=G(S=>xI(S,t)),x=G(S=>R2(S,u,t,c)),g=G(S=>s2(S,t));if(h.useLayoutEffect(()=>{if(!(n!=="auto"||!p||Qm(i)||h.isValidElement(i)||g==null)){var S=s.current;if(S){var N=S.getCalculatedWidth();Math.round(p.width)!==Math.round(N)&&d(hz({id:t,width:N}))}}},[x,p,d,i,t,n,g]),p==null||m==null||g==null)return null;var{dangerouslySetInnerHTML:b,ticks:v}=e,j=wc(e,I9),{id:y}=g,w=wc(g,$9);return h.createElement(ag,wp({},j,w,{ref:s,labelRef:o,scale:f,x:m.x,y:m.y,tickTextProps:n==="auto"?{width:void 0}:{width:n},width:p.width,height:p.height,className:ce("recharts-".concat(u," ").concat(u),r),viewBox:l,ticks:x,axisType:u}))},W9={allowDataOverflow:Mt.allowDataOverflow,allowDecimals:Mt.allowDecimals,allowDuplicatedCategory:Mt.allowDuplicatedCategory,hide:!1,mirror:Mt.mirror,orientation:Mt.orientation,padding:Mt.padding,reversed:Mt.reversed,scale:Mt.scale,tickCount:Mt.tickCount,type:Mt.type,width:Mt.width,yAxisId:0},U9=e=>{var t,r,n,i,s,o=ft(e,W9);return h.createElement(h.Fragment,null,h.createElement(B9,{interval:(t=o.interval)!==null&&t!==void 0?t:"preserveEnd",id:o.yAxisId,scale:o.scale,type:o.type,domain:o.domain,allowDataOverflow:o.allowDataOverflow,dataKey:o.dataKey,allowDuplicatedCategory:o.allowDuplicatedCategory,allowDecimals:o.allowDecimals,tickCount:o.tickCount,padding:o.padding,includeHidden:(r=o.includeHidden)!==null&&r!==void 0?r:!1,reversed:o.reversed,ticks:o.ticks,width:o.width,orientation:o.orientation,mirror:o.mirror,hide:o.hide,unit:o.unit,name:o.name,angle:(n=o.angle)!==null&&n!==void 0?n:0,minTickGap:(i=o.minTickGap)!==null&&i!==void 0?i:5,tick:(s=o.tick)!==null&&s!==void 0?s:!0,tickFormatter:o.tickFormatter}),h.createElement(F9,o))},q9=(e,t)=>{var{domain:r}=e,n=wc(e,L9),{domain:i}=t,s=wc(t,z9);return ya(n,s)?Array.isArray(r)&&r.length===2&&Array.isArray(i)&&i.length===2?r[0]===i[0]&&r[1]===i[1]:ya({domain:r},{domain:i}):!1},Sp=h.memo(U9,q9);Sp.displayName="YAxis";var H9={};/** + `).concat(w.x,",").concat(w.y),N=Re(e.id)?Ts("recharts-radial-line-"):e.id;return h.createElement("text",Rr({},n,{dominantBaseline:"central",className:ce("recharts-radial-bar-label",o)}),h.createElement("defs",null,h.createElement("path",{id:N,d:S})),h.createElement("textPath",{xlinkHref:"#".concat(N)},r))},u8=(e,t,r)=>{var{cx:n,cy:i,innerRadius:s,outerRadius:o,startAngle:l,endAngle:c}=e,d=(l+c)/2;if(r==="outside"){var{x:u,y:f}=Je(n,i,o+t,d);return{x:u,y:f,textAnchor:u>=n?"start":"end",verticalAnchor:"middle"}}if(r==="center")return{x:n,y:i,textAnchor:"middle",verticalAnchor:"middle"};if(r==="centerTop")return{x:n,y:i,textAnchor:"middle",verticalAnchor:"start"};if(r==="centerBottom")return{x:n,y:i,textAnchor:"middle",verticalAnchor:"end"};var p=(s+o)/2,{x:m,y:x}=Je(n,i,p,d);return{x:m,y:x,textAnchor:"middle",verticalAnchor:"middle"}},mp=e=>"cx"in e&&Y(e.cx),d8=(e,t)=>{var{parentViewBox:r,offset:n,position:i}=e,s;r!=null&&!mp(r)&&(s=r);var{x:o,y:l,upperWidth:c,lowerWidth:d,height:u}=t,f=o,p=o+(c-d)/2,m=(f+p)/2,x=(c+d)/2,g=f+c/2,b=u>=0?1:-1,v=b*n,j=b>0?"end":"start",y=b>0?"start":"end",w=c>=0?1:-1,S=w*n,N=w>0?"end":"start",P=w>0?"start":"end";if(i==="top"){var _={x:f+c/2,y:l-v,textAnchor:"middle",verticalAnchor:j};return Ce(Ce({},_),s?{height:Math.max(l-s.y,0),width:c}:{})}if(i==="bottom"){var T={x:p+d/2,y:l+u+v,textAnchor:"middle",verticalAnchor:y};return Ce(Ce({},T),s?{height:Math.max(s.y+s.height-(l+u),0),width:d}:{})}if(i==="left"){var $={x:m-S,y:l+u/2,textAnchor:N,verticalAnchor:"middle"};return Ce(Ce({},$),s?{width:Math.max($.x-s.x,0),height:u}:{})}if(i==="right"){var M={x:m+x+S,y:l+u/2,textAnchor:P,verticalAnchor:"middle"};return Ce(Ce({},M),s?{width:Math.max(s.x+s.width-M.x,0),height:u}:{})}var C=s?{width:x,height:u}:{};return i==="insideLeft"?Ce({x:m+S,y:l+u/2,textAnchor:P,verticalAnchor:"middle"},C):i==="insideRight"?Ce({x:m+x-S,y:l+u/2,textAnchor:N,verticalAnchor:"middle"},C):i==="insideTop"?Ce({x:f+c/2,y:l+v,textAnchor:"middle",verticalAnchor:y},C):i==="insideBottom"?Ce({x:p+d/2,y:l+u-v,textAnchor:"middle",verticalAnchor:j},C):i==="insideTopLeft"?Ce({x:f+S,y:l+v,textAnchor:P,verticalAnchor:y},C):i==="insideTopRight"?Ce({x:f+c-S,y:l+v,textAnchor:N,verticalAnchor:y},C):i==="insideBottomLeft"?Ce({x:p+S,y:l+u-v,textAnchor:P,verticalAnchor:j},C):i==="insideBottomRight"?Ce({x:p+d-S,y:l+u-v,textAnchor:N,verticalAnchor:j},C):i&&typeof i=="object"&&(Y(i.x)||Qr(i.x))&&(Y(i.y)||Qr(i.y))?Ce({x:o+Rn(i.x,x),y:l+Rn(i.y,u),textAnchor:"end",verticalAnchor:"end"},C):Ce({x:g,y:l+u/2,textAnchor:"middle",verticalAnchor:"middle"},C)},f8={offset:5,zIndex:lt.label};function yn(e){var t=ft(e,f8),{viewBox:r,position:n,value:i,children:s,content:o,className:l="",textBreakAll:c,labelRef:d}=t,u=s8(),f=_N(),p=n==="center"?f:u??f,m,x,g;if(r==null?m=p:mp(r)?m=r:m=Rw(r),!m||Re(i)&&Re(s)&&!h.isValidElement(o)&&typeof o!="function")return null;var b=Ce(Ce({},t),{},{viewBox:m});if(h.isValidElement(o)){var{labelRef:v}=b,j=QL(b,JL);return h.cloneElement(o,j)}if(typeof o=="function"){if(x=h.createElement(o,b),h.isValidElement(x))return x}else x=o8(t);var y=ut(t);if(mp(m)){if(n==="insideStart"||n==="insideEnd"||n==="end")return c8(t,n,x,y,m);g=u8(m,t.offset,t.position)}else g=d8(t,m);return h.createElement(Ir,{zIndex:t.zIndex},h.createElement(Jm,Rr({ref:d,className:ce("recharts-label",l)},y,g,{textAnchor:VL(y.textAnchor)?y.textAnchor:g.textAnchor,breakAll:c}),x))}yn.displayName="Label";var p8=(e,t,r)=>{if(!e)return null;var n={viewBox:t,labelRef:r};return e===!0?h.createElement(yn,Rr({key:"label-implicit"},n)):Or(e)?h.createElement(yn,Rr({key:"label-implicit",value:e},n)):h.isValidElement(e)?e.type===yn?h.cloneElement(e,Ce({key:"label-implicit"},n)):h.createElement(yn,Rr({key:"label-implicit",content:e},n)):Qm(e)?h.createElement(yn,Rr({key:"label-implicit",content:e},n)):e&&typeof e=="object"?h.createElement(yn,Rr({},e,{key:"label-implicit"},n)):null};function h8(e){var{label:t,labelRef:r}=e,n=_N();return p8(t,n,r)||null}var CN={},AN={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return r[r.length-1]}e.last=t})(AN);var ON={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return Array.isArray(r)?r:Array.from(r)}e.toArray=t})(ON);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=AN,r=ON,n=Jc;function i(s){if(n.isArrayLike(s))return t.last(r.toArray(s))}e.last=i})(CN);var m8=CN.last;const g8=Tr(m8);var x8=["valueAccessor"],y8=["dataKey","clockWise","id","textBreakAll","zIndex"];function hc(){return hc=Object.assign?Object.assign.bind():function(e){for(var t=1;tArray.isArray(e.value)?g8(e.value):e.value,EN=h.createContext(void 0),DN=EN.Provider,TN=h.createContext(void 0);TN.Provider;function j8(){return h.useContext(EN)}function w8(){return h.useContext(TN)}function cl(e){var{valueAccessor:t=b8}=e,r=Jy(e,x8),{dataKey:n,clockWise:i,id:s,textBreakAll:o,zIndex:l}=r,c=Jy(r,y8),d=j8(),u=w8(),f=d||u;return!f||!f.length?null:h.createElement(Ir,{zIndex:l??lt.label},h.createElement(ir,{className:"recharts-label-list"},f.map((p,m)=>{var x,g=Re(n)?t(p,m):et(p&&p.payload,n),b=Re(s)?{}:{id:"".concat(s,"-").concat(m)};return h.createElement(yn,hc({key:"label-".concat(m)},ut(p),c,b,{fill:(x=r.fill)!==null&&x!==void 0?x:p.fill,parentViewBox:p.parentViewBox,value:g,textBreakAll:o,viewBox:p.viewBox,index:m,zIndex:0}))})))}cl.displayName="LabelList";function MN(e){var{label:t}=e;return t?t===!0?h.createElement(cl,{key:"labelList-implicit"}):h.isValidElement(t)||Qm(t)?h.createElement(cl,{key:"labelList-implicit",content:t}):typeof t=="object"?h.createElement(cl,hc({key:"labelList-implicit"},t,{type:String(t.type)})):null:null}function gp(){return gp=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{cx:t,cy:r,r:n,className:i}=e,s=ce("recharts-dot",i);return Y(t)&&Y(r)&&Y(n)?h.createElement("circle",gp({},nr(e),Ih(e),{className:s,cx:t,cy:r,r:n})):null},S8={radiusAxis:{},angleAxis:{}},$N=At({name:"polarAxis",initialState:S8,reducers:{addRadiusAxis(e,t){e.radiusAxis[t.payload.id]=t.payload},removeRadiusAxis(e,t){delete e.radiusAxis[t.payload.id]},addAngleAxis(e,t){e.angleAxis[t.payload.id]=t.payload},removeAngleAxis(e,t){delete e.angleAxis[t.payload.id]}}}),{addRadiusAxis:OF,removeRadiusAxis:EF,addAngleAxis:DF,removeAngleAxis:TF}=$N.actions,N8=$N.reducer,eg=e=>e&&typeof e=="object"&&"clipDot"in e?!!e.clipDot:!0,LN={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){var i;if(typeof r!="object"||r==null)return!1;if(Object.getPrototypeOf(r)===null)return!0;if(Object.prototype.toString.call(r)!=="[object Object]"){const s=r[Symbol.toStringTag];return s==null||!((i=Object.getOwnPropertyDescriptor(r,Symbol.toStringTag))!=null&&i.writable)?!1:r.toString()===`[object ${s}]`}let n=r;for(;Object.getPrototypeOf(n)!==null;)n=Object.getPrototypeOf(n);return Object.getPrototypeOf(r)===n}e.isPlainObject=t})(LN);var k8=LN.isPlainObject;const P8=Tr(k8);function Qy(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function ev(e){for(var t=1;t{var s=r-n,o;return o="M ".concat(e,",").concat(t),o+="L ".concat(e+r,",").concat(t),o+="L ".concat(e+r-s/2,",").concat(t+i),o+="L ".concat(e+r-s/2-n,",").concat(t+i),o+="L ".concat(e,",").concat(t," Z"),o},O8={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},E8=e=>{var t=ft(e,O8),{x:r,y:n,upperWidth:i,lowerWidth:s,height:o,className:l}=t,{animationEasing:c,animationDuration:d,animationBegin:u,isUpdateAnimationActive:f}=t,p=h.useRef(null),[m,x]=h.useState(-1),g=h.useRef(i),b=h.useRef(s),v=h.useRef(o),j=h.useRef(r),y=h.useRef(n),w=pu(e,"trapezoid-");if(h.useEffect(()=>{if(p.current&&p.current.getTotalLength)try{var q=p.current.getTotalLength();q&&x(q)}catch{}},[]),r!==+r||n!==+n||i!==+i||s!==+s||o!==+o||i===0&&s===0||o===0)return null;var S=ce("recharts-trapezoid",l);if(!f)return h.createElement("g",null,h.createElement("path",mc({},ut(t),{className:S,d:tv(r,n,i,s,o)})));var N=g.current,P=b.current,_=v.current,T=j.current,$=y.current,M="0px ".concat(m===-1?1:m,"px"),C="".concat(m,"px 0px"),R=Hw(["strokeDasharray"],d,c);return h.createElement(fu,{animationId:w,key:w,canBegin:m>0,duration:d,easing:c,isActive:f,begin:u},q=>{var Z=De(N,i,q),E=De(P,s,q),D=De(_,o,q),O=De(T,r,q),k=De($,n,q);p.current&&(g.current=Z,b.current=E,v.current=D,j.current=O,y.current=k);var L=q>0?{transition:R,strokeDasharray:C}:{strokeDasharray:M};return h.createElement("path",mc({},ut(t),{className:S,d:tv(O,k,Z,E,D),ref:p,style:ev(ev({},L),t.style)}))})},D8=["option","shapeType","propTransformer","activeClassName","isActive"];function T8(e,t){if(e==null)return{};var r,n,i=M8(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n{if(!i){var s=t(r);return n(NI(s)),()=>{n(kI(s))}}},[t,r,n,i]),null}function RN(e){var{legendPayload:t}=e,r=Ve(),n=pt();return h.useLayoutEffect(()=>n?Pa:(r(o3(t)),()=>{r(l3(t))}),[r,n,t]),null}var kd,W8=()=>{var[e]=h.useState(()=>Ts("uid-"));return e},U8=(kd=Tv.useId)!==null&&kd!==void 0?kd:W8;function BN(e,t){var r=U8();return t||(e?"".concat(e,"-").concat(r):r)}var q8=h.createContext(void 0),FN=e=>{var{id:t,type:r,children:n}=e,i=BN("recharts-".concat(r),t);return h.createElement(q8.Provider,{value:i},n(i))},H8={cartesianItems:[],polarItems:[]},WN=At({name:"graphicalItems",initialState:H8,reducers:{addCartesianGraphicalItem:{reducer(e,t){e.cartesianItems.push(t.payload)},prepare:Le()},replaceCartesianGraphicalItem:{reducer(e,t){var{prev:r,next:n}=t.payload,i=Kr(e).cartesianItems.indexOf(r);i>-1&&(e.cartesianItems[i]=n)},prepare:Le()},removeCartesianGraphicalItem:{reducer(e,t){var r=Kr(e).cartesianItems.indexOf(t.payload);r>-1&&e.cartesianItems.splice(r,1)},prepare:Le()},addPolarGraphicalItem:{reducer(e,t){e.polarItems.push(t.payload)},prepare:Le()},removePolarGraphicalItem:{reducer(e,t){var r=Kr(e).polarItems.indexOf(t.payload);r>-1&&e.polarItems.splice(r,1)},prepare:Le()}}}),{addCartesianGraphicalItem:K8,replaceCartesianGraphicalItem:V8,removeCartesianGraphicalItem:Y8,addPolarGraphicalItem:MF,removePolarGraphicalItem:IF}=WN.actions,G8=WN.reducer;function UN(e){var t=Ve(),r=h.useRef(null);return h.useLayoutEffect(()=>{r.current===null?t(K8(e)):r.current!==e&&t(V8({prev:r.current,next:e})),r.current=e},[t,e]),h.useLayoutEffect(()=>()=>{r.current&&(t(Y8(r.current)),r.current=null)},[t]),null}var Z8=["points"];function iv(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Pd(e){for(var t=1;t{var b,v,j=Pd(Pd(Pd({r:3},o),f),{},{index:g,cx:(b=x.x)!==null&&b!==void 0?b:void 0,cy:(v=x.y)!==null&&v!==void 0?v:void 0,dataKey:s,value:x.value,payload:x.payload,points:t});return h.createElement(rz,{key:"dot-".concat(g),option:r,dotProps:j,className:i})}),m={};return l&&c!=null&&(m.clipPath="url(#clipPath-".concat(u?"":"dots-").concat(c,")")),h.createElement(Ir,{zIndex:d},h.createElement(ir,xc({className:n},m),p))}function av(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function sv(e){for(var t=1;t({top:e.top,bottom:e.bottom,left:e.left,right:e.right})),mz=I([hz,ln,cn],(e,t,r)=>{if(!(!e||t==null||r==null))return{x:e.left,y:e.top,width:Math.max(0,t-e.left-e.right),height:Math.max(0,r-e.top-e.bottom)}}),Mu=()=>G(mz),gz=()=>G(h$);function ov(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function _d(e){for(var t=1;t{var{point:t,childIndex:r,mainColor:n,activeDot:i,dataKey:s}=e;if(i===!1||t.x==null||t.y==null)return null;var o={index:r,dataKey:s,cx:t.x,cy:t.y,r:4,fill:n??"none",strokeWidth:2,stroke:"#fff",payload:t.payload,value:t.value},l=_d(_d(_d({},o),qc(i)),Ih(i)),c;return h.isValidElement(i)?c=h.cloneElement(i,l):typeof i=="function"?c=i(l):c=h.createElement(IN,l),h.createElement(ir,{className:"recharts-active-dot"},c)};function xp(e){var{points:t,mainColor:r,activeDot:n,itemDataKey:i,zIndex:s=lt.activeDot}=e,o=G(Us),l=gz();if(t==null||l==null)return null;var c=t.find(d=>l.includes(d.payload));return Re(c)?null:h.createElement(Ir,{zIndex:s},h.createElement(bz,{point:c,childIndex:Number(o),mainColor:r,dataKey:i,activeDot:n}))}var jz={},KN=At({name:"errorBars",initialState:jz,reducers:{addErrorBar:(e,t)=>{var{itemId:r,errorBar:n}=t.payload;e[r]||(e[r]=[]),e[r].push(n)},replaceErrorBar:(e,t)=>{var{itemId:r,prev:n,next:i}=t.payload;e[r]&&(e[r]=e[r].map(s=>s.dataKey===n.dataKey&&s.direction===n.direction?i:s))},removeErrorBar:(e,t)=>{var{itemId:r,errorBar:n}=t.payload;e[r]&&(e[r]=e[r].filter(i=>i.dataKey!==n.dataKey||i.direction!==n.direction))}}}),{addErrorBar:zF,replaceErrorBar:RF,removeErrorBar:BF}=KN.actions,wz=KN.reducer,Sz=["children"];function Nz(e,t){if(e==null)return{};var r,n,i=kz(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n({x:0,y:0,value:0}),errorBarOffset:0},_z=h.createContext(Pz);function Cz(e){var{children:t}=e,r=Nz(e,Sz);return h.createElement(_z.Provider,{value:r},t)}function tg(e,t){var r,n,i=G(d=>dn(d,e)),s=G(d=>fn(d,t)),o=(r=i==null?void 0:i.allowDataOverflow)!==null&&r!==void 0?r:Tt.allowDataOverflow,l=(n=s==null?void 0:s.allowDataOverflow)!==null&&n!==void 0?n:Mt.allowDataOverflow,c=o||l;return{needClip:c,needClipX:o,needClipY:l}}function VN(e){var{xAxisId:t,yAxisId:r,clipPathId:n}=e,i=Mu(),{needClipX:s,needClipY:o,needClip:l}=tg(t,r);if(!l||!i)return null;var{x:c,y:d,width:u,height:f}=i;return h.createElement("clipPath",{id:"clipPath-".concat(n)},h.createElement("rect",{x:s?c:c-u/2,y:o?d:d-f/2,width:s?u:u*2,height:o?f:f*2}))}var Az=e=>{var{chartData:t}=e,r=Ve(),n=pt();return h.useEffect(()=>n?()=>{}:(r(Iy(t)),()=>{r(Iy(void 0))}),[t,r,n]),null},lv={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},YN=At({name:"brush",initialState:lv,reducers:{setBrushSettings(e,t){return t.payload==null?lv:t.payload}}}),{setBrushSettings:FF}=YN.actions,Oz=YN.reducer;function Ez(e,t,r){return(t=Dz(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Dz(e){var t=Tz(e,"string");return typeof t=="symbol"?t:t+""}function Tz(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}class rg{static create(t){return new rg(t)}constructor(t){this.scale=t}get domain(){return this.scale.domain}get range(){return this.scale.range}get rangeMin(){return this.range()[0]}get rangeMax(){return this.range()[1]}get bandwidth(){return this.scale.bandwidth}apply(t){var{bandAware:r,position:n}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(t!==void 0){if(n)switch(n){case"start":return this.scale(t);case"middle":{var i=this.bandwidth?this.bandwidth()/2:0;return this.scale(t)+i}case"end":{var s=this.bandwidth?this.bandwidth():0;return this.scale(t)+s}default:return this.scale(t)}if(r){var o=this.bandwidth?this.bandwidth()/2:0;return this.scale(t)+o}return this.scale(t)}}isInRange(t){var r=this.range(),n=r[0],i=r[r.length-1];return n<=i?t>=n&&t<=i:t>=i&&t<=n}}Ez(rg,"EPS",1e-4);function Mz(e){return(e%180+180)%180}var Iz=function(t){var{width:r,height:n}=t,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,s=Mz(i),o=s*Math.PI/180,l=Math.atan(n/r),c=o>l&&o{e.dots.push(t.payload)},removeDot:(e,t)=>{var r=Kr(e).dots.findIndex(n=>n===t.payload);r!==-1&&e.dots.splice(r,1)},addArea:(e,t)=>{e.areas.push(t.payload)},removeArea:(e,t)=>{var r=Kr(e).areas.findIndex(n=>n===t.payload);r!==-1&&e.areas.splice(r,1)},addLine:(e,t)=>{e.lines.push(t.payload)},removeLine:(e,t)=>{var r=Kr(e).lines.findIndex(n=>n===t.payload);r!==-1&&e.lines.splice(r,1)}}}),{addDot:WF,removeDot:UF,addArea:qF,removeArea:HF,addLine:KF,removeLine:VF}=GN.actions,Lz=GN.reducer,zz=h.createContext(void 0),Rz=e=>{var{children:t}=e,[r]=h.useState("".concat(Ts("recharts"),"-clip")),n=Mu();if(n==null)return null;var{x:i,y:s,width:o,height:l}=n;return h.createElement(zz.Provider,{value:r},h.createElement("defs",null,h.createElement("clipPath",{id:r},h.createElement("rect",{x:i,y:s,height:l,width:o}))),t)};function va(e,t){for(var r in e)if({}.hasOwnProperty.call(e,r)&&(!{}.hasOwnProperty.call(t,r)||e[r]!==t[r]))return!1;for(var n in t)if({}.hasOwnProperty.call(t,n)&&!{}.hasOwnProperty.call(e,n))return!1;return!0}function ZN(e,t){if(t<1)return[];if(t===1)return e;for(var r=[],n=0;ne*i)return!1;var s=r();return e*(t-e*s/2-n)>=0&&e*(t+e*s/2-i)<=0}function Wz(e,t){return ZN(e,t+1)}function Uz(e,t,r,n,i){for(var s=(n||[]).slice(),{start:o,end:l}=t,c=0,d=1,u=o,f=function(){var x=n==null?void 0:n[c];if(x===void 0)return{v:ZN(n,d)};var g=c,b,v=()=>(b===void 0&&(b=r(x,g)),b),j=x.coordinate,y=c===0||yc(e,j,v,u,l);y||(c=0,u=o,d+=1),y&&(u=j+e*(v()/2+i),c+=d)},p;d<=s.length;)if(p=f(),p)return p.v;return[]}function cv(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function at(e){for(var t=1;t(x===void 0&&(x=r(m,p)),x);if(p===o-1){var b=e*(m.coordinate+e*g()/2-c);s[p]=m=at(at({},m),{},{tickCoord:b>0?m.coordinate-b*e:m.coordinate})}else s[p]=m=at(at({},m),{},{tickCoord:m.coordinate});if(m.tickCoord!=null){var v=yc(e,m.tickCoord,g,l,c);v&&(c=m.tickCoord-e*(g()/2+i),s[p]=at(at({},m),{},{isShow:!0}))}},u=o-1;u>=0;u--)d(u);return s}function Yz(e,t,r,n,i,s){var o=(n||[]).slice(),l=o.length,{start:c,end:d}=t;if(s){var u=n[l-1],f=r(u,l-1),p=e*(u.coordinate+e*f/2-d);if(o[l-1]=u=at(at({},u),{},{tickCoord:p>0?u.coordinate-p*e:u.coordinate}),u.tickCoord!=null){var m=yc(e,u.tickCoord,()=>f,c,d);m&&(d=u.tickCoord-e*(f/2+i),o[l-1]=at(at({},u),{},{isShow:!0}))}}for(var x=s?l-1:l,g=function(j){var y=o[j],w,S=()=>(w===void 0&&(w=r(y,j)),w);if(j===0){var N=e*(y.coordinate-e*S()/2-c);o[j]=y=at(at({},y),{},{tickCoord:N<0?y.coordinate-N*e:y.coordinate})}else o[j]=y=at(at({},y),{},{tickCoord:y.coordinate});if(y.tickCoord!=null){var P=yc(e,y.tickCoord,S,c,d);P&&(c=y.tickCoord+e*(S()/2+i),o[j]=at(at({},y),{},{isShow:!0}))}},b=0;b{var S=typeof d=="function"?d(y.value,w):y.value;return x==="width"?Bz(fs(S,{fontSize:t,letterSpacing:r}),g,f):fs(S,{fontSize:t,letterSpacing:r})[x]},v=i.length>=2?Jt(i[1].coordinate-i[0].coordinate):1,j=Fz(s,v,x);return c==="equidistantPreserveStart"?Uz(v,j,b,i,o):(c==="preserveStart"||c==="preserveStartEnd"?m=Yz(v,j,b,i,o,c==="preserveStartEnd"):m=Vz(v,j,b,i,o),m.filter(y=>y.isShow))}var Gz=e=>{var{ticks:t,label:r,labelGapWithTick:n=5,tickSize:i=0,tickMargin:s=0}=e,o=0;if(t){Array.from(t).forEach(u=>{if(u){var f=u.getBoundingClientRect();f.width>o&&(o=f.width)}});var l=r?r.getBoundingClientRect().width:0,c=i+s,d=o+c+l+(r?n:0);return Math.round(d)}return 0},Zz=["axisLine","width","height","className","hide","ticks","axisType"],Xz=["viewBox"],Jz=["viewBox"];function yp(e,t){if(e==null)return{};var r,n,i=Qz(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n{var{ticks:r=[],tick:n,tickLine:i,stroke:s,tickFormatter:o,unit:l,padding:c,tickTextProps:d,orientation:u,mirror:f,x:p,y:m,width:x,height:g,tickSize:b,tickMargin:v,fontSize:j,letterSpacing:y,getTicksConfig:w,events:S,axisType:N}=e,P=ng(Ee(Ee({},w),{},{ticks:r}),j,y),_=aR(u,f),T=sR(u,f),$=nr(w),M=qc(n),C={};typeof i=="object"&&(C=i);var R=Ee(Ee({},$),{},{fill:"none"},C),q=P.map(D=>Ee({entry:D},iR(D,p,m,x,g,u,b,f,v))),Z=q.map(D=>{var{entry:O,line:k}=D;return h.createElement(ir,{className:"recharts-cartesian-axis-tick",key:"tick-".concat(O.value,"-").concat(O.coordinate,"-").concat(O.tickCoord)},i&&h.createElement("line",Si({},R,k,{className:ce("recharts-cartesian-axis-tick-line",Xc(i,"className"))})))}),E=q.map((D,O)=>{var{entry:k,tick:L}=D,F=Ee(Ee(Ee(Ee({textAnchor:_,verticalAnchor:T},$),{},{stroke:"none",fill:s},M),L),{},{index:O,payload:k,visibleTicksCount:P.length,tickFormatter:o,padding:c},d);return h.createElement(ir,Si({className:"recharts-cartesian-axis-tick-label",key:"tick-label-".concat(k.value,"-").concat(k.coordinate,"-").concat(k.tickCoord)},X6(S,k,O)),n&&h.createElement(oR,{option:n,tickProps:F,value:"".concat(typeof o=="function"?o(k.value,O):k.value).concat(l||"")}))});return h.createElement("g",{className:"recharts-cartesian-axis-ticks recharts-".concat(N,"-ticks")},E.length>0&&h.createElement(Ir,{zIndex:lt.label},h.createElement("g",{className:"recharts-cartesian-axis-tick-labels recharts-".concat(N,"-tick-labels"),ref:t},E)),Z.length>0&&h.createElement("g",{className:"recharts-cartesian-axis-tick-lines recharts-".concat(N,"-tick-lines")},Z))}),cR=h.forwardRef((e,t)=>{var{axisLine:r,width:n,height:i,className:s,hide:o,ticks:l,axisType:c}=e,d=yp(e,Zz),[u,f]=h.useState(""),[p,m]=h.useState(""),x=h.useRef(null);h.useImperativeHandle(t,()=>({getCalculatedWidth:()=>{var b;return Gz({ticks:x.current,label:(b=e.labelRef)===null||b===void 0?void 0:b.current,labelGapWithTick:5,tickSize:e.tickSize,tickMargin:e.tickMargin})}}));var g=h.useCallback(b=>{if(b){var v=b.getElementsByClassName("recharts-cartesian-axis-tick-value");x.current=v;var j=v[0];if(j){var y=window.getComputedStyle(j),w=y.fontSize,S=y.letterSpacing;(w!==u||S!==p)&&(f(w),m(S))}}},[u,p]);return o||n!=null&&n<=0||i!=null&&i<=0?null:h.createElement(Ir,{zIndex:e.zIndex},h.createElement(ir,{className:ce("recharts-cartesian-axis",s)},h.createElement(nR,{x:e.x,y:e.y,width:n,height:i,orientation:e.orientation,mirror:e.mirror,axisLine:r,otherSvgProps:nr(e)}),h.createElement(lR,{ref:g,axisType:c,events:d,fontSize:u,getTicksConfig:e,height:e.height,letterSpacing:p,mirror:e.mirror,orientation:e.orientation,padding:e.padding,stroke:e.stroke,tick:e.tick,tickFormatter:e.tickFormatter,tickLine:e.tickLine,tickMargin:e.tickMargin,tickSize:e.tickSize,tickTextProps:e.tickTextProps,ticks:l,unit:e.unit,width:e.width,x:e.x,y:e.y}),h.createElement(i8,{x:e.x,y:e.y,width:e.width,height:e.height,lowerWidth:e.width,upperWidth:e.width},h.createElement(h8,{label:e.label,labelRef:e.labelRef}),e.children)))}),uR=h.memo(cR,(e,t)=>{var{viewBox:r}=e,n=yp(e,Xz),{viewBox:i}=t,s=yp(t,Jz);return va(r,i)&&va(n,s)}),ag=h.forwardRef((e,t)=>{var r=ft(e,ig);return h.createElement(uR,Si({},r,{ref:t}))});ag.displayName="CartesianAxis";var dR=["x1","y1","x2","y2","key"],fR=["offset"],pR=["xAxisId","yAxisId"],hR=["xAxisId","yAxisId"];function dv(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function ot(e){for(var t=1;t{var{fill:t}=e;if(!t||t==="none")return null;var{fillOpacity:r,x:n,y:i,width:s,height:o,ry:l}=e;return h.createElement("rect",{x:n,y:i,ry:l,width:s,height:o,stroke:"none",fill:t,fillOpacity:r,className:"recharts-cartesian-grid-bg"})};function XN(e){var{option:t,lineItemProps:r}=e,n;if(h.isValidElement(t))n=h.cloneElement(t,r);else if(typeof t=="function")n=t(r);else{var i,{x1:s,y1:o,x2:l,y2:c,key:d}=r,u=vc(r,dR),f=(i=nr(u))!==null&&i!==void 0?i:{},{offset:p}=f,m=vc(f,fR);n=h.createElement("line",ai({},m,{x1:s,y1:o,x2:l,y2:c,fill:"none",key:d}))}return n}function bR(e){var{x:t,width:r,horizontal:n=!0,horizontalPoints:i}=e;if(!n||!i||!i.length)return null;var{xAxisId:s,yAxisId:o}=e,l=vc(e,pR),c=i.map((d,u)=>{var f=ot(ot({},l),{},{x1:t,y1:d,x2:t+r,y2:d,key:"line-".concat(u),index:u});return h.createElement(XN,{key:"line-".concat(u),option:n,lineItemProps:f})});return h.createElement("g",{className:"recharts-cartesian-grid-horizontal"},c)}function jR(e){var{y:t,height:r,vertical:n=!0,verticalPoints:i}=e;if(!n||!i||!i.length)return null;var{xAxisId:s,yAxisId:o}=e,l=vc(e,hR),c=i.map((d,u)=>{var f=ot(ot({},l),{},{x1:d,y1:t,x2:d,y2:t+r,key:"line-".concat(u),index:u});return h.createElement(XN,{option:n,lineItemProps:f,key:"line-".concat(u)})});return h.createElement("g",{className:"recharts-cartesian-grid-vertical"},c)}function wR(e){var{horizontalFill:t,fillOpacity:r,x:n,y:i,width:s,height:o,horizontalPoints:l,horizontal:c=!0}=e;if(!c||!t||!t.length||l==null)return null;var d=l.map(f=>Math.round(f+i-i)).sort((f,p)=>f-p);i!==d[0]&&d.unshift(0);var u=d.map((f,p)=>{var m=!d[p+1],x=m?i+o-f:d[p+1]-f;if(x<=0)return null;var g=p%t.length;return h.createElement("rect",{key:"react-".concat(p),y:f,x:n,height:x,width:s,stroke:"none",fill:t[g],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return h.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},u)}function SR(e){var{vertical:t=!0,verticalFill:r,fillOpacity:n,x:i,y:s,width:o,height:l,verticalPoints:c}=e;if(!t||!r||!r.length)return null;var d=c.map(f=>Math.round(f+i-i)).sort((f,p)=>f-p);i!==d[0]&&d.unshift(0);var u=d.map((f,p)=>{var m=!d[p+1],x=m?i+o-f:d[p+1]-f;if(x<=0)return null;var g=p%r.length;return h.createElement("rect",{key:"react-".concat(p),x:f,y:s,width:x,height:l,stroke:"none",fill:r[g],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return h.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},u)}var NR=(e,t)=>{var{xAxis:r,width:n,height:i,offset:s}=e;return Aw(ng(ot(ot(ot({},ig),r),{},{ticks:Ow(r),viewBox:{x:0,y:0,width:n,height:i}})),s.left,s.left+s.width,t)},kR=(e,t)=>{var{yAxis:r,width:n,height:i,offset:s}=e;return Aw(ng(ot(ot(ot({},ig),r),{},{ticks:Ow(r),viewBox:{x:0,y:0,width:n,height:i}})),s.top,s.top+s.height,t)},PR={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:lt.grid};function vp(e){var t=Fw(),r=Ww(),n=Bw(),i=ot(ot({},ft(e,PR)),{},{x:Y(e.x)?e.x:n.left,y:Y(e.y)?e.y:n.top,width:Y(e.width)?e.width:n.width,height:Y(e.height)?e.height:n.height}),{xAxisId:s,yAxisId:o,x:l,y:c,width:d,height:u,syncWithTicks:f,horizontalValues:p,verticalValues:m}=i,x=pt(),g=G(T=>Ny(T,"xAxis",s,x)),b=G(T=>Ny(T,"yAxis",o,x));if(!Er(d)||!Er(u)||!Y(l)||!Y(c))return null;var v=i.verticalCoordinatesGenerator||NR,j=i.horizontalCoordinatesGenerator||kR,{horizontalPoints:y,verticalPoints:w}=i;if((!y||!y.length)&&typeof j=="function"){var S=p&&p.length,N=j({yAxis:b?ot(ot({},b),{},{ticks:S?p:b.ticks}):void 0,width:t??d,height:r??u,offset:n},S?!0:f);Gl(Array.isArray(N),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(typeof N,"]")),Array.isArray(N)&&(y=N)}if((!w||!w.length)&&typeof v=="function"){var P=m&&m.length,_=v({xAxis:g?ot(ot({},g),{},{ticks:P?m:g.ticks}):void 0,width:t??d,height:r??u,offset:n},P?!0:f);Gl(Array.isArray(_),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(typeof _,"]")),Array.isArray(_)&&(w=_)}return h.createElement(Ir,{zIndex:i.zIndex},h.createElement("g",{className:"recharts-cartesian-grid"},h.createElement(vR,{fill:i.fill,fillOpacity:i.fillOpacity,x:i.x,y:i.y,width:i.width,height:i.height,ry:i.ry}),h.createElement(wR,ai({},i,{horizontalPoints:y})),h.createElement(SR,ai({},i,{verticalPoints:w})),h.createElement(bR,ai({},i,{offset:n,horizontalPoints:y,xAxis:g,yAxis:b})),h.createElement(jR,ai({},i,{offset:n,verticalPoints:w,xAxis:g,yAxis:b}))))}vp.displayName="CartesianGrid";var JN=(e,t,r,n)=>Du(e,"xAxis",t,n),QN=(e,t,r,n)=>Eu(e,"xAxis",t,n),ek=(e,t,r,n)=>Du(e,"yAxis",r,n),tk=(e,t,r,n)=>Eu(e,"yAxis",r,n),_R=I([ue,JN,ek,QN,tk],(e,t,r,n,i)=>Mr(e,"xAxis")?ma(t,n,!1):ma(r,i,!1)),CR=(e,t,r,n,i)=>i;function AR(e){return e.type==="line"}var OR=I([Mm,CR],(e,t)=>e.filter(AR).find(r=>r.id===t)),ER=I([ue,JN,ek,QN,tk,OR,_R,bu],(e,t,r,n,i,s,o,l)=>{var{chartData:c,dataStartIndex:d,dataEndIndex:u}=l;if(!(s==null||t==null||r==null||n==null||i==null||n.length===0||i.length===0||o==null)){var{dataKey:f,data:p}=s,m;if(p!=null&&p.length>0?m=p:m=c==null?void 0:c.slice(d,u+1),m!=null)return XR({layout:e,xAxis:t,yAxis:r,xAxisTicks:n,yAxisTicks:i,dataKey:f,bandSize:o,displayedData:m})}});function rk(e){var t=qc(e),r=3,n=2;if(t!=null){var{r:i,strokeWidth:s}=t,o=Number(i),l=Number(s);return(Number.isNaN(o)||o<0)&&(o=r),(Number.isNaN(l)||l<0)&&(l=n),{r:o,strokeWidth:l}}return{r,strokeWidth:n}}var DR=["id"],TR=["type","layout","connectNulls","needClip","shape"],MR=["activeDot","animateNewValues","animationBegin","animationDuration","animationEasing","connectNulls","dot","hide","isAnimationActive","label","legendType","xAxisId","yAxisId","id"];function Hs(){return Hs=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{dataKey:t,name:r,stroke:n,legendType:i,hide:s}=e;return[{inactive:s,dataKey:t,type:i,color:n,value:au(r,t),payload:e}]};function BR(e){var{dataKey:t,data:r,stroke:n,strokeWidth:i,fill:s,name:o,hide:l,unit:c}=e;return{dataDefinedOnItem:r,positions:void 0,settings:{stroke:n,strokeWidth:i,fill:s,dataKey:t,nameKey:void 0,name:au(o,t),hide:l,type:e.tooltipType,color:e.stroke,unit:c}}}var nk=(e,t)=>"".concat(t,"px ").concat(e-t,"px");function FR(e,t){for(var r=e.length%2!==0?[...e,0]:e,n=[],i=0;i{var n=r.reduce((f,p)=>f+p);if(!n)return nk(t,e);for(var i=Math.floor(e/n),s=e%n,o=t-e,l=[],c=0,d=0;cs){l=[...r.slice(0,c),s-d];break}var u=l.length%2===0?[0,o]:[o];return[...FR(r,i),...l,...u].map(f=>"".concat(f,"px")).join(", ")};function UR(e){var{clipPathId:t,points:r,props:n}=e,{dot:i,dataKey:s,needClip:o}=n,{id:l}=n,c=sg(n,DR),d=nr(c);return h.createElement(qN,{points:r,dot:i,className:"recharts-line-dots",dotClassName:"recharts-line-dot",dataKey:s,baseProps:d,needClip:o,clipPathId:t})}function qR(e){var{showLabels:t,children:r,points:n}=e,i=h.useMemo(()=>n==null?void 0:n.map(s=>{var o,l,c={x:(o=s.x)!==null&&o!==void 0?o:0,y:(l=s.y)!==null&&l!==void 0?l:0,width:0,lowerWidth:0,upperWidth:0,height:0};return wr(wr({},c),{},{value:s.value,payload:s.payload,viewBox:c,parentViewBox:void 0,fill:void 0})}),[n]);return h.createElement(DN,{value:t?i:void 0},r)}function pv(e){var{clipPathId:t,pathRef:r,points:n,strokeDasharray:i,props:s}=e,{type:o,layout:l,connectNulls:c,needClip:d,shape:u}=s,f=sg(s,TR),p=wr(wr({},ut(f)),{},{fill:"none",className:"recharts-line-curve",clipPath:d?"url(#clipPath-".concat(t,")"):void 0,points:n,type:o,layout:l,connectNulls:c,strokeDasharray:i??s.strokeDasharray});return h.createElement(h.Fragment,null,(n==null?void 0:n.length)>1&&h.createElement(F8,Hs({shapeType:"curve",option:u},p,{pathRef:r})),h.createElement(UR,{points:n,clipPathId:t,props:s}))}function HR(e){try{return e&&e.getTotalLength&&e.getTotalLength()||0}catch{return 0}}function KR(e){var{clipPathId:t,props:r,pathRef:n,previousPointsRef:i,longestAnimatedLengthRef:s}=e,{points:o,strokeDasharray:l,isAnimationActive:c,animationBegin:d,animationDuration:u,animationEasing:f,animateNewValues:p,width:m,height:x,onAnimationEnd:g,onAnimationStart:b}=r,v=i.current,j=pu(r,"recharts-line-"),[y,w]=h.useState(!1),S=!y,N=h.useCallback(()=>{typeof g=="function"&&g(),w(!1)},[g]),P=h.useCallback(()=>{typeof b=="function"&&b(),w(!0)},[b]),_=HR(n.current),T=s.current;return h.createElement(qR,{points:o,showLabels:S},r.children,h.createElement(fu,{animationId:j,begin:d,duration:u,isActive:c,easing:f,onAnimationEnd:N,onAnimationStart:P,key:j},$=>{var M=De(T,_+T,$),C=Math.min(M,_),R;if(c)if(l){var q="".concat(l).split(/[,\s]+/gim).map(D=>parseFloat(D));R=WR(C,_,q)}else R=nk(_,C);else R=l==null?void 0:String(l);if(v){var Z=v.length/o.length,E=$===1?o:o.map((D,O)=>{var k=Math.floor(O*Z);if(v[k]){var L=v[k];return wr(wr({},D),{},{x:De(L.x,D.x,$),y:De(L.y,D.y,$)})}return p?wr(wr({},D),{},{x:De(m*2,D.x,$),y:De(x/2,D.y,$)}):wr(wr({},D),{},{x:D.x,y:D.y})});return i.current=E,h.createElement(pv,{props:r,points:E,clipPathId:t,pathRef:n,strokeDasharray:R})}return $>0&&_>0&&(i.current=o,s.current=C),h.createElement(pv,{props:r,points:o,clipPathId:t,pathRef:n,strokeDasharray:R})}),h.createElement(MN,{label:r.label}))}function VR(e){var{clipPathId:t,props:r}=e,n=h.useRef(null),i=h.useRef(0),s=h.useRef(null);return h.createElement(KR,{props:r,clipPathId:t,previousPointsRef:n,longestAnimatedLengthRef:i,pathRef:s})}var YR=(e,t)=>{var r,n;return{x:(r=e.x)!==null&&r!==void 0?r:void 0,y:(n=e.y)!==null&&n!==void 0?n:void 0,value:e.value,errorVal:et(e.payload,t)}};class GR extends h.Component{render(){var{hide:t,dot:r,points:n,className:i,xAxisId:s,yAxisId:o,top:l,left:c,width:d,height:u,id:f,needClip:p,zIndex:m}=this.props;if(t)return null;var x=ce("recharts-line",i),g=f,{r:b,strokeWidth:v}=rk(r),j=eg(r),y=b*2+v;return h.createElement(Ir,{zIndex:m},h.createElement(ir,{className:x},p&&h.createElement("defs",null,h.createElement(VN,{clipPathId:g,xAxisId:s,yAxisId:o}),!j&&h.createElement("clipPath",{id:"clipPath-dots-".concat(g)},h.createElement("rect",{x:c-y/2,y:l-y/2,width:d+y,height:u+y}))),h.createElement(Cz,{xAxisId:s,yAxisId:o,data:n,dataPointFormatter:YR,errorBarOffset:0},h.createElement(VR,{props:this.props,clipPathId:g}))),h.createElement(xp,{activeDot:this.props.activeDot,points:n,mainColor:this.props.stroke,itemDataKey:this.props.dataKey}))}}var ik={activeDot:!0,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",connectNulls:!1,dot:!0,fill:"#fff",hide:!1,isAnimationActive:!Ci.isSsr,label:!1,legendType:"line",stroke:"#3182bd",strokeWidth:1,xAxisId:0,yAxisId:0,zIndex:lt.line};function ZR(e){var t=ft(e,ik),{activeDot:r,animateNewValues:n,animationBegin:i,animationDuration:s,animationEasing:o,connectNulls:l,dot:c,hide:d,isAnimationActive:u,label:f,legendType:p,xAxisId:m,yAxisId:x,id:g}=t,b=sg(t,MR),{needClip:v}=tg(m,x),j=Mu(),y=to(),w=pt(),S=G($=>ER($,m,x,w,g));if(y!=="horizontal"&&y!=="vertical"||S==null||j==null)return null;var{height:N,width:P,x:_,y:T}=j;return h.createElement(GR,Hs({},b,{id:g,connectNulls:l,dot:c,activeDot:r,animateNewValues:n,animationBegin:i,animationDuration:s,animationEasing:o,isAnimationActive:u,hide:d,label:f,legendType:p,xAxisId:m,yAxisId:x,points:S,layout:y,height:N,width:P,left:_,top:T,needClip:v}))}function XR(e){var{layout:t,xAxis:r,yAxis:n,xAxisTicks:i,yAxisTicks:s,dataKey:o,bandSize:l,displayedData:c}=e;return c.map((d,u)=>{var f=et(d,o);if(t==="horizontal"){var p=Yl({axis:r,ticks:i,bandSize:l,entry:d,index:u}),m=Re(f)?null:n.scale(f);return{x:p,y:m,value:f,payload:d}}var x=Re(f)?null:r.scale(f),g=Yl({axis:n,ticks:s,bandSize:l,entry:d,index:u});return x==null||g==null?null:{x,y:g,value:f,payload:d}}).filter(Boolean)}function JR(e){var t=ft(e,ik),r=pt();return h.createElement(FN,{id:t.id,type:"line"},n=>h.createElement(h.Fragment,null,h.createElement(RN,{legendPayload:RR(t)}),h.createElement(zN,{fn:BR,args:t}),h.createElement(UN,{type:"line",id:n,data:t.data,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,hide:t.hide,isPanorama:r}),h.createElement(ZR,Hs({},t,{id:n}))))}var ak=h.memo(JR);ak.displayName="Line";var sk=(e,t,r,n)=>Du(e,"xAxis",t,n),ok=(e,t,r,n)=>Eu(e,"xAxis",t,n),lk=(e,t,r,n)=>Du(e,"yAxis",r,n),ck=(e,t,r,n)=>Eu(e,"yAxis",r,n),QR=I([ue,sk,lk,ok,ck],(e,t,r,n,i)=>Mr(e,"xAxis")?ma(t,n,!1):ma(r,i,!1)),e9=(e,t,r,n,i)=>i,uk=I([Mm,e9],(e,t)=>e.filter(r=>r.type==="area").find(r=>r.id===t)),t9=(e,t,r,n,i)=>{var s,o=uk(e,t,r,n,i);if(o!=null){var l=ue(e),c=Mr(l,"xAxis"),d;if(c?d=cp(e,"yAxis",r,n):d=cp(e,"xAxis",t,n),d!=null){var{stackId:u}=o,f=Em(o);if(!(u==null||f==null)){var p=(s=d[u])===null||s===void 0?void 0:s.stackedData;return p==null?void 0:p.find(m=>m.key===f)}}}},r9=I([ue,sk,lk,ok,ck,t9,bu,QR,uk,mM],(e,t,r,n,i,s,o,l,c,d)=>{var{chartData:u,dataStartIndex:f,dataEndIndex:p}=o;if(!(c==null||e!=="horizontal"&&e!=="vertical"||t==null||r==null||n==null||i==null||n.length===0||i.length===0||l==null)){var{data:m}=c,x;if(m&&m.length>0?x=m:x=u==null?void 0:u.slice(f,p+1),x!=null)return j9({layout:e,xAxis:t,yAxis:r,xAxisTicks:n,yAxisTicks:i,dataStartIndex:f,areaSettings:c,stackedData:s,displayedData:x,chartBaseValue:d,bandSize:l})}}),n9=["id"],i9=["activeDot","animationBegin","animationDuration","animationEasing","connectNulls","dot","fill","fillOpacity","hide","isAnimationActive","legendType","stroke","xAxisId","yAxisId"];function fi(){return fi=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{dataKey:t,name:r,stroke:n,fill:i,legendType:s,hide:o}=e;return[{inactive:o,dataKey:t,type:s,color:bc(n,i),value:au(r,t),payload:e}]};function u9(e){var{dataKey:t,data:r,stroke:n,strokeWidth:i,fill:s,name:o,hide:l,unit:c}=e;return{dataDefinedOnItem:r,positions:void 0,settings:{stroke:n,strokeWidth:i,fill:s,dataKey:t,nameKey:void 0,name:au(o,t),hide:l,type:e.tooltipType,color:bc(n,s),unit:c}}}function d9(e){var{clipPathId:t,points:r,props:n}=e,{needClip:i,dot:s,dataKey:o}=n,l=nr(n);return h.createElement(qN,{points:r,dot:s,className:"recharts-area-dots",dotClassName:"recharts-area-dot",dataKey:o,baseProps:l,needClip:i,clipPathId:t})}function f9(e){var{showLabels:t,children:r,points:n}=e,i=n.map(s=>{var o,l,c={x:(o=s.x)!==null&&o!==void 0?o:0,y:(l=s.y)!==null&&l!==void 0?l:0,width:0,lowerWidth:0,upperWidth:0,height:0};return Zi(Zi({},c),{},{value:s.value,payload:s.payload,parentViewBox:void 0,viewBox:c,fill:void 0})});return h.createElement(DN,{value:t?i:void 0},r)}function mv(e){var{points:t,baseLine:r,needClip:n,clipPathId:i,props:s}=e,{layout:o,type:l,stroke:c,connectNulls:d,isRange:u}=s,{id:f}=s,p=dk(s,n9),m=nr(p),x=ut(p);return h.createElement(h.Fragment,null,(t==null?void 0:t.length)>1&&h.createElement(ir,{clipPath:n?"url(#clipPath-".concat(i,")"):void 0},h.createElement(ds,fi({},x,{id:f,points:t,connectNulls:d,type:l,baseLine:r,layout:o,stroke:"none",className:"recharts-area-area"})),c!=="none"&&h.createElement(ds,fi({},m,{className:"recharts-area-curve",layout:o,type:l,connectNulls:d,fill:"none",points:t})),c!=="none"&&u&&h.createElement(ds,fi({},m,{className:"recharts-area-curve",layout:o,type:l,connectNulls:d,fill:"none",points:r}))),h.createElement(d9,{points:t,props:p,clipPathId:i}))}function p9(e){var{alpha:t,baseLine:r,points:n,strokeWidth:i}=e,s=n[0].y,o=n[n.length-1].y;if(!_e(s)||!_e(o))return null;var l=t*Math.abs(s-o),c=Math.max(...n.map(d=>d.x||0));return Y(r)?c=Math.max(r,c):r&&Array.isArray(r)&&r.length&&(c=Math.max(...r.map(d=>d.x||0),c)),Y(c)?h.createElement("rect",{x:0,y:sd.y||0));return Y(r)?c=Math.max(r,c):r&&Array.isArray(r)&&r.length&&(c=Math.max(...r.map(d=>d.y||0),c)),Y(c)?h.createElement("rect",{x:s{typeof m=="function"&&m(),b(!1)},[m]),y=h.useCallback(()=>{typeof p=="function"&&p(),b(!0)},[p]),w=i.current,S=s.current;return h.createElement(f9,{showLabels:v,points:o},n.children,h.createElement(fu,{animationId:x,begin:d,duration:u,isActive:c,easing:f,onAnimationEnd:j,onAnimationStart:y,key:x},N=>{if(w){var P=w.length/o.length,_=N===1?o:o.map(($,M)=>{var C=Math.floor(M*P);if(w[C]){var R=w[C];return Zi(Zi({},$),{},{x:De(R.x,$.x,N),y:De(R.y,$.y,N)})}return $}),T;return Y(l)?T=De(S,l,N):Re(l)||yr(l)?T=De(S,0,N):T=l.map(($,M)=>{var C=Math.floor(M*P);if(Array.isArray(S)&&S[C]){var R=S[C];return Zi(Zi({},$),{},{x:De(R.x,$.x,N),y:De(R.y,$.y,N)})}return $}),N>0&&(i.current=_,s.current=T),h.createElement(mv,{points:_,baseLine:T,needClip:t,clipPathId:r,props:n})}return N>0&&(i.current=o,s.current=l),h.createElement(ir,null,c&&h.createElement("defs",null,h.createElement("clipPath",{id:"animationClipPath-".concat(r)},h.createElement(m9,{alpha:N,points:o,baseLine:l,layout:n.layout,strokeWidth:n.strokeWidth}))),h.createElement(ir,{clipPath:"url(#animationClipPath-".concat(r,")")},h.createElement(mv,{points:o,baseLine:l,needClip:t,clipPathId:r,props:n})))}),h.createElement(MN,{label:n.label}))}function x9(e){var{needClip:t,clipPathId:r,props:n}=e,i=h.useRef(null),s=h.useRef();return h.createElement(g9,{needClip:t,clipPathId:r,props:n,previousPointsRef:i,previousBaselineRef:s})}class y9 extends h.PureComponent{render(){var{hide:t,dot:r,points:n,className:i,top:s,left:o,needClip:l,xAxisId:c,yAxisId:d,width:u,height:f,id:p,baseLine:m,zIndex:x}=this.props;if(t)return null;var g=ce("recharts-area",i),b=p,{r:v,strokeWidth:j}=rk(r),y=eg(r),w=v*2+j;return h.createElement(Ir,{zIndex:x},h.createElement(ir,{className:g},l&&h.createElement("defs",null,h.createElement(VN,{clipPathId:b,xAxisId:c,yAxisId:d}),!y&&h.createElement("clipPath",{id:"clipPath-dots-".concat(b)},h.createElement("rect",{x:o-w/2,y:s-w/2,width:u+w,height:f+w}))),h.createElement(x9,{needClip:l,clipPathId:b,props:this.props})),h.createElement(xp,{points:n,mainColor:bc(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot}),this.props.isRange&&Array.isArray(m)&&h.createElement(xp,{points:m,mainColor:bc(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot}))}}var fk={activeDot:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",connectNulls:!1,dot:!1,fill:"#3182bd",fillOpacity:.6,hide:!1,isAnimationActive:!Ci.isSsr,legendType:"line",stroke:"#3182bd",xAxisId:0,yAxisId:0,zIndex:lt.area};function v9(e){var t,r=ft(e,fk),{activeDot:n,animationBegin:i,animationDuration:s,animationEasing:o,connectNulls:l,dot:c,fill:d,fillOpacity:u,hide:f,isAnimationActive:p,legendType:m,stroke:x,xAxisId:g,yAxisId:b}=r,v=dk(r,i9),j=to(),y=oN(),{needClip:w}=tg(g,b),S=pt(),{points:N,isRange:P,baseLine:_}=(t=G(q=>r9(q,g,b,S,e.id)))!==null&&t!==void 0?t:{},T=Mu();if(j!=="horizontal"&&j!=="vertical"||T==null||y!=="AreaChart"&&y!=="ComposedChart")return null;var{height:$,width:M,x:C,y:R}=T;return!N||!N.length?null:h.createElement(y9,fi({},v,{activeDot:n,animationBegin:i,animationDuration:s,animationEasing:o,baseLine:_,connectNulls:l,dot:c,fill:d,fillOpacity:u,height:$,hide:f,layout:j,isAnimationActive:p,isRange:P,legendType:m,needClip:w,points:N,stroke:x,width:M,left:C,top:R,xAxisId:g,yAxisId:b}))}var b9=(e,t,r,n,i)=>{var s=r??t;if(Y(s))return s;var o=e==="horizontal"?i:n,l=o.scale.domain();if(o.type==="number"){var c=Math.max(l[0],l[1]),d=Math.min(l[0],l[1]);return s==="dataMin"?d:s==="dataMax"||c<0?c:Math.max(Math.min(l[0],l[1]),0)}return s==="dataMin"?l[0]:s==="dataMax"?l[1]:l[0]};function j9(e){var{areaSettings:{connectNulls:t,baseValue:r,dataKey:n},stackedData:i,layout:s,chartBaseValue:o,xAxis:l,yAxis:c,displayedData:d,dataStartIndex:u,xAxisTicks:f,yAxisTicks:p,bandSize:m}=e,x=i&&i.length,g=b9(s,o,r,l,c),b=s==="horizontal",v=!1,j=d.map((w,S)=>{var N;x?N=i[u+S]:(N=et(w,n),Array.isArray(N)?v=!0:N=[g,N]);var P=N[1]==null||x&&!t&&et(w,n)==null;return b?{x:Yl({axis:l,ticks:f,bandSize:m,entry:w,index:S}),y:P?null:c.scale(N[1]),value:N,payload:w}:{x:P?null:l.scale(N[1]),y:Yl({axis:c,ticks:p,bandSize:m,entry:w,index:S}),value:N,payload:w}}),y;return x||v?y=j.map(w=>{var S=Array.isArray(w.value)?w.value[0]:null;return b?{x:w.x,y:S!=null&&w.y!=null?c.scale(S):null,payload:w.payload}:{x:S!=null?l.scale(S):null,y:w.y,payload:w.payload}}):y=b?c.scale(g):l.scale(g),{points:j,baseLine:y,isRange:v}}function w9(e){var t=ft(e,fk),r=pt();return h.createElement(FN,{id:t.id,type:"area"},n=>h.createElement(h.Fragment,null,h.createElement(RN,{legendPayload:c9(t)}),h.createElement(zN,{fn:u9,args:t}),h.createElement(UN,{type:"area",id:n,data:t.data,dataKey:t.dataKey,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,stackId:PE(t.stackId),hide:t.hide,barSize:void 0,baseValue:t.baseValue,isPanorama:r,connectNulls:t.connectNulls}),h.createElement(v9,fi({},t,{id:n}))))}var pk=h.memo(w9);pk.displayName="Area";var S9=["dangerouslySetInnerHTML","ticks"],N9=["id"],k9=["domain"],P9=["domain"];function bp(){return bp=Object.assign?Object.assign.bind():function(e){for(var t=1;t(t(lz(e)),()=>{t(cz(e))}),[e,t]),null}var A9=e=>{var{xAxisId:t,className:r}=e,n=G(Dw),i=pt(),s="xAxis",o=G(b=>Da(b,s,t,i)),l=G(b=>R2(b,s,t,i)),c=G(b=>oI(b,t)),d=G(b=>pI(b,t)),u=G(b=>a2(b,t));if(c==null||d==null||u==null)return null;var{dangerouslySetInnerHTML:f,ticks:p}=e,m=jc(e,S9),{id:x}=u,g=jc(u,N9);return h.createElement(ag,bp({},m,g,{scale:o,x:d.x,y:d.y,width:c.width,height:c.height,className:ce("recharts-".concat(s," ").concat(s),r),viewBox:n,ticks:l,axisType:s}))},O9={allowDataOverflow:Tt.allowDataOverflow,allowDecimals:Tt.allowDecimals,allowDuplicatedCategory:Tt.allowDuplicatedCategory,height:Tt.height,hide:!1,mirror:Tt.mirror,orientation:Tt.orientation,padding:Tt.padding,reversed:Tt.reversed,scale:Tt.scale,tickCount:Tt.tickCount,type:Tt.type,xAxisId:0},E9=e=>{var t,r,n,i,s,o=ft(e,O9);return h.createElement(h.Fragment,null,h.createElement(C9,{interval:(t=o.interval)!==null&&t!==void 0?t:"preserveEnd",id:o.xAxisId,scale:o.scale,type:o.type,padding:o.padding,allowDataOverflow:o.allowDataOverflow,domain:o.domain,dataKey:o.dataKey,allowDuplicatedCategory:o.allowDuplicatedCategory,allowDecimals:o.allowDecimals,tickCount:o.tickCount,includeHidden:(r=o.includeHidden)!==null&&r!==void 0?r:!1,reversed:o.reversed,ticks:o.ticks,height:o.height,orientation:o.orientation,mirror:o.mirror,hide:o.hide,unit:o.unit,name:o.name,angle:(n=o.angle)!==null&&n!==void 0?n:0,minTickGap:(i=o.minTickGap)!==null&&i!==void 0?i:5,tick:(s=o.tick)!==null&&s!==void 0?s:!0,tickFormatter:o.tickFormatter}),h.createElement(A9,o))},D9=(e,t)=>{var{domain:r}=e,n=jc(e,k9),{domain:i}=t,s=jc(t,P9);return va(n,s)?Array.isArray(r)&&r.length===2&&Array.isArray(i)&&i.length===2?r[0]===i[0]&&r[1]===i[1]:va({domain:r},{domain:i}):!1},jp=h.memo(E9,D9);jp.displayName="XAxis";var T9=["dangerouslySetInnerHTML","ticks"],M9=["id"],I9=["domain"],$9=["domain"];function wp(){return wp=Object.assign?Object.assign.bind():function(e){for(var t=1;t(t(uz(e)),()=>{t(dz(e))}),[e,t]),null}var R9=e=>{var{yAxisId:t,className:r,width:n,label:i}=e,s=h.useRef(null),o=h.useRef(null),l=G(Dw),c=pt(),d=Ve(),u="yAxis",f=G(S=>Da(S,u,t,c)),p=G(S=>gI(S,t)),m=G(S=>mI(S,t)),x=G(S=>R2(S,u,t,c)),g=G(S=>s2(S,t));if(h.useLayoutEffect(()=>{if(!(n!=="auto"||!p||Qm(i)||h.isValidElement(i)||g==null)){var S=s.current;if(S){var N=S.getCalculatedWidth();Math.round(p.width)!==Math.round(N)&&d(fz({id:t,width:N}))}}},[x,p,d,i,t,n,g]),p==null||m==null||g==null)return null;var{dangerouslySetInnerHTML:b,ticks:v}=e,j=wc(e,T9),{id:y}=g,w=wc(g,M9);return h.createElement(ag,wp({},j,w,{ref:s,labelRef:o,scale:f,x:m.x,y:m.y,tickTextProps:n==="auto"?{width:void 0}:{width:n},width:p.width,height:p.height,className:ce("recharts-".concat(u," ").concat(u),r),viewBox:l,ticks:x,axisType:u}))},B9={allowDataOverflow:Mt.allowDataOverflow,allowDecimals:Mt.allowDecimals,allowDuplicatedCategory:Mt.allowDuplicatedCategory,hide:!1,mirror:Mt.mirror,orientation:Mt.orientation,padding:Mt.padding,reversed:Mt.reversed,scale:Mt.scale,tickCount:Mt.tickCount,type:Mt.type,width:Mt.width,yAxisId:0},F9=e=>{var t,r,n,i,s,o=ft(e,B9);return h.createElement(h.Fragment,null,h.createElement(z9,{interval:(t=o.interval)!==null&&t!==void 0?t:"preserveEnd",id:o.yAxisId,scale:o.scale,type:o.type,domain:o.domain,allowDataOverflow:o.allowDataOverflow,dataKey:o.dataKey,allowDuplicatedCategory:o.allowDuplicatedCategory,allowDecimals:o.allowDecimals,tickCount:o.tickCount,padding:o.padding,includeHidden:(r=o.includeHidden)!==null&&r!==void 0?r:!1,reversed:o.reversed,ticks:o.ticks,width:o.width,orientation:o.orientation,mirror:o.mirror,hide:o.hide,unit:o.unit,name:o.name,angle:(n=o.angle)!==null&&n!==void 0?n:0,minTickGap:(i=o.minTickGap)!==null&&i!==void 0?i:5,tick:(s=o.tick)!==null&&s!==void 0?s:!0,tickFormatter:o.tickFormatter}),h.createElement(R9,o))},W9=(e,t)=>{var{domain:r}=e,n=wc(e,I9),{domain:i}=t,s=wc(t,$9);return va(n,s)?Array.isArray(r)&&r.length===2&&Array.isArray(i)&&i.length===2?r[0]===i[0]&&r[1]===i[1]:va({domain:r},{domain:i}):!1},Sp=h.memo(F9,W9);Sp.displayName="YAxis";var U9={};/** * @license React * use-sync-external-store-with-selector.production.js * @@ -375,7 +370,7 @@ Error generating stack: `+s.message+` * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var po=h;function K9(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var V9=typeof Object.is=="function"?Object.is:K9,Y9=po.useSyncExternalStore,G9=po.useRef,Z9=po.useEffect,X9=po.useMemo,J9=po.useDebugValue;H9.useSyncExternalStoreWithSelector=function(e,t,r,n,i){var s=G9(null);if(s.current===null){var o={hasValue:!1,value:null};s.current=o}else o=s.current;s=X9(function(){function c(m){if(!d){if(d=!0,u=m,m=n(m),i!==void 0&&o.hasValue){var x=o.value;if(i(x,m))return f=x}return f=m}if(x=f,V9(u,m))return x;var g=n(m);return i!==void 0&&i(x,g)?(u=m,x):(u=m,f=g)}var d=!1,u,f,p=r===void 0?null:r;return[function(){return c(t())},p===null?void 0:function(){return c(p())}]},[t,r,n,i]);var l=Y9(e,s[0],s[1]);return Z9(function(){o.hasValue=!0,o.value=l},[l]),J9(l),l};function Q9(e){e()}function eB(){let e=null,t=null;return{clear(){e=null,t=null},notify(){Q9(()=>{let r=e;for(;r;)r.callback(),r=r.next})},get(){const r=[];let n=e;for(;n;)r.push(n),n=n.next;return r},subscribe(r){let n=!0;const i=t={callback:r,next:null,prev:t};return i.prev?i.prev.next=i:e=i,function(){!n||e===null||(n=!1,i.next?i.next.prev=i.prev:t=i.prev,i.prev?i.prev.next=i.next:e=i.next)}}}}var gv={notify(){},get:()=>[]};function tB(e,t){let r,n=gv,i=0,s=!1;function o(g){u();const b=n.subscribe(g);let v=!1;return()=>{v||(v=!0,b(),f())}}function l(){n.notify()}function c(){x.onStateChange&&x.onStateChange()}function d(){return s}function u(){i++,r||(r=e.subscribe(c),n=eB())}function f(){i--,r&&i===0&&(r(),r=void 0,n.clear(),n=gv)}function p(){s||(s=!0,u())}function m(){s&&(s=!1,f())}const x={addNestedSub:o,notifyNestedSubs:l,handleChangeWrapper:c,isSubscribed:d,trySubscribe:p,tryUnsubscribe:m,getListeners:()=>n};return x}var rB=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",nB=rB(),iB=()=>typeof navigator<"u"&&navigator.product==="ReactNative",aB=iB(),sB=()=>nB||aB?h.useLayoutEffect:h.useEffect,oB=sB(),Cd=Symbol.for("react-redux-context"),Ad=typeof globalThis<"u"?globalThis:{};function lB(){if(!h.createContext)return{};const e=Ad[Cd]??(Ad[Cd]=new Map);let t=e.get(h.createContext);return t||(t=h.createContext(null),e.set(h.createContext,t)),t}var cB=lB();function uB(e){const{children:t,context:r,serverState:n,store:i}=e,s=h.useMemo(()=>{const c=tB(i);return{store:i,subscription:c,getServerState:n?()=>n:void 0}},[i,n]),o=h.useMemo(()=>i.getState(),[i]);oB(()=>{const{subscription:c}=s;return c.onStateChange=c.notifyNestedSubs,c.trySubscribe(),o!==i.getState()&&c.notifyNestedSubs(),()=>{c.tryUnsubscribe(),c.onStateChange=void 0}},[s,o]);const l=r||cB;return h.createElement(l.Provider,{value:s},t)}var dB=uB,fB=(e,t)=>t,og=I([fB,ue,n2,We,tN,pn,C$,rt],I$),lg=e=>{var t=e.currentTarget.getBoundingClientRect(),r=t.width/e.currentTarget.offsetWidth,n=t.height/e.currentTarget.offsetHeight;return{chartX:Math.round((e.clientX-t.left)/r),chartY:Math.round((e.clientY-t.top)/n)}},hk=ar("mouseClick"),mk=Qs();mk.startListening({actionCreator:hk,effect:(e,t)=>{var r=e.payload,n=og(t.getState(),lg(r));(n==null?void 0:n.activeIndex)!=null&&t.dispatch(OI({activeIndex:n.activeIndex,activeDataKey:void 0,activeCoordinate:n.activeCoordinate}))}});var Np=ar("mouseMove"),gk=Qs();gk.startListening({actionCreator:Np,effect:(e,t)=>{var r=e.payload,n=t.getState(),i=Um(n,n.tooltip.settings.shared),s=og(n,lg(r));i==="axis"&&((s==null?void 0:s.activeIndex)!=null?t.dispatch(K2({activeIndex:s.activeIndex,activeDataKey:void 0,activeCoordinate:s.activeCoordinate})):t.dispatch(H2()))}});var xv={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,barSize:void 0,className:void 0,maxBarSize:void 0,stackOffset:"none",syncId:void 0,syncMethod:"index",baseValue:void 0},xk=At({name:"rootProps",initialState:xv,reducers:{updateOptions:(e,t)=>{var r;e.accessibilityLayer=t.payload.accessibilityLayer,e.barCategoryGap=t.payload.barCategoryGap,e.barGap=(r=t.payload.barGap)!==null&&r!==void 0?r:xv.barGap,e.barSize=t.payload.barSize,e.maxBarSize=t.payload.maxBarSize,e.stackOffset=t.payload.stackOffset,e.syncId=t.payload.syncId,e.syncMethod=t.payload.syncMethod,e.className=t.payload.className,e.baseValue=t.payload.baseValue}}}),pB=xk.reducer,{updateOptions:hB}=xk.actions,yk=At({name:"polarOptions",initialState:null,reducers:{updatePolarOptions:(e,t)=>t.payload}}),{updatePolarOptions:Z7}=yk.actions,mB=yk.reducer,vk=ar("keyDown"),bk=ar("focus"),cg=Qs();cg.startListening({actionCreator:vk,effect:(e,t)=>{var r=t.getState(),n=r.rootProps.accessibilityLayer!==!1;if(n){var{keyboardInteraction:i}=r.tooltip,s=e.payload;if(!(s!=="ArrowRight"&&s!=="ArrowLeft"&&s!=="Enter")){var o=Number(qm(i,Ta(r))),l=pn(r);if(s==="Enter"){var c=pc(r,"axis","hover",String(i.index));t.dispatch(dp({active:!i.active,activeIndex:i.index,activeDataKey:i.dataKey,activeCoordinate:c}));return}var d=wI(r),u=d==="left-to-right"?1:-1,f=s==="ArrowRight"?1:-1,p=o+f*u;if(!(l==null||p>=l.length||p<0)){var m=pc(r,"axis","hover",String(p));t.dispatch(dp({active:!0,activeIndex:p.toString(),activeDataKey:void 0,activeCoordinate:m}))}}}}});cg.startListening({actionCreator:bk,effect:(e,t)=>{var r=t.getState(),n=r.rootProps.accessibilityLayer!==!1;if(n){var{keyboardInteraction:i}=r.tooltip;if(!i.active&&i.index==null){var s="0",o=pc(r,"axis","hover",String(s));t.dispatch(dp({activeDataKey:void 0,active:!0,activeIndex:s,activeCoordinate:o}))}}}});var Vt=ar("externalEvent"),jk=Qs();jk.startListening({actionCreator:Vt,effect:(e,t)=>{if(e.payload.handler!=null){var r=t.getState(),n={activeCoordinate:p$(r),activeDataKey:d$(r),activeIndex:Us(r),activeLabel:iN(r),activeTooltipIndex:Us(r),isTooltipActive:h$(r)};e.payload.handler(n,e.payload.reactEvent)}}});var gB=I([Da],e=>e.tooltipItemPayloads),xB=I([gB,uo,(e,t,r)=>t,(e,t,r)=>r],(e,t,r,n)=>{var i=e.find(l=>l.settings.dataKey===n);if(i!=null){var{positions:s}=i;if(s!=null){var o=t(s,r);return o}}}),wk=ar("touchMove"),Sk=Qs();Sk.startListening({actionCreator:wk,effect:(e,t)=>{var r=e.payload;if(!(r.touches==null||r.touches.length===0)){var n=t.getState(),i=Um(n,n.tooltip.settings.shared);if(i==="axis"){var s=og(n,lg({clientX:r.touches[0].clientX,clientY:r.touches[0].clientY,currentTarget:r.currentTarget}));(s==null?void 0:s.activeIndex)!=null&&t.dispatch(K2({activeIndex:s.activeIndex,activeDataKey:void 0,activeCoordinate:s.activeCoordinate}))}else if(i==="item"){var o,l=r.touches[0];if(document.elementFromPoint==null)return;var c=document.elementFromPoint(l.clientX,l.clientY);if(!c||!c.getAttribute)return;var d=c.getAttribute(IE),u=(o=c.getAttribute($E))!==null&&o!==void 0?o:void 0,f=xB(t.getState(),d,u);t.dispatch(AI({activeDataKey:u,activeIndex:d,activeCoordinate:f}))}}}});var yB=nw({brush:Dz,cartesianAxis:mz,chartData:dL,errorBars:Nz,graphicalItems:X8,layout:yE,legend:d3,options:sL,polarAxis:P8,polarOptions:mB,referenceElements:Rz,rootProps:pB,tooltip:EI,zIndex:G$}),vB=function(t){return U4({reducer:yB,preloadedState:t,middleware:r=>r({serializableCheck:!1}).concat([mk.middleware,gk.middleware,cg.middleware,jk.middleware,Sk.middleware]),enhancers:r=>{var n=r;return typeof r=="function"&&(n=r()),n.concat(mw({type:"raf"}))},devTools:Ci.devToolsEnabled})};function bB(e){var{preloadedState:t,children:r,reduxStoreName:n}=e,i=pt(),s=h.useRef(null);if(i)return r;s.current==null&&(s.current=vB(t));var o=Hh;return h.createElement(dB,{context:o,store:s.current},r)}function jB(e){var{layout:t,margin:r}=e,n=Ve(),i=pt();return h.useEffect(()=>{i||(n(mE(t)),n(hE(r)))},[n,i,t,r]),null}function wB(e){var t=Ve();return h.useEffect(()=>{t(hB(e))},[t,e]),null}function yv(e){var{zIndex:t,isPanorama:r}=e,n=r?"recharts-zindex-panorama-":"recharts-zindex-",i=BN("".concat(n).concat(t)),s=Ve();return h.useLayoutEffect(()=>(s(V$({zIndex:t,elementId:i,isPanorama:r})),()=>{s(Y$({zIndex:t,isPanorama:r}))}),[s,t,i,r]),h.createElement("g",{id:i})}function vv(e){var{children:t,isPanorama:r}=e,n=G(L$);if(!n||n.length===0)return t;var i=n.filter(o=>o<0),s=n.filter(o=>o>0);return h.createElement(h.Fragment,null,i.map(o=>h.createElement(yv,{key:o,zIndex:o,isPanorama:r})),t,s.map(o=>h.createElement(yv,{key:o,zIndex:o,isPanorama:r})))}var SB=["children"];function NB(e,t){if(e==null)return{};var r,n,i=kB(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n{var r=Fw(),n=Ww(),i=qw();if(!Er(r)||!Er(n))return null;var{children:s,otherAttributes:o,title:l,desc:c}=e,d,u;return o!=null&&(typeof o.tabIndex=="number"?d=o.tabIndex:d=i?0:void 0,typeof o.role=="string"?u=o.role:u=i?"application":void 0),h.createElement(lj,Sc({},o,{title:l,desc:c,role:u,tabIndex:d,width:r,height:n,style:PB,ref:t}),s)}),CB=e=>{var{children:t}=e,r=G(cu);if(!r)return null;var{width:n,height:i,y:s,x:o}=r;return h.createElement(lj,{width:n,height:i,x:o,y:s},t)},bv=h.forwardRef((e,t)=>{var{children:r}=e,n=NB(e,SB),i=pt();return i?h.createElement(CB,null,h.createElement(vv,{isPanorama:!0},r)):h.createElement(_B,Sc({ref:t},n),h.createElement(vv,{isPanorama:!1},r))});function AB(){var e=Ve(),[t,r]=h.useState(null),n=G(ME);return h.useEffect(()=>{if(t!=null){var i=t.getBoundingClientRect(),s=i.width/t.offsetWidth;_e(s)&&s!==n&&e(xE(s))}},[t,e,n]),r}function jv(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function OB(e){for(var t=1;t(bL(),null);function Nc(e){if(typeof e=="number")return e;if(typeof e=="string"){var t=parseFloat(e);if(!Number.isNaN(t))return t}return 0}var IB=h.forwardRef((e,t)=>{var r,n,i=h.useRef(null),[s,o]=h.useState({containerWidth:Nc((r=e.style)===null||r===void 0?void 0:r.width),containerHeight:Nc((n=e.style)===null||n===void 0?void 0:n.height)}),l=h.useCallback((d,u)=>{o(f=>{var p=Math.round(d),m=Math.round(u);return f.containerWidth===p&&f.containerHeight===m?f:{containerWidth:p,containerHeight:m}})},[]),c=h.useCallback(d=>{if(typeof t=="function"&&t(d),d!=null&&typeof ResizeObserver<"u"){var{width:u,height:f}=d.getBoundingClientRect();l(u,f);var p=x=>{var{width:g,height:b}=x[0].contentRect;l(g,b)},m=new ResizeObserver(p);m.observe(d),i.current=m}},[t,l]);return h.useEffect(()=>()=>{var d=i.current;d!=null&&d.disconnect()},[l]),h.createElement(h.Fragment,null,h.createElement(du,{width:s.containerWidth,height:s.containerHeight}),h.createElement("div",Ni({ref:c},e)))}),$B=h.forwardRef((e,t)=>{var{width:r,height:n}=e,[i,s]=h.useState({containerWidth:Nc(r),containerHeight:Nc(n)}),o=h.useCallback((c,d)=>{s(u=>{var f=Math.round(c),p=Math.round(d);return u.containerWidth===f&&u.containerHeight===p?u:{containerWidth:f,containerHeight:p}})},[]),l=h.useCallback(c=>{if(typeof t=="function"&&t(c),c!=null){var{width:d,height:u}=c.getBoundingClientRect();o(d,u)}},[t,o]);return h.createElement(h.Fragment,null,h.createElement(du,{width:i.containerWidth,height:i.containerHeight}),h.createElement("div",Ni({ref:l},e)))}),LB=h.forwardRef((e,t)=>{var{width:r,height:n}=e;return h.createElement(h.Fragment,null,h.createElement(du,{width:r,height:n}),h.createElement("div",Ni({ref:t},e)))}),zB=h.forwardRef((e,t)=>{var{width:r,height:n}=e;return Qr(r)||Qr(n)?h.createElement($B,Ni({},e,{ref:t})):h.createElement(LB,Ni({},e,{ref:t}))});function RB(e){return e===!0?IB:zB}var BB=h.forwardRef((e,t)=>{var{children:r,className:n,height:i,onClick:s,onContextMenu:o,onDoubleClick:l,onMouseDown:c,onMouseEnter:d,onMouseLeave:u,onMouseMove:f,onMouseUp:p,onTouchEnd:m,onTouchMove:x,onTouchStart:g,style:b,width:v,responsive:j,dispatchTouchEvents:y=!0}=e,w=h.useRef(null),S=Ve(),[N,P]=h.useState(null),[_,T]=h.useState(null),$=AB(),M=Qh(),C=(M==null?void 0:M.width)>0?M.width:v,R=(M==null?void 0:M.height)>0?M.height:i,q=h.useCallback(z=>{$(z),typeof t=="function"&&t(z),P(z),T(z),z!=null&&(w.current=z)},[$,t,P,T]),Z=h.useCallback(z=>{S(hk(z)),S(Vt({handler:s,reactEvent:z}))},[S,s]),E=h.useCallback(z=>{S(Np(z)),S(Vt({handler:d,reactEvent:z}))},[S,d]),D=h.useCallback(z=>{S(H2()),S(Vt({handler:u,reactEvent:z}))},[S,u]),O=h.useCallback(z=>{S(Np(z)),S(Vt({handler:f,reactEvent:z}))},[S,f]),k=h.useCallback(()=>{S(bk())},[S]),L=h.useCallback(z=>{S(vk(z.key))},[S]),U=h.useCallback(z=>{S(Vt({handler:o,reactEvent:z}))},[S,o]),H=h.useCallback(z=>{S(Vt({handler:l,reactEvent:z}))},[S,l]),te=h.useCallback(z=>{S(Vt({handler:c,reactEvent:z}))},[S,c]),re=h.useCallback(z=>{S(Vt({handler:p,reactEvent:z}))},[S,p]),we=h.useCallback(z=>{S(Vt({handler:g,reactEvent:z}))},[S,g]),A=h.useCallback(z=>{y&&S(wk(z)),S(Vt({handler:x,reactEvent:z}))},[S,y,x]),J=h.useCallback(z=>{S(Vt({handler:m,reactEvent:z}))},[S,m]),Ot=RB(j);return h.createElement(pN.Provider,{value:N},h.createElement(a6.Provider,{value:_},h.createElement(Ot,{width:C??(b==null?void 0:b.width),height:R??(b==null?void 0:b.height),className:ce("recharts-wrapper",n),style:OB({position:"relative",cursor:"default",width:C,height:R},b),onClick:Z,onContextMenu:U,onDoubleClick:H,onFocus:k,onKeyDown:L,onMouseDown:te,onMouseEnter:E,onMouseLeave:D,onMouseMove:O,onMouseUp:re,onTouchEnd:J,onTouchMove:A,onTouchStart:we,ref:q},h.createElement(MB,null),r)))}),FB=["width","height","responsive","children","className","style","compact","title","desc"];function WB(e,t){if(e==null)return{};var r,n,i=UB(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n{var{width:r,height:n,responsive:i,children:s,className:o,style:l,compact:c,title:d,desc:u}=e,f=WB(e,FB),p=nr(f);return c?h.createElement(h.Fragment,null,h.createElement(du,{width:r,height:n}),h.createElement(bv,{otherAttributes:p,title:d,desc:u},s)):h.createElement(BB,{className:o,style:l,width:r,height:n,responsive:i??!1,onClick:e.onClick,onMouseLeave:e.onMouseLeave,onMouseEnter:e.onMouseEnter,onMouseMove:e.onMouseMove,onMouseDown:e.onMouseDown,onMouseUp:e.onMouseUp,onContextMenu:e.onContextMenu,onDoubleClick:e.onDoubleClick,onTouchStart:e.onTouchStart,onTouchMove:e.onTouchMove,onTouchEnd:e.onTouchEnd},h.createElement(bv,{otherAttributes:p,title:d,desc:u,ref:t},h.createElement(Fz,null,s)))});function kp(){return kp=Object.assign?Object.assign.bind():function(e){for(var t=1;th.createElement(Nk,{chartName:"LineChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:VB,tooltipPayloadSearcher:mN,categoricalChartProps:e,ref:t})),GB=["axis"],ZB=h.forwardRef((e,t)=>h.createElement(Nk,{chartName:"AreaChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:GB,tooltipPayloadSearcher:mN,categoricalChartProps:e,ref:t}));function XB(){var b,v,j,y,w,S,N,P,_,T,$,M,C,R,q,Z,E,D,O,k,L;const[e,t]=h.useState(null),[r,n]=h.useState(null),[i,s]=h.useState(!0),[o,l]=h.useState(0),[c,d]=h.useState(!1);h.useEffect(()=>{f(),u()},[]);const u=async()=>{try{const H=(await B.getChangeStats()).pending_count;l(H);const te=localStorage.getItem("dismissedPendingChangesCount"),re=te&&parseInt(te)>=H;d(H>0&&!re)}catch(U){console.error("Failed to load change stats:",U),d(!1)}},f=async()=>{try{const[U,H]=await Promise.all([B.getDashboardStats(),B.getDashboardActivity()]);t(U),n(H)}catch(U){console.error("Failed to load dashboard:",U)}finally{s(!1)}},p=()=>{localStorage.setItem("dismissedPendingChangesCount",o.toString()),d(!1)};if(i)return a.jsx(X,{children:a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsx(Xt,{className:"w-8 h-8 animate-spin text-gray-400"})})});const m=Math.round(((b=e==null?void 0:e.products)==null?void 0:b.with_images)/((v=e==null?void 0:e.products)==null?void 0:v.total)*100)||0;Math.round(((j=e==null?void 0:e.stores)==null?void 0:j.active)/((y=e==null?void 0:e.stores)==null?void 0:y.total)*100);const x=[{date:"Mon",products:120},{date:"Tue",products:145},{date:"Wed",products:132},{date:"Thu",products:178},{date:"Fri",products:195},{date:"Sat",products:210},{date:"Sun",products:((w=e==null?void 0:e.products)==null?void 0:w.total)||225}],g=[{time:"00:00",scrapes:5},{time:"04:00",scrapes:12},{time:"08:00",scrapes:18},{time:"12:00",scrapes:25},{time:"16:00",scrapes:30},{time:"20:00",scrapes:22},{time:"24:00",scrapes:((S=r==null?void 0:r.recent_scrapes)==null?void 0:S.length)||15}];return a.jsxs(X,{children:[c&&a.jsx("div",{className:"mb-6 bg-amber-50 border-l-4 border-amber-500 rounded-lg p-4",children:a.jsxs("div",{className:"flex items-center justify-between gap-4",children:[a.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[a.jsx(nj,{className:"w-5 h-5 text-amber-600 flex-shrink-0"}),a.jsxs("div",{className:"flex-1",children:[a.jsxs("h3",{className:"text-sm font-semibold text-amber-900",children:[o," pending change",o!==1?"s":""," require review"]}),a.jsx("p",{className:"text-sm text-amber-700 mt-0.5",children:"Proposed changes to dispensary data are waiting for approval"})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{className:"btn btn-sm bg-amber-600 hover:bg-amber-700 text-white border-none",children:"Review Changes"}),a.jsx("button",{onClick:p,className:"btn btn-sm btn-ghost text-amber-900 hover:bg-amber-100","aria-label":"Dismiss notification",children:a.jsx(ij,{className:"w-4 h-4"})})]})]})}),a.jsxs("div",{className:"space-y-8",children:[a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl font-semibold text-gray-900",children:"Dashboard"}),a.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"Monitor your dispensary data aggregation"})]}),a.jsxs("button",{onClick:f,className:"inline-flex items-center gap-2 px-4 py-2 bg-white border border-gray-200 rounded-lg hover:bg-gray-50 transition-colors text-sm font-medium text-gray-700",children:[a.jsx(Xt,{className:"w-4 h-4"}),"Refresh"]})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:[a.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("div",{className:"p-2 bg-blue-50 rounded-lg",children:a.jsx(Ct,{className:"w-5 h-5 text-blue-600"})}),a.jsxs("div",{className:"flex items-center gap-1 text-xs text-green-600",children:[a.jsx(zn,{className:"w-3 h-3"}),a.jsx("span",{children:"12.5%"})]})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{className:"text-sm font-medium text-gray-600",children:"Total Products"}),a.jsx("p",{className:"text-3xl font-semibold text-gray-900",children:((P=(N=e==null?void 0:e.products)==null?void 0:N.total)==null?void 0:P.toLocaleString())||0}),a.jsxs("p",{className:"text-xs text-gray-500",children:[((_=e==null?void 0:e.products)==null?void 0:_.in_stock)||0," in stock"]})]})]}),a.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("div",{className:"p-2 bg-emerald-50 rounded-lg",children:a.jsx(Il,{className:"w-5 h-5 text-emerald-600"})}),a.jsxs("div",{className:"flex items-center gap-1 text-xs text-green-600",children:[a.jsx(zn,{className:"w-3 h-3"}),a.jsx("span",{children:"8.2%"})]})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{className:"text-sm font-medium text-gray-600",children:"Total Dispensaries"}),a.jsx("p",{className:"text-3xl font-semibold text-gray-900",children:((T=e==null?void 0:e.stores)==null?void 0:T.total)||0}),a.jsxs("p",{className:"text-xs text-gray-500",children:[(($=e==null?void 0:e.stores)==null?void 0:$.active)||0," active (crawlable)"]})]})]}),a.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("div",{className:"p-2 bg-purple-50 rounded-lg",children:a.jsx(rj,{className:"w-5 h-5 text-purple-600"})}),a.jsxs("div",{className:"flex items-center gap-1 text-xs text-red-600",children:[a.jsx(FO,{className:"w-3 h-3"}),a.jsx("span",{children:"3.1%"})]})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{className:"text-sm font-medium text-gray-600",children:"Active Campaigns"}),a.jsx("p",{className:"text-3xl font-semibold text-gray-900",children:((M=e==null?void 0:e.campaigns)==null?void 0:M.active)||0}),a.jsxs("p",{className:"text-xs text-gray-500",children:[((C=e==null?void 0:e.campaigns)==null?void 0:C.total)||0," total campaigns"]})]})]}),a.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("div",{className:"p-2 bg-amber-50 rounded-lg",children:a.jsx(lO,{className:"w-5 h-5 text-amber-600"})}),a.jsxs("span",{className:"text-xs font-medium text-gray-600",children:[m,"%"]})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{className:"text-sm font-medium text-gray-600",children:"Images Downloaded"}),a.jsx("p",{className:"text-3xl font-semibold text-gray-900",children:((q=(R=e==null?void 0:e.products)==null?void 0:R.with_images)==null?void 0:q.toLocaleString())||0}),a.jsx("div",{className:"mt-3",children:a.jsx("div",{className:"w-full bg-gray-100 rounded-full h-1.5",children:a.jsx("div",{className:"bg-amber-500 h-1.5 rounded-full transition-all",style:{width:`${m}%`}})})})]})]}),a.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("div",{className:"p-2 bg-cyan-50 rounded-lg",children:a.jsx(vO,{className:"w-5 h-5 text-cyan-600"})}),a.jsx(xr,{className:"w-4 h-4 text-gray-400"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{className:"text-sm font-medium text-gray-600",children:"Clicks (24h)"}),a.jsx("p",{className:"text-3xl font-semibold text-gray-900",children:((E=(Z=e==null?void 0:e.clicks)==null?void 0:Z.clicks_24h)==null?void 0:E.toLocaleString())||0}),a.jsx("p",{className:"text-xs text-gray-500",children:"Last 24 hours"})]})]}),a.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("div",{className:"p-2 bg-indigo-50 rounded-lg",children:a.jsx(Cr,{className:"w-5 h-5 text-indigo-600"})}),a.jsx(Ds,{className:"w-4 h-4 text-gray-400"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{className:"text-sm font-medium text-gray-600",children:"Brands"}),a.jsx("p",{className:"text-3xl font-semibold text-gray-900",children:((D=e==null?void 0:e.brands)==null?void 0:D.total)||((O=e==null?void 0:e.products)==null?void 0:O.unique_brands)||0}),a.jsx("p",{className:"text-xs text-gray-500",children:"Unique brands tracked"})]})]})]}),a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-6",children:[a.jsxs("div",{className:"mb-6",children:[a.jsx("h3",{className:"text-base font-semibold text-gray-900",children:"Product Growth"}),a.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"Weekly product count trend"})]}),a.jsx(p0,{width:"100%",height:200,children:a.jsxs(ZB,{data:x,children:[a.jsx("defs",{children:a.jsxs("linearGradient",{id:"productGradient",x1:"0",y1:"0",x2:"0",y2:"1",children:[a.jsx("stop",{offset:"5%",stopColor:"#3b82f6",stopOpacity:.1}),a.jsx("stop",{offset:"95%",stopColor:"#3b82f6",stopOpacity:0})]})}),a.jsx(vp,{strokeDasharray:"3 3",stroke:"#f1f5f9"}),a.jsx(jp,{dataKey:"date",tick:{fill:"#94a3b8",fontSize:12},axisLine:{stroke:"#e2e8f0"}}),a.jsx(Sp,{tick:{fill:"#94a3b8",fontSize:12},axisLine:{stroke:"#e2e8f0"}}),a.jsx(By,{contentStyle:{backgroundColor:"#ffffff",border:"1px solid #e2e8f0",borderRadius:"8px",fontSize:"12px"}}),a.jsx(pk,{type:"monotone",dataKey:"products",stroke:"#3b82f6",strokeWidth:2,fill:"url(#productGradient)"})]})})]}),a.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-6",children:[a.jsxs("div",{className:"mb-6",children:[a.jsx("h3",{className:"text-base font-semibold text-gray-900",children:"Scrape Activity"}),a.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"Scrapes over the last 24 hours"})]}),a.jsx(p0,{width:"100%",height:200,children:a.jsxs(YB,{data:g,children:[a.jsx(vp,{strokeDasharray:"3 3",stroke:"#f1f5f9"}),a.jsx(jp,{dataKey:"time",tick:{fill:"#94a3b8",fontSize:12},axisLine:{stroke:"#e2e8f0"}}),a.jsx(Sp,{tick:{fill:"#94a3b8",fontSize:12},axisLine:{stroke:"#e2e8f0"}}),a.jsx(By,{contentStyle:{backgroundColor:"#ffffff",border:"1px solid #e2e8f0",borderRadius:"8px",fontSize:"12px"}}),a.jsx(ak,{type:"monotone",dataKey:"scrapes",stroke:"#10b981",strokeWidth:2,dot:{fill:"#10b981",r:4}})]})})]})]}),a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"bg-white rounded-xl border border-gray-200",children:[a.jsxs("div",{className:"px-6 py-4 border-b border-gray-200",children:[a.jsx("h3",{className:"text-base font-semibold text-gray-900",children:"Recent Scrapes"}),a.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"Latest data collection activities"})]}),a.jsx("div",{className:"divide-y divide-gray-100",children:((k=r==null?void 0:r.recent_scrapes)==null?void 0:k.length)>0?r.recent_scrapes.slice(0,5).map((U,H)=>a.jsx("div",{className:"px-6 py-4 hover:bg-gray-50 transition-colors",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-sm font-medium text-gray-900 truncate",children:U.name}),a.jsx("p",{className:"text-xs text-gray-500 mt-1",children:new Date(U.last_scraped_at).toLocaleString("en-US",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})})]}),a.jsx("div",{className:"ml-4 flex-shrink-0",children:a.jsxs("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-blue-50 text-blue-700",children:[U.product_count," products"]})})]})},H)):a.jsxs("div",{className:"px-6 py-12 text-center",children:[a.jsx(Ds,{className:"w-8 h-8 text-gray-300 mx-auto mb-2"}),a.jsx("p",{className:"text-sm text-gray-500",children:"No recent scrapes"})]})})]}),a.jsxs("div",{className:"bg-white rounded-xl border border-gray-200",children:[a.jsxs("div",{className:"px-6 py-4 border-b border-gray-200",children:[a.jsx("h3",{className:"text-base font-semibold text-gray-900",children:"Recent Products"}),a.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"Newly added to inventory"})]}),a.jsx("div",{className:"divide-y divide-gray-100",children:((L=r==null?void 0:r.recent_products)==null?void 0:L.length)>0?r.recent_products.slice(0,5).map((U,H)=>a.jsx("div",{className:"px-6 py-4 hover:bg-gray-50 transition-colors",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-sm font-medium text-gray-900 truncate",children:U.name}),a.jsx("p",{className:"text-xs text-gray-500 mt-1",children:U.store_name})]}),U.price&&a.jsx("div",{className:"ml-4 flex-shrink-0",children:a.jsxs("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-emerald-50 text-emerald-700",children:["$",U.price]})})]})},H)):a.jsxs("div",{className:"px-6 py-12 text-center",children:[a.jsx(Ct,{className:"w-8 h-8 text-gray-300 mx-auto mb-2"}),a.jsx("p",{className:"text-sm text-gray-500",children:"No recent products"})]})})]})]})]})]})}function JB(){const[e,t]=nA(),r=dt(),[n,i]=h.useState([]),[s,o]=h.useState([]),[l,c]=h.useState([]),[d,u]=h.useState(!1),[f,p]=h.useState(""),[m,x]=h.useState(""),[g,b]=h.useState(""),[v,j]=h.useState(""),[y,w]=h.useState(0),[S,N]=h.useState(0),P=50;h.useEffect(()=>{const k=e.get("store");k&&x(k),T()},[]),h.useEffect(()=>{m&&($(),_())},[f,m,g,v,S]);const _=async()=>{try{const k=await B.getCategoryTree(parseInt(m));c(k.categories||[])}catch(k){console.error("Failed to load categories:",k)}},T=async()=>{try{const k=await B.getStores();o(k.stores)}catch(k){console.error("Failed to load stores:",k)}},$=async()=>{u(!0);try{const k={limit:P,offset:S,store_id:m};f&&(k.search=f),g&&(k.category_id=g),v&&(k.in_stock=v);const L=await B.getProducts(k);i(L.products),w(L.total)}catch(k){console.error("Failed to load products:",k)}finally{u(!1)}},M=k=>{p(k),N(0)},C=k=>{x(k),b(""),N(0),p(""),t(k?{store:k}:{})},R=k=>{b(k),N(0)},q=(k,L=0)=>k.map(U=>a.jsxs("div",{style:{marginLeft:`${L*20}px`},children:[a.jsxs("button",{onClick:()=>R(U.id.toString()),style:{width:"100%",textAlign:"left",padding:"10px 15px",background:g===U.id.toString()?"#667eea":"transparent",color:g===U.id.toString()?"white":"#333",border:"none",borderRadius:"6px",cursor:"pointer",fontWeight:L===0?"600":"400",fontSize:L===0?"15px":"14px",marginBottom:"4px",transition:"all 0.2s"},onMouseEnter:H=>{g!==U.id.toString()&&(H.currentTarget.style.background="#f5f5f5")},onMouseLeave:H=>{g!==U.id.toString()&&(H.currentTarget.style.background="transparent")},children:[U.name," (",U.product_count||0,")"]}),U.children&&U.children.length>0&&q(U.children,L+1)]},U.id)),Z=l.find(k=>k.id.toString()===g),E=()=>{S+P{S>0&&N(Math.max(0,S-P))},O=s.find(k=>k.id.toString()===m);return a.jsx(X,{children:a.jsxs("div",{children:[a.jsx("h1",{style:{fontSize:"32px",marginBottom:"30px"},children:"Products"}),a.jsxs("div",{style:{background:"white",padding:"30px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",marginBottom:"30px"},children:[a.jsx("label",{style:{display:"block",marginBottom:"15px",fontSize:"18px",fontWeight:"600",color:"#333"},children:"Select a Store to View Products:"}),a.jsxs("select",{value:m,onChange:k=>C(k.target.value),style:{width:"100%",padding:"15px",border:"2px solid #667eea",borderRadius:"8px",fontSize:"16px",fontWeight:"500",cursor:"pointer",background:"white"},children:[a.jsx("option",{value:"",children:"-- Select a Store --"}),s.map(k=>a.jsx("option",{value:k.id,children:k.name},k.id))]})]}),m?a.jsxs(a.Fragment,{children:[a.jsxs("div",{style:{background:"#667eea",color:"white",padding:"20px",borderRadius:"8px",marginBottom:"20px",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[a.jsxs("div",{children:[a.jsx("h2",{style:{margin:0,fontSize:"24px"},children:O==null?void 0:O.name}),Z&&a.jsx("div",{style:{marginTop:"8px",fontSize:"14px",opacity:.9},children:Z.name})]}),a.jsxs("div",{style:{fontSize:"18px",fontWeight:"bold"},children:[y," Products"]})]}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"280px 1fr",gap:"20px"},children:[a.jsx("div",{children:a.jsxs("div",{style:{background:"white",padding:"20px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",position:"sticky",top:"20px"},children:[a.jsx("h3",{style:{margin:"0 0 16px 0",fontSize:"18px",fontWeight:"600",color:"#333"},children:"Categories"}),a.jsxs("button",{onClick:()=>R(""),style:{width:"100%",textAlign:"left",padding:"10px 15px",background:g===""?"#667eea":"transparent",color:g===""?"white":"#333",border:"none",borderRadius:"6px",cursor:"pointer",fontWeight:"600",fontSize:"15px",marginBottom:"12px"},children:["All Products (",y,")"]}),a.jsx("div",{style:{borderTop:"1px solid #eee",marginBottom:"12px"}}),q(l)]})}),a.jsxs("div",{children:[a.jsxs("div",{style:{background:"white",padding:"20px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",marginBottom:"20px",display:"flex",gap:"15px",flexWrap:"wrap"},children:[a.jsx("input",{type:"text",placeholder:"Search products...",value:f,onChange:k=>M(k.target.value),style:{flex:"1",minWidth:"200px",padding:"10px",border:"1px solid #ddd",borderRadius:"6px"}}),a.jsxs("select",{value:v,onChange:k=>{j(k.target.value),N(0)},style:{padding:"10px",border:"1px solid #ddd",borderRadius:"6px"},children:[a.jsx("option",{value:"",children:"All Products"}),a.jsx("option",{value:"true",children:"In Stock"}),a.jsx("option",{value:"false",children:"Out of Stock"})]})]}),d?a.jsx("div",{style:{textAlign:"center",padding:"40px"},children:"Loading..."}):a.jsxs(a.Fragment,{children:[a.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(250px, 1fr))",gap:"20px",marginBottom:"20px"},children:n.map(k=>a.jsx(QB,{product:k,onViewDetails:()=>r(`/products/${k.id}`)},k.id))}),n.length===0&&a.jsx("div",{style:{background:"white",padding:"40px",borderRadius:"8px",textAlign:"center",color:"#999"},children:"No products found"}),y>P&&a.jsxs("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",gap:"15px",marginTop:"30px"},children:[a.jsx("button",{onClick:D,disabled:S===0,style:{padding:"10px 20px",background:S===0?"#ddd":"#667eea",color:S===0?"#999":"white",border:"none",borderRadius:"6px",cursor:S===0?"not-allowed":"pointer"},children:"Previous"}),a.jsxs("span",{children:["Showing ",S+1," - ",Math.min(S+P,y)," of ",y]}),a.jsx("button",{onClick:E,disabled:S+P>=y,style:{padding:"10px 20px",background:S+P>=y?"#ddd":"#667eea",color:S+P>=y?"#999":"white",border:"none",borderRadius:"6px",cursor:S+P>=y?"not-allowed":"pointer"},children:"Next"})]})]})]})]})]}):a.jsxs("div",{style:{background:"white",padding:"60px 40px",borderRadius:"8px",textAlign:"center",boxShadow:"0 2px 8px rgba(0,0,0,0.1)"},children:[a.jsx("div",{style:{fontSize:"48px",marginBottom:"20px"},children:"🏪"}),a.jsx("div",{style:{fontSize:"18px",color:"#666"},children:"Please select a store from the dropdown above to view products"})]})]})})}function QB({product:e,onViewDetails:t}){const r=n=>{if(!n)return"Never";const i=new Date(n),o=new Date().getTime()-i.getTime(),l=Math.floor(o/(1e3*60*60*24));return l===0?"Today":l===1?"Yesterday":l<7?`${l} days ago`:i.toLocaleDateString()};return a.jsxs("div",{style:{background:"white",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",overflow:"hidden",transition:"transform 0.2s"},onMouseEnter:n=>n.currentTarget.style.transform="translateY(-4px)",onMouseLeave:n=>n.currentTarget.style.transform="translateY(0)",children:[e.image_url_full?a.jsx("img",{src:e.image_url_full,alt:e.name,style:{width:"100%",height:"200px",objectFit:"cover",background:"#f5f5f5"},onError:n=>{n.currentTarget.src='data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" width="200" height="200"%3E%3Crect fill="%23ddd" width="200" height="200"/%3E%3Ctext x="50%25" y="50%25" text-anchor="middle" dy=".3em" fill="%23999"%3ENo Image%3C/text%3E%3C/svg%3E'}}):a.jsx("div",{style:{width:"100%",height:"200px",background:"#f5f5f5",display:"flex",alignItems:"center",justifyContent:"center",color:"#999"},children:"No Image"}),a.jsxs("div",{style:{padding:"15px"},children:[a.jsx("div",{style:{fontWeight:"500",marginBottom:"8px",fontSize:"14px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.name}),a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"8px"},children:[a.jsx("div",{style:{fontWeight:"bold",color:"#667eea"},children:e.price?`$${e.price}`:"N/A"}),a.jsx("div",{style:{padding:"4px 8px",borderRadius:"4px",fontSize:"12px",background:e.in_stock?"#d4edda":"#f8d7da",color:e.in_stock?"#155724":"#721c24"},children:e.in_stock?"In Stock":"Out of Stock"})]}),a.jsxs("div",{style:{fontSize:"11px",color:"#888",marginBottom:"12px",borderTop:"1px solid #eee",paddingTop:"8px"},children:["Last Updated: ",r(e.last_seen_at)]}),a.jsxs("div",{style:{display:"flex",gap:"8px"},children:[e.dutchie_url&&a.jsx("a",{href:e.dutchie_url,target:"_blank",rel:"noopener noreferrer",style:{flex:1,padding:"8px 12px",background:"#f0f0f0",color:"#333",textDecoration:"none",borderRadius:"6px",fontSize:"12px",fontWeight:"500",textAlign:"center",border:"1px solid #ddd"},onClick:n=>n.stopPropagation(),children:"Dutchie"}),a.jsx("button",{onClick:n=>{n.stopPropagation(),t()},style:{flex:1,padding:"8px 12px",background:"#667eea",color:"white",border:"none",borderRadius:"6px",fontSize:"12px",fontWeight:"500",cursor:"pointer"},children:"Details"})]})]})]})}function e7(){const{id:e}=Na(),t=dt(),[r,n]=h.useState(null),[i,s]=h.useState(!0),[o,l]=h.useState(null);h.useEffect(()=>{c()},[e]);const c=async()=>{if(e){s(!0),l(null);try{const p=await B.getProduct(parseInt(e));n(p.product)}catch(p){l(p.message||"Failed to load product")}finally{s(!1)}}};if(i)return a.jsx(X,{children:a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsx("div",{className:"w-8 h-8 border-4 border-gray-200 border-t-blue-600 rounded-full animate-spin"})})});if(o||!r)return a.jsx(X,{children:a.jsxs("div",{className:"text-center py-12",children:[a.jsx(Ct,{className:"w-16 h-16 text-gray-300 mx-auto mb-4"}),a.jsx("h2",{className:"text-2xl font-bold text-gray-900 mb-2",children:"Product not found"}),a.jsx("p",{className:"text-gray-500 mb-4",children:o}),a.jsx("button",{onClick:()=>t(-1),className:"text-blue-600 hover:text-blue-700",children:"← Go back"})]})});const d=r.metadata||{},f=r.image_url_full?r.image_url_full:r.medium_path?`http://localhost:9020/dutchie/${r.medium_path}`:r.thumbnail_path?`http://localhost:9020/dutchie/${r.thumbnail_path}`:null;return a.jsx(X,{children:a.jsxs("div",{className:"max-w-6xl mx-auto",children:[a.jsxs("button",{onClick:()=>t(-1),className:"flex items-center gap-2 text-gray-600 hover:text-gray-900 mb-6",children:[a.jsx(_h,{className:"w-4 h-4"}),"Back"]}),a.jsx("div",{className:"bg-white rounded-xl border border-gray-200 overflow-hidden",children:a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8 p-6",children:[a.jsx("div",{className:"aspect-square bg-gray-50 rounded-lg overflow-hidden",children:f?a.jsx("img",{src:f,alt:r.name,className:"w-full h-full object-contain"}):a.jsx("div",{className:"w-full h-full flex items-center justify-center text-gray-400",children:a.jsx(Ct,{className:"w-24 h-24"})})}),a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.in_stock?a.jsx("span",{className:"px-2 py-1 bg-green-100 text-green-700 text-xs font-medium rounded",children:"In Stock"}):a.jsx("span",{className:"px-2 py-1 bg-red-100 text-red-700 text-xs font-medium rounded",children:"Out of Stock"}),r.strain_type&&a.jsx("span",{className:"px-2 py-1 bg-purple-100 text-purple-700 text-xs font-medium rounded capitalize",children:r.strain_type})]}),a.jsx("h1",{className:"text-2xl font-bold text-gray-900 mb-2",children:r.name}),r.brand&&a.jsx("p",{className:"text-lg text-gray-600 font-medium",children:r.brand}),a.jsxs("div",{className:"flex items-center gap-4 mt-2 text-sm text-gray-500",children:[r.store_name&&a.jsx("span",{children:r.store_name}),r.category_name&&a.jsxs(a.Fragment,{children:[a.jsx("span",{children:"•"}),a.jsx("span",{children:r.category_name})]})]})]}),r.price!==null&&a.jsxs("div",{className:"border-t border-gray-100 pt-4",children:[a.jsxs("div",{className:"text-3xl font-bold text-blue-600",children:["$",parseFloat(r.price).toFixed(2)]}),r.weight&&a.jsx("div",{className:"text-sm text-gray-500 mt-1",children:r.weight})]}),(r.thc_percentage||r.cbd_percentage)&&a.jsxs("div",{className:"border-t border-gray-100 pt-4",children:[a.jsx("h3",{className:"text-sm font-semibold text-gray-700 mb-3",children:"Cannabinoid Content"}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.thc_percentage!==null&&a.jsxs("div",{className:"bg-green-50 rounded-lg p-3",children:[a.jsx("div",{className:"text-xs text-gray-500 uppercase",children:"THC"}),a.jsxs("div",{className:"text-xl font-bold text-green-600",children:[r.thc_percentage,"%"]})]}),r.cbd_percentage!==null&&a.jsxs("div",{className:"bg-blue-50 rounded-lg p-3",children:[a.jsx("div",{className:"text-xs text-gray-500 uppercase",children:"CBD"}),a.jsxs("div",{className:"text-xl font-bold text-blue-600",children:[r.cbd_percentage,"%"]})]})]})]}),r.description&&a.jsxs("div",{className:"border-t border-gray-100 pt-4",children:[a.jsx("h3",{className:"text-sm font-semibold text-gray-700 mb-2",children:"Description"}),a.jsx("p",{className:"text-gray-600 text-sm leading-relaxed",children:r.description})]}),d.terpenes&&d.terpenes.length>0&&a.jsxs("div",{className:"border-t border-gray-100 pt-4",children:[a.jsx("h3",{className:"text-sm font-semibold text-gray-700 mb-2",children:"Terpenes"}),a.jsx("div",{className:"flex flex-wrap gap-2",children:d.terpenes.map(p=>a.jsx("span",{className:"px-2 py-1 bg-amber-100 text-amber-700 text-xs font-medium rounded",children:p},p))})]}),d.effects&&d.effects.length>0&&a.jsxs("div",{className:"border-t border-gray-100 pt-4",children:[a.jsx("h3",{className:"text-sm font-semibold text-gray-700 mb-2",children:"Effects"}),a.jsx("div",{className:"flex flex-wrap gap-2",children:d.effects.map(p=>a.jsx("span",{className:"px-2 py-1 bg-indigo-100 text-indigo-700 text-xs font-medium rounded",children:p},p))})]}),d.flavors&&d.flavors.length>0&&a.jsxs("div",{className:"border-t border-gray-100 pt-4",children:[a.jsx("h3",{className:"text-sm font-semibold text-gray-700 mb-2",children:"Flavors"}),a.jsx("div",{className:"flex flex-wrap gap-2",children:d.flavors.map(p=>a.jsx("span",{className:"px-2 py-1 bg-pink-100 text-pink-700 text-xs font-medium rounded",children:p},p))})]}),d.lineage&&a.jsxs("div",{className:"border-t border-gray-100 pt-4",children:[a.jsx("h3",{className:"text-sm font-semibold text-gray-700 mb-2",children:"Lineage"}),a.jsx("p",{className:"text-gray-600 text-sm",children:d.lineage})]}),r.dutchie_url&&a.jsx("div",{className:"border-t border-gray-100 pt-4",children:a.jsxs("a",{href:r.dutchie_url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-sm text-blue-600 hover:text-blue-700",children:["View on Dutchie",a.jsx(Jr,{className:"w-4 h-4"})]})}),r.last_seen_at&&a.jsxs("div",{className:"text-xs text-gray-400 pt-4 border-t border-gray-100",children:["Last updated: ",new Date(r.last_seen_at).toLocaleString()]})]})]})})]})})}function t7(){const[e,t]=h.useState([]),[r,n]=h.useState(!0),[i,s]=h.useState(new Set),[o,l]=h.useState(new Set),c=dt();h.useEffect(()=>{d()},[]);const d=async()=>{n(!0);try{const v=await B.getStores();t(v.stores)}catch(v){console.error("Failed to load stores:",v)}finally{n(!1)}},u=v=>{const j=v.match(/(?:^|-)(al|ak|az|ar|ca|co|ct|de|fl|ga|hi|id|il|in|ia|ks|ky|la|me|md|ma|mi|mn|ms|mo|mt|ne|nv|nh|nj|nm|ny|nc|nd|oh|ok|or|pa|ri|sc|sd|tn|tx|ut|vt|va|wa|wv|wi|wy)-/i),y={peoria:"AZ"};let w=j?j[1].toUpperCase():null;if(!w){for(const[S,N]of Object.entries(y))if(v.toLowerCase().includes(S)){w=N;break}}return w||"UNKNOWN"},f=v=>{const j=u(v.slug).toLowerCase(),y=v.name.match(/^([^-]+)/),w=y?y[1].trim().toLowerCase().replace(/\s+/g,"-"):"other";return`/stores/${j}/${w}/${v.slug}`},p=e.reduce((v,j)=>{const y=j.name.match(/^([^-]+)/),w=y?y[1].trim():"Other",S=u(j.slug),P={AZ:"Arizona",FL:"Florida",PA:"Pennsylvania",NJ:"New Jersey",MA:"Massachusetts",IL:"Illinois",NY:"New York",MD:"Maryland",MI:"Michigan",OH:"Ohio",CT:"Connecticut",ME:"Maine",MO:"Missouri",NV:"Nevada",OR:"Oregon",UT:"Utah"}[S]||S;return v[w]||(v[w]={}),v[w][P]||(v[w][P]=[]),v[w][P].push(j),v},{}),m=async(v,j,y)=>{y.stopPropagation();try{await B.updateStore(v,{scrape_enabled:!j}),t(e.map(w=>w.id===v?{...w,scrape_enabled:!j}:w))}catch(w){console.error("Failed to update scraping status:",w)}},x=v=>v?new Date(v).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"}):"Never",g=v=>{const j=new Set(i);j.has(v)?j.delete(v):j.add(v),s(j)},b=(v,j)=>{const y=`${v}-${j}`,w=new Set(o);w.has(y)?w.delete(y):w.add(y),l(w)};return r?a.jsx(X,{children:a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsx("div",{className:"w-8 h-8 border-4 border-gray-200 border-t-blue-600 rounded-full animate-spin"})})}):a.jsx(X,{children:a.jsxs("div",{className:"space-y-6",children:[a.jsx("div",{className:"flex items-center justify-between",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 bg-blue-50 rounded-lg",children:a.jsx(Il,{className:"w-6 h-6 text-blue-600"})}),a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl font-semibold text-gray-900",children:"Stores"}),a.jsxs("p",{className:"text-sm text-gray-500 mt-1",children:[e.length," total stores"]})]})]})}),a.jsx("div",{className:"bg-white rounded-xl border border-gray-200 overflow-hidden",children:a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full",children:[a.jsx("thead",{className:"bg-gray-50 border-b border-gray-200",children:a.jsxs("tr",{children:[a.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Store Name"}),a.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Type"}),a.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"View Online"}),a.jsx("th",{className:"px-6 py-3 text-center text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Categories"}),a.jsx("th",{className:"px-6 py-3 text-center text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Products"}),a.jsx("th",{className:"px-6 py-3 text-center text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Scraping"}),a.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Last Scraped"})]})}),a.jsx("tbody",{children:Object.entries(p).map(([v,j])=>{const y=Object.values(j).flat().length,w=y===1,S=i.has(v);if(w){const _=Object.values(j).flat()[0];return a.jsxs("tr",{className:"border-b border-gray-100 hover:bg-gray-50 cursor-pointer transition-colors",onClick:()=>c(f(_)),title:"Click to view store",children:[a.jsx("td",{className:"px-6 py-4",children:a.jsxs("div",{className:"flex items-center gap-3",children:[_.logo_url?a.jsx("img",{src:_.logo_url,alt:`${_.name} logo`,className:"w-8 h-8 object-contain flex-shrink-0",onError:T=>{T.target.style.display="none"}}):null,a.jsxs("div",{children:[a.jsx("div",{className:"font-semibold text-gray-900",children:_.name}),a.jsx("div",{className:"text-xs text-gray-500",children:_.slug})]})]})}),a.jsx("td",{className:"px-6 py-4",children:a.jsx("span",{className:"px-2 py-1 text-xs font-medium bg-blue-50 text-blue-700 rounded",children:"Dutchie"})}),a.jsx("td",{className:"px-6 py-4",children:a.jsxs("a",{href:_.dutchie_url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-sm text-blue-600 hover:text-blue-700",onClick:T=>T.stopPropagation(),children:[a.jsx("span",{children:"View Online"}),a.jsx(Jr,{className:"w-3 h-3"})]})}),a.jsx("td",{className:"px-6 py-4 text-center",children:a.jsxs("div",{className:"flex items-center justify-center gap-1",children:[a.jsx(Cr,{className:"w-4 h-4 text-gray-400"}),a.jsx("span",{className:"text-sm font-medium text-gray-900",children:_.category_count||0})]})}),a.jsx("td",{className:"px-6 py-4 text-center",children:a.jsxs("div",{className:"flex items-center justify-center gap-1",children:[a.jsx(Ct,{className:"w-4 h-4 text-gray-400"}),a.jsx("span",{className:"text-sm font-medium text-gray-900",children:_.product_count||0})]})}),a.jsx("td",{className:"px-6 py-4 text-center",onClick:T=>T.stopPropagation(),children:a.jsx("button",{onClick:T=>m(_.id,_.scrape_enabled,T),className:"inline-flex items-center gap-1 text-sm font-medium transition-colors",children:_.scrape_enabled?a.jsxs(a.Fragment,{children:[a.jsx(Ix,{className:"w-5 h-5 text-green-600"}),a.jsx("span",{className:"text-green-600",children:"On"})]}):a.jsxs(a.Fragment,{children:[a.jsx(Mx,{className:"w-5 h-5 text-gray-400"}),a.jsx("span",{className:"text-gray-500",children:"Off"})]})})}),a.jsx("td",{className:"px-6 py-4",children:a.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600",children:[a.jsx(xr,{className:"w-4 h-4 text-gray-400"}),x(_.last_scraped_at)]})})]},_.id)}const N=Object.values(j).flat()[0],P=N==null?void 0:N.logo_url;return a.jsxs(fs.Fragment,{children:[a.jsx("tr",{className:"bg-gray-100 border-b border-gray-200 cursor-pointer hover:bg-gray-150 transition-colors",onClick:()=>g(v),children:a.jsx("td",{colSpan:7,className:"px-6 py-4",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Cf,{className:`w-5 h-5 text-gray-600 transition-transform ${S?"rotate-90":""}`}),P&&a.jsx("img",{src:P,alt:`${v} logo`,className:"w-8 h-8 object-contain flex-shrink-0",onError:_=>{_.target.style.display="none"}}),a.jsx("span",{className:"text-base font-semibold text-gray-900",children:v}),a.jsxs("span",{className:"text-sm text-gray-500",children:["(",y," stores)"]})]})})}),S&&Object.entries(j).map(([_,T])=>{const $=`${v}-${_}`,M=o.has($);return a.jsxs(fs.Fragment,{children:[a.jsx("tr",{className:"bg-gray-50 border-b border-gray-100 cursor-pointer hover:bg-gray-100 transition-colors",onClick:()=>b(v,_),children:a.jsx("td",{colSpan:7,className:"px-6 py-3 pl-12",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Cf,{className:`w-4 h-4 text-gray-500 transition-transform ${M?"rotate-90":""}`}),a.jsx("span",{className:"text-sm font-medium text-gray-700",children:_}),a.jsxs("span",{className:"text-xs text-gray-500",children:["(",T.length," locations)"]})]})})}),M&&T.map(C=>a.jsxs("tr",{className:"border-b border-gray-100 hover:bg-gray-50 cursor-pointer transition-colors",onClick:()=>c(f(C)),title:"Click to view store",children:[a.jsx("td",{className:"px-6 py-4 pl-16",children:a.jsxs("div",{children:[a.jsx("div",{className:"font-semibold text-gray-900",children:C.name}),a.jsx("div",{className:"text-xs text-gray-500",children:C.slug})]})}),a.jsx("td",{className:"px-6 py-4",children:a.jsx("span",{className:"px-2 py-1 text-xs font-medium bg-blue-50 text-blue-700 rounded",children:"Dutchie"})}),a.jsx("td",{className:"px-6 py-4",children:a.jsxs("a",{href:C.dutchie_url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-sm text-blue-600 hover:text-blue-700",onClick:R=>R.stopPropagation(),children:[a.jsx("span",{children:"View Online"}),a.jsx(Jr,{className:"w-3 h-3"})]})}),a.jsx("td",{className:"px-6 py-4 text-center",children:a.jsxs("div",{className:"flex items-center justify-center gap-1",children:[a.jsx(Cr,{className:"w-4 h-4 text-gray-400"}),a.jsx("span",{className:"text-sm font-medium text-gray-900",children:C.category_count||0})]})}),a.jsx("td",{className:"px-6 py-4 text-center",children:a.jsxs("div",{className:"flex items-center justify-center gap-1",children:[a.jsx(Ct,{className:"w-4 h-4 text-gray-400"}),a.jsx("span",{className:"text-sm font-medium text-gray-900",children:C.product_count||0})]})}),a.jsx("td",{className:"px-6 py-4 text-center",onClick:R=>R.stopPropagation(),children:a.jsx("button",{onClick:R=>m(C.id,C.scrape_enabled,R),className:"inline-flex items-center gap-1 text-sm font-medium transition-colors",children:C.scrape_enabled?a.jsxs(a.Fragment,{children:[a.jsx(Ix,{className:"w-5 h-5 text-green-600"}),a.jsx("span",{className:"text-green-600",children:"On"})]}):a.jsxs(a.Fragment,{children:[a.jsx(Mx,{className:"w-5 h-5 text-gray-400"}),a.jsx("span",{className:"text-gray-500",children:"Off"})]})})}),a.jsx("td",{className:"px-6 py-4",children:a.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600",children:[a.jsx(xr,{className:"w-4 h-4 text-gray-400"}),x(C.last_scraped_at)]})})]},C.id))]},`state-${$}`)})]},`chain-${v}`)})})]})})}),e.length===0&&a.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-12 text-center",children:[a.jsx(Il,{className:"w-16 h-16 text-gray-300 mx-auto mb-4"}),a.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-2",children:"No stores found"}),a.jsx("p",{className:"text-gray-500",children:"Start by adding stores to your database"})]})]})})}function r7(){const e=dt(),[t,r]=h.useState([]),[n,i]=h.useState(!0),[s,o]=h.useState(""),[l,c]=h.useState(""),[d,u]=h.useState(null),[f,p]=h.useState({});h.useEffect(()=>{m()},[]);const m=async()=>{i(!0);try{const y=await B.getDispensaries();r(y.dispensaries)}catch(y){console.error("Failed to load dispensaries:",y)}finally{i(!1)}},x=y=>{u(y),p({dba_name:y.dba_name||"",website:y.website||"",phone:y.phone||"",google_rating:y.google_rating||"",google_review_count:y.google_review_count||""})},g=async()=>{if(d)try{await B.updateDispensary(d.id,f),await m(),u(null),p({})}catch(y){console.error("Failed to update dispensary:",y),alert("Failed to update dispensary")}},b=()=>{u(null),p({})},v=t.filter(y=>{const w=s.toLowerCase(),S=!s||y.name.toLowerCase().includes(w)||y.company_name&&y.company_name.toLowerCase().includes(w)||y.dba_name&&y.dba_name.toLowerCase().includes(w),N=!l||y.city===l;return S&&N}),j=Array.from(new Set(t.map(y=>y.city).filter(Boolean))).sort();return a.jsxs(X,{children:[a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"Dispensaries"}),a.jsxs("p",{className:"text-sm text-gray-600 mt-1",children:["AZDHS official dispensary directory (",t.length," total)"]})]}),a.jsx("div",{className:"bg-white rounded-lg border border-gray-200 p-4",children:a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Search"}),a.jsxs("div",{className:"relative",children:[a.jsx(AO,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-gray-400"}),a.jsx("input",{type:"text",value:s,onChange:y=>o(y.target.value),placeholder:"Search by name or company...",className:"w-full pl-10 pr-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Filter by City"}),a.jsxs("select",{value:l,onChange:y=>c(y.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500",children:[a.jsx("option",{value:"",children:"All Cities"}),j.map(y=>a.jsx("option",{value:y,children:y},y))]})]})]})}),n?a.jsxs("div",{className:"text-center py-12",children:[a.jsx("div",{className:"inline-block animate-spin rounded-full h-8 w-8 border-4 border-blue-500 border-t-transparent"}),a.jsx("p",{className:"mt-2 text-sm text-gray-600",children:"Loading dispensaries..."})]}):a.jsxs("div",{className:"bg-white rounded-lg border border-gray-200 overflow-hidden",children:[a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full",children:[a.jsx("thead",{className:"bg-gray-50 border-b border-gray-200",children:a.jsxs("tr",{children:[a.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-700 uppercase tracking-wider",children:"Name"}),a.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-700 uppercase tracking-wider",children:"Company"}),a.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-700 uppercase tracking-wider",children:"Address"}),a.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-700 uppercase tracking-wider",children:"City"}),a.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-700 uppercase tracking-wider",children:"Phone"}),a.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-700 uppercase tracking-wider",children:"Email"}),a.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-700 uppercase tracking-wider",children:"Website"}),a.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-700 uppercase tracking-wider",children:"Actions"})]})}),a.jsx("tbody",{className:"divide-y divide-gray-200",children:v.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:8,className:"px-4 py-8 text-center text-sm text-gray-500",children:"No dispensaries found"})}):v.map(y=>a.jsxs("tr",{className:"hover:bg-gray-50",children:[a.jsx("td",{className:"px-4 py-3",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Ln,{className:"w-4 h-4 text-gray-400 flex-shrink-0"}),a.jsxs("div",{className:"flex flex-col",children:[a.jsx("span",{className:"text-sm font-medium text-gray-900",children:y.dba_name||y.name}),y.dba_name&&y.google_rating&&a.jsxs("span",{className:"text-xs text-gray-500",children:["⭐ ",y.google_rating," (",y.google_review_count," reviews)"]})]})]})}),a.jsx("td",{className:"px-4 py-3",children:a.jsx("span",{className:"text-sm text-gray-600",children:y.company_name||"-"})}),a.jsx("td",{className:"px-4 py-3",children:a.jsxs("div",{className:"flex items-start gap-1",children:[a.jsx(yi,{className:"w-3 h-3 text-gray-400 flex-shrink-0 mt-0.5"}),a.jsx("span",{className:"text-sm text-gray-600",children:y.address||"-"})]})}),a.jsxs("td",{className:"px-4 py-3",children:[a.jsx("span",{className:"text-sm text-gray-600",children:y.city||"-"}),y.zip&&a.jsxs("span",{className:"text-xs text-gray-400 ml-1",children:["(",y.zip,")"]})]}),a.jsx("td",{className:"px-4 py-3",children:y.phone?a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(Ah,{className:"w-3 h-3 text-gray-400"}),a.jsx("span",{className:"text-sm text-gray-600",children:y.phone.replace(/(\d{3})(\d{3})(\d{4})/,"($1) $2-$3")})]}):a.jsx("span",{className:"text-sm text-gray-400",children:"-"})}),a.jsx("td",{className:"px-4 py-3",children:y.email?a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(tj,{className:"w-3 h-3 text-gray-400"}),a.jsx("a",{href:`mailto:${y.email}`,className:"text-sm text-blue-600 hover:text-blue-800",children:y.email})]}):a.jsx("span",{className:"text-sm text-gray-400",children:"-"})}),a.jsx("td",{className:"px-4 py-3",children:y.website?a.jsxs("a",{href:y.website,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-sm text-blue-600 hover:text-blue-800",children:[a.jsx(Jr,{className:"w-3 h-3"}),a.jsx("span",{children:"Visit Site"})]}):a.jsx("span",{className:"text-sm text-gray-400",children:"-"})}),a.jsx("td",{className:"px-4 py-3",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{onClick:()=>x(y),className:"inline-flex items-center gap-1 px-3 py-1.5 text-sm font-medium text-gray-600 hover:text-gray-800 hover:bg-gray-50 rounded-lg transition-colors",title:"Edit",children:a.jsx(wO,{className:"w-4 h-4"})}),a.jsx("button",{onClick:()=>{const w=y.city.toLowerCase().replace(/\s+/g,"-");e(`/dispensaries/${y.state}/${w}/${y.slug}`)},className:"inline-flex items-center gap-1 px-3 py-1.5 text-sm font-medium text-blue-600 hover:text-blue-800 hover:bg-blue-50 rounded-lg transition-colors",title:"View",children:a.jsx(rO,{className:"w-4 h-4"})})]})})]},y.id))})]})}),a.jsx("div",{className:"bg-gray-50 px-4 py-3 border-t border-gray-200",children:a.jsxs("div",{className:"text-sm text-gray-600",children:["Showing ",v.length," of ",t.length," dispensaries"]})})]})]}),d&&a.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-white rounded-lg shadow-xl max-w-2xl w-full mx-4 max-h-[90vh] overflow-y-auto",children:[a.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200",children:[a.jsxs("h2",{className:"text-xl font-bold text-gray-900",children:["Edit Dispensary: ",d.name]}),a.jsx("button",{onClick:b,className:"text-gray-400 hover:text-gray-600",children:a.jsx(ij,{className:"w-6 h-6"})})]}),a.jsxs("div",{className:"p-6 space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"DBA Name (Display Name)"}),a.jsx("input",{type:"text",value:f.dba_name,onChange:y=>p({...f,dba_name:y.target.value}),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500",placeholder:"e.g., Green Med Wellness"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Website"}),a.jsx("input",{type:"url",value:f.website,onChange:y=>p({...f,website:y.target.value}),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500",placeholder:"https://example.com"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Phone Number"}),a.jsx("input",{type:"tel",value:f.phone,onChange:y=>p({...f,phone:y.target.value}),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500",placeholder:"5551234567"})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Google Rating"}),a.jsx("input",{type:"number",step:"0.1",min:"0",max:"5",value:f.google_rating,onChange:y=>p({...f,google_rating:y.target.value}),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500",placeholder:"4.5"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Review Count"}),a.jsx("input",{type:"number",min:"0",value:f.google_review_count,onChange:y=>p({...f,google_review_count:y.target.value}),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500",placeholder:"123"})]})]}),a.jsxs("div",{className:"bg-gray-50 p-4 rounded-lg space-y-2",children:[a.jsxs("div",{className:"text-sm",children:[a.jsx("span",{className:"font-medium text-gray-700",children:"AZDHS Name:"})," ",a.jsx("span",{className:"text-gray-600",children:d.name})]}),a.jsxs("div",{className:"text-sm",children:[a.jsx("span",{className:"font-medium text-gray-700",children:"Address:"})," ",a.jsxs("span",{className:"text-gray-600",children:[d.address,", ",d.city,", ",d.state," ",d.zip]})]})]})]}),a.jsxs("div",{className:"flex items-center justify-end gap-3 p-6 border-t border-gray-200",children:[a.jsx("button",{onClick:b,className:"px-4 py-2 text-sm font-medium text-gray-700 hover:text-gray-900 hover:bg-gray-100 rounded-lg transition-colors",children:"Cancel"}),a.jsxs("button",{onClick:g,className:"inline-flex items-center gap-2 px-4 py-2 text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 rounded-lg transition-colors",children:[a.jsx(_O,{className:"w-4 h-4"}),"Save Changes"]})]})]})})]})}function n7(){const{state:e,city:t,slug:r}=Na(),n=dt(),[i,s]=h.useState(null),[o,l]=h.useState([]),[c,d]=h.useState([]),[u,f]=h.useState([]),[p,m]=h.useState(!0),[x,g]=h.useState("products"),[b,v]=h.useState(!1),[j,y]=h.useState(!1),[w,S]=h.useState(""),[N,P]=h.useState(1),[_]=h.useState(25),T=D=>{if(!D)return"Never";const O=new Date(D),L=new Date().getTime()-O.getTime(),U=Math.floor(L/(1e3*60*60*24));return U===0?"Today":U===1?"Yesterday":U<7?`${U} days ago`:O.toLocaleDateString()};h.useEffect(()=>{$()},[r]);const $=async()=>{m(!0);try{const[D,O,k,L]=await Promise.all([B.getDispensary(r),B.getDispensaryProducts(r).catch(()=>({products:[]})),B.getDispensaryBrands(r).catch(()=>({brands:[]})),B.getDispensarySpecials(r).catch(()=>({specials:[]}))]);s(D),l(O.products),d(k.brands),f(L.specials)}catch(D){console.error("Failed to load dispensary:",D)}finally{m(!1)}},M=async D=>{v(!1),y(!0);try{const O=await fetch(`https://dispos.crawlsy.com/api/dispensaries/${r}/scrape`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("token")}`},body:JSON.stringify({type:D})});if(!O.ok)throw new Error("Failed to trigger scraping");const k=await O.json();alert(`${D.charAt(0).toUpperCase()+D.slice(1)} update started! ${k.message||""}`)}catch(O){console.error("Failed to trigger scraping:",O),alert("Failed to start update. Please try again.")}finally{y(!1)}},C=o.filter(D=>{var k,L,U,H,te;if(!w)return!0;const O=w.toLowerCase();return((k=D.name)==null?void 0:k.toLowerCase().includes(O))||((L=D.brand)==null?void 0:L.toLowerCase().includes(O))||((U=D.variant)==null?void 0:U.toLowerCase().includes(O))||((H=D.description)==null?void 0:H.toLowerCase().includes(O))||((te=D.strain_type)==null?void 0:te.toLowerCase().includes(O))}),R=Math.ceil(C.length/_),q=(N-1)*_,Z=q+_,E=C.slice(q,Z);return h.useEffect(()=>{P(1)},[w]),p?a.jsx(X,{children:a.jsxs("div",{className:"text-center py-12",children:[a.jsx("div",{className:"inline-block animate-spin rounded-full h-8 w-8 border-4 border-blue-500 border-t-transparent"}),a.jsx("p",{className:"mt-2 text-sm text-gray-600",children:"Loading dispensary..."})]})}):i?a.jsx(X,{children:a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-center justify-between gap-4",children:[a.jsxs("button",{onClick:()=>n("/dispensaries"),className:"flex items-center gap-2 text-sm text-gray-600 hover:text-gray-900",children:[a.jsx(_h,{className:"w-4 h-4"}),"Back to Dispensaries"]}),a.jsxs("div",{className:"relative",children:[a.jsxs("button",{onClick:()=>v(!b),disabled:j,className:"flex items-center gap-2 px-4 py-2 text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 rounded-lg disabled:opacity-50 disabled:cursor-not-allowed",children:[a.jsx(Xt,{className:`w-4 h-4 ${j?"animate-spin":""}`}),j?"Updating...":"Update",!j&&a.jsx(ej,{className:"w-4 h-4"})]}),b&&!j&&a.jsxs("div",{className:"absolute right-0 mt-2 w-48 bg-white rounded-lg shadow-lg border border-gray-200 z-10",children:[a.jsx("button",{onClick:()=>M("products"),className:"w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 rounded-t-lg",children:"Products"}),a.jsx("button",{onClick:()=>M("brands"),className:"w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-100",children:"Brands"}),a.jsx("button",{onClick:()=>M("specials"),className:"w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-100",children:"Specials"}),a.jsx("button",{onClick:()=>M("all"),className:"w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 rounded-b-lg border-t border-gray-200",children:"All"})]})]})]}),a.jsxs("div",{className:"bg-white rounded-lg border border-gray-200 p-6",children:[a.jsxs("div",{className:"flex items-start justify-between gap-4 mb-4",children:[a.jsxs("div",{className:"flex items-start gap-4",children:[a.jsx("div",{className:"p-3 bg-blue-50 rounded-lg",children:a.jsx(Ln,{className:"w-8 h-8 text-blue-600"})}),a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:i.dba_name||i.name}),i.company_name&&a.jsx("p",{className:"text-sm text-gray-600 mt-1",children:i.company_name})]})]}),a.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600 bg-gray-50 px-4 py-2 rounded-lg",children:[a.jsx(Ch,{className:"w-4 h-4"}),a.jsxs("div",{children:[a.jsx("span",{className:"font-medium",children:"Last Crawl Date:"}),a.jsx("span",{className:"ml-2",children:i.last_menu_scrape?new Date(i.last_menu_scrape).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"Never"})]})]})]}),a.jsxs("div",{className:"flex flex-wrap gap-4",children:[i.address&&a.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600",children:[a.jsx(yi,{className:"w-4 h-4"}),a.jsxs("span",{children:[i.address,", ",i.city,", ",i.state," ",i.zip]})]}),i.phone&&a.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600",children:[a.jsx(Ah,{className:"w-4 h-4"}),a.jsx("span",{children:i.phone.replace(/(\d{3})(\d{3})(\d{4})/,"($1) $2-$3")})]}),a.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600",children:[a.jsx(Jr,{className:"w-4 h-4"}),i.website?a.jsx("a",{href:i.website,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800",children:"Website"}):a.jsx("span",{children:"Website N/A"})]}),i.email&&a.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[a.jsx(tj,{className:"w-4 h-4 text-gray-400"}),a.jsx("a",{href:`mailto:${i.email}`,className:"text-blue-600 hover:text-blue-800",children:i.email})]}),i.azdhs_url&&a.jsxs("a",{href:i.azdhs_url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 text-sm text-blue-600 hover:text-blue-800",children:[a.jsx(Jr,{className:"w-4 h-4"}),a.jsx("span",{children:"AZDHS Profile"})]}),a.jsxs(K1,{to:"/schedule",className:"flex items-center gap-2 text-sm text-blue-600 hover:text-blue-800",children:[a.jsx(xr,{className:"w-4 h-4"}),a.jsx("span",{children:"View Schedule"})]})]})]}),a.jsxs("div",{className:"grid grid-cols-4 gap-6",children:[a.jsx("button",{onClick:()=>{g("products"),S("")},className:"bg-white rounded-lg border border-gray-200 p-6 hover:border-blue-300 hover:shadow-md transition-all cursor-pointer text-left",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 bg-green-50 rounded-lg",children:a.jsx(Ct,{className:"w-5 h-5 text-green-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm text-gray-600",children:"Total Products"}),a.jsx("p",{className:"text-2xl font-bold text-gray-900",children:o.length})]})]})}),a.jsx("button",{onClick:()=>g("brands"),className:"bg-white rounded-lg border border-gray-200 p-6 hover:border-blue-300 hover:shadow-md transition-all cursor-pointer text-left",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 bg-purple-50 rounded-lg",children:a.jsx(Cr,{className:"w-5 h-5 text-purple-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm text-gray-600",children:"Brands"}),a.jsx("p",{className:"text-2xl font-bold text-gray-900",children:c.length})]})]})}),a.jsx("button",{onClick:()=>g("specials"),className:"bg-white rounded-lg border border-gray-200 p-6 hover:border-blue-300 hover:shadow-md transition-all cursor-pointer text-left",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 bg-blue-50 rounded-lg",children:a.jsx(zn,{className:"w-5 h-5 text-blue-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm text-gray-600",children:"Active Specials"}),a.jsx("p",{className:"text-2xl font-bold text-gray-900",children:u.length})]})]})}),a.jsx("div",{className:"bg-white rounded-lg border border-gray-200 p-6",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 bg-orange-50 rounded-lg",children:a.jsx(QA,{className:"w-5 h-5 text-orange-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm text-gray-600",children:"Avg Price"}),a.jsx("p",{className:"text-2xl font-bold text-gray-900",children:o.length>0?`$${(o.reduce((D,O)=>D+(O.sale_price||O.regular_price||0),0)/o.length).toFixed(2)}`:"-"})]})]})})]}),a.jsxs("div",{className:"bg-white rounded-lg border border-gray-200",children:[a.jsx("div",{className:"border-b border-gray-200",children:a.jsxs("div",{className:"flex gap-4 px-6",children:[a.jsxs("button",{onClick:()=>g("products"),className:`py-4 px-2 text-sm font-medium border-b-2 ${x==="products"?"border-blue-600 text-blue-600":"border-transparent text-gray-600 hover:text-gray-900"}`,children:["Products (",o.length,")"]}),a.jsxs("button",{onClick:()=>g("brands"),className:`py-4 px-2 text-sm font-medium border-b-2 ${x==="brands"?"border-blue-600 text-blue-600":"border-transparent text-gray-600 hover:text-gray-900"}`,children:["Brands (",c.length,")"]}),a.jsxs("button",{onClick:()=>g("specials"),className:`py-4 px-2 text-sm font-medium border-b-2 ${x==="specials"?"border-blue-600 text-blue-600":"border-transparent text-gray-600 hover:text-gray-900"}`,children:["Specials (",u.length,")"]})]})}),a.jsxs("div",{className:"p-6",children:[x==="products"&&a.jsx("div",{className:"space-y-4",children:o.length===0?a.jsx("p",{className:"text-center py-8 text-gray-500",children:"No products available"}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center gap-4 mb-4",children:[a.jsx("input",{type:"text",placeholder:"Search products by name, brand, variant, description, or strain type...",value:w,onChange:D=>S(D.target.value),className:"input input-bordered input-sm flex-1"}),w&&a.jsx("button",{onClick:()=>S(""),className:"btn btn-sm btn-ghost",children:"Clear"}),a.jsxs("div",{className:"text-sm text-gray-600",children:["Showing ",q+1,"-",Math.min(Z,C.length)," of ",C.length," products"]})]}),a.jsx("div",{className:"overflow-x-auto -mx-6 px-6",children:a.jsxs("table",{className:"table table-xs table-zebra table-pin-rows w-full",children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{children:"Image"}),a.jsx("th",{children:"Product Name"}),a.jsx("th",{children:"Brand"}),a.jsx("th",{children:"Variant"}),a.jsx("th",{children:"Description"}),a.jsx("th",{className:"text-right",children:"Price"}),a.jsx("th",{className:"text-center",children:"THC %"}),a.jsx("th",{className:"text-center",children:"CBD %"}),a.jsx("th",{className:"text-center",children:"Strain Type"}),a.jsx("th",{className:"text-center",children:"In Stock"}),a.jsx("th",{children:"Last Updated"}),a.jsx("th",{children:"Actions"})]})}),a.jsx("tbody",{children:E.map(D=>a.jsxs("tr",{children:[a.jsx("td",{className:"whitespace-nowrap",children:D.image_url?a.jsx("img",{src:D.image_url,alt:D.name,className:"w-12 h-12 object-cover rounded",onError:O=>O.currentTarget.style.display="none"}):"-"}),a.jsx("td",{className:"font-medium max-w-[150px]",children:a.jsx("div",{className:"line-clamp-2",title:D.name,children:D.name})}),a.jsx("td",{className:"max-w-[120px]",children:a.jsx("div",{className:"line-clamp-2",title:D.brand||"-",children:D.brand||"-"})}),a.jsx("td",{className:"max-w-[100px]",children:a.jsx("div",{className:"line-clamp-2",title:D.variant||"-",children:D.variant||"-"})}),a.jsx("td",{className:"w-[120px]",children:a.jsx("span",{title:D.description,children:D.description?D.description.length>15?D.description.substring(0,15)+"...":D.description:"-"})}),a.jsx("td",{className:"text-right font-semibold whitespace-nowrap",children:D.sale_price?a.jsxs("div",{className:"flex flex-col items-end",children:[a.jsxs("span",{className:"text-error",children:["$",D.sale_price]}),a.jsxs("span",{className:"text-gray-400 line-through text-xs",children:["$",D.regular_price]})]}):D.regular_price?`$${D.regular_price}`:"-"}),a.jsx("td",{className:"text-center whitespace-nowrap",children:D.thc_percentage?a.jsxs("span",{className:"badge badge-success badge-sm",children:[D.thc_percentage,"%"]}):"-"}),a.jsx("td",{className:"text-center whitespace-nowrap",children:D.cbd_percentage?a.jsxs("span",{className:"badge badge-info badge-sm",children:[D.cbd_percentage,"%"]}):"-"}),a.jsx("td",{className:"text-center whitespace-nowrap",children:D.strain_type?a.jsx("span",{className:"badge badge-ghost badge-sm",children:D.strain_type}):"-"}),a.jsx("td",{className:"text-center whitespace-nowrap",children:D.in_stock?a.jsx("span",{className:"badge badge-success badge-sm",children:"Yes"}):D.in_stock===!1?a.jsx("span",{className:"badge badge-error badge-sm",children:"No"}):"-"}),a.jsx("td",{className:"whitespace-nowrap text-xs text-gray-500",children:D.updated_at?T(D.updated_at):"-"}),a.jsx("td",{children:a.jsxs("div",{className:"flex gap-1",children:[D.dutchie_url&&a.jsx("a",{href:D.dutchie_url,target:"_blank",rel:"noopener noreferrer",className:"btn btn-xs btn-outline",children:"Dutchie"}),a.jsx("button",{onClick:()=>n(`/products/${D.id}`),className:"btn btn-xs btn-primary",children:"Details"})]})})]},D.id))})]})}),R>1&&a.jsxs("div",{className:"flex justify-center items-center gap-2 mt-4",children:[a.jsx("button",{onClick:()=>P(D=>Math.max(1,D-1)),disabled:N===1,className:"btn btn-sm btn-outline",children:"Previous"}),a.jsx("div",{className:"flex gap-1",children:Array.from({length:R},(D,O)=>O+1).map(D=>{const O=D===1||D===R||D>=N-1&&D<=N+1;return D===2&&N>3||D===R-1&&NP(D),className:`btn btn-sm ${N===D?"btn-primary":"btn-outline"}`,children:D},D):null})}),a.jsx("button",{onClick:()=>P(D=>Math.min(R,D+1)),disabled:N===R,className:"btn btn-sm btn-outline",children:"Next"})]})]})}),x==="brands"&&a.jsx("div",{className:"space-y-4",children:c.length===0?a.jsx("p",{className:"text-center py-8 text-gray-500",children:"No brands available"}):a.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",children:c.map(D=>a.jsxs("button",{onClick:()=>{g("products"),S(D.brand)},className:"border border-gray-200 rounded-lg p-4 text-center hover:border-blue-300 hover:shadow-md transition-all cursor-pointer",children:[a.jsx("p",{className:"font-medium text-gray-900 line-clamp-2",children:D.brand}),a.jsxs("p",{className:"text-sm text-gray-600 mt-1",children:[D.product_count," product",D.product_count!==1?"s":""]})]},D.brand))})}),x==="specials"&&a.jsx("div",{className:"space-y-4",children:u.length===0?a.jsx("p",{className:"text-center py-8 text-gray-500",children:"No active specials"}):a.jsx("div",{className:"space-y-3",children:u.map(D=>a.jsxs("div",{className:"border border-gray-200 rounded-lg p-4",children:[a.jsx("h4",{className:"font-medium text-gray-900",children:D.name}),D.description&&a.jsx("p",{className:"text-sm text-gray-600 mt-1",children:D.description}),a.jsxs("div",{className:"flex items-center gap-4 mt-2 text-sm text-gray-500",children:[a.jsxs("span",{children:[new Date(D.start_date).toLocaleDateString()," -"," ",D.end_date?new Date(D.end_date).toLocaleDateString():"Ongoing"]}),a.jsxs("span",{children:[D.product_count," products"]})]})]},D.id))})})]})]})]})}):a.jsx(X,{children:a.jsx("div",{className:"text-center py-12",children:a.jsx("p",{className:"text-gray-600",children:"Dispensary not found"})})})}function i7(){var $,M;const{slug:e}=Na(),t=dt(),[r,n]=h.useState(null),[i,s]=h.useState([]),[o,l]=h.useState([]),[c,d]=h.useState([]),[u,f]=h.useState(!0),[p,m]=h.useState(null),[x,g]=h.useState(""),[b,v]=h.useState("products"),[j,y]=h.useState("name");h.useEffect(()=>{w()},[e]),h.useEffect(()=>{r&&S()},[p,x,j,r]);const w=async()=>{f(!0);try{const R=(await B.getStores()).stores.find(D=>D.slug===e);if(!R)throw new Error("Store not found");const[q,Z,E]=await Promise.all([B.getStore(R.id),B.getCategories(R.id),B.getStoreBrands(R.id)]);n(q),l(Z.categories||[]),d(E.brands||[])}catch(C){console.error("Failed to load store data:",C)}finally{f(!1)}},S=async()=>{if(r)try{const C={store_id:r.id,limit:1e3};p&&(C.category_id=p),x&&(C.brand=x);let q=(await B.getProducts(C)).products||[];q.sort((Z,E)=>{switch(j){case"name":return(Z.name||"").localeCompare(E.name||"");case"price_asc":return(Z.price||0)-(E.price||0);case"price_desc":return(E.price||0)-(Z.price||0);case"thc":return(E.thc_percentage||0)-(Z.thc_percentage||0);default:return 0}}),s(q)}catch(C){console.error("Failed to load products:",C)}},N=C=>C.image_url_full?C.image_url_full:C.medium_path?`http://localhost:9020/dutchie/${C.medium_path}`:C.thumbnail_path?`http://localhost:9020/dutchie/${C.thumbnail_path}`:"https://via.placeholder.com/300x300?text=No+Image",P=C=>C?new Date(C).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"}):"Never",_=C=>{switch(C==null?void 0:C.toLowerCase()){case"dutchie":return"bg-green-100 text-green-700";case"jane":return"bg-purple-100 text-purple-700";case"treez":return"bg-blue-100 text-blue-700";case"weedmaps":return"bg-orange-100 text-orange-700";case"leafly":return"bg-emerald-100 text-emerald-700";default:return"bg-gray-100 text-gray-700"}},T=C=>{switch(C){case"completed":return a.jsxs("span",{className:"px-2 py-1 text-xs font-medium bg-green-100 text-green-700 rounded-full flex items-center gap-1",children:[a.jsx(_r,{className:"w-3 h-3"})," Completed"]});case"running":return a.jsxs("span",{className:"px-2 py-1 text-xs font-medium bg-blue-100 text-blue-700 rounded-full flex items-center gap-1",children:[a.jsx(Xt,{className:"w-3 h-3 animate-spin"})," Running"]});case"failed":return a.jsxs("span",{className:"px-2 py-1 text-xs font-medium bg-red-100 text-red-700 rounded-full flex items-center gap-1",children:[a.jsx(Hr,{className:"w-3 h-3"})," Failed"]});case"pending":return a.jsxs("span",{className:"px-2 py-1 text-xs font-medium bg-yellow-100 text-yellow-700 rounded-full flex items-center gap-1",children:[a.jsx(xr,{className:"w-3 h-3"})," Pending"]});default:return a.jsx("span",{className:"px-2 py-1 text-xs font-medium bg-gray-100 text-gray-700 rounded-full",children:C})}};return u?a.jsx(X,{children:a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsx("div",{className:"w-8 h-8 border-4 border-gray-200 border-t-blue-600 rounded-full animate-spin"})})}):r?a.jsx(X,{children:a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-6",children:[a.jsxs("div",{className:"flex items-start justify-between mb-6",children:[a.jsxs("div",{className:"flex items-start gap-4",children:[a.jsx("button",{onClick:()=>t("/stores"),className:"text-gray-600 hover:text-gray-900 mt-1",children:"← Back"}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("h1",{className:"text-2xl font-semibold text-gray-900",children:r.name}),a.jsx("span",{className:`px-2 py-1 text-xs font-medium rounded ${_(r.provider)}`,children:r.provider||"Unknown"})]}),a.jsxs("p",{className:"text-sm text-gray-500 mt-1",children:["Store ID: ",r.id]})]})]}),a.jsxs("a",{href:r.dutchie_url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-sm text-blue-600 hover:text-blue-700",children:["View Menu ",a.jsx(Jr,{className:"w-4 h-4"})]})]}),a.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-6 gap-4 mb-6",children:[a.jsxs("div",{className:"p-4 bg-gray-50 rounded-lg",children:[a.jsxs("div",{className:"flex items-center gap-2 text-gray-500 text-xs mb-1",children:[a.jsx(Ct,{className:"w-4 h-4"}),"Products"]}),a.jsx("p",{className:"text-xl font-semibold text-gray-900",children:r.product_count||0})]}),a.jsxs("div",{className:"p-4 bg-gray-50 rounded-lg",children:[a.jsxs("div",{className:"flex items-center gap-2 text-gray-500 text-xs mb-1",children:[a.jsx(Cr,{className:"w-4 h-4"}),"Categories"]}),a.jsx("p",{className:"text-xl font-semibold text-gray-900",children:r.category_count||0})]}),a.jsxs("div",{className:"p-4 bg-green-50 rounded-lg",children:[a.jsxs("div",{className:"flex items-center gap-2 text-green-600 text-xs mb-1",children:[a.jsx(_r,{className:"w-4 h-4"}),"In Stock"]}),a.jsx("p",{className:"text-xl font-semibold text-green-700",children:r.in_stock_count||0})]}),a.jsxs("div",{className:"p-4 bg-red-50 rounded-lg",children:[a.jsxs("div",{className:"flex items-center gap-2 text-red-600 text-xs mb-1",children:[a.jsx(Hr,{className:"w-4 h-4"}),"Out of Stock"]}),a.jsx("p",{className:"text-xl font-semibold text-red-700",children:r.out_of_stock_count||0})]}),a.jsxs("div",{className:`p-4 rounded-lg ${r.is_stale?"bg-yellow-50":"bg-blue-50"}`,children:[a.jsxs("div",{className:`flex items-center gap-2 text-xs mb-1 ${r.is_stale?"text-yellow-600":"text-blue-600"}`,children:[a.jsx(xr,{className:"w-4 h-4"}),"Freshness"]}),a.jsx("p",{className:`text-sm font-semibold ${r.is_stale?"text-yellow-700":"text-blue-700"}`,children:r.freshness||"Never scraped"})]}),a.jsxs("div",{className:"p-4 bg-gray-50 rounded-lg",children:[a.jsxs("div",{className:"flex items-center gap-2 text-gray-500 text-xs mb-1",children:[a.jsx(Ch,{className:"w-4 h-4"}),"Next Crawl"]}),a.jsx("p",{className:"text-sm font-semibold text-gray-700",children:($=r.schedule)!=null&&$.next_run_at?P(r.schedule.next_run_at):"Not scheduled"})]})]}),r.linked_dispensary&&a.jsxs("div",{className:"p-4 bg-indigo-50 rounded-lg mb-6",children:[a.jsxs("div",{className:"flex items-center gap-2 text-indigo-600 text-xs mb-2",children:[a.jsx(WA,{className:"w-4 h-4"}),"Linked Dispensary"]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("p",{className:"font-semibold text-indigo-900",children:r.linked_dispensary.name}),a.jsxs("p",{className:"text-sm text-indigo-700 flex items-center gap-1",children:[a.jsx(yi,{className:"w-3 h-3"}),r.linked_dispensary.city,", ",r.linked_dispensary.state,r.linked_dispensary.address&&` - ${r.linked_dispensary.address}`]})]}),a.jsx("button",{onClick:()=>t(`/dispensaries/${r.linked_dispensary.slug}`),className:"text-sm text-indigo-600 hover:text-indigo-700 font-medium",children:"View Dispensary →"})]})]}),a.jsxs("div",{className:"flex gap-2 border-b border-gray-200",children:[a.jsx("button",{onClick:()=>v("products"),className:`px-4 py-2 border-b-2 transition-colors ${b==="products"?"border-blue-600 text-blue-600 font-medium":"border-transparent text-gray-600 hover:text-gray-900"}`,children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Ct,{className:"w-4 h-4"}),"Products (",i.length,")"]})}),a.jsx("button",{onClick:()=>v("brands"),className:`px-4 py-2 border-b-2 transition-colors ${b==="brands"?"border-blue-600 text-blue-600 font-medium":"border-transparent text-gray-600 hover:text-gray-900"}`,children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Cr,{className:"w-4 h-4"}),"Brands (",c.length,")"]})}),a.jsx("button",{onClick:()=>v("specials"),className:`px-4 py-2 border-b-2 transition-colors ${b==="specials"?"border-blue-600 text-blue-600 font-medium":"border-transparent text-gray-600 hover:text-gray-900"}`,children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx($x,{className:"w-4 h-4"}),"Specials"]})}),a.jsx("button",{onClick:()=>v("crawl-history"),className:`px-4 py-2 border-b-2 transition-colors ${b==="crawl-history"?"border-blue-600 text-blue-600 font-medium":"border-transparent text-gray-600 hover:text-gray-900"}`,children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Ds,{className:"w-4 h-4"}),"Crawl History (",((M=r.recent_jobs)==null?void 0:M.length)||0,")"]})})]})]}),b==="crawl-history"&&a.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 overflow-hidden",children:[a.jsxs("div",{className:"p-4 border-b border-gray-200",children:[a.jsx("h2",{className:"text-lg font-semibold text-gray-900",children:"Recent Crawl Jobs"}),a.jsx("p",{className:"text-sm text-gray-500",children:"Last 10 crawl jobs for this store"})]}),r.recent_jobs&&r.recent_jobs.length>0?a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full",children:[a.jsx("thead",{className:"bg-gray-50",children:a.jsxs("tr",{children:[a.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"Status"}),a.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"Type"}),a.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"Started"}),a.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"Completed"}),a.jsx("th",{className:"px-4 py-3 text-center text-xs font-medium text-gray-500 uppercase",children:"Found"}),a.jsx("th",{className:"px-4 py-3 text-center text-xs font-medium text-gray-500 uppercase",children:"New"}),a.jsx("th",{className:"px-4 py-3 text-center text-xs font-medium text-gray-500 uppercase",children:"Updated"}),a.jsx("th",{className:"px-4 py-3 text-center text-xs font-medium text-gray-500 uppercase",children:"In Stock"}),a.jsx("th",{className:"px-4 py-3 text-center text-xs font-medium text-gray-500 uppercase",children:"Out of Stock"}),a.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"Error"})]})}),a.jsx("tbody",{className:"divide-y divide-gray-100",children:r.recent_jobs.map(C=>a.jsxs("tr",{className:"hover:bg-gray-50",children:[a.jsx("td",{className:"px-4 py-3",children:T(C.status)}),a.jsx("td",{className:"px-4 py-3 text-sm text-gray-700",children:C.job_type||"-"}),a.jsx("td",{className:"px-4 py-3 text-sm text-gray-700",children:P(C.started_at)}),a.jsx("td",{className:"px-4 py-3 text-sm text-gray-700",children:P(C.completed_at)}),a.jsx("td",{className:"px-4 py-3 text-center text-sm font-medium text-gray-900",children:C.products_found??"-"}),a.jsx("td",{className:"px-4 py-3 text-center text-sm font-medium text-green-600",children:C.products_new??"-"}),a.jsx("td",{className:"px-4 py-3 text-center text-sm font-medium text-blue-600",children:C.products_updated??"-"}),a.jsx("td",{className:"px-4 py-3 text-center text-sm font-medium text-green-600",children:C.in_stock_count??"-"}),a.jsx("td",{className:"px-4 py-3 text-center text-sm font-medium text-red-600",children:C.out_of_stock_count??"-"}),a.jsx("td",{className:"px-4 py-3 text-sm text-red-600 max-w-xs truncate",title:C.error_message||"",children:C.error_message||"-"})]},C.id))})]})}):a.jsxs("div",{className:"text-center py-12",children:[a.jsx(Ds,{className:"w-16 h-16 text-gray-300 mx-auto mb-4"}),a.jsx("p",{className:"text-gray-500",children:"No crawl history available"})]})]}),b==="products"&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"bg-white rounded-xl border border-gray-200 p-4",children:a.jsxs("div",{className:"flex flex-wrap gap-4",children:[a.jsxs("div",{className:"flex-1 min-w-[200px]",children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Category"}),a.jsxs("select",{value:p||"",onChange:C=>m(C.target.value?parseInt(C.target.value):null),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500",children:[a.jsx("option",{value:"",children:"All Categories"}),o.map(C=>a.jsxs("option",{value:C.id,children:[C.name," (",i.filter(R=>R.category_id===C.id).length,")"]},C.id))]})]}),a.jsxs("div",{className:"flex-1 min-w-[200px]",children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Brand"}),a.jsxs("select",{value:x,onChange:C=>g(C.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500",children:[a.jsx("option",{value:"",children:"All Brands"}),c.map(C=>a.jsx("option",{value:C,children:C},C))]})]}),a.jsxs("div",{className:"flex-1 min-w-[200px]",children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Sort By"}),a.jsxs("select",{value:j,onChange:C=>y(C.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500",children:[a.jsx("option",{value:"name",children:"Name (A-Z)"}),a.jsx("option",{value:"price_asc",children:"Price (Low to High)"}),a.jsx("option",{value:"price_desc",children:"Price (High to Low)"}),a.jsx("option",{value:"thc",children:"THC % (High to Low)"})]})]})]})}),i.length>0?a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:i.map(C=>a.jsxs("div",{className:"bg-white rounded-lg border border-gray-200 overflow-hidden hover:shadow-lg transition-shadow",children:[a.jsxs("div",{className:"aspect-square bg-gray-50 relative",children:[a.jsx("img",{src:N(C),alt:C.name,className:"w-full h-full object-cover"}),C.in_stock?a.jsx("span",{className:"absolute top-2 right-2 px-2 py-1 bg-green-500 text-white text-xs font-medium rounded",children:"In Stock"}):a.jsx("span",{className:"absolute top-2 right-2 px-2 py-1 bg-red-500 text-white text-xs font-medium rounded",children:"Out of Stock"})]}),a.jsxs("div",{className:"p-3 space-y-2",children:[a.jsx("h3",{className:"font-semibold text-sm text-gray-900 line-clamp-2",children:C.name}),C.brand&&a.jsx("p",{className:"text-xs text-gray-600 font-medium",children:C.brand}),C.category_name&&a.jsx("p",{className:"text-xs text-gray-500",children:C.category_name}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 pt-2 border-t border-gray-100",children:[C.price!==null&&a.jsxs("div",{className:"text-xs",children:[a.jsx("span",{className:"text-gray-500",children:"Price:"}),a.jsxs("span",{className:"ml-1 font-semibold text-blue-600",children:["$",parseFloat(C.price).toFixed(2)]})]}),C.weight&&a.jsxs("div",{className:"text-xs",children:[a.jsx("span",{className:"text-gray-500",children:"Weight:"}),a.jsx("span",{className:"ml-1 font-medium",children:C.weight})]}),C.thc_percentage!==null&&a.jsxs("div",{className:"text-xs",children:[a.jsx("span",{className:"text-gray-500",children:"THC:"}),a.jsxs("span",{className:"ml-1 font-medium text-green-600",children:[C.thc_percentage,"%"]})]}),C.cbd_percentage!==null&&a.jsxs("div",{className:"text-xs",children:[a.jsx("span",{className:"text-gray-500",children:"CBD:"}),a.jsxs("span",{className:"ml-1 font-medium text-blue-600",children:[C.cbd_percentage,"%"]})]}),C.strain_type&&a.jsxs("div",{className:"text-xs col-span-2",children:[a.jsx("span",{className:"text-gray-500",children:"Type:"}),a.jsx("span",{className:"ml-1 font-medium capitalize",children:C.strain_type})]})]}),C.description&&a.jsx("p",{className:"text-xs text-gray-600 line-clamp-2 pt-2 border-t border-gray-100",children:C.description}),C.last_seen_at&&a.jsxs("p",{className:"text-xs text-gray-400 pt-2 border-t border-gray-100",children:["Updated: ",new Date(C.last_seen_at).toLocaleDateString()]}),a.jsxs("div",{className:"flex gap-2 mt-3 pt-3 border-t border-gray-100",children:[C.dutchie_url&&a.jsx("a",{href:C.dutchie_url,target:"_blank",rel:"noopener noreferrer",className:"flex-1 px-3 py-2 bg-gray-100 text-gray-700 text-sm font-medium rounded-lg hover:bg-gray-200 transition-colors text-center border border-gray-200",children:"Dutchie"}),a.jsx("button",{onClick:()=>t(`/products/${C.id}`),className:"flex-1 px-3 py-2 bg-blue-600 text-white text-sm font-medium rounded-lg hover:bg-blue-700 transition-colors",children:"Details"})]})]})]},C.id))}):a.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-12 text-center",children:[a.jsx(Ct,{className:"w-16 h-16 text-gray-300 mx-auto mb-4"}),a.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-2",children:"No products found"}),a.jsx("p",{className:"text-gray-500",children:"Try adjusting your filters"})]})]}),b==="brands"&&a.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-6",children:[a.jsxs("h2",{className:"text-lg font-semibold text-gray-900 mb-4",children:["All Brands (",c.length,")"]}),c.length>0?a.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 gap-3",children:c.map(C=>{const R=i.filter(q=>q.brand===C);return a.jsxs("div",{className:"p-4 border border-gray-200 rounded-lg hover:border-blue-500 hover:bg-blue-50 transition-all cursor-pointer",onClick:()=>{v("products"),g(C)},children:[a.jsx("p",{className:"font-medium text-gray-900 text-sm",children:C}),a.jsxs("p",{className:"text-xs text-gray-500 mt-1",children:[R.length," products"]})]},C)})}):a.jsxs("div",{className:"text-center py-12",children:[a.jsx(Cr,{className:"w-16 h-16 text-gray-300 mx-auto mb-4"}),a.jsx("p",{className:"text-gray-500",children:"No brands found"})]})]}),b==="specials"&&a.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-6",children:[a.jsx("h2",{className:"text-lg font-semibold text-gray-900 mb-4",children:"Daily Specials"}),a.jsxs("div",{className:"text-center py-12",children:[a.jsx($x,{className:"w-16 h-16 text-gray-300 mx-auto mb-4"}),a.jsx("p",{className:"text-gray-500",children:"No specials available"})]})]})]})}):a.jsx(X,{children:a.jsxs("div",{className:"text-center py-12",children:[a.jsx("h2",{className:"text-2xl font-bold text-gray-900 mb-2",children:"Store not found"}),a.jsx("button",{onClick:()=>t("/stores"),className:"text-blue-600 hover:text-blue-700",children:"← Back to stores"})]})})}function a7(){const{state:e,storeName:t,slug:r}=Na(),n=dt(),[i,s]=h.useState(null),[o,l]=h.useState([]),[c,d]=h.useState(!0);h.useEffect(()=>{u()},[r]);const u=async()=>{d(!0);try{const p=(await B.getStores()).stores.find(x=>x.slug===r);if(!p)throw new Error("Store not found");s(p);const m=await B.getStoreBrands(p.id);l(m.brands)}catch(f){console.error("Failed to load brands:",f)}finally{d(!1)}};return c?a.jsx(X,{children:a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsx("span",{className:"loading loading-spinner loading-lg"})})}):i?a.jsx(X,{children:a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("button",{onClick:()=>n(`/stores/${e}/${t}/${r}`),className:"btn btn-ghost btn-sm",children:"← Back to Store"}),a.jsxs("div",{className:"flex-1",children:[a.jsxs("h1",{className:"text-3xl font-bold",children:[i.name," - Brands"]}),a.jsxs("div",{className:"flex gap-3 mt-2",children:[a.jsx("a",{href:`${i.dutchie_url}/brands`,target:"_blank",rel:"noopener noreferrer",className:"link link-primary text-sm",children:"View Live Brands Page"}),a.jsx("span",{className:"text-sm text-gray-500",children:"•"}),a.jsxs("span",{className:"text-sm text-gray-500",children:[o.length," ",o.length===1?"Brand":"Brands"]})]})]})]}),o.length>0?a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:o.map((f,p)=>a.jsx("div",{className:"card bg-base-100 shadow-md hover:shadow-lg transition-shadow",children:a.jsx("div",{className:"card-body p-6",children:a.jsx("h3",{className:"text-lg font-semibold text-center",children:f})})},p))}):a.jsx("div",{className:"card bg-base-100 shadow-xl",children:a.jsxs("div",{className:"card-body text-center py-12",children:[a.jsx("p",{className:"text-gray-500",children:"No brands found for this store"}),a.jsx("p",{className:"text-sm text-gray-400 mt-2",children:"Brands are automatically extracted from products"})]})})]})}):a.jsx(X,{children:a.jsx("div",{className:"text-center py-12",children:a.jsx("p",{className:"text-gray-500",children:"Store not found"})})})}function s7(){const{state:e,storeName:t,slug:r}=Na(),n=dt(),[i,s]=h.useState(null),[o,l]=h.useState([]),[c,d]=h.useState(new Date().toISOString().split("T")[0]),[u,f]=h.useState(!0);h.useEffect(()=>{p()},[r,c]);const p=async()=>{f(!0);try{const x=(await B.getStores()).stores.find(b=>b.slug===r);if(!x)throw new Error("Store not found");s(x);const g=await B.getStoreSpecials(x.id,c);l(g.specials)}catch(m){console.error("Failed to load specials:",m)}finally{f(!1)}};return u?a.jsx(X,{children:a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsx("span",{className:"loading loading-spinner loading-lg"})})}):i?a.jsx(X,{children:a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("button",{onClick:()=>n(`/stores/${e}/${t}/${r}`),className:"btn btn-ghost btn-sm",children:"← Back to Store"}),a.jsxs("div",{className:"flex-1",children:[a.jsxs("h1",{className:"text-3xl font-bold",children:[i.name," - Specials"]}),a.jsxs("div",{className:"flex gap-3 mt-2",children:[a.jsx("a",{href:`${i.dutchie_url}/specials`,target:"_blank",rel:"noopener noreferrer",className:"link link-primary text-sm",children:"View Live Specials Page"}),a.jsx("span",{className:"text-sm text-gray-500",children:"•"}),a.jsxs("span",{className:"text-sm text-gray-500",children:[o.length," ",o.length===1?"Special":"Specials"]})]})]})]}),a.jsx("div",{className:"card bg-base-100 shadow-md",children:a.jsx("div",{className:"card-body p-4",children:a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("label",{className:"font-semibold",children:"Select Date:"}),a.jsx("input",{type:"date",value:c,onChange:m=>d(m.target.value),className:"input input-bordered input-sm"})]})})}),o.length>0?a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:o.map((m,x)=>a.jsx("div",{className:"card bg-base-100 shadow-xl hover:shadow-2xl transition-shadow",children:a.jsxs("div",{className:"card-body",children:[a.jsx("h3",{className:"card-title text-lg",children:m.name}),m.description&&a.jsx("p",{className:"text-sm text-gray-600",children:m.description}),a.jsxs("div",{className:"space-y-2 mt-2",children:[m.original_price&&a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsx("span",{className:"text-sm opacity-60",children:"Original Price:"}),a.jsxs("span",{className:"line-through text-gray-500",children:["$",parseFloat(m.original_price).toFixed(2)]})]}),m.special_price&&a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsx("span",{className:"text-sm opacity-60",children:"Special Price:"}),a.jsxs("span",{className:"text-lg font-bold text-success",children:["$",parseFloat(m.special_price).toFixed(2)]})]}),m.discount_percentage&&a.jsxs("div",{className:"badge badge-success badge-lg",children:[m.discount_percentage,"% OFF"]}),m.discount_amount&&a.jsxs("div",{className:"badge badge-info badge-lg",children:["Save $",parseFloat(m.discount_amount).toFixed(2)]})]})]})},x))}):a.jsx("div",{className:"card bg-base-100 shadow-xl",children:a.jsxs("div",{className:"card-body text-center py-12",children:[a.jsxs("p",{className:"text-gray-500",children:["No specials found for ",c]}),a.jsx("p",{className:"text-sm text-gray-400 mt-2",children:"Try selecting a different date"})]})})]})}):a.jsx(X,{children:a.jsx("div",{className:"text-center py-12",children:a.jsx("p",{className:"text-gray-500",children:"Store not found"})})})}function o7(){const[e,t]=h.useState([]),[r,n]=h.useState(null),[i,s]=h.useState([]),[o,l]=h.useState(!0);h.useEffect(()=>{c()},[]),h.useEffect(()=>{r&&d()},[r]);const c=async()=>{try{const f=await B.getStores();t(f.stores),f.stores.length>0&&n(f.stores[0].id)}catch(f){console.error("Failed to load stores:",f)}finally{l(!1)}},d=async()=>{if(r)try{const f=await B.getCategoryTree(r);s(f.tree)}catch(f){console.error("Failed to load categories:",f)}};if(o)return a.jsx(X,{children:a.jsx("div",{children:"Loading..."})});const u=e.find(f=>f.id===r);return a.jsx(X,{children:a.jsxs("div",{children:[a.jsx("h1",{style:{fontSize:"32px",marginBottom:"30px"},children:"Categories"}),a.jsxs("div",{style:{background:"white",padding:"20px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",marginBottom:"30px"},children:[a.jsx("label",{style:{display:"block",marginBottom:"10px",fontWeight:"600"},children:"Select Store:"}),a.jsx("select",{value:r||"",onChange:f=>n(parseInt(f.target.value)),style:{width:"100%",padding:"12px",border:"2px solid #667eea",borderRadius:"6px",fontSize:"16px",cursor:"pointer"},children:e.map(f=>a.jsxs("option",{value:f.id,children:[f.name," (",f.category_count||0," categories)"]},f.id))})]}),u&&a.jsxs("div",{style:{background:"white",padding:"25px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)"},children:[a.jsxs("h2",{style:{marginBottom:"20px",fontSize:"24px"},children:[u.name," - Categories"]}),i.length===0?a.jsx("div",{style:{color:"#999",textAlign:"center",padding:"40px"},children:'No categories found. Run "Discover Categories" from the Stores page.'}):a.jsx("div",{children:i.map(f=>a.jsx(kk,{category:f},f.id))})]})]})})}function kk({category:e,level:t=0}){return a.jsxs("div",{style:{marginLeft:t*30+"px",marginBottom:"10px"},children:[a.jsxs("div",{style:{padding:"12px 15px",background:t===0?"#f0f0ff":"#f8f9fa",borderRadius:"6px",borderLeft:`4px solid ${t===0?"#667eea":"#999"}`,display:"flex",justifyContent:"space-between",alignItems:"center"},children:[a.jsxs("div",{children:[a.jsxs("strong",{style:{fontSize:t===0?"16px":"14px"},children:[t>0&&"└── ",e.name]}),a.jsxs("span",{style:{marginLeft:"10px",color:"#666",fontSize:"12px"},children:["(",e.product_count||0," products)"]})]}),a.jsx("div",{style:{fontSize:"12px",color:"#999"},children:a.jsx("code",{children:e.path})})]}),e.children&&e.children.length>0&&a.jsx("div",{style:{marginTop:"5px"},children:e.children.map(r=>a.jsx(kk,{category:r,level:t+1},r.id))})]})}function Vn({message:e,type:t,onClose:r,duration:n=4e3}){h.useEffect(()=>{const s=setTimeout(r,n);return()=>clearTimeout(s)},[n,r]);const i={success:"#10b981",error:"#ef4444",info:"#3b82f6"};return a.jsxs("div",{style:{position:"fixed",top:"20px",right:"20px",background:i[t],color:"white",padding:"16px 24px",borderRadius:"8px",boxShadow:"0 4px 12px rgba(0,0,0,0.15)",zIndex:9999,maxWidth:"400px",animation:"slideIn 0.3s ease-out",fontSize:"14px",fontWeight:"500"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px"},children:[a.jsx("div",{style:{flex:1,whiteSpace:"pre-wrap"},children:e}),a.jsx("button",{onClick:r,style:{background:"transparent",border:"none",color:"white",cursor:"pointer",fontSize:"18px",padding:"0 4px",opacity:.8},children:"×"})]}),a.jsx("style",{children:` + */var po=h;function q9(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var H9=typeof Object.is=="function"?Object.is:q9,K9=po.useSyncExternalStore,V9=po.useRef,Y9=po.useEffect,G9=po.useMemo,Z9=po.useDebugValue;U9.useSyncExternalStoreWithSelector=function(e,t,r,n,i){var s=V9(null);if(s.current===null){var o={hasValue:!1,value:null};s.current=o}else o=s.current;s=G9(function(){function c(m){if(!d){if(d=!0,u=m,m=n(m),i!==void 0&&o.hasValue){var x=o.value;if(i(x,m))return f=x}return f=m}if(x=f,H9(u,m))return x;var g=n(m);return i!==void 0&&i(x,g)?(u=m,x):(u=m,f=g)}var d=!1,u,f,p=r===void 0?null:r;return[function(){return c(t())},p===null?void 0:function(){return c(p())}]},[t,r,n,i]);var l=K9(e,s[0],s[1]);return Y9(function(){o.hasValue=!0,o.value=l},[l]),Z9(l),l};function X9(e){e()}function J9(){let e=null,t=null;return{clear(){e=null,t=null},notify(){X9(()=>{let r=e;for(;r;)r.callback(),r=r.next})},get(){const r=[];let n=e;for(;n;)r.push(n),n=n.next;return r},subscribe(r){let n=!0;const i=t={callback:r,next:null,prev:t};return i.prev?i.prev.next=i:e=i,function(){!n||e===null||(n=!1,i.next?i.next.prev=i.prev:t=i.prev,i.prev?i.prev.next=i.next:e=i.next)}}}}var gv={notify(){},get:()=>[]};function Q9(e,t){let r,n=gv,i=0,s=!1;function o(g){u();const b=n.subscribe(g);let v=!1;return()=>{v||(v=!0,b(),f())}}function l(){n.notify()}function c(){x.onStateChange&&x.onStateChange()}function d(){return s}function u(){i++,r||(r=e.subscribe(c),n=J9())}function f(){i--,r&&i===0&&(r(),r=void 0,n.clear(),n=gv)}function p(){s||(s=!0,u())}function m(){s&&(s=!1,f())}const x={addNestedSub:o,notifyNestedSubs:l,handleChangeWrapper:c,isSubscribed:d,trySubscribe:p,tryUnsubscribe:m,getListeners:()=>n};return x}var eB=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",tB=eB(),rB=()=>typeof navigator<"u"&&navigator.product==="ReactNative",nB=rB(),iB=()=>tB||nB?h.useLayoutEffect:h.useEffect,aB=iB(),Cd=Symbol.for("react-redux-context"),Ad=typeof globalThis<"u"?globalThis:{};function sB(){if(!h.createContext)return{};const e=Ad[Cd]??(Ad[Cd]=new Map);let t=e.get(h.createContext);return t||(t=h.createContext(null),e.set(h.createContext,t)),t}var oB=sB();function lB(e){const{children:t,context:r,serverState:n,store:i}=e,s=h.useMemo(()=>{const c=Q9(i);return{store:i,subscription:c,getServerState:n?()=>n:void 0}},[i,n]),o=h.useMemo(()=>i.getState(),[i]);aB(()=>{const{subscription:c}=s;return c.onStateChange=c.notifyNestedSubs,c.trySubscribe(),o!==i.getState()&&c.notifyNestedSubs(),()=>{c.tryUnsubscribe(),c.onStateChange=void 0}},[s,o]);const l=r||oB;return h.createElement(l.Provider,{value:s},t)}var cB=lB,uB=(e,t)=>t,og=I([uB,ue,n2,We,tN,pn,P$,rt],T$),lg=e=>{var t=e.currentTarget.getBoundingClientRect(),r=t.width/e.currentTarget.offsetWidth,n=t.height/e.currentTarget.offsetHeight;return{chartX:Math.round((e.clientX-t.left)/r),chartY:Math.round((e.clientY-t.top)/n)}},hk=ar("mouseClick"),mk=Qs();mk.startListening({actionCreator:hk,effect:(e,t)=>{var r=e.payload,n=og(t.getState(),lg(r));(n==null?void 0:n.activeIndex)!=null&&t.dispatch(CI({activeIndex:n.activeIndex,activeDataKey:void 0,activeCoordinate:n.activeCoordinate}))}});var Np=ar("mouseMove"),gk=Qs();gk.startListening({actionCreator:Np,effect:(e,t)=>{var r=e.payload,n=t.getState(),i=Um(n,n.tooltip.settings.shared),s=og(n,lg(r));i==="axis"&&((s==null?void 0:s.activeIndex)!=null?t.dispatch(K2({activeIndex:s.activeIndex,activeDataKey:void 0,activeCoordinate:s.activeCoordinate})):t.dispatch(H2()))}});var xv={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,barSize:void 0,className:void 0,maxBarSize:void 0,stackOffset:"none",syncId:void 0,syncMethod:"index",baseValue:void 0},xk=At({name:"rootProps",initialState:xv,reducers:{updateOptions:(e,t)=>{var r;e.accessibilityLayer=t.payload.accessibilityLayer,e.barCategoryGap=t.payload.barCategoryGap,e.barGap=(r=t.payload.barGap)!==null&&r!==void 0?r:xv.barGap,e.barSize=t.payload.barSize,e.maxBarSize=t.payload.maxBarSize,e.stackOffset=t.payload.stackOffset,e.syncId=t.payload.syncId,e.syncMethod=t.payload.syncMethod,e.className=t.payload.className,e.baseValue=t.payload.baseValue}}}),dB=xk.reducer,{updateOptions:fB}=xk.actions,yk=At({name:"polarOptions",initialState:null,reducers:{updatePolarOptions:(e,t)=>t.payload}}),{updatePolarOptions:YF}=yk.actions,pB=yk.reducer,vk=ar("keyDown"),bk=ar("focus"),cg=Qs();cg.startListening({actionCreator:vk,effect:(e,t)=>{var r=t.getState(),n=r.rootProps.accessibilityLayer!==!1;if(n){var{keyboardInteraction:i}=r.tooltip,s=e.payload;if(!(s!=="ArrowRight"&&s!=="ArrowLeft"&&s!=="Enter")){var o=Number(qm(i,Ma(r))),l=pn(r);if(s==="Enter"){var c=pc(r,"axis","hover",String(i.index));t.dispatch(dp({active:!i.active,activeIndex:i.index,activeDataKey:i.dataKey,activeCoordinate:c}));return}var d=bI(r),u=d==="left-to-right"?1:-1,f=s==="ArrowRight"?1:-1,p=o+f*u;if(!(l==null||p>=l.length||p<0)){var m=pc(r,"axis","hover",String(p));t.dispatch(dp({active:!0,activeIndex:p.toString(),activeDataKey:void 0,activeCoordinate:m}))}}}}});cg.startListening({actionCreator:bk,effect:(e,t)=>{var r=t.getState(),n=r.rootProps.accessibilityLayer!==!1;if(n){var{keyboardInteraction:i}=r.tooltip;if(!i.active&&i.index==null){var s="0",o=pc(r,"axis","hover",String(s));t.dispatch(dp({activeDataKey:void 0,active:!0,activeIndex:s,activeCoordinate:o}))}}}});var Vt=ar("externalEvent"),jk=Qs();jk.startListening({actionCreator:Vt,effect:(e,t)=>{if(e.payload.handler!=null){var r=t.getState(),n={activeCoordinate:d$(r),activeDataKey:c$(r),activeIndex:Us(r),activeLabel:iN(r),activeTooltipIndex:Us(r),isTooltipActive:f$(r)};e.payload.handler(n,e.payload.reactEvent)}}});var hB=I([Ta],e=>e.tooltipItemPayloads),mB=I([hB,uo,(e,t,r)=>t,(e,t,r)=>r],(e,t,r,n)=>{var i=e.find(l=>l.settings.dataKey===n);if(i!=null){var{positions:s}=i;if(s!=null){var o=t(s,r);return o}}}),wk=ar("touchMove"),Sk=Qs();Sk.startListening({actionCreator:wk,effect:(e,t)=>{var r=e.payload;if(!(r.touches==null||r.touches.length===0)){var n=t.getState(),i=Um(n,n.tooltip.settings.shared);if(i==="axis"){var s=og(n,lg({clientX:r.touches[0].clientX,clientY:r.touches[0].clientY,currentTarget:r.currentTarget}));(s==null?void 0:s.activeIndex)!=null&&t.dispatch(K2({activeIndex:s.activeIndex,activeDataKey:void 0,activeCoordinate:s.activeCoordinate}))}else if(i==="item"){var o,l=r.touches[0];if(document.elementFromPoint==null)return;var c=document.elementFromPoint(l.clientX,l.clientY);if(!c||!c.getAttribute)return;var d=c.getAttribute(TE),u=(o=c.getAttribute(ME))!==null&&o!==void 0?o:void 0,f=mB(t.getState(),d,u);t.dispatch(_I({activeDataKey:u,activeIndex:d,activeCoordinate:f}))}}}});var gB=nw({brush:Oz,cartesianAxis:pz,chartData:cL,errorBars:wz,graphicalItems:G8,layout:gE,legend:c3,options:iL,polarAxis:N8,polarOptions:pB,referenceElements:Lz,rootProps:dB,tooltip:AI,zIndex:V$}),xB=function(t){return F4({reducer:gB,preloadedState:t,middleware:r=>r({serializableCheck:!1}).concat([mk.middleware,gk.middleware,cg.middleware,jk.middleware,Sk.middleware]),enhancers:r=>{var n=r;return typeof r=="function"&&(n=r()),n.concat(mw({type:"raf"}))},devTools:Ci.devToolsEnabled})};function yB(e){var{preloadedState:t,children:r,reduxStoreName:n}=e,i=pt(),s=h.useRef(null);if(i)return r;s.current==null&&(s.current=xB(t));var o=Hh;return h.createElement(cB,{context:o,store:s.current},r)}function vB(e){var{layout:t,margin:r}=e,n=Ve(),i=pt();return h.useEffect(()=>{i||(n(pE(t)),n(fE(r)))},[n,i,t,r]),null}function bB(e){var t=Ve();return h.useEffect(()=>{t(fB(e))},[t,e]),null}function yv(e){var{zIndex:t,isPanorama:r}=e,n=r?"recharts-zindex-panorama-":"recharts-zindex-",i=BN("".concat(n).concat(t)),s=Ve();return h.useLayoutEffect(()=>(s(H$({zIndex:t,elementId:i,isPanorama:r})),()=>{s(K$({zIndex:t,isPanorama:r}))}),[s,t,i,r]),h.createElement("g",{id:i})}function vv(e){var{children:t,isPanorama:r}=e,n=G(I$);if(!n||n.length===0)return t;var i=n.filter(o=>o<0),s=n.filter(o=>o>0);return h.createElement(h.Fragment,null,i.map(o=>h.createElement(yv,{key:o,zIndex:o,isPanorama:r})),t,s.map(o=>h.createElement(yv,{key:o,zIndex:o,isPanorama:r})))}var jB=["children"];function wB(e,t){if(e==null)return{};var r,n,i=SB(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n{var r=Fw(),n=Ww(),i=qw();if(!Er(r)||!Er(n))return null;var{children:s,otherAttributes:o,title:l,desc:c}=e,d,u;return o!=null&&(typeof o.tabIndex=="number"?d=o.tabIndex:d=i?0:void 0,typeof o.role=="string"?u=o.role:u=i?"application":void 0),h.createElement(lj,Sc({},o,{title:l,desc:c,role:u,tabIndex:d,width:r,height:n,style:NB,ref:t}),s)}),PB=e=>{var{children:t}=e,r=G(cu);if(!r)return null;var{width:n,height:i,y:s,x:o}=r;return h.createElement(lj,{width:n,height:i,x:o,y:s},t)},bv=h.forwardRef((e,t)=>{var{children:r}=e,n=wB(e,jB),i=pt();return i?h.createElement(PB,null,h.createElement(vv,{isPanorama:!0},r)):h.createElement(kB,Sc({ref:t},n),h.createElement(vv,{isPanorama:!1},r))});function _B(){var e=Ve(),[t,r]=h.useState(null),n=G(DE);return h.useEffect(()=>{if(t!=null){var i=t.getBoundingClientRect(),s=i.width/t.offsetWidth;_e(s)&&s!==n&&e(mE(s))}},[t,e,n]),r}function jv(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function CB(e){for(var t=1;t(yL(),null);function Nc(e){if(typeof e=="number")return e;if(typeof e=="string"){var t=parseFloat(e);if(!Number.isNaN(t))return t}return 0}var TB=h.forwardRef((e,t)=>{var r,n,i=h.useRef(null),[s,o]=h.useState({containerWidth:Nc((r=e.style)===null||r===void 0?void 0:r.width),containerHeight:Nc((n=e.style)===null||n===void 0?void 0:n.height)}),l=h.useCallback((d,u)=>{o(f=>{var p=Math.round(d),m=Math.round(u);return f.containerWidth===p&&f.containerHeight===m?f:{containerWidth:p,containerHeight:m}})},[]),c=h.useCallback(d=>{if(typeof t=="function"&&t(d),d!=null&&typeof ResizeObserver<"u"){var{width:u,height:f}=d.getBoundingClientRect();l(u,f);var p=x=>{var{width:g,height:b}=x[0].contentRect;l(g,b)},m=new ResizeObserver(p);m.observe(d),i.current=m}},[t,l]);return h.useEffect(()=>()=>{var d=i.current;d!=null&&d.disconnect()},[l]),h.createElement(h.Fragment,null,h.createElement(du,{width:s.containerWidth,height:s.containerHeight}),h.createElement("div",Ni({ref:c},e)))}),MB=h.forwardRef((e,t)=>{var{width:r,height:n}=e,[i,s]=h.useState({containerWidth:Nc(r),containerHeight:Nc(n)}),o=h.useCallback((c,d)=>{s(u=>{var f=Math.round(c),p=Math.round(d);return u.containerWidth===f&&u.containerHeight===p?u:{containerWidth:f,containerHeight:p}})},[]),l=h.useCallback(c=>{if(typeof t=="function"&&t(c),c!=null){var{width:d,height:u}=c.getBoundingClientRect();o(d,u)}},[t,o]);return h.createElement(h.Fragment,null,h.createElement(du,{width:i.containerWidth,height:i.containerHeight}),h.createElement("div",Ni({ref:l},e)))}),IB=h.forwardRef((e,t)=>{var{width:r,height:n}=e;return h.createElement(h.Fragment,null,h.createElement(du,{width:r,height:n}),h.createElement("div",Ni({ref:t},e)))}),$B=h.forwardRef((e,t)=>{var{width:r,height:n}=e;return Qr(r)||Qr(n)?h.createElement(MB,Ni({},e,{ref:t})):h.createElement(IB,Ni({},e,{ref:t}))});function LB(e){return e===!0?TB:$B}var zB=h.forwardRef((e,t)=>{var{children:r,className:n,height:i,onClick:s,onContextMenu:o,onDoubleClick:l,onMouseDown:c,onMouseEnter:d,onMouseLeave:u,onMouseMove:f,onMouseUp:p,onTouchEnd:m,onTouchMove:x,onTouchStart:g,style:b,width:v,responsive:j,dispatchTouchEvents:y=!0}=e,w=h.useRef(null),S=Ve(),[N,P]=h.useState(null),[_,T]=h.useState(null),$=_B(),M=Qh(),C=(M==null?void 0:M.width)>0?M.width:v,R=(M==null?void 0:M.height)>0?M.height:i,q=h.useCallback(z=>{$(z),typeof t=="function"&&t(z),P(z),T(z),z!=null&&(w.current=z)},[$,t,P,T]),Z=h.useCallback(z=>{S(hk(z)),S(Vt({handler:s,reactEvent:z}))},[S,s]),E=h.useCallback(z=>{S(Np(z)),S(Vt({handler:d,reactEvent:z}))},[S,d]),D=h.useCallback(z=>{S(H2()),S(Vt({handler:u,reactEvent:z}))},[S,u]),O=h.useCallback(z=>{S(Np(z)),S(Vt({handler:f,reactEvent:z}))},[S,f]),k=h.useCallback(()=>{S(bk())},[S]),L=h.useCallback(z=>{S(vk(z.key))},[S]),F=h.useCallback(z=>{S(Vt({handler:o,reactEvent:z}))},[S,o]),H=h.useCallback(z=>{S(Vt({handler:l,reactEvent:z}))},[S,l]),te=h.useCallback(z=>{S(Vt({handler:c,reactEvent:z}))},[S,c]),re=h.useCallback(z=>{S(Vt({handler:p,reactEvent:z}))},[S,p]),we=h.useCallback(z=>{S(Vt({handler:g,reactEvent:z}))},[S,g]),A=h.useCallback(z=>{y&&S(wk(z)),S(Vt({handler:x,reactEvent:z}))},[S,y,x]),J=h.useCallback(z=>{S(Vt({handler:m,reactEvent:z}))},[S,m]),Ot=LB(j);return h.createElement(pN.Provider,{value:N},h.createElement(n6.Provider,{value:_},h.createElement(Ot,{width:C??(b==null?void 0:b.width),height:R??(b==null?void 0:b.height),className:ce("recharts-wrapper",n),style:CB({position:"relative",cursor:"default",width:C,height:R},b),onClick:Z,onContextMenu:F,onDoubleClick:H,onFocus:k,onKeyDown:L,onMouseDown:te,onMouseEnter:E,onMouseLeave:D,onMouseMove:O,onMouseUp:re,onTouchEnd:J,onTouchMove:A,onTouchStart:we,ref:q},h.createElement(DB,null),r)))}),RB=["width","height","responsive","children","className","style","compact","title","desc"];function BB(e,t){if(e==null)return{};var r,n,i=FB(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n{var{width:r,height:n,responsive:i,children:s,className:o,style:l,compact:c,title:d,desc:u}=e,f=BB(e,RB),p=nr(f);return c?h.createElement(h.Fragment,null,h.createElement(du,{width:r,height:n}),h.createElement(bv,{otherAttributes:p,title:d,desc:u},s)):h.createElement(zB,{className:o,style:l,width:r,height:n,responsive:i??!1,onClick:e.onClick,onMouseLeave:e.onMouseLeave,onMouseEnter:e.onMouseEnter,onMouseMove:e.onMouseMove,onMouseDown:e.onMouseDown,onMouseUp:e.onMouseUp,onContextMenu:e.onContextMenu,onDoubleClick:e.onDoubleClick,onTouchStart:e.onTouchStart,onTouchMove:e.onTouchMove,onTouchEnd:e.onTouchEnd},h.createElement(bv,{otherAttributes:p,title:d,desc:u,ref:t},h.createElement(Rz,null,s)))});function kp(){return kp=Object.assign?Object.assign.bind():function(e){for(var t=1;th.createElement(Nk,{chartName:"LineChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:HB,tooltipPayloadSearcher:mN,categoricalChartProps:e,ref:t})),VB=["axis"],YB=h.forwardRef((e,t)=>h.createElement(Nk,{chartName:"AreaChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:VB,tooltipPayloadSearcher:mN,categoricalChartProps:e,ref:t}));function GB(){var b,v,j,y,w,S,N,P,_,T,$,M,C,R,q,Z,E,D,O,k,L;const[e,t]=h.useState(null),[r,n]=h.useState(null),[i,s]=h.useState(!0),[o,l]=h.useState(0),[c,d]=h.useState(!1);h.useEffect(()=>{f(),u()},[]);const u=async()=>{try{const H=(await B.getChangeStats()).pending_count;l(H);const te=localStorage.getItem("dismissedPendingChangesCount"),re=te&&parseInt(te)>=H;d(H>0&&!re)}catch(F){console.error("Failed to load change stats:",F),d(!1)}},f=async()=>{try{const F=await B.getDutchieAZDashboard();t({products:{total:F.productCount,in_stock:F.productCount,with_images:0},stores:{total:F.dispensaryCount,active:F.dispensaryCount},brands:{total:F.brandCount},campaigns:{active:0,total:0},clicks:{clicks_24h:F.snapshotCount24h},failedJobs:F.failedJobCount,lastCrawlTime:F.lastCrawlTime});try{const H=await B.getDashboardActivity();n(H)}catch{n(null)}}catch(F){console.error("Failed to load dashboard:",F)}finally{s(!1)}},p=()=>{localStorage.setItem("dismissedPendingChangesCount",o.toString()),d(!1)};if(i)return a.jsx(X,{children:a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsx(Xt,{className:"w-8 h-8 animate-spin text-gray-400"})})});const m=Math.round(((b=e==null?void 0:e.products)==null?void 0:b.with_images)/((v=e==null?void 0:e.products)==null?void 0:v.total)*100)||0;Math.round(((j=e==null?void 0:e.stores)==null?void 0:j.active)/((y=e==null?void 0:e.stores)==null?void 0:y.total)*100);const x=[{date:"Mon",products:120},{date:"Tue",products:145},{date:"Wed",products:132},{date:"Thu",products:178},{date:"Fri",products:195},{date:"Sat",products:210},{date:"Sun",products:((w=e==null?void 0:e.products)==null?void 0:w.total)||225}],g=[{time:"00:00",scrapes:5},{time:"04:00",scrapes:12},{time:"08:00",scrapes:18},{time:"12:00",scrapes:25},{time:"16:00",scrapes:30},{time:"20:00",scrapes:22},{time:"24:00",scrapes:((S=r==null?void 0:r.recent_scrapes)==null?void 0:S.length)||15}];return a.jsxs(X,{children:[c&&a.jsx("div",{className:"mb-6 bg-amber-50 border-l-4 border-amber-500 rounded-lg p-4",children:a.jsxs("div",{className:"flex items-center justify-between gap-4",children:[a.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[a.jsx(nj,{className:"w-5 h-5 text-amber-600 flex-shrink-0"}),a.jsxs("div",{className:"flex-1",children:[a.jsxs("h3",{className:"text-sm font-semibold text-amber-900",children:[o," pending change",o!==1?"s":""," require review"]}),a.jsx("p",{className:"text-sm text-amber-700 mt-0.5",children:"Proposed changes to dispensary data are waiting for approval"})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{className:"btn btn-sm bg-amber-600 hover:bg-amber-700 text-white border-none",children:"Review Changes"}),a.jsx("button",{onClick:p,className:"btn btn-sm btn-ghost text-amber-900 hover:bg-amber-100","aria-label":"Dismiss notification",children:a.jsx(ij,{className:"w-4 h-4"})})]})]})}),a.jsxs("div",{className:"space-y-8",children:[a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl font-semibold text-gray-900",children:"Dashboard"}),a.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"Monitor your dispensary data aggregation"})]}),a.jsxs("button",{onClick:f,className:"inline-flex items-center gap-2 px-4 py-2 bg-white border border-gray-200 rounded-lg hover:bg-gray-50 transition-colors text-sm font-medium text-gray-700",children:[a.jsx(Xt,{className:"w-4 h-4"}),"Refresh"]})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:[a.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("div",{className:"p-2 bg-blue-50 rounded-lg",children:a.jsx(Ct,{className:"w-5 h-5 text-blue-600"})}),a.jsxs("div",{className:"flex items-center gap-1 text-xs text-green-600",children:[a.jsx(zn,{className:"w-3 h-3"}),a.jsx("span",{children:"12.5%"})]})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{className:"text-sm font-medium text-gray-600",children:"Total Products"}),a.jsx("p",{className:"text-3xl font-semibold text-gray-900",children:((P=(N=e==null?void 0:e.products)==null?void 0:N.total)==null?void 0:P.toLocaleString())||0}),a.jsxs("p",{className:"text-xs text-gray-500",children:[((_=e==null?void 0:e.products)==null?void 0:_.in_stock)||0," in stock"]})]})]}),a.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("div",{className:"p-2 bg-emerald-50 rounded-lg",children:a.jsx(Il,{className:"w-5 h-5 text-emerald-600"})}),a.jsxs("div",{className:"flex items-center gap-1 text-xs text-green-600",children:[a.jsx(zn,{className:"w-3 h-3"}),a.jsx("span",{children:"8.2%"})]})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{className:"text-sm font-medium text-gray-600",children:"Total Dispensaries"}),a.jsx("p",{className:"text-3xl font-semibold text-gray-900",children:((T=e==null?void 0:e.stores)==null?void 0:T.total)||0}),a.jsxs("p",{className:"text-xs text-gray-500",children:[(($=e==null?void 0:e.stores)==null?void 0:$.active)||0," active (crawlable)"]})]})]}),a.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("div",{className:"p-2 bg-purple-50 rounded-lg",children:a.jsx(rj,{className:"w-5 h-5 text-purple-600"})}),a.jsxs("div",{className:"flex items-center gap-1 text-xs text-red-600",children:[a.jsx(RO,{className:"w-3 h-3"}),a.jsx("span",{children:"3.1%"})]})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{className:"text-sm font-medium text-gray-600",children:"Active Campaigns"}),a.jsx("p",{className:"text-3xl font-semibold text-gray-900",children:((M=e==null?void 0:e.campaigns)==null?void 0:M.active)||0}),a.jsxs("p",{className:"text-xs text-gray-500",children:[((C=e==null?void 0:e.campaigns)==null?void 0:C.total)||0," total campaigns"]})]})]}),a.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("div",{className:"p-2 bg-amber-50 rounded-lg",children:a.jsx(lO,{className:"w-5 h-5 text-amber-600"})}),a.jsxs("span",{className:"text-xs font-medium text-gray-600",children:[m,"%"]})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{className:"text-sm font-medium text-gray-600",children:"Images Downloaded"}),a.jsx("p",{className:"text-3xl font-semibold text-gray-900",children:((q=(R=e==null?void 0:e.products)==null?void 0:R.with_images)==null?void 0:q.toLocaleString())||0}),a.jsx("div",{className:"mt-3",children:a.jsx("div",{className:"w-full bg-gray-100 rounded-full h-1.5",children:a.jsx("div",{className:"bg-amber-500 h-1.5 rounded-full transition-all",style:{width:`${m}%`}})})})]})]}),a.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("div",{className:"p-2 bg-cyan-50 rounded-lg",children:a.jsx(na,{className:"w-5 h-5 text-cyan-600"})}),a.jsx(xr,{className:"w-4 h-4 text-gray-400"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{className:"text-sm font-medium text-gray-600",children:"Snapshots (24h)"}),a.jsx("p",{className:"text-3xl font-semibold text-gray-900",children:((E=(Z=e==null?void 0:e.clicks)==null?void 0:Z.clicks_24h)==null?void 0:E.toLocaleString())||0}),a.jsx("p",{className:"text-xs text-gray-500",children:"Product snapshots created"})]})]}),a.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("div",{className:"p-2 bg-indigo-50 rounded-lg",children:a.jsx(Cr,{className:"w-5 h-5 text-indigo-600"})}),a.jsx(na,{className:"w-4 h-4 text-gray-400"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{className:"text-sm font-medium text-gray-600",children:"Brands"}),a.jsx("p",{className:"text-3xl font-semibold text-gray-900",children:((D=e==null?void 0:e.brands)==null?void 0:D.total)||((O=e==null?void 0:e.products)==null?void 0:O.unique_brands)||0}),a.jsx("p",{className:"text-xs text-gray-500",children:"Unique brands tracked"})]})]})]}),a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-6",children:[a.jsxs("div",{className:"mb-6",children:[a.jsx("h3",{className:"text-base font-semibold text-gray-900",children:"Product Growth"}),a.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"Weekly product count trend"})]}),a.jsx(p0,{width:"100%",height:200,children:a.jsxs(YB,{data:x,children:[a.jsx("defs",{children:a.jsxs("linearGradient",{id:"productGradient",x1:"0",y1:"0",x2:"0",y2:"1",children:[a.jsx("stop",{offset:"5%",stopColor:"#3b82f6",stopOpacity:.1}),a.jsx("stop",{offset:"95%",stopColor:"#3b82f6",stopOpacity:0})]})}),a.jsx(vp,{strokeDasharray:"3 3",stroke:"#f1f5f9"}),a.jsx(jp,{dataKey:"date",tick:{fill:"#94a3b8",fontSize:12},axisLine:{stroke:"#e2e8f0"}}),a.jsx(Sp,{tick:{fill:"#94a3b8",fontSize:12},axisLine:{stroke:"#e2e8f0"}}),a.jsx(By,{contentStyle:{backgroundColor:"#ffffff",border:"1px solid #e2e8f0",borderRadius:"8px",fontSize:"12px"}}),a.jsx(pk,{type:"monotone",dataKey:"products",stroke:"#3b82f6",strokeWidth:2,fill:"url(#productGradient)"})]})})]}),a.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-6",children:[a.jsxs("div",{className:"mb-6",children:[a.jsx("h3",{className:"text-base font-semibold text-gray-900",children:"Scrape Activity"}),a.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"Scrapes over the last 24 hours"})]}),a.jsx(p0,{width:"100%",height:200,children:a.jsxs(KB,{data:g,children:[a.jsx(vp,{strokeDasharray:"3 3",stroke:"#f1f5f9"}),a.jsx(jp,{dataKey:"time",tick:{fill:"#94a3b8",fontSize:12},axisLine:{stroke:"#e2e8f0"}}),a.jsx(Sp,{tick:{fill:"#94a3b8",fontSize:12},axisLine:{stroke:"#e2e8f0"}}),a.jsx(By,{contentStyle:{backgroundColor:"#ffffff",border:"1px solid #e2e8f0",borderRadius:"8px",fontSize:"12px"}}),a.jsx(ak,{type:"monotone",dataKey:"scrapes",stroke:"#10b981",strokeWidth:2,dot:{fill:"#10b981",r:4}})]})})]})]}),a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"bg-white rounded-xl border border-gray-200",children:[a.jsxs("div",{className:"px-6 py-4 border-b border-gray-200",children:[a.jsx("h3",{className:"text-base font-semibold text-gray-900",children:"Recent Scrapes"}),a.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"Latest data collection activities"})]}),a.jsx("div",{className:"divide-y divide-gray-100",children:((k=r==null?void 0:r.recent_scrapes)==null?void 0:k.length)>0?r.recent_scrapes.slice(0,5).map((F,H)=>a.jsx("div",{className:"px-6 py-4 hover:bg-gray-50 transition-colors",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-sm font-medium text-gray-900 truncate",children:F.name}),a.jsx("p",{className:"text-xs text-gray-500 mt-1",children:new Date(F.last_scraped_at).toLocaleString("en-US",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})})]}),a.jsx("div",{className:"ml-4 flex-shrink-0",children:a.jsxs("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-blue-50 text-blue-700",children:[F.product_count," products"]})})]})},H)):a.jsxs("div",{className:"px-6 py-12 text-center",children:[a.jsx(na,{className:"w-8 h-8 text-gray-300 mx-auto mb-2"}),a.jsx("p",{className:"text-sm text-gray-500",children:"No recent scrapes"})]})})]}),a.jsxs("div",{className:"bg-white rounded-xl border border-gray-200",children:[a.jsxs("div",{className:"px-6 py-4 border-b border-gray-200",children:[a.jsx("h3",{className:"text-base font-semibold text-gray-900",children:"Recent Products"}),a.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"Newly added to inventory"})]}),a.jsx("div",{className:"divide-y divide-gray-100",children:((L=r==null?void 0:r.recent_products)==null?void 0:L.length)>0?r.recent_products.slice(0,5).map((F,H)=>a.jsx("div",{className:"px-6 py-4 hover:bg-gray-50 transition-colors",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-sm font-medium text-gray-900 truncate",children:F.name}),a.jsx("p",{className:"text-xs text-gray-500 mt-1",children:F.store_name})]}),F.price&&a.jsx("div",{className:"ml-4 flex-shrink-0",children:a.jsxs("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-emerald-50 text-emerald-700",children:["$",F.price]})})]})},H)):a.jsxs("div",{className:"px-6 py-12 text-center",children:[a.jsx(Ct,{className:"w-8 h-8 text-gray-300 mx-auto mb-2"}),a.jsx("p",{className:"text-sm text-gray-500",children:"No recent products"})]})})]})]})]})]})}function ZB(){const[e,t]=nA(),r=dt(),[n,i]=h.useState([]),[s,o]=h.useState([]),[l,c]=h.useState([]),[d,u]=h.useState(!1),[f,p]=h.useState(""),[m,x]=h.useState(""),[g,b]=h.useState(""),[v,j]=h.useState(""),[y,w]=h.useState(0),[S,N]=h.useState(0),P=50;h.useEffect(()=>{const k=e.get("store");k&&x(k),T()},[]),h.useEffect(()=>{m&&($(),_())},[f,m,g,v,S]);const _=async()=>{try{const k=await B.getCategoryTree(parseInt(m));c(k.categories||[])}catch(k){console.error("Failed to load categories:",k)}},T=async()=>{try{const k=await B.getStores();o(k.stores)}catch(k){console.error("Failed to load stores:",k)}},$=async()=>{u(!0);try{const k={limit:P,offset:S,store_id:m};f&&(k.search=f),g&&(k.category_id=g),v&&(k.in_stock=v);const L=await B.getProducts(k);i(L.products),w(L.total)}catch(k){console.error("Failed to load products:",k)}finally{u(!1)}},M=k=>{p(k),N(0)},C=k=>{x(k),b(""),N(0),p(""),t(k?{store:k}:{})},R=k=>{b(k),N(0)},q=(k,L=0)=>k.map(F=>a.jsxs("div",{style:{marginLeft:`${L*20}px`},children:[a.jsxs("button",{onClick:()=>R(F.id.toString()),style:{width:"100%",textAlign:"left",padding:"10px 15px",background:g===F.id.toString()?"#667eea":"transparent",color:g===F.id.toString()?"white":"#333",border:"none",borderRadius:"6px",cursor:"pointer",fontWeight:L===0?"600":"400",fontSize:L===0?"15px":"14px",marginBottom:"4px",transition:"all 0.2s"},onMouseEnter:H=>{g!==F.id.toString()&&(H.currentTarget.style.background="#f5f5f5")},onMouseLeave:H=>{g!==F.id.toString()&&(H.currentTarget.style.background="transparent")},children:[F.name," (",F.product_count||0,")"]}),F.children&&F.children.length>0&&q(F.children,L+1)]},F.id)),Z=l.find(k=>k.id.toString()===g),E=()=>{S+P{S>0&&N(Math.max(0,S-P))},O=s.find(k=>k.id.toString()===m);return a.jsx(X,{children:a.jsxs("div",{children:[a.jsx("h1",{style:{fontSize:"32px",marginBottom:"30px"},children:"Products"}),a.jsxs("div",{style:{background:"white",padding:"30px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",marginBottom:"30px"},children:[a.jsx("label",{style:{display:"block",marginBottom:"15px",fontSize:"18px",fontWeight:"600",color:"#333"},children:"Select a Store to View Products:"}),a.jsxs("select",{value:m,onChange:k=>C(k.target.value),style:{width:"100%",padding:"15px",border:"2px solid #667eea",borderRadius:"8px",fontSize:"16px",fontWeight:"500",cursor:"pointer",background:"white"},children:[a.jsx("option",{value:"",children:"-- Select a Store --"}),s.map(k=>a.jsx("option",{value:k.id,children:k.name},k.id))]})]}),m?a.jsxs(a.Fragment,{children:[a.jsxs("div",{style:{background:"#667eea",color:"white",padding:"20px",borderRadius:"8px",marginBottom:"20px",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[a.jsxs("div",{children:[a.jsx("h2",{style:{margin:0,fontSize:"24px"},children:O==null?void 0:O.name}),Z&&a.jsx("div",{style:{marginTop:"8px",fontSize:"14px",opacity:.9},children:Z.name})]}),a.jsxs("div",{style:{fontSize:"18px",fontWeight:"bold"},children:[y," Products"]})]}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"280px 1fr",gap:"20px"},children:[a.jsx("div",{children:a.jsxs("div",{style:{background:"white",padding:"20px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",position:"sticky",top:"20px"},children:[a.jsx("h3",{style:{margin:"0 0 16px 0",fontSize:"18px",fontWeight:"600",color:"#333"},children:"Categories"}),a.jsxs("button",{onClick:()=>R(""),style:{width:"100%",textAlign:"left",padding:"10px 15px",background:g===""?"#667eea":"transparent",color:g===""?"white":"#333",border:"none",borderRadius:"6px",cursor:"pointer",fontWeight:"600",fontSize:"15px",marginBottom:"12px"},children:["All Products (",y,")"]}),a.jsx("div",{style:{borderTop:"1px solid #eee",marginBottom:"12px"}}),q(l)]})}),a.jsxs("div",{children:[a.jsxs("div",{style:{background:"white",padding:"20px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",marginBottom:"20px",display:"flex",gap:"15px",flexWrap:"wrap"},children:[a.jsx("input",{type:"text",placeholder:"Search products...",value:f,onChange:k=>M(k.target.value),style:{flex:"1",minWidth:"200px",padding:"10px",border:"1px solid #ddd",borderRadius:"6px"}}),a.jsxs("select",{value:v,onChange:k=>{j(k.target.value),N(0)},style:{padding:"10px",border:"1px solid #ddd",borderRadius:"6px"},children:[a.jsx("option",{value:"",children:"All Products"}),a.jsx("option",{value:"true",children:"In Stock"}),a.jsx("option",{value:"false",children:"Out of Stock"})]})]}),d?a.jsx("div",{style:{textAlign:"center",padding:"40px"},children:"Loading..."}):a.jsxs(a.Fragment,{children:[a.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(250px, 1fr))",gap:"20px",marginBottom:"20px"},children:n.map(k=>a.jsx(XB,{product:k,onViewDetails:()=>r(`/products/${k.id}`)},k.id))}),n.length===0&&a.jsx("div",{style:{background:"white",padding:"40px",borderRadius:"8px",textAlign:"center",color:"#999"},children:"No products found"}),y>P&&a.jsxs("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",gap:"15px",marginTop:"30px"},children:[a.jsx("button",{onClick:D,disabled:S===0,style:{padding:"10px 20px",background:S===0?"#ddd":"#667eea",color:S===0?"#999":"white",border:"none",borderRadius:"6px",cursor:S===0?"not-allowed":"pointer"},children:"Previous"}),a.jsxs("span",{children:["Showing ",S+1," - ",Math.min(S+P,y)," of ",y]}),a.jsx("button",{onClick:E,disabled:S+P>=y,style:{padding:"10px 20px",background:S+P>=y?"#ddd":"#667eea",color:S+P>=y?"#999":"white",border:"none",borderRadius:"6px",cursor:S+P>=y?"not-allowed":"pointer"},children:"Next"})]})]})]})]})]}):a.jsxs("div",{style:{background:"white",padding:"60px 40px",borderRadius:"8px",textAlign:"center",boxShadow:"0 2px 8px rgba(0,0,0,0.1)"},children:[a.jsx("div",{style:{fontSize:"48px",marginBottom:"20px"},children:"🏪"}),a.jsx("div",{style:{fontSize:"18px",color:"#666"},children:"Please select a store from the dropdown above to view products"})]})]})})}function XB({product:e,onViewDetails:t}){const r=n=>{if(!n)return"Never";const i=new Date(n),o=new Date().getTime()-i.getTime(),l=Math.floor(o/(1e3*60*60*24));return l===0?"Today":l===1?"Yesterday":l<7?`${l} days ago`:i.toLocaleDateString()};return a.jsxs("div",{style:{background:"white",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",overflow:"hidden",transition:"transform 0.2s"},onMouseEnter:n=>n.currentTarget.style.transform="translateY(-4px)",onMouseLeave:n=>n.currentTarget.style.transform="translateY(0)",children:[e.image_url_full?a.jsx("img",{src:e.image_url_full,alt:e.name,style:{width:"100%",height:"200px",objectFit:"cover",background:"#f5f5f5"},onError:n=>{n.currentTarget.src='data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" width="200" height="200"%3E%3Crect fill="%23ddd" width="200" height="200"/%3E%3Ctext x="50%25" y="50%25" text-anchor="middle" dy=".3em" fill="%23999"%3ENo Image%3C/text%3E%3C/svg%3E'}}):a.jsx("div",{style:{width:"100%",height:"200px",background:"#f5f5f5",display:"flex",alignItems:"center",justifyContent:"center",color:"#999"},children:"No Image"}),a.jsxs("div",{style:{padding:"15px"},children:[a.jsx("div",{style:{fontWeight:"500",marginBottom:"8px",fontSize:"14px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.name}),a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"8px"},children:[a.jsx("div",{style:{fontWeight:"bold",color:"#667eea"},children:e.price?`$${e.price}`:"N/A"}),a.jsx("div",{style:{padding:"4px 8px",borderRadius:"4px",fontSize:"12px",background:e.in_stock?"#d4edda":"#f8d7da",color:e.in_stock?"#155724":"#721c24"},children:e.in_stock?"In Stock":"Out of Stock"})]}),a.jsxs("div",{style:{fontSize:"11px",color:"#888",marginBottom:"12px",borderTop:"1px solid #eee",paddingTop:"8px"},children:["Last Updated: ",r(e.last_seen_at)]}),a.jsxs("div",{style:{display:"flex",gap:"8px"},children:[e.dutchie_url&&a.jsx("a",{href:e.dutchie_url,target:"_blank",rel:"noopener noreferrer",style:{flex:1,padding:"8px 12px",background:"#f0f0f0",color:"#333",textDecoration:"none",borderRadius:"6px",fontSize:"12px",fontWeight:"500",textAlign:"center",border:"1px solid #ddd"},onClick:n=>n.stopPropagation(),children:"Dutchie"}),a.jsx("button",{onClick:n=>{n.stopPropagation(),t()},style:{flex:1,padding:"8px 12px",background:"#667eea",color:"white",border:"none",borderRadius:"6px",fontSize:"12px",fontWeight:"500",cursor:"pointer"},children:"Details"})]})]})]})}function JB(){const{id:e}=ka(),t=dt(),[r,n]=h.useState(null),[i,s]=h.useState(!0),[o,l]=h.useState(null);h.useEffect(()=>{c()},[e]);const c=async()=>{if(e){s(!0),l(null);try{const p=await B.getProduct(parseInt(e));n(p.product)}catch(p){l(p.message||"Failed to load product")}finally{s(!1)}}};if(i)return a.jsx(X,{children:a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsx("div",{className:"w-8 h-8 border-4 border-gray-200 border-t-blue-600 rounded-full animate-spin"})})});if(o||!r)return a.jsx(X,{children:a.jsxs("div",{className:"text-center py-12",children:[a.jsx(Ct,{className:"w-16 h-16 text-gray-300 mx-auto mb-4"}),a.jsx("h2",{className:"text-2xl font-bold text-gray-900 mb-2",children:"Product not found"}),a.jsx("p",{className:"text-gray-500 mb-4",children:o}),a.jsx("button",{onClick:()=>t(-1),className:"text-blue-600 hover:text-blue-700",children:"← Go back"})]})});const d=r.metadata||{},f=r.image_url_full?r.image_url_full:r.medium_path?`http://localhost:9020/dutchie/${r.medium_path}`:r.thumbnail_path?`http://localhost:9020/dutchie/${r.thumbnail_path}`:null;return a.jsx(X,{children:a.jsxs("div",{className:"max-w-6xl mx-auto",children:[a.jsxs("button",{onClick:()=>t(-1),className:"flex items-center gap-2 text-gray-600 hover:text-gray-900 mb-6",children:[a.jsx(_h,{className:"w-4 h-4"}),"Back"]}),a.jsx("div",{className:"bg-white rounded-xl border border-gray-200 overflow-hidden",children:a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8 p-6",children:[a.jsx("div",{className:"aspect-square bg-gray-50 rounded-lg overflow-hidden",children:f?a.jsx("img",{src:f,alt:r.name,className:"w-full h-full object-contain"}):a.jsx("div",{className:"w-full h-full flex items-center justify-center text-gray-400",children:a.jsx(Ct,{className:"w-24 h-24"})})}),a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.in_stock?a.jsx("span",{className:"px-2 py-1 bg-green-100 text-green-700 text-xs font-medium rounded",children:"In Stock"}):a.jsx("span",{className:"px-2 py-1 bg-red-100 text-red-700 text-xs font-medium rounded",children:"Out of Stock"}),r.strain_type&&a.jsx("span",{className:"px-2 py-1 bg-purple-100 text-purple-700 text-xs font-medium rounded capitalize",children:r.strain_type})]}),a.jsx("h1",{className:"text-2xl font-bold text-gray-900 mb-2",children:r.name}),r.brand&&a.jsx("p",{className:"text-lg text-gray-600 font-medium",children:r.brand}),a.jsxs("div",{className:"flex items-center gap-4 mt-2 text-sm text-gray-500",children:[r.store_name&&a.jsx("span",{children:r.store_name}),r.category_name&&a.jsxs(a.Fragment,{children:[a.jsx("span",{children:"•"}),a.jsx("span",{children:r.category_name})]})]})]}),r.price!==null&&a.jsxs("div",{className:"border-t border-gray-100 pt-4",children:[a.jsxs("div",{className:"text-3xl font-bold text-blue-600",children:["$",parseFloat(r.price).toFixed(2)]}),r.weight&&a.jsx("div",{className:"text-sm text-gray-500 mt-1",children:r.weight})]}),(r.thc_percentage||r.cbd_percentage)&&a.jsxs("div",{className:"border-t border-gray-100 pt-4",children:[a.jsx("h3",{className:"text-sm font-semibold text-gray-700 mb-3",children:"Cannabinoid Content"}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.thc_percentage!==null&&a.jsxs("div",{className:"bg-green-50 rounded-lg p-3",children:[a.jsx("div",{className:"text-xs text-gray-500 uppercase",children:"THC"}),a.jsxs("div",{className:"text-xl font-bold text-green-600",children:[r.thc_percentage,"%"]})]}),r.cbd_percentage!==null&&a.jsxs("div",{className:"bg-blue-50 rounded-lg p-3",children:[a.jsx("div",{className:"text-xs text-gray-500 uppercase",children:"CBD"}),a.jsxs("div",{className:"text-xl font-bold text-blue-600",children:[r.cbd_percentage,"%"]})]})]})]}),r.description&&a.jsxs("div",{className:"border-t border-gray-100 pt-4",children:[a.jsx("h3",{className:"text-sm font-semibold text-gray-700 mb-2",children:"Description"}),a.jsx("p",{className:"text-gray-600 text-sm leading-relaxed",children:r.description})]}),d.terpenes&&d.terpenes.length>0&&a.jsxs("div",{className:"border-t border-gray-100 pt-4",children:[a.jsx("h3",{className:"text-sm font-semibold text-gray-700 mb-2",children:"Terpenes"}),a.jsx("div",{className:"flex flex-wrap gap-2",children:d.terpenes.map(p=>a.jsx("span",{className:"px-2 py-1 bg-amber-100 text-amber-700 text-xs font-medium rounded",children:p},p))})]}),d.effects&&d.effects.length>0&&a.jsxs("div",{className:"border-t border-gray-100 pt-4",children:[a.jsx("h3",{className:"text-sm font-semibold text-gray-700 mb-2",children:"Effects"}),a.jsx("div",{className:"flex flex-wrap gap-2",children:d.effects.map(p=>a.jsx("span",{className:"px-2 py-1 bg-indigo-100 text-indigo-700 text-xs font-medium rounded",children:p},p))})]}),d.flavors&&d.flavors.length>0&&a.jsxs("div",{className:"border-t border-gray-100 pt-4",children:[a.jsx("h3",{className:"text-sm font-semibold text-gray-700 mb-2",children:"Flavors"}),a.jsx("div",{className:"flex flex-wrap gap-2",children:d.flavors.map(p=>a.jsx("span",{className:"px-2 py-1 bg-pink-100 text-pink-700 text-xs font-medium rounded",children:p},p))})]}),d.lineage&&a.jsxs("div",{className:"border-t border-gray-100 pt-4",children:[a.jsx("h3",{className:"text-sm font-semibold text-gray-700 mb-2",children:"Lineage"}),a.jsx("p",{className:"text-gray-600 text-sm",children:d.lineage})]}),r.dutchie_url&&a.jsx("div",{className:"border-t border-gray-100 pt-4",children:a.jsxs("a",{href:r.dutchie_url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-sm text-blue-600 hover:text-blue-700",children:["View on Dutchie",a.jsx(Jr,{className:"w-4 h-4"})]})}),r.last_seen_at&&a.jsxs("div",{className:"text-xs text-gray-400 pt-4 border-t border-gray-100",children:["Last updated: ",new Date(r.last_seen_at).toLocaleString()]})]})]})})]})})}function QB(){const[e,t]=h.useState([]),[r,n]=h.useState(!0),[i,s]=h.useState(new Set),[o,l]=h.useState(new Set),c=dt();h.useEffect(()=>{d()},[]);const d=async()=>{n(!0);try{const v=await B.getStores();t(v.stores)}catch(v){console.error("Failed to load stores:",v)}finally{n(!1)}},u=v=>{const j=v.match(/(?:^|-)(al|ak|az|ar|ca|co|ct|de|fl|ga|hi|id|il|in|ia|ks|ky|la|me|md|ma|mi|mn|ms|mo|mt|ne|nv|nh|nj|nm|ny|nc|nd|oh|ok|or|pa|ri|sc|sd|tn|tx|ut|vt|va|wa|wv|wi|wy)-/i),y={peoria:"AZ"};let w=j?j[1].toUpperCase():null;if(!w){for(const[S,N]of Object.entries(y))if(v.toLowerCase().includes(S)){w=N;break}}return w||"UNKNOWN"},f=v=>{const j=u(v.slug).toLowerCase(),y=v.name.match(/^([^-]+)/),w=y?y[1].trim().toLowerCase().replace(/\s+/g,"-"):"other";return`/stores/${j}/${w}/${v.slug}`},p=e.reduce((v,j)=>{const y=j.name.match(/^([^-]+)/),w=y?y[1].trim():"Other",S=u(j.slug),P={AZ:"Arizona",FL:"Florida",PA:"Pennsylvania",NJ:"New Jersey",MA:"Massachusetts",IL:"Illinois",NY:"New York",MD:"Maryland",MI:"Michigan",OH:"Ohio",CT:"Connecticut",ME:"Maine",MO:"Missouri",NV:"Nevada",OR:"Oregon",UT:"Utah"}[S]||S;return v[w]||(v[w]={}),v[w][P]||(v[w][P]=[]),v[w][P].push(j),v},{}),m=async(v,j,y)=>{y.stopPropagation();try{await B.updateStore(v,{scrape_enabled:!j}),t(e.map(w=>w.id===v?{...w,scrape_enabled:!j}:w))}catch(w){console.error("Failed to update scraping status:",w)}},x=v=>v?new Date(v).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"}):"Never",g=v=>{const j=new Set(i);j.has(v)?j.delete(v):j.add(v),s(j)},b=(v,j)=>{const y=`${v}-${j}`,w=new Set(o);w.has(y)?w.delete(y):w.add(y),l(w)};return r?a.jsx(X,{children:a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsx("div",{className:"w-8 h-8 border-4 border-gray-200 border-t-blue-600 rounded-full animate-spin"})})}):a.jsx(X,{children:a.jsxs("div",{className:"space-y-6",children:[a.jsx("div",{className:"flex items-center justify-between",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 bg-blue-50 rounded-lg",children:a.jsx(Il,{className:"w-6 h-6 text-blue-600"})}),a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl font-semibold text-gray-900",children:"Stores"}),a.jsxs("p",{className:"text-sm text-gray-500 mt-1",children:[e.length," total stores"]})]})]})}),a.jsx("div",{className:"bg-white rounded-xl border border-gray-200 overflow-hidden",children:a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full",children:[a.jsx("thead",{className:"bg-gray-50 border-b border-gray-200",children:a.jsxs("tr",{children:[a.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Store Name"}),a.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Type"}),a.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"View Online"}),a.jsx("th",{className:"px-6 py-3 text-center text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Categories"}),a.jsx("th",{className:"px-6 py-3 text-center text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Products"}),a.jsx("th",{className:"px-6 py-3 text-center text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Scraping"}),a.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Last Scraped"})]})}),a.jsx("tbody",{children:Object.entries(p).map(([v,j])=>{const y=Object.values(j).flat().length,w=y===1,S=i.has(v);if(w){const _=Object.values(j).flat()[0];return a.jsxs("tr",{className:"border-b border-gray-100 hover:bg-gray-50 cursor-pointer transition-colors",onClick:()=>c(f(_)),title:"Click to view store",children:[a.jsx("td",{className:"px-6 py-4",children:a.jsxs("div",{className:"flex items-center gap-3",children:[_.logo_url?a.jsx("img",{src:_.logo_url,alt:`${_.name} logo`,className:"w-8 h-8 object-contain flex-shrink-0",onError:T=>{T.target.style.display="none"}}):null,a.jsxs("div",{children:[a.jsx("div",{className:"font-semibold text-gray-900",children:_.name}),a.jsx("div",{className:"text-xs text-gray-500",children:_.slug})]})]})}),a.jsx("td",{className:"px-6 py-4",children:a.jsx("span",{className:"px-2 py-1 text-xs font-medium bg-blue-50 text-blue-700 rounded",children:"Dutchie"})}),a.jsx("td",{className:"px-6 py-4",children:a.jsxs("a",{href:_.dutchie_url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-sm text-blue-600 hover:text-blue-700",onClick:T=>T.stopPropagation(),children:[a.jsx("span",{children:"View Online"}),a.jsx(Jr,{className:"w-3 h-3"})]})}),a.jsx("td",{className:"px-6 py-4 text-center",children:a.jsxs("div",{className:"flex items-center justify-center gap-1",children:[a.jsx(Cr,{className:"w-4 h-4 text-gray-400"}),a.jsx("span",{className:"text-sm font-medium text-gray-900",children:_.category_count||0})]})}),a.jsx("td",{className:"px-6 py-4 text-center",children:a.jsxs("div",{className:"flex items-center justify-center gap-1",children:[a.jsx(Ct,{className:"w-4 h-4 text-gray-400"}),a.jsx("span",{className:"text-sm font-medium text-gray-900",children:_.product_count||0})]})}),a.jsx("td",{className:"px-6 py-4 text-center",onClick:T=>T.stopPropagation(),children:a.jsx("button",{onClick:T=>m(_.id,_.scrape_enabled,T),className:"inline-flex items-center gap-1 text-sm font-medium transition-colors",children:_.scrape_enabled?a.jsxs(a.Fragment,{children:[a.jsx(Ix,{className:"w-5 h-5 text-green-600"}),a.jsx("span",{className:"text-green-600",children:"On"})]}):a.jsxs(a.Fragment,{children:[a.jsx(Mx,{className:"w-5 h-5 text-gray-400"}),a.jsx("span",{className:"text-gray-500",children:"Off"})]})})}),a.jsx("td",{className:"px-6 py-4",children:a.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600",children:[a.jsx(xr,{className:"w-4 h-4 text-gray-400"}),x(_.last_scraped_at)]})})]},_.id)}const N=Object.values(j).flat()[0],P=N==null?void 0:N.logo_url;return a.jsxs(ps.Fragment,{children:[a.jsx("tr",{className:"bg-gray-100 border-b border-gray-200 cursor-pointer hover:bg-gray-150 transition-colors",onClick:()=>g(v),children:a.jsx("td",{colSpan:7,className:"px-6 py-4",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Cf,{className:`w-5 h-5 text-gray-600 transition-transform ${S?"rotate-90":""}`}),P&&a.jsx("img",{src:P,alt:`${v} logo`,className:"w-8 h-8 object-contain flex-shrink-0",onError:_=>{_.target.style.display="none"}}),a.jsx("span",{className:"text-base font-semibold text-gray-900",children:v}),a.jsxs("span",{className:"text-sm text-gray-500",children:["(",y," stores)"]})]})})}),S&&Object.entries(j).map(([_,T])=>{const $=`${v}-${_}`,M=o.has($);return a.jsxs(ps.Fragment,{children:[a.jsx("tr",{className:"bg-gray-50 border-b border-gray-100 cursor-pointer hover:bg-gray-100 transition-colors",onClick:()=>b(v,_),children:a.jsx("td",{colSpan:7,className:"px-6 py-3 pl-12",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Cf,{className:`w-4 h-4 text-gray-500 transition-transform ${M?"rotate-90":""}`}),a.jsx("span",{className:"text-sm font-medium text-gray-700",children:_}),a.jsxs("span",{className:"text-xs text-gray-500",children:["(",T.length," locations)"]})]})})}),M&&T.map(C=>a.jsxs("tr",{className:"border-b border-gray-100 hover:bg-gray-50 cursor-pointer transition-colors",onClick:()=>c(f(C)),title:"Click to view store",children:[a.jsx("td",{className:"px-6 py-4 pl-16",children:a.jsxs("div",{children:[a.jsx("div",{className:"font-semibold text-gray-900",children:C.name}),a.jsx("div",{className:"text-xs text-gray-500",children:C.slug})]})}),a.jsx("td",{className:"px-6 py-4",children:a.jsx("span",{className:"px-2 py-1 text-xs font-medium bg-blue-50 text-blue-700 rounded",children:"Dutchie"})}),a.jsx("td",{className:"px-6 py-4",children:a.jsxs("a",{href:C.dutchie_url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-sm text-blue-600 hover:text-blue-700",onClick:R=>R.stopPropagation(),children:[a.jsx("span",{children:"View Online"}),a.jsx(Jr,{className:"w-3 h-3"})]})}),a.jsx("td",{className:"px-6 py-4 text-center",children:a.jsxs("div",{className:"flex items-center justify-center gap-1",children:[a.jsx(Cr,{className:"w-4 h-4 text-gray-400"}),a.jsx("span",{className:"text-sm font-medium text-gray-900",children:C.category_count||0})]})}),a.jsx("td",{className:"px-6 py-4 text-center",children:a.jsxs("div",{className:"flex items-center justify-center gap-1",children:[a.jsx(Ct,{className:"w-4 h-4 text-gray-400"}),a.jsx("span",{className:"text-sm font-medium text-gray-900",children:C.product_count||0})]})}),a.jsx("td",{className:"px-6 py-4 text-center",onClick:R=>R.stopPropagation(),children:a.jsx("button",{onClick:R=>m(C.id,C.scrape_enabled,R),className:"inline-flex items-center gap-1 text-sm font-medium transition-colors",children:C.scrape_enabled?a.jsxs(a.Fragment,{children:[a.jsx(Ix,{className:"w-5 h-5 text-green-600"}),a.jsx("span",{className:"text-green-600",children:"On"})]}):a.jsxs(a.Fragment,{children:[a.jsx(Mx,{className:"w-5 h-5 text-gray-400"}),a.jsx("span",{className:"text-gray-500",children:"Off"})]})})}),a.jsx("td",{className:"px-6 py-4",children:a.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600",children:[a.jsx(xr,{className:"w-4 h-4 text-gray-400"}),x(C.last_scraped_at)]})})]},C.id))]},`state-${$}`)})]},`chain-${v}`)})})]})})}),e.length===0&&a.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-12 text-center",children:[a.jsx(Il,{className:"w-16 h-16 text-gray-300 mx-auto mb-4"}),a.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-2",children:"No stores found"}),a.jsx("p",{className:"text-gray-500",children:"Start by adding stores to your database"})]})]})})}function eF(){const e=dt(),[t,r]=h.useState([]),[n,i]=h.useState(!0),[s,o]=h.useState(""),[l,c]=h.useState(""),[d,u]=h.useState(null),[f,p]=h.useState({});h.useEffect(()=>{m()},[]);const m=async()=>{i(!0);try{const y=await B.getDispensaries();r(y.dispensaries)}catch(y){console.error("Failed to load dispensaries:",y)}finally{i(!1)}},x=y=>{u(y),p({dba_name:y.dba_name||"",website:y.website||"",phone:y.phone||"",google_rating:y.google_rating||"",google_review_count:y.google_review_count||""})},g=async()=>{if(d)try{await B.updateDispensary(d.id,f),await m(),u(null),p({})}catch(y){console.error("Failed to update dispensary:",y),alert("Failed to update dispensary")}},b=()=>{u(null),p({})},v=t.filter(y=>{const w=s.toLowerCase(),S=!s||y.name.toLowerCase().includes(w)||y.company_name&&y.company_name.toLowerCase().includes(w)||y.dba_name&&y.dba_name.toLowerCase().includes(w),N=!l||y.city===l;return S&&N}),j=Array.from(new Set(t.map(y=>y.city).filter(Boolean))).sort();return a.jsxs(X,{children:[a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"Dispensaries"}),a.jsxs("p",{className:"text-sm text-gray-600 mt-1",children:["AZDHS official dispensary directory (",t.length," total)"]})]}),a.jsx("div",{className:"bg-white rounded-lg border border-gray-200 p-4",children:a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Search"}),a.jsxs("div",{className:"relative",children:[a.jsx(_O,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-gray-400"}),a.jsx("input",{type:"text",value:s,onChange:y=>o(y.target.value),placeholder:"Search by name or company...",className:"w-full pl-10 pr-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Filter by City"}),a.jsxs("select",{value:l,onChange:y=>c(y.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500",children:[a.jsx("option",{value:"",children:"All Cities"}),j.map(y=>a.jsx("option",{value:y,children:y},y))]})]})]})}),n?a.jsxs("div",{className:"text-center py-12",children:[a.jsx("div",{className:"inline-block animate-spin rounded-full h-8 w-8 border-4 border-blue-500 border-t-transparent"}),a.jsx("p",{className:"mt-2 text-sm text-gray-600",children:"Loading dispensaries..."})]}):a.jsxs("div",{className:"bg-white rounded-lg border border-gray-200 overflow-hidden",children:[a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full",children:[a.jsx("thead",{className:"bg-gray-50 border-b border-gray-200",children:a.jsxs("tr",{children:[a.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-700 uppercase tracking-wider",children:"Name"}),a.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-700 uppercase tracking-wider",children:"Company"}),a.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-700 uppercase tracking-wider",children:"Address"}),a.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-700 uppercase tracking-wider",children:"City"}),a.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-700 uppercase tracking-wider",children:"Phone"}),a.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-700 uppercase tracking-wider",children:"Email"}),a.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-700 uppercase tracking-wider",children:"Website"}),a.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-700 uppercase tracking-wider",children:"Actions"})]})}),a.jsx("tbody",{className:"divide-y divide-gray-200",children:v.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:8,className:"px-4 py-8 text-center text-sm text-gray-500",children:"No dispensaries found"})}):v.map(y=>a.jsxs("tr",{className:"hover:bg-gray-50",children:[a.jsx("td",{className:"px-4 py-3",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Ln,{className:"w-4 h-4 text-gray-400 flex-shrink-0"}),a.jsxs("div",{className:"flex flex-col",children:[a.jsx("span",{className:"text-sm font-medium text-gray-900",children:y.dba_name||y.name}),y.dba_name&&y.google_rating&&a.jsxs("span",{className:"text-xs text-gray-500",children:["⭐ ",y.google_rating," (",y.google_review_count," reviews)"]})]})]})}),a.jsx("td",{className:"px-4 py-3",children:a.jsx("span",{className:"text-sm text-gray-600",children:y.company_name||"-"})}),a.jsx("td",{className:"px-4 py-3",children:a.jsxs("div",{className:"flex items-start gap-1",children:[a.jsx(yi,{className:"w-3 h-3 text-gray-400 flex-shrink-0 mt-0.5"}),a.jsx("span",{className:"text-sm text-gray-600",children:y.address||"-"})]})}),a.jsxs("td",{className:"px-4 py-3",children:[a.jsx("span",{className:"text-sm text-gray-600",children:y.city||"-"}),y.zip&&a.jsxs("span",{className:"text-xs text-gray-400 ml-1",children:["(",y.zip,")"]})]}),a.jsx("td",{className:"px-4 py-3",children:y.phone?a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(Ah,{className:"w-3 h-3 text-gray-400"}),a.jsx("span",{className:"text-sm text-gray-600",children:y.phone.replace(/(\d{3})(\d{3})(\d{4})/,"($1) $2-$3")})]}):a.jsx("span",{className:"text-sm text-gray-400",children:"-"})}),a.jsx("td",{className:"px-4 py-3",children:y.email?a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(tj,{className:"w-3 h-3 text-gray-400"}),a.jsx("a",{href:`mailto:${y.email}`,className:"text-sm text-blue-600 hover:text-blue-800",children:y.email})]}):a.jsx("span",{className:"text-sm text-gray-400",children:"-"})}),a.jsx("td",{className:"px-4 py-3",children:y.website?a.jsxs("a",{href:y.website,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-sm text-blue-600 hover:text-blue-800",children:[a.jsx(Jr,{className:"w-3 h-3"}),a.jsx("span",{children:"Visit Site"})]}):a.jsx("span",{className:"text-sm text-gray-400",children:"-"})}),a.jsx("td",{className:"px-4 py-3",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{onClick:()=>x(y),className:"inline-flex items-center gap-1 px-3 py-1.5 text-sm font-medium text-gray-600 hover:text-gray-800 hover:bg-gray-50 rounded-lg transition-colors",title:"Edit",children:a.jsx(bO,{className:"w-4 h-4"})}),a.jsx("button",{onClick:()=>{const w=y.city.toLowerCase().replace(/\s+/g,"-");e(`/dispensaries/${y.state}/${w}/${y.slug}`)},className:"inline-flex items-center gap-1 px-3 py-1.5 text-sm font-medium text-blue-600 hover:text-blue-800 hover:bg-blue-50 rounded-lg transition-colors",title:"View",children:a.jsx(rO,{className:"w-4 h-4"})})]})})]},y.id))})]})}),a.jsx("div",{className:"bg-gray-50 px-4 py-3 border-t border-gray-200",children:a.jsxs("div",{className:"text-sm text-gray-600",children:["Showing ",v.length," of ",t.length," dispensaries"]})})]})]}),d&&a.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-white rounded-lg shadow-xl max-w-2xl w-full mx-4 max-h-[90vh] overflow-y-auto",children:[a.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200",children:[a.jsxs("h2",{className:"text-xl font-bold text-gray-900",children:["Edit Dispensary: ",d.name]}),a.jsx("button",{onClick:b,className:"text-gray-400 hover:text-gray-600",children:a.jsx(ij,{className:"w-6 h-6"})})]}),a.jsxs("div",{className:"p-6 space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"DBA Name (Display Name)"}),a.jsx("input",{type:"text",value:f.dba_name,onChange:y=>p({...f,dba_name:y.target.value}),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500",placeholder:"e.g., Green Med Wellness"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Website"}),a.jsx("input",{type:"url",value:f.website,onChange:y=>p({...f,website:y.target.value}),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500",placeholder:"https://example.com"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Phone Number"}),a.jsx("input",{type:"tel",value:f.phone,onChange:y=>p({...f,phone:y.target.value}),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500",placeholder:"5551234567"})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Google Rating"}),a.jsx("input",{type:"number",step:"0.1",min:"0",max:"5",value:f.google_rating,onChange:y=>p({...f,google_rating:y.target.value}),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500",placeholder:"4.5"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Review Count"}),a.jsx("input",{type:"number",min:"0",value:f.google_review_count,onChange:y=>p({...f,google_review_count:y.target.value}),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500",placeholder:"123"})]})]}),a.jsxs("div",{className:"bg-gray-50 p-4 rounded-lg space-y-2",children:[a.jsxs("div",{className:"text-sm",children:[a.jsx("span",{className:"font-medium text-gray-700",children:"AZDHS Name:"})," ",a.jsx("span",{className:"text-gray-600",children:d.name})]}),a.jsxs("div",{className:"text-sm",children:[a.jsx("span",{className:"font-medium text-gray-700",children:"Address:"})," ",a.jsxs("span",{className:"text-gray-600",children:[d.address,", ",d.city,", ",d.state," ",d.zip]})]})]})]}),a.jsxs("div",{className:"flex items-center justify-end gap-3 p-6 border-t border-gray-200",children:[a.jsx("button",{onClick:b,className:"px-4 py-2 text-sm font-medium text-gray-700 hover:text-gray-900 hover:bg-gray-100 rounded-lg transition-colors",children:"Cancel"}),a.jsxs("button",{onClick:g,className:"inline-flex items-center gap-2 px-4 py-2 text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 rounded-lg transition-colors",children:[a.jsx(kO,{className:"w-4 h-4"}),"Save Changes"]})]})]})})]})}function tF(){const{state:e,city:t,slug:r}=ka(),n=dt(),[i,s]=h.useState(null),[o,l]=h.useState([]),[c,d]=h.useState([]),[u,f]=h.useState([]),[p,m]=h.useState(!0),[x,g]=h.useState("products"),[b,v]=h.useState(!1),[j,y]=h.useState(!1),[w,S]=h.useState(""),[N,P]=h.useState(1),[_]=h.useState(25),T=D=>{if(!D)return"Never";const O=new Date(D),L=new Date().getTime()-O.getTime(),F=Math.floor(L/(1e3*60*60*24));return F===0?"Today":F===1?"Yesterday":F<7?`${F} days ago`:O.toLocaleDateString()};h.useEffect(()=>{$()},[r]);const $=async()=>{m(!0);try{const[D,O,k,L]=await Promise.all([B.getDispensary(r),B.getDispensaryProducts(r).catch(()=>({products:[]})),B.getDispensaryBrands(r).catch(()=>({brands:[]})),B.getDispensarySpecials(r).catch(()=>({specials:[]}))]);s(D),l(O.products),d(k.brands),f(L.specials)}catch(D){console.error("Failed to load dispensary:",D)}finally{m(!1)}},M=async D=>{v(!1),y(!0);try{const O=await fetch(`http://localhost:3010/api/dispensaries/${r}/scrape`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("token")}`},body:JSON.stringify({type:D})});if(!O.ok)throw new Error("Failed to trigger scraping");const k=await O.json();alert(`${D.charAt(0).toUpperCase()+D.slice(1)} update started! ${k.message||""}`)}catch(O){console.error("Failed to trigger scraping:",O),alert("Failed to start update. Please try again.")}finally{y(!1)}},C=o.filter(D=>{var k,L,F,H,te;if(!w)return!0;const O=w.toLowerCase();return((k=D.name)==null?void 0:k.toLowerCase().includes(O))||((L=D.brand)==null?void 0:L.toLowerCase().includes(O))||((F=D.variant)==null?void 0:F.toLowerCase().includes(O))||((H=D.description)==null?void 0:H.toLowerCase().includes(O))||((te=D.strain_type)==null?void 0:te.toLowerCase().includes(O))}),R=Math.ceil(C.length/_),q=(N-1)*_,Z=q+_,E=C.slice(q,Z);return h.useEffect(()=>{P(1)},[w]),p?a.jsx(X,{children:a.jsxs("div",{className:"text-center py-12",children:[a.jsx("div",{className:"inline-block animate-spin rounded-full h-8 w-8 border-4 border-blue-500 border-t-transparent"}),a.jsx("p",{className:"mt-2 text-sm text-gray-600",children:"Loading dispensary..."})]})}):i?a.jsx(X,{children:a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-center justify-between gap-4",children:[a.jsxs("button",{onClick:()=>n("/dispensaries"),className:"flex items-center gap-2 text-sm text-gray-600 hover:text-gray-900",children:[a.jsx(_h,{className:"w-4 h-4"}),"Back to Dispensaries"]}),a.jsxs("div",{className:"relative",children:[a.jsxs("button",{onClick:()=>v(!b),disabled:j,className:"flex items-center gap-2 px-4 py-2 text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 rounded-lg disabled:opacity-50 disabled:cursor-not-allowed",children:[a.jsx(Xt,{className:`w-4 h-4 ${j?"animate-spin":""}`}),j?"Updating...":"Update",!j&&a.jsx(ej,{className:"w-4 h-4"})]}),b&&!j&&a.jsxs("div",{className:"absolute right-0 mt-2 w-48 bg-white rounded-lg shadow-lg border border-gray-200 z-10",children:[a.jsx("button",{onClick:()=>M("products"),className:"w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 rounded-t-lg",children:"Products"}),a.jsx("button",{onClick:()=>M("brands"),className:"w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-100",children:"Brands"}),a.jsx("button",{onClick:()=>M("specials"),className:"w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-100",children:"Specials"}),a.jsx("button",{onClick:()=>M("all"),className:"w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 rounded-b-lg border-t border-gray-200",children:"All"})]})]})]}),a.jsxs("div",{className:"bg-white rounded-lg border border-gray-200 p-6",children:[a.jsxs("div",{className:"flex items-start justify-between gap-4 mb-4",children:[a.jsxs("div",{className:"flex items-start gap-4",children:[a.jsx("div",{className:"p-3 bg-blue-50 rounded-lg",children:a.jsx(Ln,{className:"w-8 h-8 text-blue-600"})}),a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:i.dba_name||i.name}),i.company_name&&a.jsx("p",{className:"text-sm text-gray-600 mt-1",children:i.company_name})]})]}),a.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600 bg-gray-50 px-4 py-2 rounded-lg",children:[a.jsx(Ch,{className:"w-4 h-4"}),a.jsxs("div",{children:[a.jsx("span",{className:"font-medium",children:"Last Crawl Date:"}),a.jsx("span",{className:"ml-2",children:i.last_menu_scrape?new Date(i.last_menu_scrape).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"Never"})]})]})]}),a.jsxs("div",{className:"flex flex-wrap gap-4",children:[i.address&&a.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600",children:[a.jsx(yi,{className:"w-4 h-4"}),a.jsxs("span",{children:[i.address,", ",i.city,", ",i.state," ",i.zip]})]}),i.phone&&a.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600",children:[a.jsx(Ah,{className:"w-4 h-4"}),a.jsx("span",{children:i.phone.replace(/(\d{3})(\d{3})(\d{4})/,"($1) $2-$3")})]}),a.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600",children:[a.jsx(Jr,{className:"w-4 h-4"}),i.website?a.jsx("a",{href:i.website,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800",children:"Website"}):a.jsx("span",{children:"Website N/A"})]}),i.email&&a.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[a.jsx(tj,{className:"w-4 h-4 text-gray-400"}),a.jsx("a",{href:`mailto:${i.email}`,className:"text-blue-600 hover:text-blue-800",children:i.email})]}),i.azdhs_url&&a.jsxs("a",{href:i.azdhs_url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 text-sm text-blue-600 hover:text-blue-800",children:[a.jsx(Jr,{className:"w-4 h-4"}),a.jsx("span",{children:"AZDHS Profile"})]}),a.jsxs(K1,{to:"/schedule",className:"flex items-center gap-2 text-sm text-blue-600 hover:text-blue-800",children:[a.jsx(xr,{className:"w-4 h-4"}),a.jsx("span",{children:"View Schedule"})]})]})]}),a.jsxs("div",{className:"grid grid-cols-4 gap-6",children:[a.jsx("button",{onClick:()=>{g("products"),S("")},className:"bg-white rounded-lg border border-gray-200 p-6 hover:border-blue-300 hover:shadow-md transition-all cursor-pointer text-left",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 bg-green-50 rounded-lg",children:a.jsx(Ct,{className:"w-5 h-5 text-green-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm text-gray-600",children:"Total Products"}),a.jsx("p",{className:"text-2xl font-bold text-gray-900",children:o.length})]})]})}),a.jsx("button",{onClick:()=>g("brands"),className:"bg-white rounded-lg border border-gray-200 p-6 hover:border-blue-300 hover:shadow-md transition-all cursor-pointer text-left",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 bg-purple-50 rounded-lg",children:a.jsx(Cr,{className:"w-5 h-5 text-purple-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm text-gray-600",children:"Brands"}),a.jsx("p",{className:"text-2xl font-bold text-gray-900",children:c.length})]})]})}),a.jsx("button",{onClick:()=>g("specials"),className:"bg-white rounded-lg border border-gray-200 p-6 hover:border-blue-300 hover:shadow-md transition-all cursor-pointer text-left",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 bg-blue-50 rounded-lg",children:a.jsx(zn,{className:"w-5 h-5 text-blue-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm text-gray-600",children:"Active Specials"}),a.jsx("p",{className:"text-2xl font-bold text-gray-900",children:u.length})]})]})}),a.jsx("div",{className:"bg-white rounded-lg border border-gray-200 p-6",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 bg-orange-50 rounded-lg",children:a.jsx(QA,{className:"w-5 h-5 text-orange-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm text-gray-600",children:"Avg Price"}),a.jsx("p",{className:"text-2xl font-bold text-gray-900",children:o.length>0?`$${(o.reduce((D,O)=>D+(O.sale_price||O.regular_price||0),0)/o.length).toFixed(2)}`:"-"})]})]})})]}),a.jsxs("div",{className:"bg-white rounded-lg border border-gray-200",children:[a.jsx("div",{className:"border-b border-gray-200",children:a.jsxs("div",{className:"flex gap-4 px-6",children:[a.jsxs("button",{onClick:()=>g("products"),className:`py-4 px-2 text-sm font-medium border-b-2 ${x==="products"?"border-blue-600 text-blue-600":"border-transparent text-gray-600 hover:text-gray-900"}`,children:["Products (",o.length,")"]}),a.jsxs("button",{onClick:()=>g("brands"),className:`py-4 px-2 text-sm font-medium border-b-2 ${x==="brands"?"border-blue-600 text-blue-600":"border-transparent text-gray-600 hover:text-gray-900"}`,children:["Brands (",c.length,")"]}),a.jsxs("button",{onClick:()=>g("specials"),className:`py-4 px-2 text-sm font-medium border-b-2 ${x==="specials"?"border-blue-600 text-blue-600":"border-transparent text-gray-600 hover:text-gray-900"}`,children:["Specials (",u.length,")"]})]})}),a.jsxs("div",{className:"p-6",children:[x==="products"&&a.jsx("div",{className:"space-y-4",children:o.length===0?a.jsx("p",{className:"text-center py-8 text-gray-500",children:"No products available"}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center gap-4 mb-4",children:[a.jsx("input",{type:"text",placeholder:"Search products by name, brand, variant, description, or strain type...",value:w,onChange:D=>S(D.target.value),className:"input input-bordered input-sm flex-1"}),w&&a.jsx("button",{onClick:()=>S(""),className:"btn btn-sm btn-ghost",children:"Clear"}),a.jsxs("div",{className:"text-sm text-gray-600",children:["Showing ",q+1,"-",Math.min(Z,C.length)," of ",C.length," products"]})]}),a.jsx("div",{className:"overflow-x-auto -mx-6 px-6",children:a.jsxs("table",{className:"table table-xs table-zebra table-pin-rows w-full",children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{children:"Image"}),a.jsx("th",{children:"Product Name"}),a.jsx("th",{children:"Brand"}),a.jsx("th",{children:"Variant"}),a.jsx("th",{children:"Description"}),a.jsx("th",{className:"text-right",children:"Price"}),a.jsx("th",{className:"text-center",children:"THC %"}),a.jsx("th",{className:"text-center",children:"CBD %"}),a.jsx("th",{className:"text-center",children:"Strain Type"}),a.jsx("th",{className:"text-center",children:"In Stock"}),a.jsx("th",{children:"Last Updated"}),a.jsx("th",{children:"Actions"})]})}),a.jsx("tbody",{children:E.map(D=>a.jsxs("tr",{children:[a.jsx("td",{className:"whitespace-nowrap",children:D.image_url?a.jsx("img",{src:D.image_url,alt:D.name,className:"w-12 h-12 object-cover rounded",onError:O=>O.currentTarget.style.display="none"}):"-"}),a.jsx("td",{className:"font-medium max-w-[150px]",children:a.jsx("div",{className:"line-clamp-2",title:D.name,children:D.name})}),a.jsx("td",{className:"max-w-[120px]",children:a.jsx("div",{className:"line-clamp-2",title:D.brand||"-",children:D.brand||"-"})}),a.jsx("td",{className:"max-w-[100px]",children:a.jsx("div",{className:"line-clamp-2",title:D.variant||"-",children:D.variant||"-"})}),a.jsx("td",{className:"w-[120px]",children:a.jsx("span",{title:D.description,children:D.description?D.description.length>15?D.description.substring(0,15)+"...":D.description:"-"})}),a.jsx("td",{className:"text-right font-semibold whitespace-nowrap",children:D.sale_price?a.jsxs("div",{className:"flex flex-col items-end",children:[a.jsxs("span",{className:"text-error",children:["$",D.sale_price]}),a.jsxs("span",{className:"text-gray-400 line-through text-xs",children:["$",D.regular_price]})]}):D.regular_price?`$${D.regular_price}`:"-"}),a.jsx("td",{className:"text-center whitespace-nowrap",children:D.thc_percentage?a.jsxs("span",{className:"badge badge-success badge-sm",children:[D.thc_percentage,"%"]}):"-"}),a.jsx("td",{className:"text-center whitespace-nowrap",children:D.cbd_percentage?a.jsxs("span",{className:"badge badge-info badge-sm",children:[D.cbd_percentage,"%"]}):"-"}),a.jsx("td",{className:"text-center whitespace-nowrap",children:D.strain_type?a.jsx("span",{className:"badge badge-ghost badge-sm",children:D.strain_type}):"-"}),a.jsx("td",{className:"text-center whitespace-nowrap",children:D.in_stock?a.jsx("span",{className:"badge badge-success badge-sm",children:"Yes"}):D.in_stock===!1?a.jsx("span",{className:"badge badge-error badge-sm",children:"No"}):"-"}),a.jsx("td",{className:"whitespace-nowrap text-xs text-gray-500",children:D.updated_at?T(D.updated_at):"-"}),a.jsx("td",{children:a.jsxs("div",{className:"flex gap-1",children:[D.dutchie_url&&a.jsx("a",{href:D.dutchie_url,target:"_blank",rel:"noopener noreferrer",className:"btn btn-xs btn-outline",children:"Dutchie"}),a.jsx("button",{onClick:()=>n(`/products/${D.id}`),className:"btn btn-xs btn-primary",children:"Details"})]})})]},D.id))})]})}),R>1&&a.jsxs("div",{className:"flex justify-center items-center gap-2 mt-4",children:[a.jsx("button",{onClick:()=>P(D=>Math.max(1,D-1)),disabled:N===1,className:"btn btn-sm btn-outline",children:"Previous"}),a.jsx("div",{className:"flex gap-1",children:Array.from({length:R},(D,O)=>O+1).map(D=>{const O=D===1||D===R||D>=N-1&&D<=N+1;return D===2&&N>3||D===R-1&&NP(D),className:`btn btn-sm ${N===D?"btn-primary":"btn-outline"}`,children:D},D):null})}),a.jsx("button",{onClick:()=>P(D=>Math.min(R,D+1)),disabled:N===R,className:"btn btn-sm btn-outline",children:"Next"})]})]})}),x==="brands"&&a.jsx("div",{className:"space-y-4",children:c.length===0?a.jsx("p",{className:"text-center py-8 text-gray-500",children:"No brands available"}):a.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",children:c.map(D=>a.jsxs("button",{onClick:()=>{g("products"),S(D.brand)},className:"border border-gray-200 rounded-lg p-4 text-center hover:border-blue-300 hover:shadow-md transition-all cursor-pointer",children:[a.jsx("p",{className:"font-medium text-gray-900 line-clamp-2",children:D.brand}),a.jsxs("p",{className:"text-sm text-gray-600 mt-1",children:[D.product_count," product",D.product_count!==1?"s":""]})]},D.brand))})}),x==="specials"&&a.jsx("div",{className:"space-y-4",children:u.length===0?a.jsx("p",{className:"text-center py-8 text-gray-500",children:"No active specials"}):a.jsx("div",{className:"space-y-3",children:u.map(D=>a.jsxs("div",{className:"border border-gray-200 rounded-lg p-4",children:[a.jsx("h4",{className:"font-medium text-gray-900",children:D.name}),D.description&&a.jsx("p",{className:"text-sm text-gray-600 mt-1",children:D.description}),a.jsxs("div",{className:"flex items-center gap-4 mt-2 text-sm text-gray-500",children:[a.jsxs("span",{children:[new Date(D.start_date).toLocaleDateString()," -"," ",D.end_date?new Date(D.end_date).toLocaleDateString():"Ongoing"]}),a.jsxs("span",{children:[D.product_count," products"]})]})]},D.id))})})]})]})]})}):a.jsx(X,{children:a.jsx("div",{className:"text-center py-12",children:a.jsx("p",{className:"text-gray-600",children:"Dispensary not found"})})})}function rF(){var $,M;const{slug:e}=ka(),t=dt(),[r,n]=h.useState(null),[i,s]=h.useState([]),[o,l]=h.useState([]),[c,d]=h.useState([]),[u,f]=h.useState(!0),[p,m]=h.useState(null),[x,g]=h.useState(""),[b,v]=h.useState("products"),[j,y]=h.useState("name");h.useEffect(()=>{w()},[e]),h.useEffect(()=>{r&&S()},[p,x,j,r]);const w=async()=>{f(!0);try{const R=(await B.getStores()).stores.find(D=>D.slug===e);if(!R)throw new Error("Store not found");const[q,Z,E]=await Promise.all([B.getStore(R.id),B.getCategories(R.id),B.getStoreBrands(R.id)]);n(q),l(Z.categories||[]),d(E.brands||[])}catch(C){console.error("Failed to load store data:",C)}finally{f(!1)}},S=async()=>{if(r)try{const C={store_id:r.id,limit:1e3};p&&(C.category_id=p),x&&(C.brand=x);let q=(await B.getProducts(C)).products||[];q.sort((Z,E)=>{switch(j){case"name":return(Z.name||"").localeCompare(E.name||"");case"price_asc":return(Z.price||0)-(E.price||0);case"price_desc":return(E.price||0)-(Z.price||0);case"thc":return(E.thc_percentage||0)-(Z.thc_percentage||0);default:return 0}}),s(q)}catch(C){console.error("Failed to load products:",C)}},N=C=>C.image_url_full?C.image_url_full:C.medium_path?`http://localhost:9020/dutchie/${C.medium_path}`:C.thumbnail_path?`http://localhost:9020/dutchie/${C.thumbnail_path}`:"https://via.placeholder.com/300x300?text=No+Image",P=C=>C?new Date(C).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"}):"Never",_=C=>{switch(C==null?void 0:C.toLowerCase()){case"dutchie":return"bg-green-100 text-green-700";case"jane":return"bg-purple-100 text-purple-700";case"treez":return"bg-blue-100 text-blue-700";case"weedmaps":return"bg-orange-100 text-orange-700";case"leafly":return"bg-emerald-100 text-emerald-700";default:return"bg-gray-100 text-gray-700"}},T=C=>{switch(C){case"completed":return a.jsxs("span",{className:"px-2 py-1 text-xs font-medium bg-green-100 text-green-700 rounded-full flex items-center gap-1",children:[a.jsx(_r,{className:"w-3 h-3"})," Completed"]});case"running":return a.jsxs("span",{className:"px-2 py-1 text-xs font-medium bg-blue-100 text-blue-700 rounded-full flex items-center gap-1",children:[a.jsx(Xt,{className:"w-3 h-3 animate-spin"})," Running"]});case"failed":return a.jsxs("span",{className:"px-2 py-1 text-xs font-medium bg-red-100 text-red-700 rounded-full flex items-center gap-1",children:[a.jsx(Hr,{className:"w-3 h-3"})," Failed"]});case"pending":return a.jsxs("span",{className:"px-2 py-1 text-xs font-medium bg-yellow-100 text-yellow-700 rounded-full flex items-center gap-1",children:[a.jsx(xr,{className:"w-3 h-3"})," Pending"]});default:return a.jsx("span",{className:"px-2 py-1 text-xs font-medium bg-gray-100 text-gray-700 rounded-full",children:C})}};return u?a.jsx(X,{children:a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsx("div",{className:"w-8 h-8 border-4 border-gray-200 border-t-blue-600 rounded-full animate-spin"})})}):r?a.jsx(X,{children:a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-6",children:[a.jsxs("div",{className:"flex items-start justify-between mb-6",children:[a.jsxs("div",{className:"flex items-start gap-4",children:[a.jsx("button",{onClick:()=>t("/stores"),className:"text-gray-600 hover:text-gray-900 mt-1",children:"← Back"}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("h1",{className:"text-2xl font-semibold text-gray-900",children:r.name}),a.jsx("span",{className:`px-2 py-1 text-xs font-medium rounded ${_(r.provider)}`,children:r.provider||"Unknown"})]}),a.jsxs("p",{className:"text-sm text-gray-500 mt-1",children:["Store ID: ",r.id]})]})]}),a.jsxs("a",{href:r.dutchie_url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-sm text-blue-600 hover:text-blue-700",children:["View Menu ",a.jsx(Jr,{className:"w-4 h-4"})]})]}),a.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-6 gap-4 mb-6",children:[a.jsxs("div",{className:"p-4 bg-gray-50 rounded-lg",children:[a.jsxs("div",{className:"flex items-center gap-2 text-gray-500 text-xs mb-1",children:[a.jsx(Ct,{className:"w-4 h-4"}),"Products"]}),a.jsx("p",{className:"text-xl font-semibold text-gray-900",children:r.product_count||0})]}),a.jsxs("div",{className:"p-4 bg-gray-50 rounded-lg",children:[a.jsxs("div",{className:"flex items-center gap-2 text-gray-500 text-xs mb-1",children:[a.jsx(Cr,{className:"w-4 h-4"}),"Categories"]}),a.jsx("p",{className:"text-xl font-semibold text-gray-900",children:r.category_count||0})]}),a.jsxs("div",{className:"p-4 bg-green-50 rounded-lg",children:[a.jsxs("div",{className:"flex items-center gap-2 text-green-600 text-xs mb-1",children:[a.jsx(_r,{className:"w-4 h-4"}),"In Stock"]}),a.jsx("p",{className:"text-xl font-semibold text-green-700",children:r.in_stock_count||0})]}),a.jsxs("div",{className:"p-4 bg-red-50 rounded-lg",children:[a.jsxs("div",{className:"flex items-center gap-2 text-red-600 text-xs mb-1",children:[a.jsx(Hr,{className:"w-4 h-4"}),"Out of Stock"]}),a.jsx("p",{className:"text-xl font-semibold text-red-700",children:r.out_of_stock_count||0})]}),a.jsxs("div",{className:`p-4 rounded-lg ${r.is_stale?"bg-yellow-50":"bg-blue-50"}`,children:[a.jsxs("div",{className:`flex items-center gap-2 text-xs mb-1 ${r.is_stale?"text-yellow-600":"text-blue-600"}`,children:[a.jsx(xr,{className:"w-4 h-4"}),"Freshness"]}),a.jsx("p",{className:`text-sm font-semibold ${r.is_stale?"text-yellow-700":"text-blue-700"}`,children:r.freshness||"Never scraped"})]}),a.jsxs("div",{className:"p-4 bg-gray-50 rounded-lg",children:[a.jsxs("div",{className:"flex items-center gap-2 text-gray-500 text-xs mb-1",children:[a.jsx(Ch,{className:"w-4 h-4"}),"Next Crawl"]}),a.jsx("p",{className:"text-sm font-semibold text-gray-700",children:($=r.schedule)!=null&&$.next_run_at?P(r.schedule.next_run_at):"Not scheduled"})]})]}),r.linked_dispensary&&a.jsxs("div",{className:"p-4 bg-indigo-50 rounded-lg mb-6",children:[a.jsxs("div",{className:"flex items-center gap-2 text-indigo-600 text-xs mb-2",children:[a.jsx(WA,{className:"w-4 h-4"}),"Linked Dispensary"]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("p",{className:"font-semibold text-indigo-900",children:r.linked_dispensary.name}),a.jsxs("p",{className:"text-sm text-indigo-700 flex items-center gap-1",children:[a.jsx(yi,{className:"w-3 h-3"}),r.linked_dispensary.city,", ",r.linked_dispensary.state,r.linked_dispensary.address&&` - ${r.linked_dispensary.address}`]})]}),a.jsx("button",{onClick:()=>t(`/dispensaries/${r.linked_dispensary.slug}`),className:"text-sm text-indigo-600 hover:text-indigo-700 font-medium",children:"View Dispensary →"})]})]}),a.jsxs("div",{className:"flex gap-2 border-b border-gray-200",children:[a.jsx("button",{onClick:()=>v("products"),className:`px-4 py-2 border-b-2 transition-colors ${b==="products"?"border-blue-600 text-blue-600 font-medium":"border-transparent text-gray-600 hover:text-gray-900"}`,children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Ct,{className:"w-4 h-4"}),"Products (",i.length,")"]})}),a.jsx("button",{onClick:()=>v("brands"),className:`px-4 py-2 border-b-2 transition-colors ${b==="brands"?"border-blue-600 text-blue-600 font-medium":"border-transparent text-gray-600 hover:text-gray-900"}`,children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Cr,{className:"w-4 h-4"}),"Brands (",c.length,")"]})}),a.jsx("button",{onClick:()=>v("specials"),className:`px-4 py-2 border-b-2 transition-colors ${b==="specials"?"border-blue-600 text-blue-600 font-medium":"border-transparent text-gray-600 hover:text-gray-900"}`,children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx($x,{className:"w-4 h-4"}),"Specials"]})}),a.jsx("button",{onClick:()=>v("crawl-history"),className:`px-4 py-2 border-b-2 transition-colors ${b==="crawl-history"?"border-blue-600 text-blue-600 font-medium":"border-transparent text-gray-600 hover:text-gray-900"}`,children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(na,{className:"w-4 h-4"}),"Crawl History (",((M=r.recent_jobs)==null?void 0:M.length)||0,")"]})})]})]}),b==="crawl-history"&&a.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 overflow-hidden",children:[a.jsxs("div",{className:"p-4 border-b border-gray-200",children:[a.jsx("h2",{className:"text-lg font-semibold text-gray-900",children:"Recent Crawl Jobs"}),a.jsx("p",{className:"text-sm text-gray-500",children:"Last 10 crawl jobs for this store"})]}),r.recent_jobs&&r.recent_jobs.length>0?a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full",children:[a.jsx("thead",{className:"bg-gray-50",children:a.jsxs("tr",{children:[a.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"Status"}),a.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"Type"}),a.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"Started"}),a.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"Completed"}),a.jsx("th",{className:"px-4 py-3 text-center text-xs font-medium text-gray-500 uppercase",children:"Found"}),a.jsx("th",{className:"px-4 py-3 text-center text-xs font-medium text-gray-500 uppercase",children:"New"}),a.jsx("th",{className:"px-4 py-3 text-center text-xs font-medium text-gray-500 uppercase",children:"Updated"}),a.jsx("th",{className:"px-4 py-3 text-center text-xs font-medium text-gray-500 uppercase",children:"In Stock"}),a.jsx("th",{className:"px-4 py-3 text-center text-xs font-medium text-gray-500 uppercase",children:"Out of Stock"}),a.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"Error"})]})}),a.jsx("tbody",{className:"divide-y divide-gray-100",children:r.recent_jobs.map(C=>a.jsxs("tr",{className:"hover:bg-gray-50",children:[a.jsx("td",{className:"px-4 py-3",children:T(C.status)}),a.jsx("td",{className:"px-4 py-3 text-sm text-gray-700",children:C.job_type||"-"}),a.jsx("td",{className:"px-4 py-3 text-sm text-gray-700",children:P(C.started_at)}),a.jsx("td",{className:"px-4 py-3 text-sm text-gray-700",children:P(C.completed_at)}),a.jsx("td",{className:"px-4 py-3 text-center text-sm font-medium text-gray-900",children:C.products_found??"-"}),a.jsx("td",{className:"px-4 py-3 text-center text-sm font-medium text-green-600",children:C.products_new??"-"}),a.jsx("td",{className:"px-4 py-3 text-center text-sm font-medium text-blue-600",children:C.products_updated??"-"}),a.jsx("td",{className:"px-4 py-3 text-center text-sm font-medium text-green-600",children:C.in_stock_count??"-"}),a.jsx("td",{className:"px-4 py-3 text-center text-sm font-medium text-red-600",children:C.out_of_stock_count??"-"}),a.jsx("td",{className:"px-4 py-3 text-sm text-red-600 max-w-xs truncate",title:C.error_message||"",children:C.error_message||"-"})]},C.id))})]})}):a.jsxs("div",{className:"text-center py-12",children:[a.jsx(na,{className:"w-16 h-16 text-gray-300 mx-auto mb-4"}),a.jsx("p",{className:"text-gray-500",children:"No crawl history available"})]})]}),b==="products"&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"bg-white rounded-xl border border-gray-200 p-4",children:a.jsxs("div",{className:"flex flex-wrap gap-4",children:[a.jsxs("div",{className:"flex-1 min-w-[200px]",children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Category"}),a.jsxs("select",{value:p||"",onChange:C=>m(C.target.value?parseInt(C.target.value):null),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500",children:[a.jsx("option",{value:"",children:"All Categories"}),o.map(C=>a.jsxs("option",{value:C.id,children:[C.name," (",i.filter(R=>R.category_id===C.id).length,")"]},C.id))]})]}),a.jsxs("div",{className:"flex-1 min-w-[200px]",children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Brand"}),a.jsxs("select",{value:x,onChange:C=>g(C.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500",children:[a.jsx("option",{value:"",children:"All Brands"}),c.map(C=>a.jsx("option",{value:C,children:C},C))]})]}),a.jsxs("div",{className:"flex-1 min-w-[200px]",children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Sort By"}),a.jsxs("select",{value:j,onChange:C=>y(C.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500",children:[a.jsx("option",{value:"name",children:"Name (A-Z)"}),a.jsx("option",{value:"price_asc",children:"Price (Low to High)"}),a.jsx("option",{value:"price_desc",children:"Price (High to Low)"}),a.jsx("option",{value:"thc",children:"THC % (High to Low)"})]})]})]})}),i.length>0?a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:i.map(C=>a.jsxs("div",{className:"bg-white rounded-lg border border-gray-200 overflow-hidden hover:shadow-lg transition-shadow",children:[a.jsxs("div",{className:"aspect-square bg-gray-50 relative",children:[a.jsx("img",{src:N(C),alt:C.name,className:"w-full h-full object-cover"}),C.in_stock?a.jsx("span",{className:"absolute top-2 right-2 px-2 py-1 bg-green-500 text-white text-xs font-medium rounded",children:"In Stock"}):a.jsx("span",{className:"absolute top-2 right-2 px-2 py-1 bg-red-500 text-white text-xs font-medium rounded",children:"Out of Stock"})]}),a.jsxs("div",{className:"p-3 space-y-2",children:[a.jsx("h3",{className:"font-semibold text-sm text-gray-900 line-clamp-2",children:C.name}),C.brand&&a.jsx("p",{className:"text-xs text-gray-600 font-medium",children:C.brand}),C.category_name&&a.jsx("p",{className:"text-xs text-gray-500",children:C.category_name}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 pt-2 border-t border-gray-100",children:[C.price!==null&&a.jsxs("div",{className:"text-xs",children:[a.jsx("span",{className:"text-gray-500",children:"Price:"}),a.jsxs("span",{className:"ml-1 font-semibold text-blue-600",children:["$",parseFloat(C.price).toFixed(2)]})]}),C.weight&&a.jsxs("div",{className:"text-xs",children:[a.jsx("span",{className:"text-gray-500",children:"Weight:"}),a.jsx("span",{className:"ml-1 font-medium",children:C.weight})]}),C.thc_percentage!==null&&a.jsxs("div",{className:"text-xs",children:[a.jsx("span",{className:"text-gray-500",children:"THC:"}),a.jsxs("span",{className:"ml-1 font-medium text-green-600",children:[C.thc_percentage,"%"]})]}),C.cbd_percentage!==null&&a.jsxs("div",{className:"text-xs",children:[a.jsx("span",{className:"text-gray-500",children:"CBD:"}),a.jsxs("span",{className:"ml-1 font-medium text-blue-600",children:[C.cbd_percentage,"%"]})]}),C.strain_type&&a.jsxs("div",{className:"text-xs col-span-2",children:[a.jsx("span",{className:"text-gray-500",children:"Type:"}),a.jsx("span",{className:"ml-1 font-medium capitalize",children:C.strain_type})]})]}),C.description&&a.jsx("p",{className:"text-xs text-gray-600 line-clamp-2 pt-2 border-t border-gray-100",children:C.description}),C.last_seen_at&&a.jsxs("p",{className:"text-xs text-gray-400 pt-2 border-t border-gray-100",children:["Updated: ",new Date(C.last_seen_at).toLocaleDateString()]}),a.jsxs("div",{className:"flex gap-2 mt-3 pt-3 border-t border-gray-100",children:[C.dutchie_url&&a.jsx("a",{href:C.dutchie_url,target:"_blank",rel:"noopener noreferrer",className:"flex-1 px-3 py-2 bg-gray-100 text-gray-700 text-sm font-medium rounded-lg hover:bg-gray-200 transition-colors text-center border border-gray-200",children:"Dutchie"}),a.jsx("button",{onClick:()=>t(`/products/${C.id}`),className:"flex-1 px-3 py-2 bg-blue-600 text-white text-sm font-medium rounded-lg hover:bg-blue-700 transition-colors",children:"Details"})]})]})]},C.id))}):a.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-12 text-center",children:[a.jsx(Ct,{className:"w-16 h-16 text-gray-300 mx-auto mb-4"}),a.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-2",children:"No products found"}),a.jsx("p",{className:"text-gray-500",children:"Try adjusting your filters"})]})]}),b==="brands"&&a.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-6",children:[a.jsxs("h2",{className:"text-lg font-semibold text-gray-900 mb-4",children:["All Brands (",c.length,")"]}),c.length>0?a.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 gap-3",children:c.map(C=>{const R=i.filter(q=>q.brand===C);return a.jsxs("div",{className:"p-4 border border-gray-200 rounded-lg hover:border-blue-500 hover:bg-blue-50 transition-all cursor-pointer",onClick:()=>{v("products"),g(C)},children:[a.jsx("p",{className:"font-medium text-gray-900 text-sm",children:C}),a.jsxs("p",{className:"text-xs text-gray-500 mt-1",children:[R.length," products"]})]},C)})}):a.jsxs("div",{className:"text-center py-12",children:[a.jsx(Cr,{className:"w-16 h-16 text-gray-300 mx-auto mb-4"}),a.jsx("p",{className:"text-gray-500",children:"No brands found"})]})]}),b==="specials"&&a.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-6",children:[a.jsx("h2",{className:"text-lg font-semibold text-gray-900 mb-4",children:"Daily Specials"}),a.jsxs("div",{className:"text-center py-12",children:[a.jsx($x,{className:"w-16 h-16 text-gray-300 mx-auto mb-4"}),a.jsx("p",{className:"text-gray-500",children:"No specials available"})]})]})]})}):a.jsx(X,{children:a.jsxs("div",{className:"text-center py-12",children:[a.jsx("h2",{className:"text-2xl font-bold text-gray-900 mb-2",children:"Store not found"}),a.jsx("button",{onClick:()=>t("/stores"),className:"text-blue-600 hover:text-blue-700",children:"← Back to stores"})]})})}function nF(){const{state:e,storeName:t,slug:r}=ka(),n=dt(),[i,s]=h.useState(null),[o,l]=h.useState([]),[c,d]=h.useState(!0);h.useEffect(()=>{u()},[r]);const u=async()=>{d(!0);try{const p=(await B.getStores()).stores.find(x=>x.slug===r);if(!p)throw new Error("Store not found");s(p);const m=await B.getStoreBrands(p.id);l(m.brands)}catch(f){console.error("Failed to load brands:",f)}finally{d(!1)}};return c?a.jsx(X,{children:a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsx("span",{className:"loading loading-spinner loading-lg"})})}):i?a.jsx(X,{children:a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("button",{onClick:()=>n(`/stores/${e}/${t}/${r}`),className:"btn btn-ghost btn-sm",children:"← Back to Store"}),a.jsxs("div",{className:"flex-1",children:[a.jsxs("h1",{className:"text-3xl font-bold",children:[i.name," - Brands"]}),a.jsxs("div",{className:"flex gap-3 mt-2",children:[a.jsx("a",{href:`${i.dutchie_url}/brands`,target:"_blank",rel:"noopener noreferrer",className:"link link-primary text-sm",children:"View Live Brands Page"}),a.jsx("span",{className:"text-sm text-gray-500",children:"•"}),a.jsxs("span",{className:"text-sm text-gray-500",children:[o.length," ",o.length===1?"Brand":"Brands"]})]})]})]}),o.length>0?a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:o.map((f,p)=>a.jsx("div",{className:"card bg-base-100 shadow-md hover:shadow-lg transition-shadow",children:a.jsx("div",{className:"card-body p-6",children:a.jsx("h3",{className:"text-lg font-semibold text-center",children:f})})},p))}):a.jsx("div",{className:"card bg-base-100 shadow-xl",children:a.jsxs("div",{className:"card-body text-center py-12",children:[a.jsx("p",{className:"text-gray-500",children:"No brands found for this store"}),a.jsx("p",{className:"text-sm text-gray-400 mt-2",children:"Brands are automatically extracted from products"})]})})]})}):a.jsx(X,{children:a.jsx("div",{className:"text-center py-12",children:a.jsx("p",{className:"text-gray-500",children:"Store not found"})})})}function iF(){const{state:e,storeName:t,slug:r}=ka(),n=dt(),[i,s]=h.useState(null),[o,l]=h.useState([]),[c,d]=h.useState(new Date().toISOString().split("T")[0]),[u,f]=h.useState(!0);h.useEffect(()=>{p()},[r,c]);const p=async()=>{f(!0);try{const x=(await B.getStores()).stores.find(b=>b.slug===r);if(!x)throw new Error("Store not found");s(x);const g=await B.getStoreSpecials(x.id,c);l(g.specials)}catch(m){console.error("Failed to load specials:",m)}finally{f(!1)}};return u?a.jsx(X,{children:a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsx("span",{className:"loading loading-spinner loading-lg"})})}):i?a.jsx(X,{children:a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("button",{onClick:()=>n(`/stores/${e}/${t}/${r}`),className:"btn btn-ghost btn-sm",children:"← Back to Store"}),a.jsxs("div",{className:"flex-1",children:[a.jsxs("h1",{className:"text-3xl font-bold",children:[i.name," - Specials"]}),a.jsxs("div",{className:"flex gap-3 mt-2",children:[a.jsx("a",{href:`${i.dutchie_url}/specials`,target:"_blank",rel:"noopener noreferrer",className:"link link-primary text-sm",children:"View Live Specials Page"}),a.jsx("span",{className:"text-sm text-gray-500",children:"•"}),a.jsxs("span",{className:"text-sm text-gray-500",children:[o.length," ",o.length===1?"Special":"Specials"]})]})]})]}),a.jsx("div",{className:"card bg-base-100 shadow-md",children:a.jsx("div",{className:"card-body p-4",children:a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("label",{className:"font-semibold",children:"Select Date:"}),a.jsx("input",{type:"date",value:c,onChange:m=>d(m.target.value),className:"input input-bordered input-sm"})]})})}),o.length>0?a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:o.map((m,x)=>a.jsx("div",{className:"card bg-base-100 shadow-xl hover:shadow-2xl transition-shadow",children:a.jsxs("div",{className:"card-body",children:[a.jsx("h3",{className:"card-title text-lg",children:m.name}),m.description&&a.jsx("p",{className:"text-sm text-gray-600",children:m.description}),a.jsxs("div",{className:"space-y-2 mt-2",children:[m.original_price&&a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsx("span",{className:"text-sm opacity-60",children:"Original Price:"}),a.jsxs("span",{className:"line-through text-gray-500",children:["$",parseFloat(m.original_price).toFixed(2)]})]}),m.special_price&&a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsx("span",{className:"text-sm opacity-60",children:"Special Price:"}),a.jsxs("span",{className:"text-lg font-bold text-success",children:["$",parseFloat(m.special_price).toFixed(2)]})]}),m.discount_percentage&&a.jsxs("div",{className:"badge badge-success badge-lg",children:[m.discount_percentage,"% OFF"]}),m.discount_amount&&a.jsxs("div",{className:"badge badge-info badge-lg",children:["Save $",parseFloat(m.discount_amount).toFixed(2)]})]})]})},x))}):a.jsx("div",{className:"card bg-base-100 shadow-xl",children:a.jsxs("div",{className:"card-body text-center py-12",children:[a.jsxs("p",{className:"text-gray-500",children:["No specials found for ",c]}),a.jsx("p",{className:"text-sm text-gray-400 mt-2",children:"Try selecting a different date"})]})})]})}):a.jsx(X,{children:a.jsx("div",{className:"text-center py-12",children:a.jsx("p",{className:"text-gray-500",children:"Store not found"})})})}function aF(){const[e,t]=h.useState([]),[r,n]=h.useState(null),[i,s]=h.useState([]),[o,l]=h.useState(!0);h.useEffect(()=>{c()},[]),h.useEffect(()=>{r&&d()},[r]);const c=async()=>{try{const f=await B.getStores();t(f.stores),f.stores.length>0&&n(f.stores[0].id)}catch(f){console.error("Failed to load stores:",f)}finally{l(!1)}},d=async()=>{if(r)try{const f=await B.getCategoryTree(r);s(f.tree)}catch(f){console.error("Failed to load categories:",f)}};if(o)return a.jsx(X,{children:a.jsx("div",{children:"Loading..."})});const u=e.find(f=>f.id===r);return a.jsx(X,{children:a.jsxs("div",{children:[a.jsx("h1",{style:{fontSize:"32px",marginBottom:"30px"},children:"Categories"}),a.jsxs("div",{style:{background:"white",padding:"20px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",marginBottom:"30px"},children:[a.jsx("label",{style:{display:"block",marginBottom:"10px",fontWeight:"600"},children:"Select Store:"}),a.jsx("select",{value:r||"",onChange:f=>n(parseInt(f.target.value)),style:{width:"100%",padding:"12px",border:"2px solid #667eea",borderRadius:"6px",fontSize:"16px",cursor:"pointer"},children:e.map(f=>a.jsxs("option",{value:f.id,children:[f.name," (",f.category_count||0," categories)"]},f.id))})]}),u&&a.jsxs("div",{style:{background:"white",padding:"25px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)"},children:[a.jsxs("h2",{style:{marginBottom:"20px",fontSize:"24px"},children:[u.name," - Categories"]}),i.length===0?a.jsx("div",{style:{color:"#999",textAlign:"center",padding:"40px"},children:'No categories found. Run "Discover Categories" from the Stores page.'}):a.jsx("div",{children:i.map(f=>a.jsx(kk,{category:f},f.id))})]})]})})}function kk({category:e,level:t=0}){return a.jsxs("div",{style:{marginLeft:t*30+"px",marginBottom:"10px"},children:[a.jsxs("div",{style:{padding:"12px 15px",background:t===0?"#f0f0ff":"#f8f9fa",borderRadius:"6px",borderLeft:`4px solid ${t===0?"#667eea":"#999"}`,display:"flex",justifyContent:"space-between",alignItems:"center"},children:[a.jsxs("div",{children:[a.jsxs("strong",{style:{fontSize:t===0?"16px":"14px"},children:[t>0&&"└── ",e.name]}),a.jsxs("span",{style:{marginLeft:"10px",color:"#666",fontSize:"12px"},children:["(",e.product_count||0," products)"]})]}),a.jsx("div",{style:{fontSize:"12px",color:"#999"},children:a.jsx("code",{children:e.path})})]}),e.children&&e.children.length>0&&a.jsx("div",{style:{marginTop:"5px"},children:e.children.map(r=>a.jsx(kk,{category:r,level:t+1},r.id))})]})}function Vn({message:e,type:t,onClose:r,duration:n=4e3}){h.useEffect(()=>{const s=setTimeout(r,n);return()=>clearTimeout(s)},[n,r]);const i={success:"#10b981",error:"#ef4444",info:"#3b82f6"};return a.jsxs("div",{style:{position:"fixed",top:"20px",right:"20px",background:i[t],color:"white",padding:"16px 24px",borderRadius:"8px",boxShadow:"0 4px 12px rgba(0,0,0,0.15)",zIndex:9999,maxWidth:"400px",animation:"slideIn 0.3s ease-out",fontSize:"14px",fontWeight:"500"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px"},children:[a.jsx("div",{style:{flex:1,whiteSpace:"pre-wrap"},children:e}),a.jsx("button",{onClick:r,style:{background:"transparent",border:"none",color:"white",cursor:"pointer",fontSize:"18px",padding:"0 4px",opacity:.8},children:"×"})]}),a.jsx("style",{children:` @keyframes slideIn { from { transform: translateX(100%); @@ -386,14 +381,14 @@ Error generating stack: `+s.message+` opacity: 1; } } - `})]})}function l7(){const[e,t]=h.useState([]),[r,n]=h.useState(!0),[i,s]=h.useState(!1),[o,l]=h.useState(null);h.useEffect(()=>{c()},[]);const c=async()=>{n(!0);try{const u=await B.getCampaigns();t(u.campaigns)}catch(u){console.error("Failed to load campaigns:",u)}finally{n(!1)}},d=async(u,f)=>{if(confirm(`Are you sure you want to delete campaign "${f}"?`))try{await B.deleteCampaign(u),c()}catch(p){l({message:"Failed to delete campaign: "+p.message,type:"error"})}};return r?a.jsx(X,{children:a.jsx("div",{children:"Loading..."})}):a.jsxs(X,{children:[o&&a.jsx(Vn,{message:o.message,type:o.type,onClose:()=>l(null)}),a.jsxs("div",{children:[a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"30px"},children:[a.jsx("h1",{style:{fontSize:"32px",margin:0},children:"Campaigns"}),a.jsx("button",{onClick:()=>s(!0),style:{padding:"12px 24px",background:"#667eea",color:"white",border:"none",borderRadius:"6px",cursor:"pointer",fontSize:"14px",fontWeight:"500"},children:"+ Create Campaign"})]}),i&&a.jsx(c7,{onClose:()=>s(!1),onSuccess:()=>{s(!1),c()}}),a.jsx("div",{style:{display:"grid",gap:"20px"},children:e.map(u=>a.jsx("div",{style:{background:"white",padding:"25px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)"},children:a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"start"},children:[a.jsxs("div",{style:{flex:1},children:[a.jsxs("h3",{style:{marginBottom:"10px",fontSize:"20px"},children:[u.name,a.jsx("span",{style:{marginLeft:"10px",padding:"4px 8px",borderRadius:"4px",fontSize:"12px",background:u.active?"#d4edda":"#f8d7da",color:u.active?"#155724":"#721c24"},children:u.active?"Active":"Inactive"})]}),a.jsxs("div",{style:{fontSize:"14px",color:"#666",marginBottom:"5px"},children:[a.jsx("strong",{children:"Slug:"})," ",u.slug]}),u.description&&a.jsxs("div",{style:{fontSize:"14px",color:"#666",marginBottom:"5px"},children:[a.jsx("strong",{children:"Description:"})," ",u.description]}),a.jsxs("div",{style:{fontSize:"14px",color:"#666",marginBottom:"5px"},children:[a.jsx("strong",{children:"Display Style:"})," ",u.display_style]}),a.jsxs("div",{style:{fontSize:"14px",color:"#666"},children:[a.jsx("strong",{children:"Products:"})," ",u.product_count||0]})]}),a.jsx("div",{style:{display:"flex",gap:"10px"},children:a.jsx("button",{onClick:()=>d(u.id,u.name),style:{padding:"8px 16px",background:"#e74c3c",color:"white",border:"none",borderRadius:"6px",cursor:"pointer",fontSize:"14px"},children:"Delete"})})]})},u.id))}),e.length===0&&!i&&a.jsx("div",{style:{background:"white",padding:"40px",borderRadius:"8px",textAlign:"center",color:"#999"},children:"No campaigns found"})]})]})}function c7({onClose:e,onSuccess:t}){const[r,n]=h.useState(""),[i,s]=h.useState(""),[o,l]=h.useState(""),[c,d]=h.useState("grid"),[u,f]=h.useState(!0),[p,m]=h.useState(!1),[x,g]=h.useState(null),b=async v=>{v.preventDefault(),m(!0);try{await B.createCampaign({name:r,slug:i,description:o,display_style:c,active:u}),t()}catch(j){g({message:"Failed to create campaign: "+j.message,type:"error"})}finally{m(!1)}};return a.jsxs("div",{style:{background:"white",padding:"25px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",marginBottom:"20px"},children:[x&&a.jsx(Vn,{message:x.message,type:x.type,onClose:()=>g(null)}),a.jsx("h3",{style:{marginBottom:"20px"},children:"Create New Campaign"}),a.jsxs("form",{onSubmit:b,children:[a.jsxs("div",{style:{display:"grid",gap:"15px"},children:[a.jsxs("div",{children:[a.jsx("label",{style:{display:"block",marginBottom:"5px",fontWeight:"500"},children:"Name *"}),a.jsx("input",{type:"text",value:r,onChange:v=>n(v.target.value),required:!0,style:{width:"100%",padding:"10px",border:"1px solid #ddd",borderRadius:"6px"}})]}),a.jsxs("div",{children:[a.jsx("label",{style:{display:"block",marginBottom:"5px",fontWeight:"500"},children:"Slug *"}),a.jsx("input",{type:"text",value:i,onChange:v=>s(v.target.value),required:!0,placeholder:"e.g., summer-sale",style:{width:"100%",padding:"10px",border:"1px solid #ddd",borderRadius:"6px"}})]}),a.jsxs("div",{children:[a.jsx("label",{style:{display:"block",marginBottom:"5px",fontWeight:"500"},children:"Description"}),a.jsx("textarea",{value:o,onChange:v=>l(v.target.value),rows:3,style:{width:"100%",padding:"10px",border:"1px solid #ddd",borderRadius:"6px"}})]}),a.jsxs("div",{children:[a.jsx("label",{style:{display:"block",marginBottom:"5px",fontWeight:"500"},children:"Display Style"}),a.jsxs("select",{value:c,onChange:v=>d(v.target.value),style:{width:"100%",padding:"10px",border:"1px solid #ddd",borderRadius:"6px"},children:[a.jsx("option",{value:"grid",children:"Grid"}),a.jsx("option",{value:"list",children:"List"}),a.jsx("option",{value:"carousel",children:"Carousel"})]})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px"},children:[a.jsx("input",{type:"checkbox",id:"active",checked:u,onChange:v=>f(v.target.checked)}),a.jsx("label",{htmlFor:"active",children:"Active"})]})]}),a.jsxs("div",{style:{display:"flex",gap:"10px",marginTop:"20px"},children:[a.jsx("button",{type:"submit",disabled:p,style:{padding:"10px 20px",background:p?"#999":"#667eea",color:"white",border:"none",borderRadius:"6px",cursor:p?"not-allowed":"pointer",fontSize:"14px"},children:p?"Creating...":"Create Campaign"}),a.jsx("button",{type:"button",onClick:e,style:{padding:"10px 20px",background:"#ddd",color:"#333",border:"none",borderRadius:"6px",cursor:"pointer",fontSize:"14px"},children:"Cancel"})]})]})]})}function u7(){var l,c,d,u;const[e,t]=h.useState(null),[r,n]=h.useState(!0),[i,s]=h.useState(30);h.useEffect(()=>{o()},[i]);const o=async()=>{n(!0);try{const f=await B.getAnalyticsOverview(i);t(f)}catch(f){console.error("Failed to load analytics:",f)}finally{n(!1)}};return r?a.jsx(X,{children:a.jsx("div",{children:"Loading..."})}):a.jsx(X,{children:a.jsxs("div",{children:[a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"30px"},children:[a.jsx("h1",{style:{fontSize:"32px",margin:0},children:"Analytics"}),a.jsxs("select",{value:i,onChange:f=>s(parseInt(f.target.value)),style:{padding:"10px 15px",border:"1px solid #ddd",borderRadius:"6px",fontSize:"14px"},children:[a.jsx("option",{value:7,children:"Last 7 days"}),a.jsx("option",{value:30,children:"Last 30 days"}),a.jsx("option",{value:90,children:"Last 90 days"}),a.jsx("option",{value:365,children:"Last year"})]})]}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(250px, 1fr))",gap:"20px",marginBottom:"30px"},children:[a.jsx(wv,{title:"Total Clicks",value:((l=e==null?void 0:e.overview)==null?void 0:l.total_clicks)||0,icon:"👆",color:"#3498db"}),a.jsx(wv,{title:"Unique Products Clicked",value:((c=e==null?void 0:e.overview)==null?void 0:c.unique_products)||0,icon:"📦",color:"#2ecc71"})]}),a.jsxs("div",{style:{background:"white",padding:"25px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",marginBottom:"30px"},children:[a.jsx("h3",{style:{marginBottom:"20px"},children:"Clicks Over Time"}),((d=e==null?void 0:e.clicks_by_day)==null?void 0:d.length)>0?a.jsx("div",{style:{overflowX:"auto"},children:a.jsx("div",{style:{display:"flex",alignItems:"flex-end",gap:"8px",minWidth:"600px",height:"200px"},children:e.clicks_by_day.slice().reverse().map((f,p)=>{const m=Math.max(...e.clicks_by_day.map(g=>g.clicks)),x=f.clicks/m*180;return a.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",alignItems:"center"},children:[a.jsx("div",{style:{width:"100%",height:`${x}px`,background:"#667eea",borderRadius:"4px 4px 0 0",position:"relative",minHeight:"2px"},title:`${f.clicks} clicks`,children:a.jsx("div",{style:{position:"absolute",top:"-25px",left:"50%",transform:"translateX(-50%)",fontSize:"12px",fontWeight:"bold"},children:f.clicks})}),a.jsx("div",{style:{fontSize:"10px",marginTop:"5px",color:"#666",transform:"rotate(-45deg)",transformOrigin:"left",whiteSpace:"nowrap"},children:new Date(f.date).toLocaleDateString("en-US",{month:"short",day:"numeric"})})]},p)})})}):a.jsx("div",{style:{color:"#999",textAlign:"center",padding:"40px"},children:"No click data for this period"})]}),a.jsxs("div",{style:{background:"white",padding:"25px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)"},children:[a.jsx("h3",{style:{marginBottom:"20px"},children:"Top Products"}),((u=e==null?void 0:e.top_products)==null?void 0:u.length)>0?a.jsx("div",{children:e.top_products.map((f,p)=>a.jsxs("div",{style:{padding:"15px 0",borderBottom:p{u()},[]);const u=async()=>{n(!0);try{const x=await B.getSettings();t(x.settings)}catch(x){console.error("Failed to load settings:",x)}finally{n(!1)}},f=(x,g)=>{l(b=>({...b,[x]:g}))},p=async()=>{s(!0);try{const x=Object.entries(o).map(([g,b])=>({key:g,value:b}));await B.updateSettings(x),l({}),u(),d({message:"Settings saved successfully!",type:"success"})}catch(x){d({message:"Failed to save settings: "+x.message,type:"error"})}finally{s(!1)}},m=Object.keys(o).length>0;return r?a.jsx(X,{children:a.jsx("div",{children:"Loading..."})}):a.jsxs(X,{children:[c&&a.jsx(Vn,{message:c.message,type:c.type,onClose:()=>d(null)}),a.jsxs("div",{children:[a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"30px"},children:[a.jsx("h1",{style:{fontSize:"32px",margin:0},children:"Settings"}),m&&a.jsx("button",{onClick:p,disabled:i,style:{padding:"12px 24px",background:i?"#999":"#2ecc71",color:"white",border:"none",borderRadius:"6px",cursor:i?"not-allowed":"pointer",fontSize:"14px",fontWeight:"500"},children:i?"Saving...":"Save Changes"})]}),a.jsx("div",{style:{background:"white",padding:"25px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)"},children:a.jsx("div",{style:{display:"grid",gap:"25px"},children:e.map(x=>{const g=o[x.key]!==void 0?o[x.key]:x.value;return a.jsxs("div",{children:[a.jsx("label",{style:{display:"block",marginBottom:"8px",fontWeight:"500",fontSize:"16px"},children:f7(x.key)}),x.description&&a.jsx("div",{style:{fontSize:"13px",color:"#666",marginBottom:"8px"},children:x.description}),a.jsx("input",{type:"text",value:g,onChange:b=>f(x.key,b.target.value),style:{width:"100%",maxWidth:"500px",padding:"10px",border:o[x.key]!==void 0?"2px solid #667eea":"1px solid #ddd",borderRadius:"6px",fontSize:"14px"}}),a.jsxs("div",{style:{fontSize:"12px",color:"#999",marginTop:"5px"},children:["Last updated: ",new Date(x.updated_at).toLocaleString()]})]},x.key)})})}),m&&a.jsx("div",{style:{marginTop:"20px",padding:"15px",background:"#fff3cd",border:"1px solid #ffc107",borderRadius:"6px",color:"#856404"},children:'⚠️ You have unsaved changes. Click "Save Changes" to apply them.'})]})]})}function f7(e){return e.split("_").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function p7(){const[e,t]=h.useState([]),[r,n]=h.useState(!0),[i,s]=h.useState(!1),[o,l]=h.useState({}),[c,d]=h.useState(null),[u,f]=h.useState(null);h.useEffect(()=>{p(),m()},[]),h.useEffect(()=>{if(!(c!=null&&c.id))return;if(c.status==="completed"||c.status==="cancelled"||c.status==="failed"){p();return}const P=setInterval(async()=>{try{const _=await B.getProxyTestJob(c.id);d(_.job),(_.job.status==="completed"||_.job.status==="cancelled"||_.job.status==="failed")&&(clearInterval(P),p())}catch(_){console.error("Failed to poll job status:",_)}},2e3);return()=>clearInterval(P)},[c==null?void 0:c.id]);const p=async()=>{n(!0);try{const N=await B.getProxies();t(N.proxies)}catch(N){console.error("Failed to load proxies:",N)}finally{n(!1)}},m=async()=>{try{const N=await B.getActiveProxyTestJob();N.job&&d(N.job)}catch{console.log("No active job found")}},x=async N=>{l(P=>({...P,[N]:!0}));try{await B.testProxy(N),p()}catch(P){f({message:"Test failed: "+P.message,type:"error"})}finally{l(P=>({...P,[N]:!1}))}},g=async N=>{l(P=>({...P,[N]:!0})),B.testProxy(N).then(()=>{p(),l(P=>({...P,[N]:!1}))}).catch(()=>{l(P=>({...P,[N]:!1}))})},b=async()=>{try{const N=await B.testAllProxies();f({message:"Proxy testing job started",type:"success"}),d({id:N.jobId,status:"pending",tested_proxies:0,total_proxies:e.length,passed_proxies:0,failed_proxies:0})}catch(N){f({message:"Failed to start testing: "+N.message,type:"error"})}},v=async()=>{if(c!=null&&c.id)try{await B.cancelProxyTestJob(c.id),f({message:"Job cancelled",type:"info"})}catch(N){f({message:"Failed to cancel job: "+N.message,type:"error"})}},j=async()=>{try{await B.updateProxyLocations(),f({message:"Location update job started",type:"success"})}catch(N){f({message:"Failed to start location update: "+N.message,type:"error"})}},y=async N=>{if(confirm("Delete this proxy?"))try{await B.deleteProxy(N),p()}catch(P){f({message:"Failed to delete proxy: "+P.message,type:"error"})}};if(r)return a.jsx(X,{children:a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsx("div",{className:"w-8 h-8 border-4 border-gray-200 border-t-blue-600 rounded-full animate-spin"})})});const w={total:e.length,passed:e.filter(N=>N.active).length,failed:e.filter(N=>!N.active).length},S=w.total>0?Math.round(w.passed/w.total*100):0;return a.jsxs(X,{children:[u&&a.jsx(Vn,{message:u.message,type:u.type,onClose:()=>f(null)}),a.jsxs("div",{className:"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:"p-2 bg-blue-50 rounded-lg",children:a.jsx(sl,{className:"w-6 h-6 text-blue-600"})}),a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl font-semibold text-gray-900",children:"Proxies"}),a.jsxs("p",{className:"text-sm text-gray-500 mt-1",children:[w.total," total • ",w.passed," active • ",w.failed," inactive"]})]})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs("button",{onClick:b,disabled:!!c&&c.status!=="completed"&&c.status!=="cancelled"&&c.status!=="failed",className:"inline-flex items-center gap-2 px-4 py-2 bg-blue-50 text-blue-700 rounded-lg hover:bg-blue-100 transition-colors text-sm font-medium disabled:opacity-50 disabled:cursor-not-allowed",children:[a.jsx(Xt,{className:"w-4 h-4"}),"Test All"]}),a.jsxs("button",{onClick:j,className:"inline-flex items-center gap-2 px-4 py-2 bg-purple-50 text-purple-700 rounded-lg hover:bg-purple-100 transition-colors text-sm font-medium",children:[a.jsx(yi,{className:"w-4 h-4"}),"Update Locations"]}),a.jsxs("button",{onClick:()=>s(!0),className:"inline-flex items-center gap-2 px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors text-sm font-medium",children:[a.jsx(Af,{className:"w-4 h-4"}),"Add Proxy"]})]})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[a.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("div",{className:"p-2 bg-blue-50 rounded-lg",children:a.jsx(sl,{className:"w-5 h-5 text-blue-600"})}),a.jsx("div",{className:"flex items-center gap-1 text-xs text-gray-500",children:a.jsxs("span",{children:[S,"% pass rate"]})})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{className:"text-sm font-medium text-gray-600",children:"Total Proxies"}),a.jsx("p",{className:"text-3xl font-semibold text-gray-900",children:w.total})]})]}),a.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("div",{className:"p-2 bg-green-50 rounded-lg",children:a.jsx(_r,{className:"w-5 h-5 text-green-600"})}),a.jsxs("div",{className:"flex items-center gap-1 text-xs text-green-600",children:[a.jsx(zn,{className:"w-3 h-3"}),a.jsxs("span",{children:[Math.round(w.passed/w.total*100)||0,"%"]})]})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{className:"text-sm font-medium text-gray-600",children:"Active"}),a.jsx("p",{className:"text-3xl font-semibold text-green-600",children:w.passed}),a.jsx("p",{className:"text-xs text-gray-500",children:"Passing health checks"})]})]}),a.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("div",{className:"p-2 bg-red-50 rounded-lg",children:a.jsx(Hr,{className:"w-5 h-5 text-red-600"})}),a.jsx("div",{className:"flex items-center gap-1 text-xs text-red-600",children:a.jsxs("span",{children:[Math.round(w.failed/w.total*100)||0,"%"]})})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{className:"text-sm font-medium text-gray-600",children:"Inactive"}),a.jsx("p",{className:"text-3xl font-semibold text-red-600",children:w.failed}),a.jsx("p",{className:"text-xs text-gray-500",children:"Failed health checks"})]})]}),a.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-6",children:[a.jsx("div",{className:"flex items-center justify-between mb-4",children:a.jsx("div",{className:"p-2 bg-purple-50 rounded-lg",children:a.jsx(zn,{className:"w-5 h-5 text-purple-600"})})}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{className:"text-sm font-medium text-gray-600",children:"Success Rate"}),a.jsxs("p",{className:"text-3xl font-semibold text-gray-900",children:[S,"%"]}),a.jsx("div",{className:"w-full bg-gray-200 rounded-full h-2 mt-3",children:a.jsx("div",{className:"bg-green-600 h-2 rounded-full transition-all",style:{width:`${S}%`}})})]})]})]}),c&&a.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-6",children:[a.jsxs("div",{className:"flex justify-between items-center mb-4",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 bg-blue-50 rounded-lg",children:a.jsx(Xt,{className:`w-5 h-5 text-blue-600 ${c.status==="running"?"animate-spin":""}`})}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-semibold text-gray-900",children:"Proxy Testing Job"}),a.jsx("p",{className:"text-sm text-gray-500",children:c.status.charAt(0).toUpperCase()+c.status.slice(1)})]})]}),a.jsxs("div",{className:"flex gap-2",children:[c.status==="running"&&a.jsx("button",{onClick:v,className:"px-3 py-1.5 bg-red-50 text-red-700 rounded-lg hover:bg-red-100 transition-colors text-sm font-medium",children:"Cancel"}),(c.status==="completed"||c.status==="cancelled"||c.status==="failed")&&a.jsx("button",{onClick:()=>d(null),className:"px-3 py-1.5 text-gray-600 hover:bg-gray-50 rounded-lg transition-colors text-sm font-medium",children:"Dismiss"})]})]}),a.jsxs("div",{className:"mb-4",children:[a.jsxs("div",{className:"text-sm text-gray-600 mb-2",children:["Progress: ",c.tested_proxies||0," / ",c.total_proxies||0," proxies tested"]}),a.jsx("div",{className:"w-full bg-gray-200 rounded-full h-2",children:a.jsx("div",{className:`h-2 rounded-full transition-all ${c.status==="completed"?"bg-green-600":c.status==="cancelled"||c.status==="failed"?"bg-red-600":"bg-blue-600"}`,style:{width:`${(c.tested_proxies||0)/(c.total_proxies||100)*100}%`}})})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-sm text-gray-600",children:"Passed:"}),a.jsx("span",{className:"px-2 py-1 text-xs font-medium bg-green-50 text-green-700 rounded",children:c.passed_proxies||0})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-sm text-gray-600",children:"Failed:"}),a.jsx("span",{className:"px-2 py-1 text-xs font-medium bg-red-50 text-red-700 rounded",children:c.failed_proxies||0})]})]}),c.error&&a.jsxs("div",{className:"mt-4 p-3 bg-red-50 border border-red-200 rounded-lg flex items-start gap-2",children:[a.jsx(Uc,{className:"w-5 h-5 text-red-600 flex-shrink-0 mt-0.5"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium text-red-900",children:"Error"}),a.jsx("p",{className:"text-sm text-red-700",children:c.error})]})]})]}),i&&a.jsx(h7,{onClose:()=>s(!1),onSuccess:()=>{s(!1),p()}}),a.jsx("div",{className:"space-y-3",children:e.map(N=>a.jsx("div",{className:"bg-white rounded-xl border border-gray-200 p-4 hover:shadow-lg transition-shadow",children:a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsxs("h3",{className:"font-semibold text-gray-900",children:[N.protocol,"://",N.host,":",N.port]}),a.jsx("span",{className:`px-2 py-1 text-xs font-medium rounded ${N.active?"bg-green-50 text-green-700":"bg-red-50 text-red-700"}`,children:N.active?"Active":"Inactive"}),N.is_anonymous&&a.jsx("span",{className:"px-2 py-1 text-xs font-medium bg-blue-50 text-blue-700 rounded",children:"Anonymous"}),(N.city||N.state||N.country)&&a.jsxs("span",{className:"px-2 py-1 text-xs font-medium bg-purple-50 text-purple-700 rounded flex items-center gap-1",children:[a.jsx(yi,{className:"w-3 h-3"}),N.city&&`${N.city}/`,N.state&&`${N.state.substring(0,2).toUpperCase()} `,N.country]})]}),a.jsx("div",{className:"text-sm text-gray-600",children:N.last_tested_at?a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(xr,{className:"w-4 h-4 text-gray-400"}),a.jsxs("span",{children:["Last tested: ",new Date(N.last_tested_at).toLocaleString()]})]}),N.test_result==="success"?a.jsxs("span",{className:"flex items-center gap-1 text-green-600",children:[a.jsx(_r,{className:"w-4 h-4"}),"Success (",N.response_time_ms,"ms)"]}):a.jsxs("span",{className:"flex items-center gap-1 text-red-600",children:[a.jsx(Hr,{className:"w-4 h-4"}),"Failed"]})]}):"Not tested yet"})]}),a.jsxs("div",{className:"flex gap-2",children:[N.active?a.jsx("button",{onClick:()=>x(N.id),disabled:o[N.id],className:"inline-flex items-center gap-1 px-3 py-1.5 bg-blue-50 text-blue-700 rounded-lg hover:bg-blue-100 transition-colors text-sm font-medium disabled:opacity-50",children:o[N.id]?a.jsx("div",{className:"w-4 h-4 border-2 border-blue-700 border-t-transparent rounded-full animate-spin"}):a.jsxs(a.Fragment,{children:[a.jsx(Xt,{className:"w-4 h-4"}),"Test"]})}):a.jsx("button",{onClick:()=>g(N.id),disabled:o[N.id],className:"inline-flex items-center gap-1 px-3 py-1.5 bg-yellow-50 text-yellow-700 rounded-lg hover:bg-yellow-100 transition-colors text-sm font-medium disabled:opacity-50",children:o[N.id]?a.jsx("div",{className:"w-4 h-4 border-2 border-yellow-700 border-t-transparent rounded-full animate-spin"}):a.jsxs(a.Fragment,{children:[a.jsx(Xt,{className:"w-4 h-4"}),"Retest"]})}),a.jsxs("button",{onClick:()=>y(N.id),className:"inline-flex items-center gap-1 px-3 py-1.5 bg-red-50 text-red-700 rounded-lg hover:bg-red-100 transition-colors text-sm font-medium",children:[a.jsx(RO,{className:"w-4 h-4"}),"Delete"]})]})]})},N.id))}),e.length===0&&!i&&a.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-12 text-center",children:[a.jsx(sl,{className:"w-16 h-16 text-gray-300 mx-auto mb-4"}),a.jsx("h3",{className:"text-xl font-semibold text-gray-900 mb-2",children:"No proxies configured"}),a.jsx("p",{className:"text-gray-500 mb-6",children:"Add your first proxy to get started with scraping"}),a.jsxs("button",{onClick:()=>s(!0),className:"inline-flex items-center gap-2 px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors font-medium",children:[a.jsx(Af,{className:"w-4 h-4"}),"Add Proxy"]})]})]})]})}function h7({onClose:e,onSuccess:t}){const[r,n]=h.useState("single"),[i,s]=h.useState(""),[o,l]=h.useState(""),[c,d]=h.useState("http"),[u,f]=h.useState(""),[p,m]=h.useState(""),[x,g]=h.useState(""),[b,v]=h.useState(!1),[j,y]=h.useState(null),w=_=>{if(_=_.trim(),!_||_.startsWith("#"))return null;let T;return T=_.match(/^(https?|socks5):\/\/([^:]+):([^@]+)@([^:]+):(\d+)$/),T?{protocol:T[1],username:T[2],password:T[3],host:T[4],port:parseInt(T[5])}:(T=_.match(/^(https?|socks5):\/\/([^:]+):(\d+)$/),T?{protocol:T[1],host:T[2],port:parseInt(T[3])}:(T=_.match(/^([^:]+):(\d+):([^:]+):(.+)$/),T?{protocol:"http",host:T[1],port:parseInt(T[2]),username:T[3],password:T[4]}:(T=_.match(/^([^:]+):(\d+)$/),T?{protocol:"http",host:T[1],port:parseInt(T[2])}:null)))},S=async()=>{const T=x.split(` + `})]})}function sF(){const[e,t]=h.useState([]),[r,n]=h.useState(!0),[i,s]=h.useState(!1),[o,l]=h.useState(null);h.useEffect(()=>{c()},[]);const c=async()=>{n(!0);try{const u=await B.getCampaigns();t(u.campaigns)}catch(u){console.error("Failed to load campaigns:",u)}finally{n(!1)}},d=async(u,f)=>{if(confirm(`Are you sure you want to delete campaign "${f}"?`))try{await B.deleteCampaign(u),c()}catch(p){l({message:"Failed to delete campaign: "+p.message,type:"error"})}};return r?a.jsx(X,{children:a.jsx("div",{children:"Loading..."})}):a.jsxs(X,{children:[o&&a.jsx(Vn,{message:o.message,type:o.type,onClose:()=>l(null)}),a.jsxs("div",{children:[a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"30px"},children:[a.jsx("h1",{style:{fontSize:"32px",margin:0},children:"Campaigns"}),a.jsx("button",{onClick:()=>s(!0),style:{padding:"12px 24px",background:"#667eea",color:"white",border:"none",borderRadius:"6px",cursor:"pointer",fontSize:"14px",fontWeight:"500"},children:"+ Create Campaign"})]}),i&&a.jsx(oF,{onClose:()=>s(!1),onSuccess:()=>{s(!1),c()}}),a.jsx("div",{style:{display:"grid",gap:"20px"},children:e.map(u=>a.jsx("div",{style:{background:"white",padding:"25px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)"},children:a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"start"},children:[a.jsxs("div",{style:{flex:1},children:[a.jsxs("h3",{style:{marginBottom:"10px",fontSize:"20px"},children:[u.name,a.jsx("span",{style:{marginLeft:"10px",padding:"4px 8px",borderRadius:"4px",fontSize:"12px",background:u.active?"#d4edda":"#f8d7da",color:u.active?"#155724":"#721c24"},children:u.active?"Active":"Inactive"})]}),a.jsxs("div",{style:{fontSize:"14px",color:"#666",marginBottom:"5px"},children:[a.jsx("strong",{children:"Slug:"})," ",u.slug]}),u.description&&a.jsxs("div",{style:{fontSize:"14px",color:"#666",marginBottom:"5px"},children:[a.jsx("strong",{children:"Description:"})," ",u.description]}),a.jsxs("div",{style:{fontSize:"14px",color:"#666",marginBottom:"5px"},children:[a.jsx("strong",{children:"Display Style:"})," ",u.display_style]}),a.jsxs("div",{style:{fontSize:"14px",color:"#666"},children:[a.jsx("strong",{children:"Products:"})," ",u.product_count||0]})]}),a.jsx("div",{style:{display:"flex",gap:"10px"},children:a.jsx("button",{onClick:()=>d(u.id,u.name),style:{padding:"8px 16px",background:"#e74c3c",color:"white",border:"none",borderRadius:"6px",cursor:"pointer",fontSize:"14px"},children:"Delete"})})]})},u.id))}),e.length===0&&!i&&a.jsx("div",{style:{background:"white",padding:"40px",borderRadius:"8px",textAlign:"center",color:"#999"},children:"No campaigns found"})]})]})}function oF({onClose:e,onSuccess:t}){const[r,n]=h.useState(""),[i,s]=h.useState(""),[o,l]=h.useState(""),[c,d]=h.useState("grid"),[u,f]=h.useState(!0),[p,m]=h.useState(!1),[x,g]=h.useState(null),b=async v=>{v.preventDefault(),m(!0);try{await B.createCampaign({name:r,slug:i,description:o,display_style:c,active:u}),t()}catch(j){g({message:"Failed to create campaign: "+j.message,type:"error"})}finally{m(!1)}};return a.jsxs("div",{style:{background:"white",padding:"25px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",marginBottom:"20px"},children:[x&&a.jsx(Vn,{message:x.message,type:x.type,onClose:()=>g(null)}),a.jsx("h3",{style:{marginBottom:"20px"},children:"Create New Campaign"}),a.jsxs("form",{onSubmit:b,children:[a.jsxs("div",{style:{display:"grid",gap:"15px"},children:[a.jsxs("div",{children:[a.jsx("label",{style:{display:"block",marginBottom:"5px",fontWeight:"500"},children:"Name *"}),a.jsx("input",{type:"text",value:r,onChange:v=>n(v.target.value),required:!0,style:{width:"100%",padding:"10px",border:"1px solid #ddd",borderRadius:"6px"}})]}),a.jsxs("div",{children:[a.jsx("label",{style:{display:"block",marginBottom:"5px",fontWeight:"500"},children:"Slug *"}),a.jsx("input",{type:"text",value:i,onChange:v=>s(v.target.value),required:!0,placeholder:"e.g., summer-sale",style:{width:"100%",padding:"10px",border:"1px solid #ddd",borderRadius:"6px"}})]}),a.jsxs("div",{children:[a.jsx("label",{style:{display:"block",marginBottom:"5px",fontWeight:"500"},children:"Description"}),a.jsx("textarea",{value:o,onChange:v=>l(v.target.value),rows:3,style:{width:"100%",padding:"10px",border:"1px solid #ddd",borderRadius:"6px"}})]}),a.jsxs("div",{children:[a.jsx("label",{style:{display:"block",marginBottom:"5px",fontWeight:"500"},children:"Display Style"}),a.jsxs("select",{value:c,onChange:v=>d(v.target.value),style:{width:"100%",padding:"10px",border:"1px solid #ddd",borderRadius:"6px"},children:[a.jsx("option",{value:"grid",children:"Grid"}),a.jsx("option",{value:"list",children:"List"}),a.jsx("option",{value:"carousel",children:"Carousel"})]})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px"},children:[a.jsx("input",{type:"checkbox",id:"active",checked:u,onChange:v=>f(v.target.checked)}),a.jsx("label",{htmlFor:"active",children:"Active"})]})]}),a.jsxs("div",{style:{display:"flex",gap:"10px",marginTop:"20px"},children:[a.jsx("button",{type:"submit",disabled:p,style:{padding:"10px 20px",background:p?"#999":"#667eea",color:"white",border:"none",borderRadius:"6px",cursor:p?"not-allowed":"pointer",fontSize:"14px"},children:p?"Creating...":"Create Campaign"}),a.jsx("button",{type:"button",onClick:e,style:{padding:"10px 20px",background:"#ddd",color:"#333",border:"none",borderRadius:"6px",cursor:"pointer",fontSize:"14px"},children:"Cancel"})]})]})]})}function lF(){var l,c,d,u;const[e,t]=h.useState(null),[r,n]=h.useState(!0),[i,s]=h.useState(30);h.useEffect(()=>{o()},[i]);const o=async()=>{n(!0);try{const f=await B.getAnalyticsOverview(i);t(f)}catch(f){console.error("Failed to load analytics:",f)}finally{n(!1)}};return r?a.jsx(X,{children:a.jsx("div",{children:"Loading..."})}):a.jsx(X,{children:a.jsxs("div",{children:[a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"30px"},children:[a.jsx("h1",{style:{fontSize:"32px",margin:0},children:"Analytics"}),a.jsxs("select",{value:i,onChange:f=>s(parseInt(f.target.value)),style:{padding:"10px 15px",border:"1px solid #ddd",borderRadius:"6px",fontSize:"14px"},children:[a.jsx("option",{value:7,children:"Last 7 days"}),a.jsx("option",{value:30,children:"Last 30 days"}),a.jsx("option",{value:90,children:"Last 90 days"}),a.jsx("option",{value:365,children:"Last year"})]})]}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(250px, 1fr))",gap:"20px",marginBottom:"30px"},children:[a.jsx(wv,{title:"Total Clicks",value:((l=e==null?void 0:e.overview)==null?void 0:l.total_clicks)||0,icon:"👆",color:"#3498db"}),a.jsx(wv,{title:"Unique Products Clicked",value:((c=e==null?void 0:e.overview)==null?void 0:c.unique_products)||0,icon:"📦",color:"#2ecc71"})]}),a.jsxs("div",{style:{background:"white",padding:"25px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",marginBottom:"30px"},children:[a.jsx("h3",{style:{marginBottom:"20px"},children:"Clicks Over Time"}),((d=e==null?void 0:e.clicks_by_day)==null?void 0:d.length)>0?a.jsx("div",{style:{overflowX:"auto"},children:a.jsx("div",{style:{display:"flex",alignItems:"flex-end",gap:"8px",minWidth:"600px",height:"200px"},children:e.clicks_by_day.slice().reverse().map((f,p)=>{const m=Math.max(...e.clicks_by_day.map(g=>g.clicks)),x=f.clicks/m*180;return a.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",alignItems:"center"},children:[a.jsx("div",{style:{width:"100%",height:`${x}px`,background:"#667eea",borderRadius:"4px 4px 0 0",position:"relative",minHeight:"2px"},title:`${f.clicks} clicks`,children:a.jsx("div",{style:{position:"absolute",top:"-25px",left:"50%",transform:"translateX(-50%)",fontSize:"12px",fontWeight:"bold"},children:f.clicks})}),a.jsx("div",{style:{fontSize:"10px",marginTop:"5px",color:"#666",transform:"rotate(-45deg)",transformOrigin:"left",whiteSpace:"nowrap"},children:new Date(f.date).toLocaleDateString("en-US",{month:"short",day:"numeric"})})]},p)})})}):a.jsx("div",{style:{color:"#999",textAlign:"center",padding:"40px"},children:"No click data for this period"})]}),a.jsxs("div",{style:{background:"white",padding:"25px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)"},children:[a.jsx("h3",{style:{marginBottom:"20px"},children:"Top Products"}),((u=e==null?void 0:e.top_products)==null?void 0:u.length)>0?a.jsx("div",{children:e.top_products.map((f,p)=>a.jsxs("div",{style:{padding:"15px 0",borderBottom:p{u()},[]);const u=async()=>{n(!0);try{const x=await B.getSettings();t(x.settings)}catch(x){console.error("Failed to load settings:",x)}finally{n(!1)}},f=(x,g)=>{l(b=>({...b,[x]:g}))},p=async()=>{s(!0);try{const x=Object.entries(o).map(([g,b])=>({key:g,value:b}));await B.updateSettings(x),l({}),u(),d({message:"Settings saved successfully!",type:"success"})}catch(x){d({message:"Failed to save settings: "+x.message,type:"error"})}finally{s(!1)}},m=Object.keys(o).length>0;return r?a.jsx(X,{children:a.jsx("div",{children:"Loading..."})}):a.jsxs(X,{children:[c&&a.jsx(Vn,{message:c.message,type:c.type,onClose:()=>d(null)}),a.jsxs("div",{children:[a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"30px"},children:[a.jsx("h1",{style:{fontSize:"32px",margin:0},children:"Settings"}),m&&a.jsx("button",{onClick:p,disabled:i,style:{padding:"12px 24px",background:i?"#999":"#2ecc71",color:"white",border:"none",borderRadius:"6px",cursor:i?"not-allowed":"pointer",fontSize:"14px",fontWeight:"500"},children:i?"Saving...":"Save Changes"})]}),a.jsx("div",{style:{background:"white",padding:"25px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)"},children:a.jsx("div",{style:{display:"grid",gap:"25px"},children:e.map(x=>{const g=o[x.key]!==void 0?o[x.key]:x.value;return a.jsxs("div",{children:[a.jsx("label",{style:{display:"block",marginBottom:"8px",fontWeight:"500",fontSize:"16px"},children:uF(x.key)}),x.description&&a.jsx("div",{style:{fontSize:"13px",color:"#666",marginBottom:"8px"},children:x.description}),a.jsx("input",{type:"text",value:g,onChange:b=>f(x.key,b.target.value),style:{width:"100%",maxWidth:"500px",padding:"10px",border:o[x.key]!==void 0?"2px solid #667eea":"1px solid #ddd",borderRadius:"6px",fontSize:"14px"}}),a.jsxs("div",{style:{fontSize:"12px",color:"#999",marginTop:"5px"},children:["Last updated: ",new Date(x.updated_at).toLocaleString()]})]},x.key)})})}),m&&a.jsx("div",{style:{marginTop:"20px",padding:"15px",background:"#fff3cd",border:"1px solid #ffc107",borderRadius:"6px",color:"#856404"},children:'⚠️ You have unsaved changes. Click "Save Changes" to apply them.'})]})]})}function uF(e){return e.split("_").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function dF(){const[e,t]=h.useState([]),[r,n]=h.useState(!0),[i,s]=h.useState(!1),[o,l]=h.useState({}),[c,d]=h.useState(null),[u,f]=h.useState(null);h.useEffect(()=>{p(),m()},[]),h.useEffect(()=>{if(!(c!=null&&c.id))return;if(c.status==="completed"||c.status==="cancelled"||c.status==="failed"){p();return}const P=setInterval(async()=>{try{const _=await B.getProxyTestJob(c.id);d(_.job),(_.job.status==="completed"||_.job.status==="cancelled"||_.job.status==="failed")&&(clearInterval(P),p())}catch(_){console.error("Failed to poll job status:",_)}},2e3);return()=>clearInterval(P)},[c==null?void 0:c.id]);const p=async()=>{n(!0);try{const N=await B.getProxies();t(N.proxies)}catch(N){console.error("Failed to load proxies:",N)}finally{n(!1)}},m=async()=>{try{const N=await B.getActiveProxyTestJob();N.job&&d(N.job)}catch{console.log("No active job found")}},x=async N=>{l(P=>({...P,[N]:!0}));try{await B.testProxy(N),p()}catch(P){f({message:"Test failed: "+P.message,type:"error"})}finally{l(P=>({...P,[N]:!1}))}},g=async N=>{l(P=>({...P,[N]:!0})),B.testProxy(N).then(()=>{p(),l(P=>({...P,[N]:!1}))}).catch(()=>{l(P=>({...P,[N]:!1}))})},b=async()=>{try{const N=await B.testAllProxies();f({message:"Proxy testing job started",type:"success"}),d({id:N.jobId,status:"pending",tested_proxies:0,total_proxies:e.length,passed_proxies:0,failed_proxies:0})}catch(N){f({message:"Failed to start testing: "+N.message,type:"error"})}},v=async()=>{if(c!=null&&c.id)try{await B.cancelProxyTestJob(c.id),f({message:"Job cancelled",type:"info"})}catch(N){f({message:"Failed to cancel job: "+N.message,type:"error"})}},j=async()=>{try{await B.updateProxyLocations(),f({message:"Location update job started",type:"success"})}catch(N){f({message:"Failed to start location update: "+N.message,type:"error"})}},y=async N=>{if(confirm("Delete this proxy?"))try{await B.deleteProxy(N),p()}catch(P){f({message:"Failed to delete proxy: "+P.message,type:"error"})}};if(r)return a.jsx(X,{children:a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsx("div",{className:"w-8 h-8 border-4 border-gray-200 border-t-blue-600 rounded-full animate-spin"})})});const w={total:e.length,passed:e.filter(N=>N.active).length,failed:e.filter(N=>!N.active).length},S=w.total>0?Math.round(w.passed/w.total*100):0;return a.jsxs(X,{children:[u&&a.jsx(Vn,{message:u.message,type:u.type,onClose:()=>f(null)}),a.jsxs("div",{className:"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:"p-2 bg-blue-50 rounded-lg",children:a.jsx(sl,{className:"w-6 h-6 text-blue-600"})}),a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl font-semibold text-gray-900",children:"Proxies"}),a.jsxs("p",{className:"text-sm text-gray-500 mt-1",children:[w.total," total • ",w.passed," active • ",w.failed," inactive"]})]})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs("button",{onClick:b,disabled:!!c&&c.status!=="completed"&&c.status!=="cancelled"&&c.status!=="failed",className:"inline-flex items-center gap-2 px-4 py-2 bg-blue-50 text-blue-700 rounded-lg hover:bg-blue-100 transition-colors text-sm font-medium disabled:opacity-50 disabled:cursor-not-allowed",children:[a.jsx(Xt,{className:"w-4 h-4"}),"Test All"]}),a.jsxs("button",{onClick:j,className:"inline-flex items-center gap-2 px-4 py-2 bg-purple-50 text-purple-700 rounded-lg hover:bg-purple-100 transition-colors text-sm font-medium",children:[a.jsx(yi,{className:"w-4 h-4"}),"Update Locations"]}),a.jsxs("button",{onClick:()=>s(!0),className:"inline-flex items-center gap-2 px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors text-sm font-medium",children:[a.jsx(Af,{className:"w-4 h-4"}),"Add Proxy"]})]})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[a.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("div",{className:"p-2 bg-blue-50 rounded-lg",children:a.jsx(sl,{className:"w-5 h-5 text-blue-600"})}),a.jsx("div",{className:"flex items-center gap-1 text-xs text-gray-500",children:a.jsxs("span",{children:[S,"% pass rate"]})})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{className:"text-sm font-medium text-gray-600",children:"Total Proxies"}),a.jsx("p",{className:"text-3xl font-semibold text-gray-900",children:w.total})]})]}),a.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("div",{className:"p-2 bg-green-50 rounded-lg",children:a.jsx(_r,{className:"w-5 h-5 text-green-600"})}),a.jsxs("div",{className:"flex items-center gap-1 text-xs text-green-600",children:[a.jsx(zn,{className:"w-3 h-3"}),a.jsxs("span",{children:[Math.round(w.passed/w.total*100)||0,"%"]})]})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{className:"text-sm font-medium text-gray-600",children:"Active"}),a.jsx("p",{className:"text-3xl font-semibold text-green-600",children:w.passed}),a.jsx("p",{className:"text-xs text-gray-500",children:"Passing health checks"})]})]}),a.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("div",{className:"p-2 bg-red-50 rounded-lg",children:a.jsx(Hr,{className:"w-5 h-5 text-red-600"})}),a.jsx("div",{className:"flex items-center gap-1 text-xs text-red-600",children:a.jsxs("span",{children:[Math.round(w.failed/w.total*100)||0,"%"]})})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{className:"text-sm font-medium text-gray-600",children:"Inactive"}),a.jsx("p",{className:"text-3xl font-semibold text-red-600",children:w.failed}),a.jsx("p",{className:"text-xs text-gray-500",children:"Failed health checks"})]})]}),a.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-6",children:[a.jsx("div",{className:"flex items-center justify-between mb-4",children:a.jsx("div",{className:"p-2 bg-purple-50 rounded-lg",children:a.jsx(zn,{className:"w-5 h-5 text-purple-600"})})}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{className:"text-sm font-medium text-gray-600",children:"Success Rate"}),a.jsxs("p",{className:"text-3xl font-semibold text-gray-900",children:[S,"%"]}),a.jsx("div",{className:"w-full bg-gray-200 rounded-full h-2 mt-3",children:a.jsx("div",{className:"bg-green-600 h-2 rounded-full transition-all",style:{width:`${S}%`}})})]})]})]}),c&&a.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-6",children:[a.jsxs("div",{className:"flex justify-between items-center mb-4",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 bg-blue-50 rounded-lg",children:a.jsx(Xt,{className:`w-5 h-5 text-blue-600 ${c.status==="running"?"animate-spin":""}`})}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-semibold text-gray-900",children:"Proxy Testing Job"}),a.jsx("p",{className:"text-sm text-gray-500",children:c.status.charAt(0).toUpperCase()+c.status.slice(1)})]})]}),a.jsxs("div",{className:"flex gap-2",children:[c.status==="running"&&a.jsx("button",{onClick:v,className:"px-3 py-1.5 bg-red-50 text-red-700 rounded-lg hover:bg-red-100 transition-colors text-sm font-medium",children:"Cancel"}),(c.status==="completed"||c.status==="cancelled"||c.status==="failed")&&a.jsx("button",{onClick:()=>d(null),className:"px-3 py-1.5 text-gray-600 hover:bg-gray-50 rounded-lg transition-colors text-sm font-medium",children:"Dismiss"})]})]}),a.jsxs("div",{className:"mb-4",children:[a.jsxs("div",{className:"text-sm text-gray-600 mb-2",children:["Progress: ",c.tested_proxies||0," / ",c.total_proxies||0," proxies tested"]}),a.jsx("div",{className:"w-full bg-gray-200 rounded-full h-2",children:a.jsx("div",{className:`h-2 rounded-full transition-all ${c.status==="completed"?"bg-green-600":c.status==="cancelled"||c.status==="failed"?"bg-red-600":"bg-blue-600"}`,style:{width:`${(c.tested_proxies||0)/(c.total_proxies||100)*100}%`}})})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-sm text-gray-600",children:"Passed:"}),a.jsx("span",{className:"px-2 py-1 text-xs font-medium bg-green-50 text-green-700 rounded",children:c.passed_proxies||0})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-sm text-gray-600",children:"Failed:"}),a.jsx("span",{className:"px-2 py-1 text-xs font-medium bg-red-50 text-red-700 rounded",children:c.failed_proxies||0})]})]}),c.error&&a.jsxs("div",{className:"mt-4 p-3 bg-red-50 border border-red-200 rounded-lg flex items-start gap-2",children:[a.jsx(Uc,{className:"w-5 h-5 text-red-600 flex-shrink-0 mt-0.5"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium text-red-900",children:"Error"}),a.jsx("p",{className:"text-sm text-red-700",children:c.error})]})]})]}),i&&a.jsx(fF,{onClose:()=>s(!1),onSuccess:()=>{s(!1),p()}}),a.jsx("div",{className:"space-y-3",children:e.map(N=>a.jsx("div",{className:"bg-white rounded-xl border border-gray-200 p-4 hover:shadow-lg transition-shadow",children:a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsxs("h3",{className:"font-semibold text-gray-900",children:[N.protocol,"://",N.host,":",N.port]}),a.jsx("span",{className:`px-2 py-1 text-xs font-medium rounded ${N.active?"bg-green-50 text-green-700":"bg-red-50 text-red-700"}`,children:N.active?"Active":"Inactive"}),N.is_anonymous&&a.jsx("span",{className:"px-2 py-1 text-xs font-medium bg-blue-50 text-blue-700 rounded",children:"Anonymous"}),(N.city||N.state||N.country)&&a.jsxs("span",{className:"px-2 py-1 text-xs font-medium bg-purple-50 text-purple-700 rounded flex items-center gap-1",children:[a.jsx(yi,{className:"w-3 h-3"}),N.city&&`${N.city}/`,N.state&&`${N.state.substring(0,2).toUpperCase()} `,N.country]})]}),a.jsx("div",{className:"text-sm text-gray-600",children:N.last_tested_at?a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(xr,{className:"w-4 h-4 text-gray-400"}),a.jsxs("span",{children:["Last tested: ",new Date(N.last_tested_at).toLocaleString()]})]}),N.test_result==="success"?a.jsxs("span",{className:"flex items-center gap-1 text-green-600",children:[a.jsx(_r,{className:"w-4 h-4"}),"Success (",N.response_time_ms,"ms)"]}):a.jsxs("span",{className:"flex items-center gap-1 text-red-600",children:[a.jsx(Hr,{className:"w-4 h-4"}),"Failed"]})]}):"Not tested yet"})]}),a.jsxs("div",{className:"flex gap-2",children:[N.active?a.jsx("button",{onClick:()=>x(N.id),disabled:o[N.id],className:"inline-flex items-center gap-1 px-3 py-1.5 bg-blue-50 text-blue-700 rounded-lg hover:bg-blue-100 transition-colors text-sm font-medium disabled:opacity-50",children:o[N.id]?a.jsx("div",{className:"w-4 h-4 border-2 border-blue-700 border-t-transparent rounded-full animate-spin"}):a.jsxs(a.Fragment,{children:[a.jsx(Xt,{className:"w-4 h-4"}),"Test"]})}):a.jsx("button",{onClick:()=>g(N.id),disabled:o[N.id],className:"inline-flex items-center gap-1 px-3 py-1.5 bg-yellow-50 text-yellow-700 rounded-lg hover:bg-yellow-100 transition-colors text-sm font-medium disabled:opacity-50",children:o[N.id]?a.jsx("div",{className:"w-4 h-4 border-2 border-yellow-700 border-t-transparent rounded-full animate-spin"}):a.jsxs(a.Fragment,{children:[a.jsx(Xt,{className:"w-4 h-4"}),"Retest"]})}),a.jsxs("button",{onClick:()=>y(N.id),className:"inline-flex items-center gap-1 px-3 py-1.5 bg-red-50 text-red-700 rounded-lg hover:bg-red-100 transition-colors text-sm font-medium",children:[a.jsx(LO,{className:"w-4 h-4"}),"Delete"]})]})]})},N.id))}),e.length===0&&!i&&a.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-12 text-center",children:[a.jsx(sl,{className:"w-16 h-16 text-gray-300 mx-auto mb-4"}),a.jsx("h3",{className:"text-xl font-semibold text-gray-900 mb-2",children:"No proxies configured"}),a.jsx("p",{className:"text-gray-500 mb-6",children:"Add your first proxy to get started with scraping"}),a.jsxs("button",{onClick:()=>s(!0),className:"inline-flex items-center gap-2 px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors font-medium",children:[a.jsx(Af,{className:"w-4 h-4"}),"Add Proxy"]})]})]})]})}function fF({onClose:e,onSuccess:t}){const[r,n]=h.useState("single"),[i,s]=h.useState(""),[o,l]=h.useState(""),[c,d]=h.useState("http"),[u,f]=h.useState(""),[p,m]=h.useState(""),[x,g]=h.useState(""),[b,v]=h.useState(!1),[j,y]=h.useState(null),w=_=>{if(_=_.trim(),!_||_.startsWith("#"))return null;let T;return T=_.match(/^(https?|socks5):\/\/([^:]+):([^@]+)@([^:]+):(\d+)$/),T?{protocol:T[1],username:T[2],password:T[3],host:T[4],port:parseInt(T[5])}:(T=_.match(/^(https?|socks5):\/\/([^:]+):(\d+)$/),T?{protocol:T[1],host:T[2],port:parseInt(T[3])}:(T=_.match(/^([^:]+):(\d+):([^:]+):(.+)$/),T?{protocol:"http",host:T[1],port:parseInt(T[2]),username:T[3],password:T[4]}:(T=_.match(/^([^:]+):(\d+)$/),T?{protocol:"http",host:T[1],port:parseInt(T[2])}:null)))},S=async()=>{const T=x.split(` `).map($=>w($)).filter($=>$!==null);if(T.length===0){y({message:"No valid proxies found. Please check the format.",type:"error"});return}v(!0);try{const $=await B.addProxiesBulk(T),M=`Import complete! Added: ${$.added} Duplicates: ${$.duplicates||0} Failed: ${$.failed} -Proxies are inactive by default. Use "Test All Proxies" to verify and activate them.`;y({message:M,type:"success"}),t()}catch($){y({message:"Failed to import proxies: "+$.message,type:"error"})}finally{v(!1)}},N=async _=>{var M;const T=(M=_.target.files)==null?void 0:M[0];if(!T)return;const $=await T.text();g($)},P=async _=>{if(_.preventDefault(),r==="bulk"){await S();return}v(!0);try{await B.addProxy({host:i,port:parseInt(o),protocol:c,username:u||void 0,password:p||void 0}),t()}catch(T){y({message:"Failed to add proxy: "+T.message,type:"error"})}finally{v(!1)}};return a.jsxs("div",{className:"bg-white rounded-xl border border-gray-200",children:[j&&a.jsx(Vn,{message:j.message,type:j.type,onClose:()=>y(null)}),a.jsxs("div",{className:"p-6",children:[a.jsxs("div",{className:"flex justify-between items-center mb-6",children:[a.jsx("h2",{className:"text-xl font-semibold text-gray-900",children:"Add Proxies"}),a.jsxs("div",{className:"flex bg-gray-100 rounded-lg p-1",children:[a.jsx("button",{type:"button",onClick:()=>n("single"),className:`px-4 py-2 rounded-md text-sm font-medium transition-colors ${r==="single"?"bg-white text-gray-900 shadow-sm":"text-gray-600 hover:text-gray-900"}`,children:"Single"}),a.jsx("button",{type:"button",onClick:()=>n("bulk"),className:`px-4 py-2 rounded-md text-sm font-medium transition-colors ${r==="bulk"?"bg-white text-gray-900 shadow-sm":"text-gray-600 hover:text-gray-900"}`,children:"Bulk Import"})]})]}),a.jsxs("form",{onSubmit:P,children:[r==="single"?a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Host *"}),a.jsx("input",{type:"text",value:i,onChange:_=>s(_.target.value),required:!0,placeholder:"proxy.example.com",className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Port *"}),a.jsx("input",{type:"number",value:o,onChange:_=>l(_.target.value),required:!0,placeholder:"8080",className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Protocol *"}),a.jsxs("select",{value:c,onChange:_=>d(_.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500",children:[a.jsx("option",{value:"http",children:"HTTP"}),a.jsx("option",{value:"https",children:"HTTPS"}),a.jsx("option",{value:"socks5",children:"SOCKS5"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Username"}),a.jsx("input",{type:"text",value:u,onChange:_=>f(_.target.value),placeholder:"Optional",className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500"})]}),a.jsxs("div",{className:"md:col-span-2",children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Password"}),a.jsx("input",{type:"password",value:p,onChange:_=>m(_.target.value),placeholder:"Optional",className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500"})]})]}):a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Upload File"}),a.jsxs("label",{className:"flex items-center justify-center w-full px-4 py-6 border-2 border-gray-300 border-dashed rounded-lg cursor-pointer hover:border-blue-500 hover:bg-blue-50 transition-colors",children:[a.jsxs("div",{className:"flex flex-col items-center",children:[a.jsx(HO,{className:"w-8 h-8 text-gray-400 mb-2"}),a.jsx("span",{className:"text-sm text-gray-600",children:"Click to upload or drag and drop"}),a.jsx("span",{className:"text-xs text-gray-500 mt-1",children:".txt or .list files"})]}),a.jsx("input",{type:"file",accept:".txt,.list",onChange:N,className:"hidden"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Or Paste Proxies (one per line)"}),a.jsx("textarea",{value:x,onChange:_=>g(_.target.value),placeholder:`Supported formats: +Proxies are inactive by default. Use "Test All Proxies" to verify and activate them.`;y({message:M,type:"success"}),t()}catch($){y({message:"Failed to import proxies: "+$.message,type:"error"})}finally{v(!1)}},N=async _=>{var M;const T=(M=_.target.files)==null?void 0:M[0];if(!T)return;const $=await T.text();g($)},P=async _=>{if(_.preventDefault(),r==="bulk"){await S();return}v(!0);try{await B.addProxy({host:i,port:parseInt(o),protocol:c,username:u||void 0,password:p||void 0}),t()}catch(T){y({message:"Failed to add proxy: "+T.message,type:"error"})}finally{v(!1)}};return a.jsxs("div",{className:"bg-white rounded-xl border border-gray-200",children:[j&&a.jsx(Vn,{message:j.message,type:j.type,onClose:()=>y(null)}),a.jsxs("div",{className:"p-6",children:[a.jsxs("div",{className:"flex justify-between items-center mb-6",children:[a.jsx("h2",{className:"text-xl font-semibold text-gray-900",children:"Add Proxies"}),a.jsxs("div",{className:"flex bg-gray-100 rounded-lg p-1",children:[a.jsx("button",{type:"button",onClick:()=>n("single"),className:`px-4 py-2 rounded-md text-sm font-medium transition-colors ${r==="single"?"bg-white text-gray-900 shadow-sm":"text-gray-600 hover:text-gray-900"}`,children:"Single"}),a.jsx("button",{type:"button",onClick:()=>n("bulk"),className:`px-4 py-2 rounded-md text-sm font-medium transition-colors ${r==="bulk"?"bg-white text-gray-900 shadow-sm":"text-gray-600 hover:text-gray-900"}`,children:"Bulk Import"})]})]}),a.jsxs("form",{onSubmit:P,children:[r==="single"?a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Host *"}),a.jsx("input",{type:"text",value:i,onChange:_=>s(_.target.value),required:!0,placeholder:"proxy.example.com",className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Port *"}),a.jsx("input",{type:"number",value:o,onChange:_=>l(_.target.value),required:!0,placeholder:"8080",className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Protocol *"}),a.jsxs("select",{value:c,onChange:_=>d(_.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500",children:[a.jsx("option",{value:"http",children:"HTTP"}),a.jsx("option",{value:"https",children:"HTTPS"}),a.jsx("option",{value:"socks5",children:"SOCKS5"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Username"}),a.jsx("input",{type:"text",value:u,onChange:_=>f(_.target.value),placeholder:"Optional",className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500"})]}),a.jsxs("div",{className:"md:col-span-2",children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Password"}),a.jsx("input",{type:"password",value:p,onChange:_=>m(_.target.value),placeholder:"Optional",className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500"})]})]}):a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Upload File"}),a.jsxs("label",{className:"flex items-center justify-center w-full px-4 py-6 border-2 border-gray-300 border-dashed rounded-lg cursor-pointer hover:border-blue-500 hover:bg-blue-50 transition-colors",children:[a.jsxs("div",{className:"flex flex-col items-center",children:[a.jsx(UO,{className:"w-8 h-8 text-gray-400 mb-2"}),a.jsx("span",{className:"text-sm text-gray-600",children:"Click to upload or drag and drop"}),a.jsx("span",{className:"text-xs text-gray-500 mt-1",children:".txt or .list files"})]}),a.jsx("input",{type:"file",accept:".txt,.list",onChange:N,className:"hidden"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Or Paste Proxies (one per line)"}),a.jsx("textarea",{value:x,onChange:_=>g(_.target.value),placeholder:`Supported formats: host:port protocol://host:port host:port:username:password @@ -403,7 +398,7 @@ Example: 192.168.1.1:8080 http://proxy.example.com:3128 10.0.0.1:8080:user:pass -socks5://user:pass@proxy.example.com:1080`,rows:12,className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 font-mono text-sm"})]}),a.jsxs("div",{className:"p-3 bg-blue-50 border border-blue-200 rounded-lg flex items-start gap-2",children:[a.jsx(Uc,{className:"w-5 h-5 text-blue-600 flex-shrink-0 mt-0.5"}),a.jsx("span",{className:"text-sm text-blue-900",children:"Lines starting with # are treated as comments and ignored."})]})]}),a.jsxs("div",{className:"flex justify-end gap-3 mt-6 pt-6 border-t border-gray-200",children:[a.jsx("button",{type:"button",onClick:e,className:"px-4 py-2 text-gray-700 hover:bg-gray-50 rounded-lg transition-colors font-medium",children:"Cancel"}),a.jsx("button",{type:"submit",disabled:b,className:"inline-flex items-center gap-2 px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors font-medium disabled:opacity-50 disabled:cursor-not-allowed",children:b?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}),a.jsx("span",{children:"Processing..."})]}):a.jsxs(a.Fragment,{children:[a.jsx(Af,{className:"w-4 h-4"}),r==="bulk"?"Import Proxies":"Add Proxy"]})})]})]})]})]})}function m7(){const[e,t]=h.useState([]),[r,n]=h.useState(!0),[i,s]=h.useState(!0),[o,l]=h.useState(""),[c,d]=h.useState(""),[u,f]=h.useState(200),[p,m]=h.useState(null),x=h.useRef(null);h.useEffect(()=>{g()},[o,c,u]),h.useEffect(()=>{if(!i)return;const S=setInterval(()=>{g()},2e3);return()=>clearInterval(S)},[i,o,c,u]);const g=async()=>{try{const S=await B.getLogs(u,o,c);t(S.logs)}catch(S){console.error("Failed to load logs:",S)}finally{n(!1)}},b=async()=>{if(confirm("Are you sure you want to clear all logs?"))try{await B.clearLogs(),t([]),m({message:"Logs cleared successfully",type:"success"})}catch(S){m({message:"Failed to clear logs: "+S.message,type:"error"})}},v=()=>{var S;(S=x.current)==null||S.scrollIntoView({behavior:"smooth"})},j=S=>{switch(S){case"error":return"#dc3545";case"warn":return"#ffc107";case"info":return"#17a2b8";case"debug":return"#6c757d";default:return"#333"}},y=S=>{switch(S){case"error":return"#f8d7da";case"warn":return"#fff3cd";case"info":return"#d1ecf1";case"debug":return"#e2e3e5";default:return"#f8f9fa"}},w=S=>{switch(S){case"scraper":return"🔍";case"images":return"📸";case"categories":return"📂";case"system":return"⚙️";case"api":return"🌐";default:return"📝"}};return r?a.jsx(X,{children:a.jsx("div",{children:"Loading logs..."})}):a.jsxs(X,{children:[p&&a.jsx(Vn,{message:p.message,type:p.type,onClose:()=>m(null)}),a.jsxs("div",{children:[a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"20px"},children:[a.jsx("h1",{style:{fontSize:"32px",margin:0},children:"System Logs"}),a.jsxs("div",{style:{display:"flex",gap:"10px",alignItems:"center"},children:[a.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"5px"},children:[a.jsx("input",{type:"checkbox",checked:i,onChange:S=>s(S.target.checked)}),"Auto-refresh (2s)"]}),a.jsx("button",{onClick:v,style:{padding:"8px 16px",background:"#6c757d",color:"white",border:"none",borderRadius:"6px",cursor:"pointer"},children:"⬇️ Scroll to Bottom"}),a.jsx("button",{onClick:b,style:{padding:"8px 16px",background:"#dc3545",color:"white",border:"none",borderRadius:"6px",cursor:"pointer"},children:"🗑️ Clear Logs"})]})]}),a.jsxs("div",{style:{background:"white",padding:"20px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",marginBottom:"20px",display:"flex",gap:"15px",flexWrap:"wrap"},children:[a.jsxs("select",{value:o,onChange:S=>l(S.target.value),style:{padding:"10px",border:"1px solid #ddd",borderRadius:"6px"},children:[a.jsx("option",{value:"",children:"All Levels"}),a.jsx("option",{value:"info",children:"Info"}),a.jsx("option",{value:"warn",children:"Warning"}),a.jsx("option",{value:"error",children:"Error"}),a.jsx("option",{value:"debug",children:"Debug"})]}),a.jsxs("select",{value:c,onChange:S=>d(S.target.value),style:{padding:"10px",border:"1px solid #ddd",borderRadius:"6px"},children:[a.jsx("option",{value:"",children:"All Categories"}),a.jsx("option",{value:"scraper",children:"🔍 Scraper"}),a.jsx("option",{value:"images",children:"📸 Images"}),a.jsx("option",{value:"categories",children:"📂 Categories"}),a.jsx("option",{value:"system",children:"⚙️ System"}),a.jsx("option",{value:"api",children:"🌐 API"})]}),a.jsxs("select",{value:u,onChange:S=>f(parseInt(S.target.value)),style:{padding:"10px",border:"1px solid #ddd",borderRadius:"6px"},children:[a.jsx("option",{value:"50",children:"Last 50"}),a.jsx("option",{value:"100",children:"Last 100"}),a.jsx("option",{value:"200",children:"Last 200"}),a.jsx("option",{value:"500",children:"Last 500"}),a.jsx("option",{value:"1000",children:"Last 1000"})]}),a.jsx("div",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:"10px"},children:a.jsxs("span",{style:{fontSize:"14px",color:"#666"},children:["Showing ",e.length," logs"]})})]}),a.jsxs("div",{style:{background:"#1e1e1e",padding:"20px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",maxHeight:"70vh",overflowY:"auto",fontFamily:"monospace",fontSize:"13px"},children:[e.length===0?a.jsx("div",{style:{color:"#999",textAlign:"center",padding:"40px"},children:"No logs to display"}):e.map((S,N)=>a.jsxs("div",{style:{padding:"8px 12px",marginBottom:"4px",borderRadius:"4px",background:y(S.level),borderLeft:`4px solid ${j(S.level)}`,display:"flex",gap:"10px",alignItems:"flex-start"},children:[a.jsx("span",{style:{color:"#666",fontSize:"11px",whiteSpace:"nowrap"},children:new Date(S.timestamp).toLocaleTimeString()}),a.jsx("span",{style:{fontSize:"14px"},children:w(S.category)}),a.jsx("span",{style:{padding:"2px 6px",borderRadius:"3px",fontSize:"10px",fontWeight:"bold",background:j(S.level),color:"white",textTransform:"uppercase"},children:S.level}),a.jsx("span",{style:{padding:"2px 6px",borderRadius:"3px",fontSize:"10px",background:"#e2e3e5",color:"#333"},children:S.category}),a.jsx("span",{style:{flex:1,color:"#333",wordBreak:"break-word"},children:S.message})]},N)),a.jsx("div",{ref:x})]})]})]})}function g7(){const[e,t]=h.useState([]),[r,n]=h.useState([]),[i,s]=h.useState(null),[o,l]=h.useState([]),[c,d]=h.useState([]),[u,f]=h.useState([]),[p,m]=h.useState(!0),[x,g]=h.useState(!0),[b,v]=h.useState("az-live"),[j,y]=h.useState(null),[w,S]=h.useState(""),[N,P]=h.useState(null),[_,T]=h.useState({scheduledJobs:[],crawlJobs:[],inMemoryScrapers:[],totalActive:0}),[$,M]=h.useState({jobLogs:[],crawlJobs:[]}),[C,R]=h.useState([]);h.useEffect(()=>{if(q(),x){const E=setInterval(q,3e3);return()=>clearInterval(E)}},[x]);const q=async()=>{try{const[E,D,O,k,L,U]=await Promise.all([B.getActiveScrapers(),B.getScraperHistory(),B.getJobStats(),B.getActiveJobs(),B.getWorkerStats(),B.getRecentJobs({limit:50})]);t(E.scrapers||[]),n(D.history||[]),s(O),l(k.jobs||[]),d(L.workers||[]),f(U.jobs||[]);const[H,te,re,we]=await Promise.all([B.getAZMonitorSummary().catch(()=>null),B.getAZMonitorActiveJobs().catch(()=>({scheduledJobs:[],crawlJobs:[],inMemoryScrapers:[],totalActive:0})),B.getAZMonitorRecentJobs(30).catch(()=>({jobLogs:[],crawlJobs:[]})),B.getAZMonitorErrors({limit:10,hours:24}).catch(()=>({errors:[]}))]);P(H),T(te),M(re),R((we==null?void 0:we.errors)||[])}catch(E){console.error("Failed to load scraper data:",E)}finally{m(!1)}},Z=E=>{const D=Math.floor(E/1e3),O=Math.floor(D/60),k=Math.floor(O/60);return k>0?`${k}h ${O%60}m ${D%60}s`:O>0?`${O}m ${D%60}s`:`${D}s`};return a.jsx(X,{children:a.jsxs("div",{children:[a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"30px"},children:[a.jsx("h1",{style:{fontSize:"32px",margin:0},children:"Scraper Monitor"}),a.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"10px",cursor:"pointer"},children:[a.jsx("input",{type:"checkbox",checked:x,onChange:E=>g(E.target.checked),style:{width:"18px",height:"18px",cursor:"pointer"}}),a.jsx("span",{children:"Auto-refresh (3s)"})]})]}),a.jsxs("div",{style:{marginBottom:"30px",display:"flex",gap:"10px",borderBottom:"2px solid #eee"},children:[a.jsxs("button",{onClick:()=>v("az-live"),style:{padding:"12px 24px",background:b==="az-live"?"white":"transparent",border:"none",borderBottom:b==="az-live"?"3px solid #10b981":"3px solid transparent",cursor:"pointer",fontSize:"16px",fontWeight:b==="az-live"?"600":"400",color:b==="az-live"?"#10b981":"#666",marginBottom:"-2px"},children:["AZ Live ",_.totalActive>0&&a.jsx("span",{style:{marginLeft:"8px",padding:"2px 8px",background:"#10b981",color:"white",borderRadius:"10px",fontSize:"12px"},children:_.totalActive})]}),a.jsx("button",{onClick:()=>v("jobs"),style:{padding:"12px 24px",background:b==="jobs"?"white":"transparent",border:"none",borderBottom:b==="jobs"?"3px solid #2563eb":"3px solid transparent",cursor:"pointer",fontSize:"16px",fontWeight:b==="jobs"?"600":"400",color:b==="jobs"?"#2563eb":"#666",marginBottom:"-2px"},children:"Dispensary Jobs"}),a.jsx("button",{onClick:()=>v("scrapers"),style:{padding:"12px 24px",background:b==="scrapers"?"white":"transparent",border:"none",borderBottom:b==="scrapers"?"3px solid #2563eb":"3px solid transparent",cursor:"pointer",fontSize:"16px",fontWeight:b==="scrapers"?"600":"400",color:b==="scrapers"?"#2563eb":"#666",marginBottom:"-2px"},children:"Crawl History"})]}),b==="az-live"&&a.jsxs(a.Fragment,{children:[N&&a.jsx("div",{style:{marginBottom:"30px"},children:a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(180px, 1fr))",gap:"15px"},children:[a.jsxs("div",{style:{background:"white",padding:"20px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)"},children:[a.jsx("div",{style:{fontSize:"14px",color:"#999",marginBottom:"8px"},children:"Running Jobs"}),a.jsx("div",{style:{fontSize:"32px",fontWeight:"600",color:_.totalActive>0?"#10b981":"#666"},children:_.totalActive})]}),a.jsxs("div",{style:{background:"white",padding:"20px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)"},children:[a.jsx("div",{style:{fontSize:"14px",color:"#999",marginBottom:"8px"},children:"Successful (24h)"}),a.jsx("div",{style:{fontSize:"32px",fontWeight:"600",color:"#10b981"},children:(N.successful_jobs_24h||0)+(N.successful_crawls_24h||0)})]}),a.jsxs("div",{style:{background:"white",padding:"20px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)"},children:[a.jsx("div",{style:{fontSize:"14px",color:"#999",marginBottom:"8px"},children:"Failed (24h)"}),a.jsx("div",{style:{fontSize:"32px",fontWeight:"600",color:(N.failed_jobs_24h||0)+(N.failed_crawls_24h||0)>0?"#ef4444":"#666"},children:(N.failed_jobs_24h||0)+(N.failed_crawls_24h||0)})]}),a.jsxs("div",{style:{background:"white",padding:"20px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)"},children:[a.jsx("div",{style:{fontSize:"14px",color:"#999",marginBottom:"8px"},children:"Products (24h)"}),a.jsx("div",{style:{fontSize:"32px",fontWeight:"600",color:"#8b5cf6"},children:N.products_found_24h||0})]}),a.jsxs("div",{style:{background:"white",padding:"20px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)"},children:[a.jsx("div",{style:{fontSize:"14px",color:"#999",marginBottom:"8px"},children:"Snapshots (24h)"}),a.jsx("div",{style:{fontSize:"32px",fontWeight:"600",color:"#06b6d4"},children:N.snapshots_created_24h||0})]})]})}),a.jsxs("div",{style:{marginBottom:"30px"},children:[a.jsxs("h2",{style:{fontSize:"24px",marginBottom:"20px",display:"flex",alignItems:"center",gap:"10px"},children:["Active Jobs",_.totalActive>0&&a.jsxs("span",{style:{padding:"4px 12px",background:"#d1fae5",color:"#065f46",borderRadius:"12px",fontSize:"14px",fontWeight:"600"},children:[_.totalActive," running"]})]}),_.totalActive===0?a.jsxs("div",{style:{background:"white",padding:"60px 40px",borderRadius:"8px",textAlign:"center",boxShadow:"0 2px 8px rgba(0,0,0,0.1)"},children:[a.jsx("div",{style:{fontSize:"48px",marginBottom:"20px"},children:"😴"}),a.jsx("div",{style:{fontSize:"18px",color:"#666"},children:"No jobs currently running"})]}):a.jsxs("div",{style:{display:"grid",gap:"15px"},children:[_.scheduledJobs.map(E=>a.jsx("div",{style:{background:"white",padding:"20px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",borderLeft:"4px solid #10b981"},children:a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"start"},children:[a.jsxs("div",{style:{flex:1},children:[a.jsx("div",{style:{fontSize:"18px",fontWeight:"600",marginBottom:"8px"},children:E.job_name}),a.jsx("div",{style:{fontSize:"14px",color:"#666",marginBottom:"12px"},children:E.job_description||"Scheduled job"}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(120px, 1fr))",gap:"12px"},children:[a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:"12px",color:"#999",marginBottom:"4px"},children:"Processed"}),a.jsx("div",{style:{fontSize:"16px",fontWeight:"600"},children:E.items_processed||0})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:"12px",color:"#999",marginBottom:"4px"},children:"Succeeded"}),a.jsx("div",{style:{fontSize:"16px",fontWeight:"600",color:"#10b981"},children:E.items_succeeded||0})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:"12px",color:"#999",marginBottom:"4px"},children:"Failed"}),a.jsx("div",{style:{fontSize:"16px",fontWeight:"600",color:E.items_failed>0?"#ef4444":"#666"},children:E.items_failed||0})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:"12px",color:"#999",marginBottom:"4px"},children:"Duration"}),a.jsxs("div",{style:{fontSize:"16px",fontWeight:"600"},children:[Math.floor((E.duration_seconds||0)/60),"m ",Math.floor((E.duration_seconds||0)%60),"s"]})]})]})]}),a.jsx("div",{style:{padding:"6px 12px",borderRadius:"4px",fontSize:"13px",fontWeight:"600",background:"#d1fae5",color:"#065f46"},children:"RUNNING"})]})},`sched-${E.id}`)),_.crawlJobs.map(E=>a.jsx("div",{style:{background:"white",padding:"20px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",borderLeft:"4px solid #3b82f6"},children:a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"start"},children:[a.jsxs("div",{style:{flex:1},children:[a.jsx("div",{style:{fontSize:"18px",fontWeight:"600",marginBottom:"8px"},children:E.dispensary_name||"Unknown Store"}),a.jsxs("div",{style:{fontSize:"14px",color:"#666",marginBottom:"12px"},children:[E.city," | ",E.job_type||"crawl"]}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(120px, 1fr))",gap:"12px"},children:[a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:"12px",color:"#999",marginBottom:"4px"},children:"Products Found"}),a.jsx("div",{style:{fontSize:"16px",fontWeight:"600",color:"#8b5cf6"},children:E.products_found||0})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:"12px",color:"#999",marginBottom:"4px"},children:"Snapshots"}),a.jsx("div",{style:{fontSize:"16px",fontWeight:"600",color:"#06b6d4"},children:E.snapshots_created||0})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:"12px",color:"#999",marginBottom:"4px"},children:"Duration"}),a.jsxs("div",{style:{fontSize:"16px",fontWeight:"600"},children:[Math.floor((E.duration_seconds||0)/60),"m ",Math.floor((E.duration_seconds||0)%60),"s"]})]})]})]}),a.jsx("div",{style:{padding:"6px 12px",borderRadius:"4px",fontSize:"13px",fontWeight:"600",background:"#dbeafe",color:"#1e40af"},children:"CRAWLING"})]})},`crawl-${E.id}`))]})]}),(N==null?void 0:N.nextRuns)&&N.nextRuns.length>0&&a.jsxs("div",{style:{marginBottom:"30px"},children:[a.jsx("h2",{style:{fontSize:"24px",marginBottom:"20px"},children:"Next Scheduled Runs"}),a.jsx("div",{style:{background:"white",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",overflow:"hidden"},children:a.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[a.jsx("thead",{children:a.jsxs("tr",{style:{background:"#f8f8f8",borderBottom:"2px solid #eee"},children:[a.jsx("th",{style:{padding:"15px",textAlign:"left",fontWeight:"600"},children:"Job"}),a.jsx("th",{style:{padding:"15px",textAlign:"left",fontWeight:"600"},children:"Next Run"}),a.jsx("th",{style:{padding:"15px",textAlign:"center",fontWeight:"600"},children:"Last Status"})]})}),a.jsx("tbody",{children:N.nextRuns.map(E=>a.jsxs("tr",{style:{borderBottom:"1px solid #eee"},children:[a.jsxs("td",{style:{padding:"15px"},children:[a.jsx("div",{style:{fontWeight:"600"},children:E.job_name}),a.jsx("div",{style:{fontSize:"13px",color:"#666"},children:E.description})]}),a.jsx("td",{style:{padding:"15px"},children:a.jsx("div",{style:{fontWeight:"600",color:"#2563eb"},children:E.next_run_at?new Date(E.next_run_at).toLocaleString():"-"})}),a.jsx("td",{style:{padding:"15px",textAlign:"center"},children:a.jsx("span",{style:{padding:"4px 10px",borderRadius:"12px",fontSize:"12px",fontWeight:"600",background:E.last_status==="success"?"#d1fae5":E.last_status==="error"?"#fee2e2":"#fef3c7",color:E.last_status==="success"?"#065f46":E.last_status==="error"?"#991b1b":"#92400e"},children:E.last_status||"never"})})]},E.id))})]})})]}),C.length>0&&a.jsxs("div",{style:{marginBottom:"30px"},children:[a.jsx("h2",{style:{fontSize:"24px",marginBottom:"20px",color:"#ef4444"},children:"Recent Errors (24h)"}),a.jsx("div",{style:{background:"white",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",overflow:"hidden"},children:C.map((E,D)=>a.jsxs("div",{style:{padding:"15px",borderBottom:Da.jsxs("tr",{style:{borderBottom:"1px solid #eee"},children:[a.jsxs("td",{style:{padding:"15px"},children:[a.jsx("div",{style:{fontWeight:"600"},children:E.job_name}),a.jsxs("div",{style:{fontSize:"12px",color:"#999"},children:["Log #",E.id]})]}),a.jsx("td",{style:{padding:"15px",textAlign:"center"},children:a.jsx("span",{style:{padding:"4px 10px",borderRadius:"12px",fontSize:"12px",fontWeight:"600",background:E.status==="success"?"#d1fae5":E.status==="running"?"#dbeafe":E.status==="error"?"#fee2e2":"#fef3c7",color:E.status==="success"?"#065f46":E.status==="running"?"#1e40af":E.status==="error"?"#991b1b":"#92400e"},children:E.status})}),a.jsxs("td",{style:{padding:"15px",textAlign:"right"},children:[a.jsx("span",{style:{color:"#10b981"},children:E.items_succeeded||0})," / ",a.jsx("span",{children:E.items_processed||0})]}),a.jsx("td",{style:{padding:"15px",textAlign:"right"},children:E.duration_ms?`${Math.floor(E.duration_ms/6e4)}m ${Math.floor(E.duration_ms%6e4/1e3)}s`:"-"}),a.jsx("td",{style:{padding:"15px",color:"#666"},children:E.completed_at?new Date(E.completed_at).toLocaleString():"-"})]},`log-${E.id}`))})]})})]})]}),b==="jobs"&&a.jsxs(a.Fragment,{children:[i&&a.jsxs("div",{style:{marginBottom:"30px"},children:[a.jsx("h2",{style:{fontSize:"24px",marginBottom:"20px"},children:"Job Statistics"}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(200px, 1fr))",gap:"15px"},children:[a.jsxs("div",{style:{background:"white",padding:"20px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)"},children:[a.jsx("div",{style:{fontSize:"14px",color:"#999",marginBottom:"8px"},children:"Pending"}),a.jsx("div",{style:{fontSize:"32px",fontWeight:"600",color:"#f59e0b"},children:i.pending||0})]}),a.jsxs("div",{style:{background:"white",padding:"20px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)"},children:[a.jsx("div",{style:{fontSize:"14px",color:"#999",marginBottom:"8px"},children:"In Progress"}),a.jsx("div",{style:{fontSize:"32px",fontWeight:"600",color:"#3b82f6"},children:i.in_progress||0})]}),a.jsxs("div",{style:{background:"white",padding:"20px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)"},children:[a.jsx("div",{style:{fontSize:"14px",color:"#999",marginBottom:"8px"},children:"Completed"}),a.jsx("div",{style:{fontSize:"32px",fontWeight:"600",color:"#10b981"},children:i.completed||0})]}),a.jsxs("div",{style:{background:"white",padding:"20px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)"},children:[a.jsx("div",{style:{fontSize:"14px",color:"#999",marginBottom:"8px"},children:"Failed"}),a.jsx("div",{style:{fontSize:"32px",fontWeight:"600",color:"#ef4444"},children:i.failed||0})]}),a.jsxs("div",{style:{background:"white",padding:"20px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)"},children:[a.jsx("div",{style:{fontSize:"14px",color:"#999",marginBottom:"8px"},children:"Products Found"}),a.jsx("div",{style:{fontSize:"32px",fontWeight:"600",color:"#8b5cf6"},children:i.total_products_found||0})]}),a.jsxs("div",{style:{background:"white",padding:"20px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)"},children:[a.jsx("div",{style:{fontSize:"14px",color:"#999",marginBottom:"8px"},children:"Products Saved"}),a.jsx("div",{style:{fontSize:"32px",fontWeight:"600",color:"#06b6d4"},children:i.total_products_saved||0})]})]})]}),c.length>0&&a.jsxs("div",{style:{marginBottom:"30px"},children:[a.jsxs("h2",{style:{fontSize:"24px",marginBottom:"20px"},children:["Active Workers (",c.length,")"]}),a.jsx("div",{style:{display:"grid",gap:"15px"},children:c.map(E=>a.jsxs("div",{style:{background:"white",padding:"20px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",borderLeft:"4px solid #10b981"},children:[a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[a.jsxs("div",{style:{fontSize:"18px",fontWeight:"600",marginBottom:"12px"},children:["Worker: ",E.worker_id]}),a.jsx("div",{style:{padding:"6px 12px",borderRadius:"4px",fontSize:"13px",fontWeight:"600",background:"#d1fae5",color:"#065f46"},children:"ACTIVE"})]}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(150px, 1fr))",gap:"12px"},children:[a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:"12px",color:"#999",marginBottom:"4px"},children:"Active Jobs"}),a.jsx("div",{style:{fontSize:"16px",fontWeight:"600"},children:E.active_jobs})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:"12px",color:"#999",marginBottom:"4px"},children:"Products Found"}),a.jsx("div",{style:{fontSize:"16px",fontWeight:"600",color:"#8b5cf6"},children:E.total_products_found||0})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:"12px",color:"#999",marginBottom:"4px"},children:"Products Saved"}),a.jsx("div",{style:{fontSize:"16px",fontWeight:"600",color:"#10b981"},children:E.total_products_saved||0})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:"12px",color:"#999",marginBottom:"4px"},children:"Running Since"}),a.jsx("div",{style:{fontSize:"14px"},children:new Date(E.earliest_start).toLocaleTimeString()})]})]})]},E.worker_id))})]}),a.jsxs("div",{style:{marginBottom:"30px"},children:[a.jsxs("h2",{style:{fontSize:"24px",marginBottom:"20px"},children:["Active Jobs (",o.length,")"]}),o.length===0?a.jsxs("div",{style:{background:"white",padding:"60px 40px",borderRadius:"8px",textAlign:"center",boxShadow:"0 2px 8px rgba(0,0,0,0.1)"},children:[a.jsx("div",{style:{fontSize:"48px",marginBottom:"20px"},children:"😴"}),a.jsx("div",{style:{fontSize:"18px",color:"#666"},children:"No jobs currently running"})]}):a.jsx("div",{style:{display:"grid",gap:"15px"},children:o.map(E=>a.jsx("div",{style:{background:"white",padding:"20px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",borderLeft:"4px solid #3b82f6"},children:a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"start"},children:[a.jsxs("div",{style:{flex:1},children:[a.jsx("div",{style:{fontSize:"18px",fontWeight:"600",marginBottom:"8px"},children:E.dispensary_name||E.brand_name}),a.jsxs("div",{style:{fontSize:"14px",color:"#666",marginBottom:"12px"},children:[E.job_type||"crawl"," | Job #",E.id]}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(150px, 1fr))",gap:"12px"},children:[a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:"12px",color:"#999",marginBottom:"4px"},children:"Products Found"}),a.jsx("div",{style:{fontSize:"16px",fontWeight:"600",color:"#8b5cf6"},children:E.products_found||0})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:"12px",color:"#999",marginBottom:"4px"},children:"Products Saved"}),a.jsx("div",{style:{fontSize:"16px",fontWeight:"600",color:"#10b981"},children:E.products_saved||0})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:"12px",color:"#999",marginBottom:"4px"},children:"Duration"}),a.jsxs("div",{style:{fontSize:"16px",fontWeight:"600"},children:[Math.floor(E.duration_seconds/60),"m ",Math.floor(E.duration_seconds%60),"s"]})]})]})]}),a.jsx("div",{style:{padding:"6px 12px",borderRadius:"4px",fontSize:"13px",fontWeight:"600",background:"#dbeafe",color:"#1e40af"},children:"IN PROGRESS"})]})},E.id))})]}),a.jsxs("div",{children:[a.jsxs("h2",{style:{fontSize:"24px",marginBottom:"20px"},children:["Recent Jobs (",u.length,")"]}),a.jsx("div",{style:{background:"white",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",overflow:"hidden"},children:a.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[a.jsx("thead",{children:a.jsxs("tr",{style:{background:"#f8f8f8",borderBottom:"2px solid #eee"},children:[a.jsx("th",{style:{padding:"15px",textAlign:"left",fontWeight:"600"},children:"Dispensary"}),a.jsx("th",{style:{padding:"15px",textAlign:"left",fontWeight:"600"},children:"Type"}),a.jsx("th",{style:{padding:"15px",textAlign:"center",fontWeight:"600"},children:"Status"}),a.jsx("th",{style:{padding:"15px",textAlign:"right",fontWeight:"600"},children:"Found"}),a.jsx("th",{style:{padding:"15px",textAlign:"right",fontWeight:"600"},children:"Saved"}),a.jsx("th",{style:{padding:"15px",textAlign:"right",fontWeight:"600"},children:"Duration"}),a.jsx("th",{style:{padding:"15px",textAlign:"left",fontWeight:"600"},children:"Completed"})]})}),a.jsx("tbody",{children:u.map(E=>a.jsxs("tr",{style:{borderBottom:"1px solid #eee"},children:[a.jsx("td",{style:{padding:"15px"},children:E.dispensary_name||E.brand_name}),a.jsx("td",{style:{padding:"15px",fontSize:"14px",color:"#666"},children:E.job_type||"-"}),a.jsx("td",{style:{padding:"15px",textAlign:"center"},children:a.jsx("span",{style:{padding:"4px 10px",borderRadius:"12px",fontSize:"12px",fontWeight:"600",background:E.status==="completed"?"#d1fae5":E.status==="in_progress"?"#dbeafe":E.status==="failed"?"#fee2e2":"#fef3c7",color:E.status==="completed"?"#065f46":E.status==="in_progress"?"#1e40af":E.status==="failed"?"#991b1b":"#92400e"},children:E.status})}),a.jsx("td",{style:{padding:"15px",textAlign:"right",fontWeight:"600"},children:E.products_found||0}),a.jsx("td",{style:{padding:"15px",textAlign:"right",fontWeight:"600",color:"#10b981"},children:E.products_saved||0}),a.jsx("td",{style:{padding:"15px",textAlign:"right"},children:E.duration_seconds?`${Math.floor(E.duration_seconds/60)}m ${Math.floor(E.duration_seconds%60)}s`:"-"}),a.jsx("td",{style:{padding:"15px",color:"#666"},children:E.completed_at?new Date(E.completed_at).toLocaleString():"-"})]},E.id))})]})})]})]}),b==="scrapers"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{style:{marginBottom:"30px"},children:[a.jsxs("h2",{style:{fontSize:"24px",marginBottom:"20px"},children:["Active Scrapers (",e.length,")"]}),e.length===0?a.jsxs("div",{style:{background:"white",padding:"60px 40px",borderRadius:"8px",textAlign:"center",boxShadow:"0 2px 8px rgba(0,0,0,0.1)"},children:[a.jsx("div",{style:{fontSize:"48px",marginBottom:"20px"},children:"🛌"}),a.jsx("div",{style:{fontSize:"18px",color:"#666"},children:"No scrapers currently running"})]}):a.jsx("div",{style:{display:"grid",gap:"15px"},children:e.map(E=>a.jsx("div",{style:{background:"white",padding:"20px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",borderLeft:`4px solid ${E.status==="running"?E.isStale?"#ff9800":"#2ecc71":E.status==="error"?"#e74c3c":"#95a5a6"}`},children:a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"start"},children:[a.jsxs("div",{style:{flex:1},children:[a.jsxs("div",{style:{fontSize:"18px",fontWeight:"600",marginBottom:"8px"},children:[E.storeName," - ",E.categoryName]}),a.jsxs("div",{style:{fontSize:"14px",color:"#666",marginBottom:"12px"},children:["ID: ",E.id]}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(150px, 1fr))",gap:"12px"},children:[a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:"12px",color:"#999",marginBottom:"4px"},children:"Requests"}),a.jsxs("div",{style:{fontSize:"16px",fontWeight:"600"},children:[E.stats.requestsSuccess," / ",E.stats.requestsTotal]})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:"12px",color:"#999",marginBottom:"4px"},children:"Items Saved"}),a.jsx("div",{style:{fontSize:"16px",fontWeight:"600",color:"#2ecc71"},children:E.stats.itemsSaved})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:"12px",color:"#999",marginBottom:"4px"},children:"Items Dropped"}),a.jsx("div",{style:{fontSize:"16px",fontWeight:"600",color:"#e74c3c"},children:E.stats.itemsDropped})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:"12px",color:"#999",marginBottom:"4px"},children:"Errors"}),a.jsx("div",{style:{fontSize:"16px",fontWeight:"600",color:E.stats.errorsCount>0?"#ff9800":"#999"},children:E.stats.errorsCount})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:"12px",color:"#999",marginBottom:"4px"},children:"Duration"}),a.jsx("div",{style:{fontSize:"16px",fontWeight:"600"},children:Z(E.duration)})]})]}),E.currentActivity&&a.jsxs("div",{style:{marginTop:"12px",padding:"8px 12px",background:"#f8f8f8",borderRadius:"4px",fontSize:"14px",color:"#666"},children:["📍 ",E.currentActivity]}),E.isStale&&a.jsx("div",{style:{marginTop:"12px",padding:"8px 12px",background:"#fff3cd",borderRadius:"4px",fontSize:"14px",color:"#856404"},children:"⚠️ No update in over 1 minute - scraper may be stuck"})]}),a.jsx("div",{style:{padding:"6px 12px",borderRadius:"4px",fontSize:"13px",fontWeight:"600",background:E.status==="running"?"#d4edda":E.status==="error"?"#f8d7da":"#e7e7e7",color:E.status==="running"?"#155724":E.status==="error"?"#721c24":"#666"},children:E.status.toUpperCase()})]})},E.id))})]}),a.jsxs("div",{children:[a.jsxs("h2",{style:{fontSize:"24px",marginBottom:"20px"},children:["Recent Scrapes (",r.length,")"]}),a.jsx("div",{style:{background:"white",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",overflow:"hidden"},children:a.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[a.jsx("thead",{children:a.jsxs("tr",{style:{background:"#f8f8f8",borderBottom:"2px solid #eee"},children:[a.jsx("th",{style:{padding:"15px",textAlign:"left",fontWeight:"600"},children:"Dispensary"}),a.jsx("th",{style:{padding:"15px",textAlign:"left",fontWeight:"600"},children:"Status"}),a.jsx("th",{style:{padding:"15px",textAlign:"right",fontWeight:"600"},children:"Found"}),a.jsx("th",{style:{padding:"15px",textAlign:"right",fontWeight:"600"},children:"Products"}),a.jsx("th",{style:{padding:"15px",textAlign:"left",fontWeight:"600"},children:"Last Crawled"})]})}),a.jsx("tbody",{children:r.map((E,D)=>a.jsxs("tr",{style:{borderBottom:"1px solid #eee"},children:[a.jsx("td",{style:{padding:"15px"},children:E.dispensary_name||E.store_name}),a.jsx("td",{style:{padding:"15px"},children:a.jsx("span",{style:{padding:"4px 10px",borderRadius:"12px",fontSize:"12px",fontWeight:"600",background:E.status==="completed"?"#d1fae5":E.status==="failed"?"#fee2e2":"#fef3c7",color:E.status==="completed"?"#065f46":E.status==="failed"?"#991b1b":"#92400e"},children:E.status||"-"})}),a.jsx("td",{style:{padding:"15px",textAlign:"right",fontWeight:"600"},children:E.products_found||"-"}),a.jsx("td",{style:{padding:"15px",textAlign:"right",fontWeight:"600"},children:E.product_count}),a.jsx("td",{style:{padding:"15px",color:"#666"},children:E.last_scraped_at?new Date(E.last_scraped_at).toLocaleString():"-"})]},D))})]})})]})]})]})})}function x7(){var we;const[e,t]=h.useState([]),[r,n]=h.useState([]),[i,s]=h.useState([]),[o,l]=h.useState(!0),[c,d]=h.useState(!0),[u,f]=h.useState("dispensaries"),[p,m]=h.useState(null),[x,g]=h.useState(null),[b,v]=h.useState(null),[j,y]=h.useState(null),[w,S]=h.useState(!1),[N,P]=h.useState("all"),[_,T]=h.useState(""),[$,M]=h.useState("");h.useEffect(()=>{const A=setTimeout(()=>{T($)},300);return()=>clearTimeout(A)},[$]),h.useEffect(()=>{if(C(),c){const A=setInterval(C,5e3);return()=>clearInterval(A)}},[c,N,_]);const C=async()=>{try{const A={};N==="AZ"&&(A.state="AZ"),_.trim()&&(A.search=_.trim());const[J,Ot,z]=await Promise.all([B.getGlobalSchedule(),B.getDispensarySchedules(Object.keys(A).length>0?A:void 0),B.getDispensaryCrawlJobs(100)]);t(J.schedules||[]),n(Ot.dispensaries||[]),s(z.jobs||[])}catch(A){console.error("Failed to load schedule data:",A)}finally{l(!1)}},R=async A=>{m(A);try{await B.triggerDispensaryCrawl(A),await C()}catch(J){console.error("Failed to trigger crawl:",J)}finally{m(null)}},q=async()=>{if(confirm("This will create crawl jobs for ALL active stores. Continue?"))try{const A=await B.triggerAllCrawls();alert(`Created ${A.jobs_created} crawl jobs`),await C()}catch(A){console.error("Failed to trigger all crawls:",A)}},Z=async A=>{try{await B.cancelCrawlJob(A),await C()}catch(J){console.error("Failed to cancel job:",J)}},E=async A=>{g(A);try{const J=await B.resolvePlatformId(A);J.success?alert(J.message):alert(`Failed: ${J.error||J.message}`),await C()}catch(J){console.error("Failed to resolve platform ID:",J),alert(`Error: ${J.message}`)}finally{g(null)}},D=async A=>{v(A);try{const J=await B.refreshDetection(A);alert(`Detected: ${J.menu_type}${J.platform_dispensary_id?`, Platform ID: ${J.platform_dispensary_id}`:""}`),await C()}catch(J){console.error("Failed to refresh detection:",J),alert(`Error: ${J.message}`)}finally{v(null)}},O=async(A,J)=>{y(A);try{await B.toggleDispensarySchedule(A,!J),await C()}catch(Ot){console.error("Failed to toggle schedule:",Ot),alert(`Error: ${Ot.message}`)}finally{y(null)}},k=async(A,J)=>{try{await B.updateGlobalSchedule(A,J),await C()}catch(Ot){console.error("Failed to update global schedule:",Ot)}},L=A=>{if(!A)return"Never";const J=new Date(A),z=new Date().getTime()-J.getTime(),ee=Math.floor(z/6e4),ne=Math.floor(ee/60),W=Math.floor(ne/24);return ee<1?"Just now":ee<60?`${ee}m ago`:ne<24?`${ne}h ago`:`${W}d ago`},U=A=>{const J=new Date(A),Ot=new Date,z=J.getTime()-Ot.getTime();if(z<0)return"Overdue";const ee=Math.floor(z/6e4),ne=Math.floor(ee/60);return ee<60?`${ee}m`:`${ne}h ${ee%60}m`},H=A=>{switch(A){case"completed":case"success":return{bg:"#d1fae5",color:"#065f46"};case"running":return{bg:"#dbeafe",color:"#1e40af"};case"failed":case"error":return{bg:"#fee2e2",color:"#991b1b"};case"cancelled":return{bg:"#f3f4f6",color:"#374151"};case"pending":return{bg:"#fef3c7",color:"#92400e"};case"sandbox_only":return{bg:"#e0e7ff",color:"#3730a3"};case"detection_only":return{bg:"#fce7f3",color:"#9d174d"};default:return{bg:"#f3f4f6",color:"#374151"}}},te=e.find(A=>A.schedule_type==="global_interval"),re=e.find(A=>A.schedule_type==="daily_special");return a.jsx(X,{children:a.jsxs("div",{children:[a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"30px"},children:[a.jsx("h1",{style:{fontSize:"32px",margin:0},children:"Crawler Schedule"}),a.jsxs("div",{style:{display:"flex",gap:"15px",alignItems:"center"},children:[a.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"10px",cursor:"pointer"},children:[a.jsx("input",{type:"checkbox",checked:c,onChange:A=>d(A.target.checked),style:{width:"18px",height:"18px",cursor:"pointer"}}),a.jsx("span",{children:"Auto-refresh (5s)"})]}),a.jsx("button",{onClick:q,style:{padding:"10px 20px",background:"#2563eb",color:"white",border:"none",borderRadius:"6px",cursor:"pointer",fontWeight:"600"},children:"Crawl All Stores"})]})]}),a.jsxs("div",{style:{marginBottom:"30px",display:"flex",gap:"10px",borderBottom:"2px solid #eee"},children:[a.jsxs("button",{onClick:()=>f("dispensaries"),style:{padding:"12px 24px",background:u==="dispensaries"?"white":"transparent",border:"none",borderBottom:u==="dispensaries"?"3px solid #2563eb":"3px solid transparent",cursor:"pointer",fontSize:"16px",fontWeight:u==="dispensaries"?"600":"400",color:u==="dispensaries"?"#2563eb":"#666",marginBottom:"-2px"},children:["Dispensary Schedules (",r.length,")"]}),a.jsxs("button",{onClick:()=>f("jobs"),style:{padding:"12px 24px",background:u==="jobs"?"white":"transparent",border:"none",borderBottom:u==="jobs"?"3px solid #2563eb":"3px solid transparent",cursor:"pointer",fontSize:"16px",fontWeight:u==="jobs"?"600":"400",color:u==="jobs"?"#2563eb":"#666",marginBottom:"-2px"},children:["Job Queue (",i.filter(A=>A.status==="pending"||A.status==="running").length,")"]}),a.jsx("button",{onClick:()=>f("global"),style:{padding:"12px 24px",background:u==="global"?"white":"transparent",border:"none",borderBottom:u==="global"?"3px solid #2563eb":"3px solid transparent",cursor:"pointer",fontSize:"16px",fontWeight:u==="global"?"600":"400",color:u==="global"?"#2563eb":"#666",marginBottom:"-2px"},children:"Global Settings"})]}),u==="global"&&a.jsxs("div",{style:{display:"grid",gap:"20px"},children:[a.jsxs("div",{style:{background:"white",padding:"24px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)"},children:[a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"start",marginBottom:"20px"},children:[a.jsxs("div",{children:[a.jsx("h2",{style:{fontSize:"20px",margin:0,marginBottom:"8px"},children:"Interval Crawl Schedule"}),a.jsx("p",{style:{color:"#666",margin:0},children:"Crawl all stores periodically"})]}),a.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"10px",cursor:"pointer"},children:[a.jsx("span",{style:{color:"#666"},children:"Enabled"}),a.jsx("input",{type:"checkbox",checked:(te==null?void 0:te.enabled)??!0,onChange:A=>k("global_interval",{enabled:A.target.checked}),style:{width:"20px",height:"20px",cursor:"pointer"}})]})]}),a.jsx("div",{style:{display:"flex",alignItems:"center",gap:"15px"},children:a.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"10px"},children:[a.jsx("span",{children:"Crawl every"}),a.jsxs("select",{value:(te==null?void 0:te.interval_hours)??4,onChange:A=>k("global_interval",{interval_hours:parseInt(A.target.value)}),style:{padding:"8px 12px",borderRadius:"6px",border:"1px solid #ddd",fontSize:"16px"},children:[a.jsx("option",{value:1,children:"1 hour"}),a.jsx("option",{value:2,children:"2 hours"}),a.jsx("option",{value:4,children:"4 hours"}),a.jsx("option",{value:6,children:"6 hours"}),a.jsx("option",{value:8,children:"8 hours"}),a.jsx("option",{value:12,children:"12 hours"}),a.jsx("option",{value:24,children:"24 hours"})]})]})})]}),a.jsxs("div",{style:{background:"white",padding:"24px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)"},children:[a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"start",marginBottom:"20px"},children:[a.jsxs("div",{children:[a.jsx("h2",{style:{fontSize:"20px",margin:0,marginBottom:"8px"},children:"Daily Special Crawl"}),a.jsx("p",{style:{color:"#666",margin:0},children:"Crawl stores at local midnight to capture daily specials"})]}),a.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"10px",cursor:"pointer"},children:[a.jsx("span",{style:{color:"#666"},children:"Enabled"}),a.jsx("input",{type:"checkbox",checked:(re==null?void 0:re.enabled)??!0,onChange:A=>k("daily_special",{enabled:A.target.checked}),style:{width:"20px",height:"20px",cursor:"pointer"}})]})]}),a.jsx("div",{style:{display:"flex",alignItems:"center",gap:"15px"},children:a.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"10px"},children:[a.jsx("span",{children:"Run at"}),a.jsx("input",{type:"time",value:((we=re==null?void 0:re.run_time)==null?void 0:we.slice(0,5))??"00:01",onChange:A=>k("daily_special",{run_time:A.target.value}),style:{padding:"8px 12px",borderRadius:"6px",border:"1px solid #ddd",fontSize:"16px"}}),a.jsx("span",{style:{color:"#666"},children:"(store local time)"})]})})]})]}),u==="dispensaries"&&a.jsxs("div",{children:[a.jsxs("div",{style:{marginBottom:"15px",display:"flex",gap:"20px",alignItems:"center",flexWrap:"wrap"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[a.jsx("span",{style:{fontWeight:"500",color:"#374151"},children:"State:"}),a.jsxs("div",{style:{display:"flex",borderRadius:"6px",overflow:"hidden",border:"1px solid #d1d5db"},children:[a.jsx("button",{onClick:()=>P("all"),style:{padding:"6px 14px",background:N==="all"?"#2563eb":"white",color:N==="all"?"white":"#374151",border:"none",cursor:"pointer",fontSize:"14px",fontWeight:"500"},children:"All"}),a.jsx("button",{onClick:()=>P("AZ"),style:{padding:"6px 14px",background:N==="AZ"?"#2563eb":"white",color:N==="AZ"?"white":"#374151",border:"none",borderLeft:"1px solid #d1d5db",cursor:"pointer",fontSize:"14px",fontWeight:"500"},children:"AZ Only"})]})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[a.jsx("span",{style:{fontWeight:"500",color:"#374151"},children:"Search:"}),a.jsx("input",{type:"text",placeholder:"Store name or slug...",value:$,onChange:A=>M(A.target.value),style:{padding:"6px 12px",borderRadius:"6px",border:"1px solid #d1d5db",fontSize:"14px",width:"200px"}}),$&&a.jsx("button",{onClick:()=>{M(""),T("")},style:{padding:"4px 8px",background:"#f3f4f6",border:"1px solid #d1d5db",borderRadius:"4px",cursor:"pointer",fontSize:"12px"},children:"Clear"})]}),a.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"8px",cursor:"pointer"},children:[a.jsx("input",{type:"checkbox",checked:w,onChange:A=>S(A.target.checked),style:{width:"16px",height:"16px",cursor:"pointer"}}),a.jsx("span",{children:"Dutchie only"})]}),a.jsxs("span",{style:{color:"#666",fontSize:"14px",marginLeft:"auto"},children:["Showing ",(w?r.filter(A=>A.menu_type==="dutchie"):r).length," dispensaries"]})]}),a.jsx("div",{style:{background:"white",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",overflow:"auto"},children:a.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",minWidth:"1200px"},children:[a.jsx("thead",{children:a.jsxs("tr",{style:{background:"#f8f8f8",borderBottom:"2px solid #eee"},children:[a.jsx("th",{style:{padding:"12px",textAlign:"left",fontWeight:"600"},children:"Dispensary"}),a.jsx("th",{style:{padding:"12px",textAlign:"center",fontWeight:"600"},children:"Menu Type"}),a.jsx("th",{style:{padding:"12px",textAlign:"center",fontWeight:"600"},children:"Platform ID"}),a.jsx("th",{style:{padding:"12px",textAlign:"center",fontWeight:"600"},children:"Status"}),a.jsx("th",{style:{padding:"12px",textAlign:"left",fontWeight:"600"},children:"Last Run"}),a.jsx("th",{style:{padding:"12px",textAlign:"left",fontWeight:"600"},children:"Next Run"}),a.jsx("th",{style:{padding:"12px",textAlign:"left",fontWeight:"600"},children:"Last Result"}),a.jsx("th",{style:{padding:"12px",textAlign:"center",fontWeight:"600",minWidth:"220px"},children:"Actions"})]})}),a.jsx("tbody",{children:(w?r.filter(A=>A.menu_type==="dutchie"):r).map(A=>a.jsxs("tr",{style:{borderBottom:"1px solid #eee"},children:[a.jsxs("td",{style:{padding:"12px"},children:[a.jsx("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:A.state&&A.city&&(A.dispensary_slug||A.slug)?a.jsx(K1,{to:`/dispensaries/${A.state}/${A.city.toLowerCase().replace(/\s+/g,"-")}/${A.dispensary_slug||A.slug}`,style:{fontWeight:"600",color:"#2563eb",textDecoration:"none"},children:A.dispensary_name}):a.jsx("span",{style:{fontWeight:"600"},children:A.dispensary_name})}),a.jsx("div",{style:{fontSize:"12px",color:"#666"},children:A.city?`${A.city}, ${A.state}`:A.state})]}),a.jsx("td",{style:{padding:"12px",textAlign:"center"},children:A.menu_type?a.jsx("span",{style:{padding:"4px 10px",borderRadius:"12px",fontSize:"11px",fontWeight:"600",background:A.menu_type==="dutchie"?"#d1fae5":"#e0e7ff",color:A.menu_type==="dutchie"?"#065f46":"#3730a3"},children:A.menu_type}):a.jsx("span",{style:{padding:"4px 10px",borderRadius:"12px",fontSize:"11px",fontWeight:"600",background:"#f3f4f6",color:"#666"},children:"unknown"})}),a.jsx("td",{style:{padding:"12px",textAlign:"center"},children:A.platform_dispensary_id?a.jsx("span",{style:{padding:"4px 8px",borderRadius:"4px",fontSize:"10px",fontFamily:"monospace",background:"#d1fae5",color:"#065f46"},title:A.platform_dispensary_id,children:A.platform_dispensary_id.length>12?`${A.platform_dispensary_id.slice(0,6)}...${A.platform_dispensary_id.slice(-4)}`:A.platform_dispensary_id}):a.jsx("span",{style:{padding:"4px 8px",borderRadius:"4px",fontSize:"10px",background:"#fee2e2",color:"#991b1b"},children:"missing"})}),a.jsx("td",{style:{padding:"12px",textAlign:"center"},children:a.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"4px"},children:[a.jsx("span",{style:{padding:"4px 10px",borderRadius:"12px",fontSize:"11px",fontWeight:"600",background:A.can_crawl?"#d1fae5":A.is_active!==!1?"#fef3c7":"#fee2e2",color:A.can_crawl?"#065f46":A.is_active!==!1?"#92400e":"#991b1b"},children:A.can_crawl?"Ready":A.is_active!==!1?"Not Ready":"Disabled"}),A.schedule_status_reason&&A.schedule_status_reason!=="ready"&&a.jsx("span",{style:{fontSize:"10px",color:"#666",maxWidth:"100px",textAlign:"center"},children:A.schedule_status_reason}),A.interval_minutes&&a.jsxs("span",{style:{fontSize:"10px",color:"#999"},children:["Every ",Math.round(A.interval_minutes/60),"h"]})]})}),a.jsxs("td",{style:{padding:"15px"},children:[a.jsx("div",{children:L(A.last_run_at)}),A.last_run_at&&a.jsx("div",{style:{fontSize:"12px",color:"#999"},children:new Date(A.last_run_at).toLocaleString()})]}),a.jsx("td",{style:{padding:"15px"},children:a.jsx("div",{style:{fontWeight:"600",color:"#2563eb"},children:A.next_run_at?U(A.next_run_at):"Not scheduled"})}),a.jsx("td",{style:{padding:"15px"},children:A.last_status||A.latest_job_status?a.jsxs("div",{children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"4px"},children:[a.jsx("span",{style:{padding:"4px 10px",borderRadius:"12px",fontSize:"12px",fontWeight:"600",...H(A.last_status||A.latest_job_status||"pending")},children:A.last_status||A.latest_job_status}),A.last_error&&a.jsx("button",{onClick:()=>alert(A.last_error),style:{padding:"2px 6px",background:"#fee2e2",color:"#991b1b",border:"none",borderRadius:"4px",cursor:"pointer",fontSize:"10px"},children:"Error"})]}),A.last_summary?a.jsx("div",{style:{fontSize:"12px",color:"#666",maxWidth:"250px"},children:A.last_summary}):A.latest_products_found!==null?a.jsxs("div",{style:{fontSize:"12px",color:"#666"},children:[A.latest_products_found," products"]}):null]}):a.jsx("span",{style:{color:"#999",fontSize:"13px"},children:"No runs yet"})}),a.jsx("td",{style:{padding:"12px",textAlign:"center"},children:a.jsxs("div",{style:{display:"flex",gap:"6px",justifyContent:"center",flexWrap:"wrap"},children:[a.jsx("button",{onClick:()=>D(A.dispensary_id),disabled:b===A.dispensary_id,style:{padding:"4px 8px",background:b===A.dispensary_id?"#94a3b8":"#f3f4f6",color:"#374151",border:"1px solid #d1d5db",borderRadius:"4px",cursor:b===A.dispensary_id?"wait":"pointer",fontSize:"11px"},title:"Re-detect menu type and resolve platform ID",children:b===A.dispensary_id?"...":"Refresh"}),A.menu_type==="dutchie"&&!A.platform_dispensary_id&&a.jsx("button",{onClick:()=>E(A.dispensary_id),disabled:x===A.dispensary_id,style:{padding:"4px 8px",background:x===A.dispensary_id?"#94a3b8":"#fef3c7",color:"#92400e",border:"1px solid #fcd34d",borderRadius:"4px",cursor:x===A.dispensary_id?"wait":"pointer",fontSize:"11px"},title:"Resolve platform dispensary ID via GraphQL",children:x===A.dispensary_id?"...":"Resolve ID"}),a.jsx("button",{onClick:()=>R(A.dispensary_id),disabled:p===A.dispensary_id||!A.can_crawl,style:{padding:"4px 8px",background:p===A.dispensary_id?"#94a3b8":A.can_crawl?"#2563eb":"#e5e7eb",color:A.can_crawl?"white":"#9ca3af",border:"none",borderRadius:"4px",cursor:p===A.dispensary_id||!A.can_crawl?"not-allowed":"pointer",fontSize:"11px"},title:A.can_crawl?"Trigger immediate crawl":`Cannot crawl: ${A.schedule_status_reason}`,children:p===A.dispensary_id?"...":"Run"}),a.jsx("button",{onClick:()=>O(A.dispensary_id,A.is_active),disabled:j===A.dispensary_id,style:{padding:"4px 8px",background:j===A.dispensary_id?"#94a3b8":A.is_active?"#fee2e2":"#d1fae5",color:A.is_active?"#991b1b":"#065f46",border:"none",borderRadius:"4px",cursor:j===A.dispensary_id?"wait":"pointer",fontSize:"11px"},title:A.is_active?"Disable scheduled crawling":"Enable scheduled crawling",children:j===A.dispensary_id?"...":A.is_active?"Disable":"Enable"})]})})]},A.dispensary_id))})]})})]}),u==="jobs"&&a.jsxs(a.Fragment,{children:[a.jsx("div",{style:{marginBottom:"30px"},children:a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(150px, 1fr))",gap:"15px"},children:[a.jsxs("div",{style:{background:"white",padding:"20px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)"},children:[a.jsx("div",{style:{fontSize:"14px",color:"#999",marginBottom:"8px"},children:"Pending"}),a.jsx("div",{style:{fontSize:"32px",fontWeight:"600",color:"#f59e0b"},children:i.filter(A=>A.status==="pending").length})]}),a.jsxs("div",{style:{background:"white",padding:"20px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)"},children:[a.jsx("div",{style:{fontSize:"14px",color:"#999",marginBottom:"8px"},children:"Running"}),a.jsx("div",{style:{fontSize:"32px",fontWeight:"600",color:"#3b82f6"},children:i.filter(A=>A.status==="running").length})]}),a.jsxs("div",{style:{background:"white",padding:"20px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)"},children:[a.jsx("div",{style:{fontSize:"14px",color:"#999",marginBottom:"8px"},children:"Completed"}),a.jsx("div",{style:{fontSize:"32px",fontWeight:"600",color:"#10b981"},children:i.filter(A=>A.status==="completed").length})]}),a.jsxs("div",{style:{background:"white",padding:"20px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)"},children:[a.jsx("div",{style:{fontSize:"14px",color:"#999",marginBottom:"8px"},children:"Failed"}),a.jsx("div",{style:{fontSize:"32px",fontWeight:"600",color:"#ef4444"},children:i.filter(A=>A.status==="failed").length})]})]})}),a.jsx("div",{style:{background:"white",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",overflow:"hidden"},children:a.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[a.jsx("thead",{children:a.jsxs("tr",{style:{background:"#f8f8f8",borderBottom:"2px solid #eee"},children:[a.jsx("th",{style:{padding:"15px",textAlign:"left",fontWeight:"600"},children:"Dispensary"}),a.jsx("th",{style:{padding:"15px",textAlign:"center",fontWeight:"600"},children:"Type"}),a.jsx("th",{style:{padding:"15px",textAlign:"center",fontWeight:"600"},children:"Trigger"}),a.jsx("th",{style:{padding:"15px",textAlign:"center",fontWeight:"600"},children:"Status"}),a.jsx("th",{style:{padding:"15px",textAlign:"right",fontWeight:"600"},children:"Products"}),a.jsx("th",{style:{padding:"15px",textAlign:"left",fontWeight:"600"},children:"Started"}),a.jsx("th",{style:{padding:"15px",textAlign:"left",fontWeight:"600"},children:"Completed"}),a.jsx("th",{style:{padding:"15px",textAlign:"center",fontWeight:"600"},children:"Actions"})]})}),a.jsx("tbody",{children:i.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:8,style:{padding:"40px",textAlign:"center",color:"#666"},children:"No crawl jobs found"})}):i.map(A=>a.jsxs("tr",{style:{borderBottom:"1px solid #eee"},children:[a.jsxs("td",{style:{padding:"15px"},children:[a.jsx("div",{style:{fontWeight:"600"},children:A.dispensary_name}),a.jsxs("div",{style:{fontSize:"12px",color:"#999"},children:["Job #",A.id]})]}),a.jsx("td",{style:{padding:"15px",textAlign:"center",fontSize:"13px"},children:A.job_type}),a.jsx("td",{style:{padding:"15px",textAlign:"center"},children:a.jsx("span",{style:{padding:"3px 8px",borderRadius:"4px",fontSize:"12px",background:A.trigger_type==="manual"?"#e0e7ff":A.trigger_type==="daily_special"?"#fce7f3":"#f3f4f6",color:A.trigger_type==="manual"?"#3730a3":A.trigger_type==="daily_special"?"#9d174d":"#374151"},children:A.trigger_type})}),a.jsx("td",{style:{padding:"15px",textAlign:"center"},children:a.jsx("span",{style:{padding:"4px 10px",borderRadius:"12px",fontSize:"12px",fontWeight:"600",...H(A.status)},children:A.status})}),a.jsx("td",{style:{padding:"15px",textAlign:"right"},children:A.products_found!==null?a.jsxs("div",{children:[a.jsx("div",{style:{fontWeight:"600"},children:A.products_found}),A.products_new!==null&&A.products_updated!==null&&a.jsxs("div",{style:{fontSize:"12px",color:"#666"},children:["+",A.products_new," / ~",A.products_updated]})]}):"-"}),a.jsx("td",{style:{padding:"15px",fontSize:"13px"},children:A.started_at?new Date(A.started_at).toLocaleString():"-"}),a.jsx("td",{style:{padding:"15px",fontSize:"13px"},children:A.completed_at?new Date(A.completed_at).toLocaleString():"-"}),a.jsxs("td",{style:{padding:"15px",textAlign:"center"},children:[A.status==="pending"&&a.jsx("button",{onClick:()=>Z(A.id),style:{padding:"4px 10px",background:"#fee2e2",color:"#991b1b",border:"none",borderRadius:"4px",cursor:"pointer",fontSize:"12px"},children:"Cancel"}),A.error_message&&a.jsx("button",{onClick:()=>alert(A.error_message),style:{padding:"4px 10px",background:"#fee2e2",color:"#991b1b",border:"none",borderRadius:"4px",cursor:"pointer",fontSize:"12px"},children:"View Error"})]})]},A.id))})]})})]})]})})}function y7(){const[e,t]=h.useState([]),[r,n]=h.useState(null),[i,s]=h.useState(3),[o,l]=h.useState("rotate-desktop"),[c,d]=h.useState(!1),[u,f]=h.useState(!1),[p,m]=h.useState(null),[x,g]=h.useState(!0);h.useEffect(()=>{b()},[]);const b=async()=>{g(!0);try{const S=(await B.getDispensaries()).dispensaries.filter(N=>N.menu_url&&N.scrape_enabled);t(S),S.length>0&&n(S[0].id)}catch(w){console.error("Failed to load dispensaries:",w)}finally{g(!1)}},v=async()=>{if(!(!r||c)){d(!0);try{await B.triggerDispensaryCrawl(r),m({message:"Crawl started for dispensary! Check the Scraper Monitor for progress.",type:"success"})}catch(w){m({message:"Failed to start crawl: "+w.message,type:"error"})}finally{d(!1)}}},j=async()=>{if(!(!r||u)){f(!0);try{m({message:"Image download feature coming soon!",type:"info"})}catch(w){m({message:"Failed to start image download: "+w.message,type:"error"})}finally{f(!1)}}},y=e.find(w=>w.id===r);return x?a.jsx(X,{children:a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsx("span",{className:"loading loading-spinner loading-lg"})})}):a.jsxs(X,{children:[p&&a.jsx(Vn,{message:p.message,type:p.type,onClose:()=>m(null)}),a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-3xl font-bold",children:"Scraper Tools"}),a.jsx("p",{className:"text-gray-500 mt-2",children:"Manage crawling operations for dispensaries"})]}),a.jsx("div",{className:"card bg-base-100 shadow-xl",children:a.jsxs("div",{className:"card-body",children:[a.jsx("h2",{className:"card-title",children:"Select Dispensary"}),a.jsx("select",{className:"select select-bordered w-full max-w-md",value:r||"",onChange:w=>n(parseInt(w.target.value)),children:e.map(w=>a.jsxs("option",{value:w.id,children:[w.dba_name||w.name," - ",w.city,", ",w.state]},w.id))}),y&&a.jsx("div",{className:"mt-4 p-4 bg-base-200 rounded-lg",children:a.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 text-sm",children:[a.jsxs("div",{children:[a.jsx("div",{className:"text-gray-500",children:"Status"}),a.jsx("div",{className:"font-semibold",children:y.scrape_enabled?a.jsx("span",{className:"badge badge-success",children:"Enabled"}):a.jsx("span",{className:"badge badge-error",children:"Disabled"})})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-gray-500",children:"Provider"}),a.jsx("div",{className:"font-semibold",children:y.provider_type||"Unknown"})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-gray-500",children:"Products"}),a.jsx("div",{className:"font-semibold",children:y.product_count||0})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-gray-500",children:"Last Crawled"}),a.jsx("div",{className:"font-semibold",children:y.last_crawl_at?new Date(y.last_crawl_at).toLocaleDateString():"Never"})]})]})})]})}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsx("div",{className:"card bg-base-100 shadow-xl",children:a.jsxs("div",{className:"card-body",children:[a.jsx("h2",{className:"card-title",children:"Crawl Dispensary"}),a.jsx("p",{className:"text-sm text-gray-500",children:"Start crawling products from the selected dispensary menu"}),a.jsx("div",{className:"card-actions justify-end mt-4",children:a.jsx("button",{onClick:v,disabled:!r||c,className:`btn btn-primary ${c?"loading":""}`,children:c?"Starting...":"Start Crawl"})})]})}),a.jsx("div",{className:"card bg-base-100 shadow-xl",children:a.jsxs("div",{className:"card-body",children:[a.jsx("h2",{className:"card-title",children:"Download Images"}),a.jsx("p",{className:"text-sm text-gray-500",children:"Download missing product images for the selected dispensary"}),a.jsx("div",{className:"card-actions justify-end mt-auto",children:a.jsx("button",{onClick:j,disabled:!r||u,className:`btn btn-secondary ${u?"loading":""}`,children:u?"Downloading...":"Download Missing Images"})})]})})]}),a.jsxs("div",{className:"alert alert-info",children:[a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",className:"stroke-current shrink-0 w-6 h-6",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),a.jsxs("span",{children:["After starting scraper operations, check the"," ",a.jsx("a",{href:"/scraper-monitor",className:"link",children:"Scraper Monitor"})," for real-time progress and ",a.jsx("a",{href:"/logs",className:"link",children:"Logs"})," for detailed output."]})]})]})]})}function v7(){const[e,t]=h.useState([]),[r,n]=h.useState(null),[i,s]=h.useState(!0),[o,l]=h.useState("pending"),[c,d]=h.useState(null);h.useEffect(()=>{u()},[o]);const u=async()=>{s(!0);try{const[g,b]=await Promise.all([B.getChanges(o==="all"?void 0:o),B.getChangeStats()]);t(g.changes),n(b)}catch(g){console.error("Failed to load changes:",g)}finally{s(!1)}},f=async g=>{d(g);try{(await B.approveChange(g)).requires_recrawl&&alert("Change approved! This dispensary requires a menu recrawl."),await u()}catch(b){console.error("Failed to approve change:",b),alert("Failed to approve change. Please try again.")}finally{d(null)}},p=async g=>{const b=prompt("Enter rejection reason (optional):");d(g);try{await B.rejectChange(g,b||void 0),await u()}catch(v){console.error("Failed to reject change:",v),alert("Failed to reject change. Please try again.")}finally{d(null)}},m=g=>({dba_name:"DBA Name",website:"Website",phone:"Phone",email:"Email",google_rating:"Google Rating",google_review_count:"Google Review Count",menu_url:"Menu URL"})[g]||g,x=g=>({high:"bg-green-100 text-green-800",medium:"bg-yellow-100 text-yellow-800",low:"bg-red-100 text-red-800"})[g]||"bg-gray-100 text-gray-800";return i?a.jsx(X,{children:a.jsxs("div",{className:"text-center py-12",children:[a.jsx("div",{className:"inline-block animate-spin rounded-full h-8 w-8 border-4 border-blue-500 border-t-transparent"}),a.jsx("p",{className:"mt-2 text-sm text-gray-600",children:"Loading changes..."})]})}):a.jsx(X,{children:a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"Change Approval"}),a.jsx("p",{className:"text-sm text-gray-600 mt-1",children:"Review and approve proposed changes to dispensary data"})]}),a.jsxs("button",{onClick:u,className:"flex items-center gap-2 px-4 py-2 text-sm border border-gray-300 rounded-lg hover:bg-gray-50",children:[a.jsx(Xt,{className:"w-4 h-4"}),"Refresh"]})]}),r&&a.jsxs("div",{className:"grid grid-cols-4 gap-6",children:[a.jsx("div",{className:"bg-white rounded-lg border border-gray-200 p-6",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 bg-yellow-50 rounded-lg",children:a.jsx(xr,{className:"w-5 h-5 text-yellow-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm text-gray-600",children:"Pending"}),a.jsx("p",{className:"text-2xl font-bold text-gray-900",children:r.pending_count})]})]})}),a.jsx("div",{className:"bg-white rounded-lg border border-gray-200 p-6",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 bg-orange-50 rounded-lg",children:a.jsx(nj,{className:"w-5 h-5 text-orange-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm text-gray-600",children:"Needs Recrawl"}),a.jsx("p",{className:"text-2xl font-bold text-gray-900",children:r.pending_recrawl_count})]})]})}),a.jsx("div",{className:"bg-white rounded-lg border border-gray-200 p-6",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 bg-green-50 rounded-lg",children:a.jsx(_r,{className:"w-5 h-5 text-green-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm text-gray-600",children:"Approved"}),a.jsx("p",{className:"text-2xl font-bold text-gray-900",children:r.approved_count})]})]})}),a.jsx("div",{className:"bg-white rounded-lg border border-gray-200 p-6",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 bg-red-50 rounded-lg",children:a.jsx(Hr,{className:"w-5 h-5 text-red-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm text-gray-600",children:"Rejected"}),a.jsx("p",{className:"text-2xl font-bold text-gray-900",children:r.rejected_count})]})]})})]}),a.jsx("div",{className:"flex gap-2",children:["all","pending","approved","rejected"].map(g=>a.jsx("button",{onClick:()=>l(g),className:`px-4 py-2 text-sm font-medium rounded-lg ${o===g?"bg-blue-600 text-white":"bg-white text-gray-700 border border-gray-300 hover:bg-gray-50"}`,children:g.charAt(0).toUpperCase()+g.slice(1)},g))}),a.jsx("div",{className:"bg-white rounded-lg border border-gray-200",children:e.length===0?a.jsx("div",{className:"text-center py-12",children:a.jsx("p",{className:"text-gray-600",children:"No changes found"})}):a.jsx("div",{className:"divide-y divide-gray-200",children:e.map(g=>a.jsx("div",{className:"p-6",children:a.jsxs("div",{className:"flex items-start justify-between",children:[a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[a.jsx("h3",{className:"text-lg font-semibold text-gray-900",children:g.dispensary_name}),a.jsx("span",{className:`px-2 py-1 text-xs font-medium rounded ${x(g.confidence_score)}`,children:g.confidence_score||"N/A"}),g.requires_recrawl&&a.jsx("span",{className:"px-2 py-1 text-xs font-medium rounded bg-orange-100 text-orange-800",children:"Requires Recrawl"})]}),a.jsxs("p",{className:"text-sm text-gray-600 mb-3",children:[g.city,", ",g.state," • Source: ",g.source]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4 mb-3",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-medium text-gray-500",children:"Field"}),a.jsx("p",{className:"text-sm text-gray-900",children:m(g.field_name)})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-medium text-gray-500",children:"Old Value"}),a.jsx("p",{className:"text-sm text-gray-900",children:g.old_value||a.jsx("em",{className:"text-gray-400",children:"None"})})]}),a.jsxs("div",{className:"col-span-2",children:[a.jsx("label",{className:"text-xs font-medium text-gray-500",children:"New Value"}),a.jsx("p",{className:"text-sm font-medium text-blue-600",children:g.new_value})]}),g.change_notes&&a.jsxs("div",{className:"col-span-2",children:[a.jsx("label",{className:"text-xs font-medium text-gray-500",children:"Notes"}),a.jsx("p",{className:"text-sm text-gray-700",children:g.change_notes})]})]}),a.jsxs("p",{className:"text-xs text-gray-500",children:["Created ",new Date(g.created_at).toLocaleString()]}),g.status==="rejected"&&g.rejection_reason&&a.jsxs("div",{className:"mt-2 p-3 bg-red-50 rounded border border-red-200",children:[a.jsx("p",{className:"text-xs font-medium text-red-800",children:"Rejection Reason:"}),a.jsx("p",{className:"text-sm text-red-700",children:g.rejection_reason})]})]}),a.jsxs("div",{className:"flex items-center gap-2 ml-4",children:[g.status==="pending"&&a.jsxs(a.Fragment,{children:[a.jsxs("button",{onClick:()=>f(g.id),disabled:c===g.id,className:"flex items-center gap-2 px-4 py-2 bg-green-600 text-white text-sm font-medium rounded-lg hover:bg-green-700 disabled:opacity-50",children:[a.jsx(_r,{className:"w-4 h-4"}),"Approve"]}),a.jsxs("button",{onClick:()=>p(g.id),disabled:c===g.id,className:"flex items-center gap-2 px-4 py-2 bg-red-600 text-white text-sm font-medium rounded-lg hover:bg-red-700 disabled:opacity-50",children:[a.jsx(Hr,{className:"w-4 h-4"}),"Reject"]})]}),g.status==="approved"&&a.jsxs("span",{className:"flex items-center gap-2 px-4 py-2 bg-green-100 text-green-800 text-sm font-medium rounded-lg",children:[a.jsx(_r,{className:"w-4 h-4"}),"Approved"]}),g.status==="rejected"&&a.jsxs("span",{className:"flex items-center gap-2 px-4 py-2 bg-red-100 text-red-800 text-sm font-medium rounded-lg",children:[a.jsx(Hr,{className:"w-4 h-4"}),"Rejected"]}),a.jsx("a",{href:`/dispensaries/${g.dispensary_slug}`,target:"_blank",rel:"noopener noreferrer",className:"p-2 text-gray-400 hover:text-gray-600",children:a.jsx(Jr,{className:"w-4 h-4"})})]})]})},g.id))})})]})})}function b7(){const[e,t]=h.useState([]),[r,n]=h.useState([]),[i,s]=h.useState(!0),[o,l]=h.useState(!1),[c,d]=h.useState({user_name:"",store_id:"",allowed_ips:"",allowed_domains:""}),[u,f]=h.useState(null);h.useEffect(()=>{m(),p()},[]);const p=async()=>{try{const y=await B.getApiPermissionDispensaries();n(y.dispensaries)}catch(y){console.error("Failed to load dispensaries:",y)}},m=async()=>{s(!0);try{const y=await B.getApiPermissions();t(y.permissions)}catch(y){f({message:"Failed to load API permissions: "+y.message,type:"error"})}finally{s(!1)}},x=async y=>{if(y.preventDefault(),!c.user_name.trim()){f({message:"User name is required",type:"error"});return}if(!c.store_id){f({message:"Store is required",type:"error"});return}try{const w=await B.createApiPermission({...c,store_id:parseInt(c.store_id)});f({message:w.message,type:"success"}),d({user_name:"",store_id:"",allowed_ips:"",allowed_domains:""}),l(!1),m()}catch(w){f({message:"Failed to create permission: "+w.message,type:"error"})}},g=async y=>{try{await B.toggleApiPermission(y),f({message:"Permission status updated",type:"success"}),m()}catch(w){f({message:"Failed to toggle permission: "+w.message,type:"error"})}},b=async y=>{if(confirm("Are you sure you want to delete this API permission?"))try{await B.deleteApiPermission(y),f({message:"Permission deleted successfully",type:"success"}),m()}catch(w){f({message:"Failed to delete permission: "+w.message,type:"error"})}},v=y=>{navigator.clipboard.writeText(y),f({message:"API key copied to clipboard!",type:"success"})},j=y=>{if(!y)return"Never";const w=new Date(y);return w.toLocaleDateString()+" "+w.toLocaleTimeString()};return i?a.jsx(X,{children:a.jsx("div",{className:"p-6",children:a.jsx("div",{className:"text-center text-gray-600",children:"Loading API permissions..."})})}):a.jsx(X,{children:a.jsxs("div",{className:"p-6",children:[u&&a.jsx(Vn,{message:u.message,type:u.type,onClose:()=>f(null)}),a.jsxs("div",{className:"flex justify-between items-center mb-6",children:[a.jsx("h1",{className:"text-2xl font-bold",children:"API Permissions"}),a.jsx("button",{onClick:()=>l(!o),className:"px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700",children:o?"Cancel":"Add New Permission"})]}),a.jsxs("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4 mb-6",children:[a.jsx("h3",{className:"font-semibold text-blue-900 mb-2",children:"How it works:"}),a.jsx("p",{className:"text-blue-800 text-sm",children:"Users with valid permissions can access your API without entering tokens. Access is automatically validated based on their IP address and/or domain name."})]}),o&&a.jsxs("div",{className:"bg-white rounded-lg shadow-md p-6 mb-6",children:[a.jsx("h2",{className:"text-xl font-semibold mb-4",children:"Add New API User"}),a.jsxs("form",{onSubmit:x,children:[a.jsxs("div",{className:"mb-4",children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"User/Client Name *"}),a.jsx("input",{type:"text",value:c.user_name,onChange:y=>d({...c,user_name:y.target.value}),className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"e.g., My Website",required:!0}),a.jsx("p",{className:"text-sm text-gray-600 mt-1",children:"A friendly name to identify this API user"})]}),a.jsxs("div",{className:"mb-4",children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Store *"}),a.jsxs("select",{value:c.store_id,onChange:y=>d({...c,store_id:y.target.value}),className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",required:!0,children:[a.jsx("option",{value:"",children:"Select a store..."}),r.map(y=>a.jsx("option",{value:y.id,children:y.name},y.id))]}),a.jsx("p",{className:"text-sm text-gray-600 mt-1",children:"The store this API token can access"})]}),a.jsxs("div",{className:"mb-4",children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Allowed IP Addresses"}),a.jsx("textarea",{value:c.allowed_ips,onChange:y=>d({...c,allowed_ips:y.target.value}),rows:3,className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 font-mono text-sm",placeholder:`192.168.1.1 +socks5://user:pass@proxy.example.com:1080`,rows:12,className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 font-mono text-sm"})]}),a.jsxs("div",{className:"p-3 bg-blue-50 border border-blue-200 rounded-lg flex items-start gap-2",children:[a.jsx(Uc,{className:"w-5 h-5 text-blue-600 flex-shrink-0 mt-0.5"}),a.jsx("span",{className:"text-sm text-blue-900",children:"Lines starting with # are treated as comments and ignored."})]})]}),a.jsxs("div",{className:"flex justify-end gap-3 mt-6 pt-6 border-t border-gray-200",children:[a.jsx("button",{type:"button",onClick:e,className:"px-4 py-2 text-gray-700 hover:bg-gray-50 rounded-lg transition-colors font-medium",children:"Cancel"}),a.jsx("button",{type:"submit",disabled:b,className:"inline-flex items-center gap-2 px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors font-medium disabled:opacity-50 disabled:cursor-not-allowed",children:b?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}),a.jsx("span",{children:"Processing..."})]}):a.jsxs(a.Fragment,{children:[a.jsx(Af,{className:"w-4 h-4"}),r==="bulk"?"Import Proxies":"Add Proxy"]})})]})]})]})]})}function pF(){const[e,t]=h.useState([]),[r,n]=h.useState(!0),[i,s]=h.useState(!0),[o,l]=h.useState(""),[c,d]=h.useState(""),[u,f]=h.useState(200),[p,m]=h.useState(null),x=h.useRef(null);h.useEffect(()=>{g()},[o,c,u]),h.useEffect(()=>{if(!i)return;const S=setInterval(()=>{g()},2e3);return()=>clearInterval(S)},[i,o,c,u]);const g=async()=>{try{const S=await B.getLogs(u,o,c);t(S.logs)}catch(S){console.error("Failed to load logs:",S)}finally{n(!1)}},b=async()=>{if(confirm("Are you sure you want to clear all logs?"))try{await B.clearLogs(),t([]),m({message:"Logs cleared successfully",type:"success"})}catch(S){m({message:"Failed to clear logs: "+S.message,type:"error"})}},v=()=>{var S;(S=x.current)==null||S.scrollIntoView({behavior:"smooth"})},j=S=>{switch(S){case"error":return"#dc3545";case"warn":return"#ffc107";case"info":return"#17a2b8";case"debug":return"#6c757d";default:return"#333"}},y=S=>{switch(S){case"error":return"#f8d7da";case"warn":return"#fff3cd";case"info":return"#d1ecf1";case"debug":return"#e2e3e5";default:return"#f8f9fa"}},w=S=>{switch(S){case"scraper":return"🔍";case"images":return"📸";case"categories":return"📂";case"system":return"⚙️";case"api":return"🌐";default:return"📝"}};return r?a.jsx(X,{children:a.jsx("div",{children:"Loading logs..."})}):a.jsxs(X,{children:[p&&a.jsx(Vn,{message:p.message,type:p.type,onClose:()=>m(null)}),a.jsxs("div",{children:[a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"20px"},children:[a.jsx("h1",{style:{fontSize:"32px",margin:0},children:"System Logs"}),a.jsxs("div",{style:{display:"flex",gap:"10px",alignItems:"center"},children:[a.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"5px"},children:[a.jsx("input",{type:"checkbox",checked:i,onChange:S=>s(S.target.checked)}),"Auto-refresh (2s)"]}),a.jsx("button",{onClick:v,style:{padding:"8px 16px",background:"#6c757d",color:"white",border:"none",borderRadius:"6px",cursor:"pointer"},children:"⬇️ Scroll to Bottom"}),a.jsx("button",{onClick:b,style:{padding:"8px 16px",background:"#dc3545",color:"white",border:"none",borderRadius:"6px",cursor:"pointer"},children:"🗑️ Clear Logs"})]})]}),a.jsxs("div",{style:{background:"white",padding:"20px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",marginBottom:"20px",display:"flex",gap:"15px",flexWrap:"wrap"},children:[a.jsxs("select",{value:o,onChange:S=>l(S.target.value),style:{padding:"10px",border:"1px solid #ddd",borderRadius:"6px"},children:[a.jsx("option",{value:"",children:"All Levels"}),a.jsx("option",{value:"info",children:"Info"}),a.jsx("option",{value:"warn",children:"Warning"}),a.jsx("option",{value:"error",children:"Error"}),a.jsx("option",{value:"debug",children:"Debug"})]}),a.jsxs("select",{value:c,onChange:S=>d(S.target.value),style:{padding:"10px",border:"1px solid #ddd",borderRadius:"6px"},children:[a.jsx("option",{value:"",children:"All Categories"}),a.jsx("option",{value:"scraper",children:"🔍 Scraper"}),a.jsx("option",{value:"images",children:"📸 Images"}),a.jsx("option",{value:"categories",children:"📂 Categories"}),a.jsx("option",{value:"system",children:"⚙️ System"}),a.jsx("option",{value:"api",children:"🌐 API"})]}),a.jsxs("select",{value:u,onChange:S=>f(parseInt(S.target.value)),style:{padding:"10px",border:"1px solid #ddd",borderRadius:"6px"},children:[a.jsx("option",{value:"50",children:"Last 50"}),a.jsx("option",{value:"100",children:"Last 100"}),a.jsx("option",{value:"200",children:"Last 200"}),a.jsx("option",{value:"500",children:"Last 500"}),a.jsx("option",{value:"1000",children:"Last 1000"})]}),a.jsx("div",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:"10px"},children:a.jsxs("span",{style:{fontSize:"14px",color:"#666"},children:["Showing ",e.length," logs"]})})]}),a.jsxs("div",{style:{background:"#1e1e1e",padding:"20px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",maxHeight:"70vh",overflowY:"auto",fontFamily:"monospace",fontSize:"13px"},children:[e.length===0?a.jsx("div",{style:{color:"#999",textAlign:"center",padding:"40px"},children:"No logs to display"}):e.map((S,N)=>a.jsxs("div",{style:{padding:"8px 12px",marginBottom:"4px",borderRadius:"4px",background:y(S.level),borderLeft:`4px solid ${j(S.level)}`,display:"flex",gap:"10px",alignItems:"flex-start"},children:[a.jsx("span",{style:{color:"#666",fontSize:"11px",whiteSpace:"nowrap"},children:new Date(S.timestamp).toLocaleTimeString()}),a.jsx("span",{style:{fontSize:"14px"},children:w(S.category)}),a.jsx("span",{style:{padding:"2px 6px",borderRadius:"3px",fontSize:"10px",fontWeight:"bold",background:j(S.level),color:"white",textTransform:"uppercase"},children:S.level}),a.jsx("span",{style:{padding:"2px 6px",borderRadius:"3px",fontSize:"10px",background:"#e2e3e5",color:"#333"},children:S.category}),a.jsx("span",{style:{flex:1,color:"#333",wordBreak:"break-word"},children:S.message})]},N)),a.jsx("div",{ref:x})]})]})]})}function hF(){const[e,t]=h.useState([]),[r,n]=h.useState([]),[i,s]=h.useState(null),[o,l]=h.useState([]),[c,d]=h.useState([]),[u,f]=h.useState([]),[p,m]=h.useState(!0),[x,g]=h.useState(!0),[b,v]=h.useState("az-live"),[j,y]=h.useState(null),[w,S]=h.useState(""),[N,P]=h.useState(null),[_,T]=h.useState({scheduledJobs:[],crawlJobs:[],inMemoryScrapers:[],totalActive:0}),[$,M]=h.useState({jobLogs:[],crawlJobs:[]}),[C,R]=h.useState([]);h.useEffect(()=>{if(q(),x){const E=setInterval(q,3e3);return()=>clearInterval(E)}},[x]);const q=async()=>{try{const[E,D,O,k,L,F]=await Promise.all([B.getActiveScrapers(),B.getScraperHistory(),B.getJobStats(),B.getActiveJobs(),B.getWorkerStats(),B.getRecentJobs({limit:50})]);t(E.scrapers||[]),n(D.history||[]),s(O),l(k.jobs||[]),d(L.workers||[]),f(F.jobs||[]);const[H,te,re,we]=await Promise.all([B.getAZMonitorSummary().catch(()=>null),B.getAZMonitorActiveJobs().catch(()=>({scheduledJobs:[],crawlJobs:[],inMemoryScrapers:[],totalActive:0})),B.getAZMonitorRecentJobs(30).catch(()=>({jobLogs:[],crawlJobs:[]})),B.getAZMonitorErrors({limit:10,hours:24}).catch(()=>({errors:[]}))]);P(H),T(te),M(re),R((we==null?void 0:we.errors)||[])}catch(E){console.error("Failed to load scraper data:",E)}finally{m(!1)}},Z=E=>{const D=Math.floor(E/1e3),O=Math.floor(D/60),k=Math.floor(O/60);return k>0?`${k}h ${O%60}m ${D%60}s`:O>0?`${O}m ${D%60}s`:`${D}s`};return a.jsx(X,{children:a.jsxs("div",{children:[a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"30px"},children:[a.jsx("h1",{style:{fontSize:"32px",margin:0},children:"Scraper Monitor"}),a.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"10px",cursor:"pointer"},children:[a.jsx("input",{type:"checkbox",checked:x,onChange:E=>g(E.target.checked),style:{width:"18px",height:"18px",cursor:"pointer"}}),a.jsx("span",{children:"Auto-refresh (3s)"})]})]}),a.jsxs("div",{style:{marginBottom:"30px",display:"flex",gap:"10px",borderBottom:"2px solid #eee"},children:[a.jsxs("button",{onClick:()=>v("az-live"),style:{padding:"12px 24px",background:b==="az-live"?"white":"transparent",border:"none",borderBottom:b==="az-live"?"3px solid #10b981":"3px solid transparent",cursor:"pointer",fontSize:"16px",fontWeight:b==="az-live"?"600":"400",color:b==="az-live"?"#10b981":"#666",marginBottom:"-2px"},children:["AZ Live ",_.totalActive>0&&a.jsx("span",{style:{marginLeft:"8px",padding:"2px 8px",background:"#10b981",color:"white",borderRadius:"10px",fontSize:"12px"},children:_.totalActive})]}),a.jsx("button",{onClick:()=>v("jobs"),style:{padding:"12px 24px",background:b==="jobs"?"white":"transparent",border:"none",borderBottom:b==="jobs"?"3px solid #2563eb":"3px solid transparent",cursor:"pointer",fontSize:"16px",fontWeight:b==="jobs"?"600":"400",color:b==="jobs"?"#2563eb":"#666",marginBottom:"-2px"},children:"Dispensary Jobs"}),a.jsx("button",{onClick:()=>v("scrapers"),style:{padding:"12px 24px",background:b==="scrapers"?"white":"transparent",border:"none",borderBottom:b==="scrapers"?"3px solid #2563eb":"3px solid transparent",cursor:"pointer",fontSize:"16px",fontWeight:b==="scrapers"?"600":"400",color:b==="scrapers"?"#2563eb":"#666",marginBottom:"-2px"},children:"Crawl History"})]}),b==="az-live"&&a.jsxs(a.Fragment,{children:[N&&a.jsx("div",{style:{marginBottom:"30px"},children:a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(180px, 1fr))",gap:"15px"},children:[a.jsxs("div",{style:{background:"white",padding:"20px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)"},children:[a.jsx("div",{style:{fontSize:"14px",color:"#999",marginBottom:"8px"},children:"Running Jobs"}),a.jsx("div",{style:{fontSize:"32px",fontWeight:"600",color:_.totalActive>0?"#10b981":"#666"},children:_.totalActive})]}),a.jsxs("div",{style:{background:"white",padding:"20px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)"},children:[a.jsx("div",{style:{fontSize:"14px",color:"#999",marginBottom:"8px"},children:"Successful (24h)"}),a.jsx("div",{style:{fontSize:"32px",fontWeight:"600",color:"#10b981"},children:(N.successful_jobs_24h||0)+(N.successful_crawls_24h||0)})]}),a.jsxs("div",{style:{background:"white",padding:"20px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)"},children:[a.jsx("div",{style:{fontSize:"14px",color:"#999",marginBottom:"8px"},children:"Failed (24h)"}),a.jsx("div",{style:{fontSize:"32px",fontWeight:"600",color:(N.failed_jobs_24h||0)+(N.failed_crawls_24h||0)>0?"#ef4444":"#666"},children:(N.failed_jobs_24h||0)+(N.failed_crawls_24h||0)})]}),a.jsxs("div",{style:{background:"white",padding:"20px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)"},children:[a.jsx("div",{style:{fontSize:"14px",color:"#999",marginBottom:"8px"},children:"Products (24h)"}),a.jsx("div",{style:{fontSize:"32px",fontWeight:"600",color:"#8b5cf6"},children:N.products_found_24h||0})]}),a.jsxs("div",{style:{background:"white",padding:"20px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)"},children:[a.jsx("div",{style:{fontSize:"14px",color:"#999",marginBottom:"8px"},children:"Snapshots (24h)"}),a.jsx("div",{style:{fontSize:"32px",fontWeight:"600",color:"#06b6d4"},children:N.snapshots_created_24h||0})]})]})}),a.jsxs("div",{style:{marginBottom:"30px"},children:[a.jsxs("h2",{style:{fontSize:"24px",marginBottom:"20px",display:"flex",alignItems:"center",gap:"10px"},children:["Active Jobs",_.totalActive>0&&a.jsxs("span",{style:{padding:"4px 12px",background:"#d1fae5",color:"#065f46",borderRadius:"12px",fontSize:"14px",fontWeight:"600"},children:[_.totalActive," running"]})]}),_.totalActive===0?a.jsxs("div",{style:{background:"white",padding:"60px 40px",borderRadius:"8px",textAlign:"center",boxShadow:"0 2px 8px rgba(0,0,0,0.1)"},children:[a.jsx("div",{style:{fontSize:"48px",marginBottom:"20px"},children:"😴"}),a.jsx("div",{style:{fontSize:"18px",color:"#666"},children:"No jobs currently running"})]}):a.jsxs("div",{style:{display:"grid",gap:"15px"},children:[_.scheduledJobs.map(E=>a.jsx("div",{style:{background:"white",padding:"20px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",borderLeft:"4px solid #10b981"},children:a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"start"},children:[a.jsxs("div",{style:{flex:1},children:[a.jsx("div",{style:{fontSize:"18px",fontWeight:"600",marginBottom:"8px"},children:E.job_name}),a.jsx("div",{style:{fontSize:"14px",color:"#666",marginBottom:"12px"},children:E.job_description||"Scheduled job"}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(120px, 1fr))",gap:"12px"},children:[a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:"12px",color:"#999",marginBottom:"4px"},children:"Processed"}),a.jsx("div",{style:{fontSize:"16px",fontWeight:"600"},children:E.items_processed||0})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:"12px",color:"#999",marginBottom:"4px"},children:"Succeeded"}),a.jsx("div",{style:{fontSize:"16px",fontWeight:"600",color:"#10b981"},children:E.items_succeeded||0})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:"12px",color:"#999",marginBottom:"4px"},children:"Failed"}),a.jsx("div",{style:{fontSize:"16px",fontWeight:"600",color:E.items_failed>0?"#ef4444":"#666"},children:E.items_failed||0})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:"12px",color:"#999",marginBottom:"4px"},children:"Duration"}),a.jsxs("div",{style:{fontSize:"16px",fontWeight:"600"},children:[Math.floor((E.duration_seconds||0)/60),"m ",Math.floor((E.duration_seconds||0)%60),"s"]})]})]})]}),a.jsx("div",{style:{padding:"6px 12px",borderRadius:"4px",fontSize:"13px",fontWeight:"600",background:"#d1fae5",color:"#065f46"},children:"RUNNING"})]})},`sched-${E.id}`)),_.crawlJobs.map(E=>a.jsx("div",{style:{background:"white",padding:"20px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",borderLeft:"4px solid #3b82f6"},children:a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"start"},children:[a.jsxs("div",{style:{flex:1},children:[a.jsx("div",{style:{fontSize:"18px",fontWeight:"600",marginBottom:"8px"},children:E.dispensary_name||"Unknown Store"}),a.jsxs("div",{style:{fontSize:"14px",color:"#666",marginBottom:"12px"},children:[E.city," | ",E.job_type||"crawl"]}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(120px, 1fr))",gap:"12px"},children:[a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:"12px",color:"#999",marginBottom:"4px"},children:"Products Found"}),a.jsx("div",{style:{fontSize:"16px",fontWeight:"600",color:"#8b5cf6"},children:E.products_found||0})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:"12px",color:"#999",marginBottom:"4px"},children:"Snapshots"}),a.jsx("div",{style:{fontSize:"16px",fontWeight:"600",color:"#06b6d4"},children:E.snapshots_created||0})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:"12px",color:"#999",marginBottom:"4px"},children:"Duration"}),a.jsxs("div",{style:{fontSize:"16px",fontWeight:"600"},children:[Math.floor((E.duration_seconds||0)/60),"m ",Math.floor((E.duration_seconds||0)%60),"s"]})]})]})]}),a.jsx("div",{style:{padding:"6px 12px",borderRadius:"4px",fontSize:"13px",fontWeight:"600",background:"#dbeafe",color:"#1e40af"},children:"CRAWLING"})]})},`crawl-${E.id}`))]})]}),(N==null?void 0:N.nextRuns)&&N.nextRuns.length>0&&a.jsxs("div",{style:{marginBottom:"30px"},children:[a.jsx("h2",{style:{fontSize:"24px",marginBottom:"20px"},children:"Next Scheduled Runs"}),a.jsx("div",{style:{background:"white",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",overflow:"hidden"},children:a.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[a.jsx("thead",{children:a.jsxs("tr",{style:{background:"#f8f8f8",borderBottom:"2px solid #eee"},children:[a.jsx("th",{style:{padding:"15px",textAlign:"left",fontWeight:"600"},children:"Job"}),a.jsx("th",{style:{padding:"15px",textAlign:"left",fontWeight:"600"},children:"Next Run"}),a.jsx("th",{style:{padding:"15px",textAlign:"center",fontWeight:"600"},children:"Last Status"})]})}),a.jsx("tbody",{children:N.nextRuns.map(E=>a.jsxs("tr",{style:{borderBottom:"1px solid #eee"},children:[a.jsxs("td",{style:{padding:"15px"},children:[a.jsx("div",{style:{fontWeight:"600"},children:E.job_name}),a.jsx("div",{style:{fontSize:"13px",color:"#666"},children:E.description})]}),a.jsx("td",{style:{padding:"15px"},children:a.jsx("div",{style:{fontWeight:"600",color:"#2563eb"},children:E.next_run_at?new Date(E.next_run_at).toLocaleString():"-"})}),a.jsx("td",{style:{padding:"15px",textAlign:"center"},children:a.jsx("span",{style:{padding:"4px 10px",borderRadius:"12px",fontSize:"12px",fontWeight:"600",background:E.last_status==="success"?"#d1fae5":E.last_status==="error"?"#fee2e2":"#fef3c7",color:E.last_status==="success"?"#065f46":E.last_status==="error"?"#991b1b":"#92400e"},children:E.last_status||"never"})})]},E.id))})]})})]}),C.length>0&&a.jsxs("div",{style:{marginBottom:"30px"},children:[a.jsx("h2",{style:{fontSize:"24px",marginBottom:"20px",color:"#ef4444"},children:"Recent Errors (24h)"}),a.jsx("div",{style:{background:"white",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",overflow:"hidden"},children:C.map((E,D)=>a.jsxs("div",{style:{padding:"15px",borderBottom:Da.jsxs("tr",{style:{borderBottom:"1px solid #eee"},children:[a.jsxs("td",{style:{padding:"15px"},children:[a.jsx("div",{style:{fontWeight:"600"},children:E.job_name}),a.jsxs("div",{style:{fontSize:"12px",color:"#999"},children:["Log #",E.id]})]}),a.jsx("td",{style:{padding:"15px",textAlign:"center"},children:a.jsx("span",{style:{padding:"4px 10px",borderRadius:"12px",fontSize:"12px",fontWeight:"600",background:E.status==="success"?"#d1fae5":E.status==="running"?"#dbeafe":E.status==="error"?"#fee2e2":"#fef3c7",color:E.status==="success"?"#065f46":E.status==="running"?"#1e40af":E.status==="error"?"#991b1b":"#92400e"},children:E.status})}),a.jsxs("td",{style:{padding:"15px",textAlign:"right"},children:[a.jsx("span",{style:{color:"#10b981"},children:E.items_succeeded||0})," / ",a.jsx("span",{children:E.items_processed||0})]}),a.jsx("td",{style:{padding:"15px",textAlign:"right"},children:E.duration_ms?`${Math.floor(E.duration_ms/6e4)}m ${Math.floor(E.duration_ms%6e4/1e3)}s`:"-"}),a.jsx("td",{style:{padding:"15px",color:"#666"},children:E.completed_at?new Date(E.completed_at).toLocaleString():"-"})]},`log-${E.id}`))})]})})]})]}),b==="jobs"&&a.jsxs(a.Fragment,{children:[i&&a.jsxs("div",{style:{marginBottom:"30px"},children:[a.jsx("h2",{style:{fontSize:"24px",marginBottom:"20px"},children:"Job Statistics"}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(200px, 1fr))",gap:"15px"},children:[a.jsxs("div",{style:{background:"white",padding:"20px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)"},children:[a.jsx("div",{style:{fontSize:"14px",color:"#999",marginBottom:"8px"},children:"Pending"}),a.jsx("div",{style:{fontSize:"32px",fontWeight:"600",color:"#f59e0b"},children:i.pending||0})]}),a.jsxs("div",{style:{background:"white",padding:"20px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)"},children:[a.jsx("div",{style:{fontSize:"14px",color:"#999",marginBottom:"8px"},children:"In Progress"}),a.jsx("div",{style:{fontSize:"32px",fontWeight:"600",color:"#3b82f6"},children:i.in_progress||0})]}),a.jsxs("div",{style:{background:"white",padding:"20px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)"},children:[a.jsx("div",{style:{fontSize:"14px",color:"#999",marginBottom:"8px"},children:"Completed"}),a.jsx("div",{style:{fontSize:"32px",fontWeight:"600",color:"#10b981"},children:i.completed||0})]}),a.jsxs("div",{style:{background:"white",padding:"20px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)"},children:[a.jsx("div",{style:{fontSize:"14px",color:"#999",marginBottom:"8px"},children:"Failed"}),a.jsx("div",{style:{fontSize:"32px",fontWeight:"600",color:"#ef4444"},children:i.failed||0})]}),a.jsxs("div",{style:{background:"white",padding:"20px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)"},children:[a.jsx("div",{style:{fontSize:"14px",color:"#999",marginBottom:"8px"},children:"Products Found"}),a.jsx("div",{style:{fontSize:"32px",fontWeight:"600",color:"#8b5cf6"},children:i.total_products_found||0})]}),a.jsxs("div",{style:{background:"white",padding:"20px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)"},children:[a.jsx("div",{style:{fontSize:"14px",color:"#999",marginBottom:"8px"},children:"Products Saved"}),a.jsx("div",{style:{fontSize:"32px",fontWeight:"600",color:"#06b6d4"},children:i.total_products_saved||0})]})]})]}),c.length>0&&a.jsxs("div",{style:{marginBottom:"30px"},children:[a.jsxs("h2",{style:{fontSize:"24px",marginBottom:"20px"},children:["Active Workers (",c.length,")"]}),a.jsx("div",{style:{display:"grid",gap:"15px"},children:c.map(E=>a.jsxs("div",{style:{background:"white",padding:"20px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",borderLeft:"4px solid #10b981"},children:[a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[a.jsxs("div",{style:{fontSize:"18px",fontWeight:"600",marginBottom:"12px"},children:["Worker: ",E.worker_id]}),a.jsx("div",{style:{padding:"6px 12px",borderRadius:"4px",fontSize:"13px",fontWeight:"600",background:"#d1fae5",color:"#065f46"},children:"ACTIVE"})]}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(150px, 1fr))",gap:"12px"},children:[a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:"12px",color:"#999",marginBottom:"4px"},children:"Active Jobs"}),a.jsx("div",{style:{fontSize:"16px",fontWeight:"600"},children:E.active_jobs})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:"12px",color:"#999",marginBottom:"4px"},children:"Products Found"}),a.jsx("div",{style:{fontSize:"16px",fontWeight:"600",color:"#8b5cf6"},children:E.total_products_found||0})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:"12px",color:"#999",marginBottom:"4px"},children:"Products Saved"}),a.jsx("div",{style:{fontSize:"16px",fontWeight:"600",color:"#10b981"},children:E.total_products_saved||0})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:"12px",color:"#999",marginBottom:"4px"},children:"Running Since"}),a.jsx("div",{style:{fontSize:"14px"},children:new Date(E.earliest_start).toLocaleTimeString()})]})]})]},E.worker_id))})]}),a.jsxs("div",{style:{marginBottom:"30px"},children:[a.jsxs("h2",{style:{fontSize:"24px",marginBottom:"20px"},children:["Active Jobs (",o.length,")"]}),o.length===0?a.jsxs("div",{style:{background:"white",padding:"60px 40px",borderRadius:"8px",textAlign:"center",boxShadow:"0 2px 8px rgba(0,0,0,0.1)"},children:[a.jsx("div",{style:{fontSize:"48px",marginBottom:"20px"},children:"😴"}),a.jsx("div",{style:{fontSize:"18px",color:"#666"},children:"No jobs currently running"})]}):a.jsx("div",{style:{display:"grid",gap:"15px"},children:o.map(E=>a.jsx("div",{style:{background:"white",padding:"20px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",borderLeft:"4px solid #3b82f6"},children:a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"start"},children:[a.jsxs("div",{style:{flex:1},children:[a.jsx("div",{style:{fontSize:"18px",fontWeight:"600",marginBottom:"8px"},children:E.dispensary_name||E.brand_name}),a.jsxs("div",{style:{fontSize:"14px",color:"#666",marginBottom:"12px"},children:[E.job_type||"crawl"," | Job #",E.id]}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(150px, 1fr))",gap:"12px"},children:[a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:"12px",color:"#999",marginBottom:"4px"},children:"Products Found"}),a.jsx("div",{style:{fontSize:"16px",fontWeight:"600",color:"#8b5cf6"},children:E.products_found||0})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:"12px",color:"#999",marginBottom:"4px"},children:"Products Saved"}),a.jsx("div",{style:{fontSize:"16px",fontWeight:"600",color:"#10b981"},children:E.products_saved||0})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:"12px",color:"#999",marginBottom:"4px"},children:"Duration"}),a.jsxs("div",{style:{fontSize:"16px",fontWeight:"600"},children:[Math.floor(E.duration_seconds/60),"m ",Math.floor(E.duration_seconds%60),"s"]})]})]})]}),a.jsx("div",{style:{padding:"6px 12px",borderRadius:"4px",fontSize:"13px",fontWeight:"600",background:"#dbeafe",color:"#1e40af"},children:"IN PROGRESS"})]})},E.id))})]}),a.jsxs("div",{children:[a.jsxs("h2",{style:{fontSize:"24px",marginBottom:"20px"},children:["Recent Jobs (",u.length,")"]}),a.jsx("div",{style:{background:"white",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",overflow:"hidden"},children:a.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[a.jsx("thead",{children:a.jsxs("tr",{style:{background:"#f8f8f8",borderBottom:"2px solid #eee"},children:[a.jsx("th",{style:{padding:"15px",textAlign:"left",fontWeight:"600"},children:"Dispensary"}),a.jsx("th",{style:{padding:"15px",textAlign:"left",fontWeight:"600"},children:"Type"}),a.jsx("th",{style:{padding:"15px",textAlign:"center",fontWeight:"600"},children:"Status"}),a.jsx("th",{style:{padding:"15px",textAlign:"right",fontWeight:"600"},children:"Found"}),a.jsx("th",{style:{padding:"15px",textAlign:"right",fontWeight:"600"},children:"Saved"}),a.jsx("th",{style:{padding:"15px",textAlign:"right",fontWeight:"600"},children:"Duration"}),a.jsx("th",{style:{padding:"15px",textAlign:"left",fontWeight:"600"},children:"Completed"})]})}),a.jsx("tbody",{children:u.map(E=>a.jsxs("tr",{style:{borderBottom:"1px solid #eee"},children:[a.jsx("td",{style:{padding:"15px"},children:E.dispensary_name||E.brand_name}),a.jsx("td",{style:{padding:"15px",fontSize:"14px",color:"#666"},children:E.job_type||"-"}),a.jsx("td",{style:{padding:"15px",textAlign:"center"},children:a.jsx("span",{style:{padding:"4px 10px",borderRadius:"12px",fontSize:"12px",fontWeight:"600",background:E.status==="completed"?"#d1fae5":E.status==="in_progress"?"#dbeafe":E.status==="failed"?"#fee2e2":"#fef3c7",color:E.status==="completed"?"#065f46":E.status==="in_progress"?"#1e40af":E.status==="failed"?"#991b1b":"#92400e"},children:E.status})}),a.jsx("td",{style:{padding:"15px",textAlign:"right",fontWeight:"600"},children:E.products_found||0}),a.jsx("td",{style:{padding:"15px",textAlign:"right",fontWeight:"600",color:"#10b981"},children:E.products_saved||0}),a.jsx("td",{style:{padding:"15px",textAlign:"right"},children:E.duration_seconds?`${Math.floor(E.duration_seconds/60)}m ${Math.floor(E.duration_seconds%60)}s`:"-"}),a.jsx("td",{style:{padding:"15px",color:"#666"},children:E.completed_at?new Date(E.completed_at).toLocaleString():"-"})]},E.id))})]})})]})]}),b==="scrapers"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{style:{marginBottom:"30px"},children:[a.jsxs("h2",{style:{fontSize:"24px",marginBottom:"20px"},children:["Active Scrapers (",e.length,")"]}),e.length===0?a.jsxs("div",{style:{background:"white",padding:"60px 40px",borderRadius:"8px",textAlign:"center",boxShadow:"0 2px 8px rgba(0,0,0,0.1)"},children:[a.jsx("div",{style:{fontSize:"48px",marginBottom:"20px"},children:"🛌"}),a.jsx("div",{style:{fontSize:"18px",color:"#666"},children:"No scrapers currently running"})]}):a.jsx("div",{style:{display:"grid",gap:"15px"},children:e.map(E=>a.jsx("div",{style:{background:"white",padding:"20px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",borderLeft:`4px solid ${E.status==="running"?E.isStale?"#ff9800":"#2ecc71":E.status==="error"?"#e74c3c":"#95a5a6"}`},children:a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"start"},children:[a.jsxs("div",{style:{flex:1},children:[a.jsxs("div",{style:{fontSize:"18px",fontWeight:"600",marginBottom:"8px"},children:[E.storeName," - ",E.categoryName]}),a.jsxs("div",{style:{fontSize:"14px",color:"#666",marginBottom:"12px"},children:["ID: ",E.id]}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(150px, 1fr))",gap:"12px"},children:[a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:"12px",color:"#999",marginBottom:"4px"},children:"Requests"}),a.jsxs("div",{style:{fontSize:"16px",fontWeight:"600"},children:[E.stats.requestsSuccess," / ",E.stats.requestsTotal]})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:"12px",color:"#999",marginBottom:"4px"},children:"Items Saved"}),a.jsx("div",{style:{fontSize:"16px",fontWeight:"600",color:"#2ecc71"},children:E.stats.itemsSaved})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:"12px",color:"#999",marginBottom:"4px"},children:"Items Dropped"}),a.jsx("div",{style:{fontSize:"16px",fontWeight:"600",color:"#e74c3c"},children:E.stats.itemsDropped})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:"12px",color:"#999",marginBottom:"4px"},children:"Errors"}),a.jsx("div",{style:{fontSize:"16px",fontWeight:"600",color:E.stats.errorsCount>0?"#ff9800":"#999"},children:E.stats.errorsCount})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:"12px",color:"#999",marginBottom:"4px"},children:"Duration"}),a.jsx("div",{style:{fontSize:"16px",fontWeight:"600"},children:Z(E.duration)})]})]}),E.currentActivity&&a.jsxs("div",{style:{marginTop:"12px",padding:"8px 12px",background:"#f8f8f8",borderRadius:"4px",fontSize:"14px",color:"#666"},children:["📍 ",E.currentActivity]}),E.isStale&&a.jsx("div",{style:{marginTop:"12px",padding:"8px 12px",background:"#fff3cd",borderRadius:"4px",fontSize:"14px",color:"#856404"},children:"⚠️ No update in over 1 minute - scraper may be stuck"})]}),a.jsx("div",{style:{padding:"6px 12px",borderRadius:"4px",fontSize:"13px",fontWeight:"600",background:E.status==="running"?"#d4edda":E.status==="error"?"#f8d7da":"#e7e7e7",color:E.status==="running"?"#155724":E.status==="error"?"#721c24":"#666"},children:E.status.toUpperCase()})]})},E.id))})]}),a.jsxs("div",{children:[a.jsxs("h2",{style:{fontSize:"24px",marginBottom:"20px"},children:["Recent Scrapes (",r.length,")"]}),a.jsx("div",{style:{background:"white",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",overflow:"hidden"},children:a.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[a.jsx("thead",{children:a.jsxs("tr",{style:{background:"#f8f8f8",borderBottom:"2px solid #eee"},children:[a.jsx("th",{style:{padding:"15px",textAlign:"left",fontWeight:"600"},children:"Dispensary"}),a.jsx("th",{style:{padding:"15px",textAlign:"left",fontWeight:"600"},children:"Status"}),a.jsx("th",{style:{padding:"15px",textAlign:"right",fontWeight:"600"},children:"Found"}),a.jsx("th",{style:{padding:"15px",textAlign:"right",fontWeight:"600"},children:"Products"}),a.jsx("th",{style:{padding:"15px",textAlign:"left",fontWeight:"600"},children:"Last Crawled"})]})}),a.jsx("tbody",{children:r.map((E,D)=>a.jsxs("tr",{style:{borderBottom:"1px solid #eee"},children:[a.jsx("td",{style:{padding:"15px"},children:E.dispensary_name||E.store_name}),a.jsx("td",{style:{padding:"15px"},children:a.jsx("span",{style:{padding:"4px 10px",borderRadius:"12px",fontSize:"12px",fontWeight:"600",background:E.status==="completed"?"#d1fae5":E.status==="failed"?"#fee2e2":"#fef3c7",color:E.status==="completed"?"#065f46":E.status==="failed"?"#991b1b":"#92400e"},children:E.status||"-"})}),a.jsx("td",{style:{padding:"15px",textAlign:"right",fontWeight:"600"},children:E.products_found||"-"}),a.jsx("td",{style:{padding:"15px",textAlign:"right",fontWeight:"600"},children:E.product_count}),a.jsx("td",{style:{padding:"15px",color:"#666"},children:E.last_scraped_at?new Date(E.last_scraped_at).toLocaleString():"-"})]},D))})]})})]})]})]})})}function mF(){var we;const[e,t]=h.useState([]),[r,n]=h.useState([]),[i,s]=h.useState([]),[o,l]=h.useState(!0),[c,d]=h.useState(!0),[u,f]=h.useState("dispensaries"),[p,m]=h.useState(null),[x,g]=h.useState(null),[b,v]=h.useState(null),[j,y]=h.useState(null),[w,S]=h.useState(!1),[N,P]=h.useState("all"),[_,T]=h.useState(""),[$,M]=h.useState("");h.useEffect(()=>{const A=setTimeout(()=>{T($)},300);return()=>clearTimeout(A)},[$]),h.useEffect(()=>{if(C(),c){const A=setInterval(C,5e3);return()=>clearInterval(A)}},[c,N,_]);const C=async()=>{try{const A={};N==="AZ"&&(A.state="AZ"),_.trim()&&(A.search=_.trim());const[J,Ot,z]=await Promise.all([B.getGlobalSchedule(),B.getDispensarySchedules(Object.keys(A).length>0?A:void 0),B.getDispensaryCrawlJobs(100)]);t(J.schedules||[]),n(Ot.dispensaries||[]),s(z.jobs||[])}catch(A){console.error("Failed to load schedule data:",A)}finally{l(!1)}},R=async A=>{m(A);try{await B.triggerDispensaryCrawl(A),await C()}catch(J){console.error("Failed to trigger crawl:",J)}finally{m(null)}},q=async()=>{if(confirm("This will create crawl jobs for ALL active stores. Continue?"))try{const A=await B.triggerAllCrawls();alert(`Created ${A.jobs_created} crawl jobs`),await C()}catch(A){console.error("Failed to trigger all crawls:",A)}},Z=async A=>{try{await B.cancelCrawlJob(A),await C()}catch(J){console.error("Failed to cancel job:",J)}},E=async A=>{g(A);try{const J=await B.resolvePlatformId(A);J.success?alert(J.message):alert(`Failed: ${J.error||J.message}`),await C()}catch(J){console.error("Failed to resolve platform ID:",J),alert(`Error: ${J.message}`)}finally{g(null)}},D=async A=>{v(A);try{const J=await B.refreshDetection(A);alert(`Detected: ${J.menu_type}${J.platform_dispensary_id?`, Platform ID: ${J.platform_dispensary_id}`:""}`),await C()}catch(J){console.error("Failed to refresh detection:",J),alert(`Error: ${J.message}`)}finally{v(null)}},O=async(A,J)=>{y(A);try{await B.toggleDispensarySchedule(A,!J),await C()}catch(Ot){console.error("Failed to toggle schedule:",Ot),alert(`Error: ${Ot.message}`)}finally{y(null)}},k=async(A,J)=>{try{await B.updateGlobalSchedule(A,J),await C()}catch(Ot){console.error("Failed to update global schedule:",Ot)}},L=A=>{if(!A)return"Never";const J=new Date(A),z=new Date().getTime()-J.getTime(),Q=Math.floor(z/6e4),ne=Math.floor(Q/60),U=Math.floor(ne/24);return Q<1?"Just now":Q<60?`${Q}m ago`:ne<24?`${ne}h ago`:`${U}d ago`},F=A=>{const J=new Date(A),Ot=new Date,z=J.getTime()-Ot.getTime();if(z<0)return"Overdue";const Q=Math.floor(z/6e4),ne=Math.floor(Q/60);return Q<60?`${Q}m`:`${ne}h ${Q%60}m`},H=A=>{switch(A){case"completed":case"success":return{bg:"#d1fae5",color:"#065f46"};case"running":return{bg:"#dbeafe",color:"#1e40af"};case"failed":case"error":return{bg:"#fee2e2",color:"#991b1b"};case"cancelled":return{bg:"#f3f4f6",color:"#374151"};case"pending":return{bg:"#fef3c7",color:"#92400e"};case"sandbox_only":return{bg:"#e0e7ff",color:"#3730a3"};case"detection_only":return{bg:"#fce7f3",color:"#9d174d"};default:return{bg:"#f3f4f6",color:"#374151"}}},te=e.find(A=>A.schedule_type==="global_interval"),re=e.find(A=>A.schedule_type==="daily_special");return a.jsx(X,{children:a.jsxs("div",{children:[a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"30px"},children:[a.jsx("h1",{style:{fontSize:"32px",margin:0},children:"Crawler Schedule"}),a.jsxs("div",{style:{display:"flex",gap:"15px",alignItems:"center"},children:[a.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"10px",cursor:"pointer"},children:[a.jsx("input",{type:"checkbox",checked:c,onChange:A=>d(A.target.checked),style:{width:"18px",height:"18px",cursor:"pointer"}}),a.jsx("span",{children:"Auto-refresh (5s)"})]}),a.jsx("button",{onClick:q,style:{padding:"10px 20px",background:"#2563eb",color:"white",border:"none",borderRadius:"6px",cursor:"pointer",fontWeight:"600"},children:"Crawl All Stores"})]})]}),a.jsxs("div",{style:{marginBottom:"30px",display:"flex",gap:"10px",borderBottom:"2px solid #eee"},children:[a.jsxs("button",{onClick:()=>f("dispensaries"),style:{padding:"12px 24px",background:u==="dispensaries"?"white":"transparent",border:"none",borderBottom:u==="dispensaries"?"3px solid #2563eb":"3px solid transparent",cursor:"pointer",fontSize:"16px",fontWeight:u==="dispensaries"?"600":"400",color:u==="dispensaries"?"#2563eb":"#666",marginBottom:"-2px"},children:["Dispensary Schedules (",r.length,")"]}),a.jsxs("button",{onClick:()=>f("jobs"),style:{padding:"12px 24px",background:u==="jobs"?"white":"transparent",border:"none",borderBottom:u==="jobs"?"3px solid #2563eb":"3px solid transparent",cursor:"pointer",fontSize:"16px",fontWeight:u==="jobs"?"600":"400",color:u==="jobs"?"#2563eb":"#666",marginBottom:"-2px"},children:["Job Queue (",i.filter(A=>A.status==="pending"||A.status==="running").length,")"]}),a.jsx("button",{onClick:()=>f("global"),style:{padding:"12px 24px",background:u==="global"?"white":"transparent",border:"none",borderBottom:u==="global"?"3px solid #2563eb":"3px solid transparent",cursor:"pointer",fontSize:"16px",fontWeight:u==="global"?"600":"400",color:u==="global"?"#2563eb":"#666",marginBottom:"-2px"},children:"Global Settings"})]}),u==="global"&&a.jsxs("div",{style:{display:"grid",gap:"20px"},children:[a.jsxs("div",{style:{background:"white",padding:"24px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)"},children:[a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"start",marginBottom:"20px"},children:[a.jsxs("div",{children:[a.jsx("h2",{style:{fontSize:"20px",margin:0,marginBottom:"8px"},children:"Interval Crawl Schedule"}),a.jsx("p",{style:{color:"#666",margin:0},children:"Crawl all stores periodically"})]}),a.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"10px",cursor:"pointer"},children:[a.jsx("span",{style:{color:"#666"},children:"Enabled"}),a.jsx("input",{type:"checkbox",checked:(te==null?void 0:te.enabled)??!0,onChange:A=>k("global_interval",{enabled:A.target.checked}),style:{width:"20px",height:"20px",cursor:"pointer"}})]})]}),a.jsx("div",{style:{display:"flex",alignItems:"center",gap:"15px"},children:a.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"10px"},children:[a.jsx("span",{children:"Crawl every"}),a.jsxs("select",{value:(te==null?void 0:te.interval_hours)??4,onChange:A=>k("global_interval",{interval_hours:parseInt(A.target.value)}),style:{padding:"8px 12px",borderRadius:"6px",border:"1px solid #ddd",fontSize:"16px"},children:[a.jsx("option",{value:1,children:"1 hour"}),a.jsx("option",{value:2,children:"2 hours"}),a.jsx("option",{value:4,children:"4 hours"}),a.jsx("option",{value:6,children:"6 hours"}),a.jsx("option",{value:8,children:"8 hours"}),a.jsx("option",{value:12,children:"12 hours"}),a.jsx("option",{value:24,children:"24 hours"})]})]})})]}),a.jsxs("div",{style:{background:"white",padding:"24px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)"},children:[a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"start",marginBottom:"20px"},children:[a.jsxs("div",{children:[a.jsx("h2",{style:{fontSize:"20px",margin:0,marginBottom:"8px"},children:"Daily Special Crawl"}),a.jsx("p",{style:{color:"#666",margin:0},children:"Crawl stores at local midnight to capture daily specials"})]}),a.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"10px",cursor:"pointer"},children:[a.jsx("span",{style:{color:"#666"},children:"Enabled"}),a.jsx("input",{type:"checkbox",checked:(re==null?void 0:re.enabled)??!0,onChange:A=>k("daily_special",{enabled:A.target.checked}),style:{width:"20px",height:"20px",cursor:"pointer"}})]})]}),a.jsx("div",{style:{display:"flex",alignItems:"center",gap:"15px"},children:a.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"10px"},children:[a.jsx("span",{children:"Run at"}),a.jsx("input",{type:"time",value:((we=re==null?void 0:re.run_time)==null?void 0:we.slice(0,5))??"00:01",onChange:A=>k("daily_special",{run_time:A.target.value}),style:{padding:"8px 12px",borderRadius:"6px",border:"1px solid #ddd",fontSize:"16px"}}),a.jsx("span",{style:{color:"#666"},children:"(store local time)"})]})})]})]}),u==="dispensaries"&&a.jsxs("div",{children:[a.jsxs("div",{style:{marginBottom:"15px",display:"flex",gap:"20px",alignItems:"center",flexWrap:"wrap"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[a.jsx("span",{style:{fontWeight:"500",color:"#374151"},children:"State:"}),a.jsxs("div",{style:{display:"flex",borderRadius:"6px",overflow:"hidden",border:"1px solid #d1d5db"},children:[a.jsx("button",{onClick:()=>P("all"),style:{padding:"6px 14px",background:N==="all"?"#2563eb":"white",color:N==="all"?"white":"#374151",border:"none",cursor:"pointer",fontSize:"14px",fontWeight:"500"},children:"All"}),a.jsx("button",{onClick:()=>P("AZ"),style:{padding:"6px 14px",background:N==="AZ"?"#2563eb":"white",color:N==="AZ"?"white":"#374151",border:"none",borderLeft:"1px solid #d1d5db",cursor:"pointer",fontSize:"14px",fontWeight:"500"},children:"AZ Only"})]})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[a.jsx("span",{style:{fontWeight:"500",color:"#374151"},children:"Search:"}),a.jsx("input",{type:"text",placeholder:"Store name or slug...",value:$,onChange:A=>M(A.target.value),style:{padding:"6px 12px",borderRadius:"6px",border:"1px solid #d1d5db",fontSize:"14px",width:"200px"}}),$&&a.jsx("button",{onClick:()=>{M(""),T("")},style:{padding:"4px 8px",background:"#f3f4f6",border:"1px solid #d1d5db",borderRadius:"4px",cursor:"pointer",fontSize:"12px"},children:"Clear"})]}),a.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"8px",cursor:"pointer"},children:[a.jsx("input",{type:"checkbox",checked:w,onChange:A=>S(A.target.checked),style:{width:"16px",height:"16px",cursor:"pointer"}}),a.jsx("span",{children:"Dutchie only"})]}),a.jsxs("span",{style:{color:"#666",fontSize:"14px",marginLeft:"auto"},children:["Showing ",(w?r.filter(A=>A.menu_type==="dutchie"):r).length," dispensaries"]})]}),a.jsx("div",{style:{background:"white",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",overflow:"auto"},children:a.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",minWidth:"1200px"},children:[a.jsx("thead",{children:a.jsxs("tr",{style:{background:"#f8f8f8",borderBottom:"2px solid #eee"},children:[a.jsx("th",{style:{padding:"12px",textAlign:"left",fontWeight:"600"},children:"Dispensary"}),a.jsx("th",{style:{padding:"12px",textAlign:"center",fontWeight:"600"},children:"Menu Type"}),a.jsx("th",{style:{padding:"12px",textAlign:"center",fontWeight:"600"},children:"Platform ID"}),a.jsx("th",{style:{padding:"12px",textAlign:"center",fontWeight:"600"},children:"Status"}),a.jsx("th",{style:{padding:"12px",textAlign:"left",fontWeight:"600"},children:"Last Run"}),a.jsx("th",{style:{padding:"12px",textAlign:"left",fontWeight:"600"},children:"Next Run"}),a.jsx("th",{style:{padding:"12px",textAlign:"left",fontWeight:"600"},children:"Last Result"}),a.jsx("th",{style:{padding:"12px",textAlign:"center",fontWeight:"600",minWidth:"220px"},children:"Actions"})]})}),a.jsx("tbody",{children:(w?r.filter(A=>A.menu_type==="dutchie"):r).map(A=>a.jsxs("tr",{style:{borderBottom:"1px solid #eee"},children:[a.jsxs("td",{style:{padding:"12px"},children:[a.jsx("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:A.state&&A.city&&(A.dispensary_slug||A.slug)?a.jsx(K1,{to:`/dispensaries/${A.state}/${A.city.toLowerCase().replace(/\s+/g,"-")}/${A.dispensary_slug||A.slug}`,style:{fontWeight:"600",color:"#2563eb",textDecoration:"none"},children:A.dispensary_name}):a.jsx("span",{style:{fontWeight:"600"},children:A.dispensary_name})}),a.jsx("div",{style:{fontSize:"12px",color:"#666"},children:A.city?`${A.city}, ${A.state}`:A.state})]}),a.jsx("td",{style:{padding:"12px",textAlign:"center"},children:A.menu_type?a.jsx("span",{style:{padding:"4px 10px",borderRadius:"12px",fontSize:"11px",fontWeight:"600",background:A.menu_type==="dutchie"?"#d1fae5":"#e0e7ff",color:A.menu_type==="dutchie"?"#065f46":"#3730a3"},children:A.menu_type}):a.jsx("span",{style:{padding:"4px 10px",borderRadius:"12px",fontSize:"11px",fontWeight:"600",background:"#f3f4f6",color:"#666"},children:"unknown"})}),a.jsx("td",{style:{padding:"12px",textAlign:"center"},children:A.platform_dispensary_id?a.jsx("span",{style:{padding:"4px 8px",borderRadius:"4px",fontSize:"10px",fontFamily:"monospace",background:"#d1fae5",color:"#065f46"},title:A.platform_dispensary_id,children:A.platform_dispensary_id.length>12?`${A.platform_dispensary_id.slice(0,6)}...${A.platform_dispensary_id.slice(-4)}`:A.platform_dispensary_id}):a.jsx("span",{style:{padding:"4px 8px",borderRadius:"4px",fontSize:"10px",background:"#fee2e2",color:"#991b1b"},children:"missing"})}),a.jsx("td",{style:{padding:"12px",textAlign:"center"},children:a.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"4px"},children:[a.jsx("span",{style:{padding:"4px 10px",borderRadius:"12px",fontSize:"11px",fontWeight:"600",background:A.can_crawl?"#d1fae5":A.is_active!==!1?"#fef3c7":"#fee2e2",color:A.can_crawl?"#065f46":A.is_active!==!1?"#92400e":"#991b1b"},children:A.can_crawl?"Ready":A.is_active!==!1?"Not Ready":"Disabled"}),A.schedule_status_reason&&A.schedule_status_reason!=="ready"&&a.jsx("span",{style:{fontSize:"10px",color:"#666",maxWidth:"100px",textAlign:"center"},children:A.schedule_status_reason}),A.interval_minutes&&a.jsxs("span",{style:{fontSize:"10px",color:"#999"},children:["Every ",Math.round(A.interval_minutes/60),"h"]})]})}),a.jsxs("td",{style:{padding:"15px"},children:[a.jsx("div",{children:L(A.last_run_at)}),A.last_run_at&&a.jsx("div",{style:{fontSize:"12px",color:"#999"},children:new Date(A.last_run_at).toLocaleString()})]}),a.jsx("td",{style:{padding:"15px"},children:a.jsx("div",{style:{fontWeight:"600",color:"#2563eb"},children:A.next_run_at?F(A.next_run_at):"Not scheduled"})}),a.jsx("td",{style:{padding:"15px"},children:A.last_status||A.latest_job_status?a.jsxs("div",{children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"4px"},children:[a.jsx("span",{style:{padding:"4px 10px",borderRadius:"12px",fontSize:"12px",fontWeight:"600",...H(A.last_status||A.latest_job_status||"pending")},children:A.last_status||A.latest_job_status}),A.last_error&&a.jsx("button",{onClick:()=>alert(A.last_error),style:{padding:"2px 6px",background:"#fee2e2",color:"#991b1b",border:"none",borderRadius:"4px",cursor:"pointer",fontSize:"10px"},children:"Error"})]}),A.last_summary?a.jsx("div",{style:{fontSize:"12px",color:"#666",maxWidth:"250px"},children:A.last_summary}):A.latest_products_found!==null?a.jsxs("div",{style:{fontSize:"12px",color:"#666"},children:[A.latest_products_found," products"]}):null]}):a.jsx("span",{style:{color:"#999",fontSize:"13px"},children:"No runs yet"})}),a.jsx("td",{style:{padding:"12px",textAlign:"center"},children:a.jsxs("div",{style:{display:"flex",gap:"6px",justifyContent:"center",flexWrap:"wrap"},children:[a.jsx("button",{onClick:()=>D(A.dispensary_id),disabled:b===A.dispensary_id,style:{padding:"4px 8px",background:b===A.dispensary_id?"#94a3b8":"#f3f4f6",color:"#374151",border:"1px solid #d1d5db",borderRadius:"4px",cursor:b===A.dispensary_id?"wait":"pointer",fontSize:"11px"},title:"Re-detect menu type and resolve platform ID",children:b===A.dispensary_id?"...":"Refresh"}),A.menu_type==="dutchie"&&!A.platform_dispensary_id&&a.jsx("button",{onClick:()=>E(A.dispensary_id),disabled:x===A.dispensary_id,style:{padding:"4px 8px",background:x===A.dispensary_id?"#94a3b8":"#fef3c7",color:"#92400e",border:"1px solid #fcd34d",borderRadius:"4px",cursor:x===A.dispensary_id?"wait":"pointer",fontSize:"11px"},title:"Resolve platform dispensary ID via GraphQL",children:x===A.dispensary_id?"...":"Resolve ID"}),a.jsx("button",{onClick:()=>R(A.dispensary_id),disabled:p===A.dispensary_id||!A.can_crawl,style:{padding:"4px 8px",background:p===A.dispensary_id?"#94a3b8":A.can_crawl?"#2563eb":"#e5e7eb",color:A.can_crawl?"white":"#9ca3af",border:"none",borderRadius:"4px",cursor:p===A.dispensary_id||!A.can_crawl?"not-allowed":"pointer",fontSize:"11px"},title:A.can_crawl?"Trigger immediate crawl":`Cannot crawl: ${A.schedule_status_reason}`,children:p===A.dispensary_id?"...":"Run"}),a.jsx("button",{onClick:()=>O(A.dispensary_id,A.is_active),disabled:j===A.dispensary_id,style:{padding:"4px 8px",background:j===A.dispensary_id?"#94a3b8":A.is_active?"#fee2e2":"#d1fae5",color:A.is_active?"#991b1b":"#065f46",border:"none",borderRadius:"4px",cursor:j===A.dispensary_id?"wait":"pointer",fontSize:"11px"},title:A.is_active?"Disable scheduled crawling":"Enable scheduled crawling",children:j===A.dispensary_id?"...":A.is_active?"Disable":"Enable"})]})})]},A.dispensary_id))})]})})]}),u==="jobs"&&a.jsxs(a.Fragment,{children:[a.jsx("div",{style:{marginBottom:"30px"},children:a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(150px, 1fr))",gap:"15px"},children:[a.jsxs("div",{style:{background:"white",padding:"20px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)"},children:[a.jsx("div",{style:{fontSize:"14px",color:"#999",marginBottom:"8px"},children:"Pending"}),a.jsx("div",{style:{fontSize:"32px",fontWeight:"600",color:"#f59e0b"},children:i.filter(A=>A.status==="pending").length})]}),a.jsxs("div",{style:{background:"white",padding:"20px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)"},children:[a.jsx("div",{style:{fontSize:"14px",color:"#999",marginBottom:"8px"},children:"Running"}),a.jsx("div",{style:{fontSize:"32px",fontWeight:"600",color:"#3b82f6"},children:i.filter(A=>A.status==="running").length})]}),a.jsxs("div",{style:{background:"white",padding:"20px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)"},children:[a.jsx("div",{style:{fontSize:"14px",color:"#999",marginBottom:"8px"},children:"Completed"}),a.jsx("div",{style:{fontSize:"32px",fontWeight:"600",color:"#10b981"},children:i.filter(A=>A.status==="completed").length})]}),a.jsxs("div",{style:{background:"white",padding:"20px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)"},children:[a.jsx("div",{style:{fontSize:"14px",color:"#999",marginBottom:"8px"},children:"Failed"}),a.jsx("div",{style:{fontSize:"32px",fontWeight:"600",color:"#ef4444"},children:i.filter(A=>A.status==="failed").length})]})]})}),a.jsx("div",{style:{background:"white",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",overflow:"hidden"},children:a.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[a.jsx("thead",{children:a.jsxs("tr",{style:{background:"#f8f8f8",borderBottom:"2px solid #eee"},children:[a.jsx("th",{style:{padding:"15px",textAlign:"left",fontWeight:"600"},children:"Dispensary"}),a.jsx("th",{style:{padding:"15px",textAlign:"center",fontWeight:"600"},children:"Type"}),a.jsx("th",{style:{padding:"15px",textAlign:"center",fontWeight:"600"},children:"Trigger"}),a.jsx("th",{style:{padding:"15px",textAlign:"center",fontWeight:"600"},children:"Status"}),a.jsx("th",{style:{padding:"15px",textAlign:"right",fontWeight:"600"},children:"Products"}),a.jsx("th",{style:{padding:"15px",textAlign:"left",fontWeight:"600"},children:"Started"}),a.jsx("th",{style:{padding:"15px",textAlign:"left",fontWeight:"600"},children:"Completed"}),a.jsx("th",{style:{padding:"15px",textAlign:"center",fontWeight:"600"},children:"Actions"})]})}),a.jsx("tbody",{children:i.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:8,style:{padding:"40px",textAlign:"center",color:"#666"},children:"No crawl jobs found"})}):i.map(A=>a.jsxs("tr",{style:{borderBottom:"1px solid #eee"},children:[a.jsxs("td",{style:{padding:"15px"},children:[a.jsx("div",{style:{fontWeight:"600"},children:A.dispensary_name}),a.jsxs("div",{style:{fontSize:"12px",color:"#999"},children:["Job #",A.id]})]}),a.jsx("td",{style:{padding:"15px",textAlign:"center",fontSize:"13px"},children:A.job_type}),a.jsx("td",{style:{padding:"15px",textAlign:"center"},children:a.jsx("span",{style:{padding:"3px 8px",borderRadius:"4px",fontSize:"12px",background:A.trigger_type==="manual"?"#e0e7ff":A.trigger_type==="daily_special"?"#fce7f3":"#f3f4f6",color:A.trigger_type==="manual"?"#3730a3":A.trigger_type==="daily_special"?"#9d174d":"#374151"},children:A.trigger_type})}),a.jsx("td",{style:{padding:"15px",textAlign:"center"},children:a.jsx("span",{style:{padding:"4px 10px",borderRadius:"12px",fontSize:"12px",fontWeight:"600",...H(A.status)},children:A.status})}),a.jsx("td",{style:{padding:"15px",textAlign:"right"},children:A.products_found!==null?a.jsxs("div",{children:[a.jsx("div",{style:{fontWeight:"600"},children:A.products_found}),A.products_new!==null&&A.products_updated!==null&&a.jsxs("div",{style:{fontSize:"12px",color:"#666"},children:["+",A.products_new," / ~",A.products_updated]})]}):"-"}),a.jsx("td",{style:{padding:"15px",fontSize:"13px"},children:A.started_at?new Date(A.started_at).toLocaleString():"-"}),a.jsx("td",{style:{padding:"15px",fontSize:"13px"},children:A.completed_at?new Date(A.completed_at).toLocaleString():"-"}),a.jsxs("td",{style:{padding:"15px",textAlign:"center"},children:[A.status==="pending"&&a.jsx("button",{onClick:()=>Z(A.id),style:{padding:"4px 10px",background:"#fee2e2",color:"#991b1b",border:"none",borderRadius:"4px",cursor:"pointer",fontSize:"12px"},children:"Cancel"}),A.error_message&&a.jsx("button",{onClick:()=>alert(A.error_message),style:{padding:"4px 10px",background:"#fee2e2",color:"#991b1b",border:"none",borderRadius:"4px",cursor:"pointer",fontSize:"12px"},children:"View Error"})]})]},A.id))})]})})]})]})})}function gF(){const[e,t]=h.useState([]),[r,n]=h.useState(null),[i,s]=h.useState(3),[o,l]=h.useState("rotate-desktop"),[c,d]=h.useState(!1),[u,f]=h.useState(!1),[p,m]=h.useState(null),[x,g]=h.useState(!0);h.useEffect(()=>{b()},[]);const b=async()=>{g(!0);try{const S=(await B.getDispensaries()).dispensaries.filter(N=>N.menu_url&&N.scrape_enabled);t(S),S.length>0&&n(S[0].id)}catch(w){console.error("Failed to load dispensaries:",w)}finally{g(!1)}},v=async()=>{if(!(!r||c)){d(!0);try{await B.triggerDispensaryCrawl(r),m({message:"Crawl started for dispensary! Check the Scraper Monitor for progress.",type:"success"})}catch(w){m({message:"Failed to start crawl: "+w.message,type:"error"})}finally{d(!1)}}},j=async()=>{if(!(!r||u)){f(!0);try{m({message:"Image download feature coming soon!",type:"info"})}catch(w){m({message:"Failed to start image download: "+w.message,type:"error"})}finally{f(!1)}}},y=e.find(w=>w.id===r);return x?a.jsx(X,{children:a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsx("span",{className:"loading loading-spinner loading-lg"})})}):a.jsxs(X,{children:[p&&a.jsx(Vn,{message:p.message,type:p.type,onClose:()=>m(null)}),a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-3xl font-bold",children:"Scraper Tools"}),a.jsx("p",{className:"text-gray-500 mt-2",children:"Manage crawling operations for dispensaries"})]}),a.jsx("div",{className:"card bg-base-100 shadow-xl",children:a.jsxs("div",{className:"card-body",children:[a.jsx("h2",{className:"card-title",children:"Select Dispensary"}),a.jsx("select",{className:"select select-bordered w-full max-w-md",value:r||"",onChange:w=>n(parseInt(w.target.value)),children:e.map(w=>a.jsxs("option",{value:w.id,children:[w.dba_name||w.name," - ",w.city,", ",w.state]},w.id))}),y&&a.jsx("div",{className:"mt-4 p-4 bg-base-200 rounded-lg",children:a.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 text-sm",children:[a.jsxs("div",{children:[a.jsx("div",{className:"text-gray-500",children:"Status"}),a.jsx("div",{className:"font-semibold",children:y.scrape_enabled?a.jsx("span",{className:"badge badge-success",children:"Enabled"}):a.jsx("span",{className:"badge badge-error",children:"Disabled"})})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-gray-500",children:"Provider"}),a.jsx("div",{className:"font-semibold",children:y.provider_type||"Unknown"})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-gray-500",children:"Products"}),a.jsx("div",{className:"font-semibold",children:y.product_count||0})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-gray-500",children:"Last Crawled"}),a.jsx("div",{className:"font-semibold",children:y.last_crawl_at?new Date(y.last_crawl_at).toLocaleDateString():"Never"})]})]})})]})}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsx("div",{className:"card bg-base-100 shadow-xl",children:a.jsxs("div",{className:"card-body",children:[a.jsx("h2",{className:"card-title",children:"Crawl Dispensary"}),a.jsx("p",{className:"text-sm text-gray-500",children:"Start crawling products from the selected dispensary menu"}),a.jsx("div",{className:"card-actions justify-end mt-4",children:a.jsx("button",{onClick:v,disabled:!r||c,className:`btn btn-primary ${c?"loading":""}`,children:c?"Starting...":"Start Crawl"})})]})}),a.jsx("div",{className:"card bg-base-100 shadow-xl",children:a.jsxs("div",{className:"card-body",children:[a.jsx("h2",{className:"card-title",children:"Download Images"}),a.jsx("p",{className:"text-sm text-gray-500",children:"Download missing product images for the selected dispensary"}),a.jsx("div",{className:"card-actions justify-end mt-auto",children:a.jsx("button",{onClick:j,disabled:!r||u,className:`btn btn-secondary ${u?"loading":""}`,children:u?"Downloading...":"Download Missing Images"})})]})})]}),a.jsxs("div",{className:"alert alert-info",children:[a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",className:"stroke-current shrink-0 w-6 h-6",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),a.jsxs("span",{children:["After starting scraper operations, check the"," ",a.jsx("a",{href:"/scraper-monitor",className:"link",children:"Scraper Monitor"})," for real-time progress and ",a.jsx("a",{href:"/logs",className:"link",children:"Logs"})," for detailed output."]})]})]})]})}function xF(){const[e,t]=h.useState([]),[r,n]=h.useState(null),[i,s]=h.useState(!0),[o,l]=h.useState("pending"),[c,d]=h.useState(null);h.useEffect(()=>{u()},[o]);const u=async()=>{s(!0);try{const[g,b]=await Promise.all([B.getChanges(o==="all"?void 0:o),B.getChangeStats()]);t(g.changes),n(b)}catch(g){console.error("Failed to load changes:",g)}finally{s(!1)}},f=async g=>{d(g);try{(await B.approveChange(g)).requires_recrawl&&alert("Change approved! This dispensary requires a menu recrawl."),await u()}catch(b){console.error("Failed to approve change:",b),alert("Failed to approve change. Please try again.")}finally{d(null)}},p=async g=>{const b=prompt("Enter rejection reason (optional):");d(g);try{await B.rejectChange(g,b||void 0),await u()}catch(v){console.error("Failed to reject change:",v),alert("Failed to reject change. Please try again.")}finally{d(null)}},m=g=>({dba_name:"DBA Name",website:"Website",phone:"Phone",email:"Email",google_rating:"Google Rating",google_review_count:"Google Review Count",menu_url:"Menu URL"})[g]||g,x=g=>({high:"bg-green-100 text-green-800",medium:"bg-yellow-100 text-yellow-800",low:"bg-red-100 text-red-800"})[g]||"bg-gray-100 text-gray-800";return i?a.jsx(X,{children:a.jsxs("div",{className:"text-center py-12",children:[a.jsx("div",{className:"inline-block animate-spin rounded-full h-8 w-8 border-4 border-blue-500 border-t-transparent"}),a.jsx("p",{className:"mt-2 text-sm text-gray-600",children:"Loading changes..."})]})}):a.jsx(X,{children:a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"Change Approval"}),a.jsx("p",{className:"text-sm text-gray-600 mt-1",children:"Review and approve proposed changes to dispensary data"})]}),a.jsxs("button",{onClick:u,className:"flex items-center gap-2 px-4 py-2 text-sm border border-gray-300 rounded-lg hover:bg-gray-50",children:[a.jsx(Xt,{className:"w-4 h-4"}),"Refresh"]})]}),r&&a.jsxs("div",{className:"grid grid-cols-4 gap-6",children:[a.jsx("div",{className:"bg-white rounded-lg border border-gray-200 p-6",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 bg-yellow-50 rounded-lg",children:a.jsx(xr,{className:"w-5 h-5 text-yellow-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm text-gray-600",children:"Pending"}),a.jsx("p",{className:"text-2xl font-bold text-gray-900",children:r.pending_count})]})]})}),a.jsx("div",{className:"bg-white rounded-lg border border-gray-200 p-6",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 bg-orange-50 rounded-lg",children:a.jsx(nj,{className:"w-5 h-5 text-orange-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm text-gray-600",children:"Needs Recrawl"}),a.jsx("p",{className:"text-2xl font-bold text-gray-900",children:r.pending_recrawl_count})]})]})}),a.jsx("div",{className:"bg-white rounded-lg border border-gray-200 p-6",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 bg-green-50 rounded-lg",children:a.jsx(_r,{className:"w-5 h-5 text-green-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm text-gray-600",children:"Approved"}),a.jsx("p",{className:"text-2xl font-bold text-gray-900",children:r.approved_count})]})]})}),a.jsx("div",{className:"bg-white rounded-lg border border-gray-200 p-6",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 bg-red-50 rounded-lg",children:a.jsx(Hr,{className:"w-5 h-5 text-red-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm text-gray-600",children:"Rejected"}),a.jsx("p",{className:"text-2xl font-bold text-gray-900",children:r.rejected_count})]})]})})]}),a.jsx("div",{className:"flex gap-2",children:["all","pending","approved","rejected"].map(g=>a.jsx("button",{onClick:()=>l(g),className:`px-4 py-2 text-sm font-medium rounded-lg ${o===g?"bg-blue-600 text-white":"bg-white text-gray-700 border border-gray-300 hover:bg-gray-50"}`,children:g.charAt(0).toUpperCase()+g.slice(1)},g))}),a.jsx("div",{className:"bg-white rounded-lg border border-gray-200",children:e.length===0?a.jsx("div",{className:"text-center py-12",children:a.jsx("p",{className:"text-gray-600",children:"No changes found"})}):a.jsx("div",{className:"divide-y divide-gray-200",children:e.map(g=>a.jsx("div",{className:"p-6",children:a.jsxs("div",{className:"flex items-start justify-between",children:[a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[a.jsx("h3",{className:"text-lg font-semibold text-gray-900",children:g.dispensary_name}),a.jsx("span",{className:`px-2 py-1 text-xs font-medium rounded ${x(g.confidence_score)}`,children:g.confidence_score||"N/A"}),g.requires_recrawl&&a.jsx("span",{className:"px-2 py-1 text-xs font-medium rounded bg-orange-100 text-orange-800",children:"Requires Recrawl"})]}),a.jsxs("p",{className:"text-sm text-gray-600 mb-3",children:[g.city,", ",g.state," • Source: ",g.source]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4 mb-3",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-medium text-gray-500",children:"Field"}),a.jsx("p",{className:"text-sm text-gray-900",children:m(g.field_name)})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-medium text-gray-500",children:"Old Value"}),a.jsx("p",{className:"text-sm text-gray-900",children:g.old_value||a.jsx("em",{className:"text-gray-400",children:"None"})})]}),a.jsxs("div",{className:"col-span-2",children:[a.jsx("label",{className:"text-xs font-medium text-gray-500",children:"New Value"}),a.jsx("p",{className:"text-sm font-medium text-blue-600",children:g.new_value})]}),g.change_notes&&a.jsxs("div",{className:"col-span-2",children:[a.jsx("label",{className:"text-xs font-medium text-gray-500",children:"Notes"}),a.jsx("p",{className:"text-sm text-gray-700",children:g.change_notes})]})]}),a.jsxs("p",{className:"text-xs text-gray-500",children:["Created ",new Date(g.created_at).toLocaleString()]}),g.status==="rejected"&&g.rejection_reason&&a.jsxs("div",{className:"mt-2 p-3 bg-red-50 rounded border border-red-200",children:[a.jsx("p",{className:"text-xs font-medium text-red-800",children:"Rejection Reason:"}),a.jsx("p",{className:"text-sm text-red-700",children:g.rejection_reason})]})]}),a.jsxs("div",{className:"flex items-center gap-2 ml-4",children:[g.status==="pending"&&a.jsxs(a.Fragment,{children:[a.jsxs("button",{onClick:()=>f(g.id),disabled:c===g.id,className:"flex items-center gap-2 px-4 py-2 bg-green-600 text-white text-sm font-medium rounded-lg hover:bg-green-700 disabled:opacity-50",children:[a.jsx(_r,{className:"w-4 h-4"}),"Approve"]}),a.jsxs("button",{onClick:()=>p(g.id),disabled:c===g.id,className:"flex items-center gap-2 px-4 py-2 bg-red-600 text-white text-sm font-medium rounded-lg hover:bg-red-700 disabled:opacity-50",children:[a.jsx(Hr,{className:"w-4 h-4"}),"Reject"]})]}),g.status==="approved"&&a.jsxs("span",{className:"flex items-center gap-2 px-4 py-2 bg-green-100 text-green-800 text-sm font-medium rounded-lg",children:[a.jsx(_r,{className:"w-4 h-4"}),"Approved"]}),g.status==="rejected"&&a.jsxs("span",{className:"flex items-center gap-2 px-4 py-2 bg-red-100 text-red-800 text-sm font-medium rounded-lg",children:[a.jsx(Hr,{className:"w-4 h-4"}),"Rejected"]}),a.jsx("a",{href:`/dispensaries/${g.dispensary_slug}`,target:"_blank",rel:"noopener noreferrer",className:"p-2 text-gray-400 hover:text-gray-600",children:a.jsx(Jr,{className:"w-4 h-4"})})]})]})},g.id))})})]})})}function yF(){const[e,t]=h.useState([]),[r,n]=h.useState([]),[i,s]=h.useState(!0),[o,l]=h.useState(!1),[c,d]=h.useState({user_name:"",store_id:"",allowed_ips:"",allowed_domains:""}),[u,f]=h.useState(null);h.useEffect(()=>{m(),p()},[]);const p=async()=>{try{const y=await B.getApiPermissionDispensaries();n(y.dispensaries)}catch(y){console.error("Failed to load dispensaries:",y)}},m=async()=>{s(!0);try{const y=await B.getApiPermissions();t(y.permissions)}catch(y){f({message:"Failed to load API permissions: "+y.message,type:"error"})}finally{s(!1)}},x=async y=>{if(y.preventDefault(),!c.user_name.trim()){f({message:"User name is required",type:"error"});return}if(!c.store_id){f({message:"Store is required",type:"error"});return}try{const w=await B.createApiPermission({...c,store_id:parseInt(c.store_id)});f({message:w.message,type:"success"}),d({user_name:"",store_id:"",allowed_ips:"",allowed_domains:""}),l(!1),m()}catch(w){f({message:"Failed to create permission: "+w.message,type:"error"})}},g=async y=>{try{await B.toggleApiPermission(y),f({message:"Permission status updated",type:"success"}),m()}catch(w){f({message:"Failed to toggle permission: "+w.message,type:"error"})}},b=async y=>{if(confirm("Are you sure you want to delete this API permission?"))try{await B.deleteApiPermission(y),f({message:"Permission deleted successfully",type:"success"}),m()}catch(w){f({message:"Failed to delete permission: "+w.message,type:"error"})}},v=y=>{navigator.clipboard.writeText(y),f({message:"API key copied to clipboard!",type:"success"})},j=y=>{if(!y)return"Never";const w=new Date(y);return w.toLocaleDateString()+" "+w.toLocaleTimeString()};return i?a.jsx(X,{children:a.jsx("div",{className:"p-6",children:a.jsx("div",{className:"text-center text-gray-600",children:"Loading API permissions..."})})}):a.jsx(X,{children:a.jsxs("div",{className:"p-6",children:[u&&a.jsx(Vn,{message:u.message,type:u.type,onClose:()=>f(null)}),a.jsxs("div",{className:"flex justify-between items-center mb-6",children:[a.jsx("h1",{className:"text-2xl font-bold",children:"API Permissions"}),a.jsx("button",{onClick:()=>l(!o),className:"px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700",children:o?"Cancel":"Add New Permission"})]}),a.jsxs("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4 mb-6",children:[a.jsx("h3",{className:"font-semibold text-blue-900 mb-2",children:"How it works:"}),a.jsx("p",{className:"text-blue-800 text-sm",children:"Users with valid permissions can access your API without entering tokens. Access is automatically validated based on their IP address and/or domain name."})]}),o&&a.jsxs("div",{className:"bg-white rounded-lg shadow-md p-6 mb-6",children:[a.jsx("h2",{className:"text-xl font-semibold mb-4",children:"Add New API User"}),a.jsxs("form",{onSubmit:x,children:[a.jsxs("div",{className:"mb-4",children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"User/Client Name *"}),a.jsx("input",{type:"text",value:c.user_name,onChange:y=>d({...c,user_name:y.target.value}),className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"e.g., My Website",required:!0}),a.jsx("p",{className:"text-sm text-gray-600 mt-1",children:"A friendly name to identify this API user"})]}),a.jsxs("div",{className:"mb-4",children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Store *"}),a.jsxs("select",{value:c.store_id,onChange:y=>d({...c,store_id:y.target.value}),className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",required:!0,children:[a.jsx("option",{value:"",children:"Select a store..."}),r.map(y=>a.jsx("option",{value:y.id,children:y.name},y.id))]}),a.jsx("p",{className:"text-sm text-gray-600 mt-1",children:"The store this API token can access"})]}),a.jsxs("div",{className:"mb-4",children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Allowed IP Addresses"}),a.jsx("textarea",{value:c.allowed_ips,onChange:y=>d({...c,allowed_ips:y.target.value}),rows:3,className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 font-mono text-sm",placeholder:`192.168.1.1 10.0.0.0/8 2001:db8::/32`}),a.jsxs("p",{className:"text-sm text-gray-600 mt-1",children:["One IP address or CIDR range per line. Leave empty to allow any IP.",a.jsx("br",{}),"Supports IPv4, IPv6, and CIDR notation (e.g., 192.168.0.0/24)"]})]}),a.jsxs("div",{className:"mb-4",children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Allowed Domains"}),a.jsx("textarea",{value:c.allowed_domains,onChange:y=>d({...c,allowed_domains:y.target.value}),rows:3,className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 font-mono text-sm",placeholder:`example.com *.example.com @@ -413,4 +408,4 @@ subdomain.example.com`}),a.jsx("p",{className:"text-sm text-gray-600 mt-1",child `).length-2," more"]})]}):a.jsx("span",{className:"text-gray-400 italic",children:"Any IP"})}),a.jsx("td",{className:"px-6 py-4",children:y.allowed_domains?a.jsxs("div",{className:"text-sm text-gray-600",children:[y.allowed_domains.split(` `).slice(0,2).join(", "),y.allowed_domains.split(` `).length>2&&a.jsxs("span",{className:"text-gray-400",children:[" +",y.allowed_domains.split(` -`).length-2," more"]})]}):a.jsx("span",{className:"text-gray-400 italic",children:"Any domain"})}),a.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:y.is_active?a.jsx("span",{className:"px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-green-100 text-green-800",children:"Active"}):a.jsx("span",{className:"px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-red-100 text-red-800",children:"Disabled"})}),a.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-600",children:j(y.last_used_at)}),a.jsxs("td",{className:"px-6 py-4 whitespace-nowrap text-sm space-x-2",children:[a.jsx("button",{onClick:()=>g(y.id),className:"text-blue-600 hover:text-blue-800",children:y.is_active?"Disable":"Enable"}),a.jsx("button",{onClick:()=>b(y.id),className:"text-red-600 hover:text-red-800",children:"Delete"})]})]},y.id))})]})})]})]})})}function j7(){const[e,t]=h.useState([]),[r,n]=h.useState([]),[i,s]=h.useState(null),[o,l]=h.useState(null),[c,d]=h.useState(!0),[u,f]=h.useState(!0),[p,m]=h.useState("schedules"),[x,g]=h.useState(null),[b,v]=h.useState(!1),[j,y]=h.useState(!1),[w,S]=h.useState(null);h.useEffect(()=>{if(N(),u){const k=setInterval(N,1e4);return()=>clearInterval(k)}},[u]);const N=async()=>{try{const[k,L,U,H]=await Promise.all([B.getDutchieAZSchedules(),B.getDutchieAZRunLogs({limit:50}),B.getDutchieAZSchedulerStatus(),B.getDetectionStats().catch(()=>null)]);t(k.schedules||[]),n(L.logs||[]),s(U),l(H)}catch(k){console.error("Failed to load schedule data:",k)}finally{d(!1)}},P=async()=>{try{i!=null&&i.running?await B.stopDutchieAZScheduler():await B.startDutchieAZScheduler(),await N()}catch(k){console.error("Failed to toggle scheduler:",k)}},_=async()=>{try{await B.initDutchieAZSchedules(),await N()}catch(k){console.error("Failed to initialize schedules:",k)}},T=async k=>{try{await B.triggerDutchieAZSchedule(k),await N()}catch(L){console.error("Failed to trigger schedule:",L)}},$=async k=>{try{await B.updateDutchieAZSchedule(k.id,{enabled:!k.enabled}),await N()}catch(L){console.error("Failed to toggle schedule:",L)}},M=async(k,L)=>{try{const U={description:L.description??void 0,enabled:L.enabled,baseIntervalMinutes:L.baseIntervalMinutes,jitterMinutes:L.jitterMinutes,jobConfig:L.jobConfig??void 0};await B.updateDutchieAZSchedule(k,U),g(null),await N()}catch(U){console.error("Failed to update schedule:",U)}},C=async()=>{if(confirm("Run menu detection on all dispensaries with unknown/missing menu_type?")){y(!0),S(null);try{const k=await B.detectAllDispensaries({state:"AZ",onlyUnknown:!0});S(k),await N()}catch(k){console.error("Failed to run bulk detection:",k)}finally{y(!1)}}},R=async()=>{if(confirm("Resolve platform IDs for all Dutchie dispensaries missing them?")){y(!0),S(null);try{const k=await B.detectAllDispensaries({state:"AZ",onlyMissingPlatformId:!0,onlyUnknown:!1});S(k),await N()}catch(k){console.error("Failed to resolve platform IDs:",k)}finally{y(!1)}}},q=k=>{if(!k)return"Never";const L=new Date(k),H=new Date().getTime()-L.getTime(),te=Math.floor(H/6e4),re=Math.floor(te/60),we=Math.floor(re/24);return te<1?"Just now":te<60?`${te}m ago`:re<24?`${re}h ago`:`${we}d ago`},Z=k=>{if(!k)return"Not scheduled";const L=new Date(k),U=new Date,H=L.getTime()-U.getTime();if(H<0)return"Overdue";const te=Math.floor(H/6e4),re=Math.floor(te/60);return te<60?`${te}m`:`${re}h ${te%60}m`},E=k=>{if(!k)return"-";if(k<1e3)return`${k}ms`;const L=Math.floor(k/1e3),U=Math.floor(L/60);return U<1?`${L}s`:`${U}m ${L%60}s`},D=(k,L)=>{const U=Math.floor(k/60),H=k%60,te=Math.floor(L/60),re=L%60;let we=U>0?`${U}h`:"";H>0&&(we+=`${H}m`);let A=te>0?`${te}h`:"";return re>0&&(A+=`${re}m`),`${we} +/- ${A}`},O=k=>{switch(k){case"success":return{bg:"#d1fae5",color:"#065f46"};case"running":return{bg:"#dbeafe",color:"#1e40af"};case"error":return{bg:"#fee2e2",color:"#991b1b"};case"partial":return{bg:"#fef3c7",color:"#92400e"};default:return{bg:"#f3f4f6",color:"#374151"}}};return a.jsx(X,{children:a.jsxs("div",{children:[a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"30px"},children:[a.jsxs("div",{children:[a.jsx("h1",{style:{fontSize:"32px",margin:0},children:"Dutchie AZ Schedule"}),a.jsx("p",{style:{color:"#666",margin:"8px 0 0 0"},children:"Jittered scheduling for Arizona Dutchie product crawls"})]}),a.jsx("div",{style:{display:"flex",gap:"15px",alignItems:"center"},children:a.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"10px",cursor:"pointer"},children:[a.jsx("input",{type:"checkbox",checked:u,onChange:k=>f(k.target.checked),style:{width:"18px",height:"18px",cursor:"pointer"}}),a.jsx("span",{children:"Auto-refresh (10s)"})]})})]}),a.jsxs("div",{style:{background:"white",padding:"20px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",marginBottom:"30px",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"20px"},children:[a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:"14px",color:"#666",marginBottom:"4px"},children:"Scheduler Status"}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[a.jsx("span",{style:{width:"12px",height:"12px",borderRadius:"50%",background:i!=null&&i.running?"#10b981":"#ef4444",display:"inline-block"}}),a.jsx("span",{style:{fontWeight:"600",fontSize:"18px"},children:i!=null&&i.running?"Running":"Stopped"})]})]}),a.jsxs("div",{style:{borderLeft:"1px solid #eee",paddingLeft:"20px"},children:[a.jsx("div",{style:{fontSize:"14px",color:"#666",marginBottom:"4px"},children:"Poll Interval"}),a.jsx("div",{style:{fontWeight:"600"},children:i?`${i.pollIntervalMs/1e3}s`:"-"})]}),a.jsxs("div",{style:{borderLeft:"1px solid #eee",paddingLeft:"20px"},children:[a.jsx("div",{style:{fontSize:"14px",color:"#666",marginBottom:"4px"},children:"Active Schedules"}),a.jsxs("div",{style:{fontWeight:"600"},children:[e.filter(k=>k.enabled).length," / ",e.length]})]})]}),a.jsxs("div",{style:{display:"flex",gap:"10px"},children:[a.jsx("button",{onClick:P,style:{padding:"10px 20px",background:i!=null&&i.running?"#ef4444":"#10b981",color:"white",border:"none",borderRadius:"6px",cursor:"pointer",fontWeight:"600"},children:i!=null&&i.running?"Stop Scheduler":"Start Scheduler"}),e.length===0&&a.jsx("button",{onClick:_,style:{padding:"10px 20px",background:"#2563eb",color:"white",border:"none",borderRadius:"6px",cursor:"pointer",fontWeight:"600"},children:"Initialize Default Schedules"})]})]}),a.jsxs("div",{style:{marginBottom:"30px",display:"flex",gap:"10px",borderBottom:"2px solid #eee"},children:[a.jsxs("button",{onClick:()=>m("schedules"),style:{padding:"12px 24px",background:p==="schedules"?"white":"transparent",border:"none",borderBottom:p==="schedules"?"3px solid #2563eb":"3px solid transparent",cursor:"pointer",fontSize:"16px",fontWeight:p==="schedules"?"600":"400",color:p==="schedules"?"#2563eb":"#666",marginBottom:"-2px"},children:["Schedule Configs (",e.length,")"]}),a.jsxs("button",{onClick:()=>m("logs"),style:{padding:"12px 24px",background:p==="logs"?"white":"transparent",border:"none",borderBottom:p==="logs"?"3px solid #2563eb":"3px solid transparent",cursor:"pointer",fontSize:"16px",fontWeight:p==="logs"?"600":"400",color:p==="logs"?"#2563eb":"#666",marginBottom:"-2px"},children:["Run Logs (",r.length,")"]}),a.jsxs("button",{onClick:()=>m("detection"),style:{padding:"12px 24px",background:p==="detection"?"white":"transparent",border:"none",borderBottom:p==="detection"?"3px solid #2563eb":"3px solid transparent",cursor:"pointer",fontSize:"16px",fontWeight:p==="detection"?"600":"400",color:p==="detection"?"#2563eb":"#666",marginBottom:"-2px"},children:["Menu Detection ",o!=null&&o.needsDetection?`(${o.needsDetection} pending)`:""]})]}),p==="schedules"&&a.jsx("div",{style:{background:"white",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",overflow:"hidden"},children:e.length===0?a.jsx("div",{style:{padding:"40px",textAlign:"center",color:"#666"},children:'No schedules configured. Click "Initialize Default Schedules" to create the default crawl schedule.'}):a.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[a.jsx("thead",{children:a.jsxs("tr",{style:{background:"#f8f8f8",borderBottom:"2px solid #eee"},children:[a.jsx("th",{style:{padding:"15px",textAlign:"left",fontWeight:"600"},children:"Job Name"}),a.jsx("th",{style:{padding:"15px",textAlign:"center",fontWeight:"600"},children:"Enabled"}),a.jsx("th",{style:{padding:"15px",textAlign:"center",fontWeight:"600"},children:"Interval (Jitter)"}),a.jsx("th",{style:{padding:"15px",textAlign:"left",fontWeight:"600"},children:"Last Run"}),a.jsx("th",{style:{padding:"15px",textAlign:"left",fontWeight:"600"},children:"Next Run"}),a.jsx("th",{style:{padding:"15px",textAlign:"left",fontWeight:"600"},children:"Last Status"}),a.jsx("th",{style:{padding:"15px",textAlign:"center",fontWeight:"600"},children:"Actions"})]})}),a.jsx("tbody",{children:e.map(k=>a.jsxs("tr",{style:{borderBottom:"1px solid #eee"},children:[a.jsxs("td",{style:{padding:"15px"},children:[a.jsx("div",{style:{fontWeight:"600"},children:k.jobName}),k.description&&a.jsx("div",{style:{fontSize:"13px",color:"#666",marginTop:"4px"},children:k.description}),k.jobConfig&&a.jsxs("div",{style:{fontSize:"11px",color:"#999",marginTop:"4px"},children:["Config: ",JSON.stringify(k.jobConfig)]})]}),a.jsx("td",{style:{padding:"15px",textAlign:"center"},children:a.jsx("button",{onClick:()=>$(k),style:{padding:"4px 12px",borderRadius:"12px",border:"none",cursor:"pointer",fontWeight:"600",fontSize:"12px",background:k.enabled?"#d1fae5":"#fee2e2",color:k.enabled?"#065f46":"#991b1b"},children:k.enabled?"ON":"OFF"})}),a.jsx("td",{style:{padding:"15px",textAlign:"center"},children:a.jsx("div",{style:{fontWeight:"600"},children:D(k.baseIntervalMinutes,k.jitterMinutes)})}),a.jsxs("td",{style:{padding:"15px"},children:[a.jsx("div",{children:q(k.lastRunAt)}),k.lastDurationMs&&a.jsxs("div",{style:{fontSize:"12px",color:"#666"},children:["Duration: ",E(k.lastDurationMs)]})]}),a.jsxs("td",{style:{padding:"15px"},children:[a.jsx("div",{style:{fontWeight:"600",color:"#2563eb"},children:Z(k.nextRunAt)}),k.nextRunAt&&a.jsx("div",{style:{fontSize:"12px",color:"#999"},children:new Date(k.nextRunAt).toLocaleString()})]}),a.jsx("td",{style:{padding:"15px"},children:k.lastStatus?a.jsxs("div",{children:[a.jsx("span",{style:{padding:"4px 10px",borderRadius:"12px",fontSize:"12px",fontWeight:"600",...O(k.lastStatus)},children:k.lastStatus}),k.lastErrorMessage&&a.jsx("button",{onClick:()=>alert(k.lastErrorMessage),style:{marginLeft:"8px",padding:"2px 6px",background:"#fee2e2",color:"#991b1b",border:"none",borderRadius:"4px",cursor:"pointer",fontSize:"10px"},children:"Error"})]}):a.jsx("span",{style:{color:"#999"},children:"Never run"})}),a.jsx("td",{style:{padding:"15px",textAlign:"center"},children:a.jsxs("div",{style:{display:"flex",gap:"8px",justifyContent:"center"},children:[a.jsx("button",{onClick:()=>T(k.id),disabled:k.lastStatus==="running",style:{padding:"6px 12px",background:k.lastStatus==="running"?"#94a3b8":"#2563eb",color:"white",border:"none",borderRadius:"4px",cursor:k.lastStatus==="running"?"not-allowed":"pointer",fontSize:"13px"},children:"Run Now"}),a.jsx("button",{onClick:()=>g(k),style:{padding:"6px 12px",background:"#f3f4f6",color:"#374151",border:"none",borderRadius:"4px",cursor:"pointer",fontSize:"13px"},children:"Edit"})]})})]},k.id))})]})}),p==="logs"&&a.jsx("div",{style:{background:"white",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",overflow:"hidden"},children:r.length===0?a.jsx("div",{style:{padding:"40px",textAlign:"center",color:"#666"},children:"No run logs yet. Logs will appear here after jobs execute."}):a.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[a.jsx("thead",{children:a.jsxs("tr",{style:{background:"#f8f8f8",borderBottom:"2px solid #eee"},children:[a.jsx("th",{style:{padding:"15px",textAlign:"left",fontWeight:"600"},children:"Job"}),a.jsx("th",{style:{padding:"15px",textAlign:"center",fontWeight:"600"},children:"Status"}),a.jsx("th",{style:{padding:"15px",textAlign:"left",fontWeight:"600"},children:"Started"}),a.jsx("th",{style:{padding:"15px",textAlign:"right",fontWeight:"600"},children:"Duration"}),a.jsx("th",{style:{padding:"15px",textAlign:"right",fontWeight:"600"},children:"Processed"}),a.jsx("th",{style:{padding:"15px",textAlign:"right",fontWeight:"600"},children:"Succeeded"}),a.jsx("th",{style:{padding:"15px",textAlign:"right",fontWeight:"600"},children:"Failed"})]})}),a.jsx("tbody",{children:r.map(k=>a.jsxs("tr",{style:{borderBottom:"1px solid #eee"},children:[a.jsxs("td",{style:{padding:"15px"},children:[a.jsx("div",{style:{fontWeight:"600"},children:k.job_name}),a.jsxs("div",{style:{fontSize:"12px",color:"#999"},children:["Run #",k.id]})]}),a.jsxs("td",{style:{padding:"15px",textAlign:"center"},children:[a.jsx("span",{style:{padding:"4px 10px",borderRadius:"12px",fontSize:"12px",fontWeight:"600",...O(k.status)},children:k.status}),k.error_message&&a.jsx("button",{onClick:()=>alert(k.error_message),style:{marginLeft:"8px",padding:"2px 6px",background:"#fee2e2",color:"#991b1b",border:"none",borderRadius:"4px",cursor:"pointer",fontSize:"10px"},children:"Error"})]}),a.jsxs("td",{style:{padding:"15px"},children:[a.jsx("div",{children:k.started_at?new Date(k.started_at).toLocaleString():"-"}),a.jsx("div",{style:{fontSize:"12px",color:"#999"},children:q(k.started_at)})]}),a.jsx("td",{style:{padding:"15px",textAlign:"right",fontWeight:"600"},children:E(k.duration_ms)}),a.jsx("td",{style:{padding:"15px",textAlign:"right"},children:k.items_processed??"-"}),a.jsx("td",{style:{padding:"15px",textAlign:"right",color:"#10b981"},children:k.items_succeeded??"-"}),a.jsx("td",{style:{padding:"15px",textAlign:"right",color:k.items_failed?"#ef4444":"inherit"},children:k.items_failed??"-"})]},k.id))})]})}),p==="detection"&&a.jsxs("div",{style:{background:"white",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",padding:"30px"},children:[o&&a.jsxs("div",{style:{marginBottom:"30px"},children:[a.jsx("h3",{style:{margin:"0 0 20px 0"},children:"Detection Statistics"}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(150px, 1fr))",gap:"20px"},children:[a.jsxs("div",{style:{padding:"20px",background:"#f8f8f8",borderRadius:"8px",textAlign:"center"},children:[a.jsx("div",{style:{fontSize:"32px",fontWeight:"700",color:"#2563eb"},children:o.totalDispensaries}),a.jsx("div",{style:{color:"#666",marginTop:"4px"},children:"Total Dispensaries"})]}),a.jsxs("div",{style:{padding:"20px",background:"#f8f8f8",borderRadius:"8px",textAlign:"center"},children:[a.jsx("div",{style:{fontSize:"32px",fontWeight:"700",color:"#10b981"},children:o.withMenuType}),a.jsx("div",{style:{color:"#666",marginTop:"4px"},children:"With Menu Type"})]}),a.jsxs("div",{style:{padding:"20px",background:"#f8f8f8",borderRadius:"8px",textAlign:"center"},children:[a.jsx("div",{style:{fontSize:"32px",fontWeight:"700",color:"#10b981"},children:o.withPlatformId}),a.jsx("div",{style:{color:"#666",marginTop:"4px"},children:"With Platform ID"})]}),a.jsxs("div",{style:{padding:"20px",background:"#fef3c7",borderRadius:"8px",textAlign:"center"},children:[a.jsx("div",{style:{fontSize:"32px",fontWeight:"700",color:"#92400e"},children:o.needsDetection}),a.jsx("div",{style:{color:"#666",marginTop:"4px"},children:"Needs Detection"})]})]}),Object.keys(o.byProvider).length>0&&a.jsxs("div",{style:{marginTop:"20px"},children:[a.jsx("h4",{style:{margin:"0 0 10px 0"},children:"By Provider"}),a.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"10px"},children:Object.entries(o.byProvider).map(([k,L])=>a.jsxs("span",{style:{padding:"6px 14px",background:k==="dutchie"?"#dbeafe":"#f3f4f6",borderRadius:"16px",fontSize:"14px",fontWeight:"600"},children:[k,": ",L]},k))})]})]}),a.jsxs("div",{style:{marginBottom:"30px",display:"flex",gap:"15px",flexWrap:"wrap"},children:[a.jsx("button",{onClick:C,disabled:j||!(o!=null&&o.needsDetection),style:{padding:"12px 24px",background:j?"#94a3b8":"#2563eb",color:"white",border:"none",borderRadius:"6px",cursor:j?"not-allowed":"pointer",fontWeight:"600",fontSize:"14px"},children:j?"Detecting...":"Detect All Unknown"}),a.jsx("button",{onClick:R,disabled:j,style:{padding:"12px 24px",background:j?"#94a3b8":"#10b981",color:"white",border:"none",borderRadius:"6px",cursor:j?"not-allowed":"pointer",fontWeight:"600",fontSize:"14px"},children:j?"Resolving...":"Resolve Missing Platform IDs"})]}),w&&a.jsxs("div",{style:{marginBottom:"30px",padding:"20px",background:"#f8f8f8",borderRadius:"8px"},children:[a.jsx("h4",{style:{margin:"0 0 15px 0"},children:"Detection Results"}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:"15px",marginBottom:"15px"},children:[a.jsxs("div",{children:[a.jsx("div",{style:{fontWeight:"600",fontSize:"24px"},children:w.totalProcessed}),a.jsx("div",{style:{color:"#666",fontSize:"13px"},children:"Processed"})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontWeight:"600",fontSize:"24px",color:"#10b981"},children:w.totalSucceeded}),a.jsx("div",{style:{color:"#666",fontSize:"13px"},children:"Succeeded"})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontWeight:"600",fontSize:"24px",color:"#ef4444"},children:w.totalFailed}),a.jsx("div",{style:{color:"#666",fontSize:"13px"},children:"Failed"})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontWeight:"600",fontSize:"24px",color:"#666"},children:w.totalSkipped}),a.jsx("div",{style:{color:"#666",fontSize:"13px"},children:"Skipped"})]})]}),w.errors&&w.errors.length>0&&a.jsxs("div",{style:{marginTop:"15px"},children:[a.jsx("div",{style:{fontWeight:"600",marginBottom:"8px",color:"#991b1b"},children:"Errors:"}),a.jsxs("div",{style:{maxHeight:"150px",overflow:"auto",background:"#fee2e2",padding:"10px",borderRadius:"4px",fontSize:"12px"},children:[w.errors.slice(0,10).map((k,L)=>a.jsx("div",{style:{marginBottom:"4px"},children:k},L)),w.errors.length>10&&a.jsxs("div",{style:{fontStyle:"italic",marginTop:"8px"},children:["...and ",w.errors.length-10," more"]})]})]})]}),a.jsxs("div",{style:{padding:"20px",background:"#f0f9ff",borderRadius:"8px",fontSize:"14px"},children:[a.jsx("h4",{style:{margin:"0 0 10px 0",color:"#1e40af"},children:"About Menu Detection"}),a.jsxs("ul",{style:{margin:0,paddingLeft:"20px",color:"#1e40af"},children:[a.jsxs("li",{style:{marginBottom:"8px"},children:[a.jsx("strong",{children:"Detect All Unknown:"})," Scans dispensaries with no menu_type set and detects the provider (dutchie, treez, jane, etc.) from their menu_url."]}),a.jsxs("li",{style:{marginBottom:"8px"},children:[a.jsx("strong",{children:"Resolve Missing Platform IDs:"}),' For dispensaries already detected as "dutchie", extracts the cName from menu_url and resolves the platform_dispensary_id via GraphQL.']}),a.jsxs("li",{children:[a.jsx("strong",{children:"Automatic scheduling:"}),' A "Menu Detection" job runs daily (24h +/- 1h jitter) to detect new dispensaries.']})]})]})]}),x&&a.jsx("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,background:"rgba(0,0,0,0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3},children:a.jsxs("div",{style:{background:"white",padding:"30px",borderRadius:"12px",width:"500px",maxWidth:"90vw"},children:[a.jsxs("h2",{style:{margin:"0 0 20px 0"},children:["Edit Schedule: ",x.jobName]}),a.jsxs("div",{style:{marginBottom:"20px"},children:[a.jsx("label",{style:{display:"block",marginBottom:"8px",fontWeight:"600"},children:"Description"}),a.jsx("input",{type:"text",value:x.description||"",onChange:k=>g({...x,description:k.target.value}),style:{width:"100%",padding:"10px",borderRadius:"6px",border:"1px solid #ddd",fontSize:"14px"}})]}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"20px",marginBottom:"20px"},children:[a.jsxs("div",{children:[a.jsx("label",{style:{display:"block",marginBottom:"8px",fontWeight:"600"},children:"Base Interval (minutes)"}),a.jsx("input",{type:"number",value:x.baseIntervalMinutes,onChange:k=>g({...x,baseIntervalMinutes:parseInt(k.target.value)||240}),style:{width:"100%",padding:"10px",borderRadius:"6px",border:"1px solid #ddd",fontSize:"14px"}}),a.jsxs("div",{style:{fontSize:"12px",color:"#666",marginTop:"4px"},children:["= ",Math.floor(x.baseIntervalMinutes/60),"h ",x.baseIntervalMinutes%60,"m"]})]}),a.jsxs("div",{children:[a.jsx("label",{style:{display:"block",marginBottom:"8px",fontWeight:"600"},children:"Jitter (minutes)"}),a.jsx("input",{type:"number",value:x.jitterMinutes,onChange:k=>g({...x,jitterMinutes:parseInt(k.target.value)||30}),style:{width:"100%",padding:"10px",borderRadius:"6px",border:"1px solid #ddd",fontSize:"14px"}}),a.jsxs("div",{style:{fontSize:"12px",color:"#666",marginTop:"4px"},children:["+/- ",x.jitterMinutes,"m random offset"]})]})]}),a.jsxs("div",{style:{fontSize:"13px",color:"#666",marginBottom:"20px",padding:"15px",background:"#f8f8f8",borderRadius:"6px"},children:[a.jsx("strong",{children:"Effective range:"})," ",Math.floor((x.baseIntervalMinutes-x.jitterMinutes)/60),"h ",(x.baseIntervalMinutes-x.jitterMinutes)%60,"m"," to ",Math.floor((x.baseIntervalMinutes+x.jitterMinutes)/60),"h ",(x.baseIntervalMinutes+x.jitterMinutes)%60,"m"]}),a.jsxs("div",{style:{display:"flex",gap:"10px",justifyContent:"flex-end"},children:[a.jsx("button",{onClick:()=>g(null),style:{padding:"10px 20px",background:"#f3f4f6",color:"#374151",border:"none",borderRadius:"6px",cursor:"pointer"},children:"Cancel"}),a.jsx("button",{onClick:()=>M(x.id,{description:x.description,baseIntervalMinutes:x.baseIntervalMinutes,jitterMinutes:x.jitterMinutes}),style:{padding:"10px 20px",background:"#2563eb",color:"white",border:"none",borderRadius:"6px",cursor:"pointer",fontWeight:"600"},children:"Save Changes"})]})]})})]})})}function w7(){const e=dt(),[t,r]=h.useState([]),[n,i]=h.useState(0),[s,o]=h.useState(!0),[l,c]=h.useState(null);h.useEffect(()=>{d()},[]);const d=async()=>{o(!0);try{const[u,f]=await Promise.all([B.getDutchieAZStores({limit:200}),B.getDutchieAZDashboard()]);r(u.stores),i(u.total),c(f)}catch(u){console.error("Failed to load data:",u)}finally{o(!1)}};return s?a.jsx(X,{children:a.jsxs("div",{className:"text-center py-12",children:[a.jsx("div",{className:"inline-block animate-spin rounded-full h-8 w-8 border-4 border-blue-500 border-t-transparent"}),a.jsx("p",{className:"mt-2 text-sm text-gray-600",children:"Loading stores..."})]})}):a.jsx(X,{children:a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"Dutchie AZ Stores"}),a.jsx("p",{className:"text-sm text-gray-600 mt-1",children:"Arizona dispensaries using the Dutchie platform - data from the new pipeline"})]}),a.jsxs("button",{onClick:d,className:"flex items-center gap-2 px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg hover:bg-gray-50",children:[a.jsx(Xt,{className:"w-4 h-4"}),"Refresh"]})]}),l&&a.jsxs("div",{className:"grid grid-cols-4 gap-4",children:[a.jsx("div",{className:"bg-white rounded-lg border border-gray-200 p-4",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 bg-blue-50 rounded-lg",children:a.jsx(Ln,{className:"w-5 h-5 text-blue-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm text-gray-600",children:"Dispensaries"}),a.jsx("p",{className:"text-xl font-bold text-gray-900",children:l.dispensaryCount})]})]})}),a.jsx("div",{className:"bg-white rounded-lg border border-gray-200 p-4",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 bg-green-50 rounded-lg",children:a.jsx(Ct,{className:"w-5 h-5 text-green-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm text-gray-600",children:"Total Products"}),a.jsx("p",{className:"text-xl font-bold text-gray-900",children:l.productCount.toLocaleString()})]})]})}),a.jsx("div",{className:"bg-white rounded-lg border border-gray-200 p-4",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 bg-purple-50 rounded-lg",children:a.jsx(_r,{className:"w-5 h-5 text-purple-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm text-gray-600",children:"Brands"}),a.jsx("p",{className:"text-xl font-bold text-gray-900",children:l.brandCount})]})]})}),a.jsx("div",{className:"bg-white rounded-lg border border-gray-200 p-4",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 bg-orange-50 rounded-lg",children:a.jsx(Hr,{className:"w-5 h-5 text-orange-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm text-gray-600",children:"Failed Jobs (24h)"}),a.jsx("p",{className:"text-xl font-bold text-gray-900",children:l.failedJobCount})]})]})})]}),a.jsxs("div",{className:"bg-white rounded-lg border border-gray-200",children:[a.jsx("div",{className:"p-4 border-b border-gray-200",children:a.jsxs("h2",{className:"text-lg font-semibold text-gray-900",children:["All Stores (",n,")"]})}),a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"table table-zebra w-full",children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{children:"Name"}),a.jsx("th",{children:"City"}),a.jsx("th",{children:"Platform ID"}),a.jsx("th",{children:"Status"}),a.jsx("th",{children:"Actions"})]})}),a.jsx("tbody",{children:t.map(u=>a.jsxs("tr",{children:[a.jsx("td",{children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 bg-blue-50 rounded-lg",children:a.jsx(Ln,{className:"w-4 h-4 text-blue-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"font-medium text-gray-900",children:u.dba_name||u.name}),u.company_name&&u.company_name!==u.name&&a.jsx("p",{className:"text-xs text-gray-500",children:u.company_name})]})]})}),a.jsx("td",{children:a.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600",children:[a.jsx(yi,{className:"w-4 h-4"}),u.city,", ",u.state]})}),a.jsx("td",{children:u.platform_dispensary_id?a.jsx("span",{className:"text-xs font-mono text-gray-600",children:u.platform_dispensary_id}):a.jsx("span",{className:"badge badge-warning badge-sm",children:"Not Resolved"})}),a.jsx("td",{children:u.platform_dispensary_id?a.jsx("span",{className:"badge badge-success badge-sm",children:"Ready"}):a.jsx("span",{className:"badge badge-warning badge-sm",children:"Pending"})}),a.jsx("td",{children:a.jsx("button",{onClick:()=>e(`/az/stores/${u.id}`),className:"btn btn-sm btn-primary",disabled:!u.platform_dispensary_id,children:"View Products"})})]},u.id))})]})})]})]})})}function S7(){const{id:e}=Na(),t=dt(),[r,n]=h.useState(null),[i,s]=h.useState([]),[o,l]=h.useState(!0),[c,d]=h.useState(!1),[u,f]=h.useState("products"),[p,m]=h.useState(!1),[x,g]=h.useState(!1),[b,v]=h.useState(""),[j,y]=h.useState(1),[w,S]=h.useState(0),[N]=h.useState(25),[P,_]=h.useState(""),T=O=>{if(!O)return"Never";const k=new Date(O),U=new Date().getTime()-k.getTime(),H=Math.floor(U/(1e3*60*60*24));return H===0?"Today":H===1?"Yesterday":H<7?`${H} days ago`:k.toLocaleDateString()};h.useEffect(()=>{e&&$()},[e]),h.useEffect(()=>{e&&u==="products"&&M()},[e,j,b,P,u]),h.useEffect(()=>{y(1)},[b,P]);const $=async()=>{l(!0);try{const O=await B.getDutchieAZStoreSummary(parseInt(e,10));n(O)}catch(O){console.error("Failed to load store summary:",O)}finally{l(!1)}},M=async()=>{if(e){d(!0);try{const O=await B.getDutchieAZStoreProducts(parseInt(e,10),{search:b||void 0,stockStatus:P||void 0,limit:N,offset:(j-1)*N});s(O.products),S(O.total)}catch(O){console.error("Failed to load products:",O)}finally{d(!1)}}},C=async()=>{m(!1),g(!0);try{await B.triggerDutchieAZCrawl(parseInt(e,10)),alert("Crawl started! Refresh the page in a few minutes to see updated data.")}catch(O){console.error("Failed to trigger crawl:",O),alert("Failed to start crawl. Please try again.")}finally{g(!1)}},R=Math.ceil(w/N);if(o)return a.jsx(X,{children:a.jsxs("div",{className:"text-center py-12",children:[a.jsx("div",{className:"inline-block animate-spin rounded-full h-8 w-8 border-4 border-blue-500 border-t-transparent"}),a.jsx("p",{className:"mt-2 text-sm text-gray-600",children:"Loading store..."})]})});if(!r)return a.jsx(X,{children:a.jsx("div",{className:"text-center py-12",children:a.jsx("p",{className:"text-gray-600",children:"Store not found"})})});const{dispensary:q,brands:Z,categories:E,lastCrawl:D}=r;return a.jsx(X,{children:a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-center justify-between gap-4",children:[a.jsxs("button",{onClick:()=>t("/az"),className:"flex items-center gap-2 text-sm text-gray-600 hover:text-gray-900",children:[a.jsx(_h,{className:"w-4 h-4"}),"Back to AZ Stores"]}),a.jsxs("div",{className:"relative",children:[a.jsxs("button",{onClick:()=>m(!p),disabled:x,className:"flex items-center gap-2 px-4 py-2 text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 rounded-lg disabled:opacity-50 disabled:cursor-not-allowed",children:[a.jsx(Xt,{className:`w-4 h-4 ${x?"animate-spin":""}`}),x?"Crawling...":"Crawl Now",!x&&a.jsx(ej,{className:"w-4 h-4"})]}),p&&!x&&a.jsx("div",{className:"absolute right-0 mt-2 w-48 bg-white rounded-lg shadow-lg border border-gray-200 z-10",children:a.jsx("button",{onClick:C,className:"w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 rounded-lg",children:"Start Full Crawl"})})]})]}),a.jsxs("div",{className:"bg-white rounded-lg border border-gray-200 p-6",children:[a.jsxs("div",{className:"flex items-start justify-between gap-4 mb-4",children:[a.jsxs("div",{className:"flex items-start gap-4",children:[a.jsx("div",{className:"p-3 bg-blue-50 rounded-lg",children:a.jsx(Ln,{className:"w-8 h-8 text-blue-600"})}),a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:q.dba_name||q.name}),q.company_name&&a.jsx("p",{className:"text-sm text-gray-600 mt-1",children:q.company_name}),a.jsxs("p",{className:"text-xs text-gray-500 mt-1",children:["Platform ID: ",q.platform_dispensary_id||"Not resolved"]})]})]}),a.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600 bg-gray-50 px-4 py-2 rounded-lg",children:[a.jsx(xr,{className:"w-4 h-4"}),a.jsxs("div",{children:[a.jsx("span",{className:"font-medium",children:"Last Crawl:"}),a.jsx("span",{className:"ml-2",children:D!=null&&D.completed_at?new Date(D.completed_at).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"Never"}),(D==null?void 0:D.status)&&a.jsx("span",{className:`ml-2 px-2 py-0.5 rounded text-xs ${D.status==="completed"?"bg-green-100 text-green-800":D.status==="failed"?"bg-red-100 text-red-800":"bg-yellow-100 text-yellow-800"}`,children:D.status})]})]})]}),a.jsxs("div",{className:"flex flex-wrap gap-4",children:[q.address&&a.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600",children:[a.jsx(yi,{className:"w-4 h-4"}),a.jsxs("span",{children:[q.address,", ",q.city,", ",q.state," ",q.zip]})]}),q.phone&&a.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600",children:[a.jsx(Ah,{className:"w-4 h-4"}),a.jsx("span",{children:q.phone})]}),q.website&&a.jsxs("a",{href:q.website,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 text-sm text-blue-600 hover:text-blue-800",children:[a.jsx(Jr,{className:"w-4 h-4"}),"Website"]})]})]}),a.jsxs("div",{className:"grid grid-cols-5 gap-4",children:[a.jsx("button",{onClick:()=>{f("products"),_(""),v("")},className:`bg-white rounded-lg border p-4 hover:border-blue-300 hover:shadow-md transition-all cursor-pointer text-left ${u==="products"&&!P?"border-blue-500":"border-gray-200"}`,children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 bg-green-50 rounded-lg",children:a.jsx(Ct,{className:"w-5 h-5 text-green-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm text-gray-600",children:"Total Products"}),a.jsx("p",{className:"text-xl font-bold text-gray-900",children:r.totalProducts})]})]})}),a.jsx("button",{onClick:()=>{f("products"),_("in_stock"),v("")},className:`bg-white rounded-lg border p-4 hover:border-blue-300 hover:shadow-md transition-all cursor-pointer text-left ${P==="in_stock"?"border-blue-500":"border-gray-200"}`,children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 bg-emerald-50 rounded-lg",children:a.jsx(_r,{className:"w-5 h-5 text-emerald-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm text-gray-600",children:"In Stock"}),a.jsx("p",{className:"text-xl font-bold text-gray-900",children:r.inStockCount})]})]})}),a.jsx("button",{onClick:()=>{f("products"),_("out_of_stock"),v("")},className:`bg-white rounded-lg border p-4 hover:border-blue-300 hover:shadow-md transition-all cursor-pointer text-left ${P==="out_of_stock"?"border-blue-500":"border-gray-200"}`,children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 bg-red-50 rounded-lg",children:a.jsx(Hr,{className:"w-5 h-5 text-red-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm text-gray-600",children:"Out of Stock"}),a.jsx("p",{className:"text-xl font-bold text-gray-900",children:r.outOfStockCount})]})]})}),a.jsx("button",{onClick:()=>f("brands"),className:`bg-white rounded-lg border p-4 hover:border-blue-300 hover:shadow-md transition-all cursor-pointer text-left ${u==="brands"?"border-blue-500":"border-gray-200"}`,children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 bg-purple-50 rounded-lg",children:a.jsx(Cr,{className:"w-5 h-5 text-purple-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm text-gray-600",children:"Brands"}),a.jsx("p",{className:"text-xl font-bold text-gray-900",children:r.brandCount})]})]})}),a.jsx("button",{onClick:()=>f("categories"),className:`bg-white rounded-lg border p-4 hover:border-blue-300 hover:shadow-md transition-all cursor-pointer text-left ${u==="categories"?"border-blue-500":"border-gray-200"}`,children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 bg-orange-50 rounded-lg",children:a.jsx(Uc,{className:"w-5 h-5 text-orange-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm text-gray-600",children:"Categories"}),a.jsx("p",{className:"text-xl font-bold text-gray-900",children:r.categoryCount})]})]})})]}),a.jsxs("div",{className:"bg-white rounded-lg border border-gray-200",children:[a.jsx("div",{className:"border-b border-gray-200",children:a.jsxs("div",{className:"flex gap-4 px-6",children:[a.jsxs("button",{onClick:()=>{f("products"),_("")},className:`py-4 px-2 text-sm font-medium border-b-2 ${u==="products"?"border-blue-600 text-blue-600":"border-transparent text-gray-600 hover:text-gray-900"}`,children:["Products (",r.totalProducts,")"]}),a.jsxs("button",{onClick:()=>f("brands"),className:`py-4 px-2 text-sm font-medium border-b-2 ${u==="brands"?"border-blue-600 text-blue-600":"border-transparent text-gray-600 hover:text-gray-900"}`,children:["Brands (",r.brandCount,")"]}),a.jsxs("button",{onClick:()=>f("categories"),className:`py-4 px-2 text-sm font-medium border-b-2 ${u==="categories"?"border-blue-600 text-blue-600":"border-transparent text-gray-600 hover:text-gray-900"}`,children:["Categories (",r.categoryCount,")"]})]})}),a.jsxs("div",{className:"p-6",children:[u==="products"&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center gap-4 mb-4",children:[a.jsx("input",{type:"text",placeholder:"Search products by name or brand...",value:b,onChange:O=>v(O.target.value),className:"input input-bordered input-sm flex-1"}),a.jsxs("select",{value:P,onChange:O=>_(O.target.value),className:"select select-bordered select-sm",children:[a.jsx("option",{value:"",children:"All Stock"}),a.jsx("option",{value:"in_stock",children:"In Stock"}),a.jsx("option",{value:"out_of_stock",children:"Out of Stock"}),a.jsx("option",{value:"unknown",children:"Unknown"})]}),(b||P)&&a.jsx("button",{onClick:()=>{v(""),_("")},className:"btn btn-sm btn-ghost",children:"Clear"}),a.jsxs("div",{className:"text-sm text-gray-600",children:[w," products"]})]}),c?a.jsxs("div",{className:"text-center py-8",children:[a.jsx("div",{className:"inline-block animate-spin rounded-full h-6 w-6 border-4 border-blue-500 border-t-transparent"}),a.jsx("p",{className:"mt-2 text-sm text-gray-600",children:"Loading products..."})]}):i.length===0?a.jsx("p",{className:"text-center py-8 text-gray-500",children:"No products found"}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"overflow-x-auto -mx-6 px-6",children:a.jsxs("table",{className:"table table-xs table-zebra table-pin-rows w-full",children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{children:"Image"}),a.jsx("th",{children:"Product Name"}),a.jsx("th",{children:"Brand"}),a.jsx("th",{children:"Type"}),a.jsx("th",{className:"text-right",children:"Price"}),a.jsx("th",{className:"text-center",children:"THC %"}),a.jsx("th",{className:"text-center",children:"Stock"}),a.jsx("th",{className:"text-center",children:"Qty"}),a.jsx("th",{children:"Last Updated"})]})}),a.jsx("tbody",{children:i.map(O=>a.jsxs("tr",{children:[a.jsx("td",{className:"whitespace-nowrap",children:O.image_url?a.jsx("img",{src:O.image_url,alt:O.name,className:"w-12 h-12 object-cover rounded",onError:k=>k.currentTarget.style.display="none"}):"-"}),a.jsx("td",{className:"font-medium max-w-[200px]",children:a.jsx("div",{className:"line-clamp-2",title:O.name,children:O.name})}),a.jsx("td",{className:"max-w-[120px]",children:a.jsx("div",{className:"line-clamp-2",title:O.brand||"-",children:O.brand||"-"})}),a.jsxs("td",{className:"whitespace-nowrap",children:[a.jsx("span",{className:"badge badge-ghost badge-sm",children:O.type||"-"}),O.subcategory&&a.jsx("span",{className:"badge badge-ghost badge-sm ml-1",children:O.subcategory})]}),a.jsx("td",{className:"text-right font-semibold whitespace-nowrap",children:O.sale_price?a.jsxs("div",{className:"flex flex-col items-end",children:[a.jsxs("span",{className:"text-error",children:["$",O.sale_price]}),a.jsxs("span",{className:"text-gray-400 line-through text-xs",children:["$",O.regular_price]})]}):O.regular_price?`$${O.regular_price}`:"-"}),a.jsx("td",{className:"text-center whitespace-nowrap",children:O.thc_percentage?a.jsxs("span",{className:"badge badge-success badge-sm",children:[O.thc_percentage,"%"]}):"-"}),a.jsx("td",{className:"text-center whitespace-nowrap",children:O.stock_status==="in_stock"?a.jsx("span",{className:"badge badge-success badge-sm",children:"In Stock"}):O.stock_status==="out_of_stock"?a.jsx("span",{className:"badge badge-error badge-sm",children:"Out"}):a.jsx("span",{className:"badge badge-warning badge-sm",children:"Unknown"})}),a.jsx("td",{className:"text-center whitespace-nowrap",children:O.total_quantity!=null?O.total_quantity:"-"}),a.jsx("td",{className:"whitespace-nowrap text-xs text-gray-500",children:O.updated_at?T(O.updated_at):"-"})]},O.id))})]})}),R>1&&a.jsxs("div",{className:"flex justify-center items-center gap-2 mt-4",children:[a.jsx("button",{onClick:()=>y(O=>Math.max(1,O-1)),disabled:j===1,className:"btn btn-sm btn-outline",children:"Previous"}),a.jsx("div",{className:"flex gap-1",children:Array.from({length:Math.min(5,R)},(O,k)=>{let L;return R<=5||j<=3?L=k+1:j>=R-2?L=R-4+k:L=j-2+k,a.jsx("button",{onClick:()=>y(L),className:`btn btn-sm ${j===L?"btn-primary":"btn-outline"}`,children:L},L)})}),a.jsx("button",{onClick:()=>y(O=>Math.min(R,O+1)),disabled:j===R,className:"btn btn-sm btn-outline",children:"Next"})]})]})]}),u==="brands"&&a.jsx("div",{className:"space-y-4",children:Z.length===0?a.jsx("p",{className:"text-center py-8 text-gray-500",children:"No brands found"}):a.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",children:Z.map(O=>a.jsxs("button",{onClick:()=>{f("products"),v(O.brand_name),_("")},className:"border border-gray-200 rounded-lg p-4 text-center hover:border-blue-300 hover:shadow-md transition-all cursor-pointer",children:[a.jsx("p",{className:"font-medium text-gray-900 line-clamp-2",children:O.brand_name}),a.jsxs("p",{className:"text-sm text-gray-600 mt-1",children:[O.product_count," product",O.product_count!==1?"s":""]})]},O.brand_name))})}),u==="categories"&&a.jsx("div",{className:"space-y-4",children:E.length===0?a.jsx("p",{className:"text-center py-8 text-gray-500",children:"No categories found"}):a.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",children:E.map((O,k)=>a.jsxs("div",{className:"border border-gray-200 rounded-lg p-4 text-center",children:[a.jsx("p",{className:"font-medium text-gray-900",children:O.type}),O.subcategory&&a.jsx("p",{className:"text-sm text-gray-600",children:O.subcategory}),a.jsxs("p",{className:"text-sm text-gray-500 mt-1",children:[O.product_count," product",O.product_count!==1?"s":""]})]},k))})})]})]})]})})}function N7(){const e=dt(),[t,r]=h.useState(null),[n,i]=h.useState([]),[s,o]=h.useState([]),[l,c]=h.useState([]),[d,u]=h.useState(!0),[f,p]=h.useState("overview");h.useEffect(()=>{m()},[]);const m=async()=>{u(!0);try{const[g,b,v,j]=await Promise.all([B.getDutchieAZDashboard(),B.getDutchieAZStores({limit:200}),B.getDutchieAZBrands?B.getDutchieAZBrands({limit:100}):Promise.resolve({brands:[]}),B.getDutchieAZCategories?B.getDutchieAZCategories():Promise.resolve({categories:[]})]);r(g),i(b.stores||[]),o(v.brands||[]),c(j.categories||[])}catch(g){console.error("Failed to load analytics data:",g)}finally{u(!1)}},x=g=>{if(!g)return"Never";const b=new Date(g),j=new Date().getTime()-b.getTime(),y=Math.floor(j/(1e3*60*60)),w=Math.floor(j/(1e3*60*60*24));return y<1?"Just now":y<24?`${y}h ago`:w===1?"Yesterday":w<7?`${w} days ago`:b.toLocaleDateString()};return d?a.jsx(X,{children:a.jsxs("div",{className:"text-center py-12",children:[a.jsx("div",{className:"inline-block animate-spin rounded-full h-8 w-8 border-4 border-blue-500 border-t-transparent"}),a.jsx("p",{className:"mt-2 text-sm text-gray-600",children:"Loading analytics..."})]})}):a.jsx(X,{children:a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"Wholesale & Inventory Analytics"}),a.jsx("p",{className:"text-sm text-gray-600 mt-1",children:"Arizona Dutchie dispensaries data overview"})]}),a.jsxs("button",{onClick:m,className:"flex items-center gap-2 px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg hover:bg-gray-50",children:[a.jsx(Xt,{className:"w-4 h-4"}),"Refresh"]})]}),a.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-7 gap-4",children:[a.jsx(Ii,{title:"Dispensaries",value:(t==null?void 0:t.dispensaryCount)||0,icon:a.jsx(Ln,{className:"w-5 h-5 text-blue-600"}),color:"blue"}),a.jsx(Ii,{title:"Total Products",value:(t==null?void 0:t.productCount)||0,icon:a.jsx(Ct,{className:"w-5 h-5 text-green-600"}),color:"green"}),a.jsx(Ii,{title:"Brands",value:(t==null?void 0:t.brandCount)||0,icon:a.jsx(Cr,{className:"w-5 h-5 text-purple-600"}),color:"purple"}),a.jsx(Ii,{title:"Categories",value:(t==null?void 0:t.categoryCount)||0,icon:a.jsx(Tx,{className:"w-5 h-5 text-orange-600"}),color:"orange"}),a.jsx(Ii,{title:"Snapshots (24h)",value:(t==null?void 0:t.snapshotCount24h)||0,icon:a.jsx(zn,{className:"w-5 h-5 text-cyan-600"}),color:"cyan"}),a.jsx(Ii,{title:"Failed Jobs (24h)",value:(t==null?void 0:t.failedJobCount)||0,icon:a.jsx(Uc,{className:"w-5 h-5 text-red-600"}),color:"red"}),a.jsxs("div",{className:"bg-white rounded-lg border border-gray-200 p-4",children:[a.jsxs("div",{className:"flex items-center gap-2 text-gray-600 mb-1",children:[a.jsx(xr,{className:"w-4 h-4"}),a.jsx("span",{className:"text-xs",children:"Last Crawl"})]}),a.jsx("p",{className:"text-sm font-semibold text-gray-900",children:x((t==null?void 0:t.lastCrawlTime)||null)})]})]}),a.jsxs("div",{className:"bg-white rounded-lg border border-gray-200",children:[a.jsx("div",{className:"border-b border-gray-200",children:a.jsxs("div",{className:"flex gap-4 px-6",children:[a.jsx(Vo,{active:f==="overview",onClick:()=>p("overview"),icon:a.jsx(HA,{className:"w-4 h-4"}),label:"Overview"}),a.jsx(Vo,{active:f==="stores",onClick:()=>p("stores"),icon:a.jsx(Ln,{className:"w-4 h-4"}),label:`Stores (${n.length})`}),a.jsx(Vo,{active:f==="brands",onClick:()=>p("brands"),icon:a.jsx(Cr,{className:"w-4 h-4"}),label:`Brands (${s.length})`}),a.jsx(Vo,{active:f==="categories",onClick:()=>p("categories"),icon:a.jsx(Tx,{className:"w-4 h-4"}),label:`Categories (${l.length})`})]})}),a.jsxs("div",{className:"p-6",children:[f==="overview"&&a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-4",children:"Top Stores by Products"}),a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:n.slice(0,6).map(g=>a.jsxs("button",{onClick:()=>e(`/az/stores/${g.id}`),className:"flex items-center justify-between p-4 bg-gray-50 rounded-lg hover:bg-gray-100 transition-colors text-left",children:[a.jsxs("div",{children:[a.jsx("p",{className:"font-medium text-gray-900",children:g.dba_name||g.name}),a.jsxs("p",{className:"text-sm text-gray-600",children:[g.city,", ",g.state]}),a.jsxs("p",{className:"text-xs text-gray-500 mt-1",children:["Last crawl: ",x(g.last_crawl_at||null)]})]}),a.jsx(Cf,{className:"w-5 h-5 text-gray-400"})]},g.id))})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-4",children:"Top Brands"}),a.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-4",children:s.slice(0,12).map(g=>a.jsxs("div",{className:"p-4 bg-gray-50 rounded-lg text-center",children:[a.jsx("p",{className:"font-medium text-gray-900 text-sm line-clamp-2",children:g.brand_name}),a.jsx("p",{className:"text-lg font-bold text-purple-600 mt-1",children:g.product_count}),a.jsx("p",{className:"text-xs text-gray-500",children:"products"})]},g.brand_name))})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-4",children:"Product Categories"}),a.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-6 gap-4",children:l.slice(0,12).map((g,b)=>a.jsxs("div",{className:"p-4 bg-gray-50 rounded-lg text-center",children:[a.jsx("p",{className:"font-medium text-gray-900",children:g.type}),g.subcategory&&a.jsx("p",{className:"text-xs text-gray-600",children:g.subcategory}),a.jsx("p",{className:"text-lg font-bold text-orange-600 mt-1",children:g.product_count}),a.jsx("p",{className:"text-xs text-gray-500",children:"products"})]},b))})]})]}),f==="stores"&&a.jsx("div",{className:"space-y-4",children:a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"table table-sm w-full",children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{children:"Store Name"}),a.jsx("th",{children:"City"}),a.jsx("th",{className:"text-center",children:"Platform ID"}),a.jsx("th",{className:"text-center",children:"Last Crawl"}),a.jsx("th",{})]})}),a.jsx("tbody",{children:n.map(g=>a.jsxs("tr",{className:"hover",children:[a.jsx("td",{className:"font-medium",children:g.dba_name||g.name}),a.jsxs("td",{children:[g.city,", ",g.state]}),a.jsx("td",{className:"text-center",children:g.platform_dispensary_id?a.jsx("span",{className:"badge badge-success badge-sm",children:"Resolved"}):a.jsx("span",{className:"badge badge-warning badge-sm",children:"Pending"})}),a.jsx("td",{className:"text-center text-sm text-gray-600",children:x(g.last_crawl_at||null)}),a.jsx("td",{children:a.jsx("button",{onClick:()=>e(`/az/stores/${g.id}`),className:"btn btn-xs btn-ghost",children:"View"})})]},g.id))})]})})}),f==="brands"&&a.jsx("div",{className:"space-y-4",children:s.length===0?a.jsx("p",{className:"text-center py-8 text-gray-500",children:"No brands found. Run a crawl to populate brand data."}):a.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-6 gap-4",children:s.map(g=>a.jsxs("div",{className:"border border-gray-200 rounded-lg p-4 text-center hover:border-purple-300 hover:shadow-md transition-all",children:[a.jsx("p",{className:"font-medium text-gray-900 text-sm line-clamp-2 h-10",children:g.brand_name}),a.jsxs("div",{className:"mt-2 space-y-1",children:[a.jsxs("div",{className:"flex justify-between text-xs",children:[a.jsx("span",{className:"text-gray-500",children:"Products:"}),a.jsx("span",{className:"font-semibold",children:g.product_count})]}),a.jsxs("div",{className:"flex justify-between text-xs",children:[a.jsx("span",{className:"text-gray-500",children:"Stores:"}),a.jsx("span",{className:"font-semibold",children:g.dispensary_count})]})]})]},g.brand_name))})}),f==="categories"&&a.jsx("div",{className:"space-y-4",children:l.length===0?a.jsx("p",{className:"text-center py-8 text-gray-500",children:"No categories found. Run a crawl to populate category data."}):a.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",children:l.map((g,b)=>a.jsxs("div",{className:"border border-gray-200 rounded-lg p-4 hover:border-orange-300 hover:shadow-md transition-all",children:[a.jsx("p",{className:"font-medium text-gray-900",children:g.type}),g.subcategory&&a.jsx("p",{className:"text-sm text-gray-600",children:g.subcategory}),a.jsxs("div",{className:"mt-3 grid grid-cols-2 gap-2 text-xs",children:[a.jsxs("div",{className:"bg-gray-50 rounded p-2 text-center",children:[a.jsx("p",{className:"font-bold text-lg text-orange-600",children:g.product_count}),a.jsx("p",{className:"text-gray-500",children:"products"})]}),a.jsxs("div",{className:"bg-gray-50 rounded p-2 text-center",children:[a.jsx("p",{className:"font-bold text-lg text-blue-600",children:g.brand_count}),a.jsx("p",{className:"text-gray-500",children:"brands"})]})]}),g.avg_thc!=null&&a.jsxs("p",{className:"text-xs text-gray-500 mt-2 text-center",children:["Avg THC: ",g.avg_thc.toFixed(1),"%"]})]},b))})})]})]})]})})}function Ii({title:e,value:t,icon:r,color:n}){const i={blue:"bg-blue-50",green:"bg-green-50",purple:"bg-purple-50",orange:"bg-orange-50",cyan:"bg-cyan-50",red:"bg-red-50"};return a.jsx("div",{className:"bg-white rounded-lg border border-gray-200 p-4",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:`p-2 ${i[n]||"bg-gray-50"} rounded-lg`,children:r}),a.jsxs("div",{children:[a.jsx("p",{className:"text-xs text-gray-600",children:e}),a.jsx("p",{className:"text-xl font-bold text-gray-900",children:t.toLocaleString()})]})]})})}function Vo({active:e,onClick:t,icon:r,label:n}){return a.jsxs("button",{onClick:t,className:`flex items-center gap-2 py-4 px-2 text-sm font-medium border-b-2 transition-colors ${e?"border-blue-600 text-blue-600":"border-transparent text-gray-600 hover:text-gray-900"}`,children:[r,n]})}function ve({children:e}){const{isAuthenticated:t,checkAuth:r}=Ph();return h.useEffect(()=>{r()},[]),t?a.jsx(a.Fragment,{children:e}):a.jsx(H1,{to:"/login",replace:!0})}function k7(){return a.jsx(QC,{children:a.jsxs(HC,{children:[a.jsx(de,{path:"/login",element:a.jsx(DA,{})}),a.jsx(de,{path:"/",element:a.jsx(ve,{children:a.jsx(XB,{})})}),a.jsx(de,{path:"/products",element:a.jsx(ve,{children:a.jsx(JB,{})})}),a.jsx(de,{path:"/products/:id",element:a.jsx(ve,{children:a.jsx(e7,{})})}),a.jsx(de,{path:"/stores",element:a.jsx(ve,{children:a.jsx(t7,{})})}),a.jsx(de,{path:"/dispensaries",element:a.jsx(ve,{children:a.jsx(r7,{})})}),a.jsx(de,{path:"/dispensaries/:state/:city/:slug",element:a.jsx(ve,{children:a.jsx(n7,{})})}),a.jsx(de,{path:"/stores/:state/:storeName/:slug/brands",element:a.jsx(ve,{children:a.jsx(a7,{})})}),a.jsx(de,{path:"/stores/:state/:storeName/:slug/specials",element:a.jsx(ve,{children:a.jsx(s7,{})})}),a.jsx(de,{path:"/stores/:state/:storeName/:slug",element:a.jsx(ve,{children:a.jsx(i7,{})})}),a.jsx(de,{path:"/categories",element:a.jsx(ve,{children:a.jsx(o7,{})})}),a.jsx(de,{path:"/campaigns",element:a.jsx(ve,{children:a.jsx(l7,{})})}),a.jsx(de,{path:"/analytics",element:a.jsx(ve,{children:a.jsx(u7,{})})}),a.jsx(de,{path:"/settings",element:a.jsx(ve,{children:a.jsx(d7,{})})}),a.jsx(de,{path:"/changes",element:a.jsx(ve,{children:a.jsx(v7,{})})}),a.jsx(de,{path:"/proxies",element:a.jsx(ve,{children:a.jsx(p7,{})})}),a.jsx(de,{path:"/logs",element:a.jsx(ve,{children:a.jsx(m7,{})})}),a.jsx(de,{path:"/scraper-tools",element:a.jsx(ve,{children:a.jsx(y7,{})})}),a.jsx(de,{path:"/scraper-monitor",element:a.jsx(ve,{children:a.jsx(g7,{})})}),a.jsx(de,{path:"/scraper-schedule",element:a.jsx(ve,{children:a.jsx(x7,{})})}),a.jsx(de,{path:"/az-schedule",element:a.jsx(ve,{children:a.jsx(j7,{})})}),a.jsx(de,{path:"/az",element:a.jsx(ve,{children:a.jsx(w7,{})})}),a.jsx(de,{path:"/az/stores/:id",element:a.jsx(ve,{children:a.jsx(S7,{})})}),a.jsx(de,{path:"/api-permissions",element:a.jsx(ve,{children:a.jsx(b7,{})})}),a.jsx(de,{path:"/wholesale-analytics",element:a.jsx(ve,{children:a.jsx(N7,{})})}),a.jsx(de,{path:"*",element:a.jsx(H1,{to:"/",replace:!0})})]})})}Od.createRoot(document.getElementById("root")).render(a.jsx(fs.StrictMode,{children:a.jsx(k7,{})})); +`).length-2," more"]})]}):a.jsx("span",{className:"text-gray-400 italic",children:"Any domain"})}),a.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:y.is_active?a.jsx("span",{className:"px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-green-100 text-green-800",children:"Active"}):a.jsx("span",{className:"px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-red-100 text-red-800",children:"Disabled"})}),a.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-600",children:j(y.last_used_at)}),a.jsxs("td",{className:"px-6 py-4 whitespace-nowrap text-sm space-x-2",children:[a.jsx("button",{onClick:()=>g(y.id),className:"text-blue-600 hover:text-blue-800",children:y.is_active?"Disable":"Enable"}),a.jsx("button",{onClick:()=>b(y.id),className:"text-red-600 hover:text-red-800",children:"Delete"})]})]},y.id))})]})})]})]})})}function vF(){const[e,t]=h.useState([]),[r,n]=h.useState([]),[i,s]=h.useState(null),[o,l]=h.useState(null),[c,d]=h.useState(!0),[u,f]=h.useState(!0),[p,m]=h.useState("schedules"),[x,g]=h.useState(null),[b,v]=h.useState(!1),[j,y]=h.useState(!1),[w,S]=h.useState(null);h.useEffect(()=>{if(N(),u){const k=setInterval(N,1e4);return()=>clearInterval(k)}},[u]);const N=async()=>{try{const[k,L,F,H]=await Promise.all([B.getDutchieAZSchedules(),B.getDutchieAZRunLogs({limit:50}),B.getDutchieAZSchedulerStatus(),B.getDetectionStats().catch(()=>null)]);t(k.schedules||[]),n(L.logs||[]),s(F),l(H)}catch(k){console.error("Failed to load schedule data:",k)}finally{d(!1)}},P=async()=>{try{i!=null&&i.running?await B.stopDutchieAZScheduler():await B.startDutchieAZScheduler(),await N()}catch(k){console.error("Failed to toggle scheduler:",k)}},_=async()=>{try{await B.initDutchieAZSchedules(),await N()}catch(k){console.error("Failed to initialize schedules:",k)}},T=async k=>{try{await B.triggerDutchieAZSchedule(k),await N()}catch(L){console.error("Failed to trigger schedule:",L)}},$=async k=>{try{await B.updateDutchieAZSchedule(k.id,{enabled:!k.enabled}),await N()}catch(L){console.error("Failed to toggle schedule:",L)}},M=async(k,L)=>{try{const F={description:L.description??void 0,enabled:L.enabled,baseIntervalMinutes:L.baseIntervalMinutes,jitterMinutes:L.jitterMinutes,jobConfig:L.jobConfig??void 0};await B.updateDutchieAZSchedule(k,F),g(null),await N()}catch(F){console.error("Failed to update schedule:",F)}},C=async()=>{if(confirm("Run menu detection on all dispensaries with unknown/missing menu_type?")){y(!0),S(null);try{const k=await B.detectAllDispensaries({state:"AZ",onlyUnknown:!0});S(k),await N()}catch(k){console.error("Failed to run bulk detection:",k)}finally{y(!1)}}},R=async()=>{if(confirm("Resolve platform IDs for all Dutchie dispensaries missing them?")){y(!0),S(null);try{const k=await B.detectAllDispensaries({state:"AZ",onlyMissingPlatformId:!0,onlyUnknown:!1});S(k),await N()}catch(k){console.error("Failed to resolve platform IDs:",k)}finally{y(!1)}}},q=k=>{if(!k)return"Never";const L=new Date(k),H=new Date().getTime()-L.getTime(),te=Math.floor(H/6e4),re=Math.floor(te/60),we=Math.floor(re/24);return te<1?"Just now":te<60?`${te}m ago`:re<24?`${re}h ago`:`${we}d ago`},Z=k=>{if(!k)return"Not scheduled";const L=new Date(k),F=new Date,H=L.getTime()-F.getTime();if(H<0)return"Overdue";const te=Math.floor(H/6e4),re=Math.floor(te/60);return te<60?`${te}m`:`${re}h ${te%60}m`},E=k=>{if(!k)return"-";if(k<1e3)return`${k}ms`;const L=Math.floor(k/1e3),F=Math.floor(L/60);return F<1?`${L}s`:`${F}m ${L%60}s`},D=(k,L)=>{const F=Math.floor(k/60),H=k%60,te=Math.floor(L/60),re=L%60;let we=F>0?`${F}h`:"";H>0&&(we+=`${H}m`);let A=te>0?`${te}h`:"";return re>0&&(A+=`${re}m`),`${we} +/- ${A}`},O=k=>{switch(k){case"success":return{bg:"#d1fae5",color:"#065f46"};case"running":return{bg:"#dbeafe",color:"#1e40af"};case"error":return{bg:"#fee2e2",color:"#991b1b"};case"partial":return{bg:"#fef3c7",color:"#92400e"};default:return{bg:"#f3f4f6",color:"#374151"}}};return a.jsx(X,{children:a.jsxs("div",{children:[a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"30px"},children:[a.jsxs("div",{children:[a.jsx("h1",{style:{fontSize:"32px",margin:0},children:"Dutchie AZ Schedule"}),a.jsx("p",{style:{color:"#666",margin:"8px 0 0 0"},children:"Jittered scheduling for Arizona Dutchie product crawls"})]}),a.jsx("div",{style:{display:"flex",gap:"15px",alignItems:"center"},children:a.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"10px",cursor:"pointer"},children:[a.jsx("input",{type:"checkbox",checked:u,onChange:k=>f(k.target.checked),style:{width:"18px",height:"18px",cursor:"pointer"}}),a.jsx("span",{children:"Auto-refresh (10s)"})]})})]}),a.jsxs("div",{style:{background:"white",padding:"20px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",marginBottom:"30px",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"20px"},children:[a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:"14px",color:"#666",marginBottom:"4px"},children:"Scheduler Status"}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[a.jsx("span",{style:{width:"12px",height:"12px",borderRadius:"50%",background:i!=null&&i.running?"#10b981":"#ef4444",display:"inline-block"}}),a.jsx("span",{style:{fontWeight:"600",fontSize:"18px"},children:i!=null&&i.running?"Running":"Stopped"})]})]}),a.jsxs("div",{style:{borderLeft:"1px solid #eee",paddingLeft:"20px"},children:[a.jsx("div",{style:{fontSize:"14px",color:"#666",marginBottom:"4px"},children:"Poll Interval"}),a.jsx("div",{style:{fontWeight:"600"},children:i?`${i.pollIntervalMs/1e3}s`:"-"})]}),a.jsxs("div",{style:{borderLeft:"1px solid #eee",paddingLeft:"20px"},children:[a.jsx("div",{style:{fontSize:"14px",color:"#666",marginBottom:"4px"},children:"Active Schedules"}),a.jsxs("div",{style:{fontWeight:"600"},children:[e.filter(k=>k.enabled).length," / ",e.length]})]})]}),a.jsxs("div",{style:{display:"flex",gap:"10px"},children:[a.jsx("button",{onClick:P,style:{padding:"10px 20px",background:i!=null&&i.running?"#ef4444":"#10b981",color:"white",border:"none",borderRadius:"6px",cursor:"pointer",fontWeight:"600"},children:i!=null&&i.running?"Stop Scheduler":"Start Scheduler"}),e.length===0&&a.jsx("button",{onClick:_,style:{padding:"10px 20px",background:"#2563eb",color:"white",border:"none",borderRadius:"6px",cursor:"pointer",fontWeight:"600"},children:"Initialize Default Schedules"})]})]}),a.jsxs("div",{style:{marginBottom:"30px",display:"flex",gap:"10px",borderBottom:"2px solid #eee"},children:[a.jsxs("button",{onClick:()=>m("schedules"),style:{padding:"12px 24px",background:p==="schedules"?"white":"transparent",border:"none",borderBottom:p==="schedules"?"3px solid #2563eb":"3px solid transparent",cursor:"pointer",fontSize:"16px",fontWeight:p==="schedules"?"600":"400",color:p==="schedules"?"#2563eb":"#666",marginBottom:"-2px"},children:["Schedule Configs (",e.length,")"]}),a.jsxs("button",{onClick:()=>m("logs"),style:{padding:"12px 24px",background:p==="logs"?"white":"transparent",border:"none",borderBottom:p==="logs"?"3px solid #2563eb":"3px solid transparent",cursor:"pointer",fontSize:"16px",fontWeight:p==="logs"?"600":"400",color:p==="logs"?"#2563eb":"#666",marginBottom:"-2px"},children:["Run Logs (",r.length,")"]}),a.jsxs("button",{onClick:()=>m("detection"),style:{padding:"12px 24px",background:p==="detection"?"white":"transparent",border:"none",borderBottom:p==="detection"?"3px solid #2563eb":"3px solid transparent",cursor:"pointer",fontSize:"16px",fontWeight:p==="detection"?"600":"400",color:p==="detection"?"#2563eb":"#666",marginBottom:"-2px"},children:["Menu Detection ",o!=null&&o.needsDetection?`(${o.needsDetection} pending)`:""]})]}),p==="schedules"&&a.jsx("div",{style:{background:"white",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",overflow:"hidden"},children:e.length===0?a.jsx("div",{style:{padding:"40px",textAlign:"center",color:"#666"},children:'No schedules configured. Click "Initialize Default Schedules" to create the default crawl schedule.'}):a.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[a.jsx("thead",{children:a.jsxs("tr",{style:{background:"#f8f8f8",borderBottom:"2px solid #eee"},children:[a.jsx("th",{style:{padding:"15px",textAlign:"left",fontWeight:"600"},children:"Job Name"}),a.jsx("th",{style:{padding:"15px",textAlign:"center",fontWeight:"600"},children:"Enabled"}),a.jsx("th",{style:{padding:"15px",textAlign:"center",fontWeight:"600"},children:"Interval (Jitter)"}),a.jsx("th",{style:{padding:"15px",textAlign:"left",fontWeight:"600"},children:"Last Run"}),a.jsx("th",{style:{padding:"15px",textAlign:"left",fontWeight:"600"},children:"Next Run"}),a.jsx("th",{style:{padding:"15px",textAlign:"left",fontWeight:"600"},children:"Last Status"}),a.jsx("th",{style:{padding:"15px",textAlign:"center",fontWeight:"600"},children:"Actions"})]})}),a.jsx("tbody",{children:e.map(k=>a.jsxs("tr",{style:{borderBottom:"1px solid #eee"},children:[a.jsxs("td",{style:{padding:"15px"},children:[a.jsx("div",{style:{fontWeight:"600"},children:k.jobName}),k.description&&a.jsx("div",{style:{fontSize:"13px",color:"#666",marginTop:"4px"},children:k.description}),k.jobConfig&&a.jsxs("div",{style:{fontSize:"11px",color:"#999",marginTop:"4px"},children:["Config: ",JSON.stringify(k.jobConfig)]})]}),a.jsx("td",{style:{padding:"15px",textAlign:"center"},children:a.jsx("button",{onClick:()=>$(k),style:{padding:"4px 12px",borderRadius:"12px",border:"none",cursor:"pointer",fontWeight:"600",fontSize:"12px",background:k.enabled?"#d1fae5":"#fee2e2",color:k.enabled?"#065f46":"#991b1b"},children:k.enabled?"ON":"OFF"})}),a.jsx("td",{style:{padding:"15px",textAlign:"center"},children:a.jsx("div",{style:{fontWeight:"600"},children:D(k.baseIntervalMinutes,k.jitterMinutes)})}),a.jsxs("td",{style:{padding:"15px"},children:[a.jsx("div",{children:q(k.lastRunAt)}),k.lastDurationMs&&a.jsxs("div",{style:{fontSize:"12px",color:"#666"},children:["Duration: ",E(k.lastDurationMs)]})]}),a.jsxs("td",{style:{padding:"15px"},children:[a.jsx("div",{style:{fontWeight:"600",color:"#2563eb"},children:Z(k.nextRunAt)}),k.nextRunAt&&a.jsx("div",{style:{fontSize:"12px",color:"#999"},children:new Date(k.nextRunAt).toLocaleString()})]}),a.jsx("td",{style:{padding:"15px"},children:k.lastStatus?a.jsxs("div",{children:[a.jsx("span",{style:{padding:"4px 10px",borderRadius:"12px",fontSize:"12px",fontWeight:"600",...O(k.lastStatus)},children:k.lastStatus}),k.lastErrorMessage&&a.jsx("button",{onClick:()=>alert(k.lastErrorMessage),style:{marginLeft:"8px",padding:"2px 6px",background:"#fee2e2",color:"#991b1b",border:"none",borderRadius:"4px",cursor:"pointer",fontSize:"10px"},children:"Error"})]}):a.jsx("span",{style:{color:"#999"},children:"Never run"})}),a.jsx("td",{style:{padding:"15px",textAlign:"center"},children:a.jsxs("div",{style:{display:"flex",gap:"8px",justifyContent:"center"},children:[a.jsx("button",{onClick:()=>T(k.id),disabled:k.lastStatus==="running",style:{padding:"6px 12px",background:k.lastStatus==="running"?"#94a3b8":"#2563eb",color:"white",border:"none",borderRadius:"4px",cursor:k.lastStatus==="running"?"not-allowed":"pointer",fontSize:"13px"},children:"Run Now"}),a.jsx("button",{onClick:()=>g(k),style:{padding:"6px 12px",background:"#f3f4f6",color:"#374151",border:"none",borderRadius:"4px",cursor:"pointer",fontSize:"13px"},children:"Edit"})]})})]},k.id))})]})}),p==="logs"&&a.jsx("div",{style:{background:"white",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",overflow:"hidden"},children:r.length===0?a.jsx("div",{style:{padding:"40px",textAlign:"center",color:"#666"},children:"No run logs yet. Logs will appear here after jobs execute."}):a.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[a.jsx("thead",{children:a.jsxs("tr",{style:{background:"#f8f8f8",borderBottom:"2px solid #eee"},children:[a.jsx("th",{style:{padding:"15px",textAlign:"left",fontWeight:"600"},children:"Job"}),a.jsx("th",{style:{padding:"15px",textAlign:"center",fontWeight:"600"},children:"Status"}),a.jsx("th",{style:{padding:"15px",textAlign:"left",fontWeight:"600"},children:"Started"}),a.jsx("th",{style:{padding:"15px",textAlign:"right",fontWeight:"600"},children:"Duration"}),a.jsx("th",{style:{padding:"15px",textAlign:"right",fontWeight:"600"},children:"Processed"}),a.jsx("th",{style:{padding:"15px",textAlign:"right",fontWeight:"600"},children:"Succeeded"}),a.jsx("th",{style:{padding:"15px",textAlign:"right",fontWeight:"600"},children:"Failed"})]})}),a.jsx("tbody",{children:r.map(k=>a.jsxs("tr",{style:{borderBottom:"1px solid #eee"},children:[a.jsxs("td",{style:{padding:"15px"},children:[a.jsx("div",{style:{fontWeight:"600"},children:k.job_name}),a.jsxs("div",{style:{fontSize:"12px",color:"#999"},children:["Run #",k.id]})]}),a.jsxs("td",{style:{padding:"15px",textAlign:"center"},children:[a.jsx("span",{style:{padding:"4px 10px",borderRadius:"12px",fontSize:"12px",fontWeight:"600",...O(k.status)},children:k.status}),k.error_message&&a.jsx("button",{onClick:()=>alert(k.error_message),style:{marginLeft:"8px",padding:"2px 6px",background:"#fee2e2",color:"#991b1b",border:"none",borderRadius:"4px",cursor:"pointer",fontSize:"10px"},children:"Error"})]}),a.jsxs("td",{style:{padding:"15px"},children:[a.jsx("div",{children:k.started_at?new Date(k.started_at).toLocaleString():"-"}),a.jsx("div",{style:{fontSize:"12px",color:"#999"},children:q(k.started_at)})]}),a.jsx("td",{style:{padding:"15px",textAlign:"right",fontWeight:"600"},children:E(k.duration_ms)}),a.jsx("td",{style:{padding:"15px",textAlign:"right"},children:k.items_processed??"-"}),a.jsx("td",{style:{padding:"15px",textAlign:"right",color:"#10b981"},children:k.items_succeeded??"-"}),a.jsx("td",{style:{padding:"15px",textAlign:"right",color:k.items_failed?"#ef4444":"inherit"},children:k.items_failed??"-"})]},k.id))})]})}),p==="detection"&&a.jsxs("div",{style:{background:"white",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",padding:"30px"},children:[o&&a.jsxs("div",{style:{marginBottom:"30px"},children:[a.jsx("h3",{style:{margin:"0 0 20px 0"},children:"Detection Statistics"}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(150px, 1fr))",gap:"20px"},children:[a.jsxs("div",{style:{padding:"20px",background:"#f8f8f8",borderRadius:"8px",textAlign:"center"},children:[a.jsx("div",{style:{fontSize:"32px",fontWeight:"700",color:"#2563eb"},children:o.totalDispensaries}),a.jsx("div",{style:{color:"#666",marginTop:"4px"},children:"Total Dispensaries"})]}),a.jsxs("div",{style:{padding:"20px",background:"#f8f8f8",borderRadius:"8px",textAlign:"center"},children:[a.jsx("div",{style:{fontSize:"32px",fontWeight:"700",color:"#10b981"},children:o.withMenuType}),a.jsx("div",{style:{color:"#666",marginTop:"4px"},children:"With Menu Type"})]}),a.jsxs("div",{style:{padding:"20px",background:"#f8f8f8",borderRadius:"8px",textAlign:"center"},children:[a.jsx("div",{style:{fontSize:"32px",fontWeight:"700",color:"#10b981"},children:o.withPlatformId}),a.jsx("div",{style:{color:"#666",marginTop:"4px"},children:"With Platform ID"})]}),a.jsxs("div",{style:{padding:"20px",background:"#fef3c7",borderRadius:"8px",textAlign:"center"},children:[a.jsx("div",{style:{fontSize:"32px",fontWeight:"700",color:"#92400e"},children:o.needsDetection}),a.jsx("div",{style:{color:"#666",marginTop:"4px"},children:"Needs Detection"})]})]}),Object.keys(o.byProvider).length>0&&a.jsxs("div",{style:{marginTop:"20px"},children:[a.jsx("h4",{style:{margin:"0 0 10px 0"},children:"By Provider"}),a.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"10px"},children:Object.entries(o.byProvider).map(([k,L])=>a.jsxs("span",{style:{padding:"6px 14px",background:k==="dutchie"?"#dbeafe":"#f3f4f6",borderRadius:"16px",fontSize:"14px",fontWeight:"600"},children:[k,": ",L]},k))})]})]}),a.jsxs("div",{style:{marginBottom:"30px",display:"flex",gap:"15px",flexWrap:"wrap"},children:[a.jsx("button",{onClick:C,disabled:j||!(o!=null&&o.needsDetection),style:{padding:"12px 24px",background:j?"#94a3b8":"#2563eb",color:"white",border:"none",borderRadius:"6px",cursor:j?"not-allowed":"pointer",fontWeight:"600",fontSize:"14px"},children:j?"Detecting...":"Detect All Unknown"}),a.jsx("button",{onClick:R,disabled:j,style:{padding:"12px 24px",background:j?"#94a3b8":"#10b981",color:"white",border:"none",borderRadius:"6px",cursor:j?"not-allowed":"pointer",fontWeight:"600",fontSize:"14px"},children:j?"Resolving...":"Resolve Missing Platform IDs"})]}),w&&a.jsxs("div",{style:{marginBottom:"30px",padding:"20px",background:"#f8f8f8",borderRadius:"8px"},children:[a.jsx("h4",{style:{margin:"0 0 15px 0"},children:"Detection Results"}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:"15px",marginBottom:"15px"},children:[a.jsxs("div",{children:[a.jsx("div",{style:{fontWeight:"600",fontSize:"24px"},children:w.totalProcessed}),a.jsx("div",{style:{color:"#666",fontSize:"13px"},children:"Processed"})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontWeight:"600",fontSize:"24px",color:"#10b981"},children:w.totalSucceeded}),a.jsx("div",{style:{color:"#666",fontSize:"13px"},children:"Succeeded"})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontWeight:"600",fontSize:"24px",color:"#ef4444"},children:w.totalFailed}),a.jsx("div",{style:{color:"#666",fontSize:"13px"},children:"Failed"})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontWeight:"600",fontSize:"24px",color:"#666"},children:w.totalSkipped}),a.jsx("div",{style:{color:"#666",fontSize:"13px"},children:"Skipped"})]})]}),w.errors&&w.errors.length>0&&a.jsxs("div",{style:{marginTop:"15px"},children:[a.jsx("div",{style:{fontWeight:"600",marginBottom:"8px",color:"#991b1b"},children:"Errors:"}),a.jsxs("div",{style:{maxHeight:"150px",overflow:"auto",background:"#fee2e2",padding:"10px",borderRadius:"4px",fontSize:"12px"},children:[w.errors.slice(0,10).map((k,L)=>a.jsx("div",{style:{marginBottom:"4px"},children:k},L)),w.errors.length>10&&a.jsxs("div",{style:{fontStyle:"italic",marginTop:"8px"},children:["...and ",w.errors.length-10," more"]})]})]})]}),a.jsxs("div",{style:{padding:"20px",background:"#f0f9ff",borderRadius:"8px",fontSize:"14px"},children:[a.jsx("h4",{style:{margin:"0 0 10px 0",color:"#1e40af"},children:"About Menu Detection"}),a.jsxs("ul",{style:{margin:0,paddingLeft:"20px",color:"#1e40af"},children:[a.jsxs("li",{style:{marginBottom:"8px"},children:[a.jsx("strong",{children:"Detect All Unknown:"})," Scans dispensaries with no menu_type set and detects the provider (dutchie, treez, jane, etc.) from their menu_url."]}),a.jsxs("li",{style:{marginBottom:"8px"},children:[a.jsx("strong",{children:"Resolve Missing Platform IDs:"}),' For dispensaries already detected as "dutchie", extracts the cName from menu_url and resolves the platform_dispensary_id via GraphQL.']}),a.jsxs("li",{children:[a.jsx("strong",{children:"Automatic scheduling:"}),' A "Menu Detection" job runs daily (24h +/- 1h jitter) to detect new dispensaries.']})]})]})]}),x&&a.jsx("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,background:"rgba(0,0,0,0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3},children:a.jsxs("div",{style:{background:"white",padding:"30px",borderRadius:"12px",width:"500px",maxWidth:"90vw"},children:[a.jsxs("h2",{style:{margin:"0 0 20px 0"},children:["Edit Schedule: ",x.jobName]}),a.jsxs("div",{style:{marginBottom:"20px"},children:[a.jsx("label",{style:{display:"block",marginBottom:"8px",fontWeight:"600"},children:"Description"}),a.jsx("input",{type:"text",value:x.description||"",onChange:k=>g({...x,description:k.target.value}),style:{width:"100%",padding:"10px",borderRadius:"6px",border:"1px solid #ddd",fontSize:"14px"}})]}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"20px",marginBottom:"20px"},children:[a.jsxs("div",{children:[a.jsx("label",{style:{display:"block",marginBottom:"8px",fontWeight:"600"},children:"Base Interval (minutes)"}),a.jsx("input",{type:"number",value:x.baseIntervalMinutes,onChange:k=>g({...x,baseIntervalMinutes:parseInt(k.target.value)||240}),style:{width:"100%",padding:"10px",borderRadius:"6px",border:"1px solid #ddd",fontSize:"14px"}}),a.jsxs("div",{style:{fontSize:"12px",color:"#666",marginTop:"4px"},children:["= ",Math.floor(x.baseIntervalMinutes/60),"h ",x.baseIntervalMinutes%60,"m"]})]}),a.jsxs("div",{children:[a.jsx("label",{style:{display:"block",marginBottom:"8px",fontWeight:"600"},children:"Jitter (minutes)"}),a.jsx("input",{type:"number",value:x.jitterMinutes,onChange:k=>g({...x,jitterMinutes:parseInt(k.target.value)||30}),style:{width:"100%",padding:"10px",borderRadius:"6px",border:"1px solid #ddd",fontSize:"14px"}}),a.jsxs("div",{style:{fontSize:"12px",color:"#666",marginTop:"4px"},children:["+/- ",x.jitterMinutes,"m random offset"]})]})]}),a.jsxs("div",{style:{fontSize:"13px",color:"#666",marginBottom:"20px",padding:"15px",background:"#f8f8f8",borderRadius:"6px"},children:[a.jsx("strong",{children:"Effective range:"})," ",Math.floor((x.baseIntervalMinutes-x.jitterMinutes)/60),"h ",(x.baseIntervalMinutes-x.jitterMinutes)%60,"m"," to ",Math.floor((x.baseIntervalMinutes+x.jitterMinutes)/60),"h ",(x.baseIntervalMinutes+x.jitterMinutes)%60,"m"]}),a.jsxs("div",{style:{display:"flex",gap:"10px",justifyContent:"flex-end"},children:[a.jsx("button",{onClick:()=>g(null),style:{padding:"10px 20px",background:"#f3f4f6",color:"#374151",border:"none",borderRadius:"6px",cursor:"pointer"},children:"Cancel"}),a.jsx("button",{onClick:()=>M(x.id,{description:x.description,baseIntervalMinutes:x.baseIntervalMinutes,jitterMinutes:x.jitterMinutes}),style:{padding:"10px 20px",background:"#2563eb",color:"white",border:"none",borderRadius:"6px",cursor:"pointer",fontWeight:"600"},children:"Save Changes"})]})]})})]})})}function bF(){const e=dt(),[t,r]=h.useState([]),[n,i]=h.useState(0),[s,o]=h.useState(!0),[l,c]=h.useState(null);h.useEffect(()=>{d()},[]);const d=async()=>{o(!0);try{const[u,f]=await Promise.all([B.getDutchieAZStores({limit:200}),B.getDutchieAZDashboard()]);r(u.stores),i(u.total),c(f)}catch(u){console.error("Failed to load data:",u)}finally{o(!1)}};return s?a.jsx(X,{children:a.jsxs("div",{className:"text-center py-12",children:[a.jsx("div",{className:"inline-block animate-spin rounded-full h-8 w-8 border-4 border-blue-500 border-t-transparent"}),a.jsx("p",{className:"mt-2 text-sm text-gray-600",children:"Loading stores..."})]})}):a.jsx(X,{children:a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"Dutchie AZ Stores"}),a.jsx("p",{className:"text-sm text-gray-600 mt-1",children:"Arizona dispensaries using the Dutchie platform - data from the new pipeline"})]}),a.jsxs("button",{onClick:d,className:"flex items-center gap-2 px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg hover:bg-gray-50",children:[a.jsx(Xt,{className:"w-4 h-4"}),"Refresh"]})]}),l&&a.jsxs("div",{className:"grid grid-cols-4 gap-4",children:[a.jsx("div",{className:"bg-white rounded-lg border border-gray-200 p-4",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 bg-blue-50 rounded-lg",children:a.jsx(Ln,{className:"w-5 h-5 text-blue-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm text-gray-600",children:"Dispensaries"}),a.jsx("p",{className:"text-xl font-bold text-gray-900",children:l.dispensaryCount})]})]})}),a.jsx("div",{className:"bg-white rounded-lg border border-gray-200 p-4",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 bg-green-50 rounded-lg",children:a.jsx(Ct,{className:"w-5 h-5 text-green-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm text-gray-600",children:"Total Products"}),a.jsx("p",{className:"text-xl font-bold text-gray-900",children:l.productCount.toLocaleString()})]})]})}),a.jsx("div",{className:"bg-white rounded-lg border border-gray-200 p-4",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 bg-purple-50 rounded-lg",children:a.jsx(_r,{className:"w-5 h-5 text-purple-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm text-gray-600",children:"Brands"}),a.jsx("p",{className:"text-xl font-bold text-gray-900",children:l.brandCount})]})]})}),a.jsx("div",{className:"bg-white rounded-lg border border-gray-200 p-4",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 bg-orange-50 rounded-lg",children:a.jsx(Hr,{className:"w-5 h-5 text-orange-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm text-gray-600",children:"Failed Jobs (24h)"}),a.jsx("p",{className:"text-xl font-bold text-gray-900",children:l.failedJobCount})]})]})})]}),a.jsxs("div",{className:"bg-white rounded-lg border border-gray-200",children:[a.jsx("div",{className:"p-4 border-b border-gray-200",children:a.jsxs("h2",{className:"text-lg font-semibold text-gray-900",children:["All Stores (",n,")"]})}),a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"table table-zebra w-full",children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{children:"Name"}),a.jsx("th",{children:"City"}),a.jsx("th",{children:"Platform ID"}),a.jsx("th",{children:"Status"}),a.jsx("th",{children:"Actions"})]})}),a.jsx("tbody",{children:t.map(u=>a.jsxs("tr",{children:[a.jsx("td",{children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 bg-blue-50 rounded-lg",children:a.jsx(Ln,{className:"w-4 h-4 text-blue-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"font-medium text-gray-900",children:u.dba_name||u.name}),u.company_name&&u.company_name!==u.name&&a.jsx("p",{className:"text-xs text-gray-500",children:u.company_name})]})]})}),a.jsx("td",{children:a.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600",children:[a.jsx(yi,{className:"w-4 h-4"}),u.city,", ",u.state]})}),a.jsx("td",{children:u.platform_dispensary_id?a.jsx("span",{className:"text-xs font-mono text-gray-600",children:u.platform_dispensary_id}):a.jsx("span",{className:"badge badge-warning badge-sm",children:"Not Resolved"})}),a.jsx("td",{children:u.platform_dispensary_id?a.jsx("span",{className:"badge badge-success badge-sm",children:"Ready"}):a.jsx("span",{className:"badge badge-warning badge-sm",children:"Pending"})}),a.jsx("td",{children:a.jsx("button",{onClick:()=>e(`/az/stores/${u.id}`),className:"btn btn-sm btn-primary",disabled:!u.platform_dispensary_id,children:"View Products"})})]},u.id))})]})})]})]})})}function jF(){const{id:e}=ka(),t=dt(),[r,n]=h.useState(null),[i,s]=h.useState([]),[o,l]=h.useState(!0),[c,d]=h.useState(!1),[u,f]=h.useState("products"),[p,m]=h.useState(!1),[x,g]=h.useState(!1),[b,v]=h.useState(""),[j,y]=h.useState(1),[w,S]=h.useState(0),[N]=h.useState(25),[P,_]=h.useState(""),T=O=>{if(!O)return"Never";const k=new Date(O),F=new Date().getTime()-k.getTime(),H=Math.floor(F/(1e3*60*60*24));return H===0?"Today":H===1?"Yesterday":H<7?`${H} days ago`:k.toLocaleDateString()};h.useEffect(()=>{e&&$()},[e]),h.useEffect(()=>{e&&u==="products"&&M()},[e,j,b,P,u]),h.useEffect(()=>{y(1)},[b,P]);const $=async()=>{l(!0);try{const O=await B.getDutchieAZStoreSummary(parseInt(e,10));n(O)}catch(O){console.error("Failed to load store summary:",O)}finally{l(!1)}},M=async()=>{if(e){d(!0);try{const O=await B.getDutchieAZStoreProducts(parseInt(e,10),{search:b||void 0,stockStatus:P||void 0,limit:N,offset:(j-1)*N});s(O.products),S(O.total)}catch(O){console.error("Failed to load products:",O)}finally{d(!1)}}},C=async()=>{m(!1),g(!0);try{await B.triggerDutchieAZCrawl(parseInt(e,10)),alert("Crawl started! Refresh the page in a few minutes to see updated data.")}catch(O){console.error("Failed to trigger crawl:",O),alert("Failed to start crawl. Please try again.")}finally{g(!1)}},R=Math.ceil(w/N);if(o)return a.jsx(X,{children:a.jsxs("div",{className:"text-center py-12",children:[a.jsx("div",{className:"inline-block animate-spin rounded-full h-8 w-8 border-4 border-blue-500 border-t-transparent"}),a.jsx("p",{className:"mt-2 text-sm text-gray-600",children:"Loading store..."})]})});if(!r)return a.jsx(X,{children:a.jsx("div",{className:"text-center py-12",children:a.jsx("p",{className:"text-gray-600",children:"Store not found"})})});const{dispensary:q,brands:Z,categories:E,lastCrawl:D}=r;return a.jsx(X,{children:a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-center justify-between gap-4",children:[a.jsxs("button",{onClick:()=>t("/az"),className:"flex items-center gap-2 text-sm text-gray-600 hover:text-gray-900",children:[a.jsx(_h,{className:"w-4 h-4"}),"Back to AZ Stores"]}),a.jsxs("div",{className:"relative",children:[a.jsxs("button",{onClick:()=>m(!p),disabled:x,className:"flex items-center gap-2 px-4 py-2 text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 rounded-lg disabled:opacity-50 disabled:cursor-not-allowed",children:[a.jsx(Xt,{className:`w-4 h-4 ${x?"animate-spin":""}`}),x?"Crawling...":"Crawl Now",!x&&a.jsx(ej,{className:"w-4 h-4"})]}),p&&!x&&a.jsx("div",{className:"absolute right-0 mt-2 w-48 bg-white rounded-lg shadow-lg border border-gray-200 z-10",children:a.jsx("button",{onClick:C,className:"w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 rounded-lg",children:"Start Full Crawl"})})]})]}),a.jsxs("div",{className:"bg-white rounded-lg border border-gray-200 p-6",children:[a.jsxs("div",{className:"flex items-start justify-between gap-4 mb-4",children:[a.jsxs("div",{className:"flex items-start gap-4",children:[a.jsx("div",{className:"p-3 bg-blue-50 rounded-lg",children:a.jsx(Ln,{className:"w-8 h-8 text-blue-600"})}),a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:q.dba_name||q.name}),q.company_name&&a.jsx("p",{className:"text-sm text-gray-600 mt-1",children:q.company_name}),a.jsxs("p",{className:"text-xs text-gray-500 mt-1",children:["Platform ID: ",q.platform_dispensary_id||"Not resolved"]})]})]}),a.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600 bg-gray-50 px-4 py-2 rounded-lg",children:[a.jsx(xr,{className:"w-4 h-4"}),a.jsxs("div",{children:[a.jsx("span",{className:"font-medium",children:"Last Crawl:"}),a.jsx("span",{className:"ml-2",children:D!=null&&D.completed_at?new Date(D.completed_at).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"Never"}),(D==null?void 0:D.status)&&a.jsx("span",{className:`ml-2 px-2 py-0.5 rounded text-xs ${D.status==="completed"?"bg-green-100 text-green-800":D.status==="failed"?"bg-red-100 text-red-800":"bg-yellow-100 text-yellow-800"}`,children:D.status})]})]})]}),a.jsxs("div",{className:"flex flex-wrap gap-4",children:[q.address&&a.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600",children:[a.jsx(yi,{className:"w-4 h-4"}),a.jsxs("span",{children:[q.address,", ",q.city,", ",q.state," ",q.zip]})]}),q.phone&&a.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600",children:[a.jsx(Ah,{className:"w-4 h-4"}),a.jsx("span",{children:q.phone})]}),q.website&&a.jsxs("a",{href:q.website,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 text-sm text-blue-600 hover:text-blue-800",children:[a.jsx(Jr,{className:"w-4 h-4"}),"Website"]})]})]}),a.jsxs("div",{className:"grid grid-cols-5 gap-4",children:[a.jsx("button",{onClick:()=>{f("products"),_(""),v("")},className:`bg-white rounded-lg border p-4 hover:border-blue-300 hover:shadow-md transition-all cursor-pointer text-left ${u==="products"&&!P?"border-blue-500":"border-gray-200"}`,children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 bg-green-50 rounded-lg",children:a.jsx(Ct,{className:"w-5 h-5 text-green-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm text-gray-600",children:"Total Products"}),a.jsx("p",{className:"text-xl font-bold text-gray-900",children:r.totalProducts})]})]})}),a.jsx("button",{onClick:()=>{f("products"),_("in_stock"),v("")},className:`bg-white rounded-lg border p-4 hover:border-blue-300 hover:shadow-md transition-all cursor-pointer text-left ${P==="in_stock"?"border-blue-500":"border-gray-200"}`,children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 bg-emerald-50 rounded-lg",children:a.jsx(_r,{className:"w-5 h-5 text-emerald-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm text-gray-600",children:"In Stock"}),a.jsx("p",{className:"text-xl font-bold text-gray-900",children:r.inStockCount})]})]})}),a.jsx("button",{onClick:()=>{f("products"),_("out_of_stock"),v("")},className:`bg-white rounded-lg border p-4 hover:border-blue-300 hover:shadow-md transition-all cursor-pointer text-left ${P==="out_of_stock"?"border-blue-500":"border-gray-200"}`,children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 bg-red-50 rounded-lg",children:a.jsx(Hr,{className:"w-5 h-5 text-red-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm text-gray-600",children:"Out of Stock"}),a.jsx("p",{className:"text-xl font-bold text-gray-900",children:r.outOfStockCount})]})]})}),a.jsx("button",{onClick:()=>f("brands"),className:`bg-white rounded-lg border p-4 hover:border-blue-300 hover:shadow-md transition-all cursor-pointer text-left ${u==="brands"?"border-blue-500":"border-gray-200"}`,children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 bg-purple-50 rounded-lg",children:a.jsx(Cr,{className:"w-5 h-5 text-purple-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm text-gray-600",children:"Brands"}),a.jsx("p",{className:"text-xl font-bold text-gray-900",children:r.brandCount})]})]})}),a.jsx("button",{onClick:()=>f("categories"),className:`bg-white rounded-lg border p-4 hover:border-blue-300 hover:shadow-md transition-all cursor-pointer text-left ${u==="categories"?"border-blue-500":"border-gray-200"}`,children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 bg-orange-50 rounded-lg",children:a.jsx(Uc,{className:"w-5 h-5 text-orange-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm text-gray-600",children:"Categories"}),a.jsx("p",{className:"text-xl font-bold text-gray-900",children:r.categoryCount})]})]})})]}),a.jsxs("div",{className:"bg-white rounded-lg border border-gray-200",children:[a.jsx("div",{className:"border-b border-gray-200",children:a.jsxs("div",{className:"flex gap-4 px-6",children:[a.jsxs("button",{onClick:()=>{f("products"),_("")},className:`py-4 px-2 text-sm font-medium border-b-2 ${u==="products"?"border-blue-600 text-blue-600":"border-transparent text-gray-600 hover:text-gray-900"}`,children:["Products (",r.totalProducts,")"]}),a.jsxs("button",{onClick:()=>f("brands"),className:`py-4 px-2 text-sm font-medium border-b-2 ${u==="brands"?"border-blue-600 text-blue-600":"border-transparent text-gray-600 hover:text-gray-900"}`,children:["Brands (",r.brandCount,")"]}),a.jsxs("button",{onClick:()=>f("categories"),className:`py-4 px-2 text-sm font-medium border-b-2 ${u==="categories"?"border-blue-600 text-blue-600":"border-transparent text-gray-600 hover:text-gray-900"}`,children:["Categories (",r.categoryCount,")"]})]})}),a.jsxs("div",{className:"p-6",children:[u==="products"&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center gap-4 mb-4",children:[a.jsx("input",{type:"text",placeholder:"Search products by name or brand...",value:b,onChange:O=>v(O.target.value),className:"input input-bordered input-sm flex-1"}),a.jsxs("select",{value:P,onChange:O=>_(O.target.value),className:"select select-bordered select-sm",children:[a.jsx("option",{value:"",children:"All Stock"}),a.jsx("option",{value:"in_stock",children:"In Stock"}),a.jsx("option",{value:"out_of_stock",children:"Out of Stock"}),a.jsx("option",{value:"unknown",children:"Unknown"})]}),(b||P)&&a.jsx("button",{onClick:()=>{v(""),_("")},className:"btn btn-sm btn-ghost",children:"Clear"}),a.jsxs("div",{className:"text-sm text-gray-600",children:[w," products"]})]}),c?a.jsxs("div",{className:"text-center py-8",children:[a.jsx("div",{className:"inline-block animate-spin rounded-full h-6 w-6 border-4 border-blue-500 border-t-transparent"}),a.jsx("p",{className:"mt-2 text-sm text-gray-600",children:"Loading products..."})]}):i.length===0?a.jsx("p",{className:"text-center py-8 text-gray-500",children:"No products found"}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"overflow-x-auto -mx-6 px-6",children:a.jsxs("table",{className:"table table-xs table-zebra table-pin-rows w-full",children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{children:"Image"}),a.jsx("th",{children:"Product Name"}),a.jsx("th",{children:"Brand"}),a.jsx("th",{children:"Type"}),a.jsx("th",{className:"text-right",children:"Price"}),a.jsx("th",{className:"text-center",children:"THC %"}),a.jsx("th",{className:"text-center",children:"Stock"}),a.jsx("th",{className:"text-center",children:"Qty"}),a.jsx("th",{children:"Last Updated"})]})}),a.jsx("tbody",{children:i.map(O=>a.jsxs("tr",{children:[a.jsx("td",{className:"whitespace-nowrap",children:O.image_url?a.jsx("img",{src:O.image_url,alt:O.name,className:"w-12 h-12 object-cover rounded",onError:k=>k.currentTarget.style.display="none"}):"-"}),a.jsx("td",{className:"font-medium max-w-[200px]",children:a.jsx("div",{className:"line-clamp-2",title:O.name,children:O.name})}),a.jsx("td",{className:"max-w-[120px]",children:a.jsx("div",{className:"line-clamp-2",title:O.brand||"-",children:O.brand||"-"})}),a.jsxs("td",{className:"whitespace-nowrap",children:[a.jsx("span",{className:"badge badge-ghost badge-sm",children:O.type||"-"}),O.subcategory&&a.jsx("span",{className:"badge badge-ghost badge-sm ml-1",children:O.subcategory})]}),a.jsx("td",{className:"text-right font-semibold whitespace-nowrap",children:O.sale_price?a.jsxs("div",{className:"flex flex-col items-end",children:[a.jsxs("span",{className:"text-error",children:["$",O.sale_price]}),a.jsxs("span",{className:"text-gray-400 line-through text-xs",children:["$",O.regular_price]})]}):O.regular_price?`$${O.regular_price}`:"-"}),a.jsx("td",{className:"text-center whitespace-nowrap",children:O.thc_percentage?a.jsxs("span",{className:"badge badge-success badge-sm",children:[O.thc_percentage,"%"]}):"-"}),a.jsx("td",{className:"text-center whitespace-nowrap",children:O.stock_status==="in_stock"?a.jsx("span",{className:"badge badge-success badge-sm",children:"In Stock"}):O.stock_status==="out_of_stock"?a.jsx("span",{className:"badge badge-error badge-sm",children:"Out"}):a.jsx("span",{className:"badge badge-warning badge-sm",children:"Unknown"})}),a.jsx("td",{className:"text-center whitespace-nowrap",children:O.total_quantity!=null?O.total_quantity:"-"}),a.jsx("td",{className:"whitespace-nowrap text-xs text-gray-500",children:O.updated_at?T(O.updated_at):"-"})]},O.id))})]})}),R>1&&a.jsxs("div",{className:"flex justify-center items-center gap-2 mt-4",children:[a.jsx("button",{onClick:()=>y(O=>Math.max(1,O-1)),disabled:j===1,className:"btn btn-sm btn-outline",children:"Previous"}),a.jsx("div",{className:"flex gap-1",children:Array.from({length:Math.min(5,R)},(O,k)=>{let L;return R<=5||j<=3?L=k+1:j>=R-2?L=R-4+k:L=j-2+k,a.jsx("button",{onClick:()=>y(L),className:`btn btn-sm ${j===L?"btn-primary":"btn-outline"}`,children:L},L)})}),a.jsx("button",{onClick:()=>y(O=>Math.min(R,O+1)),disabled:j===R,className:"btn btn-sm btn-outline",children:"Next"})]})]})]}),u==="brands"&&a.jsx("div",{className:"space-y-4",children:Z.length===0?a.jsx("p",{className:"text-center py-8 text-gray-500",children:"No brands found"}):a.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",children:Z.map(O=>a.jsxs("button",{onClick:()=>{f("products"),v(O.brand_name),_("")},className:"border border-gray-200 rounded-lg p-4 text-center hover:border-blue-300 hover:shadow-md transition-all cursor-pointer",children:[a.jsx("p",{className:"font-medium text-gray-900 line-clamp-2",children:O.brand_name}),a.jsxs("p",{className:"text-sm text-gray-600 mt-1",children:[O.product_count," product",O.product_count!==1?"s":""]})]},O.brand_name))})}),u==="categories"&&a.jsx("div",{className:"space-y-4",children:E.length===0?a.jsx("p",{className:"text-center py-8 text-gray-500",children:"No categories found"}):a.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",children:E.map((O,k)=>a.jsxs("div",{className:"border border-gray-200 rounded-lg p-4 text-center",children:[a.jsx("p",{className:"font-medium text-gray-900",children:O.type}),O.subcategory&&a.jsx("p",{className:"text-sm text-gray-600",children:O.subcategory}),a.jsxs("p",{className:"text-sm text-gray-500 mt-1",children:[O.product_count," product",O.product_count!==1?"s":""]})]},k))})})]})]})]})})}function wF(){const e=dt(),[t,r]=h.useState(null),[n,i]=h.useState([]),[s,o]=h.useState([]),[l,c]=h.useState([]),[d,u]=h.useState(!0),[f,p]=h.useState("overview");h.useEffect(()=>{m()},[]);const m=async()=>{u(!0);try{const[g,b,v,j]=await Promise.all([B.getDutchieAZDashboard(),B.getDutchieAZStores({limit:200}),B.getDutchieAZBrands?B.getDutchieAZBrands({limit:100}):Promise.resolve({brands:[]}),B.getDutchieAZCategories?B.getDutchieAZCategories():Promise.resolve({categories:[]})]);r(g),i(b.stores||[]),o(v.brands||[]),c(j.categories||[])}catch(g){console.error("Failed to load analytics data:",g)}finally{u(!1)}},x=g=>{if(!g)return"Never";const b=new Date(g),j=new Date().getTime()-b.getTime(),y=Math.floor(j/(1e3*60*60)),w=Math.floor(j/(1e3*60*60*24));return y<1?"Just now":y<24?`${y}h ago`:w===1?"Yesterday":w<7?`${w} days ago`:b.toLocaleDateString()};return d?a.jsx(X,{children:a.jsxs("div",{className:"text-center py-12",children:[a.jsx("div",{className:"inline-block animate-spin rounded-full h-8 w-8 border-4 border-blue-500 border-t-transparent"}),a.jsx("p",{className:"mt-2 text-sm text-gray-600",children:"Loading analytics..."})]})}):a.jsx(X,{children:a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"Wholesale & Inventory Analytics"}),a.jsx("p",{className:"text-sm text-gray-600 mt-1",children:"Arizona Dutchie dispensaries data overview"})]}),a.jsxs("button",{onClick:m,className:"flex items-center gap-2 px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg hover:bg-gray-50",children:[a.jsx(Xt,{className:"w-4 h-4"}),"Refresh"]})]}),a.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-7 gap-4",children:[a.jsx(Ii,{title:"Dispensaries",value:(t==null?void 0:t.dispensaryCount)||0,icon:a.jsx(Ln,{className:"w-5 h-5 text-blue-600"}),color:"blue"}),a.jsx(Ii,{title:"Total Products",value:(t==null?void 0:t.productCount)||0,icon:a.jsx(Ct,{className:"w-5 h-5 text-green-600"}),color:"green"}),a.jsx(Ii,{title:"Brands",value:(t==null?void 0:t.brandCount)||0,icon:a.jsx(Cr,{className:"w-5 h-5 text-purple-600"}),color:"purple"}),a.jsx(Ii,{title:"Categories",value:(t==null?void 0:t.categoryCount)||0,icon:a.jsx(Tx,{className:"w-5 h-5 text-orange-600"}),color:"orange"}),a.jsx(Ii,{title:"Snapshots (24h)",value:(t==null?void 0:t.snapshotCount24h)||0,icon:a.jsx(zn,{className:"w-5 h-5 text-cyan-600"}),color:"cyan"}),a.jsx(Ii,{title:"Failed Jobs (24h)",value:(t==null?void 0:t.failedJobCount)||0,icon:a.jsx(Uc,{className:"w-5 h-5 text-red-600"}),color:"red"}),a.jsxs("div",{className:"bg-white rounded-lg border border-gray-200 p-4",children:[a.jsxs("div",{className:"flex items-center gap-2 text-gray-600 mb-1",children:[a.jsx(xr,{className:"w-4 h-4"}),a.jsx("span",{className:"text-xs",children:"Last Crawl"})]}),a.jsx("p",{className:"text-sm font-semibold text-gray-900",children:x((t==null?void 0:t.lastCrawlTime)||null)})]})]}),a.jsxs("div",{className:"bg-white rounded-lg border border-gray-200",children:[a.jsx("div",{className:"border-b border-gray-200",children:a.jsxs("div",{className:"flex gap-4 px-6",children:[a.jsx(Vo,{active:f==="overview",onClick:()=>p("overview"),icon:a.jsx(HA,{className:"w-4 h-4"}),label:"Overview"}),a.jsx(Vo,{active:f==="stores",onClick:()=>p("stores"),icon:a.jsx(Ln,{className:"w-4 h-4"}),label:`Stores (${n.length})`}),a.jsx(Vo,{active:f==="brands",onClick:()=>p("brands"),icon:a.jsx(Cr,{className:"w-4 h-4"}),label:`Brands (${s.length})`}),a.jsx(Vo,{active:f==="categories",onClick:()=>p("categories"),icon:a.jsx(Tx,{className:"w-4 h-4"}),label:`Categories (${l.length})`})]})}),a.jsxs("div",{className:"p-6",children:[f==="overview"&&a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-4",children:"Top Stores by Products"}),a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:n.slice(0,6).map(g=>a.jsxs("button",{onClick:()=>e(`/az/stores/${g.id}`),className:"flex items-center justify-between p-4 bg-gray-50 rounded-lg hover:bg-gray-100 transition-colors text-left",children:[a.jsxs("div",{children:[a.jsx("p",{className:"font-medium text-gray-900",children:g.dba_name||g.name}),a.jsxs("p",{className:"text-sm text-gray-600",children:[g.city,", ",g.state]}),a.jsxs("p",{className:"text-xs text-gray-500 mt-1",children:["Last crawl: ",x(g.last_crawl_at||null)]})]}),a.jsx(Cf,{className:"w-5 h-5 text-gray-400"})]},g.id))})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-4",children:"Top Brands"}),a.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-4",children:s.slice(0,12).map(g=>a.jsxs("div",{className:"p-4 bg-gray-50 rounded-lg text-center",children:[a.jsx("p",{className:"font-medium text-gray-900 text-sm line-clamp-2",children:g.brand_name}),a.jsx("p",{className:"text-lg font-bold text-purple-600 mt-1",children:g.product_count}),a.jsx("p",{className:"text-xs text-gray-500",children:"products"})]},g.brand_name))})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-4",children:"Product Categories"}),a.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-6 gap-4",children:l.slice(0,12).map((g,b)=>a.jsxs("div",{className:"p-4 bg-gray-50 rounded-lg text-center",children:[a.jsx("p",{className:"font-medium text-gray-900",children:g.type}),g.subcategory&&a.jsx("p",{className:"text-xs text-gray-600",children:g.subcategory}),a.jsx("p",{className:"text-lg font-bold text-orange-600 mt-1",children:g.product_count}),a.jsx("p",{className:"text-xs text-gray-500",children:"products"})]},b))})]})]}),f==="stores"&&a.jsx("div",{className:"space-y-4",children:a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"table table-sm w-full",children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{children:"Store Name"}),a.jsx("th",{children:"City"}),a.jsx("th",{className:"text-center",children:"Platform ID"}),a.jsx("th",{className:"text-center",children:"Last Crawl"}),a.jsx("th",{})]})}),a.jsx("tbody",{children:n.map(g=>a.jsxs("tr",{className:"hover",children:[a.jsx("td",{className:"font-medium",children:g.dba_name||g.name}),a.jsxs("td",{children:[g.city,", ",g.state]}),a.jsx("td",{className:"text-center",children:g.platform_dispensary_id?a.jsx("span",{className:"badge badge-success badge-sm",children:"Resolved"}):a.jsx("span",{className:"badge badge-warning badge-sm",children:"Pending"})}),a.jsx("td",{className:"text-center text-sm text-gray-600",children:x(g.last_crawl_at||null)}),a.jsx("td",{children:a.jsx("button",{onClick:()=>e(`/az/stores/${g.id}`),className:"btn btn-xs btn-ghost",children:"View"})})]},g.id))})]})})}),f==="brands"&&a.jsx("div",{className:"space-y-4",children:s.length===0?a.jsx("p",{className:"text-center py-8 text-gray-500",children:"No brands found. Run a crawl to populate brand data."}):a.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-6 gap-4",children:s.map(g=>a.jsxs("div",{className:"border border-gray-200 rounded-lg p-4 text-center hover:border-purple-300 hover:shadow-md transition-all",children:[a.jsx("p",{className:"font-medium text-gray-900 text-sm line-clamp-2 h-10",children:g.brand_name}),a.jsxs("div",{className:"mt-2 space-y-1",children:[a.jsxs("div",{className:"flex justify-between text-xs",children:[a.jsx("span",{className:"text-gray-500",children:"Products:"}),a.jsx("span",{className:"font-semibold",children:g.product_count})]}),a.jsxs("div",{className:"flex justify-between text-xs",children:[a.jsx("span",{className:"text-gray-500",children:"Stores:"}),a.jsx("span",{className:"font-semibold",children:g.dispensary_count})]})]})]},g.brand_name))})}),f==="categories"&&a.jsx("div",{className:"space-y-4",children:l.length===0?a.jsx("p",{className:"text-center py-8 text-gray-500",children:"No categories found. Run a crawl to populate category data."}):a.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",children:l.map((g,b)=>a.jsxs("div",{className:"border border-gray-200 rounded-lg p-4 hover:border-orange-300 hover:shadow-md transition-all",children:[a.jsx("p",{className:"font-medium text-gray-900",children:g.type}),g.subcategory&&a.jsx("p",{className:"text-sm text-gray-600",children:g.subcategory}),a.jsxs("div",{className:"mt-3 grid grid-cols-2 gap-2 text-xs",children:[a.jsxs("div",{className:"bg-gray-50 rounded p-2 text-center",children:[a.jsx("p",{className:"font-bold text-lg text-orange-600",children:g.product_count}),a.jsx("p",{className:"text-gray-500",children:"products"})]}),a.jsxs("div",{className:"bg-gray-50 rounded p-2 text-center",children:[a.jsx("p",{className:"font-bold text-lg text-blue-600",children:g.brand_count}),a.jsx("p",{className:"text-gray-500",children:"brands"})]})]}),g.avg_thc!=null&&a.jsxs("p",{className:"text-xs text-gray-500 mt-2 text-center",children:["Avg THC: ",g.avg_thc.toFixed(1),"%"]})]},b))})})]})]})]})})}function Ii({title:e,value:t,icon:r,color:n}){const i={blue:"bg-blue-50",green:"bg-green-50",purple:"bg-purple-50",orange:"bg-orange-50",cyan:"bg-cyan-50",red:"bg-red-50"};return a.jsx("div",{className:"bg-white rounded-lg border border-gray-200 p-4",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:`p-2 ${i[n]||"bg-gray-50"} rounded-lg`,children:r}),a.jsxs("div",{children:[a.jsx("p",{className:"text-xs text-gray-600",children:e}),a.jsx("p",{className:"text-xl font-bold text-gray-900",children:t.toLocaleString()})]})]})})}function Vo({active:e,onClick:t,icon:r,label:n}){return a.jsxs("button",{onClick:t,className:`flex items-center gap-2 py-4 px-2 text-sm font-medium border-b-2 transition-colors ${e?"border-blue-600 text-blue-600":"border-transparent text-gray-600 hover:text-gray-900"}`,children:[r,n]})}function ve({children:e}){const{isAuthenticated:t,checkAuth:r}=Ph();return h.useEffect(()=>{r()},[]),t?a.jsx(a.Fragment,{children:e}):a.jsx(H1,{to:"/login",replace:!0})}function SF(){return a.jsx(QC,{children:a.jsxs(HC,{children:[a.jsx(de,{path:"/login",element:a.jsx(DA,{})}),a.jsx(de,{path:"/",element:a.jsx(ve,{children:a.jsx(GB,{})})}),a.jsx(de,{path:"/products",element:a.jsx(ve,{children:a.jsx(ZB,{})})}),a.jsx(de,{path:"/products/:id",element:a.jsx(ve,{children:a.jsx(JB,{})})}),a.jsx(de,{path:"/stores",element:a.jsx(ve,{children:a.jsx(QB,{})})}),a.jsx(de,{path:"/dispensaries",element:a.jsx(ve,{children:a.jsx(eF,{})})}),a.jsx(de,{path:"/dispensaries/:state/:city/:slug",element:a.jsx(ve,{children:a.jsx(tF,{})})}),a.jsx(de,{path:"/stores/:state/:storeName/:slug/brands",element:a.jsx(ve,{children:a.jsx(nF,{})})}),a.jsx(de,{path:"/stores/:state/:storeName/:slug/specials",element:a.jsx(ve,{children:a.jsx(iF,{})})}),a.jsx(de,{path:"/stores/:state/:storeName/:slug",element:a.jsx(ve,{children:a.jsx(rF,{})})}),a.jsx(de,{path:"/categories",element:a.jsx(ve,{children:a.jsx(aF,{})})}),a.jsx(de,{path:"/campaigns",element:a.jsx(ve,{children:a.jsx(sF,{})})}),a.jsx(de,{path:"/analytics",element:a.jsx(ve,{children:a.jsx(lF,{})})}),a.jsx(de,{path:"/settings",element:a.jsx(ve,{children:a.jsx(cF,{})})}),a.jsx(de,{path:"/changes",element:a.jsx(ve,{children:a.jsx(xF,{})})}),a.jsx(de,{path:"/proxies",element:a.jsx(ve,{children:a.jsx(dF,{})})}),a.jsx(de,{path:"/logs",element:a.jsx(ve,{children:a.jsx(pF,{})})}),a.jsx(de,{path:"/scraper-tools",element:a.jsx(ve,{children:a.jsx(gF,{})})}),a.jsx(de,{path:"/scraper-monitor",element:a.jsx(ve,{children:a.jsx(hF,{})})}),a.jsx(de,{path:"/scraper-schedule",element:a.jsx(ve,{children:a.jsx(mF,{})})}),a.jsx(de,{path:"/az-schedule",element:a.jsx(ve,{children:a.jsx(vF,{})})}),a.jsx(de,{path:"/az",element:a.jsx(ve,{children:a.jsx(bF,{})})}),a.jsx(de,{path:"/az/stores/:id",element:a.jsx(ve,{children:a.jsx(jF,{})})}),a.jsx(de,{path:"/api-permissions",element:a.jsx(ve,{children:a.jsx(yF,{})})}),a.jsx(de,{path:"/wholesale-analytics",element:a.jsx(ve,{children:a.jsx(wF,{})})}),a.jsx(de,{path:"*",element:a.jsx(H1,{to:"/",replace:!0})})]})})}Od.createRoot(document.getElementById("root")).render(a.jsx(ps.StrictMode,{children:a.jsx(SF,{})})); diff --git a/frontend/dist/index.html b/frontend/dist/index.html index 37352ff8..66603e29 100644 --- a/frontend/dist/index.html +++ b/frontend/dist/index.html @@ -5,7 +5,7 @@ Dutchie Menus Admin - +