PageSourceSearch

https://5stagrp-manager.replit.app/assets/index-D_i5QCrQ.js

js 5stagrp-manager.replit.app collected 2026-10-03 03:47:01 UTC 1,687,942 bytes, 222 lines download raw bytes

vendor: 5,321 bytes, line 1
1function CX(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const s in r)if(s!=="default"&&!(s in e)){const i=Object.getOwnPropertyDescriptor(r,s);i&&Object.defineProperty(e,s,i.get?i:{enumerable:!0,get:()=>r[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const l of i.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();var hx=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Bt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var bj={exports:{}},Ef={};var vM;function AX(){if(vM)return Ef;vM=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,s,i){var l=null;if(i!==void 0&&(l=""+i),s.key!==void 0&&(l=""+s.key),"key"in s){i={};for(var u in s)u!=="key"&&(i[u]=s[u])}else i=s;return s=i.ref,{$$typeof:e,type:r,key:l,ref:s!==void 0?s:null,props:i}}return Ef.Fragment=t,Ef.jsx=n,Ef.jsxs=n,Ef}var bM;function TX(){return bM||(bM=1,bj.exports=AX()),bj.exports}var a=TX(),jj={exports:{}},_f={},wj={exports:{}},Nj={};var jM;function kX(){return jM||(jM=1,(function(e){function t(D,q){var K=D.length;D.push(q);e:for(;0<K;){var Y=K-1>>>1,z=D[Y];if(0<s(z,q))D[Y]=q,D[K]=z,K=Y;else break e}}function n(D){return D.length===0?null:D[0]}function r(D){if(D.length===0)return null;var q=D[0],K=D.pop();if(K!==q){D[0]=K;e:for(var Y=0,z=D.length,Z=z>>>1;Y<Z;){var F=2*(Y+1)-1,B=D[F],X=F+1,Q=D[X];if(0>s(B,K))X<z&&0>s(Q,B)?(D[Y]=Q,D[X]=K,Y=X):(D[Y]=B,D[F]=K,Y=F);else if(X<z&&0>s(Q,K))D[Y]=Q,D[X]=K,Y=X;else break e}}return q}function s(D,q){var K=D.sortIndex-q.sortIndex;return K!==0?K:D.id-q.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var l=Date,u=l.now();e.unstable_now=function(){return l.now()-u}}var d=[],f=[],h=1,p=null,x=3,y=!1,w=!1,j=!1,b=!1,C=typeof setTimeout=="function"?setTimeout:null,N=typeof clearTimeout=="function"?clearTimeout:null,k=typeof setImmediate<"u"?setImmediate:null;function T(D){for(var q=n(f);q!==null;){if(q.callback===null)r(f);else if(q.startTime<=D)r(f),q.sortIndex=q.expirationTime,t(d,q);else break;q=n(f)}}function A(D){if(j=!1,T(D),!w)if(n(d)!==null)w=!0,P||(P=!0,I());else{var q=n(f);q!==null&&V(A,q.startTime-D)}}var P=!1,E=-1,_=5,R=-1;function H(){return b?!0:!(e.unstable_now()-R<_)}function L(){if(b=!1,P){var D=e.unstable_now();R=D;var q=!0;try{e:{w=!1,j&&(j=!1,N(E),E=-1),y=!0;var K=x;try{t:{for(T(D),p=n(d);p!==null&&!(p.expirationTime>D&&H());){var Y=p.callback;if(typeof Y=="function"){p.callback=null,x=p.priorityLevel;var z=Y(p.expirationTime<=D);if(D=e.unstable_now(),typeof z=="function"){p.callback=z,T(D),q=!0;break t}p===n(d)&&r(d),T(D)}else r(d);p=n(d)}if(p!==null)q=!0;else{var Z=n(f);Z!==null&&V(A,Z.startTime-D),q=!1}}break e}finally{p=null,x=K,y=!1}q=void 0}}finally{q?I():P=!1}}}var I;if(typeof k=="function")I=function(){k(L)};else if(typeof MessageChannel<"u"){var W=new MessageChannel,U=W.port2;W.port1.onmessage=L,I=function(){U.postMessage(null)}}else I=function(){C(L,0)};function V(D,q){E=C(function(){D(e.unstable_now())},q)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(D){D.callback=null},e.unstable_forceFrameRate=function(D){0>D||125<D?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):_=0<D?Math.floor(1e3/D):5},e.unstable_getCurrentPriorityLevel=function(){return x},e.unstable_next=function(D){switch(x){case 1:case 2:case 3:var q=3;break;default:q=x}var K=x;x=q;try{return D()}finally{x=K}},e.unstable_requestPaint=function(){b=!0},e.unstable_runWithPriority=function(D,q){switch(D){case 1:case 2:case 3:case 4:case 5:break;default:D=3}var K=x;x=D;try{return q()}finally{x=K}},e.unstable_scheduleCallback=function(D,q,K){var Y=e.unstable_now();switch(typeof K=="object"&&K!==null?(K=K.delay,K=typeof K=="number"&&0<K?Y+K:Y):K=Y,D){case 1:var z=-1;break;case 2:z=250;break;case 5:z=1073741823;break;case 4:z=1e4;break;default:z=5e3}return z=K+z,D={id:h++,callback:q,priorityLevel:D,startTime:K,expirationTime:z,sortIndex:-1},K>Y?(D.sortIndex=K,t(f,D),n(d)===null&&D===n(f)&&(j?(N(E),E=-1):j=!0,V(A,K-Y))):(D.sortIndex=z,t(d,D),w||y||(w=!0,P||(P=!0,I()))),D},e.unstable_shouldYield=H,e.unstable_wrapCallback=function(D){var q=x;return function(){var K=x;x=q;try{return D.apply(this,arguments)}finally{x=K}}}})(Nj)),Nj}var wM;
vendor: 9,085 bytes, line 1
1function OX(){return wM||(wM=1,wj.exports=kX()),wj.exports}var Sj={exports:{}},ot={};var NM;function PX(){if(NM)return ot;NM=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),i=Symbol.for("react.consumer"),l=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),p=Symbol.iterator;function x(z){return z===null||typeof z!="object"?null:(z=p&&z[p]||z["@@iterator"],typeof z=="function"?z:null)}var y={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},w=Object.assign,j={};function b(z,Z,F){this.props=z,this.context=Z,this.refs=j,this.updater=F||y}b.prototype.isReactComponent={},b.prototype.setState=function(z,Z){if(typeof z!="object"&&typeof z!="function"&&z!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,z,Z,"setState")},b.prototype.forceUpdate=function(z){this.updater.enqueueForceUpdate(this,z,"forceUpdate")};function C(){}C.prototype=b.prototype;function N(z,Z,F){this.props=z,this.context=Z,this.refs=j,this.updater=F||y}var k=N.prototype=new C;k.constructor=N,w(k,b.prototype),k.isPureReactComponent=!0;var T=Array.isArray,A={H:null,A:null,T:null,S:null,V:null},P=Object.prototype.hasOwnProperty;function E(z,Z,F,B,X,Q){return F=Q.ref,{$$typeof:e,type:z,key:Z,ref:F!==void 0?F:null,props:Q}}function _(z,Z){return E(z.type,Z,void 0,void 0,void 0,z.props)}function R(z){return typeof z=="object"&&z!==null&&z.$$typeof===e}function H(z){var Z={"=":"=0",":":"=2"};return"$"+z.replace(/[=:]/g,function(F){return Z[F]})}var L=/\/+/g;function I(z,Z){return typeof z=="object"&&z!==null&&z.key!=null?H(""+z.key):Z.toString(36)}function W(){}function U(z){switch(z.status){case"fulfilled":return z.value;case"rejected":throw z.reason;default:switch(typeof z.status=="string"?z.then(W,W):(z.status="pending",z.then(function(Z){z.status==="pending"&&(z.status="fulfilled",z.value=Z)},function(Z){z.status==="pending"&&(z.status="rejected",z.reason=Z)})),z.status){case"fulfilled":return z.value;case"rejected":throw z.reason}}throw z}function V(z,Z,F,B,X){var Q=typeof z;(Q==="undefined"||Q==="boolean")&&(z=null);var se=!1;if(z===null)se=!0;else switch(Q){case"bigint":case"string":case"number":se=!0;break;case"object":switch(z.$$typeof){case e:case t:se=!0;break;case h:return se=z._init,V(se(z._payload),Z,F,B,X)}}if(se)return X=X(z),se=B===""?"."+I(z,0):B,T(X)?(F="",se!=null&&(F=se.replace(L,"$&/")+"/"),V(X,Z,F,"",function(ue){return ue})):X!=null&&(R(X)&&(X=_(X,F+(X.key==null||z&&z.key===X.key?"":(""+X.key).replace(L,"$&/")+"/")+se)),Z.push(X)),1;se=0;var ee=B===""?".":B+":";if(T(z))for(var ve=0;ve<z.length;ve++)B=z[ve],Q=ee+I(B,ve),se+=V(B,Z,F,Q,X);else if(ve=x(z),typeof ve=="function")for(z=ve.call(z),ve=0;!(B=z.next()).done;)B=B.value,Q=ee+I(B,ve++),se+=V(B,Z,F,Q,X);else if(Q==="object"){if(typeof z.then=="function")return V(U(z),Z,F,B,X);throw Z=String(z),Error("Objects are not valid as a React child (found: "+(Z==="[object Object]"?"object with keys {"+Object.keys(z).join(", ")+"}":Z)+"). If you meant to render a collection of children, use an array instead.")}return se}function D(z,Z,F){if(z==null)return z;var B=[],X=0;return V(z,B,"","",function(Q){return Z.call(F,Q,X++)}),B}function q(z){if(z._status===-1){var Z=z._result;Z=Z(),Z.then(function(F){(z._status===0||z._status===-1)&&(z._status=1,z._result=F)},function(F){(z._status===0||z._status===-1)&&(z._status=2,z._result=F)}),z._status===-1&&(z._status=0,z._result=Z)}if(z._status===1)return z._result.default;throw z._result}var K=typeof reportError=="function"?reportError:function(z){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var Z=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof z=="object"&&z!==null&&typeof z.message=="string"?String(z.message):String(z),error:z});if(!window.dispatchEvent(Z))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",z);return}console.error(z)};function Y(){}return ot.Children={map:D,forEach:function(z,Z,F){D(z,function(){Z.apply(this,arguments)},F)},count:function(z){var Z=0;return D(z,function(){Z++}),Z},toArray:function(z){return D(z,function(Z){return Z})||[]},only:function(z){if(!R(z))throw Error("React.Children.only expected to receive a single React element child.");return z}},ot.Component=b,ot.Fragment=n,ot.Profiler=s,ot.PureComponent=N,ot.StrictMode=r,ot.Suspense=d,ot.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=A,ot.__COMPILER_RUNTIME={__proto__:null,c:function(z){return A.H.useMemoCache(z)}},ot.cache=function(z){return function(){return z.apply(null,arguments)}},ot.cloneElement=function(z,Z,F){if(z==null)throw Error("The argument must be a React element, but you passed "+z+".");var B=w({},z.props),X=z.key,Q=void 0;if(Z!=null)for(se in Z.ref!==void 0&&(Q=void 0),Z.key!==void 0&&(X=""+Z.key),Z)!P.call(Z,se)||se==="key"||se==="__self"||se==="__source"||se==="ref"&&Z.ref===void 0||(B[se]=Z[se]);var se=arguments.length-2;if(se===1)B.children=F;else if(1<se){for(var ee=Array(se),ve=0;ve<se;ve++)ee[ve]=arguments[ve+2];B.children=ee}return E(z.type,X,void 0,void 0,Q,B)},ot.createContext=function(z){return z={$$typeof:l,_currentValue:z,_currentValue2:z,_threadCount:0,Provider:null,Consumer:null},z.Provider=z,z.Consumer={$$typeof:i,_context:z},z},ot.createElement=function(z,Z,F){var B,X={},Q=null;if(Z!=null)for(B in Z.key!==void 0&&(Q=""+Z.key),Z)P.call(Z,B)&&B!=="key"&&B!=="__self"&&B!=="__source"&&(X[B]=Z[B]);var se=arguments.length-2;if(se===1)X.children=F;else if(1<se){for(var ee=Array(se),ve=0;ve<se;ve++)ee[ve]=arguments[ve+2];X.children=ee}if(z&&z.defaultProps)for(B in se=z.defaultProps,se)X[B]===void 0&&(X[B]=se[B]);return E(z,Q,void 0,void 0,null,X)},ot.createRef=function(){return{current:null}},ot.forwardRef=function(z){return{$$typeof:u,render:z}},ot.isValidElement=R,ot.lazy=function(z){return{$$typeof:h,_payload:{_status:-1,_result:z},_init:q}},ot.memo=function(z,Z){return{$$typeof:f,type:z,compare:Z===void 0?null:Z}},ot.startTransition=function(z){var Z=A.T,F={};A.T=F;try{var B=z(),X=A.S;X!==null&&X(F,B),typeof B=="object"&&B!==null&&typeof B.then=="function"&&B.then(Y,K)}catch(Q){K(Q)}finally{A.T=Z}},ot.unstable_useCacheRefresh=function(){return A.H.useCacheRefresh()},ot.use=function(z){return A.H.use(z)},ot.useActionState=function(z,Z,F){return A.H.useActionState(z,Z,F)},ot.useCallback=function(z,Z){return A.H.useCallback(z,Z)},ot.useContext=function(z){return A.H.useContext(z)},ot.useDebugValue=function(){},ot.useDeferredValue=function(z,Z){return A.H.useDeferredValue(z,Z)},ot.useEffect=function(z,Z,F){var B=A.H;if(typeof F=="function")throw Error("useEffect CRUD overload is not enabled in this build of React.");return B.useEffect(z,Z)},ot.useId=function(){return A.H.useId()},ot.useImperativeHandle=function(z,Z,F){return A.H.useImperativeHandle(z,Z,F)},ot.useInsertionEffect=function(z,Z){return A.H.useInsertionEffect(z,Z)},ot.useLayoutEffect=function(z,Z){return A.H.useLayoutEffect(z,Z)},ot.useMemo=function(z,Z){return A.H.useMemo(z,Z)},ot.useOptimistic=function(z,Z){return A.H.useOptimistic(z,Z)},ot.useReducer=function(z,Z,F){return A.H.useReducer(z,Z,F)},ot.useRef=function(z){return A.H.useRef(z)},ot.useState=function(z){return A.H.useState(z)},ot.useSyncExternalStore=function(z,Z,F){return A.H.useSyncExternalStore(z,Z,F)},ot.useTransition=function(){return A.H.useTransition()},ot.version="19.1.0",ot}var SM;function rv(){return SM||(SM=1,Sj.exports=PX()),Sj.exports}var Cj={exports:{}},sr={};var CM;function EX(){if(CM)return sr;CM=1;var e=rv();function t(d){var f="https://react.dev/errors/"+d;if(1<arguments.length){f+="?args[]="+encodeURIComponent(arguments[1]);for(var h=2;h<arguments.length;h++)f+="&args[]="+encodeURIComponent(arguments[h])}return"Minified React error #"+d+"; visit "+f+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var r={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},s=Symbol.for("react.portal");function i(d,f,h){var p=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:s,key:p==null?null:""+p,children:d,containerInfo:f,implementation:h}}var l=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function u(d,f){if(d==="font")return"";if(typeof f=="string")return f==="use-credentials"?f:""}return sr.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,sr.createPortal=function(d,f){var h=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!f||f.nodeType!==1&&f.nodeType!==9&&f.nodeType!==11)throw Error(t(299));return i(d,f,null,h)},sr.flushSync=function(d){var f=l.T,h=r.p;try{if(l.T=null,r.p=2,d)return d()}finally{l.T=f,r.p=h,r.d.f()}}
vendor: 4,875 bytes, line 1
1,sr.preconnect=function(d,f){typeof d=="string"&&(f?(f=f.crossOrigin,f=typeof f=="string"?f==="use-credentials"?f:"":void 0):f=null,r.d.C(d,f))},sr.prefetchDNS=function(d){typeof d=="string"&&r.d.D(d)},sr.preinit=function(d,f){if(typeof d=="string"&&f&&typeof f.as=="string"){var h=f.as,p=u(h,f.crossOrigin),x=typeof f.integrity=="string"?f.integrity:void 0,y=typeof f.fetchPriority=="string"?f.fetchPriority:void 0;h==="style"?r.d.S(d,typeof f.precedence=="string"?f.precedence:void 0,{crossOrigin:p,integrity:x,fetchPriority:y}):h==="script"&&r.d.X(d,{crossOrigin:p,integrity:x,fetchPriority:y,nonce:typeof f.nonce=="string"?f.nonce:void 0})}},sr.preinitModule=function(d,f){if(typeof d=="string")if(typeof f=="object"&&f!==null){if(f.as==null||f.as==="script"){var h=u(f.as,f.crossOrigin);r.d.M(d,{crossOrigin:h,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0})}}else f==null&&r.d.M(d)},sr.preload=function(d,f){if(typeof d=="string"&&typeof f=="object"&&f!==null&&typeof f.as=="string"){var h=f.as,p=u(h,f.crossOrigin);r.d.L(d,h,{crossOrigin:p,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0,type:typeof f.type=="string"?f.type:void 0,fetchPriority:typeof f.fetchPriority=="string"?f.fetchPriority:void 0,referrerPolicy:typeof f.referrerPolicy=="string"?f.referrerPolicy:void 0,imageSrcSet:typeof f.imageSrcSet=="string"?f.imageSrcSet:void 0,imageSizes:typeof f.imageSizes=="string"?f.imageSizes:void 0,media:typeof f.media=="string"?f.media:void 0})}},sr.preloadModule=function(d,f){if(typeof d=="string")if(f){var h=u(f.as,f.crossOrigin);r.d.m(d,{as:typeof f.as=="string"&&f.as!=="script"?f.as:void 0,crossOrigin:h,integrity:typeof f.integrity=="string"?f.integrity:void 0})}else r.d.m(d)},sr.requestFormReset=function(d){r.d.r(d)},sr.unstable_batchedUpdates=function(d,f){return d(f)},sr.useFormState=function(d,f,h){return l.H.useFormState(d,f,h)},sr.useFormStatus=function(){return l.H.useHostTransitionStatus()},sr.version="19.1.0",sr}var AM;function LF(){if(AM)return Cj.exports;AM=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Cj.exports=EX(),Cj.exports}var TM;function _X(){if(TM)return _f;TM=1;var e=OX(),t=rv(),n=LF();function r(o){var c="https://react.dev/errors/"+o;if(1<arguments.length){c+="?args[]="+encodeURIComponent(arguments[1]);for(var m=2;m<arguments.length;m++)c+="&args[]="+encodeURIComponent(arguments[m])}return"Minified React error #"+o+"; visit "+c+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(o){return!(!o||o.nodeType!==1&&o.nodeType!==9&&o.nodeType!==11)}function i(o){var c=o,m=o;if(o.alternate)for(;c.return;)c=c.return;else{o=c;do c=o,(c.flags&4098)!==0&&(m=c.return),o=c.return;while(o)}return c.tag===3?m:null}function l(o){if(o.tag===13){var c=o.memoizedState;if(c===null&&(o=o.alternate,o!==null&&(c=o.memoizedState)),c!==null)return c.dehydrated}return null}function u(o){if(i(o)!==o)throw Error(r(188))}function d(o){var c=o.alternate;if(!c){if(c=i(o),c===null)throw Error(r(188));return c!==o?null:o}for(var m=o,g=c;;){var S=m.return;if(S===null)break;var O=S.alternate;if(O===null){if(g=S.return,g!==null){m=g;continue}break}if(S.child===O.child){for(O=S.child;O;){if(O===m)return u(S),o;if(O===g)return u(S),c;O=O.sibling}throw Error(r(188))}if(m.return!==g.return)m=S,g=O;else{for(var $=!1,G=S.child;G;){if(G===m){$=!0,m=S,g=O;break}if(G===g){$=!0,g=S,m=O;break}G=G.sibling}if(!$){for(G=O.child;G;){if(G===m){$=!0,m=O,g=S;break}if(G===g){$=!0,g=O,m=S;break}G=G.sibling}if(!$)throw Error(r(189))}}if(m.alternate!==g)throw Error(r(190))}if(m.tag!==3)throw Error(r(188));return m.stateNode.current===m?o:c}function f(o){var c=o.tag;if(c===5||c===26||c===27||c===6)return o;for(o=o.child;o!==null;){if(c=f(o),c!==null)return c;o=o.sibling}return null}var h=Object.assign,p=Symbol.for("react.element"),x=Symbol.for("react.transitional.element"),y=Symbol.for("react.portal"),w=Symbol.for("react.fragment"),j=Symbol.for("react.strict_mode"),b=Symbol.for("react.profiler"),C=Symbol.for("react.provider"),N=Symbol.for("react.consumer"),k=Symbol.for("react.context"),T=Symbol.for("react.forward_ref"),A=Symbol.for("react.suspense"),P=Symbol.for("react.suspense_list"),E=Symbol.for("react.memo"),_=Symbol.for("react.lazy"),R=Symbol.for("react.activity"),H=Symbol.for("react.memo_cache_sentinel"),L=Symbol.iterator;function I(o){return o===null||typeof o!="object"?null:(o=L&&o[L]||o["@@iterator"],typeof o=="function"?o:null)}var W=Symbol.for("react.client.reference");function U(o){if(o==null)return null;if(typeof o=="function")return o.$$typeof===W?null:o.displayName||o.name||null;
vendor: 6,406 bytes, line 1
1if(typeof o=="string")return o;switch(o){case w:return"Fragment";case b:return"Profiler";case j:return"StrictMode";case A:return"Suspense";case P:return"SuspenseList";case R:return"Activity"}if(typeof o=="object")switch(o.$$typeof){case y:return"Portal";case k:return(o.displayName||"Context")+".Provider";case N:return(o._context.displayName||"Context")+".Consumer";case T:var c=o.render;return o=o.displayName,o||(o=c.displayName||c.name||"",o=o!==""?"ForwardRef("+o+")":"ForwardRef"),o;case E:return c=o.displayName||null,c!==null?c:U(o.type)||"Memo";case _:c=o._payload,o=o._init;try{return U(o(c))}catch{}}return null}var V=Array.isArray,D=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,q=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,K={pending:!1,data:null,method:null,action:null},Y=[],z=-1;function Z(o){return{current:o}}function F(o){0>z||(o.current=Y[z],Y[z]=null,z--)}function B(o,c){z++,Y[z]=o.current,o.current=c}var X=Z(null),Q=Z(null),se=Z(null),ee=Z(null);function ve(o,c){switch(B(se,c),B(Q,o),B(X,null),c.nodeType){case 9:case 11:o=(o=c.documentElement)&&(o=o.namespaceURI)?K_(o):0;break;default:if(o=c.tagName,c=c.namespaceURI)c=K_(c),o=W_(c,o);else switch(o){case"svg":o=1;break;case"math":o=2;break;default:o=0}}F(X),B(X,o)}function ue(){F(X),F(Q),F(se)}function de(o){o.memoizedState!==null&&B(ee,o);var c=X.current,m=W_(c,o.type);c!==m&&(B(Q,o),B(X,m))}function Se(o){Q.current===o&&(F(X),F(Q)),ee.current===o&&(F(ee),Af._currentValue=K)}var he=Object.prototype.hasOwnProperty,ce=e.unstable_scheduleCallback,te=e.unstable_cancelCallback,_e=e.unstable_shouldYield,Oe=e.unstable_requestPaint,Te=e.unstable_now,Le=e.unstable_getCurrentPriorityLevel,ze=e.unstable_ImmediatePriority,at=e.unstable_UserBlockingPriority,xt=e.unstable_NormalPriority,dt=e.unstable_LowPriority,Mt=e.unstable_IdlePriority,ds=e.log,ua=e.unstable_setDisableYieldValue,rr=null,$n=null;function Fr(o){if(typeof ds=="function"&&ua(o),$n&&typeof $n.setStrictMode=="function")try{$n.setStrictMode(rr,o)}catch{}}var In=Math.clz32?Math.clz32:pc,hc=Math.log,Zo=Math.LN2;function pc(o){return o>>>=0,o===0?32:31-(hc(o)/Zo|0)|0}var qr=256,Fi=4194304;function Br(o){var c=o&42;if(c!==0)return c;switch(o&-o){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:return 64;case 128:return 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 o&4194048;case 4194304:case 8388608:case 16777216:case 33554432:return o&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return o}}function Bs(o,c,m){var g=o.pendingLanes;if(g===0)return 0;var S=0,O=o.suspendedLanes,$=o.pingedLanes;o=o.warmLanes;var G=g&134217727;return G!==0?(g=G&~O,g!==0?S=Br(g):($&=G,$!==0?S=Br($):m||(m=G&~o,m!==0&&(S=Br(m))))):(G=g&~O,G!==0?S=Br(G):$!==0?S=Br($):m||(m=g&~o,m!==0&&(S=Br(m)))),S===0?0:c!==0&&c!==S&&(c&O)===0&&(O=S&-S,m=c&-c,O>=m||O===32&&(m&4194048)!==0)?c:S}function da(o,c){return(o.pendingLanes&~(o.suspendedLanes&~o.pingedLanes)&c)===0}function zs(o,c){switch(o){case 1:case 2:case 4:case 8:case 64:return c+250;case 16:case 32: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 c+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Us(){var o=qr;return qr<<=1,(qr&4194048)===0&&(qr=256),o}function Jo(){var o=Fi;return Fi<<=1,(Fi&62914560)===0&&(Fi=4194304),o}function qi(o){for(var c=[],m=0;31>m;m++)c.push(o);return c}function Hs(o,c){o.pendingLanes|=c,c!==268435456&&(o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0)}function pe(o,c,m,g,S,O){var $=o.pendingLanes;o.pendingLanes=m,o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0,o.expiredLanes&=m,o.entangledLanes&=m,o.errorRecoveryDisabledLanes&=m,o.shellSuspendCounter=0;var G=o.entanglements,J=o.expirationTimes,me=o.hiddenUpdates;for(m=$&~m;0<m;){var we=31-In(m),Ce=1<<we;G[we]=0,J[we]=-1;var xe=me[we];if(xe!==null)for(me[we]=null,we=0;we<xe.length;we++){var ge=xe[we];ge!==null&&(ge.lane&=-536870913)}m&=~Ce}g!==0&&Pe(o,g,0),O!==0&&S===0&&o.tag!==0&&(o.suspendedLanes|=O&~($&~c))}function Pe(o,c,m){o.pendingLanes|=c,o.suspendedLanes&=~c;var g=31-In(c);o.entangledLanes|=c,o.entanglements[g]=o.entanglements[g]|1073741824|m&4194090}function $e(o,c){var m=o.entangledLanes|=c;for(o=o.entanglements;m;){var g=31-In(m),S=1<<g;S&c|o[g]&c&&(o[g]|=c),m&=~S}}function St(o){switch(o){case 2:o=1;break;case 8:o=4;break;case 32:o=16;break;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:o=128;break;case 268435456:o=134217728;break;default:o=0}return o}function Rt(o){return o&=-o,2<o?8<o?(o&134217727)!==0?32:268435456:8:2}function fs(){var o=q.p;return o!==0?o:(o=window.event,o===void 0?32:mM(o.type))}function fa(o,c){var m=q.p;try{return q.p=o,c()}finally{q.p=m}}var Qe=Math.random().toString(36).slice(2),kt="__reactFiber$"+Qe,Jt="__reactProps$"+Qe,Sn="__reactContainer$"+Qe,xc="__reactEvents$"+Qe,ip="__reactListeners$"+Qe,wb="__reactHandles$"+Qe,op="__reactResources$"+Qe,el="__reactMarker$"+Qe;function ma(o){delete o[kt],delete o[Jt],delete o[xc],delete o[ip],delete o[wb]}function Vs(o){var c=o[kt];if(c)return c;for(var m=o.parentNode;m;){if(c=m[Sn]||m[kt]){if(m=c.alternate,c.child!==null||m!==null&&m.child!==null)for(o=Z_(o);o!==null;){if(m=o[kt])return m;o=Z_(o)}return c}o=m,m=o.parentNode}return null}function ms(o){if(o=o[kt]||o[Sn]){var c=o.tag;if(c===5||c===6||c===13||c===26||c===27||c===3)return o}return null}function Gs(o){var c=o.tag;if(c===5||c===26||c===27||c===6)return o.stateNode;throw Error(r(33))}function Bi(o){var c=o[op];return c||(c=o[op]={hoistableStyles:new Map,hoistableScripts:new Map}),c}function xn(o){o[el]=!0}var hs=new Set,zi={};function ps(o,c){Cn(o,c),Cn(o+"Capture",c)}function Cn(o,c){for(zi[o]=c,o=0;o<c.length;o++)hs.add(c[o])}var gc=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u
1037D\\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]*$"),yc={},tl={};function vc(o){return he.call(tl,o)?!0:he.call(yc,o)?!1:gc.test(o)?tl[o]=!0:(yc[o]=!0,!1)}function Ks(o,c,m){if(vc(c))if(m===null)o.removeAttribute(c);else{switch(typeof m){case"undefined":case"function":case"symbol":o.removeAttribute(c);return;case"boolean":var g=c.toLowerCase().slice(0,5);if(g!=="data-"&&g!=="aria-"){o.removeAttribute(c);return}}o.setAttribute(c,""+m)}}function Ws(o,c,m){if(m===null)o.removeAttribute(c);else{switch(typeof m){case"undefined":case"function":case"symbol":case"boolean":o.removeAttribute(c);return}o.setAttribute(c,""+m)}}function zr(o,c,m,g){if(g===null)o.removeAttribute(m);else{switch(typeof g){case"undefined":case"function":case"symbol":case"boolean":o.removeAttribute(m);return}o.setAttributeNS(c,m,""+g)}}var bc,Md;function Ys(o){if(bc===void 0)try{throw Error()}catch(m){var c=m.stack.trim().match(/\n( *(at )?)/);bc=c&&c[1]||"",Md=-1<m.stack.indexOf(`
2    at`)?" (<anonymous>)":-1<m.stack.indexOf("@")?"@unknown:0:0":""}return`
3`+bc+o+Md}var jc=!1;function wc(o,c){if(!o||jc)return"";jc=!0;var m=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var g={DetermineComponentFrameRoot:function(){try{if(c){var Ce=function(){throw Error()};if(Object.defineProperty(Ce.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Ce,[])}catch(ge){var xe=ge}Reflect.construct(o,[],Ce)}else{try{Ce.call()}catch(ge){xe=ge}o.call(Ce.prototype)}}else{try{throw Error()}catch(ge){xe=ge}(Ce=o())&&typeof Ce.catch=="function"&&Ce.catch(function(){})}}catch(ge){if(ge&&xe&&typeof ge.stack=="string")return[ge.stack,xe.stack]}return[null,null]}};g.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var S=Object.getOwnPropertyDescriptor(g.DetermineComponentFrameRoot,"name");S&&S.configurable&&Object.defineProperty(g.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var O=g.DetermineComponentFrameRoot(),$=O[0],G=O[1];if($&&G){var J=$.split(`
4`),me=G.split(`
5`);for(S=g=0;g<J.length&&!J[g].includes("DetermineComponentFrameRoot");)g++;for(;S<me.length&&!me[S].includes("DetermineComponentFrameRoot");)S++;if(g===J.length||S===me.length)for(g=J.length-1,S=me.length-1;1<=g&&0<=S&&J[g]!==me[S];)S--;for(;1<=g&&0<=S;g--,S--)if(J[g]!==me[S]){if(g!==1||S!==1)do if(g--,S--,0>S||J[g]!==me[S]){var we=`
6`+J[g].replace(" at new "," at ");return o.displayName&&we.includes("<anonymous>")&&(we=we.replace("<anonymous>",o.displayName)),we}while(1<=g&&0<=S);break}}}finally{jc=!1,Error.prepareStackTrace=m}return(m=o?o.displayName||o.name:"")?Ys(m):""}function lp(o){switch(o.tag){case 26:case 27:case 5:return Ys(o.type);case 16:return Ys("Lazy");case 13:return Ys("Suspense");case 19:return Ys("SuspenseList");case 0:case 15:return wc(o.type,!1);case 11:return wc(o.type.render,!1);case 1:return wc(o.type,!0);case 31:return Ys("Activity");default:return""}}function Nc(o){try{var c="";do c+=lp(o),o=o.return;while(o);return c}catch(m){return`
7Error generating stack: `+m.message+`
8`+m.stack}}function Vn(o){switch(typeof o){case"bigint":case"boolean":case"number":case"string":case"undefined":return o;case"object":return o;default:return""}}function Xs(o){var c=o.type;return(o=o.nodeName)&&o.toLowerCase()==="input"&&(c==="checkbox"||c==="radio")}function cp(o){var c=Xs(o)?"checked":"value",m=Object.getOwnPropertyDescriptor(o.constructor.prototype,c),g=""+o[c];if(!o.hasOwnProperty(c)&&typeof m<"u"&&typeof m.get=="function"&&typeof m.set=="function"){var S=m.get,O=m.set;return Object.defineProperty(o,c,{configurable:!0,get:function(){return S.call(this)},set:function($){g=""+$,O.call(this,$)}}),Object.defineProperty(o,c,{enumerable:m.enumerable}),{getValue:function(){return g},setValue:function($){g=""+$},stopTracking:function(){o._valueTracker=null,delete o[c]}}}}function Ui(o){o._valueTracker||(o._valueTracker=cp(o))}function Sc(o){if(!o)return!1;var c=o._valueTracker;if(!c)return!0;var m=c.getValue(),g="";return o&&(g=Xs(o)?o.checked?"true":"false":o.value),o=g,o!==m?(c.setValue(o),!0):!1}function Ae(o){if(o=o||(typeof document<"u"?document:void 0),typeof o>"u")return null;try{return o.activeElement||o.body}
vendor: 4,503 bytes, line 8
8catch{return o.body}}var nl=/[\n"\\]/g;function Ar(o){return o.replace(nl,function(c){return"\\"+c.charCodeAt(0).toString(16)+" "})}function Rd(o,c,m,g,S,O,$,G){o.name="",$!=null&&typeof $!="function"&&typeof $!="symbol"&&typeof $!="boolean"?o.type=$:o.removeAttribute("type"),c!=null?$==="number"?(c===0&&o.value===""||o.value!=c)&&(o.value=""+Vn(c)):o.value!==""+Vn(c)&&(o.value=""+Vn(c)):$!=="submit"&&$!=="reset"||o.removeAttribute("value"),c!=null?Dd(o,$,Vn(c)):m!=null?Dd(o,$,Vn(m)):g!=null&&o.removeAttribute("value"),S==null&&O!=null&&(o.defaultChecked=!!O),S!=null&&(o.checked=S&&typeof S!="function"&&typeof S!="symbol"),G!=null&&typeof G!="function"&&typeof G!="symbol"&&typeof G!="boolean"?o.name=""+Vn(G):o.removeAttribute("name")}function Fa(o,c,m,g,S,O,$,G){if(O!=null&&typeof O!="function"&&typeof O!="symbol"&&typeof O!="boolean"&&(o.type=O),c!=null||m!=null){if(!(O!=="submit"&&O!=="reset"||c!=null))return;m=m!=null?""+Vn(m):"",c=c!=null?""+Vn(c):m,G||c===o.value||(o.value=c),o.defaultValue=c}g=g??S,g=typeof g!="function"&&typeof g!="symbol"&&!!g,o.checked=G?o.checked:!!g,o.defaultChecked=!!g,$!=null&&typeof $!="function"&&typeof $!="symbol"&&typeof $!="boolean"&&(o.name=$)}function Dd(o,c,m){c==="number"&&Ae(o.ownerDocument)===o||o.defaultValue===""+m||(o.defaultValue=""+m)}function Qs(o,c,m,g){if(o=o.options,c){c={};for(var S=0;S<m.length;S++)c["$"+m[S]]=!0;for(m=0;m<o.length;m++)S=c.hasOwnProperty("$"+o[m].value),o[m].selected!==S&&(o[m].selected=S),S&&g&&(o[m].defaultSelected=!0)}else{for(m=""+Vn(m),c=null,S=0;S<o.length;S++){if(o[S].value===m){o[S].selected=!0,g&&(o[S].defaultSelected=!0);return}c!==null||o[S].disabled||(c=o[S])}c!==null&&(c.selected=!0)}}function $d(o,c,m){if(c!=null&&(c=""+Vn(c),c!==o.value&&(o.value=c),m==null)){o.defaultValue!==c&&(o.defaultValue=c);return}o.defaultValue=m!=null?""+Vn(m):""}function up(o,c,m,g){if(c==null){if(g!=null){if(m!=null)throw Error(r(92));if(V(g)){if(1<g.length)throw Error(r(93));g=g[0]}m=g}m==null&&(m=""),c=m}m=Vn(c),o.defaultValue=m,g=o.textContent,g===m&&g!==""&&g!==null&&(o.value=g)}function Zs(o,c){if(c){var m=o.firstChild;if(m&&m===o.lastChild&&m.nodeType===3){m.nodeValue=c;return}}o.textContent=c}var Gn=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function dp(o,c,m){var g=c.indexOf("--")===0;m==null||typeof m=="boolean"||m===""?g?o.setProperty(c,""):c==="float"?o.cssFloat="":o[c]="":g?o.setProperty(c,m):typeof m!="number"||m===0||Gn.has(c)?c==="float"?o.cssFloat=m:o[c]=(""+m).trim():o[c]=m+"px"}function Id(o,c,m){if(c!=null&&typeof c!="object")throw Error(r(62));if(o=o.style,m!=null){for(var g in m)!m.hasOwnProperty(g)||c!=null&&c.hasOwnProperty(g)||(g.indexOf("--")===0?o.setProperty(g,""):g==="float"?o.cssFloat="":o[g]="");for(var S in c)g=c[S],c.hasOwnProperty(S)&&m[S]!==g&&dp(o,S,g)}else for(var O in c)c.hasOwnProperty(O)&&dp(o,O,c[O])}function Cc(o){if(o.indexOf("-")===-1)return!1;switch(o){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 Nb=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRen
8dering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),Sb=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Ac(o){return Sb.test(""+o)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":o}var Ln=null;function Ld(o){return o=o.target||o.srcElement||window,o.correspondingUseElement&&(o=o.correspondingUseElement),o.nodeType===3?o.parentNode:o}var Hi=null,rl=null;function fp(o){var c=ms(o);if(c&&(o=c.stateNode)){var m=o[Jt]||null;e:switch(o=c.stateNode,c.type){case"input":if(Rd(o,m.value,m.defaultValue,m.defaultValue,m.checked,m.defaultChecked,m.type,m.name),c=m.name,m.type==="radio"&&c!=null){for(m=o;m.parentNode;)m=m.parentNode;for(m=m.querySelectorAll('input[name="'+Ar(""+c)+'"][type="radio"]'),c=0;c<m.length;c++){var g=m[c];if(g!==o&&g.form===o.form){var S=g[Jt]||null;if(!S)throw Error(r(90));Rd(g,S.value,S.defaultValue,S.defaultValue,S.checked,S.defaultChecked,S.type,S.name)}}for(c=0;c<m.length;c++)g=m[c],g.form===o.form&&Sc(g)}break e;case"textarea":$d(o,m.value,m.defaultValue);break e;case"select":c=m.value,c!=null&&Qs(o,!!m.multiple,c,!1)}}}var Fd=!1;function Vi(o,c,m){if(Fd)return o(c,m);Fd=!0;try{var g=o(c);return g}finally{if(Fd=!1,(Hi!==null||rl!==null)&&(Kp(),Hi&&(c=Hi,o=rl,rl=Hi=null,fp(c),o)))for(c=0;c<o.length;c++)fp(o[c])}}function Gi(o,c){var m=o.stateNode;if(m===null)return null;var g=m[Jt]||null;if(g===null)return null;m=g[c];e:switch(c){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(g=!g.disabled)||(o=o.type,g=!(o==="button"||o==="input"||o==="select"||o==="textarea")),o=!g;break e;default:o=!1}if(o)return null;if(m&&typeof m!="function")throw Error(r(231,c,typeof m));return m}var qa=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),al=!1;if(qa)try{var Ki={};Object.defineProperty(Ki,"passive",{get:function(){al=!0}}),window.addEventListener("test",Ki,Ki),window.removeEventListener("test",Ki,Ki)}catch{al=!1}var Ur=null,Wi=null,M=null;function re(){if(M)return M;var o,c=Wi,m=c.length,g,S="value"in Ur?Ur.value:Ur.textContent,O=S.length;for(o=0;o<m&&c[o]===S[o];o++);var $=m-o;for(g=1;g<=$&&c[m-g]===S[O-g];g++);return M=S.slice(o,1<g?1-g:void 0)}function oe(o){var c=o.keyCode;
vendor: 2,821 bytes, line 8
8return"charCode"in o?(o=o.charCode,o===0&&c===13&&(o=13)):o=c,o===10&&(o=13),32<=o||o===13?o:0}function ke(){return!0}function Fe(){return!1}function Ye(o){function c(m,g,S,O,$){this._reactName=m,this._targetInst=S,this.type=g,this.nativeEvent=O,this.target=$,this.currentTarget=null;for(var G in o)o.hasOwnProperty(G)&&(m=o[G],this[G]=m?m(O):O[G]);return this.isDefaultPrevented=(O.defaultPrevented!=null?O.defaultPrevented:O.returnValue===!1)?ke:Fe,this.isPropagationStopped=Fe,this}return h(c.prototype,{preventDefault:function(){this.defaultPrevented=!0;var m=this.nativeEvent;m&&(m.preventDefault?m.preventDefault():typeof m.returnValue!="unknown"&&(m.returnValue=!1),this.isDefaultPrevented=ke)},stopPropagation:function(){var m=this.nativeEvent;m&&(m.stopPropagation?m.stopPropagation():typeof m.cancelBubble!="unknown"&&(m.cancelBubble=!0),this.isPropagationStopped=ke)},persist:function(){},isPersistent:ke}),c}var mr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(o){return o.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Hr=Ye(mr),hr=h({},mr,{view:0,detail:0}),Cb=Ye(hr),qd,Ab,Bd,mp=h({},hr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:kb,button:0,buttons:0,relatedTarget:function(o){return o.relatedTarget===void 0?o.fromElement===o.srcElement?o.toElement:o.fromElement:o.relatedTarget},movementX:function(o){return"movementX"in o?o.movementX:(o!==Bd&&(Bd&&o.type==="mousemove"?(qd=o.screenX-Bd.screenX,Ab=o.screenY-Bd.screenY):Ab=qd=0,Bd=o),qd)},movementY:function(o){return"movementY"in o?o.movementY:Ab}}),JO=Ye(mp),AW=h({},mp,{dataTransfer:0}),TW=Ye(AW),kW=h({},hr,{relatedTarget:0}),Tb=Ye(kW),OW=h({},mr,{animationName:0,elapsedTime:0,pseudoElement:0}),PW=Ye(OW),EW=h({},mr,{clipboardData:function(o){return"clipboardData"in o?o.clipboardData:window.clipboardData}}),_W=Ye(EW),MW=h({},mr,{data:0}),eP=Ye(MW),RW={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},DW={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},$W={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function IW(o){var c=this.nativeEvent;return c.getModifierState?c.getModifierState(o):(o=$W[o])?!!c[o]:!1}function kb(){return IW}var LW=h({},hr,{key:function(o){if(o.key){var c=RW[o.key]||o.key;if(c!=="Unidentified")return c}
vendor: 5,018 bytes, line 8
8return o.type==="keypress"?(o=oe(o),o===13?"Enter":String.fromCharCode(o)):o.type==="keydown"||o.type==="keyup"?DW[o.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:kb,charCode:function(o){return o.type==="keypress"?oe(o):0},keyCode:function(o){return o.type==="keydown"||o.type==="keyup"?o.keyCode:0},which:function(o){return o.type==="keypress"?oe(o):o.type==="keydown"||o.type==="keyup"?o.keyCode:0}}),FW=Ye(LW),qW=h({},mp,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),tP=Ye(qW),BW=h({},hr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:kb}),zW=Ye(BW),UW=h({},mr,{propertyName:0,elapsedTime:0,pseudoElement:0}),HW=Ye(UW),VW=h({},mp,{deltaX:function(o){return"deltaX"in o?o.deltaX:"wheelDeltaX"in o?-o.wheelDeltaX:0},deltaY:function(o){return"deltaY"in o?o.deltaY:"wheelDeltaY"in o?-o.wheelDeltaY:"wheelDelta"in o?-o.wheelDelta:0},deltaZ:0,deltaMode:0}),GW=Ye(VW),KW=h({},mr,{newState:0,oldState:0}),WW=Ye(KW),YW=[9,13,27,32],Ob=qa&&"CompositionEvent"in window,zd=null;qa&&"documentMode"in document&&(zd=document.documentMode);var XW=qa&&"TextEvent"in window&&!zd,nP=qa&&(!Ob||zd&&8<zd&&11>=zd),rP=" ",aP=!1;function sP(o,c){switch(o){case"keyup":return YW.indexOf(c.keyCode)!==-1;case"keydown":return c.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function iP(o){return o=o.detail,typeof o=="object"&&"data"in o?o.data:null}var Tc=!1;function QW(o,c){switch(o){case"compositionend":return iP(c);case"keypress":return c.which!==32?null:(aP=!0,rP);case"textInput":return o=c.data,o===rP&&aP?null:o;default:return null}}function ZW(o,c){if(Tc)return o==="compositionend"||!Ob&&sP(o,c)?(o=re(),M=Wi=Ur=null,Tc=!1,o):null;switch(o){case"paste":return null;case"keypress":if(!(c.ctrlKey||c.altKey||c.metaKey)||c.ctrlKey&&c.altKey){if(c.char&&1<c.char.length)return c.char;if(c.which)return String.fromCharCode(c.which)}return null;case"compositionend":return nP&&c.locale!=="ko"?null:c.data;default:return null}}var JW={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function oP(o){var c=o&&o.nodeName&&o.nodeName.toLowerCase();return c==="input"?!!JW[o.type]:c==="textarea"}function lP(o,c,m,g){Hi?rl?rl.push(g):rl=[g]:Hi=g,c=Jp(c,"onChange"),0<c.length&&(m=new Hr("onChange","change",null,m,g),o.push({event:m,listeners:c}))}var Ud=null,Hd=null;function eY(o){z_(o,0)}function hp(o){var c=Gs(o);if(Sc(c))return o}function cP(o,c){if(o==="change")return c}var uP=!1;if(qa){var Pb;if(qa){var Eb="oninput"in document;if(!Eb){var dP=document.createElement("div");dP.setAttribute("oninput","return;"),Eb=typeof dP.oninput=="function"}Pb=Eb}else Pb=!1;uP=Pb&&(!document.documentMode||9<document.documentMode)}function fP(){Ud&&(Ud.detachEvent("onpropertychange",mP),Hd=Ud=null)}function mP(o){if(o.propertyName==="value"&&hp(Hd)){var c=[];lP(c,Hd,o,Ld(o)),Vi(eY,c)}}function tY(o,c,m){o==="focusin"?(fP(),Ud=c,Hd=m,Ud.attachEvent("onpropertychange",mP)):o==="focusout"&&fP()}function nY(o){if(o==="selectionchange"||o==="keyup"||o==="keydown")return hp(Hd)}function rY(o,c){if(o==="click")return hp(c)}function aY(o,c){if(o==="input"||o==="change")return hp(c)}function sY(o,c){return o===c&&(o!==0||1/o===1/c)||o!==o&&c!==c}var Vr=typeof Object.is=="function"?Object.is:sY;function Vd(o,c){if(Vr(o,c))return!0;if(typeof o!="object"||o===null||typeof c!="object"||c===null)return!1;var m=Object.keys(o),g=Object.keys(c);if(m.length!==g.length)return!1;for(g=0;g<m.length;g++){var S=m[g];if(!he.call(c,S)||!Vr(o[S],c[S]))return!1}return!0}function hP(o){for(;o&&o.firstChild;)o=o.firstChild;return o}function pP(o,c){var m=hP(o);o=0;for(var g;m;){if(m.nodeType===3){if(g=o+m.textContent.length,o<=c&&g>=c)return{node:m,offset:c-o};o=g}e:{for(;m;){if(m.nextSibling){m=m.nextSibling;break e}m=m.parentNode}m=void 0}m=hP(m)}}function xP(o,c){return o&&c?o===c?!0:o&&o.nodeType===3?!1:c&&c.nodeType===3?xP(o,c.parentNode):"contains"in o?o.contains(c):o.compareDocumentPosition?!!(o.compareDocumentPosition(c)&16):!1:!1}function gP(o){o=o!=null&&o.ownerDocument!=null&&o.ownerDocument.defaultView!=null?o.ownerDocument.defaultView:window;for(var c=Ae(o.document);c instanceof o.HTMLIFrameElement;){try{var m=typeof c.contentWindow.location.href=="string"}catch{m=!1}if(m)o=c.contentWindow;else break;c=Ae(o.document)}return c}function _b(o){var c=o&&o.nodeName&&o.nodeName.toLowerCase();return c&&(c==="input"&&(o.type==="text"||o.type==="search"||o.type==="tel"||o.type==="url"||o.type==="password")||c==="textarea"||o.contentEditable==="true")}var iY=qa&&"documentMode"in document&&11>=document.documentMode,kc=null,Mb=null,Gd=null,Rb=!1;function yP(o,c,m){var g=m.window===m?m.document:m.nodeType===9?m:m.ownerDocument;Rb||kc==null||kc!==Ae(g)||(g=kc,"selectionStart"in g&&_b(g)?g={start:g.
vendor: 98,855 bytes, line 8
8selectionStart,end:g.selectionEnd}:(g=(g.ownerDocument&&g.ownerDocument.defaultView||window).getSelection(),g={anchorNode:g.anchorNode,anchorOffset:g.anchorOffset,focusNode:g.focusNode,focusOffset:g.focusOffset}),Gd&&Vd(Gd,g)||(Gd=g,g=Jp(Mb,"onSelect"),0<g.length&&(c=new Hr("onSelect","select",null,c,m),o.push({event:c,listeners:g}),c.target=kc)))}function sl(o,c){var m={};return m[o.toLowerCase()]=c.toLowerCase(),m["Webkit"+o]="webkit"+c,m["Moz"+o]="moz"+c,m}var Oc={animationend:sl("Animation","AnimationEnd"),animationiteration:sl("Animation","AnimationIteration"),animationstart:sl("Animation","AnimationStart"),transitionrun:sl("Transition","TransitionRun"),transitionstart:sl("Transition","TransitionStart"),transitioncancel:sl("Transition","TransitionCancel"),transitionend:sl("Transition","TransitionEnd")},Db={},vP={};qa&&(vP=document.createElement("div").style,"AnimationEvent"in window||(delete Oc.animationend.animation,delete Oc.animationiteration.animation,delete Oc.animationstart.animation),"TransitionEvent"in window||delete Oc.transitionend.transition);function il(o){if(Db[o])return Db[o];if(!Oc[o])return o;var c=Oc[o],m;for(m in c)if(c.hasOwnProperty(m)&&m in vP)return Db[o]=c[m];return o}var bP=il("animationend"),jP=il("animationiteration"),wP=il("animationstart"),oY=il("transitionrun"),lY=il("transitionstart"),cY=il("transitioncancel"),NP=il("transitionend"),SP=new Map,$b="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");$b.push("scrollEnd");function Ba(o,c){SP.set(o,c),ps(c,[o])}var CP=new WeakMap;function ha(o,c){if(typeof o=="object"&&o!==null){var m=CP.get(o);return m!==void 0?m:(c={value:o,source:c,stack:Nc(c)},CP.set(o,c),c)}return{value:o,source:c,stack:Nc(c)}}var pa=[],Pc=0,Ib=0;function pp(){for(var o=Pc,c=Ib=Pc=0;c<o;){var m=pa[c];pa[c++]=null;var g=pa[c];pa[c++]=null;var S=pa[c];pa[c++]=null;var O=pa[c];if(pa[c++]=null,g!==null&&S!==null){var $=g.pending;$===null?S.next=S:(S.next=$.next,$.next=S),g.pending=S}O!==0&&AP(m,S,O)}}function xp(o,c,m,g){pa[Pc++]=o,pa[Pc++]=c,pa[Pc++]=m,pa[Pc++]=g,Ib|=g,o.lanes|=g,o=o.alternate,o!==null&&(o.lanes|=g)}function Lb(o,c,m,g){return xp(o,c,m,g),gp(o)}function Ec(o,c){return xp(o,null,null,c),gp(o)}function AP(o,c,m){o.lanes|=m;var g=o.alternate;g!==null&&(g.lanes|=m);for(var S=!1,O=o.return;O!==null;)O.childLanes|=m,g=O.alternate,g!==null&&(g.childLanes|=m),O.tag===22&&(o=O.stateNode,o===null||o._visibility&1||(S=!0)),o=O,O=O.return;return o.tag===3?(O=o.stateNode,S&&c!==null&&(S=31-In(m),o=O.hiddenUpdates,g=o[S],g===null?o[S]=[c]:g.push(c),c.lane=m|536870912),O):null}function gp(o){if(50<yf)throw yf=0,H0=null,Error(r(185));for(var c=o.return;c!==null;)o=c,c=o.return;return o.tag===3?o.stateNode:null}var _c={};function uY(o,c,m,g){this.tag=o,this.key=m,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=c,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=g,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Gr(o,c,m,g){return new uY(o,c,m,g)}function Fb(o){return o=o.prototype,!(!o||!o.isReactComponent)}function Js(o,c){var m=o.alternate;return m===null?(m=Gr(o.tag,c,o.key,o.mode),m.elementType=o.elementType,m.type=o.type,m.stateNode=o.stateNode,m.alternate=o,o.alternate=m):(m.pendingProps=c,m.type=o.type,m.flags=0,m.subtreeFlags=0,m.deletions=null),m.flags=o.flags&65011712,m.childLanes=o.childLanes,m.lanes=o.lanes,m.child=o.child,m.memoizedProps=o.memoizedProps,m.memoizedState=o.memoizedState,m.updateQueue=o.updateQueue,c=o.dependencies,m.dependencies=c===null?null:{lanes:c.lanes,firstContext:c.firstContext},m.sibling=o.sibling,m.index=o.index,m.ref=o.ref,m.refCleanup=o.refCleanup,m}function TP(o,c){o.flags&=65011714;var m=o.alternate;return m===null?(o.childLanes=0,o.lanes=c,o.child=null,o.subtreeFlags=0,o.memoizedProps=null,o.memoizedState=null,o.updateQueue=null,o.dependencies=null,o.stateNode=null):(o.childLanes=m.childLanes,o.lanes=m.lanes,o.child=m.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=m.memoizedProps,o.memoizedState=m.memoizedState,o.updateQueue=m.updateQueue,o.type=m.type,c=m.dependencies,o.dependencies=c===null?null:{lanes:c.lanes,firstContext:c.firstContext}),o}function yp(o,c,m,g,S,O){var $=0;if(g=o,typeof o=="function")Fb(o)&&($=1);else if(typeof o=="string")$=fX(o,m,X.current)?26:o==="html"||o==="head"||o==="body"?27:5;else e:switch(o){case R:return o=Gr(31,m,c,S),o.elementType=R,o.lanes=O,o;case w:return ol(m.children,S,O,c);case j:$=8,S|=24;break;case b:return o=Gr(12,m,c,S|2),o.elementType=b,o.lanes=O,o;case A:return o=Gr(13,m,c,S),o.elementType=A,o.lanes=O,o;case P:return o=Gr(19,m,c,S),o.elementType=P,o.lanes=O,o;default:if(typeof o=="object"&&o!==null)switch(o.$$typeof){case C:case k:$=10;break e;case N:$=9;break e;case T:$=11;break e;case E:$=14;break e;case _:$=16,g=null;break e}$=29,m=Error(r(130,o===null?"null":typeof o,"")),g=null}return c=Gr($,m,c,S),c.elementType=o,c.type=g,c.lanes=O,c}function ol(o,c,m,g){return o=Gr(7,o,g,c),o.lanes=m,o}function qb(o,c,m){return o=Gr(6,o,null,c),o.lanes=m,o}function Bb(o,c,m){return c=Gr(4,o.children!==null?o.children:[],o.key,c),c.lanes=m,c.stateNode={containerInfo:o.containerInfo,pendingChildren:null,implementation:o.implementation},c}var Mc=[],Rc=0,vp=null,bp=0,xa=[],ga=0,ll=null,ei=1,ti="";function cl(o,c){Mc[Rc++]=bp,Mc[Rc++]=vp,vp=o,bp=c}function kP(o,c,m){xa[ga++]=ei,xa[ga++]=ti,xa[ga++]=ll,ll=o;var g=ei;o=ti;var S=32-In(g)-1;g&=~(1<<S),m+=1;var O=32-In(c)+S;if(30<O){var $=S-S%5;O=(g&(1<<$)-1).toString(32),g>>=$,S-=$,ei=1<<32-In(c)+S|m<<S|g,ti=O+o}else ei=1<<O|m<<S|g,ti=o}function zb(o){o.return!==null&&(cl(o,1),kP(o,1,0))}function Ub(o){for(;o===vp;)vp=Mc[--Rc],Mc[Rc]=null,bp=Mc[--Rc],Mc[Rc]=null;for(;o===ll;)ll=xa[--ga],xa[ga]=null,ti=xa[--ga],xa[ga]=null,ei=xa[--ga],xa[ga]=null}var pr=null,ln=null,Nt=!1,ul=null,xs=!1,Hb=Error(r(519));function dl(o){var c=Error(r(418,""));throw Yd(ha(c,o)),Hb}function OP(o){var c=o.stateNode,m=o.type,g=o.memoizedProps;switch(c[kt]=o,c[Jt]=g,m){case"dialog":ht("cancel",c),ht("close",c);break;case"iframe":case"object":case"embed":ht("load",c);break;case"video":case"audio":for(m=0;m<bf.length;m++)ht(bf[m],c);break;case"source":ht("error",c);break;case"img":case"image":case"link":ht("error",c),ht("load",c);break;case"details":ht("toggle",c);break;case"input":ht("invalid",c),Fa(c,g.value,g.defaultValue,g.checked,g.defaultChecked,g.type,g.name,!0),Ui(c);break;case"select":ht("invalid",c);break;case"textarea":ht("invalid",c),up(c,g.value,g.defaultValue,g.children),Ui(c)}m=g.children,typeof m!="string"&&typeof m!="number"&&typeof m!="bigint"||c.textContent===""+m||g.suppressHydrationWarning===!0||G_(c.textContent,m)?(g.popover!=null&&(ht("beforetoggle",c),ht("toggle",c)),g.onScroll!=null&&ht("scroll",c),g.onScrollEnd!=null&&ht("scrollend",c),g.onClick!=null&&(c.onclick=ex),c=!0):c=!1,c||dl(o)}function PP(o){for(pr=o.return;pr;)switch(pr.tag){case 5:case 13:xs=!1;return;case 27:case 3:xs=!0;return;default:pr=pr.return}}function Kd(o){if(o!==pr)return!1;if(!Nt)return PP(o),Nt=!0,!1;var c=o.tag,m;if((m=c!==3&&c!==27)&&((m=c===5)&&(m=o.type,m=!(m!=="form"&&m!=="button")||ij(o.type,o.memoizedProps)),m=!m),m&&ln&&dl(o),PP(o),c===13){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(317));e:{for(o=o.nextSibling,c=0;o;){if(o.nodeType===8)if(m=o.data,m==="/$"){if(c===0){ln=Ua(o.nextSibling);break e}c--}else m!=="$"&&m!=="$!"&&m!=="$?"||c++;o=o.nextSibling}ln=null}}else c===27?(c=ln,uo(o.type)?(o=uj,uj=null,ln=o):ln=c):ln=pr?Ua(o.stateNode.nextSibling):null;return!0}function Wd(){ln=pr=null,Nt=!1}function EP(){var o=ul;return o!==null&&(Or===null?Or=o:Or.push.apply(Or,o),ul=null),o}function Yd(o){ul===null?ul=[o]:ul.push(o)}var Vb=Z(null),fl=null,ni=null;function Yi(o,c,m){B(Vb,c._currentValue),c._currentValue=m}function ri(o){o._currentValue=Vb.current,F(Vb)}function Gb(o,c,m){for(;o!==null;){var g=o.alternate;if((o.childLanes&c)!==c?(o.childLanes|=c,g!==null&&(g.childLanes|=c)):g!==null&&(g.childLanes&c)!==c&&(g.childLanes|=c),o===m)break;o=o.return}}function Kb(o,c,m,g){var S=o.child;for(S!==null&&(S.return=o);S!==null;){var O=S.dependencies;if(O!==null){var $=S.child;O=O.firstContext;e:for(;O!==null;){var G=O;O=S;for(var J=0;J<c.length;J++)if(G.context===c[J]){O.lanes|=m,G=O.alternate,G!==null&&(G.lanes|=m),Gb(O.return,m,o),g||($=null);break e}O=G.next}}else if(S.tag===18){if($=S.return,$===null)throw Error(r(341));$.lanes|=m,O=$.alternate,O!==null&&(O.lanes|=m),Gb($,m,o),$=null}else $=S.child;if($!==null)$.return=S;else for($=S;$!==null;){if($===o){$=null;break}if(S=$.sibling,S!==null){S.return=$.return,$=S;break}$=$.return}S=$}}function Xd(o,c,m,g){o=null;for(var S=c,O=!1;S!==null;){if(!O){if((S.flags&524288)!==0)O=!0;else if((S.flags&262144)!==0)break}if(S.tag===10){var $=S.alternate;if($===null)throw Error(r(387));if($=$.memoizedProps,$!==null){var G=S.type;Vr(S.pendingProps.value,$.value)||(o!==null?o.push(G):o=[G])}}else if(S===ee.current){if($=S.alternate,$===null)throw Error(r(387));$.memoizedState.memoizedState!==S.memoizedState.memoizedState&&(o!==null?o.push(Af):o=[Af])}S=S.return}o!==null&&Kb(c,o,m,g),c.flags|=262144}function jp(o){for(o=o.firstContext;o!==null;){if(!Vr(o.context._currentValue,o.memoizedValue))return!0;o=o.next}return!1}function ml(o){fl=o,ni=null,o=o.dependencies,o!==null&&(o.firstContext=null)}function ar(o){return _P(fl,o)}function wp(o,c){return fl===null&&ml(o),_P(o,c)}function _P(o,c){var m=c._currentValue;if(c={context:c,memoizedValue:m,next:null},ni===null){if(o===null)throw Error(r(308));ni=c,o.dependencies={lanes:0,firstContext:c},o.flags|=524288}else ni=ni.next=c;return m}var dY=typeof AbortController<"u"?AbortController:function(){var o=[],c=this.signal={aborted:!1,addEventListener:function(m,g){o.push(g)}};this.abort=function(){c.aborted=!0,o.forEach(function(m){return m()})}},fY=e.unstable_scheduleCallback,mY=e.unstable_NormalPriority,An={$$typeof:k,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Wb(){return{controller:new dY,data:new Map,refCount:0}}function Qd(o){o.refCount--,o.refCount===0&&fY(mY,function(){o.controller.abort()})}var Zd=null,Yb=0,Dc=0,$c=null;function hY(o,c){if(Zd===null){var m=Zd=[];Yb=0,Dc=Q0(),$c={status:"pending",value:void 0,then:function(g){m.push(g)}}}return Yb++,c.then(MP,MP),c}function MP(){if(--Yb===0&&Zd!==null){$c!==null&&($c.status="fulfilled");var o=Zd;Zd=null,Dc=0,$c=null;for(var c=0;c<o.length;c++)(0,o[c])()}}function pY(o,c){var m=[],g={status:"pending",value:null,reason:null,then:function(S){m.push(S)}};return o.then(function(){g.status="fulfilled",g.value=c;for(var S=0;S<m.length;S++)(0,m[S])(c)},function(S){for(g.status="rejected",g.reason=S,S=0;S<m.length;S++)(0,m[S])(void 0)}),g}var RP=D.S;D.S=function(o,c){typeof c=="object"&&c!==null&&typeof c.then=="function"&&hY(o,c),RP!==null&&RP(o,c)};var hl=Z(null);function Xb(){var o=hl.current;return o!==null?o:Vt.pooledCache}function Np(o,c){c===null?B(hl,hl.current):B(hl,c.pool)}function DP(){var o=Xb();return o===null?null:{parent:An._currentValue,pool:o}}var Jd=Error(r(460)),$P=Error(r(474)),Sp=Error(r(542)),Qb={then:function(){}};function IP(o){return o=o.status,o==="fulfilled"||o==="rejected"}function Cp(){}function LP(o,c,m){switch(m=o[m],m===void 0?o.push(c):m!==c&&(c.then(Cp,Cp),c=m),c.status){case"fulfilled":return c.value;case"rejected":throw o=c.reason,qP(o),o;default:if(typeof c.status=="string")c.then(Cp,Cp);else{if(o=Vt,o!==null&&100<o.shellSuspendCounter)throw Error(r(482));o=c,o.status="pending",o.then(function(g){if(c.status==="pending"){var S=c;S.status="fulfilled",S.value=g}},function(g){if(c.status==="pending"){var S=c;S.status="rejected",S.reason=g}})}switch(c.status){case"fulfilled":return c.value;case"rejected":throw o=c.reason,qP(o),o}throw ef=c,Jd}}var ef=null;function FP(){if(ef===null)throw Error(r(459));var o=ef;return ef=null,o}function qP(o){if(o===Jd||o===Sp)throw Error(r(483))}var Xi=!1;function Zb(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Jb(o,c){o=o.updateQueue,c.updateQueue===o&&(c.updateQueue={baseState:o.baseState,firstBaseUpdate:o.firstBaseUpdate,lastBaseUpdate:o.lastBaseUpdate,shared:o.shared,callbacks:null})}function Qi(o){return{lane:o,tag:0,payload:null,callback:null,next:null}}function Zi(o,c,m){var g=o.updateQueue;if(g===null)return null;if(g=g.shared,(Ot&2)!==0){var S=g.pending;return S===null?c.next=c:(c.next=S.next,S.next=c),g.pending=c,c=gp(o),AP(o,null,m),c}return xp(o,g,c,m),gp(o)}function tf(o,c,m){if(c=c.updateQueue,c!==null&&(c=c.shared,(m&4194048)!==0)){var g=c.lanes;g&=o.pendingLanes,m|=g,c.lanes=m,$e(o,m)}}function e0(o,c){var m=o.updateQueue,g=o.alternate;if(g!==null&&(g=g.updateQueue,m===g)){var S=null,O=null;if(m=m.firstBaseUpdate,m!==null){do{var $={lane:m.lane,tag:m.tag,payload:m.payload,callback:null,next:null};O===null?S=O=$:O=O.next=$,m=m.next}while(m!==null);O===null?S=O=c:O=O.next=c}else S=O=c;m={baseState:g.baseState,firstBaseUpdate:S,lastBaseUpdate:O,shared:g.shared,callbacks:g.callbacks},o.updateQueue=m;return}o=m.lastBaseUpdate,o===null?m.firstBaseUpdate=c:o.next=c,m.lastBaseUpdate=c}var t0=!1;function nf(){if(t0){var o=$c;if(o!==null)throw o}}function rf(o,c,m,g){t0=!1;var S=o.updateQueue;Xi=!1;var O=S.firstBaseUpdate,$=S.lastBaseUpdate,G=S.shared.pending;if(G!==null){S.shared.pending=null;var J=G,me=J.next;J.next=null,$===null?O=me:$.next=me,$=J;var we=o.alternate;we!==null&&(we=we.updateQueue,G=we.lastBaseUpdate,G!==$&&(G===null?we.firstBaseUpdate=me:G.next=me,we.lastBaseUpdate=J))}if(O!==null){var Ce=S.baseState;$=0,we=me=J=null,G=O;do{var xe=G.lane&-536870913,ge=xe!==G.lane;if(ge?(vt&xe)===xe:(g&xe)===xe){xe!==0&&xe===Dc&&(t0=!0),we!==null&&(we=we.next={lane:0,tag:G.tag,payload:G.payload,callback:null,next:null});e:{var rt=o,Ze=G;xe=c;var It=m;switch(Ze.tag){case 1:if(rt=Ze.payload,typeof rt=="function"){Ce=rt.call(It,Ce,xe);break e}Ce=rt;break e;case 3:rt.flags=rt.flags&-65537|128;case 0:if(rt=Ze.payload,xe=typeof rt=="function"?rt.call(It,Ce,xe):rt,xe==null)break e;Ce=h({},Ce,xe);break e;case 2:Xi=!0}}xe=G.callback,xe!==null&&(o.flags|=64,ge&&(o.flags|=8192),ge=S.callbacks,ge===null?S.callbacks=[xe]:ge.push(xe))}else ge={lane:xe,tag:G.tag,payload:G.payload,callback:G.callback,next:null},we===null?(me=we=ge,J=Ce):we=we.next=ge,$|=xe;if(G=G.next,G===null){if(G=S.shared.pending,G===null)break;ge=G,G=ge.next,ge.next=null,S.lastBaseUpdate=ge,S.shared.pending=null}}while(!0);we===null&&(J=Ce),S.baseState=J,S.firstBaseUpdate=me,S.lastBaseUpdate=we,O===null&&(S.shared.lanes=0),io|=$,o.lanes=$,o.memoizedState=Ce}}function BP(o,c){if(typeof o!="function")throw Error(r(191,o));o.call(c)}function zP(o,c){var m=o.callbacks;if(m!==null)for(o.callbacks=null,o=0;o<m.length;o++)BP(m[o],c)}var Ic=Z(null),Ap=Z(0);function UP(o,c){o=ui,B(Ap,o),B(Ic,c),ui=o|c.baseLanes}function n0(){B(Ap,ui),B(Ic,Ic.current)}function r0(){ui=Ap.current,F(Ic),F(Ap)}var Ji=0,lt=null,Dt=null,gn=null,Tp=!1,Lc=!1,pl=!1,kp=0,af=0,Fc=null,xY=0;function fn(){throw Error(r(321))}function a0(o,c){if(c===null)return!1;for(var m=0;m<c.length&&m<o.length;m++)if(!Vr(o[m],c[m]))return!1;return!0}function s0(o,c,m,g,S,O){return Ji=O,lt=c,c.memoizedState=null,c.updateQueue=null,c.lanes=0,D.H=o===null||o.memoizedState===null?AE:TE,pl=!1,O=m(g,S),pl=!1,Lc&&(O=VP(c,m,g,S)),HP(o),O}function HP(o){D.H=Rp;var c=Dt!==null&&Dt.next!==null;if(Ji=0,gn=Dt=lt=null,Tp=!1,af=0,Fc=null,c)throw Error(r(300));o===null||Fn||(o=o.dependencies,o!==null&&jp(o)&&(Fn=!0))}function VP(o,c,m,g){lt=o;var S=0;do{if(Lc&&(Fc=null),af=0,Lc=!1,25<=S)throw Error(r(301));if(S+=1,gn=Dt=null,o.updateQueue!=null){var O=o.updateQueue;O.lastEffect=null,O.events=null,O.stores=null,O.memoCache!=null&&(O.memoCache.index=0)}D.H=NY,O=c(m,g)}while(Lc);return O}function gY(){var o=D.H,c=o.useState()[0];return c=typeof c.then=="function"?sf(c):c,o=o.useState()[0],(Dt!==null?Dt.memoizedState:null)!==o&&(lt.flags|=1024),c}function i0(){var o=kp!==0;return kp=0,o}function o0(o,c,m){c.updateQueue=o.updateQueue,c.flags&=-2053,o.lanes&=~m}function l0(o){if(Tp){for(o=o.memoizedState;o!==null;){var c=o.queue;c!==null&&(c.pending=null),o=o.next}Tp=!1}Ji=0,gn=Dt=lt=null,Lc=!1,af=kp=0,Fc=null}function Tr(){var o={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return gn===null?lt.memoizedState=gn=o:gn=gn.next=o,gn}function yn(){if(Dt===null){var o=lt.alternate;o=o!==null?o.memoizedState:null}else o=Dt.next;var c=gn===null?lt.memoizedState:gn.next;if(c!==null)gn=c,Dt=o;else{if(o===null)throw lt.alternate===null?Error(r(467)):Error(r(310));Dt=o,o={memoizedState:Dt.memoizedState,baseState:Dt.baseState,baseQueue:Dt.baseQueue,queue:Dt.queue,next:null},gn===null?lt.memoizedState=gn=o:gn=gn.next=o}return gn}function c0(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function sf(o){var c=af;return af+=1,Fc===null&&(Fc=[]),o=LP(Fc,o,c),c=lt,(gn===null?c.memoizedState:gn.next)===null&&(c=c.alternate,D.H=c===null||c.memoizedState===null?AE:TE),o}function Op(o){if(o!==null&&typeof o=="object"){if(typeof o.then=="function")return sf(o);if(o.$$typeof===k)return ar(o)}throw Error(r(438,String(o)))}function u0(o){var c=null,m=lt.updateQueue;if(m!==null&&(c=m.memoCache),c==null){var g=lt.alternate;g!==null&&(g=g.updateQueue,g!==null&&(g=g.memoCache,g!=null&&(c={data:g.data.map(function(S){return S.slice()}),index:0})))}if(c==null&&(c={data:[],index:0}),m===null&&(m=c0(),lt.updateQueue=m),m.memoCache=c,m=c.data[c.index],m===void 0)for(m=c.data[c.index]=Array(o),g=0;g<o;g++)m[g]=H;return c.index++,m}function ai(o,c){return typeof c=="function"?c(o):c}function Pp(o){var c=yn();return d0(c,Dt,o)}function d0(o,c,m){var g=o.queue;if(g===null)throw Error(r(311));g.lastRenderedReducer=m;var S=o.baseQueue,O=g.pending;if(O!==null){if(S!==null){var $=S.next;S.next=O.next,O.next=$}c.baseQueue=S=O,g.pending=null}if(O=o.baseState,S===null)o.memoizedState=O;else{c=S.next;var G=$=null,J=null,me=c,we=!1;do{var Ce=me.lane&-536870913;if(Ce!==me.lane?(vt&Ce)===Ce:(Ji&Ce)===Ce){var xe=me.revertLane;if(xe===0)J!==null&&(J=J.next={lane:0,revertLane:0,action:me.action,hasEagerState:me.hasEagerState,eagerState:me.eagerState,next:null}),Ce===Dc&&(we=!0);else if((Ji&xe)===xe){me=me.next,xe===Dc&&(we=!0);continue}else Ce={lane:0,revertLane:me.revertLane,action:me.action,hasEagerState:me.hasEagerState,eagerState:me.eagerState,next:null},J===null?(G=J=Ce,$=O):J=J.next=Ce,lt.lanes|=xe,io|=xe;Ce=me.action,pl&&m(O,Ce),O=me.hasEagerState?me.eagerState:m(O,Ce)}else xe={lane:Ce,revertLane:me.revertLane,action:me.action,hasEagerState:me.hasEagerState,eagerState:me.eagerState,next:null},J===null?(G=J=xe,$=O):J=J.next=xe,lt.lanes|=Ce,io|=Ce;me=me.next}while(me!==null&&me!==c);if(J===null?$=O:J.next=G,!Vr(O,o.memoizedState)&&(Fn=!0,we&&(m=$c,m!==null)))throw m;o.memoizedState=O,o.baseState=$,o.baseQueue=J,g.lastRenderedState=O}return S===null&&(g.lanes=0),[o.memoizedState,g.dispatch]}function f0(o){var c=yn(),m=c.queue;if(m===null)throw Error(r(311));m.lastRenderedReducer=o;var g=m.dispatch,S=m.pending,O=c.memoizedState;if(S!==null){m.pending=null;var $=S=S.next;do O=o(O,$.action),$=$.next;while($!==S);Vr(O,c.memoizedState)||(Fn=!0),c.memoizedState=O,c.baseQueue===null&&(c.baseState=O),m.lastRenderedState=O}return[O,g]}function GP(o,c,m){var g=lt,S=yn(),O=Nt;if(O){if(m===void 0)throw Error(r(407));m=m()}else m=c();var $=!Vr((Dt||S).memoizedState,m);$&&(S.memoizedState=m,Fn=!0),S=S.queue;var G=YP.bind(null,g,S,o);if(of(2048,8,G,[o]),S.getSnapshot!==c||$||gn!==null&&gn.memoizedState.tag&1){if(g.flags|=2048,qc(9,Ep(),WP.bind(null,g,S,m,c),null),Vt===null)throw Error(r(349));O||(Ji&124)!==0||KP(g,c,m)}return m}function KP(o,c,m){o.flags|=16384,o={getSnapshot:c,value:m},c=lt.updateQueue,c===null?(c=c0(),lt.updateQueue=c,c.stores=[o]):(m=c.stores,m===null?c.stores=[o]:m.push(o))}function WP(o,c,m,g){c.value=m,c.getSnapshot=g,XP(c)&&QP(o)}function YP(o,c,m){return m(function(){XP(c)&&QP(o)})}function XP(o){var c=o.getSnapshot;o=o.value;try{var m=c();return!Vr(o,m)}catch{return!0}}function QP(o){var c=Ec(o,2);c!==null&&Qr(c,o,2)}function m0(o){var c=Tr();if(typeof o=="function"){var m=o;if(o=m(),pl){Fr(!0);try{m()}finally{Fr(!1)}}}return c.memoizedState=c.baseState=o,c.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ai,lastRenderedState:o},c}function ZP(o,c,m,g){return o.baseState=m,d0(o,Dt,typeof g=="function"?g:ai)}function yY(o,c,m,g,S){if(Mp(o))throw Error(r(485));if(o=c.action,o!==null){var O={payload:S,action:o,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function($){O.listeners.push($)}};D.T!==null?m(!0):O.isTransition=!1,g(O),m=c.pending,m===null?(O.next=c.pending=O,JP(c,O)):(O.next=m.next,c.pending=m.next=O)}}function JP(o,c){var m=c.action,g=c.payload,S=o.state;if(c.isTransition){var O=D.T,$={};D.T=$;try{var G=m(S,g),J=D.S;J!==null&&J($,G),eE(o,c,G)}catch(me){h0(o,c,me)}finally{D.T=O}}else try{O=m(S,g),eE(o,c,O)}catch(me){h0(o,c,me)}}function eE(o,c,m){m!==null&&typeof m=="object"&&typeof m.then=="function"?m.then(function(g){tE(o,c,g)},function(g){return h0(o,c,g)}):tE(o,c,m)}function tE(o,c,m){c.status="fulfilled",c.value=m,nE(c),o.state=m,c=o.pending,c!==null&&(m=c.next,m===c?o.pending=null:(m=m.next,c.next=m,JP(o,m)))}function h0(o,c,m){var g=o.pending;if(o.pending=null,g!==null){g=g.next;do c.status="rejected",c.reason=m,nE(c),c=c.next;while(c!==g)}o.action=null}function nE(o){o=o.listeners;for(var c=0;c<o.length;c++)(0,o[c])()}function rE(o,c){return c}function aE(o,c){if(Nt){var m=Vt.formState;if(m!==null){e:{var g=lt;if(Nt){if(ln){t:{for(var S=ln,O=xs;S.nodeType!==8;){if(!O){S=null;break t}if(S=Ua(S.nextSibling),S===null){S=null;break t}}O=S.data,S=O==="F!"||O==="F"?S:null}if(S){ln=Ua(S.nextSibling),g=S.data==="F!";break e}}dl(g)}g=!1}g&&(c=m[0])}}return m=Tr(),m.memoizedState=m.baseState=c,g={pending:null,lanes:0,dispatch:null,lastRenderedReducer:rE,lastRenderedState:c},m.queue=g,m=NE.bind(null,lt,g),g.dispatch=m,g=m0(!1),O=v0.bind(null,lt,!1,g.queue),g=Tr(),S={state:c,dispatch:null,action:o,pending:null},g.queue=S,m=yY.bind(null,lt,S,O,m),S.dispatch=m,g.memoizedState=o,[c,m,!1]}function sE(o){var c=yn();return iE(c,Dt,o)}function iE(o,c,m){if(c=d0(o,c,rE)[0],o=Pp(ai)[0],typeof c=="object"&&c!==null&&typeof c.then=="function")try{var g=sf(c)}catch($){throw $===Jd?Sp:$}else g=c;c=yn();var S=c.queue,O=S.dispatch;return m!==c.memoizedState&&(lt.flags|=2048,qc(9,Ep(),vY.bind(null,S,m),null)),[g,O,o]}function vY(o,c){o.action=c}function oE(o){var c=yn(),m=Dt;if(m!==null)return iE(c,m,o);yn(),c=c.memoizedState,m=yn();var g=m.queue.dispatch;return m.memoizedState=o,[c,g,!1]}function qc(o,c,m,g){return o={tag:o,create:m,deps:g,inst:c,next:null},c=lt.updateQueue,c===null&&(c=c0(),lt.updateQueue=c),m=c.lastEffect,m===null?c.lastEffect=o.next=o:(g=m.next,m.next=o,o.next=g,c.lastEffect=o),o}function Ep(){return{destroy:void 0,resource:void 0}}function lE(){return yn().memoizedState}function _p(o,c,m,g){var S=Tr();g=g===void 0?null:g,lt.flags|=o,S.memoizedState=qc(1|c,Ep(),m,g)}function of(o,c,m,g){var S=yn();g=g===void 0?null:g;var O=S.memoizedState.inst;Dt!==null&&g!==null&&a0(g,Dt.memoizedState.deps)?S.memoizedState=qc(c,O,m,g):(lt.flags|=o,S.memoizedState=qc(1|c,O,m,g))}function cE(o,c){_p(8390656,8,o,c)}function uE(o,c){of(2048,8,o,c)}function dE(o,c){return of(4,2,o,c)}function fE(o,c){return of(4,4,o,c)}function mE(o,c){if(typeof c=="function"){o=o();var m=c(o);return function(){typeof m=="function"?m():c(null)}}if(c!=null)return o=o(),c.current=o,function(){c.current=null}}function hE(o,c,m){m=m!=null?m.concat([o]):null,of(4,4,mE.bind(null,c,o),m)}function p0(){}function pE(o,c){var m=yn();c=c===void 0?null:c;var g=m.memoizedState;return c!==null&&a0(c,g[1])?g[0]:(m.memoizedState=[o,c],o)}function xE(o,c){var m=yn();c=c===void 0?null:c;var g=m.memoizedState;if(c!==null&&a0(c,g[1]))return g[0];if(g=o(),pl){Fr(!0);try{o()}finally{Fr(!1)}}return m.memoizedState=[g,c],g}function x0(o,c,m){return m===void 0||(Ji&1073741824)!==0?o.memoizedState=c:(o.memoizedState=m,o=v_(),lt.lanes|=o,io|=o,m)}function gE(o,c,m,g){return Vr(m,c)?m:Ic.current!==null?(o=x0(o,m,g),Vr(o,c)||(Fn=!0),o):(Ji&42)===0?(Fn=!0,o.memoizedState=m):(o=v_(),lt.lanes|=o,io|=o,c)}function yE(o,c,m,g,S){var O=q.p;q.p=O!==0&&8>O?O:8;var $=D.T,G={};D.T=G,v0(o,!1,c,m);try{var J=S(),me=D.S;if(me!==null&&me(G,J),J!==null&&typeof J=="object"&&typeof J.then=="function"){var we=pY(J,g);lf(o,c,we,Xr(o))}else lf(o,c,g,Xr(o))}catch(Ce){lf(o,c,{then:function(){},status:"rejected",reason:Ce},Xr())}finally{q.p=O,D.T=$}}function bY(){}function g0(o,c,m,g){if(o.tag!==5)throw Error(r(476));var S=vE(o).queue;yE(o,S,c,K,m===null?bY:function(){return bE(o),m(g)})}function vE(o){var c=o.memoizedState;if(c!==null)return c;c={memoizedState:K,baseState:K,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ai,lastRenderedState:K},next:null};var m={};return c.next={memoizedState:m,baseState:m,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ai,lastRenderedState:m},next:null},o.memoizedState=c,o=o.alternate,o!==null&&(o.memoizedState=c),c}function bE(o){var c=vE(o).next.queue;lf(o,c,{},Xr())}function y0(){return ar(Af)}function jE(){return yn().memoizedState}function wE(){return yn().memoizedState}function jY(o){for(var c=o.return;c!==null;){switch(c.tag){case 24:case 3:var m=Xr();o=Qi(m);var g=Zi(c,o,m);g!==null&&(Qr(g,c,m),tf(g,c,m)),c={cache:Wb()},o.payload=c;return}c=c.return}}function wY(o,c,m){var g=Xr();m={lane:g,revertLane:0,action:m,hasEagerState:!1,eagerState:null,next:null},Mp(o)?SE(c,m):(m=Lb(o,c,m,g),m!==null&&(Qr(m,o,g),CE(m,c,g)))}function NE(o,c,m){var g=Xr();lf(o,c,m,g)}function lf(o,c,m,g){var S={lane:g,revertLane:0,action:m,hasEagerState:!1,eagerState:null,next:null};if(Mp(o))SE(c,S);else{var O=o.alternate;if(o.lanes===0&&(O===null||O.lanes===0)&&(O=c.lastRenderedReducer,O!==null))try{var $=c.lastRenderedState,G=O($,m);if(S.hasEagerState=!0,S.eagerState=G,Vr(G,$))return xp(o,c,S,0),Vt===null&&pp(),!1}catch{}if(m=Lb(o,c,S,g),m!==null)return Qr(m,o,g),CE(m,c,g),!0}return!1}function v0(o,c,m,g){if(g={lane:2,revertLane:Q0(),action:g,hasEagerState:!1,eagerState:null,next:null},Mp(o)){if(c)throw Error(r(479))}else c=Lb(o,m,g,2),c!==null&&Qr(c,o,2)}function Mp(o){var c=o.alternate;return o===lt||c!==null&&c===lt}function SE(o,c){Lc=Tp=!0;var m=o.pending;m===null?c.next=c:(c.next=m.next,m.next=c),o.pending=c}function CE(o,c,m){if((m&4194048)!==0){var g=c.lanes;g&=o.pendingLanes,m|=g,c.lanes=m,$e(o,m)}}var Rp={readContext:ar,use:Op,useCallback:fn,useContext:fn,useEffect:fn,useImperativeHandle:fn,useLayoutEffect:fn,useInsertionEffect:fn,useMemo:fn,useReducer:fn,useRef:fn,useState:fn,useDebugValue:fn,useDeferredValue:fn,useTransition:fn,useSyncExternalStore:fn,useId:fn,useHostTransitionStatus:fn,useFormState:fn,useActionState:fn,useOptimistic:fn,useMemoCache:fn,useCacheRefresh:fn},AE={readContext:ar,use:Op,useCallback:function(o,c){return Tr().memoizedState=[o,c===void 0?null:c],o},useContext:ar,useEffect:cE,useImperativeHandle:function(o,c,m){m=m!=null?m.concat([o]):null,_p(4194308,4,mE.bind(null,c,o),m)},useLayoutEffect:function(o,c){return _p(4194308,4,o,c)},useInsertionEffect:function(o,c){_p(4,2,o,c)},useMemo:function(o,c){var m=Tr();c=c===void 0?null:c;var g=o();if(pl){Fr(!0);try{o()}finally{Fr(!1)}}return m.memoizedState=[g,c],g},useReducer:function(o,c,m){var g=Tr();if(m!==void 0){var S=m(c);if(pl){Fr(!0);try{m(c)}finally{Fr(!1)}}}else S=c;return g.memoizedState=g.baseState=S,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:S},g.queue=o,o=o.dispatch=wY.bind(null,lt,o),[g.memoizedState,o]},useRef:function(o){var c=Tr();return o={current:o},c.memoizedState=o},useState:function(o){o=m0(o);var c=o.queue,m=NE.bind(null,lt,c);return c.dispatch=m,[o.memoizedState,m]},useDebugValue:p0,useDeferredValue:function(o,c){var m=Tr();return x0(m,o,c)},useTransition:function(){var o=m0(!1);return o=yE.bind(null,lt,o.queue,!0,!1),Tr().memoizedState=o,[!1,o]},useSyncExternalStore:function(o,c,m){var g=lt,S=Tr();if(Nt){if(m===void 0)throw Error(r(407));m=m()}else{if(m=c(),Vt===null)throw Error(r(349));(vt&124)!==0||KP(g,c,m)}S.memoizedState=m;var O={value:m,getSnapshot:c};return S.queue=O,cE(YP.bind(null,g,O,o),[o]),g.flags|=2048,qc(9,Ep(),WP.bind(null,g,O,m,c),null),m},useId:function(){var o=Tr(),c=Vt.identifierPrefix;if(Nt){var m=ti,g=ei;m=(g&~(1<<32-In(g)-1)).toString(32)+m,c="«"+c+"R"+m,m=kp++,0<m&&(c+="H"+m.toString(32)),c+="»"}else m=xY++,c="«"+c+"r"+m.toString(32)+"»";return o.memoizedState=c},useHostTransitionStatus:y0,useFormState:aE,useActionState:aE,useOptimistic:function(o){var c=Tr();c.memoizedState=c.baseState=o;var m={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return c.queue=m,c=v0.bind(null,lt,!0,m),m.dispatch=c,[o,c]},useMemoCache:u0,useCacheRefresh:function(){return Tr().memoizedState=jY.bind(null,lt)}},TE={readContext:ar,use:Op,useCallback:pE,useContext:ar,useEffect:uE,useImperativeHandle:hE,useInsertionEffect:dE,useLayoutEffect:fE,useMemo:xE,useReducer:Pp,useRef:lE,useState:function(){return Pp(ai)},useDebugValue:p0,useDeferredValue:function(o,c){var m=yn();return gE(m,Dt.memoizedState,o,c)},useTransition:function(){var o=Pp(ai)[0],c=yn().memoizedState;return[typeof o=="boolean"?o:sf(o),c]},useSyncExternalStore:GP,useId:jE,useHostTransitionStatus:y0,useFormState:sE,useActionState:sE,useOptimistic:function(o,c){var m=yn();return ZP(m,Dt,o,c)},useMemoCache:u0,useCacheRefresh:wE},NY={readContext:ar,use:Op,useCallback:pE,useContext:ar,useEffect:uE,useImperativeHandle:hE,useInsertionEffect:dE,useLayoutEffect:fE,useMemo:xE,useReducer:f0,useRef:lE,useState:function(){return f0(ai)},useDebugValue:p0,useDeferredValue:function(o,c){var m=yn();return Dt===null?x0(m,o,c):gE(m,Dt.memoizedState,o,c)},useTransition:function(){var o=f0(ai)[0],c=yn().memoizedState;return[typeof o=="boolean"?o:sf(o),c]},useSyncExternalStore:GP,useId:jE,useHostTransitionStatus:y0,useFormState:oE,useActionState:oE,useOptimistic:function(o,c){var m=yn();return Dt!==null?ZP(m,Dt,o,c):(m.baseState=o,[o,m.queue.dispatch])},useMemoCache:u0,useCacheRefresh:wE},Bc=null,cf=0;function Dp(o){var c=cf;return cf+=1,Bc===null&&(Bc=[]),LP(Bc,o,c)}function uf(o,c){c=c.props.ref,o.ref=c!==void 0?c:null}function $p(o,c){throw c.$$typeof===p?Error(r(525)):(o=Object.prototype.toString.call(c),Error(r(31,o==="[object Object]"?"object with keys {"+Object.keys(c).join(", ")+"}":o)))}function kE(o){var c=o._init;return c(o._payload)}function OE(o){function c(le,ae){if(o){var fe=le.deletions;fe===null?(le.deletions=[ae],le.flags|=16):fe.push(ae)}}function m(le,ae){if(!o)return null;for(;ae!==null;)c(le,ae),ae=ae.sibling;return null}function g(le){for(var ae=new Map;le!==null;)le.key!==null?ae.set(le.key,le):ae.set(le.index,le),le=le.sibling;return ae}function S(le,ae){return le=Js(le,ae),le.index=0,le.sibling=null,le}function O(le,ae,fe){return le.index=fe,o?(fe=le.alternate,fe!==null?(fe=fe.index,fe<ae?(le.flags|=67108866,ae):fe):(le.flags|=67108866,ae)):(le.flags|=1048576,ae)}function $(le){return o&&le.alternate===null&&(le.flags|=67108866),le}function G(le,ae,fe,Ne){return ae===null||ae.tag!==6?(ae=qb(fe,le.mode,Ne),ae.return=le,ae):(ae=S(ae,fe),ae.return=le,ae)}function J(le,ae,fe,Ne){var Ue=fe.type;return Ue===w?we(le,ae,fe.props.children,Ne,fe.key):ae!==null&&(ae.elementType===Ue||typeof Ue=="object"&&Ue!==null&&Ue.$$typeof===_&&kE(Ue)===ae.type)?(ae=S(ae,fe.props),uf(ae,fe),ae.return=le,ae):(ae=yp(fe.type,fe.key,fe.props,null,le.mode,Ne),uf(ae,fe),ae.return=le,ae)}function me(le,ae,fe,Ne){return ae===null||ae.tag!==4||ae.stateNode.containerInfo!==fe.containerInfo||ae.stateNode.implementation!==fe.implementation?(ae=Bb(fe,le.mode,Ne),ae.return=le,ae):(ae=S(ae,fe.children||[]),ae.return=le,ae)}function we(le,ae,fe,Ne,Ue){return ae===null||ae.tag!==7?(ae=ol(fe,le.mode,Ne,Ue),ae.return=le,ae):(ae=S(ae,fe),ae.return=le,ae)}function Ce(le,ae,fe){if(typeof ae=="string"&&ae!==""||typeof ae=="number"||typeof ae=="bigint")return ae=qb(""+ae,le.mode,fe),ae.return=le,ae;if(typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case x:return fe=yp(ae.type,ae.key,ae.props,null,le.mode,fe),uf(fe,ae),fe.return=le,fe;case y:return ae=Bb(ae,le.mode,fe),ae.return=le,ae;case _:var Ne=ae._init;return ae=Ne(ae._payload),Ce(le,ae,fe)}if(V(ae)||I(ae))return ae=ol(ae,le.mode,fe,null),ae.return=le,ae;if(typeof ae.then=="function")return Ce(le,Dp(ae),fe);if(ae.$$typeof===k)return Ce(le,wp(le,ae),fe);$p(le,ae)}return null}function xe(le,ae,fe,Ne){var Ue=ae!==null?ae.key:null;if(typeof fe=="string"&&fe!==""||typeof fe=="number"||typeof fe=="bigint")return Ue!==null?null:G(le,ae,""+fe,Ne);if(typeof fe=="object"&&fe!==null){switch(fe.$$typeof){case x:return fe.key===Ue?J(le,ae,fe,Ne):null;case y:return fe.key===Ue?me(le,ae,fe,Ne):null;case _:return Ue=fe._init,fe=Ue(fe._payload),xe(le,ae,fe,Ne)}if(V(fe)||I(fe))return Ue!==null?null:we(le,ae,fe,Ne,null);if(typeof fe.then=="function")return xe(le,ae,Dp(fe),Ne);if(fe.$$typeof===k)return xe(le,ae,wp(le,fe),Ne);$p(le,fe)}return null}function ge(le,ae,fe,Ne,Ue){if(typeof Ne=="string"&&Ne!==""||typeof Ne=="number"||typeof Ne=="bigint")return le=le.get(fe)||null,G(ae,le,""+Ne,Ue);if(typeof Ne=="object"&&Ne!==null){switch(Ne.$$typeof){case x:return le=le.get(Ne.key===null?fe:Ne.key)||null,J(ae,le,Ne,Ue);case y:return le=le.get(Ne.key===null?fe:Ne.key)||null,me(ae,le,Ne,Ue);case _:var ft=Ne._init;return Ne=ft(Ne._payload),ge(le,ae,fe,Ne,Ue)}if(V(Ne)||I(Ne))return le=le.get(fe)||null,we(ae,le,Ne,Ue,null);if(typeof Ne.then=="function")return ge(le,ae,fe,Dp(Ne),Ue);if(Ne.$$typeof===k)return ge(le,ae,fe,wp(ae,Ne),Ue);$p(ae,Ne)}return null}function rt(le,ae,fe,Ne){for(var Ue=null,ft=null,Ke=ae,Je=ae=0,Bn=null;Ke!==null&&Je<fe.length;Je++){Ke.index>Je?(Bn=Ke,Ke=null):Bn=Ke.sibling;var bt=xe(le,Ke,fe[Je],Ne);if(bt===null){Ke===null&&(Ke=Bn);break}o&&Ke&&bt.alternate===null&&c(le,Ke),ae=O(bt,ae,Je),ft===null?Ue=bt:ft.sibling=bt,ft=bt,Ke=Bn}if(Je===fe.length)return m(le,Ke),Nt&&cl(le,Je),Ue;if(Ke===null){for(;Je<fe.length;Je++)Ke=Ce(le,fe[Je],Ne),Ke!==null&&(ae=O(Ke,ae,Je),ft===null?Ue=Ke:ft.sibling=Ke,ft=Ke);return Nt&&cl(le,Je),Ue}for(Ke=g(Ke);Je<fe.length;Je++)Bn=ge(Ke,le,Je,fe[Je],Ne),Bn!==null&&(o&&Bn.alternate!==null&&Ke.delete(Bn.key===null?Je:Bn.key),ae=O(Bn,ae,Je),ft===null?Ue=Bn:ft.sibling=Bn,ft=Bn);return o&&Ke.forEach(function(xo){return c(le,xo)}),Nt&&cl(le,Je),Ue}function Ze(le,ae,fe,Ne){if(fe==null)throw Error(r(151));for(var Ue=null,ft=null,Ke=ae,Je=ae=0,Bn=null,bt=fe.next();Ke!==null&&!bt.done;Je++,bt=fe.next()){Ke.index>Je?(Bn=Ke,Ke=null):Bn=Ke.sibling;var xo=xe(le,Ke,bt.value,Ne);if(xo===null){Ke===null&&(Ke=Bn);break}o&&Ke&&xo.alternate===null&&c(le,Ke),ae=O(xo,ae,Je),ft===null?Ue=xo:ft.sibling=xo,ft=xo,Ke=Bn}if(bt.done)return m(le,Ke),Nt&&cl(le,Je),Ue;if(Ke===null){for(;!bt.done;Je++,bt=fe.next())bt=Ce(le,bt.value,Ne),bt!==null&&(ae=O(bt,ae,Je),ft===null?Ue=bt:ft.sibling=bt,ft=bt);return Nt&&cl(le,Je),Ue}for(Ke=g(Ke);!bt.done;Je++,bt=fe.next())bt=ge(Ke,le,Je,bt.value,Ne),bt!==null&&(o&&bt.alternate!==null&&Ke.delete(bt.key===null?Je:bt.key),ae=O(bt,ae,Je),ft===null?Ue=bt:ft.sibling=bt,ft=bt);return o&&Ke.forEach(function(SX){return c(le,SX)}),Nt&&cl(le,Je),Ue}function It(le,ae,fe,Ne){if(typeof fe=="object"&&fe!==null&&fe.type===w&&fe.key===null&&(fe=fe.props.children),typeof fe=="object"&&fe!==null){switch(fe.$$typeof){case x:e:{for(var Ue=fe.key;ae!==null;){if(ae.key===Ue){if(Ue=fe.type,Ue===w){if(ae.tag===7){m(le,ae.sibling),Ne=S(ae,fe.props.children),Ne.return=le,le=Ne;break e}}else if(ae.elementType===Ue||typeof Ue=="object"&&Ue!==null&&Ue.$$typeof===_&&kE(Ue)===ae.type){m(le,ae.sibling),Ne=S(ae,fe.props),uf(Ne,fe),Ne.return=le,le=Ne;break e}m(le,ae);break}else c(le,ae);ae=ae.sibling}fe.type===w?(Ne=ol(fe.props.children,le.mode,Ne,fe.key),Ne.return=le,le=Ne):(Ne=yp(fe.type,fe.key,fe.props,null,le.mode,Ne),uf(Ne,fe),Ne.return=le,le=Ne)}return $(le);case y:e:{for(Ue=fe.key;ae!==null;){if(ae.key===Ue)if(ae.tag===4&&ae.stateNode.containerInfo===fe.containerInfo&&ae.stateNode.implementation===fe.implementation){m(le,ae.sibling),Ne=S(ae,fe.children||[]),Ne.return=le,le=Ne;break e}else{m(le,ae);break}else c(le,ae);ae=ae.sibling}Ne=Bb(fe,le.mode,Ne),Ne.return=le,le=Ne}return $(le);case _:return Ue=fe._init,fe=Ue(fe._payload),It(le,ae,fe,Ne)}if(V(fe))return rt(le,ae,fe,Ne);if(I(fe)){if(Ue=I(fe),typeof Ue!="function")throw Error(r(150));return fe=Ue.call(fe),Ze(le,ae,fe,Ne)}if(typeof fe.then=="function")return It(le,ae,Dp(fe),Ne);if(fe.$$typeof===k)return It(le,ae,wp(le,fe),Ne);$p(le,fe)}return typeof fe=="string"&&fe!==""||typeof fe=="number"||typeof fe=="bigint"?(fe=""+fe,ae!==null&&ae.tag===6?(m(le,ae.sibling),Ne=S(ae,fe),Ne.return=le,le=Ne):(m(le,ae),Ne=qb(fe,le.mode,Ne),Ne.return=le,le=Ne),$(le)):m(le,ae)}return function(le,ae,fe,Ne){try{cf=0;var Ue=It(le,ae,fe,Ne);return Bc=null,Ue}catch(Ke){if(Ke===Jd||Ke===Sp)throw Ke;var ft=Gr(29,Ke,null,le.mode);return ft.lanes=Ne,ft.return=le,ft}}}var zc=OE(!0),PE=OE(!1),ya=Z(null),gs=null;function eo(o){var c=o.alternate;B(Tn,Tn.current&1),B(ya,o),gs===null&&(c===null||Ic.current!==null||c.memoizedState!==null)&&(gs=o)}function EE(o){if(o.tag===22){if(B(Tn,Tn.current),B(ya,o),gs===null){var c=o.alternate;c!==null&&c.memoizedState!==null&&(gs=o)}}else to()}function to(){B(Tn,Tn.current),B(ya,ya.current)}function si(o){F(ya),gs===o&&(gs=null),F(Tn)}var Tn=Z(0);function Ip(o){for(var c=o;c!==null;){if(c.tag===13){var m=c.memoizedState;if(m!==null&&(m=m.dehydrated,m===null||m.data==="$?"||cj(m)))return c}else if(c.tag===19&&c.memoizedProps.revealOrder!==void 0){if((c.flags&128)!==0)return c}else if(c.child!==null){c.child.return=c,c=c.child;continue}if(c===o)break;for(;c.sibling===null;){if(c.return===null||c.return===o)return null;c=c.return}c.sibling.return=c.return,c=c.sibling}return null}function b0(o,c,m,g){c=o.memoizedState,m=m(g,c),m=m==null?c:h({},c,m),o.memoizedState=m,o.lanes===0&&(o.updateQueue.baseState=m)}var j0={enqueueSetState:function(o,c,m){o=o._reactInternals;var g=Xr(),S=Qi(g);S.payload=c,m!=null&&(S.callback=m),c=Zi(o,S,g),c!==null&&(Qr(c,o,g),tf(c,o,g))},enqueueReplaceState:function(o,c,m){o=o._reactInternals;var g=Xr(),S=Qi(g);S.tag=1,S.payload=c,m!=null&&(S.callback=m),c=Zi(o,S,g),c!==null&&(Qr(c,o,g),tf(c,o,g))},enqueueForceUpdate:function(o,c){o=o._reactInternals;var m=Xr(),g=Qi(m);g.tag=2,c!=null&&(g.callback=c),c=Zi(o,g,m),c!==null&&(Qr(c,o,m),tf(c,o,m))}};function _E(o,c,m,g,S,O,$){return o=o.stateNode,typeof o.shouldComponentUpdate=="function"?o.shouldComponentUpdate(g,O,$):c.prototype&&c.prototype.isPureReactComponent?!Vd(m,g)||!Vd(S,O):!0}function ME(o,c,m,g){o=c.state,typeof c.componentWillReceiveProps=="function"&&c.componentWillReceiveProps(m,g),typeof c.UNSAFE_componentWillReceiveProps=="function"&&c.UNSAFE_componentWillReceiveProps(m,g),c.state!==o&&j0.enqueueReplaceState(c,c.state,null)}function xl(o,c){var m=c;if("ref"in c){m={};for(var g in c)g!=="ref"&&(m[g]=c[g])}if(o=o.defaultProps){m===c&&(m=h({},m));for(var S in o)m[S]===void 0&&(m[S]=o[S])}return m}var Lp=typeof reportError=="function"?reportError:function(o){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var c=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof o=="object"&&o!==null&&typeof o.message=="string"?String(o.message):String(o),error:o});if(!window.dispatchEvent(c))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",o);return}console.error(o)};function RE(o){Lp(o)}function DE(o){console.error(o)}function $E(o){Lp(o)}function Fp(o,c){try{var m=o.onUncaughtError;m(c.value,{componentStack:c.stack})}catch(g){setTimeout(function(){throw g})}}function IE(o,c,m){try{var g=o.onCaughtError;g(m.value,{componentStack:m.stack,errorBoundary:c.tag===1?c.stateNode:null})}catch(S){setTimeout(function(){throw S})}}function w0(o,c,m){return m=Qi(m),m.tag=3,m.payload={element:null},m.callback=function(){Fp(o,c)},m}function LE(o){return o=Qi(o),o.tag=3,o}function FE(o,c,m,g){var S=m.type.getDerivedStateFromError;if(typeof S=="function"){var O=g.value;o.payload=function(){return S(O)},o.callback=function(){IE(c,m,g)}}var $=m.stateNode;$!==null&&typeof $.componentDidCatch=="function"&&(o.callback=function(){IE(c,m,g),typeof S!="function"&&(oo===null?oo=new Set([this]):oo.add(this));var G=g.stack;this.componentDidCatch(g.value,{componentStack:G!==null?G:""})})}function SY(o,c,m,g,S){if(m.flags|=32768,g!==null&&typeof g=="object"&&typeof g.then=="function"){if(c=m.alternate,c!==null&&Xd(c,m,S,!0),m=ya.current,m!==null){switch(m.tag){case 13:return gs===null?G0():m.alternate===null&&cn===0&&(cn=3),m.flags&=-257,m.flags|=65536,m.lanes=S,g===Qb?m.flags|=16384:(c=m.updateQueue,c===null?m.updateQueue=new Set([g]):c.add(g),W0(o,g,S)),!1;case 22:return m.flags|=65536,g===Qb?m.flags|=16384:(c=m.updateQueue,c===null?(c={transitions:null,markerInstances:null,retryQueue:new Set([g])},m.updateQueue=c):(m=c.retryQueue,m===null?c.retryQueue=new Set([g]):m.add(g)),W0(o,g,S)),!1}throw Error(r(435,m.tag))}return W0(o,g,S),G0(),!1}if(Nt)return c=ya.current,c!==null?((c.flags&65536)===0&&(c.flags|=256),c.flags|=65536,c.lanes=S,g!==Hb&&(o=Error(r(422),{cause:g}),Yd(ha(o,m)))):(g!==Hb&&(c=Error(r(423),{cause:g}),Yd(ha(c,m))),o=o.current.alternate,o.flags|=65536,S&=-S,o.lanes|=S,g=ha(g,m),S=w0(o.stateNode,g,S),e0(o,S),cn!==4&&(cn=2)),!1;var O=Error(r(520),{cause:g});if(O=ha(O,m),gf===null?gf=[O]:gf.push(O),cn!==4&&(cn=2),c===null)return!0;g=ha(g,m),m=c;do{switch(m.tag){case 3:return m.flags|=65536,o=S&-S,m.lanes|=o,o=w0(m.stateNode,g,o),e0(m,o),!1;case 1:if(c=m.type,O=m.stateNode,(m.flags&128)===0&&(typeof c.getDerivedStateFromError=="function"||O!==null&&typeof O.componentDidCatch=="function"&&(oo===null||!oo.has(O))))return m.flags|=65536,S&=-S,m.lanes|=S,S=LE(S),FE(S,o,m,g),e0(m,S),!1}m=m.return}while(m!==null);return!1}var qE=Error(r(461)),Fn=!1;function Kn(o,c,m,g){c.child=o===null?PE(c,null,m,g):zc(c,o.child,m,g)}function BE(o,c,m,g,S){m=m.render;var O=c.ref;if("ref"in g){var $={};for(var G in g)G!=="ref"&&($[G]=g[G])}else $=g;return ml(c),g=s0(o,c,m,$,O,S),G=i0(),o!==null&&!Fn?(o0(o,c,S),ii(o,c,S)):(Nt&&G&&zb(c),c.flags|=1,Kn(o,c,g,S),c.child)}function zE(o,c,m,g,S){if(o===null){var O=m.type;return typeof O=="function"&&!Fb(O)&&O.defaultProps===void 0&&m.compare===null?(c.tag=15,c.type=O,UE(o,c,O,g,S)):(o=yp(m.type,null,g,c,c.mode,S),o.ref=c.ref,o.return=c,c.child=o)}if(O=o.child,!P0(o,S)){var $=O.memoizedProps;if(m=m.compare,m=m!==null?m:Vd,m($,g)&&o.ref===c.ref)return ii(o,c,S)}return c.flags|=1,o=Js(O,g),o.ref=c.ref,o.return=c,c.child=o}function UE(o,c,m,g,S){if(o!==null){var O=o.memoizedProps;if(Vd(O,g)&&o.ref===c.ref)if(Fn=!1,c.pendingProps=g=O,P0(o,S))(o.flags&131072)!==0&&(Fn=!0);else return c.lanes=o.lanes,ii(o,c,S)}return N0(o,c,m,g,S)}function HE(o,c,m){var g=c.pendingProps,S=g.children,O=o!==null?o.memoizedState:null;if(g.mode==="hidden"){if((c.flags&128)!==0){if(g=O!==null?O.baseLanes|m:m,o!==null){for(S=c.child=o.child,O=0;S!==null;)O=O|S.lanes|S.childLanes,S=S.sibling;c.childLanes=O&~g}else c.childLanes=0,c.child=null;return VE(o,c,g,m)}if((m&536870912)!==0)c.memoizedState={baseLanes:0,cachePool:null},o!==null&&Np(c,O!==null?O.cachePool:null),O!==null?UP(c,O):n0(),EE(c);else return c.lanes=c.childLanes=536870912,VE(o,c,O!==null?O.baseLanes|m:m,m)}else O!==null?(Np(c,O.cachePool),UP(c,O),to(),c.memoizedState=null):(o!==null&&Np(c,null),n0(),to());return Kn(o,c,S,m),c.child}function VE(o,c,m,g){var S=Xb();return S=S===null?null:{parent:An._currentValue,pool:S},c.memoizedState={baseLanes:m,cachePool:S},o!==null&&Np(c,null),n0(),EE(c),o!==null&&Xd(o,c,g,!0),null}function qp(o,c){var m=c.ref;if(m===null)o!==null&&o.ref!==null&&(c.flags|=4194816);else{if(typeof m!="function"&&typeof m!="object")throw Error(r(284));(o===null||o.ref!==m)&&(c.flags|=4194816)}}function N0(o,c,m,g,S){return ml(c),m=s0(o,c,m,g,void 0,S),g=i0(),o!==null&&!Fn?(o0(o,c,S),ii(o,c,S)):(Nt&&g&&zb(c),c.flags|=1,Kn(o,c,m,S),c.child)}function GE(o,c,m,g,S,O){return ml(c),c.updateQueue=null,m=VP(c,g,m,S),HP(o),g=i0(),o!==null&&!Fn?(o0(o,c,O),ii(o,c,O)):(Nt&&g&&zb(c),c.flags|=1,Kn(o,c,m,O),c.child)}function KE(o,c,m,g,S){if(ml(c),c.stateNode===null){var O=_c,$=m.contextType;typeof $=="object"&&$!==null&&(O=ar($)),O=new m(g,O),c.memoizedState=O.state!==null&&O.state!==void 0?O.state:null,O.updater=j0,c.stateNode=O,O._reactInternals=c,O=c.stateNode,O.props=g,O.state=c.memoizedState,O.refs={},Zb(c),$=m.contextType,O.context=typeof $=="object"&&$!==null?ar($):_c,O.state=c.memoizedState,$=m.getDerivedStateFromProps,typeof $=="function"&&(b0(c,m,$,g),O.state=c.memoizedState),typeof m.getDerivedStateFromProps=="function"||typeof O.getSnapshotBeforeUpdate=="function"||typeof O.UNSAFE_componentWillMount!="function"&&typeof O.componentWillMount!="function"||($=O.state,typeof O.componentWillMount=="function"&&O.componentWillMount(),typeof O.UNSAFE_componentWillMount=="function"&&O.UNSAFE_componentWillMount(),$!==O.state&&j0.enqueueReplaceState(O,O.state,null),rf(c,g,O,S),nf(),O.state=c.memoizedState),typeof O.componentDidMount=="function"&&(c.flags|=4194308),g=!0}else if(o===null){O=c.stateNode;var G=c.memoizedProps,J=xl(m,G);O.props=J;var me=O.context,we=m.contextType;$=_c,typeof we=="object"&&we!==null&&($=ar(we));var Ce=m.getDerivedStateFromProps;we=typeof Ce=="function"||typeof O.getSnapshotBeforeUpdate=="function",G=c.pendingProps!==G,we||typeof O.UNSAFE_componentWillReceiveProps!="function"&&typeof O.componentWillReceiveProps!="function"||(G||me!==$)&&ME(c,O,g,$),Xi=!1;var xe=c.memoizedState;O.state=xe,rf(c,g,O,S),nf(),me=c.memoizedState,G||xe!==me||Xi?(typeof Ce=="function"&&(b0(c,m,Ce,g),me=c.memoizedState),(J=Xi||_E(c,m,J,g,xe,me,$))?(we||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"&&(c.flags|=4194308)):(typeof O.componentDidMount=="function"&&(c.flags|=4194308),c.memoizedProps=g,c.memoizedState=me),O.props=g,O.state=me,O.context=$,g=J):(typeof O.componentDidMount=="function"&&(c.flags|=4194308),g=!1)}else{O=c.stateNode,Jb(o,c),$=c.memoizedProps,we=xl(m,$),O.props=we,Ce=c.pendingProps,xe=O.context,me=m.contextType,J=_c,typeof me=="object"&&me!==null&&(J=ar(me)),G=m.getDerivedStateFromProps,(me=typeof G=="function"||typeof O.getSnapshotBeforeUpdate=="function")||typeof O.UNSAFE_componentWillReceiveProps!="function"&&typeof O.componentWillReceiveProps!="function"||($!==Ce||xe!==J)&&ME(c,O,g,J),Xi=!1,xe=c.memoizedState,O.state=xe,rf(c,g,O,S),nf();var ge=c.memoizedState;$!==Ce||xe!==ge||Xi||o!==null&&o.dependencies!==null&&jp(o.dependencies)?(typeof G=="function"&&(b0(c,m,G,g),ge=c.memoizedState),(we=Xi||_E(c,m,we,g,xe,ge,J)||o!==null&&o.dependencies!==null&&jp(o.dependencies))?(me||typeof O.UNSAFE_componentWillUpdate!="function"&&typeof O.componentWillUpdate!="function"||(typeof O.componentWillUpdate=="function"&&O.componentWillUpdate(g,ge,J),typeof O.UNSAFE_componentWillUpdate=="function"&&O.UNSAFE_componentWillUpdate(g,ge,J)),typeof O.componentDidUpdate=="function"&&(c.flags|=4),typeof O.getSnapshotBeforeUpdate=="function"&&(c.flags|=1024)):(typeof O.componentDidUpdate!="function"||$===o.memoizedProps&&xe===o.memoizedState||(c.flags|=4),typeof O.getSnapshotBeforeUpdate!="function"||$===o.memoizedProps&&xe===o.memoizedState||(c.flags|=1024),c.memoizedProps=g,c.memoizedState=ge),O.props=g,O.state=ge,O.context=J,g=we):(typeof O.componentDidUpdate!="function"||$===o.memoizedProps&&xe===o.memoizedState||(c.flags|=4),typeof O.getSnapshotBeforeUpdate!="function"||$===o.memoizedProps&&xe===o.memoizedState||(c.flags|=1024),g=!1)}return O=g,qp(o,c),g=(c.flags&128)!==0,O||g?(O=c.stateNode,m=g&&typeof m.getDerivedStateFromError!="function"?null:O.render(),c.flags|=1,o!==null&&g?(c.child=zc(c,o.child,null,S),c.child=zc(c,null,m,S)):Kn(o,c,m,S),c.memoizedState=O.state,o=c.child):o=ii(o,c,S),o}function WE(o,c,m,g){return Wd(),c.flags|=256,Kn(o,c,m,g),c.child}var S0={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function C0(o){return{baseLanes:o,cachePool:DP()}}function A0(o,c,m){return o=o!==null?o.childLanes&~m:0,c&&(o|=va),o}function YE(o,c,m){var g=c.pendingProps,S=!1,O=(c.flags&128)!==0,$;if(($=O)||($=o!==null&&o.memoizedState===null?!1:(Tn.current&2)!==0),$&&(S=!0,c.flags&=-129),$=(c.flags&32)!==0,c.flags&=-33,o===null){if(Nt){if(S?eo(c):to(),Nt){var G=ln,J;if(J=G){e:{for(J=G,G=xs;J.nodeType!==8;){if(!G){G=null;break e}if(J=Ua(J.nextSibling),J===null){G=null;break e}}G=J}G!==null?(c.memoizedState={dehydrated:G,treeContext:ll!==null?{id:ei,overflow:ti}:null,retryLane:536870912,hydrationErrors:null},J=Gr(18,null,null,0),J.stateNode=G,J.return=c,c.child=J,pr=c,ln=null,J=!0):J=!1}J||dl(c)}if(G=c.memoizedState,G!==null&&(G=G.dehydrated,G!==null))return cj(G)?c.lanes=32:c.lanes=536870912,null;si(c)}return G=g.children,g=g.fallback,S?(to(),S=c.mode,G=Bp({mode:"hidden",children:G},S),g=ol(g,S,m,null),G.return=c,g.return=c,G.sibling=g,c.child=G,S=c.child,S.memoizedState=C0(m),S.childLanes=A0(o,$,m),c.memoizedState=S0,g):(eo(c),T0(c,G))}if(J=o.memoizedState,J!==null&&(G=J.dehydrated,G!==null)){if(O)c.flags&256?(eo(c),c.flags&=-257,c=k0(o,c,m)):c.memoizedState!==null?(to(),c.child=o.child,c.flags|=128,c=null):(to(),S=g.fallback,G=c.mode,g=Bp({mode:"visible",children:g.children},G),S=ol(S,G,m,null),S.flags|=2,g.return=c,S.return=c,g.sibling=S,c.child=g,zc(c,o.child,null,m),g=c.child,g.memoizedState=C0(m),g.childLanes=A0(o,$,m),c.memoizedState=S0,c=S);else if(eo(c),cj(G)){if($=G.nextSibling&&G.nextSibling.dataset,$)var me=$.dgst;$=me,g=Error(r(419)),g.stack="",g.digest=$,Yd({value:g,source:null,stack:null}),c=k0(o,c,m)}else if(Fn||Xd(o,c,m,!1),$=(m&o.childLanes)!==0,Fn||$){if($=Vt,$!==null&&(g=m&-m,g=(g&42)!==0?1:St(g),g=(g&($.suspendedLanes|m))!==0?0:g,g!==0&&g!==J.retryLane))throw J.retryLane=g,Ec(o,g),Qr($,o,g),qE;G.data==="$?"||G0(),c=k0(o,c,m)}else G.data==="$?"?(c.flags|=192,c.child=o.child,c=null):(o=J.treeContext,ln=Ua(G.nextSibling),pr=c,Nt=!0,ul=null,xs=!1,o!==null&&(xa[ga++]=ei,xa[ga++]=ti,xa[ga++]=ll,ei=o.id,ti=o.overflow,ll=c),c=T0(c,g.children),c.flags|=4096);return c}return S?(to(),S=g.fallback,G=c.mode,J=o.child,me=J.sibling,g=Js(J,{mode:"hidden",children:g.children}),g.subtreeFlags=J.subtreeFlags&65011712,me!==null?S=Js(me,S):(S=ol(S,G,m,null),S.flags|=2),S.return=c,g.return=c,g.sibling=S,c.child=g,g=S,S=c.child,G=o.child.memoizedState,G===null?G=C0(m):(J=G.cachePool,J!==null?(me=An._currentValue,J=J.parent!==me?{parent:me,pool:me}:J):J=DP(),G={baseLanes:G.baseLanes|m,cachePool:J}),S.memoizedState=G,S.childLanes=A0(o,$,m),c.memoizedState=S0,g):(eo(c),m=o.child,o=m.sibling,m=Js(m,{mode:"visible",children:g.children}),m.return=c,m.sibling=null,o!==null&&($=c.deletions,$===null?(c.deletions=[o],c.flags|=16):$.push(o)),c.child=m,c.memoizedState=null,m)}function T0(o,c){return c=Bp({mode:"visible",children:c},o.mode),c.return=o,o.child=c}function Bp(o,c){return o=Gr(22,o,null,c),o.lanes=0,o.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null},o}function k0(o,c,m){return zc(c,o.child,null,m),o=T0(c,c.pendingProps.children),o.flags|=2,c.memoizedState=null,o}function XE(o,c,m){o.lanes|=c;var g=o.alternate;g!==null&&(g.lanes|=c),Gb(o.return,c,m)}function O0(o,c,m,g,S){var O=o.memoizedState;O===null?o.memoizedState={isBackwards:c,rendering:null,renderingStartTime:0,last:g,tail:m,tailMode:S}:(O.isBackwards=c,O.rendering=null,O.renderingStartTime=0,O.last=g,O.tail=m,O.tailMode=S)}function QE(o,c,m){var g=c.pendingProps,S=g.revealOrder,O=g.tail;if(Kn(o,c,g.children,m),g=Tn.current,(g&2)!==0)g=g&1|2,c.flags|=128;else{if(o!==null&&(o.flags&128)!==0)e:for(o=c.child;o!==null;){if(o.tag===13)o.memoizedState!==null&&XE(o,m,c);else if(o.tag===19)XE(o,m,c);else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===c)break e;for(;o.sibling===null;){if(o.return===null||o.return===c)break e;o=o.return}o.sibling.return=o.return,o=o.sibling}g&=1}switch(B(Tn,g),S){case"forwards":for(m=c.child,S=null;m!==null;)o=m.alternate,o!==null&&Ip(o)===null&&(S=m),m=m.sibling;m=S,m===null?(S=c.child,c.child=null):(S=m.sibling,m.sibling=null),O0(c,!1,S,m,O);break;case"backwards":for(m=null,S=c.child,c.child=null;S!==null;){if(o=S.alternate,o!==null&&Ip(o)===null){c.child=S;break}o=S.sibling,S.sibling=m,m=S,S=o}O0(c,!0,m,null,O);break;case"together":O0(c,!1,null,null,void 0);break;default:c.memoizedState=null}return c.child}function ii(o,c,m){if(o!==null&&(c.dependencies=o.dependencies),io|=c.lanes,(m&c.childLanes)===0)if(o!==null){if(Xd(o,c,m,!1),(m&c.childLanes)===0)return null}else return null;if(o!==null&&c.child!==o.child)throw Error(r(153));if(c.child!==null){for(o=c.child,m=Js(o,o.pendingProps),c.child=m,m.return=c;o.sibling!==null;)o=o.sibling,m=m.sibling=Js(o,o.pendingProps),m.return=c;m.sibling=null}return c.child}function P0(o,c){return(o.lanes&c)!==0?!0:(o=o.dependencies,!!(o!==null&&jp(o)))}function CY(o,c,m){switch(c.tag){case 3:ve(c,c.stateNode.containerInfo),Yi(c,An,o.memoizedState.cache),Wd();break;case 27:case 5:de(c);break;case 4:ve(c,c.stateNode.containerInfo);break;case 10:Yi(c,c.type,c.memoizedProps.value);break;case 13:var g=c.memoizedState;if(g!==null)return g.dehydrated!==null?(eo(c),c.flags|=128,null):(m&c.child.childLanes)!==0?YE(o,c,m):(eo(c),o=ii(o,c,m),o!==null?o.sibling:null);eo(c);break;case 19:var S=(o.flags&128)!==0;if(g=(m&c.childLanes)!==0,g||(Xd(o,c,m,!1),g=(m&c.childLanes)!==0),S){if(g)return QE(o,c,m);c.flags|=128}if(S=c.memoizedState,S!==null&&(S.rendering=null,S.tail=null,S.lastEffect=null),B(Tn,Tn.current),g)break;return null;case 22:case 23:return c.lanes=0,HE(o,c,m);case 24:Yi(c,An,o.memoizedState.cache)}return ii(o,c,m)}function ZE(o,c,m){if(o!==null)if(o.memoizedProps!==c.pendingProps)Fn=!0;else{if(!P0(o,m)&&(c.flags&128)===0)return Fn=!1,CY(o,c,m);Fn=(o.flags&131072)!==0}else Fn=!1,Nt&&(c.flags&1048576)!==0&&kP(c,bp,c.index);switch(c.lanes=0,c.tag){case 16:e:{o=c.pendingProps;var g=c.elementType,S=g._init;if(g=S(g._payload),c.type=g,typeof g=="function")Fb(g)?(o=xl(g,o),c.tag=1,c=KE(null,c,g,o,m)):(c.tag=0,c=N0(null,c,g,o,m));else{if(g!=null){if(S=g.$$typeof,S===T){c.tag=11,c=BE(null,c,g,o,m);break e}else if(S===E){c.tag=14,c=zE(null,c,g,o,m);break e}}throw c=U(g)||g,Error(r(306,c,""))}}return c;case 0:return N0(o,c,c.type,c.pendingProps,m);case 1:return g=c.type,S=xl(g,c.pendingProps),KE(o,c,g,S,m);case 3:e:{if(ve(c,c.stateNode.containerInfo),o===null)throw Error(r(387));g=c.pendingProps;var O=c.memoizedState;S=O.element,Jb(o,c),rf(c,g,null,m);var $=c.memoizedState;if(g=$.cache,Yi(c,An,g),g!==O.cache&&Kb(c,[An],m,!0),nf(),g=$.element,O.isDehydrated)if(O={element:g,isDehydrated:!1,cache:$.cache},c.updateQueue.baseState=O,c.memoizedState=O,c.flags&256){c=WE(o,c,g,m);break e}else if(g!==S){S=ha(Error(r(424)),c),Yd(S),c=WE(o,c,g,m);break e}else for(o=c.stateNode.containerInfo,o.nodeType===9?o=o.body:o=o.nodeName==="HTML"?o.ownerDocument.body:o,ln=Ua(o.firstChild),pr=c,Nt=!0,ul=null,xs=!0,m=PE(c,null,g,m),c.child=m;m;)m.flags=m.flags&-3|4096,m=m.sibling;else{if(Wd(),g===S){c=ii(o,c,m);break e}Kn(o,c,g,m)}c=c.child}return c;case 26:return qp(o,c),o===null?(m=nM(c.type,null,c.pendingProps,null))?c.memoizedState=m:Nt||(m=c.type,o=c.pendingProps,g=tx(se.current).createElement(m),g[kt]=c,g[Jt]=o,Yn(g,m,o),xn(g),c.stateNode=g):c.memoizedState=nM(c.type,o.memoizedProps,c.pendingProps,o.memoizedState),null;case 27:return de(c),o===null&&Nt&&(g=c.stateNode=J_(c.type,c.pendingProps,se.current),pr=c,xs=!0,S=ln,uo(c.type)?(uj=S,ln=Ua(g.firstChild)):ln=S),Kn(o,c,c.pendingProps.children,m),qp(o,c),o===null&&(c.flags|=4194304),c.child;case 5:return o===null&&Nt&&((S=g=ln)&&(g=JY(g,c.type,c.pendingProps,xs),g!==null?(c.stateNode=g,pr=c,ln=Ua(g.firstChild),xs=!1,S=!0):S=!1),S||dl(c)),de(c),S=c.type,O=c.pendingProps,$=o!==null?o.memoizedProps:null,g=O.children,ij(S,O)?g=null:$!==null&&ij(S,$)&&(c.flags|=32),c.memoizedState!==null&&(S=s0(o,c,gY,null,null,m),Af._currentValue=S),qp(o,c),Kn(o,c,g,m),c.child;case 6:return o===null&&Nt&&((o=m=ln)&&(m=eX(m,c.pendingProps,xs),m!==null?(c.stateNode=m,pr=c,ln=null,o=!0):o=!1),o||dl(c)),null;case 13:return YE(o,c,m);case 4:return ve(c,c.stateNode.containerInfo),g=c.pendingProps,o===null?c.child=zc(c,null,g,m):Kn(o,c,g,m),c.child;case 11:return BE(o,c,c.type,c.pendingProps,m);case 7:return Kn(o,c,c.pendingProps,m),c.child;case 8:return Kn(o,c,c.pendingProps.children,m),c.child;case 12:return Kn(o,c,c.pendingProps.children,m),c.child;case 10:return g=c.pendingProps,Yi(c,c.type,g.value),Kn(o,c,g.children,m),c.child;case 9:return S=c.type._context,g=c.pendingProps.children,ml(c),S=ar(S),g=g(S),c.flags|=1,Kn(o,c,g,m),c.child;case 14:return zE(o,c,c.type,c.pendingProps,m);case 15:return UE(o,c,c.type,c.pendingProps,m);case 19:return QE(o,c,m);case 31:return g=c.pendingProps,m=c.mode,g={mode:g.mode,children:g.children},o===null?(m=Bp(g,m),m.ref=c.ref,c.child=m,m.return=c,c=m):(m=Js(o.child,g),m.ref=c.ref,c.child=m,m.return=c,c=m),c;case 22:return HE(o,c,m);case 24:return ml(c),g=ar(An),o===null?(S=Xb(),S===null&&(S=Vt,O=Wb(),S.pooledCache=O,O.refCount++,O!==null&&(S.pooledCacheLanes|=m),S=O),c.memoizedState={parent:g,cache:S},Zb(c),Yi(c,An,S)):((o.lanes&m)!==0&&(Jb(o,c),rf(c,null,null,m),nf()),S=o.memoizedState,O=c.memoizedState,S.parent!==g?(S={parent:g,cache:g},c.memoizedState=S,c.lanes===0&&(c.memoizedState=c.updateQueue.baseState=S),Yi(c,An,g)):(g=O.cache,Yi(c,An,g),g!==S.cache&&Kb(c,[An],m,!0))),Kn(o,c,c.pendingProps.children,m),c.child;case 29:throw c.pendingProps}throw Error(r(156,c.tag))}function oi(o){o.flags|=4}function JE(o,c){if(c.type!=="stylesheet"||(c.state.loading&4)!==0)o.flags&=-16777217;else if(o.flags|=16777216,!oM(c)){if(c=ya.current,c!==null&&((vt&4194048)===vt?gs!==null:(vt&62914560)!==vt&&(vt&536870912)===0||c!==gs))throw ef=Qb,$P;o.flags|=8192}}function zp(o,c){c!==null&&(o.flags|=4),o.flags&16384&&(c=o.tag!==22?Jo():536870912,o.lanes|=c,Gc|=c)}function df(o,c){if(!Nt)switch(o.tailMode){case"hidden":c=o.tail;for(var m=null;c!==null;)c.alternate!==null&&(m=c),c=c.sibling;m===null?o.tail=null:m.sibling=null;break;case"collapsed":m=o.tail;for(var g=null;m!==null;)m.alternate!==null&&(g=m),m=m.sibling;g===null?c||o.tail===null?o.tail=null:o.tail.sibling=null:g.sibling=null}}function en(o){var c=o.alternate!==null&&o.alternate.child===o.child,m=0,g=0;if(c)for(var S=o.child;S!==null;)m|=S.lanes|S.childLanes,g|=S.subtreeFlags&65011712,g|=S.flags&65011712,S.return=o,S=S.sibling;else for(S=o.child;S!==null;)m|=S.lanes|S.childLanes,g|=S.subtreeFlags,g|=S.flags,S.return=o,S=S.sibling;return o.subtreeFlags|=g,o.childLanes=m,c}function AY(o,c,m){var g=c.pendingProps;switch(Ub(c),c.tag){case 31:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return en(c),null;case 1:return en(c),null;case 3:return m=c.stateNode,g=null,o!==null&&(g=o.memoizedState.cache),c.memoizedState.cache!==g&&(c.flags|=2048),ri(An),ue(),m.pendingContext&&(m.context=m.pendingContext,m.pendingContext=null),(o===null||o.child===null)&&(Kd(c)?oi(c):o===null||o.memoizedState.isDehydrated&&(c.flags&256)===0||(c.flags|=1024,EP())),en(c),null;case 26:return m=c.memoizedState,o===null?(oi(c),m!==null?(en(c),JE(c,m)):(en(c),c.flags&=-16777217)):m?m!==o.memoizedState?(oi(c),en(c),JE(c,m)):(en(c),c.flags&=-16777217):(o.memoizedProps!==g&&oi(c),en(c),c.flags&=-16777217),null;case 27:Se(c),m=se.current;var S=c.type;if(o!==null&&c.stateNode!=null)o.memoizedProps!==g&&oi(c);else{if(!g){if(c.stateNode===null)throw Error(r(166));return en(c),null}o=X.current,Kd(c)?OP(c):(o=J_(S,g,m),c.stateNode=o,oi(c))}return en(c),null;case 5:if(Se(c),m=c.type,o!==null&&c.stateNode!=null)o.memoizedProps!==g&&oi(c);else{if(!g){if(c.stateNode===null)throw Error(r(166));return en(c),null}if(o=X.current,Kd(c))OP(c);else{switch(S=tx(se.current),o){case 1:o=S.createElementNS("http://www.w3.org/2000/svg",m);break;case 2:o=S.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;default:switch(m){case"svg":o=S.createElementNS("http://www.w3.org/2000/svg",m);break;case"math":o=S.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;case"script":o=S.createElement("div"),o.innerHTML="<script><\/script>",o=o.removeChild(o.firstChild);break;case"select":o=typeof g.is=="string"?S.createElement("select",{is:g.is}):S.createElement("select"),g.multiple?o.multiple=!0:g.size&&(o.size=g.size);break;default:o=typeof g.is=="string"?S.createElement(m,{is:g.is}):S.createElement(m)}}o[kt]=c,o[Jt]=g;e:for(S=c.child;S!==null;){if(S.tag===5||S.tag===6)o.appendChild(S.stateNode);else if(S.tag!==4&&S.tag!==27&&S.child!==null){S.child.return=S,S=S.child;continue}if(S===c)break e;for(;S.sibling===null;){if(S.return===null||S.return===c)break e;S=S.return}S.sibling.return=S.return,S=S.sibling}c.stateNode=o;e:switch(Yn(o,m,g),m){case"button":case"input":case"select":case"textarea":o=!!g.autoFocus;break e;case"img":o=!0;break e;default:o=!1}o&&oi(c)}}return en(c),c.flags&=-16777217,null;case 6:if(o&&c.stateNode!=null)o.memoizedProps!==g&&oi(c);else{if(typeof g!="string"&&c.stateNode===null)throw Error(r(166));if(o=se.current,Kd(c)){if(o=c.stateNode,m=c.memoizedProps,g=null,S=pr,S!==null)switch(S.tag){case 27:case 5:g=S.memoizedProps}o[kt]=c,o=!!(o.nodeValue===m||g!==null&&g.suppressHydrationWarning===!0||G_(o.nodeValue,m)),o||dl(c)}else o=tx(o).createTextNode(g),o[kt]=c,c.stateNode=o}return en(c),null;case 13:if(g=c.memoizedState,o===null||o.memoizedState!==null&&o.memoizedState.dehydrated!==null){if(S=Kd(c),g!==null&&g.dehydrated!==null){if(o===null){if(!S)throw Error(r(318));if(S=c.memoizedState,S=S!==null?S.dehydrated:null,!S)throw Error(r(317));S[kt]=c}else Wd(),(c.flags&128)===0&&(c.memoizedState=null),c.flags|=4;en(c),S=!1}else S=EP(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=S),S=!0;if(!S)return c.flags&256?(si(c),c):(si(c),null)}if(si(c),(c.flags&128)!==0)return c.lanes=m,c;if(m=g!==null,o=o!==null&&o.memoizedState!==null,m){g=c.child,S=null,g.alternate!==null&&g.alternate.memoizedState!==null&&g.alternate.memoizedState.cachePool!==null&&(S=g.alternate.memoizedState.cachePool.pool);var O=null;g.memoizedState!==null&&g.memoizedState.cachePool!==null&&(O=g.memoizedState.cachePool.pool),O!==S&&(g.flags|=2048)}return m!==o&&m&&(c.child.flags|=8192),zp(c,c.updateQueue),en(c),null;case 4:return ue(),o===null&&tj(c.stateNode.containerInfo),en(c),null;case 10:return ri(c.type),en(c),null;case 19:if(F(Tn),S=c.memoizedState,S===null)return en(c),null;if(g=(c.flags&128)!==0,O=S.rendering,O===null)if(g)df(S,!1);else{if(cn!==0||o!==null&&(o.flags&128)!==0)for(o=c.child;o!==null;){if(O=Ip(o),O!==null){for(c.flags|=128,df(S,!1),o=O.updateQueue,c.updateQueue=o,zp(c,o),c.subtreeFlags=0,o=m,m=c.child;m!==null;)TP(m,o),m=m.sibling;return B(Tn,Tn.current&1|2),c.child}o=o.sibling}S.tail!==null&&Te()>Vp&&(c.flags|=128,g=!0,df(S,!1),c.lanes=4194304)}else{if(!g)if(o=Ip(O),o!==null){if(c.flags|=128,g=!0,o=o.updateQueue,c.updateQueue=o,zp(c,o),df(S,!0),S.tail===null&&S.tailMode==="hidden"&&!O.alternate&&!Nt)return en(c),null}else 2*Te()-S.renderingStartTime>Vp&&m!==536870912&&(c.flags|=128,g=!0,df(S,!1),c.lanes=4194304);S.isBackwards?(O.sibling=c.child,c.child=O):(o=S.last,o!==null?o.sibling=O:c.child=O,S.last=O)}return S.tail!==null?(c=S.tail,S.rendering=c,S.tail=c.sibling,S.renderingStartTime=Te(),c.sibling=null,o=Tn.current,B(Tn,g?o&1|2:o&1),c):(en(c),null);case 22:case 23:return si(c),r0(),g=c.memoizedState!==null,o!==null?o.memoizedState!==null!==g&&(c.flags|=8192):g&&(c.flags|=8192),g?(m&536870912)!==0&&(c.flags&128)===0&&(en(c),c.subtreeFlags&6&&(c.flags|=8192)):en(c),m=c.updateQueue,m!==null&&zp(c,m.retryQueue),m=null,o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(m=o.memoizedState.cachePool.pool),g=null,c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(g=c.memoizedState.cachePool.pool),g!==m&&(c.flags|=2048),o!==null&&F(hl),null;case 24:return m=null,o!==null&&(m=o.memoizedState.cache),c.memoizedState.cache!==m&&(c.flags|=2048),ri(An),en(c),null;case 25:return null;case 30:return null}throw Error(r(156,c.tag))}function TY(o,c){switch(Ub(c),c.tag){case 1:return o=c.flags,o&65536?(c.flags=o&-65537|128,c):null;case 3:return ri(An),ue(),o=c.flags,(o&65536)!==0&&(o&128)===0?(c.flags=o&-65537|128,c):null;case 26:case 27:case 5:return Se(c),null;case 13:if(si(c),o=c.memoizedState,o!==null&&o.dehydrated!==null){if(c.alternate===null)throw Error(r(340));Wd()}return o=c.flags,o&65536?(c.flags=o&-65537|128,c):null;case 19:return F(Tn),null;case 4:return ue(),null;case 10:return ri(c.type),null;case 22:case 23:return si(c),r0(),o!==null&&F(hl),o=c.flags,o&65536?(c.flags=o&-65537|128,c):null;case 24:return ri(An),null;case 25:return null;default:return null}}function e_(o,c){switch(Ub(c),c.tag){case 3:ri(An),ue();break;case 26:case 27:case 5:Se(c);break;case 4:ue();break;case 13:si(c);break;case 19:F(Tn);break;case 10:ri(c.type);break;case 22:case 23:si(c),r0(),o!==null&&F(hl);break;case 24:ri(An)}}function ff(o,c){try{var m=c.updateQueue,g=m!==null?m.lastEffect:null;if(g!==null){var S=g.next;m=S;do{if((m.tag&o)===o){g=void 0;var O=m.create,$=m.inst;g=O(),$.destroy=g}m=m.next}while(m!==S)}}catch(G){zt(c,c.return,G)}}function no(o,c,m){try{var g=c.updateQueue,S=g!==null?g.lastEffect:null;if(S!==null){var O=S.next;g=O;do{if((g.tag&o)===o){var $=g.inst,G=$.destroy;if(G!==void 0){$.destroy=void 0,S=c;var J=m,me=G;try{me()}catch(we){zt(S,J,we)}}}g=g.next}while(g!==O)}}catch(we){zt(c,c.return,we)}}function t_(o){var c=o.updateQueue;if(c!==null){var m=o.stateNode;try{zP(c,m)}catch(g){zt(o,o.return,g)}}}function n_(o,c,m){m.props=xl(o.type,o.memoizedProps),m.state=o.memoizedState;try{m.componentWillUnmount()}catch(g){zt(o,c,g)}}function mf(o,c){try{var m=o.ref;if(m!==null){switch(o.tag){case 26:case 27:case 5:var g=o.stateNode;break;case 30:g=o.stateNode;break;default:g=o.stateNode}typeof m=="function"?o.refCleanup=m(g):m.current=g}}catch(S){zt(o,c,S)}}function ys(o,c){var m=o.ref,g=o.refCleanup;if(m!==null)if(typeof g=="function")try{g()}catch(S){zt(o,c,S)}finally{o.refCleanup=null,o=o.alternate,o!=null&&(o.refCleanup=null)}else if(typeof m=="function")try{m(null)}catch(S){zt(o,c,S)}else m.current=null}function r_(o){var c=o.type,m=o.memoizedProps,g=o.stateNode;try{e:switch(c){case"button":case"input":case"select":case"textarea":m.autoFocus&&g.focus();break e;case"img":m.src?g.src=m.src:m.srcSet&&(g.srcset=m.srcSet)}}catch(S){zt(o,o.return,S)}}function E0(o,c,m){try{var g=o.stateNode;WY(g,o.type,m,c),g[Jt]=c}catch(S){zt(o,o.return,S)}}function a_(o){return o.tag===5||o.tag===3||o.tag===26||o.tag===27&&uo(o.type)||o.tag===4}function _0(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||a_(o.return))return null;o=o.return}for(o.sibling.return=o.return,o=o.sibling;o.tag!==5&&o.tag!==6&&o.tag!==18;){if(o.tag===27&&uo(o.type)||o.flags&2||o.child===null||o.tag===4)continue e;o.child.return=o,o=o.child}if(!(o.flags&2))return o.stateNode}}function M0(o,c,m){var g=o.tag;if(g===5||g===6)o=o.stateNode,c?(m.nodeType===9?m.body:m.nodeName==="HTML"?m.ownerDocument.body:m).insertBefore(o,c):(c=m.nodeType===9?m.body:m.nodeName==="HTML"?m.ownerDocument.body:m,c.appendChild(o),m=m._reactRootContainer,m!=null||c.onclick!==null||(c.onclick=ex));else if(g!==4&&(g===27&&uo(o.type)&&(m=o.stateNode,c=null),o=o.child,o!==null))for(M0(o,c,m),o=o.sibling;o!==null;)M0(o,c,m),o=o.sibling}function Up(o,c,m){var g=o.tag;if(g===5||g===6)o=o.stateNode,c?m.insertBefore(o,c):m.appendChild(o);else if(g!==4&&(g===27&&uo(o.type)&&(m=o.stateNode),o=o.child,o!==null))for(Up(o,c,m),o=o.sibling;o!==null;)Up(o,c,m),o=o.sibling}function s_(o){var c=o.stateNode,m=o.memoizedProps;try{for(var g=o.type,S=c.attributes;S.length;)c.removeAttributeNode(S[0]);Yn(c,g,m),c[kt]=o,c[Jt]=m}catch(O){zt(o,o.return,O)}}var li=!1,mn=!1,R0=!1,i_=typeof WeakSet=="function"?WeakSet:Set,qn=null;function kY(o,c){if(o=o.containerInfo,aj=ox,o=gP(o),_b(o)){if("selectionStart"in o)var m={start:o.selectionStart,end:o.selectionEnd};else e:{m=(m=o.ownerDocument)&&m.defaultView||window;var g=m.getSelection&&m.getSelection();if(g&&g.rangeCount!==0){m=g.anchorNode;var S=g.anchorOffset,O=g.focusNode;g=g.focusOffset;try{m.nodeType,O.nodeType}catch{m=null;break e}var $=0,G=-1,J=-1,me=0,we=0,Ce=o,xe=null;t:for(;;){for(var ge;Ce!==m||S!==0&&Ce.nodeType!==3||(G=$+S),Ce!==O||g!==0&&Ce.nodeType!==3||(J=$+g),Ce.nodeType===3&&($+=Ce.nodeValue.length),(ge=Ce.firstChild)!==null;)xe=Ce,Ce=ge;for(;;){if(Ce===o)break t;if(xe===m&&++me===S&&(G=$),xe===O&&++we===g&&(J=$),(ge=Ce.nextSibling)!==null)break;Ce=xe,xe=Ce.parentNode}Ce=ge}m=G===-1||J===-1?null:{start:G,end:J}}else m=null}m=m||{start:0,end:0}}else m=null;for(sj={focusedElem:o,selectionRange:m},ox=!1,qn=c;qn!==null;)if(c=qn,o=c.child,(c.subtreeFlags&1024)!==0&&o!==null)o.return=c,qn=o;else for(;qn!==null;){switch(c=qn,O=c.alternate,o=c.flags,c.tag){case 0:break;case 11:case 15:break;case 1:if((o&1024)!==0&&O!==null){o=void 0,m=c,S=O.memoizedProps,O=O.memoizedState,g=m.stateNode;try{var rt=xl(m.type,S,m.elementType===m.type);o=g.getSnapshotBeforeUpdate(rt,O),g.__reactInternalSnapshotBeforeUpdate=o}catch(Ze){zt(m,m.return,Ze)}}break;case 3:if((o&1024)!==0){if(o=c.stateNode.containerInfo,m=o.nodeType,m===9)lj(o);else if(m===1)switch(o.nodeName){case"HEAD":case"HTML":case"BODY":lj(o);break;default:o.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((o&1024)!==0)throw Error(r(163))}if(o=c.sibling,o!==null){o.return=c.return,qn=o;break}qn=c.return}}function o_(o,c,m){var g=m.flags;switch(m.tag){case 0:case 11:case 15:ro(o,m),g&4&&ff(5,m);break;case 1:if(ro(o,m),g&4)if(o=m.stateNode,c===null)try{o.componentDidMount()}catch($){zt(m,m.return,$)}else{var S=xl(m.type,c.memoizedProps);c=c.memoizedState;try{o.componentDidUpdate(S,c,o.__reactInternalSnapshotBeforeUpdate)}catch($){zt(m,m.return,$)}}g&64&&t_(m),g&512&&mf(m,m.return);break;case 3:if(ro(o,m),g&64&&(o=m.updateQueue,o!==null)){if(c=null,m.child!==null)switch(m.child.tag){case 27:case 5:c=m.child.stateNode;break;case 1:c=m.child.stateNode}try{zP(o,c)}catch($){zt(m,m.return,$)}}break;case 27:c===null&&g&4&&s_(m);case 26:case 5:ro(o,m),c===null&&g&4&&r_(m),g&512&&mf(m,m.return);break;case 12:ro(o,m);break;case 13:ro(o,m),g&4&&u_(o,m),g&64&&(o=m.memoizedState,o!==null&&(o=o.dehydrated,o!==null&&(m=IY.bind(null,m),tX(o,m))));break;case 22:if(g=m.memoizedState!==null||li,!g){c=c!==null&&c.memoizedState!==null||mn,S=li;var O=mn;li=g,(mn=c)&&!O?ao(o,m,(m.subtreeFlags&8772)!==0):ro(o,m),li=S,mn=O}break;case 30:break;default:ro(o,m)}}function l_(o){var c=o.alternate;c!==null&&(o.alternate=null,l_(c)),o.child=null,o.deletions=null,o.sibling=null,o.tag===5&&(c=o.stateNode,c!==null&&ma(c)),o.stateNode=null,o.return=null,o.dependencies=null,o.memoizedProps=null,o.memoizedState=null,o.pendingProps=null,o.stateNode=null,o.updateQueue=null}var Xt=null,kr=!1;function ci(o,c,m){for(m=m.child;m!==null;)c_(o,c,m),m=m.sibling}function c_(o,c,m){if($n&&typeof $n.onCommitFiberUnmount=="function")try{$n.onCommitFiberUnmount(rr,m)}catch{}switch(m.tag){case 26:mn||ys(m,c),ci(o,c,m),m.memoizedState?m.memoizedState.count--:m.stateNode&&(m=m.stateNode,m.parentNode.removeChild(m));break;case 27:mn||ys(m,c);var g=Xt,S=kr;uo(m.type)&&(Xt=m.stateNode,kr=!1),ci(o,c,m),wf(m.stateNode),Xt=g,kr=S;break;case 5:mn||ys(m,c);case 6:if(g=Xt,S=kr,Xt=null,ci(o,c,m),Xt=g,kr=S,Xt!==null)if(kr)try{(Xt.nodeType===9?Xt.body:Xt.nodeName==="HTML"?Xt.ownerDocument.body:Xt).removeChild(m.stateNode)}catch(O){zt(m,c,O)}else try{Xt.removeChild(m.stateNode)}catch(O){zt(m,c,O)}break;case 18:Xt!==null&&(kr?(o=Xt,Q_(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,m.stateNode),Pf(o)):Q_(Xt,m.stateNode));break;case 4:g=Xt,S=kr,Xt=m.stateNode.containerInfo,kr=!0,ci(o,c,m),Xt=g,kr=S;break;case 0:case 11:case 14:case 15:mn||no(2,m,c),mn||no(4,m,c),ci(o,c,m);break;case 1:mn||(ys(m,c),g=m.stateNode,typeof g.componentWillUnmount=="function"&&n_(m,c,g)),ci(o,c,m);break;case 21:ci(o,c,m);break;case 22:mn=(g=mn)||m.memoizedState!==null,ci(o,c,m),mn=g;break;default:ci(o,c,m)}}function u_(o,c){if(c.memoizedState===null&&(o=c.alternate,o!==null&&(o=o.memoizedState,o!==null&&(o=o.dehydrated,o!==null))))try{Pf(o)}catch(m){zt(c,c.return,m)}}function OY(o){switch(o.tag){case 13:case 19:var c=o.stateNode;return c===null&&(c=o.stateNode=new i_),c;case 22:return o=o.stateNode,c=o._retryCache,c===null&&(c=o._retryCache=new i_),c;default:throw Error(r(435,o.tag))}}function D0(o,c){var m=OY(o);c.forEach(function(g){var S=LY.bind(null,o,g);m.has(g)||(m.add(g),g.then(S,S))})}function Kr(o,c){var m=c.deletions;if(m!==null)for(var g=0;g<m.length;g++){var S=m[g],O=o,$=c,G=$;e:for(;G!==null;){switch(G.tag){case 27:if(uo(G.type)){Xt=G.stateNode,kr=!1;break e}break;case 5:Xt=G.stateNode,kr=!1;break e;case 3:case 4:Xt=G.stateNode.containerInfo,kr=!0;break e}G=G.return}if(Xt===null)throw Error(r(160));c_(O,$,S),Xt=null,kr=!1,O=S.alternate,O!==null&&(O.return=null),S.return=null}if(c.subtreeFlags&13878)for(c=c.child;c!==null;)d_(c,o),c=c.sibling}var za=null;function d_(o,c){var m=o.alternate,g=o.flags;switch(o.tag){case 0:case 11:case 14:case 15:Kr(c,o),Wr(o),g&4&&(no(3,o,o.return),ff(3,o),no(5,o,o.return));break;case 1:Kr(c,o),Wr(o),g&512&&(mn||m===null||ys(m,m.return)),g&64&&li&&(o=o.updateQueue,o!==null&&(g=o.callbacks,g!==null&&(m=o.shared.hiddenCallbacks,o.shared.hiddenCallbacks=m===null?g:m.concat(g))));break;case 26:var S=za;if(Kr(c,o),Wr(o),g&512&&(mn||m===null||ys(m,m.return)),g&4){var O=m!==null?m.memoizedState:null;if(g=o.memoizedState,m===null)if(g===null)if(o.stateNode===null){e:{g=o.type,m=o.memoizedProps,S=S.ownerDocument||S;t:switch(g){case"title":O=S.getElementsByTagName("title")[0],(!O||O[el]||O[kt]||O.namespaceURI==="http://www.w3.org/2000/svg"||O.hasAttribute("itemprop"))&&(O=S.createElement(g),S.head.insertBefore(O,S.querySelector("head > title"))),Yn(O,g,m),O[kt]=o,xn(O),g=O;break e;case"link":var $=sM("link","href",S).get(g+(m.href||""));if($){for(var G=0;G<$.length;G++)if(O=$[G],O.getAttribute("href")===(m.href==null||m.href===""?null:m.href)&&O.getAttribute("rel")===(m.rel==null?null:m.rel)&&O.getAttribute("title")===(m.title==null?null:m.title)&&O.getAttribute("crossorigin")===(m.crossOrigin==null?null:m.crossOrigin)){$.splice(G,1);break t}}O=S.createElement(g),Yn(O,g,m),S.head.appendChild(O);break;case"meta":if($=sM("meta","content",S).get(g+(m.content||""))){for(G=0;G<$.length;G++)if(O=$[G],O.getAttribute("content")===(m.content==null?null:""+m.content)&&O.getAttribute("name")===(m.name==null?null:m.name)&&O.getAttribute("property")===(m.property==null?null:m.property)&&O.getAttribute("http-equiv")===(m.httpEquiv==null?null:m.httpEquiv)&&O.getAttribute("charset")===(m.charSet==null?null:m.charSet)){$.splice(G,1);break t}}O=S.createElement(g),Yn(O,g,m),S.head.appendChild(O);break;default:throw Error(r(468,g))}O[kt]=o,xn(O),g=O}o.stateNode=g}else iM(S,o.type,o.stateNode);else o.stateNode=aM(S,g,o.memoizedProps);else O!==g?(O===null?m.stateNode!==null&&(m=m.stateNode,m.parentNode.removeChild(m)):O.count--,g===null?iM(S,o.type,o.stateNode):aM(S,g,o.memoizedProps)):g===null&&o.stateNode!==null&&E0(o,o.memoizedProps,m.memoizedProps)}break;case 27:Kr(c,o),Wr(o),g&512&&(mn||m===null||ys(m,m.return)),m!==null&&g&4&&E0(o,o.memoizedProps,m.memoizedProps);break;case 5:if(Kr(c,o),Wr(o),g&512&&(mn||m===null||ys(m,m.return)),o.flags&32){S=o.stateNode;try{Zs(S,"")}catch(ge){zt(o,o.return,ge)}}g&4&&o.stateNode!=null&&(S=o.memoizedProps,E0(o,S,m!==null?m.memoizedProps:S)),g&1024&&(R0=!0);break;case 6:if(Kr(c,o),Wr(o),g&4){if(o.stateNode===null)throw Error(r(162));g=o.memoizedProps,m=o.stateNode;try{m.nodeValue=g}catch(ge){zt(o,o.return,ge)}}break;case 3:if(ax=null,S=za,za=nx(c.containerInfo),Kr(c,o),za=S,Wr(o),g&4&&m!==null&&m.memoizedState.isDehydrated)try{Pf(c.containerInfo)}catch(ge){zt(o,o.return,ge)}R0&&(R0=!1,f_(o));break;case 4:g=za,za=nx(o.stateNode.containerInfo),Kr(c,o),Wr(o),za=g;break;case 12:Kr(c,o),Wr(o);break;case 13:Kr(c,o),Wr(o),o.child.flags&8192&&o.memoizedState!==null!=(m!==null&&m.memoizedState!==null)&&(B0=Te()),g&4&&(g=o.updateQueue,g!==null&&(o.updateQueue=null,D0(o,g)));break;case 22:S=o.memoizedState!==null;var J=m!==null&&m.memoizedState!==null,me=li,we=mn;if(li=me||S,mn=we||J,Kr(c,o),mn=we,li=me,Wr(o),g&8192)e:for(c=o.stateNode,c._visibility=S?c._visibility&-2:c._visibility|1,S&&(m===null||J||li||mn||gl(o)),m=null,c=o;;){if(c.tag===5||c.tag===26){if(m===null){J=m=c;try{if(O=J.stateNode,S)$=O.style,typeof $.setProperty=="function"?$.setProperty("display","none","important"):$.display="none";else{G=J.stateNode;var Ce=J.memoizedProps.style,xe=Ce!=null&&Ce.hasOwnProperty("display")?Ce.display:null;G.style.display=xe==null||typeof xe=="boolean"?"":(""+xe).trim()}}catch(ge){zt(J,J.return,ge)}}}else if(c.tag===6){if(m===null){J=c;try{J.stateNode.nodeValue=S?"":J.memoizedProps}catch(ge){zt(J,J.return,ge)}}}else if((c.tag!==22&&c.tag!==23||c.memoizedState===null||c===o)&&c.child!==null){c.child.return=c,c=c.child;continue}if(c===o)break e;for(;c.sibling===null;){if(c.return===null||c.return===o)break e;m===c&&(m=null),c=c.return}m===c&&(m=null),c.sibling.return=c.return,c=c.sibling}g&4&&(g=o.updateQueue,g!==null&&(m=g.retryQueue,m!==null&&(g.retryQueue=null,D0(o,m))));break;case 19:Kr(c,o),Wr(o),g&4&&(g=o.updateQueue,g!==null&&(o.updateQueue=null,D0(o,g)));break;case 30:break;case 21:break;default:Kr(c,o),Wr(o)}}function Wr(o){var c=o.flags;if(c&2){try{for(var m,g=o.return;g!==null;){if(a_(g)){m=g;break}g=g.return}if(m==null)throw Error(r(160));switch(m.tag){case 27:var S=m.stateNode,O=_0(o);Up(o,O,S);break;case 5:var $=m.stateNode;m.flags&32&&(Zs($,""),m.flags&=-33);var G=_0(o);Up(o,G,$);break;case 3:case 4:var J=m.stateNode.containerInfo,me=_0(o);M0(o,me,J);break;default:throw Error(r(161))}}catch(we){zt(o,o.return,we)}o.flags&=-3}c&4096&&(o.flags&=-4097)}function f_(o){if(o.subtreeFlags&1024)for(o=o.child;o!==null;){var c=o;f_(c),c.tag===5&&c.flags&1024&&c.stateNode.reset(),o=o.sibling}}function ro(o,c){if(c.subtreeFlags&8772)for(c=c.child;c!==null;)o_(o,c.alternate,c),c=c.sibling}function gl(o){for(o=o.child;o!==null;){var c=o;switch(c.tag){case 0:case 11:case 14:case 15:no(4,c,c.return),gl(c);break;case 1:ys(c,c.return);var m=c.stateNode;typeof m.componentWillUnmount=="function"&&n_(c,c.return,m),gl(c);break;case 27:wf(c.stateNode);case 26:case 5:ys(c,c.return),gl(c);break;case 22:c.memoizedState===null&&gl(c);break;case 30:gl(c);break;default:gl(c)}o=o.sibling}}function ao(o,c,m){for(m=m&&(c.subtreeFlags&8772)!==0,c=c.child;c!==null;){var g=c.alternate,S=o,O=c,$=O.flags;switch(O.tag){case 0:case 11:case 15:ao(S,O,m),ff(4,O);break;case 1:if(ao(S,O,m),g=O,S=g.stateNode,typeof S.componentDidMount=="function")try{S.componentDidMount()}catch(me){zt(g,g.return,me)}if(g=O,S=g.updateQueue,S!==null){var G=g.stateNode;try{var J=S.shared.hiddenCallbacks;if(J!==null)for(S.shared.hiddenCallbacks=null,S=0;S<J.length;S++)BP(J[S],G)}catch(me){zt(g,g.return,me)}}m&&$&64&&t_(O),mf(O,O.return);break;case 27:s_(O);case 26:case 5:ao(S,O,m),m&&g===null&&$&4&&r_(O),mf(O,O.return);break;case 12:ao(S,O,m);break;case 13:ao(S,O,m),m&&$&4&&u_(S,O);break;case 22:O.memoizedState===null&&ao(S,O,m),mf(O,O.return);break;case 30:break;default:ao(S,O,m)}c=c.sibling}}function $0(o,c){var m=null;o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(m=o.memoizedState.cachePool.pool),o=null,c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(o=c.memoizedState.cachePool.pool),o!==m&&(o!=null&&o.refCount++,m!=null&&Qd(m))}function I0(o,c){o=null,c.alternate!==null&&(o=c.alternate.memoizedState.cache),c=c.memoizedState.cache,c!==o&&(c.refCount++,o!=null&&Qd(o))}function vs(o,c,m,g){if(c.subtreeFlags&10256)for(c=c.child;c!==null;)m_(o,c,m,g),c=c.sibling}function m_(o,c,m,g){var S=c.flags;switch(c.tag){case 0:case 11:case 15:vs(o,c,m,g),S&2048&&ff(9,c);break;case 1:vs(o,c,m,g);break;case 3:vs(o,c,m,g),S&2048&&(o=null,c.alternate!==null&&(o=c.alternate.memoizedState.cache),c=c.memoizedState.cache,c!==o&&(c.refCount++,o!=null&&Qd(o)));break;case 12:if(S&2048){vs(o,c,m,g),o=c.stateNode;try{var O=c.memoizedProps,$=O.id,G=O.onPostCommit;typeof G=="function"&&G($,c.alternate===null?"mount":"update",o.passiveEffectDuration,-0)}catch(J){zt(c,c.return,J)}}else vs(o,c,m,g);break;case 13:vs(o,c,m,g);break;case 23:break;case 22:O=c.stateNode,$=c.alternate,c.memoizedState!==null?O._visibility&2?vs(o,c,m,g):hf(o,c):O._visibility&2?vs(o,c,m,g):(O._visibility|=2,Uc(o,c,m,g,(c.subtreeFlags&10256)!==0)),S&2048&&$0($,c);break;case 24:vs(o,c,m,g),S&2048&&I0(c.alternate,c);break;default:vs(o,c,m,g)}}function Uc(o,c,m,g,S){for(S=S&&(c.subtreeFlags&10256)!==0,c=c.child;c!==null;){var O=o,$=c,G=m,J=g,me=$.flags;switch($.tag){case 0:case 11:case 15:Uc(O,$,G,J,S),ff(8,$);break;case 23:break;case 22:var we=$.stateNode;$.memoizedState!==null?we._visibility&2?Uc(O,$,G,J,S):hf(O,$):(we._visibility|=2,Uc(O,$,G,J,S)),S&&me&2048&&$0($.alternate,$);break;case 24:Uc(O,$,G,J,S),S&&me&2048&&I0($.alternate,$);break;default:Uc(O,$,G,J,S)}c=c.sibling}}function hf(o,c){if(c.subtreeFlags&10256)for(c=c.child;c!==null;){var m=o,g=c,S=g.flags;switch(g.tag){case 22:hf(m,g),S&2048&&$0(g.alternate,g);break;case 24:hf(m,g),S&2048&&I0(g.alternate,g);break;default:hf(m,g)}c=c.sibling}}var pf=8192;function Hc(o){if(o.subtreeFlags&pf)for(o=o.child;o!==null;)h_(o),o=o.sibling}function h_(o){switch(o.tag){case 26:Hc(o),o.flags&pf&&o.memoizedState!==null&&hX(za,o.memoizedState,o.memoizedProps);break;case 5:Hc(o);break;case 3:case 4:var c=za;za=nx(o.stateNode.containerInfo),Hc(o),za=c;break;case 22:o.memoizedState===null&&(c=o.alternate,c!==null&&c.memoizedState!==null?(c=pf,pf=16777216,Hc(o),pf=c):Hc(o));break;default:Hc(o)}}function p_(o){var c=o.alternate;if(c!==null&&(o=c.child,o!==null)){c.child=null;do c=o.sibling,o.sibling=null,o=c;while(o!==null)}}function xf(o){var c=o.deletions;if((o.flags&16)!==0){if(c!==null)for(var m=0;m<c.length;m++){var g=c[m];qn=g,g_(g,o)}p_(o)}if(o.subtreeFlags&10256)for(o=o.child;o!==null;)x_(o),o=o.sibling}function x_(o){switch(o.tag){case 0:case 11:case 15:xf(o),o.flags&2048&&no(9,o,o.return);break;case 3:xf(o);break;case 12:xf(o);break;case 22:var c=o.stateNode;o.memoizedState!==null&&c._visibility&2&&(o.return===null||o.return.tag!==13)?(c._visibility&=-3,Hp(o)):xf(o);break;default:xf(o)}}function Hp(o){var c=o.deletions;if((o.flags&16)!==0){if(c!==null)for(var m=0;m<c.length;m++){var g=c[m];qn=g,g_(g,o)}p_(o)}for(o=o.child;o!==null;){switch(c=o,c.tag){case 0:case 11:case 15:no(8,c,c.return),Hp(c);break;case 22:m=c.stateNode,m._visibility&2&&(m._visibility&=-3,Hp(c));break;default:Hp(c)}o=o.sibling}}function g_(o,c){for(;qn!==null;){var m=qn;switch(m.tag){case 0:case 11:case 15:no(8,m,c);break;case 23:case 22:if(m.memoizedState!==null&&m.memoizedState.cachePool!==null){var g=m.memoizedState.cachePool.pool;g!=null&&g.refCount++}break;case 24:Qd(m.memoizedState.cache)}if(g=m.child,g!==null)g.return=m,qn=g;else e:for(m=o;qn!==null;){g=qn;var S=g.sibling,O=g.return;if(l_(g),g===m){qn=null;break e}if(S!==null){S.return=O,qn=S;break e}qn=O}}}var PY={getCacheForType:function(o){var c=ar(An),m=c.data.get(o);return m===void 0&&(m=o(),c.data.set(o,m)),m}},EY=typeof WeakMap=="function"?WeakMap:Map,Ot=0,Vt=null,mt=null,vt=0,Pt=0,Yr=null,so=!1,Vc=!1,L0=!1,ui=0,cn=0,io=0,yl=0,F0=0,va=0,Gc=0,gf=null,Or=null,q0=!1,B0=0,Vp=1/0,Gp=null,oo=null,Wn=0,lo=null,Kc=null,Wc=0,z0=0,U0=null,y_=null,yf=0,H0=null;function Xr(){if((Ot&2)!==0&&vt!==0)return vt&-vt;if(D.T!==null){var o=Dc;return o!==0?o:Q0()}return fs()}function v_(){va===0&&(va=(vt&536870912)===0||Nt?Us():536870912);var o=ya.current;return o!==null&&(o.flags|=32),va}function Qr(o,c,m){(o===Vt&&(Pt===2||Pt===9)||o.cancelPendingCommit!==null)&&(Yc(o,0),co(o,vt,va,!1)),Hs(o,m),((Ot&2)===0||o!==Vt)&&(o===Vt&&((Ot&2)===0&&(yl|=m),cn===4&&co(o,vt,va,!1)),bs(o))}function b_(o,c,m){if((Ot&6)!==0)throw Error(r(327));var g=!m&&(c&124)===0&&(c&o.expiredLanes)===0||da(o,c),S=g?RY(o,c):K0(o,c,!0),O=g;do{if(S===0){Vc&&!g&&co(o,c,0,!1);break}else{if(m=o.current.alternate,O&&!_Y(m)){S=K0(o,c,!1),O=!1;continue}if(S===2){if(O=c,o.errorRecoveryDisabledLanes&O)var $=0;else $=o.pendingLanes&-536870913,$=$!==0?$:$&536870912?536870912:0;if($!==0){c=$;e:{var G=o;S=gf;var J=G.current.memoizedState.isDehydrated;if(J&&(Yc(G,$).flags|=256),$=K0(G,$,!1),$!==2){if(L0&&!J){G.errorRecoveryDisabledLanes|=O,yl|=O,S=4;break e}O=Or,Or=S,O!==null&&(Or===null?Or=O:Or.push.apply(Or,O))}S=$}if(O=!1,S!==2)continue}}if(S===1){Yc(o,0),co(o,c,0,!0);break}e:{switch(g=o,O=S,O){case 0:case 1:throw Error(r(345));case 4:if((c&4194048)!==c)break;case 6:co(g,c,va,!so);break e;case 2:Or=null;break;case 3:case 5:break;default:throw Error(r(329))}if((c&62914560)===c&&(S=B0+300-Te(),10<S)){if(co(g,c,va,!so),Bs(g,0,!0)!==0)break e;g.timeoutHandle=Y_(j_.bind(null,g,m,Or,Gp,q0,c,va,yl,Gc,so,O,2,-0,0),S);break e}j_(g,m,Or,Gp,q0,c,va,yl,Gc,so,O,0,-0,0)}}break}while(!0);bs(o)}function j_(o,c,m,g,S,O,$,G,J,me,we,Ce,xe,ge){if(o.timeoutHandle=-1,Ce=c.subtreeFlags,(Ce&8192||(Ce&16785408)===16785408)&&(Cf={stylesheets:null,count:0,unsuspend:mX},h_(c),Ce=pX(),Ce!==null)){o.cancelPendingCommit=Ce(k_.bind(null,o,c,O,m,g,S,$,G,J,we,1,xe,ge)),co(o,O,$,!me);return}k_(o,c,O,m,g,S,$,G,J)}function _Y(o){for(var c=o;;){var m=c.tag;if((m===0||m===11||m===15)&&c.flags&16384&&(m=c.updateQueue,m!==null&&(m=m.stores,m!==null)))for(var g=0;g<m.length;g++){var S=m[g],O=S.getSnapshot;S=S.value;try{if(!Vr(O(),S))return!1}catch{return!1}}if(m=c.child,c.subtreeFlags&16384&&m!==null)m.return=c,c=m;else{if(c===o)break;for(;c.sibling===null;){if(c.return===null||c.return===o)return!0;c=c.return}c.sibling.return=c.return,c=c.sibling}}return!0}function co(o,c,m,g){c&=~F0,c&=~yl,o.suspendedLanes|=c,o.pingedLanes&=~c,g&&(o.warmLanes|=c),g=o.expirationTimes;for(var S=c;0<S;){var O=31-In(S),$=1<<O;g[O]=-1,S&=~$}m!==0&&Pe(o,m,c)}function Kp(){return(Ot&6)===0?(vf(0),!1):!0}function V0(){if(mt!==null){if(Pt===0)var o=mt.return;else o=mt,ni=fl=null,l0(o),Bc=null,cf=0,o=mt;for(;o!==null;)e_(o.alternate,o),o=o.return;mt=null}}function Yc(o,c){var m=o.timeoutHandle;m!==-1&&(o.timeoutHandle=-1,XY(m)),m=o.cancelPendingCommit,m!==null&&(o.cancelPendingCommit=null,m()),V0(),Vt=o,mt=m=Js(o.current,null),vt=c,Pt=0,Yr=null,so=!1,Vc=da(o,c),L0=!1,Gc=va=F0=yl=io=cn=0,Or=gf=null,q0=!1,(c&8)!==0&&(c|=c&32);var g=o.entangledLanes;if(g!==0)for(o=o.entanglements,g&=c;0<g;){var S=31-In(g),O=1<<S;c|=o[S],g&=~O}return ui=c,pp(),m}function w_(o,c){lt=null,D.H=Rp,c===Jd||c===Sp?(c=FP(),Pt=3):c===$P?(c=FP(),Pt=4):Pt=c===qE?8:c!==null&&typeof c=="object"&&typeof c.then=="function"?6:1,Yr=c,mt===null&&(cn=1,Fp(o,ha(c,o.current)))}function N_(){var o=D.H;return D.H=Rp,o===null?Rp:o}function S_(){var o=D.A;return D.A=PY,o}function G0(){cn=4,so||(vt&4194048)!==vt&&ya.current!==null||(Vc=!0),(io&134217727)===0&&(yl&134217727)===0||Vt===null||co(Vt,vt,va,!1)}function K0(o,c,m){var g=Ot;Ot|=2;var S=N_(),O=S_();(Vt!==o||vt!==c)&&(Gp=null,Yc(o,c)),c=!1;var $=cn;e:do try{if(Pt!==0&&mt!==null){var G=mt,J=Yr;switch(Pt){case 8:V0(),$=6;break e;case 3:case 2:case 9:case 6:ya.current===null&&(c=!0);var me=Pt;if(Pt=0,Yr=null,Xc(o,G,J,me),m&&Vc){$=0;break e}break;default:me=Pt,Pt=0,Yr=null,Xc(o,G,J,me)}}MY(),$=cn;break}catch(we){w_(o,we)}while(!0);return c&&o.shellSuspendCounter++,ni=fl=null,Ot=g,D.H=S,D.A=O,mt===null&&(Vt=null,vt=0,pp()),$}function MY(){for(;mt!==null;)C_(mt)}function RY(o,c){var m=Ot;Ot|=2;var g=N_(),S=S_();Vt!==o||vt!==c?(Gp=null,Vp=Te()+500,Yc(o,c)):Vc=da(o,c);e:do try{if(Pt!==0&&mt!==null){c=mt;var O=Yr;t:switch(Pt){case 1:Pt=0,Yr=null,Xc(o,c,O,1);break;case 2:case 9:if(IP(O)){Pt=0,Yr=null,A_(c);break}c=function(){Pt!==2&&Pt!==9||Vt!==o||(Pt=7),bs(o)},O.then(c,c);break e;case 3:Pt=7;break e;case 4:Pt=5;break e;case 7:IP(O)?(Pt=0,Yr=null,A_(c)):(Pt=0,Yr=null,Xc(o,c,O,7));break;case 5:var $=null;switch(mt.tag){case 26:$=mt.memoizedState;case 5:case 27:var G=mt;if(!$||oM($)){Pt=0,Yr=null;var J=G.sibling;if(J!==null)mt=J;else{var me=G.return;me!==null?(mt=me,Wp(me)):mt=null}break t}}Pt=0,Yr=null,Xc(o,c,O,5);break;case 6:Pt=0,Yr=null,Xc(o,c,O,6);break;case 8:V0(),cn=6;break e;default:throw Error(r(462))}}DY();break}catch(we){w_(o,we)}while(!0);return ni=fl=null,D.H=g,D.A=S,Ot=m,mt!==null?0:(Vt=null,vt=0,pp(),cn)}function DY(){for(;mt!==null&&!_e();)C_(mt)}function C_(o){var c=ZE(o.alternate,o,ui);o.memoizedProps=o.pendingProps,c===null?Wp(o):mt=c}function A_(o){var c=o,m=c.alternate;switch(c.tag){case 15:case 0:c=GE(m,c,c.pendingProps,c.type,void 0,vt);break;case 11:c=GE(m,c,c.pendingProps,c.type.render,c.ref,vt);break;case 5:l0(c);default:e_(m,c),c=mt=TP(c,ui),c=ZE(m,c,ui)}o.memoizedProps=o.pendingProps,c===null?Wp(o):mt=c}function Xc(o,c,m,g){ni=fl=null,l0(c),Bc=null,cf=0;var S=c.return;try{if(SY(o,S,c,m,vt)){cn=1,Fp(o,ha(m,o.current)),mt=null;return}}catch(O){if(S!==null)throw mt=S,O;cn=1,Fp(o,ha(m,o.current)),mt=null;return}c.flags&32768?(Nt||g===1?o=!0:Vc||(vt&536870912)!==0?o=!1:(so=o=!0,(g===2||g===9||g===3||g===6)&&(g=ya.current,g!==null&&g.tag===13&&(g.flags|=16384))),T_(c,o)):Wp(c)}function Wp(o){var c=o;do{if((c.flags&32768)!==0){T_(c,so);return}o=c.return;var m=AY(c.alternate,c,ui);if(m!==null){mt=m;return}if(c=c.sibling,c!==null){mt=c;return}mt=c=o}while(c!==null);cn===0&&(cn=5)}function T_(o,c){do{var m=TY(o.alternate,o);if(m!==null){m.flags&=32767,mt=m;return}if(m=o.return,m!==null&&(m.flags|=32768,m.subtreeFlags=0,m.deletions=null),!c&&(o=o.sibling,o!==null)){mt=o;return}mt=o=m}while(o!==null);cn=6,mt=null}function k_(o,c,m,g,S,O,$,G,J){o.cancelPendingCommit=null;do Yp();while(Wn!==0);if((Ot&6)!==0)throw Error(r(327));if(c!==null){if(c===o.current)throw Error(r(177));if(O=c.lanes|c.childLanes,O|=Ib,pe(o,m,O,$,G,J),o===Vt&&(mt=Vt=null,vt=0),Kc=c,lo=o,Wc=m,z0=O,U0=S,y_=g,(c.subtreeFlags&10256)!==0||(c.flags&10256)!==0?(o.callbackNode=null,o.callbackPriority=0,FY(xt,function(){return M_(),null})):(o.callbackNode=null,o.callbackPriority=0),g=(c.flags&13878)!==0,(c.subtreeFlags&13878)!==0||g){g=D.T,D.T=null,S=q.p,q.p=2,$=Ot,Ot|=4;try{kY(o,c,m)}finally{Ot=$,q.p=S,D.T=g}}Wn=1,O_(),P_(),E_()}}function O_(){if(Wn===1){Wn=0;var o=lo,c=Kc,m=(c.flags&13878)!==0;if((c.subtreeFlags&13878)!==0||m){m=D.T,D.T=null;var g=q.p;q.p=2;var S=Ot;Ot|=4;try{d_(c,o);var O=sj,$=gP(o.containerInfo),G=O.focusedElem,J=O.selectionRange;if($!==G&&G&&G.ownerDocument&&xP(G.ownerDocument.documentElement,G)){if(J!==null&&_b(G)){var me=J.start,we=J.end;if(we===void 0&&(we=me),"selectionStart"in G)G.selectionStart=me,G.selectionEnd=Math.min(we,G.value.length);else{var Ce=G.ownerDocument||document,xe=Ce&&Ce.defaultView||window;if(xe.getSelection){var ge=xe.getSelection(),rt=G.textContent.length,Ze=Math.min(J.start,rt),It=J.end===void 0?Ze:Math.min(J.end,rt);!ge.extend&&Ze>It&&($=It,It=Ze,Ze=$);var le=pP(G,Ze),ae=pP(G,It);if(le&&ae&&(ge.rangeCount!==1||ge.anchorNode!==le.node||ge.anchorOffset!==le.offset||ge.focusNode!==ae.node||ge.focusOffset!==ae.offset)){var fe=Ce.createRange();fe.setStart(le.node,le.offset),ge.removeAllRanges(),Ze>It?(ge.addRange(fe),ge.extend(ae.node,ae.offset)):(fe.setEnd(ae.node,ae.offset),ge.addRange(fe))}}}}for(Ce=[],ge=G;ge=ge.parentNode;)ge.nodeType===1&&Ce.push({element:ge,left:ge.scrollLeft,top:ge.scrollTop});for(typeof G.focus=="function"&&G.focus(),G=0;G<Ce.length;G++){var Ne=Ce[G];Ne.element.scrollLeft=Ne.left,Ne.element.scrollTop=Ne.top}}ox=!!aj,sj=aj=null}finally{Ot=S,q.p=g,D.T=m}}o.current=c,Wn=2}}function P_(){if(Wn===2){Wn=0;var o=lo,c=Kc,m=(c.flags&8772)!==0;if((c.subtreeFlags&8772)!==0||m){m=D.T,D.T=null;var g=q.p;q.p=2;var S=Ot;Ot|=4;try{o_(o,c.alternate,c)}finally{Ot=S,q.p=g,D.T=m}}Wn=3}}function E_(){if(Wn===4||Wn===3){Wn=0,Oe();var o=lo,c=Kc,m=Wc,g=y_;(c.subtreeFlags&10256)!==0||(c.flags&10256)!==0?Wn=5:(Wn=0,Kc=lo=null,__(o,o.pendingLanes));var S=o.pendingLanes;if(S===0&&(oo=null),Rt(m),c=c.stateNode,$n&&typeof $n.onCommitFiberRoot=="function")try{$n.onCommitFiberRoot(rr,c,void 0,(c.current.flags&128)===128)}catch{}if(g!==null){c=D.T,S=q.p,q.p=2,D.T=null;try{for(var O=o.onRecoverableError,$=0;$<g.length;$++){var G=g[$];O(G.value,{componentStack:G.stack})}}finally{D.T=c,q.p=S}}(Wc&3)!==0&&Yp(),bs(o),S=o.pendingLanes,(m&4194090)!==0&&(S&42)!==0?o===H0?yf++:(yf=0,H0=o):yf=0,vf(0)}}function __(o,c){(o.pooledCacheLanes&=c)===0&&(c=o.pooledCache,c!=null&&(o.pooledCache=null,Qd(c)))}function Yp(o){return O_(),P_(),E_(),M_()}function M_(){if(Wn!==5)return!1;var o=lo,c=z0;z0=0;var m=Rt(Wc),g=D.T,S=q.p;try{q.p=32>m?32:m,D.T=null,m=U0,U0=null;var O=lo,$=Wc;if(Wn=0,Kc=lo=null,Wc=0,(Ot&6)!==0)throw Error(r(331));var G=Ot;if(Ot|=4,x_(O.current),m_(O,O.current,$,m),Ot=G,vf(0,!1),$n&&typeof $n.onPostCommitFiberRoot=="function")try{$n.onPostCommitFiberRoot(rr,O)}catch{}return!0}finally{q.p=S,D.T=g,__(o,c)}}function R_(o,c,m){c=ha(m,c),c=w0(o.stateNode,c,2),o=Zi(o,c,2),o!==null&&(Hs(o,2),bs(o))}function zt(o,c,m){if(o.tag===3)R_(o,o,m);else for(;c!==null;){if(c.tag===3){R_(c,o,m);break}else if(c.tag===1){var g=c.stateNode;if(typeof c.type.getDerivedStateFromError=="function"||typeof g.componentDidCatch=="function"&&(oo===null||!oo.has(g))){o=ha(m,o),m=LE(2),g=Zi(c,m,2),g!==null&&(FE(m,g,c,o),Hs(g,2),bs(g));break}}c=c.return}}function W0(o,c,m){var g=o.pingCache;if(g===null){g=o.pingCache=new EY;var S=new Set;g.set(c,S)}else S=g.get(c),S===void 0&&(S=new Set,g.set(c,S));S.has(m)||(L0=!0,S.add(m),o=$Y.bind(null,o,c,m),c.then(o,o))}function $Y(o,c,m){var g=o.pingCache;g!==null&&g.delete(c),o.pingedLanes|=o.suspendedLanes&m,o.warmLanes&=~m,Vt===o&&(vt&m)===m&&(cn===4||cn===3&&(vt&62914560)===vt&&300>Te()-B0?(Ot&2)===0&&Yc(o,0):F0|=m,Gc===vt&&(Gc=0)),bs(o)}function D_(o,c){c===0&&(c=Jo()),o=Ec(o,c),o!==null&&(Hs(o,c),bs(o))}function IY(o){var c=o.memoizedState,m=0;c!==null&&(m=c.retryLane),D_(o,m)}function LY(o,c){var m=0;switch(o.tag){case 13:var g=o.stateNode,S=o.memoizedState;S!==null&&(m=S.retryLane);break;case 19:g=o.stateNode;break;case 22:g=o.stateNode._retryCache;break;default:throw Error(r(314))}g!==null&&g.delete(c),D_(o,m)}function FY(o,c){return ce(o,c)}var Xp=null,Qc=null,Y0=!1,Qp=!1,X0=!1,vl=0;function bs(o){o!==Qc&&o.next===null&&(Qc===null?Xp=Qc=o:Qc=Qc.next=o),Qp=!0,Y0||(Y0=!0,BY())}function vf(o,c){if(!X0&&Qp){X0=!0;do for(var m=!1,g=Xp;g!==null;){if(o!==0){var S=g.pendingLanes;if(S===0)var O=0;else{var $=g.suspendedLanes,G=g.pingedLanes;O=(1<<31-In(42|o)+1)-1,O&=S&~($&~G),O=O&201326741?O&201326741|1:O?O|2:0}O!==0&&(m=!0,F_(g,O))}else O=vt,O=Bs(g,g===Vt?O:0,g.cancelPendingCommit!==null||g.timeoutHandle!==-1),(O&3)===0||da(g,O)||(m=!0,F_(g,O));g=g.next}while(m);X0=!1}}function qY(){$_()}function $_(){Qp=Y0=!1;var o=0;vl!==0&&(YY()&&(o=vl),vl=0);for(var c=Te(),m=null,g=Xp;g!==null;){var S=g.next,O=I_(g,c);O===0?(g.next=null,m===null?Xp=S:m.next=S,S===null&&(Qc=m)):(m=g,(o!==0||(O&3)!==0)&&(Qp=!0)),g=S}vf(o)}function I_(o,c){for(var m=o.suspendedLanes,g=o.pingedLanes,S=o.expirationTimes,O=o.pendingLanes&-62914561;0<O;){var $=31-In(O),G=1<<$,J=S[$];J===-1?((G&m)===0||(G&g)!==0)&&(S[$]=zs(G,c)):J<=c&&(o.expiredLanes|=G),O&=~G}if(c=Vt,m=vt,m=Bs(o,o===c?m:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),g=o.callbackNode,m===0||o===c&&(Pt===2||Pt===9)||o.cancelPendingCommit!==null)return g!==null&&g!==null&&te(g),o.callbackNode=null,o.callbackPriority=0;if((m&3)===0||da(o,m)){if(c=m&-m,c===o.callbackPriority)return c;switch(g!==null&&te(g),Rt(m)){case 2:case 8:m=at;break;case 32:m=xt;break;case 268435456:m=Mt;break;default:m=xt}return g=L_.bind(null,o),m=ce(m,g),o.callbackPriority=c,o.callbackNode=m,c}return g!==null&&g!==null&&te(g),o.callbackPriority=2,o.callbackNode=null,2}function L_(o,c){if(Wn!==0&&Wn!==5)return o.callbackNode=null,o.callbackPriority=0,null;var m=o.callbackNode;if(Yp()&&o.callbackNode!==m)return null;var g=vt;return g=Bs(o,o===Vt?g:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),g===0?null:(b_(o,g,c),I_(o,Te()),o.callbackNode!=null&&o.callbackNode===m?L_.bind(null,o):null)}function F_(o,c){if(Yp())return null;b_(o,c,!0)}function BY(){QY(function(){(Ot&6)!==0?ce(ze,qY):$_()})}function Q0(){return vl===0&&(vl=Us()),vl}function q_(o){return o==null||typeof o=="symbol"||typeof o=="boolean"?null:typeof o=="function"?o:Ac(""+o)}function B_(o,c){var m=c.ownerDocument.createElement("input");return m.name=c.name,m.value=c.value,o.id&&m.setAttribute("form",o.id),c.parentNode.insertBefore(m,c),o=new FormData(o),m.parentNode.removeChild(m),o}function zY(o,c,m,g,S){if(c==="submit"&&m&&m.stateNode===S){var O=q_((S[Jt]||null).action),$=g.submitter;$&&(c=(c=$[Jt]||null)?q_(c.formAction):$.getAttribute("formAction"),c!==null&&(O=c,$=null));var G=new Hr("action","action",null,g,S);o.push({event:G,listeners:[{instance:null,listener:function(){if(g.defaultPrevented){if(vl!==0){var J=$?B_(S,$):new FormData(S);g0(m,{pending:!0,data:J,method:S.method,action:O},null,J)}}else typeof O=="function"&&(G.preventDefault(),J=$?B_(S,$):new FormData(S),g0(m,{pending:!0,data:J,method:S.method,action:O},O,J))},currentTarget:S}]})}}for(var Z0=0;Z0<$b.length;Z0++){var J0=$b[Z0],UY=J0.toLowerCase(),HY=J0[0].toUpperCase()+J0.slice(1);Ba(UY,"on"+HY)}Ba(bP,"onAnimationEnd"),Ba(jP,"onAnimationIteration"),Ba(wP,"onAnimationStart"),Ba("dblclick","onDoubleClick"),Ba("focusin","onFocus"),Ba("focusout","onBlur"),Ba(oY,"onTransitionRun"),Ba(lY,"onTransitionStart"),Ba(cY,"onTransitionCancel"),Ba(NP,"onTransitionEnd"),Cn("onMouseEnter",["mouseout","mouseover"]),Cn("onMouseLeave",["mouseout","mouseover"]),Cn("onPointerEnter",["pointerout","pointerover"]),Cn("onPointerLeave",["pointerout","pointerover"]),ps("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ps("onSelect","focusout contextmenu dragend focu
8sin keydown keyup mousedown mouseup selectionchange".split(" ")),ps("onBeforeInput",["compositionend","keypress","textInput","paste"]),ps("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ps("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ps("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var bf="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),VY=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(bf));function z_(o,c){c=(c&4)!==0;for(var m=0;m<o.length;m++){var g=o[m],S=g.event;g=g.listeners;e:{var O=void 0;if(c)for(var $=g.length-1;0<=$;$--){var G=g[$],J=G.instance,me=G.currentTarget;if(G=G.listener,J!==O&&S.isPropagationStopped())break e;O=G,S.currentTarget=me;try{O(S)}catch(we){Lp(we)}S.currentTarget=null,O=J}else for($=0;$<g.length;$++){if(G=g[$],J=G.instance,me=G.currentTarget,G=G.listener,J!==O&&S.isPropagationStopped())break e;O=G,S.currentTarget=me;try{O(S)}catch(we){Lp(we)}S.currentTarget=null,O=J}}}}function ht(o,c){var m=c[xc];m===void 0&&(m=c[xc]=new Set);var g=o+"__bubble";m.has(g)||(U_(c,o,2,!1),m.add(g))}function ej(o,c,m){var g=0;c&&(g|=4),U_(m,o,g,c)}var Zp="_reactListening"+Math.random().toString(36).slice(2);function tj(o){if(!o[Zp]){o[Zp]=!0,hs.forEach(function(m){m!=="selectionchange"&&(VY.has(m)||ej(m,!1,o),ej(m,!0,o))});var c=o.nodeType===9?o:o.ownerDocument;c===null||c[Zp]||(c[Zp]=!0,ej("selectionchange",!1,c))}}function U_(o,c,m,g){switch(mM(c)){case 2:var S=yX;break;case 8:S=vX;break;default:S=pj}m=S.bind(null,c,m,o),S=void 0,!al||c!=="touchstart"&&c!=="touchmove"&&c!=="wheel"||(S=!0),g?S!==void 0?o.addEventListener(c,m,{capture:!0,passive:S}):o.addEventListener(c,m,!0):S!==void 0?o.addEventListener(c,m,{passive:S}):o.addEventListener(c,m,!1)}function nj(o,c,m,g,S){var O=g;if((c&1)===0&&(c&2)===0&&g!==null)e:for(;;){if(g===null)return;var $=g.tag;if($===3||$===4){var G=g.stateNode.containerInfo;if(G===S)break;if($===4)for($=g.return;$!==null;){var J=$.tag;if((J===3||J===4)&&$.stateNode.containerInfo===S)return;$=$.return}for(;G!==null;){if($=Vs(G),$===null)return;if(J=$.tag,J===5||J===6||J===26||J===27){g=O=$;continue e}G=G.parentNode}}g=g.return}Vi(function(){var me=O,we=Ld(m),Ce=[];e:{var xe=SP.get(o);if(xe!==void 0){var ge=Hr,rt=o;switch(o){case"keypress":if(oe(m)===0)break e;case"keydown":case"keyup":ge=FW;break;case"focusin":rt="focus",ge=Tb;break;case"focusout":rt="blur",ge=Tb;break;case"beforeblur":case"afterblur":ge=Tb;break;case"click":if(m.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ge=JO;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ge=TW;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ge=zW;break;case bP:case jP:case wP:ge=PW;break;case NP:ge=HW;break;case"scroll":case"scrollend":ge=Cb;break;case"wheel":ge=GW;break;case"copy":case"cut":case"paste":ge=_W;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ge=tP;break;case"toggle":case"beforetoggle":ge=WW}var Ze=(c&4)!==0,It=!Ze&&(o==="scroll"||o==="scrollend"),le=Ze?xe!==null?xe+"Capture":null:xe;Ze=[];for(var ae=me,fe;ae!==null;){var Ne=ae;if(fe=Ne.stateNode,Ne=Ne.tag,Ne!==5&&Ne!==26&&Ne!==27||fe===null||le===null||(Ne=Gi(ae,le),Ne!=null&&Ze.push(jf(ae,Ne,fe))),It)break;ae=ae.return}0<Ze.length&&(xe=new ge(xe,rt,null,m,we),Ce.push({event:xe,listeners:Ze}))}}if((c&7)===0){e:{if(xe=o==="mouseover"||o==="pointerover",ge=o==="mouseout"||o==="pointerout",xe&&m!==Ln&&(rt=m.relatedTarget||m.fromElement)&&(Vs(rt)||rt[Sn]))break e;if((ge||xe)&&(xe=we.window===we?we:(xe=we.ownerDocument)?xe.defaultView||xe.parentWindow:window,ge?(rt=m.relatedTarget||m.toElement,ge=me,rt=rt?Vs(rt):null,rt!==null&&(It=i(rt),Ze=rt.tag,rt!==It||Ze!==5&&Ze!==27&&Ze!==6)&&(rt=null)):(ge=null,rt=me),ge!==rt)){if(Ze=JO,Ne="onMouseLeave",le="onMouseEnter",ae="mouse",(o==="pointerout"||o==="pointerover")&&(Ze=tP,Ne="onPointerLeave",le="onPointerEnter",ae="pointer"),It=ge==null?xe:Gs(ge),fe=rt==null?xe:Gs(rt),xe=new Ze(Ne,ae+"leave",ge,m,we),xe.target=It,xe.relatedTarget=fe,Ne=null,Vs(we)===me&&(Ze=new Ze(le,ae+"enter",rt,m,we),Ze.target=fe,Ze.relatedTarget=It,Ne=Ze),It=Ne,ge&&rt)t:{for(Ze=ge,le=rt,ae=0,fe=Ze;fe;fe=Zc(fe))ae++;for(fe=0,Ne=le;Ne;Ne=Zc(Ne))fe++;for(;0<ae-fe;)Ze=Zc(Ze),ae--;for(;0<fe-ae;)le=Zc(le),fe--;for(;ae--;){if(Ze===le||le!==null&&Ze===le.alternate)break t;Ze=Zc(Ze),le=Zc(le)}Ze=null}else Ze=null;ge!==null&&H_(Ce,xe,ge,Ze,!1),rt!==null&&It!==null&&H_(Ce,It,rt,Ze,!0)}}
vendor: 5,259 bytes, lines 8-9
8e:{if(xe=me?Gs(me):window,ge=xe.nodeName&&xe.nodeName.toLowerCase(),ge==="select"||ge==="input"&&xe.type==="file")var Ue=cP;else if(oP(xe))if(uP)Ue=aY;else{Ue=nY;var ft=tY}else ge=xe.nodeName,!ge||ge.toLowerCase()!=="input"||xe.type!=="checkbox"&&xe.type!=="radio"?me&&Cc(me.elementType)&&(Ue=cP):Ue=rY;if(Ue&&(Ue=Ue(o,me))){lP(Ce,Ue,m,we);break e}ft&&ft(o,xe,me),o==="focusout"&&me&&xe.type==="number"&&me.memoizedProps.value!=null&&Dd(xe,"number",xe.value)}switch(ft=me?Gs(me):window,o){case"focusin":(oP(ft)||ft.contentEditable==="true")&&(kc=ft,Mb=me,Gd=null);break;case"focusout":Gd=Mb=kc=null;break;case"mousedown":Rb=!0;break;case"contextmenu":case"mouseup":case"dragend":Rb=!1,yP(Ce,m,we);break;case"selectionchange":if(iY)break;case"keydown":case"keyup":yP(Ce,m,we)}var Ke;if(Ob)e:{switch(o){case"compositionstart":var Je="onCompositionStart";break e;case"compositionend":Je="onCompositionEnd";break e;case"compositionupdate":Je="onCompositionUpdate";break e}Je=void 0}else Tc?sP(o,m)&&(Je="onCompositionEnd"):o==="keydown"&&m.keyCode===229&&(Je="onCompositionStart");Je&&(nP&&m.locale!=="ko"&&(Tc||Je!=="onCompositionStart"?Je==="onCompositionEnd"&&Tc&&(Ke=re()):(Ur=we,Wi="value"in Ur?Ur.value:Ur.textContent,Tc=!0)),ft=Jp(me,Je),0<ft.length&&(Je=new eP(Je,o,null,m,we),Ce.push({event:Je,listeners:ft}),Ke?Je.data=Ke:(Ke=iP(m),Ke!==null&&(Je.data=Ke)))),(Ke=XW?QW(o,m):ZW(o,m))&&(Je=Jp(me,"onBeforeInput"),0<Je.length&&(ft=new eP("onBeforeInput","beforeinput",null,m,we),Ce.push({event:ft,listeners:Je}),ft.data=Ke)),zY(Ce,o,me,m,we)}z_(Ce,c)})}function jf(o,c,m){return{instance:o,listener:c,currentTarget:m}}function Jp(o,c){for(var m=c+"Capture",g=[];o!==null;){var S=o,O=S.stateNode;if(S=S.tag,S!==5&&S!==26&&S!==27||O===null||(S=Gi(o,m),S!=null&&g.unshift(jf(o,S,O)),S=Gi(o,c),S!=null&&g.push(jf(o,S,O))),o.tag===3)return g;o=o.return}return[]}function Zc(o){if(o===null)return null;do o=o.return;while(o&&o.tag!==5&&o.tag!==27);return o||null}function H_(o,c,m,g,S){for(var O=c._reactName,$=[];m!==null&&m!==g;){var G=m,J=G.alternate,me=G.stateNode;if(G=G.tag,J!==null&&J===g)break;G!==5&&G!==26&&G!==27||me===null||(J=me,S?(me=Gi(m,O),me!=null&&$.unshift(jf(m,me,J))):S||(me=Gi(m,O),me!=null&&$.push(jf(m,me,J)))),m=m.return}$.length!==0&&o.push({event:c,listeners:$})}var GY=/\r\n?/g,KY=/\u0000|\uFFFD/g;function V_(o){return(typeof o=="string"?o:""+o).replace(GY,`
9`).replace(KY,"")}function G_(o,c){return c=V_(c),V_(o)===c}function ex(){}function $t(o,c,m,g,S,O){switch(m){case"children":typeof g=="string"?c==="body"||c==="textarea"&&g===""||Zs(o,g):(typeof g=="number"||typeof g=="bigint")&&c!=="body"&&Zs(o,""+g);break;case"className":Ws(o,"class",g);break;case"tabIndex":Ws(o,"tabindex",g);break;case"dir":case"role":case"viewBox":case"width":case"height":Ws(o,m,g);break;case"style":Id(o,g,O);break;case"data":if(c!=="object"){Ws(o,"data",g);break}case"src":case"href":if(g===""&&(c!=="a"||m!=="href")){o.removeAttribute(m);break}if(g==null||typeof g=="function"||typeof g=="symbol"||typeof g=="boolean"){o.removeAttribute(m);break}g=Ac(""+g),o.setAttribute(m,g);break;case"action":case"formAction":if(typeof g=="function"){o.setAttribute(m,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof O=="function"&&(m==="formAction"?(c!=="input"&&$t(o,c,"name",S.name,S,null),$t(o,c,"formEncType",S.formEncType,S,null),$t(o,c,"formMethod",S.formMethod,S,null),$t(o,c,"formTarget",S.formTarget,S,null)):($t(o,c,"encType",S.encType,S,null),$t(o,c,"method",S.method,S,null),$t(o,c,"target",S.target,S,null)));if(g==null||typeof g=="symbol"||typeof g=="boolean"){o.removeAttribute(m);break}g=Ac(""+g),o.setAttribute(m,g);break;case"onClick":g!=null&&(o.onclick=ex);break;case"onScroll":g!=null&&ht("scroll",o);break;case"onScrollEnd":g!=null&&ht("scrollend",o);break;case"dangerouslySetInnerHTML":if(g!=null){if(typeof g!="object"||!("__html"in g))throw Error(r(61));if(m=g.__html,m!=null){if(S.children!=null)throw Error(r(60));o.innerHTML=m}}break;case"multiple":o.multiple=g&&typeof g!="function"&&typeof g!="symbol";break;case"muted":o.muted=g&&typeof g!="function"&&typeof g!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(g==null||typeof g=="function"||typeof g=="boolean"||typeof g=="symbol"){o.removeAttribute("xlink:href");break}m=Ac(""+g),o.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",m);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":g!=null&&typeof g!="function"&&typeof g!="symbol"?o.setAttribute(m,""+g):o.removeAttribute(m);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInl
9ine":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":g&&typeof g!="function"&&typeof g!="symbol"?o.setAttribute(m,""):o.removeAttribute(m);break;case"capture":case"download":g===!0?o.setAttribute(m,""):g!==!1&&g!=null&&typeof g!="function"&&typeof g!="symbol"?o.setAttribute(m,g):o.removeAttribute(m);break;case"cols":case"rows":case"size":case"span":g!=null&&typeof g!="function"&&typeof g!="symbol"&&!isNaN(g)&&1<=g?o.setAttribute(m,g):o.removeAttribute(m);break;case"rowSpan":case"start":g==null||typeof g=="function"||typeof g=="symbol"||isNaN(g)?o.removeAttribute(m):o.setAttribute(m,g);break;case"popover":ht("beforetoggle",o),ht("toggle",o),Ks(o,"popover",g);break;case"xlinkActuate":zr(o,"http://www.w3.org/1999/xlink","xlink:actuate",g);break;case"xlinkArcrole":zr(o,"http://www.w3.org/1999/xlink","xlink:arcrole",g);break;case"xlinkRole":zr(o,"http://www.w3.org/1999/xlink","xlink:role",g);break;case"xlinkShow":zr(o,"http://www.w3.org/1999/xlink","xlink:show",g);break;case"xlinkTitle":zr(o,"http://www.w3.org/1999/xlink","xlink:title",g);break;case"xlinkType":zr(o,"http://www.w3.org/1999/xlink","xlink:type",g);break;case"xmlBase":zr(o,"http://www.w3.org/XML/1998/namespace","xml:base",g);break;case"xmlLang":zr(o,"http://www.w3.org/XML/1998/namespace","xml:lang",g);break;case"xmlSpace":zr(o,"http://www.w3.org/XML/1998/namespace","xml:space",g);break;case"is":Ks(o,"is",g);break;case"innerText":case"textContent":break;default:(!(2<m.length)||m[0]!=="o"&&m[0]!=="O"||m[1]!=="n"&&m[1]!=="N")&&(m=Nb.get(m)||m,Ks(o,m,g))}}function rj(o,c,m,g,S,O){switch(m){case"style":Id(o,g,O);break;case"dangerouslySetInnerHTML":if(g!=null){if(typeof g!="object"||!("__html"in g))throw Error(r(61));if(m=g.__html,m!=null){if(S.children!=null)throw Error(r(60));o.innerHTML=m}}break;case"children":typeof g=="string"?Zs(o,g):(typeof g=="number"||typeof g=="bigint")&&Zs(o,""+g);break;case"onScroll":g!=null&&ht("scroll",o);break;case"onScrollEnd":g!=null&&ht("scrollend",o);break;case"onClick":g!=null&&(o.onclick=ex);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!zi.hasOwnProperty(m))e:{if(m[0]==="o"&&m[1]==="n"&&(S=m.endsWith("Capture"),c=m.slice(2,S?m.length-7:void 0),O=o[Jt]||null,O=O!=null?O[m]:null,typeof O=="function"&&o.removeEventListener(c,O,S),typeof g=="function")){typeof O!="function"&&O!==null&&(m in o?o[m]=null:o.hasAttribute(m)&&o.removeAttribute(m)),o.addEventListener(c,g,S);break e}m in o?o[m]=g:g===!0?o.setAttribute(m,""):Ks(o,m,g)}}}function Yn(o,c,m){switch(c){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":ht("error",o),ht("load",o);var g=!1,S=!1,O;for(O in m)if(m.hasOwnProperty(O)){var $=m[O];if($!=null)switch(O){case"src":g=!0;break;case"srcSet":S=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,c));default:$t(o,c,O,$,m,null)}}S&&$t(o,c,"srcSet",m.srcSet,m,null),g&&$t(o,c,"src",m.src,m,null);return;case"input":ht("invalid",o);var G=O=$=S=null,J=null,me=null;for(g in m)if(m.hasOwnProperty(g)){var we=m[g];if(we!=null)switch(g){case"name":S=we;break;case"type":$=we;break;case"checked":J=we;break;case"defaultChecked":me=we;break;case"value":O=we;break;case"defaultValue":G=we;break;case"children":case"dangerouslySetInnerHTML":if(we!=null)throw Error(r(137,c));break;default:$t(o,c,g,we,m,null)}}Fa(o,O,G,J,me,$,S,!1),Ui(o);return;case"select":ht("invalid",o),g=$=O=null;for(S in m)if(m.hasOwnProperty(S)&&(G=m[S],G!=null))switch(S){case"value":O=G;break;case"defaultValue":$=G;break;case"multiple":g=G;default:$t(o,c,S,G,m,null)}c=O,m=$,o.multiple=!!g,c!=null?Qs(o,!!g,c,!1):m!=null&&Qs(o,!!g,m,!0);return;case"textarea":ht("invalid",o),O=S=g=null;for($ in m)if(m.hasOwnProperty($)&&(G=m[$],G!=null))switch($){case"value":g=G;break;case"defaultValue":S=G;break;case"children":O=G;break;case"dangerouslySetInnerHTML":if(G!=null)throw Error(r(91));break;default:$t(o,c,$,G,m,null)}up(o,g,S,O),Ui(o);return;case"option":for(J in m)m.hasOwnProperty(J)&&(g=m[J],g!=null)&&(J==="selected"?o.selected=g&&typeof g!="function"&&typeof g!="symbol":$t(o,c,J,g,m,null));return;case"dialog":ht("beforetoggle",o),ht("toggle",o),ht("cancel",o),ht("close",o);break;case"iframe":case"object":ht("load",o);break;case"video":case"audio":for(g=0;g<bf.length;g++)ht(bf[g],o);break;case"image":ht("error",o),ht("load",o);break;case"details":ht("toggle",o);break;case"embed":case"source":case"link":ht("error",o),ht("load",o);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(me in m)if(m.hasOwnProperty(me)&&(g=m[me],g!=null))switch(me){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,c));default:$t(o,c,me,g,m,null)}return;default:if(Cc(c)){for(we in m)m.hasOwnProperty(we)&&(g=m[we],g!==void 0&&rj(o,c,we,g,m,void 0));return}}for(G in m)m.hasOwnProperty(G)&&(g=m[G],g!=null&&$t(o,c,G,g,m,null))}function WY(o,c,m,g){switch(c){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var S=null,O=null,$=null,G=null,J=null,me=null,we=null;for(ge in m){var Ce=m[ge];if(m.hasOwnProperty(ge)&&Ce!=null)switch(ge){case"checked":break;case"value":break;case"defaultValue":J=Ce;default:g.hasOwnProperty(ge)||$t(o,c,ge,null,g,Ce)}}for(var xe in g){var ge=g[xe];if(Ce=m[xe],g.hasOwnProperty(xe)&&(ge!=null||Ce!=null))switch(xe){case"type":O=ge;break;case"name":S=ge;break;case"checked":me=ge;break;case"defaultChecked":we=ge;break;case"value":$=ge;break;case"defaultValue":G=ge;break;case"children":case"dangerouslySetInnerHTML":if(ge!=null)throw Error(r(137,c));break;default:ge!==Ce&&$t(o,c,xe,ge,g,Ce)}}Rd(o,$,G,J,me,we,O,S);return;case"select":ge=$=G=xe=null;for(O in m)if(J=m[O],m.hasOwnProperty(O)&&J!=null)switch(O){case"value":break;case"multiple":ge=J;default:g.hasOwnProperty(O)||$t(o,c,O,null,g,J)}for(S in g)if(O=g[S],J=m[S],g.hasOwnProperty(S)&&(O!=null||J!=null))switch(S){case"value":xe=O;break;case"defaultValue":G=O;break;case"multiple":$=O;default:O!==J&&$t(o,c,S,O,g,J)}c=G,m=$,g=ge,xe!=null?Qs(o,!!m,xe,!1):!!g!=!!m&&(c!=null?Qs(o,!!m,c,!0):Qs(o,!!m,m?[]:"",!1));return;case"textarea":ge=xe=null;for(G in m)if(S=m[G],m.hasOwnProperty(G)&&S!=null&&!g.hasOwnProperty(G))switch(G){case"value":break;case"children":break;default:$t(o,c,G,null,g,S)}for($ in g)if(S=g[$],O=m[$],g.hasOwnProperty($)&&(S!=null||O!=null))switch($){case"value":xe=S;break;case"defaultValue":ge=S;break;case"children":break;case"dangerouslySetInnerHTML":if(S!=null)throw Error(r(91));break;default:S!==O&&$t(o,c,$,S,g,O)}$d(o,xe,ge);return;case"option":for(var rt in m)xe=m[rt],m.hasOwnProperty(rt)&&xe!=null&&!g.hasOwnProperty(rt)&&(rt==="selected"?o.selected=!1:$t(o,c,rt,null,g,xe));for(J in g)xe=g[J],ge=m[J],g.hasOwnProperty(J)&&xe!==ge&&(xe!=null||ge!=null)&&(J==="selected"?o.selected=xe&&typeof xe!="function"&&typeof xe!="symbol":$t(o,c,J,xe,g,ge));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Ze in m)xe=m[Ze],m.hasOwnProperty(Ze)&&xe!=null&&!g.hasOwnProperty(Ze)&&$t(o,c,Ze,null,g,xe);for(me in g)if(xe=g[me],ge=m[me],g.hasOwnProperty(me)&&xe!==ge&&(xe!=null||ge!=null))switch(me){case"children":case"dangerouslySetInnerHTML":if(xe!=null)throw Error(r(137,c));break;default:$t(o,c,me,xe,g,ge)}return;default:if(Cc(c)){for(var It in m)xe=m[It],m.hasOwnProperty(It)&&xe!==void 0&&!g.hasOwnProperty(It)&&rj(o,c,It,void 0,g,xe);for(we in g)xe=g[we],ge=m[we],!g.hasOwnProperty(we)||xe===ge||xe===void 0&&ge===void 0||rj(o,c,we,xe,g,ge);return}}for(var le in m)xe=m[le],m.hasOwnProperty(le)&&xe!=null&&!g.hasOwnProperty(le)&&$t(o,c,le,null,g,xe);for(Ce in g)xe=g[Ce],ge=m[Ce],!g.hasOwnProperty(Ce)||xe===ge||xe==null&&ge==null||$t(o,c,Ce,xe,g,ge)}var aj=null,sj=null;function tx(o){return o.nodeType===9?o:o.ownerDocument}function K_(o){switch(o){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function W_(o,c){if(o===0)switch(c){case"svg":return 1;case"math":return 2;default:return 0}return o===1&&c==="foreignObject"?0:o}
vendor: 4,076 bytes, line 9
9function ij(o,c){return o==="textarea"||o==="noscript"||typeof c.children=="string"||typeof c.children=="number"||typeof c.children=="bigint"||typeof c.dangerouslySetInnerHTML=="object"&&c.dangerouslySetInnerHTML!==null&&c.dangerouslySetInnerHTML.__html!=null}var oj=null;function YY(){var o=window.event;return o&&o.type==="popstate"?o===oj?!1:(oj=o,!0):(oj=null,!1)}var Y_=typeof setTimeout=="function"?setTimeout:void 0,XY=typeof clearTimeout=="function"?clearTimeout:void 0,X_=typeof Promise=="function"?Promise:void 0,QY=typeof queueMicrotask=="function"?queueMicrotask:typeof X_<"u"?function(o){return X_.resolve(null).then(o).catch(ZY)}:Y_;function ZY(o){setTimeout(function(){throw o})}function uo(o){return o==="head"}function Q_(o,c){var m=c,g=0,S=0;do{var O=m.nextSibling;if(o.removeChild(m),O&&O.nodeType===8)if(m=O.data,m==="/$"){if(0<g&&8>g){m=g;var $=o.ownerDocument;if(m&1&&wf($.documentElement),m&2&&wf($.body),m&4)for(m=$.head,wf(m),$=m.firstChild;$;){var G=$.nextSibling,J=$.nodeName;$[el]||J==="SCRIPT"||J==="STYLE"||J==="LINK"&&$.rel.toLowerCase()==="stylesheet"||m.removeChild($),$=G}}if(S===0){o.removeChild(O),Pf(c);return}S--}else m==="$"||m==="$?"||m==="$!"?S++:g=m.charCodeAt(0)-48;else g=0;m=O}while(m);Pf(c)}function lj(o){var c=o.firstChild;for(c&&c.nodeType===10&&(c=c.nextSibling);c;){var m=c;switch(c=c.nextSibling,m.nodeName){case"HTML":case"HEAD":case"BODY":lj(m),ma(m);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(m.rel.toLowerCase()==="stylesheet")continue}o.removeChild(m)}}function JY(o,c,m,g){for(;o.nodeType===1;){var S=m;if(o.nodeName.toLowerCase()!==c.toLowerCase()){if(!g&&(o.nodeName!=="INPUT"||o.type!=="hidden"))break}else if(g){if(!o[el])switch(c){case"meta":if(!o.hasAttribute("itemprop"))break;return o;case"link":if(O=o.getAttribute("rel"),O==="stylesheet"&&o.hasAttribute("data-precedence"))break;if(O!==S.rel||o.getAttribute("href")!==(S.href==null||S.href===""?null:S.href)||o.getAttribute("crossorigin")!==(S.crossOrigin==null?null:S.crossOrigin)||o.getAttribute("title")!==(S.title==null?null:S.title))break;return o;case"style":if(o.hasAttribute("data-precedence"))break;return o;case"script":if(O=o.getAttribute("src"),(O!==(S.src==null?null:S.src)||o.getAttribute("type")!==(S.type==null?null:S.type)||o.getAttribute("crossorigin")!==(S.crossOrigin==null?null:S.crossOrigin))&&O&&o.hasAttribute("async")&&!o.hasAttribute("itemprop"))break;return o;default:return o}}else if(c==="input"&&o.type==="hidden"){var O=S.name==null?null:""+S.name;if(S.type==="hidden"&&o.getAttribute("name")===O)return o}else return o;if(o=Ua(o.nextSibling),o===null)break}return null}function eX(o,c,m){if(c==="")return null;for(;o.nodeType!==3;)if((o.nodeType!==1||o.nodeName!=="INPUT"||o.type!=="hidden")&&!m||(o=Ua(o.nextSibling),o===null))return null;return o}function cj(o){return o.data==="$!"||o.data==="$?"&&o.ownerDocument.readyState==="complete"}function tX(o,c){var m=o.ownerDocument;if(o.data!=="$?"||m.readyState==="complete")c();else{var g=function(){c(),m.removeEventListener("DOMContentLoaded",g)};m.addEventListener("DOMContentLoaded",g),o._reactRetry=g}}function Ua(o){for(;o!=null;o=o.nextSibling){var c=o.nodeType;if(c===1||c===3)break;if(c===8){if(c=o.data,c==="$"||c==="$!"||c==="$?"||c==="F!"||c==="F")break;if(c==="/$")return null}}return o}var uj=null;function Z_(o){o=o.previousSibling;for(var c=0;o;){if(o.nodeType===8){var m=o.data;if(m==="$"||m==="$!"||m==="$?"){if(c===0)return o;c--}else m==="/$"&&c++}o=o.previousSibling}return null}function J_(o,c,m){switch(c=tx(m),o){case"html":if(o=c.documentElement,!o)throw Error(r(452));return o;case"head":if(o=c.head,!o)throw Error(r(453));return o;case"body":if(o=c.body,!o)throw Error(r(454));return o;default:throw Error(r(451))}}function wf(o){for(var c=o.attributes;c.length;)o.removeAttributeNode(c[0]);ma(o)}var ba=new Map,eM=new Set;function nx(o){return typeof o.getRootNode=="function"?o.getRootNode():o.nodeType===9?o:o.ownerDocument}var di=q.d;q.d={f:nX,r:rX,D:aX,C:sX,L:iX,m:oX,X:cX,S:lX,M:uX};function nX(){var o=di.f(),c=Kp();return o||c}
vendor: 6,611 bytes, line 9
9function rX(o){var c=ms(o);c!==null&&c.tag===5&&c.type==="form"?bE(c):di.r(o)}var Jc=typeof document>"u"?null:document;function tM(o,c,m){var g=Jc;if(g&&typeof c=="string"&&c){var S=Ar(c);S='link[rel="'+o+'"][href="'+S+'"]',typeof m=="string"&&(S+='[crossorigin="'+m+'"]'),eM.has(S)||(eM.add(S),o={rel:o,crossOrigin:m,href:c},g.querySelector(S)===null&&(c=g.createElement("link"),Yn(c,"link",o),xn(c),g.head.appendChild(c)))}}function aX(o){di.D(o),tM("dns-prefetch",o,null)}function sX(o,c){di.C(o,c),tM("preconnect",o,c)}function iX(o,c,m){di.L(o,c,m);var g=Jc;if(g&&o&&c){var S='link[rel="preload"][as="'+Ar(c)+'"]';c==="image"&&m&&m.imageSrcSet?(S+='[imagesrcset="'+Ar(m.imageSrcSet)+'"]',typeof m.imageSizes=="string"&&(S+='[imagesizes="'+Ar(m.imageSizes)+'"]')):S+='[href="'+Ar(o)+'"]';var O=S;switch(c){case"style":O=eu(o);break;case"script":O=tu(o)}ba.has(O)||(o=h({rel:"preload",href:c==="image"&&m&&m.imageSrcSet?void 0:o,as:c},m),ba.set(O,o),g.querySelector(S)!==null||c==="style"&&g.querySelector(Nf(O))||c==="script"&&g.querySelector(Sf(O))||(c=g.createElement("link"),Yn(c,"link",o),xn(c),g.head.appendChild(c)))}}function oX(o,c){di.m(o,c);var m=Jc;if(m&&o){var g=c&&typeof c.as=="string"?c.as:"script",S='link[rel="modulepreload"][as="'+Ar(g)+'"][href="'+Ar(o)+'"]',O=S;switch(g){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":O=tu(o)}if(!ba.has(O)&&(o=h({rel:"modulepreload",href:o},c),ba.set(O,o),m.querySelector(S)===null)){switch(g){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(m.querySelector(Sf(O)))return}g=m.createElement("link"),Yn(g,"link",o),xn(g),m.head.appendChild(g)}}}function lX(o,c,m){di.S(o,c,m);var g=Jc;if(g&&o){var S=Bi(g).hoistableStyles,O=eu(o);c=c||"default";var $=S.get(O);if(!$){var G={loading:0,preload:null};if($=g.querySelector(Nf(O)))G.loading=5;else{o=h({rel:"stylesheet",href:o,"data-precedence":c},m),(m=ba.get(O))&&dj(o,m);var J=$=g.createElement("link");xn(J),Yn(J,"link",o),J._p=new Promise(function(me,we){J.onload=me,J.onerror=we}),J.addEventListener("load",function(){G.loading|=1}),J.addEventListener("error",function(){G.loading|=2}),G.loading|=4,rx($,c,g)}$={type:"stylesheet",instance:$,count:1,state:G},S.set(O,$)}}}function cX(o,c){di.X(o,c);var m=Jc;if(m&&o){var g=Bi(m).hoistableScripts,S=tu(o),O=g.get(S);O||(O=m.querySelector(Sf(S)),O||(o=h({src:o,async:!0},c),(c=ba.get(S))&&fj(o,c),O=m.createElement("script"),xn(O),Yn(O,"link",o),m.head.appendChild(O)),O={type:"script",instance:O,count:1,state:null},g.set(S,O))}}function uX(o,c){di.M(o,c);var m=Jc;if(m&&o){var g=Bi(m).hoistableScripts,S=tu(o),O=g.get(S);O||(O=m.querySelector(Sf(S)),O||(o=h({src:o,async:!0,type:"module"},c),(c=ba.get(S))&&fj(o,c),O=m.createElement("script"),xn(O),Yn(O,"link",o),m.head.appendChild(O)),O={type:"script",instance:O,count:1,state:null},g.set(S,O))}}function nM(o,c,m,g){var S=(S=se.current)?nx(S):null;if(!S)throw Error(r(446));switch(o){case"meta":case"title":return null;case"style":return typeof m.precedence=="string"&&typeof m.href=="string"?(c=eu(m.href),m=Bi(S).hoistableStyles,g=m.get(c),g||(g={type:"style",instance:null,count:0,state:null},m.set(c,g)),g):{type:"void",instance:null,count:0,state:null};case"link":if(m.rel==="stylesheet"&&typeof m.href=="string"&&typeof m.precedence=="string"){o=eu(m.href);var O=Bi(S).hoistableStyles,$=O.get(o);if($||(S=S.ownerDocument||S,$={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},O.set(o,$),(O=S.querySelector(Nf(o)))&&!O._p&&($.instance=O,$.state.loading=5),ba.has(o)||(m={rel:"preload",as:"style",href:m.href,crossOrigin:m.crossOrigin,integrity:m.integrity,media:m.media,hrefLang:m.hrefLang,referrerPolicy:m.referrerPolicy},ba.set(o,m),O||dX(S,o,m,$.state))),c&&g===null)throw Error(r(528,""));return $}if(c&&g!==null)throw Error(r(529,""));return null;case"script":return c=m.async,m=m.src,typeof m=="string"&&c&&typeof c!="function"&&typeof c!="symbol"?(c=tu(m),m=Bi(S).hoistableScripts,g=m.get(c),g||(g={type:"script",instance:null,count:0,state:null},m.set(c,g)),g):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,o))}}function eu(o){return'href="'+Ar(o)+'"'}function Nf(o){return'link[rel="stylesheet"]['+o+"]"}function rM(o){return h({},o,{"data-precedence":o.precedence,precedence:null})}function dX(o,c,m,g){o.querySelector('link[rel="preload"][as="style"]['+c+"]")?g.loading=1:(c=o.createElement("link"),g.preload=c,c.addEventListener("load",function(){return g.loading|=1}),c.addEventListener("error",function(){return g.loading|=2}),Yn(c,"link",m),xn(c),o.head.appendChild(c))}function tu(o){return'[src="'+Ar(o)+'"]'}function Sf(o){return"script[async]"+o}function aM(o,c,m){if(c.count++,c.instance===null)switch(c.type){case"style":var g=o.querySelector('style[data-href~="'+Ar(m.href)+'"]');if(g)return c.instance=g,xn(g),g;var S=h({},m,{"data-href":m.href,"data-precedence":m.precedence,href:null,precedence:null});return g=(o.ownerDocument||o).createElement("style"),xn(g),Yn(g,"style",S),rx(g,m.precedence,o),c.instance=g;case"stylesheet":S=eu(m.href);var O=o.querySelector(Nf(S));if(O)return c.state.loading|=4,c.instance=O,xn(O),O;g=rM(m),(S=ba.get(S))&&dj(g,S),O=(o.ownerDocument||o).createElement("link"),xn(O);var $=O;return $._p=new Promise(function(G,J){$.onload=G,$.onerror=J}),Yn(O,"link",g),c.state.loading|=4,rx(O,m.precedence,o),c.instance=O;case"script":return O=tu(m.src),(S=o.querySelector(Sf(O)))?(c.instance=S,xn(S),S):(g=m,(S=ba.get(O))&&(g=h({},m),fj(g,S)),o=o.ownerDocument||o,S=o.createElement("script"),xn(S),Yn(S,"link",g),o.head.appendChild(S),c.instance=S);case"void":return null;default:throw Error(r(443,c.type))}else c.type==="stylesheet"&&(c.state.loading&4)===0&&(g=c.instance,c.state.loading|=4,rx(g,m.precedence,o));return c.instance}function rx(o,c,m){for(var g=m.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),S=g.length?g[g.length-1]:null,O=S,$=0;$<g.length;$++){var G=g[$];if(G.dataset.precedence===c)O=G;else if(O!==S)break}O?O.parentNode.insertBefore(o,O.nextSibling):(c=m.nodeType===9?m.head:m,c.insertBefore(o,c.firstChild))}function dj(o,c){o.crossOrigin==null&&(o.crossOrigin=c.crossOrigin),o.referrerPolicy==null&&(o.referrerPolicy=c.referrerPolicy),o.title==null&&(o.title=c.title)}function fj(o,c){o.crossOrigin==null&&(o.crossOrigin=c.crossOrigin),o.referrerPolicy==null&&(o.referrerPolicy=c.referrerPolicy),o.integrity==null&&(o.integrity=c.integrity)}var ax=null;function sM(o,c,m){if(ax===null){var g=new Map,S=ax=new Map;S.set(m,g)}
vendor: 10,677 bytes, line 9
9else S=ax,g=S.get(m),g||(g=new Map,S.set(m,g));if(g.has(o))return g;for(g.set(o,null),m=m.getElementsByTagName(o),S=0;S<m.length;S++){var O=m[S];if(!(O[el]||O[kt]||o==="link"&&O.getAttribute("rel")==="stylesheet")&&O.namespaceURI!=="http://www.w3.org/2000/svg"){var $=O.getAttribute(c)||"";$=o+$;var G=g.get($);G?G.push(O):g.set($,[O])}}return g}function iM(o,c,m){o=o.ownerDocument||o,o.head.insertBefore(m,c==="title"?o.querySelector("head > title"):null)}function fX(o,c,m){if(m===1||c.itemProp!=null)return!1;switch(o){case"meta":case"title":return!0;case"style":if(typeof c.precedence!="string"||typeof c.href!="string"||c.href==="")break;return!0;case"link":if(typeof c.rel!="string"||typeof c.href!="string"||c.href===""||c.onLoad||c.onError)break;return c.rel==="stylesheet"?(o=c.disabled,typeof c.precedence=="string"&&o==null):!0;case"script":if(c.async&&typeof c.async!="function"&&typeof c.async!="symbol"&&!c.onLoad&&!c.onError&&c.src&&typeof c.src=="string")return!0}return!1}function oM(o){return!(o.type==="stylesheet"&&(o.state.loading&3)===0)}var Cf=null;function mX(){}function hX(o,c,m){if(Cf===null)throw Error(r(475));var g=Cf;if(c.type==="stylesheet"&&(typeof m.media!="string"||matchMedia(m.media).matches!==!1)&&(c.state.loading&4)===0){if(c.instance===null){var S=eu(m.href),O=o.querySelector(Nf(S));if(O){o=O._p,o!==null&&typeof o=="object"&&typeof o.then=="function"&&(g.count++,g=sx.bind(g),o.then(g,g)),c.state.loading|=4,c.instance=O,xn(O);return}O=o.ownerDocument||o,m=rM(m),(S=ba.get(S))&&dj(m,S),O=O.createElement("link"),xn(O);var $=O;$._p=new Promise(function(G,J){$.onload=G,$.onerror=J}),Yn(O,"link",m),c.instance=O}g.stylesheets===null&&(g.stylesheets=new Map),g.stylesheets.set(c,o),(o=c.state.preload)&&(c.state.loading&3)===0&&(g.count++,c=sx.bind(g),o.addEventListener("load",c),o.addEventListener("error",c))}}function pX(){if(Cf===null)throw Error(r(475));var o=Cf;return o.stylesheets&&o.count===0&&mj(o,o.stylesheets),0<o.count?function(c){var m=setTimeout(function(){if(o.stylesheets&&mj(o,o.stylesheets),o.unsuspend){var g=o.unsuspend;o.unsuspend=null,g()}},6e4);return o.unsuspend=c,function(){o.unsuspend=null,clearTimeout(m)}}:null}function sx(){if(this.count--,this.count===0){if(this.stylesheets)mj(this,this.stylesheets);else if(this.unsuspend){var o=this.unsuspend;this.unsuspend=null,o()}}}var ix=null;function mj(o,c){o.stylesheets=null,o.unsuspend!==null&&(o.count++,ix=new Map,c.forEach(xX,o),ix=null,sx.call(o))}function xX(o,c){if(!(c.state.loading&4)){var m=ix.get(o);if(m)var g=m.get(null);else{m=new Map,ix.set(o,m);for(var S=o.querySelectorAll("link[data-precedence],style[data-precedence]"),O=0;O<S.length;O++){var $=S[O];($.nodeName==="LINK"||$.getAttribute("media")!=="not all")&&(m.set($.dataset.precedence,$),g=$)}g&&m.set(null,g)}S=c.instance,$=S.getAttribute("data-precedence"),O=m.get($)||g,O===g&&m.set(null,S),m.set($,S),this.count++,g=sx.bind(this),S.addEventListener("load",g),S.addEventListener("error",g),O?O.parentNode.insertBefore(S,O.nextSibling):(o=o.nodeType===9?o.head:o,o.insertBefore(S,o.firstChild)),c.state.loading|=4}}var Af={$$typeof:k,Provider:null,Consumer:null,_currentValue:K,_currentValue2:K,_threadCount:0};function gX(o,c,m,g,S,O,$,G){this.tag=1,this.containerInfo=o,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=qi(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=qi(0),this.hiddenUpdates=qi(null),this.identifierPrefix=g,this.onUncaughtError=S,this.onCaughtError=O,this.onRecoverableError=$,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=G,this.incompleteTransitions=new Map}function lM(o,c,m,g,S,O,$,G,J,me,we,Ce){return o=new gX(o,c,m,$,G,J,me,Ce),c=1,O===!0&&(c|=24),O=Gr(3,null,null,c),o.current=O,O.stateNode=o,c=Wb(),c.refCount++,o.pooledCache=c,c.refCount++,O.memoizedState={element:g,isDehydrated:m,cache:c},Zb(O),o}function cM(o){return o?(o=_c,o):_c}function uM(o,c,m,g,S,O){S=cM(S),g.context===null?g.context=S:g.pendingContext=S,g=Qi(c),g.payload={element:m},O=O===void 0?null:O,O!==null&&(g.callback=O),m=Zi(o,g,c),m!==null&&(Qr(m,o,c),tf(m,o,c))}function dM(o,c){if(o=o.memoizedState,o!==null&&o.dehydrated!==null){var m=o.retryLane;o.retryLane=m!==0&&m<c?m:c}}function hj(o,c){dM(o,c),(o=o.alternate)&&dM(o,c)}function fM(o){if(o.tag===13){var c=Ec(o,67108864);c!==null&&Qr(c,o,67108864),hj(o,67108864)}}var ox=!0;function yX(o,c,m,g){var S=D.T;D.T=null;var O=q.p;try{q.p=2,pj(o,c,m,g)}finally{q.p=O,D.T=S}}function vX(o,c,m,g){var S=D.T;D.T=null;var O=q.p;try{q.p=8,pj(o,c,m,g)}finally{q.p=O,D.T=S}}function pj(o,c,m,g){if(ox){var S=xj(g);if(S===null)nj(o,c,g,lx,m),hM(o,g);else if(jX(S,o,c,m,g))g.stopPropagation();else if(hM(o,g),c&4&&-1<bX.indexOf(o)){for(;S!==null;){var O=ms(S);if(O!==null)switch(O.tag){case 3:if(O=O.stateNode,O.current.memoizedState.isDehydrated){var $=Br(O.pendingLanes);if($!==0){var G=O;for(G.pendingLanes|=2,G.entangledLanes|=2;$;){var J=1<<31-In($);G.entanglements[1]|=J,$&=~J}bs(O),(Ot&6)===0&&(Vp=Te()+500,vf(0))}}break;case 13:G=Ec(O,2),G!==null&&Qr(G,O,2),Kp(),hj(O,2)}if(O=xj(g),O===null&&nj(o,c,g,lx,m),O===S)break;S=O}S!==null&&g.stopPropagation()}else nj(o,c,g,null,m)}}function xj(o){return o=Ld(o),gj(o)}var lx=null;function gj(o){if(lx=null,o=Vs(o),o!==null){var c=i(o);if(c===null)o=null;else{var m=c.tag;if(m===13){if(o=l(c),o!==null)return o;o=null}else if(m===3){if(c.stateNode.current.memoizedState.isDehydrated)return c.tag===3?c.stateNode.containerInfo:null;o=null}else c!==o&&(o=null)}}return lx=o,null}function mM(o){switch(o){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Le()){case ze:return 2;case at:return 8;case xt:case dt:return 32;case Mt:return 268435456;default:return 32}default:return 32}}var yj=!1,fo=null,mo=null,ho=null,Tf=new Map,kf=new Map,po=[],bX="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function hM(o,c){switch(o){case"focusin":case"focusout":fo=null;break;case"dragenter":case"dragleave":mo=null;break;case"mouseover":case"mouseout":ho=null;break;case"pointerover":case"pointerout":Tf.delete(c.pointerId);break;case"gotpointercapture":case"lostpointercapture":kf.delete(c.pointerId)}}function Of(o,c,m,g,S,O){return o===null||o.nativeEvent!==O?(o={blockedOn:c,domEventName:m,eventSystemFlags:g,nativeEvent:O,targetContainers:[S]},c!==null&&(c=ms(c),c!==null&&fM(c)),o):(o.eventSystemFlags|=g,c=o.targetContainers,S!==null&&c.indexOf(S)===-1&&c.push(S),o)}function jX(o,c,m,g,S){switch(c){case"focusin":return fo=Of(fo,o,c,m,g,S),!0;case"dragenter":return mo=Of(mo,o,c,m,g,S),!0;case"mouseover":return ho=Of(ho,o,c,m,g,S),!0;case"pointerover":var O=S.pointerId;return Tf.set(O,Of(Tf.get(O)||null,o,c,m,g,S)),!0;case"gotpointercapture":return O=S.pointerId,kf.set(O,Of(kf.get(O)||null,o,c,m,g,S)),!0}return!1}function pM(o){var c=Vs(o.target);if(c!==null){var m=i(c);if(m!==null){if(c=m.tag,c===13){if(c=l(m),c!==null){o.blockedOn=c,fa(o.priority,function(){if(m.tag===13){var g=Xr();g=St(g);var S=Ec(m,g);S!==null&&Qr(S,m,g),hj(m,g)}});return}}else if(c===3&&m.stateNode.current.memoizedState.isDehydrated){o.blockedOn=m.tag===3?m.stateNode.containerInfo:null;return}}}o.blockedOn=null}function cx(o){if(o.blockedOn!==null)return!1;for(var c=o.targetContainers;0<c.length;){var m=xj(o.nativeEvent);if(m===null){m=o.nativeEvent;var g=new m.constructor(m.type,m);Ln=g,m.target.dispatchEvent(g),Ln=null}else return c=ms(m),c!==null&&fM(c),o.blockedOn=m,!1;c.shift()}return!0}function xM(o,c,m){cx(o)&&m.delete(c)}function wX(){yj=!1,fo!==null&&cx(fo)&&(fo=null),mo!==null&&cx(mo)&&(mo=null),ho!==null&&cx(ho)&&(ho=null),Tf.forEach(xM),kf.forEach(xM)}function ux(o,c){o.blockedOn===c&&(o.blockedOn=null,yj||(yj=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,wX)))}var dx=null;function gM(o){dx!==o&&(dx=o,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){dx===o&&(dx=null);for(var c=0;c<o.length;c+=3){var m=o[c],g=o[c+1],S=o[c+2];if(typeof g!="function"){if(gj(g||m)===null)continue;break}var O=ms(m);O!==null&&(o.splice(c,3),c-=3,g0(O,{pending:!0,data:S,method:m.method,action:g},g,S))}}))}function Pf(o){function c(J){return ux(J,o)}fo!==null&&ux(fo,o),mo!==null&&ux(mo,o),ho!==null&&ux(ho,o),Tf.forEach(c),kf.forEach(c);for(var m=0;m<po.length;m++){var g=po[m];g.blockedOn===o&&(g.blockedOn=null)}for(;0<po.length&&(m=po[0],m.blockedOn===null);)pM(m),m.blockedOn===null&&po.shift();if(m=(o.ownerDocument||o).$$reactFormReplay,m!=null)for(g=0;g<m.length;g+=3){var S=m[g],O=m[g+1],$=S[Jt]||null;if(typeof O=="function")$||gM(m);else if($){var G=null;if(O&&O.hasAttribute("formAction")){if(S=O,$=O[Jt]||null)G=$.formAction;else if(gj(S)!==null)continue}else G=$.action;typeof G=="function"?m[g+1]=G:(m.splice(g,3),g-=3),gM(m)}}}function vj(o){this._internalRoot=o}fx.prototype.render=vj.prototype.render=function(o){var c=this._internalRoot;if(c===null)throw Error(r(409));var m=c.current,g=Xr();uM(m,g,o,c,null,null)},fx.prototype.unmount=vj.prototype.unmount=function(){var o=this._internalRoot;if(o!==null){this._internalRoot=null;var c=o.containerInfo;uM(o.current,2,null,o,null,null),Kp(),c[Sn]=null}};function fx(o){this._internalRoot=o}
9fx.prototype.unstable_scheduleHydration=function(o){if(o){var c=fs();o={blockedOn:null,target:o,priority:c};for(var m=0;m<po.length&&c!==0&&c<po[m].priority;m++);po.splice(m,0,o),m===0&&pM(o)}};var yM=t.version;if(yM!=="19.1.0")throw Error(r(527,yM,"19.1.0"));q.findDOMNode=function(o){var c=o._reactInternals;if(c===void 0)throw typeof o.render=="function"?Error(r(188)):(o=Object.keys(o).join(","),Error(r(268,o)));return o=d(c),o=o!==null?f(o):null,o=o===null?null:o.stateNode,o};var NX={bundleType:0,version:"19.1.0",rendererPackageName:"react-dom",currentDispatcherRef:D,reconcilerVersion:"19.1.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var mx=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!mx.isDisabled&&mx.supportsFiber)try{rr=mx.inject(NX),$n=mx}catch{}}return _f.createRoot=function(o,c){if(!s(o))throw Error(r(299));var m=!1,g="",S=RE,O=DE,$=$E,G=null;return c!=null&&(c.unstable_strictMode===!0&&(m=!0),c.identifierPrefix!==void 0&&(g=c.identifierPrefix),c.onUncaughtError!==void 0&&(S=c.onUncaughtError),c.onCaughtError!==void 0&&(O=c.onCaughtError),c.onRecoverableError!==void 0&&($=c.onRecoverableError),c.unstable_transitionCallbacks!==void 0&&(G=c.unstable_transitionCallbacks)),c=lM(o,1,!1,null,null,m,g,S,O,$,G,null),o[Sn]=c.current,tj(o),new vj(c)},_f.hydrateRoot=function(o,c,m){if(!s(o))throw Error(r(299));var g=!1,S="",O=RE,$=DE,G=$E,J=null,me=null;return m!=null&&(m.unstable_strictMode===!0&&(g=!0),m.identifierPrefix!==void 0&&(S=m.identifierPrefix),m.onUncaughtError!==void 0&&(O=m.onUncaughtError),m.onCaughtError!==void 0&&($=m.onCaughtError),m.onRecoverableError!==void 0&&(G=m.onRecoverableError),m.unstable_transitionCallbacks!==void 0&&(J=m.unstable_transitionCallbacks),m.formState!==void 0&&(me=m.formState)),c=lM(o,1,!0,c,m??null,g,S,O,$,G,J,me),c.context=cM(null),m=c.current,g=Xr(),g=St(g),S=Qi(g),S.callback=null,Zi(m,S,g),m=g,c.current.lanes=m,Hs(c,m),bs(c),o[Sn]=c.current,tj(o),new fx(c)},_f.version="19.1.0",_f}var kM;function MX(){if(kM)return jj.exports;kM=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),jj.exports=_X(),jj.exports}var RX=MX();function DX(e,t){if(e instanceof RegExp)return{keys:!1,pattern:e};var n,r,s,i,l=[],u="",d=e.split("/");for(d[0]||d.shift();s=d.shift();)n=s[0],n==="*"?(l.push(n),u+=s[1]==="?"?"(?:/(.*))?":"/(.*)"):n===":"?(r=s.indexOf("?",1),i=s.indexOf(".",1),l.push(s.substring(1,~r?r:~i?i:s.length)),u+=~r&&!~i?"(?:/([^/]+?))?":"/([^/]+?)",~i&&(u+=(~r?"?":"")+"\\"+s.substring(i))):u+="/"+s;return{keys:l,pattern:new RegExp("^"+u+(t?"(?=$|/)":"/?$"),"i")}}var v=rv();const ie=Bt(v),av=CX({__proto__:null,default:ie},[v]);
9var Aj={exports:{}},Tj={};var OM;function $X(){if(OM)return Tj;OM=1;var e=rv();function t(p,x){return p===x&&(p!==0||1/p===1/x)||p!==p&&x!==x}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,s=e.useEffect,i=e.useLayoutEffect,l=e.useDebugValue;function u(p,x){var y=x(),w=r({inst:{value:y,getSnapshot:x}}),j=w[0].inst,b=w[1];return i(function(){j.value=y,j.getSnapshot=x,d(j)&&b({inst:j})},[p,y,x]),s(function(){return d(j)&&b({inst:j}),p(function(){d(j)&&b({inst:j})})},[p]),l(y),y}function d(p){var x=p.getSnapshot;p=p.value;try{var y=x();return!n(p,y)}catch{return!0}}function f(p,x){return x()}var h=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f:u;return Tj.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:h,Tj}var PM;function IX(){return PM||(PM=1,Aj.exports=$X()),Aj.exports}var LX=IX();const FX=av.useInsertionEffect,qX=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",BX=qX?v.useLayoutEffect:v.useEffect,zX=FX||BX,FF=e=>{const t=v.useRef([e,(...n)=>t[0](...n)]).current;return zX(()=>{t[0]=e}),t[1]},UX="popstate",ZA="pushState",JA="replaceState",HX="hashchange",EM=[UX,ZA,JA,HX],VX=e=>{for(const t of EM)addEventListener(t,e);return()=>{for(const t of EM)removeEventListener(t,e)}},qF=(e,t)=>LX.useSyncExternalStore(VX,e,t),_M=()=>location.search,GX=({ssrSearch:e}={})=>qF(_M,e!=null?()=>e:_M),MM=()=>location.pathname,KX=({ssrPath:e}={})=>qF(MM,e!=null?()=>e:MM),WX=(e,{replace:t=!1,state:n=null}={})=>history[t?JA:ZA](n,"",e),YX=(e={})=>[KX(e),WX],RM=Symbol.for("wouter_v3");if(typeof history<"u"&&typeof window[RM]>"u"){for(const e of[ZA,JA]){const t=history[e];history[e]=function(){const n=t.apply(this,arguments),r=new Event(e);return r.arguments=arguments,dispatchEvent(r),n}}Object.defineProperty(window,RM,{value:!0})}const XX=(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())?"~"+t:t.slice(e.length)||"/",BF=(e="")=>e==="/"?"":e,QX=(e,t)=>e[0]==="~"?e.slice(1):BF(t)+e,ZX=(e="",t)=>XX(DM(BF(e)),DM(t)),DM=e=>{try{return decodeURI(e)}catch{return e}},zF={hook:YX,searchHook:GX,parser:DX,base:"",ssrPath:void 0,ssrSearch:void 0,ssrContext:void 0,hrefs:e=>e,aroundNav:(e,t,n)=>e(t,n)},UF=v.createContext(zF),bh=()=>v.useContext(UF),HF={},VF=v.createContext(HF),jh=()=>v.useContext(VF),sv=e=>{const[t,n]=e.hook(e);return[ZX(e.base,t),FF((r,s)=>e.aroundNav(n,QX(r,e.base),s))]},fr=()=>sv(bh()),GF=(e,t,n,r)=>{const{pattern:s,keys:i}=t instanceof RegExp?{keys:!1,pattern:t}:e(t||"*",r),l=s.exec(n)||[],[u,...d]=l;return u!==void 0?[!0,(()=>{const f=i!==!1?Object.fromEntries(i.map((p,x)=>[p,d[x]])):l.groups;let h={...d};return f&&Object.assign(h,f),h})(),...r?[u]:[]]:[!1,null]},KF=({children:e,...t})=>{const n=bh(),r=t.hook?zF:n;let s=r;const[i,l=t.ssrSearch??""]=t.ssrPath?.split("?")??[];i&&(t.ssrSearch=l,t.ssrPath=i),t.hrefs=t.hrefs??t.hook?.hrefs,t.searchHook=t.searchHook??t.hook?.searchHook;let u=v.useRef({}),d=u.current,f=d;for(let h in r){const p=h==="base"?r[h]+(t[h]??""):t[h]??r[h];d===f&&p!==f[h]&&(u.current=f={...f}),f[h]=p,(p!==r[h]||p!==s[h])&&(s=f)}return v.createElement(UF.Provider,{value:s,children:e})},$M=({children:e,component:t},n)=>t?v.createElement(t,{params:n}):typeof e=="function"?e(n):e,JX=e=>{let t=v.useRef(HF);const n=t.current;return t.current=Object.keys(e).length!==Object.keys(n).length||Object.entries(e).some(([r,s])=>s!==n[r])?e:n},Lt=({path:e,nest:t,match:n,...r})=>{const s=bh(),[i]=sv(s),[l,u,d]=n??GF(s.parser,e,i,t),f=JX({...jh(),...u});if(!l)return null;const h=d?v.createElement(KF,{base:d},$M(r,f)):$M(r,f);return v.createElement(VF.Provider,{value:f,children:h})},Cu=v.forwardRef((e,t)=>{const n=bh(),[r,s]=sv(n),{to:i="",href:l=i,onClick:u,asChild:d,children:f,className:h,replace:p,state:x,transition:y,...w}=e,j=FF(C=>{C.ctrlKey||C.metaKey||C.altKey||C.shiftKey||C.button!==0||(u?.(C),C.defaultPrevented||(C.preventDefault(),s(l,e)))}),b=n.hrefs(l[0]==="~"?l.slice(1):n.base+l,n);return d&&v.isValidElement(f)?v.cloneElement(f,{onClick:j,href:b}):v.createElement("a",{...w,onClick:j,href:b,className:h?.call?h(r===l):h,children:f,ref:t})}),WF=e=>Array.isArray(e)?e.flatMap(t=>WF(t&&t.type===v.Fragment?t.props.children:t)):[e],IM=({children:e,location:t})=>{const n=bh(),[r]=sv(n);for(const s of WF(e)){let i=0;if(v.isValidElement(s)&&(i=GF(n.parser,s.props.path,t||r,s.props.nest))[0])return v.cloneElement(s,{match:i})}return null};var hd=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},eQ={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},tQ=class{#e=eQ;#t=!1;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}},El=new tQ;function nQ(e){setTimeout(e,0)}var Bl=typeof window>"u"||"Deno"in globalThis;function xr(){}function rQ(e,t){return typeof e=="function"?e(t):e}function T2(e){return typeof e=="number"&&e>=0&&e!==1/0}function YF(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Po(e,t){return typeof e=="function"?e(t):e}function Aa(e,t){return typeof e=="function"?e(t):e}function LM(e,t){const{type:n="all",exact:r,fetchStatus:s,predicate:i,queryKey:l,stale:u}=e;if(l){if(r){if(t.queryHash!==eT(l,t.options))return!1}else if(!Cm(t.queryKey,l))return!1}if(n!=="all"){const d=t.isActive();if(n==="active"&&!d||n==="inactive"&&d)return!1}return!(typeof u=="boolean"&&t.isStale()!==u||s&&s!==t.state.fetchStatus||i&&!i(t))}function FM(e,t){const{exact:n,status:r,predicate:s,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(zl(t.options.mutationKey)!==zl(i))return!1}else if(!Cm(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||s&&!s(t))}function eT(e,t){return(t?.queryKeyHashFn||zl)(e)}function zl(e){return JSON.stringify(e,(t,n)=>k2(n)?Object.keys(n).sort().reduce((r,s)=>(r[s]=n[s],r),{}):n)}function Cm(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>Cm(e[n],t[n])):!1}var aQ=Object.prototype.hasOwnProperty;function XF(e,t,n=0){if(e===t)return e;if(n>500)return t;const r=qM(e)&&qM(t);if(!r&&!(k2(e)&&k2(t)))return t;const i=(r?e:Object.keys(e)).length,l=r?t:Object.keys(t),u=l.length,d=r?new Array(u):{};let f=0;for(let h=0;h<u;h++){const p=r?h:l[h],x=e[p],y=t[p];if(x===y){d[p]=x,(r?h<i:aQ.call(e,p))&&f++;continue}if(x===null||y===null||typeof x!="object"||typeof y!="object"){d[p]=y;continue}const w=XF(x,y,n+1);d[p]=w,w===x&&f++}return i===u&&f===i?e:d}function jg(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function qM(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function k2(e){if(!BM(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!BM(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function BM(e){return Object.prototype.toString.call(e)==="[object Object]"}function sQ(e){return new Promise(t=>{El.setTimeout(t,e)})}function O2(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?XF(e,t):t}function iQ(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function oQ(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var tT=Symbol();function QF(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===tT?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function nT(e,t){return typeof e=="function"?e(...t):!!e}function lQ(e,t,n){let r=!1,s;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(s??=t(),r||(r=!0,s.aborted?n():s.addEventListener("abort",n,{once:!0})),s)}),e}var cQ=class extends hd{#e;#t;#n;constructor(){super(),this.#n=e=>{if(!Bl&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(t=>{typeof t=="boolean"?this.setFocused(t):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){const e=this.isFocused();
vendor: 22,263 bytes, line 9
9this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e=="boolean"?this.#e:globalThis.document?.visibilityState!=="hidden"}},rT=new cQ;function P2(){let e,t;const n=new Promise((s,i)=>{e=s,t=i});n.status="pending",n.catch(()=>{});function r(s){Object.assign(n,s),delete n.resolve,delete n.reject}return n.resolve=s=>{r({status:"fulfilled",value:s}),e(s)},n.reject=s=>{r({status:"rejected",reason:s}),t(s)},n}var uQ=nQ;function dQ(){let e=[],t=0,n=u=>{u()},r=u=>{u()},s=uQ;const i=u=>{t?e.push(u):s(()=>{n(u)})},l=()=>{const u=e;e=[],u.length&&s(()=>{r(()=>{u.forEach(d=>{n(d)})})})};return{batch:u=>{let d;t++;try{d=u()}finally{t--,t||l()}return d},batchCalls:u=>(...d)=>{i(()=>{u(...d)})},schedule:i,setNotifyFunction:u=>{n=u},setBatchNotifyFunction:u=>{r=u},setScheduler:u=>{s=u}}}var _n=dQ(),fQ=class extends hd{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(!Bl&&window.addEventListener){const t=()=>e(!0),n=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(n=>{n(e)}))}isOnline(){return this.#e}},wg=new fQ;function mQ(e){return Math.min(1e3*2**e,3e4)}function ZF(e){return(e??"online")==="online"?wg.isOnline():!0}var E2=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function JF(e){let t=!1,n=0,r;const s=P2(),i=()=>s.status!=="pending",l=j=>{if(!i()){const b=new E2(j);x(b),e.onCancel?.(b)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>rT.isFocused()&&(e.networkMode==="always"||wg.isOnline())&&e.canRun(),h=()=>ZF(e.networkMode)&&e.canRun(),p=j=>{i()||(r?.(),s.resolve(j))},x=j=>{i()||(r?.(),s.reject(j))},y=()=>new Promise(j=>{r=b=>{(i()||f())&&j(b)},e.onPause?.()}).then(()=>{r=void 0,i()||e.onContinue?.()}),w=()=>{if(i())return;let j;const b=n===0?e.initialPromise:void 0;try{j=b??e.fn()}catch(C){j=Promise.reject(C)}Promise.resolve(j).then(p).catch(C=>{if(i())return;const N=e.retry??(Bl?0:3),k=e.retryDelay??mQ,T=typeof k=="function"?k(n,C):k,A=N===!0||typeof N=="number"&&n<N||typeof N=="function"&&N(n,C);if(t||!A){x(C);return}n++,e.onFail?.(n,C),sQ(T).then(()=>f()?void 0:y()).then(()=>{t?x(C):w()})})};return{promise:s,status:()=>s.status,cancel:l,continue:()=>(r?.(),s),cancelRetry:u,continueRetry:d,canStart:h,start:()=>(h()?w():y().then(w),s)}}var eq=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),T2(this.gcTime)&&(this.#e=El.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Bl?1/0:300*1e3))}clearGcTimeout(){this.#e&&(El.clearTimeout(this.#e),this.#e=void 0)}},hQ=class extends eq{#e;#t;#n;#a;#r;#i;#o;constructor(e){super(),this.#o=!1,this.#i=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#a=e.client,this.#n=this.#a.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#e=UM(this.options),this.state=e.state??this.#e,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#r?.promise}setOptions(e){if(this.options={...this.#i,...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const t=UM(this.options);t.data!==void 0&&(this.setState(zM(t.data,t.dataUpdatedAt)),this.#e=t)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#n.remove(this)}setData(e,t){const n=O2(this.state.data,e,this.options);return this.#s({data:n,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e,t){this.#s({type:"setState",state:e,setStateOptions:t})}cancel(e){const t=this.#r?.promise;return this.#r?.cancel(e),t?t.then(xr).catch(xr):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#e)}isActive(){return this.observers.some(e=>Aa(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===tT||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>Po(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!YF(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(t=>t.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#r?.continue()}onOnline(){this.observers.find(t=>t.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#r?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#r&&(this.#o?this.#r.cancel({revert:!0}):this.#r.cancelRetry()),this.scheduleGc()),this.#n.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#s({type:"invalidate"})}async fetch(e,t){if(this.state.fetchStatus!=="idle"&&this.#r?.status()!=="rejected"){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#r)return this.#r.continueRetry(),this.#r.promise}if(e&&this.setOptions(e),!this.options.queryFn){const u=this.observers.find(d=>d.options.queryFn);u&&this.setOptions(u.options)}const n=new AbortController,r=u=>{Object.defineProperty(u,"signal",{enumerable:!0,get:()=>(this.#o=!0,n.signal)})},s=()=>{const u=QF(this.options,t),f=(()=>{const h={client:this.#a,queryKey:this.queryKey,meta:this.meta};return r(h),h})();return this.#o=!1,this.options.persister?this.options.persister(u,f,this):u(f)},l=(()=>{const u={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#a,state:this.state,fetchFn:s};return r(u),u})();this.options.behavior?.onFetch(l,this),this.#t=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==l.fetchOptions?.meta)&&this.#s({type:"fetch",meta:l.fetchOptions?.meta}),this.#r=JF({initialPromise:t?.initialPromise,fn:l.fetchFn,onCancel:u=>{u instanceof E2&&u.revert&&this.setState({...this.#t,fetchStatus:"idle"}),n.abort()},onFail:(u,d)=>{this.#s({type:"failed",failureCount:u,error:d})},onPause:()=>{this.#s({type:"pause"})},onContinue:()=>{this.#s({type:"continue"})},retry:l.options.retry,retryDelay:l.options.retryDelay,networkMode:l.options.networkMode,canRun:()=>!0});try{const u=await this.#r.start();if(u===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(u),this.#n.config.onSuccess?.(u,this),this.#n.config.onSettled?.(u,this.state.error,this),u}catch(u){if(u instanceof E2){if(u.silent)return this.#r.promise;if(u.revert){if(this.state.data===void 0)throw u;return this.state.data}}throw this.#s({type:"error",error:u}),this.#n.config.onError?.(u,this),this.#n.config.onSettled?.(this.state.data,u,this),u}finally{this.scheduleGc()}}#s(e){const t=n=>{switch(e.type){case"failed":return{...n,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...tq(n.data,this.options),fetchMeta:e.meta??null};case"success":const r={...n,...zM(e.data,e.dataUpdatedAt),dataUpdateCount:n.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#t=e.manual?r:void 0,r;case"error":const s=e.error;return{...n,error:s,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...e.state}}};this.state=t(this.state),_n.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),this.#n.notify({query:this,type:"updated",action:e})})}};function tq(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:ZF(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function zM(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function UM(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var nq=class extends hd{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=P2(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#a=void 0;#r;#i;#o;#s;#p;#f;#m;#c;#u;#l;#h=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),HM(this.#t,this.options)?this.#d():this.updateResult(),this.#v())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return _2(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return _2(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#j(),this.#t.removeObserver(this)}setOptions(e){const t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Aa(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#w(),this.#t.setOptions(this.options),t._defaulted&&!jg(this.options,t)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const r=this.hasListeners();r&&VM(this.#t,n,this.options,t)&&this.#d(),this.updateResult(),r&&(this.#t!==n||Aa(this.options.enabled,this.#t)!==Aa(t.enabled,this.#t)||Po(this.options.staleTime,this.#t)!==Po(t.staleTime,this.#t))&&this.#x();const s=this.#g();r&&(this.#t!==n||Aa(this.options.enabled,this.#t)!==Aa(t.enabled,this.#t)||s!==this.#l)&&this.#y(s)}getOptimisticResult(e){const t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return xQ(this,n)&&(this.#a=n,this.#i=this.options,this.#r=this.#t.state),n}getCurrentResult(){return this.#a}trackResult(e,t){return new Proxy(e,{get:(n,r)=>(this.trackProp(r),t?.(r),r==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#o.status==="pending"&&this.#o.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(n,r))})}trackProp(e){this.#h.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#d({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#a))}#d(e){this.#w();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(xr)),t}#x(){this.#b();const e=Po(this.options.staleTime,this.#t);if(Bl||this.#a.isStale||!T2(e))return;const n=YF(this.#a.dataUpdatedAt,e)+1;this.#c=El.setTimeout(()=>{this.#a.isStale||this.updateResult()},n)}#g(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#y(e){this.#j(),this.#l=e,!(Bl||Aa(this.options.enabled,this.#t)===!1||!T2(this.#l)||this.#l===0)&&(this.#u=El.setInterval(()=>{(this.options.refetchIntervalInBackground||rT.isFocused())&&this.#d()},this.#l))}#v(){this.#x(),this.#y(this.#g())}#b(){this.#c&&(El.clearTimeout(this.#c),this.#c=void 0)}#j(){this.#u&&(El.clearInterval(this.#u),this.#u=void 0)}createResult(e,t){const n=this.#t,r=this.options,s=this.#a,i=this.#r,l=this.#i,d=e!==n?e.state:this.#n,{state:f}=e;let h={...f},p=!1,x;if(t._optimisticResults){const _=this.hasListeners(),R=!_&&HM(e,t),H=_&&VM(e,n,t,r);(R||H)&&(h={...h,...tq(f.data,e.options)}),t._optimisticResults==="isRestoring"&&(h.fetchStatus="idle")}let{error:y,errorUpdatedAt:w,status:j}=h;x=h.data;let b=!1;if(t.placeholderData!==void 0&&x===void 0&&j==="pending"){let _;s?.isPlaceholderData&&t.placeholderData===l?.placeholderData?(_=s.data,b=!0):_=typeof t.placeholderData=="function"?t.placeholderData(this.#m?.state.data,this.#m):t.placeholderData,_!==void 0&&(j="success",x=O2(s?.data,_,t),p=!0)}if(t.select&&x!==void 0&&!b)if(s&&x===i?.data&&t.select===this.#p)x=this.#f;else try{this.#p=t.select,x=t.select(x),x=O2(s?.data,x,t),this.#f=x,this.#s=null}catch(_){this.#s=_}this.#s&&(y=this.#s,x=this.#f,w=Date.now(),j="error");const C=h.fetchStatus==="fetching",N=j==="pending",k=j==="error",T=N&&C,A=x!==void 0,E={status:j,fetchStatus:h.fetchStatus,isPending:N,isSuccess:j==="success",isError:k,isInitialLoading:T,isLoading:T,data:x,dataUpdatedAt:h.dataUpdatedAt,error:y,errorUpdatedAt:w,failureCount:h.fetchFailureCount,failureReason:h.fetchFailureReason,errorUpdateCount:h.errorUpdateCount,isFetched:h.dataUpdateCount>0||h.errorUpdateCount>0,isFetchedAfterMount:h.dataUpdateCount>d.dataUpdateCount||h.errorUpdateCount>d.errorUpdateCount,isFetching:C,isRefetching:C&&!N,isLoadingError:k&&!A,isPaused:h.fetchStatus==="paused",isPlaceholderData:p,isRefetchError:k&&A,isStale:aT(e,t),refetch:this.refetch,promise:this.#o,isEnabled:Aa(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const _=E.data!==void 0,R=E.status==="error"&&!_,H=W=>{R?W.reject(E.error):_&&W.resolve(E.data)},L=()=>{const W=this.#o=E.promise=P2();H(W)},I=this.#o;switch(I.status){case"pending":e.queryHash===n.queryHash&&H(I);break;case"fulfilled":(R||E.data!==I.value)&&L();break;case"rejected":(!R||E.error!==I.reason)&&L();break}}return E}updateResult(){const e=this.#a,t=this.createResult(this.#t,this.options);if(this.#r=this.#t.state,this.#i=this.options,this.#r.data!==void 0&&(this.#m=this.#t),jg(t,e))return;this.#a=t;const n=()=>{if(!e)return!0;const{notifyOnChangeProps:r}=this.options,s=typeof r=="function"?r():r;if(s==="all"||!s&&!this.#h.size)return!0;const i=new Set(s??this.#h);return this.options.throwOnError&&i.add("error"),Object.keys(this.#a).some(l=>{const u=l;return this.#a[u]!==e[u]&&i.has(u)})};this.#N({listeners:n()})}#w(){const e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;const t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#v()}#N(e){_n.batch(()=>{e.listeners&&this.listeners.forEach(t=>{t(this.#a)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}};function pQ(e,t){return Aa(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function HM(e,t){return pQ(e,t)||e.state.data!==void 0&&_2(e,t,t.refetchOnMount)}function _2(e,t,n){if(Aa(t.enabled,e)!==!1&&Po(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&aT(e,t)}return!1}function VM(e,t,n,r){return(e!==t||Aa(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&aT(e,n)}function aT(e,t){return Aa(t.enabled,e)!==!1&&e.isStaleByTime(Po(t.staleTime,e))}function xQ(e,t){return!jg(e.getCurrentResult(),t)}function Ng(e){return{onFetch:(t,n)=>{const r=t.options,s=t.fetchOptions?.meta?.fetchMore?.direction,i=t.state.data?.pages||[],l=t.state.data?.pageParams||[];let u={pages:[],pageParams:[]},d=0;const f=async()=>{let h=!1;const p=w=>{lQ(w,()=>t.signal,()=>h=!0)},x=QF(t.options,t.fetchOptions),y=async(w,j,b)=>{if(h)return Promise.reject();if(j==null&&w.pages.length)return Promise.resolve(w);const N=(()=>{const P={client:t.client,queryKey:t.queryKey,pageParam:j,direction:b?"backward":"forward",meta:t.options.meta};return p(P),P})(),k=await x(N),{maxPages:T}=t.options,A=b?oQ:iQ;return{pages:A(w.pages,k,T),pageParams:A(w.pageParams,j,T)}};if(s&&i.length){const w=s==="backward",j=w?rq:M2,b={pages:i,pageParams:l},C=j(r,b);u=await y(b,C,w)}else{const w=e??i.length;do{const j=d===0?l[0]??r.initialPageParam:M2(r,u);if(d>0&&j==null)break;u=await y(u,j),d++}while(d<w)}return u};t.options.persister?t.fetchFn=()=>t.options.persister?.(f,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=f}}}function M2(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function rq(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function gQ(e,t){return t?M2(e,t)!=null:!1}function yQ(e,t){return!t||!e.getPreviousPageParam?!1:rq(e,t)!=null}var vQ=class extends nq{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){super.setOptions({...e,behavior:Ng()})}getOptimisticResult(e){return e.behavior=Ng(),super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){const{state:n}=e,r=super.createResult(e,t),{isFetching:s,isRefetching:i,isError:l,isRefetchError:u}=r,d=n.fetchMeta?.fetchMore?.direction,f=l&&d==="forward",h=s&&d==="forward",p=l&&d==="backward",x=s&&d==="backward";return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:gQ(t,n.data),hasPreviousPage:yQ(t,n.data),isFetchNextPageError:f,isFetchingNextPage:h,isFetchPreviousPageError:p,isFetchingPreviousPage:x,isRefetchError:u&&!f&&!p,isRefetching:i&&!h&&!x}}},bQ=class extends eq{#e;#t;#n;#a;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||aq(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#n.remove(this))}continue(){return this.#a?.continue()??this.execute(this.state.variables)}async execute(e){const t=()=>{this.#r({type:"continue"})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#a=JF({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(new Error("No mutationFn found")),onFail:(i,l)=>{this.#r({type:"failed",failureCount:i,error:l})},onPause:()=>{this.#r({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});const r=this.state.status==="pending",s=!this.#a.canStart();try{if(r)t();else{this.#r({type:"pending",variables:e,isPaused:s}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);const l=await this.options.onMutate?.(e,n);l!==this.state.context&&this.#r({type:"pending",context:l,variables:e,isPaused:s})}const i=await this.#a.start();return await this.#n.config.onSuccess?.(i,e,this.state.context,this,n),await this.options.onSuccess?.(i,e,this.state.context,n),await this.#n.config.onSettled?.(i,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(i,null,e,this.state.context,n),this.#r({type:"success",data:i}),i}catch(i){try{await this.#n.config.onError?.(i,e,this.state.context,this,n)}catch(l){Promise.reject(l)}try{await this.options.onError?.(i,e,this.state.context,n)}catch(l){Promise.reject(l)}try{await this.#n.config.onSettled?.(void 0,i,this.state.variables,this.state.context,this,n)}catch(l){Promise.reject(l)}try{await this.options.onSettled?.(void 0,i,e,this.state.context,n)}catch(l){Promise.reject(l)}throw this.#r({type:"error",error:i}),i}finally{this.#n.runNext(this)}}#r(e){const t=n=>{switch(e.type){case"failed":return{...n,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...n,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:e.error,failureCount:n.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=t(this.state),_n.batch(()=>{this.#t.forEach(n=>{n.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:"updated",action:e})})}};function aq(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var jQ=class extends hd{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){const r=new bQ({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);const t=px(e);if(typeof t=="string"){const n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#e.delete(e)){const t=px(e);if(typeof t=="string"){const n=this.#t.get(t);if(n)if(n.length>1){const r=n.indexOf(e);r!==-1&&n.splice(r,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=px(e);if(typeof t=="string"){const r=this.#t.get(t)?.find(s=>s.state.status==="pending");return!r||r===e}else return!0}runNext(e){const t=px(e);return typeof t=="string"?this.#t.get(t)?.find(r=>
9r!==e&&r.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){_n.batch(()=>{this.#e.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){const t={exact:!0,...e};return this.getAll().find(n=>FM(t,n))}findAll(e={}){return this.getAll().filter(t=>FM(e,t))}notify(e){_n.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(t=>t.state.isPaused);return _n.batch(()=>Promise.all(e.map(t=>t.continue().catch(xr))))}};function px(e){return e.options.scope?.id}var wQ=class extends hd{#e;#t=void 0;#n;#a;constructor(t,n){super(),this.#e=t,this.setOptions(n),this.bindMethods(),this.#r()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){const n=this.options;this.options=this.#e.defaultMutationOptions(t),jg(this.options,n)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#n,observer:this}),n?.mutationKey&&this.options.mutationKey&&zl(n.mutationKey)!==zl(this.options.mutationKey)?this.reset():this.#n?.state.status==="pending"&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(t){this.#r(),this.#i(t)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#r(),this.#i()}mutate(t,n){return this.#a=n,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(t)}#r(){const t=this.#n?.state??aq();this.#t={...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset}}#i(t){_n.batch(()=>{if(this.#a&&this.hasListeners()){const n=this.#t.variables,r=this.#t.context,s={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(t?.type==="success"){try{this.#a.onSuccess?.(t.data,n,r,s)}catch(i){Promise.reject(i)}
vendor: 5,448 bytes, line 9
9try{this.#a.onSettled?.(t.data,null,n,r,s)}catch(i){Promise.reject(i)}}else if(t?.type==="error"){try{this.#a.onError?.(t.error,n,r,s)}catch(i){Promise.reject(i)}try{this.#a.onSettled?.(void 0,t.error,n,r,s)}catch(i){Promise.reject(i)}}}this.listeners.forEach(n=>{n(this.#t)})})}},NQ=class extends hd{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){const r=t.queryKey,s=t.queryHash??eT(r,t);let i=this.get(s);return i||(i=new hQ({client:e,queryKey:r,queryHash:s,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(i)),i}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){_n.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){const t={exact:!0,...e};return this.getAll().find(n=>LM(t,n))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(n=>LM(e,n)):t}notify(e){_n.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){_n.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){_n.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},SQ=class{#e;#t;#n;#a;#r;#i;#o;#s;constructor(e={}){this.#e=e.queryCache||new NQ,this.#t=e.mutationCache||new jQ,this.#n=e.defaultOptions||{},this.#a=new Map,this.#r=new Map,this.#i=0}mount(){this.#i++,this.#i===1&&(this.#o=rT.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=wg.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#i--,this.#i===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#t.findAll({...e,status:"pending"}).length}getQueryData(e){const t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Po(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,l=rQ(t,i);if(l!==void 0)return this.#e.build(this,r).setData(l,{...n,manual:!0})}setQueriesData(e,t,n){return _n.batch(()=>this.#e.findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){const t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){const t=this.#e;_n.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=this.#e;return _n.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=_n.batch(()=>this.#e.findAll(e).map(s=>s.cancel(n)));return Promise.all(r).then(xr).catch(xr)}invalidateQueries(e,t={}){return _n.batch(()=>(this.#e.findAll(e).forEach(n=>{n.invalidate()}),e?.refetchType==="none"?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=_n.batch(()=>this.#e.findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let i=s.fetch(void 0,n);return n.throwOnError||(i=i.catch(xr)),s.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(xr)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=this.#e.build(this,t);return n.isStaleByTime(Po(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(xr).catch(xr)}fetchInfiniteQuery(e){return e.behavior=Ng(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(xr).catch(xr)}ensureInfiniteQueryData(e){return e.behavior=Ng(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return wg.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#a.set(zl(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#a.values()],n={};return t.forEach(r=>{Cm(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){this.#r.set(zl(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#r.values()],n={};return t.forEach(r=>{Cm(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=eT(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===tT&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},sq=v.createContext(void 0),wt=e=>{const t=v.useContext(sq);
9if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},CQ=({client:e,children:t})=>(v.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),a.jsx(sq.Provider,{value:e,children:t})),iq=v.createContext(!1),AQ=()=>v.useContext(iq);iq.Provider;function TQ(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var kQ=v.createContext(TQ()),OQ=()=>v.useContext(kQ),PQ=(e,t,n)=>{const r=n?.state.error&&typeof e.throwOnError=="function"?nT(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},EQ=e=>{v.useEffect(()=>{e.clearReset()},[e])},_Q=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(s&&e.data===void 0||nT(n,[e.error,r])),MQ=e=>{if(e.suspense){const n=s=>s==="static"?s:Math.max(s??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...s)=>n(r(...s)):n(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},RQ=(e,t)=>e.isLoading&&e.isFetching&&!t,DQ=(e,t)=>e?.suspense&&t.isPending,GM=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function oq(e,t,n){const r=AQ(),s=OQ(),i=wt(),l=i.defaultQueryOptions(e);i.getDefaultOptions().queries?._experimental_beforeQuery?.(l);const u=i.getQueryCache().get(l.queryHash);l._optimisticResults=r?"isRestoring":"optimistic",MQ(l),PQ(l,s,u),EQ(s);const d=!i.getQueryCache().get(l.queryHash),[f]=v.useState(()=>new t(i,l)),h=f.getOptimisticResult(l),p=!r&&e.subscribed!==!1;if(v.useSyncExternalStore(v.useCallback(x=>{const y=p?f.subscribe(_n.batchCalls(x)):xr;return f.updateResult(),y},[f,p]),()=>f.getCurrentResult(),()=>f.getCurrentResult()),v.useEffect(()=>{f.setOptions(l)},[l,f]),DQ(l,h))throw GM(l,f,s);if(_Q({result:h,errorResetBoundary:s,throwOnError:l.throwOnError,query:u,suspense:l.suspense}))throw h.error;return i.getDefaultOptions().queries?._experimental_afterQuery?.(l,h),l.experimental_prefetchInRender&&!Bl&&RQ(h,r)&&(d?GM(l,f,s):u?.promise)?.catch(xr).finally(()=>{f.updateResult()}),l.notifyOnChangeProps?h:f.trackResult(h)}function Xe(e,t){return oq(e,nq)}function nt(e,t){const n=wt(),[r]=v.useState(()=>new wQ(n,e));v.useEffect(()=>{r.setOptions(e)},[r,e]);const s=v.useSyncExternalStore(v.useCallback(l=>r.subscribe(_n.batchCalls(l)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),i=v.useCallback((l,u)=>{r.mutate(l,u).catch(xr)},[r]);if(s.error&&nT(r.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:i,mutateAsync:s.mutate}}function $Q(e,t){return oq(e,vQ)}const IQ=1,LQ=1e6;let kj=0;function FQ(){return kj=(kj+1)%Number.MAX_SAFE_INTEGER,kj.toString()}const Oj=new Map,KM=e=>{if(Oj.has(e))return;const t=setTimeout(()=>{Oj.delete(e),mm({type:"REMOVE_TOAST",toastId:e})},LQ);Oj.set(e,t)},qQ=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,IQ)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(n=>n.id===t.toast.id?{...n,...t.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=t;return n?KM(n):e.toasts.forEach(r=>{KM(r.id)}),{...e,toasts:e.toasts.map(r=>r.id===n||n===void 0?{...r,open:!1}:r)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(n=>n.id!==t.toastId)}}},tg=[];let ng={toasts:[]};function mm(e){ng=qQ(ng,e),tg.forEach(t=>{t(ng)})}function BQ({...e}){const t=FQ(),n=s=>mm({type:"UPDATE_TOAST",toast:{...s,id:t}}),r=()=>mm({type:"DISMISS_TOAST",toastId:t});return mm({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:s=>{s||r()}}}),{id:t,dismiss:r,update:n}}function nr(){const[e,t]=v.useState(ng);return v.useEffect(()=>
vendor: 9,117 bytes, line 9
9(tg.push(t),()=>{const n=tg.indexOf(t);n>-1&&tg.splice(n,1)}),[e]),{...e,toast:BQ,dismiss:n=>mm({type:"DISMISS_TOAST",toastId:n})}}var pd=LF();const zQ=Bt(pd);function Re(e,t,{checkForDefaultPrevented:n=!0}={}){return function(s){if(e?.(s),n===!1||!s.defaultPrevented)return t?.(s)}}function WM(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Ms(...e){return t=>{let n=!1;const r=e.map(s=>{const i=WM(s,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let s=0;s<r.length;s++){const i=r[s];typeof i=="function"?i():WM(e[s],null)}}}}function it(...e){return v.useCallback(Ms(...e),e)}function UQ(e,t){const n=v.createContext(t),r=i=>{const{children:l,...u}=i,d=v.useMemo(()=>u,Object.values(u));return a.jsx(n.Provider,{value:d,children:l})};r.displayName=e+"Provider";function s(i){const l=v.useContext(n);if(l)return l;if(t!==void 0)return t;throw new Error(`\`${i}\` must be used within \`${e}\``)}return[r,s]}function Sr(e,t=[]){let n=[];function r(i,l){const u=v.createContext(l),d=n.length;n=[...n,l];const f=p=>{const{scope:x,children:y,...w}=p,j=x?.[e]?.[d]||u,b=v.useMemo(()=>w,Object.values(w));return a.jsx(j.Provider,{value:b,children:y})};f.displayName=i+"Provider";function h(p,x){const y=x?.[e]?.[d]||u,w=v.useContext(y);if(w)return w;if(l!==void 0)return l;throw new Error(`\`${p}\` must be used within \`${i}\``)}return[f,h]}const s=()=>{const i=n.map(l=>v.createContext(l));return function(u){const d=u?.[e]||i;return v.useMemo(()=>({[`__scope${e}`]:{...u,[e]:d}}),[u,d])}};return s.scopeName=e,[r,HQ(s,...t)]}function HQ(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(i){const l=r.reduce((u,{useScope:d,scopeName:f})=>{const p=d(i)[`__scope${f}`];return{...u,...p}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:l}),[l])}};return n.scopeName=t.scopeName,n}function Ul(e){const t=VQ(e),n=v.forwardRef((r,s)=>{const{children:i,...l}=r,u=v.Children.toArray(i),d=u.find(GQ);if(d){const f=d.props.children,h=u.map(p=>p===d?v.Children.count(f)>1?v.Children.only(null):v.isValidElement(f)?f.props.children:null:p);return a.jsx(t,{...l,ref:s,children:v.isValidElement(f)?v.cloneElement(f,void 0,h):null})}return a.jsx(t,{...l,ref:s,children:i})});return n.displayName=`${e}.Slot`,n}function VQ(e){const t=v.forwardRef((n,r)=>{const{children:s,...i}=n;if(v.isValidElement(s)){const l=WQ(s),u=KQ(i,s.props);return s.type!==v.Fragment&&(u.ref=r?Ms(r,l):l),v.cloneElement(s,u)}return v.Children.count(s)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var lq=Symbol("radix.slottable");function cq(e){const t=({children:n})=>a.jsx(a.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=lq,t}function GQ(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===lq}function KQ(e,t){const n={...t};for(const r in t){const s=e[r],i=t[r];/^on[A-Z]/.test(r)?s&&i?n[r]=(...u)=>{const d=i(...u);return s(...u),d}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...e,...n}}function WQ(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function iv(e){const t=e+"CollectionProvider",[n,r]=Sr(t),[s,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),l=j=>{const{scope:b,children:C}=j,N=ie.useRef(null),k=ie.useRef(new Map).current;return a.jsx(s,{scope:b,itemMap:k,collectionRef:N,children:C})};l.displayName=t;const u=e+"CollectionSlot",d=Ul(u),f=ie.forwardRef((j,b)=>{const{scope:C,children:N}=j,k=i(u,C),T=it(b,k.collectionRef);return a.jsx(d,{ref:T,children:N})});f.displayName=u;const h=e+"CollectionItemSlot",p="data-radix-collection-item",x=Ul(h),y=ie.forwardRef((j,b)=>{const{scope:C,children:N,...k}=j,T=ie.useRef(null),A=it(b,T),P=i(h,C);return ie.useEffect(()=>(P.itemMap.set(T,{ref:T,...k}),()=>{P.itemMap.delete(T)})),a.jsx(x,{[p]:"",ref:A,children:N})});y.displayName=h;function w(j){const b=i(e+"CollectionConsumer",j);return ie.useCallback(()=>{const N=b.collectionRef.current;if(!N)return[];const k=Array.from(N.querySelectorAll(`[${p}]`));return Array.from(b.itemMap.values()).sort((P,E)=>k.indexOf(P.ref.current)-k.indexOf(E.ref.current))},[b.collectionRef,b.itemMap])}return[{Provider:l,Slot:f,ItemSlot:y},w,r]}var YQ=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],We=YQ.reduce((e,t)=>{const n=Ul(`Primitive.${t}`),r=v.forwardRef((s,i)=>{const{asChild:l,...u}=s,d=l?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(d,{...u,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function sT(e,t){e&&pd.flushSync(()=>e.dispatchEvent(t))}function hn(e){const t=v.useRef(e);return v.useEffect(()=>{t.current=e}),v.useMemo(()=>(...n)=>t.current?.(...n),[])}function XQ(e,t=globalThis?.document){const n=hn(e);v.useEffect(()=>{const r=s=>{s.key==="Escape"&&n(s)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var QQ="DismissableLayer",R2="dismissableLayer.update",ZQ="dismissableLayer.pointerDownOutside",JQ="dismissableLayer.focusOutside",YM,uq=v.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),nc=v.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:i,onInteractOutside:l,onDismiss:u,...d}=e,f=v.useContext(uq),[h,p]=v.useState(null),x=h?.ownerDocument??globalThis?.document,[,y]=v.useState({}),w=it(t,E=>p(E)),j=Array.from(f.layers),[b]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),C=j.indexOf(b),N=h?j.indexOf(h):-1,k=f.layersWithOutsidePointerEventsDisabled.size>0,T=N>=C,A=tZ(E=>{const _=E.target,R=[...f.branches].some(H=>H.contains(_));!T||R||(s?.(E),l?.(E),E.defaultPrevented||u?.())},x),P=nZ(E=>{const _=E.target;[...f.branches].some(H=>H.contains(_))||(i?.(E),l?.(E),E.defaultPrevented||u?.())},x);return XQ(E=>{N===f.layers.size-1&&(r?.(E),!E.defaultPrevented&&u&&(E.preventDefault(),u()))},x),v.useEffect(()=>{if(h)return n&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(YM=x.body.style.pointerEvents,x.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(h)),f.layers.add(h),XM(),()=>{n&&f.layersWithOutsidePointerEventsDisabled.size===1&&(x.body.style.pointerEvents=YM)}},[h,x,n,f]),v.useEffect(()=>()=>{h&&(f.layers.delete(h),f.layersWithOutsidePointerEventsDisabled.delete(h),XM())},[h,f]),v.useEffect(()=>{const E=()=>y({});return document.addEventListener(R2,E),()=>document.removeEventListener(R2,E)},[]),a.jsx(We.div,{...d,ref:w,style:{pointerEvents:k?T?"auto":"none":void 0,...e.style},onFocusCapture:Re(e.onFocusCapture,P.onFocusCapture),onBlurCapture:Re(e.onBlurCapture,P.onBlurCapture),onPointerDownCapture:Re(e.onPointerDownCapture,A.onPointerDownCapture)})});nc.displayName=QQ;var eZ="DismissableLayerBranch",dq=v.forwardRef((e,t)=>{const n=v.useContext(uq),r=v.useRef(null),s=it(t,r);return v.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),a.jsx(We.div,{...e,ref:s})});dq.displayName=eZ;function tZ(e,t=globalThis?.document){const n=hn(e),r=v.useRef(!1),s=v.useRef(()=>{});return v.useEffect(()=>{const i=u=>{if(u.target&&!r.current){let d=function(){fq(ZQ,n,f,{discrete:!0})};const f={originalEvent:u};u.pointerType==="touch"?(t.removeEventListener("click",s.current),s.current=d,t.addEventListener("click",s.current,{once:!0})):d()}else t.removeEventListener("click",s.current);r.current=!1},l=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(l),t.removeEventListener("pointerdown",i),t.removeEventListener("click",s.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function nZ(e,t=globalThis?.document){const n=hn(e),r=v.useRef(!1);return v.useEffect(()=>{const s=i=>{i.target&&!r.current&&fq(JQ,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function XM(){const e=new CustomEvent(R2);document.dispatchEvent(e)}function fq(e,t,n,{discrete:r}){const s=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&s.addEventListener(e,t,{once:!0}),r?sT(s,i):s.dispatchEvent(i)}var rZ=nc,aZ=dq,Un=globalThis?.document?v.useLayoutEffect:()=>{},sZ="Portal",rc=v.forwardRef((e,t)=>{const{container:n,...r}=e,[s,i]=v.useState(!1);Un(()=>i(!0),[]);const l=n||s&&globalThis?.document?.body;return l?zQ.createPortal(a.jsx(We.div,{...r,ref:t}),l):null});rc.displayName=sZ;function iZ(e,t){return v.useReducer((n,r)=>t[n][r]??n,e)}var Rn=e=>{const{present:t,children:n}=e,r=oZ(t),s=typeof n=="function"?n({present:r.isPresent}):v.Children.only(n),i=it(r.ref,lZ(s));return typeof n=="function"||r.isPresent?v.cloneElement(s,{ref:i}
9):null};Rn.displayName="Presence";function oZ(e){const[t,n]=v.useState(),r=v.useRef(null),s=v.useRef(e),i=v.useRef("none"),l=e?"mounted":"unmounted",[u,d]=iZ(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return v.useEffect(()=>{const f=xx(r.current);i.current=u==="mounted"?f:"none"},[u]),Un(()=>{const f=r.current,h=s.current;if(h!==e){const x=i.current,y=xx(f);e?d("MOUNT"):y==="none"||f?.display==="none"?d("UNMOUNT"):d(h&&x!==y?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,d]),Un(()=>{if(t){let f;const h=t.ownerDocument.defaultView??window,p=y=>{const j=xx(r.current).includes(CSS.escape(y.animationName));if(y.target===t&&j&&(d("ANIMATION_END"),!s.current)){const b=t.style.animationFillMode;t.style.animationFillMode="forwards",f=h.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=b)})}},x=y=>{y.target===t&&(i.current=xx(r.current))};return t.addEventListener("animationstart",x),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{h.clearTimeout(f),t.removeEventListener("animationstart",x),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else d("ANIMATION_END")},[t,d]),{isPresent:["mounted","unmountSuspended"].includes(u),ref:v.useCallback(f=>{r.current=f?getComputedStyle(f):null,n(f)},[])}}function xx(e){return e?.animationName||"none"}function lZ(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var cZ=av[" useInsertionEffect ".trim().toString()]||Un;function Rs({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[s,i,l]=uZ({defaultProp:t,onChange:n}),u=e!==void 0,d=u?e:s;{const h=v.useRef(e!==void 0);v.useEffect(()=>{const p=h.current;p!==u&&console.warn(`${r} is changing from ${p?"controlled":"uncontrolled"} to ${u?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),h.current=u},[u,r])}const f=v.useCallback(h=>{if(u){const p=dZ(h)?h(e):h;p!==e&&l.current?.(p)}else i(h)},[u,e,i,l]);return[d,f]}function uZ({defaultProp:e,onChange:t}){const[n,r]=v.useState(e),s=v.useRef(n),i=v.useRef(t);return cZ(()=>{i.current=t},[t]),v.useEffect(()=>{s.current!==n&&(i.current?.(n),s.current=n)},[n,s]),[n,r,i]}function dZ(e){return typeof e=="function"}var mq=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),fZ="VisuallyHidden",ov=v.forwardRef((e,t)=>a.jsx(We.span,{...e,ref:t,style:{...mq,...e.style}}));ov.displayName=fZ;var mZ=ov,iT="ToastProvider",[oT,hZ,pZ]=iv("Toast"),[hq]=Sr("Toast",[pZ]),[xZ,lv]=hq(iT),pq=e=>{const{__scopeToast:t,label:n="Notification",duration:r=5e3,swipeDirection:s="right",swipeThreshold:i=50,children:l}=e,[u,d]=v.useState(null),[f,h]=v.useState(0),p=v.useRef(!1),x=v.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${iT}\`. Expected non-empty \`string\`.`),a.jsx(oT.Provider,{scope:t,children:a.jsx(xZ,{scope:t,label:n,duration:r,swipeDirection:s,swipeThreshold:i,toastCount:f,viewport:u,onViewportChange:d,onToastAdd:v.useCallback(()=>h(y=>y+1),[]),onToastRemove:v.useCallback(()=>h(y=>y-1),[]),isFocusedToastEscapeKeyDownRef:p,isClosePausedRef:x,children:l})})};pq.displayName=iT;var xq="ToastViewport",gZ=["F8"],D2="toast.viewportPause",$2="toast.viewportResume",gq=v.forwardRef((e,t)=>{const{__scopeToast:n,hotkey:r=gZ,label:s="Notifications ({hotkey})",...i}=e,l=lv(xq,n),u=hZ(n),d=v.useRef(null),f=v.useRef(null),h=v.useRef(null),p=v.useRef(null),x=it(t,p,l.onViewportChange),y=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),w=l.toastCount>0;v.useEffect(()=>{const b=C=>{r.length!==0&&r.every(k=>C[k]||C.code===k)&&p.current?.focus()};return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[r]),v.useEffect(()=>{const b=d.current,C=p.current;if(w&&b&&C){const N=()=>
9{if(!l.isClosePausedRef.current){const P=new CustomEvent(D2);C.dispatchEvent(P),l.isClosePausedRef.current=!0}},k=()=>{if(l.isClosePausedRef.current){const P=new CustomEvent($2);C.dispatchEvent(P),l.isClosePausedRef.current=!1}},T=P=>{!b.contains(P.relatedTarget)&&k()},A=()=>{b.contains(document.activeElement)||k()};return b.addEventListener("focusin",N),b.addEventListener("focusout",T),b.addEventListener("pointermove",N),b.addEventListener("pointerleave",A),window.addEventListener("blur",N),window.addEventListener("focus",k),()=>{b.removeEventListener("focusin",N),b.removeEventListener("focusout",T),b.removeEventListener("pointermove",N),b.removeEventListener("pointerleave",A),window.removeEventListener("blur",N),window.removeEventListener("focus",k)}}},[w,l.isClosePausedRef]);const j=v.useCallback(({tabbingDirection:b})=>{const N=u().map(k=>{const T=k.ref.current,A=[T,...PZ(T)];return b==="forwards"?A:A.reverse()});return(b==="forwards"?N.reverse():N).flat()},[u]);return v.useEffect(()=>{const b=p.current;if(b){const C=N=>{const k=N.altKey||N.ctrlKey||N.metaKey;if(N.key==="Tab"&&!k){const A=document.activeElement,P=N.shiftKey;if(N.target===b&&P){f.current?.focus();return}const R=j({tabbingDirection:P?"backwards":"forwards"}),H=R.findIndex(L=>L===A);Pj(R.slice(H+1))?N.preventDefault():P?f.current?.focus():h.current?.focus()}};return b.addEventListener("keydown",C),()=>b.removeEventListener("keydown",C)}},[u,j]),a.jsxs(aZ,{ref:d,role:"region","aria-label":s.replace("{hotkey}",y),tabIndex:-1,style:{pointerEvents:w?void 0:"none"},children:[w&&a.jsx(I2,{ref:f,onFocusFromOutsideViewport:()=>{const b=j({tabbingDirection:"forwards"});Pj(b)}}),a.jsx(oT.Slot,{scope:n,children:a.jsx(We.ol,{tabIndex:-1,...i,ref:x})}),w&&a.jsx(I2,{ref:h,onFocusFromOutsideViewport:()=>{const b=j({tabbingDirection:"backwards"});Pj(b)}})]})});gq.displayName=xq;var yq="ToastFocusProxy",I2=v.forwardRef((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...s}=e,i=lv(yq,n);return a.jsx(ov,{tabIndex:0,...s,ref:t,style:{position:"fixed"},onFocus:l=>{const u=l.relatedTarget;!i.viewport?.contains(u)&&r()}})});I2.displayName=yq;var wh="Toast",yZ="toast.swipeStart",vZ="toast.swipeMove",bZ="toast.swipeCancel",jZ="toast.swipeEnd",vq=v.forwardRef((e,t)=>{const{forceMount:n,open:r,defaultOpen:s,onOpenChange:i,...l}=e,[u,d]=Rs({prop:r,defaultProp:s??!0,onChange:i,caller:wh});return a.jsx(Rn,{present:n||u,children:a.jsx(SZ,{open:u,...l,ref:t,onClose:()=>d(!1),onPause:hn(e.onPause),onResume:hn(e.onResume),onSwipeStart:Re(e.onSwipeStart,f=>{f.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:Re(e.onSwipeMove,f=>{const{x:h,y:p}=f.detail.delta;f.currentTarget.setAttribute("data-swipe","move"),f.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${h}px`),f.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${p}px`)}),onSwipeCancel:Re(e.onSwipeCancel,f=>{f.currentTarget.setAttribute("data-swipe","cancel"),f.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),f.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),f.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),f.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:Re(e.onSwipeEnd,f=>{const{x:h,y:p}=f.detail.delta;f.currentTarget.setAttribute("data-swipe","end"),f.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),f.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),f.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${h}px`),f.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${p}px`),d(!1)})})})});vq.displayName=wh;var[wZ,NZ]=hq(wh,{onClose(){}}),SZ=v.forwardRef((e,t)=>{const{__scopeToast:n,type:r="foreground",duration:s,open:i,onClose:l,onEscapeKeyDown:u,onPause:d,onResume:f,onSwipeStart:h,onSwipeMove:p,onSwipeCancel:x,onSwipeEnd:y,...w}=e,j=lv(wh,n),[b,C]=v.useState(null),N=it(t,U=>C(U)),k=v.useRef(null),T=v.useRef(null),A=s||j.duration,P=v.useRef(0),E=v.useRef(A),_=v.useRef(0),{onToastAdd:R,onToastRemove:H}=j,L=hn(()=>{b?.contains(document.activeElement)&&j.viewport?.focus(),l()}),I=v.useCallback(U=>
9{!U||U===1/0||(window.clearTimeout(_.current),P.current=new Date().getTime(),_.current=window.setTimeout(L,U))},[L]);v.useEffect(()=>{const U=j.viewport;if(U){const V=()=>{I(E.current),f?.()},D=()=>{const q=new Date().getTime()-P.current;E.current=E.current-q,window.clearTimeout(_.current),d?.()};return U.addEventListener(D2,D),U.addEventListener($2,V),()=>{U.removeEventListener(D2,D),U.removeEventListener($2,V)}}},[j.viewport,A,d,f,I]),v.useEffect(()=>{i&&!j.isClosePausedRef.current&&I(A)},[i,A,j.isClosePausedRef,I]),v.useEffect(()=>(R(),()=>H()),[R,H]);const W=v.useMemo(()=>b?Aq(b):null,[b]);return j.viewport?a.jsxs(a.Fragment,{children:[W&&a.jsx(CZ,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite",children:W}),a.jsx(wZ,{scope:n,onClose:L,children:pd.createPortal(a.jsx(oT.ItemSlot,{scope:n,children:a.jsx(rZ,{asChild:!0,onEscapeKeyDown:Re(u,()=>{j.isFocusedToastEscapeKeyDownRef.current||L(),j.isFocusedToastEscapeKeyDownRef.current=!1}),children:a.jsx(We.li,{tabIndex:0,"data-state":i?"open":"closed","data-swipe-direction":j.swipeDirection,...w,ref:N,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:Re(e.onKeyDown,U=>{U.key==="Escape"&&(u?.(U.nativeEvent),U.nativeEvent.defaultPrevented||(j.isFocusedToastEscapeKeyDownRef.current=!0,L()))}),onPointerDown:Re(e.onPointerDown,U=>{U.button===0&&(k.current={x:U.clientX,y:U.clientY})}),onPointerMove:Re(e.onPointerMove,U=>{if(!k.current)return;const V=U.clientX-k.current.x,D=U.clientY-k.current.y,q=!!T.current,K=["left","right"].includes(j.swipeDirection),Y=["left","up"].includes(j.swipeDirection)?Math.min:Math.max,z=K?Y(0,V):0,Z=K?0:Y(0,D),F=U.pointerType==="touch"?10:2,B={x:z,y:Z},X={originalEvent:U,delta:B};q?(T.current=B,gx(vZ,p,X,{discrete:!1})):QM(B,j.swipeDirection,F)?(T.current=B,gx(yZ,h,X,{discrete:!1}),U.target.setPointerCapture(U.pointerId)):(Math.abs(V)>F||Math.abs(D)>F)&&(k.current=null)}),onPointerUp:Re(e.onPointerUp,U=>{const V=T.current,D=U.target;if(D.hasPointerCapture(U.pointerId)&&D.releasePointerCapture(U.pointerId),T.current=null,k.current=null,V){const q=U.currentTarget,K={originalEvent:U,delta:V};QM(V,j.swipeDirection,j.swipeThreshold)?gx(jZ,y,K,{discrete:!0}):gx(bZ,x,K,{discrete:!0}),q.addEventListener("click",Y=>Y.preventDefault(),{once:!0})}})})})}),j.viewport)})]}):null}),CZ=e=>{const{__scopeToast:t,children:n,...r}=e,s=lv(wh,t),[i,l]=v.useState(!1),[u,d]=v.useState(!1);return kZ(()=>l(!0)),v.useEffect(()=>{const f=window.setTimeout(()=>d(!0),1e3);return()=>window.clearTimeout(f)},[]),u?null:a.jsx(rc,{asChild:!0,children:a.jsx(ov,{...r,children:i&&a.jsxs(a.Fragment,{children:[s.label," ",n]})})})},AZ="ToastTitle",bq=v.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return a.jsx(We.div,{...r,ref:t})});bq.displayName=AZ;var TZ="ToastDescription",jq=v.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return a.jsx(We.div,{...r,ref:t})});jq.displayName=TZ;var wq="ToastAction",Nq=v.forwardRef((e,t)=>{const{altText:n,...r}=e;return n.trim()?a.jsx(Cq,{altText:n,asChild:!0,children:a.jsx(lT,{...r,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${wq}\`. Expected non-empty \`string\`.`),null)});Nq.displayName=wq;var Sq="ToastClose",lT=v.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e,s=NZ(Sq,n);return a.jsx(Cq,{asChild:!0,children:a.jsx(We.button,{type:"button",...r,ref:t,onClick:Re(e.onClick,s.onClose)})})});lT.displayName=Sq;var Cq=v.forwardRef((e,t)=>{const{__scopeToast:n,altText:r,...s}=e;return a.jsx(We.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...s,ref:t})});function Aq(e){const t=[];return Array.from(e.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&t.push(r.textContent),OZ(r)){const s=r.ariaHidden||r.hidden||r.style.display==="none",i=r.dataset.radixToastAnnounceExclude==="";if(!s)if(i){const l=r.dataset.radixToastAnnounceAlt;l&&t.push(l)}else t.push(...Aq(r))}}),t}function gx(e,t,n,{discrete:r}){const s=n.originalEvent.currentTarget,i=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&s.addEventListener(e,t,{once:!0}),r?sT(s,i):s.dispatchEvent(i)}var QM=(e,t,n=0)=>{const r=Math.abs(e.x),s=Math.abs(e.y),i=r>s;return t==="left"||t==="right"?i&&r>n:!i&&s>n};function kZ(e=()=>{}){const t=hn(e);Un(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[t])}
vendor: 4,346 bytes, line 9
9function OZ(e){return e.nodeType===e.ELEMENT_NODE}function PZ(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Pj(e){const t=document.activeElement;return e.some(n=>n===t?!0:(n.focus(),document.activeElement!==t))}var EZ=pq,Tq=gq,kq=vq,Oq=bq,Pq=jq,Eq=Nq,_q=lT;function Mq(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(n=Mq(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function yt(){for(var e,t,n=0,r="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=Mq(e))&&(r&&(r+=" "),r+=t);return r}const ZM=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,JM=yt,cv=(e,t)=>n=>{var r;if(t?.variants==null)return JM(e,n?.class,n?.className);const{variants:s,defaultVariants:i}=t,l=Object.keys(s).map(f=>{const h=n?.[f],p=i?.[f];if(h===null)return null;const x=ZM(h)||ZM(p);return s[f][x]}),u=n&&Object.entries(n).reduce((f,h)=>{let[p,x]=h;return x===void 0||(f[p]=x),f},{}),d=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((f,h)=>{let{class:p,className:x,...y}=h;return Object.entries(y).every(w=>{let[j,b]=w;return Array.isArray(b)?b.includes({...i,...u}[j]):{...i,...u}[j]===b})?[...f,p,x]:f},[]);return JM(e,l,d,n?.class,n?.className)};const _Z=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),MZ=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),e3=e=>{const t=MZ(e);return t.charAt(0).toUpperCase()+t.slice(1)},Rq=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),RZ=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var DZ={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const $Z=v.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:s="",children:i,iconNode:l,...u},d)=>v.createElement("svg",{ref:d,...DZ,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:Rq("lucide",s),...!i&&!RZ(u)&&{"aria-hidden":"true"},...u},[...l.map(([f,h])=>v.createElement(f,h)),...Array.isArray(i)?i:[i]]));const je=(e,t)=>{const n=v.forwardRef(({className:r,...s},i)=>v.createElement($Z,{ref:i,iconNode:t,className:Rq(`lucide-${_Z(e3(e))}`,`lucide-${e}`,r),...s}));return n.displayName=e3(e),n};const IZ=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],rg=je("arrow-down",IZ);const LZ=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],Sg=je("arrow-left",LZ);const FZ=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Ru=je("arrow-right",FZ);const qZ=[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]],BZ=je("arrow-up-down",qZ);const zZ=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],UZ=je("arrow-up-right",zZ);const HZ=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],VZ=je("arrow-up",HZ);const GZ=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]],KZ=je("at-sign",GZ);const WZ=[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8",key:"1h4pet"}],["path",{d:"M12 18V6",key:"zqpxq5"}]],YZ=je("badge-dollar-sign",WZ);const XZ=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],QZ=je("bell",XZ);const ZZ=[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}],["line",{x1:"12",x2:"12",y1:"7",y2:"13",key:"1cppfj"}],["line",{x1:"15",x2:"9",y1:"10",y2:"10",key:"1gty7f"}
9]],t3=je("bookmark-plus",ZZ);const JZ=[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]],eJ=je("boxes",JZ);const tJ=[["path",{d:"M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16",key:"jecpp"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]],rs=je("briefcase",tJ);const nJ=[["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"}]],xd=je("building-2",nJ);const rJ=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]],Ma=je("calendar-days",rJ);const aJ=[["path",{d:"M16 19h6",key:"xwg31i"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M19 16v6",key:"tddt3s"}],["path",{d:"M21 12.598V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h8.5",key:"1glfrc"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}]],sJ=je("calendar-plus",aJ);const iJ=[["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"}]],Nh=je("calendar",iJ);const oJ=[["path",{d:"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z",key:"18u6gg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]],lJ=je("camera",oJ);const cJ=[["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"}]],uJ=je("chart-column",cJ);const dJ=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],ac=je("check",dJ);const fJ=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Nr=je("chevron-down",fJ);const mJ=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Dq=je("chevron-left",mJ);const hJ=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],wr=je("chevron-right",hJ);const pJ=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Sh=je("chevron-up",pJ);const xJ=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],gJ=je("chevrons-up-down",xJ);const yJ=[["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"}]],rn=je("circle-alert",yJ);const vJ=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],st=je("circle-check",vJ);const bJ=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Cg=je("circle-check-big",bJ);const jJ=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662",key:"154egf"}]],$q=je("circle-user",jJ);const wJ=[["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"}]],cT=je("circle-x",wJ);const NJ=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],SJ=je("circle",NJ);
9const CJ=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"m9 14 2 2 4-4",key:"df797q"}]],Am=je("clipboard-check",CJ);const AJ=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]],Rr=je("clipboard-list",AJ);const TJ=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Dr=je("clock",TJ);const kJ=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],OJ=je("copy",kJ);const PJ=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5v14a9 3 0 0 0 18 0V5",key:"aqi0yr"}]],Tm=je("cylinder",PJ);const EJ=[["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"}]],Ro=je("dollar-sign",EJ);const _J=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],MJ=je("download",_J);const RJ=[["path",{d:"M7 16.3c2.2 0 4-1.83 4-4.05 0-1.16-.57-2.26-1.71-3.19S7.29 6.75 7 5.3c-.29 1.45-1.14 2.84-2.29 3.76S3 11.1 3 12.25c0 2.22 1.8 4.05 4 4.05z",key:"1ptgy4"}],["path",{d:"M12.56 6.6A10.97 10.97 0 0 0 14 3.02c.5 2.5 2 4.9 4 6.5s3 3.5 3 5.5a6.98 6.98 0 0 1-11.91 4.97",key:"1sl1rz"}]],yx=je("droplets",RJ);const DJ=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],$J=je("ellipsis",DJ);const IJ=[["path",{d:"M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21",key:"g5wo59"}],["path",{d:"m5.082 11.09 8.828 8.828",key:"1wx5vj"}]],n3=je("eraser",IJ);const LJ=[["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"}]],hm=je("external-link",LJ);const FJ=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],Iq=je("eye-off",FJ);const qJ=[["path",{d:"M12 16h.01",key:"1drbdi"}],["path",{d:"M16 16h.01",key:"1f9h7w"}],["path",{d:"M3 19a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8.5a.5.5 0 0 0-.769-.422l-4.462 2.844A.5.5 0 0 1 15 10.5v-2a.5.5 0 0 0-.769-.422L9.77 10.922A.5.5 0 0 1 9 10.5V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2z",key:"1iv0i2"}],["path",{d:"M8 16h.01",key:"18s6g9"}]],uT=je("factory",qJ);const BJ=[["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"}]],zJ=je("eye",BJ);const UJ=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M12 18v-6",key:"17g6i2"}],["path",{d:"m9 15 3 3 3-3",key:"1npd3o"}]],HJ=je("file-down",UJ);const VJ=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M8 13h2",key:"yr2amv"}],["path",{d:"M14 13h2",key:"un5t4a"}],["path",{d:"M8 17h2",key:"2yhykz"}],["path",{d:"M14 17h2",key:"10kma7"}]],Ag=je("file-spreadsheet",VJ);const GJ=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],jn=je("file-text",GJ);const KJ=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Lq=je("file-warning",KJ);const WJ=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]],YJ=je("file",WJ);const XJ=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}
9],["path",{d:"m9 13 2 2 4-4",key:"6343dt"}]],r3=je("folder-check",XJ);const QJ=[["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"}]],yr=je("folder-open",QJ);const ZJ=[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],a3=je("folder-plus",ZJ);const JJ=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],Fq=je("funnel",JJ);const eee=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],em=je("globe",eee);const tee=[["path",{d:"m15 12-9.373 9.373a1 1 0 0 1-3.001-3L12 9",key:"1hayfq"}],["path",{d:"m18 15 4-4",key:"16gjal"}],["path",{d:"m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172v-.344a2 2 0 0 0-.586-1.414l-1.657-1.657A6 6 0 0 0 12.516 3H9l1.243 1.243A6 6 0 0 1 12 8.485V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5",key:"15ts47"}]],qq=je("hammer",tee);const nee=[["path",{d:"M10 10V5a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v5",key:"1p9q5i"}],["path",{d:"M14 6a6 6 0 0 1 6 6v3",key:"1hnv84"}],["path",{d:"M4 15v-3a6 6 0 0 1 6-6",key:"9ciidu"}],["rect",{x:"2",y:"15",width:"20",height:"4",rx:"1",key:"g3x8cw"}]],Bq=je("hard-hat",nee);const ree=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],Hl=je("history",ree);const aee=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],L2=je("house",aee);const see=[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]],iee=je("inbox",see);const oee=[["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"}]],zq=je("key",oee);const lee=[["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"}]],Mf=je("layout-dashboard",lee);const cee=[["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"}]],F2=je("layers",cee);const uee=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],dT=je("link-2",uee);const dee=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["rect",{x:"3",y:"4",width:"6",height:"6",rx:"1",key:"cif1o7"}]],tm=je("list-todo",dee);const fee=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Me=je("loader-circle",fee);const mee=[["circle",{cx:"12",cy:"16",r:"1",key:"1au0dj"}],["rect",{x:"3",y:"10",width:"18",height:"12",rx:"2",key:"6s8ecr"}],["path",{d:"M7 10V7a5 5 0 0 1 10 0v3",key:"1pqi11"}]],hee=je("lock-keyhole",mee);const pee=[["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"}]],fT=je("log-out",pee);const xee=[["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"}]],$r=je("mail",xee);const gee=[["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"}]],Ra=je("map-pin",gee);const yee=[["path",{d:"M18 8c0 3.613-3.869 7.429-5.393 8.795a1 1 0 0 1-1.214 0C9.87 15.429 6 11.613 6 8a6 6 0 0 1 12 0",key:"11u0oz"}],["circle",{cx:"12",cy:"8",r:"2",key:"1822b1"}],["path",{d:"M8.714 14h-3.71a1 1 0 0 0-.948.683l-2.004 6A1 1 0 0 0 3 22h18a1 1 0 0 0 .948-1.316l-2-6a1 1 0 0 0-.949-.684h-3.712",key:"q8zwxj"}]],s3=je("map-pinned",yee);const vee=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],bee=je("maximize-2",vee);const jee=[["path",{d:"m8 6 4-4 4 4",key:"ybng9g"}],["path",{d:"M12 2v10.3a4 4 0 0 1-1.172 2.872L4 22",key:"1hyw0i"}],["path",{d:"m20 22-5-5",key:"1m27yz"}]],wee=je("merge",jee);const Nee=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],See=je("menu",Nee);const Cee=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],Aee=je("message-square",Cee);const Tee=[["path",{d:"M5 12h14",key:"1ays0h"}]],kee=je("minus",Tee);const Oee=[["path",{d:"M12 16h.01",key:"1drbdi"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z",key:"1fd625"}]],Pee=je("octagon-alert",Oee);const Eee=[["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"}]],Jn=je("package",Eee);const _ee=[["path",{d:"M13 21h8",key:"1jsn5i"}],["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"}]],Mee=je("pen-line",_ee);const Ree=[["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"}]],gd=je("pencil",Ree);const Dee=[["line",{x1:"19",x2:"5",y1:"5",y2:"19",key:"1x9vlm"}],["circle",{cx:"6.5",cy:"6.5",r:"2.5",key:"4mh3h7"}],["circle",{cx:"17.5",cy:"17.5",r:"2.5",key:"1mdrzq"}]],Uq=je("percent",Dee);const $ee=[["path",{d:"M13 2a9 9 0 0 1 9 9",key:"1itnx2"}],["path",{d:"M13 6a5 5 0 0 1 5 5",key:"11nki7"}],["path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 
90 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"}]],Iee=je("phone-call",$ee);const Lee=[["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"}]],Ch=je("phone",Lee);const Fee=[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]],qee=je("plug",Fee);const Bee=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Ft=je("plus",Bee);const zee=[["path",{d:"M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2",key:"143wyd"}],["path",{d:"M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6",key:"1itne7"}],["rect",{x:"6",y:"14",width:"12",height:"8",rx:"1",key:"1ue0tg"}]],mT=je("printer",zee);const Uee=[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8",key:"1h4pet"}],["path",{d:"M12 17.5v-11",key:"1jc1ny"}]],Hee=je("receipt",Uee);const Vee=[["path",{d:"m15 14 5-5-5-5",key:"12vg1m"}],["path",{d:"M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13",key:"6uklza"}]],Gee=je("redo-2",Vee);const Kee=[["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"}]],qo=je("refresh-cw",Kee);const Wee=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],hT=je("rotate-ccw",Wee);const Yee=[["path",{d:"M21.3 15.3a2.4 2.4 0 0 1 0 3.4l-2.6 2.6a2.4 2.4 0 0 1-3.4 0L2.7 8.7a2.41 2.41 0 0 1 0-3.4l2.6-2.6a2.41 2.41 0 0 1 3.4 0Z",key:"icamh8"}],["path",{d:"m14.5 12.5 2-2",key:"inckbg"}],["path",{d:"m11.5 9.5 2-2",key:"fmmyf7"}],["path",{d:"m8.5 6.5 2-2",key:"vc6u1g"}],["path",{d:"m17.5 15.5 2-2",key:"wo5hmg"}]],Xee=je("ruler",Yee);const Qee=[["path",{d:"m13.5 6.5-3.148-3.148a1.205 1.205 0 0 0-1.704 0L6.352 5.648a1.205 1.205 0 0 0 0 1.704L9.5 10.5",key:"dzhfyz"}],["path",{d:"M16.5 7.5 19 5",key:"1ltcjm"}],["path",{d:"m17.5 10.5 3.148 3.148a1.205 1.205 0 0 1 0 1.704l-2.296 2.296a1.205 1.205 0 0 1-1.704 0L13.5 14.5",key:"nfoymv"}],["path",{d:"M9 21a6 6 0 0 0-6-6",key:"1iajcf"}],["path",{d:"M9.352 10.648a1.205 1.205 0 0 0 0 1.704l2.296 2.296a1.205 1.205 0 0 0 1.704 0l4.296-4.296a1.205 1.205 0 0 0 0-1.704l-2.296-2.296a1.205 1.205 0 0 0-1.704 0z",key:"nv9zqy"}]],Zee=je("satellite",Qee);const Jee=[["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"}]],Si=je("save",Jee);const ete=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Da=je("search",ete);const tte=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],Er=je("send",tte);const nte=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],Hq=je("shield-alert",nte);const rte=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],yd=je("shield-check",rte);const ate=[["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",ke
9y:"oel41y"}]],ste=je("shield",ate);const ite=[["circle",{cx:"8",cy:"21",r:"1",key:"jimo8o"}],["circle",{cx:"19",cy:"21",r:"1",key:"13723u"}],["path",{d:"M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12",key:"9zh506"}]],Vq=je("shopping-cart",ite);const ote=[["path",{d:"M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344",key:"2acyp4"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],lte=je("square-check-big",ote);const cte=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],ute=je("square-pen",cte);const dte=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],fte=je("square",dte);const mte=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],Gq=je("star",mte);const hte=[["path",{d:"M16 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8Z",key:"qazsjp"}],["path",{d:"M15 3v4a2 2 0 0 0 2 2h4",key:"40519r"}]],q2=je("sticky-note",hte);const pte=[["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"}]],xte=je("tag",pte);const gte=[["path",{d:"M7 10v12",key:"1qc93n"}],["path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z",key:"emmmcr"}]],yte=je("thumbs-up",gte);const vte=[["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"}]],on=je("trash-2",vte);const bte=[["path",{d:"M16 17h6v-6",key:"t6n2it"}],["path",{d:"m22 17-8.5-8.5-5 5L2 7",key:"x473p"}]],Kq=je("trending-down",bte);const jte=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],Wq=je("trending-up",jte);const wte=[["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"}]],Kt=je("triangle-alert",wte);const Nte=[["path",{d:"M10 14.66v1.626a2 2 0 0 1-.976 1.696A5 5 0 0 0 7 21.978",key:"1n3hpd"}],["path",{d:"M14 14.66v1.626a2 2 0 0 0 .976 1.696A5 5 0 0 1 17 21.978",key:"rfe1zi"}],["path",{d:"M18 9h1.5a1 1 0 0 0 0-5H18",key:"7xy6bh"}],["path",{d:"M4 22h16",key:"57wxv0"}],["path",{d:"M6 9a6 6 0 0 0 12 0V3a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1z",key:"1mhfuq"}],["path",{d:"M6 9H4.5a1 1 0 0 1 0-5H6",key:"tex48p"}]],Ste=je("trophy",Nte);const Cte=[["path",{d:"M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2",key:"wrbu53"}],["path",{d:"M15 18H9",key:"1lyqi6"}],["path",{d:"M19 18h2a1 1 0 0 0 1-1v-3.65a1 1 0 0 0-.22-.624l-3.48-4.35A1 1 0 0 0 17.52 8H14",key:"lysw3i"}],["circle",{cx:"17",cy:"18",r:"2",key:"332jqn"}],["circle",{cx:"7",cy:"18",r:"2",key:"19iecd"}]],Ci=je("truck",Cte);const Ate=[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]],Tte=je("undo-2",Ate);const kte=[["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"}]],Tg=je("upload",kte);const Ote=[["path",{d:"M10 15H6a4 4 0 0 0-4 4v2",key:"1nfge6"}],["path",{d:"m14.305 16.53.923-.382",key:"1itpsq"}],["path",{d:"m15.228 13.852-.923-.383",key:"eplpkm"}],["path",{d:"m16.852 12.228-.383-.923",key:"13v3q0"}],["path",{d:"m16.852 17.772-.383.924",key:"1i8mnm"}],["path",{d:"m19.148 12.228.383-.923",key:"1q8j1v"}],["path",{d:"m19.53 18.696-.382-.924",key:"vk1qj3"}],["path",{d:"m20.772 13.852.924-.383",key:"n880s0"}],["path",{d:"m20.772 16.148.924.383",key:"1g6xey"}],["circle",{cx:"18",cy:"15",r:"3",key:"gjjjvw"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],Pte=je("user-cog",Ote);const Ete=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],Yq=je("user-plus",Ete);const _te=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],kg=je("users",_te);const Mte=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],Ai=je("user",Mte);const Rte=[["path",{d:"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2",key:"q3hayz"}],["path",{d:"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06",key:"1go1hn"}],["path",{d:"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8",key:"qlwsc0"}]],B2=je("webhook",Rte);const Dte=[["circle",{cx:"12",cy:"5",r:"3",key:"rqqgnr"}],["path",{d:"M6.5 8a2 2 0 0 0-1.905 1.46L2.1 18.5A2 2 0 0 0 4 21h16a2 2 0 0 0 1.925-2.54L19.4 9.5A2 2 0 0 0 17.48 8Z",key:"56o5sh"}]],$te=je("weight",Dte);const Ite=[["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"}]],Du=je("wrench",Ite);const Lte=[["path",{d:"M18 6 6 18",key:"1bl5f8"}
vendor: 5,474 bytes, line 9
9],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],an=je("x",Lte);const Fte=[["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"}]],Ej=je("zap",Fte);const qte=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],Bte=je("zoom-in",qte);const zte=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],Ute=je("zoom-out",zte),Hte=(e,t)=>{const n=new Array(e.length+t.length);for(let r=0;r<e.length;r++)n[r]=e[r];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},Vte=(e,t)=>({classGroupId:e,validator:t}),Xq=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Og="-",i3=[],Gte="arbitrary..",Kte=e=>{const t=Yte(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:l=>{if(l.startsWith("[")&&l.endsWith("]"))return Wte(l);const u=l.split(Og),d=u[0]===""&&u.length>1?1:0;return Qq(u,d,t)},getConflictingClassGroupIds:(l,u)=>{if(u){const d=r[l],f=n[l];return d?f?Hte(f,d):d:f||i3}return n[l]||i3}}},Qq=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const s=e[t],i=n.nextPart.get(s);if(i){const f=Qq(e,t+1,i);if(f)return f}const l=n.validators;if(l===null)return;const u=t===0?e.join(Og):e.slice(t).join(Og),d=l.length;for(let f=0;f<d;f++){const h=l[f];if(h.validator(u))return h.classGroupId}},Wte=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),r=t.slice(0,n);return r?Gte+r:void 0})(),Yte=e=>{const{theme:t,classGroups:n}=e;return Xte(n,t)},Xte=(e,t)=>{const n=Xq();for(const r in e){const s=e[r];pT(s,n,r,t)}return n},pT=(e,t,n,r)=>{const s=e.length;for(let i=0;i<s;i++){const l=e[i];Qte(l,t,n,r)}},Qte=(e,t,n,r)=>{if(typeof e=="string"){Zte(e,t,n);return}if(typeof e=="function"){Jte(e,t,n,r);return}ene(e,t,n,r)},Zte=(e,t,n)=>{const r=e===""?t:Zq(t,e);r.classGroupId=n},Jte=(e,t,n,r)=>{if(tne(e)){pT(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(Vte(n,e))},ene=(e,t,n,r)=>{const s=Object.entries(e),i=s.length;for(let l=0;l<i;l++){const[u,d]=s[l];pT(d,Zq(t,u),n,r)}},Zq=(e,t)=>{let n=e;const r=t.split(Og),s=r.length;for(let i=0;i<s;i++){const l=r[i];let u=n.nextPart.get(l);u||(u=Xq(),n.nextPart.set(l,u)),n=u}return n},tne=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,nne=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const s=(i,l)=>{n[i]=l,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(i){let l=n[i];if(l!==void 0)return l;if((l=r[i])!==void 0)return s(i,l),l},set(i,l){i in n?n[i]=l:s(i,l)}}},z2="!",o3=":",rne=[],l3=(e,t,n,r,s)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:s}),ane=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=s=>{const i=[];let l=0,u=0,d=0,f;const h=s.length;for(let j=0;j<h;j++){const b=s[j];if(l===0&&u===0){if(b===o3){i.push(s.slice(d,j)),d=j+1;continue}if(b==="/"){f=j;continue}}b==="["?l++:b==="]"?l--:b==="("?u++:b===")"&&u--}const p=i.length===0?s:s.slice(d);let x=p,y=!1;p.endsWith(z2)?(x=p.slice(0,-1),y=!0):p.startsWith(z2)&&(x=p.slice(1),y=!0);const w=f&&f>d?f-d:void 0;return l3(i,y,x,w)};if(t){const s=t+o3,i=r;r=l=>l.startsWith(s)?i(l.slice(s.length)):l3(rne,!1,l,void 0,!0)}if(n){const s=r;r=i=>n({className:i,parseClassName:s})}return r},sne=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];let s=[];for(let i=0;i<n.length;i++){const l=n[i],u=l[0]==="[",d=t.has(l);u||d?(s.length>0&&(s.sort(),r.push(...s),s=[]),r.push(l)):s.push(l)}return s.length>0&&(s.sort(),r.push(...s)),r}},ine=e=>({cache:nne(e.cacheSize),parseClassName:ane(e),sortModifiers:sne(e),...Kte(e)}),one=/\s+/,lne=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s,sortModifiers:i}=t,l=[],u=e.trim().split(one);let d="";for(let f=u.length-1;f>=0;f-=1){const h=u[f],{isExternal:p,modifiers:x,hasImportantModifier:y,baseClassName:w,maybePostfixModifierPosition:j}=n(h);if(p){d=h+(d.length>0?" "+d:d);continue}let b=!!j,C=r(b?w.substring(0,j):w);if(!C){if(!b){d=h+(d.length>0?" "+d:d);continue}if(C=r(w),!C){d=h+(d.length>0?" "+d:d);continue}b=!1}const N=x.length===0?"":x.length===1?x[0]:i(x).join(":"),k=y?N+z2:N,T=k+C;if(l.indexOf(T)>-1)continue;l.push(T);const A=s(C,b);for(let P=0;P<A.length;++P){const E=A[P];l.push(k+E)}d=h+(d.length>0?" "+d:d)}return d},cne=(...e)=>{let t=0,n,r,s="";for(;t<e.length;)(n=e[t++])&&(r=Jq(n))&&(s&&(s+=" "),s+=r);return s},Jq=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=Jq(e[r]))&&(n&&(n+=" "),n+=t);return n},une=(e,...t)=>{let n,r,s,i;const l=d=>{const f=t.reduce((h,p)=>p(h),e());return n=ine(f),r=n.cache.get,s=n.cache.set,i=u,u(d)},u=d=>{const f=r(d);if(f)return f;const h=lne(d,n);return s(d,h),h};return i=l,(...d)=>i(cne(...d))},dne=[],kn=e=>{const t=n=>n[e]||dne;return t.isThemeGetter=!0,t},e8=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,t8=/^\((?:(\w[\w-]*):)?(.+)\)$/i,fne=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,mne=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,hne=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,pne=
vendor: 5,015 bytes, line 9
9/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,xne=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,gne=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,go=e=>fne.test(e),ct=e=>!!e&&!Number.isNaN(Number(e)),yo=e=>!!e&&Number.isInteger(Number(e)),_j=e=>e.endsWith("%")&&ct(e.slice(0,-1)),fi=e=>mne.test(e),n8=()=>!0,yne=e=>hne.test(e)&&!pne.test(e),xT=()=>!1,vne=e=>xne.test(e),bne=e=>gne.test(e),jne=e=>!He(e)&&!Ge(e),wne=e=>Bo(e,s8,xT),He=e=>e8.test(e),bl=e=>Bo(e,i8,yne),c3=e=>Bo(e,Pne,ct),Nne=e=>Bo(e,l8,n8),Sne=e=>Bo(e,o8,xT),u3=e=>Bo(e,r8,xT),Cne=e=>Bo(e,a8,bne),vx=e=>Bo(e,c8,vne),Ge=e=>t8.test(e),Rf=e=>sc(e,i8),Ane=e=>sc(e,o8),d3=e=>sc(e,r8),Tne=e=>sc(e,s8),kne=e=>sc(e,a8),bx=e=>sc(e,c8,!0),One=e=>sc(e,l8,!0),Bo=(e,t,n)=>{const r=e8.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},sc=(e,t,n=!1)=>{const r=t8.exec(e);return r?r[1]?t(r[1]):n:!1},r8=e=>e==="position"||e==="percentage",a8=e=>e==="image"||e==="url",s8=e=>e==="length"||e==="size"||e==="bg-size",i8=e=>e==="length",Pne=e=>e==="number",o8=e=>e==="family-name",l8=e=>e==="number"||e==="weight",c8=e=>e==="shadow",Ene=()=>{const e=kn("color"),t=kn("font"),n=kn("text"),r=kn("font-weight"),s=kn("tracking"),i=kn("leading"),l=kn("breakpoint"),u=kn("container"),d=kn("spacing"),f=kn("radius"),h=kn("shadow"),p=kn("inset-shadow"),x=kn("text-shadow"),y=kn("drop-shadow"),w=kn("blur"),j=kn("perspective"),b=kn("aspect"),C=kn("ease"),N=kn("animate"),k=()=>["auto","avoid","all","avoid-page","page","left","right","column"],T=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],A=()=>[...T(),Ge,He],P=()=>["auto","hidden","clip","visible","scroll"],E=()=>["auto","contain","none"],_=()=>[Ge,He,d],R=()=>[go,"full","auto",..._()],H=()=>[yo,"none","subgrid",Ge,He],L=()=>["auto",{span:["full",yo,Ge,He]},yo,Ge,He],I=()=>[yo,"auto",Ge,He],W=()=>["auto","min","max","fr",Ge,He],U=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],V=()=>["start","end","center","stretch","center-safe","end-safe"],D=()=>["auto",..._()],q=()=>[go,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",..._()],K=()=>[go,"screen","full","dvw","lvw","svw","min","max","fit",..._()],Y=()=>[go,"screen","full","lh","dvh","lvh","svh","min","max","fit",..._()],z=()=>[e,Ge,He],Z=()=>[...T(),d3,u3,{position:[Ge,He]}],F=()=>["no-repeat",{repeat:["","x","y","space","round"]}],B=()=>["auto","cover","contain",Tne,wne,{size:[Ge,He]}],X=()=>[_j,Rf,bl],Q=()=>["","none","full",f,Ge,He],se=()=>["",ct,Rf,bl],ee=()=>["solid","dashed","dotted","double"],ve=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ue=()=>[ct,_j,d3,u3],de=()=>["","none",w,Ge,He],Se=()=>["none",ct,Ge,He],he=()=>["none",ct,Ge,He],ce=()=>[ct,Ge,He],te=()=>[go,"full",..._()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[fi],breakpoint:[fi],color:[n8],container:[fi],"drop-shadow":[fi],ease:["in","out","in-out"],font:[jne],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[fi],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[fi],shadow:[fi],spacing:["px",ct],text:[fi],"text-shadow":[fi],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",go,He,Ge,b]}],container:["container"],columns:[{columns:[ct,He,Ge,u]}],"break-after":[{"break-after":k()}],"break-before":[{"break-before":k()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:A()}],overflow:[{overflow:P()}],"overflow-x":[{"overflow-x":P()}],"overflow-y":[{"overflow-y":P()}],overscroll:[{overscroll:E()}],"overscroll-x":[{"overscroll-x":E()}],"overscroll-y":[{"overscroll-y":E()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:R()}],"inset-x":[{"inset-x":R()}],"inset-y":[{"inset-y":R()}],start:[{"inset-s":R(),start:R()}],end:[{"inset-e":R(),end:R()}],"inset-bs":[{"inset-bs":R()}],"inset-be":[{"inset-be":R()}],top:[{top:R()}
vendor: 4,748 bytes, line 9
9],right:[{right:R()}],bottom:[{bottom:R()}],left:[{left:R()}],visibility:["visible","invisible","collapse"],z:[{z:[yo,"auto",Ge,He]}],basis:[{basis:[go,"full","auto",u,..._()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ct,go,"auto","initial","none",He]}],grow:[{grow:["",ct,Ge,He]}],shrink:[{shrink:["",ct,Ge,He]}],order:[{order:[yo,"first","last","none",Ge,He]}],"grid-cols":[{"grid-cols":H()}],"col-start-end":[{col:L()}],"col-start":[{"col-start":I()}],"col-end":[{"col-end":I()}],"grid-rows":[{"grid-rows":H()}],"row-start-end":[{row:L()}],"row-start":[{"row-start":I()}],"row-end":[{"row-end":I()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":W()}],"auto-rows":[{"auto-rows":W()}],gap:[{gap:_()}],"gap-x":[{"gap-x":_()}],"gap-y":[{"gap-y":_()}],"justify-content":[{justify:[...U(),"normal"]}],"justify-items":[{"justify-items":[...V(),"normal"]}],"justify-self":[{"justify-self":["auto",...V()]}],"align-content":[{content:["normal",...U()]}],"align-items":[{items:[...V(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...V(),{baseline:["","last"]}]}],"place-content":[{"place-content":U()}],"place-items":[{"place-items":[...V(),"baseline"]}],"place-self":[{"place-self":["auto",...V()]}],p:[{p:_()}],px:[{px:_()}],py:[{py:_()}],ps:[{ps:_()}],pe:[{pe:_()}],pbs:[{pbs:_()}],pbe:[{pbe:_()}],pt:[{pt:_()}],pr:[{pr:_()}],pb:[{pb:_()}],pl:[{pl:_()}],m:[{m:D()}],mx:[{mx:D()}],my:[{my:D()}],ms:[{ms:D()}],me:[{me:D()}],mbs:[{mbs:D()}],mbe:[{mbe:D()}],mt:[{mt:D()}],mr:[{mr:D()}],mb:[{mb:D()}],ml:[{ml:D()}],"space-x":[{"space-x":_()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":_()}],"space-y-reverse":["space-y-reverse"],size:[{size:q()}],"inline-size":[{inline:["auto",...K()]}],"min-inline-size":[{"min-inline":["auto",...K()]}],"max-inline-size":[{"max-inline":["none",...K()]}],"block-size":[{block:["auto",...Y()]}],"min-block-size":[{"min-block":["auto",...Y()]}],"max-block-size":[{"max-block":["none",...Y()]}],w:[{w:[u,"screen",...q()]}],"min-w":[{"min-w":[u,"screen","none",...q()]}],"max-w":[{"max-w":[u,"screen","none","prose",{screen:[l]},...q()]}],h:[{h:["screen","lh",...q()]}],"min-h":[{"min-h":["screen","lh","none",...q()]}],"max-h":[{"max-h":["screen","lh",...q()]}],"font-size":[{text:["base",n,Rf,bl]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,One,Nne]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",_j,He]}],"font-family":[{font:[Ane,Sne,t]}],"font-features":[{"font-features":[He]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[s,Ge,He]}],"line-clamp":[{"line-clamp":[ct,"none",Ge,c3]}],leading:[{leading:[i,..._()]}],"list-image":[{"list-image":["none",Ge,He]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ge,He]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:z()}],"text-color":[{text:z()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ee(),"wavy"]}],"text-decoration-thickness":[{decoration:[ct,"from-font","auto",Ge,bl]}],"text-decoration-color":[{decoration:z()}],"underline-offset":[{"underline-offset":[ct,"auto",Ge,He]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:_()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ge,He]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ge,He]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Z()}],"bg-repeat":[{bg:F()}],"bg-size":[{bg:B()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},yo,Ge,He],radial:["",Ge,He],conic:[yo,Ge,He]},kne,Cne]}],"bg-color":[{bg:z()}],"gradient-from-pos":[{from:X()}
vendor: 9,381 bytes, line 9
9],"gradient-via-pos":[{via:X()}],"gradient-to-pos":[{to:X()}],"gradient-from":[{from:z()}],"gradient-via":[{via:z()}],"gradient-to":[{to:z()}],rounded:[{rounded:Q()}],"rounded-s":[{"rounded-s":Q()}],"rounded-e":[{"rounded-e":Q()}],"rounded-t":[{"rounded-t":Q()}],"rounded-r":[{"rounded-r":Q()}],"rounded-b":[{"rounded-b":Q()}],"rounded-l":[{"rounded-l":Q()}],"rounded-ss":[{"rounded-ss":Q()}],"rounded-se":[{"rounded-se":Q()}],"rounded-ee":[{"rounded-ee":Q()}],"rounded-es":[{"rounded-es":Q()}],"rounded-tl":[{"rounded-tl":Q()}],"rounded-tr":[{"rounded-tr":Q()}],"rounded-br":[{"rounded-br":Q()}],"rounded-bl":[{"rounded-bl":Q()}],"border-w":[{border:se()}],"border-w-x":[{"border-x":se()}],"border-w-y":[{"border-y":se()}],"border-w-s":[{"border-s":se()}],"border-w-e":[{"border-e":se()}],"border-w-bs":[{"border-bs":se()}],"border-w-be":[{"border-be":se()}],"border-w-t":[{"border-t":se()}],"border-w-r":[{"border-r":se()}],"border-w-b":[{"border-b":se()}],"border-w-l":[{"border-l":se()}],"divide-x":[{"divide-x":se()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":se()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ee(),"hidden","none"]}],"divide-style":[{divide:[...ee(),"hidden","none"]}],"border-color":[{border:z()}],"border-color-x":[{"border-x":z()}],"border-color-y":[{"border-y":z()}],"border-color-s":[{"border-s":z()}],"border-color-e":[{"border-e":z()}],"border-color-bs":[{"border-bs":z()}],"border-color-be":[{"border-be":z()}],"border-color-t":[{"border-t":z()}],"border-color-r":[{"border-r":z()}],"border-color-b":[{"border-b":z()}],"border-color-l":[{"border-l":z()}],"divide-color":[{divide:z()}],"outline-style":[{outline:[...ee(),"none","hidden"]}],"outline-offset":[{"outline-offset":[ct,Ge,He]}],"outline-w":[{outline:["",ct,Rf,bl]}],"outline-color":[{outline:z()}],shadow:[{shadow:["","none",h,bx,vx]}],"shadow-color":[{shadow:z()}],"inset-shadow":[{"inset-shadow":["none",p,bx,vx]}],"inset-shadow-color":[{"inset-shadow":z()}],"ring-w":[{ring:se()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:z()}],"ring-offset-w":[{"ring-offset":[ct,bl]}],"ring-offset-color":[{"ring-offset":z()}],"inset-ring-w":[{"inset-ring":se()}],"inset-ring-color":[{"inset-ring":z()}],"text-shadow":[{"text-shadow":["none",x,bx,vx]}],"text-shadow-color":[{"text-shadow":z()}],opacity:[{opacity:[ct,Ge,He]}],"mix-blend":[{"mix-blend":[...ve(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ve()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[ct]}],"mask-image-linear-from-pos":[{"mask-linear-from":ue()}],"mask-image-linear-to-pos":[{"mask-linear-to":ue()}],"mask-image-linear-from-color":[{"mask-linear-from":z()}],"mask-image-linear-to-color":[{"mask-linear-to":z()}],"mask-image-t-from-pos":[{"mask-t-from":ue()}],"mask-image-t-to-pos":[{"mask-t-to":ue()}],"mask-image-t-from-color":[{"mask-t-from":z()}],"mask-image-t-to-color":[{"mask-t-to":z()}],"mask-image-r-from-pos":[{"mask-r-from":ue()}],"mask-image-r-to-pos":[{"mask-r-to":ue()}],"mask-image-r-from-color":[{"mask-r-from":z()}],"mask-image-r-to-color":[{"mask-r-to":z()}],"mask-image-b-from-pos":[{"mask-b-from":ue()}],"mask-image-b-to-pos":[{"mask-b-to":ue()}],"mask-image-b-from-color":[{"mask-b-from":z()}],"mask-image-b-to-color":[{"mask-b-to":z()}],"mask-image-l-from-pos":[{"mask-l-from":ue()}],"mask-image-l-to-pos":[{"mask-l-to":ue()}],"mask-image-l-from-color":[{"mask-l-from":z()}],"mask-image-l-to-color":[{"mask-l-to":z()}],"mask-image-x-from-pos":[{"mask-x-from":ue()}],"mask-image-x-to-pos":[{"mask-x-to":ue()}],"mask-image-x-from-color":[{"mask-x-from":z()}],"mask-image-x-to-color":[{"mask-x-to":z()}],"mask-image-y-from-pos":[{"mask-y-from":ue()}],"mask-image-y-to-pos":[{"mask-y-to":ue()}],"mask-image-y-from-color":[{"mask-y-from":z()}],"mask-image-y-to-color":[{"mask-y-to":z()}],"mask-image-radial":[{"mask-radial":[Ge,He]}],"mask-image-radial-from-pos":[{"mask-radial-from":ue()}],"mask-image-radial-to-pos":[{"mask-radial-to":ue()}],"mask-image-radial-from-color":[{"mask-radial-from":z()}],"mask-image-radial-to-color":[{"mask-radial-to":z()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":T()}],"mask-image-conic-pos":[{"mask-conic":[ct]}],"mask-image-conic-from-pos":[{"mask-conic-from":ue()}],"mask-image-conic-to-pos":[{"mask-conic-to":ue()}],"mask-image-conic-from-color":[{"mask-conic-from":z()}],"mask-image-conic-to-color":[{"mask-conic-to":z()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Z()}],"mask-repeat":[{mask:F()}],"mask-size":[{mask:B()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ge,He]}],filter:[{filter:["","none",Ge,He]}],blur:[{blur:de()}],brightness:[{brightness:[ct,Ge,He]}],contrast:[{contrast:[ct,Ge,He]}],"drop-shadow":[{"drop-shadow":["","none",y,bx,vx]}],"drop-shadow-color":[{"drop-shadow":z()}],grayscale:[{grayscale:["",ct,Ge,He]}],"hue-rotate":[{"hue-rotate":[ct,Ge,He]}],invert:[{invert:["",ct,Ge,He]}],saturate:[{saturate:[ct,Ge,He]}],sepia:[{sepia:["",ct,Ge,He]}],"backdrop-filter":[{"backdrop-filter":["","none",Ge,He]}],"backdrop-blur":[{"backdrop-blur":de()}],"backdrop-brightness":[{"backdrop-brightness":[ct,Ge,He]}],"backdrop-contrast":[{"backdrop-contrast":[ct,Ge,He]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ct,Ge,He]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ct,Ge,He]}],"backdrop-invert":[{"backdrop-invert":["",ct,Ge,He]}],"backdrop-opacity":[{"backdrop-opacity":[ct,Ge,He]}],"backdrop-saturate":[{"backdrop-saturate":[ct,Ge,He]}],"backdrop-sepia":[{"backdrop-sepia":["",ct,Ge,He]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":_()}],"border-spacing-x":[{"border-spacing-x":_()}],"border-spacing-y":[{"border-spacing-y":_()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ge,He]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ct,"initial",Ge,He]}],ease:[{ease:["linear","initial",C,Ge,He]}],delay:[{delay:[ct,Ge,He]}],animate:[{animate:["none",N,Ge,He]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[j,Ge,He]}],"perspective-origin":[{"perspective-origin":A()}],rotate:[{rotate:Se()}],"rotate-x":[{"rotate-x":Se()}],"rotate-y":[{"rotate-y":Se()}],"rotate-z":[{"rotate-z":Se()}],scale:[{scale:he()}],"scale-x":[{"scale-x":he()}],"scale-y":[{"scale-y":he()}],"scale-z":[{"scale-z":he()}],"scale-3d":["scale-3d"],skew:[{skew:ce()}],"skew-x":[{"skew-x":ce()}],"skew-y":[{"skew-y":ce()}],transform:[{transform:[Ge,He,"","none","gpu","cpu"]}],"transform-origin":[{origin:A()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:te()}],"translate-x":[{"translate-x":te()}],"translate-y":[{"translate-y":te()}],"translate-z":[{"translate-z":te()}],"translate-none":["translate-none"],accent:[{accent:z()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:z()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Ge,He]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":_()}],"scroll-mx":[{"scroll-mx":_()}],"scroll-my":[{"scroll-my":_()}],"scroll-ms":[{"scroll-ms":_()}],"scroll-me":[{"scroll-me":_()}],"scroll-mbs":[{"scroll-mbs":_()}],"scroll-mbe":[{"scroll-mbe":_()}],"scroll-mt":[{"scroll-mt":_()}],"scroll-mr":[{"scroll-mr":_()}],"scroll-mb":[{"scroll-mb":_()}],"scroll-ml":[{"scroll-ml":_()}],"scroll-p":[{"scroll-p":_()}],"scroll-px":[{"scroll-px":_()}],"scroll-py":[{"scroll-py":_()}],"scroll-ps":[{"scroll-ps":_()}],"scroll-pe":[{"scroll-pe":_()}],"scroll-pbs":[{"scroll-pbs":_()}],"scroll-pbe":[{"scroll-pbe":_()}],"scroll-pt":[{"scroll-pt":_()}],"scroll-pr":[{"scroll-pr":_()}],"scroll-pb":[{"scroll-pb":_()}],"scroll-pl":[{"scroll-pl":_()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Ge,He]}],fill:[{fill:["none",...z()]}],"stroke-w":[{stroke:[ct,Rf,bl,c3]}],stroke:[{stroke:["none",...z()]}
9],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},_ne=une(Ene);function qe(...e){return _ne(yt(e))}const Mne=EZ,u8=v.forwardRef(({className:e,...t},n)=>a.jsx(Tq,{ref:n,className:qe("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",e),...t}));u8.displayName=Tq.displayName;const Rne=cv("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),d8=v.forwardRef(({className:e,variant:t,...n},r)=>a.jsx(kq,{ref:r,className:qe(Rne({variant:t}),e),...n}));d8.displayName=kq.displayName;const f8=v.forwardRef(({className:e,...t},n)=>a.jsx(Eq,{ref:n,className:qe("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",e),...t}));
9f8.displayName=Eq.displayName;const m8=v.forwardRef(({className:e,...t},n)=>a.jsx(_q,{ref:n,className:qe("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",e),"toast-close":"",...t,children:a.jsx(an,{className:"h-4 w-4"})}));m8.displayName=_q.displayName;const h8=v.forwardRef(({className:e,...t},n)=>a.jsx(Oq,{ref:n,className:qe("text-sm font-semibold",e),...t}));h8.displayName=Oq.displayName;const p8=v.forwardRef(({className:e,...t},n)=>a.jsx(Pq,{ref:n,className:qe("text-sm opacity-90",e),...t}));p8.displayName=Pq.displayName;function Dne(){const{toasts:e}=nr();return a.jsxs(Mne,{children:[e.map(function({id:t,title:n,description:r,action:s,...i}){return a.jsxs(d8,{...i,children:[a.jsxs("div",{className:"grid gap-1",children:[n&&a.jsx(h8,{children:n}),r&&a.jsx(p8,{children:r})]}),s,a.jsx(m8,{})]},t)}),a.jsx(u8,{})]})}var $ne=av[" useId ".trim().toString()]||(()=>{}),Ine=0;function tr(e){const[t,n]=v.useState($ne());return Un(()=>{n(r=>r??String(Ine++))},[e]),t?`radix-${t}`:""}const Lne=["top","right","bottom","left"],Do=Math.min,ia=Math.max,Pg=Math.round,jx=Math.floor,Os=e=>({x:e,y:e}),Fne={left:"right",right:"left",bottom:"top",top:"bottom"};function U2(e,t,n){return ia(e,Do(t,n))}function Ti(e,t){return typeof e=="function"?e(t):e}function ki(e){return e.split("-")[0]}function vd(e){return e.split("-")[1]}function gT(e){return e==="x"?"y":"x"}function yT(e){return e==="y"?"height":"width"}function Ts(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function vT(e){return gT(Ts(e))}function qne(e,t,n){n===void 0&&(n=!1);const r=vd(e),s=vT(e),i=yT(s);let l=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(l=Eg(l)),[l,Eg(l)]}function Bne(e){const t=Eg(e);return[H2(e),t,H2(t)]}function H2(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const f3=["left","right"],m3=["right","left"],zne=["top","bottom"],Une=["bottom","top"];function Hne(e,t,n){switch(e){case"top":case"bottom":return n?t?m3:f3:t?f3:m3;case"left":case"right":return t?zne:Une;default:return[]}}function Vne(e,t,n,r){const s=vd(e);let i=Hne(ki(e),n==="start",r);return s&&(i=i.map(l=>l+"-"+s),t&&(i=i.concat(i.map(H2)))),i}function Eg(e){const t=ki(e);return Fne[t]+e.slice(t.length)}function Gne(e){return{top:0,right:0,bottom:0,left:0,...e}}function x8(e){return typeof e!="number"?Gne(e):{top:e,right:e,bottom:e,left:e}}function _g(e){const{x:t,y:n,width:r,height:s}=e;return{width:r,height:s,top:n,left:t,right:t+r,bottom:n+s,x:t,y:n}}function h3(e,t,n){let{reference:r,floating:s}=e;const i=Ts(t),l=vT(t),u=yT(l),d=ki(t),f=i==="y",h=r.x+r.width/2-s.width/2,p=r.y+r.height/2-s.height/2,x=r[u]/2-s[u]/2;let y;switch(d){case"top":y={x:h,y:r.y-s.height};break;case"bottom":y={x:h,y:r.y+r.height};break;case"right":y={x:r.x+r.width,y:p};break;case"left":y={x:r.x-s.width,y:p};break;default:y={x:r.x,y:r.y}}switch(vd(t)){case"start":y[l]-=x*(n&&f?-1:1);break;case"end":y[l]+=x*(n&&f?-1:1);break}return y}async function Kne(e,t){var n;t===void 0&&(t={});const{x:r,y:s,platform:i,rects:l,elements:u,strategy:d}=e,{boundary:f="clippingAncestors",rootBoundary:h="viewport",elementContext:p="floating",altBoundary:x=!1,padding:y=0}=Ti(t,e),w=x8(y),b=u[x?p==="floating"?"reference":"floating":p],C=_g(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(b)))==null||n?b:b.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(u.floating)),boundary:f,rootBoundary:h,strategy:d})),N=p==="floating"?{x:r,y:s,width:l.floating.width,height:l.floating.height}:l.reference,k=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u.floating)),T=await(i.isElement==null?void 0:i.isElement(k))?await(i.getScale==null?void 0:i.getScale(k))||{x:1,y:1}:{x:1,y:1},A=_g(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:N,offsetParent:k,strategy:d}):N);return{top:(C.top-A.top+w.top)/T.y,bottom:(A.bottom-C.bottom+w.bottom)/T.y,left
vendor: 4,092 bytes, line 9
9:(C.left-A.left+w.left)/T.x,right:(A.right-C.right+w.right)/T.x}}const Wne=50,Yne=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:i=[],platform:l}=n,u=l.detectOverflow?l:{...l,detectOverflow:Kne},d=await(l.isRTL==null?void 0:l.isRTL(t));let f=await l.getElementRects({reference:e,floating:t,strategy:s}),{x:h,y:p}=h3(f,r,d),x=r,y=0;const w={};for(let j=0;j<i.length;j++){const b=i[j];if(!b)continue;const{name:C,fn:N}=b,{x:k,y:T,data:A,reset:P}=await N({x:h,y:p,initialPlacement:r,placement:x,strategy:s,middlewareData:w,rects:f,platform:u,elements:{reference:e,floating:t}});h=k??h,p=T??p,w[C]={...w[C],...A},P&&y<Wne&&(y++,typeof P=="object"&&(P.placement&&(x=P.placement),P.rects&&(f=P.rects===!0?await l.getElementRects({reference:e,floating:t,strategy:s}):P.rects),{x:h,y:p}=h3(f,x,d)),j=-1)}return{x:h,y:p,placement:x,strategy:s,middlewareData:w}},Xne=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:s,rects:i,platform:l,elements:u,middlewareData:d}=t,{element:f,padding:h=0}=Ti(e,t)||{};if(f==null)return{};const p=x8(h),x={x:n,y:r},y=vT(s),w=yT(y),j=await l.getDimensions(f),b=y==="y",C=b?"top":"left",N=b?"bottom":"right",k=b?"clientHeight":"clientWidth",T=i.reference[w]+i.reference[y]-x[y]-i.floating[w],A=x[y]-i.reference[y],P=await(l.getOffsetParent==null?void 0:l.getOffsetParent(f));let E=P?P[k]:0;(!E||!await(l.isElement==null?void 0:l.isElement(P)))&&(E=u.floating[k]||i.floating[w]);const _=T/2-A/2,R=E/2-j[w]/2-1,H=Do(p[C],R),L=Do(p[N],R),I=H,W=E-j[w]-L,U=E/2-j[w]/2+_,V=U2(I,U,W),D=!d.arrow&&vd(s)!=null&&U!==V&&i.reference[w]/2-(U<I?H:L)-j[w]/2<0,q=D?U<I?U-I:U-W:0;return{[y]:x[y]+q,data:{[y]:V,centerOffset:U-V-q,...D&&{alignmentOffset:q}},reset:D}}}),Qne=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:s,middlewareData:i,rects:l,initialPlacement:u,platform:d,elements:f}=t,{mainAxis:h=!0,crossAxis:p=!0,fallbackPlacements:x,fallbackStrategy:y="bestFit",fallbackAxisSideDirection:w="none",flipAlignment:j=!0,...b}=Ti(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const C=ki(s),N=Ts(u),k=ki(u)===u,T=await(d.isRTL==null?void 0:d.isRTL(f.floating)),A=x||(k||!j?[Eg(u)]:Bne(u)),P=w!=="none";!x&&P&&A.push(...Vne(u,j,w,T));const E=[u,...A],_=await d.detectOverflow(t,b),R=[];let H=((r=i.flip)==null?void 0:r.overflows)||[];if(h&&R.push(_[C]),p){const U=qne(s,l,T);R.push(_[U[0]],_[U[1]])}if(H=[...H,{placement:s,overflows:R}],!R.every(U=>U<=0)){var L,I;const U=(((L=i.flip)==null?void 0:L.index)||0)+1,V=E[U];if(V&&(!(p==="alignment"?N!==Ts(V):!1)||H.every(K=>Ts(K.placement)===N?K.overflows[0]>0:!0)))return{data:{index:U,overflows:H},reset:{placement:V}};let D=(I=H.filter(q=>q.overflows[0]<=0).sort((q,K)=>q.overflows[1]-K.overflows[1])[0])==null?void 0:I.placement;if(!D)switch(y){case"bestFit":{var W;const q=(W=H.filter(K=>{if(P){const Y=Ts(K.placement);return Y===N||Y==="y"}return!0}).map(K=>[K.placement,K.overflows.filter(Y=>Y>0).reduce((Y,z)=>Y+z,0)]).sort((K,Y)=>K[1]-Y[1])[0])==null?void 0:W[0];q&&(D=q);break}case"initialPlacement":D=u;break}if(s!==D)return{reset:{placement:D}}}return{}}}};function p3(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function x3(e){return Lne.some(t=>e[t]>=0)}const Zne=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:s="referenceHidden",...i}=Ti(e,t);switch(s){case"referenceHidden":{const l=await r.detectOverflow(t,{...i,elementContext:"reference"}),u=p3(l,n.reference);return{data:{referenceHiddenOffsets:u,referenceHidden:x3(u)}}}case"escaped":{const l=await r.detectOverflow(t,{...i,altBoundary:!0}),u=p3(l,n.floating);return{data:{escapedOffsets:u,escaped:x3(u)}}}default:return{}}}}},g8=new Set(["left","top"]);async function Jne(e,t){const{placement:n,platform:r,elements:s}=e,i=await(r.isRTL==null?void 0:r.isRTL(s.floating)),l=ki(n),u=vd(n),d=Ts(n)==="y",f=g8.has(l)?-1:1,h=i&&d?-1:1,p=Ti(t,e);let{mainAxis:x,crossAxis:y,alignmentAxis:w}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}
9:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return u&&typeof w=="number"&&(y=u==="end"?w*-1:w),d?{x:y*h,y:x*f}:{x:x*f,y:y*h}}const ere=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:s,y:i,placement:l,middlewareData:u}=t,d=await Jne(t,e);return l===((n=u.offset)==null?void 0:n.placement)&&(r=u.arrow)!=null&&r.alignmentOffset?{}:{x:s+d.x,y:i+d.y,data:{...d,placement:l}}}}},tre=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:s,platform:i}=t,{mainAxis:l=!0,crossAxis:u=!1,limiter:d={fn:C=>{let{x:N,y:k}=C;return{x:N,y:k}}},...f}=Ti(e,t),h={x:n,y:r},p=await i.detectOverflow(t,f),x=Ts(ki(s)),y=gT(x);let w=h[y],j=h[x];if(l){const C=y==="y"?"top":"left",N=y==="y"?"bottom":"right",k=w+p[C],T=w-p[N];w=U2(k,w,T)}if(u){const C=x==="y"?"top":"left",N=x==="y"?"bottom":"right",k=j+p[C],T=j-p[N];j=U2(k,j,T)}const b=d.fn({...t,[y]:w,[x]:j});return{...b,data:{x:b.x-n,y:b.y-r,enabled:{[y]:l,[x]:u}}}}}},nre=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:s,rects:i,middlewareData:l}=t,{offset:u=0,mainAxis:d=!0,crossAxis:f=!0}=Ti(e,t),h={x:n,y:r},p=Ts(s),x=gT(p);let y=h[x],w=h[p];const j=Ti(u,t),b=typeof j=="number"?{mainAxis:j,crossAxis:0}:{mainAxis:0,crossAxis:0,...j};if(d){const k=x==="y"?"height":"width",T=i.reference[x]-i.floating[k]+b.mainAxis,A=i.reference[x]+i.reference[k]-b.mainAxis;y<T?y=T:y>A&&(y=A)}if(f){var C,N;const k=x==="y"?"width":"height",T=g8.has(ki(s)),A=i.reference[p]-i.floating[k]+(T&&((C=l.offset)==null?void 0:C[p])||0)+(T?0:b.crossAxis),P=i.reference[p]+i.reference[k]+(T?0:((N=l.offset)==null?void 0:N[p])||0)-(T?b.crossAxis:0);w<A?w=A:w>P&&(w=P)}return{[x]:y,[p]:w}}}},rre=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:s,rects:i,platform:l,elements:u}=t,{apply:d=()=>{},...f}=Ti(e,t),h=await l.detectOverflow(t,f),p=ki(s),x=vd(s),y=Ts(s)==="y",{width:w,height:j}=i.floating;let b,C;p==="top"||p==="bottom"?(b=p,C=x===(await(l.isRTL==null?void 0:l.isRTL(u.floating))?"start":"end")?"left":"right"):(C=p,b=x==="end"?"top":"bottom");const N=j-h.top-h.bottom,k=w-h.left-h.right,T=Do(j-h[b],N),A=Do(w-h[C],k),P=!t.middlewareData.shift;let E=T,_=A;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(_=k),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(E=N),P&&!x){const H=ia(h.left,0),L=ia(h.right,0),I=ia(h.top,0),W=ia(h.bottom,0);y?_=w-2*(H!==0||L!==0?H+L:ia(h.left,h.right)):E=j-2*(I!==0||W!==0?I+W:ia(h.top,h.bottom))}await d({...t,availableWidth:_,availableHeight:E});const R=await l.getDimensions(u.floating);return w!==R.width||j!==R.height?{reset:{rects:!0}}:{}}}};function uv(){return typeof window<"u"}function bd(e){return y8(e)?(e.nodeName||"").toLowerCase():"#document"}function la(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Is(e){var t;return(t=(y8(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function y8(e){return uv()?e instanceof Node||e instanceof la(e).Node:!1}function is(e){return uv()?e instanceof Element||e instanceof la(e).Element:!1}function Ri(e){return uv()?e instanceof HTMLElement||e instanceof la(e).HTMLElement:!1}function g3(e){return!uv()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof la(e).ShadowRoot}function Ah(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=os(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&s!=="inline"&&s!=="contents"}function are(e){return/^(table|td|th)$/.test(bd(e))}function dv(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const sre=/transform|translate|scale|rotate|perspective|filter/,ire=/paint|layout|strict|content/,jl=e=>!!e&&e!=="none";let Mj;function bT(e){const t=is(e)?os(e):e;return jl(t.transform)||jl(t.translate)||jl(t.scale)||jl(t.rotate)||jl(t.perspective)||!jT()&&(jl(t.backdropFilter)||jl(t.filter))||sre.test(t.willChange||"")||ire.test(t.contain||"")}function ore(e){let t=$o(e);for(;Ri(t)&&!$u(t);){if(bT(t))return t;if(dv(t))return null;t=$o(t)}return null}function jT(){return Mj==null&&(Mj=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Mj}function $u(e){return/^(html|body|#document)$/.test(bd(e))}function os(e){return la(e).getComputedStyle(e)}function fv(e){return is(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function $o(e){if(bd(e)==="html")return e;const t=e.assignedSlot||e.parentNode||g3(e)&&e.host||Is(e);return g3(t)?t.host:t}function v8(e){const t=$o(e);return $u(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ri(t)&&Ah(t)?t:v8(t)}function km(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=v8(e),i=s===((r=e.ownerDocument)==null?void 0:r.body),l=la(s);if(i){const u=V2(l);
vendor: 4,603 bytes, line 9
9return t.concat(l,l.visualViewport||[],Ah(s)?s:[],u&&n?km(u):[])}else return t.concat(s,km(s,[],n))}function V2(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function b8(e){const t=os(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=Ri(e),i=s?e.offsetWidth:n,l=s?e.offsetHeight:r,u=Pg(n)!==i||Pg(r)!==l;return u&&(n=i,r=l),{width:n,height:r,$:u}}function wT(e){return is(e)?e:e.contextElement}function Au(e){const t=wT(e);if(!Ri(t))return Os(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:i}=b8(t);let l=(i?Pg(n.width):n.width)/r,u=(i?Pg(n.height):n.height)/s;return(!l||!Number.isFinite(l))&&(l=1),(!u||!Number.isFinite(u))&&(u=1),{x:l,y:u}}const lre=Os(0);function j8(e){const t=la(e);return!jT()||!t.visualViewport?lre:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function cre(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==la(e)?!1:t}function Vl(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),i=wT(e);let l=Os(1);t&&(r?is(r)&&(l=Au(r)):l=Au(e));const u=cre(i,n,r)?j8(i):Os(0);let d=(s.left+u.x)/l.x,f=(s.top+u.y)/l.y,h=s.width/l.x,p=s.height/l.y;if(i){const x=la(i),y=r&&is(r)?la(r):r;let w=x,j=V2(w);for(;j&&r&&y!==w;){const b=Au(j),C=j.getBoundingClientRect(),N=os(j),k=C.left+(j.clientLeft+parseFloat(N.paddingLeft))*b.x,T=C.top+(j.clientTop+parseFloat(N.paddingTop))*b.y;d*=b.x,f*=b.y,h*=b.x,p*=b.y,d+=k,f+=T,w=la(j),j=V2(w)}}return _g({width:h,height:p,x:d,y:f})}function mv(e,t){const n=fv(e).scrollLeft;return t?t.left+n:Vl(Is(e)).left+n}function w8(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-mv(e,n),s=n.top+t.scrollTop;return{x:r,y:s}}function ure(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const i=s==="fixed",l=Is(r),u=t?dv(t.floating):!1;if(r===l||u&&i)return n;let d={scrollLeft:0,scrollTop:0},f=Os(1);const h=Os(0),p=Ri(r);if((p||!p&&!i)&&((bd(r)!=="body"||Ah(l))&&(d=fv(r)),p)){const y=Vl(r);f=Au(r),h.x=y.x+r.clientLeft,h.y=y.y+r.clientTop}const x=l&&!p&&!i?w8(l,d):Os(0);return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-d.scrollLeft*f.x+h.x+x.x,y:n.y*f.y-d.scrollTop*f.y+h.y+x.y}}function dre(e){return Array.from(e.getClientRects())}function fre(e){const t=Is(e),n=fv(e),r=e.ownerDocument.body,s=ia(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=ia(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let l=-n.scrollLeft+mv(e);const u=-n.scrollTop;return os(r).direction==="rtl"&&(l+=ia(t.clientWidth,r.clientWidth)-s),{width:s,height:i,x:l,y:u}}const y3=25;function mre(e,t){const n=la(e),r=Is(e),s=n.visualViewport;let i=r.clientWidth,l=r.clientHeight,u=0,d=0;if(s){i=s.width,l=s.height;const h=jT();(!h||h&&t==="fixed")&&(u=s.offsetLeft,d=s.offsetTop)}const f=mv(r);if(f<=0){const h=r.ownerDocument,p=h.body,x=getComputedStyle(p),y=h.compatMode==="CSS1Compat"&&parseFloat(x.marginLeft)+parseFloat(x.marginRight)||0,w=Math.abs(r.clientWidth-p.clientWidth-y);w<=y3&&(i-=w)}else f<=y3&&(i+=f);return{width:i,height:l,x:u,y:d}}function hre(e,t){const n=Vl(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,i=Ri(e)?Au(e):Os(1),l=e.clientWidth*i.x,u=e.clientHeight*i.y,d=s*i.x,f=r*i.y;return{width:l,height:u,x:d,y:f}}function v3(e,t,n){let r;if(t==="viewport")r=mre(e,n);else if(t==="document")r=fre(Is(e));else if(is(t))r=hre(t,n);else{const s=j8(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return _g(r)}function N8(e,t){const n=$o(e);return n===t||!is(n)||$u(n)?!1:os(n).position==="fixed"||N8(n,t)}function pre(e,t){const n=t.get(e);if(n)return n;let r=km(e,[],!1).filter(u=>is(u)&&bd(u)!=="body"),s=null;const i=os(e).position==="fixed";let l=i?$o(e):e;for(;is(l)&&!$u(l);){const u=os(l),d=bT(l);!d&&u.position==="fixed"&&(s=null),(i?!d&&!s:!d&&u.position==="static"&&!!s&&(s.position==="absolute"||s.position==="fixed")||Ah(l)&&!d&&N8(e,l))?r=r.filter(h=>h!==l):s=u,l=$o(l)}return t.set(e,r),r}function xre(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const l=[...n==="clippingAncestors"?dv(t)?[]:pre(t,this._c):[].concat(n),r],u=v3(t,l[0],s);let d=u.top,f=u.right,h=u.bottom,p=u.left;for(let x=1;x<l.length;x++){const y=v3(t,l[x],s);d=ia(y.top,d),f=Do(y.right,f),h=Do(y.bottom,h),p=ia(y.left,p)}return{width:f-p,height:h-d,x:p,y:d}}function gre(e){const{width:t,height:n}=b8(e);return{width:t,height:n}}function yre(e,t,n){const r=Ri(t),s=Is(t),i=n==="fixed",l=Vl(e,!0,i,t);let u={scrollLeft:0,scrollTop:0};const d=Os(0);function f(){d.x=mv(s)}if(r||!r&&!i)if((bd(t)!=="body"||Ah(s))&&(u=fv(t)),r){const y=Vl(t,!0,i,t);d.x=y.x+t.clientLeft,d.y=y.y+t.clientTop}else s&&f();i&&!r&&s&&f();
vendor: 4,333 bytes, line 9
9const h=s&&!r&&!i?w8(s,u):Os(0),p=l.left+u.scrollLeft-d.x-h.x,x=l.top+u.scrollTop-d.y-h.y;return{x:p,y:x,width:l.width,height:l.height}}function Rj(e){return os(e).position==="static"}function b3(e,t){if(!Ri(e)||os(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Is(e)===n&&(n=n.ownerDocument.body),n}function S8(e,t){const n=la(e);if(dv(e))return n;if(!Ri(e)){let s=$o(e);for(;s&&!$u(s);){if(is(s)&&!Rj(s))return s;s=$o(s)}return n}let r=b3(e,t);for(;r&&are(r)&&Rj(r);)r=b3(r,t);return r&&$u(r)&&Rj(r)&&!bT(r)?n:r||ore(e)||n}const vre=async function(e){const t=this.getOffsetParent||S8,n=this.getDimensions,r=await n(e.floating);return{reference:yre(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function bre(e){return os(e).direction==="rtl"}const jre={convertOffsetParentRelativeRectToViewportRelativeRect:ure,getDocumentElement:Is,getClippingRect:xre,getOffsetParent:S8,getElementRects:vre,getClientRects:dre,getDimensions:gre,getScale:Au,isElement:is,isRTL:bre};function C8(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function wre(e,t){let n=null,r;const s=Is(e);function i(){var u;clearTimeout(r),(u=n)==null||u.disconnect(),n=null}function l(u,d){u===void 0&&(u=!1),d===void 0&&(d=1),i();const f=e.getBoundingClientRect(),{left:h,top:p,width:x,height:y}=f;if(u||t(),!x||!y)return;const w=jx(p),j=jx(s.clientWidth-(h+x)),b=jx(s.clientHeight-(p+y)),C=jx(h),k={rootMargin:-w+"px "+-j+"px "+-b+"px "+-C+"px",threshold:ia(0,Do(1,d))||1};let T=!0;function A(P){const E=P[0].intersectionRatio;if(E!==d){if(!T)return l();E?l(!1,E):r=setTimeout(()=>{l(!1,1e-7)},1e3)}E===1&&!C8(f,e.getBoundingClientRect())&&l(),T=!1}try{n=new IntersectionObserver(A,{...k,root:s.ownerDocument})}catch{n=new IntersectionObserver(A,k)}n.observe(e)}return l(!0),i}function Nre(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:i=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:u=typeof IntersectionObserver=="function",animationFrame:d=!1}=r,f=wT(e),h=s||i?[...f?km(f):[],...t?km(t):[]]:[];h.forEach(C=>{s&&C.addEventListener("scroll",n,{passive:!0}),i&&C.addEventListener("resize",n)});const p=f&&u?wre(f,n):null;let x=-1,y=null;l&&(y=new ResizeObserver(C=>{let[N]=C;N&&N.target===f&&y&&t&&(y.unobserve(t),cancelAnimationFrame(x),x=requestAnimationFrame(()=>{var k;(k=y)==null||k.observe(t)})),n()}),f&&!d&&y.observe(f),t&&y.observe(t));let w,j=d?Vl(e):null;d&&b();function b(){const C=Vl(e);j&&!C8(j,C)&&n(),j=C,w=requestAnimationFrame(b)}return n(),()=>{var C;h.forEach(N=>{s&&N.removeEventListener("scroll",n),i&&N.removeEventListener("resize",n)}),p?.(),(C=y)==null||C.disconnect(),y=null,d&&cancelAnimationFrame(w)}}const Sre=ere,Cre=tre,Are=Qne,Tre=rre,kre=Zne,j3=Xne,Ore=nre,Pre=(e,t,n)=>{const r=new Map,s={platform:jre,...n},i={...s.platform,_c:r};return Yne(e,t,{...s,platform:i})};var Ere=typeof document<"u",_re=function(){},ag=Ere?v.useLayoutEffect:_re;function Mg(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,s;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Mg(e[r],t[r]))return!1;return!0}if(s=Object.keys(e),n=s.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,s[r]))return!1;for(r=n;r--!==0;){const i=s[r];if(!(i==="_owner"&&e.$$typeof)&&!Mg(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function A8(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function w3(e,t){const n=A8(e);return Math.round(t*n)/n}function Dj(e){const t=v.useRef(e);return ag(()=>{t.current=e}),t}function Mre(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:i,floating:l}={},transform:u=!0,whileElementsMounted:d,open:f}=e,[h,p]=v.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[x,y]=v.useState(r);Mg(x,r)||y(r);const[w,j]=v.useState(null),[b,C]=v.useState(null),N=v.useCallback(K=>{K!==P.current&&(P.current=K,j(K))},[]),k=v.useCallback(K=>{K!==E.current&&(E.current=K,C(K))},[]),T=i||w,A=l||b,P=v.useRef(null),E=v.useRef(null),_=v.useRef(h),R=d!=null,H=Dj(d),L=Dj(s),I=Dj(f),W=v.useCallback(()=>
vendor: 8,793 bytes, line 9
9{if(!P.current||!E.current)return;const K={placement:t,strategy:n,middleware:x};L.current&&(K.platform=L.current),Pre(P.current,E.current,K).then(Y=>{const z={...Y,isPositioned:I.current!==!1};U.current&&!Mg(_.current,z)&&(_.current=z,pd.flushSync(()=>{p(z)}))})},[x,t,n,L,I]);ag(()=>{f===!1&&_.current.isPositioned&&(_.current.isPositioned=!1,p(K=>({...K,isPositioned:!1})))},[f]);const U=v.useRef(!1);ag(()=>(U.current=!0,()=>{U.current=!1}),[]),ag(()=>{if(T&&(P.current=T),A&&(E.current=A),T&&A){if(H.current)return H.current(T,A,W);W()}},[T,A,W,H,R]);const V=v.useMemo(()=>({reference:P,floating:E,setReference:N,setFloating:k}),[N,k]),D=v.useMemo(()=>({reference:T,floating:A}),[T,A]),q=v.useMemo(()=>{const K={position:n,left:0,top:0};if(!D.floating)return K;const Y=w3(D.floating,h.x),z=w3(D.floating,h.y);return u?{...K,transform:"translate("+Y+"px, "+z+"px)",...A8(D.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:Y,top:z}},[n,u,D.floating,h.x,h.y]);return v.useMemo(()=>({...h,update:W,refs:V,elements:D,floatingStyles:q}),[h,W,V,D,q])}const Rre=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:s}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?j3({element:r.current,padding:s}).fn(n):{}:r?j3({element:r,padding:s}).fn(n):{}}}},Dre=(e,t)=>{const n=Sre(e);return{name:n.name,fn:n.fn,options:[e,t]}},$re=(e,t)=>{const n=Cre(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ire=(e,t)=>({fn:Ore(e).fn,options:[e,t]}),Lre=(e,t)=>{const n=Are(e);return{name:n.name,fn:n.fn,options:[e,t]}},Fre=(e,t)=>{const n=Tre(e);return{name:n.name,fn:n.fn,options:[e,t]}},qre=(e,t)=>{const n=kre(e);return{name:n.name,fn:n.fn,options:[e,t]}},Bre=(e,t)=>{const n=Rre(e);return{name:n.name,fn:n.fn,options:[e,t]}};var zre="Arrow",T8=v.forwardRef((e,t)=>{const{children:n,width:r=10,height:s=5,...i}=e;return a.jsx(We.svg,{...i,ref:t,width:r,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:a.jsx("polygon",{points:"0,0 30,0 15,10"})})});T8.displayName=zre;var Ure=T8;function NT(e){const[t,n]=v.useState(void 0);return Un(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const i=s[0];let l,u;if("borderBoxSize"in i){const d=i.borderBoxSize,f=Array.isArray(d)?d[0]:d;l=f.inlineSize,u=f.blockSize}else l=e.offsetWidth,u=e.offsetHeight;n({width:l,height:u})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var ST="Popper",[k8,zo]=Sr(ST),[Hre,O8]=k8(ST),P8=e=>{const{__scopePopper:t,children:n}=e,[r,s]=v.useState(null);return a.jsx(Hre,{scope:t,anchor:r,onAnchorChange:s,children:n})};P8.displayName=ST;var E8="PopperAnchor",_8=v.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...s}=e,i=O8(E8,n),l=v.useRef(null),u=it(t,l),d=v.useRef(null);return v.useEffect(()=>{const f=d.current;d.current=r?.current||l.current,f!==d.current&&i.onAnchorChange(d.current)}),r?null:a.jsx(We.div,{...s,ref:u})});_8.displayName=E8;var CT="PopperContent",[Vre,Gre]=k8(CT),M8=v.forwardRef((e,t)=>{const{__scopePopper:n,side:r="bottom",sideOffset:s=0,align:i="center",alignOffset:l=0,arrowPadding:u=0,avoidCollisions:d=!0,collisionBoundary:f=[],collisionPadding:h=0,sticky:p="partial",hideWhenDetached:x=!1,updatePositionStrategy:y="optimized",onPlaced:w,...j}=e,b=O8(CT,n),[C,N]=v.useState(null),k=it(t,ee=>N(ee)),[T,A]=v.useState(null),P=NT(T),E=P?.width??0,_=P?.height??0,R=r+(i!=="center"?"-"+i:""),H=typeof h=="number"?h:{top:0,right:0,bottom:0,left:0,...h},L=Array.isArray(f)?f:[f],I=L.length>0,W={padding:H,boundary:L.filter(Wre),altBoundary:I},{refs:U,floatingStyles:V,placement:D,isPositioned:q,middlewareData:K}=Mre({strategy:"fixed",placement:R,whileElementsMounted:(...ee)=>Nre(...ee,{animationFrame:y==="always"}),elements:{reference:b.anchor},middleware:[Dre({mainAxis:s+_,alignmentAxis:l}),d&&$re({mainAxis:!0,crossAxis:!1,limiter:p==="partial"?Ire():void 0,...W}),d&&Lre({...W}),Fre({...W,apply:({elements:ee,rects:ve,availableWidth:ue,availableHeight:de})=>{const{width:Se,height:he}=ve.reference,ce=ee.floating.style;ce.setProperty("--radix-popper-available-width",`${ue}px`),ce.setProperty("--radix-popper-available-height",`${de}px`),ce.setProperty("--radix-popper-anchor-width",`${Se}px`),ce.setProperty("--radix-popper-anchor-height",`${he}px`)}}),T&&Bre({element:T,padding:u}),Yre({arrowWidth:E,arrowHeight:_}),x&&qre({strategy:"referenceHidden",...W})]}),[Y,z]=$8(D),Z=hn(w);Un(()=>{q&&Z?.()},[q,Z]);const F=K.arrow?.x,B=K.arrow?.y,X=K.arrow?.centerOffset!==0,[Q,se]=v.useState();return Un(()=>{C&&se(window.getComputedStyle(C).zIndex)},[C]),a.jsx("div",{ref:U.setFloating,"data-radix-popper-content-wrapper":"",style:{...V,transform:q?V.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Q,"--radix-popper-transform-origin":[K.transformOrigin?.x,K.transformOrigin?.y].join(" "),...K.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:a.jsx(Vre,{scope:n,placedSide:Y,onArrowChange:A,arrowX:F,arrowY:B,shouldHideArrow:X,children:a.jsx(We.div,{"data-side":Y,"data-align":z,...j,ref:k,style:{...j.style,animation:q?void 0:"none"}})})})});M8.displayName=CT;var R8="PopperArrow",Kre={top:"bottom",right:"left",bottom:"top",left:"right"},D8=v.forwardRef(function(t,n){const{__scopePopper:r,...s}=t,i=Gre(R8,r),l=Kre[i.placedSide];return a.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[l]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:a.jsx(Ure,{...s,ref:n,style:{...s.style,display:"block"}})})});D8.displayName=R8;function Wre(e){return e!==null}var Yre=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:r,middlewareData:s}=t,l=s.arrow?.centerOffset!==0,u=l?0:e.arrowWidth,d=l?0:e.arrowHeight,[f,h]=$8(n),p={start:"0%",center:"50%",end:"100%"}[h],x=(s.arrow?.x??0)+u/2,y=(s.arrow?.y??0)+d/2;let w="",j="";return f==="bottom"?(w=l?p:`${x}px`,j=`${-d}px`):f==="top"?(w=l?p:`${x}px`,j=`${r.floating.height+d}px`):f==="right"?(w=`${-d}px`,j=l?p:`${y}px`):f==="left"&&(w=`${r.floating.width+d}px`,j=l?p:`${y}px`),{data:{x:w,y:j}}}});function $8(e){const[t,n="center"]=e.split("-");return[t,n]}var AT=P8,Th=_8,hv=M8,pv=D8,[xv]=Sr("Tooltip",[zo]),TT=zo(),I8="TooltipProvider",Xre=700,N3="tooltip.open",[Qre,L8]=xv(I8),F8=e=>{const{__scopeTooltip:t,delayDuration:n=Xre,skipDelayDuration:r=300,disableHoverableContent:s=!1,children:i}=e,l=v.useRef(!0),u=v.useRef(!1),d=v.useRef(0);return v.useEffect(()=>{const f=d.current;return()=>window.clearTimeout(f)},[]),a.jsx(Qre,{scope:t,isOpenDelayedRef:l,delayDuration:n,onOpen:v.useCallback(()=>{window.clearTimeout(d.current),l.current=!1},[]),onClose:v.useCallback(()=>{window.clearTimeout(d.current),d.current=window.setTimeout(()=>l.current=!0,r)},[r]),isPointerInTransitRef:u,onPointerInTransitChange:v.useCallback(f=>{u.current=f},[]),disableHoverableContent:s,children:i})};F8.displayName=I8;var q8="Tooltip",[CMe,kh]=xv(q8),G2="TooltipTrigger",Zre=v.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,s=kh(G2,n),i=L8(G2,n),l=TT(n),u=v.useRef(null),d=it(t,u,s.onTriggerChange),f=v.useRef(!1),h=v.useRef(!1),p=v.useCallback(()=>f.current=!1,[]);return v.useEffect(()=>()=>document.removeEventListener("pointerup",p),[p]),a.jsx(Th,{asChild:!0,...l,children:a.jsx(We.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...r,ref:d,onPointerMove:Re(e.onPointerMove,x=>{x.pointerType!=="touch"&&!h.current&&!i.isPointerInTransitRef.current&&(s.onTriggerEnter(),h.current=!0)}),onPointerLeave:Re(e.onPointerLeave,()=>{s.onTriggerLeave(),h.current=!1}),onPointerDown:Re(e.onPointerDown,()=>{s.open&&s.onClose(),f.current=!0,document.addEventListener("pointerup",p,{once:!0})}),onFocus:Re(e.onFocus,()=>{f.current||s.onOpen()}),onBlur:Re(e.onBlur,s.onClose),onClick:Re(e.onClick,s.onClose)})})});Zre.displayName=G2;var kT="TooltipPortal",[Jre,eae]=xv(kT,{forceMount:void 0}),B8=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:s}=e,i=kh(kT,t);return a.jsx(Jre,{scope:t,forceMount:n,children:a.jsx(Rn,{present:n||i.open,children:a.jsx(rc,{asChild:!0,container:s,children:r})})})};B8.displayName=kT;var Iu="TooltipContent",z8=v.forwardRef((e,t)=>{const n=eae(Iu,e.__scopeTooltip),{forceMount:r=n.forceMount,side:s="top",...i}=e,l=kh(Iu,e.__scopeTooltip);return a.jsx(Rn,{present:r||l.open,children:l.disableHoverableContent?a.jsx(U8,{side:s,...i,ref:t}):a.jsx(tae,{side:s,...i,ref:t})})}),tae=v.forwardRef((e,t)=>
vendor: 4,352 bytes, line 9
9{const n=kh(Iu,e.__scopeTooltip),r=L8(Iu,e.__scopeTooltip),s=v.useRef(null),i=it(t,s),[l,u]=v.useState(null),{trigger:d,onClose:f}=n,h=s.current,{onPointerInTransitChange:p}=r,x=v.useCallback(()=>{u(null),p(!1)},[p]),y=v.useCallback((w,j)=>{const b=w.currentTarget,C={x:w.clientX,y:w.clientY},N=iae(C,b.getBoundingClientRect()),k=oae(C,N),T=lae(j.getBoundingClientRect()),A=uae([...k,...T]);u(A),p(!0)},[p]);return v.useEffect(()=>()=>x(),[x]),v.useEffect(()=>{if(d&&h){const w=b=>y(b,h),j=b=>y(b,d);return d.addEventListener("pointerleave",w),h.addEventListener("pointerleave",j),()=>{d.removeEventListener("pointerleave",w),h.removeEventListener("pointerleave",j)}}},[d,h,y,x]),v.useEffect(()=>{if(l){const w=j=>{const b=j.target,C={x:j.clientX,y:j.clientY},N=d?.contains(b)||h?.contains(b),k=!cae(C,l);N?x():k&&(x(),f())};return document.addEventListener("pointermove",w),()=>document.removeEventListener("pointermove",w)}},[d,h,l,f,x]),a.jsx(U8,{...e,ref:i})}),[nae,rae]=xv(q8,{isInside:!1}),aae=cq("TooltipContent"),U8=v.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":s,onEscapeKeyDown:i,onPointerDownOutside:l,...u}=e,d=kh(Iu,n),f=TT(n),{onClose:h}=d;return v.useEffect(()=>(document.addEventListener(N3,h),()=>document.removeEventListener(N3,h)),[h]),v.useEffect(()=>{if(d.trigger){const p=x=>{x.target?.contains(d.trigger)&&h()};return window.addEventListener("scroll",p,{capture:!0}),()=>window.removeEventListener("scroll",p,{capture:!0})}},[d.trigger,h]),a.jsx(nc,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:l,onFocusOutside:p=>p.preventDefault(),onDismiss:h,children:a.jsxs(hv,{"data-state":d.stateAttribute,...f,...u,ref:t,style:{...u.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[a.jsx(aae,{children:r}),a.jsx(nae,{scope:n,isInside:!0,children:a.jsx(mZ,{id:d.contentId,role:"tooltip",children:s||r})})]})})});z8.displayName=Iu;var H8="TooltipArrow",sae=v.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,s=TT(n);return rae(H8,n).isInside?null:a.jsx(pv,{...s,...r,ref:t})});sae.displayName=H8;function iae(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),s=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(n,r,s,i)){case i:return"left";case s:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function oae(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function lae(e){const{top:t,right:n,bottom:r,left:s}=e;return[{x:s,y:t},{x:n,y:t},{x:n,y:r},{x:s,y:r}]}function cae(e,t){const{x:n,y:r}=e;let s=!1;for(let i=0,l=t.length-1;i<t.length;l=i++){const u=t[i],d=t[l],f=u.x,h=u.y,p=d.x,x=d.y;h>r!=x>r&&n<(p-f)*(r-h)/(x-h)+f&&(s=!s)}return s}function uae(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),dae(t)}function dae(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const s=e[r];for(;t.length>=2;){const i=t[t.length-1],l=t[t.length-2];if((i.x-l.x)*(s.y-l.y)>=(i.y-l.y)*(s.x-l.x))t.pop();else break}t.push(s)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const s=e[r];for(;n.length>=2;){const i=n[n.length-1],l=n[n.length-2];if((i.x-l.x)*(s.y-l.y)>=(i.y-l.y)*(s.x-l.x))n.pop();else break}n.push(s)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var fae=F8,mae=B8,V8=z8;const hae=fae,pae=v.forwardRef(({className:e,sideOffset:t=4,...n},r)=>a.jsx(mae,{children:a.jsx(V8,{ref:r,sideOffset:t,className:qe("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:sli
9de-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",e),...n})}));pae.displayName=V8.displayName;const G8=v.createContext({teamMember:null,isLoading:!0,isTeam:!1,logout:()=>{}});function xae({children:e}){const[t,n]=v.useState(null),[r,s]=v.useState(!0);v.useEffect(()=>{const l=localStorage.getItem("fs_team_token");if(!l){s(!1);return}fetch("/api/auth/me",{headers:{Authorization:`Bearer ${l}`}}).then(u=>u.ok?u.json():(localStorage.removeItem("fs_team_token"),null)).then(u=>{u&&n(u)}).finally(()=>s(!1))},[]);const i=()=>{localStorage.removeItem("fs_team_token"),localStorage.removeItem("fs_client_token"),n(null),window.location.href="/login"};return a.jsx(G8.Provider,{value:{teamMember:t,isLoading:r,isTeam:!!t,logout:i},children:e})}const Nn=()=>v.useContext(G8);function gae({children:e}){const{teamMember:t,isLoading:n}=Nn(),[,r]=fr();return v.useEffect(()=>{!n&&!t&&r("/login")},[t,n,r]),n?a.jsx(OT,{}):t?a.jsx(a.Fragment,{children:e}):null}const yae=["admin","manager","estimator"];function wx({children:e}){const{teamMember:t,isLoading:n}=Nn();return n?a.jsx(OT,{}):t?yae.includes(t.role)?a.jsx(a.Fragment,{children:e}):a.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[60vh] gap-2 text-center px-6",children:[a.jsx("h2",{className:"text-xl font-semibold text-foreground",children:"Access denied"}),a.jsx("p",{className:"text-muted-foreground max-w-sm",children:"You don't have permission to view quote pricing. Contact an administrator if you need access."})]}):null}function $j({children:e}){const[t,n]=v.useState(!1),[r,s]=v.useState(!1),[,i]=fr();return v.useEffect(()=>{const l=localStorage.getItem("fs_client_token");if(!l){n(!0);return}fetch("/api/auth/client-portal/me",{headers:{Authorization:`Bearer ${l}`}}).then(u=>{if(!u.ok){localStorage.removeItem("fs_client_token");return}s(!0)}).finally(()=>n(!0))},[]),v.useEffect(()=>{t&&!r&&i("/client-login")},[t,r,i]),t?r?a.jsx(a.Fragment,{children:e}):null:a.jsx(OT,{})}function OT(){return a.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:a.jsxs("div",{className:"flex flex-col items-center gap-4",children:[a.jsx("div",{className:"animate-spin h-10 w-10 border-4 border-primary border-t-transparent rounded-full"}),a.jsx("h2",{className:"text-xl font-medium text-foreground",children:"Loading Five Star..."})]})})}const Rg="/assets/5_Star_horizontal_logo_Dec_2025_1773753482469-BW1ZGuTC.png";var vae=Symbol.for("react.lazy"),Dg=av[" use ".trim().toString()];function bae(e){return typeof e=="object"&&e!==null&&"then"in e}function K8(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===vae&&"_payload"in e&&bae(e._payload)}function W8(e){const t=wae(e),n=v.forwardRef((r,s)=>{let{children:i,...l}=r;K8(i)&&typeof Dg=="function"&&(i=Dg(i._payload));const u=v.Children.toArray(i),d=u.find(Sae);if(d){const f=d.props.children,h=u.map(p=>p===d?v.Children.count(f)>1?v.Children.only(null):v.isValidElement(f)?f.props.children:null:p);return a.jsx(t,{...l,ref:s,children:v.isValidElement(f)?v.cloneElement(f,void 0,h):null})}return a.jsx(t,{...l,ref:s,children:i})});return n.displayName=`${e}.Slot`,n}var jae=W8("Slot");function wae(e){const t=v.forwardRef((n,r)=>{let{children:s,...i}=n;if(K8(s)&&typeof Dg=="function"&&(s=Dg(s._payload)),v.isValidElement(s)){const l=Aae(s),u=Cae(i,s.props);return s.type!==v.Fragment&&(u.ref=r?Ms(r,l):l),v.cloneElement(s,u)}return v.Children.count(s)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Nae=Symbol("radix.slottable");function Sae(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Nae}function Cae(e,t){const n={...t};for(const r in t){const s=e[r],i=t[r];/^on[A-Z]/.test(r)?s&&i?n[r]=(...u)=>{const d=i(...u);return s(...u),d}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...e,...n}}function Aae(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}const PT=cv("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 hover-elevate active-elevate-2",{variants:{variant:{default:"bg-primary text-primary-foreground border border-primary-border",destructive:"bg-destructive text-destructive-foreground shadow-sm border-destructive-border",outline:" border [border-color:var(--button-outline)] shadow-xs active:shadow-none ",secondary:"border bg-secondary text-secondary-foreground border border-secondary-border ",ghost:"border border-transparent",link:"text-primary underline-offset-4 hover:underline"},size:{default:"min-h-9 px-4 py-2",sm:"min-h-8 rounded-md px-3 text-xs",lg:"min-h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),ne=v.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...s},i)=>{const l=r?jae:"button";return a.jsx(l,{className:qe(PT({variant:t,size:n,className:e})),ref:i,...s})});
9ne.displayName="Button";const Tae=new Set([204,205,304]),kae="application/json, application/problem+json";function Y8(e){return typeof Request<"u"&&e instanceof Request}function Oae(e,t){return t?t.toUpperCase():Y8(e)?e.method.toUpperCase():"GET"}function Pae(e){return typeof URL<"u"&&e instanceof URL}function Eae(e){return typeof e=="string"?e:Pae(e)?e.toString():e.url}function _ae(...e){const t=new Headers;for(const n of e)n&&new Headers(n).forEach((r,s)=>{t.set(s,r)});return t}function X8(e){const t=e.get("content-type");return t?t.split(";",1)[0].trim().toLowerCase():null}function K2(e){return e==="application/json"||!!e?.endsWith("+json")}function Q8(e){return!!(e&&(e.startsWith("text/")||e==="application/xml"||e==="text/xml"||e.endsWith("+xml")||e==="application/x-www-form-urlencoded"))}function Z8(e,t){return!!(t==="HEAD"||Tae.has(e.status)||e.headers.get("content-length")==="0"||e.body==null)}function J8(e){return e.charCodeAt(0)===65279?e.slice(1):e}function eB(e){const t=e.trimStart();return t.startsWith("{")||t.startsWith("[")}function Df(e,t){if(!e||typeof e!="object")return;const n=e[t];if(typeof n!="string")return;const r=n.trim();return r===""?void 0:r}function Mae(e,t=300){return e.length>t?`${e.slice(0,t-1)}…`:e}function Rae(e,t){const n=`HTTP ${e.status} ${e.statusText}`;if(typeof t=="string"){const l=t.trim();return l?`${n}: ${Mae(l)}`:n}const r=Df(t,"title"),s=Df(t,"detail"),i=Df(t,"message")??Df(t,"error_description")??Df(t,"error");return r&&s?`${n}: ${r} — ${s}`:s?`${n}: ${s}`:i?`${n}: ${i}`:r?`${n}: ${r}`:n}class Dae extends Error{name="ApiError";status;statusText;data;headers;response;method;url;constructor(t,n,r){super(Rae(t,n)),Object.setPrototypeOf(this,new.target.prototype),this.status=t.status,this.statusText=t.statusText,this.data=n,this.headers=t.headers,this.response=t,this.method=r.method,this.url=t.url||r.url}}class $ae extends Error{name="ResponseParseError";status;statusText;headers;response;method;url;rawBody;cause;constructor(t,n,r,s){super(`Failed to parse response from ${s.method} ${t.url||s.url} (${t.status} ${t.statusText}) as JSON`),Object.setPrototypeOf(this,new.target.prototype),this.status=t.status,this.statusText=t.statusText,this.headers=t.headers,this.response=t,this.method=s.method,this.url=t.url||s.url,this.rawBody=n,this.cause=r}}async function Iae(e,t){const n=await e.text(),r=J8(n);if(r.trim()==="")return null;try{return JSON.parse(r)}catch(s){throw new $ae(e,n,s,t)}}async function Lae(e,t){if(Z8(e,t))return null;const n=X8(e.headers);if(n&&!K2(n)&&!Q8(n))return typeof e.blob=="function"?e.blob():e.text();const r=await e.text(),s=J8(r);if(s.trim()==="")return null;if(K2(n)||eB(s))try{return JSON.parse(s)}catch{return r}return r}function Fae(e){const t=X8(e.headers);return K2(t)?"json":Q8(t)||t==null?"text":"blob"}async function qae(e,t,n){if(Z8(e,n.method))return null;switch(t==="auto"?Fae(e):t){case"json":return Iae(e,n);case"text":{const s=await e.text();return s===""?null:s}case"blob":if(typeof e.blob!="function")throw new TypeError('Blob responses are not supported in this runtime. Use responseType "json" or "text" instead.');return e.blob()}}async function ls(e,t={}){const{responseType:n="auto",headers:r,...s}=t,i=Oae(e,s.method);if(s.body!=null&&(i==="GET"||i==="HEAD"))throw new TypeError(`customFetch: ${i} requests cannot have a body.`);const l=_ae(Y8(e)?e.headers:void 0,r);typeof s.body=="string"&&!l.has("content-type")&&eB(s.body)&&l.set("content-type","application/json"),n==="json"&&!l.has("accept")&&l.set("accept",kae);const u={method:i,url:Eae(e)};if(typeof window<"u"&&typeof localStorage<"u"){const f=localStorage.getItem("fs_team_token"),h=localStorage.getItem("fs_client_token"),p=f||h;p&&!l.has("authorization")&&l.set("authorization",`Bearer ${p}`)}const d=await fetch(e,{...s,method:i,headers:l});if(!d.ok){const f=await Lae(d,i);throw new Dae(d,f,u)}return await qae(d,n,u)}const Bae=()=>"/api/auth/logout",zae=async e=>ls(Bae(),{...e,method:"POST"}),Uae=e=>{const t=["logout"],{mutation:n,request:r}={mutation:{mutationKey:t},request:void 0};return{mutationFn:()=>zae(r),...n}},tB=e=>nt(Uae()),Hae=()=>"/api/auth/client-login",Vae=async(e,t)=>ls(Hae(),{...t,method:"POST",headers:{"Content-Type":"application/json",...t?.headers},body:JSON.stringify(e)}),Gae=e=>{const t=["clientLogin"],{mutation:n,request:r}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:t}}:{mutation:{mutationKey:t},request:void 0};return{mutationFn:i=>{const{data:l}=i??{};return Vae(l,r)},...n}},Kae=e=>nt(Gae(e)),Wae=()=>"/api/auth/client-verify",Yae=async(e,t)=>ls(Wae(),{...t,method:"POST",headers:{"Content-Type":"application/json",...t?.headers},body:JSON.stringify(e)}),Xae=e=>{const t=["clientVerify"],{mutation:n,request:r}={mutation:{mutationKey:t},request:void 0};return{mutationFn:i=>{const{data:l}=i??{};return Yae(l,r)},...n}},Qae=e=>nt(Xae()),Zae=e=>{const t=new URLSearchParams;Object.entries({}
9).forEach(([r,s])=>{s!==void 0&&t.append(r,s===null?"null":s.toString())});const n=t.toString();return n.length>0?`/api/leads?${n}`:"/api/leads"},Jae=async(e,t)=>ls(Zae(),{...t,method:"GET"}),bi=e=>["/api/leads"],ese=(e,t)=>{const{query:n,request:r}={};return{queryKey:n?.queryKey??bi(),queryFn:({signal:l})=>Jae(e,{signal:l,...r}),...n}};function tse(e,t){const n=ese(e);return{...Xe(n),queryKey:n.queryKey}}const nse=e=>[`/api/leads/${e}`],rse=e=>`/api/leads/${e}`,ase=async(e,t,n)=>ls(rse(e),{...n,method:"PATCH",headers:{"Content-Type":"application/json",...n?.headers},body:JSON.stringify(t)}),sse=e=>{const t=["updateLead"],{mutation:n,request:r}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:t}}:{mutation:{mutationKey:t},request:void 0};return{mutationFn:i=>{const{id:l,data:u}=i??{};return ase(l,u,r)},...n}},ise=e=>nt(sse(e)),ose=e=>`/api/leads/${e}`,lse=async(e,t)=>ls(ose(e),{...t,method:"DELETE"}),cse=e=>{const t=["deleteLead"],{mutation:n,request:r}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:t}}:{mutation:{mutationKey:t},request:void 0};return{mutationFn:i=>{const{id:l}=i??{};return lse(l,r)},...n}},use=e=>nt(cse(e)),dse=()=>"/api/quotes",fse=async e=>ls(dse(),{...e,method:"GET"}),gv=()=>["/api/quotes"],mse=e=>{const{query:t,request:n}=e??{};return{queryKey:t?.queryKey??gv(),queryFn:({signal:i})=>fse({signal:i,...n}),...t}};function nB(e){const t=mse(e);return{...Xe(t),queryKey:t.queryKey}}const hse=e=>`/api/quotes/${e}`,pse=async(e,t)=>ls(hse(e),{...t,method:"GET"}),ET=e=>[`/api/quotes/${e}`],xse=(e,t)=>{const{query:n,request:r}=t??{};return{queryKey:n?.queryKey??ET(e),queryFn:({signal:l})=>pse(e,{signal:l,...r}),enabled:!!e,...n}};function gse(e,t){const n=xse(e,t);return{...Xe(n),queryKey:n.queryKey}}const yse=e=>`/api/quotes/${e}`,vse=async(e,t)=>ls(yse(e),{...t,method:"DELETE"}),bse=e=>{const t=["deleteQuote"],{mutation:n,request:r}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:t}}:{mutation:{mutationKey:t},request:void 0};return{mutationFn:i=>{const{id:l}=i??{};return vse(l,r)},...n}},jse=e=>nt(bse(e)),wse=e=>{const t=new URLSearchParams;Object.entries({}).forEach(([r,s])=>{s!==void 0&&t.append(r,s===null?"null":s.toString())});const n=t.toString();return n.length>0?`/api/jobs?${n}`:"/api/jobs"},Nse=async(e,t)=>ls(wse(),{...t,method:"GET"}),Sse=e=>["/api/jobs"],Cse=(e,t)=>{const{query:n,request:r}={};return{queryKey:n?.queryKey??Sse(),queryFn:({signal:l})=>Nse(e,{signal:l,...r}),...n}};function Ase(e,t){const n=Cse(e);return{...Xe(n),queryKey:n.queryKey}}const Tse=()=>"/api/clients",kse=async e=>ls(Tse(),{...e,method:"GET"}),_T=()=>["/api/clients"],Ose=e=>{const{query:t,request:n}={};return{queryKey:t?.queryKey??_T(),queryFn:({signal:i})=>kse({signal:i,...n}),...t}};function Pse(e){const t=Ose();return{...Xe(t),queryKey:t.queryKey}}const S3=["admin","manager","estimator"];function Ese(e){switch(e){case"admin":case"manager":return{main:[{name:"Dashboard",href:"/dashboard",icon:Mf},{name:"Leads",href:"/leads",icon:kg},{name:"Clients",href:"/clients",icon:Rr},{name:"Calendar",href:"/calendar",icon:Ma},{name:"Tasks",href:"/tasks",icon:tm},{name:"Jobs",href:"/jobs",icon:rs},{name:"Materials",href:"/materials",icon:F2},{name:"Quotes",href:"/quotes",icon:jn},{name:"Daily Status",href:"/job-status",icon:Am},{name:"Inventory",href:"/inventory",icon:Jn}],admin:[{name:"Pricing",href:"/pricing",icon:Ro},{name:"Team",href:"/team",icon:$q},{name:"Email Templates",href:"/email-templates",icon:$r},{name:"Integrations",href:"/integrations",icon:qee}]};case"estimator":return{main:[{name:"Dashboard",href:"/dashboard",icon:Mf},{name:"My Leads",href:"/leads",icon:kg},{name:"Clients",href:"/clients",icon:Rr},{name:"Calendar",href:"/calendar",icon:Ma},{name:"Tasks",href:"/tasks",icon:tm},{name:"Quotes",href:"/quotes",icon:jn},{name:"Inventory",href:"/inventory",icon:Jn}],admin:[]};case"field_tech":return{main:[{name:"Dashboard",href:"/dashboard",icon:Mf},{name:"My Jobs",href:"/jobs",icon:rs},{name:"Tasks",href:"/tasks",icon:tm},{name:"Daily Status",href:"/job-status",icon:Am}],admin:[]};case"shop_technician":return{main:[{name:"Dashboard",href:"/dashboard",icon:Mf},{name:"Kit Queue",href:"/jobs",icon:Jn},{name:"Tasks",href:"/tasks",icon:tm},{name:"Inventory",href:"/inventory",icon:Jn}],admin:[]};default:return{main:[{name:"Dashboard",href:"/dashboard",icon:Mf}],admin:[]}}}function _se(e){switch(e){case"admin":return"Admin";case"manager":return"Manager";case"estimator":return"Estimator";case"field_tech":return"Field Technician";case"shop_technician":return"Shop Technician";default:return e}}function Mse({children:e}){const{teamMember:t,logout:n}=Nn(),[r]=fr(),[s,i]=ie.useState(!1),l=t?.role??"",{main:u,admin:d}=Ese(l),f=[...u,...d],{data:h}=nB({query:{enabled:S3.includes(l),queryKey:gv()}}),p=S3.includes(l)?(h||[]).filter(y=>y.status==="draft").length:0,x=f.find(y=>r===y.href||r.startsWith(`${y.href}/`))?.name??"Dashboard";return a.jsxs("div",{className:"flex h-screen bg-background overflow-hidden",children:[a.jsxs("aside",{className:`
10        fixed md:static inset-y-0 left-0 z-50 w-64 bg-sidebar text-sidebar-foreground flex flex-col
11        transition-transform duration-300 ease-in-out border-r border-sidebar-border
12        ${s?"translate-x-0":"-translate-x-full md:translate-x-0"}
13      `,children:[a.jsx("div",{className:"flex items-center p-4 border-b border-sidebar-border bg-white",children:a.jsx("img",{src:Rg,alt:"Five Star Rain Gutters",className:"h-10 w-auto"})}),a.jsxs("nav",{className:"flex-1 overflow-y-auto p-4 space-y-1",children:[a.jsx("div",{className:"text-xs font-semibold text-sidebar-foreground
13/50 uppercase tracking-wider mb-3 px-3",children:"Main Menu"}),u.map(y=>{const w=r===y.href||r.startsWith(`${y.href}/`);return a.jsxs(Cu,{href:y.href,onClick:()=>i(!1),className:`
14                  flex items-center gap-3 px-3 py-2.5 rounded-xl transition-all duration-200
15                  ${w?"bg-primary text-primary-foreground shadow-md shadow-primary/20":"text-sidebar-foreground/80 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"}
16                `,children:[a.jsx(y.icon,{className:`w-5 h-5 ${w?"text-primary-foreground":""}`}),a.jsx("span",{className:"font-medium",children:y.name}),y.href==="/quotes"&&p>0&&a.jsx("span",{className:`ml-auto text-xs font-bold px-2 py-0.5 rounded-full ${w?"bg-primary-foreground/20 text-primary-foreground":"bg-amber-100 text-amber-700"}`,"data-testid":"badge-draft-count",children:p})]},y.name)}),d.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"text-xs font-semibold text-sidebar-foreground/50 uppercase tracking-wider mt-8 mb-3 px-3",children:"Administration"}),d.map(y=>{const w=r===y.href;return a.jsxs(Cu,{href:y.href,onClick:()=>i(!1),className:`
17                      flex items-center gap-3 px-3 py-2.5 rounded-xl transition-all duration-200
18                      ${w?"bg-primary text-primary-foreground shadow-md shadow-primary/20":"text-sidebar-foreground/80 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"}
19                    `,children:[a.jsx(y.icon,{className:"w-5 h-5"}),a.jsx("span",{className:"font-medium",children:y.name})]},y.name)})]})]}),a.jsxs("div",{className:"p-4 border-t border-sidebar-border bg-sidebar-accent/30",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-4 px-2",children:[a.jsx("div",{className:"w-10 h-10 rounded-full bg-primary/20 flex items-center justify-center text-primary font-bold text-lg",children:t?.name?.charAt(0)||"U"}),a.jsxs("div",{className:"overflow-hidden",children:[a.jsx("p",{className:"text-sm font-semibold truncate text-sidebar-foreground",children:t?.name}),a.jsx("p",{className:"text-xs text-sidebar-foreground/60",children:_se(l)})]})]}),a.jsxs(ne,{variant:"outline",className:"w-full justify-start text-sidebar-foreground/80 border-sidebar-border hover:bg-sidebar-accent hover:text-white",onClick:n,children:[a.jsx(fT,{className:"w-4 h-4 mr-2"}),"Sign Out"]})]})]}),a.jsxs("div",{className:"flex-1 flex flex-col h-full overflow-hidden relative",children:[a.jsxs("header",{className:"h-16 bg-white/80 backdrop-blur-md border-b border-border flex items-center px-4 md:px-8 shrink-0 z-40 sticky top-0",children:[a.jsx(ne,{variant:"ghost",size:"icon",className:"md:hidden mr-2",onClick:()=>i(!s),children:a.jsx(See,{className:"w-5 h-5 text-foreground"})}),a.jsx("h2",{className:"font-display text-xl font-bold text-foreground",children:x})]}),a.jsx("main",{className:"flex-1 overflow-y-auto p-4 md:p-8 bg-background",children:a.jsx("div",{className:"max-w-7xl mx-auto",children:e})})]}),s&&a.jsx("div",{className:"fixed inset-0 bg-black/50 z-40 md:hidden backdrop-blur-sm transition-opacity",onClick:()=>i(!1)})]})}const rB=v.createContext({});function Rse(e){const t=v.useRef(null);return t.current===null&&(t.current=e()),t.current}const Dse=typeof window<"u",$se=Dse?v.useLayoutEffect:v.useEffect,MT=v.createContext(null);function RT(e,t){e.indexOf(t)===-1&&e.push(t)}function $g(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}const Ds=(e,t,n)=>n>t?t:n<e?e:n;let DT=()=>{};const Oi={},aB=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function sB(e){return typeof e=="object"&&e!==null}const iB=e=>/^0[^.\s]+$/u.test(e);function oB(e){let t;return()=>(t===void 0&&(t=e()),t)}const Oa=e=>e,Ise=(e,t)=>n=>t(e(n)),Oh=(...e)=>e.reduce(Ise),Om=(e,t,n)=>{const r=t-e;return r===0?1:(n-e)/r};class $T{constructor(){this.subscriptions=[]}add(t){return RT(this.subscriptions,t),()=>$g(this.subscriptions,t)}notify(t,n,r){const s=this.subscriptions.length;if(s)if(s===1)this.subscriptions[0](t,n,r);else for(let i=0;i<s;i++){const l=this.subscriptions[i];l&&l(t,n,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const as=e=>e*1e3,Ta=e=>e/1e3;function lB(e,t){return t?e*(1e3/t):0}const cB=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,Lse=1e-7,Fse=12;
vendor: 12,782 bytes, line 19
19function qse(e,t,n,r,s){let i,l,u=0;do l=t+(n-t)/2,i=cB(l,r,s)-e,i>0?n=l:t=l;while(Math.abs(i)>Lse&&++u<Fse);return l}function Ph(e,t,n,r){if(e===t&&n===r)return Oa;const s=i=>qse(i,0,1,e,n);return i=>i===0||i===1?i:cB(s(i),t,r)}const uB=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,dB=e=>t=>1-e(1-t),fB=Ph(.33,1.53,.69,.99),IT=dB(fB),mB=uB(IT),hB=e=>(e*=2)<1?.5*IT(e):.5*(2-Math.pow(2,-10*(e-1))),LT=e=>1-Math.sin(Math.acos(e)),pB=dB(LT),xB=uB(LT),Bse=Ph(.42,0,1,1),zse=Ph(0,0,.58,1),gB=Ph(.42,0,.58,1),Use=e=>Array.isArray(e)&&typeof e[0]!="number",yB=e=>Array.isArray(e)&&typeof e[0]=="number",Hse={linear:Oa,easeIn:Bse,easeInOut:gB,easeOut:zse,circIn:LT,circInOut:xB,circOut:pB,backIn:IT,backInOut:mB,backOut:fB,anticipate:hB},Vse=e=>typeof e=="string",C3=e=>{if(yB(e)){DT(e.length===4);const[t,n,r,s]=e;return Ph(t,n,r,s)}else if(Vse(e))return Hse[e];return e},Nx=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function Gse(e,t){let n=new Set,r=new Set,s=!1,i=!1;const l=new WeakSet;let u={delta:0,timestamp:0,isProcessing:!1};function d(h){l.has(h)&&(f.schedule(h),e()),h(u)}const f={schedule:(h,p=!1,x=!1)=>{const w=x&&s?n:r;return p&&l.add(h),w.has(h)||w.add(h),h},cancel:h=>{r.delete(h),l.delete(h)},process:h=>{if(u=h,s){i=!0;return}s=!0,[n,r]=[r,n],n.forEach(d),n.clear(),s=!1,i&&(i=!1,f.process(h))}};return f}const Kse=40;function vB(e,t){let n=!1,r=!0;const s={delta:0,timestamp:0,isProcessing:!1},i=()=>n=!0,l=Nx.reduce((k,T)=>(k[T]=Gse(i),k),{}),{setup:u,read:d,resolveKeyframes:f,preUpdate:h,update:p,preRender:x,render:y,postRender:w}=l,j=()=>{const k=Oi.useManualTiming?s.timestamp:performance.now();n=!1,Oi.useManualTiming||(s.delta=r?1e3/60:Math.max(Math.min(k-s.timestamp,Kse),1)),s.timestamp=k,s.isProcessing=!0,u.process(s),d.process(s),f.process(s),h.process(s),p.process(s),x.process(s),y.process(s),w.process(s),s.isProcessing=!1,n&&t&&(r=!1,e(j))},b=()=>{n=!0,r=!0,s.isProcessing||e(j)};return{schedule:Nx.reduce((k,T)=>{const A=l[T];return k[T]=(P,E=!1,_=!1)=>(n||b(),A.schedule(P,E,_)),k},{}),cancel:k=>{for(let T=0;T<Nx.length;T++)l[Nx[T]].cancel(k)},state:s,steps:l}}const{schedule:Wt,cancel:Io,state:Zn,steps:Ij}=vB(typeof requestAnimationFrame<"u"?requestAnimationFrame:Oa,!0);let sg;function Wse(){sg=void 0}const vr={now:()=>(sg===void 0&&vr.set(Zn.isProcessing||Oi.useManualTiming?Zn.timestamp:performance.now()),sg),set:e=>{sg=e,queueMicrotask(Wse)}},bB=e=>t=>typeof t=="string"&&t.startsWith(e),jB=bB("--"),Yse=bB("var(--"),FT=e=>Yse(e)?Xse.test(e.split("/*")[0].trim()):!1,Xse=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function A3(e){return typeof e!="string"?!1:e.split("/*")[0].includes("var(--")}const jd={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},Pm={...jd,transform:e=>Ds(0,1,e)},Sx={...jd,default:1},pm=e=>Math.round(e*1e5)/1e5,qT=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function Qse(e){return e==null}const Zse=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,BT=(e,t)=>n=>!!(typeof n=="string"&&Zse.test(n)&&n.startsWith(e)||t&&!Qse(n)&&Object.prototype.hasOwnProperty.call(n,t)),wB=(e,t,n)=>r=>{if(typeof r!="string")return r;const[s,i,l,u]=r.match(qT);return{[e]:parseFloat(s),[t]:parseFloat(i),[n]:parseFloat(l),alpha:u!==void 0?parseFloat(u):1}},Jse=e=>Ds(0,255,e),Lj={...jd,transform:e=>Math.round(Jse(e))},_l={test:BT("rgb","red"),parse:wB("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+Lj.transform(e)+", "+Lj.transform(t)+", "+Lj.transform(n)+", "+pm(Pm.transform(r))+")"};function eie(e){let t="",n="",r="",s="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),s=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),s=e.substring(4,5),t+=t,n+=n,r+=r,s+=s),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:s?parseInt(s,16)/255:1}}const W2={test:BT("#"),parse:eie,transform:_l.transform},Eh=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),bo=Eh("deg"),Ps=Eh("%"),Ve=Eh("px"),tie=Eh("vh"),nie=Eh("vw"),T3={...Ps,parse:e=>Ps.parse(e)/100,transform:e=>Ps.transform(e*100)},gu={test:BT("hsl","hue"),parse:wB("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+Ps.transform(pm(t))+", "+Ps.transform(pm(n))+", "+pm(Pm.transform(r))+")"},bn={test:e=>_l.test(e)||W2.test(e)||gu.test(e),parse:e=>_l.test(e)?_l.parse(e):gu.test(e)?gu.parse(e):W2.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?_l.transform(e):gu.transform(e),getAnimatableNone:e=>{const t=bn.parse(e);return t.alpha=0,bn.transform(t)}},rie=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function aie(e){return isNaN(e)&&typeof e=="string"&&(e.match(qT)?.length||0)+(e.match(rie)?.length||0)>0}const NB="number",SB="color",sie="var",iie="var(",k3="${}",oie=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Em(e){const t=e.toString(),n=[],r={color:[],number:[],var:[]},s=[];let i=0;const u=t.replace(oie,d=>(bn.test(d)?(r.color.push(i),s.push(SB),n.push(bn.parse(d))):d.startsWith(iie)?(r.var.push(i),s.push(sie),n.push(d)):(r.number.push(i),s.push(NB),n.push(parseFloat(d))),++i,k3)).split(k3);return{values:n,split:u,indexes:r,types:s}}function CB(e){return Em(e).values}function AB(e){const{split:t,types:n}=Em(e),r=t.length;return s=>{let i="";for(let l=0;l<r;l++)if(i+=t[l],s[l]!==void 0){const u=n[l];u===NB?i+=pm(s[l]):u===SB?i+=bn.transform(s[l]):i+=s[l]}return i}}const lie=e=>typeof e=="number"?0:bn.test(e)?bn.getAnimatableNone(e):e;function cie(e){const t=CB(e);return AB(e)(t.map(lie))}const ss={test:aie,parse:CB,createTransformer:AB,getAnimatableNone:cie};function Fj(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function uie({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let s=0,i=0,l=0;if(!t)s=i=l=n;else{const u=n<.5?n*(1+t):n+t-n*t,d=2*n-u;s=Fj(d,u,e+1/3),i=Fj(d,u,e),l=Fj(d,u,e-1/3)}return{red:Math.round(s*255),green:Math.round(i*255),blue:Math.round(l*255),alpha:r}}function Ig(e,t){return n=>n>0?t:e}const nn=(e,t,n)=>e+(t-e)*n,qj=(e,t,n)=>{const r=e*e,s=n*(t*t-r)+r;return s<0?0:Math.sqrt(s)},die=[W2,_l,gu],fie=e=>die.find(t=>t.test(e));function O3(e){const t=fie(e);if(!t)return!1;let n=t.parse(e);return t===gu&&(n=uie(n)),n}const P3=(e,t)=>{const n=O3(e),r=O3(t);if(!n||!r)return Ig(e,t);const s={...n};return i=>(s.red=qj(n.red,r.red,i),s.green=qj(n.green,r.green,i),s.blue=qj(n.blue,r.blue,i),s.alpha=nn(n.alpha,r.alpha,i),_l.transform(s))},Y2=new Set(["none","hidden"]);function mie(e,t){return Y2.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function hie(e,t){return n=>nn(e,t,n)}function zT(e){return typeof e=="number"?hie:typeof e=="string"?FT(e)?Ig:bn.test(e)?P3:gie:Array.isArray(e)?TB:typeof e=="object"?bn.test(e)?P3:pie:Ig}function TB(e,t){const n=[...e],r=n.length,s=e.map((i,l)=>zT(i)(i,t[l]));return i=>{for(let l=0;l<r;l++)n[l]=s[l](i);return n}}function pie(e,t){const n={...e,...t},r={};for(const s in n)e[s]!==void 0&&t[s]!==void 0&&(r[s]=zT(e[s])(e[s],t[s]));return s=>{for(const i in r)n[i]=r[i](s);return n}}function xie(e,t){const n=[],r={color:0,var:0,number:0};for(let s=0;s<t.values.length;s++){const i=t.types[s],l=e.indexes[i][r[i]],u=e.values[l]??0;n[s]=u,r[i]++}return n}const gie=(e,t)=>{const n=ss.createTransformer(t),r=Em(e),s=Em(t);return r.indexes.var.length===s.indexes.var.length&&r.indexes.color.length===s.indexes.color.length&&r.indexes.number.length>=s.indexes.number.length?Y2.has(e)&&!s.values.length||Y2.has(t)&&!r.values.length?mie(e,t):Oh(TB(xie(r,s),s.values),n):Ig(e,t)};function kB(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?nn(e,t,n):zT(e)(e,t)}const yie=e=>{const t=({timestamp:n})=>e(n);return{start:(n=!0)=>Wt.update(t,n),stop:()=>Io(t),now:()=>Zn.isProcessing?Zn.timestamp:vr.now()}},OB=(e,t,n=10)=>{let r="";const s=Math.max(Math.round(t/n),2);for(let i=0;i<s;i++)r+=Math.round(e(i/(s-1))*1e4)/1e4+", ";return`linear(${r.substring(0,r.length-2)})`},Lg=2e4;function UT(e){let t=0;const n=50;let r=e.next(t);for(;!r.done&&t<Lg;)t+=n,r=e.next(t);return t>=Lg?1/0:t}function vie(e,t=100,n){const r=n({...e,keyframes:[0,t]}),s=Math.min(UT(r),Lg);return{type:"keyframes",ease:i=>r.next(s*i).value/t,duration:Ta(s)}}const bie=5;function PB(e,t,n){const r=Math.max(t-bie,0);return lB(n-e(r),t-r)}const un={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},Bj=.001;function jie({duration:e=un.duration,bounce:t=un.bounce,velocity:n=un.velocity,mass:r=un.mass}){let s,i,l=1-t;l=Ds(un.minDamping,un.maxDamping,l),e=Ds(un.minDuration,un.maxDuration,Ta(e)),l<1?(s=f=>{const h=f*l,p=h*e,x=h-n,y=X2(f,l),w=Math.exp(-p);return Bj-x/y*w},i=f=>{const p=f*l*e,x=p*n+n,y=Math.pow(l,2)*Math.pow(f,2)*e,w=Math.exp(-p),j=X2(Math.pow(f,2),l);return(-s(f)+Bj>0?-1:1)*((x-y)*w)/j}):(s=f=>{const h=Math.exp(-f*e),p=(f-n)*e+1;return-Bj+h*p},i=f=>{const h=Math.exp(-f*e),p=(n-f)*(e*e);return h*p});const u=5/e,d=Nie(s,i,u);if(e=as(e),isNaN(d))return{stiffness:un.stiffness,damping:un.damping,duration:e};{const f=Math.pow(d,2)*r;return{stiffness:f,damping:l*2*Math.sqrt(r*f),duration:e}}}const wie=12;function Nie(e,t,n){let r=n;for(let s=1;s<wie;s++)r=r-e(r)/t(r);return r}function X2(e,t){return e*Math.sqrt(1-t*t)}const Sie=["duration","bounce"],Cie=["stiffness","damping","mass"];function E3(e,t){return t.some(n=>e[n]!==void 0)}function Aie(e){let t={velocity:un.velocity,stiffness:un.stiffness,damping:un.damping,mass:un.mass,isResolvedFromDuration:!1,...e};if(!E3(e,Cie)&&E3(e,Sie))if(t.velocity=0,e.visualDuration){const n=e.visualDuration,r=2*Math.PI/(n*1.2),s=r*r,i=2*Ds(.05,1,1-(e.bounce||0))*Math.sqrt(s);t={...t,mass:un.mass,stiffness:s,damping:i}}else{const n=jie({...e,velocity:0});t={...t,...n,mass:un.mass},t.isResolvedFromDuration=!0}return t}function Fg(e=un.visualDuration,t=un.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:r,restDelta:s}=n;const i=n.keyframes[0],l=n.keyframes[n.keyframes.length-1],u={done:!1,value:i},{stiffness:d,damping:f,mass:h,duration:p,velocity:x,isResolvedFromDuration:y}=Aie({...n,velocity:-Ta(n.velocity||0)}),w=x||0,j=f/(2*Math.sqrt(d*h)),b=l-i,C=Ta(Math.sqrt(d/h)),N=Math.abs(b)<5;r||(r=N?un.restSpeed.granular:un.restSpeed.default),s||(s=N?un.restDelta.granular:un.restDelta.default);let k;if(j<1){const A=X2(C,j);k=P=>{const E=Math.exp(-j*C*P);return l-E*((w+j*C*b)/A*Math.sin(A*P)+b*Math.cos(A*P))}}else if(j===1)k=A=>l-Math.exp(-C*A)*(b+(w+C*b)*A);else{const A=C*Math.sqrt(j*j-1);k=P=>{const E=Math.exp(-j*C*P),_=Math.min(A*P,300);return l-E*((w+j*C*b)*Math.sinh(_)+A*b*Math.cosh(_))/A}}const T={calculatedDuration:y&&p||null,next:A=>{const P=k(A);if(y)u.done=A>=p;else{let E=A===0?w:0;j<1&&(E=A===0?as(w):PB(k,A,P));const _=Math.abs(E)<=r,R=Math.abs(l-P)<=s;u.done=_&&R}return u.value=u.done?l:P,u},toString:()=>{const A=Math.min(UT(T),Lg),P=OB(E=>T.next(A*E).value,A,30);return A+"ms "+P},toTransition:()=>{}};return T}Fg.applyToOptions=e=>{const t=vie(e,100,Fg);return e.ease=t.ease,e.duration=as(t.duration),e.type="keyframes",e};function Q2({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:s=10,bounceStiffness:i=500,modifyTarget:l,min:u,max:d,restDelta:f=.5,restSpeed:h}){const p=e[0],x={done:!1,value:p},y=_=>u!==void 0&&_<u||d!==void 0&&_>d,w=_=>u===void 0?d:d===void 0||Math.abs(u-_)<Math.abs(d-_)?u:d;let j=n*t;const b=p+j,C=l===void 0?b:l(b);C!==b&&(j=C-p);const N=_=>-j*Math.exp(-_/r),k=_=>C+N(_),T=_=>{const R=N(_),H=k(_);x.done=Math.abs(R)<=f,x.value=x.done?C:H};let A,P;const E=_=>{y(x.value)&&(A=_,P=Fg({keyframes:[x.value,w(x.value)],velocity:PB(k,_,x.value),damping:s,stiffness:i,restDelta:f,restSpeed:h}))};return E(0),{calculatedDuration:null,next:_=>{let R=!1;return!P&&A===void 0&&(R=!0,T(_),E(_)),A!==void 0&&_>=A?P.next(_-A):(!R&&T(_),x)}}}function Tie(e,t,n){const r=[],s=n||Oi.mix||kB,i=e.length-1;for(let l=0;l<i;l++){let u=s(e[l],e[l+1]);if(t){const d=Array.isArray(t)?t[l]||Oa:t;u=Oh(d,u)}r.push(u)}return r}function kie(e,t,{clamp:n=!0,ease:r,mixer:s}={}){const i=e.length;if(DT(i===t.length),i===1)return()=>t[0];if(i===2&&t[0]===t[1])return()=>t[1];const l=e[0]===e[1];e[0]>e[i-1]&&(e=[...e].reverse(),t=[...t].reverse());const u=Tie(t,r,s),d=u.length,f=h=>
vendor: 14,356 bytes, line 19
19{if(l&&h<e[0])return t[0];let p=0;if(d>1)for(;p<e.length-2&&!(h<e[p+1]);p++);const x=Om(e[p],e[p+1],h);return u[p](x)};return n?h=>f(Ds(e[0],e[i-1],h)):f}function Oie(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const s=Om(0,t,r);e.push(nn(n,1,s))}}function Pie(e){const t=[0];return Oie(t,e.length-1),t}function Eie(e,t){return e.map(n=>n*t)}function _ie(e,t){return e.map(()=>t||gB).splice(0,e.length-1)}function xm({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const s=Use(r)?r.map(C3):C3(r),i={done:!1,value:t[0]},l=Eie(n&&n.length===t.length?n:Pie(t),e),u=kie(l,t,{ease:Array.isArray(s)?s:_ie(t,s)});return{calculatedDuration:e,next:d=>(i.value=u(d),i.done=d>=e,i)}}const Mie=e=>e!==null;function HT(e,{repeat:t,repeatType:n="loop"},r,s=1){const i=e.filter(Mie),u=s<0||t&&n!=="loop"&&t%2===1?0:i.length-1;return!u||r===void 0?i[u]:r}const Rie={decay:Q2,inertia:Q2,tween:xm,keyframes:xm,spring:Fg};function EB(e){typeof e.type=="string"&&(e.type=Rie[e.type])}class VT{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(t=>{this.resolve=t})}notifyFinished(){this.resolve()}then(t,n){return this.finished.then(t,n)}}const Die=e=>e/100;class GT extends VT{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{const{motionValue:n}=this.options;n&&n.updatedAt!==vr.now()&&this.tick(vr.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),this.options.onStop?.())},this.options=t,this.initAnimation(),this.play(),t.autoplay===!1&&this.pause()}initAnimation(){const{options:t}=this;EB(t);const{type:n=xm,repeat:r=0,repeatDelay:s=0,repeatType:i,velocity:l=0}=t;let{keyframes:u}=t;const d=n||xm;d!==xm&&typeof u[0]!="number"&&(this.mixKeyframes=Oh(Die,kB(u[0],u[1])),u=[0,100]);const f=d({...t,keyframes:u});i==="mirror"&&(this.mirroredGenerator=d({...t,keyframes:[...u].reverse(),velocity:-l})),f.calculatedDuration===null&&(f.calculatedDuration=UT(f));const{calculatedDuration:h}=f;this.calculatedDuration=h,this.resolvedDuration=h+s,this.totalDuration=this.resolvedDuration*(r+1)-s,this.generator=f}updateTime(t){const n=Math.round(t-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(t,n=!1){const{generator:r,totalDuration:s,mixKeyframes:i,mirroredGenerator:l,resolvedDuration:u,calculatedDuration:d}=this;if(this.startTime===null)return r.next(0);const{delay:f=0,keyframes:h,repeat:p,repeatType:x,repeatDelay:y,type:w,onUpdate:j,finalKeyframe:b}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-s/this.speed,this.startTime)),n?this.currentTime=t:this.updateTime(t);const C=this.currentTime-f*(this.playbackSpeed>=0?1:-1),N=this.playbackSpeed>=0?C<0:C>s;this.currentTime=Math.max(C,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=s);let k=this.currentTime,T=r;if(p){const _=Math.min(this.currentTime,s)/u;let R=Math.floor(_),H=_%1;!H&&_>=1&&(H=1),H===1&&R--,R=Math.min(R,p+1),R%2&&(x==="reverse"?(H=1-H,y&&(H-=y/u)):x==="mirror"&&(T=l)),k=Ds(0,1,H)*u}const A=N?{done:!1,value:h[0]}:T.next(k);i&&!N&&(A.value=i(A.value));let{done:P}=A;!N&&d!==null&&(P=this.playbackSpeed>=0?this.currentTime>=s:this.currentTime<=0);const E=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&P);return E&&w!==Q2&&(A.value=HT(h,this.options,b,this.speed)),j&&j(A.value),E&&this.finish(),A}then(t,n){return this.finished.then(t,n)}get duration(){return Ta(this.calculatedDuration)}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+Ta(t)}get time(){return Ta(this.currentTime)}set time(t){t=as(t),this.currentTime=t,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=t,this.tick(t))}get speed(){return this.playbackSpeed}set speed(t){const n=this.playbackSpeed!==t;n&&this.driver&&this.updateTime(vr.now()),this.playbackSpeed=t,n&&this.driver&&(this.time=Ta(this.currentTime))}play(){if(this.isStopped)return;const{driver:t=yie,startTime:n}=this.options;this.driver||(this.driver=t(s=>this.tick(s))),this.options.onPlay?.();const r=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=r):this.holdTime!==null?this.startTime=r-this.holdTime:this.startTime||(this.startTime=n??r),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(vr.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),t.observe(this)}}function $ie(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}const Ml=e=>e*180/Math.PI,Z2=e=>{const t=Ml(Math.atan2(e[1],e[0]));return J2(t)},Iie={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:Z2,rotateZ:Z2,skewX:e=>Ml(Math.atan(e[1])),skewY:e=>Ml(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},J2=e=>(e=e%360,e<0&&(e+=360),e),_3=Z2,M3=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),R3=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),Lie={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:M3,scaleY:R3,scale:e=>(M3(e)+R3(e))/2,rotateX:e=>J2(Ml(Math.atan2(e[6],e[5]))),rotateY:e=>J2(Ml(Math.atan2(-e[2],e[0]))),rotateZ:_3,rotate:_3,skewX:e=>Ml(Math.atan(e[4])),skewY:e=>Ml(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function eC(e){return e.includes("scale")?1:0}function tC(e,t){if(!e||e==="none")return eC(t);const n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,s;if(n)r=Lie,s=n;else{const u=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=Iie,s=u}if(!s)return eC(t);const i=r[t],l=s[1].split(",").map(qie);return typeof i=="function"?i(l):l[i]}const Fie=(e,t)=>{const{transform:n="none"}=getComputedStyle(e);return tC(n,t)};function qie(e){return parseFloat(e.trim())}const wd=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Nd=new Set(wd),D3=e=>e===jd||e===Ve,Bie=new Set(["x","y","z"]),zie=wd.filter(e=>!Bie.has(e));function Uie(e){const t=[];return zie.forEach(n=>{const r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),t}const ko={width:({x:e},{paddingLeft:t="0",paddingRight:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t="0",paddingBottom:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>tC(t,"x"),y:(e,{transform:t})=>tC(t,"y")};ko.translateX=ko.x;ko.translateY=ko.y;const Ll=new Set;let nC=!1,rC=!1,aC=!1;function _B(){if(rC){const e=Array.from(Ll).filter(r=>r.needsMeasurement),t=new Set(e.map(r=>r.element)),n=new Map;t.forEach(r=>{const s=Uie(r);s.length&&(n.set(r,s),r.render())}),e.forEach(r=>r.measureInitialState()),t.forEach(r=>{r.render();const s=n.get(r);s&&s.forEach(([i,l])=>{r.getValue(i)?.set(l)})}),e.forEach(r=>r.measureEndState()),e.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}rC=!1,nC=!1,Ll.forEach(e=>e.complete(aC)),Ll.clear()}function MB(){Ll.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(rC=!0)})}function Hie(){aC=!0,MB(),_B(),aC=!1}class KT{constructor(t,n,r,s,i,l=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=r,this.motionValue=s,this.element=i,this.isAsync=l}scheduleResolve(){this.state="scheduled",this.isAsync?(Ll.add(this),nC||(nC=!0,Wt.read(MB),Wt.resolveKeyframes(_B))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:r,motionValue:s}=this;if(t[0]===null){const i=s?.get(),l=t[t.length-1];if(i!==void 0)t[0]=i;else if(r&&n){const u=r.readValue(n,l);u!=null&&(t[0]=u)}t[0]===void 0&&(t[0]=l),s&&i===void 0&&s.set(t[0])}$ie(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),Ll.delete(this)}cancel(){this.state==="scheduled"&&(Ll.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const Vie=e=>e.startsWith("--");function RB(e,t,n){Vie(t)?e.style.setProperty(t,n):e.style[t]=n}const Gie={};function DB(e,t){const n=oB(e);return()=>Gie[t]??n()}const Kie=DB(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),$B=DB(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),nm=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,$3={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:nm([0,.65,.55,1]),circOut:nm([.55,0,1,.45]),backIn:nm([.31,.01,.66,-.59]),backOut:nm([.33,1.53,.69,.99])};function IB(e,t){if(e)return typeof e=="function"?$B()?OB(e,t):"ease-out":yB(e)?nm(e):Array.isArray(e)?e.map(n=>IB(n,t)||$3.easeOut):$3[e]}function Wie(e,t,n,{delay:r=0,duration:s=300,repeat:i=0,repeatType:l="loop",ease:u="easeOut",times:d}={},f=void 0){const h={[t]:n};d&&(h.offset=d);const p=IB(u,s);Array.isArray(p)&&(h.easing=p);const x={delay:r,duration:s,easing:Array.isArray(p)?"linear":p,fill:"both",iterations:i+1,direction:l==="reverse"?"alternate":"normal"};return f&&(x.pseudoElement=f),e.animate(h,x)}function LB(e){return typeof e=="function"&&"applyToOptions"in e}function Yie({type:e,...t}){return LB(e)&&$B()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class FB extends VT{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!t)return;const{element:n,name:r,keyframes:s,pseudoElement:i,allowFlatten:l=!1,finalKeyframe:u,onComplete:d}=t;this.isPseudoElement=!!i,this.allowFlatten=l,this.options=t,DT(typeof t.type!="string");const f=Yie(t);this.animation=Wie(n,r,s,f,i),f.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){const h=HT(s,this.options,u,this.speed);this.updateMotionValue&&this.updateMotionValue(h),RB(n,r,h),this.animation.cancel()}d?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;t==="idle"||t==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){const t=this.options?.element;!this.isPseudoElement&&t?.isConnected&&this.animation.commitStyles?.()}get duration(){const t=this.animation.effect?.getComputedTiming?.().duration||0;return Ta(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+Ta(t)}get time(){return Ta(Number(this.animation.currentTime)||0)}set time(t){const n=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=as(t),n&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(t){this.manualStartTime=this.animation.startTime=t}attachTimeline({timeline:t,rangeStart:n,rangeEnd:r,observe:s}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,t&&Kie()?(this.animation.timeline=t,n&&(this.animation.rangeStart=n),r&&(this.animation.rangeEnd=r),Oa):s(this)}}const qB={anticipate:hB,backInOut:mB,circInOut:xB};function Xie(e){return e in qB}function Qie(e){typeof e.ease=="string"&&Xie(e.ease)&&(e.ease=qB[e.ease])}const zj=10;class Zie extends FB{constructor(t){Qie(t),EB(t),super(t),t.startTime!==void 0&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:n,onUpdate:r,onComplete:s,element:i,...l}=this.options;if(!n)return;if(t!==void 0){n.set(t);return}const u=new GT({...l,autoplay:!1}),d=Math.max(zj,vr.now()-this.startTime),f=Ds(0,zj,d-zj),h=u.sample(d).value,{name:p}=this.options;i&&p&&RB(i,p,h),n.setWithVelocity(u.sample(Math.max(0,d-f)).value,h,f),u.stop()}}const I3=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(ss.test(e)||e==="0")&&!e.startsWith("url("));function Jie(e){const t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function eoe(e,t,n,r){const s=e[0];if(s===null)return!1;if(t==="display"||t==="visibility")return!0;const i=e[e.length-1],l=I3(s,t),u=I3(i,t);return!l||!u?!1:Jie(e)||(n==="spring"||LB(n))&&r}function sC(e){e.duration=0,e.type="keyframes"}const toe=new Set(["opacity","clipPath","filter","transform"]),noe=oB(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function roe(e){const{motionValue:t,name:n,repeatDelay:r,repeatType:s,damping:i,type:l}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;const{onUpdate:d,transformTemplate:f}=t.owner.getProps();return noe()&&n&&toe.has(n)&&(n!=="transform"||!f)&&!d&&!r&&s!=="mirror"&&i!==0&&l!=="inertia"}const aoe=40;class soe extends VT{constructor({autoplay:t=!0,delay:n=0,type:r="keyframes",repeat:s=0,repeatDelay:i=0,repeatType:l="loop",keyframes:u,n
vendor: 4,201 bytes, line 19
19ame:d,motionValue:f,element:h,...p}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=vr.now();const x={autoplay:t,delay:n,type:r,repeat:s,repeatDelay:i,repeatType:l,name:d,motionValue:f,element:h,...p},y=h?.KeyframeResolver||KT;this.keyframeResolver=new y(u,(w,j,b)=>this.onKeyframesResolved(w,j,x,!b),d,f,h),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(t,n,r,s){this.keyframeResolver=void 0;const{name:i,type:l,velocity:u,delay:d,isHandoff:f,onUpdate:h}=r;this.resolvedAt=vr.now(),eoe(t,i,l,u)||((Oi.instantAnimations||!d)&&h?.(HT(t,r,n)),t[0]=t[t.length-1],sC(r),r.repeat=0);const x={startTime:s?this.resolvedAt?this.resolvedAt-this.createdAt>aoe?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...r,keyframes:t},y=!f&&roe(x),w=x.motionValue?.owner?.current,j=y?new Zie({...x,element:w}):new GT(x);j.finished.then(()=>{this.notifyFinished()}).catch(Oa),this.pendingTimeline&&(this.stopTimeline=j.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=j}get finished(){return this._animation?this.animation.finished:this._finished}then(t,n){return this.finished.finally(t).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),Hie()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}function BB(e,t,n,r=0,s=1){const i=Array.from(e).sort((f,h)=>f.sortNodePosition(h)).indexOf(t),l=e.size,u=(l-1)*r;return typeof n=="function"?n(i,l):s===1?i*r:u-i*r}const ioe=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function ooe(e){const t=ioe.exec(e);if(!t)return[,];const[,n,r,s]=t;return[`--${n??r}`,s]}function zB(e,t,n=1){const[r,s]=ooe(e);if(!r)return;const i=window.getComputedStyle(t).getPropertyValue(r);if(i){const l=i.trim();return aB(l)?parseFloat(l):l}return FT(s)?zB(s,t,n+1):s}const loe={type:"spring",stiffness:500,damping:25,restSpeed:10},coe=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),uoe={type:"keyframes",duration:.8},doe={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},foe=(e,{keyframes:t})=>t.length>2?uoe:Nd.has(e)?e.startsWith("scale")?coe(t[1]):loe:doe,moe=e=>e!==null;function hoe(e,{repeat:t,repeatType:n="loop"},r){const s=e.filter(moe),i=t&&n!=="loop"&&t%2===1?0:s.length-1;return s[i]}function UB(e,t){if(e?.inherit&&t){const{inherit:n,...r}=e;return{...t,...r}}return e}function WT(e,t){const n=e?.[t]??e?.default??e;return n!==e?UB(n,e):n}function poe({when:e,delay:t,delayChildren:n,staggerChildren:r,staggerDirection:s,repeat:i,repeatType:l,repeatDelay:u,from:d,elapsed:f,...h}){return!!Object.keys(h).length}const YT=(e,t,n,r={},s,i)=>l=>{const u=WT(r,e)||{},d=u.delay||r.delay||0;let{elapsed:f=0}=r;f=f-as(d);const h={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...u,delay:-f,onUpdate:x=>{t.set(x),u.onUpdate&&u.onUpdate(x)},onComplete:()=>{l(),u.onComplete&&u.onComplete()},name:e,motionValue:t,element:i?void 0:s};poe(u)||Object.assign(h,foe(e,h)),h.duration&&(h.duration=as(h.duration)),h.repeatDelay&&(h.repeatDelay=as(h.repeatDelay)),h.from!==void 0&&(h.keyframes[0]=h.from);let p=!1;if((h.type===!1||h.duration===0&&!h.repeatDelay)&&(sC(h),h.delay===0&&(p=!0)),(Oi.instantAnimations||Oi.skipAnimations||s?.shouldSkipAnimations)&&(p=!0,sC(h),h.delay=0),h.allowFlatten=!u.type&&!u.ease,p&&!i&&t.get()!==void 0){const x=hoe(h.keyframes,u);if(x!==void 0){Wt.update(()=>{h.onUpdate(x),h.onComplete()});return}}return u.isSync?new GT(h):new soe(h)};function L3(e){const t=[{},{}];
vendor: 20,474 bytes, line 19
19return e?.values.forEach((n,r)=>{t[0][r]=n.get(),t[1][r]=n.getVelocity()}),t}function XT(e,t,n,r){if(typeof t=="function"){const[s,i]=L3(r);t=t(n!==void 0?n:e.custom,s,i)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[s,i]=L3(r);t=t(n!==void 0?n:e.custom,s,i)}return t}function Tu(e,t,n){const r=e.getProps();return XT(r,t,n!==void 0?n:r.custom,e)}const HB=new Set(["width","height","top","left","right","bottom",...wd]),F3=30,xoe=e=>!isNaN(parseFloat(e));class goe{constructor(t,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=r=>{const s=vr.now();if(this.updatedAt!==s&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const i of this.dependents)i.dirty()},this.hasAnimated=!1,this.setCurrent(t),this.owner=n.owner}setCurrent(t){this.current=t,this.updatedAt=vr.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=xoe(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new $T);const r=this.events[t].add(n);return t==="change"?()=>{r(),Wt.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t){this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t)}setWithVelocity(t,n,r){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-r}jump(t,n=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=vr.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>F3)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,F3);return lB(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Lu(e,t){return new goe(e,t)}const iC=e=>Array.isArray(e);function yoe(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,Lu(n))}function voe(e){return iC(e)?e[e.length-1]||0:e}function boe(e,t){const n=Tu(e,t);let{transitionEnd:r={},transition:s={},...i}=n||{};i={...i,...r};for(const l in i){const u=voe(i[l]);yoe(e,l,u)}}const dr=e=>!!(e&&e.getVelocity);function joe(e){return!!(dr(e)&&e.add)}function oC(e,t){const n=e.getValue("willChange");if(joe(n))return n.add(t);if(!n&&Oi.WillChange){const r=new Oi.WillChange("auto");e.addValue("willChange",r),r.add(t)}}function QT(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}const woe="framerAppearId",VB="data-"+QT(woe);function GB(e){return e.props[VB]}function Noe({protectedKeys:e,needsAnimating:t},n){const r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function KB(e,t,{delay:n=0,transitionOverride:r,type:s}={}){let{transition:i,transitionEnd:l,...u}=t;const d=e.getDefaultTransition();i=i?UB(i,d):d;const f=i?.reduceMotion;r&&(i=r);const h=[],p=s&&e.animationState&&e.animationState.getState()[s];for(const x in u){const y=e.getValue(x,e.latestValues[x]??null),w=u[x];if(w===void 0||p&&Noe(p,x))continue;const j={delay:n,...WT(i||{},x)},b=y.get();if(b!==void 0&&!y.isAnimating&&!Array.isArray(w)&&w===b&&!j.velocity)continue;let C=!1;if(window.MotionHandoffAnimation){const T=GB(e);if(T){const A=window.MotionHandoffAnimation(T,x,Wt);A!==null&&(j.startTime=A,C=!0)}}oC(e,x);const N=f??e.shouldReduceMotion;y.start(YT(x,y,w,N&&HB.has(x)?{type:!1}:j,e,C));const k=y.animation;k&&h.push(k)}if(l){const x=()=>Wt.update(()=>{l&&boe(e,l)});h.length?Promise.all(h).then(x):x()}return h}function lC(e,t,n={}){const r=Tu(e,t,n.type==="exit"?e.presenceContext?.custom:void 0);let{transition:s=e.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(s=n.transitionOverride);const i=r?()=>Promise.all(KB(e,r,n)):()=>Promise.resolve(),l=e.variantChildren&&e.variantChildren.size?(d=0)=>{const{delayChildren:f=0,staggerChildren:h,staggerDirection:p}=s;return Soe(e,t,d,f,h,p,n)}:()=>Promise.resolve(),{when:u}=s;if(u){const[d,f]=u==="beforeChildren"?[i,l]:[l,i];return d().then(()=>f())}else return Promise.all([i(),l(n.delay)])}function Soe(e,t,n=0,r=0,s=0,i=1,l){const u=[];for(const d of e.variantChildren)d.notify("AnimationStart",t),u.push(lC(d,t,{...l,delay:n+(typeof r=="function"?0:r)+BB(e.variantChildren,d,r,s,i)}).then(()=>d.notify("AnimationComplete",t)));return Promise.all(u)}function Coe(e,t,n={}){e.notify("AnimationStart",t);let r;if(Array.isArray(t)){const s=t.map(i=>lC(e,i,n));r=Promise.all(s)}else if(typeof t=="string")r=lC(e,t,n);else{const s=typeof t=="function"?Tu(e,t,n.custom):t;r=Promise.all(KB(e,s,n))}return r.then(()=>{e.notify("AnimationComplete",t)})}const Aoe={test:e=>e==="auto",parse:e=>e},WB=e=>t=>t.test(e),YB=[jd,Ve,Ps,bo,nie,tie,Aoe],q3=e=>YB.find(WB(e));function Toe(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||iB(e):!0}const koe=new Set(["brightness","contrast","saturate","opacity"]);function Ooe(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match(qT)||[];if(!r)return e;const s=n.replace(r,"");let i=koe.has(t)?1:0;return r!==n&&(i*=100),t+"("+i+s+")"}const Poe=/\b([a-z-]*)\(.*?\)/gu,cC={...ss,getAnimatableNone:e=>{const t=e.match(Poe);return t?t.map(Ooe).join(" "):e}},uC={...ss,getAnimatableNone:e=>{const t=ss.parse(e);return ss.createTransformer(e)(t.map(r=>typeof r=="number"?0:typeof r=="object"?{...r,alpha:1}:r))}},B3={...jd,transform:Math.round},Eoe={rotate:bo,rotateX:bo,rotateY:bo,rotateZ:bo,scale:Sx,scaleX:Sx,scaleY:Sx,scaleZ:Sx,skew:bo,skewX:bo,skewY:bo,distance:Ve,translateX:Ve,translateY:Ve,translateZ:Ve,x:Ve,y:Ve,z:Ve,perspective:Ve,transformPerspective:Ve,opacity:Pm,originX:T3,originY:T3,originZ:Ve},ZT={borderWidth:Ve,borderTopWidth:Ve,borderRightWidth:Ve,borderBottomWidth:Ve,borderLeftWidth:Ve,borderRadius:Ve,borderTopLeftRadius:Ve,borderTopRightRadius:Ve,borderBottomRightRadius:Ve,borderBottomLeftRadius:Ve,width:Ve,maxWidth:Ve,height:Ve,maxHeight:Ve,top:Ve,right:Ve,bottom:Ve,left:Ve,inset:Ve,insetBlock:Ve,insetBlockStart:Ve,insetBlockEnd:Ve,insetInline:Ve,insetInlineStart:Ve,insetInlineEnd:Ve,padding:Ve,paddingTop:Ve,paddingRight:Ve,paddingBottom:Ve,paddingLeft:Ve,paddingBlock:Ve,paddingBlockStart:Ve,paddingBlockEnd:Ve,paddingInline:Ve,paddingInlineStart:Ve,paddingInlineEnd:Ve,margin:Ve,marginTop:Ve,marginRight:Ve,marginBottom:Ve,marginLeft:Ve,marginBlock:Ve,marginBlockStart:Ve,marginBlockEnd:Ve,marginInline:Ve,marginInlineStart:Ve,marginInlineEnd:Ve,fontSize:Ve,backgroundPositionX:Ve,backgroundPositionY:Ve,...Eoe,zIndex:B3,fillOpacity:Pm,strokeOpacity:Pm,numOctaves:B3},_oe={...ZT,color:bn,backgroundColor:bn,outlineColor:bn,fill:bn,stroke:bn,borderColor:bn,borderTopColor:bn,borderRightColor:bn,borderBottomColor:bn,borderLeftColor:bn,filter:cC,WebkitFilter:cC,mask:uC,WebkitMask:uC},XB=e=>_oe[e],Moe=new Set([cC,uC]);function QB(e,t){let n=XB(e);return Moe.has(n)||(n=ss),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const Roe=new Set(["auto","none","0"]);function Doe(e,t,n){let r=0,s;for(;r<e.length&&!s;){const i=e[r];typeof i=="string"&&!Roe.has(i)&&Em(i).values.length&&(s=e[r]),r++}if(s&&n)for(const i of t)e[i]=QB(n,s)}class $oe extends KT{constructor(t,n,r,s,i){super(t,n,r,s,i,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:n,name:r}=this;if(!n||!n.current)return;super.readKeyframes();for(let h=0;h<t.length;h++){let p=t[h];if(typeof p=="string"&&(p=p.trim(),FT(p))){const x=zB(p,n.current);x!==void 0&&(t[h]=x),h===t.length-1&&(this.finalKeyframe=p)}}if(this.resolveNoneKeyframes(),!HB.has(r)||t.length!==2)return;const[s,i]=t,l=q3(s),u=q3(i),d=A3(s),f=A3(i);if(d!==f&&ko[r]){this.needsMeasurement=!0;return}if(l!==u)if(D3(l)&&D3(u))for(let h=0;h<t.length;h++){const p=t[h];typeof p=="string"&&(t[h]=parseFloat(p))}else ko[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:n}=this,r=[];for(let s=0;s<t.length;s++)(t[s]===null||Toe(t[s]))&&r.push(s);r.length&&Doe(t,r,n)}measureInitialState(){const{element:t,unresolvedKeyframes:n,name:r}=this;if(!t||!t.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=ko[r](t.measureViewportBox(),window.getComputedStyle(t.current)),n[0]=this.measuredOrigin;const s=n[n.length-1];s!==void 0&&t.getValue(r,s).jump(s,!1)}measureEndState(){const{element:t,name:n,unresolvedKeyframes:r}=this;if(!t||!t.current)return;const s=t.getValue(n);s&&s.jump(this.measuredOrigin,!1);const i=r.length-1,l=r[i];r[i]=ko[n](t.measureViewportBox(),window.getComputedStyle(t.current)),l!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=l),this.removedTransforms?.length&&this.removedTransforms.forEach(([u,d])=>{t.getValue(u).set(d)}),this.resolveNoneKeyframes()}}const Ioe=new Set(["opacity","clipPath","filter","transform"]);function ZB(e,t,n){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e=="string"){let r=document;const s=n?.[e]??r.querySelectorAll(e);return s?Array.from(s):[]}return Array.from(e).filter(r=>r!=null)}const JB=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function Loe(e){return sB(e)&&"offsetHeight"in e}const{schedule:JT}=vB(queueMicrotask,!1),Wa={x:!1,y:!1};function ez(){return Wa.x||Wa.y}function Foe(e){return e==="x"||e==="y"?Wa[e]?null:(Wa[e]=!0,()=>{Wa[e]=!1}):Wa.x||Wa.y?null:(Wa.x=Wa.y=!0,()=>{Wa.x=Wa.y=!1})}function tz(e,t){const n=ZB(e),r=new AbortController,s={passive:!0,...t,signal:r.signal};return[n,s,()=>r.abort()]}function qoe(e){return!(e.pointerType==="touch"||ez())}function Boe(e,t,n={}){const[r,s,i]=tz(e,n);return r.forEach(l=>{let u=!1,d=!1,f;const h=()=>{l.removeEventListener("pointerleave",w)},p=b=>{f&&(f(b),f=void 0),h()},x=b=>{u=!1,window.removeEventListener("pointerup",x),window.removeEventListener("pointercancel",x),d&&(d=!1,p(b))},y=()=>{u=!0,window.addEventListener("pointerup",x,s),window.addEventListener("pointercancel",x,s)},w=b=>{if(b.pointerType!=="touch"){if(u){d=!0;return}p(b)}},j=b=>{if(!qoe(b))return;d=!1;const C=t(l,b);typeof C=="function"&&(f=C,l.addEventListener("pointerleave",w,s))};l.addEventListener("pointerenter",j,s),l.addEventListener("pointerdown",y,s)}),i}const nz=(e,t)=>t?e===t?!0:nz(e,t.parentElement):!1,ek=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,zoe=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function Uoe(e){return zoe.has(e.tagName)||e.isContentEditable===!0}const Hoe=new Set(["INPUT","SELECT","TEXTAREA"]);function Voe(e){return Hoe.has(e.tagName)||e.isContentEditable===!0}const ig=new WeakSet;function z3(e){return t=>{t.key==="Enter"&&e(t)}}function Uj(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const Goe=(e,t)=>{const n=e.currentTarget;if(!n)return;const r=z3(()=>{if(ig.has(n))return;Uj(n,"down");const s=z3(()=>{Uj(n,"up")}),i=()=>Uj(n,"cancel");n.addEventListener("keyup",s,t),n.addEventListener("blur",i,t)});n.addEventListener("keydown",r,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),t)};function U3(e){return ek(e)&&!ez()}const H3=new WeakSet;function Koe(e,t,n={}){const[r,s,i]=tz(e,n),l=u=>{const d=u.currentTarget;if(!U3(u)||H3.has(u))return;ig.add(d),n.stopPropagation&&H3.add(u);const f=t(d,u),h=(y,w)=>{window.removeEventListener("pointerup",p),window.removeEventListener("pointercancel",x),ig.has(d)&&ig.delete(d),U3(y)&&typeof f=="function"&&f(y,{success:w})},p=y=>{h(y,d===window||d===document||n.useGlobalTarget||nz(d,y.target))},x=y=>{h(y,!1)};window.addEventListener("pointerup",p,s),window.addEventListener("pointercancel",x,s)};return r.forEach(u=>{(n.useGlobalTarget?window:u).addEventListener("pointerdown",l,s),Loe(u)&&(u.addEventListener("focus",f=>Goe(f,s)),!Uoe(u)&&!u.hasAttribute("tabindex")&&(u.tabIndex=0))}),i}function tk(e){return sB(e)&&"ownerSVGElement"in e}const og=new WeakMap;let lg;const rz=(e,t,n)=>(r,s)=>s&&s[0]?s[0][e+"Size"]:tk(r)&&"getBBox"in r?r.getBBox()[t]:r[n],Woe=rz("inline","width","offsetWidth"),Yoe=rz("block","height","offsetHeight");function Xoe({target:e,borderBoxSize:t}){og.get(e)?.forEach(n=>{n(e,{get width(){return Woe(e,t)},get height(){return Yoe(e,t)}})})}function Qoe(e){e.forEach(Xoe)}function Zoe(){typeof ResizeObserver>"u"||(lg=new ResizeObserver(Qoe))}function Joe(e,t){lg||Zoe();const n=ZB(e);return n.forEach(r=>{let s=og.get(r);s||(s=new Set,og.set(r,s)),s.add(t),lg?.observe(r)}),()=>{n.forEach(r=>{const s=og.get(r);s?.delete(t),s?.size||lg?.unobserve(r)})}}const cg=new Set;let yu;function ele(){yu=()=>{const e={get width(){return window.innerWidth},get height(){return window.innerHeight}};cg.forEach(t=>t(e))},window.addEventListener("resize",yu)}function tle(e){return cg.add(e),yu||ele(),()=>{cg.delete(e),!cg.size&&typeof yu=="function"&&(window.removeEventListener("resize",yu),yu=void 0)}}function V3(e,t){return typeof e=="function"?tle(e):Joe(e,t)}function nle(e){return tk(e)&&e.tagName==="svg"}const rle=[...YB,bn,ss],ale=e=>rle.find(WB(e)),G3=()=>({translate:0,scale:1,origin:0,originPoint:0}),vu=()=>({x:G3(),y:G3()}),K3=()=>({min:0,max:0}),En=()=>({x:K3(),y:K3()}),sle=new WeakMap;function yv(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function _m(e){return typeof e=="string"||Array.isArray(e)}const nk=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],rk=["initial",...nk];function vv(e){return yv(e.animate)||rk.some(t=>_m(e[t]))}function az(e){return!!(vv(e)||e.variants)}function ile(e,t,n){for(const r in t){const s=t[r],i=n[r];if(dr(s))e.addValue(r,s);else if(dr(i))e.addValue(r,Lu(s,{owner:e}));else if(i!==s)if(e.hasValue(r)){const l=e.getValue(r);l.liveStyle===!0?l.jump(s):l.hasAnimated||l.set(s)}else{const l=e.getStaticValue(r);e.addValue(r,Lu(l!==void 0?l:s,{owner:e}))}}for(const r in n)t[r]===void 0&&e.removeValue(r);return t}const dC={current:null},sz={current:!1},ole=typeof window<"u";function lle(){if(sz.current=!0,!!ole)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>dC.current=e.matches;e.addEventListener("change",t),t()}else dC.current=!1}const W3=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let qg={};function iz(e){qg=e}function cle(){return qg}class ule{scrapeMotionValuesFromProps(t,n,r){return{}}constructor({parent:t,props:n,presenceContext:r,reducedMotionConfig:s,skipAnimations:i,blockInitialAnimation:l,visualState:u},d={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=KT,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const y=vr.now();this.renderScheduledAt<y&&(this.renderScheduledAt=y,Wt.render(this.render,!1,!0))};const{latestValues:f,renderState:h}=u;this.latestValues=f,this.baseTarget={...f},this.initialValues=n.initial?{...f}:{},this.renderState=h,this.parent=t,this.props=n,this.presenceContext=r,this.depth=t?t.depth+1:0,this.reducedMotionConfig=s,this.skipAnimationsConfig=i,this.options=d,this.blockInitialAnimation=!!l,this.isControllingVariants=vv(n),this.isVariantNode=az(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:p,...x}=this.scrapeMotionValuesFromProps(n,{},this);for(const y in x){const w=x[y];f[y]!==void 0&&dr(w)&&w.set(f[y])}}mount(t){if(this.hasBeenMounted)for(const n in this.initialValues)this.values.get(n)?.jump(this.initialValues[n]),this.latestValues[n]=this.initialValues[n];this.current=t,sle.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,r)=>this.bindToMotionValue(r,n)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(sz.current||lle(),this.shouldReduceMotion=dC.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection&&this.projection.unmount(),Io(this.notifyUpdate),Io(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const n=this.features[t];n&&(n.unmount(),n.isMounted=!1)}this.current=null}addChild(t){this.children.add(t),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(t)}removeChild(t){this.children.delete(t),this.enteringChildren&&this.enteringChildren.delete(t)}bindToMotionValue(t,n){if(this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)(),n.accelerate&&Ioe.has(t)&&this.current instanceof HTMLElement){const{factory:l,keyframes:u,times:d,ease:f,duration:h}=n.accelerate,p=new FB({element:this.current,name:t,keyframes:u,times:d,ease:f,duration:as(h)}),x=l(p);this.valueSubscriptions.set(t,()=>{x(),p.cancel()});return}const r=Nd.has(t);r&&this.onBindTransform&&this.onBindTransform();const s=n.on("change",l=>{this.latestValues[t]=l,this.props.onUpdate&&Wt.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let i;typeof window<"u"&&window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{s(),i&&i(),n.owner&&n.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in qg){const n=qg[t];if(!n)continue;const{isEnabled:r,Feature:s}=n;if(!this.features[t]&&s&&r(this.props)&&(this.features[t]=new s(this)),this.features[t]){const i=this.features[t];i.isMounted?i.update():(i.mount(),i.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):En()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;r<W3.length;r++){const s=W3[r];this.propEventSubscriptions[s]&&(this.propEventSubscriptions[s](),delete this.propEventSubscriptions[s]);const i="on"+s,l=t[i];l&&(this.propEventSubscriptions[s]=this.on(s,l))}this.prevMotionValues=ile(this,this.scrapeMotionValuesFromProps(t,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}
vendor: 9,636 bytes, line 19
19addVariantChild(t){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(t),()=>n.variantChildren.delete(t)}addValue(t,n){const r=this.values.get(t);n!==r&&(r&&this.removeValue(t),this.bindToMotionValue(t,n),this.values.set(t,n),this.latestValues[t]=n.get())}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let r=this.values.get(t);return r===void 0&&n!==void 0&&(r=Lu(n===null?void 0:n,{owner:this}),this.addValue(t,r)),r}readValue(t,n){let r=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options);return r!=null&&(typeof r=="string"&&(aB(r)||iB(r))?r=parseFloat(r):!ale(r)&&ss.test(n)&&(r=QB(t,n)),this.setBaseTarget(t,dr(r)?r.get():r)),dr(r)?r.get():r}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){const{initial:n}=this.props;let r;if(typeof n=="string"||typeof n=="object"){const i=XT(this.props,n,this.presenceContext?.custom);i&&(r=i[t])}if(n&&r!==void 0)return r;const s=this.getBaseTargetFromProps(this.props,t);return s!==void 0&&!dr(s)?s:this.initialValues[t]!==void 0&&r===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new $T),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}scheduleRenderMicrotask(){JT.render(this.render)}}class oz extends ule{constructor(){super(...arguments),this.KeyframeResolver=$oe}sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){const r=t.style;return r?r[n]:void 0}removeValueFromRenderState(t,{vars:n,style:r}){delete n[t],delete r[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;dr(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}class Uo{constructor(t){this.isMounted=!1,this.node=t}update(){}}function lz({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function dle({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function fle(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function Hj(e){return e===void 0||e===1}function fC({scale:e,scaleX:t,scaleY:n}){return!Hj(e)||!Hj(t)||!Hj(n)}function Tl(e){return fC(e)||cz(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function cz(e){return Y3(e.x)||Y3(e.y)}function Y3(e){return e&&e!=="0%"}function Bg(e,t,n){const r=e-n,s=t*r;return n+s}function X3(e,t,n,r,s){return s!==void 0&&(e=Bg(e,s,r)),Bg(e,n,r)+t}function mC(e,t=0,n=1,r,s){e.min=X3(e.min,t,n,r,s),e.max=X3(e.max,t,n,r,s)}function uz(e,{x:t,y:n}){mC(e.x,t.translate,t.scale,t.originPoint),mC(e.y,n.translate,n.scale,n.originPoint)}const Q3=.999999999999,Z3=1.0000000000001;function mle(e,t,n,r=!1){const s=n.length;if(!s)return;t.x=t.y=1;let i,l;for(let u=0;u<s;u++){i=n[u],l=i.projectionDelta;const{visualElement:d}=i.options;d&&d.props.style&&d.props.style.display==="contents"||(r&&i.options.layoutScroll&&i.scroll&&i!==i.root&&ju(e,{x:-i.scroll.offset.x,y:-i.scroll.offset.y}),l&&(t.x*=l.x.scale,t.y*=l.y.scale,uz(e,l)),r&&Tl(i.latestValues)&&ju(e,i.latestValues))}t.x<Z3&&t.x>Q3&&(t.x=1),t.y<Z3&&t.y>Q3&&(t.y=1)}function bu(e,t){e.min=e.min+t,e.max=e.max+t}function J3(e,t,n,r,s=.5){const i=nn(e.min,e.max,s);mC(e,t,n,i,r)}function eR(e,t){return typeof e=="string"?parseFloat(e)/100*(t.max-t.min):e}function ju(e,t){J3(e.x,eR(t.x,e.x),t.scaleX,t.scale,t.originX),J3(e.y,eR(t.y,e.y),t.scaleY,t.scale,t.originY)}function dz(e,t){return lz(fle(e.getBoundingClientRect(),t))}function hle(e,t,n){const r=dz(e,n),{scroll:s}=t;return s&&(bu(r.x,s.offset.x),bu(r.y,s.offset.y)),r}const ple={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},xle=wd.length;function gle(e,t,n){let r="",s=!0;for(let i=0;i<xle;i++){const l=wd[i],u=e[l];if(u===void 0)continue;let d=!0;if(typeof u=="number")d=u===(l.startsWith("scale")?1:0);else{const f=parseFloat(u);d=l.startsWith("scale")?f===1:f===0}if(!d||n){const f=JB(u,ZT[l]);if(!d){s=!1;const h=ple[l]||l;r+=`${h}(${f}) `}n&&(t[l]=f)}}return r=r.trim(),n?r=n(t,s?"":r):s&&(r="none"),r}function ak(e,t,n){const{style:r,vars:s,transformOrigin:i}=e;let l=!1,u=!1;for(const d in t){const f=t[d];if(Nd.has(d)){l=!0;continue}else if(jB(d)){s[d]=f;continue}else{const h=JB(f,ZT[d]);d.startsWith("origin")?(u=!0,i[d]=h):r[d]=h}}if(t.transform||(l||n?r.transform=gle(t,e.transform,n):r.transform&&(r.transform="none")),u){const{originX:d="50%",originY:f="50%",originZ:h=0}=i;r.transformOrigin=`${d} ${f} ${h}`}}function fz(e,{style:t,vars:n},r,s){const i=e.style;let l;for(l in t)i[l]=t[l];s?.applyProjectionStyles(i,r);for(l in n)i.setProperty(l,n[l])}function tR(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const $f={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(Ve.test(e))e=parseFloat(e);else return e;const n=tR(e,t.target.x),r=tR(e,t.target.y);return`${n}% ${r}%`}},yle={correct:(e,{treeScale:t,projectionDelta:n})=>{const r=e,s=ss.parse(e);if(s.length>5)return r;const i=ss.createTransformer(e),l=typeof s[0]!="number"?1:0,u=n.x.scale*t.x,d=n.y.scale*t.y;s[0+l]/=u,s[1+l]/=d;const f=nn(u,d,.5);return typeof s[2+l]=="number"&&(s[2+l]/=f),typeof s[3+l]=="number"&&(s[3+l]/=f),i(s)}},hC={borderRadius:{...$f,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:$f,borderTopRightRadius:$f,borderBottomLeftRadius:$f,borderBottomRightRadius:$f,boxShadow:yle};function mz(e,{layout:t,layoutId:n}){return Nd.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!hC[e]||e==="opacity")}function sk(e,t,n){const r=e.style,s=t?.style,i={};if(!r)return i;for(const l in r)(dr(r[l])||s&&dr(s[l])||mz(l,e)||n?.getValue(l)?.liveStyle!==void 0)&&(i[l]=r[l]);return i}function vle(e){return window.getComputedStyle(e)}class ble extends oz{constructor(){super(...arguments),this.type="html",this.renderInstance=fz}readValueFromInstance(t,n){if(Nd.has(n))return this.projection?.isProjecting?eC(n):Fie(t,n);{const r=vle(t),s=(jB(n)?r.getPropertyValue(n):r[n])||0;return typeof s=="string"?s.trim():s}}measureInstanceViewportBox(t,{transformPagePoint:n}){return dz(t,n)}build(t,n,r){ak(t,n,r.transformTemplate)}scrapeMotionValuesFromProps(t,n,r){return sk(t,n,r)}}const jle={offset:"stroke-dashoffset",array:"stroke-dasharray"},wle={offset:"strokeDashoffset",array:"strokeDasharray"};function Nle(e,t,n=1,r=0,s=!0){e.pathLength=1;const i=s?jle:wle;e[i.offset]=`${-r}`,e[i.array]=`${t} ${n}`}const Sle=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function hz(e,{attrX:t,attrY:n,attrScale:r,pathLength:s,pathSpacing:i=1,pathOffset:l=0,...u},d,f,h){if(ak(e,u,f),d){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:p,style:x}=e;p.transform&&(x.transform=p.transform,delete p.transform),(x.transform||p.transformOrigin)&&(x.transformOrigin=p.transformOrigin??"50% 50%",delete p.transformOrigin),x.transform&&(x.transformBox=h?.transformBox??"fill-box",delete p.transformBox);for(const y of Sle)p[y]!==void 0&&(x[y]=p[y],delete p[y]);t!==void 0&&(p.x=t),n!==void 0&&(p.y=n),r!==void 0&&(p.scale=r),s!==void 0&&Nle(p,s,i,l,!1)}const pz=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),xz=e=>typeof e=="string"&&e.toLowerCase()==="svg";function Cle(e,t,n,r){fz(e,t,void 0,r);for(const s in t.attrs)e.setAttribute(pz.has(s)?s:QT(s),t.attrs[s])}function gz(e,t,n){const r=sk(e,t,n);for(const s in e)if(dr(e[s])||dr(t[s])){const i=wd.indexOf(s)!==-1?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s;r[i]=e[s]}return r}class Ale extends oz{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=En}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(Nd.has(n)){const r=XB(n);return r&&r.default||0}return n=pz.has(n)?n:QT(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,r){return gz(t,n,r)}build(t,n,r){hz(t,n,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(t,n,r,s){Cle(t,n,r,s)}mount(t){this.isSVGTag=xz(t.tagName),super.mount(t)}}const Tle=rk.length;function yz(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?yz(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;n<Tle;n++){const r=rk[n],s=e.props[r];(_m(s)||s===!1)&&(t[r]=s)}return t}function vz(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}const kle=[...nk].reverse(),Ole=nk.length;function Ple(e){return t=>Promise.all(t.map(({animation:n,options:r})=>Coe(e,n,r)))}function Ele(e){let t=Ple(e),n=nR(),r=!0,s=!1;const i=f=>(h,p)=>{const x=Tu(e,p,f==="exit"?e.presenceContext?.custom:void 0);if(x){const{transition:y,transitionEnd:w,...j}=x;h={...h,...j,...w}}return h};function l(f){t=f(e)}function u(f){const{props:h}=e,p=yz(e.parent)||{},x=[],y=new Set;let w={},j=1/0;for(let C=0;C<Ole;
vendor: 4,232 bytes, line 19
19C++){const N=kle[C],k=n[N],T=h[N]!==void 0?h[N]:p[N],A=_m(T),P=N===f?k.isActive:null;P===!1&&(j=C);let E=T===p[N]&&T!==h[N]&&A;if(E&&(r||s)&&e.manuallyAnimateOnMount&&(E=!1),k.protectedKeys={...w},!k.isActive&&P===null||!T&&!k.prevProp||yv(T)||typeof T=="boolean")continue;if(N==="exit"&&k.isActive&&P!==!0){k.prevResolvedValues&&(w={...w,...k.prevResolvedValues});continue}const _=_le(k.prevProp,T);let R=_||N===f&&k.isActive&&!E&&A||C>j&&A,H=!1;const L=Array.isArray(T)?T:[T];let I=L.reduce(i(N),{});P===!1&&(I={});const{prevResolvedValues:W={}}=k,U={...W,...I},V=K=>{R=!0,y.has(K)&&(H=!0,y.delete(K)),k.needsAnimating[K]=!0;const Y=e.getValue(K);Y&&(Y.liveStyle=!1)};for(const K in U){const Y=I[K],z=W[K];if(w.hasOwnProperty(K))continue;let Z=!1;iC(Y)&&iC(z)?Z=!vz(Y,z):Z=Y!==z,Z?Y!=null?V(K):y.add(K):Y!==void 0&&y.has(K)?V(K):k.protectedKeys[K]=!0}k.prevProp=T,k.prevResolvedValues=I,k.isActive&&(w={...w,...I}),(r||s)&&e.blockInitialAnimation&&(R=!1);const D=E&&_;R&&(!D||H)&&x.push(...L.map(K=>{const Y={type:N};if(typeof K=="string"&&(r||s)&&!D&&e.manuallyAnimateOnMount&&e.parent){const{parent:z}=e,Z=Tu(z,K);if(z.enteringChildren&&Z){const{delayChildren:F}=Z.transition||{};Y.delay=BB(z.enteringChildren,e,F)}}return{animation:K,options:Y}}))}if(y.size){const C={};if(typeof h.initial!="boolean"){const N=Tu(e,Array.isArray(h.initial)?h.initial[0]:h.initial);N&&N.transition&&(C.transition=N.transition)}y.forEach(N=>{const k=e.getBaseTarget(N),T=e.getValue(N);T&&(T.liveStyle=!0),C[N]=k??null}),x.push({animation:C})}let b=!!x.length;return r&&(h.initial===!1||h.initial===h.animate)&&!e.manuallyAnimateOnMount&&(b=!1),r=!1,s=!1,b?t(x):Promise.resolve()}function d(f,h){if(n[f].isActive===h)return Promise.resolve();e.variantChildren?.forEach(x=>x.animationState?.setActive(f,h)),n[f].isActive=h;const p=u(f);for(const x in n)n[x].protectedKeys={};return p}return{animateChanges:u,setActive:d,setAnimateFunction:l,getState:()=>n,reset:()=>{n=nR(),s=!0}}}function _le(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!vz(t,e):!1}function wl(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function nR(){return{animate:wl(!0),whileInView:wl(),whileHover:wl(),whileTap:wl(),whileDrag:wl(),whileFocus:wl(),exit:wl()}}function rR(e,t){e.min=t.min,e.max=t.max}function Ha(e,t){rR(e.x,t.x),rR(e.y,t.y)}function aR(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}const bz=1e-4,Mle=1-bz,Rle=1+bz,jz=.01,Dle=0-jz,$le=0+jz;function br(e){return e.max-e.min}function Ile(e,t,n){return Math.abs(e-t)<=n}function sR(e,t,n,r=.5){e.origin=r,e.originPoint=nn(t.min,t.max,e.origin),e.scale=br(n)/br(t),e.translate=nn(n.min,n.max,e.origin)-e.originPoint,(e.scale>=Mle&&e.scale<=Rle||isNaN(e.scale))&&(e.scale=1),(e.translate>=Dle&&e.translate<=$le||isNaN(e.translate))&&(e.translate=0)}function gm(e,t,n,r){sR(e.x,t.x,n.x,r?r.originX:void 0),sR(e.y,t.y,n.y,r?r.originY:void 0)}function iR(e,t,n){e.min=n.min+t.min,e.max=e.min+br(t)}function Lle(e,t,n){iR(e.x,t.x,n.x),iR(e.y,t.y,n.y)}function oR(e,t,n){e.min=t.min-n.min,e.max=e.min+br(t)}function zg(e,t,n){oR(e.x,t.x,n.x),oR(e.y,t.y,n.y)}function lR(e,t,n,r,s){return e-=t,e=Bg(e,1/n,r),s!==void 0&&(e=Bg(e,1/s,r)),e}function Fle(e,t=0,n=1,r=.5,s,i=e,l=e){if(Ps.test(t)&&(t=parseFloat(t),t=nn(l.min,l.max,t/100)-l.min),typeof t!="number")return;let u=nn(i.min,i.max,r);e===i&&(u-=t),e.min=lR(e.min,t,n,u,s),e.max=lR(e.max,t,n,u,s)}function cR(e,t,[n,r,s],i,l){Fle(e,t[n],t[r],t[s],t.scale,i,l)}const qle=["x","scaleX","originX"],Ble=["y","scaleY","originY"];function uR(e,t,n,r){cR(e.x,t,qle,n?n.x:void 0,r?r.x:void 0),cR(e.y,t,Ble,n?n.y:void 0,r?r.y:void 0)}function dR(e){return e.translate===0&&e.scale===1}function wz(e){return dR(e.x)&&dR(e.y)}function fR(e,t){return e.min===t.min&&e.max===t.max}function zle(e,t){return fR(e.x,t.x)&&fR(e.y,t.y)}function mR(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function Nz(e,t){return mR(e.x,t.x)&&mR(e.y,t.y)}function hR(e){return br(e.x)/br(e.y)}function pR(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function Ns(e){return[e("x"),e("y")]}function Ule(e,t,n){let r="";
vendor: 1,469 bytes, line 19
19const s=e.x.translate/t.x,i=e.y.translate/t.y,l=n?.z||0;if((s||i||l)&&(r=`translate3d(${s}px, ${i}px, ${l}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:f,rotate:h,rotateX:p,rotateY:x,skewX:y,skewY:w}=n;f&&(r=`perspective(${f}px) ${r}`),h&&(r+=`rotate(${h}deg) `),p&&(r+=`rotateX(${p}deg) `),x&&(r+=`rotateY(${x}deg) `),y&&(r+=`skewX(${y}deg) `),w&&(r+=`skewY(${w}deg) `)}const u=e.x.scale*t.x,d=e.y.scale*t.y;return(u!==1||d!==1)&&(r+=`scale(${u}, ${d})`),r||"none"}const Sz=["TopLeft","TopRight","BottomLeft","BottomRight"],Hle=Sz.length,xR=e=>typeof e=="string"?parseFloat(e):e,gR=e=>typeof e=="number"||Ve.test(e);function Vle(e,t,n,r,s,i){s?(e.opacity=nn(0,n.opacity??1,Gle(r)),e.opacityExit=nn(t.opacity??1,0,Kle(r))):i&&(e.opacity=nn(t.opacity??1,n.opacity??1,r));for(let l=0;l<Hle;l++){const u=`border${Sz[l]}Radius`;let d=yR(t,u),f=yR(n,u);if(d===void 0&&f===void 0)continue;d||(d=0),f||(f=0),d===0||f===0||gR(d)===gR(f)?(e[u]=Math.max(nn(xR(d),xR(f),r),0),(Ps.test(f)||Ps.test(d))&&(e[u]+="%")):e[u]=f}(t.rotate||n.rotate)&&(e.rotate=nn(t.rotate||0,n.rotate||0,r))}function yR(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const Gle=Cz(0,.5,pB),Kle=Cz(.5,.95,Oa);function Cz(e,t,n){return r=>r<e?0:r>t?1:n(Om(e,t,r))}function Wle(e,t,n){const r=dr(e)?e:Lu(e);return r.start(YT("",r,t,n)),r.animation}function Mm(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}const Yle=(e,t)=>
vendor: 4,303 bytes, line 19
19e.depth-t.depth;class Xle{constructor(){this.children=[],this.isDirty=!1}add(t){RT(this.children,t),this.isDirty=!0}remove(t){$g(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(Yle),this.isDirty=!1,this.children.forEach(t)}}function Qle(e,t){const n=vr.now(),r=({timestamp:s})=>{const i=s-n;i>=t&&(Io(r),e(i-t))};return Wt.setup(r,!0),()=>Io(r)}function ug(e){return dr(e)?e.get():e}class Zle{constructor(){this.members=[]}add(t){RT(this.members,t);for(let n=this.members.length-1;n>=0;n--){const r=this.members[n];if(r===t||r===this.lead||r===this.prevLead)continue;const s=r.instance;(!s||s.isConnected===!1)&&!r.snapshot&&($g(this.members,r),r.unmount())}t.scheduleRender()}remove(t){if($g(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){for(let n=this.members.indexOf(t)-1;n>=0;n--){const r=this.members[n];if(r.isPresent!==!1&&r.instance?.isConnected!==!1)return this.promote(r),!0}return!1}promote(t,n){const r=this.lead;if(t!==r&&(this.prevLead=r,this.lead=t,t.show(),r)){r.updateSnapshot(),t.scheduleRender();const{layoutDependency:s}=r.options,{layoutDependency:i}=t.options;(s===void 0||s!==i)&&(t.resumeFrom=r,n&&(r.preserveOpacity=!0),r.snapshot&&(t.snapshot=r.snapshot,t.snapshot.latestValues=r.animationValues||r.latestValues),t.root?.isUpdating&&(t.isLayoutDirty=!0)),t.options.crossfade===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(t=>{t.options.onExitComplete?.(),t.resumingFrom?.options.onExitComplete?.()})}scheduleRender(){this.members.forEach(t=>t.instance&&t.scheduleRender(!1))}removeLeadSnapshot(){this.lead?.snapshot&&(this.lead.snapshot=void 0)}}const dg={hasAnimatedSinceResize:!0,hasEverUpdated:!1},Vj=["","X","Y","Z"],Jle=1e3;let ece=0;function Gj(e,t,n,r){const{latestValues:s}=t;s[e]&&(n[e]=s[e],t.setStaticValue(e,0),r&&(r[e]=0))}function Az(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=GB(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:s,layoutId:i}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",Wt,!(s||i))}const{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&Az(r)}function Tz({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:s}){return class{constructor(l={},u=t?.()){this.id=ece++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(rce),this.nodes.forEach(oce),this.nodes.forEach(lce),this.nodes.forEach(ace)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=l,this.root=u?u.root||u:this,this.path=u?[...u.path,u]:[],this.parent=u,this.depth=u?u.depth+1:0;for(let d=0;d<this.path.length;d++)this.path[d].shouldResetTransform=!0;this.root===this&&(this.nodes=new Xle)}addEventListener(l,u){return this.eventHandlers.has(l)||this.eventHandlers.set(l,new $T),this.eventHandlers.get(l).add(u)}notifyListeners(l,...u){const d=this.eventHandlers.get(l);d&&d.notify(...u)}hasListeners(l){return this.eventHandlers.has(l)}mount(l){if(this.instance)return;this.isSVG=tk(l)&&!nle(l),this.instance=l;const{layoutId:u,layout:d,visualElement:f}=this.options;if(f&&!f.current&&f.mount(l),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(d||u)&&(this.isLayoutDirty=!0),e){let h,p=0;const x=()=>this.root.updateBlockedByResize=!1;Wt.read(()=>{p=window.innerWidth}),e(l,()=>{const y=window.innerWidth;
vendor: 8,624 bytes, line 19
19y!==p&&(p=y,this.root.updateBlockedByResize=!0,h&&h(),h=Qle(x,250),dg.hasAnimatedSinceResize&&(dg.hasAnimatedSinceResize=!1,this.nodes.forEach(jR)))})}u&&this.root.registerSharedNode(u,this),this.options.animate!==!1&&f&&(u||d)&&this.addEventListener("didUpdate",({delta:h,hasLayoutChanged:p,hasRelativeLayoutChanged:x,layout:y})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const w=this.options.transition||f.getDefaultTransition()||mce,{onLayoutAnimationStart:j,onLayoutAnimationComplete:b}=f.getProps(),C=!this.targetLayout||!Nz(this.targetLayout,y),N=!p&&x;if(this.options.layoutRoot||this.resumeFrom||N||p&&(C||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const k={...WT(w,"layout"),onPlay:j,onComplete:b};(f.shouldReduceMotion||this.options.layoutRoot)&&(k.delay=0,k.type=!1),this.startAnimation(k),this.setAnimationOrigin(h,N)}else p||jR(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=y})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const l=this.getStack();l&&l.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),Io(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(cce),this.animationId++)}getTransformTemplate(){const{visualElement:l}=this.options;return l&&l.getProps().transformTemplate}willUpdate(l=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&Az(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let h=0;h<this.path.length;h++){const p=this.path[h];p.shouldResetTransform=!0,p.updateScroll("snapshot"),p.options.layoutRoot&&p.willUpdate(!1)}const{layoutId:u,layout:d}=this.options;if(u===void 0&&!d)return;const f=this.getTransformTemplate();this.prevTransformTemplateValue=f?f(this.latestValues,""):void 0,this.updateSnapshot(),l&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(vR);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(bR);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(ice),this.nodes.forEach(tce),this.nodes.forEach(nce)):this.nodes.forEach(bR),this.clearAllSnapshots();const u=vr.now();Zn.delta=Ds(0,1e3/60,u-Zn.timestamp),Zn.timestamp=u,Zn.isProcessing=!0,Ij.update.process(Zn),Ij.preRender.process(Zn),Ij.render.process(Zn),Zn.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,JT.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(sce),this.sharedNodes.forEach(uce)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Wt.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Wt.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!br(this.snapshot.measuredBox.x)&&!br(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let d=0;d<this.path.length;d++)this.path[d].updateScroll();const l=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected=En(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:u}=this.options;u&&u.notify("LayoutMeasure",this.layout.layoutBox,l?l.layoutBox:void 0)}updateScroll(l="measure"){let u=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===l&&(u=!1),u&&this.instance){const d=r(this.instance);this.scroll={animationId:this.root.animationId,phase:l,isRoot:d,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:d}}}resetTransform(){if(!s)return;const l=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,u=this.projectionDelta&&!wz(this.projectionDelta),d=this.getTransformTemplate(),f=d?d(this.latestValues,""):void 0,h=f!==this.prevTransformTemplateValue;l&&this.instance&&(u||Tl(this.latestValues)||h)&&(s(this.instance,f),this.shouldResetTransform=!1,this.scheduleRender())}measure(l=!0){const u=this.measurePageBox();let d=this.removeElementScroll(u);return l&&(d=this.removeTransform(d)),hce(d),{animationId:this.root.animationId,measuredBox:u,layoutBox:d,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:l}=this.options;if(!l)return En();const u=l.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(pce))){const{scroll:f}=this.root;f&&(bu(u.x,f.offset.x),bu(u.y,f.offset.y))}return u}removeElementScroll(l){const u=En();if(Ha(u,l),this.scroll?.wasRoot)return u;for(let d=0;d<this.path.length;d++){const f=this.path[d],{scroll:h,options:p}=f;f!==this.root&&h&&p.layoutScroll&&(h.wasRoot&&Ha(u,l),bu(u.x,h.offset.x),bu(u.y,h.offset.y))}return u}applyTransform(l,u=!1){const d=En();Ha(d,l);for(let f=0;f<this.path.length;f++){const h=this.path[f];!u&&h.options.layoutScroll&&h.scroll&&h!==h.root&&ju(d,{x:-h.scroll.offset.x,y:-h.scroll.offset.y}),Tl(h.latestValues)&&ju(d,h.latestValues)}return Tl(this.latestValues)&&ju(d,this.latestValues),d}removeTransform(l){const u=En();Ha(u,l);for(let d=0;d<this.path.length;d++){const f=this.path[d];if(!f.instance||!Tl(f.latestValues))continue;fC(f.latestValues)&&f.updateSnapshot();const h=En(),p=f.measurePageBox();Ha(h,p),uR(u,f.latestValues,f.snapshot?f.snapshot.layoutBox:void 0,h)}return Tl(this.latestValues)&&uR(u,this.latestValues),u}setTargetDelta(l){this.targetDelta=l,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(l){this.options={...this.options,...l,crossfade:l.crossfade!==void 0?l.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Zn.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(l=!1){const u=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=u.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=u.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=u.isSharedProjectionDirty);const d=!!this.resumingFrom||this!==u;if(!(l||d&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:h,layoutId:p}=this.options;if(!this.layout||!(h||p))return;this.resolvedRelativeTargetAt=Zn.timestamp;const x=this.getClosestProjectingParent();x&&this.linkedParentVersion!==x.layoutVersion&&!x.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(x&&x.layout?this.createRelativeTarget(x,this.layout.layoutBox,x.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=En(),this.targetWithTransforms=En()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),Lle(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Ha(this.target,this.layout.layoutBox),uz(this.target,this.targetDelta)):Ha(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,x&&!!x.resumingFrom==!!this.resumingFrom&&!x.options.layoutScroll&&x.target&&this.animationProgress!==1?this.createRelativeTarget(x,this.target,x.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||fC(this.parent.latestValues)||cz
vendor: 5,418 bytes, line 19
19(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(l,u,d){this.relativeParent=l,this.linkedParentVersion=l.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=En(),this.relativeTargetOrigin=En(),zg(this.relativeTargetOrigin,u,d),Ha(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){const l=this.getLead(),u=!!this.resumingFrom||this!==l;let d=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(d=!1),u&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(d=!1),this.resolvedRelativeTargetAt===Zn.timestamp&&(d=!1),d)return;const{layout:f,layoutId:h}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(f||h))return;Ha(this.layoutCorrected,this.layout.layoutBox);const p=this.treeScale.x,x=this.treeScale.y;mle(this.layoutCorrected,this.treeScale,this.path,u),l.layout&&!l.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(l.target=l.layout.layoutBox,l.targetWithTransforms=En());const{target:y}=l;if(!y){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(aR(this.prevProjectionDelta.x,this.projectionDelta.x),aR(this.prevProjectionDelta.y,this.projectionDelta.y)),gm(this.projectionDelta,this.layoutCorrected,y,this.latestValues),(this.treeScale.x!==p||this.treeScale.y!==x||!pR(this.projectionDelta.x,this.prevProjectionDelta.x)||!pR(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",y))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(l=!0){if(this.options.visualElement?.scheduleRender(),l){const u=this.getStack();u&&u.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=vu(),this.projectionDelta=vu(),this.projectionDeltaWithTransform=vu()}setAnimationOrigin(l,u=!1){const d=this.snapshot,f=d?d.latestValues:{},h={...this.latestValues},p=vu();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!u;const x=En(),y=d?d.source:void 0,w=this.layout?this.layout.source:void 0,j=y!==w,b=this.getStack(),C=!b||b.members.length<=1,N=!!(j&&!C&&this.options.crossfade===!0&&!this.path.some(fce));this.animationProgress=0;let k;this.mixTargetDelta=T=>{const A=T/1e3;wR(p.x,l.x,A),wR(p.y,l.y,A),this.setTargetDelta(p),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(zg(x,this.layout.layoutBox,this.relativeParent.layout.layoutBox),dce(this.relativeTarget,this.relativeTargetOrigin,x,A),k&&zle(this.relativeTarget,k)&&(this.isProjectionDirty=!1),k||(k=En()),Ha(k,this.relativeTarget)),j&&(this.animationValues=h,Vle(h,f,this.latestValues,A,N,C)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=A},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(l){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(Io(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Wt.update(()=>{dg.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Lu(0)),this.motionValue.jump(0,!1),this.currentAnimation=Wle(this.motionValue,[0,1e3],{...l,velocity:0,isSync:!0,onUpdate:u=>{this.mixTargetDelta(u),l.onUpdate&&l.onUpdate(u)},onStop:()=>{},onComplete:()=>{l.onComplete&&l.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const l=this.getStack();l&&l.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(Jle),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const l=this.getLead();let{targetWithTransforms:u,target:d,layout:f,latestValues:h}=l;if(!(!u||!d||!f)){if(this!==l&&this.layout&&f&&kz(this.options.animationType,this.layout.layoutBox,f.layoutBox)){d=this.target||En();const p=br(this.layout.layoutBox.x);d.x.min=l.target.x.min,d.x.max=d.x.min+p;const x=br(this.layout.layoutBox.y);d.y.min=l.target.y.min,d.y.max=d.y.min+x}Ha(u,d),ju(u,h),gm(this.projectionDeltaWithTransform,this.layoutCorrected,u,h)}}registerSharedNode(l,u){this.sharedNodes.has(l)||this.sharedNodes.set(l,new Zle),this.sharedNodes.get(l).add(u);const f=u.options.initialPromotionConfig;u.promote({transition:f?f.transition:void 0,preserveFollowOpacity:f&&f.shouldPreserveFollowOpacity?f.shouldPreserveFollowOpacity(u):void 0})}isLead(){const l=this.getStack();return l?l.lead===this:!0}getLead(){const{layoutId:l}=this.options;
vendor: 8,899 bytes, line 19
19return l?this.getStack()?.lead||this:this}getPrevLead(){const{layoutId:l}=this.options;return l?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:l}=this.options;if(l)return this.root.sharedNodes.get(l)}promote({needsReset:l,transition:u,preserveFollowOpacity:d}={}){const f=this.getStack();f&&f.promote(this,d),l&&(this.projectionDelta=void 0,this.needsReset=!0),u&&this.setOptions({transition:u})}relegate(){const l=this.getStack();return l?l.relegate(this):!1}resetSkewAndRotation(){const{visualElement:l}=this.options;if(!l)return;let u=!1;const{latestValues:d}=l;if((d.z||d.rotate||d.rotateX||d.rotateY||d.rotateZ||d.skewX||d.skewY)&&(u=!0),!u)return;const f={};d.z&&Gj("z",l,f,this.animationValues);for(let h=0;h<Vj.length;h++)Gj(`rotate${Vj[h]}`,l,f,this.animationValues),Gj(`skew${Vj[h]}`,l,f,this.animationValues);l.render();for(const h in f)l.setStaticValue(h,f[h]),this.animationValues&&(this.animationValues[h]=f[h]);l.scheduleRender()}applyProjectionStyles(l,u){if(!this.instance||this.isSVG)return;if(!this.isVisible){l.visibility="hidden";return}const d=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,l.visibility="",l.opacity="",l.pointerEvents=ug(u?.pointerEvents)||"",l.transform=d?d(this.latestValues,""):"none";return}const f=this.getLead();if(!this.projectionDelta||!this.layout||!f.target){this.options.layoutId&&(l.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,l.pointerEvents=ug(u?.pointerEvents)||""),this.hasProjected&&!Tl(this.latestValues)&&(l.transform=d?d({},""):"none",this.hasProjected=!1);return}l.visibility="";const h=f.animationValues||f.latestValues;this.applyTransformsToTarget();let p=Ule(this.projectionDeltaWithTransform,this.treeScale,h);d&&(p=d(h,p)),l.transform=p;const{x,y}=this.projectionDelta;l.transformOrigin=`${x.origin*100}% ${y.origin*100}% 0`,f.animationValues?l.opacity=f===this?h.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:h.opacityExit:l.opacity=f===this?h.opacity!==void 0?h.opacity:"":h.opacityExit!==void 0?h.opacityExit:0;for(const w in hC){if(h[w]===void 0)continue;const{correct:j,applyTo:b,isCSSVariable:C}=hC[w],N=p==="none"?h[w]:j(h[w],f);if(b){const k=b.length;for(let T=0;T<k;T++)l[b[T]]=N}else C?this.options.visualElement.renderState.vars[w]=N:l[w]=N}this.options.layoutId&&(l.pointerEvents=f===this?ug(u?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(l=>l.currentAnimation?.stop()),this.root.nodes.forEach(vR),this.root.sharedNodes.clear()}}}function tce(e){e.updateLayout()}function nce(e){const t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:r}=e.layout,{animationType:s}=e.options,i=t.source!==e.layout.source;s==="size"?Ns(h=>{const p=i?t.measuredBox[h]:t.layoutBox[h],x=br(p);p.min=n[h].min,p.max=p.min+x}):kz(s,t.layoutBox,n)&&Ns(h=>{const p=i?t.measuredBox[h]:t.layoutBox[h],x=br(n[h]);p.max=p.min+x,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[h].max=e.relativeTarget[h].min+x)});const l=vu();gm(l,n,t.layoutBox);const u=vu();i?gm(u,e.applyTransform(r,!0),t.measuredBox):gm(u,n,t.layoutBox);const d=!wz(l);let f=!1;if(!e.resumeFrom){const h=e.getClosestProjectingParent();if(h&&!h.resumeFrom){const{snapshot:p,layout:x}=h;if(p&&x){const y=En();zg(y,t.layoutBox,p.layoutBox);const w=En();zg(w,n,x.layoutBox),Nz(y,w)||(f=!0),h.options.layoutRoot&&(e.relativeTarget=w,e.relativeTargetOrigin=y,e.relativeParent=h)}}}e.notifyListeners("didUpdate",{layout:n,snapshot:t,delta:u,layoutDelta:l,hasLayoutChanged:d,hasRelativeLayoutChanged:f})}else if(e.isLead()){const{onExitComplete:n}=e.options;n&&n()}e.options.transition=void 0}function rce(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function ace(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function sce(e){e.clearSnapshot()}function vR(e){e.clearMeasurements()}function bR(e){e.isLayoutDirty=!1}function ice(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function jR(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function oce(e){e.resolveTargetDelta()}function lce(e){e.calcProjection()}function cce(e){e.resetSkewAndRotation()}function uce(e){e.removeLeadSnapshot()}function wR(e,t,n){e.translate=nn(t.translate,0,n),e.scale=nn(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function NR(e,t,n,r){e.min=nn(t.min,n.min,r),e.max=nn(t.max,n.max,r)}function dce(e,t,n,r){NR(e.x,t.x,n.x,r),NR(e.y,t.y,n.y,r)}function fce(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const mce={duration:.45,ease:[.4,0,.1,1]},SR=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),CR=SR("applewebkit/")&&!SR("chrome/")?Math.round:Oa;function AR(e){e.min=CR(e.min),e.max=CR(e.max)}function hce(e){AR(e.x),AR(e.y)}function kz(e,t,n){return e==="position"||e==="preserve-aspect"&&!Ile(hR(t),hR(n),.2)}function pce(e){return e!==e.root&&e.scroll?.wasRoot}const xce=Tz({attachResizeListener:(e,t)=>Mm(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),Kj={current:void 0},Oz=Tz({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Kj.current){const e=new xce({});e.mount(window),e.setOptions({layoutScroll:!0}),Kj.current=e}return Kj.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),Pz=v.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function gce(e=!0){const t=v.useContext(MT);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:s}=t,i=v.useId();v.useEffect(()=>{if(e)return s(i)},[e]);const l=v.useCallback(()=>e&&r&&r(i),[i,r,e]);return!n&&r?[!1,l]:[!0]}const Ez=v.createContext({strict:!1}),TR={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let kR=!1;function yce(){if(kR)return;const e={};for(const t in TR)e[t]={isEnabled:n=>TR[t].some(r=>!!n[r])};iz(e),kR=!0}function _z(){return yce(),cle()}function vce(e){const t=_z();for(const n in e)t[n]={...t[n],...e[n]};iz(t)}const bce=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function Ug(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||bce.has(e)}let Mz=e=>!Ug(e);function jce(e){typeof e=="function"&&(Mz=t=>t.startsWith("on")?!Ug(t):e(t))}try{jce(require("@emotion/is-prop-valid").default)}catch{}function wce(e,t,n){const r={};for(const s in e)s==="values"&&typeof e.values=="object"||(Mz(s)||n===!0&&Ug(s)||!t&&!Ug(s)||e.draggable&&s.startsWith("onDrag"))&&(r[s]=e[s]);return r}const bv=v.createContext({});function Nce(e,t){if(vv(e)){const{initial:n,animate:r}=e;return{initial:n===!1||_m(n)?n:void 0,animate:_m(r)?r:void 0}}return e.inherit!==!1?t:{}}function Sce(e){const{initial:t,animate:n}=Nce(e,v.useContext(bv));return v.useMemo(()=>({initial:t,animate:n}),[OR(t),OR(n)])}function OR(e){return Array.isArray(e)?e.join(" "):e}const ik=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function Rz(e,t,n){for(const r in t)!dr(t[r])&&!mz(r,n)&&(e[r]=t[r])}function Cce({transformTemplate:e},t){return v.useMemo(()=>{const n=ik();return ak(n,t,e),Object.assign({},n.vars,n.style)},[t])}function Ace(e,t){const n=e.style||{},r={};return Rz(r,n,e),Object.assign(r,Cce(e,t)),r}function Tce(e,t){const n={},r=Ace(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}
19`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}const Dz=()=>({...ik(),attrs:{}});function kce(e,t,n,r){const s=v.useMemo(()=>{const i=Dz();return hz(i,t,xz(r),e.transformTemplate,e.style),{...i.attrs,style:{...i.style}}},[t]);if(e.style){const i={};Rz(i,e.style,e),s.style={...i,...s.style}}return s}const Oce=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function ok(e){return typeof e!="string"||e.includes("-")?!1:!!(Oce.indexOf(e)>-1||/[A-Z]/u.test(e))}function Pce(e,t,n,{latestValues:r},s,i=!1,l){const d=(l??ok(e)?kce:Tce)(t,r,s,e),f=wce(t,typeof e=="string",i),h=e!==v.Fragment?{...f,...d,ref:n}:{},{children:p}=t,x=v.useMemo(()=>dr(p)?p.get():p,[p]);return v.createElement(e,{...h,children:x})}function Ece({scrapeMotionValuesFromProps:e,createRenderState:t},n,r,s){return{latestValues:_ce(n,r,s,e),renderState:t()}}function _ce(e,t,n,r){const s={},i=r(e,{});for(const x in i)s[x]=ug(i[x]);let{initial:l,animate:u}=e;const d=vv(e),f=az(e);t&&f&&!d&&e.inherit!==!1&&(l===void 0&&(l=t.initial),u===void 0&&(u=t.animate));let h=n?n.initial===!1:!1;h=h||l===!1;const p=h?u:l;if(p&&typeof p!="boolean"&&!yv(p)){const x=Array.isArray(p)?p:[p];for(let y=0;y<x.length;y++){const w=XT(e,x[y]);if(w){const{transitionEnd:j,transition:b,...C}=w;for(const N in C){let k=C[N];if(Array.isArray(k)){const T=h?k.length-1:0;k=k[T]}k!==null&&(s[N]=k)}for(const N in j)s[N]=j[N]}}}return s}const $z=e=>(t,n)=>{const r=v.useContext(bv),s=v.useContext(MT),i=()=>Ece(e,t,r,s);return n?i():Rse(i)},Mce=$z({scrapeMotionValuesFromProps:sk,createRenderState:ik}),Rce=$z({scrapeMotionValuesFromProps:gz,createRenderState:Dz}),Dce=Symbol.for("motionComponentSymbol");function $ce(e,t,n){const r=v.useRef(n);v.useInsertionEffect(()=>{r.current=n});const s=v.useRef(null);return v.useCallback(i=>{i&&e.onMount?.(i);const l=r.current;if(typeof l=="function")if(i){const u=l(i);typeof u=="function"&&(s.current=u)}else s.current?(s.current(),s.current=null):l(i);else l&&(l.current=i);t&&(i?t.mount(i):t.unmount())},[t])}const Iz=v.createContext({});function hu(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function Ice(e,t,n,r,s,i){const{visualElement:l}=v.useContext(bv),u=v.useContext(Ez),d=v.useContext(MT),f=v.useContext(Pz),h=f.reducedMotion,p=f.skipAnimations,x=v.useRef(null),y=v.useRef(!1);r=r||u.renderer,!x.current&&r&&(x.current=r(e,{visualState:t,parent:l,props:n,presenceContext:d,blockInitialAnimation:d?d.initial===!1:!1,reducedMotionConfig:h,skipAnimations:p,isSVG:i}),y.current&&x.current&&(x.current.manuallyAnimateOnMount=!0));const w=x.current,j=v.useContext(Iz);w&&!w.projection&&s&&(w.type==="html"||w.type==="svg")&&Lce(x.current,n,s,j);const b=v.useRef(!1);v.useInsertionEffect(()=>{w&&b.current&&w.update(n,d)});const C=n[VB],N=v.useRef(!!C&&typeof window<"u"&&!window.MotionHandoffIsComplete?.(C)&&window.MotionHasOptimisedAnimation?.(C));return $se(()=>{y.current=!0,w&&(b.current=!0,window.MotionIsMounted=!0,w.updateFeatures(),w.scheduleRenderMicrotask(),N.current&&w.animationState&&w.animationState.animateChanges())}),v.useEffect(()=>{w&&(!N.current&&w.animationState&&w.animationState.animateChanges(),N.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(C)}),N.current=!1),w.enteringChildren=void 0)}),w}function Lce(e,t,n,r){const{layoutId:s,layout:i,drag:l,dragConstraints:u,layoutScroll:d,layoutRoot:f,layoutCrossfade:h}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:Lz(e.parent)),e.projection.setOptions({layoutId:s,layout:i,alwaysMeasureLayout:!!l||u&&hu(u),visualElement:e,animationType:typeof i=="string"?i:"both",initialPromotionConfig:r,crossfade:h,layoutScroll:d,layoutRoot:f})}function Lz(e){if(e)return e.options.allowProjection!==!1?e.projection:Lz(e.parent)}function Wj(e,{forwardMotionProps:t=!1,type:n}={},r,s){r&&vce(r);const i=n?n==="svg":ok(e),l=i?Rce:Mce;function u(f,h){let p;const x={...v.useContext(Pz),...f,layoutId:Fce(f)},{isStatic:y}=x,w=Sce(f),j=l(f,y);
vendor: 18,076 bytes, line 19
19if(!y&&typeof window<"u"){qce();const b=Bce(x);p=b.MeasureLayout,w.visualElement=Ice(e,j,x,s,b.ProjectionNode,i)}return a.jsxs(bv.Provider,{value:w,children:[p&&w.visualElement?a.jsx(p,{visualElement:w.visualElement,...x}):null,Pce(e,f,$ce(j,w.visualElement,h),j,y,t,i)]})}u.displayName=`motion.${typeof e=="string"?e:`create(${e.displayName??e.name??""})`}`;const d=v.forwardRef(u);return d[Dce]=e,d}function Fce({layoutId:e}){const t=v.useContext(rB).id;return t&&e!==void 0?t+"-"+e:e}function qce(e,t){v.useContext(Ez).strict}function Bce(e){const t=_z(),{drag:n,layout:r}=t;if(!n&&!r)return{};const s={...n,...r};return{MeasureLayout:n?.isEnabled(e)||r?.isEnabled(e)?s.MeasureLayout:void 0,ProjectionNode:s.ProjectionNode}}function zce(e,t){if(typeof Proxy>"u")return Wj;const n=new Map,r=(i,l)=>Wj(i,l,e,t),s=(i,l)=>r(i,l);return new Proxy(s,{get:(i,l)=>l==="create"?r:(n.has(l)||n.set(l,Wj(l,void 0,e,t)),n.get(l))})}const Uce=(e,t)=>t.isSVG??ok(e)?new Ale(t):new ble(t,{allowProjection:e!==v.Fragment});class Hce extends Uo{constructor(t){super(t),t.animationState||(t.animationState=Ele(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();yv(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}let Vce=0;class Gce extends Uo{constructor(){super(...arguments),this.id=Vce++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===r)return;const s=this.node.animationState.setActive("exit",!t);n&&!t&&s.then(()=>{n(this.id)})}mount(){const{register:t,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),t&&(this.unmount=t(this.id))}unmount(){}}const Kce={animation:{Feature:Hce},exit:{Feature:Gce}};function _h(e){return{point:{x:e.pageX,y:e.pageY}}}const Wce=e=>t=>ek(t)&&e(t,_h(t));function ym(e,t,n,r){return Mm(e,t,Wce(n),r)}const Fz=({current:e})=>e?e.ownerDocument.defaultView:null,PR=(e,t)=>Math.abs(e-t);function Yce(e,t){const n=PR(e.x,t.x),r=PR(e.y,t.y);return Math.sqrt(n**2+r**2)}const ER=new Set(["auto","scroll"]);class qz{constructor(t,n,{transformPagePoint:r,contextWindow:s=window,dragSnapToOrigin:i=!1,distanceThreshold:l=3,element:u}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=y=>{this.handleScroll(y.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const y=Xj(this.lastMoveEventInfo,this.history),w=this.startEvent!==null,j=Yce(y.offset,{x:0,y:0})>=this.distanceThreshold;if(!w&&!j)return;const{point:b}=y,{timestamp:C}=Zn;this.history.push({...b,timestamp:C});const{onStart:N,onMove:k}=this.handlers;w||(N&&N(this.lastMoveEvent,y),this.startEvent=this.lastMoveEvent),k&&k(this.lastMoveEvent,y)},this.handlePointerMove=(y,w)=>{this.lastMoveEvent=y,this.lastMoveEventInfo=Yj(w,this.transformPagePoint),Wt.update(this.updatePoint,!0)},this.handlePointerUp=(y,w)=>{this.end();const{onEnd:j,onSessionEnd:b,resumeAnimation:C}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&C&&C(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const N=Xj(y.type==="pointercancel"?this.lastMoveEventInfo:Yj(w,this.transformPagePoint),this.history);this.startEvent&&j&&j(y,N),b&&b(y,N)},!ek(t))return;this.dragSnapToOrigin=i,this.handlers=n,this.transformPagePoint=r,this.distanceThreshold=l,this.contextWindow=s||window;const d=_h(t),f=Yj(d,this.transformPagePoint),{point:h}=f,{timestamp:p}=Zn;this.history=[{...h,timestamp:p}];const{onSessionStart:x}=n;x&&x(t,Xj(f,this.history)),this.removeListeners=Oh(ym(this.contextWindow,"pointermove",this.handlePointerMove),ym(this.contextWindow,"pointerup",this.handlePointerUp),ym(this.contextWindow,"pointercancel",this.handlePointerUp)),u&&this.startScrollTracking(u)}startScrollTracking(t){let n=t.parentElement;for(;n;){const r=getComputedStyle(n);(ER.has(r.overflowX)||ER.has(r.overflowY))&&this.scrollPositions.set(n,{x:n.scrollLeft,y:n.scrollTop}),n=n.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(t){const n=this.scrollPositions.get(t);if(!n)return;const r=t===window,s=r?{x:window.scrollX,y:window.scrollY}:{x:t.scrollLeft,y:t.scrollTop},i={x:s.x-n.x,y:s.y-n.y};i.x===0&&i.y===0||(r?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=i.x,this.lastMoveEventInfo.point.y+=i.y):this.history.length>0&&(this.history[0].x-=i.x,this.history[0].y-=i.y),this.scrollPositions.set(t,s),Wt.update(this.updatePoint,!0))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),Io(this.updatePoint)}}function Yj(e,t){return t?{point:t(e.point)}:e}function _R(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Xj({point:e},t){return{point:e,delta:_R(e,Bz(t)),offset:_R(e,Xce(t)),velocity:Qce(t,.1)}}function Xce(e){return e[0]}function Bz(e){return e[e.length-1]}function Qce(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const s=Bz(e);for(;n>=0&&(r=e[n],!(s.timestamp-r.timestamp>as(t)));)n--;if(!r)return{x:0,y:0};r===e[0]&&e.length>2&&s.timestamp-r.timestamp>as(t)*2&&(r=e[1]);const i=Ta(s.timestamp-r.timestamp);if(i===0)return{x:0,y:0};const l={x:(s.x-r.x)/i,y:(s.y-r.y)/i};return l.x===1/0&&(l.x=0),l.y===1/0&&(l.y=0),l}function Zce(e,{min:t,max:n},r){return t!==void 0&&e<t?e=r?nn(t,e,r.min):Math.max(e,t):n!==void 0&&e>n&&(e=r?nn(n,e,r.max):Math.min(e,n)),e}function MR(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function Jce(e,{top:t,left:n,bottom:r,right:s}){return{x:MR(e.x,n,s),y:MR(e.y,t,r)}}function RR(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,r]=[r,n]),{min:n,max:r}}function eue(e,t){return{x:RR(e.x,t.x),y:RR(e.y,t.y)}}function tue(e,t){let n=.5;const r=br(e),s=br(t);return s>r?n=Om(t.min,t.max-r,e.min):r>s&&(n=Om(e.min,e.max-s,t.min)),Ds(0,1,n)}function nue(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const pC=.35;function rue(e=pC){return e===!1?e=0:e===!0&&(e=pC),{x:DR(e,"left","right"),y:DR(e,"top","bottom")}}function DR(e,t,n){return{min:$R(e,t),max:$R(e,n)}}function $R(e,t){return typeof e=="number"?e:e[t]||0}const aue=new WeakMap;class sue{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=En(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=t}start(t,{snapToCursor:n=!1,distanceThreshold:r}={}){const{presenceContext:s}=this.visualElement;if(s&&s.isPresent===!1)return;const i=p=>{n&&this.snapToCursor(_h(p).point),this.stopAnimation()},l=(p,x)=>{const{drag:y,dragPropagation:w,onDragStart:j}=this.getProps();if(y&&!w&&(this.openDragLock&&this.openDragLock(),this.openDragLock=Foe(y),!this.openDragLock))return;this.latestPointerEvent=p,this.latestPanInfo=x,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Ns(C=>{let N=this.getAxisMotionValue(C).get()||0;if(Ps.test(N)){const{projection:k}=this.visualElement;if(k&&k.layout){const T=k.layout.layoutBox[C];T&&(N=br(T)*(parseFloat(N)/100))}}this.originPoint[C]=N}),j&&Wt.update(()=>j(p,x),!1,!0),oC(this.visualElement,"transform");const{animationState:b}=this.visualElement;b&&b.setActive("whileDrag",!0)},u=(p,x)=>{this.latestPointerEvent=p,this.latestPanInfo=x;const{dragPropagation:y,dragDirectionLock:w,onDirectionLock:j,onDrag:b}=this.getProps();if(!y&&!this.openDragLock)return;const{offset:C}=x;if(w&&this.currentDirection===null){this.currentDirection=oue(C),this.currentDirection!==null&&j&&j(this.currentDirection);return}this.updateAxis("x",x.point,C),this.updateAxis("y",x.point,C),this.visualElement.render(),b&&Wt.update(()=>b(p,x),!1,!0)},d=(p,x)=>{this.latestPointerEvent=p,this.latestPanInfo=x,this.stop(p,x),this.latestPointerEvent=null,this.latestPanInfo=null},f=()=>{const{dragSnapToOrigin:p}=this.getProps();(p||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:h}=this.getProps();this.panSession=new qz(t,{onSessionStart:i,onStart:l,onMove:u,onSessionEnd:d,resumeAnimation:f},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:h,distanceThreshold:r,contextWindow:Fz(this.visualElement),element:this.visualElement.current})}stop(t,n){const r=t||this.latestPointerEvent,s=n||this.latestPanInfo,i=this.isDragging;if(this.cancel(),!i||!s||!r)return;const{velocity:l}=s;this.startAnimation(l);const{onDragEnd:u}=this.getProps();u&&Wt.postRender(()=>u(r,s))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(t,n,r){const{drag:s}=this.getProps();if(!r||!Cx(t,s,this.currentDirection))return;const i=this.getAxisMotionValue(t);let l=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(l=Zce(l,this.constraints[t],this.elastic[t])),i.set(l)}resolveConstraints(){const{dragConstraints:t,dragElastic:n}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,s=this.constraints;t&&hu(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&r?this.constraints=Jce(r.layoutBox,t):this.constraints=!1,this.elastic=rue(n),s!==this.constraints&&!hu(t)&&r&&this.constraints&&!this.hasMutatedConstraints&&Ns(i=>{this.constraints!==!1&&this.getAxisMotionValue(i)&&(this.constraints[i]=nue(r.layoutBox[i],this.constraints[i]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!hu(t))return!1;const r=t.current,{projection:s}=this.visualElement;if(!s||!s.layout)return!1;const i=hle(r,s.root,this.visualElement.getTransformPagePoint());let l=eue(s.layout.layoutBox,i);if(n){const u=n(dle(l));this.hasMutatedConstraints=!!u,u&&(l=lz(u))}return l}startAnimation(t){const{drag:n,dragMomentum:r,dragElastic:s,dragTransition:i,dragSnapToOrigin:l,onDragTransitionEnd:u}=this.getProps(),d=this.constraints||{},f=Ns(h=>{if(!Cx(h,n,this.currentDirection))return;let p=d&&d[h]||{};l&&(p={min:0,max:0});const x=s?200:1e6,y=s?40:1e7,w={type:"inertia",velocity:r?t[h]:0,bounceStiffness:x,bounceDamping:y,timeConstant:750,restDelta:1,restSpeed:10,...i,...p};return this.startAxisValueAnimation(h,w)});return Promise.all(f).then(u)}startAxisValueAnimation(t,n){const r=this.getAxisMotionValue(t);return oC(this.visualElement,t),r.start(YT(t,r,0,n,this.visualElement,!1))}stopAnimation(){Ns(t=>this.getAxisMotionValue(t).stop())}getAxisMotionValue(t){const n=`_drag${t.toUpperCase()}`,r=this.visualElement.getProps(),s=r[n];return s||this.visualElement.getValue(t,(r.initial?r.initial[t]:void 0)||0)}snapToCursor(t){Ns(n=>{const{drag:r}=this.getProps();if(!Cx(n,r,this.currentDirection))return;const{projection:s}=this.visualElement,i=this.getAxisMotionValue(n);if(s&&s.layout){const{min:l,max:u}=s.layout.layoutBox[n],d=i.get()||0;i.set(t[n]-nn(l,u,.5)+d)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!hu(n)||!r||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};Ns(l=>{const u=this.getAxisMotionValue(l);if(u&&this.constraints!==!1){const d=u.get();s[l]=tue({min:d,max:d},this.constraints[l])}});const{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.constraints=!1,this.resolveConstraints(),Ns(l=>{if(!Cx(l,t,null))return;const u=this.getAxisMotionValue(l),{min:d,max:f}=this.constraints[l];u.set(nn(d,f,s[l]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;aue.set(this.visualElement,this);const t=this.visualElement.current,n=ym(t,"pointerdown",f=>{const{drag:h,dragListener:p=!0}=this.getProps(),x=f.target,y=x!==t&&Voe(x);h&&p&&!y&&this.start(f)});let r;const s=()=>{const{dragConstraints:f}=this.getProps();hu(f)&&f.current&&(this.constraints=this.resolveRefConstraints(),r||(r=iue(t,f.current,()=>this.scalePositionWithinConstraints())))},{projection:i}=this.visualElement,l=i.addEventListener("measure",s);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),Wt.read(s);const u=Mm(window,"resize",()=>this.scalePositionWithinConstraints()),d=i.addEventListener("didUpdate",(({delta:f,hasLayoutChanged:h})=>{this.isDragging&&h&&(Ns(p=>{const x=this.getAxisMotionValue(p);x&&(this.originPoint[p]+=f[p].translate,x.set(x.get()+f[p].translate))}),this.visualElement.render())}));return()=>{u(),n(),l(),d&&d(),r&&r()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:s=!1,dragConstraints:i=!1,dragElastic:l=pC,dragMomentum:u=!0}=t;return{...t,drag:n,dragDirectionLock:r,dragPropagation:s,dragConstraints:i,dragElastic:l,dragMomentum:u}}}function IR(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function iue(e,t,n){const r=V3(e,IR(n)),s=V3(t,IR(n));return()=>{r(),s()}}function Cx(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function oue(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class lue extends Uo{constructor(t){super(t),this.removeGroupControls=Oa,this.removeListeners=Oa,this.controls=new sue(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Oa}update(){const{dragControls:t}=this.node.getProps(),{dragControls:n}=this.node.prevProps||{};t!==n&&(this.removeGroupControls(),t&&(this.removeGroupControls=t.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const Qj=e=>(t,n)=>{e&&Wt.update(()=>e(t,n),!1,!0)};class cue extends Uo{constructor(){super(...arguments),this.removePointerDownListener=Oa}onPointerDown(t){this.session=new qz(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:Fz(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:r,onPanEnd:s}=this.node.getProps();return{onSessionStart:Qj(t),onStart:Qj(n),onMove:Qj(r),onEnd:(i,l)=>{delete this.session,s&&Wt.postRender(()=>s(i,l))}}}mount(){this.removePointerDownListener=ym(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let Zj=!1;class uue extends v.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r,layoutId:s}=this.props,{projection:i}=t;i&&(n.group&&n.group.add(i),r&&r.register&&s&&r.register(i),Zj&&i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),dg.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:r,drag:s,isPresent:i}=this.props,{projection:l}=r;return l&&(l.isPresent=i,t.layoutDependency!==n&&l.setOptions({...l.options,layoutDependency:n}),Zj=!0,s||t.layoutDependency!==n||n===void 0||t.isPresent!==i?l.willUpdate():this.safeToRemove(),t.isPresent!==i&&(i?l.promote():l.relegate()||Wt.postRender(()=>{const u=l.getStack();(!u||!u.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),JT.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:s}=t;Zj=!0,s&&(s.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(s),r&&r.deregister&&r.deregister(s))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function zz(e){const[t,n]=gce(),r=v.useContext(rB);return a.jsx(uue,{...e,layoutGroup:r,switchLayoutGroup:v.useContext(Iz),isPresent:t,safeToRemove:n})}const due={pan:{Feature:cue},drag:{Feature:lue,ProjectionNode:Oz,MeasureLayout:zz}};function LR(e,t,n){const{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive("whileHover",n==="Start");const s="onHover"+n,i=r[s];i&&Wt.postRender(()=>i(t,_h(t)))}class fue extends Uo{mount(){const{current:t}=this.node;t&&(this.unmount=Boe(t,(n,r)=>(LR(this.node,r,"Start"),s=>LR(this.node,s,"End"))))}unmount(){}}class mue extends Uo{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Oh(Mm(this.node.current,"focus",()=>this.onFocus()),Mm(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}
19function FR(e,t,n){const{props:r}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&r.whileTap&&e.animationState.setActive("whileTap",n==="Start");const s="onTap"+(n==="End"?"":n),i=r[s];i&&Wt.postRender(()=>i(t,_h(t)))}class hue extends Uo{mount(){const{current:t}=this.node;if(!t)return;const{globalTapTarget:n,propagate:r}=this.node.props;this.unmount=Koe(t,(s,i)=>(FR(this.node,i,"Start"),(l,{success:u})=>FR(this.node,l,u?"End":"Cancel")),{useGlobalTarget:n,stopPropagation:r?.tap===!1})}unmount(){}}const xC=new WeakMap,Jj=new WeakMap,pue=e=>{const t=xC.get(e.target);t&&t(e)},xue=e=>{e.forEach(pue)};function gue({root:e,...t}){const n=e||document;Jj.has(n)||Jj.set(n,{});const r=Jj.get(n),s=JSON.stringify(t);return r[s]||(r[s]=new IntersectionObserver(xue,{root:e,...t})),r[s]}function yue(e,t,n){const r=gue(t);return xC.set(e,n),r.observe(e),()=>{xC.delete(e),r.unobserve(e)}}const vue={some:0,all:1};class bue extends Uo{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:r,amount:s="some",once:i}=t,l={root:n?n.current:void 0,rootMargin:r,threshold:typeof s=="number"?s:vue[s]},u=d=>{const{isIntersecting:f}=d;if(this.isInView===f||(this.isInView=f,i&&!f&&this.hasEnteredView))return;f&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",f);const{onViewportEnter:h,onViewportLeave:p}=this.node.getProps(),x=f?h:p;x&&x(d)};return yue(this.node.current,l,u)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(jue(t,n))&&this.startObserver()}unmount(){}}function jue({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const wue={inView:{Feature:bue},tap:{Feature:hue},focus:{Feature:mue},hover:{Feature:fue}},Nue={layout:{ProjectionNode:Oz,MeasureLayout:zz}},Sue={...Kce,...wue,...due,...Nue},gr=zce(Sue,Uce);function Cue(){return a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 21 21",className:"w-5 h-5 shrink-0",children:[a.jsx("rect",{x:"1",y:"1",width:"9",height:"9",fill:"#f25022"}),a.jsx("rect",{x:"11",y:"1",width:"9",height:"9",fill:"#7fba00"}),a.jsx("rect",{x:"1",y:"11",width:"9",height:"9",fill:"#00a4ef"}),a.jsx("rect",{x:"11",y:"11",width:"9",height:"9",fill:"#ffb900"})]})}function Aue(){const[e,t]=v.useState(""),[n,r]=v.useState(""),[s,i]=v.useState(""),[l,u]=v.useState(!1),[d,f]=v.useState(null),[h,p]=v.useState(!1);v.useEffect(()=>{const b=new URLSearchParams(window.location.search).get("ms_error");b&&(i(b),window.history.replaceState({},"",window.location.pathname)),fetch("/api/auth/microsoft/status").then(C=>C.json()).then(C=>f(C.configured)).catch(()=>f(!1))},[]);const x=h||d===!1,y=()=>{i(""),window.location.href="/api/auth/microsoft"},w=async j=>{j.preventDefault(),i(""),u(!0);try{const b=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:e,password:n})});if(!b.ok){const N=await b.json().catch(()=>({}));i(N.error||"Invalid email or password. Please try again.");return}const{token:C}=await b.json();localStorage.setItem("fs_team_token",C),localStorage.removeItem("fs_client_token"),window.location.href="/dashboard"}catch{i("Connection error. Please try again.")}finally{u(!1)}};return a.jsxs("div",{className:"min-h-screen flex relative bg-background overflow-hidden",children:[a.jsxs("div",{className:"hidden lg:block lg:w-1/2 relative",children:[a.jsx("img",{src:"/images/auth-bg.png",alt:"Modern Architecture",className:"absolute inset-0 w-full h-full object-cover"}),a.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-primary/80 to-primary/40 backdrop-blur-[2px]"}),a.jsx("div",{className:"absolute inset-0 flex flex-col justify-center px-16 text-white",children:a.jsxs(gr.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.8},children:[a.jsx("div",{className:"bg-white rounded-2xl px-6 py-4 w-fit mb-8 shadow-2xl",children:a.jsx("img",{src:Rg,alt:"Five Star Rain Gutters",className:"h-16 w-auto"})}),a.jsx("h1",{className:"text-5xl font-display font-bold leading-tight mb-6",children:"Management System"}),a.jsx("p",{className:"text-xl text-white/80 max-w-md font-medium leading-relaxed",children:"Streamline your workflow from initial lead to final invoice with our comprehensive platform."})]})})]}),a.jsx("div",{className:"w-full lg:w-1/2 flex flex-col justify-center px-8 sm:px-16 md:px-24 xl:px-32 bg-background relative z-10",children:a.jsxs(gr.div,{initial:{opacity:0,x:20}
19,animate:{opacity:1,x:0},transition:{duration:.5,delay:.2},className:"max-w-md w-full mx-auto",children:[a.jsx("div",{className:"lg:hidden mb-8",children:a.jsx("img",{src:Rg,alt:"Five Star Rain Gutters",className:"h-12 w-auto"})}),a.jsx("h2",{className:"text-3xl font-display font-bold text-foreground mb-2",children:"Welcome back"}),a.jsx("p",{className:"text-muted-foreground mb-8",children:"Sign in to access the Five Star Manager."}),s&&a.jsxs("div",{className:"mb-6 p-4 bg-destructive/10 border border-destructive/20 rounded-xl text-destructive text-sm font-medium flex items-start gap-3",children:[a.jsx(rn,{className:"w-4 h-4 mt-0.5 shrink-0"}),a.jsx("span",{children:s})]}),d===null&&a.jsxs("div",{className:"mb-6",children:[a.jsx("p",{className:"text-xs uppercase tracking-wider font-semibold text-muted-foreground mb-3",children:"Team members"}),a.jsx("div",{className:"w-full h-14 rounded-xl bg-secondary/50 animate-pulse flex items-center justify-center text-sm text-muted-foreground",children:"Checking sign-in options…"})]}),d&&a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"text-xs uppercase tracking-wider font-semibold text-muted-foreground mb-3",children:"Team members"}),a.jsxs(ne,{type:"button",variant:"outline",className:"w-full h-14 text-base rounded-xl font-semibold border-2 flex items-center justify-center gap-3 hover:bg-secondary/80",onClick:y,children:[a.jsx(Cue,{}),"Sign in with Microsoft"]}),a.jsxs("div",{className:"relative my-8",children:[a.jsx("div",{className:"absolute inset-0 flex items-center",children:a.jsx("div",{className:"w-full border-t border-border"})}),a.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:a.jsx("span",{className:"bg-background px-3 text-muted-foreground font-medium tracking-wider",children:"Customer portal"})})]})]}),a.jsxs("a",{href:"/client-login",className:"w-full rounded-xl border-2 border-primary bg-primary text-primary-foreground p-4 flex items-center justify-between hover:bg-primary/90 transition-colors shadow-lg shadow-primary/20",children:[a.jsxs("span",{className:"flex items-center gap-3 text-left",children:[a.jsx("span",{className:"w-10 h-10 rounded-lg bg-white/15 flex items-center justify-center shrink-0",children:a.jsx(L2,{className:"w-5 h-5"})}),a.jsxs("span",{children:[a.jsx("span",{className:"block font-bold",children:"Access Client Portal"}),a.jsx("span",{className:"block text-xs text-primary-foreground/75",children:"Homeowners, contractors, HOAs & property managers"})]})]}),a.jsx(Ru,{className:"w-5 h-5 shrink-0"})]}),a.jsxs("div",{className:"mt-4 flex items-center justify-center gap-5 text-xs text-muted-foreground",children:[a.jsxs("span",{className:"flex items-center gap-1.5",children:[a.jsx(L2,{className:"w-3.5 h-3.5"})," Homeowners"]}),a.jsxs("span",{className:"flex items-center gap-1.5",children:[a.jsx(Bq,{className:"w-3.5 h-3.5"})," Contractors"]}),a.jsxs("span",{className:"flex items-center gap-1.5",children:[a.jsx(xd,{className:"w-3.5 h-3.5"})," HOA / Property Mgmt"]})]}),x&&a.jsxs("form",{onSubmit:w,className:"space-y-5 mt-8 pt-8 border-t border-border",children:[d&&a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("p",{className:"text-xs uppercase tracking-wider font-semibold text-muted-foreground",children:"Admin password sign-in"}),a.jsx("button",{type:"button",onClick:()=>p(!1),className:"text-xs text-muted-foreground hover:text-foreground font-medium hover:underline",children:"Hide"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-semibold text-foreground",children:"Email Address"}),a.jsxs("div",{className:"relative",children:[a.jsx($r,{className:"absolute left-4 top-1/2 -translate-y-1/2 w-5 h-5 text-muted-foreground"}),a.jsx("input",{type:"email",required:!0,autoComplete:"email",value:e,onChange:j=>t(j.target.value),className:"w-full pl-12 pr-4 py-3.5 bg-secondary border-2 border-secondary focus:border-primary focus:bg-white rounded-xl outline-none transition-all duration-200",placeholder:"[email protected]"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-semibold text-foreground",children:"Password"}),a.jsxs("div",{className:"relative",children:[a.jsx(hee,{className:"absolute left-4 top-1/2 -translate-y-1/2 w-5 h-5 text-muted-foreground"}),a.jsx("input",{type:"password",required:!0,autoComplete:"current-password",value:n,onChange:j=>r(j.target.value),className:"w-full pl-12 pr-4 py-3.5 bg-secondary border-2 border-secondary focus:border-primary focus:bg-white rounded-xl outline-none transition-all duration-200",placeholder:"••••••••"})]})]}),a.jsx(ne,{type:"submit",className:"w-full h-14 text-base rounded-xl font-bold bg-primary hover:bg-primary/90 shadow-xl shadow-primary/25 mt-2",disabled:l,children:l?a.jsx(Me,{className:"w-6 h-6 animate-spin"}):a.jsxs(a.Fragment,{children:["Sign In ",a.jsx(Ru,{className:"w-5 h-5 ml-2"})]})})]}),d&&!h&&a.jsx("div",{className:"mt-10 text-center",children:a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Administrator?"," ",a.jsx("button",{type:"button",onClick:()=>p(!0),className:"text-primary font-semibold hover:underline",children:"Emergency password sign-in"})]})})]})})]})}function Tue(){const[,e]=fr(),[t,n]=v.useState(null);return v.useEffect(()=>{const s=new URLSearchParams(window.location.search).get("token");s?(localStorage.setItem("fs_team_token",s),localStorage.removeItem("fs_client_token"),window.location.replace("/dashboard")):n("Authentication failed — no token received. Please try again.")},[e]),t?a.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:a.jsxs("div",{className:"flex flex-col items-center gap-4 text-center max-w-sm px-6",children:[a.jsx(cT,{className:"w-12 h-12 text-destructive"}),a.jsx("h2",{className:"text-xl font-bold text-foreground",children:"Login Failed"}),a.jsx("p",{className:"text-muted-foreground text-sm",children:t}),a.jsx("a",{href:"/login",className:"text-primary font-semibold hover:underline text-sm",children:"Return to login"})]})}):a.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:a.jsxs("div",{className:"flex flex-col items-center gap-4",children:[a.jsx(Me,{className:"w-10 h-10 animate-spin text-primary"}),a.jsx("p",{className:"text-muted-foreground font-medium",children:"Completing Microsoft sign-in…"})]})})}function kue(){const[e,t]=v.useState(""),[n,r]=v.useState(!1),s=Kae({mutation:{onSuccess:()=>r(!0)}}),i=l=>{l.preventDefault(),s.mutate({data:{email:e}})};return a.jsx("div",{className:"min-h-screen bg-secondary flex items-center justify-center p-4",children:a.jsxs(gr.div,{initial:{opacity:0,scale:.95}
19,animate:{opacity:1,scale:1},className:"max-w-md w-full glass-panel rounded-3xl p-8 md:p-10",children:[a.jsxs("div",{className:"flex flex-col items-center text-center mb-8",children:[a.jsx("div",{className:"bg-white rounded-2xl shadow-md shadow-black/8 px-5 py-3 mb-6",children:a.jsx("img",{src:Rg,alt:"Five Star Rain Gutters",className:"h-12 w-auto object-contain"})}),a.jsx("h1",{className:"text-3xl font-display font-bold text-foreground mb-3",children:"5 Star Client Portal"}),a.jsx("p",{className:"text-muted-foreground",children:"Access your quotes, invoices, and job status securely."})]}),n?a.jsxs(gr.div,{initial:{opacity:0},animate:{opacity:1},className:"text-center space-y-6",children:[a.jsx("div",{className:"w-20 h-20 bg-green-100 text-green-600 rounded-full flex items-center justify-center mx-auto mb-6",children:a.jsx(st,{className:"w-10 h-10"})}),a.jsx("h2",{className:"text-2xl font-bold",children:"Check your email"}),a.jsxs("p",{className:"text-muted-foreground leading-relaxed",children:["We've sent a magic link to ",a.jsx("span",{className:"font-semibold text-foreground",children:e}),". Click the link in the email to sign in instantly."]}),a.jsx(ne,{variant:"outline",className:"mt-8 rounded-xl h-12 w-full",onClick:()=>r(!1),children:"Try a different email"})]}):a.jsxs("form",{onSubmit:i,className:"space-y-6",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-semibold text-foreground",children:"Email Address"}),a.jsxs("div",{className:"relative",children:[a.jsx($r,{className:"absolute left-4 top-1/2 -translate-y-1/2 w-5 h-5 text-muted-foreground"}),a.jsx("input",{type:"email",required:!0,value:e,onChange:l=>t(l.target.value),className:"w-full pl-12 pr-4 py-4 bg-background border-2 border-border focus:border-primary rounded-xl outline-none transition-all duration-200",placeholder:"Enter your email"})]})]}),a.jsxs(ne,{type:"submit",className:"w-full h-14 text-lg rounded-xl font-bold bg-primary hover:bg-primary/90 shadow-xl shadow-primary/25",disabled:s.isPending,children:[s.isPending?"Sending Link...":"Send Magic Link",!s.isPending&&a.jsx(Ru,{className:"w-5 h-5 ml-2"})]})]})]})})}function Oue(){const[,e]=fr(),t=Qae();return v.useEffect(()=>{const n=new URLSearchParams(window.location.search),r=n.get("token"),s=n.get("redirect")||"/client-portal";r?t.mutate({data:{token:r}},{onSuccess:()=>e(s),onError:()=>e("/client-login?error=invalid_token")}):e("/client-login")},[]),a.jsxs("div",{className:"min-h-screen bg-background flex flex-col items-center justify-center p-4 text-center",children:[a.jsx(Me,{className:"w-12 h-12 text-primary animate-spin mb-6"}),a.jsx("h2",{className:"text-2xl font-display font-bold mb-2",children:"Verifying your secure link..."}),a.jsx("p",{className:"text-muted-foreground",children:"This will only take a moment."})]})}const ye=v.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:qe("rounded-xl border bg-card text-card-foreground shadow",e),...t}));ye.displayName="Card";const Ss=v.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:qe("flex flex-col space-y-1.5 p-6",e),...t}));Ss.displayName="CardHeader";const Cs=v.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:qe("font-semibold leading-none tracking-tight",e),...t}));Cs.displayName="CardTitle";const Pue=v.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:qe("text-sm text-muted-foreground",e),...t}));Pue.displayName="CardDescription";const _t=v.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:qe("p-6 pt-0",e),...t}));_t.displayName="CardContent";const Eue=v.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:qe("flex items-center p-6 pt-0",e),...t}));Eue.displayName="CardFooter";function Ut(e){const t=Object.prototype.toString.call(e);return e instanceof Date||typeof e=="object"&&t==="[object Date]"?new e.constructor(+e):typeof e=="number"||t==="[object Number]"||typeof e=="string"||t==="[object String]"?new Date(e):new Date(NaN)}function Lo(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}const Uz=6048e5,_ue=864e5,Ax=43200,qR=1440;let Mue={};function Mh(){return Mue}function Rm(e,t){const n=Mh(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,s=Ut(e),i=s.getDay(),l=(i<r?7:0)+i-r;return s.setDate(s.getDate()-l),s.setHours(0,0,0,0),s}function Hg(e){return Rm(e,{weekStartsOn:1}
19)}function Hz(e){const t=Ut(e),n=t.getFullYear(),r=Lo(e,0);r.setFullYear(n+1,0,4),r.setHours(0,0,0,0);const s=Hg(r),i=Lo(e,0);i.setFullYear(n,0,4),i.setHours(0,0,0,0);const l=Hg(i);return t.getTime()>=s.getTime()?n+1:t.getTime()>=l.getTime()?n:n-1}function BR(e){const t=Ut(e);return t.setHours(0,0,0,0),t}function Vg(e){const t=Ut(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function Rue(e,t){const n=BR(e),r=BR(t),s=+n-Vg(n),i=+r-Vg(r);return Math.round((s-i)/_ue)}function Due(e){const t=Hz(e),n=Lo(e,0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),Hg(n)}function fg(e,t){const n=Ut(e),r=Ut(t),s=n.getTime()-r.getTime();return s<0?-1:s>0?1:s}function $ue(e){return Lo(e,Date.now())}function Iue(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function Lue(e){if(!Iue(e)&&typeof e!="number")return!1;const t=Ut(e);return!isNaN(Number(t))}function Fue(e,t){const n=Ut(e),r=Ut(t),s=n.getFullYear()-r.getFullYear(),i=n.getMonth()-r.getMonth();return s*12+i}function que(e){return t=>{const r=(e?Math[e]:Math.trunc)(t);return r===0?0:r}}function Bue(e,t){return+Ut(e)-+Ut(t)}function zue(e){const t=Ut(e);return t.setHours(23,59,59,999),t}function Uue(e){const t=Ut(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}function Hue(e){const t=Ut(e);return+zue(t)==+Uue(t)}function Vue(e,t){const n=Ut(e),r=Ut(t),s=fg(n,r),i=Math.abs(Fue(n,r));let l;if(i<1)l=0;else{n.getMonth()===1&&n.getDate()>27&&n.setDate(30),n.setMonth(n.getMonth()-s*i);let u=fg(n,r)===-s;Hue(Ut(e))&&i===1&&fg(e,r)===1&&(u=!1),l=s*(i-Number(u))}return l===0?0:l}function Gue(e,t,n){const r=Bue(e,t)/1e3;return que(n?.roundingMethod)(r)}function Kue(e){const t=Ut(e),n=Lo(e,0);return n.setFullYear(t.getFullYear(),0,1),n.setHours(0,0,0,0),n}const Wue={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},Yue=(e,t,n)=>{let r;const s=Wue[e];return typeof s=="string"?r=s:t===1?r=s.one:r=s.other.replace("{{count}}",t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function ew(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const Xue={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Que={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Zue={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Jue={date:ew({formats:Xue,defaultWidth:"full"}),time:ew({formats:Que,defaultWidth:"full"}),dateTime:ew({formats:Zue,defaultWidth:"full"})},ede={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},tde=(e,t,n,r)=>ede[e];function If(e){return(t,n)=>{const r=n?.context?String(n.context):"standalone";let s;if(r==="formatting"&&e.formattingValues){const l=e.defaultFormattingWidth||e.defaultWidth,u=n?.width?String(n.width):l;s=e.formattingValues[u]||e.formattingValues[l]}else{const l=e.defaultWidth,u=n?.width?String(n.width):e.defaultWidth;s=e.values[u]||e.values[l]}const i=e.argumentCallback?e.argumentCallback(t):t;return s[i]}}const nde={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},rde={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},ade={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},sde={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Frid
19ay","Saturday"]},ide={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},ode={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},lde=(e,t)=>{const n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},cde={ordinalNumber:lde,era:If({values:nde,defaultWidth:"wide"}),quarter:If({values:rde,defaultWidth:"wide",argumentCallback:e=>e-1}),month:If({values:ade,defaultWidth:"wide"}),day:If({values:sde,defaultWidth:"wide"}),dayPeriod:If({values:ide,defaultWidth:"wide",formattingValues:ode,defaultFormattingWidth:"wide"})};function Lf(e){return(t,n={})=>{const r=n.width,s=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],i=t.match(s);if(!i)return null;const l=i[0],u=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],d=Array.isArray(u)?dde(u,p=>p.test(l)):ude(u,p=>p.test(l));let f;f=e.valueCallback?e.valueCallback(d):d,f=n.valueCallback?n.valueCallback(f):f;const h=t.slice(l.length);return{value:f,rest:h}}}function ude(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function dde(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function fde(e){return(t,n={})=>{const r=t.match(e.matchPattern);if(!r)return null;const s=r[0],i=t.match(e.parsePattern);if(!i)return null;let l=e.valueCallback?e.valueCallback(i[0]):i[0];l=n.valueCallback?n.valueCallback(l):l;const u=t.slice(s.length);return{value:l,rest:u}}}const mde=/^(\d+)(th|st|nd|rd)?/i,hde=/\d+/i,pde={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},xde={any:[/^b/i,/^(a|c)/i]},gde={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},yde={any:[/1/i,/2/i,/3/i,/4/i]},vde={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},bde={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},jde={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},wde={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},Nde={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Sde={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},Cde={ordinalNumber:fde({matchPattern:mde,parsePattern:hde,valueCallback:e=>parseInt(e,10)}),era:Lf({matchPatterns:pde,defaultMatchWidth:"wide",parsePatterns:xde,defaultParseWidth:"any"}),quarter:Lf({matchPatterns:gde,defaultMatchWidth:"wide",parsePatterns:yde,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Lf({matchPatterns:vde,defaultMatchWidth:"wide",parsePatterns:bde,defaultParseWidth:"any"}),day:Lf({matchPatterns:jde,defaultMatchWidth:"wide",parsePatterns:wde,defaultParseWidth:"any"}),dayPeriod:Lf({matchPatterns:Nde,defaultMatchWidth:"any",parsePatterns:Sde,defaultParseWidth:"any"})},Vz={code:"en-US",formatDistance:Yue,formatLong:Jue,formatRelative:tde,localize:cde,match:Cde,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Ade(e){const t=Ut(e);return Rue(t,Kue(t))+1}function Tde(e){const t=Ut(e),n=+Hg(t)-+Due(t);return Math.round(n/Uz)+1}function Gz(e,t){const n=Ut(e),r=n.getFullYear(),s=Mh(),i=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??s.firstWeekContainsDate??s.locale?.options?.firstWeekContainsDate??1,l=Lo(e,0);l.setFullYear(r+1,0,i),l.setHours(0,0,0,0);const u=Rm(l,t),d=Lo(e,0);d.setFullYear(r,0,i),d.setHours(0,0,0,0);const f=Rm(d,t);return n.getTime()>=u.getTime()?r+1:n.getTime()>=f.getTime()?r:r-1}function kde(e,t){const n=Mh(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,s=Gz(e,t),i=Lo(e,0);return i.setFullYear(s,0,r),i.setHours(0,0,0,0),Rm(i,t)}function Ode(e,t){const n=Ut(e),r=+Rm(n,t)-+kde(n,t);return Math.round(r/Uz)+1}function Et(e,t){const n=e<0?"-":"",r=Math.abs(e).toString().padStart(t,"0");return n+r}const vo={y(e,t){const n=e.getFullYear(),r=n>0?n:1-n;return Et(t==="yy"?r%100:r,t.length)},M(e,t){const n=e.getMonth();return t==="M"?String(n+1):Et(n+1,2)},d(e,t){return Et(e.getDate(),t.length)},a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];default:return n==="am"?"a.m.":"p.m."}},h(e,t){return Et(e.getHours()%12||12,t.length)},H(e,t){return Et(e.getHours(),t.length)},m(e,t){return Et(e.getMinutes(),t.length)},s(e,t){return Et(e.getSeconds(),t.length)},S(e,t){const n=t.length,r=e.getMilliseconds(),s=Math.trunc(r*Math.pow(10,n-3));return Et(s,t.length)}},nu={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},zR={G:function(e,t,n){const r=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});default:return n.era(r,{width:"wide"})}},y:function(e,t,n){if(t==="yo"){const r=e.getFullYear(),s=r>0?r:1-r;return n.ordinalNumber(s,{unit:"year"})}return vo.y(e,t)},Y:function(e,t,n,r){const s=Gz(e,r),i=s>0?s:1-s;if(t==="YY"){const l=i%100;return Et(l,2)}return t==="Yo"?n.ordinalNumber(i,{unit:"year"}):Et(i,t.length)},R:function(e,t){const n=Hz(e);return Et(n,t.length)},u:function(e,t){const n=e.getFullYear();return Et(n,t.length)},Q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(r);case"QQ":return Et(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(r);case"qq":return Et(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(e,t,n){const r=e.getMonth();switch(t){case"M":case"MM":return vo.M(e,t);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(e,t,n){const r=e.getMonth();switch(t){case"L":return String(r+1);case"LL":return Et(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(e,t,n,r){const s=Ode(e,r);return t==="wo"?n.ordinalNumber(s,{unit:"week"}):Et(s,t.length)},I:function(e,t,n){const r=Tde(e);return t==="Io"?n.ordinalNumber(r,{unit:"week"}):Et(r,t.length)},d:function(e,t,n){return t==="do"?n.ordinalNumber(e.getDate(),{unit:"date"}):vo.d(e,t)},D:function(e,t,n){const r=Ade(e);return t==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):Et(r,t.length)},E:function(e,t,n){const r=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(e,t,n,r){const s=e.getDay(),i=(s-r.weekStartsOn+8)%7||7;switch(t){case"e":return String(i);case"ee":return Et(i,2);case"eo":return n.ordinalNumber(i,{unit:"day"});case"eee":return n.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(s,{width:"short",context:"formatting"});default:return n.day(s,{width:"wide",context:"formatting"})}},c:function(e,t,n,r){const s=e.getDay(),i=(s-r.weekStartsOn+8)%7||7;switch(t){case"c":return String(i);case"cc":return Et(i,t.length);case"co":return n.ordinalNumber(i,{unit:"day"});case"ccc":return n.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(s,{width:"narrow",context:"standalone"});case"cccccc":return n.day(s,{width:"short",context:"standalone"});default:return n.day(s,{width:"wide",context:"standalone"})}},i:function(e,t,n){const r=e.getDay(),s=r===0?7:r;switch(t){case"i":return String(s);case"ii":return Et(s,t.length);case"io":return n.ordinalNumber(s,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(e,t,n){const s=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(s,{width:"narrow",context:"formatting"});default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},b:function(e,t,n){const r=e.getHours();let s;switch(r===12?s=nu.noon:r===0?s=nu.midnight:s=r/12>
vendor: 4,217 bytes, line 19
19=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(s,{width:"narrow",context:"formatting"});default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(e,t,n){const r=e.getHours();let s;switch(r>=17?s=nu.evening:r>=12?s=nu.afternoon:r>=4?s=nu.morning:s=nu.night,t){case"B":case"BB":case"BBB":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(s,{width:"narrow",context:"formatting"});default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(e,t,n){if(t==="ho"){let r=e.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return vo.h(e,t)},H:function(e,t,n){return t==="Ho"?n.ordinalNumber(e.getHours(),{unit:"hour"}):vo.H(e,t)},K:function(e,t,n){const r=e.getHours()%12;return t==="Ko"?n.ordinalNumber(r,{unit:"hour"}):Et(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t==="ko"?n.ordinalNumber(r,{unit:"hour"}):Et(r,t.length)},m:function(e,t,n){return t==="mo"?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):vo.m(e,t)},s:function(e,t,n){return t==="so"?n.ordinalNumber(e.getSeconds(),{unit:"second"}):vo.s(e,t)},S:function(e,t){return vo.S(e,t)},X:function(e,t,n){const r=e.getTimezoneOffset();if(r===0)return"Z";switch(t){case"X":return HR(r);case"XXXX":case"XX":return kl(r);default:return kl(r,":")}},x:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"x":return HR(r);case"xxxx":case"xx":return kl(r);default:return kl(r,":")}},O:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+UR(r,":");default:return"GMT"+kl(r,":")}},z:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+UR(r,":");default:return"GMT"+kl(r,":")}},t:function(e,t,n){const r=Math.trunc(e.getTime()/1e3);return Et(r,t.length)},T:function(e,t,n){const r=e.getTime();return Et(r,t.length)}};function UR(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),s=Math.trunc(r/60),i=r%60;return i===0?n+String(s):n+String(s)+t+Et(i,2)}function HR(e,t){return e%60===0?(e>0?"-":"+")+Et(Math.abs(e)/60,2):kl(e,t)}function kl(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),s=Et(Math.trunc(r/60),2),i=Et(r%60,2);return n+s+t+i}const VR=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});default:return t.date({width:"full"})}},Kz=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});default:return t.time({width:"full"})}},Pde=(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],r=n[1],s=n[2];if(!s)return VR(e,t);let i;switch(r){case"P":i=t.dateTime({width:"short"});break;case"PP":i=t.dateTime({width:"medium"});break;case"PPP":i=t.dateTime({width:"long"});break;default:i=t.dateTime({width:"full"});break}return i.replace("{{date}}",VR(r,t)).replace("{{time}}",Kz(s,t))},Ede={p:Kz,P:Pde},_de=/^D+$/,Mde=/^Y+$/,Rde=["D","DD","YY","YYYY"];function Dde(e){return _de.test(e)}function $de(e){return Mde.test(e)}function Ide(e,t,n){const r=Lde(e,t,n);if(console.warn(r),Rde.includes(e))throw new RangeError(r)}function Lde(e,t,n){const r=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const Fde=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,qde=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Bde=/^'([^]*?)'?$/,zde=/''/g,Ude=/[a-zA-Z]/;function Tt(e,t,n){const r=Mh(),s=r.locale??Vz,i=r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,l=r.weekStartsOn??r.locale?.options?.weekStartsOn??0,u=Ut(e);if(!Lue(u))throw new RangeError("Invalid time value");let d=t.match(qde).map(h=>{const p=h[0];if(p==="p"||p==="P"){const x=Ede[p];return x(h,s.formatLong)}return h}).join("").match(Fde).map(h=>{if(h==="''")return{isToken:!1,value:"'"};const p=h[0];if(p==="'")return{isToken:!1,value:Hde(h)};if(zR[p])return{isToken:!0,value:h};
19if(p.match(Ude))throw new RangeError("Format string contains an unescaped latin alphabet character `"+p+"`");return{isToken:!1,value:h}});s.localize.preprocessor&&(d=s.localize.preprocessor(u,d));const f={firstWeekContainsDate:i,weekStartsOn:l,locale:s};return d.map(h=>{if(!h.isToken)return h.value;const p=h.value;($de(p)||Dde(p))&&Ide(p,t,String(e));const x=zR[p[0]];return x(u,p,s.localize,f)}).join("")}function Hde(e){const t=e.match(Bde);return t?t[1].replace(zde,"'"):e}function Vde(e,t,n){const r=Mh(),s=n?.locale??r.locale??Vz,i=2520,l=fg(e,t);if(isNaN(l))throw new RangeError("Invalid time value");const u=Object.assign({},n,{addSuffix:n?.addSuffix,comparison:l});let d,f;l>0?(d=Ut(t),f=Ut(e)):(d=Ut(e),f=Ut(t));const h=Gue(f,d),p=(Vg(f)-Vg(d))/1e3,x=Math.round((h-p)/60);let y;if(x<2)return n?.includeSeconds?h<5?s.formatDistance("lessThanXSeconds",5,u):h<10?s.formatDistance("lessThanXSeconds",10,u):h<20?s.formatDistance("lessThanXSeconds",20,u):h<40?s.formatDistance("halfAMinute",0,u):h<60?s.formatDistance("lessThanXMinutes",1,u):s.formatDistance("xMinutes",1,u):x===0?s.formatDistance("lessThanXMinutes",1,u):s.formatDistance("xMinutes",x,u);if(x<45)return s.formatDistance("xMinutes",x,u);if(x<90)return s.formatDistance("aboutXHours",1,u);if(x<qR){const w=Math.round(x/60);return s.formatDistance("aboutXHours",w,u)}else{if(x<i)return s.formatDistance("xDays",1,u);if(x<Ax){const w=Math.round(x/qR);return s.formatDistance("xDays",w,u)}else if(x<Ax*2)return y=Math.round(x/Ax),s.formatDistance("aboutXMonths",y,u)}if(y=Vue(f,d),y<12){const w=Math.round(x/Ax);return s.formatDistance("xMonths",w,u)}else{const w=y%12,j=Math.trunc(y/12);return w<3?s.formatDistance("aboutXYears",j,u):w<9?s.formatDistance("overXYears",j,u):s.formatDistance("almostXYears",j+1,u)}}function lk(e,t){return Vde(e,$ue(e),t)}const Qt={materials:["Aluminum","Copper","24 ga Steel"],roofTypes:["Gable","Hip","Flat","Mansard","Gambrel","Shed"],roofMaterials:["Asphalt Shingle","Tile","Metal","Wood Shake","Slate","Flat/Membrane"],roofPitches:["1/12","2/12","3/12","4/12","5/12","6/12","7/12","8/12","9/12","10/12","11/12","12/12"],downspoutTypes:['2"x3" Ribbed','2"x3" Smooth','3"x4" Smooth','3" Round','4" Round'],downspoutManufacturers:["IMS","VGS"],downspoutColors:{IMS:["Red","Black","White","Green","Brown"],VGS:["Red","Black","White","Green","Bronze"]},gutterTypesByMaterial:{Aluminum:['5" Ogee','6" Ogee','5" Smooth Face','6" Facia','6" Half Round'],Copper:['5" Ogee','6" Ogee','5" Smooth Face','6" Smooth Face','6" Facia','6" Half Round'],"24 ga Steel":['5" Ogee','6" Ogee','5" Smooth Face','6" Smooth Face','6" Facia','6" Half Round']},gutterMinPrices:{Aluminum:{'5" Ogee':15,'6" Ogee':18,'5" Smooth Face':15,'6" Facia':18,'6" Half Round':18},Copper:{'5" Ogee':45,'6" Ogee':50,'5" Smooth Face':45,'6" Smooth Face':50,'6" Facia':50,'6" Half Round':50},"24 ga Steel":{'5" Ogee':15,'6" Ogee':18,'5" Smooth Face':18,'6" Smooth Face':20,'6" Facia':18,'6" Half Round':18}},downspoutMinPrices:{Aluminum:{'2"x3" Ribbed':15,'2"x3" Smooth':15,'3"x4" Smooth':15,'3" Round':15,'4" Round':15},Copper:{'2"x3" Ribbed':45,'2"x3" Smooth':45,'3"x4" Smooth':50,'3" Round':50,'4" Round':50},"24 ga Steel":{'2"x3" Ribbed':15,'2"x3" Smooth':20,'3"x4" Smooth':22,'3" Round':20,'4" Round':22}},hangerPrices:{'5" Ogee':3,'6" Ogee':4,'5" Smooth Face':4,'6" Smooth Face':5,'6" Facia':6,'6" Half Round':5},rodPrice:12,guards:{none:{label:"None",rate:0},meshAluminum:{label:"Mesh Screen Aluminum",rate:15},meshSteel:{label:"Mesh Screen Stainless Steel",rate:20},reverseCurve:{label:"Mesh Screen Reverse Curve",rate:25}},miterFeetAdded:5,elbowFeetAdded:2,endCapFeetAdded:1,outletFeetAdded:1,removalRate:5,foremanRate:65,techRate:50,consumableOptions:[0,5,10,15,20,25]};function ic(){return{gutterMinPrices:Qt.gutterMinPrices,gutterSellPrices:Qt.gutterMinPrices,downspoutMinPrices:Qt.downspoutMinPrices,downspoutSellPrices:Qt.downspoutMinPrices,hangerPrices:Qt.hangerPrices,rodPrice:Qt.rodPrice,guards:Qt.guards,miterFeetAdded:Qt.miterFeetAdded,elbowFeetAdded:Qt.elbowFeetAdded,endCapFeetAdded:Qt.endCapFeetAdded,outletFeetAdded:Qt.outletFeetAdded,removalRate:Qt.removalRate,foremanRate:Qt.foremanRate,techRate:Qt.techRate,consumableOptions:[...Qt.consumableOptions],savedAddOns:[],savedPackages:[]}}function Wz(e,t){const n=new Map,r=(s,i)=>{const l=(s??"").trim();if(!l)return;let u=n.get(l);u||(u={name:l,addOnCount:0,packageCount:0,total:0},n.set(l,u)),i==="addon"?u.addOnCount++:u.packageCount++,u.total++};for(const s of e)r(s.category,"addon");for(const s of t)r(s.category,"package");return Array.from(n.values()).sort((s,i)=>s.name.localeCompare(i.name,void 0,{sensitivity:"base"}))}function Gde(e,t){const n=new Map;for(const r of Wz(e,t)){const s=r.name.toLowerCase(),i=n.get(s);i?i.push(r):n.set(s,[r])}return Array.from(n.entries()).filter(([,r])=>r.length>1).sort(([r],[s])=>r.localeCompare(s)).map(([,r])=>r)}function Kde(e){return[...e].sort((t,n)=>n.total-t.total||t.name.localeCompare(n.name))[0].name}function GR(e,t,n){const r=t.trim().toLowerCase();if(!r)return e;const s=n.trim();return e.map(i=>(i.category??"").trim().toLowerCase()===r?{...i,category:s}:i)}const KR={type:"homeowner",name:"",phone:"",email:"",address:"",city:"",state:"CA",zip:"",gateCode:"",companyName:"",contactName:"",companyPhone:"",companyEmail:"",ownerName:"",ownerPhone:"",ownerEmail:"",j
19obAddress:"",jobCity:"",jobState:"CA",jobZip:"",jobGateCode:""},WR={type:"residential",stories:"1",roofType:"",roofMaterial:"",roofPitch:""},YR={material:"Aluminum",gutterPrice:"15.00",downspoutPrice:"15.00",gutterType:'5" Ogee',gutterMfg:"IMS",gutterColor:"",gutterFootage:"",downspoutFootage:"",downspoutType:'2"x3" Ribbed',downspoutMfg:"IMS",downspoutColor:"",elbows:"",insideMiters:"",outsideMiters:"",endCaps:"",outlets:""},XR={type:"none",footage:""},QR={type:"hangers",hangerType:'5" Ogee'},ZR={needed:!1,footage:""},JR={foremanHours:"",techCount:"",techHours:""};function e5(e,t,n){return(n??ic()).gutterMinPrices[e]?.[t]??0}function t5(e,t,n){return(n??ic()).downspoutMinPrices[e]?.[t]??0}function n5(e,t,n){const r=n??ic();return r.gutterSellPrices[e]?.[t]??r.gutterMinPrices[e]?.[t]??0}function r5(e,t,n){const r=n??ic();return r.downspoutSellPrices[e]?.[t]??r.downspoutMinPrices[e]?.[t]??0}function tw(e){return Qt.gutterTypesByMaterial[e]||[]}function Ka(e){if(typeof e=="number")return e;if(!e)return 0;const t=parseFloat(String(e));return isNaN(t)?0:t}function or(e){if(typeof e=="number")return Math.round(e);if(!e)return 0;const t=parseInt(String(e));return isNaN(t)?0:t}function Yz(e,t,n,r,s,i,l,u=ic(),d){const f=Ka(e.materialPrice||"0"),h=Ka(e.gutterPrice)||f,p=Ka(e.downspoutPrice)||f;let x,y,w,j,b,C;l&&l.length>0?(x=l.reduce((dt,Mt)=>dt+Ka(Mt.gutterFootage),0),w=l.reduce((dt,Mt)=>dt+or(Mt.elbows),0),j=l.reduce((dt,Mt)=>dt+or(Mt.insideMiters),0),b=l.reduce((dt,Mt)=>dt+or(Mt.outsideMiters),0),C=l.reduce((dt,Mt)=>dt+or(Mt.endCaps),0),y=l.reduce((dt,Mt)=>dt+or(Mt.downspouts),0)*10):(x=Ka(e.gutterFootage),y=Ka(e.downspoutFootage),w=or(e.elbows),j=or(e.insideMiters),b=or(e.outsideMiters),C=or(e.endCaps));const N=y>0?Math.ceil(y/10):0,k=N*10,T=or(e.outlets),A=Ka(t.footage),P=Ka(r.footage),E=Ka(s.foremanHours),_=or(s.techCount),R=Ka(s.techHours),H=(j+b)*u.miterFeetAdded,L=w*u.elbowFeetAdded,I=C*u.endCapFeetAdded,W=T*u.outletFeetAdded,U=x*h,V=k*p,D=L*h,q=H*h,K=I*h,Y=W*h,z=U+V+D+q+K+Y,Z=x>0?Math.ceil(x/3):0;let F=0,B=0,X=0,Q=0,se=0;n.type==="hangers"?(F=Z,B=u.hangerPrices[n.hangerType]||0,X=F*B):n.type==="rods"&&(Q=Z,se=Q*u.rodPrice);const ee=u.guards[t.type]?.rate||0,ve=A*ee,ue=r.needed?P*u.removalRate:0,de=E*u.foremanRate,Se=_*R*u.techRate,he=de+Se,ce=z+X+se+ve+ue+he,te=ce*(i/100),_e=ce+te;let Oe,Te,Le;const ze=d?.gutterCostPerFt??0,at=d?.downspoutCostPerFt??0;return(ze>0||at>0)&&(Oe=(x+L+H+I+W)*ze+k*at,Te=z-Oe,Le=z>0?Te/z*100:0),{gutterFt:x,gutterRate:h,downspoutFtEntered:y,downspoutFt:k,downspoutSticks:N,downspoutRate:p,elbowCount:w,elbowFt:L,elbowCost:D,miterFt:H,insideMiterCount:j,outsideMiterCount:b,endCapCount:C,endCapFt:I,endCapCost:K,outletCount:T,outletFt:W,outletCost:Y,hangerCount:F,hangerPrice:B,hangerCost:X,rodCount:Q,rodCost:se,guardFt:A,removalFt:P,gutterCost:U,downspoutCost:V,miterCost:q,totalMaterialCost:z,guardRate:ee,guardCost:ve,removalCost:ue,foremanHrs:E,foremanCost:de,techCount:_,techHrs:R,techCost:Se,totalLaborCost:he,subtotal:ce,consumableCost:te,grandTotal:_e,materialActualCost:Oe,materialMargin:Te,materialMarginPct:Le}}function De(e){return"$"+e.toFixed(2)}function Xz(e,t,n=0,r=ic()){const s=Ka(e.gutterFootage),i=or(e.elbows),l=or(e.insideMiters),u=or(e.outsideMiters),d=or(e.endCaps),f=or(e.downspouts),h=f*10,p=i*r.elbowFeetAdded,x=(l+u)*r.miterFeetAdded,y=d*r.endCapFeetAdded,w=s*t,j=p*t,b=x*t,C=y*t,N=h*n;return{sectionId:e.id,sectionName:e.name||"Unnamed Section",gutterFt:s,gutterCost:w,elbowCount:i,elbowCost:j,insideMiterCount:l,outsideMiterCount:u,miterCost:b,endCapCount:d,endCapCost:C,downspoutCount:f,downspoutFt:h,downspoutCost:N,sectionMaterialSubtotal:w+j+b+C+N}}function Wde(e,t){return t.length===0?e:{...e,gutterFootage:String(t.reduce((n,r)=>n+(parseFloat(r.gutterFootage)||0),0)),elbows:String(t.reduce((n,r)=>n+(parseInt(r.elbows)||0),0)),insideMiters:String(t.reduce((n,r)=>n+(parseInt(r.insideMiters)||0),0)),outsideMiters:String(t.reduce((n,r)=>n+(parseInt(r.outsideMiters)||0),0)),endCaps:String(t.reduce((n,r)=>n+(parseInt(r.endCaps)||0),0))}}function Yde(){return localStorage.getItem("fs_client_token")||""}function Xde(){const e=tB(),[,t]=fr(),{data:n,isLoading:r,error:s}=Xe({queryKey:["client-portal-data"],queryFn:()=>fetch("/api/auth/client-portal/me",{headers:{Authorization:`Bearer ${Yde()}`}}).then(h=>{if(!h.ok)throw new Error("Session expired");return h.json()}),retry:!1});ie.useEffect(()=>{n?.client?.type==="contractor"&&t("/contractor")},[n,t]);const i=()=>{e.mutate(void 0,{onSuccess:()=>{localStorage.removeItem("fs_client_token"),window.location.href="/client-login"},onError:()=>{localStorage.removeItem("fs_client_token"),window.location.href="/client-login"}})};if(r)return a.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:a.jsx(Me,{className:"w-8 h-8 animate-spin text-primary"})});if(s||!n)return a.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-6",children:a.jsxs(ye,{className:"p-8 text-center max-w-md w-full",children:[a.jsx(rn,{className:"w-12 h-12 text-destructive mx-auto mb-4"}),a.jsx("h2",{className:"text-xl font-bold mb-2",children:"Session Expired"}),a.jsx("p",{className:"text-muted-foreground mb-4",children:"Please sign in again to access your portal."}),a.jsx(ne,{onClick:()=>{localStorage.removeItem("fs_client_token"),window.location.href="/client-login"},children:"Sign In"})]})});const{client:l,quotes:u,jobs:d}=n,f=h=>h==="approved"?"bg-green-100 text-green-700":h==="sent"?"bg-blue-100 text-blue-700":h==="rejected"?"bg-red-100 text-red-700":"bg-gray-100 text-gray-700";return a.jsxs("div",{className:"min-h-screen bg-background",children:[a.jsxs("header",{className:"bg-white border-b border-border px-4 py-4 md:px-8 flex justify-between items-center sticky top-0 z-10",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"bg-primary p-2 rounded-lg text-white",children:a.jsx(Gq,{className:"w-6 h-6 fill-current"})}),a.jsxs("div",{children:[a.jsx("h1",{className:"font-display font-bold text-xl leading-none",children:"Five Star Gutters"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Client Portal"})]})]}),a.jsxs(ne,{variant:"ghost",className:"text-muted-foreground hover:text-foreground",onClick:i,children:[a.jsx(fT,{className:"w-4 h-4 mr-2"}),"Sign Out"]})]}),a.jsxs("main",{className:"max-w-5xl mx-auto p-4 md:p-8 space-y-12",children:[a.jsxs("section",{children:[a.jsxs("div",{className:"mb-8",children:[a.jsxs("h2",{className:"text-3xl font-display font-bold text-foreground",children:["Welcome back, ",l.name.split(" ")[0]]}),a.jsx("p",{className:"text-lg text-muted-foreground mt-2",children:"Here's the status of your projects and estimates."})]}),a.jsxs("h3",{className:"text-xl font-bold mb-4 flex items-center gap-2",children:[a.jsx(rs,{className:"w-5 h-5 text-primary"})," Active Jobs"]}),d.length===0?a.jsx(ye,{className:"p-8 text-center bg-secondary/50 border-dashed border-2",children:a.jsx("p",{className:"text-muted-foreground",children:"No active jobs at the moment."})}):a.jsx("div",{className:"grid gap-6",children:d.map(h=>a.jsxs(ye,{className:"p-6 overflow-hidden relative glass-panel",children:[a.jsx("div",{className:`absolute top-0 left-0 w-1.5 h-full ${h.status==="completed"?"bg-green-500":"bg-primary"}`}),a.jsxs("div",{className:"flex flex-col md:flex-row justify-between gap-6",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[a.jsx("span",{className:"px-3 py-1 bg-primary/10 text-primary font-semibold text-sm rounded-full capitalize",children:h.status.replace("_"," ")}),a.jsxs("span",{className:"text-sm font-medium text-muted-foreground flex items-center gap-1",children:[a.jsx(Ma,{className:"w-4 h-4"}),h.scheduledDate?Tt(new Date(h.scheduledDate),"MMM do, yyyy"):"Scheduling Pending"]})]}),a.jsx("h4",{className:"text-xl font-bold text-foreground",children:h.address}),a.jsxs("p",{className:"text-muted-foreground mt-1",children:[h.city,", ",h.state," ",h.zip]})]}),a.jsx("div",{className:"flex flex-col md:items-end justify-between",children:a.jsxs("div",{className:"text-left md:text-right",children:[a.jsx("p",{className:"text-sm text-muted-foreground uppercase tracking-wider font-semibold",children:"Total Amount"}),a.jsx("p",{className:"text-2xl font-bold text-foreground",children:De(h.totalAmount)})]})})]})]}
19,h.id))})]}),a.jsxs("section",{children:[a.jsxs("h3",{className:"text-xl font-bold mb-4 flex items-center gap-2",children:[a.jsx(jn,{className:"w-5 h-5 text-primary"})," Your Quotes"]}),u.length===0?a.jsx(ye,{className:"p-8 text-center bg-secondary/50 border-dashed border-2",children:a.jsx("p",{className:"text-muted-foreground",children:"You don't have any quotes yet."})}):a.jsx("div",{className:"grid md:grid-cols-2 gap-6",children:u.map(h=>a.jsxs(ye,{className:"p-6 hover-elevate border-border/60",children:[a.jsxs("div",{className:"flex justify-between items-start mb-6",children:[a.jsx("div",{className:"p-3 bg-secondary rounded-xl text-foreground",children:a.jsx(jn,{className:"w-6 h-6"})}),a.jsx("span",{className:`px-3 py-1 rounded-full text-xs font-bold uppercase tracking-wider ${f(h.status)}`,children:h.status==="approved"?"Signed":h.status})]}),a.jsx("h4",{className:"text-2xl font-bold mb-1",children:De(h.grandTotal)}),a.jsxs("p",{className:"text-sm text-muted-foreground mb-6",children:["Generated on ",Tt(new Date(h.createdAt),"MMMM do, yyyy")]}),h.signedAt?a.jsxs("div",{className:"flex items-center gap-2 text-green-600 bg-green-50 rounded-xl px-4 py-3",children:[a.jsx(Cg,{className:"w-5 h-5 flex-shrink-0"}),a.jsxs("div",{children:[a.jsx("p",{className:"font-semibold text-sm",children:"Contract Signed"}),a.jsx("p",{className:"text-xs text-green-600/80",children:Tt(new Date(h.signedAt),"MMM d, yyyy 'at' h:mm a")})]})]}):h.status==="sent"?a.jsxs(ne,{className:"w-full rounded-xl bg-primary font-bold",onClick:()=>t(`/quote/${h.id}/contract`),children:[a.jsx(jn,{className:"w-4 h-4 mr-2"})," View & Sign Contract"]}):a.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground bg-secondary/60 rounded-xl px-4 py-3",children:[a.jsx(Dr,{className:"w-4 h-4 flex-shrink-0"}),a.jsx("p",{className:"text-sm",children:"Being prepared — we'll notify you when ready."})]})]},h.id))})]})]})]})}function Qz(){return localStorage.getItem("fs_client_token")||""}const mg={bid_requested:{label:"Bid Requested",short:"Bids",icon:Rr},quote_submitted:{label:"Quote Submitted",short:"Quoted",icon:Er},quote_accepted:{label:"Quote Accepted",short:"Accepted",icon:yte},job_scheduled:{label:"Job Scheduled",short:"Scheduled",icon:Ma},job_completed:{label:"Job Completed",short:"Completed",icon:qq},invoice_submitted:{label:"Invoice Submitted",short:"Invoiced",icon:Hee},invoice_paid:{label:"Invoice Paid",short:"Paid",icon:YZ}},Gg=["bid_requested","quote_submitted","quote_accepted","job_scheduled","job_completed","invoice_submitted","invoice_paid"];function Qde(e){return Gg.indexOf(e)}function Zde(){const e=tB(),[,t]=fr(),{toast:n}=nr(),r=wt(),[s,i]=v.useState(!1),{data:l,isLoading:u,error:d}=Xe({queryKey:["contractor-pipeline"],queryFn:()=>fetch("/api/auth/client-portal/pipeline",{headers:{Authorization:`Bearer ${Qz()}`}}).then(w=>{if(w.status===403)throw new Error("not_contractor");if(!w.ok)throw new Error("Session expired");return w.json()}),retry:!1});ie.useEffect(()=>{d instanceof Error&&d.message==="not_contractor"&&t("/client-portal")},[d,t]);const f=()=>{const w=()=>{localStorage.removeItem("fs_client_token"),window.location.href="/client-login"};e.mutate(void 0,{onSuccess:w,onError:w})};if(u)return a.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:a.jsx(Me,{className:"w-8 h-8 animate-spin text-primary"})});if(d||!l)return d instanceof Error&&d.message==="not_contractor"?a.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:a.jsx(Me,{className:"w-8 h-8 animate-spin text-primary"})}):a.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-6",children:a.jsxs(ye,{className:"p-8 text-center max-w-md w-full",children:[a.jsx(rn,{className:"w-12 h-12 text-destructive mx-auto mb-4"}),a.jsx("h2",{className:"text-xl font-bold mb-2",children:"Session Expired"}),a.jsx("p",{className:"text-muted-foreground mb-4",children:"Please sign in again to access your portal."}),a.jsx(ne,{onClick:()=>{localStorage.removeItem("fs_client_token"),window.location.href="/client-login"},children:"Sign In"})]})});const{client:h,projects:p,summary:x}=l,y=h.companyName||h.name;return a.jsxs("div",{className:"min-h-screen bg-background",children:[a.jsxs("header",{className:"bg-white border-b border-border px-4 py-4 md:px-8 flex justify-between items-center sticky top-0 z-10",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"bg-primary p-2 rounded-lg text-white",children:a.jsx(Gq,{className:"w-6 h-6 fill-current"})}),a.jsxs("div",{children:[a.jsx("h1",{className:"font-display font-bold text-xl leading-none",children:"Five Star Gutters"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Contractor Portal"})]})]}),a.jsxs(ne,{variant:"ghost",className:"text-muted-foreground hover:text-foreground",onClick:f,children:[a.jsx(fT,{className:"w-4 h-4 mr-2"}),"Sign Out"]})]}),a.jsxs("main",{className:"max-w-6xl mx-auto p-4 md:p-8 space-y-10",children:[a.jsxs("section",{children:[a.jsxs("div",{className:"flex flex-col md:flex-row md:items-end md:justify-between gap-4 mb-8",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-3xl font-display font-bold text-foreground",children:"Bid Tracking"}),a.jsxs("p",{className:"text-lg text-muted-foreground mt-2",children:["Welcome, ",
19y,". Track every project from bid to paid."]})]}),a.jsxs(ne,{className:"rounded-xl font-bold bg-primary",onClick:()=>i(w=>!w),children:[a.jsx(Ft,{className:"w-4 h-4 mr-2"})," Request a Bid"]})]}),s&&a.jsx(efe,{onClose:()=>i(!1),onSuccess:()=>{i(!1),n({title:"Bid request submitted",description:"Our team will review and follow up shortly."}),r.invalidateQueries({queryKey:["contractor-pipeline"]})}}),a.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-4 lg:grid-cols-7 gap-3 mb-10",children:Gg.map(w=>{const j=mg[w],b=j.icon,C=x[w]??{count:0,amount:0};return a.jsxs(ye,{className:"p-4 flex flex-col items-center text-center gap-1.5 border-border/60",children:[a.jsx("div",{className:`p-2 rounded-lg ${C.count>0?"bg-primary/10 text-primary":"bg-secondary text-muted-foreground"}`,children:a.jsx(b,{className:"w-5 h-5"})}),a.jsx("span",{className:"text-2xl font-bold leading-none",children:C.count}),a.jsx("span",{className:"text-xs text-muted-foreground leading-tight",children:j.short}),C.amount>0&&a.jsx("span",{className:"text-xs font-semibold text-foreground/80 leading-none",children:De(C.amount)})]},w)})})]}),a.jsxs("section",{children:[a.jsxs("h3",{className:"text-xl font-bold mb-4 flex items-center gap-2",children:[a.jsx(jn,{className:"w-5 h-5 text-primary"})," Your Projects"]}),p.length===0?a.jsxs(ye,{className:"p-10 text-center bg-secondary/50 border-dashed border-2",children:[a.jsx("p",{className:"text-muted-foreground mb-4",children:"No projects yet. Request your first bid to get started."}),a.jsxs(ne,{className:"rounded-xl font-bold bg-primary",onClick:()=>i(!0),children:[a.jsx(Ft,{className:"w-4 h-4 mr-2"})," Request a Bid"]})]}):a.jsx("div",{className:"grid gap-5",children:p.map(w=>a.jsx(Jde,{project:w,onViewQuote:j=>t(`/quote/${j}/contract`)},w.key))})]})]})]})}function Jde({project:e,onViewQuote:t}){const n=Qde(e.stage),r=e.quoteStatus==="sent"&&!e.signed&&e.quoteId!=null;return a.jsxs(ye,{className:"p-6 border-border/60",children:[a.jsxs("div",{className:"flex flex-col md:flex-row justify-between gap-4 mb-6",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[a.jsx("span",{className:"px-3 py-1 bg-primary/10 text-primary font-semibold text-xs rounded-full",children:mg[e.stage].label}),e.date&&a.jsx("span",{className:"text-xs text-muted-foreground",children:Tt(new Date(e.date),"MMM d, yyyy")})]}),a.jsx("h4",{className:"text-lg font-bold text-foreground truncate",children:e.address})]}),a.jsxs("div",{className:"flex items-start gap-4 md:flex-col md:items-end",children:[e.amount!=null&&e.amount>0&&a.jsxs("div",{className:"text-left md:text-right",children:[a.jsx("p",{className:"text-[11px] text-muted-foreground uppercase tracking-wider font-semibold",children:"Amount"}),a.jsx("p",{className:"text-xl font-bold text-foreground",children:De(e.amount)})]}),r&&a.jsxs(ne,{size:"sm",className:"rounded-xl bg-primary font-bold",onClick:()=>t(e.quoteId),children:[a.jsx(jn,{className:"w-4 h-4 mr-2"})," View & Sign"]}),e.quoteStatus==="approved"&&e.signed&&a.jsxs("span",{className:"inline-flex items-center gap-1.5 text-green-600 text-sm font-semibold",children:[a.jsx(st,{className:"w-4 h-4"})," Signed"]})]})]}),a.jsx("div",{className:"flex items-center",children:Gg.map((s,i)=>{const l=i<n,u=i===n,d=mg[s].icon;return a.jsxs(ie.Fragment,{children:[a.jsx("div",{className:"flex flex-col items-center gap-1.5 flex-shrink-0",title:mg[s].label,children:a.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center border-2 "+(l?"bg-primary border-primary text-white":u?"bg-primary/15 border-primary text-primary":"bg-background border-border text-muted-foreground"),children:l?a.jsx(st,{className:"w-4 h-4"}):a.jsx(d,{className:"w-4 h-4"})})}),i<Gg.length-1&&a.jsx("div",{className:"flex-1 h-0.5 mx-1 "+(i<n?"bg-primary":"bg-border")})]},s)})})]})}function efe({onClose:e,onSuccess:t}){const[n,r]=v.useState({address:"",city:"",state:"",zip:"",buildingType:"",notes:""}),{toast:s}=nr(),i=nt({mutationFn:f=>fetch("/api/auth/client-portal/bid-request",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Qz()}`},body:JSON.stringify(f)}).then(async h=>{if(!h.ok){const p=await h.json().catch(()=>({}));throw new Error(p.error||"Failed to submit")}return h.json()}),onSuccess:t,onError:f=>s({title:"Could not submit",description:f.message,variant:"destructive"})}),l=f=>h=>r(p=>({...p,[f]:h.target.value})),u=f=>{if(f.preventDefault(),!n.address.trim()){s({title:"Project address required",variant:"destructive"});return}i.mutate(n)},d="w-full px-4 py-3 bg-background border-2 border-border focus:border-primary rounded-xl outline-none transition-colors";return a.jsxs(ye,{className:"p-6 mb-8 border-primary/30",children:[a.jsxs("h3",{className:"text-lg font-bold mb-4 flex items-center gap-2",children:[a.jsx(Rr,{className:"w-5 h-5 text-primary"})," New Bid Request"]}),a.jsxs("form",{onSubmit:u,className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-semibold text-foreground",children:"Project Address *"}),a.jsx("input",{className:d,value:n.address,onChange:l("address"),placeholder:"123 Main St",required:!0})]}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-semibold text-foreground",children:"City"}),a.jsx("input",{className:d,value:n.city,onChange:l("city")})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-semibold text-foreground",children:"State"}),a.jsx("input",{className:d,value:n.state,onChange:l("state")})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-semibold text-foreground",children:"ZIP"}),a.jsx("input",{className:d,value:n.zip,onChange:l("zip")})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-semibold text-foreground",children:"Building Type"}
19),a.jsx("input",{className:d,value:n.buildingType,onChange:l("buildingType"),placeholder:"e.g. Commercial, Multi-family"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-semibold text-foreground",children:"Project Details"}),a.jsx("textarea",{className:d,rows:3,value:n.notes,onChange:l("notes"),placeholder:"Scope, timeline, materials, or anything we should know."})]}),a.jsxs("div",{className:"flex gap-3 justify-end pt-2",children:[a.jsx(ne,{type:"button",variant:"outline",className:"rounded-xl",onClick:e,disabled:i.isPending,children:"Cancel"}),a.jsxs(ne,{type:"submit",className:"rounded-xl font-bold bg-primary",disabled:i.isPending,children:[i.isPending?a.jsx(Me,{className:"w-4 h-4 mr-2 animate-spin"}):a.jsx(Er,{className:"w-4 h-4 mr-2"}),"Submit Request"]})]})]})]})}function a5(){return`dp-${Date.now()}-${Math.random().toString(36).slice(2,5)}`}function s5(e,t){return e.pinXPct!==void 0&&e.targetXPct!==void 0?{id:e.id,number:e.number??t+1,pinXPct:e.pinXPct,pinYPct:e.pinYPct,targetXPct:e.targetXPct,targetYPct:e.targetYPct,pinType:e.pinType||e.icon||"downspout",label:e.label||""}:{id:e.id,number:e.number??t+1,pinXPct:Math.max(0,Math.min(8,e.xPct??5)),pinYPct:e.yPct??(t+1)*15,targetXPct:e.xPct??50,targetYPct:e.yPct??50,pinType:e.icon||"downspout",label:e.label||(e.dimension?`${e.dimension}'`:"")}}function Zz(e){const t=e?.diagramPages||[];if(t.length>0)return t;const n=[],r=e?.layoutAnnotations||[];(e?.gutterDiagramUrl||r.length>0)&&n.push({id:a5(),name:"Layout",imageUrl:e.gutterDiagramUrl||"",annotations:r.map((i,l)=>s5(i,l)),notes:""});const s=e?.diagramAnnotations||[];return(e?.detailsDiagramUrl||s.length>0||e?.diagramNotes)&&n.push({id:a5(),name:"Details",imageUrl:e.detailsDiagramUrl||"",annotations:s.map((i,l)=>s5(i,l)),notes:e.diagramNotes||""}),n}const tfe="modulepreload",nfe=function(e){return"/"+e},i5={},rfe=function(t,n,r){let s=Promise.resolve();if(n&&n.length>0){let d=function(f){return Promise.all(f.map(h=>Promise.resolve(h).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),u=l?.nonce||l?.getAttribute("nonce");s=d(n.map(f=>{if(f=nfe(f),f in i5)return;i5[f]=!0;const h=f.endsWith(".css"),p=h?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${p}`))return;const x=document.createElement("link");if(x.rel=h?"stylesheet":tfe,h||(x.as="script"),x.crossOrigin="",x.href=f,u&&x.setAttribute("nonce",u),document.head.appendChild(x),h)return new Promise((y,w)=>{x.addEventListener("load",y),x.addEventListener("error",()=>w(new Error(`Unable to preload CSS for ${f}`)))})}))}function i(l){const u=new Event("vite:preloadError",{cancelable:!0});if(u.payload=l,window.dispatchEvent(u),!u.defaultPrevented)throw l}return s.then(l=>{for(const u of l||[])u.status==="rejected"&&i(u.reason);return t().catch(i)})};function o5(e){return e.replace(/_/g," ").replace(/\b\w/g,t=>t.toUpperCase())}function afe(e,t,n){t/=100,n/=100;const r=l=>(l+e/30)%12,s=t*Math.min(n,1-n),i=l=>n-s*Math.max(-1,Math.min(r(l)-3,Math.min(9-r(l),1)));return`#${[i(0),i(8),i(4)].map(l=>Math.round(l*255).toString(16).padStart(2,"0")).join("")}`}const nw=afe(220,80,45);async function sfe(e){if(!e.imageUrl)return null;const t=new Image;t.crossOrigin="anonymous",await new Promise((p,x)=>{t.onload=()=>p(),t.onerror=()=>x(new Error(`Failed to load image: ${e.imageUrl}`)),t.src=e.imageUrl});const n=document.createElement("canvas");n.width=t.naturalWidth,n.height=t.naturalHeight;const r=n.getContext("2d");r.drawImage(t,0,0);const s=n.width,i=n.height,l=Math.hypot(s,i),u=Math.max(1.5,l*.0015),d=Math.max(4,l*.004),f=Math.max(10,l*.012),h=Math.max(10,l*.012);for(const p of e.annotations){const x=p.pinXPct/100*s,y=p.pinYPct/100*i,w=p.targetXPct/100*s,j=p.targetYPct/100*i;r.save(),r.strokeStyle=nw,r.lineWidth=u,r.setLineDash([u*5,u*3]),r.beginPath(),r.moveTo(x,y),r.lineTo(w,j),r.stroke(),r.restore(),r.save(),r.fillStyle=nw,r.beginPath(),r.arc(w,j,d,0,Math.PI*2),r.fill(),r.restore()}for(const p of e.annotations){const x=p.pinXPct/100*s,y=p.pinYPct/100*i,w=String(p.number);r.save(),r.font=`bold ${h}px sans-serif`;const j=r.measureText(w).width,b=Math.max(f*2,j+f*.8),C=f*2;r.fillStyle=nw,r.beginPath(),r.roundRect(x-b/2,y-C/2,b,C,f*.5),r.fill(),r.fillStyle="#ffffff",r.textAlign="center",r.textBaseline="middle",r.fillText(w,x,y),r.restore(
19)}return{dataUrl:n.toDataURL("image/jpeg",.88),width:s,height:i}}async function Jz(e,t){const{jsPDF:n}=await rfe(async()=>{const{jsPDF:x}=await import("./jspdf.es.min-Dzq-EwbX.js").then(y=>y.j);return{jsPDF:x}},[]),r=new n({orientation:"landscape",unit:"mm",format:"letter"}),s=r.internal.pageSize.getWidth(),i=r.internal.pageSize.getHeight(),l=12,u=14,d=0,f=s-l*2,h=i-l*2-u-d;let p=!0;for(const x of e){if(!x.imageUrl)continue;const y=await sfe(x);if(!y)continue;p||r.addPage("letter","landscape"),p=!1,r.setFont("helvetica","bold"),r.setFontSize(11),r.setTextColor(30,30,30),r.text(`${t}  —  ${x.name}`,l,l+7),r.setDrawColor(180,180,180),r.setLineWidth(.3),r.line(l,l+9,s-l,l+9);const w=y.width/y.height;let j=f,b=j/w;b>h&&(b=h,j=b*w);const C=l+(f-j)/2,N=l+u;r.addImage(y.dataUrl,"JPEG",C,N,j,b);const k=N+b+3;if(x.annotations.length>0&&k+5<i-l){r.setFont("helvetica","bold"),r.setFontSize(7),r.setTextColor(80,80,80),r.text("Pin Legend:",l,k),r.setFont("helvetica","normal"),r.setFontSize(7);const T=Math.min(4,Math.ceil(x.annotations.length/3)),A=f/T;x.annotations.forEach((P,E)=>{const _=E%T,R=Math.floor(E/T),H=l+_*A,L=k+4+R*4.5;if(L<i-l){const I=P.label?`${P.number}. ${o5(P.pinType)}: ${P.label}`:`${P.number}. ${o5(P.pinType)}`;r.text(I,H,L,{maxWidth:A-2})}})}if(x.notes){const T=k+(x.annotations.length>0?20:0);T<i-l&&(r.setFont("helvetica","italic"),r.setFontSize(7),r.setTextColor(100,100,100),r.text(`Notes: ${x.notes}`,l,T,{maxWidth:f}))}}return r}function eU(e){return`${e.replace(/[^a-z0-9\s-]/gi,"").trim().replace(/\s+/g,"-").toLowerCase()||"diagrams"}-diagrams.pdf`}async function tU(e,t){(await Jz(e,t)).save(eU(t))}async function ife(e,t){const r=(await Jz(e,t)).output("arraybuffer"),s=new Uint8Array(r);let i="";const l=32768;for(let u=0;u<s.length;u+=l)i+=String.fromCharCode(...s.subarray(u,u+l));return btoa(i)}const Kg=[{key:"downspout",label:"Downspout"},{key:"end_cap",label:"End Cap"},{key:"right_end_cap",label:"Right End Cap"},{key:"left_end_cap",label:"Left End Cap"},{key:"inside_miter",label:"Inside Miter"},{key:"outside_miter",label:"Outside Miter"},{key:"boxed_inside_miter",label:"Boxed Inside Miter"},{key:"boxed_outside_miter",label:"Boxed Outside Miter"},{key:"a_elbow",label:"A Elbow"},{key:"b_elbow",label:"B Elbow"},{key:"splash_block",label:"Splash Block"},{key:"rain_diverter",label:"Rain Diverter"},{key:"left_to_right",label:"Left to Right"},{key:"right_to_left",label:"Right to Left"},{key:"a_return",label:"A Return"},{key:"b_return_rtl",label:"B Return RTL"},{key:"b_return_ltr",label:"B Return LTR"},{key:"text_note",label:"Text Note"}];function rm({pinType:e,size:t=14,className:n=""}){const r=t,s=r/2,i="currentColor",l=1.5,u="none",f={downspout:()=>a.jsxs("svg",{width:r,height:r,viewBox:`0 0 ${r} ${r}`,className:n,children:[a.jsx("line",{x1:s,y1:2,x2:s,y2:r-4,stroke:i,strokeWidth:l}),a.jsx("polyline",{points:`${s-3},${r-6} ${s},${r-2} ${s+3},${r-6}`,stroke:i,strokeWidth:l,fill:u})]}),end_cap:()=>a.jsxs("svg",{width:r,height:r,viewBox:`0 0 ${r} ${r}`,className:n,children:[a.jsx("rect",{x:2,y:3,width:r-4,height:r-6,rx:1,stroke:i,strokeWidth:l,fill:u}),a.jsx("line",{x1:r-3,y1:4,x2:r-3,y2:r-4,stroke:i,strokeWidth:l+.5})]}),right_end_cap:()=>a.jsxs("svg",{width:r,height:r,viewBox:`0 0 ${r} ${r}`,className:n,children:[a.jsx("line",{x1:2,y1:s,x2:r-4,y2:s,stroke:i,strokeWidth:l}),a.jsx("rect",{x:r-5,y:3,width:3,height:r-6,rx:.5,stroke:i,strokeWidth:l,fill:i})]}),left_end_cap:()=>a.jsxs("svg",{width:r,height:r,viewBox:`0 0 ${r} ${r}`,className:n,children:[a.jsx("line",{x1:6,y1:s,x2:r-2,y2:s,stroke:i,strokeWidth:l}),a.jsx("rect",{x:2,y:3,width:3,height:r-6,rx:.5,stroke:i,strokeWidth:l,fill:i})]}),inside_miter:()=>a.jsx("svg",{width:r,height:r,viewBox:`0 0 ${r} ${r}`,className:n,children:a.jsx("polyline",{points:`${r-2},2 2,2 2,${r-2}`,stroke:i,strokeWidth:l,fill:u,strokeLinejoin:"round"})}),outside_miter:()=>a.jsx("svg",{width:r,height:r,viewBox:`0 0 ${r} ${r}`,className:n,children:a.jsx("polyline",{points:`2,${r-2} ${r-2},${r-2} ${r-2},2`,stroke:i,strokeWidth:l,fill:u,strokeLinejoin:"round"})}),boxed_inside_miter:()=>a.jsxs("svg",{width:r,height:r,viewBox:`0 0 ${r} ${r}`,className:n,children:[a.jsx("polyline",{points:`${r-2},2 2,2 2,${r-2}`,stroke:i,strokeWidth:l,fill:u,strokeLinejoin:"round"}),a.jsx("rect",{x:2,y:2,width:4,height:4,stroke:i,strokeWidth:1,fill:i,opacity:.4})]}
19),boxed_outside_miter:()=>a.jsxs("svg",{width:r,height:r,viewBox:`0 0 ${r} ${r}`,className:n,children:[a.jsx("polyline",{points:`2,${r-2} ${r-2},${r-2} ${r-2},2`,stroke:i,strokeWidth:l,fill:u,strokeLinejoin:"round"}),a.jsx("rect",{x:r-6,y:r-6,width:4,height:4,stroke:i,strokeWidth:1,fill:i,opacity:.4})]}),a_elbow:()=>a.jsxs("svg",{width:r,height:r,viewBox:`0 0 ${r} ${r}`,className:n,children:[a.jsx("path",{d:`M 2 2 L 2 ${s+2} Q 2 ${r-2} ${s+2} ${r-2} L ${r-2} ${r-2}`,stroke:i,strokeWidth:l,fill:u}),a.jsx("text",{x:r-4,y:6,fontSize:6,fontWeight:"bold",fill:i,textAnchor:"middle",children:"A"})]}),b_elbow:()=>a.jsxs("svg",{width:r,height:r,viewBox:`0 0 ${r} ${r}`,className:n,children:[a.jsx("path",{d:`M ${r-2} 2 L ${r-2} ${s+2} Q ${r-2} ${r-2} ${s-2} ${r-2} L 2 ${r-2}`,stroke:i,strokeWidth:l,fill:u}),a.jsx("text",{x:4,y:6,fontSize:6,fontWeight:"bold",fill:i,textAnchor:"middle",children:"B"})]}),splash_block:()=>a.jsxs("svg",{width:r,height:r,viewBox:`0 0 ${r} ${r}`,className:n,children:[a.jsx("rect",{x:2,y:r-5,width:r-4,height:3,rx:.5,stroke:i,strokeWidth:l,fill:u}),a.jsx("circle",{cx:s-2,cy:s-1,r:1.5,fill:i}),a.jsx("circle",{cx:s+2,cy:s-3,r:1,fill:i}),a.jsx("circle",{cx:s,cy:3,r:1,fill:i})]}),rain_diverter:()=>a.jsxs("svg",{width:r,height:r,viewBox:`0 0 ${r} ${r}`,className:n,children:[a.jsx("line",{x1:s,y1:2,x2:s,y2:s,stroke:i,strokeWidth:l}),a.jsx("line",{x1:s,y1:s,x2:3,y2:r-2,stroke:i,strokeWidth:l}),a.jsx("line",{x1:s,y1:s,x2:r-3,y2:r-2,stroke:i,strokeWidth:l})]}),left_to_right:()=>a.jsxs("svg",{width:r,height:r,viewBox:`0 0 ${r} ${r}`,className:n,children:[a.jsx("line",{x1:2,y1:s,x2:r-4,y2:s,stroke:i,strokeWidth:l}),a.jsx("polyline",{points:`${r-6},${s-3} ${r-2},${s} ${r-6},${s+3}`,stroke:i,strokeWidth:l,fill:u})]}),right_to_left:()=>a.jsxs("svg",{width:r,height:r,viewBox:`0 0 ${r} ${r}`,className:n,children:[a.jsx("line",{x1:r-2,y1:s,x2:4,y2:s,stroke:i,strokeWidth:l}),a.jsx("polyline",{points:`6,${s-3} 2,${s} 6,${s+3}`,stroke:i,strokeWidth:l,fill:u})]}),a_return:()=>a.jsxs("svg",{width:r,height:r,viewBox:`0 0 ${r} ${r}`,className:n,children:[a.jsx("path",{d:`M 2 2 L 2 ${r-2} L ${r-2} ${r-2}`,stroke:i,strokeWidth:l,fill:u,strokeLinejoin:"round"}),a.jsx("text",{x:s,y:s,fontSize:5,fontWeight:"bold",fill:i,textAnchor:"middle",dominantBaseline:"central",children:"A"})]}),b_return_rtl:()=>a.jsxs("svg",{width:r,height:r,viewBox:`0 0 ${r} ${r}`,className:n,children:[a.jsx("path",{d:`M ${r-2} 2 L ${r-2} ${r-2} L 2 ${r-2}`,stroke:i,strokeWidth:l,fill:u,strokeLinejoin:"round"}),a.jsx("polyline",{points:`6,${r-5} 2,${r-2} 6,${r-2}`,stroke:i,strokeWidth:1,fill:u}),a.jsx("text",{x:s,y:s,fontSize:5,fontWeight:"bold",fill:i,textAnchor:"middle",dominantBaseline:"central",children:"B"})]}),b_return_ltr:()=>a.jsxs("svg",{width:r,height:r,viewBox:`0 0 ${r} ${r}`,className:n,children:[a.jsx("path",{d:`M 2 2 L 2 ${r-2} L ${r-2} ${r-2}`,stroke:i,strokeWidth:l,fill:u,strokeLinejoin:"round"}),a.jsx("polyline",{points:`${r-6},${r-5} ${r-2},${r-2} ${r-6},${r-2}`,stroke:i,strokeWidth:1,fill:u}),a.jsx("text",{x:s,y:s,fontSize:5,fontWeight:"bold",fill:i,textAnchor:"middle",dominantBaseline:"central",children:"B"})]}),text_note:()=>a.jsxs("svg",{width:r,height:r,viewBox:`0 0 ${r} ${r}`,className:n,children:[a.jsx("rect",{x:2,y:2,width:r-4,height:r-4,rx:1,stroke:i,strokeWidth:l,fill:u}),a.jsx("line",{x1:4,y1:s-2,x2:r-4,y2:s-2,stroke:i,strokeWidth:1}),a.jsx("line",{x1:4,y1:s+1,x2:r-4,y2:s+1,stroke:i,strokeWidth:1}),a.jsx("line",{x1:4,y1:s+4,x2:s+1,y2:s+4,stroke:i,strokeWidth:1})]})}[e];return f?f():a.jsx("svg",{width:r,height:r,viewBox:`0 0 ${r} ${r}`,className:n,children:a.jsx("circle",{cx:s,cy:s,r:s-2,stroke:i,strokeWidth:l,fill:u})})}function ofe(e){return Kg.find(t=>t.key===e)?.label||e}function nU({page:e}){if(!e.imageUrl)return null;const t=e.annotations||[];return a.jsxs("div",{className:"mb-6",children:[a.jsx("h3",{className:"text-sm font-bold text-gray-900 mb-2",children:e.name}),a.jsxs("div",{className:"relative inline-block w-full border border-gray-200 rounded-lg overflow-hidden",children:[a.jsx("img",{src:e.imageUrl,alt:e.name,className:"w-full h-auto block"}),a.jsx("svg",{className:"absolute inset-0 w-full h-full pointer-events-none",children:t.map(n=>a.jsxs("g",{children:[a.jsx("line",{x1:`${n.pinXPct}%`,y1:`${n.pinYPct}%`,x2:`${n.targetXPct}%`,y2:`${n.targetYPct}%`,stroke:"hsl(var(--primary))",strokeWidth:"1.5",strokeDasharray:"4 2",opacity:"0.8"}),a.jsx("circle",{cx:`${n.targetXPct}%`,cy:`${n.targetYPct}%`,r:"4",fill:"hsl(var(--primary))",stroke:"white",strokeWidth:"1.5"})]},`line-${n.id}`))}),t.map(n=>a.jsx("div",{className:"absolute z-10 -translate-x-1/2 -translate-y-1/2",style:{left:`${n.pinXPct}%`,top:`${n.pinYPct}%`},children:n.pinType==="text_note"?a.jsxs("div",{className:"px-1.5 py-1 max-w-[120px] rounded bg-yellow-100 text-yellow-900 shadow border border-yellow-300",children:[a.jsxs("span",{className:"text-[10px] font-bold",children:[n.number,"."]}),a.jsx("p",{className:"text-[10px] leading-tight break-words whitespace-pre-wrap",children:n.label})]}):a.jsxs("div",{className:"flex items-center gap-0.5 px-1 py-0.5 rounded bg-primary text-primary-foreground shadow border border-white/50 whitespace-nowrap",children:[a.jsx("span",{className:"text-[10px] font-bold",children:n.number}),a.jsx(rm,{pinType:n.pinType,size:12})]})},`pin-${n.id}`))]}),t.length>0&&a.jsx("ol",{className:"mt-2 grid grid-cols-2 gap-x-6 gap-y-0.5 text-xs text-gray-700",children:t.map(n=>a.jsxs("li",{className:"flex gap-1.5",children:[a.jsxs("span",{className:"font-bold text-gray-900",children:[n.number,"."]}),a.jsxs("span",{children:[ofe(n.pinType),n.label?` — ${n.label}`:""]})]},`legend-${n.id}`))}),e.notes&&a.jsxs("p",{className:"mt-2 text-xs text-gray-600 whitespace-pre-wrap",children:[a.jsx("span",{className:"font-semibold",children:"Notes: "}),e.notes]})]})}const lfe=["/api/company-profile"],ck={name:"Five Star Rain Gutters, Inc.",license:"876930",serviceArea:"Central Coast, CA",address:"3226 El Camino Real, Atascadero, CA 93422",phone:"+1.805.461.3283",email:"[email protected]",website:"https://fivestarraingutters.com",logoUrl:""};function rU(e,t={}){const n=localStorage.getItem("fs_team_token");return fetch(e,{...t,headers:{"Content-Type":"application/json",...n?{Authorization:`Bearer ${n}`}:{},...t.headers||{}}})}function uk(){const e=Xe({queryKey:lfe,queryFn:async()=>{const t=await rU("/api/company-profile");if(!t.ok)throw new Error("Failed to load company profile");return t.json()},staleTime:3e5});return{...e,profile:e.data??ck}}async function cfe(e){const t=await rU("/api/company-profile",{method:"PATCH",body:JSON.stringify(e)}),n=await t.json();if(!t.ok)throw new Error(n?.error||"Failed to save company profile");return n}const aU="/assets/5_Star_horizontal_logo_Dec_2025_1773753482469-BW1ZGuTC.png";function ufe(){return localStorage.getItem("fs_client_token")||""}function l5(e,t){return fetch(e,{...t,headers:{"Content-Type":"application/json",Authorization:`Bearer ${ufe()}`,...t?.headers||{}}})}function dfe(){const{id:e}=jh(),[,t]=fr(),n=v.useRef(null),[r,s]=v.useState(!1),[i,l]=v.useState(!1),[u,d]=v.useState(!1),[f,h]=v.useState([]),[p,x]=v.useState(""),[y,w]=v.useState(null),[j,b]=v.useState(!1),[C,N]=v.useState(!1),{data:k,isLoading:T,error:A}=Xe({queryKey:["client-quote",e],queryFn:()=>l5(`/api/quotes/${e}/client-view`).then(Q=>{if(!Q.ok)throw new Error("Not found or access denied");return Q.json()}),retry:!1}),P=nt({mutationFn:async()=>{const Q=n.current;if(!Q)throw new Error("No canvas");const se=Q.toDataURL("image/png"),ee=await l5(`/api/quotes/${e}/approve`,{method:"POST",body:JSON.stringify({signatureData:se,depositAcknowledged:u,selectedAddOnIds:f,selectedPackageId:p})});if(!ee.ok){const ve=await ee.json();throw new Error(ve.error||"Failed to submit")}return ee.json()},onSuccess:()=>b(!0),onError:Q=>w(Q.message)});v.useEffect(()=>{k&&(h(k.selectedAddOnIds||[]),x(k.selectedPackageId||""))},[k?.id]);const E=Q=>{const se=n.current;if(!se)return;s(!0);const ee=se.getContext("2d");ee.beginPath();const ve=se.getBoundingClientRect(),ue="touches"in Q?Q.touches[0].clientX-ve.left:Q.clientX-ve.left,de="touches"in Q?Q.touches[0].clientY-ve.top:Q.clientY-ve.top;ee.moveTo(ue,de)},_=Q=>
19{if(!r)return;const se=n.current;if(!se)return;const ee=se.getContext("2d"),ve=se.getBoundingClientRect(),ue="touches"in Q?Q.touches[0].clientX-ve.left:Q.clientX-ve.left,de="touches"in Q?Q.touches[0].clientY-ve.top:Q.clientY-ve.top;ee.lineWidth=2.5,ee.lineCap="round",ee.strokeStyle="#1e293b",ee.lineTo(ue,de),ee.stroke(),l(!0)},R=()=>s(!1),H=()=>{const Q=n.current;if(!Q)return;Q.getContext("2d").clearRect(0,0,Q.width,Q.height),l(!1)};if(T)return a.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:a.jsx(Me,{className:"w-8 h-8 animate-spin text-primary"})});if(A||!k)return a.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-6",children:a.jsxs(ye,{className:"p-8 text-center max-w-md w-full",children:[a.jsx(rn,{className:"w-12 h-12 text-destructive mx-auto mb-4"}),a.jsx("h2",{className:"text-xl font-bold mb-2",children:"Quote Not Found"}),a.jsx("p",{className:"text-muted-foreground mb-4",children:"This quote could not be found or you don't have access to it."}),a.jsx(ne,{onClick:()=>t("/client-portal"),children:"Back to Portal"})]})});if(j||k.signedAt)return a.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-6",children:a.jsxs(ye,{className:"p-10 text-center max-w-lg w-full shadow-xl",children:[a.jsx("div",{className:"w-20 h-20 bg-green-100 rounded-full flex items-center justify-center mx-auto mb-6",children:a.jsx(Cg,{className:"w-10 h-10 text-green-600"})}),a.jsx("h2",{className:"text-2xl font-display font-bold text-foreground mb-2",children:"Contract Signed!"}),a.jsxs("p",{className:"text-muted-foreground mb-2",children:["Thank you, ",k.client?.name||k.customerData?.name||"",". Your contract has been signed and our team has been notified."]}),k.signedAt&&a.jsxs("p",{className:"text-sm text-muted-foreground mb-6",children:["Signed on ",Tt(new Date(j?new Date:k.signedAt),"MMMM d, yyyy 'at' h:mm a")]}),a.jsx(ne,{onClick:()=>t("/client-portal"),className:"rounded-xl font-bold px-8",children:"Back to My Portal"})]})});const L=k.addOns||[],I=k.packages||[],W=!!k.signedAt,U=I.find(Q=>Q.id===p),V=U?U.total:k.grandTotal,D=L.filter(Q=>f.includes(Q.id)).reduce((Q,se)=>Q+(se.price||0),0),q=V+D,K=q*.5,Y=k.company||ck,z=k.primaryContact,Z=z?.name||Y.name,F=z?.phone||Y.phone,B=z?.email||Y.email,X=Q=>{h(se=>se.includes(Q)?se.filter(ee=>ee!==Q):[...se,Q])};return a.jsxs("div",{className:"min-h-screen bg-background",children:[a.jsxs("header",{className:"bg-white border-b border-border px-4 py-4 md:px-8 flex items-center gap-3 sticky top-0 z-10",children:[a.jsx("img",{src:Y.logoUrl||aU,alt:Y.name,className:"h-10 w-auto"}),a.jsx("div",{className:"ml-auto text-right",children:a.jsx("p",{className:"text-xs text-muted-foreground uppercase tracking-wide",children:"Quote & Contract Agreement"})})]}),a.jsxs("main",{className:"max-w-3xl mx-auto px-4 py-8 space-y-8",children:[a.jsxs("div",{className:"text-center",children:[a.jsx("p",{className:"text-sm uppercase tracking-widest text-muted-foreground font-semibold mb-1",children:"Contract Agreement"}),a.jsxs("h2",{className:"text-3xl font-display font-bold text-foreground",children:["Quote #",k.id]}),a.jsxs("p",{className:"text-muted-foreground mt-1",children:["Prepared for ",k.client?.name||k.customerData?.name]})]}),a.jsxs(ye,{className:"p-6 md:p-8 border-2 border-primary/20",children:[a.jsxs("div",{className:"flex justify-between items-center mb-6",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-sm text-muted-foreground font-semibold uppercase tracking-wider",children:"Property"}),a.jsx("p",{className:"font-bold text-lg",children:k.customerData?.address||"On File"})]}),a.jsxs("div",{className:"text-right",children:[a.jsx("p",{className:"text-sm text-muted-foreground font-semibold uppercase tracking-wider",children:"Total"}),a.jsx("p",{className:"text-3xl font-bold text-primary",children:De(q)})]})]}),k.clientSummary&&a.jsxs("div",{className:"bg-secondary/60 rounded-xl p-5 mb-6",children:[a.jsx("h4",{className:"font-bold text-sm uppercase tracking-wider text-muted-foreground mb-2",children:"Scope of Work"}),a.jsx("p",{className:"text-foreground whitespace-pre-wrap leading-relaxed",children:k.clientSummary})]}),a.jsxs("div",{className:"border-t border-border pt-6 space-y-3 text-sm text-muted-foreground",children:[a.jsx("p",{className:"font-bold text-foreground text-base",children:"Terms & Conditions"}),a.jsxs("p",{children:["This agreement is between ",Y.name," (Lic. #",Y.license,") and the property owner or authorized representative. By signing below, you agree to the following:"]}),a.jsxs("ul",{className:"list-disc pl-5 space-y-1.5",children:[a.jsx("li",{children:"The quoted price covers all labor and materials as described 
19in the scope of work above."}),a.jsxs("li",{children:["A deposit of ",a.jsxs("strong",{className:"text-foreground",children:[De(K)," (50%)"]})," is due prior to scheduling. The remaining balance is due upon completion."]}),a.jsx("li",{children:"Any changes to the scope of work after signing will require a written change order and may affect the total price."}),a.jsxs("li",{children:[Y.name," is not responsible for pre-existing conditions discovered during installation."]}),a.jsx("li",{children:"All work is warranted against defects in workmanship for one (1) year from the date of installation."}),a.jsx("li",{children:"This quote is valid for 30 days from the date of issue."})]}),a.jsxs("p",{className:"text-foreground font-medium",children:["Your point of contact: ",Z," — ",F," — ",B]}),a.jsxs("p",{children:["Lic. #",Y.license," — ",Y.serviceArea]}),Y.address&&a.jsx("p",{children:Y.address}),Y.website&&a.jsx("p",{children:Y.website})]})]}),I.length>0&&a.jsxs(ye,{className:"p-6 md:p-8",children:[a.jsx("h3",{className:"font-bold text-lg mb-1",children:"Choose Your Package"}),a.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Select the option that works best for you."}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("label",{className:`flex items-start justify-between gap-3 rounded-xl border-2 p-4 ${W?"cursor-default":"cursor-pointer"} ${p===""?"border-primary bg-primary/5":"border-border"}`,children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("input",{type:"radio",name:"package",className:"w-5 h-5 mt-0.5 accent-primary",checked:p==="",disabled:W,onChange:()=>x(""),"data-testid":"radio-package-base"}),a.jsxs("div",{children:[a.jsx("p",{className:"font-bold",children:"Standard Quote"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"The quote as originally prepared."})]})]}),a.jsx("p",{className:"font-bold text-primary whitespace-nowrap",children:De(k.grandTotal)})]}),I.map(Q=>a.jsxs("label",{className:`flex items-start justify-between gap-3 rounded-xl border-2 p-4 ${W?"cursor-default":"cursor-pointer"} ${p===Q.id?"border-primary bg-primary/5":"border-border"}`,children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("input",{type:"radio",name:"package",className:"w-5 h-5 mt-0.5 accent-primary",checked:p===Q.id,disabled:W,onChange:()=>x(Q.id),"data-testid":`radio-package-${Q.id}`}),a.jsxs("div",{children:[a.jsx("p",{className:"font-bold",children:Q.name||"Package"}),Q.description&&a.jsx("p",{className:"text-sm text-muted-foreground",children:Q.description})]})]}),a.jsx("p",{className:"font-bold text-primary whitespace-nowrap",children:De(Q.total)})]},Q.id))]})]}),L.length>0&&a.jsxs(ye,{className:"p-6 md:p-8",children:[a.jsx("h3",{className:"font-bold text-lg mb-1",children:"Optional Add-ons"}),a.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Add any extras you'd like included."}),a.jsx("div",{className:"space-y-3",children:L.map(Q=>a.jsxs("label",{className:`flex items-start justify-between gap-3 rounded-xl border-2 p-4 ${W?"cursor-default":"cursor-pointer"} ${f.includes(Q.id)?"border-primary bg-primary/5":"border-border"}`,children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("input",{type:"checkbox",className:"w-5 h-5 mt-0.5 rounded accent-primary",checked:f.includes(Q.id),disabled:W,onChange:()=>X(Q.id),"data-testid":`checkbox-addon-${Q.id}`}),a.jsxs("div",{children:[a.jsx("p",{className:"font-bold",children:Q.label||"Add-on"}),Q.description&&a.jsx("p",{className:"text-sm text-muted-foreground",children:Q.description})]})]}),a.jsxs("p",{className:"font-bold text-primary whitespace-nowrap",children:["+",De(Q.price)]})]},Q.id))})]}),(()=>{const Q=Zz(k).filter(se=>se.imageUrl);return Q.length===0?null:a.jsxs(ye,{className:"p-6 md:p-8",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4 gap-2",children:[a.jsx("h3",{className:"font-bold text-lg",children:"Gutter Diagrams"}),a.jsxs(ne,{variant:"outline",size:"sm",disabled:C,onClick:async()=>{N(!0);try{const se=k.client?.name||k.customerData?.name||`Quote-${k.id}`;await tU(Q,se)}catch{w("Could not generate the diagram PDF.")}finally{N(!1)}},"data-testid":"button-download-diagrams-pdf",children:[C?a.jsx(Me,{className:"w-4 h-4 mr-2 animate-spin"}):a.jsx(jn,{className:"w-4 h-4 mr-2"}),"Download PDF"]})]}),Q.map(se=>a.jsx(nU,{page:se},se.id))]})})(),a.jsx(ye,{className:"p-6 md:p-8",children:a.jsx("div",{className:"flex items-center gap-2 mb-1",children:a.jsxs("label",{className:"flex items-start gap-3 cursor-pointer",children:[a.jsx("input",{type:"checkbox",className:"w-5 h-5 rounded mt-0.5 text-primary accent-primary",checked:u,onChange:Q=>d(Q.target.checked)}),a.jsxs("span",{className:"text-sm leading-relaxed",children:["I acknowledge that a ",a.jsxs("strong",{children:["50% deposit of ",De(K)]})," is required before scheduling, and the remaining ",a.jsx("strong",{children:De(K)})," is due upon completion."]})]})})}),a.jsxs(ye,{className:"p-6 md:p-8",children:[a.jsxs("div",{className:"flex justify-between items-center mb-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Mee,{className:"w-5 h-5 text-primary"}),a.jsx("h3",{className:"font-bold text-lg",children:"Sign Here"})]}),a.jsxs(ne,{variant:"ghost",size:"sm",onClick:H,className:"text-muted-foreground hover:text-foreground",children:[a.jsx(on,{className:"w-4 h-4 mr-1"})," Clear"]})]}),a.jsx("div",{className:"border-2 border-dashed border-border rounded-xl overflow-hidden bg-gray-50 touch-none",children:a.jsx("canvas",{ref:n,width:700,height:200,className:"w-full cursor-crosshair",style:{touchAction:"none"},onMouseDown:E,onMouseMove:_,onMouseUp:R,onMouseLeave:R,onTouchStart:E,onTouchMove:_,onTouchEnd:R})}),!i&&a.jsx("p",{className:"text-sm text-muted-foreground text-center mt-2",children:"Draw your signature above using your mouse or finger"})]}),y&&a.jsxs("div",{className:"flex items-center gap-2 text-destructive bg-destructive/10 rounded-xl p-4",children:[a.jsx(rn,{className:"w-5 h-5 flex-shrink-0"}),a.jsx("p",{className:"text-sm",children:y})]}),a.jsxs("div",{className:"pb-8",children:[a.jsx(ne,{className:"w-full rounded-xl font-bold text-lg py-6 shadow-lg shadow-primary/25",disabled:!i||!u||P.isPending,onClick:()=>{w(null),P.mutate()},children:P.isPending?a.jsxs(a.Fragment,{children:[a.jsx(Me,{className:"w-5 h-5 mr-2 animate-spin"})," Submitting..."]}):a.jsxs(a.Fragment,{children:[a.jsx(Cg,{className:"w-5 h-5 mr-2"})," Sign & Approve Contract"]})}),(!i||!u)&&a.jsx("p",{className:"text-center text-sm text-muted-foreground mt-2",children:!i&&!u?"Please sign and acknowledge the deposit to continue":i?"Please acknowledge the deposit requirement":"Please provide your signature to continue"})]})]})]})}function dk(e){return tse(e)}function ffe(){const e=wt();return ise({mutation:{onSuccess:(t,n)=>
19{e.invalidateQueries({queryKey:bi()}),e.invalidateQueries({queryKey:nse(n.id)})}}})}function mfe(){const e=wt();return use({mutation:{onSuccess:()=>e.invalidateQueries({queryKey:bi()})}})}function fk(){return nB()}function hfe(e){return gse(e,{query:{enabled:!!e,queryKey:ET(e)}})}function pfe(){const e=wt();return jse({mutation:{onSuccess:()=>e.invalidateQueries({queryKey:gv()})}})}function xfe(){const e=wt();return nt({mutationFn:async t=>{const n=localStorage.getItem("fs_team_token"),r=await fetch(`/api/quotes/${t}/send-to-client`,{method:"POST",headers:{"Content-Type":"application/json",...n?{Authorization:`Bearer ${n}`}:{}}}),s=await r.json();if(!r.ok)throw new Error(s?.error||"Failed to send quote");return s},onSuccess:(t,n)=>{e.invalidateQueries({queryKey:gv()}),e.invalidateQueries({queryKey:ET(n)})}})}function jv(e){return Ase(e)}var rw,c5;function Ir(){if(c5)return rw;c5=1;var e=Array.isArray;return rw=e,rw}var aw,u5;function sU(){if(u5)return aw;u5=1;var e=typeof hx=="object"&&hx&&hx.Object===Object&&hx;return aw=e,aw}var sw,d5;function Ls(){if(d5)return sw;d5=1;var e=sU(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return sw=n,sw}var iw,f5;function Rh(){if(f5)return iw;f5=1;var e=Ls(),t=e.Symbol;return iw=t,iw}var ow,m5;function gfe(){if(m5)return ow;m5=1;var e=Rh(),t=Object.prototype,n=t.hasOwnProperty,r=t.toString,s=e?e.toStringTag:void 0;function i(l){var u=n.call(l,s),d=l[s];try{l[s]=void 0;var f=!0}catch{}var h=r.call(l);return f&&(u?l[s]=d:delete l[s]),h}return ow=i,ow}var lw,h5;function yfe(){if(h5)return lw;h5=1;var e=Object.prototype,t=e.toString;function n(r){return t.call(r)}return lw=n,lw}var cw,p5;function Di(){if(p5)return cw;p5=1;var e=Rh(),t=gfe(),n=yfe(),r="[object Null]",s="[object Undefined]",i=e?e.toStringTag:void 0;function l(u){return u==null?u===void 0?s:r:i&&i in Object(u)?t(u):n(u)}return cw=l,cw}var uw,x5;function $i(){if(x5)return uw;x5=1;function e(t){return t!=null&&typeof t=="object"}return uw=e,uw}var dw,g5;function Sd(){if(g5)return dw;g5=1;var e=Di(),t=$i(),n="[object Symbol]";function r(s){return typeof s=="symbol"||t(s)&&e(s)==n}return dw=r,dw}var fw,y5;function mk(){if(y5)return fw;y5=1;var e=Ir(),t=Sd(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function s(i,l){if(e(i))return!1;var u=typeof i;return u=="number"||u=="symbol"||u=="boolean"||i==null||t(i)?!0:r.test(i)||!n.test(i)||l!=null&&i in Object(l)}return fw=s,fw}var mw,v5;function Ho(){if(v5)return mw;v5=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return mw=e,mw}var hw,b5;function hk(){if(b5)return hw;b5=1;var e=Di(),t=Ho(),n="[object AsyncFunction]",r="[object Function]",s="[object GeneratorFunction]",i="[object Proxy]";function l(u){if(!t(u))return!1;var d=e(u);return d==r||d==s||d==n||d==i}return hw=l,hw}var pw,j5;function vfe(){if(j5)return pw;j5=1;var e=Ls(),t=e["__core-js_shared__"];return pw=t,pw}var xw,w5;function bfe(){if(w5)return xw;w5=1;
vendor: 4,090 bytes, line 19
19var e=vfe(),t=(function(){var r=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""})();function n(r){return!!t&&t in r}return xw=n,xw}var gw,N5;function iU(){if(N5)return gw;N5=1;var e=Function.prototype,t=e.toString;function n(r){if(r!=null){try{return t.call(r)}catch{}try{return r+""}catch{}}return""}return gw=n,gw}var yw,S5;function jfe(){if(S5)return yw;S5=1;var e=hk(),t=bfe(),n=Ho(),r=iU(),s=/[\\^$.*+?()[\]{}|]/g,i=/^\[object .+?Constructor\]$/,l=Function.prototype,u=Object.prototype,d=l.toString,f=u.hasOwnProperty,h=RegExp("^"+d.call(f).replace(s,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function p(x){if(!n(x)||t(x))return!1;var y=e(x)?h:i;return y.test(r(x))}return yw=p,yw}var vw,C5;function wfe(){if(C5)return vw;C5=1;function e(t,n){return t?.[n]}return vw=e,vw}var bw,A5;function oc(){if(A5)return bw;A5=1;var e=jfe(),t=wfe();function n(r,s){var i=t(r,s);return e(i)?i:void 0}return bw=n,bw}var jw,T5;function wv(){if(T5)return jw;T5=1;var e=oc(),t=e(Object,"create");return jw=t,jw}var ww,k5;function Nfe(){if(k5)return ww;k5=1;var e=wv();function t(){this.__data__=e?e(null):{},this.size=0}return ww=t,ww}var Nw,O5;function Sfe(){if(O5)return Nw;O5=1;function e(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}return Nw=e,Nw}var Sw,P5;function Cfe(){if(P5)return Sw;P5=1;var e=wv(),t="__lodash_hash_undefined__",n=Object.prototype,r=n.hasOwnProperty;function s(i){var l=this.__data__;if(e){var u=l[i];return u===t?void 0:u}return r.call(l,i)?l[i]:void 0}return Sw=s,Sw}var Cw,E5;function Afe(){if(E5)return Cw;E5=1;var e=wv(),t=Object.prototype,n=t.hasOwnProperty;function r(s){var i=this.__data__;return e?i[s]!==void 0:n.call(i,s)}return Cw=r,Cw}var Aw,_5;function Tfe(){if(_5)return Aw;_5=1;var e=wv(),t="__lodash_hash_undefined__";function n(r,s){var i=this.__data__;return this.size+=this.has(r)?0:1,i[r]=e&&s===void 0?t:s,this}return Aw=n,Aw}var Tw,M5;function kfe(){if(M5)return Tw;M5=1;var e=Nfe(),t=Sfe(),n=Cfe(),r=Afe(),s=Tfe();function i(l){var u=-1,d=l==null?0:l.length;for(this.clear();++u<d;){var f=l[u];this.set(f[0],f[1])}}return i.prototype.clear=e,i.prototype.delete=t,i.prototype.get=n,i.prototype.has=r,i.prototype.set=s,Tw=i,Tw}var kw,R5;function Ofe(){if(R5)return kw;R5=1;function e(){this.__data__=[],this.size=0}return kw=e,kw}var Ow,D5;function pk(){if(D5)return Ow;D5=1;function e(t,n){return t===n||t!==t&&n!==n}return Ow=e,Ow}var Pw,$5;function Nv(){if($5)return Pw;$5=1;var e=pk();function t(n,r){for(var s=n.length;s--;)if(e(n[s][0],r))return s;return-1}return Pw=t,Pw}var Ew,I5;function Pfe(){if(I5)return Ew;I5=1;var e=Nv(),t=Array.prototype,n=t.splice;function r(s){var i=this.__data__,l=e(i,s);if(l<0)return!1;var u=i.length-1;return l==u?i.pop():n.call(i,l,1),--this.size,!0}return Ew=r,Ew}var _w,L5;function Efe(){if(L5)return _w;L5=1;var e=Nv();function t(n){var r=this.__data__,s=e(r,n);return s<0?void 0:r[s][1]}return _w=t,_w}var Mw,F5;function _fe(){if(F5)return Mw;F5=1;var e=Nv();function t(n){return e(this.__data__,n)>-1}return Mw=t,Mw}var Rw,q5;function Mfe(){if(q5)return Rw;q5=1;var e=Nv();function t(n,r){var s=this.__data__,i=e(s,n);return i<0?(++this.size,s.push([n,r])):s[i][1]=r,this}return Rw=t,Rw}var Dw,B5;function Sv(){if(B5)return Dw;B5=1;var e=Ofe(),t=Pfe(),n=Efe(),r=_fe(),s=Mfe();function i(l){var u=-1,d=l==null?0:l.length;for(this.clear();++u<d;){var f=l[u];this.set(f[0],f[1])}}return i.prototype.clear=e,i.prototype.delete=t,i.prototype.get=n,i.prototype.has=r,i.prototype.set=s,Dw=i,Dw}var $w,z5;function xk(){if(z5)return $w;z5=1;var e=oc(),t=Ls(),n=e(t,"Map");return $w=n,$w}var Iw,U5;function Rfe(){if(U5)return Iw;U5=1;var e=kfe(),t=Sv(),n=xk();function r(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return Iw=r,Iw}var Lw,H5;function Dfe(){if(H5)return Lw;H5=1;function e(t){var n=typeof t;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?t!=="__proto__":t===null}return Lw=e,Lw}var Fw,V5;function Cv(){if(V5)return Fw;V5=1;var e=Dfe();function t(n,r){var s=n.__data__;
vendor: 11,487 bytes, line 19
19return e(r)?s[typeof r=="string"?"string":"hash"]:s.map}return Fw=t,Fw}var qw,G5;function $fe(){if(G5)return qw;G5=1;var e=Cv();function t(n){var r=e(this,n).delete(n);return this.size-=r?1:0,r}return qw=t,qw}var Bw,K5;function Ife(){if(K5)return Bw;K5=1;var e=Cv();function t(n){return e(this,n).get(n)}return Bw=t,Bw}var zw,W5;function Lfe(){if(W5)return zw;W5=1;var e=Cv();function t(n){return e(this,n).has(n)}return zw=t,zw}var Uw,Y5;function Ffe(){if(Y5)return Uw;Y5=1;var e=Cv();function t(n,r){var s=e(this,n),i=s.size;return s.set(n,r),this.size+=s.size==i?0:1,this}return Uw=t,Uw}var Hw,X5;function gk(){if(X5)return Hw;X5=1;var e=Rfe(),t=$fe(),n=Ife(),r=Lfe(),s=Ffe();function i(l){var u=-1,d=l==null?0:l.length;for(this.clear();++u<d;){var f=l[u];this.set(f[0],f[1])}}return i.prototype.clear=e,i.prototype.delete=t,i.prototype.get=n,i.prototype.has=r,i.prototype.set=s,Hw=i,Hw}var Vw,Q5;function oU(){if(Q5)return Vw;Q5=1;var e=gk(),t="Expected a function";function n(r,s){if(typeof r!="function"||s!=null&&typeof s!="function")throw new TypeError(t);var i=function(){var l=arguments,u=s?s.apply(this,l):l[0],d=i.cache;if(d.has(u))return d.get(u);var f=r.apply(this,l);return i.cache=d.set(u,f)||d,f};return i.cache=new(n.Cache||e),i}return n.Cache=e,Vw=n,Vw}var Gw,Z5;function qfe(){if(Z5)return Gw;Z5=1;var e=oU(),t=500;function n(r){var s=e(r,function(l){return i.size===t&&i.clear(),l}),i=s.cache;return s}return Gw=n,Gw}var Kw,J5;function Bfe(){if(J5)return Kw;J5=1;var e=qfe(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g,r=e(function(s){var i=[];return s.charCodeAt(0)===46&&i.push(""),s.replace(t,function(l,u,d,f){i.push(d?f.replace(n,"$1"):u||l)}),i});return Kw=r,Kw}var Ww,eD;function yk(){if(eD)return Ww;eD=1;function e(t,n){for(var r=-1,s=t==null?0:t.length,i=Array(s);++r<s;)i[r]=n(t[r],r,t);return i}return Ww=e,Ww}var Yw,tD;function zfe(){if(tD)return Yw;tD=1;var e=Rh(),t=yk(),n=Ir(),r=Sd(),s=e?e.prototype:void 0,i=s?s.toString:void 0;function l(u){if(typeof u=="string")return u;if(n(u))return t(u,l)+"";if(r(u))return i?i.call(u):"";var d=u+"";return d=="0"&&1/u==-1/0?"-0":d}return Yw=l,Yw}var Xw,nD;function lU(){if(nD)return Xw;nD=1;var e=zfe();function t(n){return n==null?"":e(n)}return Xw=t,Xw}var Qw,rD;function cU(){if(rD)return Qw;rD=1;var e=Ir(),t=mk(),n=Bfe(),r=lU();function s(i,l){return e(i)?i:t(i,l)?[i]:n(r(i))}return Qw=s,Qw}var Zw,aD;function Av(){if(aD)return Zw;aD=1;var e=Sd();function t(n){if(typeof n=="string"||e(n))return n;var r=n+"";return r=="0"&&1/n==-1/0?"-0":r}return Zw=t,Zw}var Jw,sD;function vk(){if(sD)return Jw;sD=1;var e=cU(),t=Av();function n(r,s){s=e(s,r);for(var i=0,l=s.length;r!=null&&i<l;)r=r[t(s[i++])];return i&&i==l?r:void 0}return Jw=n,Jw}var e1,iD;function uU(){if(iD)return e1;iD=1;var e=vk();function t(n,r,s){var i=n==null?void 0:e(n,r);return i===void 0?s:i}return e1=t,e1}var Ufe=uU();const Pa=Bt(Ufe);var t1,oD;function Hfe(){if(oD)return t1;oD=1;function e(t){return t==null}return t1=e,t1}var Vfe=Hfe();const pt=Bt(Vfe);var n1,lD;function Gfe(){if(lD)return n1;lD=1;var e=Di(),t=Ir(),n=$i(),r="[object String]";function s(i){return typeof i=="string"||!t(i)&&n(i)&&e(i)==r}return n1=s,n1}var Kfe=Gfe();const Gl=Bt(Kfe);var Wfe=hk();const ut=Bt(Wfe);var Yfe=Ho();const Cd=Bt(Yfe);var r1={exports:{}},Ct={};var cD;function Xfe(){if(cD)return Ct;cD=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),l=Symbol.for("react.context"),u=Symbol.for("react.server_context"),d=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),h=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),x=Symbol.for("react.lazy"),y=Symbol.for("react.offscreen"),w;w=Symbol.for("react.module.reference");function j(b){if(typeof b=="object"&&b!==null){var C=b.$$typeof;switch(C){case e:switch(b=b.type,b){case n:case s:case r:case f:case h:return b;default:switch(b=b&&b.$$typeof,b){case u:case l:case d:case x:case p:case i:return b;default:return C}}case t:return C}}}return Ct.ContextConsumer=l,Ct.ContextProvider=i,Ct.Element=e,Ct.ForwardRef=d,Ct.Fragment=n,Ct.Lazy=x,Ct.Memo=p,Ct.Portal=t,Ct.Profiler=s,Ct.StrictMode=r,Ct.Suspense=f,Ct.SuspenseList=h,Ct.isAsyncMode=function(){return!1},Ct.isConcurrentMode=function(){return!1},Ct.isContextConsumer=function(b){return j(b)===l},Ct.isContextProvider=function(b){return j(b)===i},Ct.isElement=function(b){return typeof b=="object"&&b!==null&&b.$$typeof===e},Ct.isForwardRef=function(b){return j(b)===d},Ct.isFragment=function(b){return j(b)===n},Ct.isLazy=function(b){return j(b)===x},Ct.isMemo=function(b){return j(b)===p},Ct.isPortal=function(b){return j(b)===t},Ct.isProfiler=function(b){return j(b)===s},Ct.isStrictMode=function(b){return j(b)===r},Ct.isSuspense=function(b){return j(b)===f},Ct.isSuspenseList=function(b){return j(b)===h},Ct.isValidElementType=function(b){return typeof b=="string"||typeof b=="function"||b===n||b===s||b===r||b===f||b===h||b===y||typeof b=="object"&&b!==null&&(b.$$typeof===x||b.$$typeof===p||b.$$typeof===i||b.$$typeof===l||b.$$typeof===d||b.$$typeof===w||b.getModuleId!==void 0)},Ct.typeOf=j,Ct}var uD;function Qfe(){return uD||(uD=1,r1.exports=Xfe()),r1.exports}var Zfe=Qfe(),a1,dD;function dU(){if(dD)return a1;dD=1;var e=Di(),t=$i(),n="[object Number]";function r(s){return typeof s=="number"||t(s)&&e(s)==n}return a1=r,a1}var s1,fD;function Jfe(){if(fD)return s1;fD=1;var e=dU();function t(n){return e(n)&&n!=+n}return s1=t,s1}var eme=Jfe();const Dh=Bt(eme);var tme=dU();const nme=Bt(tme);var ns=function(t){return t===0?0:t>0?1:-1},Rl=function(t){return Gl(t)&&t.indexOf("%")===t.length-1},Ie=function(t){return nme(t)&&!Dh(t)},rme=function(t){return pt(t)},Mn=function(t){return Ie(t)||Gl(t)},ame=0,$h=function(t){var n=++ame;return"".concat(t||"").concat(n)},Kl=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!Ie(t)&&!Gl(t))return r;var i;if(Rl(t)){var l=t.indexOf("%");i=n*parseFloat(t.slice(0,l))/100}else i=+t;return Dh(i)&&(i=r),s&&i>n&&(i=n),i},Co=function(t){if(!t)return null;var n=Object.keys(t);return n&&n.length?t[n[0]]:null},sme=function(t){if(!Array.isArray(t))return!1;for(var n=t.length,r={},s=0;s<n;s++)if(!r[t[s]])r[t[s]]=!0;else return!0;return!1},es=function(t,n){return Ie(t)&&Ie(n)?function(r){return t+r*(n-t)}:function(){return n}};function Wg(e,t,n){return!e||!e.length?null:e.find(function(r){return r&&(typeof t=="function"?t(r):Pa(r,t))===n})}var ime=function(t,n){return Ie(t)&&Ie(n)?t-n:Gl(t)&&Gl(n)?t.localeCompare(n):t instanceof Date&&n instanceof Date?t.getTime()-n.getTime():String(t).localeCompare(String(n))};function ku(e,t){for(var n in e)if({}.hasOwnProperty.call(e,n)&&(!{}.hasOwnProperty.call(t,n)||e[n]!==t[n]))return!1;for(var r in t)if({}.hasOwnProperty.call(t,r)&&!{}.hasOwnProperty.call(e,r))return!1;return!0}function gC(e){"@babel/helpers - typeof";return gC=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},gC(e)}var ome=["viewBox","children"],lme=["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-flowto","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","className","color","height","id","lang","max","media","method","min","name","style","target","width","role","tabIndex","accentHeight","accumulate","additive","alignmentBaseline","allowReorder","alphabetic","amplitude","arabicForm","ascent","attributeName","attributeType","autoReverse","azimuth","baseFrequency","baselineShift","baseProfile","bbox","begin","bias","by","calcMode","capHeight","clip","clipPath","clipPathUnits","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRendering","contentScriptType","contentStyleType","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominantBaseline","dur","dx","dy","edgeMode","elevation","enableBackground","end","exponent","externalResourcesRequired","fill","fillOpacity","fillRule","filter","filterRes","filterUnits","floodColor","floodOpacity","focusable","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","format","from","fx","fy","g1","g2","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","gradientTransform","gradientUnits","hanging","horizAdvX","horizOriginX","href","ideographic","imageRendering","in2","in","intercept","k1","k2","k3","k4","k","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letterSpacing","lightingColor","limitingConeAngle","local","markerEnd","markerHeight","markerMid","markerStart","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overlinePosition","overlineThickness","paintOrder","panose1","pathLength","patternContentUnits","patternTransform","patternUnits","pointerEvents","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","renderingIntent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","seed","shapeRendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stopColor","stopOpacity","strikethroughPosition","strikethroughThickness","string","stroke","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","surfaceScale","systemLanguage","tableValues","targetX","targetY","textAnchor","textDecoration","textLength","textRendering","to","transform","u1","u2","underlinePosition","underlineThickness","unicode","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","values","vectorEffect","version","vertAdvY","vertOriginX","vertOriginY","vHanging","vIdeographic","viewTarget","visibility","vMathematical","widths","wordSpacing","writingMode","x1","x2","x","xChannelSelector","xHeight","xlinkActuate","xlinkArcrole","xlinkHref","xlinkRole","xlinkShow","xlinkTitle","xlinkType","xmlBase","xmlLang","xmlns","xmlnsXlink","xmlSpace","y1","y2","y","yChannelSelector","z","zoomAndPan","ref","key","angle"],mD=["points","pathLength"],i1={svg:ome,polygon:mD,polyline:mD},bk=["dangerouslySetInnerHTML","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onF
19ocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"],Yg=function(t,n){if(!t||typeof t=="function"||typeof t=="boolean")return null;var r=t;if(v.isValidElement(t)&&(r=t.props),!Cd(r))return null;var s={};return Object.keys(r).forEach(function(i){bk.includes(i)&&(s[i]=n||function(l){return r[i](r,l)})}),s},cme=function(t,n,r){return function(s){return t(n,r,s),null}},Xg=function(t,n,r){if(!Cd(t)||gC(t)!=="object")return null;var s=null;return Object.keys(t).forEach(function(i){var l=t[i];bk.includes(i)&&typeof l=="function"&&(s||(s={}),s[i]=cme(l,n,r))}),s},ume=["children"],dme=["children"];function hD(e,t){if(e==null)return{};var n=fme(e,t),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)r=i[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function fme(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function yC(e){"@babel/helpers - typeof";return yC=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yC(e)}var pD={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart",contextmenu:"onContextMenu",dblclick:"onDoubleClick"}
19,ji=function(t){return typeof t=="string"?t:t?t.displayName||t.name||"Component":""},xD=null,o1=null,jk=function e(t){if(t===xD&&Array.isArray(o1))return o1;var n=[];return v.Children.forEach(t,function(r){pt(r)||(Zfe.isFragment(r)?n=n.concat(e(r.props.children)):n.push(r))}),o1=n,xD=t,n};function Ea(e,t){var n=[],r=[];return Array.isArray(t)?r=t.map(function(s){return ji(s)}):r=[ji(t)],jk(e).forEach(function(s){var i=Pa(s,"type.displayName")||Pa(s,"type.name");r.indexOf(i)!==-1&&n.push(s)}),n}function sa(e,t){var n=Ea(e,t);return n&&n[0]}var gD=function(t){if(!t||!t.props)return!1;var n=t.props,r=n.width,s=n.height;return!(!Ie(r)||r<=0||!Ie(s)||s<=0)},mme=["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColormatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-url","foreignObject","g","glyph","glyphRef","hkern","image","line","lineGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"],hme=function(t){return t&&t.type&&Gl(t.type)&&mme.indexOf(t.type)>=0},pme=function(t){return t&&yC(t)==="object"&&"clipDot"in t},xme=function(t,n,r,s){var i,l=(i=i1?.[s])!==null&&i!==void 0?i:[];return n.startsWith("data-")||!ut(t)&&(s&&l.includes(n)||lme.includes(n))||r&&bk.includes(n)},gt=function(t,n,r){if(!t||typeof t=="function"||typeof t=="boolean")return null;var s=t;if(v.isValidElement(t)&&(s=t.props),!Cd(s))return null;var i={};return Object.keys(s).forEach(function(l){var u;xme((u=s)===null||u===void 0?void 0:u[l],l,n,r)&&(i[l]=s[l])}),i},vC=function e(t,n){if(t===n)return!0;var r=v.Children.count(t);if(r!==v.Children.count(n))return!1;if(r===0)return!0;if(r===1)return yD(Array.isArray(t)?t[0]:t,Array.isArray(n)?n[0]:n);for(var s=0;s<r;s++){var i=t[s],l=n[s];if(Array.isArray(i)||Array.isArray(l)){if(!e(i,l))return!1}else if(!yD(i,l))return!1}return!0},yD=function(t,n){if(pt(t)&&pt(n))return!0;if(!pt(t)&&!pt(n)){var r=t.props||{},s=r.children,i=hD(r,ume),l=n.props||{},u=l.children,d=hD(l,dme);return s&&u?ku(i,d)&&vC(s,u):!s&&!u?ku(i,d):!1}return!1},vD=function(t,n){var r=[],s={};return jk(t).forEach(function(i,l){if(hme(i))r.push(i);else if(i){var u=ji(i.type),d=n[u]||{},f=d.handler,h=d.once;if(f&&(!h||!s[u])){var p=f(i,u,l);r.push(p),s[u]=!0}}}),r},gme=function(t){var n=t&&t.type;return n&&pD[n]?pD[n]:null},yme=function(t,n){return jk(n).indexOf(t)},vme=["children","width","height","viewBox","className","style","title","desc"];function bC(){return bC=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},bC.apply(this,arguments)}function bme(e,t){if(e==null)return{};var n=jme(e,t),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)r=i[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function jme(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function jC(e){var t=e.children,n=e.width,r=e.height,s=e.viewBox,i=e.className,l=e.style,u=e.title,d=e.desc,f=bme(e,vme),h=s||{width:n,height:r,x:0,y:0},p=yt("recharts-surface",i);return ie.createElement("svg",bC({},gt(f,!0,"svg"),{className:p,width:n,height:r,style:l,viewBox:"".concat(h.x," ").concat(h.y," ").concat(h.width," ").concat(h.height)}),ie.createElement("title",null,u),ie.createElement("desc",null,d),t)}var wme=["children","className"];function wC(){return wC=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},wC.apply(this,arguments)}function Nme(e,t){if(e==null)return{};var n=Sme(e,t),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)r=i[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Sme(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var pn=ie.forwardRef(function(e,t){var n=e.children,r=e.className,s=Nme(e,wme),i=yt("recharts-layer",r);return ie.createElement("g",wC({className:i},gt(s,!0),{ref:t}),n)}),wi=function(t,n){for(var r=arguments.length,s=new Array(r>2?r-2:0),i=2;i<r;i++)s[i-2]=arguments[i]},l1,bD;function Cme(){if(bD)return l1;bD=1;function e(t,n,r){var s=-1,i=t.length;n<0&&(n=-n>i?0:i+n),r=r>i?i:r,r<0&&(r+=i),i=n>r?0:r-n>>>0,n>>>=0;for(var l=Array(i);++s<i;)l[s]=t[s+n];return l}return l1=e,l1}var c1,jD;function Ame(){if(jD)return c1;jD=1;var e=Cme();function t(n,r,s){var i=n.length;return s=s===void 0?i:s,!r&&s>=i?n:e(n,r,s)}return c1=t,c1}var u1,wD;function fU(){if(wD)return u1;wD=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",r="\\u20d0-\\u20ff",s=t+n+r,i="\\ufe0e\\ufe0f",l="\\u200d",u=RegExp("["+l+e+s+i+"]");function d(f){return u.test(f)}return u1=d,u1}var d1,ND;function Tme(){if(ND)return d1;ND=1;function e(t){return t.split("")}return d1=e,d1}var f1,SD;function kme(){if(SD)return f1;SD=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",r="\\u20d0-\\u20ff",s=t+n+r,i="\\ufe0e\\ufe0f",l="["+e+"]",u="["+s+"]",d="\\ud83c[\\udffb-\\udfff]",f="(?:"+u+"|"+d+")",h="[^"+e+"]",p="(?:\\ud83c[\\udde6-\\uddff]){2}",x="[\\ud800-\\udbff][\\udc00-\\udfff]",y="\\u200d",w=f+"?",j="["+i+"]?",b="(?:"+y+"(?:"+[h,p,x].join("|")+")"+j+w+")*",C=j+w+b,N="(?:"+[h+u+"?",u,p,x,l].join("|")+")",k=RegExp(d+"(?="+d+")|"+N+C,"g");function T(A){return A.match(k)||[]}return f1=T,f1}var m1,CD;function Ome(){if(CD)return m1;CD=1;var e=Tme(),t=fU(),n=kme();function r(s){return t(s)?n(s):e(s)}return m1=r,m1}var h1,AD;function Pme(){if(AD)return h1;AD=1;var e=Ame(),t=fU(),n=Ome(),r=lU();function s(i){return function(l){l=r(l);var u=t(l)?n(l):void 0,d=u?u[0]:l.charAt(0),f=u?e(u,1).join(""):l.slice(1);return d[i]()+f}}return h1=s,h1}var p1,TD;function Eme(){if(TD)return p1;TD=1;var e=Pme(),t=e("toUpperCase");return p1=t,p1}var _me=Eme();const Tv=Bt(_me);function Gt(e){return function(){return e}}const mU=Math.cos,Qg=Math.sin,cs=Math.sqrt,Zg=Math.PI,kv=2*Zg,NC=Math.PI,SC=2*NC,Ol=1e-6,Mme=SC-Ol;function hU(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function Rme(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return hU;const n=10**t;return function(r){this._+=r[0];for(let s=1,i=r.length;s<i;++s)this._+=Math.round(arguments[s]*n)/n+r[s]}}class Dme{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?hU:Rme(t)}moveTo(t,n){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,n){this._append`L${this._x1=+t},${this._y1=+n}`}quadraticCurveTo(t,n,r,s){this._append`Q${+t},${+n},${this._x1=+r},${this._y1=+s}`}bezierCurveTo(t,n,r,s,i,l){this._append`C${+t},${+n},${+r},${+s},${this._x1=+i},${this._y1=+l}`}arcTo(t,n,r,s,i){if(t=+t,n=+n,r=+r,s=+s,i=+i,i<0)throw new Error(`negative radius: ${i}`);let l=this._x1,u=this._y1,d=r-t,f=s-n,h=l-t,p=u-n,x=h*h+p*p;if(this._x1===null)this._append`M${this._x1=t},${this._y1=n}`;else if(x>Ol)if(!(Math.abs(p*d-f*h)>Ol)||!i)this._append`L${this._x1=t},${this._y1=n}`;else{let y=r-l,w=s-u,j=d*d+f*f,b=y*y+w*w,C=Math.sqrt(j),N=Math.sqrt(x),k=i*Math.tan((NC-Math.acos((j+x-b)/(2*C*N)))/2),T=k/N,A=k/C;Math.abs(T-1)>
vendor: 2,628 bytes, line 19
19Ol&&this._append`L${t+T*h},${n+T*p}`,this._append`A${i},${i},0,0,${+(p*y>h*w)},${this._x1=t+A*d},${this._y1=n+A*f}`}}arc(t,n,r,s,i,l){if(t=+t,n=+n,r=+r,l=!!l,r<0)throw new Error(`negative radius: ${r}`);let u=r*Math.cos(s),d=r*Math.sin(s),f=t+u,h=n+d,p=1^l,x=l?s-i:i-s;this._x1===null?this._append`M${f},${h}`:(Math.abs(this._x1-f)>Ol||Math.abs(this._y1-h)>Ol)&&this._append`L${f},${h}`,r&&(x<0&&(x=x%SC+SC),x>Mme?this._append`A${r},${r},0,1,${p},${t-u},${n-d}A${r},${r},0,1,${p},${this._x1=f},${this._y1=h}`:x>Ol&&this._append`A${r},${r},0,${+(x>=NC)},${p},${this._x1=t+r*Math.cos(i)},${this._y1=n+r*Math.sin(i)}`)}rect(t,n,r,s){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${r=+r}v${+s}h${-r}Z`}toString(){return this._}}function wk(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{const r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);t=r}return e},()=>new Dme(t)}function Nk(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function pU(e){this._context=e}pU.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 Ov(e){return new pU(e)}function xU(e){return e[0]}function gU(e){return e[1]}function yU(e,t){var n=Gt(!0),r=null,s=Ov,i=null,l=wk(u);e=typeof e=="function"?e:e===void 0?xU:Gt(e),t=typeof t=="function"?t:t===void 0?gU:Gt(t);function u(d){var f,h=(d=Nk(d)).length,p,x=!1,y;for(r==null&&(i=s(y=l())),f=0;f<=h;++f)!(f<h&&n(p=d[f],f,d))===x&&((x=!x)?i.lineStart():i.lineEnd()),x&&i.point(+e(p,f,d),+t(p,f,d));if(y)return i=null,y+""||null}return u.x=function(d){return arguments.length?(e=typeof d=="function"?d:Gt(+d),u):e},u.y=function(d){return arguments.length?(t=typeof d=="function"?d:Gt(+d),u):t},u.defined=function(d){return arguments.length?(n=typeof d=="function"?d:Gt(!!d),u):n},u.curve=function(d){return arguments.length?(s=d,r!=null&&(i=s(r)),u):s},u.context=function(d){return arguments.length?(d==null?r=i=null:i=s(r=d),u):r},u}function Tx(e,t,n){var r=null,s=Gt(!0),i=null,l=Ov,u=null,d=wk(f);e=typeof e=="function"?e:e===void 0?xU:Gt(+e),t=typeof t=="function"?t:Gt(t===void 0?0:+t),n=typeof n=="function"?n:n===void 0?gU:Gt(+n);function f(p){var x,y,w,j=(p=Nk(p)).length,b,C=!1,N,k=new Array(j),T=new Array(j);
19for(i==null&&(u=l(N=d())),x=0;x<=j;++x){if(!(x<j&&s(b=p[x],x,p))===C)if(C=!C)y=x,u.areaStart(),u.lineStart();else{for(u.lineEnd(),u.lineStart(),w=x-1;w>=y;--w)u.point(k[w],T[w]);u.lineEnd(),u.areaEnd()}C&&(k[x]=+e(b,x,p),T[x]=+t(b,x,p),u.point(r?+r(b,x,p):k[x],n?+n(b,x,p):T[x]))}if(N)return u=null,N+""||null}function h(){return yU().defined(s).curve(l).context(i)}return f.x=function(p){return arguments.length?(e=typeof p=="function"?p:Gt(+p),r=null,f):e},f.x0=function(p){return arguments.length?(e=typeof p=="function"?p:Gt(+p),f):e},f.x1=function(p){return arguments.length?(r=p==null?null:typeof p=="function"?p:Gt(+p),f):r},f.y=function(p){return arguments.length?(t=typeof p=="function"?p:Gt(+p),n=null,f):t},f.y0=function(p){return arguments.length?(t=typeof p=="function"?p:Gt(+p),f):t},f.y1=function(p){return arguments.length?(n=p==null?null:typeof p=="function"?p:Gt(+p),f):n},f.lineX0=f.lineY0=function(){return h().x(e).y(t)},f.lineY1=function(){return h().x(e).y(n)},f.lineX1=function(){return h().x(r).y(t)},f.defined=function(p){return arguments.length?(s=typeof p=="function"?p:Gt(!!p),f):s},f.curve=function(p){return arguments.length?(l=p,i!=null&&(u=l(i)),f):l},f.context=function(p){return arguments.length?(p==null?i=u=null:u=l(i=p),f):i},f}class vU{constructor(t,n){this._context=t,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,n){switch(t=+t,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,n,t,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,t,this._y0,t,n);break}}this._x0=t,this._y0=n}}function $me(e){return new vU(e,!0)}function Ime(e){return new vU(e,!1)}const Sk={draw(e,t){const n=cs(t/Zg);e.moveTo(n,0),e.arc(0,0,n,0,kv)}},Lme={draw(e,t){const n=cs(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},bU=cs(1/3),Fme=bU*2,qme={draw(e,t){const n=cs(t/Fme),r=n*bU;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},Bme={draw(e,t){const n=cs(t),r=-n/2;e.rect(r,r,n,n)}},zme=.8908130915292852,jU=Qg(Zg/10)/Qg(7*Zg/10),Ume=Qg(kv/10)*jU,Hme=-mU(kv/10)*jU,Vme={draw(e,t){const n=cs(t*zme),r=Ume*n,s=Hme*n;e.moveTo(0,-n),e.lineTo(r,s);for(let i=1;i<5;++i){const l=kv*i/5,u=mU(l),d=Qg(l);e.lineTo(d*n,-u*n),e.lineTo(u*r-d*s,d*r+u*s)}e.closePath()}},x1=cs(3),Gme={draw(e,t){const n=-cs(t/(x1*3));e.moveTo(0,n*2),e.lineTo(-x1*n,-n),e.lineTo(x1*n,-n),e.closePath()}},ja=-.5,wa=cs(3)/2,CC=1/cs(12),Kme=(CC/2+1)*3,Wme={draw(e,t){const n=cs(t/Kme),r=n/2,s=n*CC,i=r,l=n*CC+n,u=-i,d=l;e.moveTo(r,s),e.lineTo(i,l),e.lineTo(u,d),e.lineTo(ja*r-wa*s,wa*r+ja*s),e.lineTo(ja*i-wa*l,wa*i+ja*l),e.lineTo(ja*u-wa*d,wa*u+ja*d),e.lineTo(ja*r+wa*s,ja*s-wa*r),e.lineTo(ja*i+wa*l,ja*l-wa*i),e.lineTo(ja*u+wa*d,ja*d-wa*u),e.closePath()}};function Yme(e,t){let n=null,r=wk(s);e=typeof e=="function"?e:Gt(e||Sk),t=typeof t=="function"?t:Gt(t===void 0?64:+t);function s(){let i;if(n||(n=i=r()),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),i)return n=null,i+""||null}return s.type=function(i){return arguments.length?(e=typeof i=="function"?i:Gt(i),s):e},s.size=function(i){return arguments.length?(t=typeof i=="function"?i:Gt(+i),s):t},s.context=function(i){return arguments.length?(n=i??null,s):n},s}function Jg(){}function ey(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function wU(e){this._context=e}wU.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:ey(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:ey(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Xme(e){return new wU(e)}function NU(e){this._context=e}NU.prototype={areaStart:Jg,areaEnd:Jg,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:ey(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Qme(e){return new NU(e)}function SU(e){this._context=e}SU.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:ey(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Zme(e){return new SU(e)}function CU(e){this._context=e}CU.prototype={areaStart:Jg,areaEnd:Jg,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 Jme(e){return new CU(e)}function kD(e){return e<0?-1:1}function OD(e,t,n){var r=e._x1-e._x0,s=t-e._x1,i=(e._y1-e._y0)/(r||s<0&&-0),l=(n-e._y1)/(s||r<0&&-0),u=(i*s+l*r)/(r+s);return(kD(i)+kD(l))*Math.min(Math.abs(i),Math.abs(l),.5*Math.abs(u))||0}function PD(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}
19function g1(e,t,n){var r=e._x0,s=e._y0,i=e._x1,l=e._y1,u=(i-r)/3;e._context.bezierCurveTo(r+u,s+u*t,i-u,l-u*n,i,l)}function ty(e){this._context=e}ty.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:g1(this,this._t0,PD(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,g1(this,PD(this,n=OD(this,e,t)),n);break;default:g1(this,this._t0,n=OD(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function AU(e){this._context=new TU(e)}(AU.prototype=Object.create(ty.prototype)).point=function(e,t){ty.prototype.point.call(this,t,e)};function TU(e){this._context=e}TU.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,s,i){this._context.bezierCurveTo(t,e,r,n,i,s)}};function ehe(e){return new ty(e)}function the(e){return new AU(e)}function kU(e){this._context=e}kU.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=ED(e),s=ED(t),i=0,l=1;l<n;++i,++l)this._context.bezierCurveTo(r[0][i],s[0][i],r[1][i],s[1][i],e[l],t[l]);(this._line||this._line!==0&&n===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}};function ED(e){var t,n=e.length-1,r,s=new Array(n),i=new Array(n),l=new Array(n);for(s[0]=0,i[0]=2,l[0]=e[0]+2*e[1],t=1;t<n-1;++t)s[t]=1,i[t]=4,l[t]=4*e[t]+2*e[t+1];for(s[n-1]=2,i[n-1]=7,l[n-1]=8*e[n-1]+e[n],t=1;t<n;++t)r=s[t]/i[t-1],i[t]-=r,l[t]-=r*l[t-1];for(s[n-1]=l[n-1]/i[n-1],t=n-2;t>=0;--t)s[t]=(l[t]-s[t+1])/i[t];for(i[n-1]=(e[n]+s[n-1])/2,t=0;t<n-1;++t)i[t]=2*e[t+1]-s[t+1];return[s,i]}function nhe(e){return new kU(e)}function Pv(e,t){this._context=e,this._t=t}Pv.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}}this._x=e,this._y=t}};function rhe(e){return new Pv(e,.5)}function ahe(e){return new Pv(e,0)}function she(e){return new Pv(e,1)}function Fu(e,t){if((l=e.length)>1)for(var n=1,r,s,i=e[t[0]],l,u=i.length;n<l;++n)for(s=i,i=e[t[n]],r=0;r<u;++r)i[r][1]+=i[r][0]=isNaN(s[r][1])?s[r][0]:s[r][1]}function AC(e){for(var t=e.length,n=new Array(t);--t>=0;)n[t]=t;return n}function ihe(e,t){return e[t]}function ohe(e){const t=[];return t.key=e,t}function lhe(){var e=Gt([]),t=AC,n=Fu,r=ihe;function s(i){var l=Array.from(e.apply(this,arguments),ohe),u,d=l.length,f=-1,h;for(const p of i)for(u=0,++f;u<d;++u)(l[u][f]=[0,+r(p,l[u].key,f,i)]).data=p;for(u=0,h=Nk(t(l));u<d;++u)l[h[u]].index=u;return n(l,h),l}return s.keys=function(i){return arguments.length?(e=typeof i=="function"?i:Gt(Array.from(i)),s):e},s.value=function(i){return arguments.length?(r=typeof i=="function"?i:Gt(+i),s):r},s.order=function(i){return arguments.length?(t=i==null?AC:typeof i=="function"?i:Gt(Array.from(i)),s):t},s.offset=function(i){return arguments.length?(n=i??Fu,s):n},s}function che(e,t){if((r=e.length)>0){for(var n,r,s=0,i=e[0].length,l;s<i;++s){for(l=n=0;n<r;++n)l+=e[n][s][1]||0;if(l)for(n=0;n<r;++n)e[n][s][1]/=l}Fu(e,t)}}function uhe(e,t){if((s=e.length)>0){for(var n=0,r=e[t[0]],s,i=r.length;n<i;++n){for(var l=0,u=0;l<s;++l)u+=e[l][n][1]||0;r[n][1]+=r[n][0]=-u/2}Fu(e,t)}}function dhe(e,t){if(!(!((l=e.length)>0)||!((i=(s=e[t[0]]).length)>0))){for(var n=0,r=1,s,i,l;r<i;++r){for(var u=0,d=0,f=0;u<l;
vendor: 8,724 bytes, lines 19-22
19++u){for(var h=e[t[u]],p=h[r][1]||0,x=h[r-1][1]||0,y=(p-x)/2,w=0;w<u;++w){var j=e[t[w]],b=j[r][1]||0,C=j[r-1][1]||0;y+=b-C}d+=p,f+=y*p}s[r-1][1]+=s[r-1][0]=n,d&&(n-=f/d)}s[r-1][1]+=s[r-1][0]=n,Fu(e,t)}}function Dm(e){"@babel/helpers - typeof";return Dm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Dm(e)}var fhe=["type","size","sizeType"];function TC(){return TC=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},TC.apply(this,arguments)}function _D(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function MD(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?_D(Object(n),!0).forEach(function(r){mhe(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_D(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function mhe(e,t,n){return t=hhe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function hhe(e){var t=phe(e,"string");return Dm(t)=="symbol"?t:t+""}function phe(e,t){if(Dm(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Dm(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function xhe(e,t){if(e==null)return{};var n=ghe(e,t),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)r=i[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function ghe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var OU={symbolCircle:Sk,symbolCross:Lme,symbolDiamond:qme,symbolSquare:Bme,symbolStar:Vme,symbolTriangle:Gme,symbolWye:Wme},yhe=Math.PI/180,vhe=function(t){var n="symbol".concat(Tv(t));return OU[n]||Sk},bhe=function(t,n,r){if(n==="area")return t;switch(r){case"cross":return 5*t*t/9;case"diamond":return .5*t*t/Math.sqrt(3);case"square":return t*t;case"star":{var s=18*yhe;return 1.25*t*t*(Math.tan(s)-Math.tan(s*2)*Math.pow(Math.tan(s),2))}case"triangle":return Math.sqrt(3)*t*t/4;case"wye":return(21-10*Math.sqrt(3))*t*t/8;default:return Math.PI*t*t/4}},jhe=function(t,n){OU["symbol".concat(Tv(t))]=n},Ck=function(t){var n=t.type,r=n===void 0?"circle":n,s=t.size,i=s===void 0?64:s,l=t.sizeType,u=l===void 0?"area":l,d=xhe(t,fhe),f=MD(MD({},d),{},{type:r,size:i,sizeType:u}),h=function(){var b=vhe(r),C=Yme().type(b).size(bhe(i,u,r));return C()},p=f.className,x=f.cx,y=f.cy,w=gt(f,!0);return x===+x&&y===+y&&i===+i?ie.createElement("path",TC({},w,{className:yt("recharts-symbols",p),transform:"translate(".concat(x,", ").concat(y,")"),d:h()})):null};Ck.registerSymbol=jhe;function qu(e){"@babel/helpers - typeof";return qu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},qu(e)}function kC(){return kC=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},kC.apply(this,arguments)}function RD(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function whe(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?RD(Object(n),!0).forEach(function(r){$m(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):RD(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Nhe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function She(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,EU(r.key),r)}}function Che(e,t,n){return t&&She(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ahe(e,t,n){return t=ny(t),The(e,PU()?Reflect.construct(t,n||[],ny(e).constructor):t.apply(e,n))}function The(e,t){if(t&&(qu(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return khe(e)}function khe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function PU(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(PU=function(){return!!e})()}function ny(e){return ny=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},ny(e)}function Ohe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&OC(e,t)}function OC(e,t){return OC=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},OC(e,t)}function $m(e,t,n){return t=EU(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function EU(e){var t=Phe(e,"string");return qu(t)=="symbol"?t:t+""}function Phe(e,t){if(qu(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(qu(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Na=32,Ak=(function(e){function t(){return Nhe(this,t),Ahe(this,t,arguments)}return Ohe(t,e),Che(t,[{key:"renderIcon",value:function(r){var s=this.props.inactiveColor,i=Na/2,l=Na/6,u=Na/3,d=r.inactive?s:r.color;if(r.type==="plainline")return ie.createElement("line",{strokeWidth:4,fill:"none",stroke:d,strokeDasharray:r.payload.strokeDasharray,x1:0,y1:i,x2:Na,y2:i,className:"recharts-legend-icon"});if(r.type==="line")return ie.createElement("path",{strokeWidth:4,fill:"none",stroke:d,d:"M0,".concat(i,"h").concat(u,`
20            A`).concat(l,",").concat(l,",0,1,1,").concat(2*u,",").concat(i,`
21            H`).concat(Na,"M").concat(2*u,",").concat(i,`
22            A`).concat(l,",").concat(l,",0,1,1,").concat(u,",").concat(i),className:"recharts-legend-icon"});if(r.type==="rect")return ie.createElement("path",{stroke:"none",fill:d,d:"M0,".concat(Na/8,"h").concat(Na,"v").concat(Na*3/4,"h").concat(-Na,"z"),className:"recharts-legend-icon"});if(ie.isValidElement(r.legendIcon)){var f=whe({},r);return delete f.legendIcon,ie.cloneElement(r.legendIcon,f)}return ie.createElement(Ck,{fill:d,cx:i,cy:i,size:Na,sizeType:"diameter",type:r.type})}},{key:"renderItems",value:function(){var r=this,s=this.props,i=s.payload,l=s.iconSize,u=s.layout,d=s.formatter,f=s.inactiveColor,h={x:0,y:0,width:Na,height:Na},p={display:u==="horizontal"?"inline-block":"block",marginRight:10},x={display:"inline-block",verticalAlign:"middle",marginRight:4};return i.map(function(y,w){var j=y.formatter||d,b=yt($m($m({"recharts-legend-item":!0},"legend-item-".concat(w),!0),"inactive",y.inactive));if(y.type==="none")return null;var C=ut(y.value)?null:y.value;wi(!ut(y.value),`The name property is also required when using a function for the dataKey of a chart's cartesian components. Ex: <Bar name="Name of my Data"/>`);var N=y.inactive?f:y.color;return ie.createElement("li",kC({className:b,style:p,key:"legend-item-".concat(w)},Xg(r.props,y,w)),ie.createElement(jC,{width:l,height:l,viewBox:h,style:x},r.renderIcon(y)),ie.createElement("span",{className:"recharts-legend-item-text",style:{color:N}},j?j(C,y,w):C))})}},{key:"render",value:function(){var r=this.props,s=r.payload,i=r.layout,l=r.align;if(!s||!s.length)return null;var u={padding:0,margin:0,textAlign:i==="horizontal"?l:"left"};return ie.createElement("ul",{className:"recharts-default-legend",style:u},this.renderItems())}}])})(v.PureComponent);$m(Ak,"displayName","Legend");$m(Ak,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var y1,DD;
vendor: 4,363 bytes, line 22
22function Ehe(){if(DD)return y1;DD=1;var e=Sv();function t(){this.__data__=new e,this.size=0}return y1=t,y1}var v1,$D;function _he(){if($D)return v1;$D=1;function e(t){var n=this.__data__,r=n.delete(t);return this.size=n.size,r}return v1=e,v1}var b1,ID;function Mhe(){if(ID)return b1;ID=1;function e(t){return this.__data__.get(t)}return b1=e,b1}var j1,LD;function Rhe(){if(LD)return j1;LD=1;function e(t){return this.__data__.has(t)}return j1=e,j1}var w1,FD;function Dhe(){if(FD)return w1;FD=1;var e=Sv(),t=xk(),n=gk(),r=200;function s(i,l){var u=this.__data__;if(u instanceof e){var d=u.__data__;if(!t||d.length<r-1)return d.push([i,l]),this.size=++u.size,this;u=this.__data__=new n(d)}return u.set(i,l),this.size=u.size,this}return w1=s,w1}var N1,qD;function _U(){if(qD)return N1;qD=1;var e=Sv(),t=Ehe(),n=_he(),r=Mhe(),s=Rhe(),i=Dhe();function l(u){var d=this.__data__=new e(u);this.size=d.size}return l.prototype.clear=t,l.prototype.delete=n,l.prototype.get=r,l.prototype.has=s,l.prototype.set=i,N1=l,N1}var S1,BD;function $he(){if(BD)return S1;BD=1;var e="__lodash_hash_undefined__";function t(n){return this.__data__.set(n,e),this}return S1=t,S1}var C1,zD;function Ihe(){if(zD)return C1;zD=1;function e(t){return this.__data__.has(t)}return C1=e,C1}var A1,UD;function MU(){if(UD)return A1;UD=1;var e=gk(),t=$he(),n=Ihe();function r(s){var i=-1,l=s==null?0:s.length;for(this.__data__=new e;++i<l;)this.add(s[i])}return r.prototype.add=r.prototype.push=t,r.prototype.has=n,A1=r,A1}var T1,HD;function RU(){if(HD)return T1;HD=1;function e(t,n){for(var r=-1,s=t==null?0:t.length;++r<s;)if(n(t[r],r,t))return!0;return!1}return T1=e,T1}var k1,VD;function DU(){if(VD)return k1;VD=1;function e(t,n){return t.has(n)}return k1=e,k1}var O1,GD;function $U(){if(GD)return O1;GD=1;var e=MU(),t=RU(),n=DU(),r=1,s=2;function i(l,u,d,f,h,p){var x=d&r,y=l.length,w=u.length;if(y!=w&&!(x&&w>y))return!1;var j=p.get(l),b=p.get(u);if(j&&b)return j==u&&b==l;var C=-1,N=!0,k=d&s?new e:void 0;for(p.set(l,u),p.set(u,l);++C<y;){var T=l[C],A=u[C];if(f)var P=x?f(A,T,C,u,l,p):f(T,A,C,l,u,p);if(P!==void 0){if(P)continue;N=!1;break}if(k){if(!t(u,function(E,_){if(!n(k,_)&&(T===E||h(T,E,d,f,p)))return k.push(_)})){N=!1;break}}else if(!(T===A||h(T,A,d,f,p))){N=!1;break}}return p.delete(l),p.delete(u),N}return O1=i,O1}var P1,KD;function Lhe(){if(KD)return P1;KD=1;var e=Ls(),t=e.Uint8Array;return P1=t,P1}var E1,WD;function Fhe(){if(WD)return E1;WD=1;function e(t){var n=-1,r=Array(t.size);return t.forEach(function(s,i){r[++n]=[i,s]}),r}return E1=e,E1}var _1,YD;function Tk(){if(YD)return _1;YD=1;function e(t){var n=-1,r=Array(t.size);return t.forEach(function(s){r[++n]=s}),r}return _1=e,_1}var M1,XD;function qhe(){if(XD)return M1;XD=1;var e=Rh(),t=Lhe(),n=pk(),r=$U(),s=Fhe(),i=Tk(),l=1,u=2,d="[object Boolean]",f="[object Date]",h="[object Error]",p="[object Map]",x="[object Number]",y="[object RegExp]",w="[object Set]",j="[object String]",b="[object Symbol]",C="[object ArrayBuffer]",N="[object DataView]",k=e?e.prototype:void 0,T=k?k.valueOf:void 0;function A(P,E,_,R,H,L,I){switch(_){case N:if(P.byteLength!=E.byteLength||P.byteOffset!=E.byteOffset)return!1;P=P.buffer,E=E.buffer;case C:return!(P.byteLength!=E.byteLength||!L(new t(P),new t(E)));case d:case f:case x:return n(+P,+E);case h:return P.name==E.name&&P.message==E.message;case y:case j:return P==E+"";case p:var W=s;case w:var U=R&l;if(W||(W=i),P.size!=E.size&&!U)return!1;var V=I.get(P);if(V)return V==E;R|=u,I.set(P,E);var D=r(W(P),W(E),R,H,L,I);return I.delete(P),D;case b:if(T)return T.call(P)==T.call(E)}return!1}return M1=A,M1}var R1,QD;function IU(){if(QD)return R1;QD=1;function e(t,n){for(var r=-1,s=n.length,i=t.length;++r<s;)t[i+r]=n[r];return t}return R1=e,R1}var D1,ZD;function Bhe(){if(ZD)return D1;ZD=1;var e=IU(),t=Ir();function n(r,s,i){var l=s(r);return t(r)?l:e(l,i(r))}return D1=n,D1}var $1,JD;function zhe(){if(JD)return $1;JD=1;function e(t,n){for(var r=-1,s=t==null?0:t.length,i=0,l=[];++r<s;){var u=t[r];n(u,r,t)&&(l[i++]=u)}return l}return $1=e,$1}var I1,e4;function Uhe(){if(e4)return I1;e4=1;function e(){return[]}return I1=e,I1}var L1,t4;function Hhe(){if(t4)return L1;t4=1;var e=zhe(),t=Uhe(),n=Object.prototype,r=n.propertyIsEnumerable,s=Object.getOwnPropertySymbols,i=s?function(l){return l==null?[]:(l=Object(l),e(s(l),function(u){return r.call(l,u)}))}:t;return L1=i,L1}var F1,n4;
vendor: 4,174 bytes, line 22
22function Vhe(){if(n4)return F1;n4=1;function e(t,n){for(var r=-1,s=Array(t);++r<t;)s[r]=n(r);return s}return F1=e,F1}var q1,r4;function Ghe(){if(r4)return q1;r4=1;var e=Di(),t=$i(),n="[object Arguments]";function r(s){return t(s)&&e(s)==n}return q1=r,q1}var B1,a4;function kk(){if(a4)return B1;a4=1;var e=Ghe(),t=$i(),n=Object.prototype,r=n.hasOwnProperty,s=n.propertyIsEnumerable,i=e((function(){return arguments})())?e:function(l){return t(l)&&r.call(l,"callee")&&!s.call(l,"callee")};return B1=i,B1}var am={exports:{}},z1,s4;function Khe(){if(s4)return z1;s4=1;function e(){return!1}return z1=e,z1}am.exports;var i4;function LU(){return i4||(i4=1,(function(e,t){var n=Ls(),r=Khe(),s=t&&!t.nodeType&&t,i=s&&!0&&e&&!e.nodeType&&e,l=i&&i.exports===s,u=l?n.Buffer:void 0,d=u?u.isBuffer:void 0,f=d||r;e.exports=f})(am,am.exports)),am.exports}var U1,o4;function Ok(){if(o4)return U1;o4=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function n(r,s){var i=typeof r;return s=s??e,!!s&&(i=="number"||i!="symbol"&&t.test(r))&&r>-1&&r%1==0&&r<s}return U1=n,U1}var H1,l4;function Pk(){if(l4)return H1;l4=1;var e=9007199254740991;function t(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=e}return H1=t,H1}var V1,c4;function Whe(){if(c4)return V1;c4=1;var e=Di(),t=Pk(),n=$i(),r="[object Arguments]",s="[object Array]",i="[object Boolean]",l="[object Date]",u="[object Error]",d="[object Function]",f="[object Map]",h="[object Number]",p="[object Object]",x="[object RegExp]",y="[object Set]",w="[object String]",j="[object WeakMap]",b="[object ArrayBuffer]",C="[object DataView]",N="[object Float32Array]",k="[object Float64Array]",T="[object Int8Array]",A="[object Int16Array]",P="[object Int32Array]",E="[object Uint8Array]",_="[object Uint8ClampedArray]",R="[object Uint16Array]",H="[object Uint32Array]",L={};L[N]=L[k]=L[T]=L[A]=L[P]=L[E]=L[_]=L[R]=L[H]=!0,L[r]=L[s]=L[b]=L[i]=L[C]=L[l]=L[u]=L[d]=L[f]=L[h]=L[p]=L[x]=L[y]=L[w]=L[j]=!1;function I(W){return n(W)&&t(W.length)&&!!L[e(W)]}return V1=I,V1}var G1,u4;function FU(){if(u4)return G1;u4=1;function e(t){return function(n){return t(n)}}return G1=e,G1}var sm={exports:{}};sm.exports;var d4;function Yhe(){return d4||(d4=1,(function(e,t){var n=sU(),r=t&&!t.nodeType&&t,s=r&&!0&&e&&!e.nodeType&&e,i=s&&s.exports===r,l=i&&n.process,u=(function(){try{var d=s&&s.require&&s.require("util").types;return d||l&&l.binding&&l.binding("util")}catch{}})();e.exports=u})(sm,sm.exports)),sm.exports}var K1,f4;function qU(){if(f4)return K1;f4=1;var e=Whe(),t=FU(),n=Yhe(),r=n&&n.isTypedArray,s=r?t(r):e;return K1=s,K1}var W1,m4;function Xhe(){if(m4)return W1;m4=1;var e=Vhe(),t=kk(),n=Ir(),r=LU(),s=Ok(),i=qU(),l=Object.prototype,u=l.hasOwnProperty;function d(f,h){var p=n(f),x=!p&&t(f),y=!p&&!x&&r(f),w=!p&&!x&&!y&&i(f),j=p||x||y||w,b=j?e(f.length,String):[],C=b.length;for(var N in f)(h||u.call(f,N))&&!(j&&(N=="length"||y&&(N=="offset"||N=="parent")||w&&(N=="buffer"||N=="byteLength"||N=="byteOffset")||s(N,C)))&&b.push(N);return b}return W1=d,W1}var Y1,h4;function Qhe(){if(h4)return Y1;h4=1;var e=Object.prototype;function t(n){var r=n&&n.constructor,s=typeof r=="function"&&r.prototype||e;return n===s}return Y1=t,Y1}var X1,p4;function BU(){if(p4)return X1;p4=1;function e(t,n){return function(r){return t(n(r))}}return X1=e,X1}var Q1,x4;function Zhe(){if(x4)return Q1;x4=1;var e=BU(),t=e(Object.keys,Object);return Q1=t,Q1}var Z1,g4;function Jhe(){if(g4)return Z1;g4=1;var e=Qhe(),t=Zhe(),n=Object.prototype,r=n.hasOwnProperty;function s(i){if(!e(i))return t(i);var l=[];for(var u in Object(i))r.call(i,u)&&u!="constructor"&&l.push(u);return l}return Z1=s,Z1}var J1,y4;function Ih(){if(y4)return J1;y4=1;var e=hk(),t=Pk();function n(r){return r!=null&&t(r.length)&&!e(r)}return J1=n,J1}var eN,v4;function Ev(){if(v4)return eN;v4=1;var e=Xhe(),t=Jhe(),n=Ih();function r(s){return n(s)?e(s):t(s)}return eN=r,eN}var tN,b4;function epe(){if(b4)return tN;b4=1;var e=Bhe(),t=Hhe(),n=Ev();function r(s){return e(s,n,t)}return tN=r,tN}var nN,j4;function tpe(){if(j4)return nN;j4=1;var e=epe(),t=1,n=Object.prototype,r=n.hasOwnProperty;function s(i,l,u,d,f,h){var p=u&t,x=e(i),y=x.length,w=e(l),j=w.length;if(y!=j&&!p)return!1;for(var b=y;b--;
vendor: 1,958 bytes, line 22
22){var C=x[b];if(!(p?C in l:r.call(l,C)))return!1}var N=h.get(i),k=h.get(l);if(N&&k)return N==l&&k==i;var T=!0;h.set(i,l),h.set(l,i);for(var A=p;++b<y;){C=x[b];var P=i[C],E=l[C];if(d)var _=p?d(E,P,C,l,i,h):d(P,E,C,i,l,h);if(!(_===void 0?P===E||f(P,E,u,d,h):_)){T=!1;break}A||(A=C=="constructor")}if(T&&!A){var R=i.constructor,H=l.constructor;R!=H&&"constructor"in i&&"constructor"in l&&!(typeof R=="function"&&R instanceof R&&typeof H=="function"&&H instanceof H)&&(T=!1)}return h.delete(i),h.delete(l),T}return nN=s,nN}var rN,w4;function npe(){if(w4)return rN;w4=1;var e=oc(),t=Ls(),n=e(t,"DataView");return rN=n,rN}var aN,N4;function rpe(){if(N4)return aN;N4=1;var e=oc(),t=Ls(),n=e(t,"Promise");return aN=n,aN}var sN,S4;function zU(){if(S4)return sN;S4=1;var e=oc(),t=Ls(),n=e(t,"Set");return sN=n,sN}var iN,C4;function ape(){if(C4)return iN;C4=1;var e=oc(),t=Ls(),n=e(t,"WeakMap");return iN=n,iN}var oN,A4;function spe(){if(A4)return oN;A4=1;var e=npe(),t=xk(),n=rpe(),r=zU(),s=ape(),i=Di(),l=iU(),u="[object Map]",d="[object Object]",f="[object Promise]",h="[object Set]",p="[object WeakMap]",x="[object DataView]",y=l(e),w=l(t),j=l(n),b=l(r),C=l(s),N=i;return(e&&N(new e(new ArrayBuffer(1)))!=x||t&&N(new t)!=u||n&&N(n.resolve())!=f||r&&N(new r)!=h||s&&N(new s)!=p)&&(N=function(k){var T=i(k),A=T==d?k.constructor:void 0,P=A?l(A):"";if(P)switch(P){case y:return x;case w:return u;case j:return f;case b:return h;case C:return p}return T}),oN=N,oN}var lN,T4;function ipe(){if(T4)return lN;T4=1;var e=_U(),t=$U(),n=qhe(),r=tpe(),s=spe(),i=Ir(),l=LU(),u=qU(),d=1,f="[object Arguments]",h="[object Array]",p="[object Object]",x=Object.prototype,y=x.hasOwnProperty;function w(j,b,C,N,k,T){var A=i(j),P=i(b),E=A?h:s(j),_=P?h:s(b);E=E==f?p:E,_=_==f?p:_;var R=E==p,H=_==p,L=E==_;if(L&&l(j)){if(!l(b))return!1;A=!0,R=!1}if(L&&!R)return T||(T=new e),A||u(j)?t(j,b,C,N,k,T):n(j,b,E,C,N,k,T);if(!(C&d)){var I=R&&y.call(j,"__wrapped__"),W=H&&y.call(b,"__wrapped__");
vendor: 46,068 bytes, lines 22-30
22if(I||W){var U=I?j.value():j,V=W?b.value():b;return T||(T=new e),k(U,V,C,N,T)}}return L?(T||(T=new e),r(j,b,C,N,k,T)):!1}return lN=w,lN}var cN,k4;function Ek(){if(k4)return cN;k4=1;var e=ipe(),t=$i();function n(r,s,i,l,u){return r===s?!0:r==null||s==null||!t(r)&&!t(s)?r!==r&&s!==s:e(r,s,i,l,n,u)}return cN=n,cN}var uN,O4;function ope(){if(O4)return uN;O4=1;var e=_U(),t=Ek(),n=1,r=2;function s(i,l,u,d){var f=u.length,h=f,p=!d;if(i==null)return!h;for(i=Object(i);f--;){var x=u[f];if(p&&x[2]?x[1]!==i[x[0]]:!(x[0]in i))return!1}for(;++f<h;){x=u[f];var y=x[0],w=i[y],j=x[1];if(p&&x[2]){if(w===void 0&&!(y in i))return!1}else{var b=new e;if(d)var C=d(w,j,y,i,l,b);if(!(C===void 0?t(j,w,n|r,d,b):C))return!1}}return!0}return uN=s,uN}var dN,P4;function UU(){if(P4)return dN;P4=1;var e=Ho();function t(n){return n===n&&!e(n)}return dN=t,dN}var fN,E4;function lpe(){if(E4)return fN;E4=1;var e=UU(),t=Ev();function n(r){for(var s=t(r),i=s.length;i--;){var l=s[i],u=r[l];s[i]=[l,u,e(u)]}return s}return fN=n,fN}var mN,_4;function HU(){if(_4)return mN;_4=1;function e(t,n){return function(r){return r==null?!1:r[t]===n&&(n!==void 0||t in Object(r))}}return mN=e,mN}var hN,M4;function cpe(){if(M4)return hN;M4=1;var e=ope(),t=lpe(),n=HU();function r(s){var i=t(s);return i.length==1&&i[0][2]?n(i[0][0],i[0][1]):function(l){return l===s||e(l,s,i)}}return hN=r,hN}var pN,R4;function upe(){if(R4)return pN;R4=1;function e(t,n){return t!=null&&n in Object(t)}return pN=e,pN}var xN,D4;function dpe(){if(D4)return xN;D4=1;var e=cU(),t=kk(),n=Ir(),r=Ok(),s=Pk(),i=Av();function l(u,d,f){d=e(d,u);for(var h=-1,p=d.length,x=!1;++h<p;){var y=i(d[h]);if(!(x=u!=null&&f(u,y)))break;u=u[y]}return x||++h!=p?x:(p=u==null?0:u.length,!!p&&s(p)&&r(y,p)&&(n(u)||t(u)))}return xN=l,xN}var gN,$4;function fpe(){if($4)return gN;$4=1;var e=upe(),t=dpe();function n(r,s){return r!=null&&t(r,s,e)}return gN=n,gN}var yN,I4;function mpe(){if(I4)return yN;I4=1;var e=Ek(),t=uU(),n=fpe(),r=mk(),s=UU(),i=HU(),l=Av(),u=1,d=2;function f(h,p){return r(h)&&s(p)?i(l(h),p):function(x){var y=t(x,h);return y===void 0&&y===p?n(x,h):e(p,y,u|d)}}return yN=f,yN}var vN,L4;function Ad(){if(L4)return vN;L4=1;function e(t){return t}return vN=e,vN}var bN,F4;function hpe(){if(F4)return bN;F4=1;function e(t){return function(n){return n?.[t]}}return bN=e,bN}var jN,q4;function ppe(){if(q4)return jN;q4=1;var e=vk();function t(n){return function(r){return e(r,n)}}return jN=t,jN}var wN,B4;function xpe(){if(B4)return wN;B4=1;var e=hpe(),t=ppe(),n=mk(),r=Av();function s(i){return n(i)?e(r(i)):t(i)}return wN=s,wN}var NN,z4;function Vo(){if(z4)return NN;z4=1;var e=cpe(),t=mpe(),n=Ad(),r=Ir(),s=xpe();function i(l){return typeof l=="function"?l:l==null?n:typeof l=="object"?r(l)?t(l[0],l[1]):e(l):s(l)}return NN=i,NN}var SN,U4;function VU(){if(U4)return SN;U4=1;function e(t,n,r,s){for(var i=t.length,l=r+(s?1:-1);s?l--:++l<i;)if(n(t[l],l,t))return l;return-1}return SN=e,SN}var CN,H4;function gpe(){if(H4)return CN;H4=1;function e(t){return t!==t}return CN=e,CN}var AN,V4;function ype(){if(V4)return AN;V4=1;function e(t,n,r){for(var s=r-1,i=t.length;++s<i;)if(t[s]===n)return s;return-1}return AN=e,AN}var TN,G4;function vpe(){if(G4)return TN;G4=1;var e=VU(),t=gpe(),n=ype();function r(s,i,l){return i===i?n(s,i,l):e(s,t,l)}return TN=r,TN}var kN,K4;function bpe(){if(K4)return kN;K4=1;var e=vpe();function t(n,r){var s=n==null?0:n.length;return!!s&&e(n,r,0)>-1}return kN=t,kN}var ON,W4;function jpe(){if(W4)return ON;W4=1;function e(t,n,r){for(var s=-1,i=t==null?0:t.length;++s<i;)if(r(n,t[s]))return!0;return!1}return ON=e,ON}var PN,Y4;function wpe(){if(Y4)return PN;Y4=1;function e(){}return PN=e,PN}var EN,X4;function Npe(){if(X4)return EN;X4=1;var e=zU(),t=wpe(),n=Tk(),r=1/0,s=e&&1/n(new e([,-0]))[1]==r?function(i){return new e(i)}:t;return EN=s,EN}var _N,Q4;function Spe(){if(Q4)return _N;Q4=1;var e=MU(),t=bpe(),n=jpe(),r=DU(),s=Npe(),i=Tk(),l=200;function u(d,f,h){var p=-1,x=t,y=d.length,w=!0,j=[],b=j;if(h)w=!1,x=n;else if(y>=l){var C=f?null:s(d);if(C)return i(C);w=!1,x=r,b=new e}else b=f?[]:j;e:for(;++p<y;){var N=d[p],k=f?f(N):N;if(N=h||N!==0?N:0,w&&k===k){for(var T=b.length;T--;)if(b[T]===k)continue e;f&&b.push(k),j.push(N)}else x(b,k,h)||(b!==j&&b.push(k),j.push(N))}return j}return _N=u,_N}var MN,Z4;function Cpe(){if(Z4)return MN;Z4=1;var e=Vo(),t=Spe();function n(r,s){return r&&r.length?t(r,e(s,2)):[]}return MN=n,MN}var Ape=Cpe();const J4=Bt(Ape);function GU(e,t,n){return t===!0?J4(e,n):ut(t)?J4(e,t):e}function Bu(e){"@babel/helpers - typeof";return Bu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Bu(e)}var Tpe=["ref"];function e$(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function mi(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?e$(Object(n),!0).forEach(function(r){_v(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):e$(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function kpe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t$(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,WU(r.key),r)}}function Ope(e,t,n){return t&&t$(e.prototype,t),n&&t$(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ppe(e,t,n){return t=ry(t),Epe(e,KU()?Reflect.construct(t,n||[],ry(e).constructor):t.apply(e,n))}function Epe(e,t){if(t&&(Bu(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return _pe(e)}function _pe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function KU(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(KU=function(){return!!e})()}function ry(e){return ry=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},ry(e)}function Mpe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&PC(e,t)}function PC(e,t){return PC=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},PC(e,t)}function _v(e,t,n){return t=WU(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function WU(e){var t=Rpe(e,"string");return Bu(t)=="symbol"?t:t+""}function Rpe(e,t){if(Bu(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Bu(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function Dpe(e,t){if(e==null)return{};var n=$pe(e,t),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)r=i[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function $pe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Ipe(e){return e.value}function Lpe(e,t){if(ie.isValidElement(e))return ie.cloneElement(e,t);if(typeof e=="function")return ie.createElement(e,t);t.ref;var n=Dpe(t,Tpe);return ie.createElement(Ak,n)}var n$=1,Ou=(function(e){function t(){var n;kpe(this,t);for(var r=arguments.length,s=new Array(r),i=0;i<r;i++)s[i]=arguments[i];return n=Ppe(this,t,[].concat(s)),_v(n,"lastBoundingBox",{width:-1,height:-1}),n}return Mpe(t,e),Ope(t,[{key:"componentDidMount",value:function(){this.updateBBox()}},{key:"componentDidUpdate",value:function(){this.updateBBox()}},{key:"getBBox",value:function(){if(this.wrapperNode&&this.wrapperNode.getBoundingClientRect){var r=this.wrapperNode.getBoundingClientRect();return r.height=this.wrapperNode.offsetHeight,r.width=this.wrapperNode.offsetWidth,r}return null}},{key:"updateBBox",value:function(){var r=this.props.onBBoxUpdate,s=this.getBBox();s?(Math.abs(s.width-this.lastBoundingBox.width)>n$||Math.abs(s.height-this.lastBoundingBox.height)>n$)&&(this.lastBoundingBox.width=s.width,this.lastBoundingBox.height=s.height,r&&r(s)):(this.lastBoundingBox.width!==-1||this.lastBoundingBox.height!==-1)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,r&&r(null))}},{key:"getBBoxSnapshot",value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?mi({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(r){var s=this.props,i=s.layout,l=s.align,u=s.verticalAlign,d=s.margin,f=s.chartWidth,h=s.chartHeight,p,x;if(!r||(r.left===void 0||r.left===null)&&(r.right===void 0||r.right===null))if(l==="center"&&i==="vertical"){var y=this.getBBoxSnapshot();p={left:((f||0)-y.width)/2}}else p=l==="right"?{right:d&&d.right||0}:{left:d&&d.left||0};if(!r||(r.top===void 0||r.top===null)&&(r.bottom===void 0||r.bottom===null))if(u==="middle"){var w=this.getBBoxSnapshot();x={top:((h||0)-w.height)/2}}else x=u==="bottom"?{bottom:d&&d.bottom||0}:{top:d&&d.top||0};return mi(mi({},p),x)}},{key:"render",value:function(){var r=this,s=this.props,i=s.content,l=s.width,u=s.height,d=s.wrapperStyle,f=s.payloadUniqBy,h=s.payload,p=mi(mi({position:"absolute",width:l||"auto",height:u||"auto"},this.getDefaultPosition(d)),d);return ie.createElement("div",{className:"recharts-legend-wrapper",style:p,ref:function(y){r.wrapperNode=y}},Lpe(i,mi(mi({},this.props),{},{payload:GU(h,f,Ipe)})))}}],[{key:"getWithHeight",value:function(r,s){var i=mi(mi({},this.defaultProps),r.props),l=i.layout;return l==="vertical"&&Ie(r.props.height)?{height:r.props.height}:l==="horizontal"?{width:r.props.width||s}:null}}])})(v.PureComponent);_v(Ou,"displayName","Legend");_v(Ou,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var RN,r$;function Fpe(){if(r$)return RN;r$=1;var e=Rh(),t=kk(),n=Ir(),r=e?e.isConcatSpreadable:void 0;function s(i){return n(i)||t(i)||!!(r&&i&&i[r])}return RN=s,RN}var DN,a$;function YU(){if(a$)return DN;a$=1;var e=IU(),t=Fpe();function n(r,s,i,l,u){var d=-1,f=r.length;for(i||(i=t),u||(u=[]);++d<f;){var h=r[d];s>0&&i(h)?s>1?n(h,s-1,i,l,u):e(u,h):l||(u[u.length]=h)}return u}return DN=n,DN}var $N,s$;function qpe(){if(s$)return $N;s$=1;function e(t){return function(n,r,s){for(var i=-1,l=Object(n),u=s(n),d=u.length;d--;){var f=u[t?d:++i];if(r(l[f],f,l)===!1)break}return n}}return $N=e,$N}var IN,i$;function Bpe(){if(i$)return IN;i$=1;var e=qpe(),t=e();return IN=t,IN}var LN,o$;function XU(){if(o$)return LN;o$=1;var e=Bpe(),t=Ev();function n(r,s){return r&&e(r,s,t)}return LN=n,LN}var FN,l$;function zpe(){if(l$)return FN;l$=1;var e=Ih();function t(n,r){return function(s,i){if(s==null)return s;if(!e(s))return n(s,i);for(var l=s.length,u=r?l:-1,d=Object(s);(r?u--:++u<l)&&i(d[u],u,d)!==!1;);return s}}return FN=t,FN}var qN,c$;function _k(){if(c$)return qN;c$=1;var e=XU(),t=zpe(),n=t(e);return qN=n,qN}var BN,u$;function QU(){if(u$)return BN;u$=1;var e=_k(),t=Ih();function n(r,s){var i=-1,l=t(r)?Array(r.length):[];return e(r,function(u,d,f){l[++i]=s(u,d,f)}),l}return BN=n,BN}var zN,d$;function Upe(){if(d$)return zN;d$=1;function e(t,n){var r=t.length;for(t.sort(n);r--;)t[r]=t[r].value;return t}return zN=e,zN}var UN,f$;function Hpe(){if(f$)return UN;f$=1;var e=Sd();function t(n,r){if(n!==r){var s=n!==void 0,i=n===null,l=n===n,u=e(n),d=r!==void 0,f=r===null,h=r===r,p=e(r);if(!f&&!p&&!u&&n>r||u&&d&&h&&!f&&!p||i&&d&&h||!s&&h||!l)return 1;if(!i&&!u&&!p&&n<r||p&&s&&l&&!i&&!u||f&&s&&l||!d&&l||!h)return-1}return 0}return UN=t,UN}var HN,m$;function Vpe(){if(m$)return HN;m$=1;var e=Hpe();function t(n,r,s){for(var i=-1,l=n.criteria,u=r.criteria,d=l.length,f=s.length;++i<d;){var h=e(l[i],u[i]);if(h){if(i>=f)return h;var p=s[i];return h*(p=="desc"?-1:1)}}return n.index-r.index}return HN=t,HN}var VN,h$;function Gpe(){if(h$)return VN;h$=1;var e=yk(),t=vk(),n=Vo(),r=QU(),s=Upe(),i=FU(),l=Vpe(),u=Ad(),d=Ir();function f(h,p,x){p.length?p=e(p,function(j){return d(j)?function(b){return t(b,j.length===1?j[0]:j)}:j}):p=[u];var y=-1;p=e(p,i(n));var w=r(h,function(j,b,C){var N=e(p,function(k){return k(j)});return{criteria:N,index:++y,value:j}});return s(w,function(j,b){return l(j,b,x)})}return VN=f,VN}var GN,p$;function Kpe(){if(p$)return GN;p$=1;function e(t,n,r){switch(r.length){case 0:return t.call(n);case 1:return t.call(n,r[0]);case 2:return t.call(n,r[0],r[1]);case 3:return t.call(n,r[0],r[1],r[2])}return t.apply(n,r)}return GN=e,GN}var KN,x$;function Wpe(){if(x$)return KN;x$=1;var e=Kpe(),t=Math.max;function n(r,s,i){return s=t(s===void 0?r.length-1:s,0),function(){for(var l=arguments,u=-1,d=t(l.length-s,0),f=Array(d);++u<d;)f[u]=l[s+u];u=-1;for(var h=Array(s+1);++u<s;)h[u]=l[u];return h[s]=i(f),e(r,this,h)}}return KN=n,KN}var WN,g$;function Ype(){if(g$)return WN;g$=1;function e(t){return function(){return t}}return WN=e,WN}var YN,y$;function ZU(){if(y$)return YN;y$=1;var e=oc(),t=(function(){try{var n=e(Object,"defineProperty");return n({},"",{}),n}catch{}})();return YN=t,YN}var XN,v$;function Xpe(){if(v$)return XN;v$=1;var e=Ype(),t=ZU(),n=Ad(),r=t?function(s,i){return t(s,"toString",{configurable:!0,enumerable:!1,value:e(i),writable:!0})}:n;return XN=r,XN}var QN,b$;function Qpe(){if(b$)return QN;b$=1;var e=800,t=16,n=Date.now;function r(s){var i=0,l=0;return function(){var u=n(),d=t-(u-l);if(l=u,d>0){if(++i>=e)return arguments[0]}else i=0;return s.apply(void 0,arguments)}}return QN=r,QN}var ZN,j$;function Zpe(){if(j$)return ZN;j$=1;var e=Xpe(),t=Qpe(),n=t(e);return ZN=n,ZN}var JN,w$;function Jpe(){if(w$)return JN;w$=1;var e=Ad(),t=Wpe(),n=Zpe();function r(s,i){return n(t(s,i,e),s+"")}return JN=r,JN}var eS,N$;function Mv(){if(N$)return eS;N$=1;var e=pk(),t=Ih(),n=Ok(),r=Ho();function s(i,l,u){if(!r(u))return!1;var d=typeof l;return(d=="number"?t(u)&&n(l,u.length):d=="string"&&l in u)?e(u[l],i):!1}return eS=s,eS}var tS,S$;function exe(){if(S$)return tS;S$=1;var e=YU(),t=Gpe(),n=Jpe(),r=Mv(),s=n(function(i,l){if(i==null)return[];var u=l.length;return u>1&&r(i,l[0],l[1])?l=[]:u>2&&r(l[0],l[1],l[2])&&(l=[l[0]]),t(i,e(l,1),[])});return tS=s,tS}var txe=exe();const Mk=Bt(txe);function Im(e){"@babel/helpers - typeof";return Im=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Im(e)}function EC(){return EC=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},EC.apply(this,arguments)}function nxe(e,t){return ixe(e)||sxe(e,t)||axe(e,t)||rxe()}function rxe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
23In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function axe(e,t){if(e){if(typeof e=="string")return C$(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return C$(e,t)}}function C$(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function sxe(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,s,i,l,u=[],d=!0,f=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(d=(r=i.call(n)).done)&&(u.push(r.value),u.length!==t);d=!0);}catch(h){f=!0,s=h}finally{try{if(!d&&n.return!=null&&(l=n.return(),Object(l)!==l))return}finally{if(f)throw s}}return u}}function ixe(e){if(Array.isArray(e))return e}function A$(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function nS(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?A$(Object(n),!0).forEach(function(r){oxe(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):A$(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function oxe(e,t,n){return t=lxe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function lxe(e){var t=cxe(e,"string");return Im(t)=="symbol"?t:t+""}function cxe(e,t){if(Im(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Im(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function uxe(e){return Array.isArray(e)&&Mn(e[0])&&Mn(e[1])?e.join(" ~ "):e}var dxe=function(t){var n=t.separator,r=n===void 0?" : ":n,s=t.contentStyle,i=s===void 0?{}:s,l=t.itemStyle,u=l===void 0?{}:l,d=t.labelStyle,f=d===void 0?{}:d,h=t.payload,p=t.formatter,x=t.itemSorter,y=t.wrapperClassName,w=t.labelClassName,j=t.label,b=t.labelFormatter,C=t.accessibilityLayer,N=C===void 0?!1:C,k=function(){if(h&&h.length){var I={padding:0,margin:0},W=(x?Mk(h,x):h).map(function(U,V){if(U.type==="none")return null;var D=nS({display:"block",paddingTop:4,paddingBottom:4,color:U.color||"#000"},u),q=U.formatter||p||uxe,K=U.value,Y=U.name,z=K,Z=Y;if(q&&z!=null&&Z!=null){var F=q(K,Y,U,V,h);if(Array.isArray(F)){var B=nxe(F,2);z=B[0],Z=B[1]}else z=F}return ie.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(V),style:D},Mn(Z)?ie.createElement("span",{className:"recharts-tooltip-item-name"},Z):null,Mn(Z)?ie.createElement("span",{className:"recharts-tooltip-item-separator"},r):null,ie.createElement("span",{className:"recharts-tooltip-item-value"},z),ie.createElement("span",{className:"recharts-tooltip-item-unit"},U.unit||""))});return ie.createElement("ul",{className:"recharts-tooltip-item-list",style:I},W)}return null},T=nS({margin:0,padding:10,backgroundColor:"#fff",border:"1px solid #ccc",whiteSpace:"nowrap"},i),A=nS({margin:0},f),P=!pt(j),E=P?j:"",_=yt("recharts-default-tooltip",y),R=yt("recharts-tooltip-label",w);P&&b&&h!==void 0&&h!==null&&(E=b(j,h));var H=N?{role:"status","aria-live":"assertive"}:{};return ie.createElement("div",EC({className:_,style:T},H),ie.createElement("p",{className:R,style:A},ie.isValidElement(E)?E:"".concat(E)),k())};function Lm(e){"@babel/helpers - typeof";return Lm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Lm(e)}function kx(e,t,n){return t=fxe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function fxe(e){var t=mxe(e,"string");return Lm(t)=="symbol"?t:t+""}function mxe(e,t){if(Lm(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Lm(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Ff="recharts-tooltip-wrapper",hxe={visibility:"hidden"};function pxe(e){var t=e.coordinate,n=e.translateX,r=e.translateY;return yt(Ff,kx(kx(kx(kx({},"".concat(Ff,"-right"),Ie(n)&&t&&Ie(t.x)&&n>=t.x),"".concat(Ff,"-left"),Ie(n)&&t&&Ie(t.x)&&n<t.x),"".concat(Ff,"-bottom"),Ie(r)&&t&&Ie(t.y)&&r>=t.y),"".concat(Ff,"-top"),Ie(r)&&t&&Ie(t.y)&&r<t.y))}function T$(e){var t=e.allowEscapeViewBox,n=e.coordinate,r=e.key,s=e.offsetTopLeft,i=e.position,l=e.reverseDirection,u=e.tooltipDimension,d=e.viewBox,f=e.viewBoxDimension;if(i&&Ie(i[r]))return i[r];var h=n[r]-u-s,p=n[r]+s;if(t[r])return l[r]?h:p;if(l[r]){var x=h,y=d[r];return x<y?Math.max(p,d[r]):Math.max(h,d[r])}var w=p+u,j=d[r]+f;return w>j?Math.max(h,d[r]):Math.max(p,d[r])}function xxe(e){var t=e.translateX,n=e.translateY,r=e.useTranslate3d;return{transform:r?"translate3d(".concat(t,"px, ").concat(n,"px, 0)"):"translate(".concat(t,"px, ").concat(n,"px)")}}function gxe(e){var t=e.allowEscapeViewBox,n=e.coordinate,r=e.offsetTopLeft,s=e.position,i=e.reverseDirection,l=e.tooltipBox,u=e.useTranslate3d,d=e.viewBox,f,h,p;return l.height>0&&l.width>0&&n?(h=T$({allowEscapeViewBox:t,coordinate:n,key:"x",offsetTopLeft:r,position:s,reverseDirection:i,tooltipDimension:l.width,viewBox:d,viewBoxDimension:d.width}),p=T$({allowEscapeViewBox:t,coordinate:n,key:"y",offsetTopLeft:r,position:s,reverseDirection:i,tooltipDimension:l.height,viewBox:d,viewBoxDimension:d.height}),f=xxe({translateX:h,translateY:p,useTranslate3d:u})):f=hxe,{cssProperties:f,cssClasses:pxe({translateX:h,translateY:p,coordinate:n})}}function zu(e){"@babel/helpers - typeof";return zu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},zu(e)}function k$(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function O$(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?k$(Object(n),!0).forEach(function(r){MC(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):k$(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function yxe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function vxe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,e7(r.key),r)}}function bxe(e,t,n){return t&&vxe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function jxe(e,t,n){return t=ay(t),wxe(e,JU()?Reflect.construct(t,n||[],ay(e).constructor):t.apply(e,n))}function wxe(e,t){if(t&&(zu(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Nxe(e)}function Nxe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function JU(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(JU=function(){return!!e})()}function ay(e){return ay=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},ay(e)}function Sxe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&_C(e,t)}function _C(e,t){return _C=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},_C(e,t)}function MC(e,t,n){return t=e7(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function e7(e){var t=Cxe(e,"string");return zu(t)=="symbol"?t:t+""}function Cxe(e,t){if(zu(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(zu(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var P$=1,Axe=(function(e){function t(){var n;yxe(this,t);for(var r=arguments.length,s=new Array(r),i=0;i<r;i++)s[i]=arguments[i];return n=jxe(this,t,[].concat(s)),MC(n,"state",{dismissed:!1,dismissedAtCoordinate:{x:0,y:0},lastBoundingBox:{width:-1,height:-1}}),MC(n,"handleKeyDown",function(l){if(l.key==="Escape"){var u,d,f,h;n.setState({dismissed:!0,dismissedAtCoordinate:{x:(u=(d=n.props.coordinate)===null||d===void 0?void 0:d.x)!==null&&u!==void 0?u:0,y:(f=(h=n.props.coordinate)===null||h===void 0?void 0:h.y)!==null&&f!==void 0?f:0}})}}),n}return Sxe(t,e),bxe(t,[{key:"updateBBox",value:function(){if(this.wrapperNode&&this.wrapperNode.getBoundingClientRect){var r=this.wrapperNode.getBoundingClientRect();(Math.abs(r.width-this.state.lastBoundingBox.width)>P$||Math.abs(r.height-this.state.lastBoundingBox.height)>P$)&&this.setState({lastBoundingBox:{width:r.width,height:r.height}})}else(this.state.lastBoundingBox.width!==-1||this.state.lastBoundingBox.height!==-1)&&this.setState({lastBoundingBox:{width:-1,height:-1}})}},{key:"componentDidMount",value:function(){document.addEventListener("keydown",this.handleKeyDown),this.updateBBox()}},{key:"componentWillUnmount",value:function(){document.removeEventListener("keydown",this.handleKeyDown)}},{key:"componentDidUpdate",value:function(){var r,s;this.props.active&&this.updateBBox(),this.state.dismissed&&(((r=this.props.coordinate)===null||r===void 0?void 0:r.x)!==this.state.dismissedAtCoordinate.x||((s=this.props.coordinate)===null||s===void 0?void 0:s.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}},{key:"render",value:function(){var r=this,s=this.props,i=s.active,l=s.allowEscapeViewBox,u=s.animationDuration,d=s.animationEasing,f=s.children,h=s.coordinate,p=s.hasPayload,x=s.isAnimationActive,y=s.offset,w=s.position,j=s.reverseDirection,b=s.useTranslate3d,C=s.viewBox,N=s.wrapperStyle,k=gxe({allowEscapeViewBox:l,coordinate:h,offsetTopLeft:y,position:w,reverseDirection:j,tooltipBox:this.state.lastBoundingBox,useTranslate3d:b,viewBox:C}),T=k.cssClasses,A=k.cssProperties,P=O$(O$({transition:x&&i?"transform ".concat(u,"ms ").concat(d):void 0},A),{},{pointerEvents:"none",visibility:!this.state.dismissed&&i&&p?"visible":"hidden",position:"absolute",top:0,left:0},N);return ie.createElement("div",{tabIndex:-1,className:T,style:P,ref:function(_){r.wrapperNode=_}},f)}}])})(v.PureComponent),Txe=function(){return!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout)},Td={isSsr:Txe()};function Uu(e){"@babel/helpers - typeof";return Uu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Uu(e)}function E$(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function _$(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?E$(Object(n),!0).forEach(function(r){Rk(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):E$(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function kxe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Oxe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,n7(r.key),r)}}function Pxe(e,t,n){return t&&Oxe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Exe(e,t,n){return t=sy(t),_xe(e,t7()?Reflect.construct(t,n||[],sy(e).constructor):t.apply(e,n))}function _xe(e,t){if(t&&(Uu(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Mxe(e)}function Mxe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function t7(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(t7=function(){return!!e})()}function sy(e){return sy=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},sy(e)}function Rxe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&RC(e,t)}function RC(e,t){return RC=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},RC(e,t)}function Rk(e,t,n){return t=n7(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function n7(e){var t=Dxe(e,"string");return Uu(t)=="symbol"?t:t+""}function Dxe(e,t){if(Uu(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Uu(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function $xe(e){return e.dataKey}function Ixe(e,t){return ie.isValidElement(e)?ie.cloneElement(e,t):typeof e=="function"?ie.createElement(e,t):ie.createElement(dxe,t)}var Xa=(function(e){function t(){return kxe(this,t),Exe(this,t,arguments)}return Rxe(t,e),Pxe(t,[{key:"render",value:function(){var r=this,s=this.props,i=s.active,l=s.allowEscapeViewBox,u=s.animationDuration,d=s.animationEasing,f=s.content,h=s.coordinate,p=s.filterNull,x=s.isAnimationActive,y=s.offset,w=s.payload,j=s.payloadUniqBy,b=s.position,C=s.reverseDirection,N=s.useTranslate3d,k=s.viewBox,T=s.wrapperStyle,A=w??[];p&&A.length&&(A=GU(w.filter(function(E){return E.value!=null&&(E.hide!==!0||r.props.includeHidden)}),j,$xe));var P=A.length>0;return ie.createElement(Axe,{allowEscapeViewBox:l,animationDuration:u,animationEasing:d,isAnimationActive:x,active:i,coordinate:h,hasPayload:P,offset:y,position:b,reverseDirection:C,useTranslate3d:N,viewBox:k,wrapperStyle:T},Ixe(f,_$(_$({},this.props),{},{payload:A})))}}])})(v.PureComponent);Rk(Xa,"displayName","Tooltip");Rk(Xa,"defaultProps",{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!Td.isSsr,itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:" : ",trigger:"hover",useTranslate3d:!1,viewBox:{x:0,y:0,height:0,width:0},wrapperStyle:{}});var rS,M$;function Lxe(){if(M$)return rS;M$=1;var e=Ls(),t=function(){return e.Date.now()};return rS=t,rS}var aS,R$;function Fxe(){if(R$)return aS;R$=1;var e=/\s/;function t(n){for(var r=n.length;r--&&e.test(n.charAt(r)););return r}return aS=t,aS}var sS,D$;function qxe(){if(D$)return sS;D$=1;var e=Fxe(),t=/^\s+/;function n(r){return r&&r.slice(0,e(r)+1).replace(t,"")}return sS=n,sS}var iS,$$;function r7(){if($$)return iS;$$=1;var e=qxe(),t=Ho(),n=Sd(),r=NaN,s=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,l=/^0o[0-7]+$/i,u=parseInt;function d(f){if(typeof f=="number")return f;if(n(f))return r;if(t(f)){var h=typeof f.valueOf=="function"?f.valueOf():f;f=t(h)?h+"":h}if(typeof f!="string")return f===0?f:+f;f=e(f);var p=i.test(f);return p||l.test(f)?u(f.slice(2),p?2:8):s.test(f)?r:+f}return iS=d,iS}var oS,I$;function Bxe(){if(I$)return oS;I$=1;var e=Ho(),t=Lxe(),n=r7(),r="Expected a function",s=Math.max,i=Math.min;function l(u,d,f){var h,p,x,y,w,j,b=0,C=!1,N=!1,k=!0;if(typeof u!="function")throw new TypeError(r);d=n(d)||0,e(f)&&(C=!!f.leading,N="maxWait"in f,x=N?s(n(f.maxWait)||0,d):x,k="trailing"in f?!!f.trailing:k);function T(W){var U=h,V=p;return h=p=void 0,b=W,y=u.apply(V,U),y}function A(W){return b=W,w=setTimeout(_,d),C?T(W):y}function P(W){var U=W-j,V=W-b,D=d-U;return N?i(D,x-V):D}function E(W){var U=W-j,V=W-b;return j===void 0||U>=d||U<0||N&&V>=x}function _(){var W=t();if(E(W))return R(W);w=setTimeout(_,P(W))}function R(W){return w=void 0,k&&h?T(W):(h=p=void 0,y)}function H(){w!==void 0&&clearTimeout(w),b=0,h=j=p=w=void 0}function L(){return w===void 0?y:R(t())}function I(){var W=t(),U=E(W);if(h=arguments,p=this,j=W,U){if(w===void 0)return A(j);if(N)return clearTimeout(w),w=setTimeout(_,d),T(j)}return w===void 0&&(w=setTimeout(_,d)),y}return I.cancel=H,I.flush=L,I}return oS=l,oS}var lS,L$;function zxe(){if(L$)return lS;L$=1;var e=Bxe(),t=Ho(),n="Expected a function";function r(s,i,l){var u=!0,d=!0;if(typeof s!="function")throw new TypeError(n);return t(l)&&(u="leading"in l?!!l.leading:u,d="trailing"in l?!!l.trailing:d),e(s,i,{leading:u,maxWait:i,trailing:d})}return lS=r,lS}var Uxe=zxe();const a7=Bt(Uxe);function Fm(e){"@babel/helpers - typeof";return Fm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Fm(e)}function F$(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function Ox(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?F$(Object(n),!0).forEach(function(r){Hxe(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):F$(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Hxe(e,t,n){return t=Vxe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Vxe(e){var t=Gxe(e,"string");return Fm(t)=="symbol"?t:t+""}function Gxe(e,t){if(Fm(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Fm(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Kxe(e,t){return Qxe(e)||Xxe(e,t)||Yxe(e,t)||Wxe()}function Wxe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
24In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Yxe(e,t){if(e){if(typeof e=="string")return q$(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return q$(e,t)}}function q$(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Xxe(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,s,i,l,u=[],d=!0,f=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(d=(r=i.call(n)).done)&&(u.push(r.value),u.length!==t);d=!0);}catch(h){f=!0,s=h}finally{try{if(!d&&n.return!=null&&(l=n.return(),Object(l)!==l))return}finally{if(f)throw s}}return u}}function Qxe(e){if(Array.isArray(e))return e}var B$=v.forwardRef(function(e,t){var n=e.aspect,r=e.initialDimension,s=r===void 0?{width:-1,height:-1}:r,i=e.width,l=i===void 0?"100%":i,u=e.height,d=u===void 0?"100%":u,f=e.minWidth,h=f===void 0?0:f,p=e.minHeight,x=e.maxHeight,y=e.children,w=e.debounce,j=w===void 0?0:w,b=e.id,C=e.className,N=e.onResize,k=e.style,T=k===void 0?{}:k,A=v.useRef(null),P=v.useRef();P.current=N,v.useImperativeHandle(t,function(){return Object.defineProperty(A.current,"current",{get:function(){return console.warn("The usage of ref.current.current is deprecated and will no longer be supported."),A.current},configurable:!0})});var E=v.useState({containerWidth:s.width,containerHeight:s.height}),_=Kxe(E,2),R=_[0],H=_[1],L=v.useCallback(function(W,U){H(function(V){var D=Math.round(W),q=Math.round(U);return V.containerWidth===D&&V.containerHeight===q?V:{containerWidth:D,containerHeight:q}})},[]);v.useEffect(function(){var W=function(Y){var z,Z=Y[0].contentRect,F=Z.width,B=Z.height;L(F,B),(z=P.current)===null||z===void 0||z.call(P,F,B)};j>0&&(W=a7(W,j,{trailing:!0,leading:!1}));var U=new ResizeObserver(W),V=A.current.getBoundingClientRect(),D=V.width,q=V.height;return L(D,q),U.observe(A.current),function(){U.disconnect()}},[L,j]);var I=v.useMemo(function(){var W=R.containerWidth,U=R.containerHeight;if(W<0||U<0)return null;wi(Rl(l)||Rl(d),`The width(%s) and height(%s) are both fixed numbers,
25       maybe you don't need to use a ResponsiveContainer.`,l,d),wi(!n||n>0,"The aspect(%s) must be greater than zero.",n);var V=Rl(l)?W:l,D=Rl(d)?U:d;n&&n>0&&(V?D=V/n:D&&(V=D*n),x&&D>x&&(D=x)),wi(V>0||D>0,`The width(%s) and height(%s) of chart should be greater than 0,
26       please check the style of container, or the props width(%s) and height(%s),
27       or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the
28       height and width.`,V,D,l,d,h,p,n);var q=!Array.isArray(y)&&ji(y.type).endsWith("Chart");return ie.Children.map(y,function(K){return ie.isValidElement(K)?v.cloneElement(K,Ox({width:V,height:D},q?{style:Ox({height:"100%",width:"100%",maxHeight:D,maxWidth:V},K.props.style)}:{})):K})},[n,y,d,x,p,h,R,l]);return ie.createElement("div",{id:b?"".concat(b):void 0,className:yt("recharts-responsive-container",C),style:Ox(Ox({},T),{},{width:l,height:d,minWidth:h,minHeight:p,maxHeight:x}),ref:A},I)}),s7=function(t){return null};s7.displayName="Cell";function qm(e){"@babel/helpers - typeof";return qm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},qm(e)}function z$(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function DC(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?z$(Object(n),!0).forEach(function(r){Zxe(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):z$(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Zxe(e,t,n){return t=Jxe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Jxe(e){var t=ege(e,"string");return qm(t)=="symbol"?t:t+""}function ege(e,t){if(qm(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(qm(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var ru={widthCache:{},cacheCount:0},tge=2e3,nge={position:"absolute",top:"-20000px",left:0,padding:0,margin:0,border:"none",whiteSpace:"pre"},U$="recharts_measurement_span";function rge(e){var t=DC({},e);return Object.keys(t).forEach(function(n){t[n]||delete t[n]}),t}var vm=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(t==null||Td.isSsr)return{width:0,height:0};var r=rge(n),s=JSON.stringify({text:t,copyStyle:r});if(ru.widthCache[s])return ru.widthCache[s];try{var i=document.getElementById(U$);i||(i=document.createElement("span"),i.setAttribute("id",U$),i.setAttribute("aria-hidden","true"),document.body.appendChild(i));var l=DC(DC({},nge),r);Object.assign(i.style,l),i.textContent="".concat(t);var u=i.getBoundingClientRect(),d={width:u.width,height:u.height};return ru.widthCache[s]=d,++ru.cacheCount>tge&&(ru.cacheCount=0,ru.widthCache={}),d}catch{return{width:0,height:0}}},age=function(t){return{top:t.top+window.scrollY-document.documentElement.clientTop,left:t.left+window.scrollX-document.documentElement.clientLeft}};function Bm(e){"@babel/helpers - typeof";return Bm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Bm(e)}function iy(e,t){return lge(e)||oge(e,t)||ige(e,t)||sge()}function sge(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
29In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ige(e,t){if(e){if(typeof e=="string")return H$(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return H$(e,t)}}function H$(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function oge(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,s,i,l,u=[],d=!0,f=!1;try{if(i=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;d=!1}else for(;!(d=(r=i.call(n)).done)&&(u.push(r.value),u.length!==t);d=!0);}catch(h){f=!0,s=h}finally{try{if(!d&&n.return!=null&&(l=n.return(),Object(l)!==l))return}finally{if(f)throw s}}return u}}function lge(e){if(Array.isArray(e))return e}function cge(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function V$(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,dge(r.key),r)}}function uge(e,t,n){return t&&V$(e.prototype,t),n&&V$(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function dge(e){var t=fge(e,"string");return Bm(t)=="symbol"?t:t+""}function fge(e,t){if(Bm(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Bm(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var G$=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,K$=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,mge=/^px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q$/,hge=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,i7={cm:96/2.54,mm:96/25.4,pt:96/72,pc:96/6,in:96,Q:96/(2.54*40),px:1},pge=Object.keys(i7),wu="NaN";function xge(e,t){return e*i7[t]}var Px=(function(){function e(t,n){cge(this,e),this.num=t,this.unit=n,this.num=t,this.unit=n,Number.isNaN(t)&&(this.unit=""),n!==""&&!mge.test(n)&&(this.num=NaN,this.unit=""),pge.includes(n)&&(this.num=xge(t,n),this.unit="px")}return uge(e,[{key:"add",value:function(n){return this.unit!==n.unit?new e(NaN,""):new e(this.num+n.num,this.unit)}},{key:"subtract",value:function(n){return this.unit!==n.unit?new e(NaN,""):new e(this.num-n.num,this.unit)}},{key:"multiply",value:function(n){return this.unit!==""&&n.unit!==""&&this.unit!==n.unit?new e(NaN,""):new e(this.num*n.num,this.unit||n.unit)}},{key:"divide",value:function(n){return this.unit!==""&&n.unit!==""&&this.unit!==n.unit?new e(NaN,""):new e(this.num/n.num,this.unit||n.unit)}},{key:"toString",value:function(){return"".concat(this.num).concat(this.unit)}},{key:"isNaN",value:function(){return Number.isNaN(this.num)}}],[{key:"parse",value:function(n){var r,s=(r=hge.exec(n))!==null&&r!==void 0?r:[],i=iy(s,3),l=i[1],u=i[2];return new e(parseFloat(l),u??"")}}])})();function o7(e){if(e.includes(wu))return wu;for(var t=e;t.includes("*")||t.includes("/");){var n,r=(n=G$.exec(t))!==null&&n!==void 0?n:[],s=iy(r,4),i=s[1],l=s[2],u=s[3],d=Px.parse(i??""),f=Px.parse(u??""),h=l==="*"?d.multiply(f):d.divide(f);if(h.isNaN())return wu;t=t.replace(G$,h.toString())}for(;t.includes("+")||/.-\d+(?:\.\d+)?/.test(t);){var p,x=(p=K$.exec(t))!==null&&p!==void 0?p:[],y=iy(x,4),w=y[1],j=y[2],b=y[3],C=Px.parse(w??""),N=Px.parse(b??""),k=j==="+"?C.add(N):C.subtract(N);if(k.isNaN())return wu;t=t.replace(K$,k.toString())}return t}var W$=/\(([^()]*)\)/;function gge(e){for(var t=e;t.includes("(");){var n=W$.exec(t),r=iy(n,2),s=r[1];t=t.replace(W$,o7(s))}return t}function yge(e){var t=e.replace(/\s+/g,"");return t=gge(t),t=o7(t),t}function vge(e){try{return yge(e)}catch{return wu}}function cS(e){var t=vge(e.slice(5,-1));return t===wu?"":t}var bge=["x","y","lineHeight","capHeight","scaleToFit","textAnchor","verticalAnchor","fill"],jge=["dx","dy","angle","className","breakAll"];function $C(){return $C=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},$C.apply(this,arguments)}function Y$(e,t){if(e==null)return{};var n=wge(e,t),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)r=i[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function wge(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function X$(e,t){return Age(e)||Cge(e,t)||Sge(e,t)||Nge()}function Nge(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
30In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Sge(e,t){if(e){if(typeof e=="string")return Q$(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Q$(e,t)}}function Q$(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Cge(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,s,i,l,u=[],d=!0,f=!1;try{if(i=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;d=!1}else for(;!(d=(r=i.call(n)).done)&&(u.push(r.value),u.length!==t);d=!0);}catch(h){f=!0,s=h}finally{try{if(!d&&n.return!=null&&(l=n.return(),Object(l)!==l))return}finally{if(f)throw s}}return u}}function Age(e){if(Array.isArray(e))return e}var l7=/[ \f\n\r\t\v\u2028\u2029]+/,c7=function(t){var n=t.children,r=t.breakAll,s=t.style;try{var i=[];pt(n)||(r?i=n.toString().split(""):i=n.toString().split(l7));var l=i.map(function(d){return{word:d,width:vm(d,s).width}}),u=r?0:vm(" ",s).width;
30return{wordsWithComputedWidth:l,spaceWidth:u}}catch{return null}},Tge=function(t,n,r,s,i){var l=t.maxLines,u=t.children,d=t.style,f=t.breakAll,h=Ie(l),p=u,x=function(){var V=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return V.reduce(function(D,q){var K=q.word,Y=q.width,z=D[D.length-1];if(z&&(s==null||i||z.width+Y+r<Number(s)))z.words.push(K),z.width+=Y+r;else{var Z={words:[K],width:Y};D.push(Z)}return D},[])},y=x(n),w=function(V){return V.reduce(function(D,q){return D.width>q.width?D:q})};if(!h)return y;for(var j="…",b=function(V){var D=p.slice(0,V),q=c7({breakAll:f,style:d,children:D+j}).wordsWithComputedWidth,K=x(q),Y=K.length>l||w(K).width>Number(s);return[Y,K]},C=0,N=p.length-1,k=0,T;C<=N&&k<=p.length-1;){var A=Math.floor((C+N)/2),P=A-1,E=b(P),_=X$(E,2),R=_[0],H=_[1],L=b(A),I=X$(L,1),W=I[0];if(!R&&!W&&(C=A+1),R&&W&&(N=A-1),!R&&W){T=H;break}k++}return T||y},Z$=function(t){var n=pt(t)?[]:t.toString().split(l7);return[{words:n}]},kge=function(t){var n=t.width,r=t.scaleToFit,s=t.children,i=t.style,l=t.breakAll,u=t.maxLines;if((n||r)&&!Td.isSsr){var d,f,h=c7({breakAll:l,children:s,style:i});if(h){var p=h.wordsWithComputedWidth,x=h.spaceWidth;d=p,f=x}else return Z$(s);return Tge({breakAll:l,children:s,maxLines:u,style:i},d,f,n,r)}return Z$(s)},J$="#808080",oy=function(t){var n=t.x,r=n===void 0?0:n,s=t.y,i=s===void 0?0:s,l=t.lineHeight,u=l===void 0?"1em":l,d=t.capHeight,f=d===void 0?"0.71em":d,h=t.scaleToFit,p=h===void 0?!1:h,x=t.textAnchor,y=x===void 0?"start":x,w=t.verticalAnchor,j=w===void 0?"end":w,b=t.fill,C=b===void 0?J$:b,N=Y$(t,bge),k=v.useMemo(function(){return kge({breakAll:N.breakAll,children:N.children,maxLines:N.maxLines,scaleToFit:p,style:N.style,width:N.width})},[N.breakAll,N.children,N.maxLines,p,N.style,N.width]),T=N.dx,A=N.dy,P=N.angle,E=N.className,_=N.breakAll,R=Y$(N,jge);if(!Mn(r)||!Mn(i))return null;var H=r+(Ie(T)?T:0),L=i+(Ie(A)?A:0),I;switch(j){case"start":I=cS("calc(".concat(f,")"));break;case"middle":I=cS("calc(".concat((k.length-1)/2," * -").concat(u," + (").concat(f," / 2))"));break;default:I=cS("calc(".concat(k.length-1," * -").concat(u,")"));break}var W=[];if(p){var U=k[0].width,V=N.width;W.push("scale(".concat((Ie(V)?V/U:1)/U,")"))}return P&&W.push("rotate(".concat(P,", ").concat(H,", ").concat(L,")")),W.length&&(R.transform=W.join(" ")),ie.createElement("text",$C({},gt(R,!0),{x:H,y:L,className:yt("recharts-text",E),textAnchor:y,fill:C.includes("url")?J$:C}),k.map(function(D,q){var K=D.words.join(_?"":" ");return ie.createElement("tspan",{x:H,dy:q===0?I:u,key:"".concat(K,"-").concat(q)},K)}))};function Eo(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function Oge(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function Dk(e){let t,n,r;e.length!==2?(t=Eo,n=(u,d)=>Eo(e(u),d),r=(u,d)=>e(u)-d):(t=e===Eo||e===Oge?e:Pge,n=e,r=e);function s(u,d,f=0,h=u.length){if(f<h){if(t(d,d)!==0)return h;do{const p=f+h>>>1;n(u[p],d)<0?f=p+1:h=p}while(f<h)}return f}function i(u,d,f=0,h=u.length){if(f<h){if(t(d,d)!==0)return h;do{const p=f+h>>>1;n(u[p],d)<=0?f=p+1:h=p}while(f<h)}return f}function l(u,d,f=0,h=u.length){const p=s(u,d,f,h-1);return p>f&&r(u[p-1],d)>-r(u[p],d)?p-1:p}return{left:s,center:l,right:i}}function Pge(){return 0}function u7(e){return e===null?NaN:+e}function*Ege(e,t){for(let n of e)n!=null&&(n=+n)>=n&&(yield n)}const _ge=Dk(Eo),Lh=_ge.right;Dk(u7).center;class eI extends Map{constructor(t,n=Dge){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),t!=null)for(const[r,s]of t)this.set(r,s)}get(t){return super.get(tI(this,t))}has(t){return super.has(tI(this,t))}set(t,n){return super.set(Mge(this,t),n)}delete(t){return super.delete(Rge(this,t))}}function tI({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):n}function Mge({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function Rge({_intern:e,_key:t},n){const r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function Dge(e){return e!==null&&typeof e=="object"?e.valueOf():e}function $ge(e=Eo){if(e===Eo)return d7;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,n)=>{const r=e(t,n);return r||r===0?r:(e(n,n)===0)-(e(t,t)===0)}}function d7(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(e<t?-1:e>t?1:0)}const Ige=Math.sqrt(50),Lge=Math.sqrt(10),Fge=Math.sqrt(2);
30function ly(e,t,n){const r=(t-e)/Math.max(0,n),s=Math.floor(Math.log10(r)),i=r/Math.pow(10,s),l=i>=Ige?10:i>=Lge?5:i>=Fge?2:1;let u,d,f;return s<0?(f=Math.pow(10,-s)/l,u=Math.round(e*f),d=Math.round(t*f),u/f<e&&++u,d/f>t&&--d,f=-f):(f=Math.pow(10,s)*l,u=Math.round(e/f),d=Math.round(t/f),u*f<e&&++u,d*f>t&&--d),d<u&&.5<=n&&n<2?ly(e,t,n*2):[u,d,f]}function IC(e,t,n){if(t=+t,e=+e,n=+n,!(n>0))return[];if(e===t)return[e];const r=t<e,[s,i,l]=r?ly(t,e,n):ly(e,t,n);if(!(i>=s))return[];const u=i-s+1,d=new Array(u);if(r)if(l<0)for(let f=0;f<u;++f)d[f]=(i-f)/-l;else for(let f=0;f<u;++f)d[f]=(i-f)*l;else if(l<0)for(let f=0;f<u;++f)d[f]=(s+f)/-l;else for(let f=0;f<u;++f)d[f]=(s+f)*l;return d}function LC(e,t,n){return t=+t,e=+e,n=+n,ly(e,t,n)[2]}function FC(e,t,n){t=+t,e=+e,n=+n;const r=t<e,s=r?LC(t,e,n):LC(e,t,n);return(r?-1:1)*(s<0?1/-s:s)}function nI(e,t){let n;for(const r of e)r!=null&&(n<r||n===void 0&&r>=r)&&(n=r);return n}function rI(e,t){let n;for(const r of e)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);return n}function f7(e,t,n=0,r=1/0,s){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(e.length-1,r)),!(n<=t&&t<=r))return e;for(s=s===void 0?d7:$ge(s);r>n;){if(r-n>600){const d=r-n+1,f=t-n+1,h=Math.log(d),p=.5*Math.exp(2*h/3),x=.5*Math.sqrt(h*p*(d-p)/d)*(f-d/2<0?-1:1),y=Math.max(n,Math.floor(t-f*p/d+x)),w=Math.min(r,Math.floor(t+(d-f)*p/d+x));f7(e,t,y,w,s)}const i=e[t];let l=n,u=r;for(qf(e,n,t),s(e[r],i)>0&&qf(e,n,r);l<u;){for(qf(e,l,u),++l,--u;s(e[l],i)<0;)++l;for(;s(e[u],i)>0;)--u}s(e[n],i)===0?qf(e,n,u):(++u,qf(e,u,r)),u<=t&&(n=u+1),t<=u&&(r=u-1)}return e}function qf(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function qge(e,t,n){if(e=Float64Array.from(Ege(e)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return rI(e);if(t>=1)return nI(e);var r,s=(r-1)*t,i=Math.floor(s),l=nI(f7(e,i).subarray(0,i+1)),u=rI(e.subarray(i+1));return l+(u-l)*(s-i)}}function Bge(e,t,n=u7){if(!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return+n(e[0],0,e);if(t>=1)return+n(e[r-1],r-1,e);var r,s=(r-1)*t,i=Math.floor(s),l=+n(e[i],i,e),u=+n(e[i+1],i+1,e);return l+(u-l)*(s-i)}}function zge(e,t,n){e=+e,t=+t,n=(s=arguments.length)<2?(t=e,e=0,1):s<3?1:+n;for(var r=-1,s=Math.max(0,Math.ceil((t-e)/n))|0,i=new Array(s);++r<s;)i[r]=e+r*n;return i}function Ia(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}function Ii(e,t){switch(arguments.length){case 0:break;case 1:{typeof e=="function"?this.interpolator(e):this.range(e);break}default:{this.domain(e),typeof t=="function"?this.interpolator(t):this.range(t);break}}return this}const qC=Symbol("implicit");function $k(){var e=new eI,t=[],n=[],r=qC;function s(i){let l=e.get(i);if(l===void 0){if(r!==qC)return r;e.set(i,l=t.push(i)-1)}return n[l%n.length]}return s.domain=function(i){if(!arguments.length)return t.slice();t=[],e=new eI;for(const l of i)e.has(l)||e.set(l,t.push(l)-1);return s},s.range=function(i){return arguments.length?(n=Array.from(i),s):n.slice()},s.unknown=function(i){return arguments.length?(r=i,s):r},s.copy=function(){return $k(t,n).unknown(r)},Ia.apply(s,arguments),s}function zm(){var e=$k().unknown(void 0),t=e.domain,n=e.range,r=0,s=1,i,l,u=!1,d=0,f=0,h=.5;delete e.unknown;function p(){var x=t().length,y=s<r,w=y?s:r,j=y?r:s;i=(j-w)/Math.max(1,x-d+f*2),u&&(i=Math.floor(i)),w+=(j-w-i*(x-d))*h,l=i*(1-d),u&&(w=Math.round(w),l=Math.round(l));var b=zge(x).map(function(C){return w+i*C});return n(y?b.reverse():b)}return e.domain=function(x){return arguments.length?(t(x),p()):t()},e.range=function(x){return arguments.length?([r,s]=x,r=+r,s=+s,p()):[r,s]},e.rangeRound=function(x){return[r,s]=x,r=+r,s=+s,u=!0,p()},e.bandwidth=function(){return l},e.step=function(){return i},e.round=function(x){return arguments.length?(u=!!x,p()):u},e.padding=function(x){return arguments.length?(d=Math.min(1,f=+x),p()):d},e.paddingInner=function(x){return arguments.length?(d=Math.min(1,x),p()):d},e.paddingOuter=function(x){return arguments.length?(f=+x,p()):f},e.align=function(x){return arguments.length?(h=Math.max(0,Math.min(1,x)),p()):h},e.copy=function(){return zm(t(),[r,s]).round(u).paddingInner(d).paddingOuter(f).align(h)}
vendor: 6,425 bytes, line 30
30,Ia.apply(p(),arguments)}function m7(e){var t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,delete e.paddingOuter,e.copy=function(){return m7(t())},e}function bm(){return m7(zm.apply(null,arguments).paddingInner(1))}function Ik(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function h7(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function Fh(){}var Um=.7,cy=1/Um,Pu="\\s*([+-]?\\d+)\\s*",Hm="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Es="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Uge=/^#([0-9a-f]{3,8})$/,Hge=new RegExp(`^rgb\\(${Pu},${Pu},${Pu}\\)$`),Vge=new RegExp(`^rgb\\(${Es},${Es},${Es}\\)$`),Gge=new RegExp(`^rgba\\(${Pu},${Pu},${Pu},${Hm}\\)$`),Kge=new RegExp(`^rgba\\(${Es},${Es},${Es},${Hm}\\)$`),Wge=new RegExp(`^hsl\\(${Hm},${Es},${Es}\\)$`),Yge=new RegExp(`^hsla\\(${Hm},${Es},${Es},${Hm}\\)$`),aI={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Ik(Fh,Vm,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:sI,formatHex:sI,formatHex8:Xge,formatHsl:Qge,formatRgb:iI,toString:iI});function sI(){return this.rgb().formatHex()}function Xge(){return this.rgb().formatHex8()}function Qge(){return p7(this).formatHsl()}function iI(){return this.rgb().formatRgb()}function Vm(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=Uge.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?oI(t):n===3?new _r(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Ex(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Ex(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=Hge.exec(e))?new _r(t[1],t[2],t[3],1):(t=Vge.exec(e))?new _r(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Gge.exec(e))?Ex(t[1],t[2],t[3],t[4]):(t=Kge.exec(e))?Ex(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Wge.exec(e))?uI(t[1],t[2]/100,t[3]/100,1):(t=Yge.exec(e))?uI(t[1],t[2]/100,t[3]/100,t[4]):aI.hasOwnProperty(e)?oI(aI[e]):e==="transparent"?new _r(NaN,NaN,NaN,0):null}function oI(e){return new _r(e>>16&255,e>>8&255,e&255,1)}function Ex(e,t,n,r){return r<=0&&(e=t=n=NaN),new _r(e,t,n,r)}function Zge(e){return e instanceof Fh||(e=Vm(e)),e?(e=e.rgb(),new _r(e.r,e.g,e.b,e.opacity)):new _r}function BC(e,t,n,r){return arguments.length===1?Zge(e):new _r(e,t,n,r??1)}function _r(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Ik(_r,BC,h7(Fh,{brighter(e){return e=e==null?cy:Math.pow(cy,e),new _r(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Um:Math.pow(Um,e),new _r(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new _r(Fl(this.r),Fl(this.g),Fl(this.b),uy(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:lI,formatHex:lI,formatHex8:Jge,formatRgb:cI,toString:cI}));function lI(){return`#${Dl(this.r)}${Dl(this.g)}${Dl(this.b)}`}function Jge(){return`#${Dl(this.r)}${Dl(this.g)}${Dl(this.b)}${Dl((isNaN(this.opacity)?1:this.opacity)*255)}`}function cI(){const e=uy(this.opacity);return`${e===1?"rgb(":"rgba("}${Fl(this.r)}, ${Fl(this.g)}, ${Fl(this.b)}${e===1?")":`, ${e})`}`}function uy(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Fl(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Dl(e){return e=Fl(e),(e<16?"0":"")+e.toString(16)}function uI(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new ts(e,t,n,r)}function p7(e){if(e instanceof ts)return new ts(e.h,e.s,e.l,e.opacity);if(e instanceof Fh||(e=Vm(e)),!e)return new ts;if(e instanceof ts)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,s=Math.min(t,n,r),i=Math.max(t,n,r),l=NaN,u=i-s,d=(i+s)/2;return u?(t===i?l=(n-r)/u+(n<r)*6:n===i?l=(r-t)/u+2:l=(t-n)/u+4,u/=d<.5?i+s:2-i-s,l*=60):u
vendor: 5,235 bytes, line 30
30=d>0&&d<1?0:l,new ts(l,u,d,e.opacity)}function eye(e,t,n,r){return arguments.length===1?p7(e):new ts(e,t,n,r??1)}function ts(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Ik(ts,eye,h7(Fh,{brighter(e){return e=e==null?cy:Math.pow(cy,e),new ts(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Um:Math.pow(Um,e),new ts(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,s=2*n-r;return new _r(uS(e>=240?e-240:e+120,s,r),uS(e,s,r),uS(e<120?e+240:e-120,s,r),this.opacity)},clamp(){return new ts(dI(this.h),_x(this.s),_x(this.l),uy(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=uy(this.opacity);return`${e===1?"hsl(":"hsla("}${dI(this.h)}, ${_x(this.s)*100}%, ${_x(this.l)*100}%${e===1?")":`, ${e})`}`}}));function dI(e){return e=(e||0)%360,e<0?e+360:e}function _x(e){return Math.max(0,Math.min(1,e||0))}function uS(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const Lk=e=>()=>e;function tye(e,t){return function(n){return e+n*t}}function nye(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function rye(e){return(e=+e)==1?x7:function(t,n){return n-t?nye(t,n,e):Lk(isNaN(t)?n:t)}}function x7(e,t){var n=t-e;return n?tye(e,n):Lk(isNaN(e)?t:e)}const fI=(function e(t){var n=rye(t);function r(s,i){var l=n((s=BC(s)).r,(i=BC(i)).r),u=n(s.g,i.g),d=n(s.b,i.b),f=x7(s.opacity,i.opacity);return function(h){return s.r=l(h),s.g=u(h),s.b=d(h),s.opacity=f(h),s+""}}return r.gamma=e,r})(1);function aye(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),s;return function(i){for(s=0;s<n;++s)r[s]=e[s]*(1-i)+t[s]*i;return r}}function sye(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function iye(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,s=new Array(r),i=new Array(n),l;for(l=0;l<r;++l)s[l]=kd(e[l],t[l]);for(;l<n;++l)i[l]=t[l];return function(u){for(l=0;l<r;++l)i[l]=s[l](u);return i}}function oye(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function dy(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function lye(e,t){var n={},r={},s;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(s in t)s in e?n[s]=kd(e[s],t[s]):r[s]=t[s];return function(i){for(s in n)r[s]=n[s](i);return r}}var zC=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,dS=new RegExp(zC.source,"g");function cye(e){return function(){return e}}function uye(e){return function(t){return e(t)+""}}function dye(e,t){var n=zC.lastIndex=dS.lastIndex=0,r,s,i,l=-1,u=[],d=[];for(e=e+"",t=t+"";(r=zC.exec(e))&&(s=dS.exec(t));)(i=s.index)>n&&(i=t.slice(n,i),u[l]?u[l]+=i:u[++l]=i),(r=r[0])===(s=s[0])?u[l]?u[l]+=s:u[++l]=s:(u[++l]=null,d.push({i:l,x:dy(r,s)})),n=dS.lastIndex;return n<t.length&&(i=t.slice(n),u[l]?u[l]+=i:u[++l]=i),u.length<2?d[0]?uye(d[0].x):cye(t):(t=d.length,function(f){for(var h=0,p;h<t;++h)u[(p=d[h]).i]=p.x(f);return u.join("")})}function kd(e,t){var n=typeof t,r;return t==null||n==="boolean"?Lk(t):(n==="number"?dy:n==="string"?(r=Vm(t))?(t=r,fI):dye:t instanceof Vm?fI:t instanceof Date?oye:sye(t)?aye:Array.isArray(t)?iye:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?lye:dy)(e,t)}function Fk(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}function fye(e,t){t===void 0&&(t=e,e=kd);for(var n=0,r=t.length-1,s=t[0],i=new Array(r<0?0:r);n<r;)i[n]=e(s,s=t[++n]);return function(l){var u=Math.max(0,Math.min(r-1,Math.floor(l*=r)));return i[u](l-u)}}function mye(e){return function(){return e}}function fy(e){return+e}var mI=[0,1];function jr(e){return e}function UC(e,t){return(t-=e=+e)?function(n){return(n-e)/t}:mye(isNaN(t)?NaN:.5)}function hye(e,t){var n;return e>t&&(n=e,e=t,t=n),function(r){return Math.max(e,Math.min(t,r))}}function pye(e,t,n){var r=e[0],s=e[1],i=t[0],l=t[1];return s<r?(r=UC(s,r),i=n(l,i)):(r=UC(r,s),i=n(i,l)),function(u){return i(r(u))}}function xye(e,t,n){var r=Math.min(e.length,t.length)-1,s=new Array(r),i=new Array(r),l=-1;for(e[r]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++l<r;)s[l]=UC(e[l],e[l+1]),i[l]=n(t[l],t[l+1]);return function(u){var d=Lh(e,u,1,r)-1;return i[d](s[d](u))}}function qh(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function Rv(){var e=mI,t=mI,n=kd,r,s,i,l=jr,u,d,f;function h(){var x=Math.min(e.length,t.length);return l!==jr&&(l=hye(e[0],e[x-1])),u=x>2?xye:pye,d=f=null,p}function p(x){return x==null||isNaN(x=+x)?i:(d||(d=u(e.map(r),t,n)))(r(l(x)))}return p.invert=function(x){return l(s((f||(f=u(t,e.map(r),dy)))(x)))},p.domain=function(x){return arguments.length?(e=Array.from(x,fy),h()):e.slice()},p.range=function(x){return arguments.length?(t=Array.from(x),h()):t.slice()},p.rangeRound=function(x){return t=Array.from(x),n=Fk,h()},p.clamp=function(x){return arguments.length?(l=x?!0:jr,h()):l!==jr},p.interpolate=function(x){return arguments.length?(n=x,h()):n},p.unknown=function(x){return arguments.length?(i=x,p):i},function(x,y){return r=x,s=y,h()}}function qk(){return Rv()(jr,jr)}
vendor: 4,597 bytes, line 30
30function gye(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function my(e,t){if(!isFinite(e)||e===0)return null;var n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"),r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function Hu(e){return e=my(Math.abs(e)),e?e[1]:NaN}function yye(e,t){return function(n,r){for(var s=n.length,i=[],l=0,u=e[0],d=0;s>0&&u>0&&(d+u+1>r&&(u=Math.max(1,r-d)),i.push(n.substring(s-=u,s+u)),!((d+=u+1)>r));)u=e[l=(l+1)%e.length];return i.reverse().join(t)}}function vye(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var bye=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Gm(e){if(!(t=bye.exec(e)))throw new Error("invalid format: "+e);var t;return new Bk({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]})}Gm.prototype=Bk.prototype;function Bk(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+""}Bk.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 jye(e){e:for(var t=e.length,n=1,r=-1,s;n<t;++n)switch(e[n]){case".":r=s=n;break;case"0":r===0&&(r=n),s=n;break;default:if(!+e[n])break e;r>0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(s+1):e}var hy;function wye(e,t){var n=my(e,t);if(!n)return hy=void 0,e.toPrecision(t);var r=n[0],s=n[1],i=s-(hy=Math.max(-8,Math.min(8,Math.floor(s/3)))*3)+1,l=r.length;return i===l?r:i>l?r+new Array(i-l+1).join("0"):i>0?r.slice(0,i)+"."+r.slice(i):"0."+new Array(1-i).join("0")+my(e,Math.max(0,t+i-1))[0]}function hI(e,t){var n=my(e,t);if(!n)return e+"";var r=n[0],s=n[1];return s<0?"0."+new Array(-s).join("0")+r:r.length>s+1?r.slice(0,s+1)+"."+r.slice(s+1):r+new Array(s-r.length+2).join("0")}const pI={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:gye,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)=>hI(e*100,t),r:hI,s:wye,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function xI(e){return e}var gI=Array.prototype.map,yI=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Nye(e){var t=e.grouping===void 0||e.thousands===void 0?xI:yye(gI.call(e.grouping,Number),e.thousands+""),n=e.currency===void 0?"":e.currency[0]+"",r=e.currency===void 0?"":e.currency[1]+"",s=e.decimal===void 0?".":e.decimal+"",i=e.numerals===void 0?xI:vye(gI.call(e.numerals,String)),l=e.percent===void 0?"%":e.percent+"",u=e.minus===void 0?"−":e.minus+"",d=e.nan===void 0?"NaN":e.nan+"";function f(p,x){p=Gm(p);var y=p.fill,w=p.align,j=p.sign,b=p.symbol,C=p.zero,N=p.width,k=p.comma,T=p.precision,A=p.trim,P=p.type;P==="n"?(k=!0,P="g"):pI[P]||(T===void 0&&(T=12),A=!0,P="g"),(C||y==="0"&&w==="=")&&(C=!0,y="0",w="=");var E=(x&&x.prefix!==void 0?x.prefix:"")+(b==="$"?n:b==="#"&&/[boxX]/.test(P)?"0"+P.toLowerCase():""),_=(b==="$"?r:/[%p]/.test(P)?l:"")+(x&&x.suffix!==void 0?x.suffix:""),R=pI[P],H=/[defgprs%]/.test(P);T=T===void 0?6:/[gprs]/.test(P)?Math.max(1,Math.min(21,T)):Math.max(0,Math.min(20,T));function L(I){var W=E,U=_,V,D,q;if(P==="c")U=R(I)+U,I="";else{I=+I;var K=I<0||1/I<0;if(I=isNaN(I)?d:R(Math.abs(I),T),A&&(I=jye(I)),K&&+I==0&&j!=="+"&&(K=!1),W=(K?j==="("?j:u:j==="-"||j==="("?"":j)+W,U=(P==="s"&&!isNaN(I)&&hy!==void 0?yI[8+hy/3]:"")+U+(K&&j==="("?")":""),H){for(V=-1,D=I.length;++V<D;)if(q=I.charCodeAt(V),48>q||q>57){U=(q===46?s+I.slice(V+1):I.slice(V))+U,I=I.slice(0,V);break}}}k&&!C&&(I=t(I,1/0));var Y=W.length+I.length+U.length,z=Y<N?new Array(N-Y+1).join(y):"";switch(k&&C&&(I=t(z+I,z.length?N-U.length:1/0),z=""),w){case"<":I=W+I+U+z;break;case"=":I=W+z+I+U;break;case"^":I=z.slice(0,Y=z.length>>1)+W+I+U+z.slice(Y);break;default:I=z+W+I+U;break}return i(I)}return L.toString=function(){return p+""},L}function h(p,x){var y=Math.max(-8,Math.min(8,Math.floor(Hu(x)/3)))*3,w=Math.pow(10,-y),j=f((p=Gm(p),p.type="f",p),{suffix:yI[8+y/3]});return function(b){return j(w*b)}}return{format:f,formatPrefix:h}}var Mx,zk,g7;
30Sye({thousands:",",grouping:[3],currency:["$",""]});function Sye(e){return Mx=Nye(e),zk=Mx.format,g7=Mx.formatPrefix,Mx}function Cye(e){return Math.max(0,-Hu(Math.abs(e)))}function Aye(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Hu(t)/3)))*3-Hu(Math.abs(e)))}function Tye(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,Hu(t)-Hu(e))+1}function y7(e,t,n,r){var s=FC(e,t,n),i;switch(r=Gm(r??",f"),r.type){case"s":{var l=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(i=Aye(s,l))&&(r.precision=i),g7(r,l)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(i=Tye(s,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=i-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(i=Cye(s))&&(r.precision=i-(r.type==="%")*2);break}}return zk(r)}function Go(e){var t=e.domain;return e.ticks=function(n){var r=t();return IC(r[0],r[r.length-1],n??10)},e.tickFormat=function(n,r){var s=t();return y7(s[0],s[s.length-1],n??10,r)},e.nice=function(n){n==null&&(n=10);var r=t(),s=0,i=r.length-1,l=r[s],u=r[i],d,f,h=10;for(u<l&&(f=l,l=u,u=f,f=s,s=i,i=f);h-- >0;){if(f=LC(l,u,n),f===d)return r[s]=l,r[i]=u,t(r);if(f>0)l=Math.floor(l/f)*f,u=Math.ceil(u/f)*f;else if(f<0)l=Math.ceil(l*f)/f,u=Math.floor(u*f)/f;else break;d=f}return e},e}function py(){var e=qk();return e.copy=function(){return qh(e,py())},Ia.apply(e,arguments),Go(e)}function v7(e){var t;function n(r){return r==null||isNaN(r=+r)?t:r}return n.invert=n,n.domain=n.range=function(r){return arguments.length?(e=Array.from(r,fy),n):e.slice()},n.unknown=function(r){return arguments.length?(t=r,n):t},n.copy=function(){return v7(e).unknown(t)},e=arguments.length?Array.from(e,fy):[0,1],Go(n)}function b7(e,t){e=e.slice();var n=0,r=e.length-1,s=e[n],i=e[r],l;return i<s&&(l=n,n=r,r=l,l=s,s=i,i=l),e[n]=t.floor(s),e[r]=t.ceil(i),e}function vI(e){return Math.log(e)}function bI(e){return Math.exp(e)}function kye(e){return-Math.log(-e)}function Oye(e){return-Math.exp(-e)}function Pye(e){return isFinite(e)?+("1e"+e):e<0?0:e}function Eye(e){return e===10?Pye:e===Math.E?Math.exp:t=>Math.pow(e,t)}function _ye(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 jI(e){return(t,n)=>-e(-t,n)}function Uk(e){const t=e(vI,bI),n=t.domain;let r=10,s,i;function l(){return s=_ye(r),i=Eye(r),n()[0]<0?(s=jI(s),i=jI(i),e(kye,Oye)):e(vI,bI),t}return t.base=function(u){return arguments.length?(r=+u,l()):r},t.domain=function(u){return arguments.length?(n(u),l()):n()},t.ticks=u=>{const d=n();let f=d[0],h=d[d.length-1];const p=h<f;p&&([f,h]=[h,f]);let x=s(f),y=s(h),w,j;const b=u==null?10:+u;let C=[];if(!(r%1)&&y-x<b){if(x=Math.floor(x),y=Math.ceil(y),f>0){for(;x<=y;++x)for(w=1;w<r;++w)if(j=x<0?w/i(-x):w*i(x),!(j<f)){if(j>h)break;C.push(j)}}else for(;x<=y;++x)for(w=r-1;w>=1;--w)if(j=x>0?w/i(-x):w*i(x),!(j<f)){if(j>h)break;C.push(j)}C.length*2<b&&(C=IC(f,h,b))}else C=IC(x,y,Math.min(y-x,b)).map(i);return p?C.reverse():C},t.tickFormat=(u,d)=>{if(u==null&&(u=10),d==null&&(d=r===10?"s":","),typeof d!="function"&&(!(r%1)&&(d=Gm(d)).precision==null&&(d.trim=!0),d=zk(d)),u===1/0)return d;const f=Math.max(1,r*u/t.ticks().length);return h=>{let p=h/i(Math.round(s(h)));return p*r<r-.5&&(p*=r),p<=f?d(h):""}},t.nice=()=>n(b7(n(),{floor:u=>i(Math.floor(s(u))),ceil:u=>i(Math.ceil(s(u)))})),t}function j7(){const e=Uk(Rv()).domain([1,10]);return e.copy=()=>qh(e,j7()).base(e.base()),Ia.apply(e,arguments),e}function wI(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function NI(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function Hk(e){var t=1,n=e(wI(t),NI(t));return n.constant=function(r){return arguments.length?e(wI(t=+r),NI(t)):t},Go(n)}function w7(){var e=Hk(Rv());return e.copy=function(){return qh(e,w7()).constant(e.constant())},Ia.apply(e,arguments)}function SI(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function Mye(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function Rye(e){return e<0?-e*e:e*e}function Vk(e){var t=e(jr,jr),n=1;function r(){return n===1?e(jr,jr):n===.5?e(Mye,Rye):e(SI(n),SI(1/n))}return t.exponent=function(s){return arguments.length?(n=+s,r()):n},Go(t)}function Gk(){var e=Vk(Rv());return e.copy=function(){return qh(e,Gk()).exponent(e.exponent())},Ia.apply(e,arguments),e}function Dye(){return Gk.apply(null,arguments).exponent(.5)}function CI(e){return Math.sign(e)*e*e}function $ye(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function N7(){var e=qk(),t=[0,1],n=!1,r;function s(i){var l=$ye(e(i));return isNaN(l)?r:n?Math.round(l):l}return s.invert=function(i){return e.invert(CI(i))},s.domain=function(i){return arguments.length?(e.domain(i),s):e.domain()},s.range=function(i){return arguments.length?(e.range((t=Array.from(i,fy)).map(CI)),s):t.slice()}
30,s.rangeRound=function(i){return s.range(i).round(!0)},s.round=function(i){return arguments.length?(n=!!i,s):n},s.clamp=function(i){return arguments.length?(e.clamp(i),s):e.clamp()},s.unknown=function(i){return arguments.length?(r=i,s):r},s.copy=function(){return N7(e.domain(),t).round(n).clamp(e.clamp()).unknown(r)},Ia.apply(s,arguments),Go(s)}function S7(){var e=[],t=[],n=[],r;function s(){var l=0,u=Math.max(1,t.length);for(n=new Array(u-1);++l<u;)n[l-1]=Bge(e,l/u);return i}function i(l){return l==null||isNaN(l=+l)?r:t[Lh(n,l)]}return i.invertExtent=function(l){var u=t.indexOf(l);return u<0?[NaN,NaN]:[u>0?n[u-1]:e[0],u<n.length?n[u]:e[e.length-1]]},i.domain=function(l){if(!arguments.length)return e.slice();e=[];for(let u of l)u!=null&&!isNaN(u=+u)&&e.push(u);return e.sort(Eo),s()},i.range=function(l){return arguments.length?(t=Array.from(l),s()):t.slice()},i.unknown=function(l){return arguments.length?(r=l,i):r},i.quantiles=function(){return n.slice()},i.copy=function(){return S7().domain(e).range(t).unknown(r)},Ia.apply(i,arguments)}function C7(){var e=0,t=1,n=1,r=[.5],s=[0,1],i;function l(d){return d!=null&&d<=d?s[Lh(r,d,0,n)]:i}function u(){var d=-1;for(r=new Array(n);++d<n;)r[d]=((d+1)*t-(d-n)*e)/(n+1);return l}return l.domain=function(d){return arguments.length?([e,t]=d,e=+e,t=+t,u()):[e,t]},l.range=function(d){return arguments.length?(n=(s=Array.from(d)).length-1,u()):s.slice()},l.invertExtent=function(d){var f=s.indexOf(d);return f<0?[NaN,NaN]:f<1?[e,r[0]]:f>=n?[r[n-1],t]:[r[f-1],r[f]]},l.unknown=function(d){return arguments.length&&(i=d),l},l.thresholds=function(){return r.slice()},l.copy=function(){return C7().domain([e,t]).range(s).unknown(i)},Ia.apply(Go(l),arguments)}function A7(){var e=[.5],t=[0,1],n,r=1;function s(i){return i!=null&&i<=i?t[Lh(e,i,0,r)]:n}return s.domain=function(i){return arguments.length?(e=Array.from(i),r=Math.min(e.length,t.length-1),s):e.slice()},s.range=function(i){return arguments.length?(t=Array.from(i),r=Math.min(e.length,t.length-1),s):t.slice()},s.invertExtent=function(i){var l=t.indexOf(i);return[e[l-1],e[l]]},s.unknown=function(i){return arguments.length?(n=i,s):n},s.copy=function(){return A7().domain(e).range(t).unknown(n)},Ia.apply(s,arguments)}const fS=new Date,mS=new Date;function Dn(e,t,n,r){function s(i){return e(i=arguments.length===0?new Date:new Date(+i)),i}return s.floor=i=>(e(i=new Date(+i)),i),s.ceil=i=>(e(i=new Date(i-1)),t(i,1),e(i),i),s.round=i=>{const l=s(i),u=s.ceil(i);return i-l<u-i?l:u},s.offset=(i,l)=>(t(i=new Date(+i),l==null?1:Math.floor(l)),i),s.range=(i,l,u)=>{const d=[];if(i=s.ceil(i),u=u==null?1:Math.floor(u),!(i<l)||!(u>0))return d;let f;do d.push(f=new Date(+i)),t(i,u),e(i);while(f<i&&i<l);return d},s.filter=i=>Dn(l=>{if(l>=l)for(;e(l),!i(l);)l.setTime(l-1)},(l,u)=>{if(l>=l)if(u<0)for(;++u<=0;)for(;t(l,-1),!i(l););else for(;--u>=0;)for(;t(l,1),!i(l););}),n&&(s.count=(i,l)=>(fS.setTime(+i),mS.setTime(+l),e(fS),e(mS),Math.floor(n(fS,mS))),s.every=i=>(i=Math.floor(i),!isFinite(i)||!(i>0)?null:i>1?s.filter(r?l=>r(l)%i===0:l=>s.count(0,l)%i===0):s)),s}const xy=Dn(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);xy.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?Dn(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):xy);xy.range;const gi=1e3,ka=gi*60,yi=ka*60,Pi=yi*24,Kk=Pi*7,AI=Pi*30,hS=Pi*365,$l=Dn(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*gi)},(e,t)=>(t-e)/gi,e=>e.getUTCSeconds());$l.range;const Wk=Dn(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*gi)},(e,t)=>{e.setTime(+e+t*ka)},(e,t)=>(t-e)/ka,e=>e.getMinutes());Wk.range;const Yk=Dn(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*ka)},(e,t)=>(t-e)/ka,e=>e.getUTCMinutes());Yk.range;const Xk=Dn(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*gi-e.getMinutes()*ka)},(e,t)=>{e.setTime(+e+t*yi)},(e,t)=>(t-e)/yi,e=>e.getHours());Xk.range;const Qk=Dn(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*yi)},(e,t)=>(t-e)/yi,e=>e.getUTCHours());Qk.range;const Bh=Dn(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*ka)/Pi,e=>e.getDate()-1);Bh.range;const Dv=Dn(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Pi,e=>e.getUTCDate()-1);Dv.range;const T7=Dn(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Pi,e=>Math.floor(e/Pi));T7.range;function lc(e){return Dn(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,n)=>{t.setDate(t.getDate()+n*7)},(t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*ka)/Kk)}
vendor: 7,193 bytes, line 30
30const $v=lc(0),gy=lc(1),Iye=lc(2),Lye=lc(3),Vu=lc(4),Fye=lc(5),qye=lc(6);$v.range;gy.range;Iye.range;Lye.range;Vu.range;Fye.range;qye.range;function cc(e){return Dn(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCDate(t.getUTCDate()+n*7)},(t,n)=>(n-t)/Kk)}const Iv=cc(0),yy=cc(1),Bye=cc(2),zye=cc(3),Gu=cc(4),Uye=cc(5),Hye=cc(6);Iv.range;yy.range;Bye.range;zye.range;Gu.range;Uye.range;Hye.range;const Zk=Dn(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());Zk.range;const Jk=Dn(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());Jk.range;const Ei=Dn(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());Ei.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Dn(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)});Ei.range;const _i=Dn(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());_i.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Dn(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)});_i.range;function k7(e,t,n,r,s,i){const l=[[$l,1,gi],[$l,5,5*gi],[$l,15,15*gi],[$l,30,30*gi],[i,1,ka],[i,5,5*ka],[i,15,15*ka],[i,30,30*ka],[s,1,yi],[s,3,3*yi],[s,6,6*yi],[s,12,12*yi],[r,1,Pi],[r,2,2*Pi],[n,1,Kk],[t,1,AI],[t,3,3*AI],[e,1,hS]];function u(f,h,p){const x=h<f;x&&([f,h]=[h,f]);const y=p&&typeof p.range=="function"?p:d(f,h,p),w=y?y.range(f,+h+1):[];return x?w.reverse():w}function d(f,h,p){const x=Math.abs(h-f)/p,y=Dk(([,,b])=>b).right(l,x);if(y===l.length)return e.every(FC(f/hS,h/hS,p));if(y===0)return xy.every(Math.max(FC(f,h,p),1));const[w,j]=l[x/l[y-1][2]<l[y][2]/x?y-1:y];return w.every(j)}return[u,d]}const[Vye,Gye]=k7(_i,Jk,Iv,T7,Qk,Yk),[Kye,Wye]=k7(Ei,Zk,$v,Bh,Xk,Wk);function pS(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function xS(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function Bf(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}function Yye(e){var t=e.dateTime,n=e.date,r=e.time,s=e.periods,i=e.days,l=e.shortDays,u=e.months,d=e.shortMonths,f=zf(s),h=Uf(s),p=zf(i),x=Uf(i),y=zf(l),w=Uf(l),j=zf(u),b=Uf(u),C=zf(d),N=Uf(d),k={a:q,A:K,b:Y,B:z,c:null,d:_I,e:_I,f:yve,g:kve,G:Pve,H:pve,I:xve,j:gve,L:O7,m:vve,M:bve,p:Z,q:F,Q:DI,s:$I,S:jve,u:wve,U:Nve,V:Sve,w:Cve,W:Ave,x:null,X:null,y:Tve,Y:Ove,Z:Eve,"%":RI},T={a:B,A:X,b:Q,B:se,c:null,d:MI,e:MI,f:Dve,g:Vve,G:Kve,H:_ve,I:Mve,j:Rve,L:E7,m:$ve,M:Ive,p:ee,q:ve,Q:DI,s:$I,S:Lve,u:Fve,U:qve,V:Bve,w:zve,W:Uve,x:null,X:null,y:Hve,Y:Gve,Z:Wve,"%":RI},A={a:H,A:L,b:I,B:W,c:U,d:PI,e:PI,f:dve,g:OI,G:kI,H:EI,I:EI,j:ove,L:uve,m:ive,M:lve,p:R,q:sve,Q:mve,s:hve,S:cve,u:eve,U:tve,V:nve,w:Jye,W:rve,x:V,X:D,y:OI,Y:kI,Z:ave,"%":fve};k.x=P(n,k),k.X=P(r,k),k.c=P(t,k),T.x=P(n,T),T.X=P(r,T),T.c=P(t,T);function P(ue,de){return function(Se){var he=[],ce=-1,te=0,_e=ue.length,Oe,Te,Le;for(Se instanceof Date||(Se=new Date(+Se));++ce<_e;)ue.charCodeAt(ce)===37&&(he.push(ue.slice(te,ce)),(Te=TI[Oe=ue.charAt(++ce)])!=null?Oe=ue.charAt(++ce):Te=Oe==="e"?" ":"0",(Le=de[Oe])&&(Oe=Le(Se,Te)),he.push(Oe),te=ce+1);return he.push(ue.slice(te,ce)),he.join("")}}function E(ue,de){return function(Se){var he=Bf(1900,void 0,1),ce=_(he,ue,Se+="",0),te,_e;if(ce!=Se.length)return null;if("Q"in he)return new Date(he.Q);if("s"in he)return new Date(he.s*1e3+("L"in he?he.L:0));if(de&&!("Z"in he)&&(he.Z=0),"p"in he&&(he.H=he.H%12+he.p*12),he.m===void 0&&(he.m="q"in he?he.q:0),"V"in he){if(he.V<1||he.V>53)return null;"w"in he||(he.w=1),"Z"in he?(te=xS(Bf(he.y,0,1)),_e=te.getUTCDay(),te=_e>4||_e===0?yy.ceil(te):yy(te),te=Dv.offset(te,(he.V-1)*7),he.y=te.getUTCFullYear(),he.m=te.getUTCMonth(),he.d=te.getUTCDate()+(he.w+6)%7):(te=pS(Bf(he.y,0,1)),_e=te.getDay(),te=_e>4||_e===0?gy.ceil(te):gy(te),te=Bh.offset(te,(he.V-1)*7),he.y=te.getFullYear(),he.m=te.getMonth(),he.d=te.getDate()+(he.w+6)%7)}else("W"in he||"U"in he)&&("w"in he||(he.w="u"in he?he.u%7:"W"in he?1:0),_e="Z"in he?xS(Bf(he.y,0,1)).getUTCDay():pS(Bf(he.y,0,1)).getDay(),he.m=0,he.d="W"in he?(he.w+6)%7+he.W*7-(_e+5)%7:he.w+he.U*7-(_e+6)%7);return"Z"in he?(he.H+=he.Z/100|0,he.M+=he.Z%100,xS(he)):pS(he)}}function _(ue,de,Se,he){for(var ce=0,te=de.length,_e=Se.length,Oe,Te;ce<te;){if(he>=_e)return-1;if(Oe=de.charCodeAt(ce++),Oe===37){if(Oe=de.charAt(ce++),Te=A[Oe in TI?de.charAt(ce++):Oe],!Te||(he=Te(ue,Se,he))<0)return-1}else if(Oe!=Se.charCodeAt(he++))return-1}return he}function R(ue,de,Se){var he=f.exec(de.slice(Se));return he?(ue.p=h.get(he[0].toLowerCase()),Se+he[0].length):-1}function H(ue,de,Se){var he=y.exec(de.slice(Se));return he?(ue.w=w.get(he[0].toLowerCase()),Se+he[0].length):-1}function L(ue,de,Se){var he=p.exec(de.slice(Se));return he?(ue.w=x.get(he[0].toLowerCase()),Se+he[0].length):-1}function I(ue,de,Se){var he=C.exec(de.slice(Se));return he?(ue.m=N.get(he[0].toLowerCase()),Se+he[0].length):-1}function W(ue,de,Se){var he=j.exec(de.slice(Se));return he?(ue.m=b.get(he[0].toLowerCase()),Se+he[0].length):-1}function U(ue,de,Se){return _(ue,t,de,Se)}function V(ue,de,Se){return _(ue,n,de,Se)}function D(ue,de,Se){return _(ue,r,de,Se)}function q(ue){return l[ue.getDay()]}function K(ue){return i[ue.getDay()]}function Y(ue){return d[ue.getMonth()]}function z(ue){return u[ue.getMonth()]}function Z(ue){return s[+(ue.getHours()>=12)]}function F(ue){return 1+~~(ue.getMonth()/3)}function B(ue){return l[ue.getUTCDay()]}function X(ue){return i[ue.getUTCDay()]}function Q(ue){return d[ue.getUTCMonth()]}function se(ue){return u[ue.getUTCMonth()]}function ee(ue){return s[+(ue.getUTCHours()>=12)]}function ve(ue){return 1+~~(ue.getUTCMonth()/3)}return{format:function(ue){var de=P(ue+="",k);return de.toString=function(){return ue},de},parse:function(ue){var de=E(ue+="",!1);return de.toString=function(){return ue},de},utcFormat:function(ue){var de=P(ue+="",T);return de.toString=function(){return ue},de},utcParse:function(ue){var de=E(ue+="",!0);return de.toString=function(){return ue},de}}}var TI={"-":"",_:" ",0:"0"},Hn=/^\s*\d+/,Xye=/^%/,Qye=/[\\^$*+?|[\]().{}]/g;function jt(e,t,n){var r=e<0?"-":"",s=(r?-e:e)+"",i=s.length;return r+(i<n?new Array(n-i+1).join(t)+s:s)}function Zye(e){return e.replace(Qye,"\\$&")}function zf(e){return new RegExp("^(?:"+e.map(Zye).join("|")+")","i")}function Uf(e){return new Map(e.map((t,n)=>[t.toLowerCase(),n]))}function Jye(e,t,n){var r=Hn.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function eve(e,t,n){var r=Hn.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function tve(e,t,n){var r=Hn.exec(t.slice(n,n+2));
vendor: 4,106 bytes, line 30
30return r?(e.U=+r[0],n+r[0].length):-1}function nve(e,t,n){var r=Hn.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function rve(e,t,n){var r=Hn.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function kI(e,t,n){var r=Hn.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function OI(e,t,n){var r=Hn.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function ave(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function sve(e,t,n){var r=Hn.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function ive(e,t,n){var r=Hn.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function PI(e,t,n){var r=Hn.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function ove(e,t,n){var r=Hn.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function EI(e,t,n){var r=Hn.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function lve(e,t,n){var r=Hn.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function cve(e,t,n){var r=Hn.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function uve(e,t,n){var r=Hn.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function dve(e,t,n){var r=Hn.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function fve(e,t,n){var r=Xye.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function mve(e,t,n){var r=Hn.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function hve(e,t,n){var r=Hn.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function _I(e,t){return jt(e.getDate(),t,2)}function pve(e,t){return jt(e.getHours(),t,2)}function xve(e,t){return jt(e.getHours()%12||12,t,2)}function gve(e,t){return jt(1+Bh.count(Ei(e),e),t,3)}function O7(e,t){return jt(e.getMilliseconds(),t,3)}function yve(e,t){return O7(e,t)+"000"}function vve(e,t){return jt(e.getMonth()+1,t,2)}function bve(e,t){return jt(e.getMinutes(),t,2)}function jve(e,t){return jt(e.getSeconds(),t,2)}function wve(e){var t=e.getDay();return t===0?7:t}function Nve(e,t){return jt($v.count(Ei(e)-1,e),t,2)}function P7(e){var t=e.getDay();return t>=4||t===0?Vu(e):Vu.ceil(e)}function Sve(e,t){return e=P7(e),jt(Vu.count(Ei(e),e)+(Ei(e).getDay()===4),t,2)}function Cve(e){return e.getDay()}function Ave(e,t){return jt(gy.count(Ei(e)-1,e),t,2)}function Tve(e,t){return jt(e.getFullYear()%100,t,2)}function kve(e,t){return e=P7(e),jt(e.getFullYear()%100,t,2)}function Ove(e,t){return jt(e.getFullYear()%1e4,t,4)}function Pve(e,t){var n=e.getDay();return e=n>=4||n===0?Vu(e):Vu.ceil(e),jt(e.getFullYear()%1e4,t,4)}function Eve(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+jt(t/60|0,"0",2)+jt(t%60,"0",2)}function MI(e,t){return jt(e.getUTCDate(),t,2)}function _ve(e,t){return jt(e.getUTCHours(),t,2)}function Mve(e,t){return jt(e.getUTCHours()%12||12,t,2)}function Rve(e,t){return jt(1+Dv.count(_i(e),e),t,3)}function E7(e,t){return jt(e.getUTCMilliseconds(),t,3)}function Dve(e,t){return E7(e,t)+"000"}function $ve(e,t){return jt(e.getUTCMonth()+1,t,2)}function Ive(e,t){return jt(e.getUTCMinutes(),t,2)}function Lve(e,t){return jt(e.getUTCSeconds(),t,2)}function Fve(e){var t=e.getUTCDay();return t===0?7:t}function qve(e,t){return jt(Iv.count(_i(e)-1,e),t,2)}function _7(e){var t=e.getUTCDay();return t>=4||t===0?Gu(e):Gu.ceil(e)}function Bve(e,t){return e=_7(e),jt(Gu.count(_i(e),e)+(_i(e).getUTCDay()===4),t,2)}function zve(e){return e.getUTCDay()}function Uve(e,t){return jt(yy.count(_i(e)-1,e),t,2)}function Hve(e,t){return jt(e.getUTCFullYear()%100,t,2)}function Vve(e,t){return e=_7(e),jt(e.getUTCFullYear()%100,t,2)}function Gve(e,t){return jt(e.getUTCFullYear()%1e4,t,4)}function Kve(e,t){var n=e.getUTCDay();return e=n>=4||n===0?Gu(e):Gu.ceil(e),jt(e.getUTCFullYear()%1e4,t,4)}function Wve(){return"+0000"}function RI(){return"%"}function DI(e){return+e}function $I(e){return Math.floor(+e/1e3)}var au,M7,R7;Yve({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Frid
30ay","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 Yve(e){return au=Yye(e),M7=au.format,au.parse,R7=au.utcFormat,au.utcParse,au}function Xve(e){return new Date(e)}function Qve(e){return e instanceof Date?+e:+new Date(+e)}function eO(e,t,n,r,s,i,l,u,d,f){var h=qk(),p=h.invert,x=h.domain,y=f(".%L"),w=f(":%S"),j=f("%I:%M"),b=f("%I %p"),C=f("%a %d"),N=f("%b %d"),k=f("%B"),T=f("%Y");function A(P){return(d(P)<P?y:u(P)<P?w:l(P)<P?j:i(P)<P?b:r(P)<P?s(P)<P?C:N:n(P)<P?k:T)(P)}return h.invert=function(P){return new Date(p(P))},h.domain=function(P){return arguments.length?x(Array.from(P,Qve)):x().map(Xve)},h.ticks=function(P){var E=x();return e(E[0],E[E.length-1],P??10)},h.tickFormat=function(P,E){return E==null?A:f(E)},h.nice=function(P){var E=x();return(!P||typeof P.range!="function")&&(P=t(E[0],E[E.length-1],P??10)),P?x(b7(E,P)):h},h.copy=function(){return qh(h,eO(e,t,n,r,s,i,l,u,d,f))},h}function Zve(){return Ia.apply(eO(Kye,Wye,Ei,Zk,$v,Bh,Xk,Wk,$l,M7).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function Jve(){return Ia.apply(eO(Vye,Gye,_i,Jk,Iv,Dv,Qk,Yk,$l,R7).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function Lv(){var e=0,t=1,n,r,s,i,l=jr,u=!1,d;function f(p){return p==null||isNaN(p=+p)?d:l(s===0?.5:(p=(i(p)-n)*s,u?Math.max(0,Math.min(1,p)):p))}f.domain=function(p){return arguments.length?([e,t]=p,n=i(e=+e),r=i(t=+t),s=n===r?0:1/(r-n),f):[e,t]},f.clamp=function(p){return arguments.length?(u=!!p,f):u},f.interpolator=function(p){return arguments.length?(l=p,f):l};function h(p){return function(x){var y,w;return arguments.length?([y,w]=x,l=p(y,w),f):[l(0),l(1)]}}return f.range=h(kd),f.rangeRound=h(Fk),f.unknown=function(p){return arguments.length?(d=p,f):d},function(p){return i=p,n=p(e),r=p(t),s=n===r?0:1/(r-n),f}}function Ko(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function D7(){var e=Go(Lv()(jr));return e.copy=function(){return Ko(e,D7())},Ii.apply(e,arguments)}function $7(){var e=Uk(Lv()).domain([1,10]);return e.copy=function(){return Ko(e,$7()).base(e.base())},Ii.apply(e,arguments)}function I7(){var e=Hk(Lv());return e.copy=function(){return Ko(e,I7()).constant(e.constant())},Ii.apply(e,arguments)}function tO(){var e=Vk(Lv());return e.copy=function(){return Ko(e,tO()).exponent(e.exponent())},Ii.apply(e,arguments)}function ebe(){return tO.apply(null,arguments).exponent(.5)}function L7(){var e=[],t=jr;function n(r){if(r!=null&&!isNaN(r=+r))return t((Lh(e,r,1)-1)/(e.length-1))}return n.domain=function(r){if(!arguments.length)return e.slice();e=[];for(let s of r)s!=null&&!isNaN(s=+s)&&e.push(s);return e.sort(Eo),n},n.interpolator=function(r){return arguments.length?(t=r,n):t},n.range=function(){return e.map((r,s)=>t(s/(e.length-1)))},n.quantiles=function(r){return Array.from({length:r+1},(s,i)=>qge(e,i/r))},n.copy=function(){return L7(t).domain(e)},Ii.apply(n,arguments)}function Fv(){var e=0,t=.5,n=1,r=1,s,i,l,u,d,f=jr,h,p=!1,x;function y(j){return isNaN(j=+j)?x:(j=.5+((j=+h(j))-i)*(r*j<r*i?u:d),f(p?Math.max(0,Math.min(1,j)):j))}y.domain=function(j){return arguments.length?([e,t,n]=j,s=h(e=+e),i=h(t=+t),l=h(n=+n),u=s===i?0:.5/(i-s),d=i===l?0:.5/(l-i),r=i<s?-1:1,y):[e,t,n]},y.clamp=function(j){return arguments.length?(p=!!j,y):p},y.interpolator=function(j){return arguments.length?(f=j,y):f};function w(j){return function(b){var C,N,k;return arguments.length?([C,N,k]=b,f=fye(j,[C,N,k]),y):[f(0),f(.5),f(1)]}}return y.range=w(kd),y.rangeRound=w(Fk),y.unknown=function(j){return arguments.length?(x=j,y):x},function(j){return h=j,s=j(e),i=j(t),l=j(n),u=s===i?0:.5/(i-s),d=i===l?0:.5/(l-i),r=i<s?-1:1,y}}function F7(){var e=Go(Fv()(jr));return e.copy=function(){return Ko(e,F7())},Ii.apply(e,arguments)}function q7(){var e=Uk(Fv()).domain([.1,1,10]);return e.copy=function(){return Ko(e,q7()).base(e.base())},Ii.apply(e,arguments)}function B7(){var e=Hk(Fv());return e.copy=function(){return Ko(e,B7()).constant(e.constant())},Ii.apply(e,arguments)}function nO(){var e=Vk(Fv());return e.copy=function(){return Ko(e,nO()).exponent(e.exponent())},Ii.apply(e,arguments)}function tbe(){return nO.apply(null,arguments).exponent(.5)}const II=Object.freeze(Object.defineProperty({__proto__:null,scaleBand:zm,scaleDiverging:F7,scaleDivergingLog:q7,scaleDivergingPow:nO,scaleDivergingSqrt:tbe,scaleDivergingSymlog:B7,scaleIdentity:v7,scaleImplicit:qC,scaleLinear:py,scaleLog:j7,scaleOrdinal:$k,scalePoint:bm,scalePow:Gk,scaleQuantile:S7,scaleQuantize:C7,scaleRadial:N7,scaleSequential:D7,scaleSequentialLog:$7,scaleSequentialPow:tO,scaleSequentialQuantile:L7,scaleSequentialSqrt:ebe,scaleSequentialSymlog:I7,scaleSqrt:Dye,scaleSymlog:w7,scaleThreshold:A7,scaleTime:Zve,scaleUtc:Jve,tickFormat:y7},Symbol.toStringTag,{value:"Module"}));var gS,LI;function z7(){if(LI)return gS;LI=1;var e=Sd();function t(n,r,s){for(var i=-1,l=n.length;++i<l;){var u=n[i],d=r(u);if(d!=null&&(f===void 0?d===d&&!e(d):s(d,f)))var f=d,h=u}return h}return gS=t,gS}var yS,FI;function nbe(){if(FI)return yS;FI=1;function e(t,n){return t>n}return yS=e,yS}var vS,qI;function rbe(){if(qI)return vS;qI=1;var e=z7(),t=nbe(),n=Ad();function r(s){return s&&s.length?e(s,n,t):void 0}return vS=r,vS}var abe=rbe();const qv=Bt(abe);var bS,BI;function sbe(){if(BI)return bS;BI=1;function e(t,n){return t<n}return bS=e,bS}var jS,zI;function ibe(){if(zI)return jS;zI=1;var e=z7(),t=sbe(),n=Ad();function r(s){return s&&s.length?e(s,n,t):void 0}return jS=r,jS}var obe=ibe();const Bv=Bt(obe);var wS,UI;function lbe(){if(UI)return wS;UI=1;var e=yk(),t=Vo(),n=QU(),r=Ir();function s(i,l){var u=r(i)?e:n;return u(i,t(l,3))}return wS=s,wS}var NS,HI;
vendor: 125,868 bytes, lines 30-74
30function cbe(){if(HI)return NS;HI=1;var e=YU(),t=lbe();function n(r,s){return e(t(r,s),1)}return NS=n,NS}var ube=cbe();const dbe=Bt(ube);var SS,VI;function fbe(){if(VI)return SS;VI=1;var e=Ek();function t(n,r){return e(n,r)}return SS=t,SS}var mbe=fbe();const zv=Bt(mbe);var Od=1e9,hbe={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},aO,Zt=!0,$a="[DecimalError] ",ql=$a+"Invalid argument: ",rO=$a+"Exponent out of range: ",Pd=Math.floor,Pl=Math.pow,pbe=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,oa,zn=1e7,Yt=7,U7=9007199254740991,vy=Pd(U7/Yt),Be={};Be.absoluteValue=Be.abs=function(){var e=new this.constructor(this);return e.s&&(e.s=1),e};Be.comparedTo=Be.cmp=function(e){var t,n,r,s,i=this;if(e=new i.constructor(e),i.s!==e.s)return i.s||-e.s;if(i.e!==e.e)return i.e>e.e^i.s<0?1:-1;for(r=i.d.length,s=e.d.length,t=0,n=r<s?r:s;t<n;++t)if(i.d[t]!==e.d[t])return i.d[t]>e.d[t]^i.s<0?1:-1;return r===s?0:r>s^i.s<0?1:-1};Be.decimalPlaces=Be.dp=function(){var e=this,t=e.d.length-1,n=(t-e.e)*Yt;if(t=e.d[t],t)for(;t%10==0;t/=10)n--;return n<0?0:n};Be.dividedBy=Be.div=function(e){return Ni(this,new this.constructor(e))};Be.dividedToIntegerBy=Be.idiv=function(e){var t=this,n=t.constructor;return Ht(Ni(t,new n(e),0,1),n.precision)};Be.equals=Be.eq=function(e){return!this.cmp(e)};Be.exponent=function(){return wn(this)};Be.greaterThan=Be.gt=function(e){return this.cmp(e)>0};Be.greaterThanOrEqualTo=Be.gte=function(e){return this.cmp(e)>=0};Be.isInteger=Be.isint=function(){return this.e>this.d.length-2};Be.isNegative=Be.isneg=function(){return this.s<0};Be.isPositive=Be.ispos=function(){return this.s>0};Be.isZero=function(){return this.s===0};Be.lessThan=Be.lt=function(e){return this.cmp(e)<0};Be.lessThanOrEqualTo=Be.lte=function(e){return this.cmp(e)<1};Be.logarithm=Be.log=function(e){var t,n=this,r=n.constructor,s=r.precision,i=s+5;if(e===void 0)e=new r(10);else if(e=new r(e),e.s<1||e.eq(oa))throw Error($a+"NaN");if(n.s<1)throw Error($a+(n.s?"NaN":"-Infinity"));return n.eq(oa)?new r(0):(Zt=!1,t=Ni(Km(n,i),Km(e,i),i),Zt=!0,Ht(t,s))};Be.minus=Be.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?G7(t,e):H7(t,(e.s=-e.s,e))};Be.modulo=Be.mod=function(e){var t,n=this,r=n.constructor,s=r.precision;if(e=new r(e),!e.s)throw Error($a+"NaN");return n.s?(Zt=!1,t=Ni(n,e,0,1).times(e),Zt=!0,n.minus(t)):Ht(new r(n),s)};Be.naturalExponential=Be.exp=function(){return V7(this)};Be.naturalLogarithm=Be.ln=function(){return Km(this)};Be.negated=Be.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};Be.plus=Be.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?H7(t,e):G7(t,(e.s=-e.s,e))};Be.precision=Be.sd=function(e){var t,n,r,s=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(ql+e);if(t=wn(s)+1,r=s.d.length-1,n=r*Yt+1,r=s.d[r],r){for(;r%10==0;r/=10)n--;for(r=s.d[0];r>=10;r/=10)n++}return e&&t>n?t:n};Be.squareRoot=Be.sqrt=function(){var e,t,n,r,s,i,l,u=this,d=u.constructor;if(u.s<1){if(!u.s)return new d(0);throw Error($a+"NaN")}for(e=wn(u),Zt=!1,s=Math.sqrt(+u),s==0||s==1/0?(t=ks(u.d),(t.length+e)%2==0&&(t+="0"),s=Math.sqrt(t),e=Pd((e+1)/2)-(e<0||e%2),s==1/0?t="5e"+e:(t=s.toExponential(),t=t.slice(0,t.indexOf("e")+1)+e),r=new d(t)):r=new d(s.toString()),n=d.precision,s=l=n+3;;)if(i=r,r=i.plus(Ni(u,i,l+2)).times(.5),ks(i.d).slice(0,l)===(t=ks(r.d)).slice(0,l)){if(t=t.slice(l-3,l+1),s==l&&t=="4999"){if(Ht(i,n+1,0),i.times(i).eq(u)){r=i;break}}else if(t!="9999")break;l+=4}return Zt=!0,Ht(r,n)};Be.times=Be.mul=function(e){var t,n,r,s,i,l,u,d,f,h=this,p=h.constructor,x=h.d,y=(e=new p(e)).d;if(!h.s||!e.s)return new p(0);for(e.s*=h.s,n=h.e+e.e,d=x.length,f=y.length,d<f&&(i=x,x=y,y=i,l=d,d=f,f=l),i=[],l=d+f,r=l;r--;)i.push(0);for(r=f;--r>=0;){for(t=0,s=d+r;s>r;)u=i[s]+y[r]*x[s-r-1]+t,i[s--]=u%zn|0,t=u/zn|0;i[s]=(i[s]+t)%zn|0}for(;!i[--l];)i.pop();return t?++n:i.shift(),e.d=i,e.e=n,Zt?Ht(e,p.precision):e};Be.toDecimalPlaces=Be.todp=function(e,t){var n=this,r=n.constructor;return n=new r(n),e===void 0?n:($s(e,0,Od),t===void 0?t=r.rounding:$s(t,0,8),Ht(n,e+wn(n)+1,t))};Be.toExponential=function(e,t){var n,r=this,s=r.constructor;return e===void 0?n=Wl(r,!0):($s(e,0,Od),t===void 0?t=s.rounding:$s(t,0,8),r=Ht(new s(r),e+1,t),n=Wl(r,!0,e+1)),n};Be.toFixed=function(e,t){var n,r,s=this,i=s.constructor;return e===void 0?Wl(s):($s(e,0,Od),t===void 0?t=i.rounding:$s(t,0,8),r=Ht(new i(s),e+wn(s)+1,t),n=Wl(r.abs(),!1,e+wn(r)+1),s.isneg()&&!s.isZero()?"-"+n:n)};Be.toInteger=Be.toint=function(){var e=this,t=e.constructor;return Ht(new t(e),wn(e)+1,t.rounding)};Be.toNumber=function(){return+this};Be.toPower=Be.pow=function(e){var t,n,r,s,i,l,u=this,d=u.constructor,f=12,h=+(e=new d(e));if(!e.s)return new d(oa);if(u=new d(u),!u.s){if(e.s<1)throw Error($a+"Infinity");return u}if(u.eq(oa))return u;if(r=d.precision,e.eq(oa))return Ht(u,r);if(t=e.e,n=e.d.length-1,l=t>=n,i=u.s,l){if((n=h<0?-h:h)<=U7){for(s=new d(oa),t=Math.ceil(r/Yt+4),Zt=!1;n%2&&(s=s.times(u),KI(s.d,t)),n=Pd(n/2),n!==0;)u=u.times(u),KI(u.d,t);return Zt=!0,e.s<0?new d(oa).div(s):Ht(s,r)}}else if(i<0)throw Error($a+"NaN");return i=i<0&&e.d[Math.max(t,n)]&1?-1:1,u.s=1,Zt=!1,s=e.times(Km(u,r+f)),Zt=!0,s=V7(s),s.s=i,s};Be.toPrecision=function(e,t){var n,r,s=this,i=s.constructor;return e===void 0?(n=wn(s),r=Wl(s,n<=i.toExpNeg||n>=i.toExpPos)):($s(e,1,Od),t===void 0?t=i.rounding:$s(t,0,8),s=Ht(new i(s),e,t),n=wn(s),r=Wl(s,e<=n||n<=i.toExpNeg,e)),r};Be.toSignificantDigits=Be.tosd=function(e,t){var n=this,r=n.constructor;return e===void 0?(e=r.precision,t=r.rounding):($s(e,1,Od),t===void 0?t=r.rounding:$s(t,0,8)),Ht(new r(n),e,t)};Be.toString=Be.valueOf=Be.val=Be.toJSON=Be[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,t=wn(e),n=e.constructor;return Wl(e,t<=n.toExpNeg||t>=n.toExpPos)};function H7(e,t){var n,r,s,i,l,u,d,f,h=e.constructor,p=h.precision;if(!e.s||!t.s)return t.s||(t=new h(e)),Zt?Ht(t,p):t;if(d=e.d,f=t.d,l=e.e,s=t.e,d=d.slice(),i=l-s,i){for(i<0?(r=d,i=-i,u=f.length):(r=f,s=l,u=d.length),l=Math.ceil(p/Yt),u=l>u?l+1:u+1,i>u&&(i=u,r.length=1),r.reverse();i--;)r.push(0);r.reverse()}for(u=d.length,i=f.length,u-i<0&&(i=u,r=f,f=d,d=r),n=0;i;)n=(d[--i]=d[i]+f[i]+n)/zn|0,d[i]%=zn;for(n&&(d.unshift(n),++s),u=d.length;d[--u]==0;)d.pop();return t.d=d,t.e=s,Zt?Ht(t,p):t}function $s(e,t,n){if(e!==~~e||e<t||e>n)throw Error(ql+e)}function ks(e){var t,n,r,s=e.length-1,i="",l=e[0];if(s>0){for(i+=l,t=1;t<s;t++)r=e[t]+"",n=Yt-r.length,n&&(i+=So(n)),i+=r;l=e[t],r=l+"",n=Yt-r.length,n&&(i+=So(n))}else if(l===0)return"0";for(;l%10===0;)l/=10;return i+l}var Ni=(function(){function e(r,s){var i,l=0,u=r.length;for(r=r.slice();u--;)i=r[u]*s+l,r[u]=i%zn|0,l=i/zn|0;return l&&r.unshift(l),r}function t(r,s,i,l){var u,d;if(i!=l)d=i>l?1:-1;else for(u=d=0;u<i;u++)if(r[u]!=s[u]){d=r[u]>s[u]?1:-1;break}return d}function n(r,s,i){for(var l=0;i--;)r[i]-=l,l=r[i]<s[i]?1:0,r[i]=l*zn+r[i]-s[i];for(;!r[0]&&r.length>1;)r.shift()}return function(r,s,i,l){var u,d,f,h,p,x,y,w,j,b,C,N,k,T,A,P,E,_,R=r.constructor,H=r.s==s.s?1:-1,L=r.d,I=s.d;if(!r.s)return new R(r);if(!s.s)throw Error($a+"Division by zero");for(d=r.e-s.e,E=I.length,A=L.length,y=new R(H),w=y.d=[],f=0;I[f]==(L[f]||0);)++f;if(I[f]>(L[f]||0)&&--d,i==null?N=i=R.precision:l?N=i+(wn(r)-wn(s))+1:N=i,N<0)return new R(0);if(N=N/Yt+2|0,f=0,E==1)for(h=0,I=I[0],N++;(f<A||h)&&N--;f++)k=h*zn+(L[f]||0),w[f]=k/I|0,h=k%I|0;else{for(h=zn/(I[0]+1)|0,h>1&&(I=e(I,h),L=e(L,h),E=I.length,A=L.length),T=E,j=L.slice(0,E),b=j.length;b<E;)j[b++]=0;_=I.slice(),_.unshift(0),P=I[0],I[1]>=zn/2&&++P;do h=0,u=t(I,j,E,b),u<0?(C=j[0],E!=b&&(C=C*zn+(j[1]||0)),h=C/P|0,h>1?(h>=zn&&(h=zn-1),p=e(I,h),x=p.length,b=j.length,u=t(p,j,x,b),u==1&&(h--,n(p,E<x?_:I,x))):(h==0&&(u=h=1),p=I.slice()),x=p.length,x<b&&p.unshift(0),n(j,p,b),u==-1&&(b=j.length,u=t(I,j,E,b),u<1&&(h++,n(j,E<b?_:I,b))),b=j.length):u===0&&(h++,j=[0]),w[f++]=h,u&&j[0]?j[b++]=L[T]||0:(j=[L[T]],b=1);while((T++<A||j[0]!==void 0)&&N--)}return w[0]||w.shift(),y.e=d,Ht(y,l?i+wn(y)+1:i)}})();function V7(e,t){var n,r,s,i,l,u,d=0,f=0,h=e.constructor,p=h.precision;if(wn(e)>16)throw Error(rO+wn(e));if(!e.s)return new h(oa);for(Zt=!1,u=p,l=new h(.03125);e.abs().gte(.1);)e=e.times(l),f+=5;for(r=Math.log(Pl(2,f))/Math.LN10*2+5|0,u+=r,n=s=i=new h(oa),h.precision=u;;){if(s=Ht(s.times(e),u),n=n.times(++d),l=i.plus(Ni(s,n,u)),ks(l.d).slice(0,u)===ks(i.d).slice(0,u)){for(;f--;)i=Ht(i.times(i),u);return h.precision=p,t==null?(Zt=!0,Ht(i,p)):i}i=l}}function wn(e){for(var t=e.e*Yt,n=e.d[0];n>=10;n/=10)t++;return t}function CS(e,t,n){if(t>e.LN10.sd())throw Zt=!0,n&&(e.precision=n),Error($a+"LN10 precision limit exceeded");return Ht(new e(e.LN10),t)}function So(e){for(var t="";e--;)t+="0";return t}function Km(e,t){var n,r,s,i,l,u,d,f,h,p=1,x=10,y=e,w=y.d,j=y.constructor,b=j.precision;if(y.s<1)throw Error($a+(y.s?"NaN":"-Infinity"));if(y.eq(oa))return new j(0);if(t==null?(Zt=!1,f=b):f=t,y.eq(10))return t==null&&(Zt=!0),CS(j,f);if(f+=x,j.precision=f,n=ks(w),r=n.charAt(0),i=wn(y),Math.abs(i)<15e14){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)y=y.times(e),n=ks(y.d),r=n.charAt(0),p++;i=wn(y),r>1?(y=new j("0."+n),i++):y=new j(r+"."+n.slice(1))}else return d=CS(j,f+2,b).times(i+""),y=Km(new j(r+"."+n.slice(1)),f-x).plus(d),j.precision=b,t==null?(Zt=!0,Ht(y,b)):y;for(u=l=y=Ni(y.minus(oa),y.plus(oa),f),h=Ht(y.times(y),f),s=3;;){if(l=Ht(l.times(h),f),d=u.plus(Ni(l,new j(s),f)),ks(d.d).slice(0,f)===ks(u.d).slice(0,f))return u=u.times(2),i!==0&&(u=u.plus(CS(j,f+2,b).times(i+""))),u=Ni(u,new j(p),f),j.precision=b,t==null?(Zt=!0,Ht(u,b)):u;u=d,s+=2}}function GI(e,t){var n,r,s;for((n=t.indexOf("."))>-1&&(t=t.replace(".","")),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;t.charCodeAt(r)===48;)++r;for(s=t.length;t.charCodeAt(s-1)===48;)--s;if(t=t.slice(r,s),t){if(s-=r,n=n-r-1,e.e=Pd(n/Yt),e.d=[],r=(n+1)%Yt,n<0&&(r+=Yt),r<s){for(r&&e.d.push(+t.slice(0,r)),s-=Yt;r<s;)e.d.push(+t.slice(r,r+=Yt));t=t.slice(r),r=Yt-t.length}else r-=s;for(;r--;)t+="0";if(e.d.push(+t),Zt&&(e.e>vy||e.e<-vy))throw Error(rO+n)}else e.s=0,e.e=0,e.d=[0];return e}function Ht(e,t,n){var r,s,i,l,u,d,f,h,p=e.d;for(l=1,i=p[0];i>=10;i/=10)l++;if(r=t-l,r<0)r+=Yt,s=t,f=p[h=0];else{if(h=Math.ceil((r+1)/Yt),i=p.length,h>=i)return e;for(f=i=p[h],l=1;i>=10;i/=10)l++;r%=Yt,s=r-Yt+l}if(n!==void 0&&(i=Pl(10,l-s-1),u=f/i%10|0,d=t<0||p[h+1]!==void 0||f%i,d=n<4?(u||d)&&(n==0||n==(e.s<0?3:2)):u>5||u==5&&(n==4||d||n==6&&(r>0?s>0?f/Pl(10,l-s):0:p[h-1])%10&1||n==(e.s<0?8:7))),t<1||!p[0])return d?(i=wn(e),p.length=1,t=t-i-1,p[0]=Pl(10,(Yt-t%Yt)%Yt),e.e=Pd(-t/Yt)||0):(p.length=1,p[0]=e.e=e.s=0),e;if(r==0?(p.length=h,i=1,h--):(p.length=h+1,i=Pl(10,Yt-r),p[h]=s>0?(f/Pl(10,l-s)%Pl(10,s)|0)*i:0),d)for(;;)if(h==0){(p[0]+=i)==zn&&(p[0]=1,++e.e);break}else{if(p[h]+=i,p[h]!=zn)break;p[h--]=0,i=1}for(r=p.length;p[--r]===0;)p.pop();if(Zt&&(e.e>vy||e.e<-vy))throw Error(rO+wn(e));return e}function G7(e,t){var n,r,s,i,l,u,d,f,h,p,x=e.constructor,y=x.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new x(e),Zt?Ht(t,y):t;if(d=e.d,p=t.d,r=t.e,f=e.e,d=d.slice(),l=f-r,l){for(h=l<0,h?(n=d,l=-l,u=p.length):(n=p,r=f,u=d.length),s=Math.max(Math.ceil(y/Yt),u)+2,l>s&&(l=s,n.length=1),n.reverse(),s=l;s--;)n.push(0);n.reverse()}else{for(s=d.length,u=p.length,h=s<u,h&&(u=s),s=0;s<u;s++)if(d[s]!=p[s]){h=d[s]<p[s];break}l=0}for(h&&(n=d,d=p,p=n,t.s=-t.s),u=d.length,s=p.length-u;s>0;--s)d[u++]=0;for(s=p.length;s>l;){if(d[--s]<p[s]){for(i=s;i&&d[--i]===0;)d[i]=zn-1;--d[i],d[s]+=zn}d[s]-=p[s]}for(;d[--u]===0;)d.pop();for(;d[0]===0;d.shift())--r;return d[0]?(t.d=d,t.e=r,Zt?Ht(t,y):t):new x(0)}function Wl(e,t,n){var r,s=wn(e),i=ks(e.d),l=i.length;return t?(n&&(r=n-l)>0?i=i.charAt(0)+"."+i.slice(1)+So(r):l>1&&(i=i.charAt(0)+"."+i.slice(1)),i=i+(s<0?"e":"e+")+s):s<0?(i="0."+So(-s-1)+i,n&&(r=n-l)>0&&(i+=So(r))):s>=l?(i+=So(s+1-l),n&&(r=n-s-1)>0&&(i=i+"."+So(r))):((r=s+1)<l&&(i=i.slice(0,r)+"."+i.slice(r)),n&&(r=n-l)>0&&(s+1===l&&(i+="."),i+=So(r))),e.s<0?"-"+i:i}function KI(e,t){if(e.length>t)return e.length=t,!0}function K7(e){var t,n,r;function s(i){var l=this;if(!(l instanceof s))return new s(i);if(l.constructor=s,i instanceof s){l.s=i.s,l.e=i.e,l.d=(i=i.d)?i.slice():i;return}if(typeof i=="number"){if(i*0!==0)throw Error(ql+i);if(i>0)l.s=1;else if(i<0)i=-i,l.s=-1;else{l.s=0,l.e=0,l.d=[0];return}if(i===~~i&&i<1e7){l.e=0,l.d=[i];return}return GI(l,i.toString())}else if(typeof i!="string")throw Error(ql+i);if(i.charCodeAt(0)===45?(i=i.slice(1),l.s=-1):l.s=1,pbe.test(i))GI(l,i);else throw Error(ql+i)}if(s.prototype=Be,s.ROUND_UP=0,s.ROUND_DOWN=1,s.ROUND_CEIL=2,s.ROUND_FLOOR=3,s.ROUND_HALF_UP=4,s.ROUND_HALF_DOWN=5,s.ROUND_HALF_EVEN=6,s.ROUND_HALF_CEIL=7,s.ROUND_HALF_FLOOR=8,s.clone=K7,s.config=s.set=xbe,e===void 0&&(e={}),e)for(r=["precision","rounding","toExpNeg","toExpPos","LN10"],t=0;t<r.length;)e.hasOwnProperty(n=r[t++])||(e[n]=this[n]);return s.config(e),s}function xbe(e){if(!e||typeof e!="object")throw Error($a+"Object expected");var t,n,r,s=["precision",1,Od,"rounding",0,8,"toExpNeg",-1/0,0,"toExpPos",0,1/0];for(t=0;t<s.length;t+=3)if((r=e[n=s[t]])!==void 0)if(Pd(r)===r&&r>=s[t+1]&&r<=s[t+2])this[n]=r;else throw Error(ql+n+": "+r);if((r=e[n="LN10"])!==void 0)if(r==Math.LN10)this[n]=new this(r);else throw Error(ql+n+": "+r);return this}var aO=K7(hbe);oa=new aO(1);const qt=aO;function gbe(e){return jbe(e)||bbe(e)||vbe(e)||ybe()}function ybe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
31In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function vbe(e,t){if(e){if(typeof e=="string")return HC(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return HC(e,t)}}function bbe(e){if(typeof Symbol<"u"&&Symbol.iterator in Object(e))return Array.from(e)}function jbe(e){if(Array.isArray(e))return HC(e)}function HC(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var wbe=function(t){return t},W7={},Y7=function(t){return t===W7},WI=function(t){return function n(){return arguments.length===0||arguments.length===1&&Y7(arguments.length<=0?void 0:arguments[0])?n:t.apply(void 0,arguments)}},Nbe=function e(t,n){return t===1?n:WI(function(){for(var r=arguments.length,s=new Array(r),i=0;i<r;i++)s[i]=arguments[i];var l=s.filter(function(u){return u!==W7}).length;return l>=t?n.apply(void 0,s):e(t-l,WI(function(){for(var u=arguments.length,d=new Array(u),f=0;f<u;f++)d[f]=arguments[f];var h=s.map(function(p){return Y7(p)?d.shift():p});return n.apply(void 0,gbe(h).concat(d))}))})},Uv=function(t){return Nbe(t.length,t)},VC=function(t,n){for(var r=[],s=t;s<n;++s)r[s-t]=s;return r},Sbe=Uv(function(e,t){return Array.isArray(t)?t.map(e):Object.keys(t).map(function(n){return t[n]}).map(e)}),Cbe=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];if(!n.length)return wbe;var s=n.reverse(),i=s[0],l=s.slice(1);return function(){return l.reduce(function(u,d){return d(u)},i.apply(void 0,arguments))}},GC=function(t){return Array.isArray(t)?t.reverse():t.split("").reverse.join("")},X7=function(t){var n=null,r=null;return function(){for(var s=arguments.length,i=new Array(s),l=0;l<s;l++)i[l]=arguments[l];return n&&i.every(function(u,d){return u===n[d]})||(n=i,r=t.apply(void 0,i)),r}};function Abe(e){var t;return e===0?t=1:t=Math.floor(new qt(e).abs().log(10).toNumber())+1,t}function Tbe(e,t,n){for(var r=new qt(e),s=0,i=[];r.lt(t)&&s<1e5;)i.push(r.toNumber()),r=r.add(n),s++;return i}var kbe=Uv(function(e,t,n){var r=+e,s=+t;return r+n*(s-r)}),Obe=Uv(function(e,t,n){var r=t-+e;return r=r||1/0,(n-e)/r}),Pbe=Uv(function(e,t,n){var r=t-+e;return r=r||1/0,Math.max(0,Math.min(1,(n-e)/r))});const Hv={rangeStep:Tbe,getDigitCount:Abe,interpolateNumber:kbe,uninterpolateNumber:Obe,uninterpolateTruncation:Pbe};function KC(e){return Mbe(e)||_be(e)||Q7(e)||Ebe()}function Ebe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
32In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _be(e){if(typeof Symbol<"u"&&Symbol.iterator in Object(e))return Array.from(e)}function Mbe(e){if(Array.isArray(e))return WC(e)}function Wm(e,t){return $be(e)||Dbe(e,t)||Q7(e,t)||Rbe()}function Rbe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
33In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Q7(e,t){if(e){if(typeof e=="string")return WC(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return WC(e,t)}}function WC(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Dbe(e,t){if(!(typeof Symbol>"u"||!(Symbol.iterator in Object(e)))){var n=[],r=!0,s=!1,i=void 0;try{for(var l=e[Symbol.iterator](),u;!(r=(u=l.next()).done)&&(n.push(u.value),!(t&&n.length===t));r=!0);}catch(d){s=!0,i=d}finally{try{!r&&l.return!=null&&l.return()}finally{if(s)throw i}}return n}}function $be(e){if(Array.isArray(e))return e}function Z7(e){var t=Wm(e,2),n=t[0],r=t[1],s=n,i=r;return n>r&&(s=r,i=n),[s,i]}function J7(e,t,n){if(e.lte(0))return new qt(0);var r=Hv.getDigitCount(e.toNumber()),s=new qt(10).pow(r),i=e.div(s),l=r!==1?.05:.1,u=new qt(Math.ceil(i.div(l).toNumber())).add(n).mul(l),d=u.mul(s);return t?d:new qt(Math.ceil(d))}function Ibe(e,t,n){var r=1,s=new qt(e);if(!s.isint()&&n){var i=Math.abs(e);i<1?(r=new qt(10).pow(Hv.getDigitCount(e)-1),s=new qt(Math.floor(s.div(r).toNumber())).mul(r)):i>1&&(s=new qt(Math.floor(e)))}else e===0?s=new qt(Math.floor((t-1)/2)):n||(s=new qt(Math.floor(e)));var l=Math.floor((t-1)/2),u=Cbe(Sbe(function(d){return s.add(new qt(d-l).mul(r)).toNumber()}),VC);return u(0,t)}function e9(e,t,n,r){var s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((t-e)/(n-1)))return{step:new qt(0),tickMin:new qt(0),tickMax:new qt(0)};var i=J7(new qt(t).sub(e).div(n-1),r,s),l;e<=0&&t>=0?l=new qt(0):(l=new qt(e).add(t).div(2),l=l.sub(new qt(l).mod(i)));var u=Math.ceil(l.sub(e).div(i).toNumber()),d=Math.ceil(new qt(t).sub(l).div(i).toNumber()),f=u+d+1;return f>n?e9(e,t,n,r,s+1):(f<n&&(d=t>0?d+(n-f):d,u=t>0?u:u+(n-f)),{step:i,tickMin:l.sub(new qt(u).mul(i)),tickMax:l.add(new qt(d).mul(i))})}function Lbe(e){var t=Wm(e,2),n=t[0],r=t[1],s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,l=Math.max(s,2),u=Z7([n,r]),d=Wm(u,2),f=d[0],h=d[1];if(f===-1/0||h===1/0){var p=h===1/0?[f].concat(KC(VC(0,s-1).map(function(){return 1/0}))):[].concat(KC(VC(0,s-1).map(function(){return-1/0})),[h]);return n>r?GC(p):p}if(f===h)return Ibe(f,s,i);var x=e9(f,h,l,i),y=x.step,w=x.tickMin,j=x.tickMax,b=Hv.rangeStep(w,j.add(new qt(.1).mul(y)),y);return n>r?GC(b):b}function Fbe(e,t){var n=Wm(e,2),r=n[0],s=n[1],i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,l=Z7([r,s]),u=Wm(l,2),d=u[0],f=u[1];if(d===-1/0||f===1/0)return[r,s];if(d===f)return[d];var h=Math.max(t,2),p=J7(new qt(f).sub(d).div(h-1),i,0),x=[].concat(KC(Hv.rangeStep(new qt(d),new qt(f).sub(new qt(.99).mul(p)),p)),[f]);return r>s?GC(x):x}var qbe=X7(Lbe),Bbe=X7(Fbe),zbe="Invariant failed";function Yl(e,t){throw new Error(zbe)}var Ube=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function Ku(e){"@babel/helpers - typeof";return Ku=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ku(e)}function by(){return by=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},by.apply(this,arguments)}function Hbe(e,t){return Wbe(e)||Kbe(e,t)||Gbe(e,t)||Vbe()}function Vbe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
34In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Gbe(e,t){if(e){if(typeof e=="string")return YI(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return YI(e,t)}}function YI(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Kbe(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,s,i,l,u=[],d=!0,f=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(d=(r=i.call(n)).done)&&(u.push(r.value),u.length!==t);d=!0);}catch(h){f=!0,s=h}finally{try{if(!d&&n.return!=null&&(l=n.return(),Object(l)!==l))return}finally{if(f)throw s}}return u}}function Wbe(e){if(Array.isArray(e))return e}function Ybe(e,t){if(e==null)return{};var n=Xbe(e,t),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)r=i[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Xbe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Qbe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Zbe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r9(r.key),r)}}function Jbe(e,t,n){return t&&Zbe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function e0e(e,t,n){return t=jy(t),t0e(e,t9()?Reflect.construct(t,n||[],jy(e).constructor):t.apply(e,n))}function t0e(e,t){if(t&&(Ku(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return n0e(e)}function n0e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function t9(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(t9=function(){return!!e})()}function jy(e){return jy=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},jy(e)}function r0e(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&YC(e,t)}function YC(e,t){return YC=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},YC(e,t)}function n9(e,t,n){return t=r9(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r9(e){var t=a0e(e,"string");return Ku(t)=="symbol"?t:t+""}function a0e(e,t){if(Ku(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Ku(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var zh=(function(e){function t(){return Qbe(this,t),e0e(this,t,arguments)}return r0e(t,e),Jbe(t,[{key:"render",value:function(){var r=this.props,s=r.offset,i=r.layout,l=r.width,u=r.dataKey,d=r.data,f=r.dataPointFormatter,h=r.xAxis,p=r.yAxis,x=Ybe(r,Ube),y=gt(x,!1);this.props.direction==="x"&&h.type!=="number"&&Yl();var w=d.map(function(j){var b=f(j,u),C=b.x,N=b.y,k=b.value,T=b.errorVal;if(!T)return null;var A=[],P,E;if(Array.isArray(T)){var _=Hbe(T,2);P=_[0],E=_[1]}else P=E=T;if(i==="vertical"){var R=h.scale,H=N+s,L=H+l,I=H-l,W=R(k-P),U=R(k+E);A.push({x1:U,y1:L,x2:U,y2:I}),A.push({x1:W,y1:H,x2:U,y2:H}),A.push({x1:W,y1:L,x2:W,y2:I})}else if(i==="horizontal"){var V=p.scale,D=C+s,q=D-l,K=D+l,Y=V(k-P),z=V(k+E);A.push({x1:q,y1:z,x2:K,y2:z}),A.push({x1:D,y1:Y,x2:D,y2:z}),A.push({x1:q,y1:Y,x2:K,y2:Y})}return ie.createElement(pn,by({className:"recharts-errorBar",key:"bar-".concat(A.map(function(Z){return"".concat(Z.x1,"-").concat(Z.x2,"-").concat(Z.y1,"-").concat(Z.y2)}))},y),A.map(function(Z){return ie.createElement("line",by({},Z,{key:"line-".concat(Z.x1,"-").concat(Z.x2,"-").concat(Z.y1,"-").concat(Z.y2)}))}))});return ie.createElement(pn,{className:"recharts-errorBars"},w)}}])})(ie.Component);n9(zh,"defaultProps",{stroke:"black",strokeWidth:1.5,width:5,offset:0,layout:"horizontal"});n9(zh,"displayName","ErrorBar");function Ym(e){"@babel/helpers - typeof";return Ym=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ym(e)}function XI(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function Nl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?XI(Object(n),!0).forEach(function(r){s0e(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):XI(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function s0e(e,t,n){return t=i0e(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i0e(e){var t=o0e(e,"string");return Ym(t)=="symbol"?t:t+""}function o0e(e,t){if(Ym(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Ym(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var a9=function(t){var n=t.children,r=t.formattedGraphicalItems,s=t.legendWidth,i=t.legendContent,l=sa(n,Ou);if(!l)return null;var u=Ou.defaultProps,d=u!==void 0?Nl(Nl({},u),l.props):{},f;return l.props&&l.props.payload?f=l.props&&l.props.payload:i==="children"?f=(r||[]).reduce(function(h,p){var x=p.item,y=p.props,w=y.sectors||y.data||[];return h.concat(w.map(function(j){return{type:l.props.iconType||x.props.legendType,value:j.name,color:j.fill,payload:j}}))},[]):f=(r||[]).map(function(h){var p=h.item,x=p.type.defaultProps,y=x!==void 0?Nl(Nl({},x),p.props):{},w=y.dataKey,j=y.name,b=y.legendType,C=y.hide;return{inactive:C,dataKey:w,type:d.iconType||b||"square",color:sO(p),value:j||w,payload:y}}),Nl(Nl(Nl({},d),Ou.getWithHeight(l,s)),{},{payload:f,item:l})};function Xm(e){"@babel/helpers - typeof";return Xm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Xm(e)}function QI(e){return d0e(e)||u0e(e)||c0e(e)||l0e()}function l0e(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
35In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function c0e(e,t){if(e){if(typeof e=="string")return XC(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return XC(e,t)}}function u0e(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function d0e(e){if(Array.isArray(e))return XC(e)}function XC(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ZI(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function dn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ZI(Object(n),!0).forEach(function(r){Eu(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ZI(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Eu(e,t,n){return t=f0e(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function f0e(e){var t=m0e(e,"string");return Xm(t)=="symbol"?t:t+""}function m0e(e,t){if(Xm(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Xm(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ca(e,t,n){return pt(e)||pt(t)?n:Mn(t)?Pa(e,t,n):ut(t)?t(e):n}function jm(e,t,n,r){var s=dbe(e,function(u){return ca(u,t)});if(n==="number"){var i=s.filter(function(u){return Ie(u)||parseFloat(u)});return i.length?[Bv(i),qv(i)]:[1/0,-1/0]}var l=r?s.filter(function(u){return!pt(u)}):s;return l.map(function(u){return Mn(u)||u instanceof Date?u:""})}var h0e=function(t){var n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],s=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,l=-1,u=(n=r?.length)!==null&&n!==void 0?n:0;if(u<=1)return 0;if(i&&i.axisType==="angleAxis"&&Math.abs(Math.abs(i.range[1]-i.range[0])-360)<=1e-6)for(var d=i.range,f=0;f<u;f++){var h=f>0?s[f-1].coordinate:s[u-1].coordinate,p=s[f].coordinate,x=f>=u-1?s[0].coordinate:s[f+1].coordinate,y=void 0;if(ns(p-h)!==ns(x-p)){var w=[];if(ns(x-p)===ns(d[1]-d[0])){y=x;var j=p+d[1]-d[0];w[0]=Math.min(j,(j+h)/2),w[1]=Math.max(j,(j+h)/2)}else{y=h;var b=x+d[1]-d[0];w[0]=Math.min(p,(b+p)/2),w[1]=Math.max(p,(b+p)/2)}var C=[Math.min(p,(y+p)/2),Math.max(p,(y+p)/2)];if(t>C[0]&&t<=C[1]||t>=w[0]&&t<=w[1]){l=s[f].index;break}}else{var N=Math.min(h,x),k=Math.max(h,x);if(t>(N+p)/2&&t<=(k+p)/2){l=s[f].index;break}}}else for(var T=0;T<u;T++)if(T===0&&t<=(r[T].coordinate+r[T+1].coordinate)/2||T>0&&T<u-1&&t>(r[T].coordinate+r[T-1].coordinate)/2&&t<=(r[T].coordinate+r[T+1].coordinate)/2||T===u-1&&t>(r[T].coordinate+r[T-1].coordinate)/2){l=r[T].index;break}return l},sO=function(t){var n,r=t,s=r.type.displayName,i=(n=t.type)!==null&&n!==void 0&&n.defaultProps?dn(dn({},t.type.defaultProps),t.props):t.props,l=i.stroke,u=i.fill,d;switch(s){case"Line":d=l;break;case"Area":case"Radar":d=l&&l!=="none"?l:u;break;default:d=u;break}return d},p0e=function(t){var n=t.barSize,r=t.totalSize,s=t.stackGroups,i=s===void 0?{}:s;if(!i)return{};for(var l={},u=Object.keys(i),d=0,f=u.length;d<f;d++)for(var h=i[u[d]].stackGroups,p=Object.keys(h),x=0,y=p.length;x<y;x++){var w=h[p[x]],j=w.items,b=w.cateAxisId,C=j.filter(function(E){return ji(E.type).indexOf("Bar")>=0});if(C&&C.length){var N=C[0].type.defaultProps,k=N!==void 0?dn(dn({},N),C[0].props):C[0].props,T=k.barSize,A=k[b];l[A]||(l[A]=[]);var P=pt(T)?n:T;l[A].push({item:C[0],stackList:C.slice(1),barSize:pt(P)?void 0:Kl(P,r,0)})}}return l},x0e=function(t){var n=t.barGap,r=t.barCategoryGap,s=t.bandSize,i=t.sizeList,l=i===void 0?[]:i,u=t.maxBarSize,d=l.length;if(d<1)return null;var f=Kl(n,s,0,!0),h,p=[];if(l[0].barSize===+l[0].barSize){var x=!1,y=s/d,w=l.reduce(function(T,A){return T+A.barSize||0},0);w+=(d-1)*f,w>=s&&(w-=(d-1)*f,f=0),w>=s&&y>0&&(x=!0,y*=.9,w=d*y);var j=(s-w)/2>>0,b={offset:j-f,size:0};h=l.reduce(function(T,A){var P={item:A.item,position:{offset:b.offset+b.size+f,size:x?y:A.barSize}},E=[].concat(QI(T),[P]);return b=E[E.length-1].position,A.stackList&&A.stackList.length&&A.stackList.forEach(function(_){E.push({item:_,position:b})}),E},p)}else{var C=Kl(r,s,0,!0);s-2*C-(d-1)*f<=0&&(f=0);var N=(s-2*C-(d-1)*f)/d;N>1&&(N>>=0);var k=u===+u?Math.min(N,u):N;h=l.reduce(function(T,A,P){var E=[].concat(QI(T),[{item:A.item,position:{offset:C+(N+f)*P+(N-k)/2,size:k}}]);return A.stackList&&A.stackList.length&&A.stackList.forEach(function(_){E.push({item:_,position:E[E.length-1].position})}),E},p)}return h},g0e=function(t,n,r,s){var i=r.children,l=r.width,u=r.margin,d=l-(u.left||0)-(u.right||0),f=a9({children:i,legendWidth:d});if(f){var h=s||{},p=h.width,x=h.height,y=f.align,w=f.verticalAlign,j=f.layout;if((j==="vertical"||j==="horizontal"&&w==="middle")&&y!=="center"&&Ie(t[y]))return dn(dn({},t),{},Eu({},y,t[y]+(p||0)));if((j==="horizontal"||j==="vertical"&&y==="center")&&w!=="middle"&&Ie(t[w]))return dn(dn({},t),{},Eu({},w,t[w]+(x||0)))}return t},y0e=function(t,n,r){return pt(n)?!0:t==="horizontal"?n==="yAxis":t==="vertical"||r==="x"?n==="xAxis":r==="y"?n==="yAxis":!0},s9=function(t,n,r,s,i){var l=n.props.children,u=Ea(l,zh).filter(function(f){return y0e(s,i,f.props.direction)});if(u&&u.length){var d=u.map(function(f){return f.props.dataKey});return t.reduce(function(f,h){var p=ca(h,r);if(pt(p))return f;var x=Array.isArray(p)?[Bv(p),qv(p)]:[p,p],y=d.reduce(function(w,j){var b=ca(h,j,0),C=x[0]-Math.abs(Array.isArray(b)?b[0]:b),N=x[1]+Math.abs(Array.isArray(b)?b[1]:b);return[Math.min(C,w[0]),Math.max(N,w[1])]},[1/0,-1/0]);return[Math.min(y[0],f[0]),Math.max(y[1],f[1])]},[1/0,-1/0])}return null},v0e=function(t,n,r,s,i){var l=n.map(function(u){return s9(t,u,r,i,s)}).filter(function(u){return!pt(u)});return l&&l.length?l.reduce(function(u,d){return[Math.min(u[0],d[0]),Math.max(u[1],d[1])]},[1/0,-1/0]):null},i9=function(t,n,r,s,i){var l=n.map(function(d){var f=d.props.dataKey;return r==="number"&&f&&s9(t,d,f,s)||jm(t,f,r,i)});if(r==="number")return l.reduce(function(d,f){return[Math.min(d[0],f[0]),Math.max(d[1],f[1])]},[1/0,-1/0]);var u={};return l.reduce(function(d,f){for(var h=0,p=f.length;h<p;h++)u[f[h]]||(u[f[h]]=!0,d.push(f[h]));return d},[])},o9=function(t,n){return t==="horizontal"&&n==="xAxis"||t==="vertical"&&n==="yAxis"||t==="centric"&&n==="angleAxis"||t==="radial"&&n==="radiusAxis"},l9=function(t,n,r,s){if(s)return t.map(function(d){return d.coordinate});var i,l,u=t.map(function(d){return d.coordinate===n&&(i=!0),d.coordinate===r&&(l=!0),d.coordinate});return i||u.push(n),l||u.push(r),u},vi=function(t,n,r){if(!t)return null;var s=t.scale,i=t.duplicateDomain,l=t.type,u=t.range,d=t.realScaleType==="scaleBand"?s.bandwidth()/2:2,f=(n||r)&&l==="category"&&s.bandwidth?s.bandwidth()/d:0;if(f=t.axisType==="angleAxis"&&u?.length>=2?ns(u[0]-u[1])*2*f:f,n&&(t.ticks||t.niceTicks)){var h=(t.ticks||t.niceTicks).map(function(p){var x=i?i.indexOf(p):p;return{coordinate:s(x)+f,value:p,offset:f}});return h.filter(function(p){return!Dh(p.coordinate)})}return t.isCategorical&&t.categoricalDomain?t.categoricalDomain.map(function(p,x){return{coordinate:s(p)+f,value:p,index:x,offset:f}}):s.ticks&&!r?s.ticks(t.tickCount).map(function(p){return{coordinate:s(p)+f,value:p,offset:f}}):s.domain().map(function(p,x){return{coordinate:s(p)+f,value:i?i[p]:p,index:x,offset:f}})},AS=new WeakMap,Rx=function(t,n){if(typeof n!="function")return t;AS.has(t)||AS.set(t,new WeakMap);var r=AS.get(t);if(r.has(n))return r.get(n);var s=function(){t.apply(void 0,arguments),n.apply(void 0,arguments)};return r.set(n,s),s},b0e=function(t,n,r){var s=t.scale,i=t.type,l=t.layout,u=t.axisType;if(s==="auto")return l==="radial"&&u==="radiusAxis"?{scale:zm(),realScaleType:"band"}:l==="radial"&&u==="angleAxis"?{scale:py(),realScaleType:"linear"}:i==="category"&&n&&(n.indexOf("LineChart")>=0||n.indexOf("AreaChart")>=0||n.indexOf("ComposedChart")>=0&&!r)?{scale:bm(),realScaleType:"point"}:i==="category"?{scale:zm(),realScaleType:"band"}:{scale:py(),realScaleType:"linear"};if(Gl(s)){var d="scale".concat(Tv(s));return{scale:(II[d]||bm)(),realScaleType:II[d]?d:"point"}}return ut(s)?{scale:s}:{scale:bm(),realScaleType:"point"}},JI=1e-4,j0e=function(t){var n=t.domain();if(!(!n||n.length<=2)){var r=n.length,s=t.range(),i=Math.min(s[0],s[1])-JI,l=Math.max(s[0],s[1])+JI,u=t(n[0]),d=t(n[r-1]);(u<i||u>l||d<i||d>l)&&t.domain([n[0],n[r-1]])}},w0e=function(t,n){if(!t)return null;for(var r=0,s=t.length;r<s;r++)if(t[r].item===n)return t[r].position;return null},N0e=function(t,n){if(!n||n.length!==2||!Ie(n[0])||!Ie(n[1]))return t;var r=Math.min(n[0],n[1]),s=Math.max(n[0],n[1]),i=[t[0],t[1]];return(!Ie(t[0])||t[0]<r)&&(i[0]=r),(!Ie(t[1])||t[1]>s)&&(i[1]=s),i[0]>s&&(i[0]=s),i[1]<r&&(i[1]=r),i},S0e=function(t){var n=t.length;if(!(n<=0))for(var r=0,s=t[0].length;r<s;++r)for(var i=0,l=0,u=0;u<n;++u){var d=Dh(t[u][r][1])?t[u][r][0]:t[u][r][1];d>=0?(t[u][r][0]=i,t[u][r][1]=i+d,i=t[u][r][1]):(t[u][r][0]=l,t[u][r][1]=l+d,l=t[u][r][1])}},C0e=function(t){var n=t.length;if(!(n<=0))for(var r=0,s=t[0].length;r<s;++r)for(var i=0,l=0;l<n;++l){var u=Dh(t[l][r][1])?t[l][r][0]:t[l][r][1];u>=0?(t[l][r][0]=i,t[l][r][1]=i+u,i=t[l][r][1]):(t[l][r][0]=0,t[l][r][1]=0)}},A0e={sign:S0e,expand:che,none:Fu,silhouette:uhe,wiggle:dhe,positive:C0e},T0e=function(t,n,r){var s=n.map(function(u){return u.props.dataKey}),i=A0e[r],l=lhe().keys(s).value(function(u,d){return+ca(u,d,0)}).order(AC).offset(i);return l(t)},k0e=function(t,n,r,s,i,l){if(!t)return null;var u=l?n.reverse():n,d={},f=u.reduce(function(p,x){var y,w=(y=x.type)!==null&&y!==void 0&&y.defaultProps?dn(dn({},x.type.defaultProps),x.props):x.props,j=w.stackId,b=w.hide;if(b)return p;var C=w[r],N=p[C]||{hasStack:!1,stackGroups:{}};if(Mn(j)){var k=N.stackGroups[j]||{numericAxisId:r,cateAxisId:s,items:[]};k.items.push(x),N.hasStack=!0,N.stackGroups[j]=k}else N.stackGroups[$h("_stackId_")]={numericAxisId:r,cateAxisId:s,items:[x]};return dn(dn({},p),{},Eu({},C,N))},d),h={};return Object.keys(f).reduce(function(p,x){var y=f[x];if(y.hasStack){var w={};y.stackGroups=Object.keys(y.stackGroups).reduce(function(j,b){var C=y.stackGroups[b];return dn(dn({},j),{},Eu({},b,{numericAxisId:r,cateAxisId:s,items:C.items,stackedData:T0e(t,C.items,i)}))},w)}return dn(dn({},p),{},Eu({},x,y))},h)},O0e=function(t,n){var r=n.realScaleType,s=n.type,i=n.tickCount,l=n.originalDomain,u=n.allowDecimals,d=r||n.scale;if(d!=="auto"&&d!=="linear")return null;if(i&&s==="number"&&l&&(l[0]==="auto"||l[1]==="auto")){var f=t.domain();if(!f.length)return null;var h=qbe(f,i,u);return t.domain([Bv(h),qv(h)]),{niceTicks:h}}if(i&&s==="number"){var p=t.domain(),x=Bbe(p,i,u);return{niceTicks:x}}return null};function eL(e){var t=e.axis,n=e.ticks,r=e.bandSize,s=e.entry,i=e.index,l=e.dataKey;if(t.type==="category"){if(!t.allowDuplicatedCategory&&t.dataKey&&!pt(s[t.dataKey])){var u=Wg(n,"value",s[t.dataKey]);if(u)return u.coordinate+r/2}return n[i]?n[i].coordinate+r/2:null}var d=ca(s,pt(l)?t.dataKey:l);return pt(d)?null:t.scale(d)}var tL=function(t){var n=t.axis,r=t.ticks,s=t.offset,i=t.bandSize,l=t.entry,u=t.index;if(n.type==="category")return r[u]?r[u].coordinate+s:null;var d=ca(l,n.dataKey,n.domain[u]);return pt(d)?null:n.scale(d)-i/2+s},P0e=function(t){var n=t.numericAxis,r=n.scale.domain();if(n.type==="number"){var s=Math.min(r[0],r[1]),i=Math.max(r[0],r[1]);return s<=0&&i>=0?0:i<0?i:s}return r[0]},E0e=function(t,n){var r,s=(r=t.type)!==null&&r!==void 0&&r.defaultProps?dn(dn({},t.type.defaultProps),t.props):t.props,i=s.stackId;if(Mn(i)){var l=n[i];if(l){var u=l.items.indexOf(t);return u>=0?l.stackedData[u]:null}}return null},_0e=function(t){return t.reduce(function(n,r){return[Bv(r.concat([n[0]]).filter(Ie)),qv(r.concat([n[1]]).filter(Ie))]},[1/0,-1/0])},c9=function(t,n,r){return Object.keys(t).reduce(function(s,i){var l=t[i],u=l.stackedData,d=u.reduce(function(f,h){var p=_0e(h.slice(n,r+1));return[Math.min(f[0],p[0]),Math.max(f[1],p[1])]},[1/0,-1/0]);return[Math.min(d[0],s[0]),Math.max(d[1],s[1])]},[1/0,-1/0]).map(function(s){return s===1/0||s===-1/0?0:s})},nL=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,rL=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,QC=function(t,n,r){if(ut(t))return t(n,r);if(!Array.isArray(t))return n;var s=[];if(Ie(t[0]))s[0]=r?t[0]:Math.min(t[0],n[0]);else if(nL.test(t[0])){var i=+nL.exec(t[0])[1];s[0]=n[0]-i}else ut(t[0])?s[0]=t[0](n[0]):s[0]=n[0];if(Ie(t[1]))s[1]=r?t[1]:Math.max(t[1],n[1]);else if(rL.test(t[1])){var l=+rL.exec(t[1])[1];s[1]=n[1]+l}else ut(t[1])?s[1]=t[1](n[1]):s[1]=n[1];return s},wy=function(t,n,r){if(t&&t.scale&&t.scale.bandwidth){var s=t.scale.bandwidth();if(!r||s>0)return s}if(t&&n&&n.length>=2){for(var i=Mk(n,function(p){return p.coordinate}),l=1/0,u=1,d=i.length;u<d;u++){var f=i[u],h=i[u-1];l=Math.min((f.coordinate||0)-(h.coordinate||0),l)}return l===1/0?0:l}return r?void 0:0},aL=function(t,n,r){return!t||!t.length||zv(t,Pa(r,"type.defaultProps.domain"))?n:t},u9=function(t,n){var r=t.type.defaultProps?dn(dn({},t.type.defaultProps),t.props):t.props,s=r.dataKey,i=r.name,l=r.unit,u=r.formatter,d=r.tooltipType,f=r.chartType,h=r.hide;return dn(dn({},gt(t,!1)),{},{dataKey:s,unit:l,formatter:u,name:i||s,color:sO(t),value:ca(n,s),type:d,payload:n,chartType:f,hide:h})};function Qm(e){"@babel/helpers - typeof";return Qm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Qm(e)}function sL(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function iL(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?sL(Object(n),!0).forEach(function(r){M0e(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):sL(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function M0e(e,t,n){return t=R0e(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function R0e(e){var t=D0e(e,"string");return Qm(t)=="symbol"?t:t+""}function D0e(e,t){if(Qm(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Qm(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Ny=Math.PI/180,$0e=function(t){return t*180/Math.PI},er=function(t,n,r,s){return{x:t+Math.cos(-Ny*s)*r,y:n+Math.sin(-Ny*s)*r}},I0e=function(t,n){var r=t.x,s=t.y,i=n.x,l=n.y;return Math.sqrt(Math.pow(r-i,2)+Math.pow(s-l,2))},L0e=function(t,n){var r=t.x,s=t.y,i=n.cx,l=n.cy,u=I0e({x:r,y:s},{x:i,y:l});if(u<=0)return{radius:u};var d=(r-i)/u,f=Math.acos(d);return s>l&&(f=2*Math.PI-f),{radius:u,angle:$0e(f),angleInRadian:f}},F0e=function(t){var n=t.startAngle,r=t.endAngle,s=Math.floor(n/360),i=Math.floor(r/360),l=Math.min(s,i);return{startAngle:n-l*360,endAngle:r-l*360}},q0e=function(t,n){var r=n.startAngle,s=n.endAngle,i=Math.floor(r/360),l=Math.floor(s/360),u=Math.min(i,l);return t+u*360},oL=function(t,n){var r=t.x,s=t.y,i=L0e({x:r,y:s},n),l=i.radius,u=i.angle,d=n.innerRadius,f=n.outerRadius;if(l<d||l>f)return!1;if(l===0)return!0;var h=F0e(n),p=h.startAngle,x=h.endAngle,y=u,w;if(p<=x){for(;y>x;)y-=360;for(;y<p;)y+=360;w=y>=p&&y<=x}else{for(;y>p;)y-=360;for(;y<x;)y+=360;w=y>=x&&y<=p}return w?iL(iL({},n),{},{radius:l,angle:q0e(y,n)}):null};function Zm(e){"@babel/helpers - typeof";return Zm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Zm(e)}var B0e=["offset"];function z0e(e){return G0e(e)||V0e(e)||H0e(e)||U0e()}function U0e(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
36In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function H0e(e,t){if(e){if(typeof e=="string")return ZC(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ZC(e,t)}}function V0e(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function G0e(e){if(Array.isArray(e))return ZC(e)}function ZC(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function K0e(e,t){if(e==null)return{};var n=W0e(e,t),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)r=i[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function W0e(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function lL(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function Pn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?lL(Object(n),!0).forEach(function(r){Y0e(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):lL(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Y0e(e,t,n){return t=X0e(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function X0e(e){var t=Q0e(e,"string");return Zm(t)=="symbol"?t:t+""}function Q0e(e,t){if(Zm(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Zm(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Jm(){return Jm=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Jm.apply(this,arguments)}var Z0e=function(t){var n=t.value,r=t.formatter,s=pt(t.children)?n:t.children;return ut(r)?r(s):s},J0e=function(t,n){var r=ns(n-t),s=Math.min(Math.abs(n-t),360);return r*s},eje=function(t,n,r){var s=t.position,i=t.viewBox,l=t.offset,u=t.className,d=i,f=d.cx,h=d.cy,p=d.innerRadius,x=d.outerRadius,y=d.startAngle,w=d.endAngle,j=d.clockWise,b=(p+x)/2,C=J0e(y,w),N=C>=0?1:-1,k,T;s==="insideStart"?(k=y+N*l,T=j):s==="insideEnd"?(k=w-N*l,T=!j):s==="end"&&(k=w+N*l,T=j),T=C<=0?T:!T;var A=er(f,h,b,k),P=er(f,h,b,k+(T?1:-1)*359),E="M".concat(A.x,",").concat(A.y,`
37    A`).concat(b,",").concat(b,",0,1,").concat(T?0:1,`,
38    `).concat(P.x,",").concat(P.y),_=pt(t.id)?$h("recharts-radial-line-"):t.id;return ie.createElement("text",Jm({},r,{dominantBaseline:"central",className:yt("recharts-radial-bar-label",u)}),ie.createElement("defs",null,ie.createElement("path",{id:_,d:E})),ie.createElement("textPath",{xlinkHref:"#".concat(_)},n))},tje=function(t){var n=t.viewBox,r=t.offset,s=t.position,i=n,l=i.cx,u=i.cy,d=i.innerRadius,f=i.outerRadius,h=i.startAngle,p=i.endAngle,x=(h+p)/2;if(s==="outside"){var y=er(l,u,f+r,x),w=y.x,j=y.y;return{x:w,y:j,textAnchor:w>=l?"start":"end",verticalAnchor:"middle"}}if(s==="center")return{x:l,y:u,textAnchor:"middle",verticalAnchor:"middle"};if(s==="centerTop")return{x:l,y:u,textAnchor:"middle",verticalAnchor:"start"};if(s==="centerBottom")return{x:l,y:u,textAnchor:"middle",verticalAnchor:"end"};var b=(d+f)/2,C=er(l,u,b,x),N=C.x,k=C.y;return{x:N,y:k,textAnchor:"middle",verticalAnchor:"middle"}},nje=function(t){var n=t.viewBox,r=t.parentViewBox,s=t.offset,i=t.position,l=n,u=l.x,d=l.y,f=l.width,h=l.height,p=h>=0?1:-1,x=p*s,y=p>0?"end":"start",w=p>0?"start":"end",j=f>=0?1:-1,b=j*s,C=j>0?"end":"start",N=j>0?"start":"end";if(i==="top"){var k={x:u+f/2,y:d-p*s,textAnchor:"middle",verticalAnchor:y};return Pn(Pn({},k),r?{height:Math.max(d-r.y,0),width:f}:{})}if(i==="bottom"){var T={x:u+f/2,y:d+h+x,textAnchor:"middle",verticalAnchor:w};return Pn(Pn({},T),r?{height:Math.max(r.y+r.height-(d+h),0),width:f}:{})}if(i==="left"){var A={x:u-b,y:d+h/2,textAnchor:C,verticalAnchor:"middle"};return Pn(Pn({},A),r?{width:Math.max(A.x-r.x,0),height:h}:{})}if(i==="right"){var P={x:u+f+b,y:d+h/2,textAnchor:N,verticalAnchor:"middle"};return Pn(Pn({},P),r?{width:Math.max(r.x+r.width-P.x,0),height:h}:{})}var E=r?{width:f,height:h}:{};return i==="insideLeft"?Pn({x:u+b,y:d+h/2,textAnchor:N,verticalAnchor:"middle"},E):i==="insideRight"?Pn({x:u+f-b,y:d+h/2,textAnchor:C,verticalAnchor:"middle"},E):i==="insideTop"?Pn({x:u+f/2,y:d+x,textAnchor:"middle",verticalAnchor:w},E):i==="insideBottom"?Pn({x:u+f/2,y:d+h-x,textAnchor:"middle",verticalAnchor:y},E):i==="insideTopLeft"?Pn({x:u+b,y:d+x,textAnchor:N,verticalAnchor:w},E):i==="insideTopRight"?Pn({x:u+f-b,y:d+x,textAnchor:C,verticalAnchor:w},E):i==="insideBottomLeft"?Pn({x:u+b,y:d+h-x,textAnchor:N,verticalAnchor:y},E):i==="insideBottomRight"?Pn({x:u+f-b,y:d+h-x,textAnchor:C,verticalAnchor:y},E):Cd(i)&&(Ie(i.x)||Rl(i.x))&&(Ie(i.y)||Rl(i.y))?Pn({x:u+Kl(i.x,f),y:d+Kl(i.y,h),textAnchor:"end",verticalAnchor:"end"},E):Pn({x:u+f/2,y:d+h/2,textAnchor:"middle",verticalAnchor:"middle"},E)},rje=function(t){return"cx"in t&&Ie(t.cx)};function cr(e){var t=e.offset,n=t===void 0?5:t,r=K0e(e,B0e),s=Pn({offset:n},r),i=s.viewBox,l=s.position,u=s.value,d=s.children,f=s.content,h=s.className,p=h===void 0?"":h,x=s.textBreakAll;if(!i||pt(u)&&pt(d)&&!v.isValidElement(f)&&!ut(f))return null;if(v.isValidElement(f))return v.cloneElement(f,s);var y;if(ut(f)){if(y=v.createElement(f,s),v.isValidElement(y))return y}else y=Z0e(s);var w=rje(i),j=gt(s,!0);if(w&&(l==="insideStart"||l==="insideEnd"||l==="end"))return eje(s,y,j);var b=w?tje(s):nje(s);return ie.createElement(oy,Jm({className:yt("recharts-label",p)},j,b,{breakAll:x}),y)}cr.displayName="Label";var d9=function(t){var n=t.cx,r=t.cy,s=t.angle,i=t.startAngle,l=t.endAngle,u=t.r,d=t.radius,f=t.innerRadius,h=t.outerRadius,p=t.x,x=t.y,y=t.top,w=t.left,j=t.width,b=t.height,C=t.clockWise,N=t.labelViewBox;if(N)return N;if(Ie(j)&&Ie(b)){if(Ie(p)&&Ie(x))return{x:p,y:x,width:j,height:b};if(Ie(y)&&Ie(w))return{x:y,y:w,width:j,height:b}}return Ie(p)&&Ie(x)?{x:p,y:x,width:0,height:0}:Ie(n)&&Ie(r)?{cx:n,cy:r,startAngle:i||s||0,endAngle:l||s||0,innerRadius:f||0,outerRadius:h||d||u||0,clockWise:C}:t.viewBox?t.viewBox:{}},aje=function(t,n){return t?t===!0?ie.createElement(cr,{key:"label-implicit",viewBox:n}):Mn(t)?ie.createElement(cr,{key:"label-implicit",viewBox:n,value:t}):v.isValidElement(t)?t.type===cr?v.cloneElement(t,{key:"label-implicit",viewBox:n}):ie.createElement(cr,{key:"label-implicit",content:t,viewBox:n}):ut(t)?ie.createElement(cr,{key:"label-implicit",content:t,viewBox:n}):Cd(t)?ie.createElement(cr,Jm({viewBox:n},t,{key:"label-implicit"})):null:null},sje=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!t||!t.children&&r&&!t.label)return null;var s=t.children,i=d9(t),l=Ea(s,cr).map(function(d,f){return v.cloneElement(d,{viewBox:n||i,key:"label-".concat(f)})});if(!r)return l;var u=aje(t.label,n||i);return[u].concat(z0e(l))};cr.parseViewBox=d9;cr.renderCallByParent=sje;var TS,cL;function ije(){if(cL)return TS;cL=1;function e(t){var n=t==null?0:t.length;return n?t[n-1]:void 0}return TS=e,TS}var oje=ije();const lje=Bt(oje);function eh(e){"@babel/helpers - typeof";return eh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},eh(e)}var cje=["valueAccessor"],uje=["data","dataKey","clockWise","id","textBreakAll"];function dje(e){return pje(e)||hje(e)||mje(e)||fje()}function fje(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
39In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function mje(e,t){if(e){if(typeof e=="string")return JC(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return JC(e,t)}}function hje(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function pje(e){if(Array.isArray(e))return JC(e)}function JC(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Sy(){return Sy=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Sy.apply(this,arguments)}function uL(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function dL(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?uL(Object(n),!0).forEach(function(r){xje(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):uL(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function xje(e,t,n){return t=gje(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function gje(e){var t=yje(e,"string");return eh(t)=="symbol"?t:t+""}function yje(e,t){if(eh(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(eh(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function fL(e,t){if(e==null)return{};var n=vje(e,t),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)r=i[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function vje(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var bje=function(t){return Array.isArray(t.value)?lje(t.value):t.value};function _o(e){var t=e.valueAccessor,n=t===void 0?bje:t,r=fL(e,cje),s=r.data,i=r.dataKey,l=r.clockWise,u=r.id,d=r.textBreakAll,f=fL(r,uje);return!s||!s.length?null:ie.createElement(pn,{className:"recharts-label-list"},s.map(function(h,p){var x=pt(i)?n(h,p):ca(h&&h.payload,i),y=pt(u)?{}:{id:"".concat(u,"-").concat(p)};return ie.createElement(cr,Sy({},gt(h,!0),f,y,{parentViewBox:h.parentViewBox,value:x,textBreakAll:d,viewBox:cr.parseViewBox(pt(l)?h:dL(dL({},h),{},{clockWise:l})),key:"label-".concat(p),index:p}))}))}_o.displayName="LabelList";function jje(e,t){return e?e===!0?ie.createElement(_o,{key:"labelList-implicit",data:t}):ie.isValidElement(e)||ut(e)?ie.createElement(_o,{key:"labelList-implicit",data:t,content:e}):Cd(e)?ie.createElement(_o,Sy({data:t},e,{key:"labelList-implicit"})):null:null}function wje(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&n&&!e.label)return null;var r=e.children,s=Ea(r,_o).map(function(l,u){return v.cloneElement(l,{data:t,key:"labelList-".concat(u)})});if(!n)return s;var i=jje(e.label,t);return[i].concat(dje(s))}_o.renderCallByParent=wje;function th(e){"@babel/helpers - typeof";return th=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},th(e)}function eA(){return eA=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},eA.apply(this,arguments)}function mL(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function hL(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?mL(Object(n),!0).forEach(function(r){Nje(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):mL(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Nje(e,t,n){return t=Sje(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Sje(e){var t=Cje(e,"string");return th(t)=="symbol"?t:t+""}function Cje(e,t){if(th(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(th(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Aje=function(t,n){var r=ns(n-t),s=Math.min(Math.abs(n-t),359.999);return r*s},Dx=function(t){var n=t.cx,r=t.cy,s=t.radius,i=t.angle,l=t.sign,u=t.isExternal,d=t.cornerRadius,f=t.cornerIsExternal,h=d*(u?1:-1)+s,p=Math.asin(d/h)/Ny,x=f?i:i+l*p,y=er(n,r,h,x),w=er(n,r,s,x),j=f?i-l*p:i,b=er(n,r,h*Math.cos(p*Ny),j);return{center:y,circleTangency:w,lineTangency:b,theta:p}},f9=function(t){var n=t.cx,r=t.cy,s=t.innerRadius,i=t.outerRadius,l=t.startAngle,u=t.endAngle,d=Aje(l,u),f=l+d,h=er(n,r,i,l),p=er(n,r,i,f),x="M ".concat(h.x,",").concat(h.y,`
40    A `).concat(i,",").concat(i,`,0,
41    `).concat(+(Math.abs(d)>180),",").concat(+(l>f),`,
42    `).concat(p.x,",").concat(p.y,`
43  `);if(s>0){var y=er(n,r,s,l),w=er(n,r,s,f);x+="L ".concat(w.x,",").concat(w.y,`
44            A `).concat(s,",").concat(s,`,0,
45            `).concat(+(Math.abs(d)>180),",").concat(+(l<=f),`,
46            `).concat(y.x,",").concat(y.y," Z")}else x+="L ".concat(n,",").concat(r," Z");return x},Tje=function(t){var n=t.cx,r=t.cy,s=t.innerRadius,i=t.outerRadius,l=t.cornerRadius,u=t.forceCornerRadius,d=t.cornerIsExternal,f=t.startAngle,h=t.endAngle,p=ns(h-f),x=Dx({cx:n,cy:r,radius:i,angle:f,sign:p,cornerRadius:l,cornerIsExternal:d}),y=x.circleTangency,w=x.lineTangency,j=x.theta,b=Dx({cx:n,cy:r,radius:i,angle:h,sign:-p,cornerRadius:l,cornerIsExternal:d}),C=b.circleTangency,N=b.lineTangency,k=b.theta,T=d?Math.abs(f-h):Math.abs(f-h)-j-k;if(T<0)return u?"M ".concat(w.x,",").concat(w.y,`
47        a`).concat(l,",").concat(l,",0,0,1,").concat(l*2,`,0
48        a`).concat(l,",").concat(l,",0,0,1,").concat(-l*2,`,0
49      `):f9({cx:n,cy:r,innerRadius:s,outerRadius:i,startAngle:f,endAngle:h});var A="M ".concat(w.x,",").concat(w.y,`
50    A`).concat(l,",").concat(l,",0,0,").concat(+(p<0),",").concat(y.x,",").concat(y.y,`
51    A`).concat(i,",").concat(i,",0,").concat(+(T>180),",").concat(+(p<0),",").concat(C.x,",").concat(C.y,`
52    A`).concat(l,",").concat(l,",0,0,").concat(+(p<0),",").concat(N.x,",").concat(N.y,`
53  `);if(s>0){var P=Dx({cx:n,cy:r,radius:s,angle:f,sign:p,isExternal:!0,cornerRadius:l,cornerIsExternal:d}),E=P.circleTangency,_=P.lineTangency,R=P.theta,H=Dx({cx:n,cy:r,radius:s,angle:h,sign:-p,isExternal:!0,cornerRadius:l,cornerIsExternal:d}),L=H.circleTangency,I=H.lineTangency,W=H.theta,U=d?Math.abs(f-h):Math.abs(f-h)-R-W;if(U<0&&l===0)return"".concat(A,"L").concat(n,",").concat(r,"Z");A+="L".concat(I.x,",").concat(I.y,`
54      A`).concat(l,",").concat(l,",0,0,").concat(+(p<0),",").concat(L.x,",").concat(L.y,`
55      A`).concat(s,",").concat(s,",0,").concat(+(U>180),",").concat(+(p>0),",").concat(E.x,",").concat(E.y,`
56      A`).concat(l,",").concat(l,",0,0,").concat(+(p<0),",").concat(_.x,",").concat(_.y,"Z")}else A+="L".concat(n,",").concat(r,"Z");return A},kje={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},m9=function(t){var n=hL(hL({},kje),t),r=n.cx,s=n.cy,i=n.innerRadius,l=n.outerRadius,u=n.cornerRadius,d=n.forceCornerRadius,f=n.cornerIsExternal,h=n.startAngle,p=n.endAngle,x=n.className;if(l<i||h===p)return null;var y=yt("recharts-sector",x),w=l-i,j=Kl(u,w,0,!0),b;return j>0&&Math.abs(h-p)<360?b=Tje({cx:r,cy:s,innerRadius:i,outerRadius:l,cornerRadius:Math.min(j,w/2),forceCornerRadius:d,cornerIsExternal:f,startAngle:h,endAngle:p}):b=f9({cx:r,cy:s,innerRadius:i,outerRadius:l,startAngle:h,endAngle:p}),ie.createElement("path",eA({},gt(n,!0),{className:y,d:b,role:"img"}))};function nh(e){"@babel/helpers - typeof";return nh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},nh(e)}function tA(){return tA=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},tA.apply(this,arguments)}function pL(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function xL(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?pL(Object(n),!0).forEach(function(r){Oje(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):pL(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Oje(e,t,n){return t=Pje(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Pje(e){var t=Eje(e,"string");return nh(t)=="symbol"?t:t+""}function Eje(e,t){if(nh(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(nh(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var gL={curveBasisClosed:Qme,curveBasisOpen:Zme,curveBasis:Xme,curveBumpX:$me,curveBumpY:Ime,curveLinearClosed:Jme,curveLinear:Ov,curveMonotoneX:ehe,curveMonotoneY:the,curveNatural:nhe,curveStep:rhe,curveStepAfter:she,curveStepBefore:ahe},$x=function(t){return t.x===+t.x&&t.y===+t.y},Hf=function(t){return t.x},Vf=function(t){return t.y},_je=function(t,n){if(ut(t))return t;var r="curve".concat(Tv(t));return(r==="curveMonotone"||r==="curveBump")&&n?gL["".concat(r).concat(n==="vertical"?"Y":"X")]:gL[r]||Ov},Mje=function(t){var n=t.type,r=n===void 0?"linear":n,s=t.points,i=s===void 0?[]:s,l=t.baseLine,u=t.layout,d=t.connectNulls,f=d===void 0?!1:d,h=_je(r,u),p=f?i.filter(function(j){return $x(j)}):i,x;if(Array.isArray(l)){var y=f?l.filter(function(j){return $x(j)}):l,w=p.map(function(j,b){return xL(xL({},j),{},{base:y[b]})});return u==="vertical"?x=Tx().y(Vf).x1(Hf).x0(function(j){return j.base.x}):x=Tx().x(Hf).y1(Vf).y0(function(j){return j.base.y}),x.defined($x).curve(h),x(w)}return u==="vertical"&&Ie(l)?x=Tx().y(Vf).x1(Hf).x0(l):Ie(l)?x=Tx().x(Hf).y1(Vf).y0(l):x=yU().x(Hf).y(Vf),x.defined($x).curve(h),x(p)},nA=function(t){var n=t.className,r=t.points,s=t.path,i=t.pathRef;if((!r||!r.length)&&!s)return null;var l=r&&r.length?Mje(t):s;return v.createElement("path",tA({},gt(t,!1),Yg(t),{className:yt("recharts-curve",n),d:l,ref:i}))},kS={exports:{}},OS,yL;function Rje(){if(yL)return OS;yL=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return OS=e,OS}var PS,vL;function Dje(){if(vL)return PS;vL=1;var e=Rje();function t(){}function n(){}return n.resetWarningCache=t,PS=function(){function r(l,u,d,f,h,p){if(p!==e){var x=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw x.name="Invariant Violation",x}}r.isRequired=r;function s(){return r}var i={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:s,element:r,elementType:r,instanceOf:s,node:r,objectOf:s,oneOf:s,oneOfType:s,shape:s,exact:s,checkPropTypes:n,resetWarningCache:t};return i.PropTypes=i,i},PS}var bL;function $je(){return bL||(bL=1,kS.exports=Dje()()),kS.exports}var Ije=$je();const At=Bt(Ije),{getOwnPropertyNames:Lje,getOwnPropertySymbols:Fje}=Object,{hasOwnProperty:qje}=Object.prototype;function ES(e,t){return function(r,s,i){return e(r,s,i)&&t(r,s,i)}}function Ix(e){return function(n,r,s){if(!n||!r||typeof n!="object"||typeof r!="object")return e(n,r,s);const{cache:i}=s,l=i.get(n),u=i.get(r);if(l&&u)return l===r&&u===n;i.set(n,r),i.set(r,n);const d=e(n,r,s);return i.delete(n),i.delete(r),d}}function Bje(e){return e?.[Symbol.toStringTag]}function jL(e){return Lje(e).concat(Fje(e))}const zje=Object.hasOwn||((e,t)=>qje.call(e,t));function uc(e,t){return e===t||!e&&!t&&e!==e&&t!==t}const Uje="__v",Hje="__o",Vje="_owner",{getOwnPropertyDescriptor:wL,keys:NL}=Object;function Gje(e,t){return e.byteLength===t.byteLength&&Cy(new Uint8Array(e),new Uint8Array(t))}function Kje(e,t,n){let r=e.length;if(t.length!==r)return!1;for(;r-- >0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function Wje(e,t){return e.byteLength===t.byteLength&&Cy(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function Yje(e,t){return uc(e.getTime(),t.getTime())}function Xje(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function Qje(e,t){return e===t}function SL(e,t,n){const r=e.size;if(r!==t.size)return!1;if(!r)return!0;const s=new Array(r),i=e.entries();let l,u,d=0;for(;(l=i.next())&&!l.done;){const f=t.entries();let h=!1,p=0;for(;(u=f.next())&&!u.done;){if(s[p]){p++;continue}const x=l.value,y=u.value;if(n.equals(x[0],y[0],d,p,e,t,n)&&n.equals(x[1],y[1],x[0],y[0],e,t,n)){h=s[p]=!0;break}p++}if(!h)return!1;d++}return!0}const Zje=uc;function Jje(e,t,n){const r=NL(e);let s=r.length;if(NL(t).length!==s)return!1;for(;s-- >0;)if(!h9(e,t,n,r[s]))return!1;return!0}function Gf(e,t,n){const r=jL(e);let s=r.length;if(jL(t).length!==s)return!1;let i,l,u;for(;s-- >0;)if(i=r[s],!h9(e,t,n,i)||(l=wL(e,i),u=wL(t,i),(l||u)&&(!l||!u||l.configurable!==u.configurable||l.enumerable!==u.enumerable||l.writable!==u.writable)))return!1;return!0}function ewe(e,t){return uc(e.valueOf(),t.valueOf())}function twe(e,t){return e.source===t.source&&e.flags===t.flags}function CL(e,t,n){const r=e.size;if(r!==t.size)return!1;if(!r)return!0;const s=new Array(r),i=e.values();let l,u;for(;(l=i.next())&&!l.done;){const d=t.values();let f=!1,h=0;for(;(u=d.next())&&!u.done;){if(!s[h]&&n.equals(l.value,u.value,l.value,u.value,e,t,n)){f=s[h]=!0;break}h++}if(!f)return!1}return!0}function Cy(e,t){let n=e.byteLength;if(t.byteLength!==n||e.byteOffset!==t.byteOffset)return!1;for(;n-- >0;)if(e[n]!==t[n])return!1;return!0}function nwe(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function h9(e,t,n,r){return(r===Vje||r===Hje||r===Uje)&&(e.$$typeof||t.$$typeof)?!0:zje(t,r)&&n.equals(e[r],t[r],r,r,e,t,n)}const rwe="[object ArrayBuffer]",awe="[object Arguments]",swe="[object Boolean]",iwe="[object DataView]",owe="[object Date]",lwe="[object Error]",cwe="[object Map]",uwe="[object Number]",dwe="[object Object]",fwe="[object RegExp]",mwe="[object Set]",hwe="[object String]",pwe={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},xwe="[object URL]",gwe=Object.prototype.toString;function ywe({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:s,areFunctionsEqual:i,areMapsEqual:l,areNumbersEqual:u,areObjectsEqual:d,arePrimitiveWrappersEqual:f,areRegExpsEqual:h,areSetsEqual:p,areTypedArraysEqual:x,areUrlsEqual:y,unknownTagComparators:w}){return function(b,C,N){if(b===C)return!0;if(b==null||C==null)return!1;const k=typeof b;if(k!==typeof C)return!1;if(k!=="object")return k==="number"?u(b,C,N):k==="function"?i(b,C,N):!1;const T=b.constructor;if(T!==C.constructor)return!1;if(T===Object)return d(b,C,N);if(Array.isArray(b))return t(b,C,N);if(T===Date)return r(b,C,N);if(T===RegExp)return h(b,C,N);if(T===Map)return l(b,C,N);if(T===Set)return p(b,C,N);const A=gwe.call(b);if(A===owe)return r(b,C,N);if(A===fwe)return h(b,C,N);if(A===cwe)return l(b,C,N);if(A===mwe)return p(b,C,N);if(A===dwe)return typeof b.then!="function"&&typeof C.then!="function"&&d(b,C,N);if(A===xwe)return y(b,C,N);if(A===lwe)return s(b,C,N);if(A===awe)return d(b,C,N);if(pwe[A])return x(b,C,N);if(A===rwe)return e(b,C,N);if(A===iwe)return n(b,C,N);if(A===swe||A===uwe||A===hwe)return f(b,C,N);if(w){let P=w[A];if(!P){const E=Bje(b);E&&(P=w[E])}if(P)return P(b,C,N)}return!1}}function vwe({circular:e,createCustomConfig:t,strict:n}){let r={areArrayBuffersEqual:Gje,areArraysEqual:n?Gf:Kje,areDataViewsEqual:Wje,areDatesEqual:Yje,areErrorsEqual:Xje,areFunctionsEqual:Qje,areMapsEqual:n?ES(SL,Gf):SL,areNumbersEqual:Zje,areObjectsEqual:n?Gf:Jje,arePrimitiveWrappersEqual:ewe,areRegExpsEqual:twe,areSetsEqual:n?ES(CL,Gf):CL,areTypedArraysEqual:n?ES(Cy,Gf):Cy,areUrlsEqual:nwe,unknownTagComparators:void 0};if(t&&(r=Object.assign({},r,t(r))),e){const s=Ix(r.areArraysEqual),i=Ix(r.areMapsEqual),l=Ix(r.areObjectsEqual),u=Ix(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:s,areMapsEqual:i,areObjectsEqual:l,areSetsEqual:u})}return r}function bwe(e){return function(t,n,r,s,i,l,u){return e(t,n,u)}}function jwe({circular:e,comparator:t,createState:n,equals:r,strict:s}){if(n)return function(u,d){const{cache:f=e?new WeakMap:void 0,meta:h}=n();return t(u,d,{cache:f,equals:r,meta:h,strict:s})};if(e)return function(u,d){return t(u,d,{cache:new WeakMap,equals:r,meta:void 0,strict:s})};const i={cache:void 0,equals:r,meta:void 0,strict:s};return function(u,d){return t(u,d,i)}}const wwe=Wo();Wo({strict:!0});Wo({circular:!0});Wo({circular:!0,strict:!0});Wo({createInternalComparator:()=>uc});Wo({strict:!0,createInternalComparator:()=>uc});Wo({circular:!0,createInternalComparator:()=>uc});Wo({circular:!0,createInternalComparator:()=>uc,strict:!0});function Wo(e={}){const{circular:t=!1,createInternalComparator:n,createState:r,strict:s=!1}=e,i=vwe(e),l=ywe(i),u=n?n(l):bwe(l);return jwe({circular:t,comparator:l,createState:r,equals:u,strict:s})}function Nwe(e){typeof requestAnimationFrame<"u"&&requestAnimationFrame(e)}function AL(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=-1,r=function s(i){n<0&&(n=i),i-n>t?(e(i),n=-1):Nwe(s)};requestAnimationFrame(r)}function rA(e){"@babel/helpers - typeof";return rA=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},rA(e)}function Swe(e){return kwe(e)||Twe(e)||Awe(e)||Cwe()}function Cwe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
57In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Awe(e,t){if(e){if(typeof e=="string")return TL(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return TL(e,t)}}function TL(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Twe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function kwe(e){if(Array.isArray(e))return e}function Owe(){var e={},t=function(){return null},n=!1,r=function s(i){if(!n){if(Array.isArray(i)){if(!i.length)return;var l=i,u=Swe(l),d=u[0],f=u.slice(1);if(typeof d=="number"){AL(s.bind(null,f),d);return}s(d),AL(s.bind(null,f));return}rA(i)==="object"&&(e=i,t(e)),typeof i=="function"&&i()}};return{stop:function(){n=!0},start:function(i){n=!1,r(i)},subscribe:function(i){return t=i,function(){t=function(){return null}}}}}function rh(e){"@babel/helpers - typeof";return rh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},rh(e)}function kL(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function OL(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?kL(Object(n),!0).forEach(function(r){p9(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):kL(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function p9(e,t,n){return t=Pwe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Pwe(e){var t=Ewe(e,"string");return rh(t)==="symbol"?t:String(t)}function Ewe(e,t){if(rh(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(rh(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var _we=function(t,n){return[Object.keys(t),Object.keys(n)].reduce(function(r,s){return r.filter(function(i){return s.includes(i)})})},Mwe=function(t){return t},Rwe=function(t){return t.replace(/([A-Z])/g,function(n){return"-".concat(n.toLowerCase())})},wm=function(t,n){return Object.keys(n).reduce(function(r,s){return OL(OL({},r),{},p9({},s,t(s,n[s])))},{})},PL=function(t,n,r){return t.map(function(s){return"".concat(Rwe(s)," ").concat(n,"ms ").concat(r)}).join(",")};function Dwe(e,t){return Lwe(e)||Iwe(e,t)||x9(e,t)||$we()}function $we(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
58In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Iwe(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,s,i,l,u=[],d=!0,f=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(d=(r=i.call(n)).done)&&(u.push(r.value),u.length!==t);d=!0);}catch(h){f=!0,s=h}finally{try{if(!d&&n.return!=null&&(l=n.return(),Object(l)!==l))return}finally{if(f)throw s}}return u}}function Lwe(e){if(Array.isArray(e))return e}function Fwe(e){return zwe(e)||Bwe(e)||x9(e)||qwe()}function qwe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
59In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function x9(e,t){if(e){if(typeof e=="string")return aA(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return aA(e,t)}}function Bwe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function zwe(e){if(Array.isArray(e))return aA(e)}function aA(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Ay=1e-4,g9=function(t,n){return[0,3*t,3*n-6*t,3*t-3*n+1]},y9=function(t,n){return t.map(function(r,s){return r*Math.pow(n,s)}).reduce(function(r,s){return r+s})},EL=function(t,n){return function(r){var s=g9(t,n);return y9(s,r)}},Uwe=function(t,n){return function(r){var s=g9(t,n),i=[].concat(Fwe(s.map(function(l,u){return l*u}).slice(1)),[0]);return y9(i,r)}},_L=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var s=n[0],i=n[1],l=n[2],u=n[3];if(n.length===1)switch(n[0]){case"linear":s=0,i=0,l=1,u=1;break;case"ease":s=.25,i=.1,l=.25,u=1;break;case"ease-in":s=.42,i=0,l=1,u=1;break;case"ease-out":s=.42,i=0,l=.58,u=1;break;case"ease-in-out":s=0,i=0,l=.58,u=1;break;default:{var d=n[0].split("(");if(d[0]==="cubic-bezier"&&d[1].split(")")[0].split(",").length===4){var f=d[1].split(")")[0].split(",").map(function(b){return parseFloat(b)}),h=Dwe(f,4);s=h[0],i=h[1],l=h[2],u=h[3]}}}var p=EL(s,l),x=EL(i,u),y=Uwe(s,l),w=function(C){return C>1?1:C<0?0:C},j=function(C){for(var N=C>1?1:C,k=N,T=0;T<8;++T){var A=p(k)-N,P=y(k);if(Math.abs(A-N)<Ay||P<Ay)return x(k);k=w(k-A/P)}return x(k)};return j.isStepper=!1,j},Hwe=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=t.stiff,r=n===void 0?100:n,s=t.damping,i=s===void 0?8:s,l=t.dt,u=l===void 0?17:l,d=function(h,p,x){var y=-(h-p)*r,w=x*i,j=x+(y-w)*u/1e3,b=x*u/1e3+h;return Math.abs(b-p)<Ay&&Math.abs(j)<Ay?[p,0]:[b,j]};return d.isStepper=!0,d.dt=u,d},Vwe=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var s=n[0];if(typeof s=="string")switch(s){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return _L(s);case"spring":return Hwe();default:if(s.split("(")[0]==="cubic-bezier")return _L(s)}return typeof s=="function"?s:null};function ah(e){"@babel/helpers - typeof";return ah=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ah(e)}function ML(e){return Wwe(e)||Kwe(e)||v9(e)||Gwe()}function Gwe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
60In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Kwe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Wwe(e){if(Array.isArray(e))return iA(e)}function RL(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function Xn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?RL(Object(n),!0).forEach(function(r){sA(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):RL(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function sA(e,t,n){return t=Ywe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ywe(e){var t=Xwe(e,"string");return ah(t)==="symbol"?t:String(t)}function Xwe(e,t){if(ah(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(ah(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Qwe(e,t){return e1e(e)||Jwe(e,t)||v9(e,t)||Zwe()}function Zwe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
61In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function v9(e,t){if(e){if(typeof e=="string")return iA(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return iA(e,t)}}function iA(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Jwe(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,s,i,l,u=[],d=!0,f=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(d=(r=i.call(n)).done)&&(u.push(r.value),u.length!==t);d=!0);}catch(h){f=!0,s=h}finally{try{if(!d&&n.return!=null&&(l=n.return(),Object(l)!==l))return}finally{if(f)throw s}}return u}}function e1e(e){if(Array.isArray(e))return e}var Ty=function(t,n,r){return t+(n-t)*r},oA=function(t){var n=t.from,r=t.to;return n!==r},t1e=function e(t,n,r){var s=wm(function(i,l){if(oA(l)){var u=t(l.from,l.to,l.velocity),d=Qwe(u,2),f=d[0],h=d[1];return Xn(Xn({},l),{},{from:f,velocity:h})}return l},n);return r<1?wm(function(i,l){return oA(l)?Xn(Xn({},l),{},{velocity:Ty(l.velocity,s[i].velocity,r),from:Ty(l.from,s[i].from,r)}):l},n):e(t,s,r-1)};const n1e=(function(e,t,n,r,s){var i=_we(e,t),l=i.reduce(function(b,C){return Xn(Xn({},b),{},sA({},C,[e[C],t[C]]))},{}),u=i.reduce(function(b,C){return Xn(Xn({},b),{},sA({},C,{from:e[C],velocity:0,to:t[C]}))},{}),d=-1,f,h,p=function(){return null},x=function(){return wm(function(C,N){return N.from},u)},y=function(){return!Object.values(u).filter(oA).length},w=function(C){f||(f=C);var N=C-f,k=N/n.dt;u=t1e(n,u,k),s(Xn(Xn(Xn({},e),t),x())),f=C,y()||(d=requestAnimationFrame(p))},j=function(C){h||(h=C);var N=(C-h)/r,k=wm(function(A,P){return Ty.apply(void 0,ML(P).concat([n(N)]))},l);if(s(Xn(Xn(Xn({},e),t),k)),N<1)d=requestAnimationFrame(p);else{var T=wm(function(A,P){return Ty.apply(void 0,ML(P).concat([n(1)]))},l);s(Xn(Xn(Xn({},e),t),T))}};return p=n.isStepper?w:j,function(){return requestAnimationFrame(p),function(){cancelAnimationFrame(d)}}});function Wu(e){"@babel/helpers - typeof";return Wu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Wu(e)}var r1e=["children","begin","duration","attributeName","easing","isActive","steps","from","to","canBegin","onAnimationEnd","shouldReAnimate","onAnimationReStart"];function a1e(e,t){if(e==null)return{};var n=s1e(e,t),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)r=i[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function s1e(e,t){if(e==null)return{};var n={},r=Object.keys(e),s,i;for(i=0;i<r.length;i++)s=r[i],!(t.indexOf(s)>=0)&&(n[s]=e[s]);return n}function _S(e){return c1e(e)||l1e(e)||o1e(e)||i1e()}function i1e(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
62In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function o1e(e,t){if(e){if(typeof e=="string")return lA(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return lA(e,t)}}function l1e(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function c1e(e){if(Array.isArray(e))return lA(e)}function lA(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function DL(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function Va(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?DL(Object(n),!0).forEach(function(r){im(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):DL(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function im(e,t,n){return t=b9(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function u1e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function d1e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,b9(r.key),r)}}function f1e(e,t,n){return t&&d1e(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function b9(e){var t=m1e(e,"string");return Wu(t)==="symbol"?t:String(t)}function m1e(e,t){if(Wu(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Wu(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function h1e(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&cA(e,t)}function cA(e,t){return cA=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},cA(e,t)}function p1e(e){var t=x1e();return function(){var r=ky(e),s;if(t){var i=ky(this).constructor;s=Reflect.construct(r,arguments,i)}else s=r.apply(this,arguments);return uA(this,s)}}function uA(e,t){if(t&&(Wu(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return dA(e)}function dA(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function x1e(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function ky(e){return ky=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},ky(e)}var Mi=(function(e){h1e(n,e);var t=p1e(n);function n(r,s){var i;u1e(this,n),i=t.call(this,r,s);var l=i.props,u=l.isActive,d=l.attributeName,f=l.from,h=l.to,p=l.steps,x=l.children,y=l.duration;if(i.handleStyleChange=i.handleStyleChange.bind(dA(i)),i.changeStyle=i.changeStyle.bind(dA(i)),!u||y<=0)return i.state={style:{}},typeof x=="function"&&(i.state={style:h}),uA(i);if(p&&p.length)i.state={style:p[0].style};else if(f){if(typeof x=="function")return i.state={style:f},uA(i);i.state={style:d?im({},d,f):f}}else i.state={style:{}};return i}return f1e(n,[{key:"componentDidMount",value:function(){var s=this.props,i=s.isActive,l=s.canBegin;this.mounted=!0,!(!i||!l)&&this.runAnimation(this.props)}},{key:"componentDidUpdate",value:function(s){var i=this.props,l=i.isActive,u=i.canBegin,d=i.attributeName,f=i.shouldReAnimate,h=i.to,p=i.from,x=this.state.style;if(u){if(!l){var y={style:d?im({},d,h):h};this.state&&x&&(d&&x[d]!==h||!d&&x!==h)&&this.setState(y);return}if(!(wwe(s.to,h)&&s.canBegin&&s.isActive)){var w=!s.canBegin||!s.isActive;this.manager&&this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation();var j=w||f?p:s.to;if(this.state&&x){var b={style:d?im({},d,j):j};(d&&x[d]!==j||!d&&x!==j)&&this.setState(b)}this.runAnimation(Va(Va({},this.props),{},{from:j,begin:0}))}}}},{key:"componentWillUnmount",value:function(){this.mounted=!1;var s=this.props.onAnimationEnd;this.unSubscribe&&this.unSubscribe(),this.manager&&(this.manager.stop(),this.manager=null),this.stopJSAnimation&&this.stopJSAnimation(),s&&s()}},{key:"handleStyleChange",value:function(s){this.changeStyle(s)}},{key:"changeStyle",value:function(s){this.mounted&&this.setState({style:s})}},{key:"runJSAnimation",value:function(s){var i=this,l=s.from,u=s.to,d=s.duration,f=s.easing,h=s.begin,p=s.onAnimationEnd,x=s.onAnimationStart,y=n1e(l,u,Vwe(f),d,this.changeStyle),w=function(){i.stopJSAnimation=y()};this.manager.start([x,h,w,d,p])}},{key:"runStepAnimation",value:function(s){var i=this,l=s.steps,u=s.begin,d=s.onAnimationStart,f=l[0],h=f.style,p=f.duration,x=p===void 0?0:p,y=function(j,b,C){if(C===0)return j;var N=b.duration,k=b.easing,T=k===void 0?"ease":k,A=b.style,P=b.properties,E=b.onAnimationEnd,_=C>0?l[C-1]:b,R=P||Object.keys(A);if(typeof T=="function"||T==="spring")return[].concat(_S(j),[i.runJSAnimation.bind(i,{from:_.style,to:A,duration:N,easing:T}),N]);var H=PL(R,N,T),L=Va(Va(Va({},_.style),A),{},{transition:H});return[].concat(_S(j),[L,N,E]).filter(Mwe)};return this.manager.start([d].concat(_S(l.reduce(y,[h,Math.max(x,u)])),[s.onAnimationEnd]))}},{key:"runAnimation",value:function(s){this.manager||(this.manager=Owe());var i=s.begin,l=s.duration,u=s.attributeName,d=s.to,f=s.easing,h=s.onAnimationStart,p=s.onAnimationEnd,x=s.steps,y=s.children,w=this.manager;if(this.unSubscribe=w.subscribe(this.handleStyleChange),typeof f=="function"||typeof y=="function"||f==="spring"){this.runJSAnimation(s);return}if(x.length>1){this.runStepAnimation(s);return}var j=u?im({},u,d):d,b=PL(Object.keys(j),l,f);w.start([h,i,Va(Va({},j),{},{transition:b}),l,p])}},{key:"render",value:function(){var s=this.props,i=s.children;s.begin;var l=s.duration;s.attributeName,s.easing;var u=s.isActive;s.steps,s.from,s.to,s.canBegin,s.onAnimationEnd,s.shouldReAnimate,s.onAnimationReStart;var d=a1e(s,r1e),f=v.Children.count(i),h=this.state.style;if(typeof i=="function")return i(h);if(!u||f===0||l<=0)return i;var p=function(y){var w=y.props,j=w.style,b=j===void 0?{}:j,C=w.className,N=v.cloneElement(y,Va(Va({},d),{},{style:Va(Va({},b),h),className:C}));return N};return f===1?p(v.Children.only(i)):ie.createElement("div",null,v.Children.map(i,function(x){return p(x)}))}}]),n})(v.PureComponent);Mi.displayName="Animate";Mi.defaultProps={begin:0,duration:1e3,from:"",to:"",attributeName:"",easing:"ease",isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}};Mi.propTypes={from:At.oneOfType([At.object,At.string]),to:At.oneOfType([At.object,At.string]),attributeName:At.string,duration:At.number,begin:At.number,easing:At.oneOfType([At.string,At.func]),steps:At.arrayOf(At.shape({duration:At.number.isRequired,style:At.object.isRequired,easing:At.oneOfType([At.oneOf(["ease","ease-in","ease-out","ease-in-out","linear"]),At.func]),properties:At.arrayOf("string"),onAnimationEnd:At.func})),children:At.oneOfType([At.node,At.func]),isActive:At.bool,canBegin:At.bool,onAnimationEnd:At.func,shouldReAnimate:At.bool,onAnimationStart:At.func,onAnimationReStart:At.func};function sh(e){"@babel/helpers - typeof";return sh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},sh(e)}function Oy(){return Oy=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Oy.apply(this,arguments)}function g1e(e,t){return j1e(e)||b1e(e,t)||v1e(e,t)||y1e()}function y1e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
63In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function v1e(e,t){if(e){if(typeof e=="string")return $L(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return $L(e,t)}}function $L(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function b1e(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,s,i,l,u=[],d=!0,f=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(d=(r=i.call(n)).done)&&(u.push(r.value),u.length!==t);d=!0);}catch(h){f=!0,s=h}finally{try{if(!d&&n.return!=null&&(l=n.return(),Object(l)!==l))return}finally{if(f)throw s}}return u}}function j1e(e){if(Array.isArray(e))return e}function IL(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function LL(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?IL(Object(n),!0).forEach(function(r){w1e(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):IL(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function w1e(e,t,n){return t=N1e(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function N1e(e){var t=S1e(e,"string");return sh(t)=="symbol"?t:t+""}function S1e(e,t){if(sh(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(sh(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var FL=function(t,n,r,s,i){var l=Math.min(Math.abs(r)/2,Math.abs(s)/2),u=s>=0?1:-1,d=r>=0?1:-1,f=s>=0&&r>=0||s<0&&r<0?1:0,h;if(l>0&&i instanceof Array){for(var p=[0,0,0,0],x=0,y=4;x<y;x++)p[x]=i[x]>l?l:i[x];h="M".concat(t,",").concat(n+u*p[0]),p[0]>0&&(h+="A ".concat(p[0],",").concat(p[0],",0,0,").concat(f,",").concat(t+d*p[0],",").concat(n)),h+="L ".concat(t+r-d*p[1],",").concat(n),p[1]>0&&(h+="A ".concat(p[1],",").concat(p[1],",0,0,").concat(f,`,
64        `).concat(t+r,",").concat(n+u*p[1])),h+="L ".concat(t+r,",").concat(n+s-u*p[2]),p[2]>0&&(h+="A ".concat(p[2],",").concat(p[2],",0,0,").concat(f,`,
65        `).concat(t+r-d*p[2],",").concat(n+s)),h+="L ".concat(t+d*p[3],",").concat(n+s),p[3]>0&&(h+="A ".concat(p[3],",").concat(p[3],",0,0,").concat(f,`,
66        `).concat(t,",").concat(n+s-u*p[3])),h+="Z"}else if(l>0&&i===+i&&i>0){var w=Math.min(l,i);h="M ".concat(t,",").concat(n+u*w,`
67            A `).concat(w,",").concat(w,",0,0,").concat(f,",").concat(t+d*w,",").concat(n,`
68            L `).concat(t+r-d*w,",").concat(n,`
69            A `).concat(w,",").concat(w,",0,0,").concat(f,",").concat(t+r,",").concat(n+u*w,`
70            L `).concat(t+r,",").concat(n+s-u*w,`
71            A `).concat(w,",").concat(w,",0,0,").concat(f,",").concat(t+r-d*w,",").concat(n+s,`
72            L `).concat(t+d*w,",").concat(n+s,`
73            A `).concat(w,",").concat(w,",0,0,").concat(f,",").concat(t,",").concat(n+s-u*w," Z")}else h="M ".concat(t,",").concat(n," h ").concat(r," v ").concat(s," h ").concat(-r," Z");return h},C1e=function(t,n){if(!t||!n)return!1;var r=t.x,s=t.y,i=n.x,l=n.y,u=n.width,d=n.height;if(Math.abs(u)>0&&Math.abs(d)>0){var f=Math.min(i,i+u),h=Math.max(i,i+u),p=Math.min(l,l+d),x=Math.max(l,l+d);return r>=f&&r<=h&&s>=p&&s<=x}return!1},A1e={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},iO=function(t){var n=LL(LL({},A1e),t),r=v.useRef(),s=v.useState(-1),i=g1e(s,2),l=i[0],u=i[1];v.useEffect(function(){if(r.current&&r.current.getTotalLength)try{var T=r.current.getTotalLength();T&&u(T)}catch{}},[]);var d=n.x,f=n.y,h=n.width,p=n.height,x=n.radius,y=n.className,w=n.animationEasing,j=n.animationDuration,b=n.animationBegin,C=n.isAnimationActive,N=n.isUpdateAnimationActive;if(d!==+d||f!==+f||h!==+h||p!==+p||h===0||p===0)return null;var k=yt("recharts-rectangle",y);return N?ie.createElement(Mi,{canBegin:l>0,from:{width:h,height:p,x:d,y:f},to:{width:h,height:p,x:d,y:f},duration:j,animationEasing:w,isActive:N},function(T){var A=T.width,P=T.height,E=T.x,_=T.y;return ie.createElement(Mi,{canBegin:l>0,from:"0px ".concat(l===-1?1:l,"px"),to:"".concat(l,"px 0px"),attributeName:"strokeDasharray",begin:b,duration:j,isActive:C,easing:w},ie.createElement("path",Oy({},gt(n,!0),{className:k,d:FL(E,_,A,P,x),ref:r})))}):ie.createElement("path",Oy({},gt(n,!0),{className:k,d:FL(d,f,h,p,x)}))};function fA(){return fA=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},fA.apply(this,arguments)}var oO=function(t){var n=t.cx,r=t.cy,s=t.r,i=t.className,l=yt("recharts-dot",i);return n===+n&&r===+r&&s===+s?v.createElement("circle",fA({},gt(t,!1),Yg(t),{className:l,cx:n,cy:r,r:s})):null};function ih(e){"@babel/helpers - typeof";return ih=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ih(e)}var T1e=["x","y","top","left","width","height","className"];function mA(){return mA=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},mA.apply(this,arguments)}function qL(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function k1e(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?qL(Object(n),!0).forEach(function(r){O1e(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qL(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function O1e(e,t,n){return t=P1e(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function P1e(e){var t=E1e(e,"string");return ih(t)=="symbol"?t:t+""}function E1e(e,t){if(ih(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(ih(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function _1e(e,t){if(e==null)return{};var n=M1e(e,t),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)r=i[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function M1e(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var R1e=function(t,n,r,s,i,l){return"M".concat(t,",").concat(i,"v").concat(s,"M").concat(l,",").concat(n,"h").concat(r)},D1e=function(t){var n=t.x,r=n===void 0?0:n,s=t.y,i=s===void 0?0:s,l=t.top,u=l===void 0?0:l,d=t.left,f=d===void 0?0:d,h=t.width,p=h===void 0?0:h,x=t.height,y=x===void 0?0:x,w=t.className,j=_1e(t,T1e),b=k1e({x:r,y:i,top:u,left:f,width:p,height:y},j);return!Ie(r)||!Ie(i)||!Ie(p)||!Ie(y)||!Ie(u)||!Ie(f)?null:ie.createElement("path",mA({},gt(b,!0),{className:yt("recharts-cross",w),d:R1e(r,i,p,y,u,f)}))},MS,BL;function $1e(){if(BL)return MS;BL=1;var e=BU(),t=e(Object.getPrototypeOf,Object);return MS=t,MS}var RS,zL;function I1e(){if(zL)return RS;zL=1;var e=Di(),t=$1e(),n=$i(),r="[object Object]",s=Function.prototype,i=Object.prototype,l=s.toString,u=i.hasOwnProperty,d=l.call(Object);function f(h){if(!n(h)||e(h)!=r)return!1;var p=t(h);if(p===null)return!0;var x=u.call(p,"constructor")&&p.constructor;return typeof x=="function"&&x instanceof x&&l.call(x)==d}return RS=f,RS}var L1e=I1e();const F1e=Bt(L1e);var DS,UL;function q1e(){if(UL)return DS;UL=1;var e=Di(),t=$i(),n="[object Boolean]";function r(s){return s===!0||s===!1||t(s)&&e(s)==n}return DS=r,DS}var B1e=q1e();const z1e=Bt(B1e);function oh(e){"@babel/helpers - typeof";return oh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},oh(e)}function Py(){return Py=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Py.apply(this,arguments)}function U1e(e,t){return K1e(e)||G1e(e,t)||V1e(e,t)||H1e()}function H1e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
74In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function V1e(e,t){if(e){if(typeof e=="string")return HL(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return HL(e,t)}}function HL(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function G1e(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,s,i,l,u=[],d=!0,f=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(d=(r=i.call(n)).done)&&(u.push(r.value),u.length!==t);d=!0);}catch(h){f=!0,s=h}finally{try{if(!d&&n.return!=null&&(l=n.return(),Object(l)!==l))return}finally{if(f)throw s}}return u}}function K1e(e){if(Array.isArray(e))return e}function VL(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function GL(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?VL(Object(n),!0).forEach(function(r){W1e(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):VL(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function W1e(e,t,n){return t=Y1e(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Y1e(e){var t=X1e(e,"string");return oh(t)=="symbol"?t:t+""}function X1e(e,t){if(oh(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(oh(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var KL=function(t,n,r,s,i){var l=r-s,u;return u="M ".concat(t,",").concat(n),u+="L ".concat(t+r,",").concat(n),u+="L ".concat(t+r-l/2,",").concat(n+i),u+="L ".concat(t+r-l/2-s,",").concat(n+i),u+="L ".concat(t,",").concat(n," Z"),u},Q1e={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},Z1e=function(t){var n=GL(GL({},Q1e),t),r=v.useRef(),s=v.useState(-1),i=U1e(s,2),l=i[0],u=i[1];v.useEffect(function(){if(r.current&&r.current.getTotalLength)try{var k=r.current.getTotalLength();k&&u(k)}catch{}},[]);var d=n.x,f=n.y,h=n.upperWidth,p=n.lowerWidth,x=n.height,y=n.className,w=n.animationEasing,j=n.animationDuration,b=n.animationBegin,C=n.isUpdateAnimationActive;if(d!==+d||f!==+f||h!==+h||p!==+p||x!==+x||h===0&&p===0||x===0)return null;var N=yt("recharts-trapezoid",y);return C?ie.createElement(Mi,{canBegin:l>0,from:{upperWidth:0,lowerWidth:0,height:x,x:d,y:f},to:{upperWidth:h,lowerWidth:p,height:x,x:d,y:f},duration:j,animationEasing:w,isActive:C},function(k){var T=k.upperWidth,A=k.lowerWidth,P=k.height,E=k.x,_=k.y;return ie.createElement(Mi,{canBegin:l>0,from:"0px ".concat(l===-1?1:l,"px"),to:"".concat(l,"px 0px"),attributeName:"strokeDasharray",begin:b,duration:j,easing:w},ie.createElement("path",Py({},gt(n,!0),{className:N,d:KL(E,_,T,A,P),ref:r})))}):ie.createElement("g",null,ie.createElement("path",Py({},gt(n,!0),{className:N,d:KL(d,f,h,p,x)})))},J1e=["option","shapeType","propTransformer","activeClassName","isActive"];function lh(e){"@babel/helpers - typeof";return lh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},lh(e)}function eNe(e,t){if(e==null)return{};var n=tNe(e,t),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)r=i[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function tNe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function WL(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function Ey(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?WL(Object(n),!0).forEach(function(r){nNe(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):WL(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function nNe(e,t,n){return t=rNe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function rNe(e){var t=aNe(e,"string");return lh(t)=="symbol"?t:t+""}function aNe(e,t){if(lh(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(lh(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function sNe(e,t){return Ey(Ey({},t),e)}function iNe(e,t){return e==="symbols"}function YL(e){var t=e.shapeType,n=e.elementProps;switch(t){case"rectangle":return ie.createElement(iO,n);case"trapezoid":return ie.createElement(Z1e,n);case"sector":return ie.createElement(m9,n);case"symbols":if(iNe(t))return ie.createElement(Ck,n);break;default:return null}}function oNe(e){return v.isValidElement(e)?e.props:e}function lNe(e){var t=e.option,n=e.shapeType,r=e.propTransformer,s=r===void 0?sNe:r,i=e.activeClassName,l=i===void 0?"recharts-active-shape":i,u=e.isActive,d=eNe(e,J1e),f;if(v.isValidElement(t))f=v.cloneElement(t,Ey(Ey({},d),oNe(t)));else if(ut(t))f=t(d);else if(F1e(t)&&!z1e(t)){var h=s(t,d);f=ie.createElement(YL,{shapeType:n,elementProps:h})}else{var p=d;f=ie.createElement(YL,{shapeType:n,elementProps:p})}return u?ie.createElement(pn,{className:l},f):f}function Vv(e,t){return t!=null&&"trapezoids"in e.props}function Gv(e,t){return t!=null&&"sectors"in e.props}function ch(e,t){return t!=null&&"points"in e.props}function cNe(e,t){var n,r,s=e.x===(t==null||(n=t.labelViewBox)===null||n===void 0?void 0:n.x)||e.x===t.x,i=e.y===(t==null||(r=t.labelViewBox)===null||r===void 0?void 0:r.y)||e.y===t.y;return s&&i}function uNe(e,t){var n=e.endAngle===t.endAngle,r=e.startAngle===t.startAngle;return n&&r}function dNe(e,t){var n=e.x===t.x,r=e.y===t.y,s=e.z===t.z;return n&&r&&s}function fNe(e,t){var n;return Vv(e,t)?n=cNe:Gv(e,t)?n=uNe:ch(e,t)&&(n=dNe),n}function mNe(e,t){var n;return Vv(e,t)?n="trapezoids":Gv(e,t)?n="sectors":ch(e,t)&&(n="points"),n}function hNe(e,t){if(Vv(e,t)){var n;return(n=t.tooltipPayload)===null||n===void 0||(n=n[0])===null||n===void 0||(n=n.payload)===null||n===void 0?void 0:n.payload}if(Gv(e,t)){var r;return(r=t.tooltipPayload)===null||r===void 0||(r=r[0])===null||r===void 0||(r=r.payload)===null||r===void 0?void 0:r.payload}return ch(e,t)?t.payload:{}}function pNe(e){var t=e.activeTooltipItem,n=e.graphicalItem,r=e.itemData,s=mNe(n,t),i=hNe(n,t),l=r.filter(function(d,f){var h=zv(i,d),p=n.props[s].filter(function(w){var j=fNe(n,t);return j(w,t)}),x=n.props[s].indexOf(p[p.length-1]),y=f===x;return h&&y}),u=r.indexOf(l[l.length-1]);return u}var $S,XL;function xNe(){if(XL)return $S;XL=1;var e=Math.ceil,t=Math.max;function n(r,s,i,l){for(var u=-1,d=t(e((s-r)/(i||1)),0),f=Array(d);d--;)f[l?d:++u]=r,r+=i;return f}return $S=n,$S}var IS,QL;function j9(){if(QL)return IS;QL=1;var e=r7(),t=1/0,n=17976931348623157e292;function r(s){if(!s)return s===0?s:0;if(s=e(s),s===t||s===-t){var i=s<0?-1:1;return i*n}return s===s?s:0}return IS=r,IS}var LS,ZL;function gNe(){if(ZL)return LS;ZL=1;var e=xNe(),t=Mv(),n=j9();function r(s){return function(i,l,u){return u&&typeof u!="number"&&t(i,l,u)&&(l=u=void 0),i=n(i),l===void 0?(l=i,i=0):l=n(l),u=u===void 0?i<l?1:-1:n(u),e(i,l,u,s)}}return LS=r,LS}var FS,JL;function yNe(){if(JL)return FS;JL=1;var e=gNe(),t=e();return FS=t,FS}var vNe=yNe();const _y=Bt(vNe);function uh(e){"@babel/helpers - typeof";return uh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},uh(e)}function e6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function t6(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?e6(Object(n),!0).forEach(function(r){w9(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):e6(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function w9(e,t,n){return t=bNe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function bNe(e){var t=jNe(e,"string");return uh(t)=="symbol"?t:t+""}function jNe(e,t){if(uh(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(uh(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var wNe=["Webkit","Moz","O","ms"],NNe=function(t,n){var r=t.replace(/(\w)/,function(i){return i.toUpperCase()}),s=wNe.reduce(function(i,l){return t6(t6({},i),{},w9({},l+r,n))},{});return s[t]=n,s};function Yu(e){"@babel/helpers - typeof";return Yu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Yu(e)}function My(){return My=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},My.apply(this,arguments)}function n6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function qS(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?n6(Object(n),!0).forEach(function(r){na(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):n6(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function SNe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r6(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,S9(r.key),r)}}function CNe(e,t,n){return t&&r6(e.prototype,t),n&&r6(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function ANe(e,t,n){return t=Ry(t),TNe(e,N9()?Reflect.construct(t,n||[],Ry(e).constructor):t.apply(e,n))}function TNe(e,t){if(t&&(Yu(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return kNe(e)}function kNe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function N9(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(N9=function(){return!!e})()}function Ry(e){return Ry=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Ry(e)}function ONe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&hA(e,t)}function hA(e,t){return hA=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},hA(e,t)}function na(e,t,n){return t=S9(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function S9(e){var t=PNe(e,"string");return Yu(t)=="symbol"?t:t+""}function PNe(e,t){if(Yu(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Yu(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var ENe=function(t){var n=t.data,r=t.startIndex,s=t.endIndex,i=t.x,l=t.width,u=t.travellerWidth;if(!n||!n.length)return{};var d=n.length,f=bm().domain(_y(0,d)).range([i,i+l-u]),h=f.domain().map(function(p){return f(p)});return{isTextActive:!1,isSlideMoving:!1,isTravellerMoving:!1,isTravellerFocused:!1,startX:f(r),endX:f(s),scale:f,scaleValues:h}},a6=function(t){return t.changedTouches&&!!t.changedTouches.length},Xu=(function(e){function t(n){var r;return SNe(this,t),r=ANe(this,t,[n]),na(r,"handleDrag",function(s){r.leaveTimer&&(clearTimeout(r.leaveTimer),r.leaveTimer=null),r.state.isTravellerMoving?r.handleTravellerMove(s):r.state.isSlideMoving&&r.handleSlideDrag(s)}),na(r,"handleTouchMove",function(s){s.changedTouches!=null&&s.changedTouches.length>0&&r.handleDrag(s.changedTouches[0])}),na(r,"handleDragEnd",function(){r.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var s=r.props,i=s.endIndex,l=s.onDragEnd,u=s.startIndex;l?.({endIndex:i,startIndex:u})}),r.detachDragEndListener()}),na(r,"handleLeaveWrapper",function(){(r.state.isTravellerMoving||r.state.isSlideMoving)&&(r.leaveTimer=window.setTimeout(r.handleDragEnd,r.props.leaveTimeOut))}),na(r,"handleEnterSlideOrTraveller",function(){r.setState({isTextActive:!0})}),na(r,"handleLeaveSlideOrTraveller",function(){r.setState({isTextActive:!1})}),na(r,"handleSlideDragStart",function(s){var i=a6(s)?s.changedTouches[0]:s;r.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:i.pageX}),r.attachDragEndListener()}),r.travellerDragStartHandlers={startX:r.handleTravellerDragStart.bind(r,"startX"),endX:r.handleTravellerDragStart.bind(r,"endX")},r.state={},r}return ONe(t,e),CNe(t,[{key:"componentWillUnmount",value:function(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}},{key:"getIndex",value:function(r){var s=r.startX,i=r.endX,l=this.state.scaleValues,u=this.props,d=u.gap,f=u.data,h=f.length-1,p=Math.min(s,i),x=Math.max(s,i),y=t.getIndexInRange(l,p),w=t.getIndexInRange(l,x);return{startIndex:y-y%d,endIndex:w===h?h:w-w%d}}},{key:"getTextOfTick",value:function(r){var s=this.props,i=s.data,l=s.tickFormatter,u=s.dataKey,d=ca(i[r],u,r);return ut(l)?l(d,r):d}},{key:"attachDragEndListener",value:function(){window.addEventListener("mouseup",this.handleDragEnd,!0),window.addEventListener("touchend",this.handleDragEnd,!0),window.addEventListener("mousemove",this.handleDrag,!0)}},{key:"detachDragEndListener",value:function(){window.removeEventListener("mouseup",this.handleDragEnd,!0),window.removeEventListener("touchend",this.handleDragEnd,!0),window.removeEventListener("mousemove",this.handleDrag,!0)}},{key:"handleSlideDrag",value:function(r){var s=this.state,i=s.slideMoveStartX,l=s.startX,u=s.endX,d=this.props,f=d.x,h=d.width,p=d.travellerWidth,x=d.startIndex,y=d.endIndex,w=d.onChange,j=r.pageX-i;j>0?j=Math.min(j,f+h-p-u,f+h-p-l):j<0&&(j=Math.max(j,f-l,f-u));var b=this.getIndex({startX:l+j,endX:u+j});(b.startIndex!==x||b.endIndex!==y)&&w&&w(b),this.setState({startX:l+j,endX:u+j,slideMoveStartX:r.pageX})}},{key:"handleTravellerDragStart",value:function(r,s){var i=a6(s)?s.changedTouches[0]:s;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:r,brushMoveStartX:i.pageX}),this.attachDragEndListener()}},{key:"handleTravellerMove",value:function(r){var s=this.state,i=s.brushMoveStartX,l=s.movingTravellerId,u=s.endX,d=s.startX,f=this.state[l],h=this.props,p=h.x,x=h.width,y=h.travellerWidth,w=h.onChange,j=h.gap,b=h.data,C={startX:this.state.startX,endX:this.state.endX},N=r.pageX-i;N>0?N=Math.min(N,p+x-y-f):N<0&&(N=Math.max(N,p-f)),C[l]=f+N;var k=this.getIndex(C),T=k.startIndex,A=k.endIndex,P=function(){var _=b.length-1;return l==="startX"&&(u>d?T%j===0:A%j===0)||u<d&&A===_||l==="endX"&&(u>d?A%j===0:T%j===0)||u>d&&A===_};this.setState(na(na({},l,f+N),"brushMoveStartX",r.pageX),function(){w&&P()&&w(k)})}},{key:"handleTravellerMoveKeyboard",value:function(r,s){var i=this,l=this.state,u=l.scaleValues,d=l.startX,f=l.endX,h=this.state[s],p=u.indexOf(h);if(p!==-1){var x=p+r;if(!(x===-1||x>=u.length)){var y=u[x];s==="startX"&&y>=f||s==="endX"&&y<=d||this.setState(na({},s,y),function(){i.props.onChange(i.getIndex({startX:i.state.startX,endX:i.state.endX}))})}}}},{key:"renderBackground",value:function(){var r=this.props,s=r.x,i=r.y,l=r.width,u=r.height,d=r.fill,f=r.stroke;return ie.createElement("rect",{stroke:f,fill:d,x:s,y:i,width:l,height:u})}},{key:"renderPanorama",value:function(){var r=this.props,s=r.x,i=r.y,l=r.width,u=r.height,d=r.data,f=r.children,h=r.padding,p=v.Children.only(f);return p?ie.cloneElement(p,{x:s,y:i,width:l,height:u,margin:h,compact:!0,data:d}):null}},{key:"renderTravellerLayer",value:function(r,s){var i,l,u=this,d=this.props,f=d.y,h=d.travellerWidth,p=d.height,x=d.traveller,y=d.ariaLabel,w=d.data,j=d.startIndex,b=d.endIndex,C=Math.max(r,this.props.x),N=qS(qS({},gt(this.props,!1)),{},{x:C,y:f,width:h,height:p}),k=y||"Min value: ".concat((i=w[j])===null||i===void 0?void 0:i.name,", Max value: ").concat((l=w[b])===null||l===void 0?void 0:l.name);return ie.createElement(pn,{tabIndex:0,role:"slider","aria-label":k,"aria-valuenow":r,className:"recharts-brush-traveller",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[s],onTouchStart:this.travellerDragStartHandlers[s],onKeyDown:function(A){["ArrowLeft","ArrowRight"].includes(A.key)&&(A.preventDefault(),A.stopPropagation(),u.handleTravellerMoveKeyboard(A.key==="ArrowRight"?1:-1,s))},onFocus:function(){u.setState({isTravellerFocused:!0})},onBlur:function(){u.setState({isTravellerFocused:!1})},style:{cursor:"col-resize"}},t.renderTraveller(x,N))}},{key:"renderSlide",value:function(r,s){var i=this.props,l=i.y,u=i.height,d=i.stroke,f=i.travellerWidth,h=Math.min(r,s)+f,p=Math.max(Math.abs(s-r)-f,0);return ie.createElement("rect",{className:"recharts-brush-slide",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart,style:{cursor:"move"},stroke:"none",fill:d,fillOpacity:.2,x:h,y:l,width:p,height:u})}},{key:"renderText",value:function(){var r=this.props,s=r.startIndex,i=r.endIndex,l=r.y,u=r.height,d=r.travellerWidth,f=r.stroke,h=this.state,p=h.startX,x=h.endX,y=5,w={pointerEvents:"none",fill:f};return ie.createElement(pn,{className:"recharts-brush-texts"},ie.createElement(oy,My({textAnchor:"end",verticalAnchor:"middle",x:Math.min(p,x)-y,y:l+u/2},w),this.getTextOfTick(s)),ie.createElement(oy,My({textAnchor:"start",verticalAnchor:"middle",x:Math.max(p,x)+d+y,y:l+u/2},w),this.getTextOfTick(i)))}},{key:"render",value:function(){var r=this.props,s=r.data,i=r.className,l=r.children,u=r.x,d=r.y,f=r.width,h=r.height,p=r.alwaysShowText,x=this.state,y=x.startX,w=x.endX,j=x.isTextActive,b=x.isSlideMoving,C=x.isTravellerMoving,N=x.isTravellerFocused;if(!s||!s.length||!Ie(u)||!Ie(d)||!Ie(f)||!Ie(h)||f<=0||h<=0)return null;var k=yt("recharts-brush",i),T=ie.Children.count(l)===1,A=NNe("userSelect","none");return ie.createElement(pn,{className:k,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:A},this.renderBackground(),T&&this.renderPanorama(),this.renderSlide(y,w),this.renderTravellerLayer(y,"startX"),this.renderTravellerLayer(w,"endX"),(j||b||C||N||p)&&this.renderText())}}],[{key:"renderDefaultTraveller",value:function(r){var s=r.x,i=r.y,l=r.width,u=r.height,d=r.stroke,f=Math.floor(i+u/2)-1;return ie.createElement(ie.Fragment,null,ie.createElement("rect",{x:s,y:i,width:l,height:u,fill:d,stroke:"none"}),ie.createElement("line",{x1:s+1,y1:f,x2:s+l-1,y2:f,fill:"none",stroke:"#fff"}),ie.createElement("line",{x1:s+1,y1:f+2,x2:s+l-1,y2:f+2,fill:"none",stroke:"#fff"}))}},{key:"renderTraveller",value:function(r,s){var i;return ie.isValidElement(r)?i=ie.cloneElement(r,s):ut(r)?i=r(s):i=t.renderDefaultTraveller(s),i}},{key:"getDerivedStateFromProps",value:function(r,s){var i=r.data,l=r.width,u=r.x,d=r.travellerWidth,f=r.updateId,h=r.startIndex,p=r.endIndex;if(i!==s.prevData||f!==s.prevUpdateId)return qS({prevData:i,prevTravellerWidth:d,prevUpdateId:f,prevX:u,prevWidth:l},i&&i.length?ENe({data:i,width:l,x:u,travellerWidth:d,startIndex:h,endIndex:p}):{scale:null,scaleValues:null});if(s.scale&&(l!==s.prevWidth||u!==s.prevX||d!==s.prevTravellerWidth)){s.scale.range([u,u+l-d]);var x=s.scale.domain().map(function(y){return s.scale(y)});return{prevData:i,prevTravellerWidth:d,prevUpdateId:f,prevX:u,prevWidth:l,startX:s.scale(r.startIndex),endX:s.scale(r.endIndex),scaleValues:x}}return null}},{key:"getIndexInRange",value:function(r,s){for(var i=r.length,l=0,u=i-1;u-l>1;){var d=Math.floor((l+u)/2);r[d]>s?u=d:l=d}return s>=r[u]?u:l}}])})(v.PureComponent);na(Xu,"displayName","Brush");na(Xu,"defaultProps",{height:40,travellerWidth:5,gap:1,fill:"#fff",stroke:"#666",padding:{top:1,right:1,bottom:1,left:1},leaveTimeOut:1e3,alwaysShowText:!1});var BS,s6;function _Ne(){if(s6)return BS;s6=1;var e=_k();function t(n,r){var s;return e(n,function(i,l,u){return s=r(i,l,u),!s}),!!s}return BS=t,BS}var zS,i6;function MNe(){if(i6)return zS;i6=1;var e=RU(),t=Vo(),n=_Ne(),r=Ir(),s=Mv();function i(l,u,d){var f=r(l)?e:n;return d&&s(l,u,d)&&(u=void 0),f(l,t(u,3))}return zS=i,zS}var RNe=MNe();const DNe=Bt(RNe);var _s=function(t,n){var r=t.alwaysShow,s=t.ifOverflow;return r&&(s="extendDomain"),s===n},US,o6;function $Ne(){if(o6)return US;o6=1;var e=ZU();function t(n,r,s){r=="__proto__"&&e?e(n,r,{configurable:!0,enumerable:!0,value:s,writable:!0}):n[r]=s}return US=t,US}var HS,l6;function INe(){if(l6)return HS;l6=1;var e=$Ne(),t=XU(),n=Vo();function r(s,i){var l={};return i=n(i,3),t(s,function(u,d,f){e(l,d,i(u,d,f))}),l}return HS=r,HS}var LNe=INe();const FNe=Bt(LNe);var VS,c6;function qNe(){if(c6)return VS;c6=1;function e(t,n){for(var r=-1,s=t==null?0:t.length;++r<s;)if(!n(t[r],r,t))return!1;return!0}return VS=e,VS}var GS,u6;function BNe(){if(u6)return GS;u6=1;var e=_k();function t(n,r){var s=!0;return e(n,function(i,l,u){return s=!!r(i,l,u),s}),s}return GS=t,GS}var KS,d6;function zNe(){if(d6)return KS;d6=1;var e=qNe(),t=BNe(),n=Vo(),r=Ir(),s=Mv();function i(l,u,d){var f=r(l)?e:t;return d&&s(l,u,d)&&(u=void 0),f(l,n(u,3))}return KS=i,KS}var UNe=zNe();const C9=Bt(UNe);var HNe=["x","y"];function dh(e){"@babel/helpers - typeof";return dh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},dh(e)}function pA(){return pA=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},pA.apply(this,arguments)}function f6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function Kf(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?f6(Object(n),!0).forEach(function(r){VNe(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):f6(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function VNe(e,t,n){return t=GNe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function GNe(e){var t=KNe(e,"string");return dh(t)=="symbol"?t:t+""}function KNe(e,t){if(dh(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(dh(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function WNe(e,t){if(e==null)return{};var n=YNe(e,t),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)r=i[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function YNe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function XNe(e,t){var n=e.x,r=e.y,s=WNe(e,HNe),i="".concat(n),l=parseInt(i,10),u="".concat(r),d=parseInt(u,10),f="".concat(t.height||s.height),h=parseInt(f,10),p="".concat(t.width||s.width),x=parseInt(p,10);return Kf(Kf(Kf(Kf(Kf({},t),s),l?{x:l}:{}),d?{y:d}:{}),{},{height:h,width:x,name:t.name,radius:t.radius})}function m6(e){return ie.createElement(lNe,pA({shapeType:"rectangle",propTransformer:XNe,activeClassName:"recharts-active-bar"},e))}var QNe=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return function(r,s){if(typeof t=="number")return t;var i=Ie(r)||rme(r);return i?t(r,s):(i||Yl(),n)}},ZNe=["value","background"],A9;function Qu(e){"@babel/helpers - typeof";return Qu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Qu(e)}function JNe(e,t){if(e==null)return{};var n=eSe(e,t),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)r=i[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function eSe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Dy(){return Dy=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Dy.apply(this,arguments)}function h6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function vn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};
74t%2?h6(Object(n),!0).forEach(function(r){Oo(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):h6(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function tSe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function p6(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,k9(r.key),r)}}function nSe(e,t,n){return t&&p6(e.prototype,t),n&&p6(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function rSe(e,t,n){return t=$y(t),aSe(e,T9()?Reflect.construct(t,n||[],$y(e).constructor):t.apply(e,n))}function aSe(e,t){if(t&&(Qu(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return sSe(e)}function sSe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function T9(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(T9=function(){return!!e})()}
vendor: 103,774 bytes, lines 74-79
74function $y(e){return $y=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},$y(e)}function iSe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&xA(e,t)}function xA(e,t){return xA=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},xA(e,t)}function Oo(e,t,n){return t=k9(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function k9(e){var t=oSe(e,"string");return Qu(t)=="symbol"?t:t+""}function oSe(e,t){if(Qu(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Qu(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var dc=(function(e){function t(){var n;tSe(this,t);for(var r=arguments.length,s=new Array(r),i=0;i<r;i++)s[i]=arguments[i];return n=rSe(this,t,[].concat(s)),Oo(n,"state",{isAnimationFinished:!1}),Oo(n,"id",$h("recharts-bar-")),Oo(n,"handleAnimationEnd",function(){var l=n.props.onAnimationEnd;n.setState({isAnimationFinished:!0}),l&&l()}),Oo(n,"handleAnimationStart",function(){var l=n.props.onAnimationStart;n.setState({isAnimationFinished:!1}),l&&l()}),n}return iSe(t,e),nSe(t,[{key:"renderRectanglesStatically",value:function(r){var s=this,i=this.props,l=i.shape,u=i.dataKey,d=i.activeIndex,f=i.activeBar,h=gt(this.props,!1);return r&&r.map(function(p,x){var y=x===d,w=y?f:l,j=vn(vn(vn({},h),p),{},{isActive:y,option:w,index:x,dataKey:u,onAnimationStart:s.handleAnimationStart,onAnimationEnd:s.handleAnimationEnd});return ie.createElement(pn,Dy({className:"recharts-bar-rectangle"},Xg(s.props,p,x),{key:"rectangle-".concat(p?.x,"-").concat(p?.y,"-").concat(p?.value,"-").concat(x)}),ie.createElement(m6,j))})}},{key:"renderRectanglesWithAnimation",value:function(){var r=this,s=this.props,i=s.data,l=s.layout,u=s.isAnimationActive,d=s.animationBegin,f=s.animationDuration,h=s.animationEasing,p=s.animationId,x=this.state.prevData;return ie.createElement(Mi,{begin:d,duration:f,isActive:u,easing:h,from:{t:0},to:{t:1},key:"bar-".concat(p),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(y){var w=y.t,j=i.map(function(b,C){var N=x&&x[C];if(N){var k=es(N.x,b.x),T=es(N.y,b.y),A=es(N.width,b.width),P=es(N.height,b.height);return vn(vn({},b),{},{x:k(w),y:T(w),width:A(w),height:P(w)})}if(l==="horizontal"){var E=es(0,b.height),_=E(w);return vn(vn({},b),{},{y:b.y+b.height-_,height:_})}var R=es(0,b.width),H=R(w);return vn(vn({},b),{},{width:H})});return ie.createElement(pn,null,r.renderRectanglesStatically(j))})}},{key:"renderRectangles",value:function(){var r=this.props,s=r.data,i=r.isAnimationActive,l=this.state.prevData;return i&&s&&s.length&&(!l||!zv(l,s))?this.renderRectanglesWithAnimation():this.renderRectanglesStatically(s)}},{key:"renderBackground",value:function(){var r=this,s=this.props,i=s.data,l=s.dataKey,u=s.activeIndex,d=gt(this.props.background,!1);return i.map(function(f,h){f.value;var p=f.background,x=JNe(f,ZNe);if(!p)return null;var y=vn(vn(vn(vn(vn({},x),{},{fill:"#eee"},p),d),Xg(r.props,f,h)),{},{onAnimationStart:r.handleAnimationStart,onAnimationEnd:r.handleAnimationEnd,dataKey:l,index:h,className:"recharts-bar-background-rectangle"});return ie.createElement(m6,Dy({key:"background-bar-".concat(h),option:r.props.background,isActive:h===u},y))})}},{key:"renderErrorBar",value:function(r,s){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var i=this.props,l=i.data,u=i.xAxis,d=i.yAxis,f=i.layout,h=i.children,p=Ea(h,zh);if(!p)return null;var x=f==="vertical"?l[0].height/2:l[0].width/2,y=function(b,C){var N=Array.isArray(b.value)?b.value[1]:b.value;return{x:b.x,y:b.y,value:N,errorVal:ca(b,C)}},w={clipPath:r?"url(#clipPath-".concat(s,")"):null};return ie.createElement(pn,w,p.map(function(j){return ie.cloneElement(j,{key:"error-bar-".concat(s,"-").concat(j.props.dataKey),data:l,xAxis:u,yAxis:d,layout:f,offset:x,dataPointFormatter:y})}))}},{key:"render",value:function(){var r=this.props,s=r.hide,i=r.data,l=r.className,u=r.xAxis,d=r.yAxis,f=r.left,h=r.top,p=r.width,x=r.height,y=r.isAnimationActive,w=r.background,j=r.id;if(s||!i||!i.length)return null;var b=this.state.isAnimationFinished,C=yt("recharts-bar",l),N=u&&u.allowDataOverflow,k=d&&d.allowDataOverflow,T=N||k,A=pt(j)?this.id:j;return ie.createElement(pn,{className:C},N||k?ie.createElement("defs",null,ie.createElement("clipPath",{id:"clipPath-".concat(A)},ie.createElement("rect",{x:N?f:f-p/2,y:k?h:h-x/2,width:N?p:p*2,height:k?x:x*2}))):null,ie.createElement(pn,{className:"recharts-bar-rectangles",clipPath:T?"url(#clipPath-".concat(A,")"):null},w?this.renderBackground():null,this.renderRectangles()),this.renderErrorBar(T,A),(!y||b)&&_o.renderCallByParent(this.props,i))}}],[{key:"getDerivedStateFromProps",value:function(r,s){return r.animationId!==s.prevAnimationId?{prevAnimationId:r.animationId,curData:r.data,prevData:s.curData}:r.data!==s.curData?{curData:r.data}:null}}])})(v.PureComponent);A9=dc;Oo(dc,"displayName","Bar");Oo(dc,"defaultProps",{xAxisId:0,yAxisId:0,legendType:"rect",minPointSize:0,hide:!1,data:[],layout:"vertical",activeBar:!1,isAnimationActive:!Td.isSsr,animationBegin:0,animationDuration:400,animationEasing:"ease"});Oo(dc,"getComposedData",function(e){var t=e.props,n=e.item,r=e.barPosition,s=e.bandSize,i=e.xAxis,l=e.yAxis,u=e.xAxisTicks,d=e.yAxisTicks,f=e.stackedData,h=e.dataStartIndex,p=e.displayedData,x=e.offset,y=w0e(r,n);if(!y)return null;var w=t.layout,j=n.type.defaultProps,b=j!==void 0?vn(vn({},j),n.props):n.props,C=b.dataKey,N=b.children,k=b.minPointSize,T=w==="horizontal"?l:i,A=f?T.scale.domain():null,P=P0e({numericAxis:T}),E=Ea(N,s7),_=p.map(function(R,H){var L,I,W,U,V,D;f?L=N0e(f[h+H],A):(L=ca(R,C),Array.isArray(L)||(L=[P,L]));var q=QNe(k,A9.defaultProps.minPointSize)(L[1],H);if(w==="horizontal"){var K,Y=[l.scale(L[0]),l.scale(L[1])],z=Y[0],Z=Y[1];I=tL({axis:i,ticks:u,bandSize:s,offset:y.offset,entry:R,index:H}),W=(K=Z??z)!==null&&K!==void 0?K:void 0,U=y.size;var F=z-Z;if(V=Number.isNaN(F)?0:F,D={x:I,y:l.y,width:U,height:l.height},Math.abs(q)>0&&Math.abs(V)<Math.abs(q)){var B=ns(V||q)*(Math.abs(q)-Math.abs(V));W-=B,V+=B}}else{var X=[i.scale(L[0]),i.scale(L[1])],Q=X[0],se=X[1];if(I=Q,W=tL({axis:l,ticks:d,bandSize:s,offset:y.offset,entry:R,index:H}),U=se-Q,V=y.size,D={x:i.x,y:W,width:i.width,height:V},Math.abs(q)>0&&Math.abs(U)<Math.abs(q)){var ee=ns(U||q)*(Math.abs(q)-Math.abs(U));U+=ee}}return vn(vn(vn({},R),{},{x:I,y:W,width:U,height:V,value:f?L:L[1],payload:R,background:D},E&&E[H]&&E[H].props),{},{tooltipPayload:[u9(n,R)],tooltipPosition:{x:I+U/2,y:W+V/2}})});return vn({data:_,layout:w},x)});function fh(e){"@babel/helpers - typeof";return fh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},fh(e)}function lSe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function x6(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,O9(r.key),r)}}function cSe(e,t,n){return t&&x6(e.prototype,t),n&&x6(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function g6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function Qa(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?g6(Object(n),!0).forEach(function(r){Kv(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):g6(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Kv(e,t,n){return t=O9(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function O9(e){var t=uSe(e,"string");return fh(t)=="symbol"?t:t+""}function uSe(e,t){if(fh(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(fh(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var P9=function(t,n,r,s,i){var l=t.width,u=t.height,d=t.layout,f=t.children,h=Object.keys(n),p={left:r.left,leftMirror:r.left,right:l-r.right,rightMirror:l-r.right,top:r.top,topMirror:r.top,bottom:u-r.bottom,bottomMirror:u-r.bottom},x=!!sa(f,dc);return h.reduce(function(y,w){var j=n[w],b=j.orientation,C=j.domain,N=j.padding,k=N===void 0?{}:N,T=j.mirror,A=j.reversed,P="".concat(b).concat(T?"Mirror":""),E,_,R,H,L;if(j.type==="number"&&(j.padding==="gap"||j.padding==="no-gap")){var I=C[1]-C[0],W=1/0,U=j.categoricalDomain.sort(ime);if(U.forEach(function(X,Q){Q>0&&(W=Math.min((X||0)-(U[Q-1]||0),W))}),Number.isFinite(W)){var V=W/I,D=j.layout==="vertical"?r.height:r.width;if(j.padding==="gap"&&(E=V*D/2),j.padding==="no-gap"){var q=Kl(t.barCategoryGap,V*D),K=V*D/2;E=K-q-(K-q)/D*q}}}s==="xAxis"?_=[r.left+(k.left||0)+(E||0),r.left+r.width-(k.right||0)-(E||0)]:s==="yAxis"?_=d==="horizontal"?[r.top+r.height-(k.bottom||0),r.top+(k.top||0)]:[r.top+(k.top||0)+(E||0),r.top+r.height-(k.bottom||0)-(E||0)]:_=j.range,A&&(_=[_[1],_[0]]);var Y=b0e(j,i,x),z=Y.scale,Z=Y.realScaleType;z.domain(C).range(_),j0e(z);var F=O0e(z,Qa(Qa({},j),{},{realScaleType:Z}));s==="xAxis"?(L=b==="top"&&!T||b==="bottom"&&T,R=r.left,H=p[P]-L*j.height):s==="yAxis"&&(L=b==="left"&&!T||b==="right"&&T,R=p[P]-L*j.width,H=r.top);var B=Qa(Qa(Qa({},j),F),{},{realScaleType:Z,x:R,y:H,scale:z,width:s==="xAxis"?r.width:j.width,height:s==="yAxis"?r.height:j.height});return B.bandSize=wy(B,F),!j.hide&&s==="xAxis"?p[P]+=(L?-1:1)*B.height:j.hide||(p[P]+=(L?-1:1)*B.width),Qa(Qa({},y),{},Kv({},w,B))},{})},E9=function(t,n){var r=t.x,s=t.y,i=n.x,l=n.y;return{x:Math.min(r,i),y:Math.min(s,l),width:Math.abs(i-r),height:Math.abs(l-s)}},dSe=function(t){var n=t.x1,r=t.y1,s=t.x2,i=t.y2;return E9({x:n,y:r},{x:s,y:i})},_9=(function(){function e(t){lSe(this,e),this.scale=t}return cSe(e,[{key:"domain",get:function(){return this.scale.domain}},{key:"range",get:function(){return this.scale.range}},{key:"rangeMin",get:function(){return this.range()[0]}},{key:"rangeMax",get:function(){return this.range()[1]}},{key:"bandwidth",get:function(){return this.scale.bandwidth}},{key:"apply",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=r.bandAware,i=r.position;if(n!==void 0){if(i)switch(i){case"start":return this.scale(n);case"middle":{var l=this.bandwidth?this.bandwidth()/2:0;return this.scale(n)+l}case"end":{var u=this.bandwidth?this.bandwidth():0;return this.scale(n)+u}default:return this.scale(n)}if(s){var d=this.bandwidth?this.bandwidth()/2:0;return this.scale(n)+d}return this.scale(n)}}},{key:"isInRange",value:function(n){var r=this.range(),s=r[0],i=r[r.length-1];return s<=i?n>=s&&n<=i:n>=i&&n<=s}}],[{key:"create",value:function(n){return new e(n)}}])})();Kv(_9,"EPS",1e-4);var lO=function(t){var n=Object.keys(t).reduce(function(r,s){return Qa(Qa({},r),{},Kv({},s,_9.create(t[s])))},{});return Qa(Qa({},n),{},{apply:function(s){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},l=i.bandAware,u=i.position;return FNe(s,function(d,f){return n[f].apply(d,{bandAware:l,position:u})})},isInRange:function(s){return C9(s,function(i,l){return n[l].isInRange(i)})}})};function fSe(e){return(e%180+180)%180}var mSe=function(t){var n=t.width,r=t.height,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,i=fSe(s),l=i*Math.PI/180,u=Math.atan(r/n),d=l>u&&l<Math.PI-u?r/Math.sin(l):n/Math.cos(l);return Math.abs(d)},WS,y6;function hSe(){if(y6)return WS;y6=1;var e=Vo(),t=Ih(),n=Ev();function r(s){return function(i,l,u){var d=Object(i);if(!t(i)){var f=e(l,3);i=n(i),l=function(p){return f(d[p],p,d)}}var h=s(i,l,u);return h>-1?d[f?i[h]:h]:void 0}}return WS=r,WS}var YS,v6;function pSe(){if(v6)return YS;v6=1;var e=j9();function t(n){var r=e(n),s=r%1;return r===r?s?r-s:r:0}return YS=t,YS}var XS,b6;function xSe(){if(b6)return XS;b6=1;var e=VU(),t=Vo(),n=pSe(),r=Math.max;function s(i,l,u){var d=i==null?0:i.length;if(!d)return-1;var f=u==null?0:n(u);return f<0&&(f=r(d+f,0)),e(i,t(l,3),f)}return XS=s,XS}var QS,j6;function gSe(){if(j6)return QS;j6=1;var e=hSe(),t=xSe(),n=e(t);return QS=n,QS}var ySe=gSe();const vSe=Bt(ySe);var bSe=oU();const jSe=Bt(bSe);var wSe=jSe(function(e){return{x:e.left,y:e.top,width:e.width,height:e.height}},function(e){return["l",e.left,"t",e.top,"w",e.width,"h",e.height].join("")}),cO=v.createContext(void 0),uO=v.createContext(void 0),M9=v.createContext(void 0),R9=v.createContext({}),D9=v.createContext(void 0),$9=v.createContext(0),I9=v.createContext(0),w6=function(t){var n=t.state,r=n.xAxisMap,s=n.yAxisMap,i=n.offset,l=t.clipPathId,u=t.children,d=t.width,f=t.height,h=wSe(i);return ie.createElement(cO.Provider,{value:r},ie.createElement(uO.Provider,{value:s},ie.createElement(R9.Provider,{value:i},ie.createElement(M9.Provider,{value:h},ie.createElement(D9.Provider,{value:l},ie.createElement($9.Provider,{value:f},ie.createElement(I9.Provider,{value:d},u)))))))},NSe=function(){return v.useContext(D9)},L9=function(t){var n=v.useContext(cO);n==null&&Yl();var r=n[t];return r==null&&Yl(),r},SSe=function(){var t=v.useContext(cO);return Co(t)},CSe=function(){var t=v.useContext(uO),n=vSe(t,function(r){return C9(r.domain,Number.isFinite)});return n||Co(t)},F9=function(t){var n=v.useContext(uO);n==null&&Yl();var r=n[t];return r==null&&Yl(),r},ASe=function(){var t=v.useContext(M9);return t},TSe=function(){return v.useContext(R9)},dO=function(){return v.useContext(I9)},fO=function(){return v.useContext($9)};function Zu(e){"@babel/helpers - typeof";return Zu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Zu(e)}function kSe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function OSe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,B9(r.key),r)}}function PSe(e,t,n){return t&&OSe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function ESe(e,t,n){return t=Iy(t),_Se(e,q9()?Reflect.construct(t,n||[],Iy(e).constructor):t.apply(e,n))}function _Se(e,t){if(t&&(Zu(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return MSe(e)}function MSe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function q9(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(q9=function(){return!!e})()}function Iy(e){return Iy=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Iy(e)}function RSe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&gA(e,t)}function gA(e,t){return gA=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},gA(e,t)}function N6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function S6(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?N6(Object(n),!0).forEach(function(r){mO(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):N6(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function mO(e,t,n){return t=B9(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function B9(e){var t=DSe(e,"string");return Zu(t)=="symbol"?t:t+""}function DSe(e,t){if(Zu(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Zu(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function $Se(e,t){return qSe(e)||FSe(e,t)||LSe(e,t)||ISe()}function ISe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
75In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function LSe(e,t){if(e){if(typeof e=="string")return C6(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return C6(e,t)}}function C6(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function FSe(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,s,i,l,u=[],d=!0,f=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(d=(r=i.call(n)).done)&&(u.push(r.value),u.length!==t);d=!0);}catch(h){f=!0,s=h}finally{try{if(!d&&n.return!=null&&(l=n.return(),Object(l)!==l))return}finally{if(f)throw s}}return u}}function qSe(e){if(Array.isArray(e))return e}function yA(){return yA=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},yA.apply(this,arguments)}var BSe=function(t,n){var r;return ie.isValidElement(t)?r=ie.cloneElement(t,n):ut(t)?r=t(n):r=ie.createElement("line",yA({},n,{className:"recharts-reference-line-line"})),r},zSe=function(t,n,r,s,i,l,u,d,f){var h=i.x,p=i.y,x=i.width,y=i.height;if(r){var w=f.y,j=t.y.apply(w,{position:l});if(_s(f,"discard")&&!t.y.isInRange(j))return null;var b=[{x:h+x,y:j},{x:h,y:j}];return d==="left"?b.reverse():b}if(n){var C=f.x,N=t.x.apply(C,{position:l});if(_s(f,"discard")&&!t.x.isInRange(N))return null;var k=[{x:N,y:p+y},{x:N,y:p}];return u==="top"?k.reverse():k}if(s){var T=f.segment,A=T.map(function(P){return t.apply(P,{position:l})});return _s(f,"discard")&&DNe(A,function(P){return!t.isInRange(P)})?null:A}return null};function USe(e){var t=e.x,n=e.y,r=e.segment,s=e.xAxisId,i=e.yAxisId,l=e.shape,u=e.className,d=e.alwaysShow,f=NSe(),h=L9(s),p=F9(i),x=ASe();if(!f||!x)return null;wi(d===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.');var y=lO({x:h.scale,y:p.scale}),w=Mn(t),j=Mn(n),b=r&&r.length===2,C=zSe(y,w,j,b,x,e.position,h.orientation,p.orientation,e);if(!C)return null;var N=$Se(C,2),k=N[0],T=k.x,A=k.y,P=N[1],E=P.x,_=P.y,R=_s(e,"hidden")?"url(#".concat(f,")"):void 0,H=S6(S6({clipPath:R},gt(e,!0)),{},{x1:T,y1:A,x2:E,y2:_});return ie.createElement(pn,{className:yt("recharts-reference-line",u)},BSe(l,H),cr.renderCallByParent(e,dSe({x1:T,y1:A,x2:E,y2:_})))}var hO=(function(e){function t(){return kSe(this,t),ESe(this,t,arguments)}return RSe(t,e),PSe(t,[{key:"render",value:function(){return ie.createElement(USe,this.props)}}])})(ie.Component);mO(hO,"displayName","ReferenceLine");mO(hO,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,fill:"none",stroke:"#ccc",fillOpacity:1,strokeWidth:1,position:"middle"});function vA(){return vA=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},vA.apply(this,arguments)}function Ju(e){"@babel/helpers - typeof";return Ju=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ju(e)}function A6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function T6(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?A6(Object(n),!0).forEach(function(r){Wv(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):A6(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function HSe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function VSe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,U9(r.key),r)}}function GSe(e,t,n){return t&&VSe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function KSe(e,t,n){return t=Ly(t),WSe(e,z9()?Reflect.construct(t,n||[],Ly(e).constructor):t.apply(e,n))}function WSe(e,t){if(t&&(Ju(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return YSe(e)}function YSe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function z9(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(z9=function(){return!!e})()}function Ly(e){return Ly=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Ly(e)}function XSe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&bA(e,t)}function bA(e,t){return bA=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},bA(e,t)}function Wv(e,t,n){return t=U9(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function U9(e){var t=QSe(e,"string");return Ju(t)=="symbol"?t:t+""}function QSe(e,t){if(Ju(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Ju(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var ZSe=function(t){var n=t.x,r=t.y,s=t.xAxis,i=t.yAxis,l=lO({x:s.scale,y:i.scale}),u=l.apply({x:n,y:r},{bandAware:!0});return _s(t,"discard")&&!l.isInRange(u)?null:u},Yv=(function(e){function t(){return HSe(this,t),KSe(this,t,arguments)}return XSe(t,e),GSe(t,[{key:"render",value:function(){var r=this.props,s=r.x,i=r.y,l=r.r,u=r.alwaysShow,d=r.clipPathId,f=Mn(s),h=Mn(i);if(wi(u===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.'),!f||!h)return null;var p=ZSe(this.props);if(!p)return null;var x=p.x,y=p.y,w=this.props,j=w.shape,b=w.className,C=_s(this.props,"hidden")?"url(#".concat(d,")"):void 0,N=T6(T6({clipPath:C},gt(this.props,!0)),{},{cx:x,cy:y});return ie.createElement(pn,{className:yt("recharts-reference-dot",b)},t.renderDot(j,N),cr.renderCallByParent(this.props,{x:x-l,y:y-l,width:2*l,height:2*l}))}}])})(ie.Component);Wv(Yv,"displayName","ReferenceDot");Wv(Yv,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,r:10,fill:"#fff",stroke:"#ccc",fillOpacity:1,strokeWidth:1});Wv(Yv,"renderDot",function(e,t){var n;return ie.isValidElement(e)?n=ie.cloneElement(e,t):ut(e)?n=e(t):n=ie.createElement(oO,vA({},t,{cx:t.cx,cy:t.cy,className:"recharts-reference-dot-dot"})),n});function jA(){return jA=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},jA.apply(this,arguments)}function ed(e){"@babel/helpers - typeof";return ed=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ed(e)}function k6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function O6(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?k6(Object(n),!0).forEach(function(r){Xv(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):k6(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function JSe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function e2e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,V9(r.key),r)}}function t2e(e,t,n){return t&&e2e(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function n2e(e,t,n){return t=Fy(t),r2e(e,H9()?Reflect.construct(t,n||[],Fy(e).constructor):t.apply(e,n))}function r2e(e,t){if(t&&(ed(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return a2e(e)}function a2e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function H9(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(H9=function(){return!!e})()}function Fy(e){return Fy=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Fy(e)}function s2e(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&wA(e,t)}function wA(e,t){return wA=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},wA(e,t)}function Xv(e,t,n){return t=V9(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function V9(e){var t=i2e(e,"string");return ed(t)=="symbol"?t:t+""}function i2e(e,t){if(ed(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(ed(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var o2e=function(t,n,r,s,i){var l=i.x1,u=i.x2,d=i.y1,f=i.y2,h=i.xAxis,p=i.yAxis;if(!h||!p)return null;var x=lO({x:h.scale,y:p.scale}),y={x:t?x.x.apply(l,{position:"start"}):x.x.rangeMin,y:r?x.y.apply(d,{position:"start"}):x.y.rangeMin},w={x:n?x.x.apply(u,{position:"end"}):x.x.rangeMax,y:s?x.y.apply(f,{position:"end"}):x.y.rangeMax};return _s(i,"discard")&&(!x.isInRange(y)||!x.isInRange(w))?null:E9(y,w)},Qv=(function(e){function t(){return JSe(this,t),n2e(this,t,arguments)}return s2e(t,e),t2e(t,[{key:"render",value:function(){var r=this.props,s=r.x1,i=r.x2,l=r.y1,u=r.y2,d=r.className,f=r.alwaysShow,h=r.clipPathId;wi(f===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.');var p=Mn(s),x=Mn(i),y=Mn(l),w=Mn(u),j=this.props.shape;if(!p&&!x&&!y&&!w&&!j)return null;var b=o2e(p,x,y,w,this.props);if(!b&&!j)return null;var C=_s(this.props,"hidden")?"url(#".concat(h,")"):void 0;return ie.createElement(pn,{className:yt("recharts-reference-area",d)},t.renderRect(j,O6(O6({clipPath:C},gt(this.props,!0)),b)),cr.renderCallByParent(this.props,b))}}])})(ie.Component);Xv(Qv,"displayName","ReferenceArea");Xv(Qv,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,r:10,fill:"#ccc",fillOpacity:.5,stroke:"none",strokeWidth:1});Xv(Qv,"renderRect",function(e,t){var n;return ie.isValidElement(e)?n=ie.cloneElement(e,t):ut(e)?n=e(t):n=ie.createElement(iO,jA({},t,{className:"recharts-reference-area-rect"})),n});function G9(e,t,n){if(t<1)return[];if(t===1&&n===void 0)return e;for(var r=[],s=0;s<e.length;s+=t)r.push(e[s]);return r}function l2e(e,t,n){var r={width:e.width+t.width,height:e.height+t.height};return mSe(r,n)}function c2e(e,t,n){var r=n==="width",s=e.x,i=e.y,l=e.width,u=e.height;return t===1?{start:r?s:i,end:r?s+l:i+u}:{start:r?s+l:i+u,end:r?s:i}}function qy(e,t,n,r,s){if(e*t<e*r||e*t>e*s)return!1;var i=n();return e*(t-e*i/2-r)>=0&&e*(t+e*i/2-s)<=0}function u2e(e,t){return G9(e,t+1)}function d2e(e,t,n,r,s){for(var i=(r||[]).slice(),l=t.start,u=t.end,d=0,f=1,h=l,p=function(){var w=r?.[d];if(w===void 0)return{v:G9(r,f)};var j=d,b,C=function(){return b===void 0&&(b=n(w,j)),b},N=w.coordinate,k=d===0||qy(e,N,C,h,u);k||(d=0,h=l,f+=1),k&&(h=N+e*(C()/2+s),d+=f)},x;f<=i.length;)if(x=p(),x)return x.v;return[]}function mh(e){"@babel/helpers - typeof";return mh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},mh(e)}function P6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function lr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?P6(Object(n),!0).forEach(function(r){f2e(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):P6(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function f2e(e,t,n){return t=m2e(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function m2e(e){var t=h2e(e,"string");return mh(t)=="symbol"?t:t+""}function h2e(e,t){if(mh(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(mh(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function p2e(e,t,n,r,s){for(var i=(r||[]).slice(),l=i.length,u=t.start,d=t.end,f=function(x){var y=i[x],w,j=function(){return w===void 0&&(w=n(y,x)),w};if(x===l-1){var b=e*(y.coordinate+e*j()/2-d);i[x]=y=lr(lr({},y),{},{tickCoord:b>0?y.coordinate-b*e:y.coordinate})}else i[x]=y=lr(lr({},y),{},{tickCoord:y.coordinate});var C=qy(e,y.tickCoord,j,u,d);C&&(d=y.tickCoord-e*(j()/2+s),i[x]=lr(lr({},y),{},{isShow:!0}))},h=l-1;h>=0;h--)f(h);return i}function x2e(e,t,n,r,s,i){var l=(r||[]).slice(),u=l.length,d=t.start,f=t.end;if(i){var h=r[u-1],p=n(h,u-1),x=e*(h.coordinate+e*p/2-f);l[u-1]=h=lr(lr({},h),{},{tickCoord:x>0?h.coordinate-x*e:h.coordinate});var y=qy(e,h.tickCoord,function(){return p},d,f);y&&(f=h.tickCoord-e*(p/2+s),l[u-1]=lr(lr({},h),{},{isShow:!0}))}for(var w=i?u-1:u,j=function(N){var k=l[N],T,A=function(){return T===void 0&&(T=n(k,N)),T};if(N===0){var P=e*(k.coordinate-e*A()/2-d);l[N]=k=lr(lr({},k),{},{tickCoord:P<0?k.coordinate-P*e:k.coordinate})}else l[N]=k=lr(lr({},k),{},{tickCoord:k.coordinate});var E=qy(e,k.tickCoord,A,d,f);E&&(d=k.tickCoord+e*(A()/2+s),l[N]=lr(lr({},k),{},{isShow:!0}))},b=0;b<w;b++)j(b);return l}function pO(e,t,n){var r=e.tick,s=e.ticks,i=e.viewBox,l=e.minTickGap,u=e.orientation,d=e.interval,f=e.tickFormatter,h=e.unit,p=e.angle;if(!s||!s.length||!r)return[];if(Ie(d)||Td.isSsr)return u2e(s,typeof d=="number"&&Ie(d)?d:0);var x=[],y=u==="top"||u==="bottom"?"width":"height",w=h&&y==="width"?vm(h,{fontSize:t,letterSpacing:n}):{width:0,height:0},j=function(k,T){var A=ut(f)?f(k.value,T):k.value;return y==="width"?l2e(vm(A,{fontSize:t,letterSpacing:n}),w,p):vm(A,{fontSize:t,letterSpacing:n})[y]},b=s.length>=2?ns(s[1].coordinate-s[0].coordinate):1,C=c2e(i,b,y);return d==="equidistantPreserveStart"?d2e(b,C,j,s,l):(d==="preserveStart"||d==="preserveStartEnd"?x=x2e(b,C,j,s,l,d==="preserveStartEnd"):x=p2e(b,C,j,s,l),x.filter(function(N){return N.isShow}))}var g2e=["viewBox"],y2e=["viewBox"],v2e=["ticks"];function td(e){"@babel/helpers - typeof";return td=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},td(e)}function Nu(){return Nu=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Nu.apply(this,arguments)}function E6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function On(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?E6(Object(n),!0).forEach(function(r){xO(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):E6(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function ZS(e,t){if(e==null)return{};var n=b2e(e,t),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)r=i[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function b2e(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function j2e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _6(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,W9(r.key),r)}}function w2e(e,t,n){return t&&_6(e.prototype,t),n&&_6(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function N2e(e,t,n){return t=By(t),S2e(e,K9()?Reflect.construct(t,n||[],By(e).constructor):t.apply(e,n))}function S2e(e,t){if(t&&(td(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return C2e(e)}function C2e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function K9(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(K9=function(){return!!e})()}function By(e){return By=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},By(e)}function A2e(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&NA(e,t)}function NA(e,t){return NA=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},NA(e,t)}function xO(e,t,n){return t=W9(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function W9(e){var t=T2e(e,"string");return td(t)=="symbol"?t:t+""}function T2e(e,t){if(td(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(td(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Ed=(function(e){function t(n){var r;return j2e(this,t),r=N2e(this,t,[n]),r.state={fontSize:"",letterSpacing:""},r}return A2e(t,e),w2e(t,[{key:"shouldComponentUpdate",value:function(r,s){var i=r.viewBox,l=ZS(r,g2e),u=this.props,d=u.viewBox,f=ZS(u,y2e);return!ku(i,d)||!ku(l,f)||!ku(s,this.state)}},{key:"componentDidMount",value:function(){var r=this.layerReference;if(r){var s=r.getElementsByClassName("recharts-cartesian-axis-tick-value")[0];s&&this.setState({fontSize:window.getComputedStyle(s).fontSize,letterSpacing:window.getComputedStyle(s).letterSpacing})}}},{key:"getTickLineCoord",value:function(r){var s=this.props,i=s.x,l=s.y,u=s.width,d=s.height,f=s.orientation,h=s.tickSize,p=s.mirror,x=s.tickMargin,y,w,j,b,C,N,k=p?-1:1,T=r.tickSize||h,A=Ie(r.tickCoord)?r.tickCoord:r.coordinate;switch(f){case"top":y=w=r.coordinate,b=l+ +!p*d,j=b-k*T,N=j-k*x,C=A;break;case"left":j=b=r.coordinate,w=i+ +!p*u,y=w-k*T,C=y-k*x,N=A;break;case"right":j=b=r.coordinate,w=i+ +p*u,y=w+k*T,C=y+k*x,N=A;break;default:y=w=r.coordinate,b=l+ +p*d,j=b+k*T,N=j+k*x,C=A;break}return{line:{x1:y,y1:j,x2:w,y2:b},tick:{x:C,y:N}}}},{key:"getTickTextAnchor",value:function(){var r=this.props,s=r.orientation,i=r.mirror,l;switch(s){case"left":l=i?"start":"end";break;case"right":l=i?"end":"start";break;default:l="middle";break}return l}},{key:"getTickVerticalAnchor",value:function(){var r=this.props,s=r.orientation,i=r.mirror,l="end";switch(s){case"left":case"right":l="middle";break;case"top":l=i?"start":"end";break;default:l=i?"end":"start";break}return l}},{key:"renderAxisLine",value:function(){var r=this.props,s=r.x,i=r.y,l=r.width,u=r.height,d=r.orientation,f=r.mirror,h=r.axisLine,p=On(On(On({},gt(this.props,!1)),gt(h,!1)),{},{fill:"none"});if(d==="top"||d==="bottom"){var x=+(d==="top"&&!f||d==="bottom"&&f);p=On(On({},p),{},{x1:s,y1:i+x*u,x2:s+l,y2:i+x*u})}else{var y=+(d==="left"&&!f||d==="right"&&f);p=On(On({},p),{},{x1:s+y*l,y1:i,x2:s+y*l,y2:i+u})}return ie.createElement("line",Nu({},p,{className:yt("recharts-cartesian-axis-line",Pa(h,"className"))}))}},{key:"renderTicks",value:function(r,s,i){var l=this,u=this.props,d=u.tickLine,f=u.stroke,h=u.tick,p=u.tickFormatter,x=u.unit,y=pO(On(On({},this.props),{},{ticks:r}),s,i),w=this.getTickTextAnchor(),j=this.getTickVerticalAnchor(),b=gt(this.props,!1),C=gt(h,!1),N=On(On({},b),{},{fill:"none"},gt(d,!1)),k=y.map(function(T,A){var P=l.getTickLineCoord(T),E=P.line,_=P.tick,R=On(On(On(On({textAnchor:w,verticalAnchor:j},b),{},{stroke:"none",fill:f},C),_),{},{index:A,payload:T,visibleTicksCount:y.length,tickFormatter:p});return ie.createElement(pn,Nu({className:"recharts-cartesian-axis-tick",key:"tick-".concat(T.value,"-").concat(T.coordinate,"-").concat(T.tickCoord)},Xg(l.props,T,A)),d&&ie.createElement("line",Nu({},N,E,{className:yt("recharts-cartesian-axis-tick-line",Pa(d,"className"))})),h&&t.renderTickItem(h,R,"".concat(ut(p)?p(T.value,A):T.value).concat(x||"")))});return ie.createElement("g",{className:"recharts-cartesian-axis-ticks"},k)}},{key:"render",value:function(){var r=this,s=this.props,i=s.axisLine,l=s.width,u=s.height,d=s.ticksGenerator,f=s.className,h=s.hide;if(h)return null;var p=this.props,x=p.ticks,y=ZS(p,v2e),w=x;return ut(d)&&(w=x&&x.length>0?d(this.props):d(y)),l<=0||u<=0||!w||!w.length?null:ie.createElement(pn,{className:yt("recharts-cartesian-axis",f),ref:function(b){r.layerReference=b}},i&&this.renderAxisLine(),this.renderTicks(w,this.state.fontSize,this.state.letterSpacing),cr.renderCallByParent(this.props))}}],[{key:"renderTickItem",value:function(r,s,i){var l,u=yt(s.className,"recharts-cartesian-axis-tick-value");return ie.isValidElement(r)?l=ie.cloneElement(r,On(On({},s),{},{className:u})):ut(r)?l=r(On(On({},s),{},{className:u})):l=ie.createElement(oy,Nu({},s,{className:"recharts-cartesian-axis-tick-value"}),i),l}}])})(v.Component);xO(Ed,"displayName","CartesianAxis");xO(Ed,"defaultProps",{x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:"bottom",ticks:[],stroke:"#666",tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:"preserveEnd"});var k2e=["x1","y1","x2","y2","key"],O2e=["offset"];function Xl(e){"@babel/helpers - typeof";return Xl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Xl(e)}function M6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function ur(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?M6(Object(n),!0).forEach(function(r){P2e(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):M6(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function P2e(e,t,n){return t=E2e(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function E2e(e){var t=_2e(e,"string");return Xl(t)=="symbol"?t:t+""}function _2e(e,t){if(Xl(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Xl(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Il(){return Il=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Il.apply(this,arguments)}function R6(e,t){if(e==null)return{};var n=M2e(e,t),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)r=i[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function M2e(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var R2e=function(t){var n=t.fill;if(!n||n==="none")return null;var r=t.fillOpacity,s=t.x,i=t.y,l=t.width,u=t.height,d=t.ry;return ie.createElement("rect",{x:s,y:i,ry:d,width:l,height:u,stroke:"none",fill:n,fillOpacity:r,className:"recharts-cartesian-grid-bg"})};function Y9(e,t){var n;if(ie.isValidElement(e))n=ie.cloneElement(e,t);else if(ut(e))n=e(t);else{var r=t.x1,s=t.y1,i=t.x2,l=t.y2,u=t.key,d=R6(t,k2e),f=gt(d,!1);f.offset;var h=R6(f,O2e);n=ie.createElement("line",Il({},h,{x1:r,y1:s,x2:i,y2:l,fill:"none",key:u}))}return n}function D2e(e){var t=e.x,n=e.width,r=e.horizontal,s=r===void 0?!0:r,i=e.horizontalPoints;if(!s||!i||!i.length)return null;var l=i.map(function(u,d){var f=ur(ur({},e),{},{x1:t,y1:u,x2:t+n,y2:u,key:"line-".concat(d),index:d});return Y9(s,f)});return ie.createElement("g",{className:"recharts-cartesian-grid-horizontal"},l)}function $2e(e){var t=e.y,n=e.height,r=e.vertical,s=r===void 0?!0:r,i=e.verticalPoints;if(!s||!i||!i.length)return null;var l=i.map(function(u,d){var f=ur(ur({},e),{},{x1:u,y1:t,x2:u,y2:t+n,key:"line-".concat(d),index:d});return Y9(s,f)});return ie.createElement("g",{className:"recharts-cartesian-grid-vertical"},l)}function I2e(e){var t=e.horizontalFill,n=e.fillOpacity,r=e.x,s=e.y,i=e.width,l=e.height,u=e.horizontalPoints,d=e.horizontal,f=d===void 0?!0:d;if(!f||!t||!t.length)return null;var h=u.map(function(x){return Math.round(x+s-s)}).sort(function(x,y){return x-y});s!==h[0]&&h.unshift(0);var p=h.map(function(x,y){var w=!h[y+1],j=w?s+l-x:h[y+1]-x;if(j<=0)return null;var b=y%t.length;return ie.createElement("rect",{key:"react-".concat(y),y:x,x:r,height:j,width:i,stroke:"none",fill:t[b],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return ie.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},p)}function L2e(e){var t=e.vertical,n=t===void 0?!0:t,r=e.verticalFill,s=e.fillOpacity,i=e.x,l=e.y,u=e.width,d=e.height,f=e.verticalPoints;if(!n||!r||!r.length)return null;var h=f.map(function(x){return Math.round(x+i-i)}).sort(function(x,y){return x-y});i!==h[0]&&h.unshift(0);var p=h.map(function(x,y){var w=!h[y+1],j=w?i+u-x:h[y+1]-x;if(j<=0)return null;var b=y%r.length;return ie.createElement("rect",{key:"react-".concat(y),x,y:l,width:j,height:d,stroke:"none",fill:r[b],fillOpacity:s,className:"recharts-cartesian-grid-bg"})});return ie.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},p)}var F2e=function(t,n){var r=t.xAxis,s=t.width,i=t.height,l=t.offset;return l9(pO(ur(ur(ur({},Ed.defaultProps),r),{},{ticks:vi(r,!0),viewBox:{x:0,y:0,width:s,height:i}})),l.left,l.left+l.width,n)},q2e=function(t,n){var r=t.yAxis,s=t.width,i=t.height,l=t.offset;return l9(pO(ur(ur(ur({},Ed.defaultProps),r),{},{ticks:vi(r,!0),viewBox:{x:0,y:0,width:s,height:i}})),l.top,l.top+l.height,n)},su={horizontal:!0,vertical:!0,stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function SA(e){var t,n,r,s,i,l,u=dO(),d=fO(),f=TSe(),h=ur(ur({},e),{},{stroke:(t=e.stroke)!==null&&t!==void 0?t:su.stroke,fill:(n=e.fill)!==null&&n!==void 0?n:su.fill,horizontal:(r=e.horizontal)!==null&&r!==void 0?r:su.horizontal,horizontalFill:(s=e.horizontalFill)!==null&&s!==void 0?s:su.horizontalFill,vertical:(i=e.vertical)!==null&&i!==void 0?i:su.vertical,verticalFill:(l=e.verticalFill)!==null&&l!==void 0?l:su.verticalFill,x:Ie(e.x)?e.x:f.left,y:Ie(e.y)?e.y:f.top,width:Ie(e.width)?e.width:f.width,height:Ie(e.height)?e.height:f.height}),p=h.x,x=h.y,y=h.width,w=h.height,j=h.syncWithTicks,b=h.horizontalValues,C=h.verticalValues,N=SSe(),k=CSe();if(!Ie(y)||y<=0||!Ie(w)||w<=0||!Ie(p)||p!==+p||!Ie(x)||x!==+x)return null;var T=h.verticalCoordinatesGenerator||F2e,A=h.horizontalCoordinatesGenerator||q2e,P=h.horizontalPoints,E=h.verticalPoints;if((!P||!P.length)&&ut(A)){var _=b&&b.length,R=A({yAxis:k?ur(ur({},k),{},{ticks:_?b:k.ticks}):void 0,width:u,height:d,offset:f},_?!0:j);wi(Array.isArray(R),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(Xl(R),"]")),Array.isArray(R)&&(P=R)}if((!E||!E.length)&&ut(T)){var H=C&&C.length,L=T({xAxis:N?ur(ur({},N),{},{ticks:H?C:N.ticks}):void 0,width:u,height:d,offset:f},H?!0:j);wi(Array.isArray(L),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(Xl(L),"]")),Array.isArray(L)&&(E=L)}return ie.createElement("g",{className:"recharts-cartesian-grid"},ie.createElement(R2e,{fill:h.fill,fillOpacity:h.fillOpacity,x:h.x,y:h.y,width:h.width,height:h.height,ry:h.ry}),ie.createElement(D2e,Il({},h,{offset:f,horizontalPoints:P,xAxis:N,yAxis:k})),ie.createElement($2e,Il({},h,{offset:f,verticalPoints:E,xAxis:N,yAxis:k})),ie.createElement(I2e,Il({},h,{horizontalPoints:P})),ie.createElement(L2e,Il({},h,{verticalPoints:E})))}SA.displayName="CartesianGrid";var B2e=["type","layout","connectNulls","ref"],z2e=["key"];function nd(e){"@babel/helpers - typeof";return nd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},nd(e)}function D6(e,t){if(e==null)return{};var n=U2e(e,t),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)r=i[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function U2e(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Nm(){return Nm=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Nm.apply(this,arguments)}function $6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function ta(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?$6(Object(n),!0).forEach(function(r){Za(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$6(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function iu(e){return K2e(e)||G2e(e)||V2e(e)||H2e()}function H2e(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
76In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function V2e(e,t){if(e){if(typeof e=="string")return CA(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return CA(e,t)}}function G2e(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function K2e(e){if(Array.isArray(e))return CA(e)}function CA(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function W2e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function I6(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Q9(r.key),r)}}function Y2e(e,t,n){return t&&I6(e.prototype,t),n&&I6(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function X2e(e,t,n){return t=zy(t),Q2e(e,X9()?Reflect.construct(t,n||[],zy(e).constructor):t.apply(e,n))}function Q2e(e,t){if(t&&(nd(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Z2e(e)}function Z2e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function X9(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(X9=function(){return!!e})()}function zy(e){return zy=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},zy(e)}function J2e(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&AA(e,t)}function AA(e,t){return AA=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},AA(e,t)}function Za(e,t,n){return t=Q9(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Q9(e){var t=eCe(e,"string");return nd(t)=="symbol"?t:t+""}function eCe(e,t){if(nd(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(nd(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Uh=(function(e){function t(){var n;W2e(this,t);for(var r=arguments.length,s=new Array(r),i=0;i<r;i++)s[i]=arguments[i];return n=X2e(this,t,[].concat(s)),Za(n,"state",{isAnimationFinished:!0,totalLength:0}),Za(n,"generateSimpleStrokeDasharray",function(l,u){return"".concat(u,"px ").concat(l-u,"px")}),Za(n,"getStrokeDasharray",function(l,u,d){var f=d.reduce(function(C,N){return C+N});if(!f)return n.generateSimpleStrokeDasharray(u,l);for(var h=Math.floor(l/f),p=l%f,x=u-l,y=[],w=0,j=0;w<d.length;j+=d[w],++w)if(j+d[w]>p){y=[].concat(iu(d.slice(0,w)),[p-j]);break}var b=y.length%2===0?[0,x]:[x];return[].concat(iu(t.repeat(d,h)),iu(y),b).map(function(C){return"".concat(C,"px")}).join(", ")}),Za(n,"id",$h("recharts-line-")),Za(n,"pathRef",function(l){n.mainCurve=l}),Za(n,"handleAnimationEnd",function(){n.setState({isAnimationFinished:!0}),n.props.onAnimationEnd&&n.props.onAnimationEnd()}),Za(n,"handleAnimationStart",function(){n.setState({isAnimationFinished:!1}),n.props.onAnimationStart&&n.props.onAnimationStart()}),n}return J2e(t,e),Y2e(t,[{key:"componentDidMount",value:function(){if(this.props.isAnimationActive){var r=this.getTotalLength();this.setState({totalLength:r})}}},{key:"componentDidUpdate",value:function(){if(this.props.isAnimationActive){var r=this.getTotalLength();r!==this.state.totalLength&&this.setState({totalLength:r})}}},{key:"getTotalLength",value:function(){var r=this.mainCurve;try{return r&&r.getTotalLength&&r.getTotalLength()||0}catch{return 0}}},{key:"renderErrorBar",value:function(r,s){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var i=this.props,l=i.points,u=i.xAxis,d=i.yAxis,f=i.layout,h=i.children,p=Ea(h,zh);if(!p)return null;var x=function(j,b){return{x:j.x,y:j.y,value:j.value,errorVal:ca(j.payload,b)}},y={clipPath:r?"url(#clipPath-".concat(s,")"):null};return ie.createElement(pn,y,p.map(function(w){return ie.cloneElement(w,{key:"bar-".concat(w.props.dataKey),data:l,xAxis:u,yAxis:d,layout:f,dataPointFormatter:x})}))}},{key:"renderDots",value:function(r,s,i){var l=this.props.isAnimationActive;if(l&&!this.state.isAnimationFinished)return null;var u=this.props,d=u.dot,f=u.points,h=u.dataKey,p=gt(this.props,!1),x=gt(d,!0),y=f.map(function(j,b){var C=ta(ta(ta({key:"dot-".concat(b),r:3},p),x),{},{index:b,cx:j.x,cy:j.y,value:j.value,dataKey:h,payload:j.payload,points:f});return t.renderDotItem(d,C)}),w={clipPath:r?"url(#clipPath-".concat(s?"":"dots-").concat(i,")"):null};return ie.createElement(pn,Nm({className:"recharts-line-dots",key:"dots"},w),y)}},{key:"renderCurveStatically",value:function(r,s,i,l){var u=this.props,d=u.type,f=u.layout,h=u.connectNulls;u.ref;var p=D6(u,B2e),x=ta(ta(ta({},gt(p,!0)),{},{fill:"none",className:"recharts-line-curve",clipPath:s?"url(#clipPath-".concat(i,")"):null,points:r},l),{},{type:d,layout:f,connectNulls:h});return ie.createElement(nA,Nm({},x,{pathRef:this.pathRef}))}},{key:"renderCurveWithAnimation",value:function(r,s){var i=this,l=this.props,u=l.points,d=l.strokeDasharray,f=l.isAnimationActive,h=l.animationBegin,p=l.animationDuration,x=l.animationEasing,y=l.animationId,w=l.animateNewValues,j=l.width,b=l.height,C=this.state,N=C.prevPoints,k=C.totalLength;return ie.createElement(Mi,{begin:h,duration:p,isActive:f,easing:x,from:{t:0},to:{t:1},key:"line-".concat(y),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(T){var A=T.t;if(N){var P=N.length/u.length,E=u.map(function(I,W){var U=Math.floor(W*P);if(N[U]){var V=N[U],D=es(V.x,I.x),q=es(V.y,I.y);return ta(ta({},I),{},{x:D(A),y:q(A)})}if(w){var K=es(j*2,I.x),Y=es(b/2,I.y);return ta(ta({},I),{},{x:K(A),y:Y(A)})}return ta(ta({},I),{},{x:I.x,y:I.y})});return i.renderCurveStatically(E,r,s)}var _=es(0,k),R=_(A),H;if(d){var L="".concat(d).split(/[,\s]+/gim).map(function(I){return parseFloat(I)});H=i.getStrokeDasharray(R,k,L)}else H=i.generateSimpleStrokeDasharray(k,R);return i.renderCurveStatically(u,r,s,{strokeDasharray:H})})}},{key:"renderCurve",value:function(r,s){var i=this.props,l=i.points,u=i.isAnimationActive,d=this.state,f=d.prevPoints,h=d.totalLength;return u&&l&&l.length&&(!f&&h>0||!zv(f,l))?this.renderCurveWithAnimation(r,s):this.renderCurveStatically(l,r,s)}},{key:"render",value:function(){var r,s=this.props,i=s.hide,l=s.dot,u=s.points,d=s.className,f=s.xAxis,h=s.yAxis,p=s.top,x=s.left,y=s.width,w=s.height,j=s.isAnimationActive,b=s.id;if(i||!u||!u.length)return null;var C=this.state.isAnimationFinished,N=u.length===1,k=yt("recharts-line",d),T=f&&f.allowDataOverflow,A=h&&h.allowDataOverflow,P=T||A,E=pt(b)?this.id:b,_=(r=gt(l,!1))!==null&&r!==void 0?r:{r:3,strokeWidth:2},R=_.r,H=R===void 0?3:R,L=_.strokeWidth,I=L===void 0?2:L,W=pme(l)?l:{},U=W.clipDot,V=U===void 0?!0:U,D=H*2+I;return ie.createElement(pn,{className:k},T||A?ie.createElement("defs",null,ie.createElement("clipPath",{id:"clipPath-".concat(E)},ie.createElement("rect",{x:T?x:x-y/2,y:A?p:p-w/2,width:T?y:y*2,height:A?w:w*2})),!V&&ie.createElement("clipPath",{id:"clipPath-dots-".concat(E)},ie.createElement("rect",{x:x-D/2,y:p-D/2,width:y+D,height:w+D}))):null,!N&&this.renderCurve(P,E),this.renderErrorBar(P,E),(N||l)&&this.renderDots(P,V,E),(!j||C)&&_o.renderCallByParent(this.props,u))}}],[{key:"getDerivedStateFromProps",value:function(r,s){return r.animationId!==s.prevAnimationId?{prevAnimationId:r.animationId,curPoints:r.points,prevPoints:s.curPoints}:r.points!==s.curPoints?{curPoints:r.points}:null}},{key:"repeat",value:function(r,s){for(var i=r.length%2!==0?[].concat(iu(r),[0]):r,l=[],u=0;u<s;++u)l=[].concat(iu(l),iu(i));return l}},{key:"renderDotItem",value:function(r,s){var i;if(ie.isValidElement(r))i=ie.cloneElement(r,s);else if(ut(r))i=r(s);else{var l=s.key,u=D6(s,z2e),d=yt("recharts-line-dot",typeof r!="boolean"?r.className:"");i=ie.createElement(oO,Nm({key:l},u,{className:d}))}return i}}])})(v.PureComponent);Za(Uh,"displayName","Line");Za(Uh,"defaultProps",{xAxisId:0,yAxisId:0,connectNulls:!1,activeDot:!0,dot:!0,legendType:"line",stroke:"#3182bd",strokeWidth:1,fill:"#fff",points:[],isAnimationActive:!Td.isSsr,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",hide:!1,label:!1});Za(Uh,"getComposedData",function(e){var t=e.props,n=e.xAxis,r=e.yAxis,s=e.xAxisTicks,i=e.yAxisTicks,l=e.dataKey,u=e.bandSize,d=e.displayedData,f=e.offset,h=t.layout,p=d.map(function(x,y){var w=ca(x,l);return h==="horizontal"?{x:eL({axis:n,ticks:s,bandSize:u,entry:x,index:y}),y:pt(w)?null:r.scale(w),value:w,payload:x}:{x:pt(w)?null:n.scale(w),y:eL({axis:r,ticks:i,bandSize:u,entry:x,index:y}),value:w,payload:x}});return ta({points:p,layout:h},f)});function rd(e){"@babel/helpers - typeof";return rd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},rd(e)}function tCe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function nCe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,eH(r.key),r)}}function rCe(e,t,n){return t&&nCe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function aCe(e,t,n){return t=Uy(t),sCe(e,Z9()?Reflect.construct(t,n||[],Uy(e).constructor):t.apply(e,n))}function sCe(e,t){if(t&&(rd(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return iCe(e)}function iCe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Z9(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Z9=function(){return!!e})()}function Uy(e){return Uy=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Uy(e)}function oCe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&TA(e,t)}function TA(e,t){return TA=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},TA(e,t)}function J9(e,t,n){return t=eH(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function eH(e){var t=lCe(e,"string");return rd(t)=="symbol"?t:t+""}function lCe(e,t){if(rd(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(rd(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function kA(){return kA=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},kA.apply(this,arguments)}function cCe(e){var t=e.xAxisId,n=dO(),r=fO(),s=L9(t);return s==null?null:v.createElement(Ed,kA({},s,{className:yt("recharts-".concat(s.axisType," ").concat(s.axisType),s.className),viewBox:{x:0,y:0,width:n,height:r},ticksGenerator:function(l){return vi(l,!0)}}))}var ad=(function(e){function t(){return tCe(this,t),aCe(this,t,arguments)}return oCe(t,e),rCe(t,[{key:"render",value:function(){return v.createElement(cCe,this.props)}}])})(v.Component);J9(ad,"displayName","XAxis");J9(ad,"defaultProps",{allowDecimals:!0,hide:!1,orientation:"bottom",width:0,height:30,mirror:!1,xAxisId:0,tickCount:5,type:"category",padding:{left:0,right:0},allowDataOverflow:!1,scale:"auto",reversed:!1,allowDuplicatedCategory:!0});function sd(e){"@babel/helpers - typeof";return sd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},sd(e)}function uCe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function dCe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,rH(r.key),r)}}function fCe(e,t,n){return t&&dCe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function mCe(e,t,n){return t=Hy(t),hCe(e,tH()?Reflect.construct(t,n||[],Hy(e).constructor):t.apply(e,n))}function hCe(e,t){if(t&&(sd(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return pCe(e)}function pCe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function tH(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(tH=function(){return!!e})()}function Hy(e){return Hy=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Hy(e)}function xCe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&OA(e,t)}function OA(e,t){return OA=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},OA(e,t)}function nH(e,t,n){return t=rH(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function rH(e){var t=gCe(e,"string");return sd(t)=="symbol"?t:t+""}function gCe(e,t){if(sd(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(sd(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function PA(){return PA=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},PA.apply(this,arguments)}var yCe=function(t){var n=t.yAxisId,r=dO(),s=fO(),i=F9(n);return i==null?null:v.createElement(Ed,PA({},i,{className:yt("recharts-".concat(i.axisType," ").concat(i.axisType),i.className),viewBox:{x:0,y:0,width:r,height:s},ticksGenerator:function(u){return vi(u,!0)}}))},id=(function(e){function t(){return uCe(this,t),mCe(this,t,arguments)}return xCe(t,e),fCe(t,[{key:"render",value:function(){return v.createElement(yCe,this.props)}}])})(v.Component);nH(id,"displayName","YAxis");nH(id,"defaultProps",{allowDuplicatedCategory:!0,allowDecimals:!0,hide:!1,orientation:"left",width:60,height:0,mirror:!1,yAxisId:0,tickCount:5,type:"number",padding:{top:0,bottom:0},allowDataOverflow:!1,scale:"auto",reversed:!1});function L6(e){return wCe(e)||jCe(e)||bCe(e)||vCe()}function vCe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
77In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function bCe(e,t){if(e){if(typeof e=="string")return EA(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return EA(e,t)}}function jCe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function wCe(e){if(Array.isArray(e))return EA(e)}function EA(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var _A=function(t,n,r,s,i){var l=Ea(t,hO),u=Ea(t,Yv),d=[].concat(L6(l),L6(u)),f=Ea(t,Qv),h="".concat(s,"Id"),p=s[0],x=n;if(d.length&&(x=d.reduce(function(j,b){if(b.props[h]===r&&_s(b.props,"extendDomain")&&Ie(b.props[p])){var C=b.props[p];return[Math.min(j[0],C),Math.max(j[1],C)]}return j},x)),f.length){var y="".concat(p,"1"),w="".concat(p,"2");x=f.reduce(function(j,b){if(b.props[h]===r&&_s(b.props,"extendDomain")&&Ie(b.props[y])&&Ie(b.props[w])){var C=b.props[y],N=b.props[w];return[Math.min(j[0],C,N),Math.max(j[1],C,N)]}return j},x)}return i&&i.length&&(x=i.reduce(function(j,b){return Ie(b)?[Math.min(j[0],b),Math.max(j[1],b)]:j},x)),x},JS={exports:{}},F6;function NCe(){return F6||(F6=1,(function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function s(d,f,h){this.fn=d,this.context=f,this.once=h||!1}function i(d,f,h,p,x){if(typeof h!="function")throw new TypeError("The listener must be a function");var y=new s(h,p||d,x),w=n?n+f:f;return d._events[w]?d._events[w].fn?d._events[w]=[d._events[w],y]:d._events[w].push(y):(d._events[w]=y,d._eventsCount++),d}function l(d,f){--d._eventsCount===0?d._events=new r:delete d._events[f]}function u(){this._events=new r,this._eventsCount=0}u.prototype.eventNames=function(){var f=[],h,p;if(this._eventsCount===0)return f;for(p in h=this._events)t.call(h,p)&&f.push(n?p.slice(1):p);return Object.getOwnPropertySymbols?f.concat(Object.getOwnPropertySymbols(h)):f},u.prototype.listeners=function(f){var h=n?n+f:f,p=this._events[h];if(!p)return[];if(p.fn)return[p.fn];for(var x=0,y=p.length,w=new Array(y);x<y;x++)w[x]=p[x].fn;return w},u.prototype.listenerCount=function(f){var h=n?n+f:f,p=this._events[h];return p?p.fn?1:p.length:0},u.prototype.emit=function(f,h,p,x,y,w){var j=n?n+f:f;if(!this._events[j])return!1;var b=this._events[j],C=arguments.length,N,k;if(b.fn){switch(b.once&&this.removeListener(f,b.fn,void 0,!0),C){case 1:return b.fn.call(b.context),!0;case 2:return b.fn.call(b.context,h),!0;case 3:return b.fn.call(b.context,h,p),!0;case 4:return b.fn.call(b.context,h,p,x),!0;case 5:return b.fn.call(b.context,h,p,x,y),!0;case 6:return b.fn.call(b.context,h,p,x,y,w),!0}for(k=1,N=new Array(C-1);k<C;k++)N[k-1]=arguments[k];b.fn.apply(b.context,N)}else{var T=b.length,A;for(k=0;k<T;k++)switch(b[k].once&&this.removeListener(f,b[k].fn,void 0,!0),C){case 1:b[k].fn.call(b[k].context);break;case 2:b[k].fn.call(b[k].context,h);break;case 3:b[k].fn.call(b[k].context,h,p);break;case 4:b[k].fn.call(b[k].context,h,p,x);break;default:if(!N)for(A=1,N=new Array(C-1);A<C;A++)N[A-1]=arguments[A];b[k].fn.apply(b[k].context,N)}}return!0},u.prototype.on=function(f,h,p){return i(this,f,h,p,!1)},u.prototype.once=function(f,h,p){return i(this,f,h,p,!0)},u.prototype.removeListener=function(f,h,p,x){var y=n?n+f:f;if(!this._events[y])return this;if(!h)return l(this,y),this;var w=this._events[y];if(w.fn)w.fn===h&&(!x||w.once)&&(!p||w.context===p)&&l(this,y);else{for(var j=0,b=[],C=w.length;j<C;j++)(w[j].fn!==h||x&&!w[j].once||p&&w[j].context!==p)&&b.push(w[j]);b.length?this._events[y]=b.length===1?b[0]:b:l(this,y)}return this},u.prototype.removeAllListeners=function(f){var h;return f?(h=n?n+f:f,this._events[h]&&l(this,h)):(this._events=new r,this._eventsCount=0),this},u.prototype.off=u.prototype.removeListener,u.prototype.addListener=u.prototype.on,u.prefixed=n,u.EventEmitter=u,e.exports=u})(JS)),JS.exports}var SCe=NCe();const CCe=Bt(SCe);var e2=new CCe,t2="recharts.syncMouseEvents";function hh(e){"@babel/helpers - typeof";return hh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},hh(e)}function ACe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function TCe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,aH(r.key),r)}}function kCe(e,t,n){return t&&TCe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function n2(e,t,n){return t=aH(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function aH(e){var t=OCe(e,"string");return hh(t)=="symbol"?t:t+""}function OCe(e,t){if(hh(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(hh(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var PCe=(function(){function e(){ACe(this,e),n2(this,"activeIndex",0),n2(this,"coordinateList",[]),n2(this,"layout","horizontal")}return kCe(e,[{key:"setDetails",value:function(n){var r,s=n.coordinateList,i=s===void 0?null:s,l=n.container,u=l===void 0?null:l,d=n.layout,f=d===void 0?null:d,h=n.offset,p=h===void 0?null:h,x=n.mouseHandlerCallback,y=x===void 0?null:x;this.coordinateList=(r=i??this.coordinateList)!==null&&r!==void 0?r:[],this.container=u??this.container,this.layout=f??this.layout,this.offset=p??this.offset,this.mouseHandlerCallback=y??this.mouseHandlerCallback,this.activeIndex=Math.min(Math.max(this.activeIndex,0),this.coordinateList.length-1)}},{key:"focus",value:function(){this.spoofMouse()}},{key:"keyboardEvent",value:function(n){if(this.coordinateList.length!==0)switch(n.key){case"ArrowRight":{if(this.layout!=="horizontal")return;this.activeIndex=Math.min(this.activeIndex+1,this.coordinateList.length-1),this.spoofMouse();break}case"ArrowLeft":{if(this.layout!=="horizontal")return;this.activeIndex=Math.max(this.activeIndex-1,0),this.spoofMouse();break}}}},{key:"setIndex",value:function(n){this.activeIndex=n}},{key:"spoofMouse",value:function(){var n,r;if(this.layout==="horizontal"&&this.coordinateList.length!==0){var s=this.container.getBoundingClientRect(),i=s.x,l=s.y,u=s.height,d=this.coordinateList[this.activeIndex].coordinate,f=((n=window)===null||n===void 0?void 0:n.scrollX)||0,h=((r=window)===null||r===void 0?void 0:r.scrollY)||0,p=i+d+f,x=l+this.offset.top+u/2+h;this.mouseHandlerCallback({pageX:p,pageY:x})}}}])})();function ECe(e,t,n){if(n==="number"&&t===!0&&Array.isArray(e)){var r=e?.[0],s=e?.[1];if(r&&s&&Ie(r)&&Ie(s))return!0}return!1}function _Ce(e,t,n,r){var s=r/2;return{stroke:"none",fill:"#ccc",x:e==="horizontal"?t.x-s:n.left+.5,y:e==="horizontal"?n.top+.5:t.y-s,width:e==="horizontal"?r:n.width-1,height:e==="horizontal"?n.height-1:r}}function sH(e){var t=e.cx,n=e.cy,r=e.radius,s=e.startAngle,i=e.endAngle,l=er(t,n,r,s),u=er(t,n,r,i);return{points:[l,u],cx:t,cy:n,radius:r,startAngle:s,endAngle:i}}function MCe(e,t,n){var r,s,i,l;if(e==="horizontal")r=t.x,i=r,s=n.top,l=n.top+n.height;else if(e==="vertical")s=t.y,l=s,r=n.left,i=n.left+n.width;else if(t.cx!=null&&t.cy!=null)if(e==="centric"){var u=t.cx,d=t.cy,f=t.innerRadius,h=t.outerRadius,p=t.angle,x=er(u,d,f,p),y=er(u,d,h,p);r=x.x,s=x.y,i=y.x,l=y.y}else return sH(t);return[{x:r,y:s},{x:i,y:l}]}function ph(e){"@babel/helpers - typeof";return ph=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ph(e)}function q6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function Lx(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?q6(Object(n),!0).forEach(function(r){RCe(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):q6(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function RCe(e,t,n){return t=DCe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function DCe(e){var t=$Ce(e,"string");return ph(t)=="symbol"?t:t+""}function $Ce(e,t){if(ph(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(ph(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ICe(e){var t,n,r=e.element,s=e.tooltipEventType,i=e.isActive,l=e.activeCoordinate,u=e.activePayload,d=e.offset,f=e.activeTooltipIndex,h=e.tooltipAxisBandSize,p=e.layout,x=e.chartName,y=(t=r.props.cursor)!==null&&t!==void 0?t:(n=r.type.defaultProps)===null||n===void 0?void 0:n.cursor;if(!r||!y||!i||!l||x!=="ScatterChart"&&s!=="axis")return null;var w,j=nA;if(x==="ScatterChart")w=l,j=D1e;else if(x==="BarChart")w=_Ce(p,l,d,h),j=iO;else if(p==="radial"){var b=sH(l),C=b.cx,N=b.cy,k=b.radius,T=b.startAngle,A=b.endAngle;w={cx:C,cy:N,startAngle:T,endAngle:A,innerRadius:k,outerRadius:k},j=m9}else w={points:MCe(p,l,d)},j=nA;var P=Lx(Lx(Lx(Lx({stroke:"#ccc",pointerEvents:"none"},d),w),gt(y,!1)),{},{payload:u,payloadIndex:f,className:yt("recharts-tooltip-cursor",y.className)});return v.isValidElement(y)?v.cloneElement(y,P):v.createElement(j,P)}var LCe=["item"],FCe=["children","className","width","height","style","compact","title","desc"];function od(e){"@babel/helpers - typeof";return od=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},od(e)}function Su(){return Su=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Su.apply(this,arguments)}function B6(e,t){return zCe(e)||BCe(e,t)||oH(e,t)||qCe()}function qCe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
78In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function BCe(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,s,i,l,u=[],d=!0,f=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(d=(r=i.call(n)).done)&&(u.push(r.value),u.length!==t);d=!0);}catch(h){f=!0,s=h}finally{try{if(!d&&n.return!=null&&(l=n.return(),Object(l)!==l))return}finally{if(f)throw s}}return u}}function zCe(e){if(Array.isArray(e))return e}function z6(e,t){if(e==null)return{};var n=UCe(e,t),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)r=i[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function UCe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function HCe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function VCe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,lH(r.key),r)}}function GCe(e,t,n){return t&&VCe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function KCe(e,t,n){return t=Vy(t),WCe(e,iH()?Reflect.construct(t,n||[],Vy(e).constructor):t.apply(e,n))}function WCe(e,t){if(t&&(od(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return YCe(e)}function YCe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function iH(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(iH=function(){return!!e})()}function Vy(e){return Vy=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Vy(e)}function XCe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&MA(e,t)}function MA(e,t){return MA=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},MA(e,t)}function ld(e){return JCe(e)||ZCe(e)||oH(e)||QCe()}function QCe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
79In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function oH(e,t){if(e){if(typeof e=="string")return RA(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return RA(e,t)}}function ZCe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function JCe(e){if(Array.isArray(e))return RA(e)}function RA(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function U6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function be(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?U6(Object(n),!0).forEach(function(r){tt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):U6(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function tt(e,t,n){return t=lH(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function lH(e){var t=eAe(e,"string");return od(t)=="symbol"?t:t+""}function eAe(e,t){if(od(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(od(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var tAe={xAxis:["bottom","top"],yAxis:["left","right"]},nAe={width:"100%",height:"100%"},cH={x:0,y:0};function Fx(e){return e}var rAe=function(t,n){return n==="horizontal"?t.x:n==="vertical"?t.y:n==="centric"?t.angle:t.radius},aAe=function(t,n,r,s){var i=n.find(function(h){return h&&h.index===r});if(i){if(t==="horizontal")return{x:i.coordinate,y:s.y};if(t==="vertical")return{x:s.x,y:i.coordinate};if(t==="centric"){var l=i.coordinate,u=s.radius;return be(be(be({},s),er(s.cx,s.cy,u,l)),{},{angle:l,radius:u})}var d=i.coordinate,f=s.angle;return be(be(be({},s),er(s.cx,s.cy,d,f)),{},{angle:f,radius:d})}return cH},Zv=function(t,n){var r=n.graphicalItems,s=n.dataStartIndex,i=n.dataEndIndex,l=(r??[]).reduce(function(u,d){var f=d.props.data;return f&&f.length?[].concat(ld(u),ld(f)):u},[]);return l.length>0?l:t&&t.length&&Ie(s)&&Ie(i)?t.slice(s,i+1):[]};function uH(e){return e==="number"?[0,"auto"]:void 0}var DA=function(t,n,r,s){var i=t.graphicalItems,l=t.tooltipAxis,u=Zv(n,t);return r<0||!i||!i.length||r>=u.length?null:i.reduce(function(d,f){var h,p=(h=f.props.data)!==null&&h!==void 0?h:n;p&&t.dataStartIndex+t.dataEndIndex!==0&&t.dataEndIndex-t.dataStartIndex>=r&&(p=p.slice(t.dataStartIndex,t.dataEndIndex+1));var x;if(l.dataKey&&!l.allowDuplicatedCategory){var y=p===void 0?u:p;x=Wg(y,l.dataKey,s)}else x=p&&p[r]||u[r];return x?[].concat(ld(d),[u9(f,x)]):d},[])},H6=function(t,n,r,s){var i=s||{x:t.chartX,y:t.chartY},l=rAe(i,r),u=t.orderedTooltipTicks,d=t.tooltipAxis,f=t.tooltipTicks,h=h0e(l,u,f,d);if(h>=0&&f){var p=f[h]&&f[h].value,x=DA(t,n,h,p),y=aAe(r,u,h,i);return{activeTooltipIndex:h,activeLabel:p,activePayload:x,activeCoordinate:y}}return null},sAe=function(t,n){var r=n.axes,s=n.graphicalItems,i=n.axisType,l=n.axisIdKey,u=n.stackGroups,d=n.dataStartIndex,f=n.dataEndIndex,h=t.layout,p=t.children,x=t.stackOffset,y=o9(h,i);return r.reduce(function(w,j){var b,C=j.type.defaultProps!==void 0?be(be({},j.type.defaultProps),j.props):j.props,N=C.type,k=C.dataKey,T=C.allowDataOverflow,A=C.allowDuplicatedCategory,P=C.scale,E=C.ticks,_=C.includeHidden,R=C[l];if(w[R])return w;var H=Zv(t.data,{graphicalItems:s.filter(function(F){var B,X=l in F.props?F.props[l]:(B=F.type.defaultProps)===null||B===void 0?void 0:B[l];return X===R}),dataStartIndex:d,dataEndIndex:f}),L=H.length,I,W,U;ECe(C.domain,T,N)&&(I=QC(C.domain,null,T),y&&(N==="number"||P!=="auto")&&(U=jm(H,k,"category")));var V=uH(N);if(!I||I.length===0){var D,q=(D=C.domain)!==null&&D!==void 0?D:V;if(k){if(I=jm(H,k,N),N==="category"&&y){var K=sme(I);A&&K?(W=I,I=_y(0,L)):A||(I=aL(q,I,j).reduce(function(F,B){return F.indexOf(B)>=0?F:[].concat(ld(F),[B])},[]))}else if(N==="category")A?I=I.filter(function(F){return F!==""&&!pt(F)}):I=aL(q,I,j).reduce(function(F,B){return F.indexOf(B)>=0||B===""||pt(B)?F:[].concat(ld(F),[B])},[]);else if(N==="number"){var Y=v0e(H,s.filter(function(F){var B,X,Q=l in F.props?F.props[l]:(B=F.type.defaultProps)===null||B===void 0?void 0:B[l],se="hide"in F.props?F.props.hide:(X=F.type.defaultProps)===null||X===void 0?void 0:X.hide;return Q===R&&(_||!se)}),k,i,h);Y&&(I=Y)}y&&(N==="number"||P!=="auto")&&(U=jm(H,k,"category"))}else y?I=_y(0,L):u&&u[R]&&u[R].hasStack&&N==="number"?I=x==="expand"?[0,1]:c9(u[R].stackGroups,d,f):I=i9(H,s.filter(function(F){var B=l in F.props?F.props[l]:F.type.defaultProps[l],X="hide"in F.props?F.props.hide:F.type.defaultProps.hide;return B===R&&(_||!X)}),N,h,!0);if(N==="number")I=_A(p,I,R,i,E),q&&(I=QC(q,I,T));else if(N==="category"&&q){var z=q,Z=I.every(function(F){return z.indexOf(F)>=0});Z&&(I=z)}}return be(be({},w),{},tt({},R,be(be({},C),{},{axisType:i,domain:I,categoricalDomain:U,duplicateDomain:W,originalDomain:(b=C.domain)!==null&&b!==void 0?b:V,isCategorical:y,layout:h})))},{})},iAe=function(t,n){var r=n.graphicalItems,s=n.Axis,i=n.axisType,l=n.axisIdKey,u=n.stackGroups,d=n.dataStartIndex,f=n.dataEndIndex,h=t.layout,p=t.children,x=Zv(t.data,{graphicalItems:r,dataStartIndex:d,dataEndIndex:f}),y=x.length,w=o9(h,i),j=-1;return r.reduce(function(b,C){var N=C.type.defaultProps!==void 0?be(be({},C.type.defaultProps),C.props):C.props,k=N[l],T=uH("number");if(!b[k]){j++;var A;return w?A=_y(0,y):u&&u[k]&&u[k].hasStack?(A=c9(u[k].stackGroups,d,f),A=_A(p,A,k,i)):(A=QC(T,i9(x,r.filter(function(P){var E,_,R=l in P.props?P.props[l]:(E=P.type.defaultProps)===null||E===void 0?void 0:E[l],H="hide"in P.props?P.props.hide:(_=P.type.defaultProps)===null||_===void 0?void 0:_.hide;return R===k&&!H}),"number",h),s.defaultProps.allowDataOverflow),A=_A(p,A,k,i)),be(be({},b),{},tt({},k,be(be({axisType:i},s.defaultProps),{},{hide:!0,orientation:Pa(tAe,"".concat(i,".").concat(j%2),null),domain:A,originalDomain:T,isCategorical:w,layout:h})))}return b},{})},oAe=function(t,n){var r=n.axisType,s=r===void 0?"xAxis":r,i=n.AxisComp,l=n.graphicalItems,u=n.stackGroups,d=n.dataStartIndex,f=n.dataEndIndex,h=t.children,p="".concat(s,"Id"),x=Ea(h,i),y={};return x&&x.length?y=sAe(t,{axes:x,graphicalItems:l,axisType:s,axisIdKey:p,stackGroups:u,dataStartIndex:d,dataEndIndex:f}):l&&l.length&&(y=iAe(t,{Axis:i,graphicalItems:l,axisType:s,axisIdKey:p,stackGroups:u,dataStartIndex:d,dataEndIndex:f})),y},lAe=function(t){var n=Co(t),r=vi(n,!1,!0);return{tooltipTicks:r,orderedTooltipTicks:Mk(r,function(s){return s.coordinate}),tooltipAxis:n,tooltipAxisBandSize:wy(n,r)}},V6=function(t){var n=t.children,r=t.defaultShowTooltip,s=sa(n,Xu),i=0,l=0;return t.data&&t.data.length!==0&&(l=t.data.length-1),s&&s.props&&(s.props.startIndex>=0&&(i=s.props.startIndex),s.props.endIndex>=0&&(l=s.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:i,dataEndIndex:l,activeTooltipIndex:-1,isTooltipActive:!!r}},cAe=function(t){return!t||!t.length?!1:t.some(function(n){var r=ji(n&&n.type);return r&&r.indexOf("Bar")>=0})},G6=function(t){return t==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:t==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:t==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},uAe=function(t,n){var r=t.props,s=t.graphicalItems,i=t.xAxisMap,l=i===void 0?{}:i,u=t.yAxisMap,d=u===void 0?{}:u,f=r.width,h=r.height,p=r.children,x=r.margin||{},y=sa(p,Xu),w=sa(p,Ou),j=Object.keys(d).reduce(function(A,P){var E=d[P],_=E.orientation;return!E.mirror&&!E.hide?be(be({},A),{},tt({},_,A[_]+E.width)):A},{left:x.left||0,right:x.right||0}),b=Object.keys(l).reduce(function(A,P){var E=l[P],_=E.orientation;return!E.mirror&&!E.hide?be(be({},A),{},tt({},_,Pa(A,"".concat(_))+E.height)):A},{top:x.top||0,bottom:x.bottom||0}),C=be(be({},b),j),N=C.bottom;y&&(C.bottom+=y.props.height||Xu.defaultProps.height),w&&n&&(C=g0e(C,s,r,n));var k=f-C.left-C.right,T=h-C.top-C.bottom;return be(be({brushBottom:N},C),{},{width:Math.max(k,0),height:Math.max(T,0)})},dAe=function(t,n){if(n==="xAxis")return t[n].width;if(n==="yAxis")return t[n].height},dH=function(t){var n=t.chartName,r=t.GraphicalChild,s=t.defaultTooltipEventType,i=s===void 0?"axis":s,l=t.validateTooltipEventTypes,u=l===void 0?["axis"]:l,d=t.axisComponents,f=t.legendContent,h=t.formatAxisMap,p=t.defaultProps,x=function(C,N){var k=N.graphicalItems,T=N.stackGroups,A=N.offset,P=N.updateId,E=N.dataStartIndex,_=N.dataEndIndex,R=C.barSize,H=C.layout,L=C.barGap,I=C.barCategoryGap,W=C.maxBarSize,U=G6(H),V=U.numericAxisName,D=U.cateAxisName,q=cAe(k),K=[];return k.forEach(function(Y,z){var Z=Zv(C.data,{graphicalItems:[Y],dataStartIndex:E,dataEndIndex:_}),F=Y.type.defaultProps!==void 0?be(be({},Y.type.defaultProps),Y.props):Y.props,B=F.dataKey,X=F.maxBarSize,Q=F["".concat(V,"Id")],se=F["".concat(D,"Id")],ee={},ve=d.reduce(function(xt,dt){var Mt=N["".concat(dt.axisType,"Map")],ds=F["".concat(dt.axisType,"Id")];Mt&&Mt[ds]||dt.axisType==="zAxis"||Yl();var ua=Mt[ds];return be(be({},xt),{},tt(tt({},dt.axisType,ua),"".concat(dt.axisType,"Ticks"),vi(ua)))},ee),ue=ve[D],de=ve["".concat(D,"Ticks")],Se=T&&T[Q]&&T[Q].hasStack&&E0e(Y,T[Q].stackGroups),he=ji(Y.type).indexOf("Bar")>=0,ce=wy(ue,de),te=[],_e=q&&p0e({barSize:R,stackGroups:T,totalSize:dAe(ve,D)});if(he){var Oe,Te,Le=pt(X)?W:X,ze=(Oe=(Te=wy(ue,de,!0))!==null&&Te!==void 0?Te:Le)!==null&&Oe!==void 0?Oe:0;te=x0e({barGap:L,barCategoryGap:I,bandSize:ze!==ce?ze:ce,sizeList:_e[se],maxBarSize:Le}),ze!==ce&&(te=te.map(function(xt){return be(be({},xt),{},{position:be(be({},xt.position),{},{offset:xt.position.offset-ze/2})})}))}var at=Y&&Y.type&&Y.type.getComposedData;at&&K.push({props:be(be({},at(be(be({},ve),{},{displayedData:Z,props:C,dataKey:B,item:Y,bandSize:ce,barPosition:te,offset:A,stackedData:Se,layout:H,dataStartIndex:E,dataEndIndex:_}))),{},tt(tt(tt({key:Y.key||"item-".concat(z)},V,ve[V]),D,ve[D]),"animationId",P)),childIndex:yme(Y,C.children),item:Y})}),K},y=function(C,N){var k=C.props,T=C.dataStartIndex,A=C.dataEndIndex,P=C.updateId;if(!gD({props:k}))return null;var E=k.children,_=k.layout,R=k.stackOffset,H=k.data,L=k.reverseStackOrder,I=G6(_),W=I.numericAxisName,U=I.cateAxisName,V=Ea(E,r),D=k0e(H,V,"".concat(W,"Id"),"".concat(U,"Id"),R,L),q=d.reduce(function(F,B){var X="".concat(B.axisType,"Map");return be(be({},F),{},tt({},X,oAe(k,be(be({},B),{},{graphicalItems:V,stackGroups:B.axisType===W&&D,dataStartIndex:T,dataEndIndex:A}))))},{}),K=uAe(be(be({},q),{},{props:k,graphicalItems:V}),N?.legendBBox);Object.keys(q).forEach(function(F){q[F]=h(k,q[F],K,F.replace("Map",""),n)});var Y=q["".concat(U,"Map")],z=lAe(Y),Z=x(k,be(be({},q),{},{dataStartIndex:T,dataEndIndex:A,updateId:P,graphicalItems:V,stackGroups:D,offset:K}));return be(be({formattedGraphicalItems:Z,graphicalItems:V,offset:K,stackGroups:D},z),q)},w=(function(b){function C(N){var k,T,A;return HCe(this,C),A=KCe(this,C,[N]),tt(A,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),tt(A,"accessibilityManager",new PCe),tt(A,"handleLegendBBoxUpdate",function(P){if(P){var E=A.state,_=E.dataStartIndex,R=E.dataEndIndex,H=E.updateId;A.setState(be({legendBBox:P},y({props:A.props,dataStartIndex:_,dataEndIndex:R,updateId:H},be(be({},A.state),{},{legendBBox:P}))))}}),tt(A,"handleReceiveSyncEvent",function(P,E,_){if(A.props.syncId===P){if(_===A.eventEmitterSymbol&&typeof A.props.syncMethod!="function")return;A.applySyncEvent(E)}}),tt(A,"handleBrushChange",function(P){var E=P.startIndex,_=P.endIndex;if(E!==A.state.dataStartIndex||_!==A.state.dataEndIndex){var R=A.state.updateId;A.setState(function(){return be({dataStartIndex:E,dataEndIndex:_},y({props:A.props,dataStartIndex:E,dataEndIndex:_,updateId:R},A.state))}),A.triggerSyncEvent({dataStartIndex:E,dataEndIndex:_})}}),tt(A,"handleMouseEnter",function(P){var E=A.getMouseInfo(P);if(E){var _=be(be({},E),{},{isTooltipActive:!0});A.setState(_),A.triggerSyncEvent(_);var R=A.props.onMouseEnter;ut(R)&&R(_,P)}}),tt(A,"triggeredAfterMouseMove",function(P){var E=A.getMouseInfo(P),_=E?be(be({},E),{},{isTooltipActive:!0}):{isTooltipActive:!1};A.setState(_),A.triggerSyncEvent(_);var R=A.props.onMouseMove;ut(R)&&R(_,P)}),tt(A,"handleItemMouseEnter",function(P){A.setState(function(){return{isTooltipActive:!0,activeItem:P,activePayload:P.tooltipPayload,activeCoordinate:P.tooltipPosition||{x:P.cx,y:P.cy}}})}),tt(A,"handleItemMouseLeave",function(){A.setState(function(){return{isTooltipActive:!1}})}),tt(A,"handleMouseMove",function(P){P.persist(),A.throttleTriggeredAfterMouseMove(P)}),tt(A,"handleMouseLeave",function(P){A.throttleTriggeredAfterMouseMove.cancel();var E={isTooltipActive:!1};A.setState(E),A.triggerSyncEvent(E);var _=A.props.onMouseLeave;ut(_)&&_(E,P)}),tt(A,"handleOuterEvent",function(P){var E=gme(P),_=Pa(A.props,"".concat(E));if(E&&ut(_)){var R,H;/.*touch.*/i.test(E)?H=A.getMouseInfo(P.changedTouches[0]):H=A.getMouseInfo(P),_((R=H)!==null&&R!==void 0?R:{},P)}}),tt(A,"handleClick",function(P){var E=A.getMouseInfo(P);if(E){var _=be(be({},E),{},{isTooltipActive:!0});A.setState(_),A.triggerSyncEvent(_);var R=A.props.onClick;ut(R)&&R(_,P)}}),tt(A,"handleMouseDown",function(P){var E=A.props.onMouseDown;if(ut(E)){var _=A.getMouseInfo(P);E(_,P)}}),tt(A,"handleMouseUp",function(P){var E=A.props.onMouseUp;if(ut(E)){var _=A.getMouseInfo(P);E(_,P)}}),tt(A,"handleTouchMove",function(P){P.changedTouches!=null&&P.changedTouches.length>0&&A.throttleTriggeredAfterMouseMove(P.changedTouches[0])}),tt(A,"handleTouchStart",function(P){P.changedTouches!=null&&P.changedTouches.length>0&&A.handleMouseDown(P.changedTouches[0])}),tt(A,"handleTouchEnd",function(P){P.changedTouches!=null&&P.changedTouches.length>0&&A.handleMouseUp(P.changedTouches[0])}),tt(A,"handleDoubleClick",function(P){var E=A.props.onDoubleClick;if(ut(E)){var _=A.getMouseInfo(P);E(_,P)}}),tt(A,"handleContextMenu",function(P){var E=A.props.onContextMenu;if(ut(E)){var _=A.getMouseInfo(P);E(_,P)}}),tt(A,"triggerSyncEvent",function(P){A.props.syncId!==void 0&&e2.emit(t2,A.props.syncId,P,A.eventEmitterSymbol)}),tt(A,"applySyncEvent",function(P){var E=A.props,_=E.layout,R=E.syncMethod,H=A.state.updateId,L=P.dataStartIndex,I=P.dataEndIndex;if(P.dataStartIndex!==void 0||P.dataEndIndex!==void 0)A.setState(be({dataStartIndex:L,dataEndIndex:I},y({props:A.props,dataStartIndex:L,dataEndIndex:I,updateId:H},A.state)));else if(P.activeTooltipIndex!==void 0){var W=P.chartX,U=P.chartY,V=P.activeTooltipIndex,D=A.state,q=D.offset,K=D.tooltipTicks;if(!q)return;if(typeof R=="function")V=R(K,P);else if(R==="value"){V=-1;for(var Y=0;Y<K.length;Y++)if(K[Y].value===P.activeLabel){V=Y;break}}var z=be(be({},q),{},{x:q.left,y:q.top}),Z=Math.min(W,z.x+z.width),F=Math.min(U,z.y+z.height),B=K[V]&&K[V].value,X=DA(A.state,A.props.data,V),Q=K[V]?{x:_==="horizontal"?K[V].coordinate:Z,y:_==="horizontal"?F:K[V].coordinate}:cH;A.setState(be(be({},P),{},{activeLabel:B,activeCoordinate:Q,activePayload:X,activeTooltipIndex:V}))}else A.setState(P)}),tt(A,"renderCursor",function(P){var E,_=A.state,R=_.isTooltipActive,H=_.activeCoordinate,L=_.activePayload,I=_.offset,W=_.activeTooltipIndex,U=_.tooltipAxisBandSize,V=A.getTooltipEventType(),D=(E=P.props.active)!==null&&E!==void 0?E:R,q=A.props.layout,K=P.key||"_recharts-cursor";return ie.createElement(ICe,{key:K,activeCoordinate:H,activePayload:L,activeTooltipIndex:W,chartName:n,element:P,isActive:D,layout:q,offset:I,tooltipAxisBandSize:U,tooltipEventType:V})}),tt(A,"renderPolarAxis",function(P,E,_){var R=Pa(P,"type.axisType"),H=Pa(A.state,"".concat(R,"Map")),L=P.type.defaultProps,I=L!==void 0?be(be({},L),P.props):P.props,W=H&&H[I["".concat(R,"Id")]];return v.cloneElement(P,be(be({},W),{},{className:yt(R,W.className),key:P.key||"".concat(E,"-").concat(_),ticks:vi(W,!0)}))}),tt(A,"renderPolarGrid",function(P){var E=P.props,_=E.radialLines,R=E.polarAngles,H=E.polarRadius,L=A.state,I=L.radiusAxisMap,W=L.angleAxisMap,U=Co(I),V=Co(W),D=V.cx,q=V.cy,K=V.innerRadius,Y=V.outerRadius;return v.cloneElement(P,{polarAngles:Array.isArray(R)?R:vi(V,!0).map(function(z){return z.coordinate}),polarRadius:Array.isArray(H)?H:vi(U,!0).map(function(z){return z.coordinate}),cx:D,cy:q,innerRadius:K,outerRadius:Y,key:P.key||"polar-grid",radialLines:_})}),tt(A,"renderLegend",function(){var P=A.state.formattedGraphicalItems,E=A.props,_=E.children,R=E.width,H=E.height,L=A.props.margin||{},I=R-(L.left||0)-(L.right||0),W=a9({children:_,formattedGraphicalItems:P,legendWidth:I,legendContent:f});if(!W)return null;var U=W.item,V=z6(W,LCe);return v.cloneElement(U,be(be({},V),{},{chartWidth:R,chartHeight:H,margin:L,onBBoxUpdate:A.handleLegendBBoxUpdate}))}),tt(A,"renderTooltip",function(){var P,E=A.props,_=E.children,R=E.accessibilityLayer,H=sa(_,Xa);if(!H)return null;var L=A.state,I=L.isTooltipActive,W=L.activeCoordinate,U=L.activePayload,V=L.activeLabel,D=L.offset,q=(P=H.props.active)!==null&&P!==void 0?P:I;return v.cloneElement(H,{viewBox:be(be({},D),{},{x:D.left,y:D.top}),active:q,label:V,payload:q?U:[],coordinate:W,accessibilityLayer:R})}),tt(A,"renderBrush",function(P){var E=A.props,_=E.margin,R=E.data,H=A.state,L=H.offset,I=H.dataStartIndex,W=H.dataEndIndex,U=H.updateId;return v.cloneElement(P,{key:P.key||"_recharts-brush",onChange:Rx(A.handleBrushChange,P.props.onChange),data:R,x:Ie(P.props.x)?P.props.x:L.left,y:Ie(P.props.y)?P.props.y:L.top+L.height+L.brushBottom-(_.bottom||0),width:Ie(P.props.width)?P.props.width:L.width,startIndex:I,endIndex:W,updateId:"brush-".concat(U)})}),tt(A,"renderReferenceElement",function(P,E,_){if(!P)return null;var R=A,H=R.clipPathId,L=A.state,I=L.xAxisMap,W=L.yAxisMap,U=L.offset,V=P.type.defaultProps||{},D=P.props,q=D.xAxisId,K=q===void 0?V.xAxisId:q,Y=D.yAxisId,z=Y===void 0?V.yAxisId:Y;return v.cloneElement(P,{key:P.key||"".concat(E,"-").concat(_),xAxis:I[K],yAxis:W[z],viewBox:{x:U.left,y:U.top,width:U.width,height:U.height},clipPathId:H})}),tt(A,"renderActivePoints",function(P){var E=P.item,_=P.activePoint,R=P.basePoint,H=P.childIndex,L=P.isRange,I=[],W=E.props.key,U=E.item.type.defaultProps!==void 0?be(be({},E.item.type.defaultProps),E.item.props):E.item.props,V=U.activeDot,D=U.dataKey,q=be(be({index:H,dataKey:D,cx:_.x,cy:_.y,r:4,fill:sO(E.item),strokeWidth:2,stroke:"#fff",payload:_.payload,value:_.value},gt(V,!1)),Yg(V));return I.push(C.renderActiveDot(V,q,"".concat(W,"-activePoint-").concat(H))),R?I.push(C.renderActiveDot(V,be(be({},q),{},{cx:R.x,cy:R.y}),"".concat(W,"-basePoint-").concat(H))):L&&I.push(null),I}),tt(A,"renderGraphicChild",function(P,E,_){var R=A.filterFormatItem(P,E,_);if(!R)return null;var H=A.getTooltipEventType(),L=A.state,I=L.isTooltipActive,W=L.tooltipAxis,U=L.activeTooltipIndex,V=L.activeLabel,D=A.props.children,q=sa(D,Xa),K=R.props,Y=K.points,z=K.isRange,Z=K.baseLine,F=R.item.type.defaultProps!==void 0?be(be({},R.item.type.defaultProps),R.item.props):R.item.props,B=F.activeDot,X=F.hide,Q=F.activeBar,se=F.activeShape,ee=!!(!X&&I&&q&&(B||Q||se)),ve={};H!=="axis"&&q&&q.props.trigger==="click"?ve={onClick:Rx(A.handleItemMouseEnter,P.props.onClick)}:H!=="axis"&&(ve={onMouseLeave:Rx(A.handleItemMouseLeave,P.props.onMouseLeave),onMouseEnter:Rx(A.handleItemMouseEnter,P.props.onMouseEnter)});var ue=v.cloneElement(P,be(be({},R.props),ve));function de(dt){return typeof W.dataKey=="function"?W.dataKey(dt.payload):null}if(ee)if(U>=0){var Se,he;if(W.dataKey&&!W.allowDuplicatedCategory){var ce=typeof W.dataKey=="function"?de:"payload.".concat(W.dataKey.toString());Se=Wg(Y,ce,V),he=z&&Z&&Wg(Z,ce,V)}else Se=Y?.[U],he=z&&Z&&Z[U];if(se||Q){var te=P.props.activeIndex!==void 0?P.props.activeIndex:U;return[v.cloneElement(P,be(be(be({},R.props),ve),{},{activeIndex:te})),null,null]}if(!pt(Se))return[ue].concat(ld(A.renderActivePoints({item:R,activePoint:Se,basePoint:he,childIndex:U,isRange:z})))}else{var _e,Oe=(_e=A.getItemByXY(A.state.activeCoordinate))!==null&&_e!==void 0?_e:{graphicalItem:ue},Te=Oe.graphicalItem,Le=Te.item,ze=Le===void 0?P:Le,at=Te.childIndex,xt=be(be(be({},R.props),ve),{},{activeIndex:at});return[v.cloneElement(ze,xt),null,null]}return z?[ue,null,null]:[ue,null]}),tt(A,"renderCustomized",function(P,E,_){return v.cloneElement(P,be(be({key:"recharts-customized-".concat(_)},A.props),A.state))}),tt(A,"renderMap",{CartesianGrid:{handler:Fx,once:!0},ReferenceArea:{handler:A.renderReferenceElement},ReferenceLine:{handler:Fx},ReferenceDot:{handler:A.renderReferenceElement},XAxis:{handler:Fx},YAxis:{handler:Fx},Brush:{handler:A.renderBrush,once:!0},Bar:{handler:A.renderGraphicChild},Line:{handler:A.renderGraphicChild},Area:{handler:A.renderGraphicChild},Radar:{handler:A.renderGraphicChild},RadialBar:{handler:A.renderGraphicChild},Scatter:{handler:A.renderGraphicChild},Pie:{handler:A.renderGraphicChild},Funnel:{handler:A.renderGraphicChild},Tooltip:{handler:A.renderCursor,once:!0},PolarGrid:{handler:A.renderPolarGrid,once:!0},PolarAngleAxis:{handler:A.renderPolarAxis},PolarRadiusAxis:{handler:A.renderPolarAxis},Customized:{handler:A.renderCustomized}}),A.clipPathId="".concat((k=N.id)!==null&&k!==void 0?k:$h("recharts"),"-clip"),A.throttleTriggeredAfterMouseMove=a7(A.triggeredAfterMouseMove,(T=N.throttleDelay)!==null&&T!==void 0?T:1e3/60),A.state={},A}return XCe(C,b),GCe(C,[{key:"componentDidMount",value:function(){var k,T;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(k=this.props.margin.left)!==null&&k!==void 0?k:0,top:(T=this.props.margin.top)!==null&&T!==void 0?T:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var k=this.props,T=k.children,A=k.data,P=k.height,E=k.layout,_=sa(T,Xa);if(_){var R=_.props.defaultIndex;if(!(typeof R!="number"||R<0||R>this.state.tooltipTicks.length-1)){var H=this.state.tooltipTicks[R]&&this.state.tooltipTicks[R].value,L=DA(this.state,A,R,H),I=this.state.tooltipTicks[R].coordinate,W=(this.state.offset.top+P)/2,U=E==="horizontal",V=U?{x:I,y:W}:{y:I,x:W},D=this.state.formattedGraphicalItems.find(function(K){var Y=K.item;return Y.type.name==="Scatter"});D&&(V=be(be({},V),D.props.points[R].tooltipPosition),L=D.props.points[R].tooltipPayload);var q={activeTooltipIndex:R,isTooltipActive:!0,activeLabel:H,activePayload:L,activeCoordinate:V};this.setState(q),this.renderCursor(_),this.accessibilityManager.setIndex(R)}}}},{key:"getSnapshotBeforeUpdate",value:function(k,T){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==T.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==k.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==k.margin){var A,P;this.accessibilityManager.setDetails({offset:{left:(A=this.props.margin.left)!==null&&A!==void 0?A:0,top:(P=this.props.margin.top)!==null&&P!==void 0?P:0}})}return null}},{key:"componentDidUpdate",value:function(k){vC([sa(k.children,Xa)],[sa(this.props.children,Xa)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var k=sa(this.props.children,Xa);if(k&&typeof k.props.shared=="boolean"){var T=k.props.shared?"axis":"item";return u.indexOf(T)>=0?T:i}return i}},{key:"getMouseInfo",value:function(k){if(!this.container)return null;var T=this.container,A=T.getBoundingClientRect(),P=age(A),E={chartX:Math.round(k.pageX-P.left),chartY:Math.round(k.pageY-P.top)},_=A.width/T.offsetWidth||1,R=this.inRange(E.chartX,E.chartY,_);if(!R)return null;var H=this.state,L=H.xAxisMap,I=H.yAxisMap,W=this.getTooltipEventType(),U=H6(this.state,this.props.data,this.props.layout,R);if(W!=="axis"&&L&&I){var V=Co(L).scale,D=Co(I).scale,q=V&&V.invert?V.invert(E.chartX):null,K=D&&D.invert?D.invert(E.chartY):null;return be(be({},E),{},{xValue:q,yValue:K},U)}return U?be(be({},E),U):null}},{key:"inRange",value:function(k,T){var A=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,P=this.props.layout,E=k/A,_=T/A;if(P==="horizontal"||P==="vertical"){var R=this.state.offset,H=E>=R.left&&E<=R.left+R.width&&_>=R.top&&_<=R.top+R.height;return H?{x:E,y:_}:null}var L=this.state,I=L.angleAxisMap,W=L.radiusAxisMap;if(I&&W){var U=Co(I);return oL({x:E,y:_},U)}return null}},{key:"parseEventsOfWrapper",value:function(){var k=this.props.children,T=this.getTooltipEventType(),A=sa(k,Xa),P={};A&&T==="axis"&&(A.props.trigger==="click"?P={onClick:this.handleClick}:P={onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu});var E=Yg(this.props,this.handleOuterEvent);return be(be({},E),P)}},{key:"addListener",value:function(){e2.on(t2,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){e2.removeListener(t2,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(k,T,A){for(var P=this.state.formattedGraphicalItems,E=0,_=P.length;E<_;E++){var R=P[E];if(R.item===k||R.props.key===k.key||T===ji(R.item.type)&&A===R.childIndex)return R}return null}},{key:"renderClipPath",value:function(){var k=this.clipPathId,T=this.state.offset,A=T.left,P=T.top,E=T.height,_=T.width;return ie.createElement("defs",null,ie.createElement("clipPath",{id:k},ie.createElement("rect",{x:A,y:P,height:E,width:_})))}},{key:"getXScales",value:function(){var k=this.state.xAxisMap;return k?Object.entries(k).reduce(function(T,A){var P=B6(A,2),E=P[0],_=P[1];return be(be({},T),{},tt({},E,_.scale))},{}):null}},{key:"getYScales",value:function(){var k=this.state.yAxisMap;return k?Object.entries(k).reduce(function(T,A){var P=B6(A,2),E=P[0],_=P[1];return be(be({},T),{},tt({},E,_.scale))},{}):null}},{key:"getXScaleByAxisId",value:function(k){var T;return(T=this.state.xAxisMap)===null||T===void 0||(T=T[k])===null||T===void 0?void 0:T.scale}},{key:"getYScaleByAxisId",value:function(k){var T;return(T=this.state.yAxisMap)===null||T===void 0||(T=T[k])===null||T===void 0?void 0:T.scale}},{key:"getItemByXY",value:function(k){var T=this.state,A=T.formattedGraphicalItems,P=T.activeItem;if(A&&A.length)for(var E=0,_=A.length;E<_;E++){var R=A[E],H=R.props,L=R.item,I=L.type.defaultProps!==void 0?be(be({},L.type.defaultProps),L.props):L.props,W=ji(L.type);if(W==="Bar"){var U=(H.data||[]).find(function(K){return C1e(k,K)});if(U)return{graphicalItem:R,payload:U}}else if(W==="RadialBar"){var V=(H.data||[]).find(function(K){return oL(k,K)});if(V)return{graphicalItem:R,payload:V}
79}else if(Vv(R,P)||Gv(R,P)||ch(R,P)){var D=pNe({graphicalItem:R,activeTooltipItem:P,itemData:I.data}),q=I.activeIndex===void 0?D:I.activeIndex;return{graphicalItem:be(be({},R),{},{childIndex:q}),payload:ch(R,P)?I.data[D]:R.props.data[D]}}}return null}},{key:"render",value:function(){var k=this;if(!gD(this))return null;var T=this.props,A=T.children,P=T.className,E=T.width,_=T.height,R=T.style,H=T.compact,L=T.title,I=T.desc,W=z6(T,FCe),U=gt(W,!1);if(H)return ie.createElement(w6,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},ie.createElement(jC,Su({},U,{width:E,height:_,title:L,desc:I}),this.renderClipPath(),vD(A,this.renderMap)));if(this.props.accessibilityLayer){var V,D;U.tabIndex=(V=this.props.tabIndex)!==null&&V!==void 0?V:0,U.role=(D=this.props.role)!==null&&D!==void 0?D:"application",U.onKeyDown=function(K){k.accessibilityManager.keyboardEvent(K)},U.onFocus=function(){k.accessibilityManager.focus()}}var q=this.parseEventsOfWrapper();return ie.createElement(w6,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},ie.createElement("div",Su({className:yt("recharts-wrapper",P),style:be({position:"relative",cursor:"default",width:E,height:_},R)},q,{ref:function(Y){k.container=Y}}),ie.createElement(jC,Su({},U,{width:E,height:_,title:L,desc:I,style:nAe}),this.renderClipPath(),vD(A,this.renderMap)),this.renderLegend(),this.renderTooltip()))}}])})(v.Component);tt(w,"displayName",n),tt(w,"defaultProps",be({layout:"horizontal",stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:{top:5,right:5,bottom:5,left:5},reverseStackOrder:!1,syncMethod:"index"},p)),tt(w,"getDerivedStateFromProps",function(b,C){var N=b.dataKey,k=b.data,T=b.children,A=b.width,P=b.height,E=b.layout,_=b.stackOffset,R=b.margin,H=C.dataStartIndex,L=C.dataEndIndex;if(C.updateId===void 0){var I=V6(b);return be(be(be({},I),{},{updateId:0},y(be(be({props:b},I),{},{updateId:0}),C)),{},{prevDataKey:N,prevData:k,prevWidth:A,prevHeight:P,prevLayout:E,prevStackOffset:_,prevMargin:R,prevChildren:T})}if(N!==C.prevDataKey||k!==C.prevData||A!==C.prevWidth||P!==C.prevHeight||E!==C.prevLayout||_!==C.prevStackOffset||!ku(R,C.prevMargin)){var W=V6(b),U={chartX:C.chartX,chartY:C.chartY,isTooltipActive:C.isTooltipActive},V=be(be({},H6(C,k,E)),{},{updateId:C.updateId+1}),D=be(be(be({},W),U),V);return be(be(be({},D),y(be({props:b},D),C)),{},{prevDataKey:N,prevData:k,prevWidth:A,prevHeight:P,prevLayout:E,prevStackOffset:_,prevMargin:R,prevChildren:T})}if(!vC(T,C.prevChildren)){var q,K,Y,z,Z=sa(T,Xu),F=Z&&(q=(K=Z.props)===null||K===void 0?void 0:K.startIndex)!==null&&q!==void 0?q:H,B=Z&&(Y=(z=Z.props)===null||z===void 0?void 0:z.endIndex)!==null&&Y!==void 0?Y:L,X=F!==H||B!==L,Q=!pt(k),se=Q&&!X?C.updateId:C.updateId+1;return be(be({updateId:se},y(be(be({props:b},C),{},{updateId:se,dataStartIndex:F,dataEndIndex:B}),C)),{},{prevChildren:T,dataStartIndex:F,dataEndIndex:B})}return null}),tt(w,"renderActiveDot",function(b,C,N){var k;return v.isValidElement(b)?k=v.cloneElement(b,C):ut(b)?k=b(C):k=ie.createElement(oO,C),ie.createElement(pn,{className:"recharts-active-dot",key:N},k)});var j=v.forwardRef(function(C,N){return ie.createElement(w,Su({},C,{ref:N}))});return j.displayName=w.displayName,j},fAe=dH({chartName:"LineChart",GraphicalChild:Uh,axisComponents:[{axisType:"xAxis",AxisComp:ad},{axisType:"yAxis",AxisComp:id}],formatAxisMap:P9}),mAe=dH({chartName:"BarChart",GraphicalChild:dc,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:ad},{axisType:"yAxis",AxisComp:id}],formatAxisMap:P9});function $A(e,t={}){const n=localStorage.getItem("fs_team_token");return fetch(e,{...t,headers:{"Content-Type":"application/json",...n?{Authorization:`Bearer ${n}`}:{},...t.headers||{}}})}function hAe(e){return Math.floor((Date.now()-new Date(e).getTime())/864e5)}function fH({quotes:e}){const t=(e||[]).filter(n=>n.status==="draft").sort((n,r)=>new Date(n.updatedAt).getTime()-new Date(r.updatedAt).getTime());return t.length===0?null:a.jsx(gr.div,{initial:{opacity:0,y:10}
79,animate:{opacity:1,y:0},children:a.jsxs(ye,{className:"p-5 border-border/50 shadow-sm","data-testid":"drafts-to-finish-card",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[a.jsx(jn,{className:"h-5 w-5 text-primary shrink-0"}),a.jsxs("h3",{className:"text-base font-bold text-foreground",children:["Drafts to finish — ",t.length," quote",t.length!==1?"s":""," waiting"]})]}),a.jsx("div",{className:"divide-y divide-border/60",children:t.slice(0,6).map(n=>{const r=hAe(n.updatedAt),s=n.customerData||{},i=s.name||s.companyName||"No customer yet",l=r>=5?"bg-red-100 text-red-700":r>=2?"bg-amber-100 text-amber-700":"bg-muted text-muted-foreground";return a.jsxs("a",{href:`/quotes/${n.id}/edit`,className:"flex items-center justify-between py-2 text-sm hover:bg-muted/40 rounded-lg px-2 -mx-2 transition-colors","data-testid":`draft-row-${n.id}`,children:[a.jsxs("div",{className:"min-w-0",children:[a.jsxs("span",{className:"font-medium text-foreground",children:["Quote #",n.id]}),a.jsx("span",{className:"text-muted-foreground ml-2 text-xs truncate",children:i})]}),a.jsxs("div",{className:"flex items-center gap-3 shrink-0 ml-4",children:[n.grandTotal>0&&a.jsx("span",{className:"text-sm font-semibold text-primary",children:De(n.grandTotal)}),a.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full font-medium ${l}`,children:r===0?"today":`${r}d old`})]})]},n.id)})}),t.length>6&&a.jsxs("a",{href:"/quotes",className:"block text-xs text-primary font-medium mt-2",children:["View all ",t.length," drafts →"]})]})})}function IA(e){const t=new Date(e),n=new Date;return t.getFullYear()===n.getFullYear()&&t.getMonth()===n.getMonth()}function K6(e){return new Date(e).getFullYear()===new Date().getFullYear()}function pAe(){const{data:e}=dk(),{data:t}=fk(),{data:n}=jv(),{data:r}=Xe({queryKey:["/api/inventory/low-stock"],queryFn:()=>$A("/api/inventory/low-stock").then(N=>N.json()),refetchInterval:300*1e3}),{data:s}=Xe({queryKey:["/api/inventory/value"],queryFn:()=>$A("/api/inventory/value").then(N=>N.json()),refetchInterval:300*1e3}),i=e?.filter(N=>N.status==="new").length||0,l=t?.filter(N=>N.status==="sent").reduce((N,k)=>N+k.grandTotal,0)||0,u=n?.filter(N=>N.status==="scheduled"||N.status==="in_progress").length||0,d=(n||[]).filter(N=>N.scheduledDate&&IA(N.scheduledDate)).reduce((N,k)=>N+(k.totalAmount||0),0),f=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],h=new Date,p=h.getDay(),x=p===0?-6:1-p,y=new Date(h);y.setDate(h.getDate()+x),y.setHours(0,0,0,0);const w=f.map((N,k)=>{const T=new Date(y);T.setDate(y.getDate()+k);const A=new Date(T);A.setDate(T.getDate()+1);const P=(n||[]).filter(E=>{if(!E.scheduledDate)return!1;const _=new Date(E.scheduledDate);return _>=T&&_<A}).reduce((E,_)=>E+(_.totalAmount||0),0);return{name:N,total:P}}),b=Object.entries({contact_form:"Contact Form",estimate_form:"Estimate",phone:"Phone",referral:"Referral",other:"Other"}).map(([N,k])=>({name:k,value:(e||[]).filter(T=>(T.source||"other")===N).length})).filter(N=>N.value>0),C=[{title:"New Leads",value:i.toString(),icon:kg,color:"text-blue-600",bg:"bg-blue-100",trend:""},{title:"Open Quotes",value:De(l),icon:jn,color:"text-amber-600",bg:"bg-amber-100",trend:""},{title:"Active Jobs",value:u.toString(),icon:rs,color:"text-green-600",bg:"bg-green-100",trend:""},{title:"Revenue (MTD)",value:De(d),icon:Wq,color:"text-purple-600",bg:"bg-purple-100",trend:""}];return a.jsxs("div",{className:"space-y-8 pb-12",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-3xl font-display font-bold text-foreground",children:"Overview"}),a.jsx("p",{className:"text-muted-foreground mt-1",children:"Here's what's happening with your business today."})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5 gap-6",children:[C.map((N,k)=>a.jsx(gr.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:k*.1},children:a.jsxs(ye,{className:"p-6 hover-elevate border-border/50",children:[a.jsxs("div",{className:"flex justify-between items-start mb-4",children:[a.jsx("div",{className:`p-3 rounded-xl ${N.bg} ${N.color}`,children:a.jsx(N.icon,{className:"w-6 h-6"})}),N.trend&&a.jsxs("div",{className:"flex items-center text-sm font-semibold text-green-600 bg-green-50 px-2 py-1 rounded-lg",children:[N.trend," ",a.jsx(UZ,{className:"w-3 h-3 ml-1"})]})]}),a.jsx("p",{className:"text-muted-foreground font-medium text-sm mb-1",children:N.title}),a.jsx("h3",{className:"text-3xl font-bold text-foreground",children:N.value})]})},N.title)),a.jsx(gr.div,{initial:{opacity:0,y:20}
79,animate:{opacity:1,y:0},transition:{delay:.4},children:a.jsxs(ye,{className:"p-6 hover-elevate border-border/50",children:[a.jsxs("div",{className:"flex justify-between items-start mb-4",children:[a.jsx("div",{className:"p-3 rounded-xl bg-amber-100 text-amber-600",children:a.jsx(Jn,{className:"w-6 h-6"})}),(s?.outCount??0)>0&&a.jsxs("a",{href:"/inventory",className:"flex items-center text-xs font-semibold text-red-600 bg-red-50 px-2 py-1 rounded-lg hover:bg-red-100 transition-colors",children:[s.outCount," out of stock"]})]}),a.jsx("p",{className:"text-muted-foreground font-medium text-sm mb-1",children:"Inventory Value"}),a.jsx("h3",{className:"text-3xl font-bold text-foreground",children:s?De(s.totalValue):"—"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"at cost"})]})})]}),a.jsx(fH,{quotes:t}),r&&r.length>0&&a.jsx(gr.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},children:a.jsxs(ye,{className:"p-5 border-orange-200 bg-orange-50 shadow-sm",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[a.jsx(Kt,{className:"h-5 w-5 text-orange-600 shrink-0"}),a.jsxs("h3",{className:"text-base font-bold text-orange-800",children:["Low Stock Alert — ",r.length," item",r.length!==1?"s":""," at or below reorder point"]})]}),a.jsx("div",{className:"divide-y divide-orange-200",children:r.map(N=>a.jsxs("div",{className:"flex items-center justify-between py-2 text-sm",children:[a.jsxs("div",{children:[a.jsx("span",{className:"font-medium text-orange-900",children:N.name}),N.categoryName&&a.jsx("span",{className:"text-orange-600 ml-2 text-xs",children:N.categoryName}),N.supplierName&&a.jsxs("span",{className:"text-muted-foreground ml-2 text-xs",children:["(",N.supplierName,")"]})]}),a.jsxs("div",{className:"text-right shrink-0 ml-4",children:[a.jsx("span",{className:"font-bold text-orange-700",children:Number(N.qtyOnHand).toFixed(1)}),a.jsxs("span",{className:"text-orange-500 text-xs ml-1",children:["/ reorder @ ",Number(N.reorderPoint).toFixed(1)]})]})]},N.productId))})]})}),a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[a.jsxs(ye,{className:"col-span-1 lg:col-span-2 p-6 border-border/50 shadow-md",children:[a.jsx("h3",{className:"text-lg font-bold mb-6",children:"Revenue Trend"}),a.jsx("div",{className:"h-[300px] w-full",children:a.jsx(B$,{width:"100%",height:"100%",children:a.jsxs(fAe,{data:w,children:[a.jsx(SA,{strokeDasharray:"3 3",vertical:!1,stroke:"#E2E8F0"}),a.jsx(ad,{dataKey:"name",axisLine:!1,tickLine:!1,tick:{fill:"#64748b",fontSize:12},dy:10}),a.jsx(id,{axisLine:!1,tickLine:!1,tick:{fill:"#64748b",fontSize:12},dx:-10,tickFormatter:N=>`$${N/1e3}k`}),a.jsx(Xa,{contentStyle:{borderRadius:"12px",border:"none",boxShadow:"0 10px 25px -5px rgba(0,0,0,0.1)"},formatter:N=>[De(N),"Revenue"]}),a.jsx(Uh,{type:"monotone",dataKey:"total",stroke:"hsl(var(--primary))",strokeWidth:4,dot:{r:4,strokeWidth:2},activeDot:{r:8,fill:"hsl(var(--primary))"}})]})})})]}),a.jsxs(ye,{className:"col-span-1 p-6 border-border/50 shadow-md",children:[a.jsx("h3",{className:"text-lg font-bold mb-6",children:"Lead Sources"}),a.jsx("div",{className:"h-[300px] w-full",children:a.jsx(B$,{width:"100%",height:"100%",children:a.jsxs(mAe,{data:b.length>0?b:[{name:"No data",value:0}],layout:"vertical",margin:{left:0,right:10,top:0,bottom:0},children:[a.jsx(SA,{strokeDasharray:"3 3",horizontal:!1,stroke:"#E2E8F0"}),a.jsx(ad,{type:"number",hide:!0}),a.jsx(id,{dataKey:"name",type:"category",axisLine:!1,tickLine:!1,tick:{fill:"#0f172a",fontWeight:500,fontSize:12},width:110}),a.jsx(Xa,{cursor:{fill:"transparent"},contentStyle:{borderRadius:"8px"}}),a.jsx(dc,{dataKey:"value",fill:"hsl(var(--primary))",radius:[0,4,4,0],barSize:24})]})})})]})]})]})}function xAe({name:e}){const{data:t}=dk(),{data:n}=fk(),{data:r}=jv(),s=t?.filter(p=>p.status==="new"||p.status==="contacted").length||0,i=n?.filter(p=>p.status==="sent"||p.status==="draft").reduce((p,x)=>p+x.grandTotal,0)||0,l=r?.filter(p=>p.status==="scheduled"||p.status==="in_progress").length||0,u=n?.filter(p=>IA(p.createdAt)).reduce((p,x)=>p+x.grandTotal,0)||0,d=n?.filter(p=>K6(p.createdAt)).reduce((p,x)=>
79p+x.grandTotal,0)||0,f=n?.filter(p=>p.status==="approved"&&IA(p.createdAt)).reduce((p,x)=>p+x.grandTotal,0)||0,h=n?.filter(p=>p.status==="approved"&&K6(p.createdAt)).reduce((p,x)=>p+x.grandTotal,0)||0;return a.jsxs("div",{className:"space-y-8 pb-12",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-3xl font-display font-bold text-foreground",children:"Overview"}),a.jsxs("p",{className:"text-muted-foreground mt-1",children:["Welcome back, ",e,". Here's your activity summary."]})]}),a.jsx(fH,{quotes:n}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[a.jsx(gr.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:0},children:a.jsxs(ye,{className:"p-6 hover-elevate border-border/50",children:[a.jsxs("div",{className:"flex justify-between items-start mb-4",children:[a.jsx("div",{className:"p-3 rounded-xl bg-blue-100 text-blue-600",children:a.jsx(kg,{className:"w-6 h-6"})}),a.jsx("div",{className:"text-xs font-medium text-muted-foreground bg-muted px-2 py-1 rounded-lg",children:"Assigned to me"})]}),a.jsx("p",{className:"text-muted-foreground font-medium text-sm mb-1",children:"My Leads"}),a.jsx("h3",{className:"text-3xl font-bold text-foreground",children:s})]})}),a.jsx(gr.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.1},children:a.jsxs(ye,{className:"p-6 hover-elevate border-border/50",children:[a.jsxs("div",{className:"flex justify-between items-start mb-4",children:[a.jsx("div",{className:"p-3 rounded-xl bg-amber-100 text-amber-600",children:a.jsx(jn,{className:"w-6 h-6"})}),a.jsx("div",{className:"text-xs font-medium text-muted-foreground bg-muted px-2 py-1 rounded-lg",children:"Open quotes"})]}),a.jsx("p",{className:"text-muted-foreground font-medium text-sm mb-1",children:"My Open Quotes"}),a.jsx("h3",{className:"text-3xl font-bold text-foreground",children:De(i)})]})}),a.jsx(gr.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.2},children:a.jsxs(ye,{className:"p-6 hover-elevate border-border/50",children:[a.jsxs("div",{className:"flex justify-between items-start mb-4",children:[a.jsx("div",{className:"p-3 rounded-xl bg-green-100 text-green-600",children:a.jsx(rs,{className:"w-6 h-6"})}),a.jsx("div",{className:"text-xs font-medium text-muted-foreground bg-muted px-2 py-1 rounded-lg",children:"In progress"})]}),a.jsx("p",{className:"text-muted-foreground font-medium text-sm mb-1",children:"My Active Jobs"}),a.jsx("h3",{className:"text-3xl font-bold text-foreground",children:l})]})})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsx(gr.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.3},children:a.jsxs(ye,{className:"p-6 hover-elevate border-border/50",children:[a.jsxs("div",{className:"flex justify-between items-start mb-4",children:[a.jsx("div",{className:"p-3 rounded-xl bg-purple-100 text-purple-600",children:a.jsx(Wq,{className:"w-6 h-6"})}),a.jsx("div",{className:"flex items-center gap-2",children:a.jsx("span",{className:"text-xs font-medium text-muted-foreground bg-muted px-2 py-1 rounded-lg",children:"This month"})})]}),a.jsx("p",{className:"text-muted-foreground font-medium text-sm mb-1",children:"Projects Quoted"}),a.jsx("h3",{className:"text-3xl font-bold text-foreground",children:De(u)}),a.jsxs("div",{className:"mt-3 pt-3 border-t border-border/50 flex items-center justify-between",children:[a.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Year to date"}),a.jsx("span",{className:"text-sm font-bold text-foreground",children:De(d)})]})]})}),a.jsx(gr.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.4},children:a.jsxs(ye,{className:"p-6 hover-elevate border-border/50",children:[a.jsxs("div",{className:"flex justify-between items-start mb-4",children:[a.jsx("div",{className:"p-3 rounded-xl bg-emerald-100 text-emerald-600",children:a.jsx(Ste,{className:"w-6 h-6"})}),a.jsx("div",{className:"flex items-center gap-2",children:a.jsx("span",{className:"text-xs font-medium text-muted-foreground bg-muted px-2 py-1 rounded-lg",children:"This month"})})]}),a.jsx("p",{className:"text-muted-foreground font-medium text-sm mb-1",children:"Projects Won"}),a.jsx("h3",{className:"text-3xl font-bold text-foreground",children:De(f)}),a.jsxs("div",{className:"mt-3 pt-3 border-t border-border/50 flex items-center justify-between",children:[a.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Year to date"}),a.jsx("span",{className:"text-sm font-bold text-foreground",children:De(h)})]})]})})]}),a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[a.jsxs(ye,{className:"p-6 border-border/50 shadow-md",children:[a.jsx("h3",{className:"text-lg font-bold mb-4",children:"My Upcoming Jobs"}),(r?.filter(p=>p.status==="scheduled").length||0)===0?a.jsx("p",{className:"text-muted-foreground text-sm py-8 text-center",children:"No upcoming jobs assigned to you yet."}):a.jsx("div",{className:"space-y-3",children:r?.filter(p=>p.status==="scheduled").slice(0,5).map(p=>a.jsxs("div",{className:"flex items-center justify-between p-3 rounded-xl bg-muted/40",children:[a.jsxs("div",{children:[a.jsx("p",{className:"font-medium text-sm",children:p.address||"No address"}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:[p.city,p.city&&p.zip?", ":"",p.zip]})]}),a.jsxs("div",{className:"text-right",children:[a.jsx("p",{className:"text-sm font-semibold text-primary",children:De(p.totalAmount)}),a.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full bg-green-100 text-green-700 capitalize",children:p.status})]})]}
79,p.id))})]}),a.jsxs(ye,{className:"p-6 border-border/50 shadow-md",children:[a.jsx("h3",{className:"text-lg font-bold mb-4",children:"My Recent Quotes"}),(n?.length||0)===0?a.jsx("p",{className:"text-muted-foreground text-sm py-8 text-center",children:"No quotes found for you yet."}):a.jsx("div",{className:"space-y-3",children:n?.slice(0,5).map(p=>a.jsxs("div",{className:"flex items-center justify-between p-3 rounded-xl bg-muted/40",children:[a.jsxs("div",{children:[a.jsxs("p",{className:"font-medium text-sm",children:["Quote #",p.id]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:new Date(p.createdAt).toLocaleDateString()})]}),a.jsxs("div",{className:"text-right",children:[a.jsx("p",{className:"text-sm font-semibold text-primary",children:De(p.grandTotal)}),a.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full capitalize ${p.status==="approved"?"bg-green-100 text-green-700":p.status==="sent"?"bg-blue-100 text-blue-700":"bg-gray-100 text-gray-600"}`,children:p.status})]})]},p.id))})]})]})]})}function gAe({name:e,role:t}){const n=t==="shop_technician",{data:r}=jv(),s=(r||[]).filter(y=>y.status==="scheduled"||y.status==="in_progress"),i=(r||[]).filter(y=>y.status==="in_progress"),l=(r||[]).filter(y=>y.status==="completed"),u=(r||[]).filter(y=>y.status==="scheduled"),d=s.filter(y=>y.kitReady).length,f=s.filter(y=>!y.kitReady).length,{data:h}=Xe({queryKey:["/api/inventory/low-stock"],queryFn:()=>$A("/api/inventory/low-stock").then(y=>y.json()),refetchInterval:300*1e3,enabled:n}),p=n?[{title:"Kits to Prepare",value:f.toString(),icon:Jn,color:"text-amber-600",bg:"bg-amber-100"},{title:"Kits Ready",value:d.toString(),icon:st,color:"text-green-600",bg:"bg-green-100"},{title:"Low Stock Items",value:(h?.length??0).toString(),icon:Kt,color:"text-orange-600",bg:"bg-orange-100"}]:[{title:"Active Jobs",value:s.length.toString(),icon:rs,color:"text-green-600",bg:"bg-green-100"},{title:"In Progress",value:i.length.toString(),icon:Dr,color:"text-blue-600",bg:"bg-blue-100"},{title:"Completed",value:l.length.toString(),icon:st,color:"text-purple-600",bg:"bg-purple-100"}],x=u.slice().sort((y,w)=>{const j=y.scheduledDate?new Date(y.scheduledDate).getTime():1/0,b=w.scheduledDate?new Date(w.scheduledDate).getTime():1/0;return j-b}).slice(0,6);return a.jsxs("div",{className:"space-y-8 pb-12","data-testid":"tech-dashboard",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-3xl font-display font-bold text-foreground",children:"Overview"}),a.jsxs("p",{className:"text-muted-foreground mt-1",children:["Welcome back, ",e,". ",n?"Here's the shop's kit queue.":"Here's your job board."]})]}),a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:p.map((y,w)=>a.jsx(gr.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:w*.1},children:a.jsxs(ye,{className:"p-6 hover-elevate border-border/50",children:[a.jsx("div",{className:"flex justify-between items-start mb-4",children:a.jsx("div",{className:`p-3 rounded-xl ${y.bg} ${y.color}`,children:a.jsx(y.icon,{className:"w-6 h-6"})})}),a.jsx("p",{className:"text-muted-foreground font-medium text-sm mb-1",children:y.title}),a.jsx("h3",{className:"text-3xl font-bold text-foreground","data-testid":`stat-${y.title.toLowerCase().replace(/\s+/g,"-")}`,children:y.value})]})},y.title))}),n&&h&&h.length>0&&a.jsx(gr.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},children:a.jsxs(ye,{className:"p-5 border-orange-200 bg-orange-50 shadow-sm",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[a.jsx(Kt,{className:"h-5 w-5 text-orange-600 shrink-0"}),a.jsxs("h3",{className:"text-base font-bold text-orange-800",children:["Low Stock Alert — ",h.length," item",h.length!==1?"s":""," at or below reorder point"]})]}),a.jsx("div",{className:"divide-y divide-orange-200",children:h.map(y=>a.jsxs("div",{className:"flex items-center justify-between py-2 text-sm",children:[a.jsxs("div",{children:[a.jsx("span",{className:"font-medium text-orange-900",children:y.name}),y.categoryName&&a.jsx("span",{className:"text-orange-600 ml-2 text-xs",children:y.categoryName})]}),a.jsxs("div",{className:"text-right shrink-0 ml-4",children:[a.jsx("span",{className:"font-bold text-orange-700",children:Number(y.qtyOnHand).toFixed(1)}),a.jsxs("span",{className:"text-orange-500 text-xs ml-1",children:["/ reorder @ ",Number(y.reorderPoint).toFixed(1)]})]})]},y.productId))})]})}),a.jsxs(ye,{className:"p-6 border-border/50 shadow-md",children:[a.jsx("h3",{className:"text-lg font-bold mb-4",children:n?"Upcoming Kits":"My Upcoming Jobs"}),x.length===0?a.jsx("p",{className:"text-muted-foreground text-sm py-8 text-center",children:"No upcoming jobs scheduled."}):a.jsx("div",{className:"space-y-3",children:x.map(y=>a.jsxs("div",{className:"flex items-center justify-between p-3 rounded-xl bg-muted/40","data-testid":`upcoming-job-${y.id}`,children:[a.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[a.jsx(Ra,{className:"w-4 h-4 text-muted-foreground shrink-0"}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"font-medium text-sm truncate",children:y.address||"No address"}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:[y.city,y.city&&y.zip?", ":"",y.zip]})]})]}),a.jsxs("div",{className:"text-right shrink-0 ml-4",children:[y.scheduledDate&&a.jsx("p",{className:"text-sm font-medium text-foreground",children:Tt(new Date(y.scheduledDate),"MMM d")}),n?a.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full ${y.kitReady?"bg-green-100 text-green-700":"bg-amber-100 text-amber-700"}`,children:y.kitReady?"Kit ready":"Kit pending"}):a.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full bg-green-100 text-green-700 capitalize",children:y.status.replace("_"," ")})]})]},y.id))})]})]})}function yAe(){const{teamMember:e}=Nn();return e?.role==="field_tech"||e?.role==="shop_technician"?a.jsx(gAe,{name:e.name,role:e.role}):e?.role==="estimator"?a.jsx(xAe,{name:e.name}):a.jsx(pAe,{})}const vAe=cv("whitespace-nowrap inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 hover-elevate ",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow-xs",secondary:"border-transparent bg-secondary text-secondary-foreground",destructive:"border-transparent bg-destructive text-destructive-foreground shadow-xs",outline:"text-foreground border [border-color:var(--badge-outline)]"}},defaultVariants:{variant:"default"}});function Hh({className:e,variant:t,...n}){return a.jsx("div",{className:qe(vAe({variant:t}),e),...n})}const Wf=async(e,t)=>{const n=localStorage.getItem("fs_team_token"),r=await fetch(e,{...t,headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`,...t?.headers||{}}});if(!r.ok)throw new Error(await r.text());return r.json()},bAe={homeowner:"Homeowner",contractor:"Contractor",property_mgmt:"HOA / Property Mgmt"},jAe=[{id:"estimate",label:"Needs Estimate",desc:"Estimator visits site, builds quote",icon:a.jsx(Rr,{className:"w-5 h-5"}),color:"bg-blue-50 text-blue-700",border:"border-blue-400 bg-blue-50"},{id:"direct_service",label:"Direct Service",desc:"Cleaning, repair — price known upfront",icon:a.jsx(Du,{className:"w-5 h-5"}),color:"bg-emerald-50 text-emerald-700",border:"border-emerald-400 bg-emerald-50"},{id:"shop_fabrication",label:"Shop Fabrication",desc:"Custom parts built in shop, no field install",icon:a.jsx(uT,{className:"w-5 h-5"}),color:"bg-orange-50 text-orange-700",border:"border-orange-400 bg-orange-50"},{id:"warranty",label:"Warranty Call",desc:"Previous work — no charge, schedule field tech",icon:a.jsx(yd,{className:"w-5 h-5"}),color:"bg-purple-50 text-purple-700",border:"border-purple-400 bg-purple-50"}];function wAe(e){const t=[];
79return(e.firstName.trim()||e.lastName.trim())&&t.push(`${e.firstName} ${e.lastName}`.trim()),e.email.trim()&&t.push(e.email.trim()),e.phone.trim()&&t.push(e.phone.trim()),e.address.trim()&&t.push(e.address.trim()),t.join(" ").trim()}const r2={firstName:"",lastName:"",email:"",phone:"",address:""},a2={address:"",city:"",state:"CA",zip:"",buildingType:"",buildingStories:"",source:"phone",notes:"",priority:"medium"},s2={assignedToId:"",scheduledDate:"",totalAmount:"",notes:""};function mH({open:e,onClose:t,onCreated:n}){const[r,s]=v.useState("contact"),[i,l]=v.useState("estimate"),[u,d]=v.useState(""),[f,h]=v.useState([]),[p,x]=v.useState(!1),[y,w]=v.useState(null),[j,b]=v.useState(!1),[C,N]=v.useState(""),[k,T]=v.useState(r2),[A,P]=v.useState({type:"homeowner",companyName:""}),[E,_]=v.useState(a2),[R,H]=v.useState(s2),[L,I]=v.useState([]),W=v.useRef(null);v.useEffect(()=>{e||(s("contact"),d(""),h([]),w(null),b(!1),N(""),l("estimate"),T(r2),P({type:"homeowner",companyName:""}),_(a2),H(s2))},[e]),v.useEffect(()=>{e&&i!=="estimate"&&Wf("/api/team").then(I).catch(()=>{})},[e,i]);const U=B=>{if(W.current&&clearTimeout(W.current),B.trim().length<2){h([]);return}W.current=setTimeout(async()=>{x(!0);try{const X=await Wf(`/api/clients/search?q=${encodeURIComponent(B)}`);h(X)}catch{h([])}finally{x(!1)}},350)},V=B=>{d(B),U(B)},D=()=>{if(!(k.firstName.trim()||k.lastName.trim()||k.email.trim()||k.phone.trim()||k.address.trim())){N("Enter at least one field to search for an existing client.");return}N("");const X=wAe(k);d(X),U(X),k.address.trim()&&_(Q=>({...Q,address:k.address.trim()})),s("client-select")},q=B=>{w(B),b(!1),s("lead-details")},K=()=>{w(null),b(!0),s("lead-details")},Y=async()=>{N(""),s("submitting");try{let B=y?.id??null;if(j){const X=`${k.firstName} ${k.lastName}`.trim();B=(await Wf("/api/clients",{method:"POST",body:JSON.stringify({name:X,email:k.email,phone:k.phone,address:E.address,city:E.city,state:E.state,zip:E.zip,type:A.type,companyName:A.companyName})})).id}if(i==="estimate")await Wf("/api/leads",{method:"POST",body:JSON.stringify({firstName:k.firstName,lastName:k.lastName,email:k.email,phone:k.phone,address:E.address,city:E.city,state:E.state,zip:E.zip,buildingType:E.buildingType,buildingStories:E.buildingStories,source:E.source,notes:E.notes,priority:E.priority,clientId:B,status:"new"})});else{if(!R.assignedToId)throw new Error("Please assign a team member.");await Wf("/api/jobs",{method:"POST",body:JSON.stringify({clientId:B,assignedToId:p
79arseInt(R.assignedToId),jobType:i,scheduledDate:R.scheduledDate||null,totalAmount:R.totalAmount?parseFloat(R.totalAmount):0,address:E.address,city:E.city,state:E.state,zip:E.zip,notes:R.notes})})}s("done"),n?.()}catch(B){N(B.message||"Something went wrong. Please try again."),s("lead-details")}};if(!e)return null;const z=i!=="estimate",Z=L.filter(B=>B.active!==!1&&(i==="shop_fabrication"?["shop_technician","admin","manager"].includes(B.role):["field_tech","admin","manager"].includes(B.role))),F=()=>r==="contact"?"Select service type & contact":r==="client-select"?"Check for existing client":r==="lead-details"?z?y?`Job for ${y.name}`:"Job details":y?`Linking to ${y.name}`:"New client — enter details":r==="submitting"?"Saving…":r==="done"?z?"Job created!":"Lead created!":"";return a.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[a.jsx("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-sm",onClick:t}),a.jsxs(ye,{className:"relative z-10 w-full max-w-lg max-h-[90vh] overflow-y-auto shadow-2xl border-border/60",children:[a.jsxs("div",{className:"flex items-center justify-between p-5 border-b border-border",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-lg font-display font-bold text-foreground",children:"New Lead / Job"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:F()})]}),a.jsx("button",{onClick:t,className:"text-muted-foreground hover:text-foreground transition-colors",children:a.jsx(an,{className:"w-5 h-5"})})]}),a.jsxs("div",{className:"p-5",children:[r==="contact"&&a.jsxs("div",{className:"space-y-5",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-2",children:"What type of service?"}),a.jsx("div",{className:"grid grid-cols-2 gap-2",children:jAe.map(B=>a.jsxs("button",{onClick:()=>l(B.id),className:`flex flex-col items-center gap-2 p-3 rounded-xl border-2 text-center transition-all ${i===B.id?`${B.border} shadow-sm`:"border-border hover:border-border/80 hover:bg-secondary/50"}`,children:[a.jsx("div",{className:`w-9 h-9 rounded-full flex items-center justify-center ${i===B.id?B.color:"bg-secondary text-muted-foreground"}`,children:B.icon}),a.jsxs("div",{children:[a.jsx("p",{className:"text-xs font-bold text-foreground leading-tight",children:B.label}),a.jsx("p",{className:"text-[10px] text-muted-foreground leading-snug mt-0.5",children:B.desc})]})]},B.id))})]}),a.jsxs("div",{className:"border-t border-border pt-4 space-y-4",children:[a.jsx("p",{className:"text-xs text-muted-foreground",children:"Fill in any fields you know — at least one is needed to check for existing clients."}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-1.5 block",children:"First Name"}),a.jsx("input",{className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background outline-none focus:border-primary",value:k.firstName,onChange:B=>T(X=>({...X,firstName:B.target.value})),placeholder:"John",onKeyDown:B=>B.key==="Enter"&&D()})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-1.5 block",children:"Last Name"}),a.jsx("input",{className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background outline-none focus:border-primary",value:k.lastName,onChange:B=>T(X=>({...X,lastName:B.target.value})),placeholder:"Smith",onKeyDown:B=>B.key==="Enter"&&D()})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-1.5 block",children:"Street Address"}),a.jsx("input",{className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background outline-none focus:border-primary",value:k.address,onChange:B=>T(X=>({...X,address:B.target.value})),placeholder:"123 Main St (partial OK)",onKeyDown:B=>B.key==="Enter"&&D()})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-1.5 block",children:"Email"}),a.jsx("input",{type:"email",className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background outline-none focus:border-primary",value:k.email,onChange:B=>T(X=>({...X,email:B.target.value})),placeholder:"[email protected]",onKeyDown:B=>B.key==="Enter"&&D()})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-1.5 block",children:"Phone"}),a.jsx("input",{type:"tel",className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background outline-none focus:border-primary",value:k.phone,onChange:B=>T(X=>({...X,phone:B.target.value})),placeholder:"(805) 555-0100",onKeyDown:B=>B.key==="Enter"&&D()})]})]})]}),C&&a.jsx("p",{className:"text-xs text-red-600 font-medium",children:C}),a.jsxs(ne,{className:"w-full rounded-xl",onClick:D,children:["Check for E
79xisting Client ",a.jsx(wr,{className:"w-4 h-4 ml-1"})]})]}),r==="client-select"&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"relative",children:[a.jsx(Da,{className:"w-4 h-4 absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),a.jsx("input",{className:"w-full pl-9 pr-4 py-2 text-sm border border-border rounded-lg bg-background outline-none focus:border-primary",placeholder:"Search by name, email, phone, or address…",value:u,onChange:B=>V(B.target.value),autoFocus:!0})]}),p&&a.jsx("div",{className:"flex justify-center py-4",children:a.jsx("div",{className:"animate-spin h-5 w-5 border-2 border-primary border-t-transparent rounded-full"})}),!p&&f.length>0&&a.jsxs("div",{className:"space-y-2",children:[a.jsxs("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:[f.length," existing client",f.length!==1?"s":""," found"]}),f.map(B=>a.jsx("button",{onClick:()=>q(B),className:"w-full text-left border border-border rounded-xl p-4 hover:border-primary/60 hover:bg-primary/5 transition-colors group",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-10 h-10 rounded-full bg-primary/10 flex items-center justify-center text-primary flex-shrink-0",children:B.type==="homeowner"?a.jsx(Ai,{className:"w-5 h-5"}):a.jsx(xd,{className:"w-5 h-5"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("p",{className:"font-bold text-sm text-foreground truncate",children:B.type!=="homeowner"&&B.companyName?B.companyName:B.name}),a.jsx("span",{className:"text-[10px] px-2 py-0.5 rounded-full bg-secondary text-muted-foreground font-semibold uppercase tracking-wider flex-shrink-0",children:bAe[B.type]})]}),a.jsxs("div",{className:"flex items-center gap-3 mt-1 text-xs text-muted-foreground",children:[B.email&&a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx($r,{className:"w-3 h-3"}),B.email]}),B.phone&&a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx(Ch,{className:"w-3 h-3"}),B.phone]}),B.city&&a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx(Ra,{className:"w-3 h-3"}),B.city]})]}),B.address&&a.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:B.address}),a.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["Client since ",Tt(new Date(B.createdAt),"MMM yyyy")]})]}),a.jsx(wr,{className:"w-4 h-4 text-muted-foreground group-hover:text-primary transition-colors flex-shrink-0"})]})},B.id))]}),!p&&u.length>=2&&f.length===0&&a.jsxs("div",{className:"text-center py-4 text-muted-foreground text-sm",children:['No existing clients found for "',u,'"']}),a.jsx("div",{className:"border-t border-border pt-4",children:a.jsxs("button",{onClick:K,className:"w-full flex items-center gap-3 border-2 border-dashed border-border hover:border-primary/60 hover:bg-primary/5 rounded-xl p-4 transition-colors group text-left",children:[a.jsx("div",{className:"w-10 h-10 rounded-full bg-secondary flex items-center justify-center flex-shrink-0",children:a.jsx(Yq,{className:"w-5 h-5 text-muted-foreground group-hover:text-primary transition-colors"})}),a.jsxs("div",{children:[a.jsx("p",{className:"font-bold text-sm text-foreground",children:"Create New Client"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:k.firstName||k.lastName?`Set up a new client record for ${k.firstName} ${k.lastName}`.trim():"Set up a new client record"})]}),a.jsx(wr,{className:"w-4 h-4 text-muted-foreground group-hover:text-primary transition-colors ml-auto flex-shrink-0"})]})}),a.jsx("button",{onClick:()=>s("contact"),className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:"← Back"})]}),r==="lead-details"&&!z&&a.jsxs("div",{className:"space-y-4",children:[y&&a.jsxs("div",{className:"flex items-center gap-3 bg-green-50 border border-green-200 rounded-xl p-3",children:[a.jsx(st,{className:"w-5 h-5 text-green-600 flex-shrink-0"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-semibold text-green-800",children:"Linked to existing client"}),a.jsxs("p",{className:"text-xs text-green-700",children:[y.name," · ",y.email]})]})]}),j&&a.jsxs("div",{className:"space-y-3 bg-blue-50 border border-blue-200 rounded-xl p-4",children:[a.jsx("p",{className:"text-xs font-semibold text-blue-800 uppercase tracking-wider",children:"New Client Setup"}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-1.5 block",children:"Client Type"}),a.jsxs("select",{className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background outline-none focus:border-primary",value:A.type,onCh
79ange:B=>P(X=>({...X,type:B.target.value})),children:[a.jsx("option",{value:"homeowner",children:"Homeowner"}),a.jsx("option",{value:"contractor",children:"Contractor"}),a.jsx("option",{value:"property_mgmt",children:"HOA / Property Management"})]})]}),A.type!=="homeowner"&&a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-1.5 block",children:"Company / HOA Name"}),a.jsx("input",{className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background outline-none focus:border-primary",value:A.companyName,onChange:B=>P(X=>({...X,companyName:B.target.value})),placeholder:"Company name"})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{className:"col-span-2",children:[a.jsx("label",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-1.5 block",children:"Street Address"}),a.jsx("input",{className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background outline-none focus:border-primary",value:E.address,onChange:B=>_(X=>({...X,address:B.target.value})),placeholder:"123 Main St"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-1.5 block",children:"City"}),a.jsx("input",{className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background outline-none focus:border-primary",value:E.city,onChange:B=>_(X=>({...X,city:B.target.value})),placeholder:"San Luis Obispo"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-1.5 block",children:"Zip"}),a.jsx("input",{className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background outline-none focus:border-primary",value:E.zip,onChange:B=>_(X=>({...X,zip:B.target.value})),placeholder:"93401"})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-1.5 block",children:"Source"}),a.jsxs("select",{className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background outline-none focus:border-primary",value:E.source,onChange:B=>_(X=>({...X,source:B.target.value})),children:[a.jsx("option",{value:"phone",children:"Phone"}),a.jsx("option",{value:"contact_form",children:"Contact Form"}),a.jsx("option",{value:"estimate_form",children:"Estimate Form"}),a.jsx("option",{value:"referral",children:"Referral"}),a.jsx("option",{value:"other",children:"Other"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-1.5 block",children:"Priority"}),a.jsxs("select",{className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background outline-none focus:border-primary",value:E.priority,onChange:B=>_(X=>({...X,priority:B.target.value})),children:[a.jsx("option",{value:"low",children:"Low"}),a.jsx("option",{value:"medium",children:"Medium"}),a.jsx("option",{value:"high",children:"High"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-1.5 block",children:"Building Type"}),a.jsx("input",{className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background outline-none focus:border-primary",value:E.buildingType,onChange:B=>_(X=>({...X,buildingType:B.target.value})),placeholder:"Residential, Commercial…"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-1.5 block",children:"Stories"}),a.jsx("input",{className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background outline-none focus:border-primary",value:E.buildingStories,onChange:B=>_(X=>({...X,buildingStories:B.target.value})),placeholder:"1, 2, 3…"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-1.5 block",children:"Notes"}),a.jsx("textarea",{className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background outline-none focus:border-primary resize-none",rows:3,value:E.notes,onChange:B=>_(X=>({...X,notes:B.target.value})),placeholder:"Additional details about this lead…"})]}),C&&a.jsx("p",{className:"text-xs text-red-600 font-medium",children:C}),a.jsxs("div",{className:"flex gap-3 pt-2",children:[a.jsx("button",{onClick:()=>s("client-select"),className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:"← Back"}),a.jsxs(ne,{className:"flex-1 rounded-xl",onClick:Y,children:["Create Lead ",j&&"+ New Client"]})]})]}),r==="lead-details"&&z&&a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{className:`flex items-center gap-2 px-3 py-2 rounded-xl text-sm font-semibold ${i==="direct_service"?"bg-emerald-50 border border-emerald-200 text-emerald-800":i==="warranty"?"bg-purple-50 border border-purple-200 text-purple-800":"bg-orange-50 border border-orange-200 text-orange-800"}`,children:i==="direct_service"?a.jsxs(a.Fragment,{children:[a.jsx(Du,{className:"w-4 h-4"})," Direct Service Job"]}):i==="warranty"?a.jsxs(a.Fragment,{children:[a.jsx(yd,{className:"w-4 h-4"})," Warranty Call"]}):a.jsxs(a.Fragment,{children:[a.jsx(uT,{className:"w-4 h-4"})," Shop Fabrication Job"]})}),y&&a.jsxs("div",{className:"flex items-center gap-3 bg-green-50 border border-green-200 rounded-xl p-3",children:[a.jsx(st,{className:"w-5 h-5 text-green-600 flex-shrink-0"}),a.jsxs("div",{children:[a.jsxs("p",{className:"text-sm font-semibold text-green-800",children:["Client: ",y.name]}),a.jsx("p",{className:"text-xs text-green-700",children:y.email})]})]}),j&&a.jsxs("div",{className:"space-y-3 bg-blue-50 border border-blue-200 rounded-xl p-4",children:[a.jsx("p",{className:"text-xs font-semibold text-blue-800 uppercase tracking-wider",children:"New Client Setup"}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-1.5 block",children:"Client Type"}),a.jsxs("select",{className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background outline-none focus:border-primary",value:A.type,onCh
79ange:B=>P(X=>({...X,type:B.target.value})),children:[a.jsx("option",{value:"homeowner",children:"Homeowner"}),a.jsx("option",{value:"contractor",children:"Contractor"}),a.jsx("option",{value:"property_mgmt",children:"HOA / Property Management"})]})]}),A.type!=="homeowner"&&a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-1.5 block",children:"Company / HOA Name"}),a.jsx("input",{className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background outline-none focus:border-primary",value:A.companyName,onChange:B=>P(X=>({...X,companyName:B.target.value})),placeholder:"Company name"})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{className:"col-span-2",children:[a.jsx("label",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-1.5 block",children:"Job Address"}),a.jsx("input",{className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background outline-none focus:border-primary",value:E.address,onChange:B=>_(X=>({...X,address:B.target.value})),placeholder:"123 Main St"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-1.5 block",children:"City"}),a.jsx("input",{className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background outline-none focus:border-primary",value:E.city,onChange:B=>_(X=>({...X,city:B.target.value})),placeholder:"San Luis Obispo"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-1.5 block",children:"Zip"}),a.jsx("input",{className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background outline-none focus:border-primary",value:E.zip,onChange:B=>_(X=>({...X,zip:B.target.value})),placeholder:"93401"})]})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-1.5 block",children:["Assign to ",i==="shop_fabrication"?"Shop Tech":"Field Tech"," *"]}),a.jsxs("select",{className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background outline-none focus:border-primary",value:R.assignedToId,onChange:B=>H(X=>({...X,assignedToId:B.target.value})),children:[a.jsx("option",{value:"",children:"— Select team member —"}),Z.map(B=>a.jsxs("option",{value:B.id,children:[B.name," (",B.role.replace(/_/g," "),")"]},B.id))]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-1.5 block",children:"Scheduled Date"}),a.jsx("input",{type:"date",className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background outline-none focus:border-primary",value:R.scheduledDate,onChange:B=>H(X=>({...X,scheduledDate:B.target.value}))})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-1.5 block",children:"Estimated Amount ($)"}),a.jsx("input",{type:"number",min:"0",step:"0.01",className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background outline-none focus:border-primary",value:R.totalAmount,onChange:B=>H(X=>({...X,totalAmount:B.target.value})),placeholder:"0.00"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-1.5 block",children:"Notes"}),a.jsx("textarea",{className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background outline-none focus:border-primary resize-none",rows:3,value:R.notes,onChange:B=>H(X=>({...X,notes:B.target.value})),placeholder:"Scope of work, special instructions…"})]}),C&&a.jsx("p",{className:"text-xs text-red-600 font-medium",children:C}),a.jsxs("div",{className:"flex gap-3 pt-2",children:[a.jsx("button",{onClick:()=>s("client-select"),className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:"← Back"}),a.jsxs(ne,{className:"flex-1 rounded-xl",onClick:Y,children:["Create Job ",j&&"+ New Client"]})]})]}),r==="submitting"&&a.jsxs("div",{className:"flex flex-col items-center py-10 gap-3",children:[a.jsx("div",{className:"animate-spin h-8 w-8 border-4 border-primary border-t-transparent roun
79ded-full"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:z?"Creating job…":"Creating lead…"})]}),r==="done"&&a.jsxs("div",{className:"flex flex-col items-center py-10 gap-4 text-center",children:[a.jsx("div",{className:"w-16 h-16 rounded-full bg-green-100 flex items-center justify-center",children:a.jsx(st,{className:"w-8 h-8 text-green-600"})}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-display font-bold text-lg text-foreground",children:z?"Job Created!":"Lead Created!"}),a.jsxs("p",{className:"text-sm text-muted-foreground mt-1",children:[k.firstName||k.lastName?`${k.firstName} ${k.lastName}`.trim()+(z?" has been scheduled.":" has been added to your pipeline."):z?"Job has been scheduled.":"Lead has been added to your pipeline.",j&&" A new client record was created."]})]}),a.jsxs("div",{className:"flex gap-3 w-full pt-2",children:[a.jsx(ne,{variant:"outline",className:"flex-1 rounded-xl",onClick:t,children:"Close"}),a.jsx(ne,{className:"flex-1 rounded-xl",onClick:()=>{s("contact"),d(""),h([]),w(null),b(!1),N(""),l("estimate"),T(r2),P({type:"homeowner",companyName:""}),_(a2),H(s2)},children:"Add Another"})]})]})]})]})]})}const W6=(e,t)=>{const n=localStorage.getItem("fs_team_token");return fetch(e,{...t,headers:{Authorization:`Bearer ${n}`,"Content-Type":"application/json",...t?.headers||{}}})},NAe=[{value:30,label:"30 min"},{value:60,label:"1 hour"},{value:90,label:"1.5 hours"},{value:120,label:"2 hours"},{value:180,label:"3 hours"},{value:240,label:"4 hours"}],SAe=[{value:0,label:"None"},{value:15,label:"15 min"},{value:30,label:"30 min"},{value:45,label:"45 min"},{value:60,label:"1 hour"}];function Y6(e){return new Date(e).toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0})}function CAe(){const e=new Date,t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return`${t}-${n}-${r}`}function AAe({lead:e,teamMembers:t,onClose:n,onScheduled:r}){const s=`${e.firstName||""} ${e.lastName||""}`.trim()||"Client",i=[e.address,e.city].filter(Boolean).join(", ")||"",[l,u]=v.useState(e.assignedToId??t[0]?.id??0),[d,f]=v.useState(CAe()),[h,p]=v.useState("09:00"),[x,y]=v.useState(60),[w,j]=v.useState(30),[b,C]=v.useState(i),[N,k]=v.useState(""),[T,A]=v.useState([]),[P,E]=v.useState(!1),[_,R]=v.useState(!1),[H,L]=v.useState(null);v.useEffect(()=>{!d||!l||(E(!0),W6(`/api/calendar/day?date=${d}&estimatorId=${l}`).then(V=>V.json()).then(V=>A(Array.isArray(V)?V:[])).catch(()=>A([])).finally(()=>E(!1)))},[d,l]);const I=async()=>{if(!l||!d||!h||!x){L("Please fill in all required fields.");return}R(!0),L(null);try{const V=await W6("/api/calendar/schedule-estimate",{method:"POST",body:JSON.stringify({leadId:e.id,estimatorId:l,date:d,startTime:h,appointmentMinutes:x,driveTimeMinutes:w,address:b,notes:N||void 0})}),D=await V.json();if(!V.ok){L(D.error||"Failed to schedule estimate. Please try again.");return}r(),n()}catch{L("Network error. Please try again.")}finally{R(!1)}},W=[];for(let V=7;V<=18;V++)for(const D of[0,15,30,45]){if(V===18&&D>0)break;W.push(`${String(V).padStart(2,"0")}:${String(D).padStart(2,"0")}`)}const U=V=>{const[D,q]=V.split(":").map(Number),K=D>=12?"PM":"AM";return`${D%12||12}:${String(q).padStart(2,"0")} ${K}`};return a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4",children:a.jsxs("div",{className:"bg-white rounded-2xl shadow-2xl w-full max-w-lg max-h-[90vh] overflow-y-auto",children:[a.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-border",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-xl font-bold text-foreground",children:"Schedule Estimate"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:s})]}),a.jsx("button",{onClick:n,className:"p-2 rounded-lg hover:bg-accent text-muted-foreground",children:a.jsx(an,{className:"w-5 h-5"})})]}),a.jsxs("div",{className:"p-6 space-y-5",children:[a.jsxs("div",{children:[a.jsxs("label",{className:"block text-xs font-semibold uppercase tracking-wider text-muted-foreground mb-1.5",children:[a.jsx(Ai,{className:"w-3.5 h-3.5 inline mr-1"})," Estimator"]}
79),a.jsx("select",{value:l,onChange:V=>u(Number(V.target.value)),className:"w-full border border-border rounded-xl px-3 py-2.5 text-sm bg-white focus:outline-none focus:ring-2 focus:ring-primary/30",children:t.map(V=>a.jsxs("option",{value:V.id,children:[V.name," (",V.role,")"]},V.id))})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsxs("label",{className:"block text-xs font-semibold uppercase tracking-wider text-muted-foreground mb-1.5",children:[a.jsx(Nh,{className:"w-3.5 h-3.5 inline mr-1"})," Date"]}),a.jsx("input",{type:"date",value:d,onChange:V=>f(V.target.value),className:"w-full border border-border rounded-xl px-3 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-primary/30"})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"block text-xs font-semibold uppercase tracking-wider text-muted-foreground mb-1.5",children:[a.jsx(Dr,{className:"w-3.5 h-3.5 inline mr-1"})," Start Time"]}),a.jsx("select",{value:h,onChange:V=>p(V.target.value),className:"w-full border border-border rounded-xl px-3 py-2.5 text-sm bg-white focus:outline-none focus:ring-2 focus:ring-primary/30",children:W.map(V=>a.jsx("option",{value:V,children:U(V)},V))})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-semibold uppercase tracking-wider text-muted-foreground mb-1.5",children:"Appointment Duration"}),a.jsx("select",{value:x,onChange:V=>y(Number(V.target.value)),className:"w-full border border-border rounded-xl px-3 py-2.5 text-sm bg-white focus:outline-none focus:ring-2 focus:ring-primary/30",children:NAe.map(V=>a.jsx("option",{value:V.value,children:V.label},V.value))})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-semibold uppercase tracking-wider text-muted-foreground mb-1.5",children:"Drive Time Buffer"}),a.jsx("select",{value:w,onChange:V=>j(Number(V.target.value)),className:"w-full border border-border rounded-xl px-3 py-2.5 text-sm bg-white focus:outline-none focus:ring-2 focus:ring-primary/30",children:SAe.map(V=>a.jsx("option",{value:V.value,children:V.label},V.value))})]})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"block text-xs font-semibold uppercase tracking-wider text-muted-foreground mb-1.5",children:[a.jsx(Ra,{className:"w-3.5 h-3.5 inline mr-1"})," Address"]}),a.jsx("input",{type:"text",value:b,onChange:V=>C(V.target.value),placeholder:"123 Main St, Cambria, CA",className:"w-full border border-border rounded-xl px-3 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-primary/30"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-semibold uppercase tracking-wider text-muted-foreground mb-1.5",children:"Notes (optional)"}),a.jsx("textarea",{value:N,onChange:V=>k(V.target.value),rows:2,placeholder:"Any special instructions for the estimator...",className:"w-full border border-border rounded-xl px-3 py-2.5 text-sm resize-none focus:outline-none focus:ring-2 focus:ring-primary/30"})]}),a.jsxs("div",{className:"border border-border rounded-xl p-4 bg-accent/30",children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsx("p",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"That Day's Schedule"}),P&&a.jsx(Me,{className:"w-3.5 h-3.5 animate-spin text-muted-foreground"})]}),!P&&T.length===0&&a.jsx("p",{className:"text-sm text-muted-foreground italic",children:"No appointments found for this date."}),T.map(V=>a.jsxs("div",{className:"flex items-start gap-2 mb-2 last:mb-0",children:[a.jsx(wr,{className:"w-3.5 h-3.5 text-primary mt-0.5 shrink-0"}),a.jsxs("div",{children:[a.jsxs("p",{className:"text-xs font-semibold text-foreground",children:[Y6(V.start.dateTime)," – ",Y6(V.end.dateTime)]}),a.jsx("p",{className:"text-xs text-muted-foreground line-clamp-1",children:V.subject}),V.location?.displayName&&a.jsx("p",{className:"text-[11px] text-muted-foreground/70",children:V.location.displayName})]})]},V.id))]}),H&&a.jsxs("div",{className:"flex items-start gap-2 bg-destructive/10 border border-destructive/20 rounded-xl p-3",children:[a.jsx(rn,{className:"w-4 h-4 text-destructive shrink-0 mt-0.5"}),a.jsx("p",{className:"text-sm text-destructive",children:H})]})]}),a.jsxs("div",{className:"flex justify-end gap-3 p-6 border-t border-border",children:[a.jsx(ne,{variant:"outline",onClick:n,disabled:_,className:"rounded-xl",children:"Cancel"}),a.jsx(ne,{onClick:I,disabled:_,className:"rounded-xl px-6",children:_?a.jsxs(a.Fragment,{children:[a.jsx(Me,{className:"w-4 h-4 mr-2 animate-spin"})," Scheduling…"]}):"Confirm Appointment"})]})]})})}const hH=(e,t)=>{const n=localStorage.getItem("fs_team_token");return fetch(e,{...t,headers:{Authorization:`Bearer ${n}`,"Content-Type":"application/json"}}).then(r=>r.json())},pH=[{id:"new",label:"New Leads",color:"bg-blue-50 border-blue-200"}
79,{id:"contacted",label:"Contacted",color:"bg-amber-50 border-amber-200"},{id:"quoted",label:"Quoted",color:"bg-purple-50 border-purple-200"},{id:"scheduled",label:"Scheduled",color:"bg-indigo-50 border-indigo-200"},{id:"won",label:"Won",color:"bg-green-50 border-green-200"}],TAe={new:"New Lead",contacted:"Contacted",quoted:"Quoted",scheduled:"Scheduled",won:"Won"},xH={contact_form:"Contact Form",estimate_form:"Estimate Request",phone:"Phone",referral:"Referral",other:"Other"},kAe=new Set(["contact_form","estimate_form","phone","referral","other"]);function Sm(e){const t=`${e.firstName||""} ${e.lastName||""}`.trim();return!t||kAe.has(t.toLowerCase())?"Unknown Lead":t}function Zr({icon:e,label:t,value:n}){return n?a.jsxs("div",{className:"flex gap-3 py-3 border-b border-border/50 last:border-0",children:[a.jsx("div",{className:"text-muted-foreground mt-0.5 shrink-0",children:e}),a.jsxs("div",{children:[a.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground mb-0.5",children:t}),a.jsx("p",{className:"text-sm text-foreground",children:n})]})]}):null}const LA=[{id:"estimate",label:"Needs Estimate",desc:"Schedule a site visit",icon:Rr,color:"blue"},{id:"direct_service",label:"Direct Service",desc:"Field tech dispatched",icon:Du,color:"green"},{id:"shop_fabrication",label:"Shop Fabrication",desc:"Kit built in shop",icon:uT,color:"orange"},{id:"warranty",label:"Warranty Call",desc:"No-charge return visit",icon:yd,color:"purple"}],gH={estimate:"bg-blue-50 border-blue-300 text-blue-700",direct_service:"bg-green-50 border-green-300 text-green-700",shop_fabrication:"bg-orange-50 border-orange-300 text-orange-700",warranty:"bg-purple-50 border-purple-300 text-purple-700"};function Jr({label:e,value:t,onChange:n,type:r="text"}){return a.jsxs("div",{className:"flex flex-col gap-1",children:[a.jsx("label",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:e}),a.jsx("input",{type:r,value:t,onChange:s=>n(s.target.value),className:"border border-input rounded-lg px-3 py-2 text-sm bg-background focus:outline-none focus:ring-2 focus:ring-primary/40"})]})}const hg=[{id:"call",label:"Phone Call",icon:Iee},{id:"email",label:"Email",icon:KZ},{id:"sms",label:"SMS",icon:Aee},{id:"note",label:"Note",icon:jn}],X6={call:[{id:"left_voicemail",label:"Left Voicemail"},{id:"spoke_with_client",label:"Spoke with Client"},{id:"no_answer",label:"No Answer"},{id:"scheduled_callback",label:"Scheduled Callback"}],email:[{id:"sent",label:"Sent"}],sms:[{id:"sent",label:"Sent"}],meeting:[{id:"completed",label:"Completed"}],note:[]},OAe={left_voicemail:"Left Voicemail",spoke_with_client:"Spoke with Client",no_answer:"No Answer",scheduled_callback:"Scheduled Callback",sent:"Sent",completed:"Completed",other:"Other"},PAe={spoke_with_client:"bg-green-100 text-green-700",left_voicemail:"bg-amber-100 text-amber-700",no_answer:"bg-red-100 text-red-700",scheduled_callback:"bg-blue-100 text-blue-700",sent:"bg-indigo-100 text-indigo-700",completed:"bg-green-100 text-green-700",other:"bg-gray-100 text-gray-600"};function EAe({leadId:e,teamMemberId:t,isAdmin:n,onActivityLogged:r}){const s=wt(),[i,l]=v.useState(!1),[u,d]=v.useState("call"),[f,h]=v.useState("left_voicemail"),[p,x]=v.useState(""),[y,w]=v.useState(!1),j=X6[u]||[],{data:b=[],refetch:C}=Xe({queryKey:["activities",e],queryFn:()=>hH(`/api/leads/${e}/activities`),staleTime:30*1e3}),N=A=>{d(A);const P=X6[A]||[];P.length>0?h(P[0].id):h("")},k=async()=>{w(!0);try{const A=localStorage.getItem("fs_team_token"),P={type:u};f&&(P.outcome=f),p.trim()&&(P.notes=p);const E=await fetch(`/api/leads/${e}/activities`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${A}`},body:JSON.stringify(P)});if(!E.ok)throw new Error(await E.text());l(!1),x(""),C(),s.invalidateQueries({queryKey:bi()}),r?.()}catch(A){alert(A.message||"Failed to log activity")}finally{w(!1)}},T=async A=>{if(!confirm("Remove this activity entry?"))return;const P=localStorage.getItem("fs_team_token");await fetch(`/api/lead-activities/${A}`,{method:"DELETE",headers:{Authorization:`Bearer ${P}`}}),C(),s.invalidateQueries({queryKey:bi()})};return a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsx("h3",{className:"text-xs font-bold uppercase tracking-widest text-muted-foreground",children:"Activity L
79og"}),a.jsx("button",{onClick:()=>l(A=>!A),className:"flex items-center gap-1 text-[11px] font-semibold text-primary hover:underline",children:i?a.jsxs(a.Fragment,{children:[a.jsx(Sh,{className:"w-3 h-3"})," Hide"]}):a.jsxs(a.Fragment,{children:[a.jsx(Ft,{className:"w-3 h-3"})," Log Activity"]})})]}),i&&a.jsxs("div",{className:"bg-secondary/40 rounded-xl p-4 mb-4 space-y-3",children:[a.jsx("div",{className:"flex gap-2",children:hg.map(A=>{const P=A.icon;return a.jsxs("button",{onClick:()=>N(A.id),className:`flex-1 flex flex-col items-center gap-1 py-2 rounded-xl border-2 text-[11px] font-semibold transition-all ${u===A.id?"border-primary bg-primary/5 text-primary":"border-border text-muted-foreground hover:border-primary/30"}`,children:[a.jsx(P,{className:"w-3.5 h-3.5"}),A.label]},A.id)})}),j.length>0&&a.jsxs("div",{className:"flex flex-col gap-1",children:[a.jsx("label",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Outcome"}),a.jsx("select",{value:f,onChange:A=>h(A.target.value),className:"border border-input rounded-lg px-3 py-2 text-sm bg-background focus:outline-none focus:ring-2 focus:ring-primary/40",children:j.map(A=>a.jsx("option",{value:A.id,children:A.label},A.id))})]}),a.jsxs("div",{className:"flex flex-col gap-1",children:[a.jsx("label",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Notes (optional)"}),a.jsx("textarea",{value:p,onChange:A=>x(A.target.value),rows:2,placeholder:"Add details about this contact…",className:"border border-input rounded-lg px-3 py-2 text-sm bg-background focus:outline-none focus:ring-2 focus:ring-primary/40 resize-none"})]}),a.jsx(ne,{size:"sm",className:"w-full rounded-xl",onClick:k,disabled:y,children:y?"Logging…":"Log Activity"})]}),a.jsxs("div",{className:"space-y-0",children:[b.length===0&&!i&&a.jsx("div",{className:"text-sm text-muted-foreground text-center py-6 border-2 border-dashed border-border/50 rounded-xl",children:"No activity yet — log your first contact above."}),b.map((A,P)=>{const E=hg.find(_=>_.id===A.type)?.icon||Dr;return a.jsxs("div",{className:`flex gap-3 py-3 ${P<b.length-1?"border-b border-border/50":""}`,children:[a.jsx("div",{className:"shrink-0 mt-0.5",children:a.jsx("div",{className:"w-7 h-7 rounded-full bg-secondary flex items-center justify-center",children:a.jsx(E,{className:"w-3.5 h-3.5 text-muted-foreground"})})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2 flex-wrap mb-0.5",children:[a.jsx("span",{className:"text-[12px] font-semibold capitalize text-foreground",children:hg.find(_=>_.id===A.type)?.label||A.type}),A.outcome&&a.jsx("span",{className:`text-[10px] font-bold px-1.5 py-0.5 rounded-full ${PAe[A.outcome]||"bg-gray-100 text-gray-600"}`,children:OAe[A.outcome]||A.outcome})]}),A.notes&&a.jsx("p",{className:"text-[12px] text-muted-foreground mb-0.5 leading-relaxed",children:A.notes}),a.jsxs("p",{className:"text-[10px] text-muted-foreground/70",children:[A.authorName||"Team"," · ",lk(new Date(A.createdAt),{addSuffix:!0})]})]}),n&&a.jsx("button",{onClick:()=>T(A.id),className:"shrink-0 text-muted-foreground/40 hover:text-destructive transition-colors",children:a.jsx(an,{className:"w-3.5 h-3.5"})})]},A.id)})]})]})}function _Ae({lead:e,onClose:t,onDelete:n,onStatusChange:r,onBuildQuote:s,isAdmin:i,onUpdated:l,teamMemberId:u}){const d=wt(),[,f]=fr(),[h,p]=v.useState(!1),[x,y]=v.useState(!1),[w,j]=v.useState(e.serviceType||"estimate"),[b,C]=v.useState({firstName:e.firstName||"",lastName:e.lastName||"",email:e.email||"",phone:e.phone||"",address:e.address||"",city:e.city||"",state:e.state||"",zip:e.zip||"",buildingType:e.buildingType||"",buildingStories:e.buildingStories||"",squareFootage:e.squareFootage||"",roofType:e.roofType||"",buildingDescription:e.buildingDescription||"",gutterStyle:e.gutterStyle||"",gutterColor:e.gutterColor||"",downspoutStyle:e.downspoutStyle||"",downspoutColor:e.downspoutColor||"",source:String(e.source||"other"),priority:String(e.priority||"medium"),notes:e.notes||""}),N=()=>{j(e.serviceType||"estimate"),C({firstName:e.firstName||"",lastName:e.lastName||"",email:e.email||"",phone:e.phone||"",address:e.address||"",city:e.city||"",state:e.state||"",zip:e.zip||"",buildingType:e.buildingType||"",buildingStories:e.buildingStories||"",squareFootage:e.squareFootage||"",roofType:e.roofType||"",buildingDescription:e.buildingDescription||"",gutterStyle:e.gutterStyle||"",gutterColor:e.gutterColor||"",downspoutStyle:e.downspoutStyle||"",downspoutColor:e.downspoutColor||"",source:e.source||"other",priority:e.priority||"medium",notes:e.notes||""}),p(!0)},k=async()=>{y(!0);try{const E=localStorage.getItem("fs_team_token"),_=await fetch(`/api/leads/${e.id}`,{method:"PATCH",headers:{"Content-Type":"application/json",Authorization:`Bearer ${E}`},body:JSON.stringify({...b,serviceType:w})});if(!_.ok)throw new Error(await _.text());const R=await _.json();l?.(R),p(!1)}catch(E){alert(E.message||"Save failed")}finally{y(!1)}},T=E=>_=>C(R=>({...R,[E]:_})),A=pH.filter(E=>E.id!==e.status),P=LA.find(E=>E.id===(e.serviceType||"estimate"));return a.jsxs("div",{className:"fixed inset-0 z-40 flex justify-end",onClick:h?void 0:t,children:[a.jsx("div",{className:"fixed inset-0 bg-black/20 backdrop-blur-[1px]",onClick:h?void 0:t}),a.jsxs("div",{className:"relative w-full max-w-md bg-background shadow-2xl flex flex-col h-full overflow-y-auto",onClick:E=>E.stopPropagation(),children:[a.jsxs("div",{className:"sticky top-0 bg-background z-10 border-b border-border px-6 py-4 flex items-start justify-between",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[a.jsx(Hh,{variant:"outline",className:"text-[10px] uppercase tracking-wider font-semibold",children:xH[e.source]??e.source.replace(/_/g," ")}),a.jsx("span",{className:"text-[10px] font-bold px-2 py-0.5 bg-primary/10 text-primary rounded-full",children:TAe[e.status]||e.status}),P&&a.jsx("span",{className:`text-[10px] font-bold px-2 py-0.5 border rounded-full ${gH[P.id]}`,children:P.label})]}),a.jsx("h2",{className:"text-xl font-display font-bold text-foreground",children:h?`${b.firstName} ${b.lastName}`.trim()||"Edit Lead":Sm(e)}),!h&&a.jsxs("p",{className:"text-sm text-muted-foreground",children:["Received ",Tt(new Date(e.createdAt),"MMM d, yyyy 'at' h:mm a")]})]}),a.jsxs("div",{className:"flex items-center gap-2 shrink-0 ml-2",children:[i&&!h&&a.jsx("button",{onClick:N,className:"p-1.5 rounded-lg hover:bg-secondary text-muted-foreground hover:text-foreground transition-colors",title:"Edit lead",children:a.jsx(gd,{className:"w-4 h-4"})}),a.jsx("button",{onClick:t,className:"text-muted-foreground hover:text-foreground p-1 rounded-lg hover:bg-secondary",children:a.jsx(an,{className:"w-5 h-5"})})]})]}),h?a.jsxs("div",{className:"flex-1 px-6 py-5 space-y-6 overflow-y-auto",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-xs font-bold uppercase tracking-widest text-muted-foreground mb-3",children:"Service Type"}),a.jsx("div",{className:"grid grid-cols-2 gap-3",children:LA.map(E=>
79{const _=E.icon,R=w===E.id;return a.jsxs("button",{type:"button",onClick:()=>j(E.id),className:`flex flex-col items-start gap-1 p-3 rounded-xl border-2 text-left transition-all ${R?"border-primary bg-primary/5 shadow-sm":"border-border bg-secondary/30 hover:border-primary/40"}`,children:[a.jsx("div",{className:`w-8 h-8 rounded-lg flex items-center justify-center mb-1 ${R?"bg-primary text-white":"bg-muted text-muted-foreground"}`,children:a.jsx(_,{className:"w-4 h-4"})}),a.jsx("span",{className:"text-[13px] font-semibold leading-tight",children:E.label}),a.jsx("span",{className:"text-[11px] text-muted-foreground leading-tight",children:E.desc})]},E.id)})})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-xs font-bold uppercase tracking-widest text-muted-foreground mb-3",children:"Contact Information"}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsx(Jr,{label:"First Name",value:b.firstName,onChange:T("firstName")}),a.jsx(Jr,{label:"Last Name",value:b.lastName,onChange:T("lastName")})]}),a.jsx(Jr,{label:"Email",value:b.email,onChange:T("email"),type:"email"}),a.jsx(Jr,{label:"Phone",value:b.phone,onChange:T("phone"),type:"tel"})]})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-xs font-bold uppercase tracking-widest text-muted-foreground mb-3",children:"Contact Address"}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(Jr,{label:"Street",value:b.address,onChange:T("address")}),a.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[a.jsx("div",{className:"col-span-1",children:a.jsx(Jr,{label:"City",value:b.city,onChange:T("city")})}),a.jsx(Jr,{label:"State",value:b.state,onChange:T("state")}),a.jsx(Jr,{label:"Zip",value:b.zip,onChange:T("zip")})]})]})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-xs font-bold uppercase tracking-widest text-muted-foreground mb-3",children:"Building Details"}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsx(Jr,{label:"Building Type",value:b.buildingType,onChange:T("buildingType")}),a.jsx(Jr,{label:"Stories",value:b.buildingStories,onChange:T("buildingStories")})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsx(Jr,{label:"Square Footage",value:b.squareFootage,onChange:T("squareFootage")}),a.jsx(Jr,{label:"Roof Type",value:b.roofType,onChange:T("roofType")})]}),a.jsx(Jr,{label:"Building Description",value:b.buildingDescription,onChange:T("buildingDescription")})]})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-xs font-bold uppercase tracking-widest text-muted-foreground mb-3",children:"Lead Details"}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{className:"flex flex-col gap-1",children:[a.jsx("label",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Source"}),a.jsxs("select",{value:b.source,onChange:E=>C(_=>({..._,source:E.target.value})),className:"border border-input rounded-lg px-3 py-2 text-sm bg-background focus:outline-none focus:ring-2 focus:ring-primary/40",children:[a.jsx("option",{value:"contact_form",children:"Contact Form"}),a.jsx("option",{value:"estimate_form",children:"Estimate Request"}),a.jsx("option",{value:"phone",children:"Phone"}),a.jsx("option",{value:"referral",children:"Referral"}),a.jsx("option",{value:"other",children:"Other"})]})]}),a.jsxs("div",{className:"flex flex-col gap-1",children:[a.jsx("label",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Priority"}),a.jsxs("select",{value:b.priority,onChange:E=>C(_=>({..._,priority:E.target.value})),className:"border border-input rounded-lg px-3 py-2 text-sm bg-background focus:outline-none focus:ring-2 focus:ring-primary/40",children:[a.jsx("option",{value:"low",children:"Low"}),a.jsx("option",{value:"medium",children:"Medium"}),a.jsx("option",{value:"high",children:"High"})]})]})]}),a.jsxs("div",{className:"flex flex-col gap-1",children:[a.jsx("label",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Notes"}),a.jsx("textarea",{value:b.notes,onChange:E=>C(_=>({..._,notes:E.target.value})),rows:3,className:"border border-input rounded-lg px-3 py-2 text-sm bg-background focus:outline-none focus:ring-2 focus:ring-primary/40 resize-none"})]})]})]})]}):a.jsxs("div",{className:"flex-1 px-6 py-4 space-y-6",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-xs font-bold uppercase tracking-widest text-muted-foreground mb-3",children:"Contact Information"}),a.jsxs("div",{className:"bg-secondary/40 rounded-xl px-4",children:[a.jsx(Zr,{icon:a.jsx(Ai,{className:"w-4 h-4"}),label:"Full Name",value:Sm(e)!=="Unknown Lead"?Sm(e):void 0}),a.jsx(Zr,{icon:a.jsx($r,{className:"w-4 h-4"}),label:"Email",value:e.email}),a.jsx(Zr,{icon:a.jsx(Ch,{className:"w-4 h-4"}),label:"Phone",value:e.phone})]})]}),(e.address||e.city||e.state||e.zip)&&a.jsxs("div",{children:[a.jsx("h3",{className:"text-xs font-bold uppercase tracking-widest text-muted-foreground mb-3",children:"Billing / Contact Address"}),a.jsx("div",{className:"bg-secondary/40 rounded-xl px-4",children:a.jsx(Zr,{icon:a.jsx(Ra,{className:"w-4 h-4"}),label:"Address",value:[e.address,e.city,e.state,e.zip].filter(
79Boolean).join(", ")})})]}),(e.jobAddress||e.jobCity)&&a.jsxs("div",{children:[a.jsx("h3",{className:"text-xs font-bold uppercase tracking-widest text-muted-foreground mb-3",children:"Job Site Address"}),a.jsx("div",{className:"bg-secondary/40 rounded-xl px-4",children:a.jsx(Zr,{icon:a.jsx(Ra,{className:"w-4 h-4"}),label:"Job Address",value:[e.jobAddress,e.jobCity,e.jobState,e.jobZip].filter(Boolean).join(", ")})})]}),(e.buildingType||e.buildingStories||e.squareFootage||e.buildingDescription)&&a.jsxs("div",{children:[a.jsx("h3",{className:"text-xs font-bold uppercase tracking-widest text-muted-foreground mb-3",children:"Building"}),a.jsxs("div",{className:"bg-secondary/40 rounded-xl px-4",children:[a.jsx(Zr,{icon:a.jsx(L2,{className:"w-4 h-4"}),label:"Building Type",value:e.buildingType}),a.jsx(Zr,{icon:a.jsx(F2,{className:"w-4 h-4"}),label:"Stories / Height",value:e.buildingStories}),a.jsx(Zr,{icon:a.jsx(F2,{className:"w-4 h-4"}),label:"Square Footage",value:e.squareFootage}),a.jsx(Zr,{icon:a.jsx(q2,{className:"w-4 h-4"}),label:"Building Description",value:e.buildingDescription})]})]}),(e.gutterStyle||e.gutterColor||e.downspoutStyle||e.downspoutColor)&&a.jsxs("div",{children:[a.jsx("h3",{className:"text-xs font-bold uppercase tracking-widest text-muted-foreground mb-3",children:"Gutter Specifications"}),a.jsxs("div",{className:"bg-secondary/40 rounded-xl px-4",children:[a.jsx(Zr,{icon:a.jsx(yx,{className:"w-4 h-4"}),label:"Gutter Style",value:e.gutterStyle}),a.jsx(Zr,{icon:a.jsx(yx,{className:"w-4 h-4"}),label:"Gutter Color",value:e.gutterColor}),a.jsx(Zr,{icon:a.jsx(yx,{className:"w-4 h-4"}),label:"Downspout Style",value:e.downspoutStyle}),a.jsx(Zr,{icon:a.jsx(yx,{className:"w-4 h-4"}),label:"Downspout Color",value:e.downspoutColor})]})]}),e.notes&&a.jsxs("div",{children:[a.jsx("h3",{className:"text-xs font-bold uppercase tracking-widest text-muted-foreground mb-3",children:"Notes"}),a.jsxs("div",{className:"bg-secondary/40 rounded-xl p-4 flex gap-3",children:[a.jsx(q2,{className:"w-4 h-4 text-muted-foreground shrink-0 mt-0.5"}),a.jsx("p",{className:"text-sm text-foreground whitespace-pre-wrap",children:e.notes})]})]}),i&&a.jsxs("div",{children:[a.jsx("h3",{className:"text-xs font-bold uppercase tracking-widest text-muted-foreground mb-3",children:"Move to Stage"}),a.jsx("div",{className:"flex flex-wrap gap-2",children:A.map(E=>a.jsxs("button",{onClick:()=>r(e.id,E.id),className:`px-3 py-1.5 rounded-xl text-xs font-semibold border-2 transition-colors ${E.color} hover:opacity-80`,children:[E.label," ",a.jsx(Ru,{className:"w-3 h-3 inline ml-1"})]},E.id))})]}),a.jsx("div",{className:"pt-2 border-t border-border/50",children:a.jsx(EAe,{leadId:e.id,teamMemberId:u,isAdmin:i,onActivityLogged:()=>{d.invalidateQueries({queryKey:bi()})}})})]}),a.jsx("div",{className:"sticky bottom-0 bg-background border-t border-border px-6 py-4 flex gap-3",children:h?a.jsxs(a.Fragment,{children:[a.jsx(ne,{className:"flex-1 rounded-xl",size:"sm",onClick:k,disabled:x,children:x?"Saving…":a.jsxs(a.Fragment,{children:[a.jsx(Si,{className:"w-4 h-4 mr-1.5"}),"Save Changes"]})}),a.jsx(ne,{variant:"outline",className:"rounded-xl",size:"sm",onClick:()=>p(!1),disabled:x,children:"Cancel"})]}):a.jsxs(a.Fragment,{children:[i&&a.jsx(ne,{className:"flex-1 rounded-xl",size:"sm",onClick:()=>s(e),children:"Build Quote"}),e.clientId&&a.jsx(ne,{variant:"outline",className:"flex-1 rounded-xl",size:"sm",onClick:()=>f(`/clients/${e.clientId}`),children:"View Client"}),i&&a.jsx("button",{onClick:()=>n(e.id),className:"p-2 rounded-xl border border-destructive/30 text-destructive hover:bg-destructive/10 transition-colors",children:a.jsx(on,{className:"w-4 h-4"})})]})})]})]})}function MAe(){const{teamMember:e}=Nn(),t=["admin","manager"].includes(e?.role??""),{data:n,isLoading:r}=dk(),s=ffe(),i=mfe(),l=wt(),[,u]=fr(),[d,f]=v.useState(null),[h,p]=v.useState(!1),[x,y]=v.useState(null),[w,j]=v.useState(null),[b,C]=v.useState(null),[N,k]=v.useState(null),T=v.useRef(null),{data:A=[]}=Xe({queryKey:["team"],queryFn:()=>hH("/api/team"),staleTime:300*1e3}),P=Object.fromEntries(A.map(V=>[V.id,V]));v.useEffect(()=>{if(!b)return;const V=D=>{T.current&&!T.current.contains(D.target)&&C(null)};return document.addEventListener("mousedown",V),()=>document.removeEventListener("mousedown",V)},[b]);const E=(V,D)=>{s.mutate({id:V,data:{assignedToId:D}}),C(null)},_=V=>{confirm("Delete this lead? This cannot be undone.")&&(i.mutate({id:V}),y(null),j(null))},R=(V,D)=>{s.mutate({id:V,data:{status:D}}),j(q=>q?.id===V?{...q,status:D}:q)},H=V=>{const D=V,q={aluminum:"Aluminum","aluminum (standard)":"Aluminum",copper:"Copper","copper (premium)":"Copper","24 ga steel":"24 ga Steel","24 gauge steel":"24 ga Steel","24ga steel":"24 ga Steel"},K=(D.material||"").toLowerCase().trim(),Y=q[K]||"Aluminum",z=(D.buildingStories||"").toLowerCase(),Z=z.includes("3")||z.includes("4")?"3":z.includes("2")?"2":"1",F={leadId:V.id,customerData:{type:["apartment","condominium","retail","industrial","commercial"].some(B=>(V.buildingType||"").toLowerCase().includes(B))?"commercial":"homeowner",name:`${V.firstName} ${V.lastName}`.trim(),email:V.email||"",phone:V.phone||"",address:[V.address,V.city,V.state,V.zip].filter(
79Boolean).join(", ")},buildingData:{type:(V.buildingType||"residential").toLowerCase(),stories:Z,roofType:D.roofType||""},jobData:{material:Y,gutterColor:V.gutterColor||"",gutterType:V.gutterStyle||"",downspoutType:V.downspoutStyle||""},notes:V.notes||""};sessionStorage.setItem("quotePreFill",JSON.stringify(F)),u("/quotes/new")},L=(V,D)=>{f(D),V.dataTransfer.setData("leadId",D.toString())},I=V=>V.preventDefault(),W=(V,D)=>{V.preventDefault();const q=V.dataTransfer.getData("leadId");q&&s.mutate({id:parseInt(q),data:{status:D}}),f(null)},U=()=>{l.invalidateQueries({queryKey:bi()})};return r?a.jsx("div",{className:"animate-pulse flex gap-4",children:[1,2,3,4].map(V=>a.jsx("div",{className:"flex-1 h-[600px] bg-secondary rounded-xl"},V))}):a.jsxs("div",{className:"flex flex-col h-[calc(100vh-8rem)]",children:[a.jsxs("div",{className:"flex justify-between items-center mb-6 shrink-0",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-3xl font-display font-bold text-foreground",children:t?"Leads Pipeline":"My Leads"}),a.jsx("p",{className:"text-muted-foreground mt-1",children:t?"Manage and track potential clients":"Your assigned leads"})]}),t&&a.jsxs(ne,{className:"rounded-xl px-6",onClick:()=>p(!0),children:[a.jsx(Ft,{className:"w-4 h-4 mr-2"})," New Lead"]})]}),a.jsx("div",{className:"flex-1 overflow-x-auto pb-4",children:a.jsx("div",{className:"flex gap-4 min-w-max h-full",children:pH.map(V=>{const D=n?.filter(q=>q.status===V.id)||[];return a.jsxs("div",{className:`w-80 flex flex-col rounded-2xl border-2 ${V.color} p-4 transition-colors ${t&&d?"border-dashed":""}`,onDragOver:t?I:void 0,onDrop:t?q=>W(q,V.id):void 0,children:[a.jsxs("div",{className:"flex justify-between items-center mb-4 shrink-0",children:[a.jsx("h3",{className:"font-bold text-foreground",children:V.label}),a.jsx("span",{className:"bg-white px-2.5 py-1 rounded-full text-xs font-bold text-muted-foreground shadow-sm",children:D.length})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto space-y-3 pr-2 custom-scrollbar",children:[D.map(q=>a.jsxs(ye,{draggable:t,onDragStart:t?K=>L(K,q.id):void 0,onClick:()=>j(q),className:"p-4 cursor-pointer hover:border-primary/50 hover:shadow-md transition-all shadow-sm",children:[a.jsxs("div",{className:"flex justify-between items-start mb-2",children:[a.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[a.jsx(Hh,{variant:"outline",className:"text-[10px] uppercase tracking-wider font-semibold",children:xH[q.source]??q.source.replace(/_/g," ")}),q.serviceType&&q.serviceType!=="estimate"&&a.jsx("span",{className:`text-[10px] font-bold px-2 py-0.5 border rounded-full ${gH[q.serviceType]||""}`,children:LA.find(K=>K.id===q.serviceType)?.label??q.serviceType}),q.clientId&&(q.isReturning?a.jsx("span",{className:"text-[10px] font-bold px-2 py-0.5 bg-green-100 text-green-700 rounded-full",children:"Returning"}):a.jsx("span",{className:"text-[10px] font-bold px-2 py-0.5 bg-blue-100 text-blue-700 rounded-full",children:"New Client"}))]}),t&&a.jsxs("div",{className:"relative",children:[a.jsx("button",{className:"text-muted-foreground hover:text-foreground",onClick:K=>{K.stopPropagation(),y(x===q.id?null:q.id)},children:a.jsx($J,{className:"w-4 h-4"})}),x===q.id&&a.jsx("div",{className:"absolute right-0 top-6 z-50 bg-white border border-border rounded-xl shadow-lg py-1 min-w-[130px]",children:a.jsxs("button",{className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-destructive hover:bg-destructive/10",onClick:K=>{K.stopPropagation(),_(q.id)},children:[a.jsx(on,{className:"w-3.5 h-3.5"})," Delete lead"]})})]})]}),a.jsx("h4",{className:`font-bold text-base mb-1 ${Sm(q)==="Unknown Lead"?"text-muted-foreground italic":"text-foreground"}`,children:Sm(q)}),a.jsxs("p",{className:"text-xs text-muted-foreground mb-3 line-clamp-1",children:[q.address,q.city?`, ${q.city}`:""]}),a.jsxs("div",{className:"flex flex-col gap-1.5 mb-4",children:[q.phone&&a.jsxs("div",{className:"flex items-center text-xs text-muted-foreground",children:[a.jsx(Ch,{className:"w-3.5 h-3.5 mr-2"})," ",q.phone]}),q.email&&a.jsxs("div",{className:"flex items-center text-xs text-muted-foreground",children:[a.jsx($r,{className:"w-3.5 h-3.5 mr-2"})," ",q.email]}),q.lastActivityAt&&a.jsxs("div",{className:"flex items-center text-[10px] text-muted-foreground
79/60 font-medium",children:[a.jsx(Dr,{className:"w-3 h-3 mr-1.5 shrink-0"}),hg.find(K=>K.id===q.lastActivityType)?.label||"Contact"," · ",lk(new Date(q.lastActivityAt),{addSuffix:!0})]})]}),a.jsxs("div",{className:"flex justify-between items-center pt-3 border-t border-border",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("div",{className:"flex items-center text-[10px] text-muted-foreground font-medium",children:[a.jsx(Nh,{className:"w-3 h-3 mr-1"}),Tt(new Date(q.createdAt),"MMM d")]}),t&&q.assignedToId&&q.status!=="scheduled"&&q.status!=="won"&&a.jsxs("button",{onClick:K=>{K.stopPropagation(),k(q)},className:"text-[10px] font-semibold text-emerald-600 flex items-center hover:underline",title:"Schedule Estimate Appointment",children:[a.jsx(sJ,{className:"w-3 h-3 mr-0.5"})," Schedule"]})]}),t?a.jsxs("div",{className:"relative",ref:b===q.id?T:void 0,children:[q.assignedToId&&P[q.assignedToId]?a.jsxs("button",{onClick:K=>{K.stopPropagation(),C(b===q.id?null:q.id)},className:"flex items-center gap-1 text-[10px] font-semibold text-primary hover:underline",title:"Reassign",children:[a.jsx("div",{className:"w-5 h-5 rounded-full bg-primary text-white flex items-center justify-center text-[10px] font-bold shrink-0",children:P[q.assignedToId].name.charAt(0).toUpperCase()}),a.jsx("span",{className:"hidden sm:inline max-w-[60px] truncate",children:P[q.assignedToId].name.split(" ")[0]}),a.jsx(Nr,{className:"w-2.5 h-2.5 opacity-60"})]}):a.jsxs("button",{onClick:K=>{K.stopPropagation(),C(b===q.id?null:q.id)},className:"text-[10px] font-semibold text-primary flex items-center hover:underline",children:[a.jsx(Yq,{className:"w-3 h-3 mr-1"})," Assign"]}),b===q.id&&a.jsxs("div",{className:"absolute right-0 bottom-7 z-50 bg-white border border-border rounded-xl shadow-lg py-1 min-w-[140px] max-h-48 overflow-y-auto",children:[A.filter(K=>K.active!==!1).map(K=>a.jsxs("button",{onClick:Y=>{Y.stopPropagation(),E(q.id,K.id)},className:`w-full flex items-center gap-2 px-3 py-2 text-sm hover:bg-accent text-left ${q.assignedToId===K.id?"font-semibold text-primary":""}`,children:[a.jsx("div",{className:"w-5 h-5 rounded-full bg-primary/20 text-primary flex items-center justify-center text-[10px] font-bold shrink-0",children:K.name.charAt(0).toUpperCase()}),a.jsx("span",{className:"truncate",children:K.name})]},K.id)),q.assignedToId&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"border-t border-border my-1"}),a.jsxs("button",{onClick:K=>{K.stopPropagation(),E(q.id,null)},className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-muted-foreground hover:bg-accent text-left",children:[a.jsx(an,{className:"w-3.5 h-3.5"})," Unassign"]})]})]})]}):q.assignedToId&&P[q.assignedToId]&&a.jsxs("div",{className:"flex items-center gap-1 text-[10px] font-semibold text-primary",children:[a.jsx("div",{className:"w-5 h-5 rounded-full bg-primary text-white flex items-center justify-center text-[10px] font-bold shrink-0",children:P[q.assignedToId].name.charAt(0).toUpperCase()}),a.jsx("span",{className:"hidden sm:inline max-w-[60px] truncate",children:P[q.assignedToId].name.split(" ")[0]})]})]})]},q.id)),D.length===0&&a.jsx("div",{className:"h-24 border-2 border-dashed border-border/50 rounded-xl flex items-center justify-center text-sm text-muted-foreground/50",children:t?"Drop lead here":"No leads"})]})]},V.id)})})}),w&&a.jsx(_Ae,{lead:w,onClose:()=>j(null),onDelete:_,onStatusChange:R,onBuildQuote:H,isAdmin:t,teamMemberId:e?.id,onUpdated:V=>{j(V),l.invalidateQueries({queryKey:bi()})}}),a.jsx(mH,{open:h,onClose:()=>p(!1),onCreated:U}),N&&a.jsx(AAe,{lead:N,teamMembers:A.filter(V=>V.active!==!1),onClose:()=>k(null),onScheduled:()=>{l.invalidateQueries({queryKey:bi()}),k(null)}})]})}const RAe={bg:"bg-teal-50 border-teal-400 border-dashed text-teal-800",pill:"bg-teal-200 text-teal-800"},Q6=e=>{const t=localStorage.getItem("fs_team_token");return fetch(e,{headers:{Authorization:`Bearer ${t}`}}).then(n=>n.json())};function Ao(e){const t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return`${t}-${n}-${r}`}function om(e){const t=new Date(e),n=t.getDay(),r=n===0?-6:1-n;return t.setDate(t.getDate()+r),t.setHours(0,0,0,0),t}function yH(e){return new Date(e.getFullYear(),e.getMonth(),1)}function vH(e){return new Date(e.getFullYear(),e.getMonth()+1,0)}function bH(e){const t=new Date;return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function cd(e){return new Date(e).toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0})}function Z6(e){const t=new Date(e);return t.getHours()*60+t.getMinutes()}const Gy=[{bg:"bg-blue-100 border-blue-300 text-blue-800",pill:"bg-blue-200 text-blue-800"},{bg:"bg-purple-100 border-purple-300 text-purple-800",pill:"bg-purple-200 text-purple-800"}
79,{bg:"bg-amber-100 border-amber-300 text-amber-800",pill:"bg-amber-200 text-amber-800"},{bg:"bg-green-100 border-green-300 text-green-800",pill:"bg-green-200 text-green-800"},{bg:"bg-rose-100 border-rose-300 text-rose-800",pill:"bg-rose-200 text-rose-800"},{bg:"bg-indigo-100 border-indigo-300 text-indigo-800",pill:"bg-indigo-200 text-indigo-800"}];function DAe(e){const t={};return e.forEach((n,r)=>{n.email&&(t[n.email.toLowerCase()]=Gy[r%Gy.length])}),t}function gO(e,t){if(e.source==="google")return RAe;const n=e.attendees?.find(r=>r.type==="required");return n&&t[n.emailAddress.address.toLowerCase()]||Gy[0]}function jH(e){if(e.source==="google")return{initial:"G",name:"Google Calendar"};const t=e.attendees?.find(r=>r.type==="required");if(!t)return{initial:"?",name:"Unknown"};const n=t.emailAddress.name||t.emailAddress.address;return{initial:n.charAt(0).toUpperCase(),name:n}}function yO(e,t){const n=Ao(t);return e.filter(r=>r.start.dateTime.split("T")[0]===n)}const lm=7,wH=20,qx=(wH-lm)*60,i2=72;function $Ae({events:e,colorMap:t,onSwitchToDay:n}){const r=Array.from({length:wH-lm},(l,u)=>lm+u),s=qx*(i2/60),i=e.map(l=>{const u=Z6(l.start.dateTime),d=Z6(l.end.dateTime),f=u-lm*60,h=Math.max(d-u,30),p=Math.max(f,0)/qx*s,x=Math.min(h,qx-Math.max(f,0))/qx*s;return{ev:l,top:p,height:x}}).filter(l=>l.top<s&&l.height>0);return e.length===0?a.jsxs("div",{className:"flex-1 flex items-center justify-center flex-col gap-3 text-muted-foreground",children:[a.jsx(Nh,{className:"w-10 h-10 opacity-20"}),a.jsx("p",{className:"text-sm",children:"No events scheduled for this day"})]}):a.jsx("div",{className:"flex-1 overflow-y-auto",children:a.jsxs("div",{className:"flex min-w-[400px]",children:[a.jsx("div",{className:"w-16 shrink-0 select-none",style:{paddingTop:0},children:r.map(l=>a.jsx("div",{className:"text-right pr-3 text-[11px] text-muted-foreground",style:{height:i2},children:l===12?"12 PM":l<12?`${l} AM`:`${l-12} PM`},l))}),a.jsxs("div",{className:"flex-1 relative border-l border-border",children:[r.map(l=>a.jsx("div",{className:"absolute w-full border-t border-border/50",style:{to
79p:(l-lm)*i2}},l)),i.map(({ev:l,top:u,height:d})=>{const f=gO(l,t),{initial:h,name:p}=jH(l);return a.jsxs("div",{className:`absolute left-1 right-1 rounded-lg border px-2 py-1 text-xs overflow-hidden ${f.bg}`,style:{top:u+1,height:Math.max(d-2,20)},children:[a.jsxs("div",{className:"flex items-center gap-1 font-semibold truncate",children:[a.jsx("span",{className:"w-4 h-4 rounded-full bg-current/20 flex items-center justify-center text-[9px] shrink-0",children:h}),a.jsx("span",{className:"truncate",children:l.subject})]}),d>40&&a.jsxs("div",{className:"flex items-center gap-1 opacity-75 mt-0.5",children:[a.jsx(Dr,{className:"w-2.5 h-2.5 shrink-0"}),a.jsxs("span",{children:[cd(l.start.dateTime)," – ",cd(l.end.dateTime)]})]}),d>60&&l.location?.displayName&&a.jsxs("div",{className:"flex items-center gap-1 opacity-70 mt-0.5",children:[a.jsx(Ra,{className:"w-2.5 h-2.5 shrink-0"}),a.jsx("span",{className:"truncate",children:l.location.displayName})]})]},l.id)}),a.jsx("div",{style:{height:s}})]})]})})}function IAe({weekStart:e,events:t,colorMap:n,onDayClick:r}){const s=Array.from({length:6},(i,l)=>{const u=new Date(e);return u.setDate(u.getDate()+l),u});return a.jsx("div",{className:"flex-1 overflow-x-auto",children:a.jsx("div",{className:"grid grid-cols-6 gap-3 min-w-[640px] h-full",children:s.map(i=>{const l=yO(t,i),u=bH(i);return a.jsxs("div",{className:"flex flex-col min-h-0",children:[a.jsxs("div",{className:`text-center py-2 px-2 rounded-xl mb-2 shrink-0 cursor-pointer transition-opacity hover:opacity-80 ${u?"bg-primary text-white":"bg-secondary text-muted-foreground"}`,onClick:()=>r(i),children:[a.jsx("p",{className:`text-[11px] font-semibold uppercase tracking-wider ${u?"text-white/80":""}`,children:i.toLocaleDateString("en-US",{weekday:"short"})}),a.jsx("p",{className:`text-lg font-bold leading-tight ${u?"text-white":"text-foreground"}`,children:i.getDate()}),a.jsxs("p",{className:`text-[10px] ${u?"text-white/70":"text-muted-foreground"}`,children:[l.length," event",l.length!==1?"s":""]})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto space-y-2 pr-0.5",children:[l.length===0&&a.jsx("div",{className:"h-16 border-2 border-dashed border-border/40 rounded-xl flex items-center justify-center",children:a.jsx(Nh,{className:"w-4 h-4 text-muted-foreground/30"})}),l.map(d=>{const{initial:f,name:h}=jH(d),p=gO(d,n);return a.jsxs("div",{className:`rounded-xl border p-2.5 text-xs ${p.bg}`,children:[a.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[a.jsx("div",{className:"w-5 h-5 rounded-full bg-current/20 flex items-center justify-center font-bold text-[10px] shrink-0",children:f}),a.jsx("span",{className:"font-semibold truncate",children:h})]}),a.jsxs("div",{className:"flex items-center gap-1 text-[10px] opacity-80 mb-0.5",children:[a.jsx(Dr,{className:"w-3 h-3 shrink-0"}),cd(d.start.dateTime)," – ",cd(d.end.dateTime)]}),a.jsx("p",{className:"font-medium truncate leading-tight",children:d.subject}),d.location?.displayName&&a.jsxs("div",{className:"flex items-center gap-1 mt-1 opacity-70",children:[a.jsx(Ra,{className:"w-3 h-3 shrink-0"}),a.jsx("span",{className:"truncate",children:d.location.displayName})]})]},d.id)})]})]},Ao(i))})})})}function LAe({currentDate:e,events:t,colorMap:n,onDayClick:r}){const s=yH(e),i=vH(e),l=om(s),u=new Date(l);for(;u<i||u.getDay()!==0;)u.setDate(u.getDate()+1);const d=[],f=new Date(l);for(;f<=u;)d.push(new Date(f)),f.setDate(f.getDate()+1);const h=[];for(let x=0;x<d.length;x+=7)h.push(d.slice(x,x+7));const p=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"];return a.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[a.jsx("div",{className:"grid grid-cols-7 gap-px mb-1 shrink-0",children:p.map(x=>a.jsx("div",{className:"text-center text-[11px] font-semibold uppercase tracking-wider text-muted-foreground py-1",children:x},x))}),a.jsx("div",{className:"flex-1 grid gap-px overflow-hidden",style:{gridTemplateRows:`repeat(${h.length}, minmax(0, 1fr))`},children:h.map((x,y)=>a.jsx("div",{className:"grid grid-cols-7 gap-px",children:x.map(w=>{const j=w.getMonth()===e.getMonth(),b=bH(w),C=yO(t,w),N=C.slice(0,3),k=C.length-N.length;return a.jsxs("div",{onClick:()=>r(w),className:`rounded-lg p-1.5 cursor-pointer transition-colors min-h-0 flex flex-col gap-0.5 ${j?"bg-white hover:bg-secondary/50":"bg-secondary/30 hover:bg-secondary/60"} ${b?"ring-2 ring-primary ring-inset":""}`,children:[a.jsx("span",{className:`text-xs font-semibold leading-none mb-0.5 self-start px-1 py-0.5 rounded-full ${b?"bg-primary text-white":j?"text-foreground":"text-muted-foreground
79/50"}`,children:w.getDate()}),N.map(T=>{const A=gO(T,n);return a.jsxs("div",{className:`rounded text-[10px] px-1 py-0.5 truncate leading-tight font-medium ${A.pill}`,title:`${cd(T.start.dateTime)} – ${T.subject}`,children:[cd(T.start.dateTime).replace(":00","")," ",T.subject]},T.id)}),k>0&&a.jsxs("div",{className:"text-[10px] text-muted-foreground font-medium px-1",children:["+",k," more"]})]},Ao(w))})},y))})]})}function FAe(){const[e,t]=v.useState("week"),[n,r]=v.useState(()=>{const E=new Date;return E.setHours(0,0,0,0),E}),[s,i]=v.useState([]),[l,u]=v.useState(!1),[d,f]=v.useState([]),[h,p]=v.useState(null),[x,y]=v.useState(!0);v.useEffect(()=>{Q6("/api/team").then(E=>f(Array.isArray(E)?E:[])).catch(()=>{})},[]);const w=v.useCallback(()=>{if(e==="day"){const W=Ao(n);return{startDate:W,endDate:W,endpoint:`/api/calendar/range?startDate=${W}&endDate=${W}`}}if(e==="week"){const W=om(n),U=new Date(W);U.setDate(U.getDate()+6);const V=Ao(W),D=Ao(U);return{startDate:V,endDate:D,endpoint:`/api/calendar/week?startDate=${V}`}}const E=yH(n),_=vH(n),R=om(E),H=new Date(R);for(;H<_||H.getDay()!==0;)H.setDate(H.getDate()+1);const L=Ao(R),I=Ao(H);return{startDate:L,endDate:I,endpoint:`/api/calendar/range?startDate=${L}&endDate=${I}`}},[e,n]);v.useEffect(()=>{u(!0);const{endpoint:E}=w();Q6(E).then(_=>{Array.isArray(_)?(i(_),y(!0)):(y(!1),i([]))}).catch(()=>{y(!1),i([])}).finally(()=>u(!1))},[w]);const j=DAe(d),b=h?(()=>{const E=d.find(R=>R.id===h);if(!E||!E.email)return s;const _=E.email.toLowerCase();return s.filter(R=>R.attendees?.some(H=>H.emailAddress.address.toLowerCase()===_))})():s,C=()=>{const E=new Date(n);e==="day"?E.setDate(E.getDate()-1):e==="week"?E.setDate(E.getDate()-7):E.setMonth(E.getMonth()-1),r(E)},N=()=>{const E=new Date(n);e==="day"?E.setDate(E.getDate()+1):e==="week"?E.setDate(E.getDate()+7):E.setMonth(E.getMonth()+1),r(E)},k=()=>{const E=new Date;E.setHours(0,0,0,0),r(E)},T=E=>{r(E),t("day")},A=(()=>{if(e==="day")return n.toLocaleDateString("en-US",{weekday:"long",month:"long",day:"numeric",year:"numeric"});if(e==="week"){const E=om(n),_=new Date(E);return _.setDate(_.getDate()+5),`${E.toLocaleDateString("en-US",{month:"long",day:"numeric"})} – ${_.toLocaleDateString("en-US",{month:"long",day:"numeric",year:"numeric"})}`}return n.toLocaleDateString("en-US",{month:"long",year:"numeric"})})(),P=om(n);return a.jsxs("div",{className:"flex flex-col h-[calc(100vh-8rem)]",children:[a.jsxs("div",{className:"flex justify-between items-center mb-4 shrink-0 flex-wrap gap-3",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-3xl font-display font-bold text-foreground",children:"Calendar"}),a.jsx("p",{className:"text-muted-foreground mt-1",children:"Estimate & job appointments from Outlook"})]}),a.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[a.jsx("div",{className:"flex rounded-xl border border-border overflow-hidden text-sm",children:["day","week","month"].map(E=>a.jsx("button",{onClick:()=>t(E),className:`px-3 py-1.5 font-medium capitalize transition-colors ${e===E?"bg-primary text-white":"bg-white text-muted-foreground hover:bg-secondary"}`,children:E},E))}),a.jsxs("select",{value:h??"",onChange:E=>p(E.target.value?Number(E.target.value):null),className:"border border-border rounded-xl px-3 py-2 text-sm bg-white focus:outline-none",children:[a.jsx("option",{value:"",children:"All Estimators"}),d.map(E=>a.jsx("option",{value:E.id,children:E.name},E.id))]}),a.jsx(ne,{variant:"outline",size:"icon",className:"rounded-xl",onClick:C,children:a.jsx(Dq,{className:"w-4 h-4"})}),a.jsx(ne,{variant:"outline",className:"rounded-xl px-4 text-sm",onClick:k,children:"Today"}),a.jsx(ne,{variant:"outline",size:"icon",className:"rounded-xl",onClick:N,children:a.jsx(wr,{className:"w-4 h-4"})}),a.jsx("span",{className:"text-sm font-medium text-muted-foreground min-w-[180px] text-right",children:A})]})]}),!x&&a.jsxs("div",{className:"mb-4 bg-amber-50 border border-amber-200 rounded-xl px-4 py-3 text-sm text-amber-800 shrink-0",children:[a.jsx("strong",{children:"Calendar not connected."})," Connect [email protected] Microsoft account on the Team page to see Outlook appointments here."]}),l?a.jsx("div",{className:"flex-1 flex items-center justify-center",children:a.jsx(Me,{className:"w-8 h-8 animate-spin text-muted-foreground"})}):e==="day"?a.jsx($Ae,{events:yO(b,n),colorMap:j}
79):e==="week"?a.jsx(IAe,{weekStart:P,events:b,colorMap:j,onDayClick:T}):a.jsx(LAe,{currentDate:n,events:b,colorMap:j,onDayClick:T})]})}function qAe(){const{data:e,isLoading:t}=fk(),n=pfe(),r=xfe(),[s,i]=ie.useState(new Set),l=u=>u?u.type==="homeowner"?u.name:u.companyName||u.contactName:"Unknown";return t?a.jsx("div",{className:"p-8 flex justify-center",children:a.jsx("div",{className:"animate-spin h-8 w-8 border-4 border-primary border-t-transparent rounded-full"})}):a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-3xl font-display font-bold text-foreground",children:"Quotes"}),a.jsx("p",{className:"text-muted-foreground mt-1",children:"Manage and create estimates"})]}),a.jsx(Cu,{href:"/quotes/new",children:a.jsxs(ne,{className:"rounded-xl px-6 shadow-lg shadow-primary/20",children:[a.jsx(Ft,{className:"w-4 h-4 mr-2"})," New Quote"]})})]}),a.jsxs(ye,{className:"border-border/60 shadow-sm overflow-hidden",children:[a.jsxs("div",{className:"p-4 border-b border-border flex justify-between items-center bg-secondary/30",children:[a.jsxs("div",{className:"relative w-72",children:[a.jsx(Da,{className:"w-4 h-4 absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),a.jsx("input",{type:"text",placeholder:"Search quotes...",className:"w-full pl-9 pr-4 py-2 text-sm bg-white border border-border rounded-lg outline-none focus:border-primary focus:ring-1 focus:ring-primary"})]}),a.jsxs("div",{className:"text-sm font-semibold text-muted-foreground",children:[e?.length||0," Total Quotes"]})]}),a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm text-left",children:[a.jsx("thead",{className:"text-xs text-muted-foreground uppercase bg-secondary/50 font-semibold",children:a.jsxs("tr",{children:[a.jsx("th",{className:"px-6 py-4",children:"Customer"}),a.jsx("th",{className:"px-6 py-4",children:"Amount"}),a.jsx("th",{className:"px-6 py-4",children:"Status"}),a.jsx("th",{className:"px-6 py-4",children:"Date"}),a.jsx("th",{className:"px-6 py-4 text-right",children:"Actions"})]})}),a.jsx("tbody",{className:"divide-y divide-border",children:e?.length===0?a.jsx("tr",{children:a.jsxs("td",{colSpan:5,className:"px-6 py-12 text-center text-muted-foreground",children:[a.jsx(jn,{className:"w-12 h-12 mx-auto mb-3 opacity-20"}),a.jsx("p",{children:"No quotes found. Create your first quote."})]})}):e?.map(u=>a.jsxs("tr",{className:"hover:bg-secondary/30 transition-colors",children:[a.jsxs("td",{className:"px-6 py-4",children:[a.jsx("div",{className:"font-bold text-foreground",children:l(u.customerData)}),a.jsx("div",{className:"text-xs text-muted-foreground mt-0.5",children:u.customerData?.address||"No address provided"})]}),a.jsx("td",{className:"px-6 py-4 font-bold",children:De(u.grandTotal)}),a.jsx("td",{className:"px-6 py-4",children:a.jsx("span",{className:`px-2.5 py-1 text-xs font-bold uppercase tracking-wider rounded-full
80                      ${u.status==="approved"?"bg-green-100 text-green-700":u.status==="sent"?"bg-blue-100 text-blue-700":"bg-gray-100 text-gray-700"}`,children:u.status})}),a.jsx("td",{className:"px-6 py-4 text-muted-foreground",children:Tt(new Date(u.createdAt),"MMM dd, yyyy")}),a.jsx("td",{className:"px-6 py-4 text-right",children:a.jsxs("div",{className:"flex items-center justify-end gap-2",children:[(u.clientId||u.customerData?.email)&&u.status!=="approved"&&a.jsx(ne,{variant:"ghost",size:"icon",title:"Email quote to client",className:`h-8 w-8 ${s.has(u.id)?"text-green-600":"text-muted-foreground hover:text-blue-600 hover:bg-blue-50"}`,disabled:r.isPending,onClick:()=>{r.mutate(u.id,{onSuccess:()=>i(d=>new Set(d).add(u.id))})},children:r.isPending&&r.variables===u.id?a.jsx(Me,{className:"w-4 h-4 animate-spin"}):a.jsx(Er,{className:"w-4 h-4"})}),a.jsx(Cu,{href:`/quotes/${u.id}/proposal`,children:a.jsx(ne,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-primary hover:bg-primary/10",children:a.jsx(HJ,{className:"w-4 h-4"})})}),a.jsx(Cu,{href:`/quotes/${u.id}/edit`,children:a.jsx(ne,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",children:a.jsx(ute,{className:"w-4 h-4"})})}),a.jsx(ne,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-destructive hover:bg-destructive/10",onClick:()=>{confirm("Are you sure you want to delete this quote?")&&n.mutate({id:u.id})},children:a.jsx(on,{className:"w-4 h-4"})})]})})]},u.id))})]})})]})]})}const Ee=v.forwardRef(({className:e,type:t,...n},r)=>a.jsx("input",{type:t,className:qe("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:r,...n}));
vendor: 11,586 bytes, lines 80-95
80Ee.displayName="Input";const Ql=v.forwardRef(({className:e,...t},n)=>a.jsx("textarea",{className:qe("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:n,...t}));Ql.displayName="Textarea";function FA(e,[t,n]){return Math.min(n,Math.max(t,e))}var BAe=v.createContext(void 0);function Vh(e){const t=v.useContext(BAe);return e||t||"ltr"}var o2=0;function Jv(){v.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??J6()),document.body.insertAdjacentElement("beforeend",e[1]??J6()),o2++,()=>{o2===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),o2--}},[])}function J6(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var l2="focusScope.autoFocusOnMount",c2="focusScope.autoFocusOnUnmount",eF={bubbles:!1,cancelable:!0},zAe="FocusScope",Gh=v.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:s,onUnmountAutoFocus:i,...l}=e,[u,d]=v.useState(null),f=hn(s),h=hn(i),p=v.useRef(null),x=it(t,j=>d(j)),y=v.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;v.useEffect(()=>{if(r){let j=function(k){if(y.paused||!u)return;const T=k.target;u.contains(T)?p.current=T:jo(p.current,{select:!0})},b=function(k){if(y.paused||!u)return;const T=k.relatedTarget;T!==null&&(u.contains(T)||jo(p.current,{select:!0}))},C=function(k){if(document.activeElement===document.body)for(const A of k)A.removedNodes.length>0&&jo(u)};document.addEventListener("focusin",j),document.addEventListener("focusout",b);const N=new MutationObserver(C);return u&&N.observe(u,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",j),document.removeEventListener("focusout",b),N.disconnect()}}},[r,u,y.paused]),v.useEffect(()=>{if(u){nF.add(y);const j=document.activeElement;if(!u.contains(j)){const C=new CustomEvent(l2,eF);u.addEventListener(l2,f),u.dispatchEvent(C),C.defaultPrevented||(UAe(WAe(NH(u)),{select:!0}),document.activeElement===j&&jo(u))}return()=>{u.removeEventListener(l2,f),setTimeout(()=>{const C=new CustomEvent(c2,eF);u.addEventListener(c2,h),u.dispatchEvent(C),C.defaultPrevented||jo(j??document.body,{select:!0}),u.removeEventListener(c2,h),nF.remove(y)},0)}}},[u,f,h,y]);const w=v.useCallback(j=>{if(!n&&!r||y.paused)return;const b=j.key==="Tab"&&!j.altKey&&!j.ctrlKey&&!j.metaKey,C=document.activeElement;if(b&&C){const N=j.currentTarget,[k,T]=HAe(N);k&&T?!j.shiftKey&&C===T?(j.preventDefault(),n&&jo(k,{select:!0})):j.shiftKey&&C===k&&(j.preventDefault(),n&&jo(T,{select:!0})):C===N&&j.preventDefault()}},[n,r,y.paused]);return a.jsx(We.div,{tabIndex:-1,...l,ref:x,onKeyDown:w})});Gh.displayName=zAe;function UAe(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(jo(r,{select:t}),document.activeElement!==n)return}function HAe(e){const t=NH(e),n=tF(t,e),r=tF(t.reverse(),e);return[n,r]}function NH(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function tF(e,t){for(const n of e)if(!VAe(n,{upTo:t}))return n}function VAe(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function GAe(e){return e instanceof HTMLInputElement&&"select"in e}function jo(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&GAe(e)&&t&&e.select()}}var nF=KAe();function KAe(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=rF(e,t),e.unshift(t)},remove(t){e=rF(e,t),e[0]?.resume()}}}function rF(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function WAe(e){return e.filter(t=>t.tagName!=="A")}function vO(e){const t=v.useRef({value:e,previous:e});return v.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var YAe=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},ou=new WeakMap,Bx=new WeakMap,zx={},u2=0,SH=function(e){return e&&(e.host||SH(e.parentNode))},XAe=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=SH(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},QAe=function(e,t,n,r){var s=XAe(t,Array.isArray(e)?e:[e]);zx[n]||(zx[n]=new WeakMap);var i=zx[n],l=[],u=new Set,d=new Set(s),f=function(p){!p||u.has(p)||(u.add(p),f(p.parentNode))};s.forEach(f);var h=function(p){!p||d.has(p)||Array.prototype.forEach.call(p.children,function(x){if(u.has(x))h(x);else try{var y=x.getAttribute(r),w=y!==null&&y!=="false",j=(ou.get(x)||0)+1,b=(i.get(x)||0)+1;ou.set(x,j),i.set(x,b),l.push(x),j===1&&w&&Bx.set(x,!0),b===1&&x.setAttribute(n,"true"),w||x.setAttribute(r,"true")}catch(C){console.error("aria-hidden: cannot operate on ",x,C)}})};return h(t),u.clear(),u2++,function(){l.forEach(function(p){var x=ou.get(p)-1,y=i.get(p)-1;ou.set(p,x),i.set(p,y),x||(Bx.has(p)||p.removeAttribute(r),Bx.delete(p)),y||p.removeAttribute(n)}),u2--,u2||(ou=new WeakMap,ou=new WeakMap,Bx=new WeakMap,zx={})}},eb=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),s=YAe(e);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live], script"))),QAe(r,s,n,"aria-hidden")):function(){return null}},As=function(){return As=Object.assign||function(t){for(var n,r=1,s=arguments.length;r<s;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},As.apply(this,arguments)};function CH(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(n[r[s]]=e[r[s]]);return n}function ZAe(e,t,n){if(n||arguments.length===2)for(var r=0,s=t.length,i;r<s;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}var pg="right-scroll-bar-position",xg="width-before-scroll-bar",JAe="with-scroll-bars-hidden",eTe="--removed-body-scroll-bar-size";function d2(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function tTe(e,t){var n=v.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var s=n.value;s!==r&&(n.value=r,n.callback(r,s))}}}})[0];return n.callback=t,n.facade}var nTe=typeof window<"u"?v.useLayoutEffect:v.useEffect,aF=new WeakMap;function rTe(e,t){var n=tTe(null,function(r){return e.forEach(function(s){return d2(s,r)})});return nTe(function(){var r=aF.get(n);if(r){var s=new Set(r),i=new Set(e),l=n.current;s.forEach(function(u){i.has(u)||d2(u,null)}),i.forEach(function(u){s.has(u)||d2(u,l)})}aF.set(n,e)},[e]),n}function aTe(e){return e}function sTe(e,t){t===void 0&&(t=aTe);var n=[],r=!1,s={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(i){var l=t(i,r);return n.push(l),function(){n=n.filter(function(u){return u!==l})}},assignSyncMedium:function(i){for(r=!0;n.length;){var l=n;n=[],l.forEach(i)}n={push:function(u){return i(u)},filter:function(){return n}}},assignMedium:function(i){r=!0;var l=[];if(n.length){var u=n;n=[],u.forEach(i),l=n}var d=function(){var h=l;l=[],h.forEach(i)},f=function(){return Promise.resolve().then(d)};f(),n={push:function(h){l.push(h),f()},filter:function(h){return l=l.filter(h),n}}}};return s}function iTe(e){e===void 0&&(e={});var t=sTe(null);return t.options=As({async:!0,ssr:!1},e),t}var AH=function(e){var t=e.sideCar,n=CH(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return v.createElement(r,As({},n))};AH.isSideCarExport=!0;function oTe(e,t){return e.useMedium(t),AH}var TH=iTe(),f2=function(){},tb=v.forwardRef(function(e,t){var n=v.useRef(null),r=v.useState({onScrollCapture:f2,onWheelCapture:f2,onTouchMoveCapture:f2}),s=r[0],i=r[1],l=e.forwardProps,u=e.children,d=e.className,f=e.removeScrollBar,h=e.enabled,p=e.shards,x=e.sideCar,y=e.noRelative,w=e.noIsolation,j=e.inert,b=e.allowPinchZoom,C=e.as,N=C===void 0?"div":C,k=e.gapMode,T=CH(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),A=x,P=rTe([n,t]),E=As(As({},T),s);return v.createElement(v.Fragment,null,h&&v.createElement(A,{sideCar:TH,removeScrollBar:f,shards:p,noRelative:y,noIsolation:w,inert:j,setCallbacks:i,allowPinchZoom:!!b,lockRef:n,gapMode:k}),l?v.cloneElement(v.Children.only(u),As(As({},E),{ref:P})):v.createElement(N,As({},E,{className:d,ref:P}),u))});tb.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};tb.classNames={fullWidth:xg,zeroRight:pg};var lTe=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function cTe(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=lTe();return t&&e.setAttribute("nonce",t),e}function uTe(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function dTe(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var fTe=function(){var e=0,t=null;return{add:function(n){e==0&&(t=cTe())&&(uTe(t,n),dTe(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},mTe=function(){var e=fTe();return function(t,n){v.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},kH=function(){var e=mTe(),t=function(n){var r=n.styles,s=n.dynamic;return e(r,s),null};return t},hTe={left:0,top:0,right:0,gap:0},m2=function(e){return parseInt(e||"",10)||0},pTe=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],s=t[e==="padding"?"paddingRight":"marginRight"];return[m2(n),m2(r),m2(s)]},xTe=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return hTe;var t=pTe(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},gTe=kH(),_u="data-scroll-locked",yTe=function(e,t,n,r){var s=e.left,i=e.top,l=e.right,u=e.gap;return n===void 0&&(n="margin"),`
81  .`.concat(JAe,` {
82   overflow: hidden `).concat(r,`;
83   padding-right: `).concat(u,"px ").concat(r,`;
84  }
85  body[`).concat(_u,`] {
86    overflow: hidden `).concat(r,`;
87    overscroll-behavior: contain;
88    `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
89    padding-left: `.concat(s,`px;
90    padding-top: `).concat(i,`px;
91    padding-right: `).concat(l,`px;
92    margin-left:0;
93    margin-top:0;
94    margin-right: `).concat(u,"px ").concat(r,`;
95    `),n==="padding"&&"padding-right: ".concat(u,"px ").concat(r,";
95")].filter(Boolean).join(""),`
96  }
97  
98  .`).concat(pg,` {
99    right: `).concat(u,"px ").concat(r,`;
100  }
101  
102  .`).concat(xg,` {
103    margin-right: `).concat(u,"px ").concat(r,`;
104  }
105  
106  .`).concat(pg," .").concat(pg,` {
107    right: 0 `).concat(r,`;
108  }
109  
110  .`).concat(xg," .").concat(xg,` {
111    margin-right: 0 `).concat(r,`;
112  }
113  
114  body[`).concat(_u,`] {
115    `).concat(eTe,": ").concat(u,`px;
116  }
117`)},sF=function(){var e=parseInt(document.body.getAttribute(_u)||"0",10);return isFinite(e)?e:0},vTe=function(){v.useEffect(function(){return document.body.setAttribute(_u,(sF()+1).toString()),function(){var e=sF()-1;e<=0?document.body.removeAttribute(_u):document.body.setAttribute(_u,e.toString())}},[])},bTe=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,s=r===void 0?"margin":r;vTe();var i=v.useMemo(function(){return xTe(s)},[s]);return v.createElement(gTe,{styles:yTe(i,!t,s,n?"":"!important")})},qA=!1;if(typeof window<"u")try{var Ux=Object.defineProperty({},"passive",{get:function(){return qA=!0,!0}});window.addEventListener("test",Ux,Ux),window.removeEventListener("test",Ux,Ux)}catch{qA=!1}var lu=qA?{passive:!1}:!1,jTe=function(e){return e.tagName==="TEXTAREA"},OH=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!jTe(e)&&n[t]==="visible")},wTe=function(e){return OH(e,"overflowY")},NTe=function(e){return OH(e,"overflowX")},iF=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var s=PH(e,r);if(s){var i=EH(e,r),l=i[1],u=i[2];if(l>u)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},STe=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},CTe=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},PH=function(e,t){return e==="v"?wTe(t):NTe(t)},EH=function(e,t){return e==="v"?STe(t):CTe(t)},ATe=function(e,t){return e==="h"&&t==="rtl"?-1:1},TTe=function(e,t,n,r,s){var i=ATe(e,window.getComputedStyle(t).direction),l=i*r,u=n.target,d=t.contains(u),f=!1,h=l>0,p=0,x=0;do{if(!u)break;var y=EH(e,u),w=y[0],j=y[1],b=y[2],C=j-b-i*w;(w||C)&&PH(e,u)&&(p+=C,x+=w);var N=u.parentNode;u=N&&N.nodeType===Node.DOCUMENT_FRAGMENT_NODE?N.host:N}while(!d&&u!==document.body||d&&(t.contains(u)||t===u));return(h&&Math.abs(p)<1||!h&&Math.abs(x)<1)&&(f=!0),f},Hx=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},oF=function(e){return[e.deltaX,e.deltaY]},lF=function(e){return e&&"current"in e?e.current:e},kTe=function(e,t){return e[0]===t[0]&&e[1]===t[1]},OTe=function(e){return`
118  .block-interactivity-`.concat(e,` {pointer-events: none;}
119  .allow-interactivity-`).concat(e,` {pointer-events: all;}
120`)},PTe=0,cu=[];function ETe(e){var t=v.useRef([]),n=v.useRef([0,0]),r=v.useRef(),s=v.useState(PTe++)[0],i=v.useState(kH)[0],l=v.useRef(e);v.useEffect(function(){l.current=e},[e]),v.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var j=ZAe([e.lockRef.current],(e.shards||[]).map(lF),!0).filter(Boolean);return j.forEach(function(b){return b.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),j.forEach(function(b){return b.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var u=v.useCallback(function(j,b){if("touches"in j&&j.touches.length===2||j.type==="wheel"&&j.ctrlKey)return!l.current.allowPinchZoom;var C=Hx(j),N=n.current,k="deltaX"in j?j.deltaX:N[0]-C[0],T="deltaY"in j?j.deltaY:N[1]-C[1],A,P=j.target,E=Math.abs(k)>Math.abs(T)?"h":"v";if("touches"in j&&E==="h"&&P.type==="range")return!1;var _=window.getSelection(),R=_&&_.anchorNode,H=R?R===P||R.contains(P):!1;if(H)return!1;var L=iF(E,P);if(!L)return!0;if(L?A=E:(A=E==="v"?"h":"v",L=iF(E,P)),!L)return!1;if(!r.current&&"changedTouches"in j&&(k||T)&&(r.current=A),!A)return!0;var I=r.current||A;return TTe(I,b,j,I==="h"?k:T)},[]),d=v.useCallback(function(j){var b=j;if(!(!cu.length||cu[cu.length-1]!==i)){var C="deltaY"in b?oF(b):Hx(b),N=t.current.filter(function(A){return A.name===b.type&&(A.target===b.target||b.target===A.shadowParent)&&kTe(A.delta,C)})[0];if(N&&N.should){b.cancelable&&b.preventDefault();return}
vendor: 4,235 bytes, line 120
120if(!N){var k=(l.current.shards||[]).map(lF).filter(Boolean).filter(function(A){return A.contains(b.target)}),T=k.length>0?u(b,k[0]):!l.current.noIsolation;T&&b.cancelable&&b.preventDefault()}}},[]),f=v.useCallback(function(j,b,C,N){var k={name:j,delta:b,target:C,should:N,shadowParent:_Te(C)};t.current.push(k),setTimeout(function(){t.current=t.current.filter(function(T){return T!==k})},1)},[]),h=v.useCallback(function(j){n.current=Hx(j),r.current=void 0},[]),p=v.useCallback(function(j){f(j.type,oF(j),j.target,u(j,e.lockRef.current))},[]),x=v.useCallback(function(j){f(j.type,Hx(j),j.target,u(j,e.lockRef.current))},[]);v.useEffect(function(){return cu.push(i),e.setCallbacks({onScrollCapture:p,onWheelCapture:p,onTouchMoveCapture:x}),document.addEventListener("wheel",d,lu),document.addEventListener("touchmove",d,lu),document.addEventListener("touchstart",h,lu),function(){cu=cu.filter(function(j){return j!==i}),document.removeEventListener("wheel",d,lu),document.removeEventListener("touchmove",d,lu),document.removeEventListener("touchstart",h,lu)}},[]);var y=e.removeScrollBar,w=e.inert;return v.createElement(v.Fragment,null,w?v.createElement(i,{styles:OTe(s)}):null,y?v.createElement(bTe,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function _Te(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const MTe=oTe(TH,ETe);var Kh=v.forwardRef(function(e,t){return v.createElement(tb,As({},e,{ref:t,sideCar:MTe}))});Kh.classNames=tb.classNames;var RTe=[" ","Enter","ArrowUp","ArrowDown"],DTe=[" ","Enter"],Zl="Select",[nb,rb,$Te]=iv(Zl),[_d]=Sr(Zl,[$Te,zo]),ab=zo(),[ITe,Yo]=_d(Zl),[LTe,FTe]=_d(Zl),_H=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:s,onOpenChange:i,value:l,defaultValue:u,onValueChange:d,dir:f,name:h,autoComplete:p,disabled:x,required:y,form:w}=e,j=ab(t),[b,C]=v.useState(null),[N,k]=v.useState(null),[T,A]=v.useState(!1),P=Vh(f),[E,_]=Rs({prop:r,defaultProp:s??!1,onChange:i,caller:Zl}),[R,H]=Rs({prop:l,defaultProp:u,onChange:d,caller:Zl}),L=v.useRef(null),I=b?w||!!b.closest("form"):!0,[W,U]=v.useState(new Set),V=Array.from(W).map(D=>D.props.value).join(";");return a.jsx(AT,{...j,children:a.jsxs(ITe,{required:y,scope:t,trigger:b,onTriggerChange:C,valueNode:N,onValueNodeChange:k,valueNodeHasChildren:T,onValueNodeHasChildrenChange:A,contentId:tr(),value:R,onValueChange:H,open:E,onOpenChange:_,dir:P,triggerPointerDownPosRef:L,disabled:x,children:[a.jsx(nb.Provider,{scope:t,children:a.jsx(LTe,{scope:e.__scopeSelect,onNativeOptionAdd:v.useCallback(D=>{U(q=>new Set(q).add(D))},[]),onNativeOptionRemove:v.useCallback(D=>{U(q=>{const K=new Set(q);return K.delete(D),K})},[]),children:n})}),I?a.jsxs(nV,{"aria-hidden":!0,required:y,tabIndex:-1,name:h,autoComplete:p,value:R,onChange:D=>H(D.target.value),disabled:x,form:w,children:[R===void 0?a.jsx("option",{value:""}):null,Array.from(W)]},V):null]})})};_H.displayName=Zl;var MH="SelectTrigger",RH=v.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...s}=e,i=ab(n),l=Yo(MH,n),u=l.disabled||r,d=it(t,l.onTriggerChange),f=rb(n),h=v.useRef("touch"),[p,x,y]=aV(j=>{const b=f().filter(k=>!k.disabled),C=b.find(k=>k.value===l.value),N=sV(b,j,C);N!==void 0&&l.onValueChange(N.value)}),w=j=>{u||(l.onOpenChange(!0),y()),j&&(l.triggerPointerDownPosRef.current={x:Math.round(j.pageX),y:Math.round(j.pageY)})};return a.jsx(Th,{asChild:!0,...i,children:a.jsx(We.button,{type:"button",role:"combobox","aria-controls":l.contentId,"aria-expanded":l.open,"aria-required":l.required,"aria-autocomplete":"none",dir:l.dir,"data-state":l.open?"open":"closed",disabled:u,"data-disabled":u?"":void 0,"data-placeholder":rV(l.value)?"":void 0,...s,ref:d,onClick:Re(s.onClick,j=>{j.currentTarget.focus(),h.current!=="mouse"&&w(j)}),onPointerDown:Re(s.onPointerDown,j=>{h.current=j.pointerType;const b=j.target;b.hasPointerCapture(j.pointerId)&&b.releasePointerCapture(j.pointerId),j.button===0&&j.ctrlKey===!1&&j.pointerType==="mouse"&&(w(j),j.preventDefault())}),onKeyDown:Re(s.onKeyDown,j=>{const b=p.current!=="";!(j.ctrlKey||j.altKey||j.metaKey)&&j.key.length===1&&x(j.key),!(b&&j.key===" ")&&RTe.includes(j.key)&&(w(),j.preventDefault())})})})});RH.displayName=MH;var DH="SelectValue",$H=v.forwardRef((e,t)=>
vendor: 13,461 bytes, line 120
120{const{__scopeSelect:n,className:r,style:s,children:i,placeholder:l="",...u}=e,d=Yo(DH,n),{onValueNodeHasChildrenChange:f}=d,h=i!==void 0,p=it(t,d.onValueNodeChange);return Un(()=>{f(h)},[f,h]),a.jsx(We.span,{...u,ref:p,style:{pointerEvents:"none"},children:rV(d.value)?a.jsx(a.Fragment,{children:l}):i})});$H.displayName=DH;var qTe="SelectIcon",IH=v.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...s}=e;return a.jsx(We.span,{"aria-hidden":!0,...s,ref:t,children:r||"▼"})});IH.displayName=qTe;var BTe="SelectPortal",LH=e=>a.jsx(rc,{asChild:!0,...e});LH.displayName=BTe;var Jl="SelectContent",FH=v.forwardRef((e,t)=>{const n=Yo(Jl,e.__scopeSelect),[r,s]=v.useState();if(Un(()=>{s(new DocumentFragment)},[]),!n.open){const i=r;return i?pd.createPortal(a.jsx(qH,{scope:e.__scopeSelect,children:a.jsx(nb.Slot,{scope:e.__scopeSelect,children:a.jsx("div",{children:e.children})})}),i):null}return a.jsx(BH,{...e,ref:t})});FH.displayName=Jl;var Ya=10,[qH,Xo]=_d(Jl),zTe="SelectContentImpl",UTe=Ul("SelectContent.RemoveScroll"),BH=v.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:i,onPointerDownOutside:l,side:u,sideOffset:d,align:f,alignOffset:h,arrowPadding:p,collisionBoundary:x,collisionPadding:y,sticky:w,hideWhenDetached:j,avoidCollisions:b,...C}=e,N=Yo(Jl,n),[k,T]=v.useState(null),[A,P]=v.useState(null),E=it(t,ee=>T(ee)),[_,R]=v.useState(null),[H,L]=v.useState(null),I=rb(n),[W,U]=v.useState(!1),V=v.useRef(!1);v.useEffect(()=>{if(k)return eb(k)},[k]),Jv();const D=v.useCallback(ee=>{const[ve,...ue]=I().map(he=>he.ref.current),[de]=ue.slice(-1),Se=document.activeElement;for(const he of ee)if(he===Se||(he?.scrollIntoView({block:"nearest"}),he===ve&&A&&(A.scrollTop=0),he===de&&A&&(A.scrollTop=A.scrollHeight),he?.focus(),document.activeElement!==Se))return},[I,A]),q=v.useCallback(()=>D([_,k]),[D,_,k]);v.useEffect(()=>{W&&q()},[W,q]);const{onOpenChange:K,triggerPointerDownPosRef:Y}=N;v.useEffect(()=>{if(k){let ee={x:0,y:0};const ve=de=>{ee={x:Math.abs(Math.round(de.pageX)-(Y.current?.x??0)),y:Math.abs(Math.round(de.pageY)-(Y.current?.y??0))}},ue=de=>{ee.x<=10&&ee.y<=10?de.preventDefault():k.contains(de.target)||K(!1),document.removeEventListener("pointermove",ve),Y.current=null};return Y.current!==null&&(document.addEventListener("pointermove",ve),document.addEventListener("pointerup",ue,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ve),document.removeEventListener("pointerup",ue,{capture:!0})}}},[k,K,Y]),v.useEffect(()=>{const ee=()=>K(!1);return window.addEventListener("blur",ee),window.addEventListener("resize",ee),()=>{window.removeEventListener("blur",ee),window.removeEventListener("resize",ee)}},[K]);const[z,Z]=aV(ee=>{const ve=I().filter(Se=>!Se.disabled),ue=ve.find(Se=>Se.ref.current===document.activeElement),de=sV(ve,ee,ue);de&&setTimeout(()=>de.ref.current.focus())}),F=v.useCallback((ee,ve,ue)=>{const de=!V.current&&!ue;(N.value!==void 0&&N.value===ve||de)&&(R(ee),de&&(V.current=!0))},[N.value]),B=v.useCallback(()=>k?.focus(),[k]),X=v.useCallback((ee,ve,ue)=>{const de=!V.current&&!ue;(N.value!==void 0&&N.value===ve||de)&&L(ee)},[N.value]),Q=r==="popper"?BA:zH,se=Q===BA?{side:u,sideOffset:d,align:f,alignOffset:h,arrowPadding:p,collisionBoundary:x,collisionPadding:y,sticky:w,hideWhenDetached:j,avoidCollisions:b}:{};return a.jsx(qH,{scope:n,content:k,viewport:A,onViewportChange:P,itemRefCallback:F,selectedItem:_,onItemLeave:B,itemTextRefCallback:X,focusSelectedItem:q,selectedItemText:H,position:r,isPositioned:W,searchRef:z,children:a.jsx(Kh,{as:UTe,allowPinchZoom:!0,children:a.jsx(Gh,{asChild:!0,trapped:N.open,onMountAutoFocus:ee=>{ee.preventDefault()},onUnmountAutoFocus:Re(s,ee=>{N.trigger?.focus({preventScroll:!0}),ee.preventDefault()}),children:a.jsx(nc,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:l,onFocusOutside:ee=>ee.preventDefault(),onDismiss:()=>N.onOpenChange(!1),children:a.jsx(Q,{role:"listbox",id:N.contentId,"data-state":N.open?"open":"closed",dir:N.dir,onContextMenu:ee=>ee.preventDefault(),...C,...se,onPlaced:()=>U(!0),ref:E,style:{display:"flex",flexDirection:"column",outline:"none",...C.style},onKeyDown:Re(C.onKeyDown,ee=>{const ve=ee.ctrlKey||ee.altKey||ee.metaKey;if(ee.key==="Tab"&&ee.preventDefault(),!ve&&ee.key.length===1&&Z(ee.key),["ArrowUp","ArrowDown","Home","End"].includes(ee.key)){let de=I().filter(Se=>!Se.disabled).map(Se=>Se.ref.current);if(["ArrowUp","End"].includes(ee.key)&&(de=de.slice().reverse()),["ArrowUp","ArrowDown"].includes(ee.key)){const Se=ee.target,he=de.indexOf(Se);de=de.slice(he+1)}setTimeout(()=>D(de)),ee.preventDefault()}})})})})})})});BH.displayName=zTe;var HTe="SelectItemAlignedPosition",zH=v.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...s}=e,i=Yo(Jl,n),l=Xo(Jl,n),[u,d]=v.useState(null),[f,h]=v.useState(null),p=it(t,E=>h(E)),x=rb(n),y=v.useRef(!1),w=v.useRef(!0),{viewport:j,selectedItem:b,selectedItemText:C,focusSelectedItem:N}=l,k=v.useCallback(()=>{if(i.trigger&&i.valueNode&&u&&f&&j&&b&&C){const E=i.trigger.getBoundingClientRect(),_=f.getBoundingClientRect(),R=i.valueNode.getBoundingClientRect(),H=C.getBoundingClientRect();if(i.dir!=="rtl"){const Se=H.left-_.left,he=R.left-Se,ce=E.left-he,te=E.width+ce,_e=Math.max(te,_.width),Oe=window.innerWidth-Ya,Te=FA(he,[Ya,Math.max(Ya,Oe-_e)]);u.style.minWidth=te+"px",u.style.left=Te+"px"}else{const Se=_.right-H.right,he=window.innerWidth-R.right-Se,ce=window.innerWidth-E.right-he,te=E.width+ce,_e=Math.max(te,_.width),Oe=window.innerWidth-Ya,Te=FA(he,[Ya,Math.max(Ya,Oe-_e)]);u.style.minWidth=te+"px",u.style.right=Te+"px"}const L=x(),I=window.innerHeight-Ya*2,W=j.scrollHeight,U=window.getComputedStyle(f),V=parseInt(U.borderTopWidth,10),D=parseInt(U.paddingTop,10),q=parseInt(U.borderBottomWidth,10),K=parseInt(U.paddingBottom,10),Y=V+D+W+K+q,z=Math.min(b.offsetHeight*5,Y),Z=window.getComputedStyle(j),F=parseInt(Z.paddingTop,10),B=parseInt(Z.paddingBottom,10),X=E.top+E.height/2-Ya,Q=I-X,se=b.offsetHeight/2,ee=b.offsetTop+se,ve=V+D+ee,ue=Y-ve;if(ve<=X){const Se=L.length>0&&b===L[L.length-1].ref.current;u.style.bottom="0px";const he=f.clientHeight-j.offsetTop-j.offsetHeight,ce=Math.max(Q,se+(Se?B:0)+he+q),te=ve+ce;u.style.height=te+"px"}else{const Se=L.length>0&&b===L[0].ref.current;u.style.top="0px";const ce=Math.max(X,V+j.offsetTop+(Se?F:0)+se)+ue;u.style.height=ce+"px",j.scrollTop=ve-X+j.offsetTop}u.style.margin=`${Ya}px 0`,u.style.minHeight=z+"px",u.style.maxHeight=I+"px",r?.(),requestAnimationFrame(()=>y.current=!0)}},[x,i.trigger,i.valueNode,u,f,j,b,C,i.dir,r]);Un(()=>k(),[k]);const[T,A]=v.useState();Un(()=>{f&&A(window.getComputedStyle(f).zIndex)},[f]);const P=v.useCallback(E=>{E&&w.current===!0&&(k(),N?.(),w.current=!1)},[k,N]);return a.jsx(GTe,{scope:n,contentWrapper:u,shouldExpandOnScrollRef:y,onScrollButtonChange:P,children:a.jsx("div",{ref:d,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:T},children:a.jsx(We.div,{...s,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});zH.displayName=HTe;var VTe="SelectPopperPosition",BA=v.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:s=Ya,...i}=e,l=ab(n);return a.jsx(hv,{...l,...i,ref:t,align:r,collisionPadding:s,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});BA.displayName=VTe;var[GTe,bO]=_d(Jl,{}),zA="SelectViewport",UH=v.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...s}=e,i=Xo(zA,n),l=bO(zA,n),u=it(t,i.onViewportChange),d=v.useRef(0);return a.jsxs(a.Fragment,{children:[a.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),a.jsx(nb.Slot,{scope:n,children:a.jsx(We.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:u,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:Re(s.onScroll,f=>{const h=f.currentTarget,{contentWrapper:p,shouldExpandOnScrollRef:x}=l;if(x?.current&&p){const y=Math.abs(d.current-h.scrollTop);if(y>0){const w=window.innerHeight-Ya*2,j=parseFloat(p.style.minHeight),b=parseFloat(p.style.height),C=Math.max(j,b);if(C<w){const N=C+y,k=Math.min(w,N),T=N-k;p.style.height=k+"px",p.style.bottom==="0px"&&(h.scrollTop=T>0?T:0,p.style.justifyContent="flex-end")}}}d.current=h.scrollTop})})})]})});UH.displayName=zA;var HH="SelectGroup",[KTe,WTe]=_d(HH),YTe=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=tr();return a.jsx(KTe,{scope:n,id:s,children:a.jsx(We.div,{role:"group","aria-labelledby":s,...r,ref:t})})});YTe.displayName=HH;var VH="SelectLabel",GH=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=WTe(VH,n);return a.jsx(We.div,{id:s.id,...r,ref:t})});GH.displayName=VH;var Ky="SelectItem",[XTe,KH]=_d(Ky),WH=v.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:s=!1,textValue:i,...l}=e,u=Yo(Ky,n),d=Xo(Ky,n),f=u.value===r,[h,p]=v.useState(i??""),[x,y]=v.useState(!1),w=it(t,N=>d.itemRefCallback?.(N,r,s)),j=tr(),b=v.useRef("touch"),C=()=>{s||(u.onValueChange(r),u.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return a.jsx(XTe,{scope:n,value:r,disabled:s,textId:j,isSelected:f,onItemTextChange:v.useCallback(N=>{p(k=>k||(N?.textContent??"").trim())},[]),children:a.jsx(nb.ItemSlot,{scope:n,value:r,disabled:s,textValue:h,children:a.jsx(We.div,{role:"option","aria-labelledby":j,"data-highlighted":x?"":void 0,"aria-selected":f&&x,"data-state":f?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...l,ref:w,onFocus:Re(l.onFocus,()=>y(!0)),onBlur:Re(l.onBlur,()=>y(!1)),onClick:Re(l.onClick,()=>{b.current!=="mouse"&&C()}),onPointerUp:Re(l.onPointerUp,()=>{b.current==="mouse"&&C()}),onPointerDown:Re(l.onPointerDown,N=>{b.current=N.pointerType}),onPointerMove:Re(l.onPointerMove,N=>{b.current=N.pointerType,s?d.onItemLeave?.():b.current==="mouse"&&N.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Re(l.onPointerLeave,N=>{N.currentTarget===document.activeElement&&d.onItemLeave?.()}),onKeyDown:Re(l.onKeyDown,N=>{d.searchRef?.current!==""&&N.key===" "||(DTe.includes(N.key)&&C(),N.key===" "&&N.preventDefault())})})})})});WH.displayName=Ky;var cm="SelectItemText",YH=v.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,...i}=e,l=Yo(cm,n),u=Xo(cm,n),d=KH(cm,n),f=FTe(cm,n),[h,p]=v.useState(null),x=it(t,C=>p(C),d.onItemTextChange,C=>u.itemTextRefCallback?.(C,d.value,d.disabled)),y=h?.textContent,w=v.useMemo(()=>a.jsx("option",{value:d.value,disabled:d.disabled,children:y},d.value),[d.disabled,d.value,y]),{onNativeOptionAdd:j,onNativeOptionRemove:b}=f;return Un(()=>(j(w),()=>b(w)),[j,b,w]),a.jsxs(a.Fragment,{children:[a.jsx(We.span,{id:d.textId,...i,ref:x}),d.isSelected&&l.valueNode&&!l.valueNodeHasChildren?pd.createPortal(i.children,l.valueNode):null]})});YH.displayName=cm;var XH="SelectItemIndicator",QH=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return KH(XH,n).isSelected?a.jsx(We.span,{"aria-hidden":!0,...r,ref:t}):null});QH.displayName=XH;var UA="SelectScrollUpButton",ZH=v.forwardRef((e,t)=>{const n=Xo(UA,e.__scopeSelect),r=bO(UA,e.__scopeSelect),[s,i]=v.useState(!1),l=it(t,r.onScrollButtonChange);return Un(()=>{if(n.viewport&&n.isPositioned){let u=function(){const f=d.scrollTop>0;i(f)};const d=n.viewport;return u(),d.addEventListener("scroll",u),()=>d.removeEventListener("scroll",u)}},[n.viewport,n.isPositioned]),s?a.jsx(eV,{...e,ref:l,onAutoScroll:()=>{const{viewport:u,selectedItem:d}=n;u&&d&&(u.scrollTop=u.scrollTop-d.offsetHeight)}}):null});ZH.displayName=UA;var HA="SelectScrollDownButton",JH=v.forwardRef((e,t)=>{const n=Xo(HA,e.__scopeSelect),r=bO(HA,e.__scopeSelect),[s,i]=v.useState(!1),l=it(t,r.onScrollButtonChange);return Un(()=>{if(n.viewport&&n.isPositioned){let u=function(){const f=d.scrollHeight-d.clientHeight,h=Math.ceil(d.scrollTop)<f;i(h)};const d=n.viewport;return u(),d.addEventListener("scroll",u),()=>d.removeEventListener("scroll",u)}},[n.viewport,n.isPositioned]),s?a.jsx(eV,{...e,ref:l,onAutoScroll:()=>{const{viewport:u,selectedItem:d}=n;u&&d&&(u.scrollTop=u.scrollTop+d.offsetHeight)}}):null});JH.displayName=HA;var eV=v.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...s}=e,i=Xo("SelectScrollButton",n),l=v.useRef(null),u=rb(n),d=v.useCallback(()=>{l.current!==null&&(window.clearInterval(l.current),l.current=null)},[]);return v.useEffect(()=>()=>d(),[d]),Un(()=>{u().find(h=>h.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[u]),a.jsx(We.div,{"aria-hidden":!0,...s,ref:t,style:{flexShrink:0,...s.style},onPointerDown:Re(s.onPointerDown,()=>{l.current===null&&(l.current=window.setInterval(r,50))}),onPointerMove:Re(s.onPointerMove,()=>{i.onItemLeave?.(),l.current===null&&(l.current=window.setInterval(r,50))}),onPointerLeave:Re(s.onPointerLeave,()=>{d()})})}),QTe="SelectSeparator",tV=v.forwardRef((e,t)=>
120{const{__scopeSelect:n,...r}=e;return a.jsx(We.div,{"aria-hidden":!0,...r,ref:t})});tV.displayName=QTe;var VA="SelectArrow",ZTe=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=ab(n),i=Yo(VA,n),l=Xo(VA,n);return i.open&&l.position==="popper"?a.jsx(pv,{...s,...r,ref:t}):null});ZTe.displayName=VA;var JTe="SelectBubbleInput",nV=v.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const s=v.useRef(null),i=it(r,s),l=vO(t);return v.useEffect(()=>{const u=s.current;if(!u)return;const d=window.HTMLSelectElement.prototype,h=Object.getOwnPropertyDescriptor(d,"value").set;if(l!==t&&h){const p=new Event("change",{bubbles:!0});h.call(u,t),u.dispatchEvent(p)}},[l,t]),a.jsx(We.select,{...n,style:{...mq,...n.style},ref:i,defaultValue:t})});nV.displayName=JTe;function rV(e){return e===""||e===void 0}function aV(e){const t=hn(e),n=v.useRef(""),r=v.useRef(0),s=v.useCallback(l=>{const u=n.current+l;t(u),(function d(f){n.current=f,window.clearTimeout(r.current),f!==""&&(r.current=window.setTimeout(()=>d(""),1e3))})(u)},[t]),i=v.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return v.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,s,i]}function sV(e,t,n){const s=t.length>1&&Array.from(t).every(f=>f===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let l=eke(e,Math.max(i,0));s.length===1&&(l=l.filter(f=>f!==n));const d=l.find(f=>f.textValue.toLowerCase().startsWith(s.toLowerCase()));return d!==n?d:void 0}function eke(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var tke=_H,iV=RH,nke=$H,rke=IH,ake=LH,oV=FH,ske=UH,lV=GH,cV=WH,ike=YH,oke=QH,uV=ZH,dV=JH,fV=tV;const Sa=tke,Ca=nke,ra=v.forwardRef(({className:e,children:t,...n},r)=>a.jsxs(iV,{ref:r,className:qe("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[t,a.jsx(rke,{asChild:!0,children:a.jsx(Nr,{className:"h-4 w-4 opacity-50"})})]}));ra.displayName=iV.displayName;const mV=v.forwardRef(({className:e,...t},n)=>a.jsx(uV,{ref:n,className:qe("flex cursor-default items-center justify-center py-1",e),...t,children:a.jsx(Sh,{className:"h-4 w-4"})}));mV.displayName=uV.displayName;const hV=v.forwardRef(({className:e,...t},n)=>a.jsx(dV,{ref:n,className:qe("flex cursor-default items-center justify-center py-1",e),...t,children:a.jsx(Nr,{className:"h-4 w-4"})}));hV.displayName=dV.displayName;const aa=v.forwardRef(({className:e,children:t,position:n="popper",...r},s)=>a.jsx(ake,{children:a.jsxs(oV,{ref:s,className:qe("relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-select-content-transform-origin]",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...r,children:[a.jsx(mV,{}),a.jsx(ske,{className:qe("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),a.jsx(hV,{})]})}));aa.displayName=oV.displayName;const lke=v.forwardRef(({className:e,...t},n)=>a.jsx(lV,{ref:n,className:qe("px-2 py-1.5 text-sm font-semibold",e),...t}));lke.displayName=lV.displayName;const Qn=v.forwardRef(({className:e,children:t,...n},r)=>a.jsxs(cV,{ref:r,className:qe("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[a.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(oke,{children:a.jsx(ac,{className:"h-4 w-4"})})}),a.jsx(ike,{children:t})]}));Qn.displayName=cV.displayName;const cke=v.forwardRef(({className:e,...t},n)=>a.jsx(fV,{ref:n,className:qe("-mx-1 my-1 h-px bg-muted",e),...t}));cke.displayName=fV.displayName;var sb="Switch",[uke]=Sr(sb),[dke,fke]=uke(sb),pV=v.forwardRef((e,t)=>
vendor: 8,290 bytes, lines 120-124
120{const{__scopeSwitch:n,name:r,checked:s,defaultChecked:i,required:l,disabled:u,value:d="on",onCheckedChange:f,form:h,...p}=e,[x,y]=v.useState(null),w=it(t,k=>y(k)),j=v.useRef(!1),b=x?h||!!x.closest("form"):!0,[C,N]=Rs({prop:s,defaultProp:i??!1,onChange:f,caller:sb});return a.jsxs(dke,{scope:n,checked:C,disabled:u,children:[a.jsx(We.button,{type:"button",role:"switch","aria-checked":C,"aria-required":l,"data-state":vV(C),"data-disabled":u?"":void 0,disabled:u,value:d,...p,ref:w,onClick:Re(e.onClick,k=>{N(T=>!T),b&&(j.current=k.isPropagationStopped(),j.current||k.stopPropagation())})}),b&&a.jsx(yV,{control:x,bubbles:!j.current,name:r,value:d,checked:C,required:l,disabled:u,form:h,style:{transform:"translateX(-100%)"}})]})});pV.displayName=sb;var xV="SwitchThumb",gV=v.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,s=fke(xV,n);return a.jsx(We.span,{"data-state":vV(s.checked),"data-disabled":s.disabled?"":void 0,...r,ref:t})});gV.displayName=xV;var mke="SwitchBubbleInput",yV=v.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...s},i)=>{const l=v.useRef(null),u=it(l,i),d=vO(n),f=NT(t);return v.useEffect(()=>{const h=l.current;if(!h)return;const p=window.HTMLInputElement.prototype,y=Object.getOwnPropertyDescriptor(p,"checked").set;if(d!==n&&y){const w=new Event("click",{bubbles:r});y.call(h,n),h.dispatchEvent(w)}},[d,n,r]),a.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...s,tabIndex:-1,ref:u,style:{...s.style,...f,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});yV.displayName=mke;function vV(e){return e?"checked":"unchecked"}var bV=pV,hke=gV;const jV=v.forwardRef(({className:e,...t},n)=>a.jsx(bV,{className:qe("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,ref:n,children:a.jsx(hke,{className:qe("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));jV.displayName=bV.displayName;var ib="Dialog",[wV,NV]=Sr(ib),[pke,us]=wV(ib),SV=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:s,onOpenChange:i,modal:l=!0}=e,u=v.useRef(null),d=v.useRef(null),[f,h]=Rs({prop:r,defaultProp:s??!1,onChange:i,caller:ib});return a.jsx(pke,{scope:t,triggerRef:u,contentRef:d,contentId:tr(),titleId:tr(),descriptionId:tr(),open:f,onOpenChange:h,onOpenToggle:v.useCallback(()=>h(p=>!p),[h]),modal:l,children:n})};SV.displayName=ib;var CV="DialogTrigger",AV=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=us(CV,n),i=it(t,s.triggerRef);return a.jsx(We.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":NO(s.open),...r,ref:i,onClick:Re(e.onClick,s.onOpenToggle)})});AV.displayName=CV;var jO="DialogPortal",[xke,TV]=wV(jO,{forceMount:void 0}),kV=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:s}=e,i=us(jO,t);return a.jsx(xke,{scope:t,forceMount:n,children:v.Children.map(r,l=>a.jsx(Rn,{present:n||i.open,children:a.jsx(rc,{asChild:!0,container:s,children:l})}))})};kV.displayName=jO;var Wy="DialogOverlay",OV=v.forwardRef((e,t)=>{const n=TV(Wy,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,i=us(Wy,e.__scopeDialog);return i.modal?a.jsx(Rn,{present:r||i.open,children:a.jsx(yke,{...s,ref:t})}):null});OV.displayName=Wy;var gke=Ul("DialogOverlay.RemoveScroll"),yke=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=us(Wy,n);return a.jsx(Kh,{as:gke,allowPinchZoom:!0,shards:[s.contentRef],children:a.jsx(We.div,{"data-state":NO(s.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),ec="DialogContent",PV=v.forwardRef((e,t)=>{const n=TV(ec,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,i=us(ec,e.__scopeDialog);return a.jsx(Rn,{present:r||i.open,children:i.modal?a.jsx(vke,{...s,ref:t}):a.jsx(bke,{...s,ref:t})})});PV.displayName=ec;var vke=v.forwardRef((e,t)=>{const n=us(ec,e.__scopeDialog),r=v.useRef(null),s=it(t,n.contentRef,r);return v.useEffect(()=>{const i=r.current;if(i)return eb(i)},[]),a.jsx(EV,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Re(e.onCloseAutoFocus,i=>{i.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:Re(e.onPointerDownOutside,i=>{const l=i.detail.originalEvent,u=l.button===0&&l.ctrlKey===!0;(l.button===2||u)&&i.preventDefault()}),onFocusOutside:Re(e.onFocusOutside,i=>i.preventDefault())})}),bke=v.forwardRef((e,t)=>{const n=us(ec,e.__scopeDialog),r=v.useRef(!1),s=v.useRef(!1);return a.jsx(EV,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{e.onCloseAutoFocus?.(i),i.defaultPrevented||(r.current||n.triggerRef.current?.focus(),i.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:i=>{e.onInteractOutside?.(i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const l=i.target;n.triggerRef.current?.contains(l)&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&s.current&&i.preventDefault()}})}),EV=v.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,...l}=e,u=us(ec,n),d=v.useRef(null),f=it(t,d);return Jv(),a.jsxs(a.Fragment,{children:[a.jsx(Gh,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:i,children:a.jsx(nc,{role:"dialog",id:u.contentId,"aria-describedby":u.descriptionId,"aria-labelledby":u.titleId,"data-state":NO(u.open),...l,ref:f,onDismiss:()=>u.onOpenChange(!1)})}),a.jsxs(a.Fragment,{children:[a.jsx(wke,{titleId:u.titleId}),a.jsx(Ske,{contentRef:d,descriptionId:u.descriptionId})]})]})}),wO="DialogTitle",_V=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=us(wO,n);return a.jsx(We.h2,{id:s.titleId,...r,ref:t})});_V.displayName=wO;var MV="DialogDescription",RV=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=us(MV,n);return a.jsx(We.p,{id:s.descriptionId,...r,ref:t})});RV.displayName=MV;var DV="DialogClose",$V=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=us(DV,n);return a.jsx(We.button,{type:"button",...r,ref:t,onClick:Re(e.onClick,()=>s.onOpenChange(!1))})});$V.displayName=DV;function NO(e){return e?"open":"closed"}var IV="DialogTitleWarning",[jke,LV]=UQ(IV,{contentName:ec,titleName:wO,docsSlug:"dialog"}),wke=({titleId:e})=>{const t=LV(IV),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
121
122If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
123
124For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return v.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Nke="DialogDescriptionWarning",Ske=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${LV(Nke).contentName}}.`;return v.useEffect(()=>{const s=e.current?.getAttribute("aria-describedby");t&&s&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},SO=SV,Cke=AV,CO=kV,ob=OV,lb=PV,AO=_V,TO=RV,kO=$V;const xh=SO,Ake=CO,FV=v.forwardRef(({className:e,...t},n)=>a.jsx(ob,{ref:n,className:qe("fixed inset-0 z-50 bg-black/80  data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));FV.displayName=ob.displayName;const ud=v.forwardRef(({className:e,children:t,...n},r)=>a.jsxs(Ake,{children:[a.jsx(FV,{}),a.jsxs(lb,{ref:r,className:qe("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...n,children:[t,a.jsxs(kO,{className:"absolute right-4 top-4 roun
124ded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[a.jsx(an,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));ud.displayName=lb.displayName;const gh=({className:e,...t})=>a.jsx("div",{className:qe("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});gh.displayName="DialogHeader";const OO=({className:e,...t})=>a.jsx("div",{className:qe("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});OO.displayName="DialogFooter";const dd=v.forwardRef(({className:e,...t},n)=>a.jsx(AO,{ref:n,className:qe("text-lg font-semibold leading-none tracking-tight",e),...t}));dd.displayName=AO.displayName;const Tke=v.forwardRef(({className:e,...t},n)=>a.jsx(TO,{ref:n,className:qe("text-sm text-muted-foreground",e),...t}));Tke.displayName=TO.displayName;var h2="rovingFocusGroup.onEntryFocus",kke={bubbles:!1,cancelable:!0},Wh="RovingFocusGroup",[GA,qV,Oke]=iv(Wh),[Pke,cb]=Sr(Wh,[Oke]),[Eke,_ke]=Pke(Wh),BV=v.forwardRef((e,t)=>a.jsx(GA.Provider,{scope:e.__scopeRovingFocusGroup,children:a.jsx(GA.Slot,{scope:e.__scopeRovingFocusGroup,children:a.jsx(Mke,{...e,ref:t})})}));BV.displayName=Wh;var Mke=v.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:s=!1,dir:i,currentTabStopId:l,defaultCurrentTabStopId:u,onCurrentTabStopIdChange:d,onEntryFocus:f,preventScrollOnEntryFocus:h=!1,...p}=e,x=v.useRef(null),y=it(t,x),w=Vh(i),[j,b]=Rs({prop:l,defaultProp:u??null,onChange:d,caller:Wh}),[C,N]=v.useState(!1),k=hn(f),T=qV(n),A=v.useRef(!1),[P,E]=v.useState(0);return v.useEffect(()=>{const _=x.current;if(_)return _.addEventListener(h2,k),()=>_.removeEventListener(h2,k)},[k]),a.jsx(Eke,{scope:n,orientation:r,dir:w,loop:s,currentTabStopId:j,onItemFocus:v.useCallback(_=>b(_),[b]),onItemShiftTab:v.useCallback(()=>N(!0),[]),onFocusableItemAdd:v.useCallback(()=>E(_=>_+1),[]),onFocusableItemRemove:v.useCallback(()=>E(_=>_-1),[]),children:a.jsx(We.div,{tabIndex:C||P===0?-1:0,"data-orientation":r,...p,ref:y,style:{outline:"none",...e.style},onMouseDown:Re(e.onMouseDown,()=>{A.current=!0}),onFocus:Re(e.onFocus,_=>{const R=!A.current;if(_.target===_.currentTarget&&R&&!C){const H=new CustomEvent(h2,kke);if(_.currentTarget.dispatchEvent(H),!H.defaultPrevented){const L=T().filter(D=>D.focusable),I=L.find(D=>D.active),W=L.find(D=>D.id===j),V=[I,W,...L].filter(Boolean).map(D=>D.ref.current);HV(V,h)}}A.current=!1}),onBlur:Re(e.onBlur,()=>N(!1))})})}),zV="RovingFocusGroupItem",UV=v.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:s=!1,tabStopId:i,children:l,...u}=e,d=tr(),f=i||d,h=_ke(zV,n),p=h.currentTabStopId===f,x=qV(n),{onFocusableItemAdd:y,onFocusableItemRemove:w,currentTabStopId:j}=h;return v.useEffect(()=>{if(r)return y(),()=>w()},[r,y,w]),a.jsx(GA.ItemSlot,{scope:n,id:f,focusable:r,active:s,children:a.jsx(We.span,{tabIndex:p?0:-1,"data-orientation":h.orientation,...u,ref:t,onMouseDown:Re(e.onMouseDown,b=>{r?h.onItemFocus(f):b.preventDefault()}),onFocus:Re(e.onFocus,()=>h.onItemFocus(f)),onKeyDown:Re(e.onKeyDown,b=>{if(b.key==="Tab"&&b.shiftKey){h.onItemShiftTab();return}if(b.target!==b.currentTarget)return;const C=$ke(b,h.orientation,h.dir);if(C!==void 0){if(b.metaKey||b.ctrlKey||b.altKey||b.shiftKey)return;b.preventDefault();let k=x().filter(T=>T.focusable).map(T=>T.ref.current);if(C==="last")k.reverse();else if(C==="prev"||C==="next"){C==="prev"&&k.reverse();const T=k.indexOf(b.currentTarget);k=h.loop?Ike(k,T+1):k.slice(T+1)}setTimeout(()=>HV(k))}}),children:typeof l=="function"?l({isCurrentTabStop:p,hasTabStop:j!=null}):l})})});UV.displayName=zV;var Rke={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Dke(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function $ke(e,t,n){const r=Dke(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return Rke[r]}function HV(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Ike(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var VV=BV,GV=UV,KA=["Enter"," "],Lke=["ArrowDown","PageUp","Home"],KV=["ArrowUp","PageDown","End"],Fke=[...Lke,...KV],qke={ltr:[...KA,"ArrowRight"],rtl:[...KA,"ArrowLeft"]},Bke={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Yh="Menu",[yh,zke,Uke]=iv(Yh),[fc,WV]=Sr(Yh,[Uke,zo,cb]),ub=zo(),YV=cb(),[Hke,mc]=fc(Yh),[Vke,Xh]=fc(Yh),XV=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:s,onOpenChange:i,modal:l=!0}=e,u=ub(t),[d,f]=v.useState(null),h=v.useRef(!1),p=hn(i),x=Vh(s);return v.useEffect(()=>{const y=()=>{h.current=!0,document.addEventListener("pointerdown",w,{capture:!0,once:!0}),document.addEventListener("pointermove",w,{capture:!0,once:!0})},w=()=>h.current=!1;return document.addEventListener("keydown",y,{capture:!0}),()=>{document.removeEventListener("keydown",y,{capture:!0}),document.removeEventListener("pointerdown",w,{capture:!0}),document.removeEventListener("pointermove",w,{capture:!0})}},[]),a.jsx(AT,{...u,children:a.jsx(Hke,{scope:t,open:n,onOpenChange:p,content:d,onContentChange:f,children:a.jsx(Vke,{scope:t,onClose:v.useCallback(()=>p(!1),[p]),isUsingKeyboardRef:h,dir:x,modal:l,children:r})})})};XV.displayName=Yh;var Gke="MenuAnchor",PO=v.forwardRef((e,t)=>
vendor: 13,523 bytes, line 124
124{const{__scopeMenu:n,...r}=e,s=ub(n);return a.jsx(Th,{...s,...r,ref:t})});PO.displayName=Gke;var EO="MenuPortal",[Kke,QV]=fc(EO,{forceMount:void 0}),ZV=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:s}=e,i=mc(EO,t);return a.jsx(Kke,{scope:t,forceMount:n,children:a.jsx(Rn,{present:n||i.open,children:a.jsx(rc,{asChild:!0,container:s,children:r})})})};ZV.displayName=EO;var _a="MenuContent",[Wke,_O]=fc(_a),JV=v.forwardRef((e,t)=>{const n=QV(_a,e.__scopeMenu),{forceMount:r=n.forceMount,...s}=e,i=mc(_a,e.__scopeMenu),l=Xh(_a,e.__scopeMenu);return a.jsx(yh.Provider,{scope:e.__scopeMenu,children:a.jsx(Rn,{present:r||i.open,children:a.jsx(yh.Slot,{scope:e.__scopeMenu,children:l.modal?a.jsx(Yke,{...s,ref:t}):a.jsx(Xke,{...s,ref:t})})})})}),Yke=v.forwardRef((e,t)=>{const n=mc(_a,e.__scopeMenu),r=v.useRef(null),s=it(t,r);return v.useEffect(()=>{const i=r.current;if(i)return eb(i)},[]),a.jsx(MO,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Re(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Xke=v.forwardRef((e,t)=>{const n=mc(_a,e.__scopeMenu);return a.jsx(MO,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Qke=Ul("MenuContent.ScrollLock"),MO=v.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:s,onOpenAutoFocus:i,onCloseAutoFocus:l,disableOutsidePointerEvents:u,onEntryFocus:d,onEscapeKeyDown:f,onPointerDownOutside:h,onFocusOutside:p,onInteractOutside:x,onDismiss:y,disableOutsideScroll:w,...j}=e,b=mc(_a,n),C=Xh(_a,n),N=ub(n),k=YV(n),T=zke(n),[A,P]=v.useState(null),E=v.useRef(null),_=it(t,E,b.onContentChange),R=v.useRef(0),H=v.useRef(""),L=v.useRef(0),I=v.useRef(null),W=v.useRef("right"),U=v.useRef(0),V=w?Kh:v.Fragment,D=w?{as:Qke,allowPinchZoom:!0}:void 0,q=Y=>{const z=H.current+Y,Z=T().filter(ee=>!ee.disabled),F=document.activeElement,B=Z.find(ee=>ee.ref.current===F)?.textValue,X=Z.map(ee=>ee.textValue),Q=cOe(X,z,B),se=Z.find(ee=>ee.textValue===Q)?.ref.current;(function ee(ve){H.current=ve,window.clearTimeout(R.current),ve!==""&&(R.current=window.setTimeout(()=>ee(""),1e3))})(z),se&&setTimeout(()=>se.focus())};v.useEffect(()=>()=>window.clearTimeout(R.current),[]),Jv();const K=v.useCallback(Y=>W.current===I.current?.side&&dOe(Y,I.current?.area),[]);return a.jsx(Wke,{scope:n,searchRef:H,onItemEnter:v.useCallback(Y=>{K(Y)&&Y.preventDefault()},[K]),onItemLeave:v.useCallback(Y=>{K(Y)||(E.current?.focus(),P(null))},[K]),onTriggerLeave:v.useCallback(Y=>{K(Y)&&Y.preventDefault()},[K]),pointerGraceTimerRef:L,onPointerGraceIntentChange:v.useCallback(Y=>{I.current=Y},[]),children:a.jsx(V,{...D,children:a.jsx(Gh,{asChild:!0,trapped:s,onMountAutoFocus:Re(i,Y=>{Y.preventDefault(),E.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:l,children:a.jsx(nc,{asChild:!0,disableOutsidePointerEvents:u,onEscapeKeyDown:f,onPointerDownOutside:h,onFocusOutside:p,onInteractOutside:x,onDismiss:y,children:a.jsx(VV,{asChild:!0,...k,dir:C.dir,orientation:"vertical",loop:r,currentTabStopId:A,onCurrentTabStopIdChange:P,onEntryFocus:Re(d,Y=>{C.isUsingKeyboardRef.current||Y.preventDefault()}),preventScrollOnEntryFocus:!0,children:a.jsx(hv,{role:"menu","aria-orientation":"vertical","data-state":pG(b.open),"data-radix-menu-content":"",dir:C.dir,...N,...j,ref:_,style:{outline:"none",...j.style},onKeyDown:Re(j.onKeyDown,Y=>{const Z=Y.target.closest("[data-radix-menu-content]")===Y.currentTarget,F=Y.ctrlKey||Y.altKey||Y.metaKey,B=Y.key.length===1;Z&&(Y.key==="Tab"&&Y.preventDefault(),!F&&B&&q(Y.key));const X=E.current;if(Y.target!==X||!Fke.includes(Y.key))return;Y.preventDefault();const se=T().filter(ee=>!ee.disabled).map(ee=>ee.ref.current);KV.includes(Y.key)&&se.reverse(),oOe(se)}),onBlur:Re(e.onBlur,Y=>{Y.currentTarget.contains(Y.target)||(window.clearTimeout(R.current),H.current="")}),onPointerMove:Re(e.onPointerMove,vh(Y=>{const z=Y.target,Z=U.current!==Y.clientX;if(Y.currentTarget.contains(z)&&Z){const F=Y.clientX>U.current?"right":"left";W.current=F,U.current=Y.clientX}}))})})})})})})});JV.displayName=_a;var Zke="MenuGroup",RO=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return a.jsx(We.div,{role:"group",...r,ref:t})});RO.displayName=Zke;var Jke="MenuLabel",eG=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return a.jsx(We.div,{...r,ref:t})});eG.displayName=Jke;var Yy="MenuItem",cF="menu.itemSelect",db=v.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...s}=e,i=v.useRef(null),l=Xh(Yy,e.__scopeMenu),u=_O(Yy,e.__scopeMenu),d=it(t,i),f=v.useRef(!1),h=()=>{const p=i.current;if(!n&&p){const x=new CustomEvent(cF,{bubbles:!0,cancelable:!0});p.addEventListener(cF,y=>r?.(y),{once:!0}),sT(p,x),x.defaultPrevented?f.current=!1:l.onClose()}};return a.jsx(tG,{...s,ref:d,disabled:n,onClick:Re(e.onClick,h),onPointerDown:p=>{e.onPointerDown?.(p),f.current=!0},onPointerUp:Re(e.onPointerUp,p=>{f.current||p.currentTarget?.click()}),onKeyDown:Re(e.onKeyDown,p=>{const x=u.searchRef.current!=="";n||x&&p.key===" "||KA.includes(p.key)&&(p.currentTarget.click(),p.preventDefault())})})});db.displayName=Yy;var tG=v.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:s,...i}=e,l=_O(Yy,n),u=YV(n),d=v.useRef(null),f=it(t,d),[h,p]=v.useState(!1),[x,y]=v.useState("");return v.useEffect(()=>{const w=d.current;w&&y((w.textContent??"").trim())},[i.children]),a.jsx(yh.ItemSlot,{scope:n,disabled:r,textValue:s??x,children:a.jsx(GV,{asChild:!0,...u,focusable:!r,children:a.jsx(We.div,{role:"menuitem","data-highlighted":h?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...i,ref:f,onPointerMove:Re(e.onPointerMove,vh(w=>{r?l.onItemLeave(w):(l.onItemEnter(w),w.defaultPrevented||w.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Re(e.onPointerLeave,vh(w=>l.onItemLeave(w))),onFocus:Re(e.onFocus,()=>p(!0)),onBlur:Re(e.onBlur,()=>p(!1))})})})}),eOe="MenuCheckboxItem",nG=v.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...s}=e;return a.jsx(oG,{scope:e.__scopeMenu,checked:n,children:a.jsx(db,{role:"menuitemcheckbox","aria-checked":Xy(n)?"mixed":n,...s,ref:t,"data-state":$O(n),onSelect:Re(s.onSelect,()=>r?.(Xy(n)?!0:!n),{checkForDefaultPrevented:!1})})})});nG.displayName=eOe;var rG="MenuRadioGroup",[tOe,nOe]=fc(rG,{value:void 0,onValueChange:()=>{}}),aG=v.forwardRef((e,t)=>{const{value:n,onValueChange:r,...s}=e,i=hn(r);return a.jsx(tOe,{scope:e.__scopeMenu,value:n,onValueChange:i,children:a.jsx(RO,{...s,ref:t})})});aG.displayName=rG;var sG="MenuRadioItem",iG=v.forwardRef((e,t)=>{const{value:n,...r}=e,s=nOe(sG,e.__scopeMenu),i=n===s.value;return a.jsx(oG,{scope:e.__scopeMenu,checked:i,children:a.jsx(db,{role:"menuitemradio","aria-checked":i,...r,ref:t,"data-state":$O(i),onSelect:Re(r.onSelect,()=>s.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});iG.displayName=sG;var DO="MenuItemIndicator",[oG,rOe]=fc(DO,{checked:!1}),lG=v.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...s}=e,i=rOe(DO,n);return a.jsx(Rn,{present:r||Xy(i.checked)||i.checked===!0,children:a.jsx(We.span,{...s,ref:t,"data-state":$O(i.checked)})})});lG.displayName=DO;var aOe="MenuSeparator",cG=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return a.jsx(We.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});cG.displayName=aOe;var sOe="MenuArrow",uG=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,s=ub(n);return a.jsx(pv,{...s,...r,ref:t})});uG.displayName=sOe;var iOe="MenuSub",[TMe,dG]=fc(iOe),um="MenuSubTrigger",fG=v.forwardRef((e,t)=>{const n=mc(um,e.__scopeMenu),r=Xh(um,e.__scopeMenu),s=dG(um,e.__scopeMenu),i=_O(um,e.__scopeMenu),l=v.useRef(null),{pointerGraceTimerRef:u,onPointerGraceIntentChange:d}=i,f={__scopeMenu:e.__scopeMenu},h=v.useCallback(()=>{l.current&&window.clearTimeout(l.current),l.current=null},[]);return v.useEffect(()=>h,[h]),v.useEffect(()=>{const p=u.current;return()=>{window.clearTimeout(p),d(null)}},[u,d]),a.jsx(PO,{asChild:!0,...f,children:a.jsx(tG,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":s.contentId,"data-state":pG(n.open),...e,ref:Ms(t,s.onTriggerChange),onClick:p=>{e.onClick?.(p),!(e.disabled||p.defaultPrevented)&&(p.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Re(e.onPointerMove,vh(p=>{i.onItemEnter(p),!p.defaultPrevented&&!e.disabled&&!n.open&&!l.current&&(i.onPointerGraceIntentChange(null),l.current=window.setTimeout(()=>{n.onOpenChange(!0),h()},100))})),onPointerLeave:Re(e.onPointerLeave,vh(p=>{h();const x=n.content?.getBoundingClientRect();if(x){const y=n.content?.dataset.side,w=y==="right",j=w?-5:5,b=x[w?"left":"right"],C=x[w?"right":"left"];i.onPointerGraceIntentChange({area:[{x:p.clientX+j,y:p.clientY},{x:b,y:x.top},{x:C,y:x.top},{x:C,y:x.bottom},{x:b,y:x.bottom}],side:y}),window.clearTimeout(u.current),u.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(p),p.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:Re(e.onKeyDown,p=>{const x=i.searchRef.current!=="";e.disabled||x&&p.key===" "||qke[r.dir].includes(p.key)&&(n.onOpenChange(!0),n.content?.focus(),p.preventDefault())})})})});fG.displayName=um;var mG="MenuSubContent",hG=v.forwardRef((e,t)=>{const n=QV(_a,e.__scopeMenu),{forceMount:r=n.forceMount,...s}=e,i=mc(_a,e.__scopeMenu),l=Xh(_a,e.__scopeMenu),u=dG(mG,e.__scopeMenu),d=v.useRef(null),f=it(t,d);return a.jsx(yh.Provider,{scope:e.__scopeMenu,children:a.jsx(Rn,{present:r||i.open,children:a.jsx(yh.Slot,{scope:e.__scopeMenu,children:a.jsx(MO,{id:u.contentId,"aria-labelledby":u.triggerId,...s,ref:f,align:"start",side:l.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:h=>{l.isUsingKeyboardRef.current&&d.current?.focus(),h.preventDefault()},onCloseAutoFocus:h=>h.preventDefault(),onFocusOutside:Re(e.onFocusOutside,h=>{h.target!==u.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:Re(e.onEscapeKeyDown,h=>{l.onClose(),h.preventDefault()}),onKeyDown:Re(e.onKeyDown,h=>{const p=h.currentTarget.contains(h.target),x=Bke[l.dir].includes(h.key);p&&x&&(i.onOpenChange(!1),u.trigger?.focus(),h.preventDefault())})})})})})});hG.displayName=mG;function pG(e){return e?"open":"closed"}function Xy(e){return e==="indeterminate"}function $O(e){return Xy(e)?"indeterminate":e?"checked":"unchecked"}function oOe(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function lOe(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function cOe(e,t,n){const s=t.length>1&&Array.from(t).every(f=>f===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let l=lOe(e,Math.max(i,0));s.length===1&&(l=l.filter(f=>f!==n));const d=l.find(f=>f.toLowerCase().startsWith(s.toLowerCase()));return d!==n?d:void 0}function uOe(e,t){const{x:n,y:r}=e;let s=!1;for(let i=0,l=t.length-1;i<t.length;l=i++){const u=t[i],d=t[l],f=u.x,h=u.y,p=d.x,x=d.y;h>r!=x>r&&n<(p-f)*(r-h)/(x-h)+f&&(s=!s)}return s}function dOe(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return uOe(n,t)}function vh(e){return t=>t.pointerType==="mouse"?e(t):void 0}var fOe=XV,mOe=PO,hOe=ZV,pOe=JV,xOe=RO,gOe=eG,yOe=db,vOe=nG,bOe=aG,jOe=iG,wOe=lG,NOe=cG,SOe=uG,COe=fG,AOe=hG,fb="DropdownMenu",[TOe]=Sr(fb,[WV]),Cr=WV(),[kOe,xG]=TOe(fb),gG=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:s,defaultOpen:i,onOpenChange:l,modal:u=!0}=e,d=Cr(t),f=v.useRef(null),[h,p]=Rs({prop:s,defaultProp:i??!1,onChange:l,caller:fb});return a.jsx(kOe,{scope:t,triggerId:tr(),triggerRef:f,contentId:tr(),open:h,onOpenChange:p,onOpenToggle:v.useCallback(()=>p(x=>!x),[p]),modal:u,children:a.jsx(fOe,{...d,open:h,onOpenChange:p,dir:r,modal:u,children:n})})};gG.displayName=fb;var yG="DropdownMenuTrigger",vG=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...s}=e,i=xG(yG,n),l=Cr(n);return a.jsx(mOe,{asChild:!0,...l,children:a.jsx(We.button,{type:"button",id:i.triggerId,"aria-haspopup":"menu","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":i.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...s,ref:Ms(t,i.triggerRef),onPointerDown:Re(e.onPointerDown,u=>{!r&&u.button===0&&u.ctrlKey===!1&&(i.onOpenToggle(),i.open||u.preventDefault())}),onKeyDown:Re(e.onKeyDown,u=>{r||(["Enter"," "].includes(u.key)&&i.onOpenToggle(),u.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(u.key)&&u.preventDefault())})})})});vG.displayName=yG;var OOe="DropdownMenuPortal",bG=e=>{const{__scopeDropdownMenu:t,...n}=e,r=Cr(t);return a.jsx(hOe,{...r,...n})};bG.displayName=OOe;var jG="DropdownMenuContent",wG=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=xG(jG,n),i=Cr(n),l=v.useRef(!1);return a.jsx(pOe,{id:s.contentId,"aria-labelledby":s.triggerId,...i,...r,ref:t,onCloseAutoFocus:Re(e.onCloseAutoFocus,u=>{l.current||s.triggerRef.current?.focus(),l.current=!1,u.preventDefault()}),onInteractOutside:Re(e.onInteractOutside,u=>{const d=u.detail.originalEvent,f=d.button===0&&d.ctrlKey===!0,h=d.button===2||f;(!s.modal||h)&&(l.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});wG.displayName=jG;var POe="DropdownMenuGroup",EOe=v.forwardRef((e,t)=>
124{const{__scopeDropdownMenu:n,...r}=e,s=Cr(n);return a.jsx(xOe,{...s,...r,ref:t})});EOe.displayName=POe;var _Oe="DropdownMenuLabel",NG=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Cr(n);return a.jsx(gOe,{...s,...r,ref:t})});NG.displayName=_Oe;var MOe="DropdownMenuItem",SG=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Cr(n);return a.jsx(yOe,{...s,...r,ref:t})});SG.displayName=MOe;var ROe="DropdownMenuCheckboxItem",CG=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Cr(n);return a.jsx(vOe,{...s,...r,ref:t})});CG.displayName=ROe;var DOe="DropdownMenuRadioGroup",$Oe=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Cr(n);return a.jsx(bOe,{...s,...r,ref:t})});$Oe.displayName=DOe;var IOe="DropdownMenuRadioItem",AG=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Cr(n);return a.jsx(jOe,{...s,...r,ref:t})});AG.displayName=IOe;var LOe="DropdownMenuItemIndicator",TG=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Cr(n);return a.jsx(wOe,{...s,...r,ref:t})});TG.displayName=LOe;var FOe="DropdownMenuSeparator",kG=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Cr(n);return a.jsx(NOe,{...s,...r,ref:t})});kG.displayName=FOe;var qOe="DropdownMenuArrow",BOe=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Cr(n);return a.jsx(SOe,{...s,...r,ref:t})});BOe.displayName=qOe;var zOe="DropdownMenuSubTrigger",OG=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Cr(n);return a.jsx(COe,{...s,...r,ref:t})});OG.displayName=zOe;var UOe="DropdownMenuSubContent",PG=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Cr(n);return a.jsx(AOe,{...s,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});PG.displayName=UOe;var HOe=gG,VOe=vG,GOe=bG,EG=wG,_G=NG,MG=SG,RG=CG,DG=AG,$G=TG,IG=kG,LG=OG,FG=PG;const p2=HOe,x2=VOe,KOe=v.forwardRef(({className:e,inset:t,children:n,...r},s)=>a.jsxs(LG,{ref:s,className:qe("flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",t&&"pl-8",e),...r,children:[n,a.jsx(wr,{className:"ml-auto"})]}));KOe.displayName=LG.displayName;const WOe=v.forwardRef(({className:e,...t},n)=>a.jsx(FG,{ref:n,className:qe("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin]",e),...t}));WOe.displayName=FG.displayName;const gg=v.forwardRef(({className:e,sideOffset:t=4,...n},r)=>a.jsx(GOe,{children:a.jsx(EG,{ref:r,sideOffset:t,className:qe("z-50 max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin]",e),...n})}));gg.displayName=EG.displayName;const dm=v.forwardRef(({className:e,inset:t,...n},r)=>a.jsx(MG,{ref:r,className:qe("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",t&&"pl-8",e),...n}));dm.displayName=MG.displayName;const YOe=v.forwardRef(({className:e,children:t,checked:n,...r},s)=>
124a.jsxs(RG,{ref:s,className:qe("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:n,...r,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx($G,{children:a.jsx(ac,{className:"h-4 w-4"})})}),t]}));YOe.displayName=RG.displayName;const XOe=v.forwardRef(({className:e,children:t,...n},r)=>a.jsxs(DG,{ref:r,className:qe("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx($G,{children:a.jsx(SJ,{className:"h-2 w-2 fill-current"})})}),t]}));XOe.displayName=DG.displayName;const yg=v.forwardRef(({className:e,inset:t,...n},r)=>a.jsx(_G,{ref:r,className:qe("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));yg.displayName=_G.displayName;const fm=v.forwardRef(({className:e,...t},n)=>a.jsx(IG,{ref:n,className:qe("-mx-1 my-1 h-px bg-muted",e),...t}));fm.displayName=IG.displayName;var qG="AlertDialog",[QOe]=Sr(qG,[NV]),Li=NV(),BG=e=>{const{__scopeAlertDialog:t,...n}=e,r=Li(t);return a.jsx(SO,{...r,...n,modal:!0})};BG.displayName=qG;var ZOe="AlertDialogTrigger",JOe=v.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=Li(n);return a.jsx(Cke,{...s,...r,ref:t})});JOe.displayName=ZOe;var ePe="AlertDialogPortal",zG=e=>{const{__scopeAlertDialog:t,...n}=e,r=Li(t);return a.jsx(CO,{...r,...n})};zG.displayName=ePe;var tPe="AlertDialogOverlay",UG=v.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=Li(n);return a.jsx(ob,{...s,...r,ref:t})});UG.displayName=tPe;var Mu="AlertDialogContent",[nPe,rPe]=QOe(Mu),aPe=cq("AlertDialogContent"),HG=v.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:r,...s}=e,i=Li(n),l=v.useRef(null),u=it(t,l),d=v.useRef(null);return a.jsx(jke,{contentName:Mu,titleName:VG,docsSlug:"alert-dialog",children:a.jsx(nPe,{scope:n,cancelRef:d,children:a.jsxs(lb,{role:"alertdialog",...i,...s,ref:u,onOpenAutoFocus:Re(s.onOpenAutoFocus,f=>{f.preventDefault(),d.current?.focus({preventScroll:!0})}),onPointerDownOutside:f=>f.preventDefault(),onInteractOutside:f=>f.preventDefault(),children:[a.jsx(aPe,{children:r}),a.jsx(iPe,{contentRef:l})]})})})});HG.displayName=Mu;var VG="AlertDialogTitle",GG=v.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=Li(n);return a.jsx(AO,{...s,...r,ref:t})});GG.displayName=VG;var KG="AlertDialogDescription",WG=v.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=Li(n);return a.jsx(TO,{...s,...r,ref:t})});WG.displayName=KG;var sPe="AlertDialogAction",YG=v.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=Li(n);return a.jsx(kO,{...s,...r,ref:t})});YG.displayName=sPe;var XG="AlertDialogCancel",QG=v.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,{cancelRef:s}=rPe(XG,n),i=Li(n),l=it(t,s);return a.jsx(kO,{...i,...r,ref:l})});QG.displayName=XG;var iPe=({contentRef:e})=>{const t=`\`${Mu}\` requires a description for the component to be accessible for screen reader users.
125
126You can add a description to the \`${Mu}\` by passing a \`${KG}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
127
128Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${Mu}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
129
130For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return v.useEffect(()=>{document.getElementById(e.current?.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},oPe=BG,lPe=zG,ZG=UG,JG=HG,eK=YG,tK=QG,nK=GG,rK=WG;const mb=oPe,cPe=lPe,aK=v.forwardRef(({className:e,...t},n)=>a.jsx(ZG,{className:qe("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:n}));aK.displayName=ZG.displayName;const Qh=v.forwardRef(({className:e,...t},n)=>a.jsxs(cPe,{children:[a.jsx(aK,{}),a.jsx(JG,{ref:n,className:qe("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rou
130nded-lg",e),...t})]}));Qh.displayName=JG.displayName;const Zh=({className:e,...t})=>a.jsx("div",{className:qe("flex flex-col space-y-2 text-center sm:text-left",e),...t});Zh.displayName="AlertDialogHeader";const Jh=({className:e,...t})=>a.jsx("div",{className:qe("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Jh.displayName="AlertDialogFooter";const ep=v.forwardRef(({className:e,...t},n)=>a.jsx(nK,{ref:n,className:qe("text-lg font-semibold",e),...t}));ep.displayName=nK.displayName;const tp=v.forwardRef(({className:e,...t},n)=>a.jsx(rK,{ref:n,className:qe("text-sm text-muted-foreground",e),...t}));tp.displayName=rK.displayName;const np=v.forwardRef(({className:e,...t},n)=>a.jsx(eK,{ref:n,className:qe(PT(),e),...t}));np.displayName=eK.displayName;const rp=v.forwardRef(({className:e,...t},n)=>a.jsx(tK,{ref:n,className:qe(PT({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));rp.displayName=tK.displayName;var uPe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Fs=uPe.reduce((e,t)=>{const n=W8(`Primitive.${t}`),r=v.forwardRef((s,i)=>{const{asChild:l,...u}=s,d=l?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(d,{...u,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),dPe="Separator",uF="horizontal",fPe=["horizontal","vertical"],sK=v.forwardRef((e,t)=>{const{decorative:n,orientation:r=uF,...s}=e,i=mPe(r)?r:uF,u=n?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return a.jsx(Fs.div,{"data-orientation":i,...u,...s,ref:t})});sK.displayName=dPe;function mPe(e){return fPe.includes(e)}var iK=sK;const ws=v.forwardRef(({className:e,orientation:t="horizontal",decorative:n=!0,...r},s)=>a.jsx(iK,{ref:s,decorative:n,orientation:t,className:qe("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...r}));ws.displayName=iK.displayName;const IO=["/api/pricing/config"],LO=["/api/pricing/config/history"],hPe=25;function hb(e,t={}){const n=localStorage.getItem("fs_team_token");return fetch(e,{...t,headers:{"Content-Type":"application/json",...n?{Authorization:`Bearer ${n}`}:{},...t.headers||{}}})}function pb(){const e=Xe({queryKey:IO,queryFn:async()=>{const t=await hb("/api/pricing/config");if(!t.ok)throw new Error("Failed to load pricing config");return t.json()},staleTime:3e5});return{...e,config:e.data??ic()}}function oK(){const e=wt();return nt({mutationFn:async t=>{const n=await hb("/api/pricing/config",{method:"PATCH",body:JSON.stringify(t)}),r=await n.json();if(!n.ok)throw new Error(r?.error||"Failed to save pricing config");return r},onSuccess:t=>{e.setQueryData(IO,t),e.invalidateQueries({queryKey:LO})}})}function pPe(e={}){return $Q({queryKey:[...LO,e],initialPageParam:0,queryFn:async({pageParam:t})=>{const n=new URLSearchParams;n.set("limit",String(hPe)),n.set("offset",String(t??0)),typeof e.savedById=="number"&&n.set("savedById",String(e.savedById)),e.from&&n.set("from",e.from),e.to&&n.set("to",e.to);const r=await hb(`/api/pricing/config/history?${n.toString()}`);if(!r.ok)throw new Error("Failed to load pricing history");return r.json()},getNextPageParam:t=>{const n=t.offset+t.entries.length;return n<t.total?n:void 0},staleTime:60*1e3})}function xPe(){const e=wt();return nt({mutationFn:async t=>{const n=await hb(`/api/pricing/config/history/${t}/restore`,{method:"POST"}),r=await n.json();if(!n.ok)throw new Error(r?.error||"Failed to restore pricing version");return r},onSuccess:t=>{e.setQueryData(IO,t),e.invalidateQueries({queryKey:LO})}})}var xb="Popover",[lK]=Sr(xb,[zo]),ap=zo(),[gPe,Qo]=lK(xb),cK=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:s,onOpenChange:i,modal:l=!1}=e,u=ap(t),d=v.useRef(null),[f,h]=v.useState(!1),[p,x]=Rs({prop:r,defaultProp:s??!1,onChange:i,caller:xb});return a.jsx(AT,{...u,children:a.jsx(gPe,{scope:t,contentId:tr(),triggerRef:d,open:p,onOpenChange:x,onOpenToggle:v.useCallback(()=>x(y=>!y),[x]),hasCustomAnchor:f,onCustomAnchorAdd:v.useCallback(()=>h(!0),[]),onCustomAnchorRemove:v.useCallback(()=>h(!1),[]),modal:l,children:n})})};cK.displayName=xb;var uK="PopoverAnchor",yPe=v.forwardRef((e,t)=>
vendor: 4,370 bytes, line 130
130{const{__scopePopover:n,...r}=e,s=Qo(uK,n),i=ap(n),{onCustomAnchorAdd:l,onCustomAnchorRemove:u}=s;return v.useEffect(()=>(l(),()=>u()),[l,u]),a.jsx(Th,{...i,...r,ref:t})});yPe.displayName=uK;var dK="PopoverTrigger",fK=v.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=Qo(dK,n),i=ap(n),l=it(t,s.triggerRef),u=a.jsx(We.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":gK(s.open),...r,ref:l,onClick:Re(e.onClick,s.onOpenToggle)});return s.hasCustomAnchor?u:a.jsx(Th,{asChild:!0,...i,children:u})});fK.displayName=dK;var FO="PopoverPortal",[vPe,bPe]=lK(FO,{forceMount:void 0}),mK=e=>{const{__scopePopover:t,forceMount:n,children:r,container:s}=e,i=Qo(FO,t);return a.jsx(vPe,{scope:t,forceMount:n,children:a.jsx(Rn,{present:n||i.open,children:a.jsx(rc,{asChild:!0,container:s,children:r})})})};mK.displayName=FO;var fd="PopoverContent",hK=v.forwardRef((e,t)=>{const n=bPe(fd,e.__scopePopover),{forceMount:r=n.forceMount,...s}=e,i=Qo(fd,e.__scopePopover);return a.jsx(Rn,{present:r||i.open,children:i.modal?a.jsx(wPe,{...s,ref:t}):a.jsx(NPe,{...s,ref:t})})});hK.displayName=fd;var jPe=Ul("PopoverContent.RemoveScroll"),wPe=v.forwardRef((e,t)=>{const n=Qo(fd,e.__scopePopover),r=v.useRef(null),s=it(t,r),i=v.useRef(!1);return v.useEffect(()=>{const l=r.current;if(l)return eb(l)},[]),a.jsx(Kh,{as:jPe,allowPinchZoom:!0,children:a.jsx(pK,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Re(e.onCloseAutoFocus,l=>{l.preventDefault(),i.current||n.triggerRef.current?.focus()}),onPointerDownOutside:Re(e.onPointerDownOutside,l=>{const u=l.detail.originalEvent,d=u.button===0&&u.ctrlKey===!0,f=u.button===2||d;i.current=f},{checkForDefaultPrevented:!1}),onFocusOutside:Re(e.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1})})})}),NPe=v.forwardRef((e,t)=>{const n=Qo(fd,e.__scopePopover),r=v.useRef(!1),s=v.useRef(!1);return a.jsx(pK,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{e.onCloseAutoFocus?.(i),i.defaultPrevented||(r.current||n.triggerRef.current?.focus(),i.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:i=>{e.onInteractOutside?.(i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const l=i.target;n.triggerRef.current?.contains(l)&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&s.current&&i.preventDefault()}})}),pK=v.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,disableOutsidePointerEvents:l,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:h,...p}=e,x=Qo(fd,n),y=ap(n);return Jv(),a.jsx(Gh,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:i,children:a.jsx(nc,{asChild:!0,disableOutsidePointerEvents:l,onInteractOutside:h,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onDismiss:()=>x.onOpenChange(!1),children:a.jsx(hv,{"data-state":gK(x.open),role:"dialog",id:x.contentId,...y,...p,ref:t,style:{...p.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),xK="PopoverClose",SPe=v.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=Qo(xK,n);return a.jsx(We.button,{type:"button",...r,ref:t,onClick:Re(e.onClick,()=>s.onOpenChange(!1))})});SPe.displayName=xK;var CPe="PopoverArrow",APe=v.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=ap(n);return a.jsx(pv,{...s,...r,ref:t})});APe.displayName=CPe;function gK(e){return e?"open":"closed"}var TPe=cK,kPe=fK,OPe=mK,yK=hK;const vK=TPe,bK=kPe,qO=v.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},s)=>a.jsx(OPe,{children:a.jsx(yK,{ref:s,align:t,sideOffset:n,className:qe("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:sli
130de-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-popover-content-transform-origin]",e),...r})}));qO.displayName=yK.displayName;const PPe=["a_return","b_return_rtl","b_return_ltr"];function dF(e){return e==="text_note"||PPe.includes(e)}function EPe(e){return Kg.find(t=>t.key===e)?.label||e}function _Pe(){return`ann-${Date.now()}-${Math.random().toString(36).slice(2,6)}`}function MPe(e){return v.createElement(jK,{...e,key:e.testIdPrefix})}function jK({imageUrl:e,annotations:t,notes:n="",onChange:r,onUploadImage:s,title:i,description:l,showNotes:u,testIdPrefix:d,fullscreen:f=!1}){const{toast:h}=nr(),p=v.useRef(null),x=v.useRef(null),y=v.useRef(null),[w,j]=v.useState("idle"),[b,C]=v.useState("downspout"),[N,k]=v.useState(null),[T,A]=v.useState(null),[P,E]=v.useState(null),[_,R]=v.useState(!1),[H,L]=v.useState(!1),[I,W]=v.useState(!1),[U,V]=v.useState(!1),D=v.useRef(null),q=v.useRef([]),K=v.useRef([]),[Y,z]=v.useState(0),[Z,F]=v.useState(3),[B,X]=v.useState(!1),[Q,se]=v.useState(1),[ee,ve]=v.useState({x:0,y:0}),ue=v.useRef({active:!1,startX:0,startY:0,baseX:0,baseY:0}),de=v.useRef({pointers:new Map,baseDist:0,baseScale:1}),Se=v.useRef(null),[he,ce]=v.useState([{imageUrl:e,annotations:t,notes:n}]),[te,_e]=v.useState(0),Oe=v.useRef(!1),Te=te>0,Le=te<he.length-1;v.useEffect(()=>{if(Oe.current){Oe.current=!1;return}const pe=he[te];if(pe&&pe.imageUrl===e&&pe.notes===n&&RPe(pe.annotations,t))return;const $e=[...he.slice(0,te+1),{imageUrl:e,annotations:t,notes:n}].slice(-50);ce($e),_e($e.length-1)},[e,t,n]);const ze=v.useCallback(pe=>{const Pe=he[te]??{imageUrl:e,annotations:t,notes:n},$e={imageUrl:pe.imageUrl??Pe.imageUrl,annotations:pe.annotations??Pe.annotations,notes:pe.notes??Pe.notes},Rt=[...he.slice(0,te+1),$e].slice(-50);ce(Rt),_e(Rt.length-1),Oe.current=!0,r({imageUrl:$e.imageUrl,annotations:$e.annotations,notes:$e.notes})},[he,te,e,t,n,r]),at=v.useCallback(()=>{if(!Te)return;const pe=te-1;_e(pe);const Pe=he[pe];Oe.current=!0,r({imageUrl:Pe.imageUrl,annotations:Pe.annotations,notes:Pe.notes})},[Te,te,he,r]),xt=v.useCallback(()=>{if(!Le)return;const pe=te+1;_e(pe);const Pe=he[pe];Oe.current=!0,r({imageUrl:Pe.imageUrl,annotations:Pe.annotations,notes:Pe.notes})},[Le,te,he,r]),dt=v.useCallback(()=>{const pe=D.current,Pe=y.current;if(!pe||!Pe)return;const $e=Pe.offsetWidth,St=Pe.offsetHeight;if($e===0||St===0)return;(pe.width!==$e||pe.height!==St)&&(pe.width=$e,pe.height=St);const Rt=pe.getContext("2d");if(!Rt)return;Rt.clearRect(0,0,pe.width,pe.height),Rt.fillStyle="rgba(255,255,255,0.85)";const fs=[...q.current,K.current];for(const fa of fs)for(const Qe of fa){Rt.beginPath();const kt=Qe.x/100*pe.width,Jt=Qe.y/100*pe.height,Sn=Z/100*pe.width;Rt.arc(kt,Jt,Sn,0,Math.PI*2),Rt.fill()}},[Z]),Mt=v.useCallback(async()=>{if(q.current.length===0){V(!1);return}X(!0);try{const pe=new Image;pe.crossOrigin="anonymous",await new Promise((fa,Qe)=>{pe.onload=()=>fa(),pe.onerror=Qe,pe.src=e});const Pe=document.createElement("canvas");Pe.width=pe.naturalWidth,Pe.height=pe.naturalHeight;const $e=Pe.getContext("2d");$e.drawImage(pe,0,0),$e.fillStyle="white";for(const fa of q.current)for(const Qe of fa){const kt=Qe.x/100*Pe.width,Jt=Qe.y/100*Pe.height,Sn=Z/100*Pe.width;$e.beginPath(),$e.arc(kt,Jt,Sn,0,Math.PI*2),$e.fill()}const St=await new Promise(fa=>Pe.toBlob(fa,"image/png"));if(!St)throw new Error("Canvas export failed");const Rt=new File([St],"erased.png",{type:"image/png"}),fs=await s(Rt);ze({imageUrl:fs}),q.current=[],K.current=[],z(0),V(!1),h({title:"Erase applied"})}catch{h({title:"Erase failed",variant:"destructive"})}finally{X(!1)}},[e,Z,s,ze,h]),ds=v.useCallback(()=>{q.current=[],K.current=[],z(0),V(!1);const pe=D.current;pe&&pe.getContext("2d")?.clearRect(0,0,pe.width,pe.height)},[]);v.useEffect(()=>{const pe=Pe=>{if(!p.current||!p.current.matches(":hover")&&!p.current.contains(document.activeElement))return;const $e=Pe.metaKey||Pe.ctrlKey;$e&&Pe.key.toLowerCase()==="z"&&!Pe.shiftKey?(Pe.preventDefault(),at()):$e&&(Pe.key.toLowerCase()==="y"||Pe.key.toLowerCase()==="z"&&Pe.shiftKey)&&(Pe.preventDefault(),xt())};return window.addEventListener("keydown",pe),()=>window.removeEventListener("keydown",pe)},[at,xt]);const ua=v.useCallback((pe,Pe)=>{const $e=y.current?.getBoundingClientRect();return!$e||$e.width===0||$e.height===0?null:{xPct:Math.max(0,Math.min(100,(pe-$e.left)/$e.width*100)),yPct:Math.max(0,Math.min(100,(Pe-$e.top)/$e.height*100))}},[]),rr=()=>{j("idle"),k(null)},$n=pe=>{b===pe&&w!=="idle"?rr():(C(pe),V(!1),j("placing_pin"))},Fr=pe=>{if(U){pe.preventDefault(),K.current=[];const St=ua(pe.clientX,pe.clientY);St&&(K.current.push({x:St.xPct,y:St.yPct}),dt()),x.current?.setPointerCapture(pe.pointerId);return}if(de.current.pointers.set(pe.pointerId,{x:pe.clientX,y:pe.clientY}),de.current.pointers.size===2){const[St,Rt]=Array.from(de.current.pointers.values());de.current.baseDist=Math.hypot(St.x-Rt.x,St.y-Rt.y),de.current.baseScale=Q;return}const $e=pe.target.closest("[data-pin-handle]");w==="idle"&&Q>1&&!$e&&(ue.current={active:!0,startX:pe.clientX,startY:pe.clientY,baseX:ee.x,baseY:ee.y},x.current?.setPointerCapture(pe.pointerId))},In=pe=>{if(U){if(!(pe.buttons&1))return;const Pe=ua(pe.clientX,pe.clientY);Pe&&(K.current.push({x:Pe.xPct,y:Pe.yPct}),dt());return}if(de.current.pointers.has(pe.pointerId)&&de.current.pointers.set(pe.pointerId,{x:pe.clientX,y:pe.clientY}),de.current.pointers.size===2&&de.current.baseDist>0){const[Pe,$e]=Array.from(de.current.pointers.values()),St=Math.hypot(Pe.x-$e.x,Pe.y-$e.y),Rt=Math.max(1,Math.min(5,de.current.baseScale*(St/de.current.baseDist)));se(Rt);return}if(ue.current.active){ve({x:ue.current.baseX+(pe.clientX-ue.current.startX),y:ue.current.baseY+(pe.clientY-ue.current.startY)});return}if(T){const Pe=ua(pe.clientX,pe.clientY);if(!Pe)return;const St=(Se.current??t).map(Rt=>Rt.id!==T.id?Rt:T.part==="pin"?{...Rt,pinXPct:Pe.xPct,pinYPct:Pe.yPct}:{...Rt,targetXPct:Pe.xPct,targetYPct:Pe.yPct});Se.current=St,Oe.current=!0,r({imageUrl:e,annotations:St,notes:n})}},hc=pe=>{if(U){K.current.length>0&&(q.current=[...q.current,[...K.current]],K.current=[],z(Pe=>Pe+1),dt());try{x.current?.releasePointerCapture(pe.pointerId)}catch{}return}if(de.current.pointers.delete(pe.pointerId),de.current.pointers.size<2&&(de.current.baseDist=0),ue.current.active){ue.current.active=!1;
130try{x.current?.releasePointerCapture(pe.pointerId)}catch{}return}if(T){try{x.current?.releasePointerCapture(pe.pointerId)}catch{}const Pe=Se.current??t;Se.current=null,ze({annotations:Pe}),A(null)}},Zo=pe=>{if(U||T||ue.current.active||w==="idle")return;const Pe=ua(pe.clientX,pe.clientY);if(Pe){if(w==="placing_pin"){const $e=t.length+1;k({id:_Pe(),number:$e,pinXPct:Pe.xPct,pinYPct:Pe.yPct,pinType:b,label:""}),j("placing_target")}else if(w==="placing_target"&&N){const $e={id:N.id,number:N.number,pinXPct:N.pinXPct,pinYPct:N.pinYPct,targetXPct:Pe.xPct,targetYPct:Pe.yPct,pinType:N.pinType,label:N.label||""},St=[...t,$e];ze({annotations:St}),k(null),dF($e.pinType)?(E($e),j("idle")):(j("placing_pin"),h({title:`Pin #${$e.number} placed`}))}}},pc=pe=>{if(!pe.ctrlKey&&!pe.metaKey)return;pe.preventDefault();const Pe=-pe.deltaY*.01;se($e=>Math.max(1,Math.min(5,$e+Pe)))},qr=()=>{se(1),ve({x:0,y:0})},Fi=()=>se(pe=>Math.min(5,pe+.25)),Br=()=>{se(pe=>{const Pe=Math.max(1,pe-.25);return Pe===1&&ve({x:0,y:0}),Pe})},Bs=pe=>pe.map((Pe,$e)=>({...Pe,number:$e+1})),da=pe=>{const Pe=Bs(t.filter($e=>$e.id!==pe));ze({annotations:Pe})},zs=pe=>{if(!pe)return;const Pe=t.map($e=>$e.id===pe.id?pe:$e);ze({annotations:Pe}),E(null)},Us=async pe=>{if(!pe.type.startsWith("image/")){h({title:"Please upload an image file",variant:"destructive"});return}if(pe.size>10*1024*1024){h({title:"File too large (max 10MB)",variant:"destructive"});return}W(!0);try{const Pe=await s(pe);ze({imageUrl:Pe}),h({title:`${i} uploaded`})}catch{h({title:"Upload failed",variant:"destructive"})}finally{W(!1)}},Jo=()=>{ze({imageUrl:"",annotations:[],notes:""}),rr(),qr(),R(!1)},qi=()=>e?a.jsx("div",{className:"flex flex-wrap gap-1.5 p-2 bg-slate-100 dark:bg-slate-900 border-b border-border z-20",children:U?a.jsxs("div",{className:"flex flex-wrap gap-2 items-center w-full",children:[a.jsxs(ne,{variant:"default",className:"h-11 px-3.5 gap-2 touch-manipulation shadow-md",onClick:()=>{ds(),rr()},children:[a.jsx(n3,{className:"h-5 w-5"}),a.jsx("span",{className:"font-semibold text-sm",children:"Exit Erase Mode"})]}),a.jsx("div",{className:"w-px bg-border/50 h-8 mx-1 hidden sm:block"}),a.jsx("span",{className:"text-sm font-medium",children:"Brush Size:"}),a.jsx("input",{type:"range",min:"1",max:"10",value:Z,onChange:pe=>F(Number(pe.target.value)),className:"w-32"}),a.jsx("div",{className:"w-px bg-border/50 h-8 mx-1 hidden sm:block"}),a.jsxs(ne,{variant:"default",onClick:Mt,disabled:Y===0||B,className:"h-11 px-4 ml-auto",children:[B?a.jsx(Me,{className:"h-5 w-5 animate-spin mr-2"}):a.jsx(Si,{className:"h-5 w-5 mr-2"}),a.jsx("span",{className:"font-semibold text-sm",children:"Apply Erase"})]})]}):a.jsxs(a.Fragment,{children:[Kg.map(pe=>{const Pe=b===pe.key&&w!=="idle";return a.jsxs(ne,{variant:Pe?"default":"outline",className:`h-11 px-3.5 gap-2 touch-manipulation transition-colors ${Pe?"shadow-md":"bg-white hover:bg-slate-50 dark:bg-slate-800 dark:hover:bg-slate-700"}`,onClick:()=>$n(pe.key),children:[a.jsx(rm,{pinType:pe.key,size:20}),a.jsx("span",{className:"font-semibold text-sm",children:pe.label})]},pe.key)}),a.jsx("div",{className:"w-px bg-border/50 shrink-0 self-stretch mx-1 hidden sm:block"}),a.jsxs(ne,{variant:"outline",className:"h-11 px-3.5 gap-2 touch-manipulation bg-white hover:bg-slate-50 dark:bg-slate-800 dark:hover:bg-slate-700",onClick:()=>{rr(),V(!0)},children:[a.jsx(n3,{className:"h-5 w-5"}),a.jsx("span",{className:"font-semibold text-sm",children:"Erase"})]}),a.jsx("div",{className:"w-px bg-border/50 shrink-0 self-stretch mx-1 hidden sm:block"}),a.jsxs(ne,{variant:"outline",className:"h-11 px-3.5 gap-2 touch-manipulation bg-white hover:bg-slate-50 dark:bg-slate-800 dark:hover:bg-slate-700",onClick:at,disabled:!Te,children:[a.jsx(Tte,{className:"h-5 w-5"}),a.jsx("span",{className:"font-semibold text-sm hidden md:inline",children:"Undo"})]}),a.jsxs(ne,{variant:"outline",className:"h-11 px-3.5 gap-2 touch-manipulation bg-white hover:bg-slate-50 dark:bg-slate-800 dark:hover:bg-slate-700",onClick:xt,disabled:!Le,children:[a.jsx(Gee,{className:"h-5 w-5"}),a.jsx("span",{className:"font-semibold text-sm hidden md:inline",children:"Redo"})]}),a.jsx("div",{className:"w-px bg-border/50 shrink-0 self-stretch mx-1 hidden sm:block"}),a.jsxs(ne,{variant:"outline",className:"h-11 px-3.5 gap-2 touch-manipulation bg-white hover:bg-slate-50 dark:bg-slate-800 dark:hover:bg-slate-700",onClick:Fi,children:[a.jsx(Bte,{className:"h-5 w-5"}),a.jsx("span",{className:"font-semibold text-sm hidden lg:inline",children:"Zoom In"})]}),a.jsxs(ne,{variant:"outline",className:"h-11 px-3.5 gap-2 touch-manipulation bg-white hover:bg-slate-50 dark:bg-slate-800 dark:hover:bg-slate-700",onClick:Br,children:[a.jsx(Ute,{className:"h-5 w-5"}),a.jsx("span",{className:"font-semibold text-sm hidden lg:inline",children:"Zoom Out"})]}),!f&&a.jsxs(ne,{variant:"outline",className:"h-11 px-3.5 gap-2 touch-manipulation bg-white hover:bg-slate-50 dark:bg-slate-800 dark:hover:bg-slate-700 ml-auto",onClick:()=>L(!0),children:[a.jsx(bee,{className:"h-5 w-5"}),a.jsx("span",{className:"font-semibold text-sm",children:"Fullscreen"})]})]})}):null,Hs=a.jsxs("div",{ref:x,className:`relative w-full bg-slate-50 overflow-hidden ${f?"flex items-center justify-center h-[calc(100vh-120px)]":"h-auto"} ${w!=="idle"?"cursor-crosshair":Q>1?"cursor-grab":""}
130 ${T?"cursor-grabbing":""}`,style:{touchAction:"none"},onPointerDown:Fr,onPointerMove:In,onPointerUp:hc,onPointerCancel:hc,onClick:Zo,onWheel:pc,"data-testid":`${d}-surface`,children:[a.jsxs("div",{ref:y,className:`relative origin-top-left ${f?"":"w-full"}`,style:{transform:`translate(${ee.x}px, ${ee.y}px) scale(${Q})`,transformOrigin:"0 0",transition:ue.current.active||T?"none":"transform 100ms ease-out"},children:[e&&a.jsx("img",{src:e,alt:i,className:`block pointer-events-none ${f?"max-w-full max-h-[calc(100vh-120px)] w-auto h-auto":"w-full h-auto"}`,draggable:!1,"data-testid":`${d}-img`}),a.jsxs("svg",{className:"absolute inset-0 w-full h-full pointer-events-none",style:{zIndex:5},children:[t.map(pe=>a.jsxs("g",{children:[a.jsx("line",{x1:`${pe.pinXPct}%`,y1:`${pe.pinYPct}%`,x2:`${pe.targetXPct}%`,y2:`${pe.targetYPct}%`,stroke:"hsl(var(--primary))",strokeWidth:"1.5",strokeDasharray:"4 2",opacity:"0.8"}),a.jsx("circle",{cx:`${pe.targetXPct}%`,cy:`${pe.targetYPct}%`,r:"4",fill:"hsl(var(--primary))",stroke:"white",strokeWidth:"1.5"})]},`line-${pe.id}`)),N&&w==="placing_target"&&a.jsx("circle",{cx:`${N.pinXPct}%`,cy:`${N.pinYPct}%`,r:"6",fill:"hsl(var(--primary))",stroke:"white",strokeWidth:"2",opacity:"0.6",className:"animate-pulse"})]}),U&&e&&a.jsx("canvas",{ref:D,className:"absolute inset-0 w-full h-full pointer-events-none",style:{zIndex:25}}),t.map(pe=>{const Pe=P?.id===pe.id;return a.jsxs(vK,{open:Pe,onOpenChange:$e=>{!$e&&Pe&&P?zs(P):$e||E(null)},children:[a.jsx(bK,{asChild:!0,children:a.jsx("div",{"data-pin-handle":!0,className:`absolute z-10 -translate-x-1/2 -translate-y-1/2 ${w==="idle"?"cursor-grab active:cursor-grabbing hover:scale-105 transition-transform":""}`,style:{left:`${pe.pinXPct}%`,top:`${pe.pinYPct}%`},onPointerDown:$e=>{if(w==="idle"){$e.stopPropagation(),Se.current=t,A({id:pe.id,part:"pin"});try{x.current?.setPointerCapture($e.pointerId)}catch{}}},onClick:$e=>{w==="idle"&&($e.stopPropagation(),T||E({...pe}))},title:`#${pe.number} ${EPe(pe.pinType)}${pe.label?` — ${pe.label}`:""}`,"data-testid":`${d}-pin-${pe.id}`,children:pe.pinType==="text_note"?a.jsxs("div",{className:"px-2 py-1 min-h-[44px] min-w-[44px] max-w-[160px] flex items-center justify-center gap-1.5 rounded bg-yellow-100 text-yellow-900 shadow-md border border-yellow-300",children:[a.jsxs("span",{className:"text-xs font-bold",children:[pe.number,"."]}),a.jsx("p",{className:"text-xs leading-tight break-words whitespace-pre-wrap",children:pe.label||"Note"})]}):a.jsxs("div",{className:"flex items-center justify-center gap-1 min-h-[44px] min-w-[44px] px-2 py-1 rounded bg-primary text-primary-foreground shadow-md border border-white/50 whitespace-nowrap",children:[a.jsx("span",{className:"text-[13px] font-bold",children:pe.number}),a.jsx(rm,{pinType:pe.pinType,size:18})]})})}),Pe&&P&&a.jsxs(qO,{side:"bottom",align:"center",className:"w-72 p-4 flex flex-col gap-4 z-[100]",onPointerDown:$e=>$e.stopPropagation(),onWheel:$e=>$e.stopPropagation(),children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("h4",{className:"font-semibold text-sm",children:["Edit Pin #",P.number]}),a.jsx(ne,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>zs(P),children:a.jsx(an,{className:"h-4 w-4"})})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("label",{className:"text-xs text-muted-foreground font-medium",children:"Pin Type"}),a.jsxs(Sa,{value:P.pinType,onValueChange:$e=>E({...P,pinType:$e}),children:[a.jsx(ra,{className:"h-10",children:a.jsx(Ca,{})}),a.jsx(aa,{children:Kg.map($e=>a.jsx(Qn,{value:$e.key,children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(rm,{pinType:$e.key,size:16}),a.jsx("span",{children:$e.label})]})},$e.key))})]})]}),dF(P.pinType)&&a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("label",{className:"text-xs text-muted-foreground font-medium",children:P.pinType==="text_note"?"Note Text":"Dimension / Label"}),P.pinType==="text_note"?a.jsx(Ql,{className:"min-h-[80px] resize-none",value:P.label,onChange:$e=>E({...P,label:$e.target.value}),placeholder:"Enter note...",autoFocus:!0}):a.jsx(Ee,{className:"h-10",value:P.label,onChange:$e=>E({...P,label:$e.target.value}
130),placeholder:"e.g. 15",autoFocus:!0})]}),a.jsxs("div",{className:"flex justify-between items-center pt-2",children:[a.jsxs(ne,{variant:"destructive",size:"sm",className:"h-9 px-3",onClick:()=>{da(P.id),E(null)},children:[a.jsx(on,{className:"h-4 w-4 mr-2"})," Delete"]}),a.jsxs(ne,{variant:"default",size:"sm",className:"h-9 px-4",onClick:()=>zs(P),children:[a.jsx(Si,{className:"h-4 w-4 mr-2"})," Save"]})]})]})]})]},`pin-${pe.id}`)}),w==="idle"&&t.map(pe=>a.jsx("div",{"data-pin-handle":!0,className:"absolute z-10 w-11 h-11 flex items-center justify-center -translate-x-1/2 -translate-y-1/2 cursor-grab active:cursor-grabbing",style:{left:`${pe.targetXPct}%`,top:`${pe.targetYPct}%`},onPointerDown:Pe=>{Pe.stopPropagation(),Se.current=t,A({id:pe.id,part:"target"});try{x.current?.setPointerCapture(Pe.pointerId)}catch{}},title:`Target for #${pe.number}`,"data-testid":`${d}-target-${pe.id}`,children:a.jsx("div",{className:"w-4 h-4 rounded-full bg-primary border-2 border-white shadow-md"})},`target-${pe.id}`)),N&&w==="placing_target"&&a.jsx("div",{className:"absolute z-10 -translate-x-1/2 -translate-y-1/2",style:{left:`${N.pinXPct}%`,top:`${N.pinYPct}%`},children:N.pinType==="text_note"?a.jsxs("div",{className:"px-2 py-1 min-h-[44px] min-w-[44px] max-w-[160px] flex items-center justify-center gap-1.5 rounded bg-yellow-100/70 text-yellow-900 shadow-md border border-yellow-300 animate-pulse",children:[a.jsxs("span",{className:"text-xs font-bold",children:[N.number,"."]}),a.jsx("p",{className:"text-xs leading-tight break-words whitespace-pre-wrap",children:N.label||"Note"})]}):a.jsxs("div",{className:"flex items-center justify-center gap-1 min-h-[44px] min-w-[44px] px-2 py-1 rounded bg-primary/70 text-primary-foreground shadow-md border border-white/50 whitespace-nowrap animate-pulse",children:[a.jsx("span",{className:"text-[13px] font-bold",children:N.number}),a.jsx(rm,{pinType:N.pinType,size:18})]})})]}),e&&Q>1&&a.jsxs("div",{className:"absolute top-2 right-2 z-20 px-2 py-1 rounded bg-slate-900/80 text-white text-xs font-medium shadow-md backdrop-blur pointer-events-none","data-testid":`${d}-zoom-indicator`,children:[Math.round(Q*100),"%"]}),w!=="idle"&&a.jsx("div",{className:"absolute top-4 left-1/2 -translate-x-1/2 z-30 pointer-events-none",children:a.jsx("div",{className:"px-4 py-2 bg-primary text-primary-foreground text-sm font-bold rounded-full shadow-lg animate-in fade-in slide-in-from-top-4 text-center whitespace-nowrap border border-white/20",children:w==="placing_pin"?"Tap to place the label, then tap where it points":"Now tap where this pin points to"})})]});return a.jsxs("div",{ref:p,className:"flex flex-col gap-4",children:[!f&&a.jsxs("div",{className:"flex items-start justify-between gap-4",children:[a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("h3",{className:"text-base font-semibold",children:i}),t.length>0&&a.jsxs("span",{className:"text-xs text-muted-foreground bg-muted px-1.5 py-0.5 rounded",children:[t.length," pins"]})]}),l&&a.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:l})]}),e&&a.jsxs(ne,{variant:"ghost",size:"sm",className:"text-destructive hover:bg-destructive/10 hover:text-destructive shrink-0",onClick:()=>R(!0),children:[a.jsx(on,{className:"h-4 w-4 mr-1.5"})," Remove Image"]})]}),e?a.jsxs("div",{className:"flex flex-col border border-border rounded-lg shadow-sm overflow-hidden bg-white relative",children:[a.jsx(qi,{}),Hs]}):a.jsxs("div",{className:"w-full h-64 md:h-96 border-2 border-dashed rounded-lg flex flex-col items-center justify-center bg-slate-50 dark:bg-slate-900 text-muted-foreground hover:bg-slate-100 dark:hover:bg-slate-800 hover:border-primary/50 transition-colors cursor-pointer",onClick:()=>document.getElementById(`upload-${d}`)?.click(),onDragOver:pe=>pe.preventDefault(),onDrop:pe=>{pe.preventDefault();const Pe=pe.dataTransfer.files?.[0];Pe&&Us(Pe)},"data-testid":`${d}-upload-zone`,children:[a.jsx("input",{id:`upload-${d}`,type:"file",accept:"image/*",className:"hidden",onChange:pe=>{const Pe=pe.target.files?.[0];Pe&&Us(Pe)}}),I?a.jsxs("div",{className:"flex flex-col items-center gap-3",children:[a.jsx(Me,{className:"h-8 w-8 text-primary animate-spin"}),a.jsx("p",{className:"font-medium text-primary",children:"Uploading image..."})]}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"w-16 h-16 rounded-full bg-primary/10 flex items-center justify-center mb-4",children:a.jsx(Tg,{className:"h-8 w-8 text-primary"})}),a.jsxs("p",{className:"text-lg font-semibold text-foreground mb-1",children:["Click to upload ",i.toLowerCase()]}),a.jsx("p",{className:"text-sm",children:"or drag and drop an image file"})]})]}),u&&a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("label",{className:"text-sm font-medium",children:"Diagram Notes"}),a.jsx(Ql,{value:n,onChange:pe=>{Oe.current=!0,r({imageUrl:e,annotations:t,notes:pe.target.value})},onBlur:pe=>{(he[te]?.notes||"")!==pe.target.value&&ze({notes:pe.target.value})},placeholder:"Add any extra notes or instructions for this diagram...",className:"min-h-[100px] resize-y","data-testid":`${d}-notes`})]}),a.jsx(mb,{open:_,onOpenChange:R,children:a.jsxs(Qh,{children:[a.jsxs(Zh,{children:[a.jsxs(ep,{children:["Remove ",i.toLowerCase(),"?"]}),a.jsxs(tp,{children:["This will erase the image",t.length>0?` and all ${t.length} pin${t.length===1?"":"s"}`:"",".",n?" Notes will also be cleared.":""," This cannot be undone after saving the quote."]})]}),a.jsxs(Jh,{children:[a.jsx(rp,{"data-testid":`${d}-confirm-remove-cancel`,children:"Cancel"}),a.jsx(np,{onClick:Jo,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90","data-testid":`${d}-confirm-remove-ok`,children:"Remove"})]})]})}),!f&&a.jsx(xh,{open:H,onOpenChange:L,children:a.jsxs(ud,{className:"max-w-[98vw] w-[1400px] h-[98vh] max-h-[1000px] p-0 flex flex-col gap-0 overflow-hidden bg-slate-50 dark:bg-slate-900 border-0",children:[a.jsx(dd,{className:"sr-only",children:"Fullscreen Diagram"}),a.jsx("div",{className:"flex-1 overflow-auto relative flex flex-col",children:a.jsx(jK,{imageUrl:e,annotations:t,notes:n,onChange:r,onUploadImage:s,title:i,description:l,showNotes:u,testIdPrefix:`${d}-full`,fullscreen:!0})})]})})]})}function RPe(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){const r=e[n],s=t[n];if(r.id!==s.id||r.number!==s.number||r.pinType!==s.pinType||r.label!==s.label||r.pinXPct!==s.pinXPct||r.pinYPct!==s.pinYPct||r.targetXPct!==s.targetXPct||r.targetYPct!==s.targetYPct)return!1}return!0}function g2(){return`dp-${Date.now()}-${Math.random().toString(36).slice(2,5)}`}const Yf=["customer","layout","materials","pricing","review"],fF={customer:"Customer",layout:"Layout",materials:"Materials",pricing:"Pricing",review:"Review"},mF={customer:"estimator",layout:"layout",materials:"material",pricing:"labor",review:"notes"};function Vx(){return`opt-${Date.now()}-${Math.random().toString(36).slice(2,5)}`}function hF(e){const t="Other",n=new Map;for(const r of e){const s=r.category?.trim()||t,i=n.get(s);i?i.push(r):n.set(s,[r])}return Array.from(n.entries()).sort(([r],[s])=>r===t?1:s===t?-1:r.localeCompare(s)).map(([r,s])=>({category:r,items:s}))}function Pr({title:e,icon:t,section:n,activeSection:r,onToggle:s,badge:i}){const l=r===n;return a.jsxs("button",{className:"w-full flex items-center gap-3 p-3 hover-elevate rounded-md",onClick:()=>s(l?"":n),"data-testid":`button-section-${n}`,children:[a.jsx(t,{className:"h-4 w-4 text-muted-foreground shrink-0"}),a.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground flex-1 text-left",children:e}),i&&a.jsx(Hh,{variant:"secondary",className:"text-xs",children:i}),l?a.jsx(Nr,{className:"h-4 w-4 text-primary shrink-0"}):a.jsx(wr,{className:"h-4 w-4 text-muted-foreground shrink-0"})]})}function et({children:e}){return a.jsx("p",{className:"text-xs font-medium text-muted-foreground mb-1.5 mt-3 first:mt-0",children:e})}function pF(e,t){return e.pinXPct!==void 0&&e.targetXPct!==void 0?{id:e.id,number:e.number??t+1,pinXPct:e.pinXPct,pinYPct:e.pinYPct,targetXPct:e.targetXPct,targetYPct:e.targetYPct,pinType:e.pinType||e.icon||"downspout",label:e.label||""}:{id:e.id,number:e.number??t+1,pinXPct:Math.max(0,Math.min(8,e.xPct??5)),pinYPct:e.yPct??(t+1)*15,targetXPct:e.xPct??50,targetYPct:e.yPct??50,pinType:e.icon||"downspout",label:e.label||(e.dimension?`${e.dimension}'`:"")}}function hi(e,t={}){const n=localStorage.getItem("fs_team_token"),r=t.body instanceof FormData;return fetch(e,{...t,headers:{...r?{}:{"Content-Type":"application/json"},...n?{Authorization:`Bearer ${n}`}:{},...t.headers||{}}})}function xF(){const[,e]=fr(),t=jh(),n=t.id?Number(t.id):null,r=n!==null,s=wt(),{toast:i}=nr(),{teamMember:l}=Nn(),u=l?.role==="admin",d=["admin","manager","estimator"].includes(l?.role??""),f=["admin","manager"].includes(l?.role??""),[h,p]=v.useState("estimator"),[x,y]=v.useState("customer"),[w,j]=v.useState(!1),[b,C]=v.useState(!1),[N,k]=v.useState(null),[T,A]=v.useState({...KR}),[P,E]=v.useState({...WR}),[_,R]=v.useState({...YR}),[H,L]=v.useState({...XR}),[I,W]=v.useState({...QR}),[U,V]=v.useState({...ZR}),[D,q]=v.useState({...JR}),[K,Y]=v.useState(0),[z,Z]=v.useState(""),[F,B]=v.useState(""),[X,Q]=v.useState([]),[se,ee]=v.useState(0),[ve,ue]=v.useState(null),[de,Se]=v.useState([]),[he,ce]=v.useState([]),[te,_e]=v.useState([]),[Oe,Te]=v.useState(!1),[Le,ze]=v.useState(null),[at,xt]=v.useState(null),[dt,Mt]=v.useState(!1),[ds,ua]=v.useState(""),[rr,$n]=v.useState(""),[Fr,In]=v.useState(!1),[hc,Zo]=v.useState(!1),[pc,qr]=v.useState(null),[Fi,Br]=v.useState(null),[Bs,da]=v.useState(null),[zs,Us]=v.useState(""),[Jo,qi]=v.useState([]),[Hs,pe]=v.useState(!1),[Pe,$e]=v.useState(null),{data:St}=Xe({queryKey:["/api/estimators"],queryFn:()=>hi("/api/estimators").then(M=>M.json())}),{data:Rt}=Xe({queryKey:["/api/clients"],queryFn:()=>hi("/api/clients").then(M=>M.json()),enabled:T.type==="contractor"}),fs=v.useMemo(()=>(Rt||[]).filter(M=>M.type==="contractor"),[Rt]);v.useEffect(()=>{if(r)return;const M=sessionStorage.getItem("quotePreFill");
130if(M){sessionStorage.removeItem("quotePreFill");try{const re=JSON.parse(M);if(re.leadId&&Br(Number(re.leadId)),re.customerData){const oe={...re.customerData};oe.type&&!["homeowner","contractor","business","hoa","propertyMgmt"].includes(oe.type)&&(oe.type="business",!oe.companyName&&oe.name&&(oe.contactName=oe.name)),A(ke=>({...ke,...oe}))}re.buildingData&&E(oe=>({...oe,...re.buildingData})),re.jobData&&R(oe=>({...oe,...re.jobData})),re.notes&&Z(re.notes)}catch{}}},[]),v.useEffect(()=>{const M=zs.trim();if(M.length<2){qi([]),pe(!1);return}const re=setTimeout(async()=>{try{const oe=await hi(`/api/clients/search?q=${encodeURIComponent(M)}`);if(oe.ok){const ke=await oe.json();qi(ke),pe(!0)}}catch{}},300);return()=>clearTimeout(re)},[zs]);const fa=v.useCallback(M=>{da(M.id),Us(""),pe(!1);const re=["homeowner","contractor","business","hoa","propertyMgmt"].includes(M.type)?M.type:"homeowner";A(re==="homeowner"?oe=>({...oe,type:re,name:M.name||"",phone:M.phone||"",email:M.email||"",address:M.address||"",city:M.city||"",state:M.state||oe.state,zip:M.zip||""}):oe=>({...oe,type:re,companyName:M.companyName||M.name||"",contactName:M.name||"",companyPhone:M.phone||"",companyEmail:M.email||"",address:M.address||"",city:M.city||"",state:M.state||oe.state,zip:M.zip||""}))},[]),{config:Qe}=pb(),{profile:kt}=uk(),Jt=oK(),Sn=M=>M.trim().toLowerCase();async function xc(M,re){const oe=M.label.trim(),ke=M.description.trim();let Fe;re?Fe=Qe.savedAddOns.map(Ye=>Sn(Ye.label)===Sn(oe)?{...Ye,label:oe,description:ke,price:M.price}:Ye):Fe=[...Qe.savedAddOns,{id:`saved-addon-${Date.now()}-${Math.random().toString(36).slice(2,5)}`,label:oe,description:ke,price:M.price}];try{await Jt.mutateAsync({savedAddOns:Fe}),i({title:re?"Library add-on updated":"Add-on saved to library"})}catch(Ye){i({title:Ye?.message||"Failed to save to library",variant:"destructive"})}}async function ip(M,re){const oe=M.name.trim(),ke=M.description.trim();let Fe;re?Fe=Qe.savedPackages.map(Ye=>Sn(Ye.name)===Sn(oe)?{...Ye,name:oe,description:ke,total:M.total}:Ye):Fe=[...Qe.savedPackages,{id:`saved-package-${Date.now()}-${Math.random().toString(36).slice(2,5)}`,name:oe,description:ke,total:M.total}];try{await Jt.mutateAsync({savedPackages:Fe}),i({title:re?"Library package updated":"Package saved to library"})}catch(Ye){i({title:Ye?.message||"Failed to save to library",variant:"destructive"})}}function wb(M){if(!M.label.trim()){i({title:"Add a label before saving to the library",variant:"destructive"});return}if(Qe.savedAddOns.some(re=>Sn(re.label)===Sn(M.label))){$e({type:"addon",item:M});return}xc(M,!1)}function op(M){if(!M.name.trim()){i({title:"Add a name before saving to the library",variant:"destructive"});return}if(Qe.savedPackages.some(re=>Sn(re.name)===Sn(M.name))){$e({type:"package",item:M});return}ip(M,!1)}const{data:el}=Xe({queryKey:["/api/inventory/products/for-estimate"],queryFn:()=>hi("/api/inventory/products/for-estimate").then(M=>M.json()),staleTime:300*1e3}),ma=el?.categories??[],Vs={Aluminum:"aluminum-coil","24 ga Steel":"steel-coil",Copper:"copper-coil"};function ms(M,re){const oe=Vs[M];if(!oe)return[];const ke=ma.find(Fe=>Fe.slug===oe);return ke?ke.products.filter(Fe=>!re||Fe.supplierName?.toLowerCase()===re.toLowerCase()):[]}function Gs(M,re){const oe=ma.find(Fe=>Fe.slug==="downspouts");if(!oe)return[];const ke=M==="24 ga Steel"?"steel":M.toLowerCase();return oe.products.filter(Fe=>{const Ye=!M||Fe.material===ke,mr=!re||Fe.supplierName?.toLowerCase()===re.toLowerCase();return Ye&&mr})}function Bi(M,re){if(Le){const oe=Vs[M],Fe=ma.find(Ye=>Ye.slug===oe)?.products.find(Ye=>Ye.id===Le);if(Fe?.minPricePerUnit!=null)return Fe.minPricePerUnit}return e5(M,re,Qe)}function xn(M,re){if(at){const ke=ma.find(Fe=>Fe.slug==="downspouts")?.products.find(Fe=>Fe.id===at);if(ke?.minPricePerUnit!=null)return ke.minPricePerUnit}return t5(M,re,Qe)}const hs=v.useMemo(()=>{if(!Le)return null;for(const M of ma){const re=M.products.find(oe=>oe.id===Le);if(re)return re}return null},[Le,ma]),zi=v.useMemo(()=>at?ma.find(re=>re.slug==="downspouts")?.products.find(re=>re.id===at)??null:null,[at,ma]),{data:ps=[]}=Xe({queryKey:["coil-rolls",Le],queryFn:()=>hi(`/api/inventory/coil-rolls/${Le}`).then(M=>
130{if(!M.ok)throw new Error("Failed to load rolls");return M.json()}),enabled:!!Le}),Cn=v.useMemo(()=>{const M=hs?.ftPerLb??0;if(!Le||!(M>0))return null;const re=ps.filter(Fe=>Fe.status==="partial"&&(Fe.weightLbs??0)>0).map(Fe=>{const Ye=Math.round((Fe.weightLbs??0)*10)/10;return{id:Fe.id,lbs:Ye,ft:Math.round(Ye*M)}}).sort((Fe,Ye)=>Ye.ft-Fe.ft);if(re.length===0)return null;const oe=de.length>0?Math.max(...de.map(Fe=>parseFloat(Fe.gutterFootage)||0)):parseFloat(_.gutterFootage)||0,ke=oe>0?re.filter(Fe=>Fe.ft>=oe):[];return{partials:re,fitting:ke,longestRun:oe}},[Le,ps,hs,de,_.gutterFootage]),gc=parseFloat(_.gutterPrice)||0,yc=parseFloat(_.downspoutPrice)||0,tl=Bi(_.material,_.gutterType),vc=xn(_.material,_.downspoutType),Ks=gc>0&&gc<tl,Ws=yc>0&&yc<vc,{data:zr}=Xe({queryKey:["/api/quotes",n],queryFn:()=>hi(`/api/quotes/${n}`).then(M=>M.json()),enabled:r});if(r&&zr&&!Oe){const M=zr;A(M.customerData),E(M.buildingData);const re=M.jobData;re.material==="Steel"&&(re.material="24 ga Steel"),re.materialPrice&&!re.gutterPrice&&(re.gutterPrice=re.materialPrice,re.downspoutPrice=re.materialPrice),re.gutterPrice||(re.gutterPrice=""),re.downspoutPrice||(re.downspoutPrice=""),R(re),L(M.guardsData),W(M.hardwareData),V(M.removalData),q(M.laborData),Y(M.consumablePercent||0),Z(M.notes||""),B(M.clientSummary||""),Se(M.sections||[]),ce(M.addOns||[]),_e(M.packages||[]);const oe=M.diagramPages||[];if(oe.length>0)Q(oe);else{const Fe=[],Ye=M.layoutAnnotations||[];(M.gutterDiagramUrl||Ye.length>0)&&Fe.push({id:g2(),name:"Layout",imageUrl:M.gutterDiagramUrl||"",annotations:Ye.map((Hr,hr)=>pF(Hr,hr)),notes:""});const mr=M.diagramAnnotations||[];(M.detailsDiagramUrl||mr.length>0||M.diagramNotes)&&Fe.push({id:g2(),name:"Details",imageUrl:M.detailsDiagramUrl||"",annotations:mr.map((Hr,hr)=>pF(Hr,hr)),notes:M.diagramNotes||""}),Q(Fe)}ee(0),k(M.estimatorId),Br(M.leadId??null),da(M.clientId??null);const ke=M.jobData;ke?.gutterProductId&&ze(ke.gutterProductId),ke?.downspoutProductId&&xt(ke.downspoutProductId),Te(!0)}v.useMemo(()=>Wde(_,de),[_,de]);const bc=["downspout"],Md=["a_elbow","b_elbow"],Ys=["inside_miter","boxed_inside_miter"],jc=["outside_miter","boxed_outside_miter"],wc=["end_cap","right_end_cap","left_end_cap"],lp=["splash_block","rain_diverter","left_to_right","right_to_left","a_return","b_return_rtl","b_return_ltr","text_note"],Nc=v.useMemo(()=>{const M=(ke,Fe)=>ke.filter(Ye=>Fe.includes(Ye.pinType)).length,re=X[se]?.annotations||[],oe=X.flatMap(ke=>ke.annotations||[]);return{current:{downspouts:M(re,bc),elbows:M(re,Md),insideMiters:M(re,Ys),outsideMiters:M(re,jc),endCaps:M(re,wc),other:M(re,lp)},total:{downspouts:M(oe,bc),elbows:M(oe,Md),insideMiters:M(oe,Ys),outsideMiters:M(oe,jc),endCaps:M(oe,wc),other:M(oe,lp)}}},[X,se]),Vn=M=>{const re=Nc.total;if(!M){const Fe=Date.now();Se(Ye=>[...Ye,{id:Fe,name:`Section ${Ye.length+1}`,gutterFootage:"",downspouts:re.downspouts?String(re.downspouts):"",elbows:re.elbows?String(re.elbows):"",insideMiters:re.insideMiters?String(re.insideMiters):"",outsideMiters:re.outsideMiters?String(re.outsideMiters):"",endCaps:re.endCaps?String(re.endCaps):"",note:""}]),i({title:"Section created with pin counts"});return}const oe=de.find(Fe=>Fe.id===M);!oe||(oe.downspouts||oe.elbows||oe.insideMiters||oe.outsideMiters||oe.endCaps)&&!confirm(`Overwrite existing pin counts in ${oe.name}? Gutter footage will not be affected.`)||(Se(Fe=>Fe.map(Ye=>Ye.id!==M?Ye:{...Ye,downspouts:re.downspouts?String(re.downspouts):"",elbows:re.elbows?String(re.elbows):"",insideMiters:re.insideMiters?String(re.insideMiters):"",outsideMiters:re.outsideMiters?String(re.outsideMiters):"",endCaps:re.endCaps?String(re.endCaps):""})),i({title:`Pin counts applied to ${oe.name}`}))},Xs=v.useMemo(()=>{if(de.length===0)return[];const M=parseFloat(_.gutterPrice)||0,re=parseFloat(_.downspoutPrice)||0;return de.map(oe=>Xz(oe,M,re,Qe))},[de,_.gutterPrice,_.downspoutPrice,Qe]);function cp(M){return!M||!M.costPerUnit?0:M.unitType==="per_pound"?M.ftPerLb&&M.ftPerLb>0?M.costPerUnit/M.ftPerLb:0:M.unitType==="per_foot"?M.costPerUnit:0}const Ui=v.useMemo(()=>cp(hs),[hs]),Sc=v.useMemo(()=>cp(zi),[zi]),Ae=v.useMemo(()=>Yz(_,H,I,U,D,K,de,Qe,{gutterCostPerFt:Ui,downspoutCostPerFt:Sc}),[_,H,I,U,D,K,de,Qe,Ui,Sc]),nl=nt({mutationFn:async({asDraft:M=!1}={})=>
130{if(!M&&Ks)throw new Error(`Gutter price $${gc.toFixed(2)}/ft is below the minimum $${tl.toFixed(2)}/ft.`);if(!M&&Ws)throw new Error(`Downspout price $${yc.toFixed(2)}/ft is below the minimum $${vc.toFixed(2)}/ft.`);const re={leadId:Fi,clientId:Bs,estimatorId:N,customerData:T,buildingData:P,jobData:{..._,gutterProductId:Le??null,downspoutProductId:at??null,gutterCostPerFt:Ui||null,downspoutCostPerFt:Sc||null,sectionPricings:Xs},guardsData:H,hardwareData:I,removalData:U,laborData:D,sections:de,addOns:he,packages:te,consumablePercent:K,notes:z,clientSummary:F,diagramPages:X,gutterDiagramUrl:X[0]?.imageUrl||"",layoutAnnotations:X[0]?.annotations||[],detailsDiagramUrl:X[1]?.imageUrl||"",diagramAnnotations:X[1]?.annotations||[],diagramNotes:X[1]?.notes||"",grandTotal:Ae.grandTotal},oe=r?`/api/quotes/${n}`:"/api/quotes",Fe=await hi(oe,{method:r?"PATCH":"POST",body:JSON.stringify(re)});if(!Fe.ok)throw new Error("Save failed");return Fe.json()},onSuccess:(M,re)=>{s.invalidateQueries({queryKey:["/api/quotes"]}),i({title:re?.asDraft?"Draft saved — resume it anytime from Quotes or the dashboard":r?"Quote updated":"Quote saved"}),e("/quotes")},onError:M=>{i({title:M?.message||"Error saving quote",variant:"destructive"})}}),Ar=v.useCallback(()=>{Br(null),da(null),Us(""),A({...KR}),E({...WR}),R({...YR}),L({...XR}),W({...QR}),V({...ZR}),q({...JR}),Y(0),Z(""),B(""),Q([]),ee(0),Se([]),ce([]),_e([]),k(null),ze(null),xt(null)},[]),Rd=()=>{Se(M=>[...M,{id:Date.now(),name:"",gutterFootage:"",downspouts:"",elbows:"",insideMiters:"",outsideMiters:"",endCaps:"",note:""}])},Fa=(M,re,oe)=>{Se(ke=>ke.map(Fe=>Fe.id===M?{...Fe,[re]:oe}:Fe))},Dd=M=>{Se(re=>re.filter(oe=>oe.id!==M))},Qs=()=>{const M={id:g2(),name:`Page ${X.length+1}`,imageUrl:"",annotations:[],notes:""};Q(re=>[...re,M]),ee(X.length)},$d=(M,re)=>{Q(oe=>oe.map((ke,Fe)=>Fe===M?{...ke,...re}:ke))},up=M=>{Q(re=>re.filter((oe,ke)=>ke!==M)),ee(re=>Math.min(re,Math.max(0,X.length-2)))},Zs=(M,re)=>{const oe=M+re;oe<0||oe>=X.length||(Q(ke=>{if(oe<0||oe>=ke.length)return ke;const Fe=[...ke];return[Fe[M],Fe[oe]]=[Fe[oe],Fe[M]],Fe}),ee(ke=>ke===M?oe:ke===oe?M:ke))},Gn=v.useMemo(()=>({gutterFt:de.reduce((M,re)=>M+(parseFloat(re.gutterFootage)||0),0),downspouts:de.reduce((M,re)=>M+(parseInt(re.downspouts)||0),0),elbows:de.reduce((M,re)=>M+(parseInt(re.elbows)||0),0),insideMiters:de.reduce((M,re)=>M+(parseInt(re.insideMiters)||0),0),outsideMiters:de.reduce((M,re)=>M+(parseInt(re.outsideMiters)||0),0),endCaps:de.reduce((M,re)=>M+(parseInt(re.endCaps)||0),0)}),[de]),dp=P.type==="residential"?[1,2,3,4]:[1,2,3,4,5,6,7,8,9,10],[Id,Cc]=v.useState(!1),Nb=async()=>{const M=X.filter(re=>re.imageUrl);if(M.length===0){i({title:"No diagram images to export"});return}Cc(!0);try{const re=T.name||T.companyName||"Quote";await tU(M,re)}catch{i({title:"PDF export failed",variant:"destructive"})}finally{Cc(!1)}},Sb=()=>{const M=T.type==="homeowner"?`${T.address}, ${T.city}, ${T.state} ${T.zip}`:`${T.jobAddress||T.address}, ${T.jobCity||T.city}, ${T.jobState||T.state} ${T.jobZip||T.zip}`;window.open(`https://www.google.com/maps/search/${encodeURIComponent(M)}/@?basemap=satellite`,"_blank")},Ac=async M=>{const re=new FormData;re.append("file",M);const oe=await hi("/api/uploads/gutter-diagram",{method:"POST",body:re});if(!oe.ok)throw new Error("Upload failed");return(await oe.json()).url},Ln=St?.find(M=>M.id===N),Ld=!!N&&(T.type==="homeowner"?!!T.name.trim():!!(T.companyName||"").trim()),Hi=de.length>0||X.some(M=>M.imageUrl)||(parseFloat(_.gutterFootage)||0)>0,fp=(de.length>0?Gn.gutterFt:parseFloat(_.gutterFootage)||0)>0&&gc>0&&!Ks&&!Ws,Fd=Ae.grandTotal>0,Vi={customer:Ld,layout:Hi,materials:fp,pricing:Fd,review:!1},[Gi,qa]=v.useState(!1);v.useEffect(()=>{if(!r||!Oe||Gi)return;const M=Yf.find(re=>re!=="review"&&!Vi[re])??"review";y(M),p(mF[M]),qa(!0)},[r,Oe,Gi]);const al=M=>{y(M),p(mF[M]),window.scrollTo({top:0})},Ki=Yf.indexOf(x),Ur=Ki<Yf.length-1?Yf[Ki+1]:null,Wi=Ur?a.jsxs(ne,{className:"w-full mt-2",variant:"secondary",onClick:()=>al(Ur),"data-testid":`button-next-${Ur}`,children:["Next: ",fF[Ur],a.jsx(wr,{className:"h-4 w-4 ml-1"})]}):null;return a.jsxs("div",{className:"pb-40",children:[a.jsxs("div",{className:`mx-auto p-3 space-y-2 ${x==="layout"?"max-w-[1500px]":"max-w-4xl"}`,children:[a.jsxs("div",{className:"flex items-center justify-between gap-2 flex-wrap mb-2",children:[a.jsx("h1",{className:"text-xl font-semibold tracking-tight","data-testid":"text-page-title",children:r?"Edit Quote":"New Quote"}),a.jsx(ne,{variant:"outline",size:"icon",onClick:()=>C(!0),"data-testid":"button-summary",children:a.jsx(jn,{className:"h-4 w-4"})})]}),a.jsx("div",{className:"sticky top-0 z-40 -mx-3 px-3 py-2 bg-background/95 backdrop-blur border-b",children:a.jsx("div",{className:"flex gap-1 overflow-x-auto",children:Yf.map((M,re)=>{const oe=x===M,ke=Vi[M];return a.jsxs("button",{onClick:()=>al(M),className:`flex items-center gap-1.5 px-3 py-1.5 rounded-full text-xs font-medium whitespace-nowrap border transition-colors ${oe?"bg-primary text-primary-foreground border-primary":ke?"bg-emerald-50 text-emerald-700 border-emerald-200 dark:bg-emerald-950 dark:text-emerald-300 dark:border-emerald-800":"bg-card text-muted-foreground border-border hover:bg-muted"}`,"data-testid":`tab-${M}`,children:[ke&&M!=="review"?a.jsx(st,{className:"h-3.5 w-3.5 shrink-0"}):a.jsx("span",{className:`h-4 w-4 shrink-0 rounded-full text-[10px] leading-4 text-center ${oe?"bg-primary-foreground
130/20":"bg-muted"}`,children:re+1}),fF[M]]},M)})})}),x==="customer"&&a.jsxs(a.Fragment,{children:[a.jsxs(ye,{children:[a.jsx(Pr,{title:"Estimator",icon:$q,section:"estimator",activeSection:h,onToggle:p,badge:Ln?.name}),h==="estimator"&&a.jsx(_t,{className:"px-3 pb-3 pt-0",children:St&&St.length>0?a.jsx("div",{className:"space-y-2",children:St.map(M=>a.jsxs("div",{className:`p-3 rounded-md border cursor-pointer transition-colors ${N===M.id?"border-primary bg-primary/5":"border-border"}`,onClick:()=>k(N===M.id?null:M.id),"data-testid":`card-estimator-${M.id}`,children:[a.jsx("p",{className:"font-medium text-sm",children:M.name}),M.phone&&a.jsx("p",{className:"text-xs text-muted-foreground",children:M.phone}),M.license&&a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Lic: ",M.license]})]},M.id))}):a.jsx("p",{className:"text-sm text-muted-foreground",children:"No estimators. Add them in settings."})})]}),a.jsxs(ye,{children:[a.jsx(Pr,{title:"Customer",icon:s3,section:"customer",activeSection:h,onToggle:p,badge:T.type==="homeowner"?T.name:T.companyName||T.contactName||void 0}),h==="customer"&&a.jsxs(_t,{className:"px-3 pb-3 pt-0",children:[a.jsxs("div",{className:"relative mb-3",children:[a.jsx(et,{children:"Find Existing Client"}),a.jsx(Ee,{placeholder:"Search clients by name, email, phone…",value:zs,onChange:M=>Us(M.target.value),"data-testid":"input-client-search"}),Hs&&Jo.length>0&&a.jsx("div",{className:"absolute z-20 mt-1 w-full rounded-md border bg-popover shadow-md max-h-60 overflow-y-auto",children:Jo.slice(0,8).map(M=>a.jsxs("button",{type:"button",className:"w-full text-left px-3 py-2 hover:bg-accent text-sm",onClick:()=>fa(M),"data-testid":`option-client-${M.id}`,children:[a.jsx("div",{className:"font-medium",children:M.companyName||M.name}),a.jsx("div",{className:"text-xs text-muted-foreground",children:[M.email,M.phone,[M.city,M.state].filter(Boolean).join(", ")].filter(Boolean).join(" · ")})]},M.id))}),Bs!==null&&a.jsxs("div",{className:"flex items-center gap-2 mt-1.5 text-xs text-muted-foreground",children:[a.jsx(st,{className:"h-3.5 w-3.5 text-green-600"}),"Linked to existing client",a.jsx("button",{type:"button",className:"underline",onClick:()=>da(null),"data-testid":"button-unlink-client",children:"Unlink"})]})]}),a.jsx("div",{className:"flex flex-wrap gap-1.5 mb-3",children:[{key:"homeowner",label:"Homeowner"},{key:"contractor",label:"Contractor"},{key:"business",label:"Business"},{key:"hoa",label:"HOA"},{key:"propertyMgmt",label:"Property Mgmt"}].map(M=>a.jsx(ne,{variant:T.type===M.key?"default":"outline",size:"sm",onClick:()=>A({...T,type:M.key}),"data-testid":`button-cust-type-${M.key}`,children:M.label},M.key))}),T.type==="homeowner"&&a.jsxs(a.Fragment,{children:[a.jsx(et,{children:"Contact Info"}),a.jsx(Ee,{placeholder:"Name",value:T.name,onChange:M=>A({...T,name:M.target.value}),className:"mb-2","data-testid":"input-name"}),a.jsxs("div",{className:"flex gap-2 mb-2",children:[a.jsx(Ee,{placeholder:"Phone",value:T.phone,onChange:M=>A({...T,phone:M.target.value}),"data-testid":"input-phone"}),a.jsx(Ee,{placeholder:"Email",value:T.email,onChange:M=>A({...T,email:M.target.value}),"data-testid":"input-email"})]}),a.jsx(et,{children:"Property Address"}),a.jsx(Ee,{placeholder:"Address",value:T.address,onChange:M=>A({...T,address:M.target.value}),className:"mb-2","data-testid":"input-address"}),a.jsxs("div",{className:"flex gap-2 mb-2",children:[a.jsx(Ee,{placeholder:"City",value:T.city,onChange:M=>A({...T,city:M.target.value}),className:"flex-[2]","data-testid":"input-city"}),a.jsx(Ee,{placeholder:"State",value:T.state,onChange:M=>A({...T,state:M.target.value}),className:"flex-1","data-testid":"input-state"}),a.jsx(Ee,{placeholder:"ZIP",value:T.zip,onChange:M=>A({...T,zip:M.target.value}),className:"flex-1","data-testid":"input-zip"})]}),a.jsx(Ee,{placeholder:"Gate Code (if any)",value:T.gateCode,onChange:M=>A({...T,gateCode:M.target.value}),"data-testid":"input-gatecode"})]}),T.type==="contractor"&&a.jsxs(a.Fragment,{children:[fs.length>0&&a.jsxs("div",{className:"mb-3",children:[a.jsx(et,{children:"Contractor Partner"}),a.jsxs(Sa,{value:"",onValueChange:M=>{const re=fs.find(oe=>String(oe.id)===M);re&&fa(re)},children:[a.jsx(ra,{"data-testid":"select-contractor-partner",children:a.jsx(Ca,{placeholder:"Pick an existing contractor partner…"})}),a.jsx(aa,{children:fs.map(M=>a.jsx(Qn,{value:String(M.id),children:M.companyName||M.name},M.id))})]})]}),a.jsx(et,{children:"Contractor Info"}),a.jsx(Ee,{placeholder:"Company Name",value:T.companyName,onChange:M=>A({...T,companyName:M.target.value}),className:"mb-2","data-testid":"input-company"}),a.jsx(Ee,{placeholder:"Contact Name",value:T.contactName,onChange:M=>A({...T,contactName:M.target.value}),className:"mb-2","data-testid":"input-contact"}),a.jsxs("div",{className:"flex gap-2 mb-2",children:[a.jsx(Ee,{placeholder:"Phone",value:T.companyPhone,onChange:M=>A({...T,companyPhone:M.target.value}),"data-testid":"input-comp-phone"}),a.jsx(Ee,{placeholder:"Email",value:T.companyEmail,onChange:M=>A({...T,companyEmail:M.target.value}),"data-testid":"input-comp-email"})]}),a.jsx(et,{children:"Property Owner"}),a.jsx(Ee,{placeholder:"Owner Name",value:T.ownerName,onChange:M=>A({...T,ownerName:M.target.value}),className:"mb-2","data-testid":"input-owner"}),a.jsxs("div",{className:"flex gap-2 mb-2",children:[a.jsx(Ee,{placeholder:"Owner Phone",value:T.ownerPhone,onChange:M=>A({...T,ownerPhone:M.target.value}),"data-testid":"input-owner-phone"}),a.jsx(Ee,{placeholder:"Owner Email",value:T.ownerEmail,onChange:M=>A({...T,ownerEmail:M.target.value}),"data-testid":"input-owner-email"})]}),a.jsx(et,{children:"Job Site Address"}),a.jsx(Ee,{placeholder:"Address",value:T.jobAddress,onChange:M=>A({...T,jobAddress:M.target.value}),className:"mb-2","data-testid":"input-job-addr"}),a.jsxs("div",{className:"flex gap-2 mb-2",children:[a.jsx(Ee,{placeholder:"City",value:T.jobCity,onChange:M=>A({...T,jobCity:M.target.value}),className:"flex-[2]"}),a.jsx(Ee,{placeholder:"State",value:T.jobState,onChange:M=>A({...T,jobState:M.target.value}),className:"flex-1"}),a.jsx(Ee,{placeholder:"ZIP",value:T.jobZip,onChange:M=>A({...T,jobZip:M.target.value}),className:"flex-1"})]}),a.jsx(Ee,{placeholder:"Gate Code (if any)",value:T.jobGateCode,onChange:M=>A({...T,jobGateCode:M.target.value})})]}),T.type==="business"&&a.jsxs(a.Fragment,{children:[a.jsx(et,{children:"Business Info"}
130),a.jsx(Ee,{placeholder:"Business Name",value:T.companyName,onChange:M=>A({...T,companyName:M.target.value}),className:"mb-2"}),a.jsx(Ee,{placeholder:"Contact Person",value:T.contactName,onChange:M=>A({...T,contactName:M.target.value}),className:"mb-2"}),a.jsxs("div",{className:"flex gap-2 mb-2",children:[a.jsx(Ee,{placeholder:"Phone",value:T.companyPhone,onChange:M=>A({...T,companyPhone:M.target.value})}),a.jsx(Ee,{placeholder:"Email",value:T.companyEmail,onChange:M=>A({...T,companyEmail:M.target.value})})]}),a.jsx(et,{children:"Business Address"}),a.jsx(Ee,{placeholder:"Address",value:T.address,onChange:M=>A({...T,address:M.target.value}),className:"mb-2"}),a.jsxs("div",{className:"flex gap-2 mb-2",children:[a.jsx(Ee,{placeholder:"City",value:T.city,onChange:M=>A({...T,city:M.target.value}),className:"flex-[2]"}),a.jsx(Ee,{placeholder:"State",value:T.state,onChange:M=>A({...T,state:M.target.value}),className:"flex-1"}),a.jsx(Ee,{placeholder:"ZIP",value:T.zip,onChange:M=>A({...T,zip:M.target.value}),className:"flex-1"})]}),a.jsx(Ee,{placeholder:"Gate Code (if any)",value:T.gateCode,onChange:M=>A({...T,gateCode:M.target.value})})]}),T.type==="hoa"&&a.jsxs(a.Fragment,{children:[a.jsx(et,{children:"HOA Info"}),a.jsx(Ee,{placeholder:"HOA Name",value:T.companyName,onChange:M=>A({...T,companyName:M.target.value}),className:"mb-2","data-testid":"input-hoa-name"}),a.jsx(Ee,{placeholder:"Property Manager / Contact",value:T.contactName,onChange:M=>A({...T,contactName:M.target.value}),className:"mb-2"}),a.jsxs("div",{className:"flex gap-2 mb-2",children:[a.jsx(Ee,{placeholder:"Phone",value:T.companyPhone,onChange:M=>A({...T,companyPhone:M.target.value})}),a.jsx(Ee,{placeholder:"Email",value:T.companyEmail,onChange:M=>A({...T,companyEmail:M.target.value})})]}),a.jsx(et,{children:"Community Address"}),a.jsx(Ee,{placeholder:"Address",value:T.address,onChange:M=>A({...T,address:M.target.value}),className:"mb-2"}),a.jsxs("div",{className:"flex gap-2 mb-2",children:[a.jsx(Ee,{placeholder:"City",value:T.city,onChange:M=>A({...T,city:M.target.value}),className:"flex-[2]"}),a.jsx(Ee,{placeholder:"State",value:T.state,onChange:M=>A({...T,state:M.target.value}),className:"flex-1"}),a.jsx(Ee,{placeholder:"ZIP",value:T.zip,onChange:M=>A({...T,zip:M.target.value}),className:"flex-1"})]}),a.jsx(Ee,{placeholder:"Gate Code (if any)",value:T.gateCode,onChange:M=>A({...T,gateCode:M.target.value})})]}),T.type==="propertyMgmt"&&a.jsxs(a.Fragment,{children:[a.jsx(et,{children:"Property Management Co."}),a.jsx(Ee,{placeholder:"Company Name",value:T.companyName,onChange:M=>A({...T,companyName:M.target.value}),className:"mb-2","data-testid":"input-pm-name"}),a.jsx(Ee,{placeholder:"Contact Name",value:T.contactName,onChange:M=>A({...T,contactName:M.target.value}),className:"mb-2"}),a.jsxs("div",{className:"flex gap-2 mb-2",children:[a.jsx(Ee,{placeholder:"Phone",value:T.companyPhone,onChange:M=>A({...T,companyPhone:M.target.value})}),a.jsx(Ee,{placeholder:"Email",value:T.companyEmail,onChange:M=>A({...T,companyEmail:M.target.value})})]}),a.jsx(et,{children:"Property Owner"}),a.jsx(Ee,{placeholder:"Owner Name",value:T.ownerName,onChange:M=>A({...T,ownerName:M.target.value}),className:"mb-2"}),a.jsxs("div",{className:"flex gap-2 mb-2",children:[a.jsx(Ee,{placeholder:"Owner Phone",value:T.ownerPhone,onChange:M=>A({...T,ownerPhone:M.target.value})}),a.jsx(Ee,{placeholder:"Owner Email",value:T.ownerEmail,onChange:M=>A({...T,ownerEmail:M.target.value})})]}),a.jsx(et,{children:"Job Site Address"}),a.jsx(Ee,{placeholder:"Address",value:T.jobAddress,onChange:M=>A({...T,jobAddress:M.target.value}),className:"mb-2"}),a.jsxs("div",{className:"flex gap-2 mb-2",children:[a.jsx(Ee,{placeholder:"City",value:T.jobCity,onChange:M=>A({...T,jobCity:M.target.value}),className:"flex-[2]"}),a.jsx(Ee,{placeholder:"State",value:T.jobState,onChange:M=>A({...T,jobState:M.target.value}),className:"flex-1"}),a.jsx(Ee,{placeholder:"ZIP",value:T.jobZip,onChange:M=>A({...T,jobZip:M.target.value}),className:"flex-1"})]}),a.jsx(Ee,{placeholder:"Gate Code (if any)",value:T.jobGateCode,onChange:M=>A({...T,jobGateCode:M.target.value})})]})]})]}),a.jsxs(ye,{children:[a.jsx(Pr,{title:"Building",icon:xd,section:"building",activeSection:h,onToggle:p,badge:`${P.type==="residential"?"Residential":"Commercial"} ${P.stories}st`}),h==="building"&&a.jsxs(_t,{className:"px-3 pb-3 pt-0",children:[a.jsx(et,{children:"Building Type"}),a.jsxs("div",{className:"flex gap-2 mb-3",children:[a.jsx(ne,{variant:P.type==="residential"?"default":"outline",className:"flex-1",onClick:()=>E({...P,type:"residential",stories:"1"}),"data-testid":"button-residential",children:"Residential"}),a.jsx(ne,{variant:P.type==="commercial"?"default":"outline",className:"flex-1",onClick:()=>E({...P,type:"commercial",stories:"1"}),"data-testid":"button-commercial",children:"Commercial"})]}),a.jsx(et,{children:"Number of Stories"}),a.jsx("div",{className:"flex flex-wrap gap-1.5 mb-3",children:dp.map(M=>a.jsx(ne,{variant:P.stories===String(M)?"default":"outline",size:"icon",onClick:()=>E({...P,stories:String(M)}),"data-testid":`button-story-${M}`,children:M},M))}),a.jsx(et,{children:"Roof Type"}),a.jsxs(Sa,{value:P.roofType,onValueChange:M=>E({...P,roofType:M}),children:[a.jsx(ra,{className:"mb-2","data-testid":"select-roof-type",children:a.jsx(Ca,{placeholder:"Select roof type"})}),a.jsx(aa,{children:Qt.roofTypes.map(M=>a.jsx(Qn,{value:M,children:M},M))})]}),a.jsx(et,{children:"Roof Material"}),a.jsxs(Sa,{value:P.roofMaterial,onValueChange:M=>E({...P,roofMaterial:M}),children:[a.jsx(ra,{className:"mb-2","data-testid":"select-roof-material",children:a.jsx(Ca,{placeholder:"Select roof material"})}),a.jsx(aa,{children:Qt.roofMaterials.map(M=>a.jsx(Qn,{value:M,children:M},M))})]}),a.jsx(et,{children:"Roof Pitch"}),a.jsxs(Sa,{value:P.roofPitch,onValueChange:M=>E({...P,roofPitch:M}),children:[a.jsx(ra,{"data-testid":"select-roof-pitch",children:a.jsx(Ca,{placeholder:"Select pitch"})}),a.jsx(aa,{children:Qt.roofPitches.map(M=>a.jsx(Qn,{value:M,children:M},M))})]})]})]}),Wi]}),x==="layout"&&a.jsxs(a.Fragment,{children:[a.jsxs(ye,{children:[a.jsx(Pr,{title:"Project Layout",icon:Ra,section:"layout",activeSection:h,onToggle:p,badge:de.length>0?`${de.length} sections`:X.some(M=>M.imageUrl)?`${X.filter(M=>M.imageUrl).length} diagram${X.filter(M=>M.imageUrl).length!==1?"s":""}`:void 0}),h==="layout"&&a.jsx(_t,{className:"px-3 pb-3 pt-0",children:a.jsxs("div",{className:"flex flex-col lg:flex-row gap-8 items-start",children:[a.jsxs("div",{className:"flex-1 min-w-0 
130w-full",children:[a.jsxs("div",{className:"mb-3",children:[a.jsxs("div",{className:"flex flex-row items-center gap-1 mb-2 overflow-x-auto pb-1",children:[X.map((M,re)=>a.jsxs("div",{className:`flex items-center gap-1 px-2 py-1 rounded-md text-sm cursor-pointer border shrink-0 ${se===re?"bg-primary text-primary-foreground border-primary":"bg-card hover:bg-muted border-border"}`,onClick:()=>ee(re),children:[X.length>1&&a.jsx("button",{className:"opacity-60 hover:opacity-100 disabled:opacity-20 disabled:cursor-not-allowed shrink-0",disabled:re===0,onClick:oe=>{oe.stopPropagation(),Zs(re,-1)},title:"Move page left","data-testid":`diagram-move-left-${re}`,children:a.jsx(Dq,{className:"h-3 w-3"})}),ve===re?a.jsx(Ee,{value:M.name,onChange:oe=>$d(re,{name:oe.target.value}),onBlur:()=>ue(null),onKeyDown:oe=>{(oe.key==="Enter"||oe.key==="Escape")&&ue(null)},className:"h-5 text-xs w-24 p-0 border-0 bg-transparent focus-visible:ring-0",autoFocus:!0,onClick:oe=>oe.stopPropagation(),"data-testid":`diagram-rename-input-${re}`}):a.jsx("span",{className:"text-xs",onDoubleClick:oe=>{oe.stopPropagation(),ue(re)},children:M.name||`Page ${re+1}`}),X.length>1&&a.jsx("button",{className:"opacity-60 hover:opacity-100 disabled:opacity-20 disabled:cursor-not-allowed shrink-0",disabled:re===X.length-1,onClick:oe=>{oe.stopPropagation(),Zs(re,1)},title:"Move page right","data-testid":`diagram-move-right-${re}`,children:a.jsx(wr,{className:"h-3 w-3"})}),X.length>1&&a.jsx("button",{className:"ml-0.5 opacity-60 hover:opacity-100 shrink-0",onClick:oe=>{oe.stopPropagation(),up(re)},"data-testid":`diagram-remove-page-${re}`,children:a.jsx(an,{className:"h-3 w-3"})})]},M.id)),a.jsxs(ne,{variant:"outline",size:"sm",className:"shrink-0 h-7 text-xs",onClick:Qs,"data-testid":"button-add-diagram-page",children:[a.jsx(Ft,{className:"h-3 w-3 mr-1"}),"Add Page"]})]}),X.length===0?a.jsx("div",{className:"text-center py-4",children:a.jsxs(ne,{variant:"outline",size:"sm",onClick:Qs,children:[a.jsx(Ft,{className:"h-3 w-3 mr-1"}),"Add First Diagram"]})}):a.jsx(MPe,{title:X[se]?.name||`Page ${se+1}`,imageUrl:X[se]?.imageUrl??"",annotations:X[se]?.annotations??[],notes:X[se]?.notes,onChange:M=>$d(se,{imageUrl:M.imageUrl,annotations:M.annotations,notes:M.notes??""}),onUploadImage:Ac,showNotes:!0,testIdPrefix:`diagram-page-${se}`},X[se]?.id??`page-${se}`)]}),a.jsx(ws,{className:"my-3"}),a.jsxs("div",{className:"flex gap-2 mb-3 items-start",children:[a.jsxs("div",{className:"flex-1 flex flex-col gap-1",children:[a.jsxs(ne,{variant:"outline",className:"w-full h-10",onClick:Sb,disabled:!T.address&&!T.jobAddress,"data-testid":"button-satellite",children:[a.jsx(Zee,{className:"h-4 w-4 mr-2"}),"Satellite View"]}),!T.address&&!T.jobAddress&&a.jsx("p",{className:"text-[10px] text-destructive leading-tight text-center font-medium",children:"Enter address first"})]}),a.jsxs(ne,{variant:"outline",className:"flex-1 h-10",onClick:Nb,disabled:Id||!X.some(M=>M.imageUrl),"data-testid":"button-export-diagrams-pdf",children:[Id?a.jsx(Me,{className:"h-4 w-4 mr-2 animate-spin"}):a.jsx(jn,{className:"h-4 w-4 mr-2"}),"Export PDF"]})]}),!T.address&&!T.jobAddress&&a.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:"Enter customer address first"})]}),a.jsxs("div",{className:"w-full lg:w-[420px] xl:w-[480px] shrink-0 lg:sticky lg:top-20 space-y-4",children:[X.length>0&&a.jsxs("div",{className:"mb-4 mt-2 p-3 bg-slate-50 dark:bg-slate-900 border border-border rounded-lg shadow-sm",children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsxs("div",{children:[a.jsxs("h4",{className:"font-semibold text-sm flex items-center gap-2",children:[a.jsx(s3,{className:"h-4 w-4 text-primary"}),"Live Pin Tally"]}),a.jsx("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:X.length>1?"Counts from all pages (current page in parenthesis)":"Counts from current diagram"})]}),de.length===0?a.jsxs(ne,{size:"sm",variant:"default",className:"h-8 text-xs",onClick:()=>Vn(null),children:[a.jsx(Ft,{className:"h-3 w-3 mr-1"})," Create Section"]}):de.length===1?a.jsxs(ne,{size:"sm",variant:"default",className:"h-8 text-xs",onClick:()=>Vn(de[0].id),children:[a.jsx(rg,{className:"h-3 w-3 mr-1"})," Apply to"," ",de[0].name]}):a.jsxs(p2,{children:[a.jsx(x2,{asChild:!0,children:a.jsxs(ne,{size:"sm",variant:"default",className:"h-8 text-xs",children:[a.jsx(rg,{className:"h-3 w-3 mr-1"})," Apply to Section"," ",a.jsx(Nr,{className:"h-3 w-3 ml-1 opacity-70"})]})}),a.jsxs(gg,{align:"end",children:[a.jsx(yg,{children:"Apply counts to..."}),a.jsx(fm,{}),de.map(M=>a.jsx(dm,{onClick:()=>Vn(M.id),children:M.name},M.id)),a.jsx(fm,{}),a.jsxs(dm,{onClick:()=>Vn(null),children:[a.jsx(Ft,{className:"h-4 w-4 mr-2"})," New Section"]})]})]})]}),a.jsx("div",{className:"grid grid-cols-3 sm:grid-cols-6 gap-2",children:[{label:"Downspouts",key:"downspouts"},{label:"Elbows",key:"elbows"},{label:"In Miters",key:"insideMiters"},{label:"Out Miters",key:"outsideMiters"},{label:"End Caps",key:"endCaps"},{label:"Other",key:"other",infoOnly:!0}].map(M=>{const re=M.key,oe=Nc.total[re],ke=Nc.current[re],Fe=oe>0;return a.jsxs("div",{className:`flex flex-col items-center justify-center p-2 rounded-md border transition-colors ${Fe&&!M.infoOnly?"bg-primary/5 border-primary/20":"bg-white dark:bg-slate-950 border-border"} ${M.infoOnly?"opacity-70":""}`,children:[a.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground text-center mb-1 line-clamp-1 w-full",title:M.label,children:M.label}),a.jsxs("div",{className:"flex items-baseline gap-1",children:[a.jsx("span",{className:`text-lg font-bold leading-none animate-in zoom-in duration-300 ${Fe&&!M.infoOnly?"text-primary":"text-foreground"}`,children:oe}),X.length>1&&a.jsxs("span",{className:"text-xs text-muted-foreground font-medium",children:["(",ke,")"]})]},oe)]},M.key)})})]}),a.jsxs("div",{className:"space-y-0",children:[a.jsx(et,{children:"Layout Sections"}),a.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"Add sections for each area (e.g., Front, Back, Garage)"}),a.jsxs(ne,{variant:"outline",className:"w-full mb-3",onClick:Rd,"data-testid":"button-add-section",children:[a.jsx(Ft,{className:"h-4 w-4 mr-2"}),"Add Section"]}),de.map((M,re)=>a.jsx(ye,{className:"mb-2",children:a.jsxs(_t,{className:"p-3",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Ee,{placeholder:`Section ${re+1} name`,value:M.name,onChange:oe=>Fa(M.id,"name",oe.target.value),className:"flex-1 font-medium","data-testid":`input-section-name-${re}`}),a.jsx(ne,{size:"icon",variant:"ghost",onClick:()=>Dd(M.id),"data-testid":`button-del-section-${re}`,children:a.jsx(an,{className:"h-4 w-4"})})]}),a.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"Gutter (ft)"}),a.jsx(Ee,{type:"text",inputMode:"decimal",placeholder:"0",value:M.gutterFootage,onChange:oe=>Fa(M.id,"gutterFootage",oe.target.value),"data-testid":`input-section-gutter-${re}`})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"Downspouts"}),a.jsx(Ee,{type:"text",inputMode:"numeric",placeholder:"0",value:M.downspouts,onChange:oe=>Fa(M.id,"downspouts",oe.target.value)})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"Elbows"}),a.jsx(Ee,{type:"text",inputMode:"numeric",placeholder:"0",value:M.elbows,onChange:oe=>Fa(M.id,"elbows",oe.target.value)})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"In Miters"}),a.jsx(Ee,{type:"text",inputMode:"numeric",placeholder:"0",value:M.insideMiters,onChange:oe=>Fa(M.id,"insideMiters",oe.target.value)})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"Out Miters"}),a.jsx(Ee,{type:"text",inputMode:"numeric",placeholder:"0",value:M.outsideMiters,onChange:oe=>Fa(M.id,"outsideMiters",oe.target.value)})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"End Caps"}),a.jsx(Ee,{type:"text",inputMode:"numeric",placeholder:"0",value:M.endCaps,onChange:oe=>Fa(M.id,"endCaps",oe.target.value)})]})]}),a.jsx(Ee,{placeholder:"Install notes...",value:M.note,onChange:oe=>Fa(M.id,"note",oe.target.value),className:"mt-2"}),Xs[re]&&Xs[re].sectionMaterialSubtotal>0&&a.jsxs("div",{className:"mt-2 flex items-center justify-between px-2 py-1.5 bg-primary/5 rounded-md",children:[a.jsx("span",{className:"text-xs text-muted-foreground",children:"Section subtotal"}),a.jsx("span",{className:"text-xs font-semibold text-primary",children:De(Xs[re].sectionMaterialSubtotal)})]})]})},M.id)),de.length>0&&a.jsxs("div",{className:"bg-muted rounded-md p-3 mt-2",children:[a.jsx("p",{className:"text-xs font-semibold text-muted-foreground mb-2 uppercase",children:"Section Totals"}),a.jsxs("div",{className:"grid grid-cols-3 gap-x-4 gap-y-1 text-sm mb-2",children:[a.jsxs("span",{children:["Gutters:"," ",a.jsxs("strong",{className:"text-primary",children:[Gn.gutterFt," ft"]})]}),a.jsxs("span",{children:["Downspouts:"," ",a.jsx("strong",{className:"text-primary",children:Gn.downspouts})]}),a.jsxs("span",{children:["Elbows:"," ",a.jsx("strong",{className:"text-primary",children:Gn.elbows})]}),a.jsxs("span",{children:["In Miters:"," ",a.jsx("strong",{className:"text-primary",children:Gn.insideMiters})]}),a.jsxs("span",{children:["Out Miters:"," ",a.jsx("strong",{className:"text-primary",children:Gn.outsideMiters})]}),a.jsxs("span",{children:["End Caps:"," ",a.jsx("strong",{className:"text-primary",children:Gn.endCaps})]})]}),Xs.some(M=>M.sectionMaterialSubtotal>0)&&a.jsx("div",{className:"border-t border-border/40 pt-2",children:a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Material subtotal:"," ",a.jsx("strong",{className:"text-primary",children:De(Xs.reduce((M,re)=>M+re.sectionMaterialSubtotal,0))})]})})]})]})]})]})})]}),Wi]}),x==="materials"&&a.jsxs(a.Fragment,{children:[a.jsxs(ye,{children:[a.jsx(Pr,{title:"Material & Gutter Type",icon:Du,section:"material",activeSection:h,onToggle:p,badge:_.material}),h==="material"&&a.jsxs(_t,{className:"px-3 pb-3 pt-0",children:[a.jsx(et,{children:"Material Type"}),a.jsx("div",{className:"flex gap-2 mb-3",children:Qt.materials.map(M=>a.jsx(ne,{variant:_.material===M?"default":"outline",className:"flex-1",onClick:()=>{const re=tw(M),oe=re.includes(_.gutterType)?_.gutterType:re[0]||_.gutterType,ke=n5(M,oe,Qe),Fe=r5(M,_.downspoutType,Qe);R({..._,material:M,gutterType:oe,gutterPrice:ke.toFixed(2),downspoutPrice:Fe.toFixed(2)}),ze(null),I.type==="hangers"&&!re.includes(I.hangerType)&&W({...I,hangerType:oe})},"data-testid":`button-mat-${M.toLowerCase().replace(/\s/g,"-")}`,children:M},M))}),a.jsx(et,{children:"Gutter Type"}),a.jsxs(Sa,{value:_.gutterType,onValueChange:M=>{const re=n5(_.material,M,Qe);R({..._,gutterType:M,gutterPrice:re.toFixed(2)}),ze(null)},children:[a.jsx(ra,{className:"mb-2","data-testid":"select-gutter-type",children:a.jsx(Ca,{})}),a.jsx(aa,{children:tw(_.material).map(M=>a.jsxs(Qn,{value:M,children:[M," — $",e5(_.material,M,Qe).toFixed(2),"/ft min"]},M))})]}),a.jsx(et,{children:"Manufacturer"}),a.jsx("div",{className:"flex gap-2 mb-3",children:Qt.downspoutManufacturers.map(M=>a.jsx(ne,{variant:_.gutterMfg===M?"default":"outline",className:"flex-1",onClick:()=>{R({..._,gutterMfg:M}),ze(null)},children:M},M))}),ms(_.material,_.gutterMfg).length>0&&a.jsxs(a.Fragment,{children:[a.jsx(et,{children:"Coil Product (from Inventory)"}),a.jsxs(Sa,{value:Le?String(Le):"_none",onValueChange:M=>{if(M==="_none"){ze(null);return}const re=Number(M);ze(re);const oe=ms(_.material,_.gutterMfg).find(ke=>ke.id===re);oe?.suggestedPricePerUnit!=null?R(ke=>({...ke,gutterPrice:oe.suggestedPricePerUnit.toFixed(2)})):oe?.minPricePerUnit!=null&&R(ke=>({...ke,gutterPrice:oe.minPricePerUnit.toFixed(2)}))},children:[a.jsx(ra,{className:"mb-1","data-testid":"select-gutter-product",children:a.jsx(Ca,{placeholder:"Select coil product…"})}),a.jsxs(aa,{children:[a.jsx(Qn,{value:"_none",children:"— None selected —"}),ms(_.material,_.gutterMfg).map(M=>a.jsxs(Qn,{value:String(M.id),children:[M.name,M.gauge?` .${M.gauge.replace(/^\./,"")}`:"",M.inStock?" ✓":" (out)"]},M.id))]})]}),u&&hs&&a.jsxs("p",{className:"text-xs text-blue-600 mb-2",children:["Cost ref: $",Number(hs.costPerUnit).toFixed(2),"/lb",hs.inStock?a.jsx("span",{className:"text-green-600 ml-1",children:"● In stock"}):a.jsx("span",{className:"text-orange-500 ml-1",children:"● Out of stock"})]}),Cn&&a.jsxs("div",{className:"mb-2 px-3 py-2 rounded-lg bg-amber-50 border border-amber-200","data-testid":"remnant-hint",children:[a.jsxs("p",{className:"text-xs font-semibold text-amber-900",children:[Cn.partials.length," remnant",Cn.partials.length!==1?"s":""," in shop:"," ",a.jsx("span",{className:"font-normal",children:Cn.partials.map(M=>`~${M.ft} ft (${M.lbs} lbs)`).join(", ")})]}),Cn.longestRun>0&&(Cn.fitting.length>0?a.jsxs("p",{className:"text-xs text-green-700 mt-0.5",children:["✓ Longest run on this job is"," ",Cn.longestRun," ft — remnant of ~",Cn.fitting[Cn.fitting.length-1].ft," ","ft (",Cn.fitting[Cn.fitting.length-1].lbs," ","lbs) covers it. Consider using a remnant before opening a new roll."]}):a.jsxs("p",{className:"text-xs text-amber-700 mt-0.5",children:["Longest run on this job is"," ",Cn.longestRun," ft — no single remnant covers it, but shorter runs may still use one."]}))]})]}),a.jsx(et,{children:"Gutter Price Per Foot"}),a.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[a.jsx("span",{className:"text-sm text-muted-foreground font-medium",children:"$"}),a.jsx(Ee,{type:"text",inputMode:"decimal",placeholder:"0.00",value:_.gutterPrice,onChange:M=>R({..._,gutterPrice:M.target.value}),className:`w-28 ${Ks?"border-red-500 focus-visible:ring-red-500":""}`,"data-testid":"input-gutter-price"}),a.jsx("span",{className:"text-xs text-muted-foreground",children:"/ ft"})]}),Ks?a.jsxs("p",{className:"text-xs text-red-600 font-medium mb-3",children:["Below minimum: $",tl.toFixed(2),"/ft — cannot save"]}):a.jsxs("p",{className:"text-xs text-muted-foreground mb-3",children:["Min: $",tl.toFixed(2),"/ft"]}),a.jsx(et,{children:"Color"}),a.jsx(Ee,{placeholder:"Enter color",value:_.gutterColor,onChange:M=>R({..._,gutterColor:M.target.value}),className:"mb-2","data-testid":"input-gutter-color"}),a.jsx(et,{children:"Gutter Footage"}),a.jsxs("div",{className:"flex items-center gap-2",children:[de.length>0?a.jsx("div",{className:"w-28 px-3 py-2 text-sm bg-muted rounded-md font-medium","data-testid":"input-gutter-footage",children:Gn.gutterFt}):a.jsx(Ee,{type:"text",inputMode:"decimal",placeholder:"0",value:_.gutterFootage,onChange:M=>R({..._,gutterFootage:M.target.value}),className:"w-28","data-testid":"input-gutter-footage"}),a.jsx("span",{className:"text-xs text-muted-foreground",children:de.length>0?"linear feet (from sections)":"linear feet"})]})]})]}),a.jsxs(ye,{children:[a.jsx(Pr,{title:"Downspouts",icon:rg,section:"downspout",activeSection:h,onToggle:p,badge:de.length>0?Gn.downspouts>0?`${Gn.downspouts*10} ft`:void 0:_.downspoutFootage?`${_.downspoutFootage} ft`:void 0}),h==="downspout"&&a.jsxs(_t,{className:"px-3 pb-3 pt-0",children:[a.jsx(et,{children:"Downspout Type"}),a.jsxs(Sa,{value:_.downspoutType,onValueChange:M=>{const re=r5(_.material,M,Qe);R({..._,downspoutType:M,downspoutPrice:re.toFixed(2)}),xt(null)},children:[a.jsx(ra,{className:"mb-2","data-testid":"select-ds-type",children:a.jsx(Ca,{})}),a.jsx(aa,{children:Qt.downspoutTypes.map(M=>a.jsxs(Qn,{value:M,children:[M," — $",t5(_.material,M,Qe).toFixed(2),"/ft min"]},M))})]}),a.jsx(et,{children:"Manufacturer"}),a.jsx("div",{className:"flex gap-2 mb-3",children:Qt.downspoutManufacturers.map(M=>a.jsx(ne,{variant:_.downspoutMfg===M?"default":"outline",className:"flex-1",onClick:()=>{R({..._,downspoutMfg:M}),xt(null)},children:M},M))}),Gs(_.material,_.downspoutMfg).length>0&&a.jsxs(a.Fragment,{children:[a.jsx(et,{children:"Downspout Product (from Inventory)"}),a.jsxs(Sa,{value:at?String(at):"_none",onValueChange:M=>{if(M==="_none"){xt(null);return}const re=Number(M);xt(re);const oe=Gs(_.material,_.downspoutMfg).find(ke=>ke.id===re);oe?.suggestedPricePerUnit!=null?R(ke=>({...ke,downspoutPrice:oe.suggested
130PricePerUnit.toFixed(2)})):oe?.minPricePerUnit!=null&&R(ke=>({...ke,downspoutPrice:oe.minPricePerUnit.toFixed(2)}))},children:[a.jsx(ra,{className:"mb-1","data-testid":"select-ds-product",children:a.jsx(Ca,{placeholder:"Select downspout product…"})}),a.jsxs(aa,{children:[a.jsx(Qn,{value:"_none",children:"— None selected —"}),Gs(_.material,_.downspoutMfg).map(M=>a.jsxs(Qn,{value:String(M.id),children:[M.name,M.inStock?" ✓":" (out)"]},M.id))]})]}),u&&zi&&a.jsxs("p",{className:"text-xs text-blue-600 mb-2",children:["Cost ref: $",Number(zi.costPerUnit).toFixed(2),"/ft",zi.inStock?a.jsx("span",{className:"text-green-600 ml-1",children:"● In stock"}):a.jsx("span",{className:"text-orange-500 ml-1",children:"● Out of stock"})]})]}),a.jsx(et,{children:"Downspout Price Per Foot"}),a.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[a.jsx("span",{className:"text-sm text-muted-foreground font-medium",children:"$"}),a.jsx(Ee,{type:"text",inputMode:"decimal",placeholder:"0.00",value:_.downspoutPrice,onChange:M=>R({..._,downspoutPrice:M.target.value}),className:`w-28 ${Ws?"border-red-500 focus-visible:ring-red-500":""}`,"data-testid":"input-ds-price"}),a.jsx("span",{className:"text-xs text-muted-foreground",children:"/ ft"})]}),Ws?a.jsxs("p",{className:"text-xs text-red-600 font-medium mb-3",children:["Below minimum: $",vc.toFixed(2),"/ft — cannot save"]}):a.jsxs("p",{className:"text-xs text-muted-foreground mb-3",children:["Min: $",vc.toFixed(2),"/ft"]}),a.jsx(et,{children:"Color"}),a.jsxs(Sa,{value:_.downspoutColor||"_none",onValueChange:M=>R({..._,downspoutColor:M==="_none"?"":M}),children:[a.jsx(ra,{className:"mb-2","data-testid":"select-ds-color",children:a.jsx(Ca,{placeholder:"Select color"})}),a.jsxs(aa,{children:[a.jsx(Qn,{value:"_none",children:"-- Select --"}),(Qt.downspoutColors[_.downspoutMfg]||[]).map(M=>a.jsx(Qn,{value:M,children:M},M))]})]}),a.jsx(et,{children:"Downspout Footage"}),a.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[de.length>0?a.jsx("div",{className:"w-28 px-3 py-2 text-sm bg-muted rounded-md font-medium","data-testid":"input-ds-footage",children:Gn.downspouts*10}):a.jsx(Ee,{type:"text",inputMode:"decimal",placeholder:"0",value:_.downspoutFootage,onChange:M=>R({..._,downspoutFootage:M.target.value}),className:"w-28","data-testid":"input-ds-footage"}),a.jsx("span",{className:"text-xs text-muted-foreground",children:de.length>0?"linear feet (from sections)":"linear feet"})]}),Ae.downspoutSticks>0&&a.jsxs("p",{className:"text-xs text-primary",children:[Ae.downspoutSticks," stick(s) = ",Ae.downspoutFt," ","billable ft"]}),a.jsx(et,{children:"Elbows"}),de.length>0?a.jsx("div",{className:"w-28 px-3 py-2 text-sm bg-muted rounded-md mb-1 font-medium","data-testid":"input-elbows",children:Gn.elbows}):a.jsx(Ee,{type:"text",inputMode:"numeric",placeholder:"0",value:_.elbows,onChange:M=>R({..._,elbows:M.target.value}),className:"w-28 mb-1","data-testid":"input-elbows"}),Ae.elbowCount>0&&a.jsxs("p",{className:"text-xs text-primary",children:["Adds ",Ae.elbowFt," ft (",Qe.elbowFeetAdded," ft each)",de.length>0?" (from sections)":""]})]})]}),a.jsxs(ye,{children:[a.jsx(Pr,{title:"Miters, End Caps & Outlets",icon:Xee,section:"fittings",activeSection:h,onToggle:p}),h==="fittings"&&a.jsxs(_t,{className:"px-3 pb-3 pt-0",children:[de.length>0&&a.jsx("p",{className:"text-[11px] text-muted-foreground mb-2 bg-muted/60 rounded px-2 py-1",children:"Miters and end caps are computed from Layout Sections. Outlets remain manual."}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx(et,{children:"Inside Miters"}),de.length>0?a.jsx("div",{className:"px-3 py-2 text-sm bg-muted rounded-md font-medium","data-testid":"input-in-miters",children:Gn.insideMiters}):a.jsx(Ee,{type:"text",inputMode:"numeric",placeholder:"0",value:_.insideMiters,onChange:M=>R({..._,insideMiters:M.target.value}),"data-testid":"input-in-miters"})]}),a.jsxs("div",{children:[a.jsx(et,{children:"Outside Miters"}),de.length>0?a.jsx("div",{className:"px-3 py-2 text-sm bg-muted rounded-md font-medium","data-testid":"input-out-miters",children:Gn.outsideMiters}):a.jsx(Ee,{type:"text",inputMode:"numeric",placeholder:"0",value:_.outsideMiters,onChange:M=>R({..._,outsideMiters:M.target.value}),"data-testid":"input-out-miters"})]}),a.jsxs("div",{children:[a.jsx(et,{children:"End Caps"}),de.length>0?a.jsx("div",{className:"px-3 py-2 text-sm bg-muted rounded-md font-medium","data-testid":"input-end-caps",children:Gn.endCaps}):a.jsx(Ee,{type:"text",inputMode:"numeric",placeholder:"0",value:_.endCaps,onChange:M=>R({..._,endCaps:M.target.value}),"data-testid":"input-end-caps"})]}),a.jsxs("div",{children:[a.jsx(et,{children:"Outlets"}),a.jsx(Ee,{type:"text",inputMode:"numeric",placeholder:"0",value:_.outlets,onChange:M=>R({..._,outlets:M.target.value}),"data-testid":"input-outlets"})]})]}),(Ae.miterFt>0||Ae.endCapFt>0||Ae.outletFt>0)&&a.jsxs("p",{className:"text-xs text-primary mt-2",children:["Adds ",Ae.miterFt+Ae.endCapFt+Ae.outletFt," ft total (",Ae.insideMiterCount+Ae.outsideMiterCount," ","miter
130s x ",Qe.miterFeetAdded,"ft,"," ",Ae.endCapCount," caps x ",Qe.endCapFeetAdded,"ft, ",Ae.outletCount," outlets x"," ",Qe.outletFeetAdded,"ft)"]})]})]}),a.jsxs(ye,{children:[a.jsx(Pr,{title:"Hardware",icon:qq,section:"hardware",activeSection:h,onToggle:p,badge:I.type==="hangers"?"Hangers":"Rods"}),h==="hardware"&&a.jsxs(_t,{className:"px-3 pb-3 pt-0",children:[a.jsx(et,{children:"Attachment Type"}),a.jsxs("div",{className:"flex gap-2 mb-3",children:[a.jsx(ne,{variant:I.type==="hangers"?"default":"outline",className:"flex-1",onClick:()=>W({...I,type:"hangers"}),"data-testid":"button-hangers",children:"Hangers"}),a.jsx(ne,{variant:I.type==="rods"?"default":"outline",className:"flex-1",onClick:()=>W({...I,type:"rods"}),"data-testid":"button-rods",children:"Rods"})]}),I.type==="hangers"&&a.jsxs(a.Fragment,{children:[a.jsx(et,{children:"Hanger Type"}),a.jsxs(Sa,{value:I.hangerType,onValueChange:M=>W({...I,hangerType:M}),children:[a.jsx(ra,{"data-testid":"select-hanger-type",children:a.jsx(Ca,{})}),a.jsx(aa,{children:tw(_.material).map(M=>a.jsxs(Qn,{value:M,children:[M," - $",Qe.hangerPrices[M]?.toFixed(2)]},M))})]})]}),Ae.hangerCount>0&&a.jsxs("p",{className:"text-xs text-primary mt-2",children:[Ae.hangerCount," hangers @ ",De(Ae.hangerPrice)," ","each = ",De(Ae.hangerCost)]}),Ae.rodCount>0&&a.jsxs("p",{className:"text-xs text-primary mt-2",children:[Ae.rodCount," rods @ ",De(Qe.rodPrice)," each = ",De(Ae.rodCost)]}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"1 per every 3 feet of gutter"})]})]}),a.jsxs(ye,{children:[a.jsx(Pr,{title:"Gutter Guards",icon:ste,section:"guards",activeSection:h,onToggle:p,badge:H.type!=="none"?Qe.guards[H.type]?.label:void 0}),h==="guards"&&a.jsxs(_t,{className:"px-3 pb-3 pt-0",children:[a.jsx(et,{children:"Guard Type"}),a.jsx("div",{className:"space-y-1.5 mb-3",children:Object.entries(Qe.guards).map(([M,re])=>a.jsxs(ne,{variant:H.type===M?"default":"outline",className:"w-full justify-between",onClick:()=>L({...H,type:M}),"data-testid":`button-guard-${M}`,children:[a.jsx("span",{children:re.label}),re.rate>0&&a.jsxs("span",{className:"text-xs opacity-70",children:["$",re.rate.toFixed(2),"/ft"]})]},M))}),H.type!=="none"&&a.jsxs(a.Fragment,{children:[a.jsx(et,{children:"Guard Footage"}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Ee,{type:"text",inputMode:"decimal",placeholder:"0",value:H.footage,onChange:M=>L({...H,footage:M.target.value}),className:"w-28","data-testid":"input-guard-footage"}),a.jsx("span",{className:"text-xs text-muted-foreground",children:"linear feet"})]}),Ae.guardCost>0&&a.jsxs("p",{className:"text-xs text-primary mt-1",children:["Guard cost: ",De(Ae.guardCost)]})]})]})]}),a.jsxs(ye,{children:[a.jsx(Pr,{title:"Removal",icon:on,section:"removal",activeSection:h,onToggle:p,badge:U.needed?`${U.footage||0} ft`:void 0}),h==="removal"&&a.jsxs(_t,{className:"px-3 pb-3 pt-0",children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsx("span",{className:"text-sm",children:"Existing gutter removal needed?"}),a.jsx(jV,{checked:U.needed,onCheckedChange:M=>V({...U,needed:M}),"data-testid":"switch-removal"})]}),U.needed&&a.jsxs(a.Fragment,{children:[a.jsx(et,{children:"Removal Footage"}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Ee,{type:"text",inputMode:"decimal",placeholder:"0",value:U.footage,onChange:M=>V({...U,footage:M.target.value}),className:"w-28","data-testid":"input-removal-footage"}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:["ft @ $",Qe.removalRate.toFixed(2),"/ft"]})]}),Ae.removalCost>0&&a.jsxs("p",{className:"text-xs text-primary mt-1",children:["Removal cost: ",De(Ae.removalCost)]})]})]})]}),Wi]}),x==="pricing"&&a.jsxs(a.Fragment,{children:[a.jsxs(ye,{children:[a.jsx(Pr,{title:"Labor",icon:Bq,section:"labor",activeSection:h,onToggle:p,badge:Ae.totalLaborCost>0?De(Ae.totalLaborCost):void 0}),h==="labor"&&a.jsxs(_t,{className:"px-3 pb-3 pt-0",children:[a.jsx(et,{children:"Foreman Hours"}),a.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[a.jsx(Ee,{type:"text",inputMode:"decimal",placeholder:"0",value:D.foremanHours,onChange:M=>q({...D,foremanHours:M.target.value}),className:"w-28","data-testid":"input-foreman-hrs"}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:["hrs @ $",Qe.foremanRate.toFixed(2),"/hr"]})]}),a.jsx(et,{children:"Technicians"}),a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Ee,{type:"text",inputMode:"numeric",placeholder:"0",value:D.techCount,onChange:M=>q({...D,techCount:M.target.value}),className:"w-20","data-testid":"input-tech-count"}),a.jsx("span",{className:"text-xs text-muted-foreground",children:"techs"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Ee,{type:"text",inputMode:"decimal",placeholder:"0",value:D.techHours,onChange:M=>q({...D,techHours:M.target.value}),className:"w-20","data-testid":"input-tech-hrs"}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:["hrs each @ $",Qe.techRate.toFixed(2),"/hr"]})]}),Ae.totalLaborCost>0&&a.jsxs("div",{className:"bg-muted rounded-md p-2 mt-3 text-xs space-y-0.5",children:[Ae.foremanCost>0&&a.jsxs("p",{children:["Foreman: ",De(Ae.foremanCost)]}),Ae.techCost>0&&a.jsxs("p",{children:["Techs: ",De(Ae.techCost)]}),a.jsxs("p",{className:"font-medium",children:["Total labor: ",De(Ae.totalLaborCost)]})]})]})]}),a.jsxs("button",{className:"w-full flex items-center gap-2 px-3 py-2 text-xs font-medium text-muted-foreground hover:text-foreground",onClick:()=>j(M=>!M),"data-testid":"button-toggle-advanced",children:[w?a.jsx(Nr,{className:"h-3.5 w-3.5"}):a.jsx(wr,{className:"h-3.5 w-3.5"}),"Advanced",K>0&&!w?` (consumables ${K}%)`:""]}),w&&a.jsxs(ye,{children:[a.jsx(Pr,{title:"Consumables",icon:Uq,section:"consumables",activeSection:h,onToggle:p,badge:K>0?`${K}%`:void 0}),h==="consumables"&&a.jsxs(_t,{className:"px-3 pb-3 pt-0",children:[a.jsx(et,{children:"Consumable Percentage"}),a.jsx("div",{className:"flex flex-wrap gap-1.5",children:Qe.consumableOptions.map(M=>a.jsxs(ne,{variant:K===M?"default":"outline",size:"sm",onClick:()=>Y(M),"data-testid":`button-cons-${M}`,children:[M,"%"]},M))}),K>0&&Ae.subtotal>0&&a.jsxs("p",{className:"text-xs text-primary mt-2",children:["Adds ",De(Ae.consumableCost)," to total"]})]})]}),a.jsxs(ye,{children:[a.jsx(Pr,{title:"Client Options",icon:Ft,section:"options",activeSection:h,onToggle:p,badge:he.length||te.length?`${he.length} add-on${he.length!==1?"s":""}, ${te.length} package${te.length!==1?"s":""}`:void 0}),h==="options"&&a.jsxs(_t,{className:"px-3 pb-3 pt-0 space-y-4",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-1",children:[a.jsx(et,{children:"Optional Add-ons"}),a.jsxs("div",{className:"flex items-center gap-1",children:[Qe.savedAddOns.length>0&&a.jsxs(p2,{children:[a.jsx(x2,{asChild:!0,children:a.jsxs(ne,{variant:"outline",size:"sm","data-testid":"button-use-saved-addon",children:[a.jsx(Ft,{className:"h-3 w-3 mr-1"}),"Use saved"]})}),a.jsx(gg,{align:"end",className:"max-w-[18rem]",children:hF(Qe.savedAddOns).map((M,re)=>a.jsxs("div",{children:[re>0&&a.jsx(fm,{}),a.jsx(yg,{children:M.category}),M.items.map(oe=>a.jsx(dm,{onSelect:()=>ce(ke=>[...ke,{id:Vx(),label:oe.label,description:oe.description,price:oe.price}]),"data-testid":`item-saved-addon-${oe.id}`,children:a.jsxs("div",{className:"flex items-center justify-between gap-3 w-full",children:[a.jsx("span",{className:"truncate",children:oe.label||"Untitled add-on"}),a.jsx("span",{className:"text-muted-foreground shrink-0",children:De(oe.price)})]})},oe.id))]},M.category))})]}),a.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>ce(M=>[...M,{id:Vx(),label:"",description:"",price:0}]),"data-testid":"button-add-addon",children:[a.jsx(Ft,{className:"h-3 w-3 mr-1"}),"Add"]})]})]}),a.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"Extras the client can choose to add to the base quote."}),he.length===0&&a.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No add-ons."}),a.jsx("div",{className:"space-y-2",children:he.map(M=>a.jsxs("div",{className:"rounded-md border p-2 space-y-1.5",children:[a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Ee,{placeholder:"Label (e.g. Leaf guard upgrade)",value:M.label,onChange:re=>ce(oe=>oe.map(ke=>ke.id===M.id?{...ke,label:re.target.value}:ke)),"data-testid":`input-addon-label-${M.id}`}),a.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:"$"}),a.jsx(Ee,{type:"number",className:"w-24",placeholder:"0",value:M.price||"",onChange:re=>ce(oe=>oe.map(ke=>ke.id===M.id?{...ke,price:parseFloat(re.target.value)||0}:ke)),"data-testid":`input-addon-price-${M.id}`})]}),f&&a.jsx(ne,{variant:"ghost",size:"icon",className:"shrink-0",title:"Save to library",disabled:Jt.isPending,onClick:()=>wb(M),"data-testid":`button-save-addon-${M.id}`,children:a.jsx(t3,{className:"h-4 w-4"})}),a.jsx(ne,{variant:"ghost",size:"icon",className:"shrink-0",onClick:()=>ce(re=>re.filter(oe=>oe.id!==M.id)),"data-testid":`button-remove-addon-${M.id}`,children:a.jsx(an,{className:"h-4 w-4"})})]}),a.jsx(Ee,{placeholder:"Description (optional)",value:M.description,onChange:re=>ce(oe=>oe.map(ke=>ke.id===M.id?{...ke,description:re.target.value}:ke)),"data-testid":`input-addon-desc-${M.id}`})]},M.id))})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-1",children:[a.jsx(et,{children:"Alternate Packages"}),a.jsxs("div",{className:"flex items-center gap-1",children:[Qe.savedPackages.length>0&&a.jsxs(p2,{children:[a.jsx(x2,{asChild:!0,children:a.jsxs(ne,{variant:"outline",size:"sm","data-testid":"button-use-saved-package",children:[a.jsx(Ft,{className:"h-3 w-3 mr-1"}),"Use saved"]})}),a.jsx(gg,{align:"end",className:"max-w-[18rem]",children:hF(Qe.savedPackages).map((M,re)=>a.jsxs("div",{children:[re>0&&a.jsx(fm,{}),a.jsx(yg,{children:M.category}),M.items.map(oe=>a.jsx(dm,{onSelect:()=>_e(ke=>[...ke,{id:Vx(),name:oe.name,description:oe.description,total:oe.total}]),"data-testid":`item-saved-package-${oe.id}`,children:a.jsxs("div",{className:"flex items-center justify-between gap-3 w-full",children:[a.jsx("span",{className:"truncate",children:oe.name||"Untitled package"}),a.jsx("span",{className:"text-muted-foreground shrink-0",children:De(oe.total)})]})},oe.id))]},M.category))})]}),a.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>_e(M=>[...M,{id:Vx(),name:"",description:"",total:0}]),"data-testid":"button-add-package",children:[a.jsx(Ft,{className:"h-3 w-3 mr-1"}),"Add"]})]})]}),a.jsxs("p",{className:"text-xs text-muted-foreground mb-2",children:["Alternate tiers the client can pick instead of the base quote (",De(Ae.grandTotal),")."]}),te.length===0&&a.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No alternate packages."}),a.jsx("div",{className:"space-y-2",children:te.map(M=>a.jsxs("div",{className:"rounded-md border p-2 space-y-1.5",children:[a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Ee,{placeholder:"Name (e.g. Premium)",value:M.name,onChange:re=>_e(oe=>oe.map(ke=>ke.id===M.id?{...ke,name:re.target.value}:ke)),"data-testid":`input-package-name-${M.id}`}),a.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:"$"}),a.jsx(Ee,{type:"number",className:"w-24",placeholder:"0",value:M.total||"",onChange:re=>_e(oe=>oe.map(ke=>ke.id===M.id?{...ke,total:parseFloat(re.target.value)||0}:ke)),"data-testid":`input-package-total-${M.id}`})]}),f&&a.jsx(ne,{variant:"ghost",size:"icon",className:"shrink-0",title:"Save to library",disabled:Jt.isPending,onClick:()=>op(M),"data-testid":`button-save-package-${M.id}`,children:a.jsx(t3,{className:"h-4 w-4"})}),a.jsx(ne,{variant:"ghost",size:"icon",className:"shrink-0",onClick:()=>_e(re=>re.filter(oe=>oe.id!==M.id)),"data-testid":`button-remove-package-${M.id}`,children:a.jsx(an,{className:"h-4 w-4"})})]}),a.jsx(Ee,{placeholder:"Description (optional)",value:M.description,onChange:re=>_e(oe=>oe.map(ke=>ke.id===M.id?{...ke,description:re.target.value}:ke)),"data-testid":`input-package-desc-${M.id}`})]},M.id))})]})]})]}),Wi]}),x==="review"&&a.jsxs(a.Fragment,{children:[a.jsxs(ye,{children:[a.jsx(Pr,{title:"Notes",icon:q2,section:"notes",activeSection:h,onToggle:p,badge:z||F?"Has notes":void 0}),h==="notes"&&a.jsxs(_t,{className:"px-3 pb-3 pt-0",children:[a.jsx(et,{children:"Internal Notes"}),a.jsx(Ql,{placeholder:"Internal notes (not shown to customer)...",value:z,onChange:M=>Z(M.target.value),rows:3,"data-testid":"textarea-notes"}),a.jsx(et,{children:"Client Summary"}),a.jsx(Ql,{placeholder:"Summary of work for the client proposal...",value:F,onChange:M=>
130B(M.target.value),rows:4,"data-testid":"textarea-client-summary"})]})]}),a.jsx(ye,{children:a.jsxs(_t,{className:"p-3 space-y-2",children:[a.jsx("p",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Ready to save?"}),[["customer","Customer & estimator"],["layout","Layout"],["materials","Materials & footage"],["pricing","Pricing"]].map(([M,re])=>a.jsxs("button",{className:"w-full flex items-center gap-2 text-sm",onClick:()=>al(M),"data-testid":`review-check-${M}`,children:[Vi[M]?a.jsx(st,{className:"h-4 w-4 text-emerald-600 shrink-0"}):a.jsx(Kt,{className:"h-4 w-4 text-amber-500 shrink-0"}),a.jsx("span",{className:`flex-1 text-left ${Vi[M]?"":"text-muted-foreground"}`,children:re}),!Vi[M]&&a.jsx("span",{className:"text-xs text-primary",children:"Fix"})]},M)),a.jsx(ws,{}),a.jsxs(ne,{variant:"outline",className:"w-full",onClick:()=>C(!0),"data-testid":"button-review-summary",children:[a.jsx(jn,{className:"h-4 w-4 mr-2"}),"View Full Summary"]})]})})]})]}),a.jsx("div",{className:"sticky bottom-0 z-50 bg-card border-t shadow-lg",children:a.jsxs("div",{className:"max-w-2xl mx-auto",children:[Ae.subtotal>0&&a.jsxs("div",{className:"flex flex-wrap gap-x-3 gap-y-0.5 px-4 pt-2 text-xs text-muted-foreground",children:[Ae.totalMaterialCost>0&&a.jsxs("span",{children:["Material: ",De(Ae.totalMaterialCost)]}),Ae.hangerCost>0&&a.jsxs("span",{children:["Hangers: ",De(Ae.hangerCost)]}),Ae.rodCost>0&&a.jsxs("span",{children:["Rods: ",De(Ae.rodCost)]}),Ae.guardCost>0&&a.jsxs("span",{children:["Guards: ",De(Ae.guardCost)]}),Ae.removalCost>0&&a.jsxs("span",{children:["Removal: ",De(Ae.removalCost)]}),Ae.totalLaborCost>0&&a.jsxs("span",{children:["Labor: ",De(Ae.totalLaborCost)]}),Ae.consumableCost>0&&a.jsxs("span",{children:["Consumables: ",De(Ae.consumableCost)]})]}),d&&Ae.materialActualCost!=null&&a.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-0.5 px-4 pt-1 text-xs","data-testid":"text-material-margin",children:[a.jsxs("span",{className:"text-muted-foreground",children:["Mat. sell: ",De(Ae.totalMaterialCost)]}),a.jsxs("span",{className:"text-muted-foreground",children:["Mat. cost: ",De(Ae.materialActualCost)]}),a.jsxs("span",{className:Ae.materialMargin>=0?"font-medium text-emerald-600":"font-medium text-destructive",children:["Margin: ",De(Ae.materialMargin)," (",Ae.materialMarginPct.toFixed(0),"%)"]})]}),a.jsxs("div",{className:"flex items-center justify-between gap-2 px-4 py-2",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:"Total"}),a.jsx("span",{className:"text-2xl font-bold text-primary","data-testid":"text-grand-total",children:De(Ae.grandTotal)})]}),a.jsxs("div",{className:"flex gap-2 px-4 pb-3",children:[a.jsxs(ne,{variant:"outline",size:"sm",onClick:Ar,"data-testid":"button-clear",children:[a.jsx(hT,{className:"h-3 w-3 mr-1"}),"Clear"]}),(!r||zr?.status==="draft")&&a.jsxs(ne,{variant:"outline",size:"sm",className:"flex-1",onClick:()=>nl.mutate({asDraft:!0}),disabled:nl.isPending,"data-testid":"button-save-draft",children:[a.jsx(Si,{className:"h-3 w-3 mr-1"}),"Save Draft"]}),a.jsxs(ne,{size:"sm",className:"flex-1",onClick:()=>nl.mutate({}),disabled:nl.isPending,"data-testid":"button-save",children:[a.jsx(Si,{className:"h-3 w-3 mr-1"}),nl.isPending?"Saving...":r?"Update":"Save"]}),a.jsxs(ne,{variant:"outline",size:"sm",className:"flex-1",onClick:()=>C(!0),"data-testid":"button-view-summary",children:[a.jsx(jn,{className:"h-3 w-3 mr-1"}),"Summary"]})]})]})}),a.jsx(xh,{open:b,onOpenChange:C,children:a.jsxs(ud,{className:"max-w-md max-h-[85vh] overflow-auto",children:[a.jsx(gh,{children:a.jsx(dd,{children:"Quote Summary"})}),Ln&&a.jsxs("div",{className:"mb-3",children:[a.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase mb-1",children:"Estimator"}),a.jsx("p",{className:"text-sm font-medium",children:Ln.name}),Ln.phone&&a.jsx("p",{className:"text-xs text-muted-foreground",children:Ln.phone}),Ln.license&&a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Lic: ",Ln.license]})]}),a.jsx(ws,{}),a.jsxs("div",{className:"mb-3",children:[a.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase mb-1",children:T.type==="homeowner"?"Homeowner":T.type==="contractor"?"Contractor":T.type==="business"?"Business":T.type==="hoa"?"HOA":"Property Management"}),T.type==="homeowner"?a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"text-sm font-medium",children:T.name||"—"}),T.phone&&a.jsx("p",{className:"text-xs text-muted-foreground",children:T.phone}),T.address&&a.jsxs("p",{className:"text-xs text-muted-foreground",children:[T.address,", ",T.city," ",T.state," ",T.zip]})]}):a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"text-sm font-medium",children:T.companyName||"—"}),T.contactName&&a.jsx("p",{className:"text-xs text-muted-foreground",children:T.contactName}),T.companyPhone&&a.jsx("p",{className:"text-xs text-muted-foreground",children:T.companyPhone})]})]}),a.jsx(ws,{}),a.jsxs("div",{className:"mb-3",children:[a.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase mb-1",children:"Building"}),a.jsxs("p",{className:"text-sm",children:[P.type," · ",P.stories," story"]}),P.roofType&&a.jsxs("p",{className:"text-xs text-muted-foreground",children:[P.roofType," · ",P.roofMaterial," ·"," ",P.roofPitch]})]}),a.jsx(ws,{}),a.jsxs("div",{className:"mb-3",children:[a.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase mb-1",children:"Job Specs"}),a.jsxs("p",{className:"text-sm",children:[_.material," · ",_.gutterType," · ",_.gutterMfg]}),_.gutterColor&&a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Color: ",_.gutterColor]})]}),a.jsx(ws,{}),a.jsxs("div",{className:"mb-3 space-y-1",children:[a.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase mb-1",children:"Cost Breakdown"}),a.jsxs("div",{className:"text-sm space-y-0.5",children:[Ae.gutterCost>0&&a.jsxs("div",{className:"flex justify-between",children:[a.jsxs("span",{children:["Gutter (",Ae.gutterFt," ft)"]}),a.jsx("span",{className:"font-medium",children:De(Ae.gutterCost)})]}),Ae.downspoutCost>0&&a.jsxs("div",{className:"flex justify-between",children:[a.jsxs("span",{children:["Downspout (",Ae.downspoutFt," ft)"]}),a.jsx("span",{className:"font-medium",children:De(Ae.downspoutCost)})]}),Ae.elbowCost>0&&a.jsxs("div",{className:"flex justify-between",children:[a.jsxs("span",{children:["Elbows (",Ae.elbowCount,")"]}),a.jsx("span",{className:"font-medium",children:De(Ae.elbowCost)})]}),Ae.miterCost>0&&a.jsxs("div",{className:"flex justify-between",children:[a.jsxs("span",{children:["Miters (",Ae.insideMiterCount+Ae.outsideMiterCount,")"]}),a.jsx("span",{className:"font-medium",children:De(Ae.miterCost)})]}),Ae.endCapCost>0&&a.jsxs("div",{className:"flex justify-between",children:[a.jsxs("span",{children:["End Caps (",Ae.endCapCount,")"]}),a.jsx("span",{className:"font-medium",children:De(Ae.endCapCost)})]}),Ae.outletCost>0&&a.jsxs("div",{className:"flex justify-between",children:[a.jsxs("span",{children:["Outlets (",Ae.outletCount,")"]}),a.jsx("span",{className:"font-medium",children:De(Ae.outletCost)})]}),Ae.hangerCost>0&&a.jsxs("div",{className:"flex justify-between",children:[a.jsxs("span",{children:["Hangers (",Ae.hangerCount,")"]}),a.jsx("span",{className:"font-medium",children:De(Ae.hangerCost)})]}),Ae.rodCost>0&&a.jsxs("div",{className:"flex justify-between",children:[a.jsxs("span",{children:["Rods (",Ae.rodCount,")"]}),a.jsx("span",{className:"font-medium",children:De(Ae.rodCost)})]}),Ae.guardCost>0&&a.jsxs("div",{className:"flex justify-between",children:[a.jsxs("span",{children:["Guards (",Ae.guardFt," ft)"]}),a.jsx("span",{className:"font-medium",children:De(Ae.guardCost)})]}),Ae.removalCost>0&&a.jsxs("div",{className:"flex justify-between",children:[a.jsxs("span",{children:["Removal (",Ae.removalFt," ft)"]}),a.jsx("span",{className:"font-medium",children:De(Ae.removalCost)})]}),Ae.foremanCost>0&&a.jsxs("div",{className:"flex justify-between",children:[a.jsxs("span",{children:["Foreman (",Ae.foremanHrs," hrs)"]}),a.jsx("span",{className:"font-medium",children:De(Ae.foremanCost)})]}),Ae.techCost>0&&a.jsxs("div",{className:"flex justify-between",children:[a.jsxs("span",{children:["Techs (",Ae.techCount," x ",Ae.techHrs," hrs)"]}),a.jsx("span",{className:"font-medium",children:De(Ae.techCost)})]}),Ae.consumableCost>0&&a.jsxs("div",{className:"flex justify-between",children:[a.jsxs("span",{children:["Consumables (",K,"%)"]}),a.jsx("span",{className:"font-medium",children:De(Ae.consumableCost)})]})]})]}),a.jsx(ws,{}),a.jsxs("div",{className:"flex justify-between items-center pt-2",children:[a.jsx("span",{className:"text-lg font-semibold",children:"Total"}),a.jsx("span",{className:"text-2xl font-bold text-primary","data-testid":"text-summary-total",children:De(Ae.grandTotal)})]}),(z||F)&&a.jsxs(a.Fragment,{children:[a.jsx(ws,{className:"my-2"}),F&&a.jsxs("div",{className:"mb-2",children:[a.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase mb-1",children:"Client Summary"}),a.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-wrap",children:F})]}),z&&a.jsxs("div",{children:[a.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase mb-1",children:"Internal Notes"}),a.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-wrap",children:z})]})]}),a.jsx(ws,{className:"my-2"}),a.jsxs(ne,{className:"w-full rounded-xl",variant:"outline",onClick:()=>{T.type==="homeowner"?T.email:T.companyEmail;const M=T.type==="homeowner"?T.name:T.companyName||"Client",re=T.type==="homeowner"?`${T.address||""}, ${T.city||""} ${T.state||""}`:`${T.jobAddress||""}, ${T.jobCity||""}
130`,oe=`$${(Ae.grandTotal||0).toLocaleString("en-US",{minimumFractionDigits:2})}`,ke=Ln?.name?.trim()||kt.name,Fe=Ln?.phone?.trim()||kt.phone,Ye=Ln?.email?.trim()||kt.email,mr=!!Ln?.name?.trim(),Hr=`Your ${kt.name} Quote${re.trim().replace(/^,\s*/,"")?" — "+re.trim().replace(/^,\s*/,""):""}`,hr=mr?[ke,kt.name,`CA Lic: ${kt.license}`,Fe,Ye]:[kt.name,`CA Lic: ${kt.license}`,Fe,Ye],Cb=[`Hello ${M},`,"","Thank you for the opportunity to work with you! Please find your gutter quote below.","",F?`Project Overview:
131${F}`:"",`Estimated Total: ${oe}`,"",`If you have any questions, feel free to reply to this email or call ${ke} at ${Fe}.`,"","We look forward to serving you!","",...hr].filter(qd=>qd!==null).join(`
132`);ua(Hr),$n(Cb),Zo(!1),qr(null),Mt(!0)},children:[a.jsx(Er,{className:"h-4 w-4 mr-2"}),"Send Quote via Outlook"]})]})}),a.jsx(xh,{open:dt,onOpenChange:M=>{M||(Mt(!1),Zo(!1),qr(null))},children:a.jsxs(ud,{className:"max-w-lg max-h-[85vh] overflow-auto",children:[a.jsx(gh,{children:a.jsxs(dd,{className:"flex items-center gap-2",children:[a.jsx(Er,{className:"w-4 h-4 text-primary"}),"Send Quote via Outlook"]})}),hc?a.jsxs("div",{className:"py-8 text-center",children:[a.jsx(st,{className:"w-14 h-14 text-green-500 mx-auto mb-3"}),a.jsx("p",{className:"text-lg font-bold text-foreground mb-1",children:"Email sent!"}),a.jsxs("p",{className:"text-sm text-muted-foreground",children:["Delivered to"," ",T.type==="homeowner"?T.email:T.companyEmail||"client"," ","and saved to your Outlook Sent Items."]})]}):a.jsxs("div",{className:"space-y-4",children:[pc&&a.jsxs("div",{className:"p-3 bg-red-50 border border-red-200 rounded-xl text-red-700 text-sm flex gap-2",children:[a.jsx(Kt,{className:"w-4 h-4 mt-0.5 flex-shrink-0"}),a.jsx("span",{children:pc})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-xs font-semibold text-muted-foreground mb-1",children:"To"}),a.jsx("div",{className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-secondary/30",children:T.type==="homeowner"?`${T.name||"Client"} <${T.email||""}>`:`${T.companyName||"Client"} <${T.companyEmail||""}>`})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-xs font-semibold text-muted-foreground mb-1",children:"Subject"}),a.jsx("input",{type:"text",value:ds,onChange:M=>ua(M.target.value),className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background outline-none focus:border-primary transition-colors"})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-xs font-semibold text-muted-foreground mb-1",children:"Message"}),a.jsx("textarea",{value:rr,onChange:M=>$n(M.target.value),rows:12,className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background outline-none focus:border-primary transition-colors resize-none"})]}),a.jsxs("div",{className:"flex gap-2 pt-1",children:[a.jsx(ne,{variant:"outline",className:"flex-1 rounded-xl",onClick:()=>Mt(!1),children:"Cancel"}),a.jsx(ne,{className:"flex-1 rounded-xl",disabled:Fr,onClick:async()=>{const M=T.type==="homeowner"?T.email:T.companyEmail;if(!M){qr("No email address for this customer. Fill in the Customer section first.");return}if(!ds.trim()||!rr.trim()){qr("Subject and message body are required.");return}In(!0),qr(null);try{const re=`<p>${rr.replace(/\n\n/g,"</p><p>").replace(/\n/g,"<br/>")}</p>`,oe=T.type==="homeowner"?T.name||"Customer":T.companyName||"Customer",ke=[T.address||T.companyAddress||"",T.city||T.companyCity||"",T.state||T.companyState||""].filter(Boolean).join(", ");let Fe={to:M,subject:ds,html:re,text:rr,clientEmail:M};Fe.quotePdf={quoteId:n??null,customerName:oe,customerEmail:M,address:ke,grandTotal:Ae.grandTotal||0,clientSummary:rr.slice(0,500),estimatorName:Ln?.name||void 0,estimatorPhone:Ln?.phone||void 0,estimatorEmail:Ln?.email||void 0};const Ye=X.filter(hr=>hr.imageUrl);if(Ye.length>0){const hr=await ife(Ye,oe);Fe.attachments=[{name:eU(oe),contentType:"application/pdf",contentBytes:hr}]}const Hr=await(await hi("/api/emails/send",{method:"POST",body:JSON.stringify(Fe)})).json();if(!Hr.ok)throw new Error(Hr.error||"Send failed");Zo(!0)}catch(re){qr(re.message||"Could not send. Make sure your Microsoft account is connected.")}finally{In(!1)}},children:Fr?a.jsxs(a.Fragment,{children:[a.jsx(Me,{className:"h-4 w-4 animate-spin mr-2"}),"Sending…"]}):a.jsxs(a.Fragment,{children:[a.jsx(Er,{className:"h-4 w-4 mr-2"}),"Send"]})})]})]})]})}),a.jsx(mb,{open:!!Pe,onOpenChange:M=>{M||$e(null)},children:a.jsxs(Qh,{"data-testid":"dialog-library-duplicate",children:[a.jsxs(Zh,{children:[a.jsx(ep,{children:"Already in the library"}),a.jsx(tp,{children:Pe?.type==="addon"?`An add-on named "${Pe.item.label.trim()}" is already saved. Update it with this version?`:`A package named "${Pe?.type==="package"?Pe.item.name.trim():""}" is already saved. Update it with this version?`})]}),a.jsxs(Jh,{children:[a.jsx(rp,{"data-testid":"button-library-duplicate-cancel",children:"Cancel"}),a.jsx(np,{"data-testid":"button-library-duplicate-confirm",onClick:()=>{const M=Pe;$e(null),M&&(M.type==="addon"?xc(M.item,!0):ip(M.item,!0))},children:"Update existing"})]})]})})]})}function DPe(){const{id:e}=jh(),[,t]=fr(),{data:n,isLoading:r}=hfe(parseInt(e)),{config:s}=pb(),{teamMember:i}=Nn(),l=["admin","manager","estimator"].includes(i?.role??"");if(r)return a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsx(Me,{className:"w-8 h-8 animate-spin text-primary"})});if(!n)return a.jsx("div",{className:"p-8 text-center text-muted-foreground",children:"Quote not found."});
132const u=n.company||ck,d=n.primaryContact,f=d?.name||u.name,h=d?.phone||u.phone,p=d?.email||u.email,x=n.jobData||{},y=n.guardsData||{},w=n.hardwareData||{},j=n.removalData||{},b=n.laborData||{},C=n.customerData||{},N=n.buildingData||{},k=n.consumablePercent??10,T=n.sections||[],A=n.addOns||[],P=n.packages||[],E=parseFloat(x.gutterPrice)||0,_=parseFloat(x.downspoutPrice)||0,R=T.length>0?T.map(Y=>Xz(Y,E,_,s)):[],H=Yz(x,y,w,j,b,k,T,s,{gutterCostPerFt:Number(x.gutterCostPerFt)||0,downspoutCostPerFt:Number(x.downspoutCostPerFt)||0}),L=R.length>0?R:[{sectionId:-1,sectionName:"Unnamed Section",gutterFt:H.gutterFt,gutterCost:H.gutterCost,elbowCount:H.elbowCount,elbowCost:H.elbowCost,insideMiterCount:H.insideMiterCount,outsideMiterCount:H.outsideMiterCount,miterCost:H.miterCost,endCapCount:H.endCapCount,endCapCost:H.endCapCost,downspoutCount:H.downspoutSticks,downspoutFt:H.downspoutFt,downspoutCost:H.downspoutCost,sectionMaterialSubtotal:H.gutterCost+H.elbowCost+H.miterCost+H.endCapCost+H.downspoutCost}],I=s.guards[y.type]?.label||y.type||"None",W=y.type&&y.type!=="none"&&H.guardCost>0,U=j.needed&&H.removalCost>0,V=w.type==="hangers"&&H.hangerCost>0,D=w.type==="rods"&&H.rodCost>0,q=new Date().toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"}),K=new Date(Date.now()+720*60*60*1e3).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"});return a.jsxs("div",{className:"max-w-3xl mx-auto",children:[a.jsxs("div",{className:"print:hidden flex items-center justify-between mb-6 gap-4",children:[a.jsx(ne,{variant:"ghost",size:"icon",onClick:()=>t("/quotes"),className:"rounded-full bg-secondary",children:a.jsx(Sg,{className:"w-5 h-5"})}),a.jsx("div",{className:"flex gap-3",children:a.jsxs(ne,{className:"rounded-xl font-bold shadow-lg shadow-primary/25",onClick:()=>window.print(),children:[a.jsx(mT,{className:"w-4 h-4 mr-2"})," Print / Save as PDF"]})})]}),a.jsxs("div",{id:"proposal",className:"bg-white p-10 shadow-sm rounded-2xl print:shadow-none print:rounded-none print:p-0",children:[a.jsxs("div",{className:"flex justify-between items-start mb-8 pb-6 border-b-2 border-blue-600",children:[a.jsxs("div",{children:[a.jsx("img",{src:u.logoUrl||aU,alt:u.name,className:"h-12 w-auto mb-2"}),a.jsxs("p",{className:"text-sm text-gray-500 mt-1",children:["CA Lic: ",u.license," • ",u.serviceArea]}),a.jsxs("p",{className:"text-sm text-gray-500",children:[u.phone," • ",u.email]}),u.website&&a.jsx("p",{className:"text-sm text-gray-500",children:u.website}),u.address&&a.jsx("p",{className:"text-sm text-gray-500",children:u.address})]}),a.jsxs("div",{className:"text-right",children:[a.jsx("div",{className:"text-2xl font-bold text-gray-800",children:"PROPOSAL"}),a.jsxs("div",{className:"text-sm text-gray-500 mt-1",children:["Quote #",n.id]}),a.jsxs("div",{className:"text-sm text-gray-500",children:["Date: ",q]}),a.jsxs("div",{className:"text-sm text-gray-500",children:["Valid Until: ",K]})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-8 mb-8",children:[a.jsxs("div",{children:[a.jsx("div",{className:"text-xs font-bold uppercase tracking-widest text-blue-600 mb-2",children:"Prepared For"}),a.jsx("div",{className:"font-bold text-gray-900 text-lg",children:C.type==="homeowner"?C.name:C.companyName||C.contactName||"—"}),C.address&&a.jsx("div",{className:"text-gray-600 mt-1",children:C.address}),C.phone&&a.jsx("div",{className:"text-gray-600",children:C.phone}),C.email&&a.jsx("div",{className:"text-gray-600",children:C.email})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-xs font-bold uppercase tracking-widest text-blue-600 mb-2",children:"Property"}),a.jsxs("div",{className:"text-gray-600",children:[a.jsxs("div",{children:[N.type==="commercial"?"Commercial":"Residential"," — ",N.stories||"1"," ",parseInt(N.stories)===1?"story":"stories"]}),N.roofType&&a.jsxs("div",{children:["Roof type: ",N.roofType]}),x.material&&a.jsxs("div",{children:["Material: ",x.material]}),x.gutterColor&&a.jsxs("div",{children:["Color: ",x.gutterColor]})]})]})]}),n.clientSummary&&a.jsxs("div",{className:"bg-blue-50 border-l-4 border-blue-500 px-5 py-4 rounded-r-lg mb-8",children:[a.jsx("div",{className:"text-xs font-bold uppercase tracking-widest text-blue-600 mb-1",children:"Project Overview"}),a.jsx("p",{className:"text-gray-700 text-sm leading-relaxed whitespace-pre-wrap",children:n.clientSummary})]}),a.jsxs("div",{className:"mb-8",children:[a.jsx("div",{className:"text-xs font-bold uppercase tracking-widest text-blue-600 mb-3",children:"Scope of Work"}),a.jsxs(a.Fragment,{children:[L.map(Y=>a.jsxs("div",{className:"mb-4",children:[a.jsx("div",{className:"font-semibold text-gray-700 text-sm px-3 py-1.5 bg-gray-50 border border-gray-200 rounded mb-0",children:Y.sectionName}),a.jsx("table",{className:"w-full text-sm",children:a.jsxs("tbody",{className:"divide-y divide-gray-100",children:[Y.gutterFt>0&&a.jsxs("tr",{children:[a.jsxs("td",{className:"py-2 px-3 text-gray-700",children:[x.gutterType||"Gutters",x.material?` — ${x.material}`:""]}),a.jsxs("td",{className:"py-2 px-3 text-right text-gray-500",children:[Y.gutterFt," LF"]}),a.jsx("td",{className:"py-2 px-3 text-right font-medium",children:De(Y.gutterCost)})]}),Y.elbowCount>0&&a.jsxs("tr",{children:[a.jsxs("td",{className:"py-2 px-3 text-gray-700",children:["Elbows (",Y.elbowCount,")"]}),a.jsxs("td",{className:"py-2 px-3 text-right text-gray-500",children:[(Y.elbowCount*s.elbowFeetAdded).toFixed(1)," LF eq."]}),a.jsx("td",{className:"py-2 px-3 text-right font-medium",children:De(Y.elbowCost)})]}),Y.insideMiterCount+Y.outsideMiterCount>0&&a.jsxs("tr",{children:[a.jsxs("td",{className:"py-2 px-3 text-gray-700",children:["Miters (",Y.insideMiterCount+Y.outsideMiterCount,")"]}),a.jsxs("td",{className:"py-2 px-3 text-right text-gray-500",children:[((Y.insideMiterCount+Y.outsideMiterCount)*s.miterFeetAdded).toFixed(1)," LF eq."]}),a.jsx("td",{className:"py-2 px-3 text-right font-medium",children:De(Y.miterCost)})]}),Y.endCapCount>0&&a.jsxs("tr",{children:[a.jsxs("td",{className:"py-2 px-3 text-gray-700",children:["End Caps (",Y.endCapCount,")"]}),a.jsxs("td",{className:"py-2 px-3 text-right text-gray-500",children:[(Y.endCapCount*s.endCapFeetAdded).toFixed(1)," LF eq."]}),a.jsx("td",{className:"py-2 px-3 text-right font-medium",children:De(Y.endCapCost)})]}),Y.downspoutCount>0&&a.jsxs("tr",{children:[a.jsxs("td",{className:"py-2 px-3 text-gray-700",children:["Downspouts — ",x.downspoutType||""," (",Y.downspoutCount," loc.)"]}),a.jsxs("td",{className:"py-2 px-3 text-right text-gray-500",children:[Y.downspoutFt," LF"]}),a.jsx("td",{className:"py-2 px-3 text-right font-medium",children:De(Y.downspoutCost)})]}),Y.sectionMaterialSubtotal>0&&a.jsxs("tr",{className:"bg-gray-50",children:[a.jsx("td",{className:"py-1.5 px-3 text-xs font-semibold text-gray-500 uppercase tracking-wide",colSpan:2,children:"Section subtotal"}),a.jsx("td",{className:"py-1.5 px-3 text-right font-semibold text-gray-800",children:De(Y.sectionMaterialSubtotal)})]})]})})]}
132,Y.sectionId)),(H.outletCost>0||V||D||W||U||H.totalLaborCost>0)&&a.jsxs("table",{className:"w-full text-sm border-t-2 border-gray-200 mt-1",children:[a.jsx("thead",{children:a.jsx("tr",{className:"bg-gray-50",children:a.jsx("th",{className:"py-2 px-3 text-left text-gray-500 font-semibold text-xs uppercase tracking-wide",colSpan:3,children:"Additional Items"})})}),a.jsxs("tbody",{className:"divide-y divide-gray-100",children:[H.outletCost>0&&a.jsxs("tr",{children:[a.jsxs("td",{className:"py-2.5 px-3 text-gray-700",children:["Outlets (",x.outlets,")"]}),a.jsxs("td",{className:"py-2.5 px-3 text-right text-gray-500",children:[(parseFloat(x.outlets||"0")*s.outletFeetAdded).toFixed(1)," LF eq."]}),a.jsx("td",{className:"py-2.5 px-3 text-right font-medium",children:De(H.outletCost)})]}),V&&a.jsxs("tr",{children:[a.jsxs("td",{className:"py-2.5 px-3 text-gray-700",children:["Hangers — ",w.hangerType||""]}),a.jsx("td",{className:"py-2.5 px-3 text-right text-gray-500"}),a.jsx("td",{className:"py-2.5 px-3 text-right font-medium",children:De(H.hangerCost)})]}),D&&a.jsxs("tr",{children:[a.jsx("td",{className:"py-2.5 px-3 text-gray-700",children:"Rods"}),a.jsx("td",{className:"py-2.5 px-3 text-right text-gray-500"}),a.jsx("td",{className:"py-2.5 px-3 text-right font-medium",children:De(H.rodCost)})]}),W&&a.jsxs("tr",{children:[a.jsxs("td",{className:"py-2.5 px-3 text-gray-700",children:["Gutter Guards — ",I]}),a.jsxs("td",{className:"py-2.5 px-3 text-right text-gray-500",children:[y.footage," LF"]}),a.jsx("td",{className:"py-2.5 px-3 text-right font-medium",children:De(H.guardCost)})]}),U&&a.jsxs("tr",{children:[a.jsx("td",{className:"py-2.5 px-3 text-gray-700",children:"Remove Existing Gutters"}),a.jsxs("td",{className:"py-2.5 px-3 text-right text-gray-500",children:[j.footage," LF"]}),a.jsx("td",{className:"py-2.5 px-3 text-right font-medium",children:De(H.removalCost)})]}),H.totalLaborCost>0&&a.jsxs("tr",{children:[a.jsx("td",{className:"py-2.5 px-3 text-gray-700",children:"Labor"}),a.jsx("td",{className:"py-2.5 px-3 text-right text-gray-500"}),a.jsx("td",{className:"py-2.5 px-3 text-right font-medium",children:De(H.totalLaborCost)})]})]})]})]})]}),a.jsx("div",{className:"flex justify-end mb-10",children:a.jsx("div",{className:"w-72",children:a.jsxs("div",{className:"space-y-1.5 text-sm",children:[a.jsxs("div",{className:"flex justify-between text-gray-600",children:[a.jsx("span",{children:"Subtotal"}),a.jsx("span",{className:"font-medium",children:De(H.subtotal)})]}),H.consumableCost>0&&a.jsxs("div",{className:"flex justify-between text-gray-600",children:[a.jsxs("span",{children:["Materials & Consumables (",k,"%)"]}),a.jsx("span",{className:"font-medium",children:De(H.consumableCost)})]}),a.jsxs("div",{className:"flex justify-between items-center pt-3 border-t-2 border-blue-600 mt-2",children:[a.jsx("span",{className:"text-lg font-bold text-gray-900",children:"Total"}),a.jsx("span",{className:"text-2xl font-bold text-blue-700",children:De(n.grandTotal)})]})]})})}),(P.length>0||A.length>0)&&a.jsxs("div",{className:"mb-8",children:[a.jsx("div",{className:"text-xs font-bold uppercase tracking-widest text-blue-600 mb-3",children:"Options"}),P.length>0&&a.jsxs("div",{className:"mb-4",children:[a.jsx("div",{className:"font-semibold text-gray-700 text-sm px-3 py-1.5 bg-gray-50 border border-gray-200 rounded mb-0",children:"Alternate Packages"}),a.jsx("table",{className:"w-full text-sm",children:a.jsx("tbody",{className:"divide-y divide-gray-100",children:P.map(Y=>a.jsxs("tr",{children:[a.jsxs("td",{className:"py-2 px-3 text-gray-700",children:[a.jsx("div",{className:"font-medium",children:Y.name||"Package"}),Y.description&&a.jsx("div",{className:"text-xs text-gray-500",children:Y.description})]}),a.jsx("td",{className:"py-2 px-3 text-right font-medium whitespace-nowrap",children:De(Y.total)})]},Y.id))})})]}),A.length>0&&a.jsxs("div",{children:[a.jsx("div",{className:"font-semibold text-gray-700 text-sm px-3 py-1.5 bg-gray-50 border border-gray-200 rounded mb-0",children:"Optional Add-ons"}),a.jsx("table",{className:"w-full text-sm",children:a.jsx("tbody",{className:"divide-y divide-gray-100",children:A.map(Y=>a.jsxs("tr",{children:[a.jsxs("td",{className:"py-2 px-3 text-gray-700",children:[a.jsx("div",{className:"font-medium",children:Y.label||"Add-on"}),Y.description&&a.jsx("div",{className:"text-xs text-gray-500",children:Y.description})]}),a.jsxs("td",{className:"py-2 px-3 text-right font-medium whitespace-nowrap",children:["+",De(Y.price)]})]},Y.id))})})]})]}),l&&H.materialActualCost!=null&&a.jsxs("div",{className:"print:hidden mb-8 rounded-lg border border-amber-200 bg-amber-50 p-4","data-testid":"text-internal-margin",children:[a.jsx("div",{className:"text-xs font-bold uppercase tracking-widest text-amber-700 mb-2",children:"Internal — Material Margin (not shown to client)"}),a.jsxs("div",{className:"flex flex-wrap gap-x-6 gap-y-1 text-sm text-gray-700",children:[a.jsxs("span",{children:["Material sell: ",a.jsx("span",{className:"font-semibold",children:De(H.totalMaterialCost)})]}),a.jsxs("span",{children:["Material cost: ",a.jsx("span",{className:"font-semibold",children:De(H.materialActualCost)})]}),a.jsxs("span",{className:H.materialMargin>=0?"text-emerald-700":"text-red-700",children:["Margin: ",a.jsxs("span",{className:"font-semibold",children:[De(H.materialMargin)," (",H.materialMarginPct.toFixed(0),"%)"]})]})]})]}),n.notes&&a.jsxs("div",{className:"mb-8 text-sm text-gray-600 bg-gray-50 rounded-lg p-4 border border-gray-200",children:[a.jsx("div",{className:"font-semibold text-gray-700 mb-1",children:"Notes"}),a.jsx("p",{className:"whitespace-pre-wrap",children:n.notes})]}),(()=>{const Y=Zz(n).filter(z=>z.imageUrl);return Y.length===0?null:a.jsxs("div",{className:"mb-8 border-t pt-6",children:[a.jsx("div",{className:"font-semibold text-gray-700 mb-3",children:"Gutter Diagrams"}),Y.map(z=>a.jsx(nU,{page:z},z.id))]})})(),a.jsxs("div",{className:"mb-10 text-xs text-gray-500 space-y-1 border-t pt-4",children:[a.jsxs("p",{children:[a.jsx("strong",{children:"Payment Terms:"})," 50% deposit required to schedule. Balance due upon completion."]}),a.jsxs("p",{children:[a.jsx("strong",{children:"Validity:"})," This proposal is valid for 30 days from the date above."]}),a.jsxs("p",{children:[a.jsx("strong",{children:"Warranty:"})," All workmanship guaranteed for 1 year. Material warranties per manufacturer."]}),a.jsxs("p",{children:[u.name," is fully licensed and insured. CA Contractor License #",u.license,"."]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-10 border-t pt-8",children:[a.jsxs("div",{children:[a.jsx("div",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider mb-6",children:"Customer Acceptance"}),a.jsx("div",{className:"border-b border-gray-400 mb-1"}),a.jsx("div",{className:"text-xs text-gray-400",children:"Signature"}),a.jsx("div",{className:"border-b border-gray-400 mt-5 mb-1"}),a.jsx("div",{className:"text-xs text-gray-400",children:"Printed Name"}),a.jsx("div",{className:"border-b border-gray-400 mt-5 mb-1"}),a.jsx("div",{className:"text-xs text-gray-400",children:"Date"})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider mb-6",children:"Authorized By"}),a.jsx("div",{className:"border-b border-gray-400 mb-1"}),a.jsxs("div",{className:"text-xs text-gray-400",children:[u.name," Representative"]}),a.jsxs("div",{className:"mt-6 text-sm text-gray-600",children:[a.jsx("p",{className:"font-medium",children:f}),a.jsx("p",{children:h}),a.jsx("p",{children:p})]})]})]})]})]})}const Sl=(e,t)=>{const n=localStorage.getItem("fs_team_token"),r=t?.body instanceof FormData;return fetch(e,{...t,headers:{Authorization:`Bearer ${n}`,...r?{}:{"Content-Type":"application/json"},...t?.headers||{}}})},Gx={per_foot:"ft",per_pound:"lbs",per_each:"ea",per_bag:"bag",per_box:"box",per_tube:"tube"},$Pe={pending:"bg-amber-100 text-amber-700",picked:"bg-green-100 text-green-700",short:"bg-red-100 text-red-700",substituted:"bg-blue-100 text-blue-700"};function BO({jobId:e,kitReady:t}){const[n,r]=v.useState(!1),s=wt(),{data:i=[],isLoading:l,refetch:u}=Xe({queryKey:["kit-list",e],queryFn:async()=>{const N=await Sl(`/api/jobs/${e}/kit-list`);return N.ok?N.json():[]},enabled:n}),{data:d}=Xe({queryKey:["kit-availability",e],queryFn:async()=>{const N=await Sl(`/api/jobs/${e}/availability`);return N.ok?N.json():null},enabled:n}),f=nt({mutationFn:()=>Sl(`/api/jobs/${e}/kit-list`,{method:"POST"}).then(N=>N.ok?N.json():N.json().then(k=>{throw new Error(k.error)})),onSuccess:()=>{s.invalidateQueries({queryKey:["kit-list",e]}),s.invalidateQueries({queryKey:["kit-availability",e]})}}),h=nt({mutationFn:()=>Sl(`/api/jobs/${e}/kit-list`,{method:"DELETE"}).then(N=>N.ok?N.json():N.json().then(k=>{throw new Error(k.error)})),onSuccess:()=>{s.invalidateQueries({queryKey:["kit-list",e]}),s.invalidateQueries({queryKey:["kit-availability",e]})}}),p=nt({mutationFn:({itemId:N,status:k,quantityPicked:T})=>Sl(`/api/jobs/${e}/kit-list/item/${N}`,{method:"PATCH",body:JSON.stringify({status:k,quantityPicked:T})}).then(A=>A.ok?A.json():A.json().then(P=>{throw new Error(P.error)})),onSuccess:()=>{s.invalidateQueries({queryKey:["kit-list",e]}),s.invalidateQueries({queryKey:["kit-availability",e]})}}),x=nt({mutationFn:({itemId:N,coilRollId:k})=>Sl(`/api/jobs/${e}/kit-list/item/${N}`,{method:"PATCH",body:JSON.stringify({coilRollId:k})}).then(T=>T.ok?T.json():T.json().then(A=>{throw new Error(A.error)})),onSuccess:()=>{s.invalidateQueries({queryKey:["kit-list",e]})}}),y=nt({mutationFn:()=>Sl(`/api/jobs/${e}/kit-list/confirm`,{method:"POST"}).then(N=>N.ok?N.json():N.json().then(k=>{throw new Error(k.error)})),onSuccess:()=>{s.invalidateQueries({queryKey:["kit-list",e]}),s.invalidateQueries({queryKey:["kit-availability",e]}),s.invalidateQueries({queryKey:["jobs"]})}}),w=i.length>0&&i.every(N=>N.status!=="pending"),j=i.filter(N=>N.status==="picked").length,b=i.filter(N=>N.status==="short").length,C=()=>{i.map(k=>`${k.fsgPartNumber||"—"}	${k.productName}	${k.quantityNeeded} ${Gx[k.unitType]||k.unitType}	${k.storageLocation||"—"}	${k.status}`).join(`
133`);const N=window.open("","_blank");N&&(N.document.write(`<html><head><title>Kit List — Job #${e}</title>
134      <style>body{font-family:monospace;font-size:12px;padding:20px}table{border-collapse:collapse;width:100%}
135      th,td{border:1px solid #ccc;padding:6px 10px;text-align:left}th{background:#f5f5f5;font-weight:bold}
136      h1{font-size:18px;margin-bottom:10px}@media print{button{display:none}}</style></head><body>
137      <h1>Kit List — Job #${e}</h1>
138      <table><thead><tr><th>
138FSG Part #</th><th>Product</th><th>Qty Needed</th><th>Location</th><th>Status</th></tr></thead>
139      <tbody>${i.map(k=>`<tr>
140        <td>${k.fsgPartNumber||"—"}</td>
141        <td>${k.productName}</td>
142        <td>${k.quantityNeeded} ${Gx[k.unitType]||k.unitType}</td>
143        <td>${k.storageLocation||"—"}</td>
144        <td>${k.status}</td>
145      </tr>`).join("")}</tbody></table>
146      <button onclick="window.print()" style="margin-top:16px;padding:8px 16px;cursor:pointer">Print</button>
147      </body></html>`),N.document.close())};return a.jsxs("div",{className:"border-t border-border/60 mt-3 pt-3",children:[a.jsxs("button",{className:"w-full flex items-center justify-between text-sm font-semibold text-foreground hover:text-primary transition-colors",onClick:()=>r(N=>!N),children:[a.jsxs("span",{className:"flex items-center gap-1.5",children:[a.jsx(Jn,{className:"w-4 h-4"})," Kit List",i.length>0&&a.jsxs("span",{className:"text-xs font-normal text-muted-foreground",children:["(",j,"/",i.length," picked",b>0?`, ${b} short`:"",")"]}),t&&a.jsx(st,{className:"w-3.5 h-3.5 text-green-600"})]}),n?a.jsx(Nr,{className:"w-4 h-4"}):a.jsx(wr,{className:"w-4 h-4"})]}),n&&a.jsxs("div",{className:"mt-3 space-y-3",children:[d?.hasShortages&&a.jsxs("div",{className:"flex items-start gap-2 rounded-lg bg-red-50 border border-red-200 px-3 py-2 text-[11px] text-red-700",children:[a.jsx(Kt,{className:"w-4 h-4 mt-0.5 shrink-0"}),a.jsxs("div",{children:[a.jsxs("span",{className:"font-semibold",children:[d.shortageCount," material",d.shortageCount===1?"":"s"," short of stock."]})," ","Order the shortfall or mark this job Material Pending before sending the crew.",a.jsx("ul",{className:"mt-1 list-disc pl-4 space-y-0.5",children:d.shortages.map((N,k)=>a.jsxs("li",{children:[N.productName," — need ",N.quantityNeeded," ",Gx[N.unitType]||N.unitType,", have"," ",N.available??0]},k))})]})]}),l?a.jsx("div",{className:"text-xs text-muted-foreground animate-pulse",children:"Loading kit list…"}):i.length===0?a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No kit list generated yet."}),!t&&a.jsxs(ne,{size:"sm",variant:"outline",className:"text-xs rounded-xl",disabled:f.isPending,onClick:()=>f.mutate(),children:[f.isPending?a.jsx(Me,{className:"w-3.5 h-3.5 mr-1.5 animate-spin"}):a.jsx(Rr,{className:"w-3.5 h-3.5 mr-1.5"}),"Generate Kit List"]}),f.isError&&a.jsx("p",{className:"text-xs text-red-600",children:f.error.message})]}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"text-muted-foreground border-b border-border/60",children:[a.jsx("th",{className:"text-left pb-1.5 pr-2 w-8"}),a.jsx("th",{className:"text-left pb-1.5 pr-2",children:"FSG #"}),a.jsx("th",{className:"text-left pb-1.5 pr-2",children:"Product"}),a.jsx("th",{className:"text-right pb-1.5 pr-2",children:"Qty"}),a.jsx("th",{className:"text-left pb-1.5 pr-2",children:"Location"}),a.jsx("th",{className:"text-center pb-1.5",children:"Status"})]})}),a.jsx("tbody",{children:i.map(N=>a.jsxs(ie.Fragment,{children:[a.jsxs("tr",{className:`border-b border-border/30 ${N.status==="picked"?"opacity-60":""}`,children:[a.jsxs("td",{className:"py-1.5 pr-2",children:[!t&&a.jsx("input",{type:"checkbox",checked:N.status==="picked",onChange:()=>{N.status==="picked"?p.mutate({itemId:N.id,status:"pending",quantityPicked:0}):p.mutate({itemId:N.id,status:"picked",quantityPicked:N.quantityNeeded})},className:"rounded",disabled:p.isPending}),t&&N.status==="picked"&&a.jsx(st,{className:"w-3.5 h-3.5 text-green-600"}),t&&N.status==="short"&&a.jsx(Kt,{className:"w-3.5 h-3.5 text-red-500"})]}),a.jsx("td",{className:"py-1.5 pr-2 font-mono text-[10px]",children:N.fsgPartNumber||"—"}),a.jsxs("td",{className:"py-1.5 pr-2",children:[a.jsx("span",{className:N.status==="picked"?"line-through":"",children:N.productName}),N.notes&&a.jsx("span",{className:"block text-[10px] text-muted-foreground",children:N.notes})]}),a.jsxs("td",{className:"py-1.5 pr-2 text-right font-medium",children:[N.quantityNeeded," ",a.jsx("span",{className:"text-muted-foreground",children:Gx[N.unitType]||N.unitType}),N.qtyOnHand!==null&&a.jsxs("span",{className:`block text-[10px] ${(N.qtyOnHand??
1470)<N.quantityNeeded?"text-red-500 font-bold":"text-muted-foreground"}`,children:["(",N.qtyOnHand," avail)"]})]}),a.jsx("td",{className:"py-1.5 pr-2 text-[10px]",children:N.storageLocation||"—"}),a.jsx("td",{className:"py-1.5 text-center",children:!t&&N.status==="pending"?a.jsx("button",{className:"text-[10px] text-red-600 hover:text-red-800 font-medium",onClick:()=>p.mutate({itemId:N.id,status:"short",quantityPicked:0}),disabled:p.isPending,children:"Short"}):a.jsx("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-bold uppercase ${$Pe[N.status]||""}`,children:N.status})})]}),N.isCoil&&(N.rolls?.length??0)>0&&a.jsxs("tr",{className:"border-b border-border/30",children:[a.jsx("td",{}),a.jsx("td",{colSpan:5,className:"py-1 pr-2",children:a.jsxs("div",{className:"flex items-center gap-2 text-[10px] flex-wrap",children:[a.jsx("span",{className:"text-muted-foreground",children:"Coil roll:"}),t?a.jsx("span",{className:"font-medium",children:N.coilRollId?N.rolls.find(k=>k.id===N.coilRollId)?.rollNumber??`#${N.coilRollId}`:"FIFO (oldest first)"}):a.jsxs("select",{className:"border border-border rounded px-1 py-0.5 text-[10px] bg-background",value:N.coilRollId??"",disabled:x.isPending,onChange:k=>x.mutate({itemId:N.id,coilRollId:k.target.value?Number(k.target.value):null}),children:[a.jsx("option",{value:"",children:"FIFO (oldest first)"}),N.rolls.map(k=>a.jsxs("option",{value:k.id,children:[k.rollNumber," — ",k.weightLbs," lbs (",k.status,")",k.storageLocation?` @ ${k.storageLocation}`:""]},k.id))]})]})})]})]},N.id))})]})}),a.jsxs("div",{className:"flex items-center gap-2 flex-wrap pt-1",children:[a.jsxs(ne,{size:"sm",variant:"outline",className:"text-xs rounded-xl h-7",onClick:C,children:[a.jsx(mT,{className:"w-3 h-3 mr-1"})," Print"]}),!t&&a.jsxs(a.Fragment,{children:[a.jsxs(ne,{size:"sm",className:"text-xs rounded-xl h-7 bg-green-600 hover:bg-green-700 text-white",disabled:!w||y.isPending,onClick:()=>y.mutate(),children:[y.isPending?a.jsx(Me,{className:"w-3 h-3 mr-1 animate-spin"}):a.jsx(st,{className:"w-3 h-3 mr-1"}),"Mark Kit Ready"]}),a.jsxs(ne,{size:"sm",variant:"ghost",className:"text-xs rounded-xl h-7 text-red-600 hover:text-red-800",disabled:h.isPending,onClick:()=>{confirm("Delete kit list and regenerate?")&&h.mutate()},children:[a.jsx(on,{className:"w-3 h-3 mr-1"})," Reset"]})]})]}),y.isError&&a.jsx("p",{className:"text-xs text-red-600",children:y.error.message})]})]})]})}const Qy={scheduled:"bg-amber-400",in_progress:"bg-blue-500",completed:"bg-green-500",on_hold:"bg-orange-400",cancelled:"bg-gray-400"},zO={scheduled:"bg-amber-100 text-amber-700",in_progress:"bg-blue-100 text-blue-700",completed:"bg-green-100 text-green-700",on_hold:"bg-orange-100 text-orange-700",cancelled:"bg-gray-100 text-gray-700"},To=(e,t)=>{const n=localStorage.getItem("fs_team_token"),r=t?.body instanceof FormData;return fetch(e,{...t,headers:{Authorization:`Bearer ${n}`,...r?{}:{"Content-Type":"application/json"},...t?.headers||{}}})};function IPe({job:e}){return e.materialReceivedAt?a.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-bold bg-green-100 text-green-700 px-2 py-0.5 rounded-full",children:[a.jsx(Ci,{className:"w-3 h-3"})," Material In"]}):e.materialOrderedAt?a.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-bold bg-blue-100 text-blue-700 px-2 py-0.5 rounded-full",children:[a.jsx(Dr,{className:"w-3 h-3"})," Awaiting Delivery"]}):null}const LPe={per_foot:"ft",per_pound:"lbs",per_each:"ea",per_bag:"bag",per_box:"box",per_tube:"tube"};function UO({jobId:e,quoteId:t}){const[n,r]=v.useState(!1),[s,i]=v.useState("sections"),[l,u]=v.useState(null),[d,f]=v.useState(""),h=wt(),{data:p,isLoading:x}=Xe({queryKey:["quote-wo",t],queryFn:async()=>{if(!t)return null;const D=await To(`/api/quotes/${t}`);return D.ok?D.json():null},enabled:n&&!!t}),{data:y}=Xe({queryKey:["job-detail",e],queryFn:async()=>{const D=await To(`/api/jobs/${e}`);return D.ok?D.json():null},enabled:n}),w=y?.sectionStatus||{},j=p?.sections||[],b=nt({mutationFn:async D=>{const q=await To(`/api/jobs/${e}`,{method:"PATCH",body:JSON.stringify({sectionStatus:D})});if(!q.ok)throw new Error("Failed to save section status");return q.json()},onSuccess:()=>h.invalidateQueries({queryKey:["job-detail",e]})}),C=(D,q)=>{const K=j.map((Z,F)=>String(Z.id??F)),z={...Object.fromEntries(K.map(Z=>[Z,w[Z]??!1])),[D]:!q};b.mutate(z)},N=j.filter((D,q)=>w[String(D.id??q)]).length,k=j.length>0?Math.round(N/j.length*100):0,T=p?.jobData?.gutterType||p?.gutterType||"",A=T.match(/(\d+(?:\.\d+)?)"?/),P=A?A[1]:"",{data:E=[],isLoading:_}=Xe({queryKey:["cut-chart"],queryFn:async()=>{const D=await To("/api/cut-chart");return D.ok?D.json():[]},enabled:n&&s==="cutchart"}),R=[...new Set(E.map(D=>String(D.gutterSize)))].sort(),H=[...new Set(E.map(D=>D.componentType))].sort(),L=l!==null?l:P,I=E.filter(D=>{const q=!L||String(D.gutterSize).includes(L),K=!d||D.componentType===d;return q&&K}),{data:W=[],isLoading:U}=Xe({queryKey:["kit-list",e],queryFn:async()=>{const D=await To(`/api/jobs/${e}/kit-list`);return D.ok?D.json():[]},enabled:n&&s==="materials"});if(!t)return null;const V=()=>{const D=window.open("","_blank");if(!D)return;const q=j.map((Y,z)=>{const Z=String(Y.id??z);return`<tr>
148        <td style="padding:5px 8px;border:1px solid #e5e7eb">${w[Z]?"✓":"○"}</td>
149        <td style="padding:5px 8px;border:1px solid #e5e7eb;font-weight:600">${Y.name||`Section ${z+1}`}</td>
150        <td style="padding:5px 8px;border:1px solid #e5e7eb;text-align:right">${parseFloat(Y.gutterFootage||"0").toFixed(0)}</td>
151        <td style="padding:5px 8px;border:1px solid #e5e7eb;text-align:right">${Y.downspouts||0}</td>
152        <td style="padding:5px 8px;border:1px solid #e5e7eb;text-align:right">${Y.elbows||0}</td>
153        <td style="padding:5px 8px;border:1px solid #e5e7eb;text-align:right">${parseInt(Y.insideMiters||"0")+parseInt(Y.outsideMiters||"0")}</td>
154      </tr>`}).join(""),K=I.map(Y=>`<tr>
155      <td style="padding:5px 8px;border:1px solid #e5e7eb">${Y.componentType}</td>
156      <td style="padding:5px 8px;border:1px solid #e5e7eb">${Y.gutterSize}</td>
157      <td style="padding:5px 8px;border:1px solid #e5e7eb">${Y.direction||"—"}</td>
158      <td style="padding:5px 8px;border:1px solid #e5e7eb;text-align:right;font-family:monospace;font-weight:700">${Y.cutLengthInches}"</td>
159      <td style="padding:5px 8px;border:1px solid #e5e7eb;text-align:center">${Y.leftCrimps??0}</td>
160      <td style="padding:5px 8px;border:1px solid #e5e7eb;text-align:center">${Y.rightCrimps??0}</td>
161      <td style="padding:5px 8px;border:1px solid #e5e7eb;font-size:11px;color:#6b7280">${Y.notes||""}</td>
162    </tr>`).join("");D.document.write(`<html><head><title>Work Order — Job #${e}</title>
163      <style>body{font-family:-apple-system,sans-serif;font-size:13px;padding:24px;color:#111}
164      h1{font-size:20px;margin-bottom:4px}h2{font-size:13px;margin:18px 0 8px;padding-bottom:4px;border-bottom:2px solid #e5e7eb;text-transform:uppercase;letter-spacing:.05em;
164color:#374151}
165      table{width:100%;border-collapse:collapse;margin-bottom:12px}
166      th{text-align:left;padding:5px 8px;background:#f9fafb;border:1px solid #e5e7eb;font-size:11px;text-transform:uppercase;letter-spacing:.05em;color:#6b7280}
167      @media print{button{display:none}}</style></head><body>
168      <h1>Work Order — Job #${e}</h1>
169      ${T?`<p style="color:#6b7280;font-size:12px;margin-bottom:16px">Gutter: <strong>${T}</strong></p>`:""}
170      <h2>Sections — ${N}/${j.length} Complete</h2>
171      <table><thead><tr>
172        <th></th><th>Section</th>
173        <th style="text-align:right">Gutter (ft)</th>
174        <th style="text-align:right">DS</th>
175        <th style="text-align:right">Elbows</th>
176        <th style="text-align:right">Miters</th>
177      </tr></thead><tbody>${q}</tbody></table>
178      ${I.length>0?`
179      <h2>Cut Chart${P?` — ${P}" Gutter`:""}</h2>
180      <table><thead><tr>
181        <th>Component</th><th>Size</th><th>Direction</th>
182        <th style="text-align:right">Cut Length</th>
183        <th style="text-align:center">L Crimps</th>
184        <th style="text-align:center">R Crimps</th>
185        <th>Notes</th>
186      </tr></thead><tbody>${K}</tbody></table>`:""}
187      <button onclick="window.print()" style="margin-top:16px;padding:8px 16px;cursor:pointer;font-size:13px">🖨 Print</button>
188    </body></html>`),D.document.close()};return a.jsxs("div",{className:"border-t border-border/60 mt-3 pt-3",children:[a.jsxs("button",{className:"w-full flex items-center justify-between text-sm font-semibold text-foreground hover:text-primary transition-colors",onClick:()=>r(D=>!D),children:[a.jsxs("span",{className:"flex items-center gap-1.5",children:[a.jsx(Rr,{className:"w-4 h-4"})," Work Order",j.length>0&&a.jsxs("span",{className:`text-xs font-normal ${k===100?"text-green-600 font-semibold":"text-muted-foreground"}`,children:["(",N,"/",j.length," · ",k,"%)"]}),k===100&&a.jsx(st,{className:"w-3.5 h-3.5 text-green-600"})]}),n?a.jsx(Nr,{className:"w-4 h-4"}):a.jsx(wr,{className:"w-4 h-4"})]}),n&&a.jsxs("div",{className:"mt-3",children:[a.jsxs("div",{className:"flex gap-0 mb-3 border-b border-border/60",children:[["sections","cutchart","materials"].map(D=>a.jsx("button",{onClick:()=>i(D),className:`px-3 py-1.5 text-xs font-medium transition-colors ${s===D?"text-primary border-b-2 border-primary -mb-px":"text-muted-foreground hover:text-foreground"}`,children:D==="sections"?"Sections":D==="cutchart"?"Cut Chart":"Materials"},D)),a.jsx("div",{className:"flex-1 flex justify-end pb-1",children:a.jsxs("button",{onClick:V,className:"text-[10px] text-muted-foreground hover:text-foreground flex items-center gap-1 px-2",title:"Print work order",children:[a.jsx(mT,{className:"w-3 h-3"})," Print"]})})]}),s==="sections"&&a.jsx("div",{className:"space-y-2",children:x?a.jsx("div",{className:"text-xs text-muted-foreground animate-pulse",children:"Loading…"}):j.length===0?a.jsx("div",{className:"text-xs text-muted-foreground italic",children:"No sections defined on this quote."}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"text-muted-foreground border-b border-border/60",children:[a.jsx("th",{className:"text-left pb-1.5 pr-3",children:"Section"}),a.jsx("th",{className:"text-right pb-1.5 pr-3",children:"Gutter (ft)"}),a.jsx("th",{className:"text-right pb-1.5 pr-3",children:"DS"}),a.jsx("th",{className:"text-right pb-1.5 pr-3",children:"Elbows"}),a.jsx("th",{className:"text-right pb-1.5",children:"Miters"})]})}),a.jsx("tbody",{children:j.map((D,q)=>{const K=String(D.id??q),Y=!!w[K];return a.jsxs("tr",{className:`border-b border-border/30 ${Y?"opacity-60":""}`,children:[a.jsx("td",{className:"py-1.5 pr-3 font-medium",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("input",{type:"checkbox",checked:Y,onChange:()=>C(K,Y),className:"rounded",disabled:b.isPending}),a.jsx("span",{className:Y?"line-through text-muted-foreground":"",children:D.name||`Section ${q+1}`})]})}),a.jsx("td",{className:"py-1.5 pr-3 text-right",children:parseFloat(D.gutterFootage||"0").toFixed(0)}),a.jsx("td",{className:"py-1.5 pr-3 text-right",children:D.downspouts||0}),a.jsx("td",{className:"py-1.5 pr-3 text-right",children:D.elbows||0}),a.jsx("td",{className:"py-1.5 text-right",children:parseInt(D.insideMiters||"0")+parseInt(D.outsideMiters||"0")})]},K)})}),a.jsx("tfoot",{children:a.jsxs("tr",{className:"font-bold text-foreground",children:[a.jsx("td",{className:"pt-2",children:"Total"}),a.jsx("td",{className:"pt-2 text-right pr-3",children:j.reduce((D,q)=>D+parseFloat(q.gutterFootage||"0"),0).toFixed(0)}),a.jsx("td",{className:"pt-2 text-right pr-3",children:j.reduce((D,q)=>D+parseInt(q.downspouts||"0"),0)}),a.jsx("td",{className:"pt-2 text-right pr-3",children:j.reduce((D,q)=>D+parseInt(q.elbows||"0"),0)}),a.jsx("td",{className:"pt-2 text-right",children:j.reduce((D,q)=>D+parseInt(q.insideMiters||"0")+parseInt(q.outsideMiters||"0"),0)})]})})]})}),T&&a.jsxs("div",{className:"text-[10px] text-muted-foreground pt-1",children:["Gutter: ",a.jsx("strong",{children:T}),p?.material&&a.jsxs(a.Fragment,{children:[" · Material: ",a.jsx("strong",{children:p.material})]})]})]})}),s==="cutchart"&&a.jsx("div",{children:_?a.jsx("div",{className:"text-xs text-muted-foreground animate-pulse",children:"Loading cut chart…"}):E.length===0?a.jsx("div",{className:"text-xs text-muted-foreground italic",children:"No cut chart entries. Add them in Settings."}):a.jsxs("div",{children:[a.jsxs("div",{className:"space-y-1.5 mb-3",children:[a.jsxs("div",{className:"flex gap-1 flex-wrap items-center",children:[a.jsx("span",{className:"text-[10px] text-muted-foreground w-8 shrink-0",children:"Size:"}),["",...R].map(D=>a.jsx("button",{onClick:()=>u(D),className:`px-1.5 py-0.5 rounded text-[10px] font-medium border transition-colors ${L===D?"bg-primary text-primary-foreground border-primary":"border-border text-muted-foreground hover:border-primary/60"}`,children:D||"All"},D||"all"))]}),a.jsxs("div",{className:"flex gap-1 flex-wrap items-center",children:[a.jsx("span",{className:"text-[10px] text-muted-foreground w-8 shrink-0",children:"Type:"}),["",...H].map(D=>a.jsx("button",{onClick:()=>f(D),className:`px-1.5 py-0.5 rounded text-[10px] font-medium border transition-colors ${d===D?"bg-primary text-primary-foreground border-primary":"border-border text-muted-foreground hover:border-primary/60"}`,children:D||"All"},D||"all"))]})]}),I.length===0?a.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No entries match the selected filters."}):a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"text-muted-foreground border-b border-border/60",children:[a.jsx("th",{className:"text-left pb-1.5 pr-2",children:"Component"}),a.jsx("th",{className:"text-left pb-1.5 pr-2",children:"Direction"}),a.jsx("th",{className:"text-right pb-1.5 pr-2",children:"Cut (in)"}),a.jsx("th",{className:"text-center pb-1.5 pr-2",children:"L"}),a.jsx("th",{className:"text-center pb-1.5 pr-2",children:"R"}),a.jsx("th",{className:"text-left pb-1.5",children:"Notes"})]})}),a.jsx("tbody",{children:I.map(D=>a.jsxs("tr",{className:"border-b border-border/30",children:[a.jsx("td",{className:"py-1.5 pr-2 font-medium",children:D.componentType}),a.jsx("td",{className:"py-1.5 pr-2 text-muted-foreground",children:D.direction||"—"}),a.jsxs("td",{className:"py-1.5 pr-2 text-right font-mono font-bold",children:[D.cutLengthInches,'"']}),a.jsx("td",{className:"py-1.5 pr-2 text-center",children:D.leftCrimps??0}),a.jsx("td",{className:"py-1.5 pr-2 text-center",children:D.rightCrimps??0}),a.jsx("td",{className:"py-1.5 text-[10px] text-muted-foreground",children:D.notes||""})]},D.id))})]})})]})}),s==="materials"&&a.jsx("div",{children:U?a.jsx("div",{className:"text-xs text-muted-foreground animate-pulse",children:"Loading kit…"}):W.length===0?a.jsx("div",{className:"text-xs text-muted-foreground italic",children:"No kit list yet — generate one in the Kit List section below."}):j.length===0?a.jsx("div",{className:"text-xs text-muted-foreground italic",children:"No sections defined — materials shown in Kit List below."}):(()=>{const D=j.reduce((Z,F)=>Z+parseFloat(F.gutterFootage||"0"),0),q=j.reduce((Z,F)=>Z+parseInt(F.downspouts||"0"),0),K=j.reduce((Z,F)=>Z+parseInt(F.insideMiters||"0")+parseInt(F.outsideMiters||"0"),0),Y=W.some(Z=>Z.qtyOnHand!==null&&Z.qtyOnHand<Z.quantityNeeded),z=j.map((Z,F)=>
188{const B=String(Z.id??F),X=parseFloat(Z.gutterFootage||"0"),Q=parseInt(Z.downspouts||"0"),se=parseInt(Z.insideMiters||"0")+parseInt(Z.outsideMiters||"0"),ee=W.map(ve=>{let ue=0;const de=ve.categorySlug;return de==="downspouts"||de==="end-caps"?ue=q>0?Math.round(Q/q*ve.quantityNeeded*10)/10:0:de==="miters"?ue=K>0?Math.round(se/K*ve.quantityNeeded*10)/10:0:ue=D>0?Math.round(X/D*ve.quantityNeeded*10)/10:0,ue>0?{...ve,sectionQty:ue}:null}).filter(Boolean);return{sid:B,s:Z,idx:F,done:!!w[B],items:ee}});return a.jsxs("div",{className:"space-y-3",children:[z.map(({sid:Z,s:F,idx:B,done:X,items:Q})=>a.jsxs("div",{className:X?"opacity-60":"",children:[a.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[X?a.jsx(st,{className:"w-3.5 h-3.5 text-green-600 shrink-0"}):a.jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-border shrink-0"}),a.jsx("span",{className:"text-xs font-semibold",children:F.name||`Section ${B+1}`}),a.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[parseFloat(F.gutterFootage||"0").toFixed(0)," ft · ",F.downspouts||0," DS"]})]}),a.jsx("div",{className:"ml-5 space-y-0.5",children:Q.length===0?a.jsx("span",{className:"text-[10px] text-muted-foreground italic",children:"No materials"}):Q.map(se=>{const ee=se.qtyOnHand!==null&&se.qtyOnHand<se.quantityNeeded;return a.jsxs("div",{className:"flex justify-between items-baseline text-[10px]",children:[a.jsxs("span",{className:ee?"text-red-600 font-medium":"text-muted-foreground",children:[se.productName,ee&&a.jsx(Kt,{className:"w-2.5 h-2.5 inline ml-0.5 text-red-500"})]}),a.jsxs("span",{className:"font-medium tabular-nums ml-3 shrink-0",children:[se.sectionQty," ",a.jsx("span",{className:"text-muted-foreground font-normal",children:LPe[se.unitType]||se.unitType})]})]},se.id)})})]},Z)),Y&&a.jsxs("p",{className:"text-[10px] text-red-600 flex items-center gap-1 pt-1 border-t border-border/40",children:[a.jsx(Kt,{className:"w-3 h-3"})," Some items are below stock — check Kit List for details"]})]})})()})]})]})}function FPe({jobs:e,role:t}){const n=wt(),[r,s]=v.useState(()=>Object.fromEntries(e.map(x=>[x.id,x.kitReady??!1]))),i=async x=>{const y=!r[x];s(w=>({...w,[x]:y})),await To(`/api/jobs/${x}`,{method:"PATCH",body:JSON.stringify({kitReady:y})})},l=nt({mutationFn:x=>To(`/api/jobs/${x}/mark-received`,{method:"POST"}).then(y=>y.json()),onSuccess:()=>n.invalidateQueries({queryKey:["jobs"]})}),u=e.filter(x=>["scheduled","in_progress"].includes(x.status)),d=u.filter(x=>x.materialOrderedAt&&!x.materialReceivedAt),f=u.filter(x=>x.materialReceivedAt),h=u.filter(x=>!x.materialOrderedAt),p=(x,y=!1)=>{const w=r[x.id]??!1;return a.jsxs(ye,{className:`overflow-hidden border-border/60 ${w?"opacity-70":""}`,children:[a.jsx("div",{className:`h-2 w-full ${Qy[x.status]??"bg-gray-400"}`}),a.jsxs("div",{className:"p-5",children:[a.jsxs("div",{className:"flex justify-between items-start mb-3",children:[a.jsx("span",{className:`px-2.5 py-1 rounded-md text-[10px] font-bold uppercase tracking-wider ${zO[x.status]??"bg-gray-100 text-gray-700"}`,children:x.status.replace("_"," ")}),x.scheduledDate&&a.jsxs("div",{className:"flex items-center text-xs text-muted-foreground",children:[a.jsx(Ma,{className:"w-3.5 h-3.5 mr-1"}),Tt(new Date(x.scheduledDate),"MMM d")]})]}),a.jsx("h3",{className:"font-bold text-lg leading-tight mb-1",children:x.address||"No address"}),a.jsxs("p",{className:"text-sm text-muted-foreground mb-1",children:[x.city,", ",x.state," ",x.zip]}),(()=>{const j=x.sectionStatus||{},b=Object.values(j).filter(Boolean).length,C=x.sectionCount??0;if(!C)return null;const N=Math.round(b/C*100);return a.jsxs("span",{className:`inline-flex items-center gap-1 text-[10px] font-bold px-2 py-0.5 rounded-full mb-3 ${N===100?"bg-green-100 text-green-700":"bg-secondary text-muted-foreground"}`,children:[a.jsx(Rr,{className:"w-3 h-3"}),b,"/",C," sections",N===100?" ✓":` · ${N}%`]})})(),x.notes&&a.jsx("p",{className:"text-xs text-muted-foreground bg-secondary/50 rounded-lg p-2 mb-3 line-clamp-2",children:x.notes}),y&&a.jsxs(ne,{size:"sm",className:"w-full mb-3 bg-blue-600 hover:bg-blue-700 text-white rounded-xl",disabled:l.isPending,onClick:()=>l.mutate(x.id),children:[a.jsx(Ci,{className:"w-4 h-4 mr-2"}),l.isPending?"Checking In…":"Check In Material"]}),x.materialReceivedAt&&a.jsxs("button",{onClick:()=>i(x.id),className:`w-full flex items-center justify-center gap-2 py-2.5 rounded-xl font-semibold text-sm transition-all border-2 mb-3 ${w?"border-green-500 bg-green-50 text-green-700 hover:bg-green-100":"border-border hover:border-primary/60 hover:bg-secondary"}`,children:[a.jsx(st,{className:`w-4 h-4 ${w?"text-green-600":"text-muted-foreground"}`}),w?"Kit Ready ✓":"Mark Kit Ready"]}),a.jsx(UO,{jobId:x.id,quoteId:x.quoteId??null}),x.quoteId&&a.jsx(BO,{jobId:x.id,kitReady:x.kitReady??!1})]})]},x.id)};return a.jsxs("div",{className:"space-y-8",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-3xl font-display font-bold text-foreground",children:"Kit Queue"}),a.jsx("p",{className:"text-muted-foreground mt-1",children:"Prepare job kits for upcoming installations"})]}),u.length===0?a.jsxs("div",{className:"py-16 text-center bg-secondary/30 rounded-2xl border-2 border-dashed border-border",children:[a.jsx(Jn,{className:"w-12 h-12 text-muted-foreground opacity-30 mx-auto mb-4"}),a.jsx("p",{className:"text-muted-foreground font-medium text-lg",children:"No upcoming jobs to prep."})]}):a.jsxs(a.Fragment,{children:[d.length>0&&a.jsxs("div",{children:[a.jsxs("h2",{className:"text-sm font-bold uppercase tracking-wider text-blue-600 mb-3 flex items-center gap-2",children:[a.jsx(Ci,{className:"w-4 h-4"})," Awaiting Delivery (",d.length,")"]}),a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:d.map(x=>p(x,!0))})]}),f.length>0&&a.jsxs("div",{children:[a.jsxs("h2",{className:"text-sm font-bold uppercase tracking-wider text-green-700 mb-3 flex items-center gap-2",children:[a.jsx(Jn,{className:"w-4 h-4"})," Ready to Prep (",f.length,")"]}),a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:f.map(x=>p(x,!1))})]}),h.length>0&&a.jsxs("div",{children:[a.jsxs("h2",{className:"text-sm font-bold uppercase tracking-wider text-muted-foreground mb-3 flex items-center gap-2",children:[a.jsx(rn,{className:"w-4 h-4"})," Material Not Yet Ordered (",h.length,")"]}),a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:h.map(x=>a.jsxs(ye,{className:"overflow-hidden border-dashed border-border/40 opacity-60",children:[a.jsx("div",{className:`h-2 w-full ${Qy[x.status]??"bg-gray-400"}`}),a.jsxs("div",{className:"p-5",children:[a.jsx("h3",{className:"font-bold text-base leading-tight mb-1",children:x.address||"No address"}),a.jsxs("p",{className:"text-sm text-muted-foreground",children:[x.city,", ",x.state]}),x.scheduledDate&&a.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[a.jsx(Ma,{className:"w-3 h-3 inline mr-1"}),Tt(new Date(x.scheduledDate),"MMM d")]})]})]},x.id))})]})]})]})}function qPe({jobs:e}){const[,t]=fr(),n=e.filter(s=>
188s.status!=="completed"&&s.status!=="cancelled"),r=e.filter(s=>s.status==="completed");return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-3xl font-display font-bold text-foreground",children:"My Jobs"}),a.jsx("p",{className:"text-muted-foreground mt-1",children:"Jobs assigned to you"})]}),a.jsxs(ne,{className:"rounded-xl",onClick:()=>t("/job-status"),children:[a.jsx(Dr,{className:"w-4 h-4 mr-2"})," Submit Daily Status"]})]}),e.length===0?a.jsxs("div",{className:"py-16 text-center bg-secondary/30 rounded-2xl border-2 border-dashed border-border",children:[a.jsx(rs,{className:"w-12 h-12 text-muted-foreground opacity-30 mx-auto mb-4"}),a.jsx("p",{className:"text-muted-foreground font-medium text-lg",children:"No jobs assigned to you yet."})]}):a.jsxs(a.Fragment,{children:[n.length>0&&a.jsxs("div",{children:[a.jsx("h2",{className:"text-sm font-bold uppercase tracking-wider text-muted-foreground mb-3",children:"Active"}),a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:n.map(s=>a.jsxs(ye,{className:"overflow-hidden border-border/60",children:[a.jsx("div",{className:`h-2 w-full ${Qy[s.status]??"bg-gray-400"}`}),a.jsxs("div",{className:"p-5",children:[a.jsxs("div",{className:"flex justify-between items-start mb-3",children:[a.jsx("span",{className:`px-2.5 py-1 rounded-md text-[10px] font-bold uppercase tracking-wider ${zO[s.status]??"bg-gray-100 text-gray-700"}`,children:s.status.replace("_"," ")}),s.scheduledDate&&a.jsxs("div",{className:"flex items-center text-xs text-muted-foreground",children:[a.jsx(Ma,{className:"w-3.5 h-3.5 mr-1"}),Tt(new Date(s.scheduledDate),"MMM do, yyyy")]})]}),a.jsx("h3",{className:"font-bold text-lg leading-tight mb-1",children:s.address||"No address"}),a.jsxs("p",{className:"text-sm text-muted-foreground mb-1",children:[s.city,", ",s.state," ",s.zip]}),(()=>{const i=s.sectionStatus||{},l=Object.values(i).filter(Boolean).length,u=s.sectionCount??0;if(!u)return null;const d=Math.round(l/u*100);return a.jsxs("span",{className:`inline-flex items-center gap-1 text-[10px] font-bold px-2 py-0.5 rounded-full mb-3 ${d===100?"bg-green-100 text-green-700":"bg-secondary text-muted-foreground"}`,children:[a.jsx(Rr,{className:"w-3 h-3"}),l,"/",u," sections",d===100?" ✓":` · ${d}%`]})})(),s.notes&&a.jsx("p",{className:"text-sm text-muted-foreground bg-secondary/40 rounded-lg p-3 mb-3",children:s.notes}),a.jsxs(ne,{variant:"outline",className:"w-full rounded-xl text-sm mb-2",onClick:()=>t("/job-status"),children:[a.jsx(Dr,{className:"w-3.5 h-3.5 mr-2"})," Submit Status Update"]}),a.jsx(UO,{jobId:s.id,quoteId:s.quoteId??null}),s.quoteId&&a.jsx(BO,{jobId:s.id,kitReady:s.kitReady??!1})]})]},s.id))})]}),r.length>0&&a.jsxs("div",{children:[a.jsx("h2",{className:"text-sm font-bold uppercase tracking-wider text-muted-foreground mb-3",children:"Completed"}),a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:r.map(s=>a.jsxs(ye,{className:"overflow-hidden border-border/60 opacity-60",children:[a.jsx("div",{className:"h-2 w-full bg-green-500"}),a.jsxs("div",{className:"p-4",children:[a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsx("h3",{className:"font-semibold",children:s.address||"No address"}),a.jsx("span",{className:"text-[10px] font-bold bg-green-100 text-green-700 px-2 py-0.5 rounded-full",children:"Completed"})]}),a.jsxs("p",{className:"text-sm text-muted-foreground",children:[s.city,", ",s.state]}),s.completedDate&&a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:Tt(new Date(s.completedDate),"MMM d, yyyy")})]})]},s.id))})]})]})]})}function BPe({jobs:e}){const[t,n]=v.useState(""),r=wt(),s=e.filter(l=>!t||(l.address+" "+l.city).toLowerCase().includes(t.toLowerCase())),i=nt({mutationFn:l=>To(`/api/jobs/${l}/mark-ordered`,{method:"POST"}).then(u=>u.json()),onSuccess:()=>r.invalidateQueries({queryKey:["jobs"]})});return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-3xl font-display font-bold text-foreground",children:"Jobs Board"}),a.jsx("p",{className:"text-muted-foreground mt-1",children:"Track scheduled and active installations"})]}),a.jsxs("div",{className:"relative w-full sm:w-72",children:[a.jsx(Da,{className:"w-4 h-4 absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),a.jsx("input",{type:"text",placeholder:"Search address or client...",value:t,onChange:l=>n(l.target.value),className:"w-full pl-9 pr-4 py-2 bg-white border border-border rounded-xl outline-none focus:border-primary shadow-sm"})]})]}),a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:s.length===0?a.jsxs("div",{className:"col-span-full py-16 text-center bg-secondary/30 rounded-2xl border-2 border-dashed border-border",children:[a.jsx(rs,{className:"w-12 h-12 text-muted-foreground opacity-30 mx-auto mb-4"}),a.jsx("p",{className:"text-muted-foreground font-medium text-lg",children:e.length===0?"N
188o jobs scheduled yet.":"No jobs match your search."})]}):s.map(l=>a.jsxs(ye,{className:"overflow-hidden hover-elevate border-border/60",children:[a.jsx("div",{className:`h-2 w-full ${Qy[l.status]??"bg-gray-400"}`}),a.jsxs("div",{className:"p-5",children:[a.jsxs("div",{className:"flex justify-between items-start mb-4",children:[a.jsx("span",{className:`px-2.5 py-1 rounded-md text-[10px] font-bold uppercase tracking-wider ${zO[l.status]??"bg-gray-100 text-gray-700"}`,children:l.status.replace("_"," ")}),a.jsx("span",{className:"font-bold text-foreground",children:De(l.totalAmount)})]}),a.jsx("h3",{className:"font-bold text-lg leading-tight mb-1",children:l.address||"No address"}),a.jsxs("p",{className:"text-sm text-muted-foreground mb-4",children:[l.city,", ",l.state," ",l.zip]}),a.jsxs("div",{className:"space-y-2 mb-4",children:[a.jsxs("div",{className:"flex items-center text-sm text-muted-foreground",children:[a.jsx(Ma,{className:"w-4 h-4 mr-2"}),l.scheduledDate?Tt(new Date(l.scheduledDate),"MMM do, yyyy"):"Not scheduled"]}),a.jsxs("div",{className:"flex items-center text-sm text-muted-foreground",children:[a.jsx(Ra,{className:"w-4 h-4 mr-2"}),l.city||"Unknown area"]}),a.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[l.kitReady&&a.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-bold bg-green-100 text-green-700 px-2 py-0.5 rounded-full",children:[a.jsx(Jn,{className:"w-3 h-3"})," Kit Ready"]}),a.jsx(IPe,{job:l}),(()=>{const u=l.sectionStatus||{},d=Object.values(u).filter(Boolean).length,f=l.sectionCount??0;if(!f)return null;const h=Math.round(d/f*100);return a.jsxs("span",{className:`inline-flex items-center gap-1 text-[10px] font-bold px-2 py-0.5 rounded-full ${h===100?"bg-green-100 text-green-700":"bg-secondary text-muted-foreground"}`,children:[a.jsx(Rr,{className:"w-3 h-3"}),d,"/",f," sections",h===100?" ✓":` · ${h}%`]})})()]})]}),!l.materialOrderedAt&&l.status!=="completed"&&l.status!=="cancelled"&&a.jsxs(ne,{size:"sm",variant:"outline",className:"w-full mb-3 rounded-xl text-xs border-blue-300 text-blue-700 hover:bg-blue-50",disabled:i.isPending,onClick:()=>i.mutate(l.id),children:[a.jsx(Ci,{className:"w-3.5 h-3.5 mr-1.5"})," Mark Material Ordered"]}),l.materialOrderedAt&&a.jsxs("p",{className:"text-[10px] text-muted-foreground mb-3",children:["Ordered ",Tt(new Date(l.materialOrderedAt),"MMM d, h:mm a")]}),a.jsx(UO,{jobId:l.id,quoteId:l.quoteId??null}),l.quoteId&&a.jsx(BO,{jobId:l.id,kitReady:l.kitReady??!1}),a.jsx("div",{className:"flex justify-between items-center pt-3 mt-3 border-t border-border/60",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"w-6 h-6 rounded-full bg-primary/20 text-primary flex items-center justify-center text-xs font-bold",children:l.assignedToId?"T":"?"}),a.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:l.assignedToId?"Assigned":"Unassigned"})]})})]})]},l.id))})]})}function zPe(){const{teamMember:e}=Nn(),{data:t=[],isLoading:n}=jv(),r=e?.role??"";return n?a.jsx("div",{className:"p-8 flex justify-center",children:a.jsx("div",{className:"animate-spin h-8 w-8 border-4 border-primary border-t-transparent rounded-full"})}):r==="shop_technician"?a.jsx(FPe,{jobs:t,role:r}):r==="field_tech"?a.jsx(qPe,{jobs:t}):a.jsx(BPe,{jobs:t})}function UPe(){return Pse()}const y2=async(e,t)=>{const n=localStorage.getItem("fs_team_token"),r=await fetch(e,{...t,headers:{Authorization:`Bearer ${n}`,"Content-Type":"application/json",...t?.headers||{}}}),s=await r.text();try{return JSON.parse(s)}catch{throw console.error(`[authFetch] Non-JSON response from ${e} (HTTP ${r.status}):`,s.slice(0,500)),new Error(`Server returned unexpected response (HTTP ${r.status}). Check the browser console for details.`)}},HPe={homeowner:"Homeowner",contractor:"Contractor",property_mgmt:"HOA / Prop Mgmt"},VPe={homeowner:"bg-blue-100 text-blue-700",contractor:"bg-amber-100 text-amber-700",property_mgmt:"bg-purple-100 text-purple-700"};function GPe({onClose:e,onImported:t}){const[n,r]=v.useState("idle"),[s,i]=v.useState([]),[l,u]=v.useState(new Set),[d,f]=v.useState(""),[h,p]=v.useState({done:0,total:0,phase:""}),[x,y]=v.useState(null),w=async()=>{r("loading"),f("");try{const A=await y2("/api/sharepoint/list-project-folders");if(!A.ok)throw new Error(A.error||"Failed to load folders");i(A.folders||[]),u(new Set((A.folders||[]).map(P=>P.webUrl))),r("preview")}catch(A){f(A.message||"Failed to connect to SharePoint"),r("idle")}},j=s.reduce((A,P)=>{const E=P.estimatorGroup||"Other";return A[E]||(A[E]=[]),A[E].push(P),A},{}),b=Object.keys(j).sort(),C=()=>{l.size===s.length?u(new Set):u(new Set(s.map(A=>A.webUrl)))},N=A=>{const P=(j[A]||[]).map(R=>R.webUrl),E=P.every(R=>l.has(R)),_=new Set(l);E?P.forEach(R=>_.delete(R)):P.forEach(R=>_.add(R)),u(_)},k=A=>{const P=new Set(l);P.has(A)?P.delete(A):P.add(A),u(P)},T=async()=>{r("importing"),f(""),p({done:0,total:l.size,phase:"Starting…"});const A=s.map(E=>E.webUrl);let P;l.size===s.length?P={importAll:!0}:l.size>s.length/2?P={excludeUrls:A.filter(_=>!l.has(_))}:P={includeUrls:Array.from(l)};try{const E=await y2("/api/sharepoint/start-import",{method:"POST",body:JSON.stringify(P)});if(!E.ok)throw new Error(E.error||"Failed to start import");const{jobId:_}=E;await new Promise((R,H)=>{const L=setInterval(async()=>{try{const I=await y2(`/api/sharepoint/import-status/${_}`);if(!I.ok){clearInterval(L),H(new Error(I.error||"Import failed"));return}const W=I.status==="fetching"?"Fetching folders from SharePoint…":I.status==="importing"?`Importing clients… ${I.created} done`:I.status==="done"?"Done":I.status==="error"?"Error":"Starting…";p({done:I.created||0,total:I.total||l.size,phase:W}),I.status==="done"?(clearInterval(L),y({created:I.created||0,skipped:I.skipped||0,createdNames:[],skippedNames:[]}),R()):I.status==="error"&&(clearInterval(L),H(new Error(I.error||"Import failed")))}catch(I){clearInterval(L),H(I)}},2e3)}),r("done"),t()}catch(E){f(E.message||"Import failed"),r("preview")}};return a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",children:a.jsxs("div",{className:"bg-white rounded-2xl shadow-2xl w-full max-w-2xl max-h-[85vh] flex flex-col",children:[a.jsxs("div",{className:"flex items-center gap-3 px-6 py-4 border-b border-border",children:[a.jsx("div",{className:"w-10 h-10 rounded-xl bg-primary/10 flex items-center justify-center",children:a.jsx(yr,{className:"w-5 h-5 text-primary"})}),a.jsxs("div",{className:"flex-1",children:[a.jsx("h2",{className:"text-lg font-bold text-foreground",children:"Sync from SharePoint"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:'Import client folders from your SharePoint "Client Projects" library'})]}),a.jsx("button",{onClick:e,className:"text-muted-foreground hover:text-foreground text-xl font-bold px-2",children:"×"})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto p-6",children:[d&&a.jsxs("div",{className:"mb-4 p-3 bg-red-50 border border-red-200 rounded-xl text-red-700 text-sm flex gap-2",children:[a.jsx(rn,{className:"w-4 h-4 mt-0.5 shrink-0"}),a.jsx("span",{children:d})]}),n==="idle"&&a.jsxs("div",{className:"text-center py-8",children:[a.jsx(yr,{className:"w-16 h-16 mx-auto text-primary/30 mb-4"}),a.jsxs("p",{className:"text-muted-foreground mb-2 max-w-sm mx-auto",children:["Scans your SharePoint ",a.jsx("strong",{children:"Client Projects"})," library and imports client folders as client records."]}
188),a.jsx("p",{className:"text-xs text-muted-foreground/70 mb-6 max-w-sm mx-auto",children:"Client folders are grouped under each estimator's folder. Only client-level folders are imported — not job address folders inside them."}),a.jsxs(ne,{className:"rounded-xl px-8",onClick:w,children:[a.jsx(qo,{className:"w-4 h-4 mr-2"})," Load Folders from SharePoint"]})]}),n==="loading"&&a.jsxs("div",{className:"text-center py-12",children:[a.jsx(Me,{className:"w-10 h-10 animate-spin text-primary mx-auto mb-3"}),a.jsx("p",{className:"text-muted-foreground",children:"Scanning SharePoint client folders…"}),a.jsx("p",{className:"text-xs text-muted-foreground/60 mt-1",children:"This may take a moment — scanning all estimator groups"})]}),(n==="preview"||n==="importing")&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("p",{className:"text-sm font-semibold text-foreground",children:[s.length," client folder",s.length!==1?"s":""," found across ",b.length," group",b.length!==1?"s":""]}),a.jsx("button",{onClick:C,className:"text-xs text-primary font-semibold hover:underline",children:l.size===s.length?"Deselect All":"Select All"})]}),a.jsx("div",{className:"space-y-4",children:b.map(A=>{const P=j[A],_=P.map(R=>R.webUrl).every(R=>l.has(R));return a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(yr,{className:"w-3.5 h-3.5 text-muted-foreground/60"}),a.jsx("span",{className:"text-xs font-bold text-muted-foreground uppercase tracking-wide",children:A}),a.jsxs("span",{className:"text-xs text-muted-foreground/60",children:["(",P.length,")"]})]}),a.jsx("button",{onClick:()=>N(A),className:"text-[10px] text-primary font-semibold hover:underline",children:_?"Deselect":"Select All"})]}),a.jsx("div",{className:"space-y-1 pl-2",children:P.map(R=>{const H=l.has(R.webUrl);return a.jsxs("div",{onClick:()=>k(R.webUrl),className:`flex items-center gap-3 px-3 py-2 rounded-lg border cursor-pointer transition-colors ${H?"border-primary/30 bg-primary/5":"border-border hover:bg-secondary/40"}`,children:[H?a.jsx(lte,{className:"w-4 h-4 text-primary shrink-0"}):a.jsx(fte,{className:"w-4 h-4 text-muted-foreground shrink-0"}),a.jsx("span",{className:"text-sm text-foreground truncate",children:R.parsed.name})]},R.webUrl)})})]},A)})}),s.length===0&&a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:a.jsx("p",{children:"No client folders found in SharePoint."})})]}),n==="done"&&x&&a.jsxs("div",{className:"text-center py-6",children:[a.jsx(st,{className:"w-16 h-16 text-green-500 mx-auto mb-4"}),a.jsx("p",{className:"text-xl font-bold text-foreground mb-1",children:"Import complete!"}),a.jsxs("p",{className:"text-muted-foreground mb-6",children:[a.jsx("span",{className:"font-bold text-green-600",children:x.created})," client",x.created!==1?"s":""," created",x.skipped>0&&a.jsxs(a.Fragment,{children:[", ",a.jsx("span",{className:"font-bold text-amber-600",children:x.skipped})," already existed and were skipped"]})]}),x.createdNames.length>0&&a.jsxs("div",{className:"text-left bg-green-50 border border-green-200 rounded-xl p-4 max-h-48 overflow-y-auto",children:[a.jsx("p",{className:"text-xs font-bold text-green-800 mb-2 uppercase tracking-wide",children:"Created:"}),x.createdNames.map(A=>a.jsxs("p",{className:"text-sm text-green-700",children:["✓ ",A]},A))]})]})]}),a.jsx("div",{className:"px-6 py-4 border-t border-border flex justify-end gap-3",children:n==="done"?a.jsx(ne,{className:"rounded-xl",onClick:e,children:"Done"}):a.jsxs(a.Fragment,{children:[a.jsx(ne,{variant:"outline",className:"rounded-xl",onClick:e,children:"Cancel"}),n==="preview"&&a.jsxs(ne,{className:"rounded-xl",disabled:l.size===0,onClick:T,children:["Import ",l.size," Client",l.size!==1?"s":""]}),n==="importing"&&a.jsxs("div",{className:"flex flex-col items-end gap-1",children:[a.jsxs(ne,{className:"rounded-xl",disabled:!0,children:[a.jsx(Me,{className:"w-4 h-4 animate-spin mr-2"}),h.phase||"Starting…"]}),h.total>0&&h.done>0&&a.jsx("div",{className:"w-52 bg-gray-200 rounded-full h-1.5",children:a.jsx("div",{className:"bg-primary h-1.5 rounded-full transition-all duration-500",style:{width:`${Math.round(Math.min(h.done/h.total*100,100))}%`}})})]})]})})]})})}function KPe(){const{data:e,isLoading:t}=UPe(),{teamMember:n}=Nn(),r=wt(),[,s]=fr(),[i,l]=v.useState(""),[u,d]=v.useState(!1),[f,h]=v.useState(!1),[p,x]=v.useState(""),[y,w]=v.useState([]),j=n?.role==="estimator",b=!j;v.useEffect(()=>{if(b){const N=localStorage.getItem("fs_team_token");fetch("/api/clients/estimator-groups",{headers:{Authorization:`Bearer ${N}`}}).then(k=>k.ok?k.json():[]).then(w).catch(()=>{})}},[b]);const C=e?.filter(N=>{const k=i.toLowerCase(),T=!i||N.name.toLowerCase().includes(k)||N.email.toLowerCase().includes(k)||N.companyName?.toLowerCase().includes(k)||N.city?.toLowerCase().includes(k)||N.phone?.includes(i),A=!p||(N.estimatorGroup||"").toLowerCase().includes(p.toLowerCase());return T&&A});return t?a.jsx("div",{className:"p-8 flex justify-center",children:a.jsx("div",{className:"animate-spin h-8 w-8 border-4 border-primary border-t-transparent roun
188ded-full"})}):a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-3xl font-display font-bold text-foreground",children:"Clients"}),a.jsx("p",{className:"text-muted-foreground mt-1",children:j?`Your assigned clients — ${n?.name}`:"All homeowners, contractors, and HOAs"})]}),a.jsxs("div",{className:"flex gap-2",children:[b&&a.jsxs(ne,{variant:"outline",className:"rounded-xl px-5 border-2",onClick:()=>h(!0),children:[a.jsx(qo,{className:"w-4 h-4 mr-2"})," Sync from OneDrive"]}),a.jsxs(ne,{className:"rounded-xl px-6 shadow-lg shadow-primary/20",onClick:()=>d(!0),children:[a.jsx(Ft,{className:"w-4 h-4 mr-2"})," New Lead / Client"]})]})]}),j&&a.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 bg-blue-50 border border-blue-200 rounded-xl text-blue-800 text-sm",children:[a.jsx(Ai,{className:"w-4 h-4 flex-shrink-0 text-blue-500"}),a.jsxs("span",{children:["You're viewing clients assigned to ",a.jsx("strong",{children:n?.name}),". Contact an admin if you need access to other clients."]})]}),a.jsx("div",{className:"grid grid-cols-3 gap-4",children:[{label:"Homeowners",count:C?.filter(N=>N.type==="homeowner").length??0,color:"text-blue-600",bg:"bg-blue-50"},{label:"Contractors",count:C?.filter(N=>N.type==="contractor").length??0,color:"text-amber-600",bg:"bg-amber-50"},{label:"HOA / Prop Mgmt",count:C?.filter(N=>N.type==="property_mgmt").length??0,color:"text-purple-600",bg:"bg-purple-50"}].map(N=>a.jsxs(ye,{className:`p-4 border-border/60 shadow-sm ${N.bg}`,children:[a.jsx("div",{className:`text-2xl font-display font-bold ${N.color}`,children:N.count}),a.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 font-medium",children:N.label})]},N.label))}),a.jsxs(ye,{className:"border-border/60 shadow-sm overflow-hidden",children:[a.jsxs("div",{className:"p-4 border-b border-border flex flex-wrap justify-between items-center gap-3 bg-secondary/30",children:[a.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[a.jsxs("div",{className:"relative w-64 flex-shrink-0",children:[a.jsx(Da,{className:"w-4 h-4 absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),a.jsx("input",{type:"text",placeholder:"Search by name, email, phone, city…",value:i,onChange:N=>l(N.target.value),className:"w-full pl-9 pr-4 py-2 text-sm bg-white border border-border rounded-lg outline-none focus:border-primary"})]}),b&&y.length>0&&a.jsxs("div",{className:"relative flex-shrink-0",children:[a.jsx(Fq,{className:"w-3.5 h-3.5 absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none"}),a.jsxs("select",{value:p,onChange:N=>x(N.target.value),className:"pl-8 pr-8 py-2 text-sm bg-white border border-border rounded-lg outline-none focus:border-primary appearance-none cursor-pointer",children:[a.jsx("option",{value:"",children:"All Estimators"}),y.map(N=>a.jsx("option",{value:N,children:N},N))]})]})]}),a.jsxs("span",{className:"text-xs text-muted-foreground font-medium flex-shrink-0",children:[C?.length??0," client",C?.length!==1?"s":""]})]}),a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm text-left",children:[a.jsx("thead",{className:"text-xs text-muted-foreground uppercase bg-secondary/50 font-semibold",children:a.jsxs("tr",{children:[a.jsx("th",{className:"px-6 py-4",children:"Client"}),a.jsx("th",{className:"px-6 py-4",children:"Contact"}),a.jsx("th",{className:"px-6 py-4",children:"Location"}),a.jsx("th",{className:"px-6 py-4",children:"Type"}),a.jsx("th",{className:"px-6 py-4",children:"Added"}),a.jsx("th",{className:"px-6 py-4 text-right",children:"Profile"})]})}),a.jsx("tbody",{className:"divide-y divide-border",children:C?.length===0?a.jsx("tr",{children:a.jsxs("td",{colSpan:6,className:"px-6 py-12 text-center text-muted-foreground",children:[a.jsx(Rr,{className:"w-12 h-12 mx-auto mb-3 opacity-20"}),a.jsx("p",{className:"mb-2",children:"No clients yet."}),a.jsx("button",{onClick:()=>h(!0),className:"text-primary text-sm font-semibold hover:underline",children:"Import from OneDrive →"})]})}):C?.map(N=>a.jsxs("tr",{className:"hover:bg-secondary/30 transition-colors cursor-pointer",onClick:()=>s(`/clients/${N.id}`),children:[a.jsx("td",{className:"px-6 py-4",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-10 h-10 rounded-full bg-primary/10 flex items-center justify-center text-primary",children:N.type==="homeowner"?a.jsx(Ai,{className:"w-5 h-5"}):a.jsx(xd,{className:"w-5 h-5"})}),a.jsxs("div",{children:[a.jsx("div",{className:"font-bold text-foreground",children:N.type!=="homeowner"&&N.companyName?N.companyName:N.name}),N.type!=="homeowner"&&N.companyName&&a.jsx("div",{className:"text-xs text-muted-foreground",children:N.name})]})]})}),a.jsxs("td",{className:"px-6 py-4",children:[a.jsx("div",{className:"text-foreground font-medium",children:N.email||a.jsx("span",{className:"text-muted-foreground italic",children:"No email"})}),N.phone&&a.jsx("div",{className:"text-muted-foreground text-xs mt-0.5",children:N.phone})]}),a.jsx("td",{className:"px-6 py-4 text-muted-foreground",children:[N.city,N.state].filter(
188Boolean).join(", ")||"—"}),a.jsx("td",{className:"px-6 py-4",children:a.jsx("span",{className:`px-2.5 py-1 text-[10px] font-bold uppercase tracking-wider rounded-full ${VPe[N.type]||"bg-secondary text-secondary-foreground"}`,children:HPe[N.type]||N.type})}),a.jsx("td",{className:"px-6 py-4 text-muted-foreground",children:Tt(new Date(N.createdAt),"MMM dd, yyyy")}),a.jsx("td",{className:"px-6 py-4 text-right",children:a.jsxs(ne,{variant:"outline",size:"sm",className:"rounded-lg",onClick:k=>{k.stopPropagation(),s(`/clients/${N.id}`)},children:["View ",a.jsx(wr,{className:"w-3.5 h-3.5 ml-1"})]})})]},N.id))})]})})]}),a.jsx(mH,{open:u,onClose:()=>d(!1)}),f&&a.jsx(GPe,{onClose:()=>h(!1),onImported:()=>r.invalidateQueries({queryKey:_T()})})]})}const wK="fs_team_token";function WPe(e,t={}){const n=localStorage.getItem(wK);return fetch(e,{...t,headers:{"Content-Type":"application/json",...n?{Authorization:`Bearer ${n}`}:{},...t.headers||{}}})}function YPe(){const e=wt();return nt({mutationFn:async t=>{const n=await WPe("/api/job-status-updates",{method:"POST",body:JSON.stringify(t)});if(!n.ok){const r=await n.json().catch(()=>({}));throw new Error(r.error||"Failed to submit status update")}return n.json()},onSuccess:()=>{e.invalidateQueries({queryKey:["/api/job-status-updates"]})}})}async function XPe(e){const t=localStorage.getItem(wK),n=await fetch("/api/storage/uploads/request-url",{method:"POST",headers:{"Content-Type":"application/json",...t?{Authorization:`Bearer ${t}`}:{}},body:JSON.stringify({name:e.name,size:e.size,contentType:e.type||"image/jpeg"})});if(!n.ok)throw new Error("Failed to get upload URL");return n.json()}async function QPe(e){const{uploadURL:t,objectPath:n}=await XPe(e);if(!(await fetch(t,{method:"PUT",body:e,headers:{"Content-Type":e.type||"image/jpeg"}})).ok)throw new Error("Failed to upload photo");return n}const ZPe=["Estimate Completed","Estimate Not Completed - No Access","Estimate Not Completed - Client No Show","Estimate Not Completed - Missed Appointment","Job Completed","Job Not Completed - Have To Go Back - Ran Out Of Time","Job Not Completed - Client Change Order Requested","Job Not Completed - Missing Material","Job Not Completed - Material Wrong","Job Not Completed - No Access","Job Not Completed - No Power","Job Not Completed - Roof Not Accessible","Job Not Completed - Weather","Job Not Completed - Did Not Go To Job Site"];function JPe(){const{teamMember:e}=Nn(),[,t]=fr(),n=YPe(),[r,s]=v.useState(!1),[i,l]=v.useState([]),[u,d]=v.useState(!0);v.useEffect(()=>{const R=localStorage.getItem("fs_team_token");fetch("/api/team",{headers:{Authorization:`Bearer ${R}`}}).then(H=>H.json()).then(H=>{l(H.filter(L=>L.active).map(L=>L.name))}).catch(()=>l([])).finally(()=>d(!1))},[]);const h=new Date().toISOString().slice(0,16),[p,x]=v.useState({streetAddress:"",city:"",technician:e?.name||"",jobStatus:"",arriveAt:h,departAt:"",notes:""}),[y,w]=v.useState(Array.from({length:10},()=>({file:null,preview:null,uploading:!1,objectPath:null,error:null}))),[j,b]=v.useState({}),C=v.useRef([]),N=(R,H)=>{x(L=>({...L,[R]:H})),b(L=>({...L,[R]:""}))},k=async(R,H)=>{const L=URL.createObjectURL(H);w(I=>{const W=[...I];return W[R]={file:H,preview:L,uploading:!0,objectPath:null,error:null},W});try{const I=await QPe(H);w(W=>{const U=[...W];return U[R]={...U[R],uploading:!1,objectPath:I},U})}catch{w(W=>{const U=[...W];return U[R]={...U[R],uploading:!1,error:"Upload failed"},U})}},T=R=>{y[R].preview&&URL.revokeObjectURL(y[R].preview),w(H=>{const L=[...H];return L[R]={file:null,preview:null,uploading:!1,objectPath:null,error:null},L}),C.current[R]&&(C.current[R].value="")},A=()=>{const R={};return p.streetAddress.trim()||(R.streetAddress="Street address is required"),p.city.trim()||(R.city="City is required"),p.technician||(R.technician="Select your name"),p.jobStatus||(R.jobStatus="Select a job status"),p.arriveAt||(R.arriveAt="Arrive time is required"),p.departAt||(R.departAt="Depart time is required"),R},P=async R=>{R.preventDefault();const H=A();if(Object.keys(H).length){b(H);return}if(y.some(W=>W.uploading))return;const I=y.filter(W=>W.objectPath).map(W=>W.objectPath);n.mutate({jobId:null,streetAddress:p.streetAddress,city:p.city,technician:p.technician,jobStatus:p.jobStatus,photoUrls:I,arriveAt:new Date(p.arriveAt).toISOString(),departAt:(()=>{const W=new Date(p.arriveAt),[U,V]=p.departAt.split(":");return W.setHours(parseInt(U),parseInt(V),0,0),W.toISOString()})(),notes:p.notes,submittedById:e?.id||null},{onSuccess:()=>s(!0)})};if(r)return a.jsxs("div",{className:"min-h-[60vh] flex flex-col items-center justify-center text-center px-4",children:[a.jsx("div",{className:"w-20 h-20 rounded-full bg-green-100 flex items-center justify-center mb-6",children:a.jsx(Cg,{className:"w-10 h-10 text-green-600"})}),a.jsx("h2",{className:"text-2xl font-display font-bold text-foreground mb-2",children:"Status Submitted!"}),a.jsx("p",{className:"text-muted-foreground mb-8",children:"Your daily job status has been recorded."}),a.jsxs("div",{className:"flex gap-3",children:[a.jsx(ne,{variant:"outline",onClick:()=>
188{s(!1),x({streetAddress:"",city:"",technician:e?.name||"",jobStatus:"",arriveAt:new Date().toISOString().slice(0,16),departAt:"",notes:""}),w(Array.from({length:10},()=>({file:null,preview:null,uploading:!1,objectPath:null,error:null})))},children:"Submit Another"}),a.jsx(ne,{onClick:()=>t("/jobs"),children:"View Jobs"})]})]});const E=R=>`w-full p-3 border rounded-xl text-sm focus:ring-2 focus:ring-primary outline-none transition ${j[R]?"border-destructive bg-destructive/5":"border-border focus:border-primary"}`,_=y.some(R=>R.uploading);return a.jsxs("div",{className:"max-w-2xl mx-auto pb-24",children:[a.jsxs("div",{className:"mb-8",children:[a.jsx("h1",{className:"text-3xl font-display font-bold text-foreground",children:"Daily Job Status"}),a.jsx("p",{className:"text-muted-foreground mt-1",children:"Submit your end-of-day field report"})]}),a.jsxs("form",{onSubmit:P,className:"space-y-6",children:[a.jsxs(ye,{className:"p-6 border-border/50 space-y-4",children:[a.jsx("h3",{className:"font-bold text-lg border-b pb-2 text-primary",children:"Job Location"}),a.jsxs("div",{children:[a.jsxs("label",{className:"text-sm font-semibold text-muted-foreground block mb-1",children:["Street Address ",a.jsx("span",{className:"text-destructive",children:"*"})]}),a.jsx("input",{type:"text",className:E("streetAddress"),placeholder:"123 Main St",value:p.streetAddress,onChange:R=>N("streetAddress",R.target.value)}),j.streetAddress&&a.jsx("p",{className:"text-xs text-destructive mt-1",children:j.streetAddress})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"text-sm font-semibold text-muted-foreground block mb-1",children:["City ",a.jsx("span",{className:"text-destructive",children:"*"})]}),a.jsx("input",{type:"text",className:E("city"),placeholder:"San Luis Obispo",value:p.city,onChange:R=>N("city",R.target.value)}),j.city&&a.jsx("p",{className:"text-xs text-destructive mt-1",children:j.city})]})]}),a.jsxs(ye,{className:"p-6 border-border/50 space-y-4",children:[a.jsx("h3",{className:"font-bold text-lg border-b pb-2 text-primary",children:"Technician"}),a.jsxs("div",{children:[a.jsxs("label",{className:"text-sm font-semibold text-muted-foreground block mb-2",children:["Select Your Name ",a.jsx("span",{className:"text-destructive",children:"*"})]}),u?a.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground py-3",children:[a.jsx(Me,{className:"w-4 h-4 animate-spin"})," Loading team members…"]}):a.jsx("div",{className:"grid grid-cols-3 gap-2",children:i.map(R=>a.jsx("button",{type:"button",onClick:()=>N("technician",R),className:`py-2.5 px-3 text-sm font-semibold rounded-xl border-2 transition-all ${p.technician===R?"border-primary bg-primary text-primary-foreground shadow-md":"border-border hover:border-primary/50 hover:bg-secondary"}`,children:R},R))}),j.technician&&a.jsx("p",{className:"text-xs text-destructive mt-1",children:j.technician})]})]}),a.jsxs(ye,{className:"p-6 border-border/50 space-y-4",children:[a.jsx("h3",{className:"font-bold text-lg border-b pb-2 text-primary",children:"Job Status"}),a.jsxs("div",{children:[a.jsxs("label",{className:"text-sm font-semibold text-muted-foreground block mb-2",children:["Select Status ",a.jsx("span",{className:"text-destructive",children:"*"})]}),a.jsx("div",{className:"space-y-2",children:ZPe.map(R=>a.jsxs("label",{className:`flex items-center gap-3 p-3 rounded-xl border-2 cursor-pointer transition-all ${p.jobStatus===R?"border-primary bg-primary/5":"border-border hover:border-primary/30 hover:bg-secondary/50"}`,children:[a.jsx("input",{type:"radio",name:"jobStatus",value:R,checked:p.jobStatus===R,onChange:()=>N("jobStatus",R),className:"w-4 h-4 text-primary accent-primary"}),a.jsx("span",{className:`text-sm font-medium ${p.jobStatus===R?"text-primary":"text-foreground"}`,children:R})]},R))}),j.jobStatus&&a.jsx("p",{className:"text-xs text-destructive mt-1",children:j.jobStatus})]})]}),a.jsxs(ye,{className:"p-6 border-border/50 space-y-4",children:[a.jsx("h3",{className:"font-bold text-lg border-b pb-2 text-primary",children:"Job Photos"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Upload up to 10 photos from the job site."}),a.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-3",children:y.map((R,H)=>a.jsx("div",{className:"relative aspect-square",children:R.preview?a.jsxs("div",{className:"w-full h-full rounded-xl overflow-hidden border-2 border-primary/30 relative",children:[a.jsx("img",{src:R.preview,alt:`Photo ${H+1}`,className:"w-full h-full object-cover"}),R.uploading&&a.jsx("div",{className:"absolute inset-0 bg-black/50 flex items-center justify-center",children:a.jsx(Me,{className:"w-6 h-6 text-white animate-spin"})}),R.error&&a.jsx("div",{className:"absolute inset-0 bg-red-900/60 flex items-center justify-center",children:a.jsx("p",{className:"text-white text-xs text-center px-2",children:R.error})}),!R.uploading&&a.jsx("button",{type:"button",onClick:()=>T(H),className:"absolute top-1 right-1 w-6 h-6 rounded-full bg-black/60 text-white flex items-center justify-center hover:bg-black",children:a.jsx(an,{className:"w-3 h-3"})})]}):a.jsxs("label",{className:"w-full h-full flex flex-col items-center justify-center rounded-xl border-2 border-dashed border-border hover:border-primary/60 hover:bg-secondary/50 cursor-pointer transition-all bg-secondary/20",children:[a.jsx(lJ,{className:"w-6 h-6 text-muted-foreground mb-1"}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:["Photo ",H+1]}),a.jsx("input",{ref:L=>{C.current[H]=L},type:"file",accept:"image/*",capture:"environment",className:"hidden",onChange:L=>{const I=L.target.files?.[0];I&&k(H,I)}})]})},H))})]}),a.jsxs(ye,{className:"p-6 border-border/50 space-y-4",children:[a.jsx("h3",{className:"font-bold text-lg border-b pb-2 text-primary",children:"Time Tracking"}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsxs("label",{className:"text-sm font-semibold text-muted-foreground block mb-1",children:["Arrive Date & Time ",a.jsx("span",{className:"text-destructive",children:"*"})]}),a.jsx("input",{type:"datetime-local",className:E("arriveAt"),value:p.arriveAt,onChange:R=>N("arriveAt",R.target.value)}),j.arriveAt&&a.jsx("p",{className:"text-xs text-destructive mt-1",children:j.arriveAt})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"text-sm font-semibold text-muted-foreground block mb-1",children:["Depart Time ",a.jsx("span",{className:"text-destructive",children:"*"})]}),a.jsx("input",{type:"time",className:E("departAt"),value:p.departAt,onCh
188ange:R=>N("departAt",R.target.value)}),j.departAt&&a.jsx("p",{className:"text-xs text-destructive mt-1",children:j.departAt})]})]})]}),a.jsxs(ye,{className:"p-6 border-border/50 space-y-4",children:[a.jsx("h3",{className:"font-bold text-lg border-b pb-2 text-primary",children:"Additional Notes"}),a.jsx("textarea",{className:"w-full p-3 border border-border rounded-xl text-sm focus:ring-2 focus:ring-primary outline-none resize-none",rows:3,placeholder:"Any additional notes about today's work...",value:p.notes,onChange:R=>x(H=>({...H,notes:R.target.value}))})]}),a.jsx(ne,{type:"submit",size:"lg",className:"w-full rounded-xl text-base font-bold h-14 shadow-lg shadow-primary/25",disabled:n.isPending||_,children:n.isPending?a.jsxs(a.Fragment,{children:[a.jsx(Me,{className:"w-5 h-5 mr-2 animate-spin"})," Submitting..."]}):_?a.jsxs(a.Fragment,{children:[a.jsx(Me,{className:"w-5 h-5 mr-2 animate-spin"})," Uploading Photos..."]}):a.jsxs(a.Fragment,{children:[a.jsx(Tg,{className:"w-5 h-5 mr-2"})," Submit Daily Status"]})}),n.isError&&a.jsx("p",{className:"text-center text-sm text-destructive",children:"Failed to submit. Please try again."})]})]})}const Ja=(e,t)=>{const n=localStorage.getItem("fs_team_token");return fetch(e,{...t,headers:{Authorization:`Bearer ${n}`,"Content-Type":"application/json",...t?.headers||{}}}).then(r=>r.json())},eEe={homeowner:"Homeowner",contractor:"Contractor",property_mgmt:"HOA / Property Mgmt"},tEe={homeowner:"bg-blue-100 text-blue-700",contractor:"bg-amber-100 text-amber-700",property_mgmt:"bg-purple-100 text-purple-700"},Xf={scheduled:"bg-blue-100 text-blue-700",in_progress:"bg-amber-100 text-amber-700",completed:"bg-green-100 text-green-700",on_hold:"bg-gray-100 text-gray-600",cancelled:"bg-red-100 text-red-700",draft:"bg-gray-100 text-gray-600",sent:"bg-blue-100 text-blue-700",approved:"bg-green-100 text-green-700",rejected:"bg-red-100 text-red-700"},nEe=["Overview","Quotes","Jobs","Service Reports","Emails","SharePoint"];function rEe({client:e,open:t,onClose:n,onSaved:r}){const[s,i]=v.useState({name:e.name||"",email:e.email||"",phone:e.phone||"",address:e.address||"",city:e.city||"",state:e.state||"",zip:e.zip||"",type:e.type||"homeowner",companyName:e.companyName||"",notes:e.notes||"",clientSince:e.clientSince?Tt(new Date(e.clientSince),"yyyy-MM-dd"):e.createdAt?Tt(new Date(e.createdAt),"yyyy-MM-dd"):""}),[l,u]=v.useState(!1),[d,f]=v.useState(null),h=(w,j)=>i(b=>({...b,[w]:j})),p=async()=>{if(!s.name.trim()){f("Name is required.");return}u(!0),f(null);try{const w=localStorage.getItem("fs_team_token"),j=await fetch(`/api/clients/${e.id}`,{method:"PATCH",headers:{Authorization:`Bearer ${w}`,"Content-Type":"application/json"},body:JSON.stringify({...s,clientSince:s.clientSince?new Date(s.clientSince).toISOString():null})}),b=await j.json();if(!j.ok)throw new Error(b.error||"Save failed");r(),n()}catch(w){f(w.message||"Could not save changes.")}finally{u(!1)}},x="w-full px-3 py-2 text-sm border border-border rounded-lg bg-background outline-none focus:border-primary transition-colors",y="block text-xs font-semibold text-foreground mb-1";return a.jsx(xh,{open:t,onOpenChange:w=>{w||n()},children:a.jsxs(ud,{className:"max-w-xl max-h-[90vh] overflow-y-auto",children:[a.jsx(gh,{children:a.jsx(dd,{children:"Edit Client"})}),a.jsxs("div",{className:"space-y-4 py-2",children:[d&&a.jsx("div",{className:"text-sm text-red-600 bg-red-50 border border-red-200 rounded-lg px-3 py-2",children:d}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[a.jsxs("div",{className:"sm:col-span-2",children:[a.jsx("label",{className:y,children:"Full Name *"}),a.jsx("input",{className:x,value:s.name,onChange:w=>h("name",w.target.value),placeholder:"Jane Smith"})]}),a.jsxs("div",{children:[a.jsx("label",{className:y,children:"Email"}),a.jsx("input",{className:x,type:"email",value:s.email,onChange:w=>h("email",w.target.value),placeholder:"[email protected]"})]}),a.jsxs("div",{children:[a.jsx("label",{className:y,children:"Phone"}),a.jsx("input",{className:x,value:s.phone,onChange:w=>h("phone",w.target.value),placeholder:"(805) 555-1234"})]}),a.jsxs("div",{children:[a.jsx("label",{className:y,children:"Client Type"}),a.jsxs("div",{className:"relative",children:[a.jsxs("select",{className:`${x}
188 appearance-none pr-8`,value:s.type,onChange:w=>h("type",w.target.value),children:[a.jsx("option",{value:"homeowner",children:"Homeowner"}),a.jsx("option",{value:"contractor",children:"Contractor"}),a.jsx("option",{value:"property_mgmt",children:"HOA / Property Mgmt"})]}),a.jsx(Nr,{className:"absolute right-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-muted-foreground pointer-events-none"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:y,children:"Company Name"}),a.jsx("input",{className:x,value:s.companyName,onChange:w=>h("companyName",w.target.value),placeholder:"Acme Corp (optional)"})]}),a.jsxs("div",{className:"sm:col-span-2",children:[a.jsx("label",{className:y,children:"Street Address"}),a.jsx("input",{className:x,value:s.address,onChange:w=>h("address",w.target.value),placeholder:"123 Oak Street"})]}),a.jsxs("div",{children:[a.jsx("label",{className:y,children:"City"}),a.jsx("input",{className:x,value:s.city,onChange:w=>h("city",w.target.value),placeholder:"Arroyo Grande"})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx("label",{className:y,children:"State"}),a.jsx("input",{className:x,value:s.state,onChange:w=>h("state",w.target.value),placeholder:"CA",maxLength:2})]}),a.jsxs("div",{children:[a.jsx("label",{className:y,children:"Zip"}),a.jsx("input",{className:x,value:s.zip,onChange:w=>h("zip",w.target.value),placeholder:"93420"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:y,children:"Client Since"}),a.jsx("input",{className:x,type:"date",value:s.clientSince,onChange:w=>h("clientSince",w.target.value)}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"When they first became a customer (not the system entry date)."})]}),a.jsxs("div",{className:"sm:col-span-2",children:[a.jsx("label",{className:y,children:"Notes"}),a.jsx("textarea",{className:`${x} resize-none`,rows:3,value:s.notes,onChange:w=>h("notes",w.target.value),placeholder:"Internal notes about this client…"})]})]})]}),a.jsxs(OO,{children:[a.jsx(ne,{variant:"outline",onClick:n,disabled:l,children:"Cancel"}),a.jsxs(ne,{onClick:p,disabled:l,children:[l&&a.jsx(Me,{className:"w-3.5 h-3.5 mr-1.5 animate-spin"}),"Save Changes"]})]})]})})}function aEe({client:e,onSent:t}){const n=wt(),[r,s]=v.useState(!1),[i,l]=v.useState(null),[u,d]=v.useState(null),[f,h]=v.useState(!1),p=Xe({queryKey:["client-emails",e.id],queryFn:()=>Ja(`/api/clients/${e.id}/emails`),staleTime:6e4}),x=async N=>{if(i===N.id){l(null),d(null);return}l(N.id),d(null),h(!0);try{const k=await Ja(`/api/clients/${e.id}/emails/${encodeURIComponent(N.id)}`);k.ok&&d(k.message)}finally{h(!1)}},{ok:y,noToken:w,messages:j=[],logged:b=[]}=p.data||{},C=N=>{try{return Tt(new Date(N),"MMM d, yyyy h:mm a")}catch{return N}};return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(iee,{className:"w-4 h-4 text-muted-foreground"}),a.jsxs("span",{className:"text-sm font-semibold text-foreground",children:["Email Thread with ",e.name]}),j.length>0&&a.jsx("span",{className:"bg-primary/10 text-primary text-xs px-2 py-0.5 rounded-full font-bold",children:j.length})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(ne,{variant:"outline",size:"sm",className:"rounded-lg",onClick:()=>n.invalidateQueries({queryKey:["client-emails",e.id]}),disabled:p.isFetching,children:[a.jsx(qo,{className:`w-3.5 h-3.5 mr-1.5 ${p.isFetching?"animate-spin":""}`}),"Refresh"]}),a.jsxs(ne,{size:"sm",className:"rounded-lg",onClick:()=>s(!0),children:[a.jsx(Er,{className:"w-3.5 h-3.5 mr-1.5"}),"Compose"]})]})]}),w&&a.jsx(ye,{className:"p-5 border-amber-200 bg-amber-50/50",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(Kt,{className:"w-5 h-5 text-amber-600 flex-shrink-0 mt-0.5"}),a.jsxs("div",{children:[a.jsx("p",{className:"font-semibold text-amber-800 text-sm",children:"Microsoft account not connected"}),a.jsx("p",{className:"text-xs text-amber-700 mt-1",children:"Connect your Microsoft 365 account on the Team page to view email history from your Outlook mailbox and send emails as yourself."})]})]})}),p.isLoading&&a.jsxs("div",{className:"py-12 text-center text-muted-foreground",children:[a.jsx(Me,{className:"w-8 h-8 animate-spin mx-auto mb-3 text-primary"}),a.jsx("p",{children:"Loading emails from Outlook…"})]}),!p.isLoading&&y&&j.length===0&&a.jsxs("div",{className:"py-12 text-center text-muted-foreground",children:[a.jsx($r,{className:"w-12 h-12 mx-auto mb-3 opacity-20"}),a.jsx("p",{className:"font-medium mb-1",children:"No emails found"}),a.jsxs("p",{className:"text-sm",children:["No Outlook messages involving ",a.jsx("span",{className:"font-medium",children:e.email})," were found in your mailbox."]})]}),!p.isLoading&&y&&j.length>0&&a.jsx("div",{className:"space-y-2",children:j.map(N=>{const k=i===N.id,T=N.sentDateTime||N.receivedDateTime,A=N.from?.emailAddress?.name||N.from?.emailAddress?.address||"",P=N.from?.emailAddress?.address||"",E=(N.toRecipients||[]).map(R=>R.emailAddress.address).join(", "),_=P.toLowerCase().includes("5star")||P.toLowerCase().includes("5stargrp");return a.jsxs(ye,{className:`border-border/60 shadow-sm overflow-hidden transition-all ${N.isRead===!1?"border-l-4 border-l-primary":""}`,children:[a.jsxs("button",{className:"w-full px-4 py-3 flex items-start gap-3 hover:bg-secondary/30 transition-colors text-left",onClick:()=>x(N),children:[a.jsx("div",{className:`w-8 h-8 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5 ${_?"bg-primary/10 text-primary":"bg-gray-100 text-gray-600"}`,children:_?a.jsx(Er,{className:"w-3.5 h-3.5"}):a.jsx($r,{className:"w-3.5 h-3.5"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2 mb-0.5",children:[a.jsx("p",{className:`text-sm truncate ${N.isRead===!1?"font-bold text-foreground":"font-medium text-foreground"}`,children:N.subject||"(no subject)"}),a.jsx("span",{className:"text-xs text-muted-foreground whitespace-nowrap flex-shrink-0",children:T?C(T):""})]}),a.jsxs("p",{className:"text-xs text-muted-foreground truncate",children:[a.jsx("span",{className:"font-medium",children:A||P}),E&&a.jsxs("span",{children:[" → ",E]})]}),!k&&a.jsx("p",{className:"text-xs text-muted-foreground mt-1 truncate",children:N.bodyPreview})]}),k?a.jsx(Sh,{className:"w-4 h-4 text-muted-foreground flex-shrink-0 mt-1"}):a.jsx(Nr,{className:"w-4 h-4 text-muted-foreground flex-shrink-0 mt-1"})]}),k&&a.jsx("div",{className:"px-4 pb-4 border-t border-border/40 bg-secondary/10",children:f?a.jsxs("div",{className:"py-4 text-center text-muted-foreground text-sm flex items-center justify-center gap-2",children:[a.jsx(Me,{className:"w-4 h-4 animate-spin"})," Loading…"]}):u&&u.id===N.id?a.jsxs("div",{className:"pt-3",children:[a.jsxs("div",{className:"text-xs text-muted-foreground mb-3 space-y-0.5",children:[a.jsxs("div",{children:[a.jsx("span",{className:"font-semibold",children:"From:"})," ",u.from?.emailAddress?.name," <",u.from?.emailAddress?.address,">"]}),a.jsxs("div",{children:[a.jsx("span",{className:"font-semibold",children:"To:"})," ",(u.toRecipients||[]).map(R=>`${R.emailAddress.name} <${R.emailAddress.address}>
188`).join(", ")]}),a.jsxs("div",{children:[a.jsx("span",{className:"font-semibold",children:"Date:"})," ",C(u.sentDateTime||u.receivedDateTime)]})]}),u.body?.contentType==="html"?a.jsx("iframe",{srcDoc:u.body.content,sandbox:"allow-same-origin",className:"w-full rounded-lg border border-border/40 bg-white",style:{minHeight:"200px",maxHeight:"400px"},title:`Email: ${u.subject}`}):a.jsx("pre",{className:"text-sm whitespace-pre-wrap text-foreground bg-white rounded-lg border border-border/40 p-4 overflow-auto max-h-96",children:u.body?.content||N.bodyPreview})]}):a.jsx("div",{className:"pt-3 text-sm text-foreground whitespace-pre-wrap",children:N.bodyPreview})})]},N.id)})}),!p.isLoading&&b.length>0&&a.jsxs("div",{className:"mt-2",children:[a.jsxs("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-2 flex items-center gap-1.5",children:[a.jsx(Er,{className:"w-3 h-3"}),"Sent via App (",b.length,")"]}),a.jsx("div",{className:"space-y-1.5",children:b.map(N=>a.jsxs("div",{className:"flex items-start gap-3 px-3 py-2 bg-secondary/20 rounded-lg border border-border/40 text-xs",children:[a.jsx("div",{className:"w-6 h-6 rounded-full bg-primary/10 text-primary flex items-center justify-center flex-shrink-0 mt-0.5",children:a.jsx(Er,{className:"w-3 h-3"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"font-medium text-foreground truncate",children:N.subject||"(no subject)"}),a.jsxs("p",{className:"text-muted-foreground",children:["To: ",N.sentTo,N.sentAt&&a.jsxs(a.Fragment,{children:[" · ",C(N.sentAt)]})]}),N.bodyPreview&&a.jsx("p",{className:"text-muted-foreground mt-0.5 truncate",children:N.bodyPreview})]})]},N.id))})]}),r&&a.jsx(iEe,{client:e,onClose:()=>s(!1),onSent:()=>{s(!1),n.invalidateQueries({queryKey:["client-emails",e.id]}),t?.()}})]})}function Kx(e,t,n){const r=[n,e.name];return e.name!==t.name&&r.push(t.name),r.push(e.phone,e.email),r}const sEe=[{id:"follow-up",label:"Follow-up",build:({clientName:e,company:t,contact:n})=>({subject:"Following up on your gutter project",body:[`Hi ${e},`,"","I wanted to follow up on the gutter work we discussed. We'd be glad to answer any questions and help you decide on the best option for your home.","",`Just reply to this email or give me a call at ${n.phone} whenever you're ready.`,"",...Kx(n,t,"Best regards,")].join(`
189`)})},{id:"appointment",label:"Appointment Reminder",build:({clientName:e,company:t,contact:n})=>({subject:"Reminder: your upcoming gutter appointment",body:[`Hi ${e},`,"","This is a friendly reminder about your upcoming appointment with our team. Please make sure the work areas around your home are accessible so we can get started on time.","",`If you need to reschedule or have any questions, reply here or call ${n.name} at ${n.phone}.`,"",...Kx(n,t,"Thank you,")].join(`
190`)})},{id:"thank-you",label:"Thank You",build:({clientName:e,company:t,contact:n})=>({subject:`Thank you from ${t.name}`,body:[`Hi ${e},`,"",`Thank you for choosing ${t.name}. It was a pleasure working with you, and we're confident you'll enjoy your new gutters for years to come.`,"",`If anything comes up or you'd like to refer a friend, I'm always just a phone call away at ${n.phone}.`,"",...Kx(n,t,"Warm regards,")].join(`
191`)})},{id:"invoice",label:"Invoice / Payment",build:({clientName:e,company:t,contact:n})=>({subject:"Invoice for your gutter project",body:[`Hi ${e},`,"","Please find your invoice for the recently completed gutter work attached. We appreciate your business and prompt payment.","",`If you have any questions about the invoice, reply here or call ${n.name} at ${n.phone}.`,"",...Kx(n,t,"Thank you,")].join(`
192`)})}];function iEe({client:e,onClose:t,onSent:n,prefillSubject:r,prefillBody:s}){const{profile:i}=uk(),{teamMember:l}=Nn(),u={name:l?.name?.trim()||i.name,phone:l?.phone?.trim()||i.phone,email:l?.email?.trim()||i.email,assigned:!!l?.name?.trim()},[d,f]=v.useState(r||""),[h,p]=v.useState(s||""),[x,y]=v.useState([]),[w,j]=v.useState(!1),[b,C]=v.useState(null),[N,k]=v.useState(!1),T=v.useRef(null),A=async _=>{const R=Array.from(_.target.files||[]),H=await Promise.all(R.map(L=>new Promise((I,W)=>{const U=new FileReader;U.onload=()=>{const V=U.result.split(",")[1];I({name:L.name,contentType:L.type||"application/octet-stream",contentBytes:V})},U.onerror=W,U.readAsDataURL(L)})));y(L=>[...L,...H]),_.target.value=""},P=_=>y(R=>R.filter((H,L)=>L!==_)),E=async()=>
192{if(!d.trim()){C("Subject is required.");return}if(!h.trim()){C("Message body is required.");return}j(!0),C(null);try{const _=`<p>${h.replace(/\n\n/g,"</p><p>").replace(/\n/g,"<br/>")}</p>`,R=await Ja(`/api/clients/${e.id}/send-email`,{method:"POST",body:JSON.stringify({subject:d.trim(),html:_,text:h,attachments:x.length>0?x:void 0})});if(!R.ok)throw new Error(R.error||"Send failed");k(!0),setTimeout(()=>n?.(),1e3)}catch(_){C(_.message||"Could not send email.")}finally{j(!1)}};return a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",children:a.jsxs("div",{className:"bg-white rounded-2xl shadow-2xl w-full max-w-2xl flex flex-col max-h-[90vh]",children:[a.jsxs("div",{className:"flex items-center gap-3 px-6 py-4 border-b border-border",children:[a.jsx("div",{className:"w-10 h-10 rounded-xl bg-primary/10 flex items-center justify-center",children:a.jsx(Er,{className:"w-5 h-5 text-primary"})}),a.jsxs("div",{className:"flex-1",children:[a.jsx("h2",{className:"text-lg font-bold text-foreground",children:"New Email"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Sent from your Outlook, visible in your Sent Items"})]}),a.jsx("button",{onClick:t,className:"text-muted-foreground hover:text-foreground text-xl font-bold px-2",children:"×"})]}),a.jsx("div",{className:"flex-1 overflow-y-auto px-6 py-4 space-y-4",children:N?a.jsxs("div",{className:"py-12 text-center",children:[a.jsx(st,{className:"w-16 h-16 text-green-500 mx-auto mb-4"}),a.jsx("p",{className:"text-xl font-bold text-foreground mb-1",children:"Email sent!"}),a.jsxs("p",{className:"text-muted-foreground text-sm",children:["Delivered to ",e.email," and saved to your Outlook Sent Items."]})]}):a.jsxs(a.Fragment,{children:[b&&a.jsxs("div",{className:"p-3 bg-red-50 border border-red-200 rounded-xl text-red-700 text-sm flex gap-2",children:[a.jsx(Kt,{className:"w-4 h-4 mt-0.5 flex-shrink-0"}),a.jsx("span",{children:b})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-semibold text-muted-foreground mb-1",children:"To"}),a.jsxs("div",{className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-secondary/30 text-foreground",children:[e.name," <",e.email,">"]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-semibold text-muted-foreground mb-1",children:"Starter Templates"}),a.jsx("div",{className:"flex flex-wrap gap-2",children:sEe.map(_=>a.jsx("button",{type:"button",onClick:()=>{const{subject:R,body:H}=_.build({clientName:e.name||"there",company:i,contact:u});f(R),p(H)},className:"px-3 py-1.5 text-xs font-medium border border-border rounded-lg bg-secondary/40 text-foreground hover:bg-secondary hover:border-primary/40 transition-colors",children:_.label},_.id))})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-semibold text-muted-foreground mb-1",children:"Subject"}),a.jsx("input",{type:"text",value:d,onChange:_=>f(_.target.value),placeholder:"Subject…",className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background outline-none focus:border-primary transition-colors"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-semibold text-muted-foreground mb-1",children:"Message"}),a.jsx("textarea",{value:h,onChange:_=>p(_.target.value),placeholder:"Type your message here…",rows:9,className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background outline-none focus:border-primary transition-colors resize-none"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-semibold text-muted-foreground mb-1",children:"Attachments"}),x.length>0&&a.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:x.map((_,R)=>a.jsxs("div",{className:"flex items-center gap-1.5 bg-secondary/50 border border-border rounded-lg px-2.5 py-1.5 text-xs text-foreground",children:[a.jsx("span",{className:"max-w-[160px] truncate",children:_.name}),a.jsx("button",{onClick:()=>P(R),className:"text-muted-foreground hover:text-red-500 transition-colors","aria-label":"Remove attachment",children:"×"})]},R))}
192),a.jsx("input",{type:"file",multiple:!0,ref:T,onChange:A,className:"hidden","aria-label":"Attach files"}),a.jsx(ne,{variant:"outline",size:"sm",className:"rounded-lg text-xs",onClick:()=>T.current?.click(),children:"Attach Files"})]})]})}),!N&&a.jsxs("div",{className:"px-6 py-4 border-t border-border flex justify-end gap-3",children:[a.jsx(ne,{variant:"outline",className:"rounded-xl",onClick:t,disabled:w,children:"Cancel"}),a.jsx(ne,{className:"rounded-xl px-8",onClick:E,disabled:w,children:w?a.jsxs(a.Fragment,{children:[a.jsx(Me,{className:"w-4 h-4 animate-spin mr-2"}),"Sending…"]}):a.jsxs(a.Fragment,{children:[a.jsx(Er,{className:"w-4 h-4 mr-2"}),"Send Email"]})})]})]})})}function oEe({client:e,onRefresh:t}){const[n,r]=v.useState(e.onedriveFolderUrl||""),[s,i]=v.useState(!1),[l,u]=v.useState(null),[d,f]=v.useState(null),[h,p]=v.useState(null),[x,y]=v.useState(null),[w,j]=v.useState(null),[b,C]=v.useState([]),[N,k]=v.useState(""),[T,A]=v.useState(""),[P,E]=v.useState(!1),_=!!e.onedriveFolderUrl;ie.useEffect(()=>{E(!0),Ja("/api/sharepoint/estimator-groups").then(D=>
192{if(D.ok){const q=D.groups||[];if(C(q),q.length===1)k(q[0].id),A(q[0].name);else if(e.estimatorGroup){const K=q.find(Y=>Y.name.trim().toLowerCase()===e.estimatorGroup.trim().toLowerCase());K&&(k(K.id),A(K.name))}}}).catch(()=>{}).finally(()=>E(!1))},[]);const R=Xe({queryKey:["sp-folder-contents",e.id,e.onedriveFolderUrl],queryFn:()=>Ja(`/api/sharepoint/folder-contents/${e.id}`),enabled:_,staleTime:6e4}),H=nt({mutationFn:()=>Ja(`/api/sharepoint/search/${e.id}`,{method:"POST"}),onSuccess:D=>{D.error?(p(D.error),f(null)):(f(D.folders||[]),p(null))},onError:()=>p("Search failed. Make sure you are signed in with Microsoft.")}),L=nt({mutationFn:()=>Ja(`/api/sharepoint/create-folder/${e.id}`,{method:"POST",body:JSON.stringify({estimatorGroupId:N||void 0,estimatorGroupName:T||void 0})}),onSuccess:D=>{D.error?y({type:"err",text:D.error}):(y({type:"ok",text:D.message||"Folder created in SharePoint."}),t())},onError:()=>y({type:"err",text:"Folder creation failed. Make sure you are signed in with Microsoft."})}),I=nt({mutationFn:({url:D,force:q})=>Ja(`/api/sharepoint/folder-url/${e.id}`,{method:"PATCH",body:JSON.stringify({folderUrl:D,...q?{force:!0}:{}})}),onSuccess:(D,q)=>{if(D?.conflict){u({url:q.url,names:(D.conflictClients||[]).map(K=>K.name)});return}u(null),i(!1),t()}}),W=nt({mutationFn:()=>Ja(`/api/sharepoint/folder-url/${e.id}`,{method:"DELETE"}),onSuccess:()=>{r(""),t()}}),U=nt({mutationFn:()=>Ja(`/api/sharepoint/ensure-template/${e.id}`,{method:"POST"}),onSuccess:D=>{D.error?j({type:"err",text:D.error}):(j({type:"ok",text:D.message||"Template folders verified."}),R.refetch())},onError:()=>j({type:"err",text:"Could not verify template folders. Make sure you are signed in with Microsoft."})}),V=D=>{u(null),I.mutate({url:D}),f(null)};return a.jsxs("div",{className:"space-y-4",children:[l&&a.jsxs(ye,{className:"p-4 border-amber-300 bg-amber-50 shadow-sm",children:[a.jsx("p",{className:"text-sm font-semibold text-amber-900 mb-1",children:"⚠️ Folder already linked to another client"}),a.jsxs("p",{className:"text-xs text-amber-800 mb-3",children:["This folder is already linked to ",a.jsx("span",{className:"font-semibold",children:l.names.join(", ")}),". If you link it here too, both clients will share the same project folder and documents may get filed into the wrong client's folder."]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(ne,{size:"sm",variant:"outline",className:"rounded-lg",onClick:()=>u(null),children:"Cancel"}),a.jsxs(ne,{size:"sm",className:"rounded-lg bg-amber-600 hover:bg-amber-700 text-white",onClick:()=>I.mutate({url:l.url,force:!0}),disabled:I.isPending,children:[I.isPending&&a.jsx(Me,{className:"w-3.5 h-3.5 mr-1.5 animate-spin"}),"Link anyway"]})]})]}),_?a.jsx(ye,{className:"p-5 border-green-200 bg-green-50/50 shadow-sm",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"w-10 h-10 rounded-xl bg-green-100 flex items-center justify-center flex-shrink-0",children:a.jsx(yr,{className:"w-5 h-5 text-green-700"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"font-bold text-green-800 text-sm",children:"SharePoint Folder Linked"}),a.jsxs("a",{href:e.onedriveFolderUrl,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 text-blue-600 hover:text-blue-800 text-sm mt-1 underline underline-offset-2 break-all",children:[a.jsx(hm,{className:"w-3.5 h-3.5 flex-shrink-0"}),"Open in SharePoint"]})]}),a.jsx("button",{onClick:()=>W.mutate(),className:"text-muted-foreground hover:text-red-600 transition-colors flex-shrink-0",title:"Remove link",children:a.jsx(an,{className:"w-4 h-4"})})]})}):a.jsx(ye,{className:"p-5 border-amber-200 bg-amber-50/40 shadow-sm",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Kt,{className:"w-5 h-5 text-amber-600 flex-shrink-0"}),a.jsxs("div",{children:[a.jsx("p",{className:"font-semibold text-amber-800 text-sm",children:"No SharePoint folder linked yet"}),a.jsx("p",{className:"text-xs text-amber-700 mt-0.5",children:"Search for an existing folder or create a new one below."})]})]})}),_&&a.jsxs(ye,{className:"p-4 border-border/60 shadow-sm",children:[a.jsxs("div",{className:"flex items-start gap-3 mb-3",children:[a.jsx("div",{className:"w-9 h-9 rounded-lg bg-violet-100 flex items-center justify-center flex-shrink-0",children:a.jsx(r3,{className:"w-4 h-4 text-violet-700"})}),a.jsxs("div",{className:"flex-1",children:[a.jsx("p",{className:"font-semibold text-sm text-foreground",children:"Ensure Template Folders"}),a.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:["Verifies that all standard sub-folders exist in this client's SharePoint folder and creates any that are missing:",a.jsx("span",{className:"font-mono ml-1",children:"Estimates · Invoices · Emails · Images"})]})]})]}),w&&a.jsxs("p",{className:`text-xs mb-2 font-medium ${w.type==="err"?"text-amber-700":"text-green-700"}`,children:[w.type==="ok"?"✓":"⚠️"," ",w.text]}),a.jsx(ne,{size:"sm",variant:"outline",className:"w-full rounded-lg",onClick:()=>{j(null),U.mutate()},disabled:U.isPending,children:U.isPending?a.jsxs(a.Fragment,{children:[a.jsx(Me,{className:"w-3.5 h-3.5 mr-1.5 animate-spin"}),"Checking folders…"]}):a.jsxs(a.Fragment,{children:[a.jsx(r3,{className:"w-3.5 h-3.5 mr-1.5"}),"Ensure Template Folders"]})})]}),e.onedriveSearchTerms&&!d&&a.jsxs("div",{className:"text-xs text-muted-foreground bg-secondary/40 rounded-lg px-4 py-2.5 border border-border/40",children:[a.jsx("span",{className:"font-semibold",children:"Last searched:"})," ",e.onedriveSearchTerms]}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[a.jsxs(ye,{className:"p-4 border-border/60 shadow-sm",children:[a.jsxs("div",{className:"flex items-start gap-3 mb-3",children:[a.jsx("div",{className:"w-9 h-9 rounded-lg bg-blue-100 flex items-center justify-center flex-shrink-0",children:a.jsx(Da,{className:"w-4 h-4 text-blue-700"})}),a.jsxs("div",{children:[a.jsx("p",{className:"font-semibold text-sm text-foreground",children:"Search Existing Folders"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Searches SharePoint for folders matching this client's name and address."})]})]}),h&&a.jsxs("p",{className:"text-xs mb-2 font-medium text-amber-700",children:["⚠️ ",h]}),d!==null&&a.jsx("div",{className:"mb-3",children:d.length===0?a.jsx("p",{className:"text-xs text-muted-foreground bg-secondary/50 rounded px-3 py-2",children:"No matching folders found. Try creating a new one."}):a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("p",{className:"text-xs font-semibold text-foreground mb-1",children:[d.length," folder",d.length!==1?"s":""," found — 
192click to link:"]}),d.map((D,q)=>a.jsxs("button",{onClick:()=>V(D.webUrl),disabled:I.isPending,className:"w-full text-left text-xs flex items-center gap-2 px-3 py-2 rounded-lg bg-blue-50 hover:bg-blue-100 border border-blue-200 transition-colors",children:[a.jsx(yr,{className:"w-3.5 h-3.5 text-blue-600 flex-shrink-0"}),a.jsx("span",{className:"truncate font-medium text-blue-800",children:D.name})]},q)),a.jsx("button",{onClick:()=>f(null),className:"text-xs text-muted-foreground hover:underline mt-1 ml-1",children:"Clear results"})]})}),a.jsxs(ne,{size:"sm",variant:"outline",className:"w-full rounded-lg",onClick:()=>{f(null),p(null),H.mutate()},disabled:H.isPending,children:[H.isPending?a.jsx(Me,{className:"w-3.5 h-3.5 mr-1.5 animate-spin"}):a.jsx(Da,{className:"w-3.5 h-3.5 mr-1.5"}),"Search SharePoint"]})]}),a.jsxs(ye,{className:"p-4 border-border/60 shadow-sm",children:[a.jsxs("div",{className:"flex items-start gap-3 mb-3",children:[a.jsx("div",{className:"w-9 h-9 rounded-lg bg-green-100 flex items-center justify-center flex-shrink-0",children:a.jsx(a3,{className:"w-4 h-4 text-green-700"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"font-semibold text-sm text-foreground",children:"Create New Folder"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Creates a project folder with sub-folders (Estimates, Invoices, Emails, Images):"}),a.jsx("p",{className:"text-xs font-mono bg-secondary/60 rounded px-2 py-1 mt-1 break-all",children:[e.name,e.address,e.city,e.zip].filter(Boolean).join(" - ")})]})]}),a.jsxs("div",{className:"mb-3",children:[a.jsx("label",{className:"text-xs font-semibold text-foreground block mb-1",children:"Place under estimator folder:"}),P?a.jsx("div",{className:"h-9 bg-secondary/40 rounded-lg animate-pulse"}):b.length===0?a.jsx("p",{className:"text-xs text-amber-700 italic",children:"No estimator groups found — folders can't be created until the SharePoint Projects library is reachable."}):a.jsxs("div",{className:"relative",children:[a.jsxs("select",{value:N,onChange:D=>{k(D.target.value);const q=b.find(K=>K.id===D.target.value);A(q?.name||"")},className:"w-full appearance-none px-3 py-2 text-sm border border-border rounded-lg bg-background outline-none focus:border-primary pr-8",children:[a.jsx("option",{value:"",children:"— Select estimator —"}),b.map(D=>a.jsx("option",{value:D.id,children:D.name},D.id))]}),a.jsx(Nr,{className:"absolute right-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-muted-foreground pointer-events-none"})]})]}),x&&a.jsxs("p",{className:`text-xs mb-2 font-medium ${x.type==="err"?"text-amber-700":"text-green-700"}`,children:[x.type==="ok"?"✓":"⚠️"," ",x.text]}),a.jsxs(ne,{size:"sm",className:"w-full rounded-lg",onClick:()=>{y(null),L.mutate()},disabled:L.isPending||!N,children:[L.isPending?a.jsx(Me,{className:"w-3.5 h-3.5 mr-1.5 animate-spin"}):a.jsx(a3,{className:"w-3.5 h-3.5 mr-1.5"}),L.isPending?"Creating in SharePoint…":"Create Folder in SharePoint"]}),!N&&!P&&a.jsx("p",{className:"text-[11px] text-muted-foreground mt-1.5",children:"Select an estimator folder above to enable creation."})]})]}),a.jsxs(ye,{className:"p-4 border-border/60 shadow-sm",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(dT,{className:"w-4 h-4 text-muted-foreground"}),a.jsx("p",{className:"text-sm font-semibold text-foreground",children:"Paste Folder Link Manually"})]}),!s&&a.jsxs("button",{onClick:()=>{i(!0),r(e.onedriveFolderUrl||"")},className:"text-xs text-primary hover:underline flex items-center gap-1",children:[a.jsx(gd,{className:"w-3 h-3"})," ",_?"Change":"Paste link"]})]}),s?a.jsxs("div",{className:"space-y-2",children:[a.jsx("input",{type:"url",className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background outline-none focus:border-primary",placeholder:"https://fivestarrainguttersinc.sharepoint.com/...",value:n,onChange:D=>r(D.target.value),autoFocus:!0}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(ne,{size:"sm",variant:"outline",className:"rounded-lg",onClick:()=>i(!1),children:"Cancel"}),a.jsxs(ne,{size:"sm",className:"rounded-lg flex-1",onClick:()=>{u(null),I.mutate({url:n})},disabled:!n.trim()||I.isPending,children:[I.isPending?a.jsx(Me,{className:"w-3.5 h-3.5 mr-1.5 animate-spin"}):a.jsx(st,{className:"w-3.5 h-3.5 mr-1.5"}),"Save Link"]})]})]}):a.jsx("p",{className:"text-xs text-muted-foreground",children:"Copy a folder link from SharePoint and paste it here to link it instantly."})]}),_&&a.jsxs(ye,{className:"p-4 border-border/60 shadow-sm",children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(yr,{className:"w-4 h-4 text-primary/70"}),a.jsx("p",{className:"text-sm font-semibold text-foreground",children:"Folder Contents"})]}),a.jsxs("button",{onClick:()=>R.refetch(),className:"text-xs text-primary hover:underline flex items-center gap-1",children:[a.jsx(st,{className:"w-3 h-3"})," Refresh"]})]}),R.isLoading&&a.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground py-2",children:[a.jsx(Me,{className:"w-3.5 h-3.5 animate-spin"})," Loading folder contents…"]}),R.isError&&a.jsx("p",{className:"text-xs text-amber-700",children:"⚠️ Could not load folder contents."}),!R.isLoading&&!R.isError&&R.data?.outdatedLink&&a.jsxs("div",{className:"rounded-lg bg-amber-50 border border-amber-200 p-3 space-y-2",children:[a.jsxs("p",{className:"text-xs font-semibold text-amber-800 flex items-center gap-1.5",children:[a.jsx(Kt,{className:"w-3.5 h-3.5 flex-shrink-0"})," Folder link is outdated"]}),a.jsx("p",{className:"text-xs text-amber-700",children:"The stored link points to a personal OneDrive location that is no longer accessible. Paste the correct SharePoint folder link below, or use the search / create options above."}),a.jsxs("a",{href:e.onedriveFolderUrl,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 text-xs text-amber-700 hover:underline break-all",children:[a.jsx(hm,{className:"w-3 h-3 flex-shrink-0"}),e.onedriveFolderUrl]})]}),R.data?.ok&&a.jsx(a.Fragment,{children:R.data.items.length===0?a.jsx("p",{className:"text-xs text-muted-foreground italic",children:"This folder is empty."}):a.jsx("div",{className:"space-y-1",children:R.data.items.map(D=>a.jsxs("a",{href:D.webUrl,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2.5 px-3 py-2 rounded-lg hover:bg-secondary/60 transition-colors group",children:[D.isFolder?a.jsx(yr,{className:"w-4 h-4 text-amber-500 flex-shrink-0"}):a.jsx(YJ,{className:"w-4 h-4 text-blue-400 flex-shrink-0"}),a.jsx("span",{className:"text-sm text-foreground group-hover:text-primary truncate flex-1",children:D.name}
192),a.jsx(hm,{className:"w-3 h-3 text-muted-foreground/50 group-hover:text-primary flex-shrink-0 opacity-0 group-hover:opacity-100 transition-opacity"})]},D.id))})})]})]})}function lEe({client:e,counts:t,open:n,onClose:r,onDeleted:s}){const[i,l]=v.useState(""),[u,d]=v.useState(!1),[f,h]=v.useState(""),p=e.type!=="homeowner"&&e.companyName?e.companyName:e.name,x=t.leads+t.quotes+t.jobs,y=async()=>{d(!0),h("");const w=await fetch(`/api/clients/${e.id}`,{method:"DELETE",headers:{Authorization:`Bearer ${localStorage.getItem("fs_team_token")}`,"Content-Type":"application/json"}});if(d(!1),w.ok){s();return}const j=await w.json().catch(()=>({}));h(j?.error||`Failed to delete client (HTTP ${w.status}).`)};return a.jsx(xh,{open:n,onOpenChange:w=>{w||r()},children:a.jsxs(ud,{children:[a.jsx(gh,{children:a.jsxs(dd,{className:"flex items-center gap-2 text-red-600",children:[a.jsx(Kt,{className:"w-5 h-5"})," Delete ",p,"?"]})}),a.jsxs("div",{className:"space-y-4 text-sm",children:[a.jsxs("p",{className:"text-muted-foreground",children:["This permanently deletes this client and ",a.jsx("strong",{children:"all"})," of their associated records. This cannot be undone."]}),a.jsxs("div",{className:"rounded-lg border border-red-200 bg-red-50 p-3 text-red-700 space-y-1",children:[a.jsxs("div",{className:"flex justify-between",children:[a.jsx("span",{children:"Leads"}),a.jsx("span",{className:"font-semibold",children:t.leads})]}),a.jsxs("div",{className:"flex justify-between",children:[a.jsx("span",{children:"Quotes"}),a.jsx("span",{className:"font-semibold",children:t.quotes})]}),a.jsxs("div",{className:"flex justify-between",children:[a.jsx("span",{children:"Jobs"}),a.jsx("span",{className:"font-semibold",children:t.jobs})]}),a.jsxs("div",{className:"flex justify-between",children:[a.jsx("span",{children:"Communications"}),a.jsx("span",{className:"font-semibold",children:"all"})]})]}),x>0&&a.jsxs("div",{children:[a.jsxs("label",{className:"block text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1.5",children:["Type ",a.jsx("span",{className:"font-mono text-red-600",children:"DELETE"})," to confirm"]}),a.jsx("input",{className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm",value:i,onChange:w=>l(w.target.value),placeholder:"DELETE"})]}),f&&a.jsx("p",{className:"text-red-600",children:f})]}),a.jsxs(OO,{children:[a.jsx(ne,{variant:"outline",className:"rounded-lg",onClick:r,disabled:u,children:"Cancel"}),a.jsx(ne,{className:"rounded-lg bg-red-600 hover:bg-red-700 text-white",onClick:y,disabled:u||x>0&&i!=="DELETE",children:u?a.jsx(Me,{className:"w-4 h-4 animate-spin"}):"Delete permanently"})]})]})})}function cEe(){const{id:e}=jh(),[,t]=fr(),[n,r]=v.useState("Overview"),[s,i]=v.useState(!1),[l,u]=v.useState(!1),{teamMember:d}=Nn(),f=d?.role==="admin",h=wt(),{data:p,isLoading:x,error:y}=Xe({queryKey:["client-history",e],queryFn:()=>Ja(`/api/clients/${e}/history`),enabled:!!e}),w=()=>h.invalidateQueries({queryKey:["client-history",e]});if(x)return a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsx("div",{className:"animate-spin h-8 w-8 border-4 border-primary border-t-transparent rounded-full"})});if(y||!p?.client)return a.jsxs("div",{className:"text-center py-16 text-muted-foreground",children:[a.jsx("p",{className:"text-lg font-medium",children:"Client not found."}),a.jsxs(ne,{variant:"ghost",className:"mt-4",onClick:()=>t("/clients"),children:[a.jsx(Sg,{className:"w-4 h-4 mr-2"})," Back to Clients"]})]});const{client:j,leads:b,quotes:C,jobs:N,statusUpdates:k}=p,T=N.reduce((_,R)=>_+(R.totalAmount||0),0),A=j.type!=="homeowner"&&j.companyName?j.companyName:j.name,P=j.type!=="homeowner"&&j.companyName?j.name:null,E=j.clientSince||j.createdAt;return a.jsxs("div",{className:"space-y-6",children:[s&&a.jsx(rEe,{client:j,open:s,onClose:()=>i(!1),onSaved:w}),l&&a.jsx(lEe,{client:j,counts:{leads:b.length,quotes:C.length,jobs:N.length},open:l,onClose:()=>u(!1),onDeleted:()=>{h.invalidateQueries({queryKey:_T()}),t("/clients")}}),a.jsxs("button",{onClick:()=>t("/clients"),className:"flex items-center text-sm text-muted-foreground hover:text-foreground transition-colors",children:[a.jsx(Sg,{className:"w-4 h-4 mr-1.5"})," Back to Clients"]}),a.jsxs(ye,{className:"p-6 border-border/60 shadow-sm",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 sm:items-start justify-between",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("div",{className:"w-16 h-16 rounded-2xl bg-primary/10 flex items-center justify-center text-primary flex-shrink-0",children:j.type==="homeowner"?a.jsx(Ai,{className:"w-8 h-8"}):a.jsx(xd,{className:"w-8 h-8"})}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[a.jsx("h1",{className:"text-2xl font-display font-bold text-foreground",children:A}),a.jsx("span",{className:`text-xs px-2.5 py-1 rounded-full font-bold uppercase tracking-wider ${tEe[j.type]}`,children:eEe[j.type]}),j.onedriveFolderUrl&&a.jsxs("a",{href:j.onedriveFolderUrl,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-xs text-blue-600 hover:text-blue-800 bg-blue-50 border border-blue-200 px-2 py-1 rounded-full font-semibold",children:[a.jsx(yr,{className:"w-3 h-3"})," SharePoint"]})]}),P&&a.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:P}),a.jsxs("p",{className:"text-xs text-muted-foreground mt-1 flex items-center gap-1",children:[a.jsx(Nh,{className:"w-3 h-3"}),"Client since ",Tt(new Date(E),"MMMM d, yyyy"),!j.clientSince&&a.jsx("button",{onClick:()=>i(!0),className:"ml-1 text-primary hover:underline",children:"(edit)"})]})]})]}
192),a.jsxs("div",{className:"flex items-center gap-2 self-start",children:[a.jsxs(ne,{variant:"outline",size:"sm",className:"rounded-lg",onClick:()=>i(!0),children:[a.jsx(gd,{className:"w-3.5 h-3.5 mr-1.5"})," Edit Client"]}),f&&a.jsxs(ne,{variant:"outline",size:"sm",className:"rounded-lg text-red-600 border-red-200 hover:bg-red-50",onClick:()=>u(!0),children:[a.jsx(on,{className:"w-3.5 h-3.5 mr-1.5"})," Delete"]})]})]}),a.jsxs("div",{className:"mt-5 grid grid-cols-1 sm:grid-cols-3 gap-4 text-sm",children:[j.phone&&a.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[a.jsx(Ch,{className:"w-4 h-4 text-primary/70 flex-shrink-0"}),a.jsx("span",{children:j.phone})]}),a.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[a.jsx($r,{className:"w-4 h-4 text-primary/70 flex-shrink-0"}),a.jsx("span",{className:"truncate",children:j.email})]}),(j.address||j.city)&&a.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[a.jsx(Ra,{className:"w-4 h-4 text-primary/70 flex-shrink-0"}),a.jsx("span",{children:[j.address,j.city,j.state].filter(Boolean).join(", ")})]})]}),j.notes&&a.jsx("p",{className:"mt-4 text-sm text-muted-foreground bg-secondary/40 rounded-lg px-4 py-3 border border-border/50",children:j.notes})]}),a.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4",children:[{icon:a.jsx(jn,{className:"w-5 h-5"}),label:"Leads",value:b.length,color:"text-blue-600"},{icon:a.jsx(Ro,{className:"w-5 h-5"}),label:"Quotes",value:C.length,color:"text-purple-600"},{icon:a.jsx(rs,{className:"w-5 h-5"}),label:"Jobs",value:N.length,color:"text-amber-600"},{icon:a.jsx(Ro,{className:"w-5 h-5"}),label:"Total Billed",value:`$${T.toLocaleString("en-US",{minimumFractionDigits:0})}`,color:"text-green-600"}].map(_=>a.jsxs(ye,{className:"p-4 border-border/60 shadow-sm",children:[a.jsx("div",{className:`${_.color} mb-2`,children:_.icon}),a.jsx("div",{className:"text-2xl font-display font-bold text-foreground",children:_.value}),a.jsx("div",{className:"text-xs text-muted-foreground mt-0.5",children:_.label})]},_.label))}),a.jsx("div",{className:"border-b border-border flex gap-1 overflow-x-auto",children:nEe.map(_=>a.jsxs("button",{onClick:()=>r(_),className:`px-4 py-2.5 text-sm font-semibold transition-colors border-b-2 -mb-px whitespace-nowrap flex items-center gap-1.5 ${n===_?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"}`,children:[_==="SharePoint"&&a.jsx(yr,{className:"w-3.5 h-3.5"}),_==="Emails"&&a.jsx($r,{className:"w-3.5 h-3.5"}),_,_==="SharePoint"&&j.onedriveFolderUrl&&a.jsx("span",{className:"w-2 h-2 rounded-full bg-green-500"})]},_))}),n==="Overview"&&a.jsx("div",{className:"space-y-4",children:b.length===0&&C.length===0&&N.length===0?a.jsxs("div",{className:"py-12 text-center text-muted-foreground",children:[a.jsx(Ai,{className:"w-12 h-12 mx-auto mb-3 opacity-20"}),a.jsx("p",{children:"No history yet for this client."})]}):a.jsxs(a.Fragment,{children:[N.slice(0,3).map(_=>a.jsxs(ye,{className:"p-4 border-border/60 shadow-sm flex flex-col sm:flex-row sm:items-center gap-3 justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-9 h-9 rounded-lg bg-amber-100 flex items-center justify-center",children:a.jsx(rs,{className:"w-4 h-4 text-amber-600"})}),a.jsxs("div",{children:[a.jsxs("p",{className:"font-semibold text-sm text-foreground",children:[_.address||"Job",_.city?`, ${_.city}`:""]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:_.scheduledDate?Tt(new Date(_.scheduledDate),"MMM d, yyyy"):Tt(new Date(_.createdAt),"MMM d, yyyy")})]})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("span",{className:`text-[10px] px-2.5 py-1 rounded-full font-bold uppercase tracking-wider ${Xf[_.status]||"bg-gray-100 text-gray-600"}`,children:_.status.replace("_"," ")}),a.jsxs("span",{className:"font-bold text-sm text-foreground",children:["$",_.totalAmount?.toLocaleString()??"0"]})]})]},_.id)),C.slice(0,2).map(_=>a.jsxs(ye,{className:"p-4 border-border/60 shadow-sm flex flex-col sm:flex-row sm:items-center gap-3 justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-9 h-9 rounded-lg bg-purple-100 flex items-center justify-center",children:a.jsx(jn,{className:"w-4 h-4 text-purple-600"})}),a.jsxs("div",{children:[a.jsxs("p",{className:"font-semibold text-sm text-foreground",children:["Quote #",_.id]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:Tt(new Date(_.createdAt),"MMM d, yyyy")})]})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("span",{className:`text-[10px] px-2.5 py-1 rounded-full font-bold uppercase tracking-wider ${Xf[_.status]||"bg-gray-100 text-gray-600"}`,children:_.status}),a.jsxs("span",{className:"font-bold text-sm text-foreground",children:["$",_.grandTotal?.toLocaleStr
192ing()??"0"]})]})]},_.id))]})}),n==="Quotes"&&a.jsx(ye,{className:"overflow-hidden border-border/60 shadow-sm",children:C.length===0?a.jsxs("div",{className:"py-12 text-center text-muted-foreground",children:[a.jsx(jn,{className:"w-10 h-10 mx-auto mb-3 opacity-20"}),a.jsx("p",{children:"No quotes yet."})]}):a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{className:"bg-secondary/50 text-xs text-muted-foreground uppercase font-semibold",children:a.jsxs("tr",{children:[a.jsx("th",{className:"px-6 py-4 text-left",children:"Quote #"}),a.jsx("th",{className:"px-6 py-4 text-left",children:"Status"}),a.jsx("th",{className:"px-6 py-4 text-left",children:"Total"}),a.jsx("th",{className:"px-6 py-4 text-left",children:"Date"}),a.jsx("th",{className:"px-6 py-4 text-right",children:"Action"})]})}),a.jsx("tbody",{className:"divide-y divide-border",children:C.map(_=>a.jsxs("tr",{className:"hover:bg-secondary/20",children:[a.jsxs("td",{className:"px-6 py-4 font-bold text-foreground",children:["#",_.id]}),a.jsx("td",{className:"px-6 py-4",children:a.jsx("span",{className:`text-[10px] px-2.5 py-1 rounded-full font-bold uppercase tracking-wider ${Xf[_.status]||"bg-gray-100 text-gray-600"}`,children:_.status})}),a.jsxs("td",{className:"px-6 py-4 font-semibold",children:["$",_.grandTotal?.toLocaleString()??"0"]}),a.jsx("td",{className:"px-6 py-4 text-muted-foreground",children:Tt(new Date(_.createdAt),"MMM d, yyyy")}),a.jsx("td",{className:"px-6 py-4 text-right",children:a.jsx(ne,{variant:"outline",size:"sm",className:"rounded-lg",onClick:()=>t(`/quotes/${_.id}/edit`),children:"View"})})]},_.id))})]})}),n==="Jobs"&&a.jsx(ye,{className:"overflow-hidden border-border/60 shadow-sm",children:N.length===0?a.jsxs("div",{className:"py-12 text-center text-muted-foreground",children:[a.jsx(rs,{className:"w-10 h-10 mx-auto mb-3 opacity-20"}),a.jsx("p",{children:"No jobs yet."})]}):a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{className:"bg-secondary/50 text-xs text-muted-foreground uppercase font-semibold",children:a.jsxs("tr",{children:[a.jsx("th",{className:"px-6 py-4 text-left",children:"Location"}),a.jsx("th",{className:"px-6 py-4 text-left",children:"Status"}),a.jsx("th",{className:"px-6 py-4 text-left",children:"Invoice"}),a.jsx("th",{className:"px-6 py-4 text-left",children:"Amount"}),a.jsx("th",{className:"px-6 py-4 text-left",children:"Date"})]})}),a.jsx("tbody",{className:"divide-y divide-border",children:N.map(_=>a.jsxs("tr",{className:"hover:bg-secondary/20",children:[a.jsxs("td",{className:"px-6 py-4 font-medium text-foreground",children:[_.address||"—",_.city?`, ${_.city}`:""]}),a.jsx("td",{className:"px-6 py-4",children:a.jsx("span",{className:`text-[10px] px-2.5 py-1 rounded-full font-bold uppercase tracking-wider ${Xf[_.status]||"bg-gray-100 text-gray-600"}`,children:_.status.replace("_"," ")})}),a.jsx("td",{className:"px-6 py-4",children:a.jsx("span",{className:`text-[10px] px-2.5 py-1 rounded-full font-bold uppercase tracking-wider ${Xf[_.invoiceStatus]||"bg-gray-100 text-gray-600"}`,children:_.invoiceStatus.replace("_"," ")})}),a.jsxs("td",{className:"px-6 py-4 font-semibold",children:["$",_.totalAmount?.toLocaleString()??"0"]}),a.jsx("td",{className:"px-6 py-4 text-muted-foreground",children:_.scheduledDate?Tt(new Date(_.scheduledDate),"MMM d, yyyy"):Tt(new Date(_.createdAt),"MMM d, yyyy")})]},_.id))})]})}),n==="Service Reports"&&a.jsx("div",{className:"space-y-3",children:k.length===0?a.jsxs("div",{className:"py-12 text-center text-muted-foreground",children:[a.jsx(Am,{className:"w-10 h-10 mx-auto mb-3 opacity-20"}),a.jsx("p",{children:"No field reports yet."})]}):k.map(_=>a.jsx(ye,{className:"p-4 border-border/60 shadow-sm",children:a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3",children:[a.jsxs("div",{children:[a.jsxs("p",{className:"font-semibold text-foreground text-sm",children:[_.streetAddress,", ",_.city]}),a.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5 flex items-center gap-1.5",children:[a.jsx(Dr,{className:"w-3 h-3"}),Tt(new Date(_.arriveAt),"MMM d, yyyy")," · ",_.technician]})]}),a.jsx("span",{className:`text-[10px] px-2.5 py-1 rounded-full font-bold self-start sm:self-ce
192nter whitespace-nowrap ${_.jobStatus.includes("Completed")&&!_.jobStatus.includes("Not")?"bg-green-100 text-green-700":"bg-amber-100 text-amber-700"}`,children:_.jobStatus})]})},_.id))}),n==="Emails"&&a.jsx(aEe,{client:j,onSent:w}),n==="SharePoint"&&a.jsx(oEe,{client:j,onRefresh:w})]})}function uEe(){const[e,t]=v.useState(null),[n,r]=v.useState(!0),[s,i]=v.useState(!1),l=()=>{r(!0),i(!1),sn("/api/integrations/status").then(f=>{if(f.error)throw new Error(f.error);t(f)}).catch(()=>i(!0)).finally(()=>r(!1))};v.useEffect(()=>{l()},[]);const u=["microsoftApp","microsoftTokens","email","sharepoint","webhooks","jwtSecret","objectStorage"],d={microsoftApp:a.jsx(Zy,{}),microsoftTokens:a.jsx(Zy,{}),email:a.jsx($r,{className:"w-4 h-4"}),sharepoint:a.jsx(yr,{className:"w-4 h-4"}),webhooks:a.jsx(B2,{className:"w-4 h-4"}),jwtSecret:a.jsx(zq,{className:"w-4 h-4"}),objectStorage:a.jsx(yr,{className:"w-4 h-4"})};return a.jsxs(ye,{className:"border-border/60 overflow-hidden",children:[a.jsxs("div",{className:"flex items-center justify-between p-5 border-b border-border",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[n?a.jsx(Me,{className:"w-5 h-5 animate-spin text-primary"}):e?.ok?a.jsx(yd,{className:"w-5 h-5 text-green-600"}):a.jsx(Hq,{className:"w-5 h-5 text-amber-500"}),a.jsx("span",{className:"font-display font-bold text-foreground",children:"Integration Health Check"})]}),a.jsxs(ne,{variant:"ghost",size:"sm",onClick:l,disabled:n,className:"rounded-lg gap-1.5",children:[a.jsx(qo,{className:`w-3.5 h-3.5 ${n?"animate-spin":""}`})," Refresh"]})]}),s?a.jsxs("div",{className:"p-5 text-sm text-muted-foreground flex items-center gap-2",children:[a.jsx(rn,{className:"w-4 h-4 text-red-500"})," Failed to load status. Make sure you are signed in."]}):n?a.jsx("div",{className:"p-5 space-y-3",children:[...Array(6)].map((f,h)=>a.jsx("div",{className:"h-12 bg-secondary/30 rounded-xl animate-pulse"},h))}):e?a.jsx("div",{className:"divide-y divide-border",children:u.filter(f=>e.checks[f]).map(f=>{const h=e.checks[f],p=!h.ok&&!h.optional,x=h.critical;return a.jsxs("div",{className:`flex items-start gap-3 px-5 py-3.5 ${x?"bg-red-50/60":!h.ok&&!h.optional?"bg-amber-50/60":h.optional&&!h.ok?"bg-secondary/20":""}`,children:[a.jsx("div",{className:`mt-0.5 flex-shrink-0 ${h.ok?"text-green-600":h.optional?"text-muted-foreground":x?"text-red-500":"text-amber-500"}`,children:h.ok?a.jsx(st,{className:"w-4 h-4"}):h.optional?a.jsx("div",{className:"w-4 h-4 flex items-center justify-center",children:a.jsx("div",{className:"w-2 h-2 rounded-full bg-muted-foreground/40"})}):a.jsx(cT,{className:"w-4 h-4"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[a.jsx("span",{className:`text-sm font-semibold ${x?"text-red-700":p?"text-amber-700":"text-foreground"}`,children:h.label}),h.optional&&a.jsx("span",{className:"text-[10px] px-2 py-0.5 rounded-full bg-secondary text-muted-foreground font-bold",children:"Optional"}),x&&a.jsx("span",{className:"text-[10px] px-2 py-0.5 rounded-full bg-red-100 text-red-700 font-bold",children:"Action Required"})]}),a.jsx("p",{className:`text-xs mt-0.5 ${x?"text-red-600":p?"text-amber-600":"text-muted-foreground"}`,children:h.detail})]}),a.jsx("div",{className:"text-muted-foreground flex-shrink-0",children:d[f]})]},f)})}):null]})}function WA({text:e,label:t="Copy"}){const[n,r]=v.useState(!1),s=()=>{navigator.clipboard.writeText(e),r(!0),setTimeout(()=>r(!1),2e3)};return a.jsxs("button",{onClick:s,className:"flex items-center gap-1.5 text-xs font-semibold px-3 py-1.5 rounded-lg bg-secondary hover:bg-secondary/80 transition-colors border border-border",children:[n?a.jsx(ac,{className:"w-3.5 h-3.5 text-green-600"}):a.jsx(OJ,{className:"w-3.5 h-3.5"}),n?"Copied!":t]})}function gF({code:e,lang:t="json"}){return a.jsxs("div",{className:"relative",children:[a.jsx("div",{className:"absolute top-3 right-3",children:a.jsx(WA,{text:e})}),a.jsx("pre",{className:"bg-gray-950 text-green-400 rounded-xl p-5 text-xs font-mono overflow-x-auto leading-relaxed pr-24 whitespace-pre-wrap",children:e})]})}function Cl({n:e}){return a.jsx("span",{className:"w-7 h-7 rounded-full bg-primary text-primary-foreground font-bold text-sm flex items-center justify-center flex-shrink-0",children:e})}function ea({title:e,icon:t,children:n,defaultOpen:r=!0}){const[s,i]=v.useState(r);return a.jsxs(ye,{className:"border-border/60 shadow-sm overflow-hidden",children:[a.jsxs("button",{onClick:()=>i(l=>!l),className:"w-full flex items-center gap-3 p-5 text-left hover:bg-secondary/30 transition-colors",children:[a.jsx("span",{className:"text-primary",children:t}),a.jsx("span",{className:"font-display font-bold text-foreground flex-1",children:e}),s?a.jsx(Nr,{className:"w-4 h-4 text-muted-foreground"}):a.jsx(wr,{className:"w-4 h-4 text-muted-foreground"})]}),s&&a.jsx("div",{className:"px-5 pb-5 border-t border-border space-y-5 pt-5",children:n})]})}const sn=(e,t)=>{const n=localStorage.getItem("fs_team_token");return fetch(e,{...t,headers:{Authorization:`Bearer ${n}`,"Content-Type":"application/json",...t?.headers||{}}}).then(r=>r.json())};function Zy(){return a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 21 21",width:"16",height:"16",children:[a.jsx("rect",{x:"1",y:"1",width:"9",height:"9",fill:"#f25022"}),a.jsx("rect",{x:"11",y:"1",width:"9",height:"9",fill:"#7fba00"}),a.jsx("rect",{x:"1",y:"11",width:"9",height:"9",fill:"#00a4ef"}),a.jsx("rect",{x:"11",y:"11",width:"9",height:"9",fill:"#ffb900"})]})}function dEe(){const[e,t]=v.useState(null),[n,r]=v.useState(!0);v.useEffect(()=>{sn("/api/auth/microsoft/me").then(i=>{i.error||t(i)}).catch(()=>{}).finally(()=>r(!1))},[]);const s=()=>{window.location.href="/api/auth/microsoft"};return n?a.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[a.jsx(Me,{className:"w-4 h-4 animate-spin"})," Checking Microsoft connection…"]}):e?.connected?a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-green-50 border border-green-200 text-sm text-green-800",children:[a.jsx(st,{className:"w-4 h-4 text-green-600 flex-shrink-0"}),a.jsxs("span",{children:["Connected as ",a.jsx("strong",{children:e.email})]})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"SharePoint and other Microsoft features are active for your account."})]}):a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-start gap-2 p-3 rounded-xl bg-amber-50 border border-amber-200 text-sm text-amber-800",children:[a.jsx(rn,{className:"w-4 h-4 text-amber-600 flex-shrink-0 mt-0.5"}),a.jsxs("div",{children:[a.jsx("p",{className:"font-semibold",children:"Microsoft account not connected"}),a.jsx("p",{className:"mt-0.5 text-amber-700",children:"Your current login does not have a Microsoft 365 connection. SharePoint folder operations require a connected Microsoft account. Sign in with Microsoft to enable SharePoint features for your account."})]})]}),a.jsxs(ne,{size:"sm",variant:"outline",className:"rounded-lg gap-2",onClick:s,children:[a.jsx(Zy,{}),"Sign in with Microsoft"]})]})}function fEe(e){return e==null?"—":e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(0)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function mEe({item:e,clients:t,groups:n,onMoved:r}){const[s,i]=v.useState(""),[l,u]=v.useState(e.suggestion?.hasFolder?e.suggestion.clientId:null),[d,f]=v.useState(""),[h,p]=v.useState(!1),[x,y]=v.useState(null),w=s.trim()?t.filter(N=>N.name.toLowerCase().includes(s.trim().toLowerCase())).slice(0,8):[],j=t.find(N=>N.id===l)||null,b=async()=>
192{if(l){p(!0),y(null);try{const N=await sn("/api/sharepoint/move-item-to-client",{method:"POST",body:JSON.stringify({driveId:e.driveId,itemId:e.id,clientId:l})});if(N.error){y(N.error);return}r(e.id,N.message||"Moved.")}catch{y("Move failed.")}finally{p(!1)}}},C=async()=>{if(d){p(!0),y(null);try{const N=await sn("/api/sharepoint/move-folder-to-group",{method:"POST",body:JSON.stringify({driveId:e.driveId,itemId:e.id,estimatorGroupId:d})});if(N.error){y(N.error);return}r(e.id,N.message||"Moved.")}catch{y("Move failed.")}finally{p(!1)}}};return a.jsxs("div",{className:"rounded-xl border border-border bg-secondary/20 p-3 space-y-2",children:[a.jsx("div",{className:"flex items-start gap-3 flex-wrap",children:a.jsxs("div",{className:"flex-1 min-w-[200px]",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[e.isFolder?a.jsx(yr,{className:"w-4 h-4 text-amber-600 flex-shrink-0"}):a.jsx(Lq,{className:"w-4 h-4 text-blue-600 flex-shrink-0"}),a.jsxs("a",{href:e.webUrl,target:"_blank",rel:"noreferrer",className:"font-semibold text-sm text-foreground hover:underline break-all",children:[e.name," ",a.jsx(hm,{className:"w-3 h-3 inline-block text-muted-foreground"})]})]}),a.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:[e.isFolder?"Misplaced folder":"Loose file"," in ",a.jsx("strong",{children:e.location})," · ",fEe(e.size),e.lastModified&&a.jsxs(a.Fragment,{children:[" · modified ",new Date(e.lastModified).toLocaleDateString()]})]})]})}),e.isFolder?a.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[a.jsxs("select",{className:"h-8 text-xs rounded-lg border border-border bg-background px-2",value:d,onChange:N=>f(N.target.value),children:[a.jsx("option",{value:"",children:"Move under estimator group…"}),n.map(N=>a.jsx("option",{value:N.id,children:N.name},N.id))]}),a.jsx(ne,{size:"sm",variant:"outline",className:"h-8 rounded-lg text-xs",disabled:!d||h,onClick:C,children:h?a.jsx(Me,{className:"w-3.5 h-3.5 animate-spin"}):"Move folder"})]}):a.jsx("div",{className:"space-y-1.5",children:j?a.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[a.jsxs("span",{className:"text-xs px-2 py-1 rounded-full bg-green-100 text-green-800 font-semibold",children:["→ ",j.name,e.suggestion?.clientId===j.id?" (suggested)":""]}),a.jsx(ne,{size:"sm",className:"h-8 rounded-lg text-xs",disabled:h,onClick:b,children:h?a.jsx(Me,{className:"w-3.5 h-3.5 animate-spin"}):"Move to client folder"}),a.jsx("button",{className:"text-xs text-muted-foreground underline",onClick:()=>{u(null),i("")},children:"change"})]}):a.jsxs("div",{className:"relative",children:[a.jsx("input",{className:"h-8 w-full max-w-xs text-xs rounded-lg border border-border bg-background px-2",placeholder:e.suggestion&&!e.suggestion.hasFolder?`Suggested: ${e.suggestion.clientName} (no folder yet) — search client…`:"Search client by name…",value:s,onChange:N=>i(N.target.value)}),w.length>0&&a.jsx("div",{className:"absolute z-10 mt-1 w-full max-w-xs bg-background border border-border rounded-lg shadow-md overflow-hidden",children:w.map(N=>a.jsxs("button",{className:"block w-full text-left px-3 py-1.5 text-xs hover:bg-secondary/60 disabled:opacity-50",disabled:!N.onedriveFolderUrl,onClick:()=>{u(N.id),i("")},children:[N.name,!N.onedriveFolderUrl&&" — no linked folder"]},N.id))})]})}),x&&a.jsx("p",{className:"text-xs text-red-600",children:x})]})}function hEe(){const[e,t]=v.useState(null),[n,r]=v.useState(!1),[s,i]=v.useState(null),[l,u]=v.useState([]),[d,f]=v.useState([]),[h,p]=v.useState(null),x=async()=>{r(!0),i(null),p(null);try{const[w,j,b]=await Promise.all([sn("/api/sharepoint/unfiled-items"),sn("/api/clients"),sn("/api/sharepoint/estimator-groups")]);if(w.error){i(w.error),t(null);return}t(w.items||[]),Array.isArray(j)&&u(j.map(C=>({id:C.id,name:C.name,onedriveFolderUrl:C.onedriveFolderUrl||""}))),b.ok&&f(b.groups||[])}catch{i("Scan failed. Make sure you are signed in.")}finally{r(!1)}},y=(w,j)=>{t(b=>b&&b.filter(C=>C.id!==w)),p(j)};return a.jsxs("div",{className:"space-y-4",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"Finds loose files sitting at the Client Projects library root or directly inside an estimator group folder (e.g. scanned PDFs in DUSTY SCAN FOLDER), plus misplaced client folders inside scan/holding folders. File each one into the right client's project folder."}),a.jsxs(ne,{size:"sm",variant:"outline",className:"rounded-lg gap-2",disabled:n,onClick:x,children:[n?a.jsx(Me,{className:"w-4 h-4 animate-spin"}):a.jsx(qo,{className:"w-4 h-4"}),n?"Scanning SharePoint…":e?"Re-scan":"Scan for unfiled items"]}),s&&a.jsxs("div",{className:"flex items-start gap-2 p-3 rounded-lg bg-red-50 border border-red-200 text-sm text-red-700",children:[a.jsx(rn,{className:"w-4 h-4 flex-shrink-0 mt-0.5"})," ",s]}),h&&a.jsxs("div",{className:"flex items-start gap-2 p-3 rounded-lg bg-green-50 border border-green-200 text-sm text-green-800",children:[a.jsx(st,{className:"w-4 h-4 text-green-600 flex-shrink-0 mt-0.5"})," ",h]}),e&&e.length===0&&a.jsx("p",{className:"text-sm text-green-700 font-medium",children:"No unfiled items found — everything is inside a client folder. ✔"}),e&&e.length>0&&a.jsxs("div",{className:"space-y-2",children:[a.jsxs("p",{className:"text-xs text-muted-foreground font-semibold",children:[e.length," unfiled item",e.length===1?"":"s"," found"]}
192),e.map(w=>a.jsx(mEe,{item:w,clients:l,groups:d,onMoved:y},w.id))]})]})}function pEe({clientId:e,clientName:t,onFixed:n,onVerifyFailed:r}){const[s,i]=v.useState(!1),[l,u]=v.useState(!1),[d,f]=v.useState(null),[h,p]=v.useState(null),[x,y]=v.useState(null),[w,j]=v.useState(null),[b,C]=v.useState(null),[N,k]=v.useState(null),T=async()=>{u(!0),p(null),f(null),C(null);try{const P=await sn(`/api/sharepoint/search/${e}`,{method:"POST"});if(P.error){p(P.error);return}f(P.folders||[])}catch{p("Search failed. Make sure you are signed in with Microsoft.")}finally{u(!1)}},A=async(P,E=!1)=>{y(P),C(null),k(null);try{const _=await sn(`/api/sharepoint/folder-url/${e}`,{method:"PATCH",body:JSON.stringify({folderUrl:P,...E?{force:!0}:{}})});if(_.conflict){k({url:P,names:(_.conflictClients||[]).map(R=>R.name)});return}if(_.error){C(_.error);return}j(P);try{const R=await sn(`/api/sharepoint/verify-link/${e}`,{method:"POST"});if(!R.verified){const H=R.error||"The new link did not resolve in SharePoint.";C(`The new link was saved but does not verify: ${H}`),r(e,R.link||P,H);return}n(e)}finally{j(null)}}catch{C("Failed to save the new link. Make sure you are signed in.")}finally{y(null)}};return s?a.jsxs("div",{className:"w-full mt-1 space-y-1.5",children:[l&&a.jsxs("p",{className:"text-xs text-muted-foreground flex items-center gap-1.5",children:[a.jsx(Me,{className:"w-3.5 h-3.5 animate-spin"})," Searching SharePoint for folders matching ",t,"…"]}),h&&a.jsxs("p",{className:"text-xs font-medium text-amber-700",children:["⚠️ ",h]}),b&&a.jsxs("p",{className:"text-xs font-medium text-red-700",children:["⚠️ ",b]}),N&&a.jsxs("div",{className:"rounded-lg border border-amber-300 bg-amber-50 px-3 py-2 space-y-1.5",children:[a.jsx("p",{className:"text-xs font-semibold text-amber-900",children:"⚠️ Folder already linked to another client"}),a.jsxs("p",{className:"text-xs text-amber-800",children:["This folder is already linked to ",a.jsx("span",{className:"font-semibold",children:N.names.join(", ")}),". Linking it here means both clients would share one project folder and documents may be filed into the wrong client's folder."]}),a.jsxs("div",{className:"flex items-center gap-3 pt-0.5",children:[a.jsx("button",{onClick:()=>A(N.url,!0),disabled:x!==null,className:"text-xs font-semibold text-amber-800 hover:underline disabled:opacity-60",children:"Link anyway"}),a.jsx("button",{onClick:()=>k(null),disabled:x!==null,className:"text-xs text-muted-foreground hover:underline disabled:opacity-60",children:"Cancel"})]})]}),w&&a.jsxs("p",{className:"text-xs text-muted-foreground flex items-center gap-1.5",children:[a.jsx(Me,{className:"w-3.5 h-3.5 animate-spin"})," Verifying the new link resolves in SharePoint…"]}),d!==null&&d.length===0&&a.jsx("p",{className:"text-xs text-muted-foreground bg-secondary/50 rounded px-3 py-2",children:"No matching folders found. Open the client's profile to create a folder or paste a link manually."}),d!==null&&d.length>0&&a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("p",{className:"text-xs font-semibold text-foreground",children:[d.length," folder",d.length!==1?"s":""," found — click to link:"]}),d.map((P,E)=>a.jsxs("button",{onClick:()=>A(P.webUrl),disabled:x!==null,className:"w-full text-left text-xs flex items-center gap-2 px-3 py-2 rounded-lg bg-blue-50 hover:bg-blue-100 border border-blue-200 transition-colors disabled:opacity-60",children:[x===P.webUrl?a.jsx(Me,{className:"w-3.5 h-3.5 text-blue-600 animate-spin flex-shrink-0"}):a.jsx(yr,{className:"w-3.5 h-3.5 text-blue-600 flex-shrink-0"}),a.jsx("span",{className:"truncate font-medium text-blue-800",children:P.name})]},E))]}),a.jsxs("div",{className:"flex items-center gap-3",children:[!l&&a.jsxs("button",{onClick:T,className:"text-xs text-primary hover:underline flex items-center gap-1",disabled:x!==null,children:[a.jsx(Da,{className:"w-3 h-3"})," Search again"]}),a.jsx("button",{onClick:()=>{i(!1),f(null),p(null),C(null),k(null)},className:"text-xs text-muted-foreground hover:underline",disabled:x!==null,children:"Cancel"})]})]}):a.jsxs("button",{onClick:()=>{i(!0),T()},className:"text-xs text-primary font-semibold hover:underline flex items-center gap-1",children:[a.jsx(dT,{className:"w-3 h-3"})," Re-link"]})}function xEe(){const[e,t]=v.useState(null),[n,r]=v.useState(null),[s,i]=v.useState(!1),[l,u]=v.useState(null),[d,f]=v.useState(new Set),[h,p]=v.useState(new Set),[x,y]=v.useState(!1),[w,j]=v.useState(!1),[b,C]=v.useState(null),[N,k]=v.useState(null),[T,A]=v.useState(null),P=n?.status==="pending"||n?.status==="running";v.useEffect(()=>{if(!e||!P)return;const D=setInterval(async()=>{try{const q=await sn(`/api/sharepoint/audit-links-status/${e}`);if(q.error){u(q.error),t(null);return}r(q)}catch{}},1500);return()=>clearInterval(D)},[e,P]);const E=async()=>
192{i(!0),u(null),r(null),f(new Set),p(new Set),j(!1),C(null),k(null),A(null);try{const D=await sn("/api/sharepoint/audit-links",{method:"POST"});if(D.error){u(D.error);return}t(D.jobId),r({status:"pending",total:0,checked:0,failures:[]})}catch{u("Could not start the audit. Make sure you are signed in.")}finally{i(!1)}},_=n&&n.total>0?Math.round(n.checked/n.total*100):0,R=n?n.failures.filter(D=>!h.has(D.clientId)):[],H=R.length>0&&R.every(D=>d.has(D.clientId)),L=D=>{f(q=>{const K=new Set(q);return K.has(D)?K.delete(D):K.add(D),K}),j(!1)},I=()=>{f(H?new Set:new Set(R.map(D=>D.clientId))),j(!1)},W=async()=>{const D=R.filter(q=>d.has(q.clientId)).map(q=>q.clientId);if(D.length!==0){y(!0),C(null),k(null);try{const q=await sn("/api/sharepoint/folder-urls",{method:"DELETE",body:JSON.stringify({clientIds:D})});if(q.error){C(q.error);return}p(K=>new Set([...K,...D])),f(new Set),k(`Cleared ${q.cleared} broken link${q.cleared===1?"":"s"}. Those clients now show as having no folder linked.`)}catch{C("Failed to clear links. Make sure you are signed in.")}finally{y(!1),j(!1)}}},U=(D,q)=>{p(K=>new Set([...K,D])),f(K=>{if(!K.has(D))return K;const Y=new Set(K);return Y.delete(D),Y}),A(`Re-linked ${q}'s folder and verified the new link resolves in SharePoint. ✔`)},V=(D,q,K)=>{r(Y=>Y&&{...Y,failures:Y.failures.map(z=>z.clientId===D?{...z,link:q,error:K}
192:z)}),A(null)};return a.jsxs("div",{className:"space-y-4",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"Checks every client with a linked SharePoint folder and reports any whose stored link no longer resolves (folder moved, renamed, or deleted). Runs in the background — it can take a while with thousands of clients. Fix each broken link right here with the Re-link action."}),a.jsxs(ne,{size:"sm",variant:"outline",className:"rounded-lg gap-2",disabled:s||P,onClick:E,children:[s||P?a.jsx(Me,{className:"w-4 h-4 animate-spin"}):a.jsx(yd,{className:"w-4 h-4"}),s?"Starting…":P?"Checking links…":n?"Run again":"Check folder links"]}),l&&a.jsxs("div",{className:"flex items-start gap-2 p-3 rounded-lg bg-red-50 border border-red-200 text-sm text-red-700",children:[a.jsx(rn,{className:"w-4 h-4 flex-shrink-0 mt-0.5"})," ",l]}),n&&P&&a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[a.jsx("span",{children:n.total>0?`Checked ${n.checked.toLocaleString()} of ${n.total.toLocaleString()} linked clients`:"Preparing…"}),n.total>0&&a.jsxs("span",{className:"font-semibold",children:[_,"%"]})]}),a.jsx("div",{className:"h-2 rounded-full bg-secondary overflow-hidden",children:a.jsx("div",{className:"h-full bg-primary transition-all duration-500",style:{width:`${_}%`}})}),n.failures.length>0&&a.jsxs("p",{className:"text-xs text-amber-700 font-semibold",children:[n.failures.length," broken link",n.failures.length===1?"":"s"," found so far…"]})]}),n?.status==="error"&&a.jsxs("div",{className:"flex items-start gap-2 p-3 rounded-lg bg-red-50 border border-red-200 text-sm text-red-700",children:[a.jsx(rn,{className:"w-4 h-4 flex-shrink-0 mt-0.5"})," Audit failed: ",n.error||"Unknown error"]}),n?.status==="done"&&n.failures.length===0&&a.jsxs("p",{className:"text-sm text-green-700 font-medium",children:["All ",n.total.toLocaleString()," linked folder",n.total===1?"":"s"," resolved correctly — no broken links. ✔"]}),N&&a.jsxs("div",{className:"flex items-start gap-2 p-3 rounded-lg bg-green-50 border border-green-200 text-sm text-green-800",children:[a.jsx(st,{className:"w-4 h-4 text-green-600 flex-shrink-0 mt-0.5"})," ",N]}),T&&a.jsxs("div",{className:"flex items-start gap-2 p-3 rounded-lg bg-green-50 border border-green-200 text-sm text-green-800",children:[a.jsx(st,{className:"w-4 h-4 text-green-600 flex-shrink-0 mt-0.5"})," ",T]}),b&&a.jsxs("div",{className:"flex items-start gap-2 p-3 rounded-lg bg-red-50 border border-red-200 text-sm text-red-700",children:[a.jsx(rn,{className:"w-4 h-4 flex-shrink-0 mt-0.5"})," ",b]}),n?.status==="done"&&n.failures.length>0&&R.length===0&&a.jsx("p",{className:"text-sm text-green-700 font-medium",children:"All broken links from this audit have been fixed or cleared. ✔"}),n&&R.length>0&&(n.status==="done"||P)&&a.jsxs("div",{className:"space-y-2",children:[n.status==="done"&&a.jsxs("div",{className:"flex items-start gap-2 p-3 rounded-lg bg-amber-50 border border-amber-200 text-sm text-amber-800",children:[a.jsx(rn,{className:"w-4 h-4 text-amber-600 flex-shrink-0 mt-0.5"}),a.jsxs("span",{children:[a.jsx("strong",{children:R.length})," of ",n.total.toLocaleString()," linked clients have a folder link that no longer works. Use Re-link on a row to search and pick the right folder, or select rows below to clear the dead links in bulk."]})]}),a.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[a.jsxs("label",{className:"flex items-center gap-2 cursor-pointer text-xs font-semibold text-foreground",children:[a.jsx("input",{type:"checkbox",className:"w-4 h-4 rounded border-border accent-primary",checked:H,onChange:I}),"Select all (",R.length,")"]}),d.size>0&&!w&&a.jsxs(ne,{size:"sm",variant:"destructive",className:"rounded-lg gap-2",disabled:x,onClick:()=>j(!0),children:[a.jsx(on,{className:"w-4 h-4"})," Clear selected link",d.size===1?"":"s"," (",d.size,")"]}),d.size>0&&w&&a.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[a.jsxs("span",{className:"text-xs text-red-700 font-semibold",children:["Remove the stored folder link from ",d.size," client",d.size===1?"":"s","? Files are not deleted."]}),a.jsxs(ne,{size:"sm",variant:"destructive",className:"rounded-lg gap-2",disabled:x,onClick:W,children:[x?a.jsx(Me,{className:"w-4 h-4 animate-spin"}):a.jsx(on,{className:"w-4 h-4"}),x?"Clearing…":"Yes, clear links"]}),a.jsx(ne,{size:"sm",variant:"outline",className:"rounded-lg",disabled:x,onClick:()=>j(!1),children:"Cancel"})]})]}),a.jsx("div",{className:"divide-y divide-border rounded-xl border border-border overflow-hidden",children:R.map(D=>a.jsxs("div",{className:"p-3 bg-secondary/10 flex items-start gap-3",children:[a.jsx("input",{type:"checkbox",className:"w-4 h-4 mt-0.5 rounded border-border accent-primary flex-shrink-0",checked:d.has(D.clientId),onChange:()=>L(D.clientId),"aria-label":`Select ${D.name}`}),a.jsxs("div",{className:"space-y-1 min-w-0 flex-1",children:[a.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[a.jsx("a",{href:`/clients/${D.clientId}`,className:"text-sm font-semibold text-primary hover:underline",children:D.name}),a.jsx(pEe,{clientId:D.clientId,clientName:D.name,onFixed:q=>U(q,D.name),onVerifyFailed:V}),a.jsx("a",{href:`/clients/${D.clientId}`,className:"text-xs text-muted-foreground underline",children:"open profile"})]}),a.jsx("p",{className:"text-xs font-mono text-muted-foreground break-all",children:D.link}),a.jsx("p",{className:"text-xs text-red-600",children:D.error})]})]},D.clientId))})]})]})}function gEe(){const[e,t]=v.useState(!1),[n,r]=v.useState(null),[s,i]=v.useState(null),[l,u]=v.useState(!1),d=async()=>{t(!0),i(null);try{const R=await sn("/api/sharepoint/clear-legacy-links",{method:"DELETE"});if(R.error){i(R.error);return}r(R)}catch{i("Failed. Make sure you are logged in.")}finally{t(!1),u(!1)}},[f,h]=v.useState(null),[p,x]=v.useState(!1),[y,w]=v.useState(null),[j,b]=v.useState(!1),[C,N]=v.useState(!1),[k,T]=v.useState(null),[A,P]=v.useState(null),E=async()=>{x(!0),w(null),h(null),b(!1),T(null),P(null);
192try{const R=await sn("/api/sharepoint/cleanup-preview");if(R.error){w(R.error);return}h(R.clients||[])}catch{w("Preview failed. Make sure you are signed in with Microsoft.")}finally{x(!1)}},_=async()=>{if(!(!f||f.length===0)){N(!0),P(null);try{const R=await sn("/api/sharepoint/cleanup-execute",{method:"DELETE",body:JSON.stringify({clientIds:f.map(H=>H.id)})});if(R.error){P(R.error);return}T({deleted:R.deleted}),h(null),b(!1)}catch{P("Deletion failed.")}finally{N(!1)}}};return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-semibold text-foreground",children:"Step 1 — Clear old personal OneDrive links"}),a.jsxs("p",{className:"text-sm text-muted-foreground mt-1",children:["All clients currently have links pointing to George's personal OneDrive/Synology NAS (",a.jsx("code",{className:"bg-secondary rounded px-1 text-xs",children:"-my.sharepoint.com/personal/…"}),"). These no longer work now that you've moved to the company SharePoint site. This will clear those links so each client can be re-linked to the new location. It does ",a.jsx("strong",{children:"not"})," delete any files."]})]}),n&&a.jsxs("div",{className:"flex items-start gap-2 p-3 rounded-xl bg-green-50 border border-green-200 text-sm text-green-800",children:[a.jsx(st,{className:"w-4 h-4 text-green-600 flex-shrink-0 mt-0.5"}),a.jsxs("div",{children:[a.jsxs("p",{className:"font-semibold",children:["Cleared ",n.cleared," old link",n.cleared!==1?"s":"","."]}),n.clientNames.length>0&&a.jsx("p",{className:"text-xs mt-1 text-green-700",children:n.clientNames.join(", ")})]})]}),a.jsxs("label",{className:"flex items-start gap-2 cursor-pointer text-sm text-foreground",children:[a.jsx("input",{type:"checkbox",className:"mt-0.5",checked:l,onChange:R=>u(R.target.checked)}),"I understand this will clear the stored folder links for all affected clients (files are not deleted)."]}),a.jsxs(ne,{size:"sm",variant:"destructive",className:"rounded-lg",disabled:!l||e||!!n,onClick:d,children:[e?a.jsx(Me,{className:"w-3.5 h-3.5 mr-1.5 animate-spin"}):a.jsx(on,{className:"w-3.5 h-3.5 mr-1.5"}),e?"Clearing…":n?"Done ✓":"Clear Old OneDrive Links"]}),s&&a.jsxs("p",{className:"text-xs text-red-600",children:["⚠️ ",s]})]}),a.jsx("hr",{className:"border-border/60"}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-semibold text-foreground",children:"Step 2 — Remove incorrectly-imported client records"}),a.jsxs("p",{className:"text-sm text-muted-foreground mt-1",children:['During the initial bulk-import, Level-1 estimator group folders (e.g. "Andy Blaski") were incorrectly imported as clients. This tool identifies and removes those records. It does ',a.jsx("strong",{children:"not"})," touch any SharePoint files."]})]}),k&&a.jsxs("div",{className:"flex items-center gap-2 p-3 rounded-xl bg-green-50 border border-green-200 text-sm text-green-800",children:[a.jsx(st,{className:"w-4 h-4 text-green-600 flex-shrink-0"}),"Successfully removed ",k.deleted," incorrectly-imported client record",k.deleted!==1?"s":"","."]}),a.jsxs(ne,{size:"sm",variant:"outline",className:"rounded-lg",onClick:E,disabled:p,children:[p?a.jsx(Me,{className:"w-3.5 h-3.5 mr-1.5 animate-spin"}):a.jsx(Pee,{className:"w-3.5 h-3.5 mr-1.5"}),p?"Scanning…":"Preview Incorrectly-Imported Clients"]}),y&&a.jsxs("p",{className:"text-xs text-red-600",children:["⚠️ ",y]}),f!==null&&a.jsx(ye,{className:"border-border/60 overflow-hidden",children:f.length===0?a.jsxs("div",{className:"p-4 flex items-center gap-2 text-sm text-green-700",children:[a.jsx(st,{className:"w-4 h-4"})," No incorrectly-imported clients found — database looks clean."]}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"p-3 bg-amber-50 border-b border-amber-100 flex items-center gap-2",children:[a.jsx(rn,{className:"w-4 h-4 text-amber-600 flex-shrink-0"}),a.jsxs("p",{className:"text-sm text-amber-800 font-medium",children:[f.length," client record",f.length!==1?"s":""," will be deleted:"]})]}),a.jsx("div",{className:"divide-y divide-border/40",children:f.map(R=>a.jsxs("div",{className:"flex items-center gap-3 px-4 py-2.5",children:[a.jsx(on,{className:"w-3.5 h-3.5 text-red-400 flex-shrink-0"}),a.jsx("span",{className:"text-sm text-foreground flex-1",children:R.name}),a.jsxs("span",{className:"text-xs text-muted-foreground font-mono",children:["ID ",R.id]})]},R.id))}),a.jsxs("div",{className:"p-4 border-t border-border/60 bg-secondary/10 space-y-3",children:[a.jsxs("label",{className:"flex items-start gap-2 cursor-pointer text-sm text-foreground",children:[a.jsx("input",{type:"checkbox",className:"mt-0.5",checked:j,onChange:R=>b(R.target.checked)}),"I confirm I want to permanently delete these ",f.length," client record",f.length!==1?"s":""," from the database."]}),a.jsxs(ne,{size:"sm",variant:"destructive",className:"rounded-lg",disabled:!j||C,onClick:_,children:[C?a.jsx(Me,{className:"w-3.5 h-3.5 mr-1.5 animate-spin"}):a.jsx(on,{className:"w-3.5 h-3.5 mr-1.5"}),C?"Deleting…":`Delete ${f.length} Record${f.length!==1?"s":""}`]}),A&&a.jsxs("p",{className:"text-xs text-red-600",children:["⚠️ ",A]})]})]})})]}),a.jsx("hr",{className:"border-border/60"}),a.jsx(yEe,{})]})}function yEe(){const[e,t]=v.useState(!1),[n,r]=v.useState(null),[s,i]=v.useState(null),l=async()=>{t(!0),i(null),r(null);try{const u=await sn("/api/sharepoint/fix-estimator-groups",{method:"POST"});if(u.error){i(u.error);return}r(u)}catch{i("Request failed. Make sure you are logged in.")}finally{t(!1)}};return a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-semibold text-foreground",children:"Step 3 — Assign clients to estimator folders"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Clients imported before this feature was added don't know 
192which estimator folder they belong to. This reads the SharePoint folder path already stored for each client and fills in that data instantly — no SharePoint scan needed. Run this once so estimators like Andy see their own clients."})]}),n&&a.jsxs("div",{className:"flex items-start gap-2 p-3 rounded-xl bg-green-50 border border-green-200 text-sm text-green-800",children:[a.jsx(st,{className:"w-4 h-4 text-green-600 flex-shrink-0 mt-0.5"}),a.jsxs("div",{children:[n.message?a.jsx("p",{children:n.message}):a.jsxs("p",{className:"font-semibold",children:["Updated ",n.updated.toLocaleString()," of ",n.total.toLocaleString()," clients with their estimator folder."]}),n.updated>0&&a.jsx("p",{className:"text-xs text-green-700 mt-1",children:"Estimators can now see their assigned clients. No further action needed."})]})]}),s&&a.jsxs("p",{className:"text-xs text-red-600",children:["⚠️ ",s]}),a.jsxs(ne,{size:"sm",className:"rounded-lg",disabled:e||!!n,onClick:l,children:[e?a.jsx(Me,{className:"w-3.5 h-3.5 mr-1.5 animate-spin"}):a.jsx(qo,{className:"w-3.5 h-3.5 mr-1.5"}),e?"Fixing…":n?"Done ✓":"Fix Estimator Assignments"]})]})}function vEe(){const[e,t]=v.useState(""),[n,r]=v.useState(!1),[s,i]=v.useState(!0),[l,u]=v.useState(!1),[d,f]=v.useState("");v.useEffect(()=>{sn("/api/settings").then(p=>{t(p.sharepoint_projects_url||""),i(!1)}).catch(()=>i(!1))},[]);const h=async()=>{u(!0),f(""),r(!1);try{const p=await sn("/api/settings",{method:"PATCH",body:JSON.stringify({sharepoint_projects_url:e.trim()})});if(p.error)throw new Error(p.error);r(!0),setTimeout(()=>r(!1),3e3)}catch(p){f(p.message||"Failed to save")}finally{u(!1)}};return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("p",{className:"text-sm text-muted-foreground",children:["Paste the URL of the shared SharePoint ",a.jsx("strong",{children:"Projects"})," library here. New client folders will be created inside it, and folder sync will scan it for existing folders. Personal OneDrive links are not supported. You can change this anytime — no restart needed."]}),d&&a.jsxs("div",{className:"p-3 bg-red-50 border border-red-200 rounded-xl text-red-700 text-sm flex gap-2",children:[a.jsx(rn,{className:"w-4 h-4 shrink-0 mt-0.5"}),a.jsx("span",{children:d})]}),s?a.jsx("div",{className:"h-12 bg-secondary/40 rounded-xl animate-pulse"}):a.jsxs("div",{className:"space-y-3",children:[a.jsx("label",{className:"text-xs font-semibold text-foreground uppercase tracking-wider",children:"Projects Folder URL"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("input",{type:"url",value:e,onChange:p=>t(p.target.value),placeholder:"https://fivestarrainguttersinc.sharepoint.com/sites/Projects/...",className:"flex-1 px-4 py-2.5 text-sm bg-white border-2 border-border focus:border-primary rounded-xl outline-none transition-colors font-mono"}),e&&a.jsxs("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 px-3 py-2.5 bg-secondary hover:bg-secondary/80 border border-border rounded-xl text-xs font-semibold",children:[a.jsx(hm,{className:"w-3.5 h-3.5"})," Test"]})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(ne,{className:"rounded-xl px-5",onClick:h,disabled:l,children:l?a.jsxs(a.Fragment,{children:[a.jsx(Me,{className:"w-4 h-4 animate-spin mr-2"})," Saving…"]}):n?a.jsxs(a.Fragment,{children:[a.jsx(ac,{className:"w-4 h-4 mr-2 text-green-400"})," Saved!"]}):a.jsxs(a.Fragment,{children:[a.jsx(Si,{className:"w-4 h-4 mr-2"})," Save"]})}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Accepts SharePoint document library URLs (",a.jsx("code",{className:"bg-secondary rounded px-1",children:"…sharepoint.com/sites/…"}),") or SharePoint sharing links. Personal OneDrive links are rejected."]})]}),a.jsxs("div",{className:"mt-2 p-3 bg-blue-50 border border-blue-200 rounded-xl text-xs text-blue-700 space-y-1",children:[a.jsx("p",{className:"font-semibold",children:"How to get the URL for a SharePoint library:"}),a.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-blue-600",children:[a.jsxs("li",{children:["Open SharePoint → navigate to the ",a.jsx("strong",{children:"Projects"})," folder (or create one)"]}),a.jsxs("li",{children:["Click ",a.jsx("strong",{children:"Share"})," → ",a.jsx("strong",{children:"Copy link"})," (or copy the browser URL)"]}),a.jsx("li",{children:"Paste it above and click Save"})]})]})]})]})}const uu="https://5stagrp-manager.replit.app",bEe=`{
193  "source": "contact_form",
194  "firstName": "{{1.first_name}}",
195  "lastName": "{{1.last_name}}",
196  "email": "{{1.email}}",
197  "phone": "{{1.phone}}",
198  "message": "{{1.message}}",
199  "priority": "medium"
200}`,jEe=`{
201  "source": "estimate_form",
202  "firstName": "{{1.first_name}}",
203  "lastName": "{{1.last_name}}",
204  "email": "{{1.email}}",
205  "phone": "{{1.phone}}",
206  "address": "{{1.address}}",
207  "city": "{{1.city}}",
208  "state": "{{1.state}}",
209  "zip": "{{1.zip}}",
210  "buildingType": "{{1.building_type}}",
211  "buildingStories": "{{1.stories}}",
212  "gutterStyle": "{{1.gutter_style}}",
213  "gutterColor": "{{1.gutter_color}}",
214  "downspoutStyle": "{{1.downspout_style}}",
215  "downspoutColor": "{{1.downspout_color}}",
216  "notes": "{{1.message}}",
217  "priority": "high"
218}`,wEe="/api/webhooks/lead",NEe="/api/webhooks/estimate",SEe=[{wsForm:"first_name",ourField:"firstName",required:!0,notes:"Also accepts: name, full_name (will auto-split)"},{wsForm:"last_name",ourField:"lastName",required:!0,notes:""},{wsForm:"email",ourField:"email",required:!0,notes:"Also accepts: email_address"},{wsForm:"phone",ourField:"phone",required:!1,notes:"Also accepts: phone_number, mobile, cell"},{wsForm:"message",ourField:"notes",required:!1,notes:"Also accepts: notes, comments"}],CEe=[{wsForm:"first_name",ourField:"firstName",required:!0,notes:""},{wsForm:"last_name",ourField:"lastName",required:!0,notes:""},{wsForm:"email",ourField:"email",required:!0,notes:""},{wsForm:"phone",ourField:"phone",required:!1,notes:""},{wsForm:"address",ourField:"address",required:!1,notes:"Also: street, street_address"},{wsForm:"city",ourField:"city",required:!1,notes:""},{wsForm:"state",ourField:"state",required:!1,notes:""},{wsForm:"zip",ourField:"zip",required:!1,notes:"Also: zip_code, postal_code"},{wsForm:"building_type",ourField:"buildingType",required:!1,notes:"Also: property_type"},{wsForm:"stories",ourField:"buildingStories",required:!1,notes:"Also: building_stories, floors"},{wsForm:"gutter_style",ourField:"gutterStyle",required:!1,notes:"Also: gutter_size"},{wsForm:"gutter_color",ourField:"gutterColor",required:!1,notes:""},{wsForm:"downspout_style",ourField:"downspoutStyle",required:!1,notes:""},{wsForm:"downspout_color",ourField:"downspoutColor",required:!1,notes:""},{wsForm:"message",ourField:"notes",required:!1,notes:"Also: notes, comments"}];function AEe(){const[e,t]=v.useState(null),[n,r]=v.useState(""),[s,i]=v.useState(!1),[l,u]=v.useState(!1),[d,f]=v.useState(!1),[h,p]=v.useState(null),x=()=>
218sn("/api/calendar/google-feed").then(t).catch(()=>t(null));v.useEffect(()=>{x()},[]);const y=async()=>{if(n.trim()){i(!0),p(null);try{const b=await sn("/api/calendar/google-feed",{method:"PUT",body:JSON.stringify({url:n.trim()})});if(b.error)throw new Error(b.error);p({ok:!0,text:`Connected — found ${b.eventCount} event${b.eventCount===1?"":"s"} in the feed. They now appear on the Calendar page.`}),r(""),x()}catch(b){p({ok:!1,text:b.message||"Could not connect the calendar feed."})}finally{i(!1)}}},w=async()=>{if(window.confirm("Copy your Google events (today through 12 months out) into the Outlook calendar? Already-imported events are skipped, so it's safe to run again.")){f(!0),p(null);try{const b=await sn("/api/calendar/google-feed/import",{method:"POST",body:JSON.stringify({})});if(b.error)throw new Error(b.error);const C=[`${b.imported} event${b.imported===1?"":"s"} imported into Outlook`];b.skippedDuplicates&&C.push(`${b.skippedDuplicates} already there (skipped)`),b.failed&&C.push(`${b.failed} failed`),p({ok:b.failed===0,text:`Import finished — ${C.join(", ")}.`})}catch(b){p({ok:!1,text:b.message||"Import failed."})}finally{f(!1)}}},j=async()=>{u(!0),p(null);try{await sn("/api/calendar/google-feed",{method:"DELETE"}),p({ok:!0,text:"Google Calendar feed disconnected."}),x()}finally{u(!1)}};return a.jsxs("div",{className:"space-y-4 text-sm",children:[e?.configured?a.jsxs("div",{className:"flex items-start justify-between gap-3 rounded-lg border border-green-200 bg-green-50 p-3",children:[a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx(st,{className:"w-4 h-4 text-green-600 mt-0.5 shrink-0"}),a.jsxs("div",{children:[a.jsx("p",{className:"font-semibold text-green-800",children:"Google Calendar connected"}),a.jsxs("p",{className:"text-xs text-green-700 mt-0.5",children:["Feed from ",a.jsx("code",{className:"bg-green-100 rounded px-1",children:e.host})," — events show on the Calendar page (teal, dashed border) and refresh about every 5 minutes."]}),a.jsxs("p",{className:"text-xs text-green-700 mt-1",children:["Or use ",a.jsx("span",{className:"font-medium",children:"Import into Outlook"})," to copy the next 12 months of Google events permanently into your Outlook calendar. After importing, you can disconnect the feed."]})]})]}),a.jsxs("div",{className:"flex shrink-0 gap-2",children:[a.jsxs(ne,{size:"sm",onClick:w,disabled:d,"data-testid":"button-import-google-feed",children:[d?a.jsx(Me,{className:"w-4 h-4 animate-spin mr-1"}):null,d?"Importing…":"Import into Outlook"]}),a.jsx(ne,{variant:"outline",size:"sm",onClick:j,disabled:l,"data-testid":"button-remove-google-feed",children:l?a.jsx(Me,{className:"w-4 h-4 animate-spin"}):"Disconnect"})]})]}):a.jsx("p",{className:"text-muted-foreground",children:"Show a Google Calendar alongside your Outlook events on the Calendar page. Events stay in Google and update automatically (read-only)."}),a.jsxs("div",{className:"rounded-lg border bg-secondary/40 p-3 text-xs text-muted-foreground space-y-1",children:[a.jsx("p",{className:"font-semibold text-foreground",children:"How to get your secret iCal link:"}),a.jsxs("p",{children:["1. Open ",a.jsx("span",{className:"font-medium",children:"Google Calendar"})," on the web → hover your calendar in the left sidebar → ⋮ → ",a.jsx("span",{className:"font-medium",children:"Settings and sharing"}),"."]}),a.jsxs("p",{children:["2. Scroll to ",a.jsx("span",{className:"font-medium",children:"Integrate calendar"})," and copy the ",a.jsx("span",{className:"font-medium",children:'"Secret address in iCal format"'})," (ends in ",a.jsx("code",{children:".ics"}),")."]}),a.jsx("p",{children:"3. Paste it below. Keep this link private — anyone with it can read the calendar."})]}),a.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[a.jsx("input",{type:"url",value:n,onChange:b=>r(b.target.value),placeholder:"https://calendar.google.com/calendar/ical/…/basic.ics",className:"flex-1 rounded-md border border-input bg-background px-3 py-2 text-sm","data-testid":"input-google-ics-url"}),a.jsxs(ne,{onClick:y,disabled:s||!n.trim(),"data-testid":"button-save-google-feed",children:[s?a.jsx(Me,{className:"w-4 h-4 animate-spin mr-1"}):a.jsx(dT,{className:"w-4 h-4 mr-1"}),e?.configured?"Replace feed":"Connect"]})]}),h&&a.jsx("div",{className:`rounded-lg border p-3 text-xs ${h.ok?"border-green-200 bg-green-50 text-green-800":"border-red-200 bg-red-50 text-red-800"}`,"data-testid":"text-google-feed-message",children:h.text})]})}function TEe(){return a.jsxs("div",{className:"space-y-6 max-w-4xl",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-3xl font-display font-bold text-foreground",children:"Integrations"}),a.jsx("p",{className:"text-muted-foreground mt-1",children:"Microsoft 365, SharePoint, Make.com webhooks, and system health for Five Star Rain Gutters."})]}),a.jsx(uEe,{}),a.jsx(ea,{title:"Microsoft 365 Connection",icon:a.jsx(Zy,{}),children:a.jsx(dEe,{})}),a.jsx(ea,{title:"SharePoint / OneDrive Configuration",icon:a.jsx(yr,{className:"w-5 h-5"}),children:a.jsx(vEe,{})}),a.jsx(ea,{title:"Google Calendar — Show Alongside Outlook",icon:a.jsx(Ma,{className:"w-5 h-5 text-teal-600"}),defaultOpen:!1,children:a.jsx(AEe,{})}),a.jsx(ea,{title:"Folder Link Audit — Find Broken Client Links",icon:a.jsx(Hq,{className:"w-5 h-5 text-amber-500"}),defaultOpen:!1,children:a.jsx(xEe,{})}),a.jsx(ea,{title:"Unfiled Items — Loose Files & Misplaced Folders",icon:a.jsx(Lq,{className:"w-5 h-5 text-amber-500"}),defaultOpen:!1,children:a.jsx(hEe,{})}),a.jsx(ea,{title:"SharePoint Cleanup — Remove Incorrectly-Imported Clients",icon:a.jsx(on,{className:"w-5 h-5 text-red-500"}),defaultOpen:!1,children:a.jsx(gEe,{})}),a.jsxs(ye,{className:"p-4 border-blue-200 bg-blue-50/50 flex items-start gap-3",children:[a.jsx(em,{className:"w-5 h-5 text-blue-600 flex-shrink-0 mt-0.5"}),a.jsxs("div",{className:"text-sm",children:[a.jsx("p",{className:"font-semibold text-blue-800",children:"Production webhook base URL"}),a.jsxs("p",{className:"text-blue-700 mt-0.5",children:["All webhook URLs below use your live deployment at"," ",a.jsx("code",{className:"bg-blue-100 rounded px-1 font-mono",children:uu}),". Use these exact URLs in Make.com."]})]})]}),a.jsxs(ea,{title:"Webhook Endpoints",icon:a.jsx(B2,{className:"w-5 h-5"}),children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"These are the two 
218URLs you will use in Make.com as the HTTP POST destination. Both accept the same field names — the estimate endpoint always marks leads as high priority."}),a.jsx("div",{className:"space-y-3",children:[{label:"Contact Form",url:wEe,badge:"source: contact_form",color:"bg-blue-100 text-blue-700"},{label:"Estimate Form",url:NEe,badge:"source: estimate_form • priority: high",color:"bg-green-100 text-green-700"}].map(e=>a.jsxs("div",{className:"flex items-center gap-3 bg-secondary/40 rounded-xl p-4 border border-border",children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[a.jsx("span",{className:"font-semibold text-sm text-foreground",children:e.label}),a.jsx("span",{className:`text-[10px] px-2 py-0.5 rounded-full font-bold ${e.color}`,children:e.badge})]}),a.jsxs("code",{className:"text-xs font-mono text-muted-foreground break-all",children:[uu,e.url]})]}),a.jsx(WA,{text:uu+e.url})]},e.label))}),a.jsxs("div",{className:"text-sm text-muted-foreground bg-secondary/30 rounded-lg p-4 border border-border/50",children:[a.jsx("p",{className:"font-semibold text-foreground mb-1",children:"Optional security"}),a.jsxs("p",{children:["Set the ",a.jsx("code",{className:"bg-secondary rounded px-1",children:"WEBHOOK_SECRET"})," environment variable in Replit Secrets. Then add ",a.jsx("code",{className:"bg-secondary rounded px-1",children:'"secret": "your-secret"'})," to every Make.com request body — our server will reject calls without it."]})]})]}),a.jsx(ea,{title:"Scenario 1 — Contact Form",icon:a.jsx(em,{className:"w-5 h-5"}),children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(Cl,{n:1}),a.jsxs("div",{children:[a.jsx("p",{className:"font-semibold text-sm text-foreground",children:"Trigger: WS Form → Watch Form Submissions"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Select your contact form from the dropdown in the WS Form Make.com module."})]})]}),a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(Cl,{n:2}),a.jsxs("div",{className:"flex-1",children:[a.jsx("p",{className:"font-semibold text-sm text-foreground mb-2",children:"Action: HTTP → Make a Request"}),a.jsxs("div",{className:"bg-secondary/40 rounded-lg p-3 text-xs font-mono space-y-1 border border-border mb-3",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"URL:"})," ",a.jsxs("span",{children:[uu,"/api/webhooks/lead"]})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"Method:"})," ",a.jsx("span",{children:"POST"})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"Body type:"})," ",a.jsx("span",{children:"Raw (JSON)"})]})]}),a.jsxs("p",{className:"text-xs text-muted-foreground font-semibold mb-2",children:["Request body — replace ",a.jsx("code",{className:"bg-secondary rounded px-1",children:"{{1.field_name}}"})," with your actual WS Form field variable names:"]}),a.jsx(gF,{code:bEe})]})]}),a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(Cl,{n:3}),a.jsxs("div",{className:"flex-1",children:[a.jsx("p",{className:"font-semibold text-sm text-foreground mb-1",children:"Optional: Send auto-reply email (Microsoft Outlook module)"}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:['Add an Outlook "Send an Email" module after step 2. To: ',a.jsx("code",{className:"bg-secondary rounded px-1",children:"{{1.email}}"}),'. Subject: "Thanks for contacting Five Star Rain Gutters".']})]})]})]})}),a.jsx(ea,{title:"Scenario 2 — Request for Free Estimate Form",icon:a.jsx(Ej,{className:"w-5 h-5"}),children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(Cl,{n:1}),a.jsxs("div",{children:[a.jsx("p",{className:"font-semibold text-sm text-foreground",children:"Trigger: WS Form → Watch Form Submissions"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:'Select your "Request for Free Estimate" form. This is a separate scenario from the contact form so you can add more steps.'})]})]}),a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(Cl,{n:2}),a.jsxs("div",{className:"flex-1",children:[a.jsx("p",{className:"font-semibold text-sm text-foreground mb-2",children:"Action: HTTP → Make a Request (create lead)"}),a.jsxs("div",{className:"bg-secondary/40 rounded-lg p-3 text-xs font-mono space-y-1 border border-border mb-3",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"URL:"})," ",a.jsxs("span",{children:[uu,"/api/webhooks/estimate"]})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"Method:"})," ",a.jsx("span",{children:"POST"})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"Body type:"})," ",a.jsx("span",{children:"Raw (JSON)"})]})]}),a.jsx(gF,{code:jEe})]})]}),a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(Cl,{n:3}),a.jsxs("div",{className:"flex-1",children:[a.jsx("p",{className:"font-semibold text-sm text-foreground mb-1",children:"Action: HTTP → Make a Request (create SharePoint folder)"}),a.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"Creates the client's project folder directly in the shared SharePoint Projects library. The folder link appears on the client's profile immediately."}),a.jsxs("div",{className:"bg-secondary/40 rounded-lg p-3 text-xs font-mono space-y-1 border border-border mb-3",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"URL:"})," ",a.jsxs("span",{children:[uu,"/api/sharepoint/create-folder/",a.jsx("b",{children:"{{2.clientId}}"})]})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"Note:"})," ",a.jsx("span",{children:"Use the clientId returned from Step 2 response body"})]})]})]})]}),a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(Cl,{n:4}),a.jsxs("div",{children:[a.jsx("p",{className:"font-semibold text-sm text-foreground",children:"Optional: Send confirmation email to prospect + internal notification"}),a.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:["Outlook → Send an Email · To: ",a.jsx("code",{className:"bg-secondary rounded px-1",children:"{{1.email}}"}),' · Subject: "We received your estimate request — Five Star Rain Gutters"',a.jsx("br",{}),"Then another Outlook module to notify your team at [email protected]."]})]})]})]})}),a.jsxs(ea,{title:"Field Mapping — Contact Form",icon:a.jsx(em,{className:"w-5 h-5"}),defaultOpen:!1,children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"Replace the WS Form field slug column with your actual field slugs from WS Form → Form Settings → Fields. The system accepts both camelCase and snake_case automatically."}),a.jsx("div",{className:"overflow-x-auto rounded-xl border border-border",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{className:"bg-secondary/60 text-xs text-muted-foreground uppercase font-semibold",children:a.jsxs("tr",{children:[a.jsx("th",{className:"px-4 py-3 text-left",children:"WS Form Field Slug"}),a.jsx("th",{className:"px-4 py-3 text-left",children:"Our Field Name"}),a.jsx("th",{className:"px-4 py-3 text-left",children:"Required"}),a.jsx("th",{className:"px-4 py-3 text-left",children:"Accepted Variations"})]})}),a.jsx("tbody",{className:"divide-y divide-border",children:SEe.map(e=>a.jsxs("tr",{className:"hover:bg-secondary/20",children:[a.jsx("td",{className:"px-4 py-3 font-mono text-xs text-blue-700 bg-blue-50/50",children:e.wsForm}),a.jsx("td",{className:"px-4 py-3 font-mono text-xs text-green-700",children:e.ourField}),a.jsx("td",{className:"px-4 py-3",children:e.required?a.jsx("span",{className:"text-[10px] font-bold px-2 py-0.5 bg-red-100 text-red-700 rounded-full",children:"Required"}):a.jsx("span",{className:"text-[10px] font-bold px-2 py-0.5 bg-secondary text-muted-foreground rounded-full",children:"Optional"})}),a.jsx("td",{className:"px-4 py-3 text-xs text-muted-foreground",children:e.notes})]},e.wsForm))})]})})]}),a.jsxs(ea,{title:"Field Mapping — Estimate Form",icon:a.jsx(Ej,{className:"w-5 h-5"}),defaultOpen:!1,children:[a.jsxs("p",{className:"text-sm text-muted-foreground",children:["The estimate form sends all the same contact fields plus gutter-specific details. Every estimate lead is automatically set to ",a.jsx("span",{className:"font-semibold text-foreground",children:"high priority"}),"."]}),a.jsx("div",{className:"overflow-x-auto rounded-xl border border-border",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{className:"bg-secondary/60 text-xs text-muted-foreground uppercase font-semibold",children:a.jsxs("tr",{children:[a.jsx("th",{className:"px-4 py-3 text-left",children:"WS Form Field Slug"}),a.jsx("th",{className:"px-4 py-3 text-left",children:"Our Field Name"}),a.jsx("th",{className:"px-4 py-3 text-left",children:"Required"}),a.jsx("th",{className:"px-4 py-3 text-left",children:"Notes"})]})}),a.jsx("tbody",{className:"divide-y divide-border",children:CEe.map(e=>a.jsxs("tr",{className:"hover:bg-secondary/20",children:[a.jsx("td",{className:"px-4 py-3 font-mono text-xs text-blue-700 bg-blue-50/50",children:e.wsForm}),a.jsx("td",{className:"px-4 py-3 font-mono text-xs text-green-700",children:e.ourField}),a.jsx("td",{className:"px-4 py-3",children:e.required?a.jsx("span",{className:"text-[10px] font-bold px-2 py-0.5 bg-red-100 text-red-700 rounded-full",children:"Required"}):a.jsx("span",{className:"text-[10px] font-bold px-2 py-0.5 bg-secondary text-muted-foreground rounded-full",children:"Optional"})}),a.jsx("td",{className:"px-4 py-3 text-xs text-muted-foreground",children:e.notes})]},e.wsForm))})]})})]}),a.jsxs(ea,{title:"Full Automation Flow (Estimate Form)",icon:a.jsx(st,{className:"w-5 h-5"}),defaultOpen:!1,children:[a.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"When fully set up, a single form submission on your website triggers this entire chain automatically — no manual steps needed."}),a.jsx("div",{className:"relative",children:[{icon:a.jsx(em,{className:"w-4 h-4"}),color:"bg-blue-100 text-blue-700",label:"Visitor submits estimate form",sub:"fivestarraingutters.com"},{icon:a.jsx(Ej,{className:"w-4 h-4"}),color:"bg-violet-100 text-violet-700",label:"Make.com scenario triggers",sub:"WS Form → Watch Form Submissions"},{icon:a.jsx(B2,{className:"w-4 h-4"}),color:"bg-primary/10 text-primary",label:"Lead created in this system",sub:"POST /api/webhooks/estimate → appears in Leads Pipeline"},{icon:a.jsx(yr,{className:"w-4 h-4"}
218),color:"bg-amber-100 text-amber-700",label:"SharePoint folder created",sub:"Shared Projects library → folder named 'FirstName LastName - Address - City - Zip'"},{icon:a.jsx($r,{className:"w-4 h-4"}),color:"bg-green-100 text-green-700",label:"Auto-reply sent to prospect",sub:"Outlook → confirmation email"},{icon:a.jsx(QZ,{className:"w-4 h-4"}),color:"bg-red-100 text-red-700",label:"Internal notification sent",sub:"Outlook → [email protected] notified of new estimate request"}].map((e,t)=>a.jsxs("div",{className:"flex items-start gap-4 relative",children:[t<5&&a.jsx("div",{className:"absolute left-5 top-10 w-0.5 h-8 bg-border"}),a.jsx("div",{className:`w-10 h-10 rounded-full flex items-center justify-center flex-shrink-0 ${e.color}`,children:e.icon}),a.jsxs("div",{className:"pb-8",children:[a.jsx("p",{className:"font-semibold text-sm text-foreground",children:e.label}),a.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:e.sub})]})]},t))})]}),a.jsxs(ea,{title:"Environment Variables",icon:a.jsx(zq,{className:"w-5 h-5"}),defaultOpen:!1,children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"Set these in Replit Secrets (the lock icon in your project sidebar)."}),a.jsx("div",{className:"space-y-2",children:[{key:"JWT_SECRET",desc:"Required for security — set to a long random string (50+ characters). Signs all login tokens. The current default value is insecure and publicly known.",required:!0,critical:!0},{key:"WEBHOOK_SECRET",desc:"Optional shared secret — add to every Make.com request body as 'secret'. Rejects calls without it.",required:!1},{key:"MICROSOFT_SHAREPOINT_DRIVE_ID",desc:"Optional — the SharePoint document library drive ID. Setting this permanently speeds up all SharePoint operations (skips drive discovery on every call). Find it by running a folder creation from the client profile, then check server logs for the resolved drive ID.",required:!1},{key:"API_BASE_URL",desc:"Your deployed Replit URL (e.g. https://5stagrp-manager.replit.app). Used in OAuth redirect URIs and email links. Already set.",required:!1}].map(e=>a.jsxs("div",{className:`flex items-start gap-3 rounded-lg p-3 border ${e.critical?"bg-red-50/60 border-red-200":"bg-secondary/40 border-border"}`,children:[a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[a.jsx("code",{className:`text-xs font-mono font-bold ${e.critical?"text-red-700":"text-foreground"}`,children:e.key}),!e.required&&a.jsx("span",{className:"text-[10px] px-2 py-0.5 bg-secondary rounded-full text-muted-foreground font-semibold",children:"Optional"}),e.critical&&a.jsx("span",{className:"text-[10px] px-2 py-0.5 bg-red-100 text-red-700 rounded-full font-bold",children:"Security Risk"})]}),a.jsx("p",{className:`text-xs mt-1 ${e.critical?"text-red-600":"text-muted-foreground"}`,children:e.desc})]}),a.jsx(WA,{text:e.key,label:"Copy key"})]},e.key))})]})]})}function kEe(e){const t=localStorage.getItem("fs_team_token");return fetch(e,{headers:{"Content-Type":"application/json",...t?{Authorization:`Bearer ${t}`}:{}}})}function OEe(){const{data:e,isLoading:t,isError:n}=Xe({queryKey:["/api/email-templates/previews"],queryFn:async()=>{const u=await kEe("/api/email-templates/previews");if(!u.ok)throw new Error("Failed to load email templates");return(await u.json()).previews},staleTime:3e5}),[r,s]=v.useState(null),i=e??[],l=i.find(u=>u.id===r)??i[0]??null;return t?a.jsxs("div",{className:"flex items-center justify-center py-24 text-muted-foreground",children:[a.jsx(Me,{className:"w-6 h-6 animate-spin mr-3"}),"Rendering email templates…"]}):n?a.jsxs("div",{className:"flex flex-col items-center justify-center py-24 text-center",children:[a.jsx(rn,{className:"w-8 h-8 text-destructive mb-3"}),a.jsx("p",{className:"font-medium text-foreground",children:"Couldn't load the email templates"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Please refresh the page and try again."})]}):a.jsxs("div",{className:"space-y-6",children:[a.jsx("div",{children:a.jsx("p",{className:"text-sm text-muted-foreground max-w-2xl",children:"Live previews of every automated email, rendered with your current company profile and sample data. These are exactly what your clients (and your team) receive."})}),a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-[300px_1fr] gap-6",children:[a.jsx("div",{className:"space-y-2",children:i.map(u=>{const d=l?.id===u.id;return a.jsx("button",{onClick:()=>s(u.id),className:`w-full text-left rounded-xl border p-4 transition-all duration-200 ${d?"border-primary bg-primary/5 shadow-sm":"border-border bg-white hover:border-primary/40 hover:bg-muted/40"}`,children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:`mt-0.5 w-8 h-8 rounded-lg flex items-center justify-center shrink-0 ${d?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground"}`,children:a.jsx($r,{className:"w-4 h-4"})}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"font-semibold text-sm text-foreground",children:u.label}),a.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 leading-snug",children:u.description})]})]})},u.id)})}),l&&a.jsxs("div",{className:"rounded-xl border border-border bg-white overflow-hidden flex flex-col",children:[a.jsxs("div",{className:"border-b border-border px-5 py-3 bg-muted/30",children:[a.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Subject"}),a.jsx("p",{className:"text-sm font-semibold text-foreground mt-0.5 break-words",children:l.subject})]}),a.jsx("iframe",{title:l.label,srcDoc:l.html,className:"w-full bg-[#f4f4f5]",style:{height:"75vh",border:"none"},sandbox:""},l.id)]})]})]})}const Jy=async(e,t)=>{const n=localStorage.getItem("fs_team_token"),r=await fetch(e,{...t,headers:{Authorization:`Bearer ${n}`,"Content-Type":"application/json",...t?.headers||{}}}),s=await r.text();try{return{ok:r.ok,status:r.status,data:JSON.parse(s)}}catch{return{ok:!1,status:r.status,data:{error:`Server error (HTTP ${r.status})`}}}},ev={admin:{label:"Admin",color:"bg-purple-100 text-purple-700 border-purple-200",icon:yd},manager:{label:"Manager",color:"bg-blue-100 text-blue-700 border-blue-200",icon:Pte},estimator:{label:"Estimator",color:"bg-green-100 text-green-700 border-green-200",icon:Ai}
218,field_tech:{label:"Field Tech",color:"bg-amber-100 text-amber-700 border-amber-200",icon:Du},shop_technician:{label:"Shop Tech",color:"bg-orange-100 text-orange-700 border-orange-200",icon:Du}};function yF({role:e}){const t=ev[e]||ev.estimator,n=t.icon;return a.jsxs("span",{className:`inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-semibold border ${t.color}`,children:[a.jsx(n,{className:"w-3 h-3"}),t.label]})}const PEe={name:"",email:"",phone:"",license:"",role:"estimator",password:"",confirmPassword:"",canManageInventory:!1,draftReminderOptIn:!1},NK=["admin","manager","estimator"];function EEe({member:e,onClose:t,onSaved:n}){const r=!!e,[s,i]=v.useState(r?{name:e.name,email:e.email,phone:e.phone||"",license:e.license||"",role:e.role,password:"",confirmPassword:"",canManageInventory:e.canManageInventory,draftReminderOptIn:e.draftReminderOptIn??!1}:{...PEe}),[l,u]=v.useState(!1),[d,f]=v.useState(""),[h,p]=v.useState(!1),x=(j,b)=>i(C=>({...C,[j]:b})),y=(j,b)=>i(C=>({...C,[j]:b})),w=async j=>{if(j.preventDefault(),f(""),!s.name.trim()||!s.email.trim()||!s.role){f("Name, email, and role are required.");return}if(!r&&!s.password){f("A password is required for new members.");return}if(s.password&&s.password!==s.confirmPassword){f("Passwords do not match.");return}const b={name:s.name.trim(),email:s.email.trim(),phone:s.phone.trim(),license:s.license.trim(),role:s.role,canManageInventory:s.canManageInventory,draftReminderOptIn:s.draftReminderOptIn};s.password&&(b.password=s.password),u(!0);const C=r?`/api/team/${e.id}`:"/api/team",k=await Jy(C,{method:r?"PATCH":"POST",body:JSON.stringify(b)});if(u(!1),!k.ok){f(k.data.error||"Save failed. Please try again.");return}n(k.data)};return a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm p-4",children:a.jsxs("div",{className:"bg-white rounded-2xl shadow-2xl w-full max-w-md",children:[a.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-border",children:[a.jsx("h2",{className:"text-xl font-bold font-display",children:r?`Edit ${e.name}`:"Add Team Member"}),a.jsx("button",{onClick:t,className:"text-muted-foreground hover:text-foreground transition-colors",children:a.jsx(an,{className:"w-5 h-5"})})]}),a.jsxs("form",{onSubmit:w,className:"p-6 space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{className:"col-span-2",children:[a.jsx("label",{className:"text-sm font-semibold text-muted-foreground block mb-1",children:"Full Name *"}),a.jsx("input",{type:"text",required:!0,value:s.name,onChange:j=>x("name",j.target.value),className:"w-full p-2.5 border border-border rounded-lg outline-none focus:border-primary text-sm",placeholder:"e.g. Andy Balski"})]}),a.jsxs("div",{className:"col-span-2",children:[a.jsx("label",{className:"text-sm font-semibold text-muted-foreground block mb-1",children:"Email Address *"}),a.jsx("input",{type:"email",required:!0,value:s.email,onChange:j=>x("email",j.target.value),className:"w-full p-2.5 border border-border rounded-lg outline-none focus:border-primary text-sm",placeholder:"[email protected]"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-semibold text-muted-foreground block mb-1",children:"Phone"}),a.jsx("input",{type:"tel",value:s.phone,onChange:j=>x("phone",j.target.value),className:"w-full p-2.5 border border-border rounded-lg outline-none focus:border-primary text-sm",placeholder:"(805) 555-1234"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-semibold text-muted-foreground block mb-1",children:"Role *"}),a.jsxs("select",{required:!0,value:s.role,onChange:j=>x("role",j.target.value),className:"w-full p-2.5 border border-border rounded-lg outline-none focus:border-primary text-sm bg-white",children:[a.jsx("option",{value:"admin",children:"Admin"}),a.jsx("option",{value:"manager",children:"Manager"}),a.jsx("option",{value:"estimator",children:"Estimator"}),a.jsx("option",{value:"field_tech",children:"Field Tech"}),a.jsx("option",{value:"shop_technician",children:"Shop Technician"})]})]}),NK.includes(s.role)&&a.jsxs("div",{className:"col-span-2",children:[a.jsxs("label",{className:"text-sm font-semibold text-muted-foreground block mb-1",children:["License # ",a.jsx("span",{className:"font-normal text-muted-foreground
218/70",children:"(shown on proposals)"})]}),a.jsx("input",{type:"text",value:s.license,onChange:j=>x("license",j.target.value),className:"w-full p-2.5 border border-border rounded-lg outline-none focus:border-primary text-sm",placeholder:"e.g. 876930"})]})]}),a.jsxs("div",{className:"border-t border-border pt-4",children:[a.jsx("p",{className:"text-xs font-semibold text-muted-foreground mb-3 uppercase tracking-wider",children:"Permissions"}),a.jsxs("label",{className:"flex items-center gap-3 cursor-pointer select-none",children:[a.jsx("div",{onClick:()=>y("canManageInventory",!s.canManageInventory),className:`relative w-10 h-6 rounded-full transition-colors ${s.canManageInventory?"bg-primary":"bg-muted-foreground/30"}`,children:a.jsx("span",{className:`absolute top-1 left-1 w-4 h-4 rounded-full bg-white shadow transition-transform ${s.canManageInventory?"translate-x-4":"translate-x-0"}`})}),a.jsxs("div",{children:[a.jsx("span",{className:"text-sm font-medium text-foreground",children:"Inventory Manager"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Can add/edit products, adjust stock, and run CSV imports"})]})]}),a.jsxs("label",{className:"flex items-center gap-3 cursor-pointer select-none mt-3",children:[a.jsx("div",{onClick:()=>y("draftReminderOptIn",!s.draftReminderOptIn),className:`relative w-10 h-6 rounded-full transition-colors ${s.draftReminderOptIn?"bg-primary":"bg-muted-foreground/30"}`,"data-testid":"toggle-draft-reminders",children:a.jsx("span",{className:`absolute top-1 left-1 w-4 h-4 rounded-full bg-white shadow transition-transform ${s.draftReminderOptIn?"translate-x-4":"translate-x-0"}`})}),a.jsxs("div",{children:[a.jsx("span",{className:"text-sm font-medium text-foreground",children:"Draft Quote Reminders"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Nightly email nudge when their draft quotes sit untouched for 3+ days"})]})]})]}),a.jsxs("div",{className:"border-t border-border pt-4",children:[a.jsx("p",{className:"text-xs font-semibold text-muted-foreground mb-3 uppercase tracking-wider",children:r?"Reset Password (leave blank to keep current)":"Set Password *"}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"relative",children:[a.jsx("label",{className:"text-sm font-semibold text-muted-foreground block mb-1",children:r?"New Password":"Password *"}),a.jsx("input",{type:h?"text":"password",value:s.password,onChange:j=>x("password",j.target.value),className:"w-full p-2.5 pr-10 border border-border rounded-lg outline-none focus:border-primary text-sm",placeholder:r?"Leave blank to keep current":"Min 8 characters"}),a.jsx("button",{type:"button",onClick:()=>p(j=>!j),className:"absolute right-3 top-8 text-muted-foreground hover:text-foreground",children:h?a.jsx(Iq,{className:"w-4 h-4"}):a.jsx(zJ,{className:"w-4 h-4"})})]}),s.password&&a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-semibold text-muted-foreground block mb-1",children:"Confirm Password"}),a.jsx("input",{type:h?"text":"password",value:s.confirmPassword,onChange:j=>x("confirmPassword",j.target.value),className:"w-full p-2.5 border border-border rounded-lg outline-none focus:border-primary text-sm",placeholder:"Re-enter password"})]})]})]}),d&&a.jsxs("div",{className:"flex items-center gap-2 p-3 bg-red-50 border border-red-200 rounded-lg text-sm text-red-700",children:[a.jsx(rn,{className:"w-4 h-4 flex-shrink-0"}),d]}),a.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[a.jsx(ne,{type:"button",variant:"outline",className:"rounded-xl",onClick:t,children:"Cancel"}),a.jsxs(ne,{type:"submit",className:"rounded-xl",disabled:l,children:[l?a.jsx(Me,{className:"w-4 h-4 mr-2 animate-spin"}):null,r?"Save Changes":"Add Member"]})]})]})]})})}function _Ee({member:e,members:t,onClose:n,onDeleted:r}){const[s,i]=v.useState(""),[l,u]=v.useState(!1),[d,f]=v.useState(""),[h,p]=v.useState(!1),[x,y]=v.useState(0),w=t.filter(b=>b.id!==e.id&&b.active!==!1),j=async()=>{u(!0),f("");const b={};s&&(b.reassignToId=Number(s));const C=await Jy(`/api/team/${e.id}`,{method:"DELETE",body:JSON.stringify(b)});if(u(!1),C.ok){r(e.id);return}if(C.status===400&&C.data?.error==="reassign_required"){p(!0),y(C.data?.refCount||0),f("");return}f(C.data?.error||"Failed to delete member.")};return a.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[a.jsx("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-sm",onClick:n}
218),a.jsxs(ye,{className:"relative z-10 w-full max-w-md shadow-2xl border-border/60",children:[a.jsxs("div",{className:"flex items-start gap-3 p-5 border-b border-border",children:[a.jsx("div",{className:"w-10 h-10 rounded-full bg-red-100 flex items-center justify-center shrink-0",children:a.jsx(Kt,{className:"w-5 h-5 text-red-600"})}),a.jsxs("div",{children:[a.jsxs("h2",{className:"text-lg font-display font-bold text-foreground",children:["Delete ",e.name,"?"]}),a.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"This permanently removes the member. This cannot be undone."})]})]}),a.jsxs("div",{className:"p-5 space-y-4",children:[h&&a.jsxs("div",{className:"text-sm text-amber-700 bg-amber-50 border border-amber-200 rounded-lg p-3",children:["This member is referenced by ",x," record",x===1?"":"s"," (leads, quotes, jobs, inventory activity, etc.). Choose another member to inherit those records before deleting."]}),a.jsxs("div",{children:[a.jsxs("label",{className:"block text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1.5",children:["Reassign their records to ",h?"(required)":"(optional)"]}),a.jsxs("select",{className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm",value:s,onChange:b=>i(b.target.value),children:[a.jsx("option",{value:"",children:"— Keep none / no records —"}),w.map(b=>a.jsxs("option",{value:b.id,children:[b.name," (",ev[b.role]?.label||b.role,")"]},b.id))]}),a.jsxs("p",{className:"text-xs text-muted-foreground mt-1.5",children:["All leads, quotes, jobs, and activity attributed to ",e.name," will be transferred to the chosen member."]})]}),d&&a.jsx("p",{className:"text-sm text-red-600",children:d})]}),a.jsxs("div",{className:"flex justify-end gap-2 p-5 border-t border-border",children:[a.jsx(ne,{variant:"outline",className:"rounded-lg",onClick:n,disabled:l,children:"Cancel"}),a.jsx(ne,{className:"rounded-lg bg-red-600 hover:bg-red-700 text-white",onClick:j,disabled:l||h&&!s,children:l?a.jsx(Me,{className:"w-4 h-4 animate-spin"}):"Delete permanently"})]})]})]})}const MEe=[{key:"name",label:"Business Name",placeholder:"Five Star Rain Gutters"},{key:"license",label:"License # (digits only)",placeholder:"876930"},{key:"serviceArea",label:"Service Area",placeholder:"Central Coast, CA"},{key:"phone",label:"Phone",placeholder:"+1.805.461.3283"},{key:"email",label:"Contact Email",placeholder:"[email protected]"},{key:"website",label:"Website",placeholder:"https://fivestarraingutters.com"},{key:"address",label:"Address (optional)",placeholder:"123 Main St, City, CA"},{key:"logoUrl",label:"Logo URL (optional override)",placeholder:"Leave blank to use the default logo"}];function REe(){const{profile:e,isLoading:t}=uk(),n=wt(),[r,s]=v.useState(null),[i,l]=v.useState(!1),[u,d]=v.useState(!1),[f,h]=v.useState(null);v.useEffect(()=>{t||s(e)},[t]);const p=(y,w)=>{s(j=>j&&{...j,[y]:w}),d(!1)},x=async()=>{if(r){l(!0),h(null);try{const y=await cfe(r);n.setQueryData(["/api/company-profile"],y),s(y),d(!0)}catch(y){h(y.message||"Failed to save company profile.")}finally{l(!1)}}};return a.jsxs(ye,{className:"border-border/60 shadow-sm overflow-hidden",children:[a.jsxs("div",{className:"px-6 py-4 border-b border-border bg-secondary/30 flex items-center gap-2",children:[a.jsx(xd,{className:"w-4 h-4 text-muted-foreground"}),a.jsx("h2",{className:"font-semibold text-foreground",children:"Company Profile"})]}),a.jsxs("div",{className:"p-6 space-y-4",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"These details appear on proposals, contracts, the quote PDF, and client emails."}),f&&a.jsxs("div",{className:"p-3 bg-red-50 border border-red-200 rounded-xl text-red-700 text-sm flex gap-2",children:[a.jsx(Kt,{className:"w-4 h-4 mt-0.5 flex-shrink-0"}),a.jsx("span",{children:f})]}),a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:MEe.map(y=>a.jsxs("div",{className:y.key==="address"||y.key==="logoUrl"?"sm:col-span-2":"",children:[a.jsx("label",{className:"block text-xs font-semibold text-muted-foreground mb-1",children:y.label}),a.jsx("input",{type:"text",value:r?.[y.key]??"",onChange:w=>p(y.key,w.target.value),placeholder:y.placeholder,disabled:!r,className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background outline-none focus:border-primary transition-colors disabled:opacity-50"})]},y.key))}),a.jsxs("div",{className:"flex items-center justify-end gap-3",children:[u&&a.jsxs("span",{className:"text-sm text-green-600 flex items-center gap-1",children:[a.jsx(st,{className:"w-4 h-4"}),"Saved"]}),a.jsx(ne,{className:"rounded-xl px-6",onClick:x,disabled:i||!r,children:i?a.jsxs(a.Fragment,{children:[a.jsx(Me,{className:"w-4 h-4 animate-spin mr-2"}),"Saving…"]}):"Save Profile"})]})]})]})}function DEe(){const{teamMember:e}=Nn(),t=e?.role==="admin",[n,r]=v.useState([]),[s,i]=v.useState(!0),[l,u]=v.useState(""),[d,f]=v.useState(null),[h,p]=v.useState(null),[x,y]=v.useState(null),w=v.useCallback(async()=>{i(!0);const T=await Jy("/api/team");if(i(!1),!T.ok){u("Failed to load team members.");return}r(T.data)},[]);v.useEffect(()=>{w()},[w]);const j=T=>{r(A=>{const P=A.findIndex(E=>E.id===T.id);if(P>=0){const E=[...A];return E[P]=T,E}return[...A,T]}),f(null)},b=async T=>{p(T.id);const A=await Jy(`/api/team/${T.id}`,{method:"PATCH",body:JSON.stringify({active:!T.active})});p(null),A.ok&&j(A.data)},C=T=>{r(A=>A.filter(P=>P.id!==T)),y(null)};if(s)return a.jsx("div",{className:"p-8 flex justify-center",children:a.jsx("div",{className:"animate-spin h-8 w-8 border-4 border-primary border-t-transparent roun
218ded-full"})});if(l)return a.jsxs("div",{className:"p-8 text-center text-red-600",children:[a.jsx(rn,{className:"w-10 h-10 mx-auto mb-2 opacity-60"}),a.jsx("p",{children:l})]});const N=n.filter(T=>T.active),k=n.filter(T=>!T.active);return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-3xl font-display font-bold text-foreground",children:"Team"}),a.jsx("p",{className:"text-muted-foreground mt-1",children:"Manage team members, roles, and access"})]}),a.jsxs(ne,{className:"rounded-xl px-6 shadow-lg shadow-primary/20",onClick:()=>f("new"),children:[a.jsx(Ft,{className:"w-4 h-4 mr-2"})," Add Team Member"]})]}),a.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-5 gap-4",children:["admin","manager","estimator","field_tech","shop_technician"].map(T=>{const A=ev[T],P=n.filter(_=>_.role===T&&_.active).length,E=A.icon;return a.jsxs(ye,{className:"p-4 border-border/60 shadow-sm",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[a.jsx(E,{className:"w-4 h-4 text-muted-foreground"}),a.jsxs("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:[A.label,"s"]})]}),a.jsx("div",{className:"text-2xl font-display font-bold text-foreground",children:P})]},T)})}),t&&a.jsx(REe,{}),a.jsxs(ye,{className:"border-border/60 shadow-sm overflow-hidden",children:[a.jsx("div",{className:"px-6 py-4 border-b border-border bg-secondary/30",children:a.jsx("h2",{className:"font-semibold text-foreground",children:"Active Members"})}),a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{className:"text-xs text-muted-foreground uppercase bg-secondary/50 font-semibold",children:a.jsxs("tr",{children:[a.jsx("th",{className:"px-6 py-3 text-left",children:"Member"}),a.jsx("th",{className:"px-6 py-3 text-left",children:"Role"}),a.jsx("th",{className:"px-6 py-3 text-left",children:"Phone"}),a.jsx("th",{className:"px-6 py-3 text-left",children:"License #"}),a.jsx("th",{className:"px-6 py-3 text-left",children:"Inventory"}),a.jsx("th",{className:"px-6 py-3 text-left",children:"Microsoft 365"}),a.jsx("th",{className:"px-6 py-3 text-right",children:"Actions"})]})}),a.jsx("tbody",{className:"divide-y divide-border",children:N.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:7,className:"px-6 py-8 text-center text-muted-foreground",children:"No active team members."})}):N.map(T=>a.jsxs("tr",{className:"hover:bg-secondary/20 transition-colors",children:[a.jsx("td",{className:"px-6 py-4",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-9 h-9 rounded-full bg-primary/10 flex items-center justify-center text-primary font-bold text-base",children:T.name.charAt(0)}),a.jsxs("div",{children:[a.jsx("div",{className:"font-semibold text-foreground",children:T.name}),a.jsx("div",{className:"text-xs text-muted-foreground",children:T.email})]})]})}),a.jsx("td",{className:"px-6 py-4",children:a.jsx(yF,{role:T.role})}),a.jsx("td",{className:"px-6 py-4 text-muted-foreground",children:T.phone||a.jsx("span",{className:"italic",children:"—"})}),a.jsx("td",{className:"px-6 py-4 text-muted-foreground",children:NK.includes(T.role)?T.license||a.jsx("span",{className:"italic",children:"—"}):a.jsx("span",{className:"text-muted-foreground/30",children:"N/A"})}),a.jsx("td",{className:"px-6 py-4",children:T.canManageInventory?a.jsx("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-semibold bg-emerald-100 text-emerald-700 border border-emerald-200",children:"Manager"}):T.role==="shop_technician"?a.jsx("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-semibold bg-orange-100 text-orange-700 border border-orange-200",children:"Adjust Only"}):a.jsx("span",{className:"text-xs text-muted-foreground/50 italic",children:"View only"})}),a.jsx("td",{className:"px-6 py-4",children:T.microsoftConnected?a.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs font-semibold text-green-700",children:[a.jsx(st,{className:"w-4 h-4 text-green-500"})," Connected"]}):a.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs font-medium text-muted-foreground",children:[a.jsx(cT,{className:"w-4 h-4 text-muted-foreground
218/50"})," Not connected"]})}),a.jsx("td",{className:"px-6 py-4",children:a.jsxs("div",{className:"flex items-center justify-end gap-2",children:[a.jsxs(ne,{size:"sm",variant:"outline",className:"rounded-lg",onClick:()=>f(T),children:[a.jsx(gd,{className:"w-3.5 h-3.5 mr-1"})," Edit"]}),a.jsx(ne,{size:"sm",variant:"outline",className:"rounded-lg text-amber-600 border-amber-200 hover:bg-amber-50",disabled:h===T.id,onClick:()=>b(T),children:h===T.id?a.jsx(Me,{className:"w-3.5 h-3.5 animate-spin"}):"Archive"}),a.jsx(ne,{size:"sm",variant:"outline",className:"rounded-lg text-red-600 border-red-200 hover:bg-red-50",onClick:()=>y(T),children:a.jsx(on,{className:"w-3.5 h-3.5"})})]})})]},T.id))})]})})]}),k.length>0&&a.jsxs(ye,{className:"border-border/60 shadow-sm overflow-hidden",children:[a.jsx("div",{className:"px-6 py-4 border-b border-border bg-secondary/30",children:a.jsxs("h2",{className:"font-semibold text-foreground text-muted-foreground",children:["Archived Members (",k.length,")"]})}),a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{className:"text-xs text-muted-foreground uppercase bg-secondary/50 font-semibold",children:a.jsxs("tr",{children:[a.jsx("th",{className:"px-6 py-3 text-left",children:"Member"}),a.jsx("th",{className:"px-6 py-3 text-left",children:"Role"}),a.jsx("th",{className:"px-6 py-3 text-right",children:"Actions"})]})}),a.jsx("tbody",{className:"divide-y divide-border",children:k.map(T=>a.jsxs("tr",{className:"hover:bg-secondary/20 transition-colors opacity-60",children:[a.jsx("td",{className:"px-6 py-4",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-9 h-9 rounded-full bg-secondary flex items-center justify-center text-muted-foreground font-bold text-base",children:T.name.charAt(0)}),a.jsxs("div",{children:[a.jsx("div",{className:"font-semibold text-foreground line-through",children:T.name}),a.jsx("div",{className:"text-xs text-muted-foreground",children:T.email})]})]})}),a.jsx("td",{className:"px-6 py-4",children:a.jsx(yF,{role:T.role})}),a.jsx("td",{className:"px-6 py-4",children:a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx(ne,{size:"sm",variant:"outline",className:"rounded-lg text-green-700 border-green-200 hover:bg-green-50",disabled:h===T.id,onClick:()=>b(T),children:h===T.id?a.jsx(Me,{className:"w-3.5 h-3.5 animate-spin"}):"Unarchive"}),a.jsx(ne,{size:"sm",variant:"outline",className:"rounded-lg text-red-600 border-red-200 hover:bg-red-50",onClick:()=>y(T),children:a.jsx(on,{className:"w-3.5 h-3.5"})})]})})]},T.id))})]})})]}),d!==null&&a.jsx(EEe,{member:d==="new"?null:d,onClose:()=>f(null),onSaved:j}),x&&a.jsx(_Ee,{member:x,members:n,onClose:()=>y(null),onDeleted:C})]})}function $Ee(){return a.jsxs("div",{className:"min-h-screen flex flex-col items-center justify-center bg-background text-center px-4",children:[a.jsx("h1",{className:"text-6xl font-display font-bold text-primary mb-4",children:"404"}),a.jsx("h2",{className:"text-2xl font-bold text-foreground mb-4",children:"Page not found"}),a.jsx("p",{className:"text-muted-foreground mb-8 max-w-md mx-auto",children:"The page you are looking for doesn't exist or has been moved."}),a.jsx(Cu,{href:"/",children:a.jsx(ne,{size:"lg",className:"rounded-xl",children:"Go to Homepage"})})]})}const SK=(e,t)=>{const n=localStorage.getItem("fs_team_token");return fetch(e,{...t,headers:{Authorization:`Bearer ${n}`,"Content-Type":"application/json",...t?.headers||{}}})};function IEe(){return Xe({queryKey:["materials-planning"],queryFn:async()=>{const e=await SK("/api/materials/planning");if(!e.ok)throw new Error("Failed to load planning data");return e.json()}})}function CK(e){return{gutterFt:e.reduce((t,n)=>t+parseFloat(n.gutterFootage||"0"),0),downspouts:e.reduce((t,n)=>t+parseInt(n.downspouts||"0"),0),elbows:e.reduce((t,n)=>t+parseInt(n.elbows||"0"),0),insideMiters:e.reduce((t,n)=>t+parseInt(n.insideMiters||"0"),0),outsideMiters:e.reduce((t,n)=>t+parseInt(n.outsideMiters||"0"),0),endCaps:e.reduce((t,n)=>t+parseInt(n.endCaps||"0"),0),slipJoints:e.reduce((t,n)=>t+parseInt(n.slipJoints||n.slipjoints||"0"),0)}}function LEe({jobs:e}){const t={};for(const n of e){const r=n.quote?.sections||[],s=n.quote?.material||"Unknown";t[s]||(t[s]={gutterFt:0,downspouts:0,elbows:0,insideMiters:0,outsideMiters:0,endCaps:0,slipJoints:0});const i=CK(r);for(const l of Object.keys(i))t[s][l]+=i[l]}return Object.keys(t).length===0?null:a.jsxs(ye,{className:"p-6 border-border/60 bg-primary/5",children:[a.jsxs("h2",{className:"text-lg font-bold mb-4 flex items-center gap-2",children:[a.jsx(Jn,{className:"w-5 h-5 text-primary"}),"Total Materials Needed — Next 14 Days"]}),a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:Object.entries(t).map(([n,r])=>a.jsxs("div",{className:"bg-white rounded-xl border border-border/60 p-4",children:[a.jsx("h3",{className:"font-bold text-sm mb-3 text-foreground",children:n}),a.jsxs("div",{className:"space-y-1 text-sm",children:[a.jsxs("div",{className:"flex justify-between",children:[a.jsx("span",{className:"text-muted-foreground",children:"Gutter footage"}),a.jsxs("span",{className:"font-semibold",children:[r.gutterFt.toFixed(0)," ft"]})]}),r.downspouts>0&&a.jsxs("div",{className:"flex justify-between",children:[a.jsx("span",{className:"text-muted-foreground",children:"Downspouts"}),a.jsx("span",{className:"font-semibold",children:r.downspouts})]}),r.elbows>0&&a.jsxs("div",{className:"flex justify-between",children:[a.jsx("span",{className:"text-muted-foreground",children:"Elbows"}),a.jsx("span",{className:"font-semibold",children:r.elbows})]}),r.insideMiters+r.outsideMiters>0&&a.jsxs("div",{className:"flex justify-between",children:[a.jsx("span",{className:"text-muted-foreground",children:"Miters (I/O)"}),a.jsxs("span",{className:"font-semibold",children:[r.insideMiters," / ",r.outsideMiters]})]}),r.endCaps>0&&a.jsxs("div",{className:"flex justify-between",children:[a.jsx("span",{className:"text-muted-foreground",children:"End caps"}),a.jsx("span",{className:"font-semibold",children:r.endCaps})]})]})]},n))})]})}function v2({job:e,onMarkOrdered:t}){const[n,r]=v.useState(!1),s=e.quote?.sections||[],i=CK(s),l=s.length>0;return a.jsxs(ye,{className:"overflow-hidden border-border/60",children:[a.jsx("div",{className:`h-1.5 w-full ${e.materialReceivedAt?"bg-green-500":e.materialOrderedAt?"bg-blue-400":"bg-amber-400"}`}),a.jsxs("div",{className:"p-5",children:[a.jsxs("div",{className:"flex justify-between items-start mb-3",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"font-bold text-base leading-tight",children:e.address||"No address"}),a.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.city,", ",e.state," ",e.zip]}),e.clientName&&a.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:e.clientName})]}),e.scheduledDate&&a.jsxs("div",{className:"text-right shrink-0 ml-3",children:[a.jsxs("div",{className:"flex items-center text-xs text-muted-foreground",children:[a.jsx(Ma,{className:"w-3.5 h-3.5 mr-1"}),Tt(new Date(e.scheduledDate),"EEE, MMM d")]}),a.jsx("div",{className:"text-xs font-bold text-foreground mt-0.5",children:De(e.totalAmount)})]})]}),a.jsxs("div",{className:"flex items-center gap-2 mb-4 flex-wrap",children:[e.quote?.material&&a.jsx("span",{className:"text-[10px] font-bold bg-secondary text-foreground px-2 py-0.5 rounded-full",children:e.quote.material}),e.quote?.gutterType&&a.jsx("span",{className:"text-[10px] font-bold bg-secondary text-foreground px-2 py-0.5 rounded-full",children:e.quote.gutterType}),e.materialReceivedAt?a.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-bold bg-green-100 text-green-700 px-2 py-0.5 rounded-full",children:[a.jsx(st,{className:"w-3 h-3"})," Material In"]}):e.materialOrderedAt?a.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-bold bg-blue-100 text-blue-700 px-2 py-0.5 rounded-full",children:[a.jsx(Ci,{className:"w-3 h-3"})," Ordered ",Tt(new Date(e.materialOrderedAt),"M/d"),e.materialOrderedByName&&` by ${e.materialOrderedByName.split(" ")[0]}`]}):null]}),l?a.jsxs("div",{className:"bg-secondary/40 rounded-xl p-3 mb-3",children:[a.jsxs("div",{className:"grid grid-cols-3 gap-2 text-xs",children:[a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"font-bold text-base text-foreground",children:i.gutterFt.toFixed(0)}),a.jsx("div",{className:"text-muted-foreground",children:"ft gutter"})]}),a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"font-bold text-base text-foreground",children:i.downspouts}),a.jsx("div",{className:"text-muted-foreground",children:"downspouts"})]}),a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"font-bold text-base text-foreground",children:i.elbows}),a.jsx("div",{className:"text-muted-foreground",children:"elbows"})]})]}),i.insideMiters+i.outsideMiters+i.endCaps>0&&a.jsxs("div",{className:"grid grid-cols-3 gap-2 text-xs mt-2 pt-2 border-t border-border/40",children:[a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"font-semibold",children:i.insideMiters}),a.jsx("div",{className:"text-muted-foreground",children:"inside miters"})]}),a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"font-semibold",children:i.outsideMiters}),a.jsx("div",{className:"text-muted-foreground",children:"outside miters"})]}),a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"font-semibold",children:i.endCaps}),a.jsx("div",{className:"text-muted-foreground",children:"end caps"})]})]})]}):a.jsxs("div",{className:"flex items-center gap-2 text-xs text-amber-600 bg-amber-50 rounded-lg px-3 py-2 mb-3",children:[a.jsx(rn,{className:"w-3.5 h-3.5 shrink-0"}),"No work order — quote sections not entered"]}),l&&a.jsxs("button",{className:"w-full flex items-center justify-between text-xs font-semibold text-muted-foreground hover:text-foreground transition-colors mb-3",onClick:()=>r(u=>!u),children:[a.jsxs("span",{children:["Section Breakdown (",s.length,")"]}),n?a.jsx(Nr,{className:"w-3.5 h-3.5"}):a.jsx(wr,{className:"w-3.5 h-3.5"})]}),n&&s.length>0&&a.jsx("div",{className:"overflow-x-auto mb-3",children:a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"text-muted-foreground border-b border-border/60",children:[a.jsx("th",{className:"text-left pb-1 pr-2",children:"Section"}),a.jsx("th",{className:"text-right pb-1 pr-2",children:"ft"}),a.jsx("th",{className:"text-right pb-1 pr-2",children:"DS"}),a.jsx("th",{className:"text-right pb-1",children:"Elb"})]})}),a.jsx("tbody",{children:s.map((u,d)=>a.jsxs("tr",{className:"border-b border-border/20",children:[a.jsx("td",{className:"py-1 pr-2 font-medium",children:u.name||`S${d+1}`}),a.jsx("td",{className:"py-1 pr-2 text-right",children:parseFloat(u.gutterFootage||"0").toFixed(0)}),a.jsx("td",{className:"py-1 pr-2 text-right",children:u.downspouts||0}),a.jsx("td",{className:"py-1 text-right",children:u.elbows||0})]},d))})]})}),!e.materialOrderedAt&&a.jsxs(ne,{size:"sm",variant:"outline",className:"w-full rounded-xl text-xs border-blue-300 text-blue-700 hover:bg-blue-50",onClick:t,children:[a.jsx(Ci,{className:"w-3.5 h-3.5 mr-1.5"})," Mark Material Ordered"]})]})]})}function FEe(){const{data:e=[],isLoading:t,refetch:n}=IEe(),r=wt(),s=nt({mutationFn:d=>SK(`/api/jobs/${d}/mark-ordered`,{method:"POST"}).then(f=>f.json()),onSuccess:()=>{r.invalidateQueries({queryKey:["materials-planning"]}),r.invalidateQueries({queryKey:["jobs"]})}}),i=e.filter(d=>!d.materialOrderedAt),l=e.filter(d=>d.materialOrderedAt&&!d.materialReceivedAt),u=e.filter(d=>d.materialReceivedAt);return t?a.jsx("div",{className:"p-8 flex justify-center",children:a.jsx("div",{className:"animate-spin h-8 w-8 border-4 border-primary border-t-transparent roun
218ded-full"})}):a.jsxs("div",{className:"space-y-8 pb-12",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-3xl font-display font-bold text-foreground",children:"Materials Planning"}),a.jsx("p",{className:"text-muted-foreground mt-1",children:"Jobs scheduled in the next 14 days — review and order materials"})]}),e.length===0?a.jsxs("div",{className:"py-16 text-center bg-secondary/30 rounded-2xl border-2 border-dashed border-border",children:[a.jsx(Ma,{className:"w-12 h-12 text-muted-foreground opacity-30 mx-auto mb-4"}),a.jsx("p",{className:"text-muted-foreground font-medium text-lg",children:"No jobs scheduled in the next 14 days."})]}):a.jsxs(a.Fragment,{children:[a.jsx(LEe,{jobs:e}),i.length>0&&a.jsxs("div",{children:[a.jsxs("h2",{className:"text-sm font-bold uppercase tracking-wider text-amber-600 mb-3 flex items-center gap-2",children:[a.jsx(rn,{className:"w-4 h-4"})," Needs Order (",i.length,")"]}),a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:i.map(d=>a.jsx(v2,{job:d,onMarkOrdered:()=>s.mutate(d.id)},d.id))})]}),l.length>0&&a.jsxs("div",{children:[a.jsxs("h2",{className:"text-sm font-bold uppercase tracking-wider text-blue-600 mb-3 flex items-center gap-2",children:[a.jsx(Ci,{className:"w-4 h-4"})," Material Ordered (",l.length,")"]}),a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:l.map(d=>a.jsx(v2,{job:d,onMarkOrdered:()=>{}},d.id))})]}),u.length>0&&a.jsxs("div",{children:[a.jsxs("h2",{className:"text-sm font-bold uppercase tracking-wider text-green-700 mb-3 flex items-center gap-2",children:[a.jsx(st,{className:"w-4 h-4"})," Material Received (",u.length,")"]}),a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:u.map(d=>a.jsx(v2,{job:d,onMarkOrdered:()=>{}},d.id))})]})]})]})}const b2=(e,t)=>{const n=localStorage.getItem("fs_team_token");return fetch(e,{...t,headers:{Authorization:`Bearer ${n}`,"Content-Type":"application/json",...t?.headers||{}}})},js="text-xs font-semibold text-muted-foreground uppercase tracking-wider block mb-1",pi="w-full px-3 py-2 bg-white border border-border rounded-xl outline-none focus:border-primary text-sm",qEe="w-full px-3 py-2 bg-white border border-border rounded-xl outline-none focus:border-primary text-sm",Qf=["Aluminum Coil","Steel Coil","Copper Coil"];function BEe({onClose:e,onSaved:t}){const[n,r]=v.useState("header"),[s,i]=v.useState(""),[l,u]=v.useState(""),[d,f]=v.useState(""),[h,p]=v.useState(""),[x,y]=v.useState([]),[w,j]=v.useState(""),[b,C]=v.useState(""),{data:N=[]}=Xe({queryKey:["inv-suppliers"],queryFn:()=>b2("/api/inventory/suppliers").then(L=>L.json())}),{data:k=[]}=Xe({queryKey:["inventory-stock"],queryFn:async()=>{const L=await b2("/api/inventory/stock");if(!L.ok)throw new Error("Failed");return L.json()}}),T=v.useMemo(()=>{if(!w.trim())return[];const L=w.toLowerCase(),I=N.find(W=>String(W.id)===s);return k.filter(W=>I&&W.supplier!==I.name?!1:W.productName?.toLowerCase().includes(L)||W.sku5star?.toLowerCase().includes(L)||W.color?.toLowerCase().includes(L)).slice(0,10)},[w,k,s,N]);function A(L){const I=Qf.includes(L.category);y(W=>[...W,{id:`${L.productId}-${Date.now()}`,productId:L.productId,productName:`${L.productName}${L.color&&L.color!=="All Colors"?` · ${L.color}`:""}`,sku5star:L.sku5star,category:L.category,unitType:L.unitType,quantity:I?"":"1",costPerUnit:String(L.costPerUnit||""),storageLocation:L.storageLocation||"",rollCount:I?"1":"",weightPerRoll:I?"500":"",notes:""}]),j("")}function P(L,I,W){y(U=>U.map(V=>V.id===L?{...V,[I]:W}:V))}function E(L){y(I=>I.filter(W=>W.id!==L))}const _=nt({mutationFn:async()=>{const L={supplierId:Number(s),invoiceNumber:l,poNumber:d,notes:h,items:x.map(W=>{const U=Qf.includes(W.category);return{productId:W.productId,quantity:U?Number(W.rollCount)*Number(W.weightPerRoll):Number(W.quantity),unitType:W.unitType,costPerUnit:W.costPerUnit?Number(W.costPerUnit):null,storageLocation:W.storageLocation,rollCount:U?Number(W.rollCount):null,weightPerRoll:U?Number(W.weightPerRoll):null,notes:W.notes}})},I=await b2("/api/inventory/receipts",{method:"POST",body:JSON.stringify(L)});if(!I.ok){const W=await I.json().catch(()=>({}));throw new Error(W.error||"Failed to save receipt")}return I.json()},onSuccess:()=>{t(),e()},onError:L=>C(L.message)}),R=!!s,H=x.length>0&&x.every(L=>Qf.includes(L.category)?Number(L.rollCount)>0&&Number(L.weightPerRoll)>0:Number(L.quantity)>0);return a.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm z-50 flex items-center justify-center p-4 overflow-y-auto",children:a.jsxs("div",{className:"bg-card rounded-2xl shadow-2xl border border-border w-full max-w-3xl my-4",children:[a.jsxs("div",{className:"p-6 border-b border-border",children:[a.jsx("h2",{className:"text-lg font-bold text-foreground",children:"Receive Shipment"}),a.jsxs("p",{className:"text-sm text-muted-foreground mt-1",children:[n==="header"&&"Select supplier and enter shipment details",n==="items"&&"Add products received in this shipment",n==="confirm"&&"Review and confirm the receipt"]}),a.jsx("div",{className:"flex gap-2 mt-3",children:["header","items","confirm"].map((L,I)=>a.jsx("div",{className:`flex-1 h-1.5 rounded-full ${["header","items","confirm"].indexOf(n)>=I?"bg-primary":"bg-secondary"}`},L))})]}),a.jsxs("div",{className:"p-6 space-y-4 max-h-[60vh] overflow-y-auto",children:[n==="header"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{children:[a.jsx("label",{className:js,children:"Supplier *"}),a.jsxs("select",{value:s,onChange:L=>i(L.target.value),className:qEe,children:[a.jsx("option",{value:"",children:"Select supplier…"}),N.map(L=>a.jsx("option",{value:L.id,children:L.name},L.id))]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:js,children:"Invoice Number"}
218),a.jsx("input",{type:"text",value:l,onChange:L=>u(L.target.value),placeholder:"INV-12345",className:pi})]}),a.jsxs("div",{children:[a.jsx("label",{className:js,children:"PO Number"}),a.jsx("input",{type:"text",value:d,onChange:L=>f(L.target.value),placeholder:"PO-2024-001",className:pi})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:js,children:"Notes"}),a.jsx("input",{type:"text",value:h,onChange:L=>p(L.target.value),placeholder:"Optional notes about this shipment",className:pi})]})]}),n==="items"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"relative",children:[a.jsx(Da,{className:"w-4 h-4 absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),a.jsx("input",{type:"text",placeholder:"Search by product name or FSG Part #...",value:w,onChange:L=>j(L.target.value),className:"w-full pl-9 pr-4 py-2 bg-white border border-border rounded-xl outline-none focus:border-primary text-sm"}),T.length>0&&a.jsx("div",{className:"absolute top-full left-0 right-0 mt-1 bg-card border border-border rounded-xl shadow-lg z-10 max-h-48 overflow-y-auto",children:T.map(L=>a.jsxs("button",{onClick:()=>A(L),className:"w-full px-4 py-2.5 text-left hover:bg-muted/50 transition-colors flex items-center justify-between border-b border-border/30 last:border-0",children:[a.jsxs("div",{children:[a.jsxs("p",{className:"text-sm font-medium text-foreground",children:[L.productName,L.color&&L.color!=="All Colors"?` · ${L.color}`:""]}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:[L.sku5star," · ",L.category]})]}),a.jsx(Ft,{className:"w-4 h-4 text-primary flex-shrink-0"})]},L.productId))})]}),x.length===0?a.jsxs("div",{className:"text-center py-8",children:[a.jsx(Jn,{className:"w-10 h-10 mx-auto mb-3 text-muted-foreground/30"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"No products added yet"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Search for products above to add them"})]}):a.jsx("div",{className:"space-y-3",children:x.map(L=>{const I=Qf.includes(L.category);return a.jsxs("div",{className:"border border-border rounded-xl p-4",children:[a.jsxs("div",{className:"flex items-start justify-between mb-3",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:L.productName}),a.jsx("p",{className:"text-xs font-mono text-primary",children:L.sku5star})]}),a.jsx("button",{onClick:()=>E(L.id),className:"p-1 rounded-lg hover:bg-red-50 text-red-400 hover:text-red-600 transition-colors",children:a.jsx(on,{className:"w-4 h-4"})})]}),I?a.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[a.jsxs("div",{children:[a.jsx("label",{className:js,children:"# of Rolls *"}),a.jsx("input",{type:"number",min:"1",value:L.rollCount,onChange:W=>P(L.id,"rollCount",W.target.value),className:pi})]}),a.jsxs("div",{children:[a.jsx("label",{className:js,children:"Weight/Roll (lbs) *"}),a.jsx("input",{type:"number",value:L.weightPerRoll,onChange:W=>P(L.id,"weightPerRoll",W.target.value),className:pi})]}),a.jsxs("div",{children:[a.jsx("label",{className:js,children:"Storage Location"}),a.jsx("input",{type:"text",value:L.storageLocation,onChange:W=>P(L.id,"storageLocation",W.target.value),placeholder:"W1-RCK-A3",className:pi})]})]}):a.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[a.jsxs("div",{children:[a.jsx("label",{className:js,children:"Quantity *"}),a.jsx("input",{type:"number",min:"1",value:L.quantity,onChange:W=>P(L.id,"quantity",W.target.value),className:pi})]}),a.jsxs("div",{children:[a.jsx("label",{className:js,children:"Cost/Unit ($)"}),a.jsx("input",{type:"number",step:"0.01",value:L.costPerUnit,onChange:W=>P(L.id,"costPerUnit",W.target.value),className:pi})]}),a.jsxs("div",{children:[a.jsx("label",{className:js,children:"Storage Location"}),a.jsx("input",{type:"text",value:L.storageLocation,onChange:W=>P(L.id,"storageLocation",W.target.value),placeholder:"W1-RCK-A3",className:pi})]})]})]},L.id)})})]}),n==="confirm"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"bg-secondary/30 rounded-xl p-4 space-y-2",children:[a.jsxs("p",{className:"text-sm",children:[a.jsx("span",{className:"font-semibold",children:"Supplier:"})," ",N.find(L=>String(L.id)===s)?.name??"—"]}),l&&a.jsxs("p",{className:"text-sm",children:[a.jsx("span",{className:"font-semibold",children:"Invoice:"})," ",l]}),d&&a.jsxs("p",{className:"text-sm",children:[a.jsx("span",{className:"font-semibold",children:"PO:"})," ",d]}),h&&a.jsxs("p",{className:"text-sm",children:[a.jsx("span",{className:"font-semibold",children:"Notes:"})," ",h]})]}),a.jsx("div",{className:"border border-border rounded-xl overflow-hidden",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"bg-secondary/30 border-b border-border",children:[a.jsx("th",{className:"px-4 py-2 text-left font-semibold text-muted-foreground text-xs",children:"Product"}),a.jsx("th",{className:"px-4 py-2 text-left font-semibold text-muted-foreground text-xs",children:"Qty"}),a.jsx("th",{className:"px-4 py-2 text-left font-semibold text-muted-foreground text-xs",children:"Location"})]})}),a.jsx("tbody",{children:x.map(L=>{const I=Qf.includes(L.category);return a.jsxs("tr",{className:"border-b border-border/50",children:[a.jsxs("td",{className:"px-4 py-2",children:[a.jsx("p",{className:"font-medium text-foreground",children:L.productName}),a.jsx("p",{className:"text-xs font-mono text-primary",children:L.sku5star})]}),a.jsx("td",{className:"px-4 py-2 text-foreground",children:I?`${L.rollCount} roll${Number(L.rollCount)!==1?"s":""} × ${L.weightPerRoll} lbs`:`${L.quantity} ${L.unitType?.replace("per_","")||"units"}`}),a.jsx("td",{className:"px-4 py-2 font-mono text-xs text-foreground",children:L.storageLocation||"—"})]},L.id)})})]})}),b&&a.jsx("p",{className:"text-xs text-red-600 font-medium",children:b})]})]}),a.jsxs("div",{className:"p-6 pt-4 flex gap-3 border-t border-border",children:[n==="header"&&a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:e,className:"flex-1 px-4 py-2.5 rounded-xl border border-border text-sm font-medium hover:bg-muted transition-colors",children:"Cancel"}),a.jsx("button",{onClick:()=>r("items"),disabled:!R,className:"flex-1 px-4 py-2.5 rounded-xl bg-primary text-primary-foreground text-sm font-semibold hover:bg-primary/90 transition-colors disabled:opacity-60",children:"Next: Add Products"})]}),n==="items"&&a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:()=>r("header"),className:"flex-1 px-4 py-2.5 rounded-xl border border-border text-sm font-medium hover:bg-muted transition-colors",children:"Back"}),a.jsxs("button",{onClick:()=>r("confirm"),disabled:!H,className:"flex-1 px-4 py-2.5 rounded-xl bg-primary text-primary-foreground text-sm font-semibold hover:bg-primary/90 transition-colors disabled:opacity-60",children:["Review (",x.length," item",x.length!==1?"s":"",")"]})]}),n==="confirm"&&a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:()=>r("items"),className:"flex-1 px-4 py-2.5 rounded-xl border border-border text-sm font-medium hover:bg-muted transition-colors",children:"Back"}),a.jsxs("button",{onClick:()=>_.mutate(),disabled:_.isPending,className:"flex-1 px-4 py-2.5 rounded-xl bg-primary text-primary-foreground text-sm font-semibold hover:bg-primary/90 transition-colors disabled:opacity-60 flex items-center justify-center gap-2",children:[_.isPending&&a.jsx(Me,{className:"w-4 h-4 animate-spin"}),_.isPending?"Saving...":"Confirm Receipt"]})]})]})]})})}const zEe=(e,t)=>{const n=localStorage.getItem("fs_team_token");return fetch(e,{...t,headers:{Authorization:`Bearer ${n}`,"Content-Type":"application/json"}})},UEe={received:{label:"Received",color:"bg-green-100 text-green-700"},receive:{label:"Received",color:"bg-green-100 text-green-700"},job_close:{label:"Job Close",color:"bg-blue-100 text-blue-700"}
218,manual_correction:{label:"Manual Correction",color:"bg-amber-100 text-amber-700"},return:{label:"Return",color:"bg-purple-100 text-purple-700"},damaged:{label:"Damaged",color:"bg-red-100 text-red-600"},kit_deduct:{label:"Kit Deduction",color:"bg-orange-100 text-orange-700"},remnant_return:{label:"Remnant Return",color:"bg-teal-100 text-teal-700"},manual_add:{label:"Manual Add",color:"bg-green-100 text-green-700"},manual_remove:{label:"Manual Remove",color:"bg-red-100 text-red-600"},spot_check:{label:"Spot Check",color:"bg-slate-100 text-slate-700"}};function HEe(e){const t=new Date(e);return t.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})+" "+t.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit"})}function VEe({productId:e,productName:t,sku5star:n,color:r,onClose:s}){const{data:i=[],isLoading:l}=Xe({queryKey:["adjustments",e],queryFn:async()=>{const u=await zEe(`/api/inventory/adjustments/${e}`);if(!u.ok)throw new Error("Failed to load");return u.json()}});return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"fixed inset-0 bg-black/30 z-40",onClick:s}),a.jsxs("div",{className:"fixed inset-y-0 right-0 w-full max-w-lg bg-card border-l border-border shadow-2xl z-50 flex flex-col",children:[a.jsxs("div",{className:"p-5 border-b border-border flex items-start justify-between",children:[a.jsxs("div",{children:[a.jsxs("h2",{className:"text-lg font-bold text-foreground flex items-center gap-2",children:[a.jsx(Dr,{className:"w-5 h-5 text-primary"}),"Adjustment History"]}),a.jsxs("p",{className:"text-sm text-muted-foreground mt-0.5",children:[t,r&&r!=="All Colors"?` · ${r}`:""]}),n&&a.jsx("p",{className:"text-xs font-mono text-primary mt-0.5",children:n})]}),a.jsx("button",{onClick:s,"aria-label":"Close",className:"p-1.5 rounded-lg hover:bg-muted transition-colors",children:a.jsx(an,{className:"w-5 h-5 text-muted-foreground"})})]}),a.jsx("div",{className:"flex-1 overflow-y-auto p-5",children:l?a.jsx("div",{className:"flex justify-center py-12",children:a.jsx(Me,{className:"w-6 h-6 animate-spin text-muted-foreground"})}):i.length===0?a.jsxs("div",{className:"text-center py-12",children:[a.jsx(Dr,{className:"w-10 h-10 mx-auto mb-3 text-muted-foreground/30"}),a.jsx("p",{className:"text-sm text-muted-foreground font-medium",children:"No adjustments recorded"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Changes to stock levels will appear here"})]}):a.jsx("div",{className:"space-y-3",children:i.map(u=>{const d=UEe[u.adjustmentType]??{label:u.adjustmentType,color:"bg-secondary text-foreground"},f=u.qtyChange>0,h=u.qtyChange===0;return a.jsxs("div",{className:"border border-border rounded-xl p-4 hover:border-primary/20 transition-colors",children:[a.jsxs("div",{className:"flex items-start justify-between mb-2",children:[a.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded-md text-xs font-semibold ${d.color}`,children:d.label}),a.jsx("span",{className:"text-xs text-muted-foreground",children:HEe(u.adjustedAt)})]}),a.jsxs("div",{className:"flex items-center gap-3 mt-3",children:[a.jsxs("div",{className:`flex items-center gap-1 text-sm font-bold ${h?"text-muted-foreground":f?"text-green-600":"text-red-600"}`,children:[h?a.jsx(kee,{className:"w-3.5 h-3.5"}):f?a.jsx(VZ,{className:"w-3.5 h-3.5"}):a.jsx(rg,{className:"w-3.5 h-3.5"}),f?"+":"",u.qtyChange]}),u.qtyBefore!==null&&u.qtyAfter!==null&&a.jsxs("span",{className:"text-xs text-muted-foreground",children:[u.qtyBefore," → ",u.qtyAfter]})]}),a.jsxs("div",{className:"mt-2 text-xs text-muted-foreground space-y-0.5",children:[a.jsxs("p",{children:["By: ",a.jsx("span",{className:"font-medium text-foreground",children:u.adjustedByName})]}),u.poNumber&&a.jsxs("p",{children:["PO: ",a.jsx("span",{className:"font-medium text-foreground",children:u.poNumber})]}),u.notes&&a.jsx("p",{className:"italic",children:u.notes})]})]},u.id)})})})]})]})}const Al=async(e,t)=>{const n=localStorage.getItem("fs_team_token"),r=await fetch(e,{...t,headers:{Authorization:`Bearer ${n}`,"Content-Type":"application/json",...t?.headers||{}}});if(!r.ok){const s=await r.json().catch(()=>({}));throw new Error(s.error||`Request failed (${r.status})`)}return r},GEe={open:"bg-blue-100 text-blue-700",submitted:"bg-amber-100 text-amber-700",received:"bg-green-100 text-green-700"},KEe={open:a.jsx(Vq,{className:"w-4 h-4"}),submitted:a.jsx(Er,{className:"w-4 h-4"}),received:a.jsx(st,{className:"w-4 h-4"})};function WEe(){const{teamMember:e}=Nn(),t=wt(),{toast:n}=nr(),[r,s]=v.useState("current"),[i,l]=v.useState(new Set),[u,d]=v.useState(null),[f,h]=v.useState(null),[p,x]=v.useState(""),[y,w]=v.useState(""),j=e?.role==="admin"||e?.role==="manager",b=j||e?.role==="shop_technician",C=Xe({queryKey:["order-sheets-current"],queryFn:async()=>(await Al("/api/inventory/order-sheets/current")).json()}),N=Xe({queryKey:["order-sheets-history"],queryFn:async()=>(await Al("/api/inventory/order-sheets")).json(),enabled:r==="history"}),k=nt({mutationFn:async U=>(await Al(`/api/inventory/order-sheets/${U}/submit`,{method:"POST"})).json(),onSuccess:()=>{t.invalidateQueries({queryKey:["order-sheets-current"]}),t.invalidateQueries({queryKey:["order-sheets-history"]}),n({title:"Order submitted"})},onError:U=>n({title:U.message,variant:"destructive"})}),T=nt({mutationFn:async U=>(await Al(`/api/inventory/order-sheets/${U}/mark-received`,{method:"POST"})).json(),onSuccess:()=>{t.invalidateQueries({queryKey:["order-sheets-current"]}),t.invalidateQueries({queryKey:["order-sheets-history"]}),n({title:"Order marked as received"})},onError:U=>n({title:U.message,variant:"destructive"})}),A=nt({mutationFn:async({sheetId:U,itemId:V,qtyToOrder:D,notes:q})=>(await Al(`/api/inventory/order-sheets/${U}/item/${V}`,{method:"PATCH",body:JSON.stringify({qtyToOrder:D,notes:q})})).json(),onSuccess:()=>{t.invalidateQueries({queryKey:["order-sheets-current"]}),d(null)},onError:U=>n({title:U.message,variant:"destructive"})}),P=nt({mutationFn:async({sheetId:U,itemId:V})=>(await Al(`/api/inventory/order-sheets/${U}/item/${V}`,{method:"DELETE"})).json(),onSuccess:()=>{t.invalidateQueries({queryKey:["order-sheets-current"]}),n({title:"Item removed from order"})},onError:U=>n({title:U.message,variant:"destructive"})}),E=nt({mutationFn:async({sheetId:U,productId:V,qtyToOrder:D})=>(await Al(`/api/inventory/order-sheets/${U}/add-item`,{method:"POST",body:JSON.stringify({productId:V,qtyToOrder:D})})).json(),onSuccess:()=>{t.invalidateQueries({queryKey:["order-sheets-current"]}),h(null),x(""),w(""),n({title:"Item added to order"})},onError:U=>n({title:U.message,variant:"destructive"})}),_=U=>{l(V=>{const D=new Set(V);return D.has(U)?D.delete(U):D.add(U),D})},R=r==="current"?C.data:N.data,H=r==="current"?C.isLoading:N.isLoading,L=new Date,I=new Date(L);I.setDate(L.getDate()-(L.getDay()+6)%7);const W=I.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-2xl font-display font-bold text-foreground",children:"Weekly Order Sheets"}),a.jsx("p",{className:"text-muted-foreground mt-1",children:r==="current"?`Week of ${W}`:"Order history"})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(ne,{variant:r==="current"?"default":"outline",className:"rounded-xl",onClick:()=>s("current"),children:[a.jsx(Vq,{className:"w-4 h-4 mr-2"}),"Current"]}),a.jsxs(ne,{variant:r==="history"?"default":"outline",className:"rounded-xl",onClick:()=>s("history"),children:[a.jsx(Hl,{className:"w-4 h-4 mr-2"}),"History"]})]})]}),H&&a.jsx("div",{className:"flex justify-center p-8",children:a.jsx(Me,{className:"w-8 h-8 animate-spin text-muted-foreground"})}),!H&&(!R||R.length===0)&&a.jsxs(ye,{className:"p-8 text-center",children:[a.jsx(Jn,{className:"w-12 h-12 mx-auto text-muted-foreground
218/40 mb-3"}),a.jsx("p",{className:"text-muted-foreground font-medium",children:r==="current"?"No order sheets this week. Orders are auto-created when products drop below reorder points.":"No order history yet."})]}),R?.map(U=>{const V=i.has(U.id)||r==="current"&&U.status==="open",D=U.items.length;return a.jsxs(ye,{className:"overflow-hidden",children:[a.jsxs("div",{className:"p-4 flex items-center justify-between cursor-pointer hover:bg-muted/30 transition-colors",onClick:()=>_(U.id),children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs("span",{className:`inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-semibold ${GEe[U.status]}`,children:[KEe[U.status],U.status.charAt(0).toUpperCase()+U.status.slice(1)]}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-semibold text-foreground",children:U.supplierName}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Week of ",new Date(U.weekOf+"T00:00:00").toLocaleDateString("en-US",{month:"short",day:"numeric"})," · ",D," item",D!==1?"s":"",U.submittedAt&&` · Submitted ${new Date(U.submittedAt).toLocaleDateString()}`]})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[U.status==="open"&&j&&a.jsxs(ne,{size:"sm",className:"rounded-xl",onClick:q=>{q.stopPropagation(),k.mutate(U.id)},disabled:k.isPending||D===0,children:[a.jsx(Er,{className:"w-3 h-3 mr-1"}),"Submit Order"]}),U.status==="submitted"&&b&&a.jsxs(ne,{size:"sm",variant:"outline",className:"rounded-xl bg-green-50 text-green-700 border-green-200 hover:bg-green-100",onClick:q=>{q.stopPropagation(),T.mutate(U.id)},disabled:T.isPending,children:[a.jsx(st,{className:"w-3 h-3 mr-1"}),"Mark Received"]}),V?a.jsx(Sh,{className:"w-4 h-4 text-muted-foreground"}):a.jsx(Nr,{className:"w-4 h-4 text-muted-foreground"})]})]}),V&&a.jsxs("div",{className:"border-t",children:[a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"bg-muted/30",children:[a.jsx("th",{className:"text-left p-3 font-medium text-muted-foreground",children:"FSG Part #"}),a.jsx("th",{className:"text-left p-3 font-medium text-muted-foreground",children:"Product"}),a.jsx("th",{className:"text-center p-3 font-medium text-muted-foreground",children:"On Hand"}),a.jsx("th",{className:"text-center p-3 font-medium text-muted-foreground",children:"Reorder Pt"}),a.jsx("th",{className:"text-center p-3 font-medium text-muted-foreground",children:"Order Qty"}),a.jsx("th",{className:"text-left p-3 font-medium text-muted-foreground",children:"Notes"}),U.status==="open"&&b&&a.jsx("th",{className:"text-center p-3 font-medium text-muted-foreground w-20",children:"Actions"})]})}),a.jsx("tbody",{children:U.items.map(q=>a.jsxs("tr",{className:"border-t hover:bg-muted/20",children:[a.jsx("td",{className:"p-3 font-mono text-xs",children:q.fsgPartNumber||"—"}),a.jsxs("td",{className:"p-3",children:[a.jsx("span",{className:"font-medium",children:q.productName}),q.triggeredByJobId&&a.jsxs("span",{className:"ml-2 text-xs text-blue-600 bg-blue-50 px-1.5 py-0.5 rounded",children:["Job #",q.triggeredByJobId]})]}),a.jsx("td",{className:"p-3 text-center",children:a.jsx("span",{className:q.qtyOnHand<=0?"text-red-600 font-semibold":"",children:q.qtyOnHand})}),a.jsx("td",{className:"p-3 text-center text-muted-foreground",children:q.reorderPoint}),a.jsx("td",{className:"p-3 text-center",children:u?.id===q.id?a.jsx("input",{type:"number",className:"w-16 px-2 py-1 border rounded text-center text-sm",value:u.qty,onChange:K=>d({...u,qty:K.target.value}),onKeyDown:K=>{K.key==="Enter"&&A.mutate({sheetId:q.orderSheetId,itemId:q.id,qtyToOrder:Number(u.qty),notes:u.notes})},autoFocus:!0}):a.jsx("span",{className:"font-semibold text-primary",children:q.qtyToOrder})}),a.jsx("td",{className:"p-3 text-muted-foreground text-xs",children:u?.id===q.id?a.jsx("input",{type:"text",className:"w-full px-2 py-1 border rounded text-sm",value:u.notes,onChange:K=>d({...u,notes:K.target.value}),placeholder:"Notes..."}):q.notes||"—"}),U.status==="open"&&b&&a.jsx("td",{className:"p-3 text-center",children:a.jsx("div",{className:"flex gap-1 justify-center",children:u?.id===q.id?a.jsxs(a.Fragment,{children:[a.jsx(ne,{size:"sm",variant:"ghost",className:"h-7 px-2 text-green-600",onClick:()=>A.mutate({sheetId:q.orderSheetId,itemId:q.id,qtyToOrder:Number(u.qty),notes:u.notes}),children:a.jsx(st,{className:"w-3 h-3"})}),a.jsx(ne,{size:"sm",variant:"ghost",className:"h-7 px-2",onClick:()=>d(null),children:"✕"})]}):a.jsxs(a.Fragment,{children:[a.jsx(ne,{size:"sm",variant:"ghost",className:"h-7 px-2",onClick:()=>d({id:q.id,qty:String(q.qtyToOrder),notes:q.notes||""}),children:a.jsx(gd,{className:"w-3 h-3"})}),j&&a.jsx(ne,{size:"sm",variant:"ghost",className:"h-7 px-2 text-red-500 hover:text-red-700",onClick:()=>P.mutate({sheetId:U.id,itemId:q.id}),children:a.jsx(on,{className:"w-3 h-3"})})]})})})]},q.id))})]}),U.status==="open"&&b&&a.jsx("div",{className:"p-3 border-t bg-muted/20",children:f===U.id?a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("input",{type:"number",className:"w-24 px-2 py-1.5 border rounded text-sm",placeholder:"Product ID",value:p,onChange:q=>x(q.target.value)}),a.jsx("input",{type:"number",className:"w-20 px-2 py-1.5 border rounded text-sm",placeholder:"Qty",value:y,onChange:q=>w(q.target.value)}),a.jsx(ne,{size:"sm",className:"rounded-xl",disabled:!p||E.isPending,onClick:()=>E.mutate({sheetId:U.id,productId:Number(p),qtyToOrder:Number(y)||0}),children:E.isPending?a.jsx(Me,{className:"w-3 h-3 animate-spin"}):"Add"}),a.jsx(ne,{size:"sm",variant:"ghost",onClick:()=>{h(null),x(""),w("")},children:"Cancel"})]}):a.jsxs(ne,{size:"sm",variant:"ghost",className:"text-muted-foreground",onClick:()=>h(U.id),children:[a.jsx(Ft,{className:"w-3 h-3 mr-1"}),"Add item manually"]})})]})]},U.id)})]})}const Wx=async(e,t)=>{const n=localStorage.getItem("fs_team_token"),r=await fetch(e,{...t,headers:{Authorization:`Bearer ${n}`,"Content-Type":"application/json",...t?.headers||{}}});if(!r.ok&&t?.method&&t.method!=="GET"){const s=await r.json().catch(()=>({}));throw new Error(s.error||`Request failed (${r.status})`)}return r};function YEe(){const{teamMember:e}=Nn(),t=wt(),{toast:n}=nr(),[r,s]=v.useState("current"),[i,l]=v.useState({}),[u,d]=v.useState({}),f=e?.role==="admin"||e?.role==="manager",h=f||e?.role==="shop_technician",p=Xe({queryKey:["spot-checks-current"],queryFn:async()=>(await Wx("/api/inventory/spot-checks/current")).json()}),x=Xe({queryKey:["spot-checks-history"],queryFn:async()=>(await Wx("/api/inventory/spot-checks/history")).json(),enabled:r==="history"}),y=nt({mutationFn:async()=>{const E=await Wx("/api/inventory/spot-checks/generate",{method:"POST"});if(!E.ok){const _=await E.json();throw new Error(_.error||"Failed to generate")}return E.json()},onSuccess:E=>{t.invalidateQueries({queryKey:["spot-checks-current"]}),n({title:`Generated ${E.length} spot checks for this week`})},onError:E=>{n({title:E.message,variant:"destructive"})}}),w=nt({mutationFn:async({checkId:E,countedQty:_,notes:R})=>(await Wx(`/api/inventory/spot-checks/${E}/complete`,{method:"POST",body:JSON.stringify({countedQty:_,notes:R})})).json(),onSuccess:()=>{t.invalidateQueries({queryKey:["spot-checks-current"]}),t.invalidateQueries({queryKey:["inventory-stock"]}),n({title:"Count submitted"})},onError:E=>n({title:E.message,variant:"destructive"})}),j=r==="current"?p.data:x.data,b=r==="current"?p.isLoading:x.isLoading,C=p.data?.filter(E=>E.completedAt).length??0,N=p.data?.length??0,k=N>0?Math.round(C/N*100):0,T=new Date,A=new Date(T);A.setDate(T.getDate()-(T.getDay()+6)%7);const P=A.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-2xl font-display font-bold text-foreground",children:"Spot Checks"}),a.jsx("p",{className:"text-muted-foreground mt-1",children:r==="current"?`Week of ${P}`:"Check history"})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(ne,{variant:r==="current"?"default":"outline",className:"rounded-xl",onClick:()=>s("current"),children:[a.jsx(Am,{className:"w-4 h-4 mr-2"}),"Current"]}),a.jsxs(ne,{variant:r==="history"?"default":"outline",className:"rounded-xl",onClick:()=>s("history"),children:[a.jsx(Hl,{className:"w-4 h-4 mr-2"}),"History"]}),r==="current"&&f&&a.jsxs(ne,{variant:"outline",className:"rounded-xl",onClick:()=>y.mutate(),disabled:y.isPending,children:[y.isPending?a.jsx(Me,{className:"w-4 h-4 mr-2 animate-spin"}):a.jsx(qo,{className:"w-4 h-4 mr-2"}),"Generate"]})]})]}),r==="current"&&N>0&&a.jsxs(ye,{className:"p-4",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsxs("span",{className:"text-sm font-medium text-foreground",children:[C," of ",N," counted"]}),a.jsxs("span",{className:"text-sm font-semibold text-primary",children:[k,"%"]})]}),a.jsx("div",{className:"w-full bg-muted rounded-full h-3 overflow-hidden",children:a.jsx("div",{className:"h-full bg-primary rounded-full transition-all duration-500",style:{width:`${k}%`}})})]}),b&&a.jsx("div",{className:"flex justify-center p-8",children:a.jsx(Me,{className:"w-8 h-8 animate-spin text-muted-foreground"})}),!b&&(!j||j.length===0)&&a.jsxs(ye,{className:"p-8 text-center",children:[a.jsx(Am,{className:"w-12 h-12 mx-auto text-muted-foreground
218/40 mb-3"}),a.jsx("p",{className:"text-muted-foreground font-medium mb-3",children:r==="current"?"No spot checks generated for this week yet.":"No spot check history."}),r==="current"&&f&&a.jsx(ne,{className:"rounded-xl",onClick:()=>y.mutate(),disabled:y.isPending,children:"Generate This Week's Checks"})]}),j&&j.length>0&&a.jsx(ye,{className:"overflow-hidden",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"bg-muted/30",children:[a.jsx("th",{className:"text-left p-3 font-medium text-muted-foreground",children:"FSG Part #"}),a.jsx("th",{className:"text-left p-3 font-medium text-muted-foreground",children:"Product"}),a.jsx("th",{className:"text-left p-3 font-medium text-muted-foreground",children:"Location"}),a.jsx("th",{className:"text-center p-3 font-medium text-muted-foreground",children:"System Qty"}),a.jsx("th",{className:"text-center p-3 font-medium text-muted-foreground",children:"Counted"}),a.jsx("th",{className:"text-center p-3 font-medium text-muted-foreground",children:"Variance"}),a.jsx("th",{className:"text-left p-3 font-medium text-muted-foreground",children:"Notes"}),r==="current"&&h&&a.jsx("th",{className:"text-center p-3 font-medium text-muted-foreground w-24",children:"Action"})]})}),a.jsx("tbody",{children:j.map(E=>{const _=!!E.completedAt,R=i[E.id],H=u[E.id],L=E.variance!==null?E.variance:null;return a.jsxs("tr",{className:`border-t ${_?"bg-muted/10":"hover:bg-muted/20"} ${L!==null&&Math.abs(L)>0?"bg-amber-50/50":""}`,children:[a.jsx("td",{className:"p-3 font-mono text-xs",children:E.fsgPartNumber||"—"}),a.jsx("td",{className:"p-3",children:a.jsx("span",{className:`font-medium ${_?"text-muted-foreground":""}`,children:E.productName})}),a.jsx("td",{className:"p-3",children:E.storageLocation?a.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground",children:[a.jsx(Ra,{className:"w-3 h-3"}),E.storageLocation]}):"—"}),a.jsx("td",{className:"p-3 text-center font-medium",children:r==="current"?E.currentSystemQty:E.systemQty}),a.jsx("td",{className:"p-3 text-center",children:_?a.jsx("span",{className:"font-semibold",children:E.countedQty}):r==="current"&&h?a.jsx("input",{type:"number",className:"w-20 px-2 py-1 border rounded text-center text-sm",placeholder:"Count",value:R??"",onChange:I=>l(W=>({...W,[E.id]:I.target.value}))}):"—"}),a.jsx("td",{className:"p-3 text-center",children:L!==null?a.jsxs("span",{className:`font-semibold ${L>0?"text-green-600":L<0?"text-red-600":"text-muted-foreground"}`,children:[L>0?"+":"",L,E.adjustmentMade&&a.jsx("span",{className:"ml-1 text-xs text-amber-600",title:"Inventory adjusted",children:"⚡"})]}):"—"}),a.jsx("td",{className:"p-3 text-xs text-muted-foreground",children:_?E.notes||"—":r==="current"&&h?a.jsx("input",{type:"text",className:"w-full px-2 py-1 border rounded text-sm",placeholder:"Notes...",value:H??"",onChange:I=>d(W=>({...W,[E.id]:I.target.value}))}):"—"}),r==="current"&&h&&a.jsx("td",{className:"p-3 text-center",children:_?a.jsx(st,{className:"w-5 h-5 text-green-500 mx-auto"}):a.jsx(ne,{size:"sm",className:"rounded-xl h-7",disabled:R===void 0||R===""||w.isPending,onClick:()=>w.mutate({checkId:E.id,countedQty:Number(R),notes:H||""}),children:w.isPending?a.jsx(Me,{className:"w-3 h-3 animate-spin"}):"Submit"})})]},E.id)})})]})}),r==="history"&&j&&j.length>0&&a.jsxs(ye,{className:"p-4",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(uJ,{className:"w-4 h-4 text-muted-foreground"}),a.jsx("h3",{className:"font-semibold text-sm",children:"Variance Summary"})]}),(()=>{const E=j.filter(L=>L.variance!==null&&Math.abs(L.variance)>0),_=E.length,R=j.filter(L=>L.completedAt).length,H=_>0?(E.reduce((L,I)=>L+Math.abs(I.variance),0)/_).toFixed(1):"0";return a.jsxs("div",{className:"grid grid-cols-3 gap-4 text-center",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-2xl font-bold text-foreground",children:R}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Counted"})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-2xl font-bold text-amber-600",children:_}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"With Variance"})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-2xl font-bold text-foreground",children:H}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Avg Variance"})]})]})})()]})]})}const j2=async(e,t)=>{const n=localStorage.getItem("fs_team_token"),r=await fetch(e,{...t,headers:{Authorization:`Bearer ${n}`,"Content-Type":"application/json",...t?.headers||{}}});if(!r.ok&&t?.method&&t.method!=="GET"){const s=await r.json().catch(()=>({}));throw new Error(s.error||`Request failed (${r.status})`)}return r},XEe=["All Categories","Aluminum Coil","Steel Coil","Copper Coil","Downspouts","End Caps","Miters","Gutter Guard","Hangers & Hardware","Straps","Screws & Fasteners","Sealant","Paint"];function QEe(){const{teamMember:e}=Nn(),t=wt(),{toast:n}=nr(),[r,s]=v.useState(""),[i,l]=v.useState("All Categories"),[u,d]=v.useState({}),[f,h]=v.useState(!1),p=e?.role==="admin"||e?.role==="manager",x=Xe({queryKey:["inventory-stock"],queryFn:async()=>(await j2("/api/inventory/stock")).json()}),y=Xe({queryKey:["low-stock"],queryFn:async()=>(await j2("/api/inventory/low-stock")).json()}),w=nt({mutationFn:async A=>(await j2("/api/inventory/reorder-points",{method:"PATCH",body:JSON.stringify({updates:A})})).json(),onSuccess:()=>{t.invalidateQueries({queryKey:["inventory-stock"]}),t.invalidateQueries({queryKey:["low-stock"]}),d({}),h(!1),n({title:"Reorder points saved"})},onError:A=>n({title:A.message,variant:"destructive"})}),j=(x.data||[]).filter(A=>{if(i!=="All Categories"&&A.category!==i)return!1;if(r){const P=r.toLowerCase();return A.productName.toLowerCase().includes(P)||A.sku5star?.toLowerCase().includes(P)}return!0}).sort((A,P)=>A.productName.localeCompare(P.productName)),b=A=>u[A.productId]?u[A.productId]:{reorderPoint:String(A.reorderPoint??0),reorderQty:String(A.reorderQty??0)},C=(A,P,E)=>{d(_=>({..._,[A]:{...N(A),[P]:E}})),h(!0)},N=A=>{const P=j.find(E=>E.productId===A);return u[A]?u[A]:{reorderPoint:String(P?.reorderPoint??0),reorderQty:String(P?.reorderQty??0)}},k=()=>{const A=Object.entries(u).map(([P,E])=>({productId:Number(P),reorderPoint:Number(E.reorderPoint)||0,reorderQty:Number(E.reorderQty)||0}));A.length!==0&&w.mutate(A)},T=y.data||[];return x.isLoading?a.jsx("div",{className:"flex justify-center p-8",children:a.jsx(Me,{className:"w-8 h-8 animate-spin text-muted-foreground"})}):a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-2xl font-display font-bold text-foreground",children:"Reorder Points"}),a.jsx("p",{className:"text-muted-foreground mt-1",children:"Set minimum stock levels and reorder quantities"})]}),p&&f&&a.jsxs(ne,{className:"rounded-xl",onClick:k,disabled:w.isPending,children:[w.isPending?a.jsx(Me,{className:"w-4 h-4 mr-2 animate-spin"}):a.jsx(Si,{className:"w-4 h-4 mr-2"}),"Save Changes (",Object.keys(u).length,")"]})]}),T.length>0&&a.jsxs(ye,{className:"p-4 border-amber-200 bg-amber-50/50",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[a.jsx(Kt,{className:"w-5 h-5 text-amber-600"}),a.jsxs("h3",{className:"font-semibold text-amber-800",children:[T.length," Products Below Reorder Point"]})]}),a.jsxs("div",{className:"grid gap-2",children:[T.slice(0,8).map(A=>a.jsxs("div",{className:"flex items-center justify-between text-sm",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Kq,{className:"w-3 h-3 text-red-500"}),a.jsx("span",{className:"font-medium",children:A.productName}),a.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:A.fsgPartNumber})]}),a.jsxs("div",{className:"text-xs",children:[a.jsx("span",{className:"text-red-600 font-semibold",children:A.qtyOnHand}),a.jsxs("span",{className:"text-muted-foreground",children:[" / ",A.reorderPoint," min"]})]})]},A.productId)),T.length>8&&a.jsxs("p",{className:"text-xs text-muted-foreground",children:["+",T.length-8," more..."]})]})]}),a.jsxs("div",{className:"flex gap-3",children:[a.jsxs("div",{className:"relative flex-1",children:[a.jsx(Da,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),a.jsx("input",{className:"w-full pl-9 pr-3 py-2 border rounded-xl text-sm",placeholder:"Search products...",value:r,onChange:A=>s(A.target.value)})]}),a.jsx("select",{className:"border rounded-xl px-3 py-2 text-sm bg-background",value:i,onChange:A=>l(A.target.value),children:XEe.map(A=>a.jsx("option",{children:A},A))})]}),a.jsx(ye,{className:"overflow-hidden",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"bg-muted/30",children:[a.jsx("th",{className:"text-left p-3 font-medium text-muted-foreground",children:"FSG Part #"}),a.jsx("th",{className:"text-left p-3 font-medium text-muted-foreground",children:"Product"}),a.jsx("th",{className:"text-left p-3 font-medium text-muted-foreground",children:"Category"}),a.jsx("th",{className:"text-center p-3 font-medium text-muted-foreground",children:"On Hand"}),a.jsx("th",{className:"text-center p-3 font-medium text-muted-foreground",children:"Reorder Point"}),a.jsx("th",{className:"text-center p-3 font-medium text-muted-foreground",children:"Reorder Qty"}),a.jsx("th",{className:"text-center p-3 font-medium text-muted-foreground",children:"Status"})]})}),a.jsx("tbody",{children:j.map(A=>{const P=b(A),E=Number(P.reorderPoint)||0,_=E>
2180&&(A.qtyOnHand??0)<=E;return a.jsxs("tr",{className:`border-t hover:bg-muted/20 ${_?"bg-red-50/50":""}`,children:[a.jsx("td",{className:"p-3 font-mono text-xs",children:A.sku5star||"—"}),a.jsxs("td",{className:"p-3 font-medium",children:[A.productName,A.color&&a.jsxs("span",{className:"text-muted-foreground ml-1",children:["- ",A.color]})]}),a.jsx("td",{className:"p-3 text-muted-foreground text-xs",children:A.category}),a.jsx("td",{className:"p-3 text-center",children:a.jsx("span",{className:_?"text-red-600 font-semibold":"",children:A.qtyOnHand})}),a.jsx("td",{className:"p-3 text-center",children:p?a.jsx("input",{type:"number",className:`w-20 px-2 py-1 border rounded text-center text-sm ${u[A.productId]?"border-primary bg-primary/5":""}`,value:P.reorderPoint,onChange:R=>C(A.productId,"reorderPoint",R.target.value),min:"0"}):a.jsx("span",{children:A.reorderPoint})}),a.jsx("td",{className:"p-3 text-center",children:p?a.jsx("input",{type:"number",className:`w-20 px-2 py-1 border rounded text-center text-sm ${u[A.productId]?"border-primary bg-primary/5":""}`,value:P.reorderQty,onChange:R=>C(A.productId,"reorderQty",R.target.value),min:"0"}):a.jsx("span",{children:A.reorderQty??0})}),a.jsx("td",{className:"p-3 text-center",children:_?a.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-semibold bg-red-100 text-red-700",children:[a.jsx(Kt,{className:"w-3 h-3"}),"Low"]}):E>0?a.jsx("span",{className:"inline-flex px-2 py-0.5 rounded-full text-xs font-semibold bg-green-100 text-green-700",children:"OK"}):a.jsx("span",{className:"text-xs text-muted-foreground",children:"Not set"})})]},A.productId)})})]})})]})}const Yx=(e,t)=>{const n=localStorage.getItem("fs_team_token");return fetch(e,{...t,headers:{Authorization:`Bearer ${n}`,...t?.headers||{}}})};function ZEe(){const{toast:e}=nr(),t=wt(),[n,r]=v.useState(null),[s,i]=v.useState(!1),l=v.useRef(null),{data:u=[]}=Xe({queryKey:["physical-count-history"],queryFn:async()=>{const y=await Yx("/api/inventory/physical-count/history");if(!y.ok)throw new Error("Failed to load count history");return y.json()}});async function d(){i(!0);try{const y=await Yx("/api/inventory/physical-count/export");if(!y.ok)throw new Error("Export failed");const w=await y.blob(),j=URL.createObjectURL(w),b=document.createElement("a");b.href=j,b.download=`FSG-Physical-Inventory-${new Date().toISOString().slice(0,10)}.xlsx`,document.body.appendChild(b),b.click(),b.remove(),URL.revokeObjectURL(j),e({title:"Count sheet downloaded",description:"Open in Excel or Google Sheets to fill in counts."})}catch(y){e({title:"Export failed",description:y.message??"Unknown error",variant:"destructive"})}finally{i(!1)}}const f=nt({mutationFn:async y=>{const w=new FormData;w.append("file",y);const j=await Yx("/api/inventory/physical-count/import",{method:"POST",body:w});if(!j.ok){const b=await j.json().catch(()=>({}));throw new Error(b.error||"Upload failed")}return j.json()},onSuccess:y=>{r(y),e({title:"File parsed",description:"Review the changes below, then confirm."})},onError:y=>{e({title:"Upload failed",description:y.message,variant:"destructive"})}}),h=nt({mutationFn:async()=>{if(!n)throw new Error("Nothing to commit");const y=await Yx("/api/inventory/physical-count/commit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({coilUpdates:n.coilUpdates,stockUpdates:n.stockUpdates})});if(!y.ok){const w=await y.json().catch(()=>({}));throw new Error(w.error||"Commit failed")}return y.json()},onSuccess:y=>{e({title:"Inventory updated",description:`Coils updated: ${y.coilsUpdated}, stock items updated: ${y.stockUpdated}`}),r(null),l.current&&(l.current.value=""),t.invalidateQueries({queryKey:["physical-count-history"]})},onError:y=>{e({title:"Commit failed",description:y.message,variant:"destructive"})}});function p(y){const w=y.target.files?.[0];w&&f.mutate(w)}function x(){r(null),l.current&&(l.current.value="")}return n?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("button",{onClick:x,className:"p-2 hover:bg-muted rounded-lg",children:a.jsx(Sg,{className:"w-4 h-4"})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-2xl font-bold",children:"Review Count"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Verify changes before applying."})]})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(ne,{variant:"outline",onClick:x,className:"rounded-xl",children:"Cancel"}),a.jsx(ne,{onClick:()=>h.mutate(),disabled:h.isPending,className:"rounded-xl",children:h.isPending?a.jsxs(a.Fragment,{children:[a.jsx(Me,{className:"w-4 h-4 mr-2 animate-spin"}),"Applying…"]}):a.jsxs(a.Fragment,{children:[a.jsx(st,{className:"w-4 h-4 mr-2"}),"Confirm & Apply"]})})]})]}),a.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[a.jsxs(ye,{className:"p-5",children:[a.jsx("div",{className:"flex items-start justify-between mb-3",children:a.jsx("div",{className:"p-2 rounded-lg bg-blue-100 text-blue-600",children:a.jsx(Tm,{className:"w-5 h-5"})})}),a.jsx("p",{className:"text-xs uppercase tracking-wider text-muted-foreground font-semibold mb-1",children:"Coils Counted"}),a.jsx("h3",{className:"text-2xl font-bold",children:n.summary.coilsUpdated})]}),a.jsxs(ye,{className:"p-5",children:[a.jsx("div",{className:"flex items-start justify-between mb-3",children:a.jsx("div",{className:"p-2 rounded-lg bg-purple-100 text-purple-600",children:a.jsx(Jn,{className:"w-5 h-5"})})}),a.jsx("p",{className:"text-xs uppercase tracking-wider text-muted-foreground font-semibold mb-1",children:"Stock Items"}),a.jsx("h3",{className:"text-2xl font-bold",children:n.summary.stockItemsUpdated})]}),a.jsxs(ye,{className:"p-5",children:[a.jsx("div",{className:"flex items-start justify-between mb-3",children:a.jsx("div",{className:"p-2 rounded-lg bg-amber-100 text-amber-600",children:a.jsx(Kt,{className:"w-5 h-5"})})}),a.jsx("p",{className:"text-xs uppercase tracking-wider text-muted-foreground font-semibold mb-1",children:"Skipped"}),a.jsx("h3",{className:"text-2xl font-bold",children:n.summary.skippedCount})]})]}),n.skipped.length>0&&a.jsx(ye,{className:"p-4 border-amber-200 bg-amber-50",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(Kt,{className:"w-5 h-5 text-amber-600 flex-shrink-0 mt-0.5"}),a.jsxs("div",{className:"flex-1",children:[a.jsxs("p",{className:"font-semibold text-amber-900",children:[n.skipped.length," row(s) skipped"]}),a.jsx("ul",{className:"mt-2 space-y-1 text-sm text-amber-800 max-h-40 overflow-y-auto",children:n.skipped.map((y,w)=>
218a.jsxs("li",{children:["• ",y.sheet,y.row?` row ${y.row}`:"",": ",y.reason]},w))})]})]})}),n.coilUpdates.length>0&&a.jsxs(ye,{className:"overflow-hidden",children:[a.jsxs("div",{className:"p-4 border-b bg-secondary/30 flex items-center gap-2",children:[a.jsx(Tm,{className:"w-4 h-4"}),a.jsxs("h3",{className:"font-semibold",children:["Coil Stock Updates (",n.coilUpdates.length,")"]})]}),a.jsx("div",{className:"overflow-x-auto max-h-96",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{className:"bg-secondary/20 sticky top-0",children:a.jsxs("tr",{children:[a.jsx("th",{className:"px-3 py-2 text-left font-semibold",children:"FSG Part #"}),a.jsx("th",{className:"px-3 py-2 text-left font-semibold",children:"Product"}),a.jsx("th",{className:"px-3 py-2 text-left font-semibold",children:"Color / Temper"}),a.jsx("th",{className:"px-3 py-2 text-left font-semibold",children:"Supplier"}),a.jsx("th",{className:"px-3 py-2 text-right font-semibold",children:"Full Rolls"}),a.jsx("th",{className:"px-3 py-2 text-right font-semibold",children:"Partial Rolls (weighed)"})]})}),a.jsx("tbody",{children:n.coilUpdates.map(y=>{const w=j=>j.length===0?"none":j.map(b=>b.ft>0?`${b.ft} ft (${Math.round(b.lbs*10)/10} lbs)`:`${Math.round(b.lbs*10)/10} lbs`).join(", ");return a.jsxs("tr",{className:"border-t",children:[a.jsx("td",{className:"px-3 py-2 font-mono text-xs",children:y.sku}),a.jsxs("td",{className:"px-3 py-2",children:[y.productName,y.size?a.jsxs("span",{className:"text-muted-foreground text-xs",children:[" · ",y.size]}):null]}),a.jsx("td",{className:"px-3 py-2 text-muted-foreground",children:y.color}),a.jsx("td",{className:"px-3 py-2 text-muted-foreground",children:y.supplierName}),a.jsx("td",{className:"px-3 py-2 text-right",children:y.countedFullRolls===null?a.jsxs("span",{className:"text-muted-foreground",children:[y.currentFullRolls," (no change)"]}):a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-muted-foreground",children:y.currentFullRolls})," → ",a.jsx("span",{className:"font-semibold",children:y.countedFullRolls}),y.deltaFullRolls!==0&&a.jsxs("span",{className:y.deltaFullRolls<0?"text-red-600":"text-green-600",children:[" ","(",y.deltaFullRolls>0?"+":"",y.deltaFullRolls,")"]})]})}),a.jsx("td",{className:"px-3 py-2 text-right",children:y.countedPartials===null?a.jsxs("span",{className:"text-muted-foreground",children:[w(y.currentPartials)," (no change)"]}):a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-muted-foreground",children:w(y.currentPartials)})," → ",a.jsx("span",{className:"font-semibold",children:w(y.countedPartials)}),y.deltaPartialLbs!==0&&a.jsxs("span",{className:y.deltaPartialLbs<0?"text-red-600":"text-green-600",children:[" ","(",y.deltaPartialLbs>0?"+":"",y.deltaPartialLbs.toFixed(1)," lbs)"]})]})})]},y.productId)})})]})})]}),n.stockUpdates.length>0&&a.jsxs(ye,{className:"overflow-hidden",children:[a.jsxs("div",{className:"p-4 border-b bg-secondary/30 flex items-center gap-2",children:[a.jsx(Jn,{className:"w-4 h-4"}),a.jsxs("h3",{className:"font-semibold",children:["Stock Quantity Updates (",n.stockUpdates.length,")"]})]}),a.jsx("div",{className:"overflow-x-auto max-h-96",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{className:"bg-secondary/20 sticky top-0",children:a.jsxs("tr",{children:[a.jsx("th",{className:"px-3 py-2 text-left font-semibold",children:"Category"}),a.jsx("th",{className:"px-3 py-2 text-left font-semibold",children:"FSG Part #"}),a.jsx("th",{className:"px-3 py-2 text-left font-semibold",children:"Product"}),a.jsx("th",{className:"px-3 py-2 text-left font-semibold",children:"Color / Size"}),a.jsx("th",{className:"px-3 py-2 text-left font-semibold",children:"Supplier"}),a.jsx("th",{className:"px-3 py-2 text-right font-semibold",children:"Current"}),a.jsx("th",{className:"px-3 py-2 text-right font-semibold",children:"Counted"}),a.jsx("th",{className:"px-3 py-2 text-right font-semibold",children:"Delta"})]})}),a.jsx("tbody",{children:n.stockUpdates.map(y=>a.jsxs("tr",{className:"border-t",children:[a.jsx("td",{className:"px-3 py-2 text-xs text-muted-foreground",children:y.category}),a.jsx("td",{className:"px-3 py-2 font-mono text-xs",children:y.sku}),a.jsx("td",{className:"px-3 py-2",children:y.productName}),a.jsx("td",{className:"px-3 py-2 text-muted-foreground",children:[y.color,y.size].filter(
218Boolean).join(" · ")}),a.jsx("td",{className:"px-3 py-2 text-muted-foreground",children:y.supplierName}),a.jsxs("td",{className:"px-3 py-2 text-right",children:[y.currentQty," ",y.unitLabel]}),a.jsxs("td",{className:"px-3 py-2 text-right font-semibold",children:[y.countedQty," ",y.unitLabel]}),a.jsxs("td",{className:`px-3 py-2 text-right font-semibold ${y.delta<0?"text-red-600":y.delta>0?"text-green-600":"text-muted-foreground"}`,children:[y.delta>0?"+":"",y.delta]})]},y.productId))})]})})]})]}):a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs(ye,{className:"p-6",children:[a.jsxs("div",{className:"flex items-start gap-4 mb-4",children:[a.jsx("div",{className:"p-3 rounded-xl bg-blue-100 text-blue-600",children:a.jsx(MJ,{className:"w-6 h-6"})}),a.jsxs("div",{className:"flex-1",children:[a.jsx("h3",{className:"text-lg font-bold mb-1",children:"1. Download Count Sheet"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Generate an Excel workbook with all your products pre-filled. Print it or fill it in on a tablet while walking the shop."})]})]}),a.jsxs("ul",{className:"text-xs text-muted-foreground mb-4 space-y-1.5 ml-1",children:[a.jsx("li",{children:"• Coils sheet: full rolls + a separate weight column for each opened (partial) roll"}),a.jsx("li",{children:"• Weigh each remnant on the scale — footage is computed automatically from weight"}),a.jsx("li",{children:"• One sheet per category (Downspouts, End Caps, Hangers, etc.) with a Supplier column"}),a.jsx("li",{children:"• Frozen header rows for easy scrolling"})]}),a.jsx(ne,{onClick:d,disabled:s,className:"w-full rounded-xl",children:s?a.jsxs(a.Fragment,{children:[a.jsx(Me,{className:"w-4 h-4 mr-2 animate-spin"}),"Generating…"]}):a.jsxs(a.Fragment,{children:[a.jsx(Ag,{className:"w-4 h-4 mr-2"}),"Download Count Sheet"]})})]}),a.jsxs(ye,{className:"p-6",children:[a.jsxs("div",{className:"flex items-start gap-4 mb-4",children:[a.jsx("div",{className:"p-3 rounded-xl bg-green-100 text-green-600",children:a.jsx(Tg,{className:"w-6 h-6"})}),a.jsxs("div",{className:"flex-1",children:[a.jsx("h3",{className:"text-lg font-bold mb-1",children:"2. Upload Counted Sheet"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Once you've counted, upload the filled-in workbook. You'll see a preview of all changes before anything is committed."})]})]}),a.jsxs("ul",{className:"text-xs text-muted-foreground mb-4 space-y-1.5 ml-1",children:[a.jsx("li",{children:"• Coil counts → full rolls + each weighed remnant tracked individually with lbs and ft"}),a.jsx("li",{children:"• Stock counts set on-hand quantities directly"}),a.jsx("li",{children:"• Every count logged as an audit-trail adjustment"})]}),a.jsx("input",{ref:l,type:"file",accept:".xlsx,.xls",onChange:p,className:"hidden"}),a.jsx(ne,{onClick:()=>l.current?.click(),disabled:f.isPending,className:"w-full rounded-xl",variant:"outline",children:f.isPending?a.jsxs(a.Fragment,{children:[a.jsx(Me,{className:"w-4 h-4 mr-2 animate-spin"}),"Parsing…"]}):a.jsxs(a.Fragment,{children:[a.jsx(Tg,{className:"w-4 h-4 mr-2"}),"Upload Counted Sheet"]})})]})]}),a.jsxs(ye,{className:"p-6 bg-blue-50 border-blue-200",children:[a.jsxs("h4",{className:"font-semibold text-blue-900 mb-2 flex items-center gap-2",children:[a.jsx(Ag,{className:"w-4 h-4"}),"Tips for accurate counts"]}),a.jsxs("ul",{className:"text-sm text-blue-800 space-y-1.5 ml-1",children:[a.jsxs("li",{children:["• ",a.jsx("strong",{children:"Counted blank = no change."})," Only fill in items you actually counted."]}),a.jsxs("li",{children:["• ",a.jsx("strong",{children:"Counted = 0"})," means out of stock (for coils: 0 full rolls, or 0 in Partial #1 for zero remnants)."]}),a.jsxs("li",{children:["• ",a.jsx("strong",{children:"Weigh each opened roll separately"})," — enter each weight in its own Partial #1–#4 column. Don't add weights together; the system computes each remnant's footage so you can see which jobs it covers."]}),a.jsxs("li",{children:["• ",a.jsx("strong",{children:"Supplier is 
218informational"})," — it helps you tell IMS and VGS lines apart; editing it won't move a product."]}),a.jsxs("li",{children:["• ",a.jsx("strong",{children:"Don't edit"}),' the columns marked "DO NOT EDIT" — they contain the IDs the system needs to match rows.']})]})]}),a.jsxs(ye,{className:"overflow-hidden",children:[a.jsxs("div",{className:"p-4 border-b bg-secondary/30 flex items-center gap-2",children:[a.jsx(Hl,{className:"w-4 h-4"}),a.jsx("h3",{className:"font-semibold",children:"Count History"})]}),u.length===0?a.jsx("div",{className:"p-6 text-sm text-muted-foreground text-center",children:"No physical counts recorded yet. Your first count will appear here."}):a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{className:"bg-secondary/20",children:a.jsxs("tr",{children:[a.jsx("th",{className:"px-4 py-2 text-left font-semibold",children:"Date"}),a.jsx("th",{className:"px-4 py-2 text-left font-semibold",children:"Counted By"}),a.jsx("th",{className:"px-4 py-2 text-right font-semibold",children:"Coils Counted"}),a.jsx("th",{className:"px-4 py-2 text-right font-semibold",children:"Stock Items"})]})}),a.jsx("tbody",{children:u.map(y=>a.jsxs("tr",{className:"border-t",children:[a.jsx("td",{className:"px-4 py-2",children:new Date(y.countedAt).toLocaleString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}),a.jsx("td",{className:"px-4 py-2",children:y.countedByName}),a.jsx("td",{className:"px-4 py-2 text-right",children:y.rollsUpdated}),a.jsx("td",{className:"px-4 py-2 text-right",children:y.stockUpdated})]},y.id))})]})})]})]})}const HO=(e,t)=>{const n=localStorage.getItem("fs_team_token");return fetch(e,{...t,headers:{Authorization:`Bearer ${n}`,"Content-Type":"application/json",...t?.headers||{}}})},du="text-xs font-semibold text-muted-foreground uppercase tracking-wider block mb-1",fu="w-full px-3 py-2 bg-white border border-border rounded-xl outline-none focus:border-primary text-sm",Xx=()=>({name:"",contactName:"",phone:"",email:"",website:"",notes:""});function JEe({onClose:e,onSaved:t}){const{toast:n}=nr(),[r,s]=v.useState([Xx(),Xx(),Xx()]),[i,l]=v.useState(""),[u,d]=v.useState(""),[f,h]=v.useState(null);function p(b,C,N){s(k=>k.map((T,A)=>A===b?{...T,[C]:N}:T))}function x(){s(b=>[...b,Xx()])}function y(b){s(C=>C.filter((N,k)=>k!==b))}function w(){const b=i.split(/\r?\n/).map(N=>N.trim()).filter(Boolean);if(b.length===0)return;const C=b.map(N=>{const k=N.includes("	")?N.split("	"):N.split(","),[T="",A="",P="",E="",_="",...R]=k.map(H=>H.trim());return{name:T,contactName:A,phone:P,email:E,website:_,notes:R.join(", ")}});s(C),l("")}const j=nt({mutationFn:async()=>{const b=r.filter(N=>N.name.trim()||N.contactName.trim()||N.phone.trim()||N.email.trim()||N.website.trim()||N.notes.trim()).map(N=>({name:N.name.trim(),contactName:N.contactName.trim(),phone:N.phone.trim(),email:N.email.trim(),website:N.website.trim(),notes:N.notes.trim()}));if(b.length===0)throw new Error("Enter at least one supplier row");const C=await HO("/api/inventory/suppliers/bulk",{method:"POST",body:JSON.stringify({suppliers:b})});if(!C.ok){const N=await C.json().catch(()=>({}));throw new Error(N.error||"Failed to add suppliers")}return C.json()},onSuccess:b=>{h({addedCount:b.addedCount,skipped:b.skipped||[]}),b.addedCount>0&&t(),n({title:`${b.addedCount} supplier${b.addedCount!==1?"s":""} added`,description:b.skippedCount>0?`${b.skippedCount} skipped`:void 0})},onError:b=>d(b.message)});return a.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm z-50 flex items-center justify-center p-4 overflow-y-auto",children:a.jsxs("div",{className:"bg-card rounded-2xl shadow-2xl border border-border w-full max-w-4xl my-4",children:[a.jsxs("div",{className:"p-6 border-b border-border flex items-start justify-between",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-lg font-bold text-foreground",children:"Bulk Add Suppliers"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Add several suppliers at once — name is required, the rest is optional."})]}),a.jsx("button",{onClick:e,className:"p-1 rounded-lg hover:bg-muted text-muted-foreground",children:a.jsx(an,{className:"w-5 h-5"})})]}),a.jsx("div",{className:"p-6 space-y-4 max-h-[65vh] overflow-y-auto",children:f?a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center gap-2 text-green-700 bg-green-50 border border-green-200 rounded-xl p-4",children:[a.jsx(st,{className:"w-5 h-5"}),a.jsxs("span",{className:"font-medium",children:[f.addedCount," supplier",f.addedCount!==1?"s":""," added."]})]}),f.skipped.length>0&&a.jsxs("div",{className:"bg-amber-50 border border-amber-200 rounded-xl p-4",children:[a.jsxs("p",{className:"font-medium text-amber-800 mb-2",children:[f.skipped.length," row",f.skipped.length!==1?"s":""," skipped:"]}),a.jsx("ul",{className:"space-y-1 text-sm text-amber-700",children:f.skipped.map((b,C)=>a.jsxs("li",{children:["Row ",b.row,b.name?` (${b.name})`:"",": ",b.reason]},C))})]})]}):a.jsxs(a.Fragment,{children:[a.jsxs("details",{className:"bg-secondary/30 rounded-xl",children:[a.jsx("summary",{className:"px-4 py-2.5 cursor-pointer text-sm font-medium text-foreground",children:"Paste rows (one per line)"}),a.jsxs("div",{className:"px-4 pb-4 space-y-2",children:[a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Columns separated by tab or comma: ",a.jsx("span",{className:"font-mono",children:"name, contact, phone, email, website, notes"})]}),a.jsx("textarea",{value:i,onChange:b=>l(b.target.value),rows:4,placeholder:`Acme Metals, Jane Doe, 555-1234, [email protected]
219VGS Supply, , 555-9876`,className:"w-full px-3 py-2 bg-white border border-border rounded-xl outline-none focus:border-primary text-sm font-mono"}),a.jsx(ne,{type:"button",variant:"outline",size:"sm",className:"rounded-xl",onClick:w,disabled:!i.trim(),children:"Fill rows from paste"})]})]}),a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm border-separate border-spacing-y-2",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"text-left",children:[a.jsx("th",{className:du+" px-2",children:"Name *"}),a.jsx("th",{className:du+" px-2",children:"Contact"}),a.jsx("th",{className:du+" px-2",children:"Phone"}),a.jsx("th",{className:du+" px-2",children:"Email"}),a.jsx("th",{className:du+" px-2",children:"Website"}),a.jsx("th",{className:du+" px-2",children:"Notes"}),a.jsx("th",{className:"w-8"})]})}),a.jsx("tbody",{children:r.map((b,C)=>a.jsxs("tr",{children:[a.jsx("td",{className:"px-1",children:a.jsx("input",{value:b.name,onChange:N=>p(C,"name",N.target.value),placeholder:"Supplier name",className:fu})}),a.jsx("td",{className:"px-1",children:a.jsx("input",{value:b.contactName,onChange:N=>p(C,"contactName",N.target.value),placeholder:"Contact",className:fu})}),a.jsx("td",{className:"px-1",children:a.jsx("input",{value:b.phone,onChange:N=>p(C,"phone",N.target.value),placeholder:"Phone",className:fu})}),a.jsx("td",{className:"px-1",children:a.jsx("input",{value:b.email,onChange:N=>p(C,"email",N.target.value),placeholder:"Email",className:fu})}),a.jsx("td",{className:"px-1",children:a.jsx("input",{value:b.website,onChange:N=>p(C,"website",N.target.value),placeholder:"Website",className:fu})}),a.jsx("td",{className:"px-1",children:a.jsx("input",{value:b.notes,onChange:N=>p(C,"notes",N.target.value),placeholder:"Notes",className:fu})}),a.jsx("td",{className:"px-1 text-center",children:a.jsx("button",{onClick:()=>y(C),className:"p-1 rounded-lg hover:bg-red-50 text-red-400 hover:text-red-600 transition-colors",disabled:r.length===1,children:a.jsx(on,{className:"w-4 h-4"})})})]},C))})]})}),a.jsxs(ne,{type:"button",variant:"ghost",size:"sm",className:"text-muted-foreground",onClick:x,children:[a.jsx(Ft,{className:"w-4 h-4 mr-1"}),"Add another row"]}),u&&a.jsx("p",{className:"text-xs text-red-600 font-medium",children:u})]})}),a.jsx("div",{className:"p-6 pt-4 flex gap-3 border-t border-border",children:f?a.jsx("button",{onClick:e,className:"flex-1 px-4 py-2.5 rounded-xl bg-primary text-primary-foreground text-sm font-semibold hover:bg-primary/90 transition-colors",children:"Done"}):a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:e,className:"flex-1 px-4 py-2.5 rounded-xl border border-border text-sm font-medium hover:bg-muted transition-colors",children:"Cancel"}),a.jsxs("button",{onClick:()=>j.mutate(),disabled:j.isPending,className:"flex-1 px-4 py-2.5 rounded-xl bg-primary text-primary-foreground text-sm font-semibold hover:bg-primary/90 transition-colors disabled:opacity-60 flex items-center justify-center gap-2",children:[j.isPending&&a.jsx(Me,{className:"w-4 h-4 animate-spin"}),j.isPending?"Saving...":"Add Suppliers"]})]})})]})})}function e_e({suppliers:e,onClose:t,onDeleted:n}){const{toast:r}=nr(),[s,i]=v.useState(""),[l,u]=v.useState(null),d=nt({mutationFn:async()=>{const f=await HO("/api/inventory/suppliers/bulk-delete",{method:"POST",body:JSON.stringify({ids:e.map(h=>h.id)})});if(!f.ok){const h=await f.json().catch(()=>({}));throw new Error(h.error||"Failed to remove suppliers")}return f.json()},onSuccess:f=>{u({deletedCount:f.deletedCount,deactivatedCount:f.deactivatedCount,deactivated:f.deactivated||[]}),n(),r({title:`${f.deletedCount+f.deactivatedCount} supplier${f.deletedCount+f.deactivatedCount!==1?"s":""} removed`,description:f.deactivatedCount>0?`${f.deactivatedCount} deactivated (still used by products)`:void 0})},onError:f=>i(f.message)});return a.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm z-50 flex items-center justify-center p-4",children:a.jsxs("div",{className:"bg-card rounded-2xl shadow-2xl border border-border w-full max-w-md",children:[a.jsx("div",{className:"p-6 border-b border-border",children:a.jsxs("h2",{className:"text-lg font-bold text-foreground",children:["Remove ",e.length," Supplier",e.length!==1?"s":"","?"]})}),a.jsx("div",{className:"p-6 space-y-4",children:l?a.jsxs("div",{className:"space-y-3",children:[l.deletedCount>0&&a.jsxs("div",{className:"flex items-center gap-2 text-green-700 bg-green-50 border border-green-200 rounded-xl p-3 text-sm",children:[a.jsx(st,{className:"w-4 h-4"}),l.deletedCount," fully deleted."]}),l.deactivatedCount>0&&a.jsxs("div",{className:"bg-amber-50 border border-amber-200 rounded-xl p-3 text-sm text-amber-800",children:[a.jsxs("div",{className:"flex items-center gap-2 font-medium mb-1",children:[a.jsx(Kt,{className:"w-4 h-4"}),l.deactivatedCount," deactivated instead of deleted"]}),a.jsx("p",{className:"text-amber-700",children:"These are still used by products, so they were hidden from active lists to avoid orphaning those products:"}),a.jsx("ul",{className:"mt-1 list-disc list-inside text-amber-700",children:l.deactivated.map(f=>a.jsx("li",{children:f.name},f.id))})]})]}):a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"Suppliers not used by any products will be permanently deleted. Suppliers still referenced by products will be deactivated (hidden from active lists) instead, so no product is left orphaned."}),a.jsx("div",{className:"bg-secondary/40 rounded-xl p-3 max-h-40 overflow-y-auto",children:a.jsx("ul",{className:"text-sm text-foreground space-y-1",children:e.map(f=>a.jsx("li",{className:"font-medium",children:f.name},f.id))})}),s&&a.jsx("p",{className:"text-xs text-red-600 font-medium",children:s})]})}),a.jsx("div",{className:"p-6 pt-0 flex gap-3",children:l?a.jsx("button",{onClick:t,className:"flex-1 px-4 py-2.5 rounded-xl bg-primary text-primary-foreground text-sm font-semibold hover:bg-primary/90 transition-colors",children:"Done"}):a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:t,className:"flex-1 px-4 py-2.5 rounded-xl border border-border text-sm font-medium hover:bg-muted transition-colors",children:"Cancel"}),a.jsxs("button",{onClick:()=>d.mutate(),disabled:d.isPending,className:"flex-1 px-4 py-2.5 rounded-xl bg-red-600 text-white text-sm font-semibold hover:bg-red-700 transition-colors disabled:opacity-60 flex items-center justify-center gap-2",children:[d.isPending&&a.jsx(Me,{className:"w-4 h-4 animate-spin"}),d.isPending?"Removing...":"Remove"]})]})})]})})}function t_e(){const{teamMember:e}=Nn(),t=wt(),n=!!e?.canManageInventory,[r,s]=v.useState(!1),[i,l]=v.useState(new Set),[u,d]=v.useState(null),{data:f=[],isLoading:h,isError:p}=Xe({queryKey:["inv-suppliers"],queryFn:async()=>{const b=await HO("/api/inventory/suppliers");if(!b.ok)throw new Error("Failed to load suppliers");return b.json()}});function x(b){l(C=>{const N=new Set(C);return N.has(b)?N.delete(b):N.add(b),N})}function y(){l(b=>b.size===f.length?new Set:new Set(f.map(C=>C.id)))}const w=()=>
219t.invalidateQueries({queryKey:["inv-suppliers"]}),j=f.filter(b=>i.has(b.id));return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-2xl font-display font-bold text-foreground",children:"Suppliers"}),a.jsx("p",{className:"text-muted-foreground mt-1",children:"Vendors & manufacturers your products are sourced from"})]}),n&&a.jsxs("div",{className:"flex gap-2",children:[i.size>0&&a.jsxs(ne,{variant:"outline",className:"rounded-xl bg-red-50 border-red-200 text-red-700 hover:bg-red-100 hover:text-red-800",onClick:()=>d(j),children:[a.jsx(on,{className:"w-4 h-4 mr-2"}),"Remove (",i.size,")"]}),a.jsxs(ne,{className:"rounded-xl",onClick:()=>s(!0),children:[a.jsx(Ft,{className:"w-4 h-4 mr-2"}),"Bulk Add"]})]})]}),h&&a.jsx("div",{className:"flex justify-center p-8",children:a.jsx(Me,{className:"w-8 h-8 animate-spin text-muted-foreground"})}),p&&a.jsxs("div",{className:"flex items-center gap-3 p-4 bg-red-50 border border-red-200 rounded-xl",children:[a.jsx(Kt,{className:"w-5 h-5 text-red-500 flex-shrink-0"}),a.jsx("p",{className:"text-sm text-red-700 font-medium",children:"Could not load suppliers."})]}),!h&&!p&&f.length===0&&a.jsxs(ye,{className:"p-8 text-center",children:[a.jsx(Ci,{className:"w-12 h-12 mx-auto text-muted-foreground/40 mb-3"}),a.jsx("p",{className:"text-muted-foreground font-medium",children:"No suppliers yet."}),n&&a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Use “Bulk Add” to enter your vendors and manufacturers."})]}),!h&&!p&&f.length>0&&a.jsx(ye,{className:"overflow-hidden",children:a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"bg-muted/30 border-b border-border",children:[n&&a.jsx("th",{className:"p-3 w-10 text-center",children:a.jsx("input",{type:"checkbox",checked:i.size===f.length&&f.length>0,onChange:y,className:"rounded border-border"})}),a.jsx("th",{className:"text-left p-3 font-medium text-muted-foreground",children:"Name"}),a.jsx("th",{className:"text-left p-3 font-medium text-muted-foreground",children:"Contact"}),a.jsx("th",{className:"text-left p-3 font-medium text-muted-foreground",children:"Phone"}),a.jsx("th",{className:"text-left p-3 font-medium text-muted-foreground",children:"Email"}),a.jsx("th",{className:"text-left p-3 font-medium text-muted-foreground",children:"Website"}),a.jsx("th",{className:"text-left p-3 font-medium text-muted-foreground",children:"Notes"})]})}),a.jsx("tbody",{children:f.map(b=>a.jsxs("tr",{className:`border-t border-border/50 hover:bg-muted/20 ${i.has(b.id)?"bg-primary/5":""}`,children:[n&&a.jsx("td",{className:"p-3 text-center",children:a.jsx("input",{type:"checkbox",checked:i.has(b.id),onChange:()=>x(b.id),className:"rounded border-border"})}),a.jsx("td",{className:"p-3 font-semibold text-foreground",children:b.name}),a.jsx("td",{className:"p-3 text-muted-foreground",children:b.contactName?a.jsxs("span",{className:"inline-flex items-center gap-1",children:[a.jsx(Ai,{className:"w-3 h-3"}),b.contactName]}):"—"}),a.jsx("td",{className:"p-3 text-muted-foreground",children:b.phone?a.jsxs("span",{className:"inline-flex items-center gap-1",children:[a.jsx(Ch,{className:"w-3 h-3"}),b.phone]}):"—"}),a.jsx("td",{className:"p-3 text-muted-foreground",children:b.email?a.jsxs("span",{className:"inline-flex items-center gap-1",children:[a.jsx($r,{className:"w-3 h-3"}),b.email]}):"—"}),a.jsx("td",{className:"p-3 text-muted-foreground",children:b.website?a.jsxs("a",{href:b.website.startsWith("http")?b.website:`https://${b.website}`,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-primary hover:underline",children:[a.jsx(em,{className:"w-3 h-3"}),b.website]}):"—"}),a.jsx("td",{className:"p-3 text-muted-foreground max-w-xs truncate",children:b.notes||"—"})]},b.id))})]})})}),r&&a.jsx(JEe,{onClose:()=>s(!1),onSaved:w}),u&&a.jsx(e_e,{suppliers:u,onClose:()=>d(null),onDeleted:()=>{w(),l(new Set)}})]})}const Zf=(e,t)=>
219{const n=localStorage.getItem("fs_team_token");return fetch(e,{...t,headers:{Authorization:`Bearer ${n}`,"Content-Type":"application/json",...t?.headers||{}}})},mu=["costPerUnit","minPricePerUnit","suggestedPricePerUnit"],w2={costPerUnit:"Cost",minPricePerUnit:"Min Sell",suggestedPricePerUnit:"Suggested"},vF=["aluminum","steel","copper","galvanized","zinc_alum","other"],n_e=["per_foot","per_pound","per_each","per_bag","per_box","per_tube"],N2="w-full px-2 py-1.5 bg-white border border-border rounded-lg outline-none focus:border-primary text-sm",bF="w-24 px-2 py-1 bg-white border border-border rounded-lg outline-none focus:border-primary text-sm text-right";let r_e=0;function a_e(){return{key:`draft-${r_e++}`,name:"",categoryId:"",supplierId:"",material:"aluminum",unitType:"per_each",costPerUnit:"",minPricePerUnit:"",suggestedPricePerUnit:""}}function s_e(){const e=wt(),{toast:t}=nr(),[n,r]=v.useState(""),[s,i]=v.useState("all"),[l,u]=v.useState("all"),[d,f]=v.useState("all"),[h,p]=v.useState(!1),[x,y]=v.useState({}),[w,j]=v.useState(new Set),[b,C]=v.useState([]),[N,k]=v.useState({}),[T,A]=v.useState({}),[P,E]=v.useState("costPerUnit"),[_,R]=v.useState("percent"),[H,L]=v.useState("inc"),[I,W]=v.useState(""),{data:U=[],isLoading:V}=Xe({queryKey:["bulk-products",h],queryFn:async()=>{const te=await Zf(`/api/inventory/products?includeInactive=${h}`);if(!te.ok)throw new Error("Failed to load products");return te.json()}}),{data:D=[]}=Xe({queryKey:["inv-categories"],queryFn:()=>Zf("/api/inventory/categories").then(te=>te.json()),staleTime:300*1e3}),{data:q=[]}=Xe({queryKey:["inv-suppliers"],queryFn:()=>Zf("/api/inventory/suppliers").then(te=>te.json()),staleTime:300*1e3}),K=v.useMemo(()=>U.filter(te=>!(n&&!`${te.name} ${te.material} ${te.categoryName??""} ${te.supplierName??""}`.toLowerCase().includes(n.toLowerCase())||s!=="all"&&String(te.categoryId)!==s||l!=="all"&&String(te.supplierId)!==l||d!=="all"&&te.material!==d)),[U,n,s,l,d]),{updates:Y,dirtyCells:z}=v.useMemo(()=>{const te=[],_e=new Set;for(const Oe of U){const Te=x[Oe.id];if(!Te)continue;const Le={id:Oe.id};let ze=!1;for(const at of mu){if(Te[at]===void 0)continue;const xt=Te[at],dt=xt===""?null:Number(xt);if(xt!==""&&(!Number.isFinite(dt)||dt<0))continue;const Mt=Oe[at]??null;dt===null&&Mt===null||dt!==null&&Mt!==null&&Math.abs(dt-Mt)<1e-9||(Le[at]=xt===""?null:dt,_e.add(`${Oe.id}:${at}`),ze=!0)}ze&&te.push(Le)}return{updates:te,dirtyCells:_e}},[U,x]),Z=Y.length,F=Z>0||b.length>0;function B(te,_e){const Oe=x[te.id]?.[_e];if(Oe!==void 0)return Oe;const Te=te[_e];return Te==null?"":String(Te)}function X(te,_e,Oe){y(Te=>({...Te,[te]:{...Te[te],[_e]:Oe}}))}function Q(te){y(_e=>{const Oe={..._e};return delete Oe[te],Oe})}function se(te){j(_e=>{const Oe=new Set(_e);return Oe.has(te)?Oe.delete(te):Oe.add(te),Oe})}const ee=K.length>0&&K.every(te=>w.has(te.id));function ve(){j(te=>{if(ee){const Oe=new Set(te);return K.forEach(Te=>Oe.delete(Te.id)),Oe}const _e=new Set(te);return K.forEach(Oe=>_e.add(Oe.id)),_e})}function ue(){const te=Number(I);if(!Number.isFinite(te)||te===0){t({title:"Enter an adjustment amount",variant:"destructive"});return}const _e=w.size?K.filter(Te=>w.has(Te.id)):K;if(_e.length===0){t({title:"No products to adjust",variant:"destructive"});return}let Oe=0;y(Te=>{const Le={...Te};for(const ze of _e){const at=(()=>{const dt=Te[ze.id]?.[P];return dt!==void 0?dt===""?null:Number(dt):ze[P]??null})();if(at===null||!Number.isFinite(at))continue;let xt=_==="percent"?at*(1+(H==="dec"?-1:1)*te/100):at+(H==="dec"?-1:1)*te;xt<0&&(xt=0),Le[ze.id]={...Le[ze.id],[P]:xt.toFixed(2)},Oe++}return Le}),t({title:`Adjusted ${w2[P]} on ${Oe} item${Oe!==1?"s":""}`,description:"Review and click Save changes to apply."})}const de=nt({mutationFn:async()=>{const te={};for(const Le of b)Le.name.trim()?Le.categoryId?Le.supplierId||(te[Le.key]="Supplier is required"):te[Le.key]="Category is required":te[Le.key]="Name is required";if(Object.keys(te).length){const Le=new Error("Each new row needs a name, category, and supplier");throw Le.draftErrors=te,Le}const _e=b.map(Le=>({key:Le.key,name:Le.name.trim(),categoryId:Number(Le.categoryId),supplierId:Number(Le.supplierId),material:Le.material,unitType:Le.unitType,costPerUnit:Le.costPerUnit?Number(Le.costPerUnit):0,minPricePerUnit:Le.minPricePerUnit?Number(Le.minPricePerUnit):null,suggestedPricePerUnit:Le.suggestedPricePerUnit?Number(Le.suggestedPricePerUnit):null})),Oe=await Zf("/api/inventory/products/bulk-save",{method:"POST",body:JSON.stringify({creates:_e,updates:Y})}),Te=await Oe.json().catch(()=>({}));if(!Oe.ok){const Le=new Error(Te.error||"Save failed — nothing was applied");throw Array.isArray(Te.createErrors)&&(Le.draftErrors=Object.fromEntries(Te.createErrors.map(ze=>
219[String(ze.key),ze.error]))),Array.isArray(Te.updateErrors)&&(Le.productErrors=Object.fromEntries(Te.updateErrors.map(ze=>[Number(ze.id),ze.error]))),Le}return Te},onSuccess:te=>{const _e=te?.created??b.length;y({}),C([]),k({}),A({}),he();const Oe=[];te?.updated&&Oe.push(`${te.updated} price${te.updated!==1?"s":""} updated`),_e&&Oe.push(`${_e} item${_e!==1?"s":""} added`),t({title:Oe.length?Oe.join(", "):"Saved"})},onError:te=>{k(te?.draftErrors||{}),A(te?.productErrors||{});const _e=Object.keys(te?.draftErrors||{}).length+Object.keys(te?.productErrors||{}).length;t({title:te.message||"Save failed",description:_e?`Nothing was saved. ${_e} row${_e!==1?"s are":" is"} highlighted below — fix and save again.`:"Nothing was saved.",variant:"destructive"})}}),Se=nt({mutationFn:async te=>{const _e=[...w],Oe=await Zf("/api/inventory/products/bulk-activate",{method:"POST",body:JSON.stringify({ids:_e,active:te})});if(!Oe.ok){const Te=await Oe.json().catch(()=>({}));throw new Error(Te.error||"Failed to update items")}return{...await Oe.json(),active:te}},onSuccess:te=>{j(new Set),he(),t({title:`${te.updated} item${te.updated!==1?"s":""} ${te.active?"reactivated":"deactivated"}`})},onError:te=>t({title:te.message||"Update failed",variant:"destructive"})});function he(){e.invalidateQueries({queryKey:["bulk-products"]}),e.invalidateQueries({queryKey:["inventory-stock"]}),e.invalidateQueries({queryKey:["inventory-value"]})}const ce=de.isPending||Se.isPending;return V?a.jsx("div",{className:"p-8 flex justify-center",children:a.jsx(Me,{className:"w-8 h-8 animate-spin text-primary"})}):a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-lg font-bold text-foreground",children:"Bulk Pricing"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Edit cost, min-sell and suggested prices across many products at once, apply an across-the-board adjustment, add new items, or deactivate items you no longer carry."})]}),a.jsxs("div",{className:"flex flex-wrap gap-2 items-center",children:[a.jsxs("div",{className:"relative flex-1 min-w-[220px]",children:[a.jsx(Da,{className:"w-4 h-4 absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),a.jsx("input",{type:"text",placeholder:"Search name, category, supplier…",value:n,onChange:te=>r(te.target.value),className:"w-full pl-9 pr-3 py-2 bg-white border border-border rounded-xl outline-none focus:border-primary text-sm"})]}),a.jsxs("select",{value:s,onChange:te=>i(te.target.value),className:"px-3 py-2 bg-white border border-border rounded-xl text-sm",children:[a.jsx("option",{value:"all",children:"All Categories"}),D.map(te=>a.jsx("option",{value:String(te.id),children:te.name},te.id))]}),a.jsxs("select",{value:l,onChange:te=>u(te.target.value),className:"px-3 py-2 bg-white border border-border rounded-xl text-sm",children:[a.jsx("option",{value:"all",children:"All Suppliers"}),q.map(te=>a.jsx("option",{value:String(te.id),children:te.name},te.id))]}),a.jsxs("select",{value:d,onChange:te=>f(te.target.value),className:"px-3 py-2 bg-white border border-border rounded-xl text-sm capitalize",children:[a.jsx("option",{value:"all",children:"All Materials"}),vF.map(te=>a.jsx("option",{value:te,children:te.replace("_"," ")},te))]}),a.jsxs("label",{className:"flex items-center gap-2 text-sm text-muted-foreground px-2 cursor-pointer select-none",children:[a.jsx("input",{type:"checkbox",checked:h,onChange:te=>p(te.target.checked)}),"Show inactive"]})]}),a.jsx(ye,{className:"p-3 border-border/50 bg-secondary/20",children:a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider mr-1",children:"Apply adjustment"}),a.jsx("select",{value:P,onChange:te=>E(te.target.value),className:"px-2 py-1.5 bg-white border border-border rounded-lg text-sm",children:mu.map(te=>a.jsx("option",{value:te,children:w2[te]},te))}),a.jsxs("div",{className:"flex rounded-lg overflow-hidden border border-border",children:[a.jsx("button",{onClick:()=>L("inc"),className:`px-3 py-1.5 text-sm font-medium ${H==="inc"?"bg-primary text-primary-foreground":"bg-white"}`,children:"Increase"}),a.jsx("button",{onClick:()=>L("dec"),className:`px-3 py-1.5 text-sm font-medium ${H==="dec"?"bg-primary text-primary-foreground":"bg-white"}`,children:"Decrease"})]}),a.jsxs("div",{className:"flex rounded-lg overflow-hidden border border-border",children:[a.jsxs("button",{onClick:()=>R("percent"),className:`px-2.5 py-1.5 text-sm font-medium flex items-center gap-1 ${_==="percent"?"bg-primary text-primary-foreground":"bg-white"}`,children:[a.jsx(Uq,{className:"w-3.5 h-3.5"}),"%"]}),a.jsxs("button",{onClick:()=>R("fixed"),className:`px-2.5 py-1.5 text-sm font-medium flex items-center gap-1 ${_==="fixed"?"bg-primary text-primary-foreground":"bg-white"}`,children:[a.jsx(Ro,{className:"w-3.5 h-3.5"}),"$"]})]}),a.jsx("input",{type:"number",step:"0.01",min:"0",value:I,onChange:te=>W(te.target.value),placeholder:_==="percent"?"e.g. 5":"e.g. 1.50",className:"w-28 px-2 py-1.5 bg-white border border-border rounded-lg text-sm"}),a.jsx(ne,{size:"sm",className:"rounded-lg",onClick:ue,children:"Apply"}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:["to ",w.size?`${w.size} selected`:`all ${K.length} shown`]})]})}),a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs(ne,{size:"sm",variant:"outline",className:"rounded-lg",disabled:w.size===0||ce,onClick:()=>Se.mutate(!1),children:[a.jsx(Iq,{className:"w-4 h-4 mr-1.5"}),"Deactivate",w.size?` (${w.size})`:""]}),h&&a.jsxs(ne,{size:"sm",variant:"outline",className:"rounded-lg",disabled:w.size===0||ce,onClick:()=>Se.mutate(!0),children:[a.jsx(st,{className:"w-4 h-4 mr-1.5"}),"Reactivate",w.size?` (${w.size})`:""]}),a.jsxs(ne,{size:"sm",variant:"outline",className:"rounded-lg",onClick:()=>C(te=>[...te,a_e()]),children:[a.jsx(Ft,{className:"w-4 h-4 mr-1.5"}),"Add Row"]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[F&&a.jsx("button",{onClick:()=>{y({}),C([])},className:"text-xs text-muted-foreground hover:text-foreground underline",children:"Discard changes"}),a.jsxs(ne,{size:"sm",className:"rounded-lg",disabled:!F||ce,onClick:()=>de.mutate(),children:[de.isPending?a.jsx(Me,{className:"w-4 h-4 mr-1.5 animate-spin"}):a.jsx(Si,{className:"w-4 h-4 mr-1.5"}),"Save changes",Z||b.length?` (${Z+b.length})`:""]})]})]}),a.jsx(ye,{className:"overflow-hidden border-border/50",children:a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-border bg-secondary/30 text-xs uppercase tracking-wider text-muted-foreground",children:[a.jsx("th",{className:"px-3 py-3 w-10",children:a.jsx("input",{type:"checkbox",checked:ee,onChange:ve})}),a.jsx("th",{className:"px-3 py-3 text-left font-semibold",children:"Product"}),a.jsx("th",{className:"px-3 py-3 text-left font-semibold",children:"Category"}),a.jsx("th",{className:"px-3 py-3 text-left font-semibold",children:"Supplier"}),mu.map(te=>a.jsxs("th",{className:"px-3 py-3 text-right font-semibold",children:[w2[te]," ($)"]},te)),a.jsx("th",{className:"px-3 py-3 w-10"})]})}),a.jsxs("tbody",{children:[K.length===0&&b.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:8,className:"px-4 py-16 text-center text-muted-foreground",children:"No products match your filters."})}):K.map(te=>{const _e=!!x[te.id]&&mu.some(Te=>z.has(`${te.id}:${Te}`)),Oe=T[te.id];return a.jsxs("tr",{className:`border-b border-border/50 ${Oe?"bg-red-50/70":te.active?_e?"bg-amber-50/60":"hover:bg-muted/30":"bg-zinc-50 opacity-70"}`,children:[a.jsx("td",{className:"px-3 py-2 text-center",children:a.jsx("input",{type:"checkbox",checked:w.has(te.id),onChange:()=>se(te.id)})}),a.jsxs("td",{className:"px-3 py-2",children:[a.jsxs("div",{className:"font-medium text-foreground flex items-center gap-2",children:[te.name,!te.active&&a.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-zinc-200 text-zinc-600 font-semibold uppercase",children:"Inactive"})]}),a.jsxs("div",{className:"text-xs text-muted-foreground capitalize",children:[te.material.replace("_"," ")," · ",te.unitType.replace("per_","per ")]}),Oe&&a.jsx("div",{className:"text-xs text-red-600 font-medium mt
219-0.5",children:Oe})]}),a.jsx("td",{className:"px-3 py-2 text-muted-foreground",children:te.categoryName||"—"}),a.jsx("td",{className:"px-3 py-2 text-muted-foreground",children:te.supplierName||"—"}),mu.map(Te=>{const Le=z.has(`${te.id}:${Te}`);return a.jsx("td",{className:"px-3 py-2 text-right",children:a.jsx("input",{type:"number",step:"0.01",min:"0",value:B(te,Te),onChange:ze=>X(te.id,Te,ze.target.value),placeholder:Te==="costPerUnit"?"0.00":"—",className:`${bF} ${Le?"border-amber-400 bg-amber-50 font-semibold":""}`})},Te)}),a.jsx("td",{className:"px-3 py-2 text-center",children:_e&&a.jsx("button",{onClick:()=>Q(te.id),title:"Reset row",className:"text-muted-foreground hover:text-foreground",children:a.jsx(hT,{className:"w-3.5 h-3.5"})})})]},te.id)}),b.map((te,_e)=>{const Oe=N[te.key];return a.jsxs("tr",{className:`border-b border-border/50 ${Oe?"bg-red-50/70":"bg-green-50/50"}`,children:[a.jsx("td",{className:"px-3 py-2 text-center",children:a.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-green-200 text-green-700 font-semibold uppercase",children:"New"})}),a.jsxs("td",{className:"px-3 py-2",children:[a.jsx("input",{type:"text",value:te.name,onChange:Te=>C(Le=>Le.map((ze,at)=>at===_e?{...ze,name:Te.target.value}:ze)),placeholder:"Product name *",className:`${N2} ${Oe?"border-red-400":""}`}),Oe&&a.jsx("div",{className:"text-xs text-red-600 font-medium mt-0.5",children:Oe}),a.jsxs("div",{className:"flex gap-1 mt-1",children:[a.jsx("select",{value:te.material,onChange:Te=>C(Le=>Le.map((ze,at)=>at===_e?{...ze,material:Te.target.value}:ze)),className:"flex-1 px-1.5 py-1 bg-white border border-border rounded text-xs capitalize",children:vF.map(Te=>a.jsx("option",{value:Te,children:Te.replace("_"," ")},Te))}),a.jsx("select",{value:te.unitType,onChange:Te=>C(Le=>Le.map((ze,at)=>at===_e?{...ze,unitType:Te.target.value}:ze)),className:"flex-1 px-1.5 py-1 bg-white border border-border rounded text-xs",children:n_e.map(Te=>a.jsx("option",{value:Te,children:Te.replace(/_/g," ")},Te))})]})]}),a.jsx("td",{className:"px-3 py-2",children:a.jsxs("select",{value:te.categoryId,onChange:Te=>C(Le=>Le.map((ze,at)=>at===_e?{...ze,categoryId:Te.target.value}:ze)),className:N2,children:[a.jsx("option",{value:"",children:"Category *"}),D.map(Te=>a.jsx("option",{value:String(Te.id),children:Te.name},Te.id))]})}),a.jsx("td",{className:"px-3 py-2",children:a.jsxs("select",{value:te.supplierId,onChange:Te=>C(Le=>Le.map((ze,at)=>at===_e?{...ze,supplierId:Te.target.value}:ze)),className:N2,children:[a.jsx("option",{value:"",children:"Supplier *"}),q.map(Te=>a.jsx("option",{value:String(Te.id),children:Te.name},Te.id))]})}),mu.map(Te=>a.jsx("td",{className:"px-3 py-2 text-right",children:a.jsx("input",{type:"number",step:"0.01",min:"0",value:te[Te],onChange:Le=>C(ze=>ze.map((at,xt)=>xt===_e?{...at,[Te]:Le.target.value}:at)),placeholder:Te==="costPerUnit"?"0.00":"—",className:bF})},Te)),a.jsx("td",{className:"px-3 py-2 text-center",children:a.jsx("button",{onClick:()=>C(Te=>Te.filter((Le,ze)=>ze!==_e)),title:"Remove row",className:"text-muted-foreground hover:text-red-600",children:a.jsx(on,{className:"w-3.5 h-3.5"})})})]},te.key)})]})]})})}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Showing ",K.length," product",K.length!==1?"s":"",b.length>0?` · ${b.length} new row${b.length!==1?"s":""}`:"",Z>0?` · ${Z} with unsaved price edits`:""]})]})}const Mr=(e,t)=>{const n=localStorage.getItem("fs_team_token");return fetch(e,{...t,headers:{Authorization:`Bearer ${n}`,"Content-Type":"application/json",...t?.headers||{}}})},i_e=["All Suppliers","VGS","IMS","Custom Bilt Metals"],o_e=["All","In Stock","Low Stock","Out of Stock"],l_e=["All","W1","W2","TRK"];function c_e(e,t){if(t==="All")return!0;const n=`${t}-`,r=(e.storageLocation||"").toUpperCase(),s=(e.storageLocation2||"").toUpperCase();return r.startsWith(n)||s.startsWith(n)}const jF={OK:{label:"In Stock",badge:"bg-green-100 text-green-700",dot:"bg-green-500"},LOW:{label:"Low Stock",badge:"bg-amber-100 text-amber-700",dot:"bg-amber-400"},OUT:{label:"Out of Stock",badge:"bg-red-100 text-red-600",dot:"bg-red-500"}},wF={aluminum:"bg-blue-100 text-blue-700",steel:"bg-slate-100 text-slate-700",copper:"bg-orange-100 text-orange-700",galvanized:"bg-zinc-100 text-zinc-700",other:"bg-purple-100 text-purple-700"},AK={per_pound:"/lb",per_foot:"/ft",per_each:"/ea",per_bag:"/bag",per_tube:"/tube",per_box:"/box"};function TK(e){if(["Aluminum Coil","Steel Coil","Copper Coil"].includes(e.category)){const n=[];if(e.qtyFullRolls>0&&n.push(`${e.qtyFullRolls} roll${e.qtyFullRolls!==1?"s":""}`),e.partials&&e.partials.length>0){const r=e.partials.map(s=>s.ft>0?`${s.ft} ft (${Math.round(s.lbs*10)/10} lbs)`:`${Math.round(s.lbs*10)/10} lbs`).join(", ");n.push(`${e.partials.length} partial${e.partials.length!==1?"s":""}: ${r}`)}else e.qtyPartialLbs>0&&n.push(`${e.qtyPartialLbs} lbs partial`);return n.length?n.join(" + "):"0"}
219return String(e.qtyOnHand??0)}function kK(e){return e.costPerUnit?`$${Number(e.costPerUnit).toFixed(2)}${AK[e.unitType]||""}`:"—"}function u_e({item:e,onClose:t,onSaved:n}){const[r,s]=v.useState(""),[i,l]=v.useState("received"),[u,d]=v.useState(""),[f,h]=v.useState(""),p=["Aluminum Coil","Steel Coil","Copper Coil"].includes(e.category),x=nt({mutationFn:async()=>{const w=i==="received"?1:-1,j=await Mr("/api/inventory/adjust",{method:"POST",body:JSON.stringify({productId:e.productId,adjustmentType:i,qtyChange:w*Math.abs(parseFloat(r)),poNumber:f||void 0,notes:u||void 0})});if(!j.ok)throw new Error("Failed to save adjustment");return j.json()},onSuccess:()=>{n(),t()}}),y=()=>{!r||isNaN(parseFloat(r))||x.mutate()};return a.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm z-50 flex items-center justify-center p-4",children:a.jsxs("div",{className:"bg-card rounded-2xl shadow-2xl border border-border w-full max-w-md",children:[a.jsxs("div",{className:"p-6 border-b border-border",children:[a.jsx("h2",{className:"text-lg font-bold text-foreground",children:"Adjust Inventory"}),a.jsxs("p",{className:"text-sm text-muted-foreground mt-1",children:[e.productName,e.color&&e.color!=="All Colors"?` · ${e.color}`:""]})]}),a.jsxs("div",{className:"p-6 space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium text-foreground block mb-1.5",children:"Adjustment Type"}),a.jsxs("select",{value:i,onChange:w=>l(w.target.value),className:"w-full px-3 py-2 bg-white border border-border rounded-xl outline-none focus:border-primary text-sm",children:[a.jsx("option",{value:"received",children:"Received — add stock"}),a.jsx("option",{value:"manual_correction",children:"Manual Correction"}),a.jsx("option",{value:"damaged",children:"Damaged / Write-off"}),a.jsx("option",{value:"return",children:"Return to Supplier"})]})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"text-sm font-medium text-foreground block mb-1.5",children:["Quantity (",p?"lbs":e.unitType==="per_foot"?"ft":"units",")"]}),a.jsx("input",{type:"number",value:r,onChange:w=>s(w.target.value),placeholder:"Enter quantity",className:"w-full px-3 py-2 bg-white border border-border rounded-xl outline-none focus:border-primary text-sm"})]}),i==="received"&&a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium text-foreground block mb-1.5",children:"PO Number"}),a.jsx("input",{type:"text",value:f,onChange:w=>h(w.target.value),placeholder:"Optional purchase order number",className:"w-full px-3 py-2 bg-white border border-border rounded-xl outline-none focus:border-primary text-sm"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium text-foreground block mb-1.5",children:"Notes"}),a.jsx("input",{type:"text",value:u,onChange:w=>d(w.target.value),placeholder:"Optional notes",className:"w-full px-3 py-2 bg-white border border-border rounded-xl outline-none focus:border-primary text-sm"})]}),a.jsxs("div",{className:"bg-secondary/50 rounded-xl p-3 text-xs text-muted-foreground",children:["Current: ",a.jsx("span",{className:"font-semibold text-foreground",children:TK(e)})," ·  Cost: ",a.jsx("span",{className:"font-semibold text-foreground",children:kK(e)})," ·  Supplier: ",a.jsx("span",{className:"font-semibold text-foreground",children:e.supplier})]}),x.isError&&a.jsx("p",{className:"text-xs text-red-600 font-medium",children:"Failed to save. Please try again."})]}),a.jsxs("div",{className:"p-6 pt-0 flex gap-3",children:[a.jsx("button",{onClick:t,className:"flex-1 px-4 py-2.5 rounded-xl border border-border text-sm font-medium hover:bg-muted transition-colors",children:"Cancel"}),a.jsxs("button",{onClick:y,disabled:x.isPending||!r,className:"flex-1 px-4 py-2.5 rounded-xl bg-primary text-primary-foreground text-sm font-semibold hover:bg-primary/90 transition-colors disabled:opacity-60 flex items-center justify-center gap-2",children:[x.isPending&&a.jsx(Me,{className:"w-4 h-4 animate-spin"}),x.isPending?"Saving...":"Save Adjustment"]})]})]})})}const tn="text-xs font-semibold text-muted-foreground uppercase tracking-wider block mb-1",ir="w-full px-3 py-2 bg-white border border-border rounded-xl outline-none focus:border-primary text-sm",Qx="w-full px-3 py-2 bg-white border border-border rounded-xl outline-none focus:border-primary text-sm";function NF({item:e,onClose:t,onSaved:n}){const r=!!e,[s,i]=v.useState(e?.productName??""),[l,u]=v.useState(""),[d,f]=v.useState(""),[h,p]=v.useState(e?.material??"aluminum"),[x,y]=v.useState(e?.color??""),[w,j]=v.useState(e?.size??""),[b,C]=v.useState(e?.gauge??""),[N,k]=v.useState(e?.skuMfg??""),[T,A]=v.useState(e?.storageLocation??""),[P,E]=v.useState(e?.storageLocation2??""),[_,R]=v.useState(e?.unitType??"per_each"),[H,L]=v.useState(String(e?.costPerUnit??"")),[I,W]=v.useState(String(e?.minPricePerUnit??"")),[U,V]=v.useState(String(e?.reorderPoint??"0")),[D,q]=v.useState(String(e?.qtyOnHand??"0")),[K,Y]=v.useState(""),[z,Z]=v.useState(""),{data:F}=Xe({queryKey:["product-detail",e?.productId],queryFn:()=>Mr(`/api/inventory/products/${e.productId}`).then(ee=>ee.json()),enabled:r&&!!e?.productId}),B=ie.useRef(!1);v.useEffect(()=>{F&&!B.current&&(B.current=!0,u(String(F.categoryId??"")),f(String(F.supplierId??"")),A(F.storageLocation??""),E(F.storageLocation2??""),Y(F.notes??""))},[F]);const{data:X=[]}=Xe({queryKey:["inv-categories"],queryFn:()=>Mr("/api/inventory/categories").then(ee=>ee.json())}),{data:Q=[]}=Xe({queryKey:["inv-suppliers"],queryFn:()=>Mr("/api/inventory/suppliers").then(ee=>ee.json())}),se=nt({mutationFn:async()=>
219{if(!s.trim())throw new Error("Product name is required");if(!l)throw new Error("Category is required");if(!d)throw new Error("Supplier is required");const ee={name:s.trim(),categoryId:Number(l),supplierId:Number(d),material:h,color:x,size:w,gauge:b,skuMfg:N,unitType:_,costPerUnit:parseFloat(H)||0,minPricePerUnit:I?parseFloat(I):null,reorderPoint:parseFloat(U)||0,storageLocation:T,storageLocation2:P,notes:K};r||(ee.qtyOnHand=parseFloat(D)||0);const ve=r?`/api/inventory/products/${e.productId}`:"/api/inventory/products",de=await Mr(ve,{method:r?"PATCH":"POST",body:JSON.stringify(ee)});if(!de.ok){const Se=await de.json().catch(()=>({}));throw new Error(Se.error||"Failed to save product")}return de.json()},onSuccess:()=>{n(),t()},onError:ee=>Z(ee.message)});return a.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm z-50 flex items-center justify-center p-4 overflow-y-auto",children:a.jsxs("div",{className:"bg-card rounded-2xl shadow-2xl border border-border w-full max-w-2xl my-4",children:[a.jsxs("div",{className:"p-6 border-b border-border",children:[a.jsx("h2",{className:"text-lg font-bold text-foreground",children:r?"Edit Product":"Add Product"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:r?`Editing: ${e.productName}`:"Enter product details below"})]}),a.jsxs("div",{className:"p-6 space-y-5 max-h-[65vh] overflow-y-auto",children:[a.jsxs("div",{children:[a.jsx("label",{className:tn,children:"Product Name *"}),a.jsx("input",{type:"text",value:s,onChange:ee=>i(ee.target.value),placeholder:"e.g. Aluminum Gutter Coil",className:ir})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:tn,children:"Category *"}),a.jsxs("select",{value:l,onChange:ee=>u(ee.target.value),className:Qx,children:[a.jsx("option",{value:"",children:"Select category…"}),X.map(ee=>a.jsx("option",{value:ee.id,children:ee.name},ee.id))]})]}),a.jsxs("div",{children:[a.jsx("label",{className:tn,children:"Supplier *"}),a.jsxs("select",{value:d,onChange:ee=>f(ee.target.value),className:Qx,children:[a.jsx("option",{value:"",children:"Select supplier…"}),Q.map(ee=>a.jsx("option",{value:ee.id,children:ee.name},ee.id))]})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:tn,children:"Material"}),a.jsx("select",{value:h,onChange:ee=>p(ee.target.value),className:Qx,children:["aluminum","steel","copper","galvanized","zinc_alum","other"].map(ee=>a.jsx("option",{value:ee,children:ee.replace("_"," ")},ee))})]}),a.jsxs("div",{children:[a.jsx("label",{className:tn,children:"Unit Type"}),a.jsx("select",{value:_,onChange:ee=>R(ee.target.value),className:Qx,children:["per_foot","per_pound","per_each","per_bag","per_box","per_tube"].map(ee=>a.jsx("option",{value:ee,children:ee.replace(/_/g," ")},ee))})]})]}),a.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:tn,children:"Color"}),a.jsx("input",{type:"text",value:x,onChange:ee=>y(ee.target.value),placeholder:"e.g. Musket Brown",className:ir})]}),a.jsxs("div",{children:[a.jsx("label",{className:tn,children:"Size"}),a.jsx("input",{type:"text",value:w,onChange:ee=>j(ee.target.value),placeholder:'e.g. 5"',className:ir})]}),a.jsxs("div",{children:[a.jsx("label",{className:tn,children:"Gauge"}),a.jsx("input",{type:"text",value:b,onChange:ee=>C(ee.target.value),placeholder:"e.g. .027",className:ir})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r&&e?.sku5star&&a.jsxs("div",{children:[a.jsx("label",{className:tn,children:"FSG Part #"}),a.jsx("div",{className:"px-3 py-2 bg-secondary/50 rounded-xl text-sm font-mono text-foreground",children:e.sku5star})]}),!r&&a.jsxs("div",{children:[a.jsx("label",{className:tn,children:"FSG Part #"}),a.jsx("div",{className:"px-3 py-2 bg-secondary/50 rounded-xl text-sm text-muted-foreground italic",children:"Auto-generated on save"})]}),a.jsxs("div",{children:[a.jsx("label",{className:tn,children:"Manufacturer SKU"}),a.jsx("input",{type:"text",value:N,onChange:ee=>k(ee.target.value),placeholder:"Supplier part number",className:ir})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:tn,children:"Storage Location"}),a.jsx("input",{type:"text",value:T,onChange:ee=>A(ee.target.value),placeholder:"e.g. W1-RCK-A3",className:ir})]}),a.jsxs("div",{children:[a.jsx("label",{className:tn,children:"Storage Location 2"}),a.jsx("input",{type:"text",value:P,onChange:ee=>E(ee.target.value),placeholder:"e.g. W2-SHF-B2",className:ir})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:tn,children:"Cost Per Unit ($) *"}),a.jsx("input",{type:"number",step:"0.01",value:H,onChange:ee=>L(ee.target.value),placeholder:"0.00",className:ir})]}),a.jsxs("div",{children:[a.jsx("label",{className:tn,children:"Min Sell Price ($)"}),a.jsx("input",{type:"number",step:"0.01",value:I,onChange:ee=>W(ee.target.value),placeholder:"Optional",className:ir})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[!r&&a.jsxs("div",{children:[a.jsx("label",{className:tn,children:"Initial Qty on Hand"}),a.jsx("input",{type:"number",step:"0.01",value:D,onChange:ee=>q(ee.target.value),placeholder:"0",className:ir})]}),r&&a.jsxs("div",{children:[a.jsx("label",{className:tn,children:"Qty on Hand"}),a.jsxs("div",{className:"px-3 py-2 bg-secondary/50 rounded-xl text-sm text-muted-foreground",children:[String(e.qtyOnHand??
2190)," — use Adjust to change"]})]}),a.jsxs("div",{children:[a.jsx("label",{className:tn,children:"Reorder Point"}),a.jsx("input",{type:"number",step:"0.01",value:U,onChange:ee=>V(ee.target.value),placeholder:"0",className:ir})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:tn,children:"Notes"}),a.jsx("input",{type:"text",value:K,onChange:ee=>Y(ee.target.value),placeholder:"Internal notes",className:ir})]}),z&&a.jsx("p",{className:"text-xs text-red-600 font-medium",children:z})]}),a.jsxs("div",{className:"p-6 pt-4 flex gap-3 border-t border-border",children:[a.jsx("button",{onClick:t,className:"flex-1 px-4 py-2.5 rounded-xl border border-border text-sm font-medium hover:bg-muted transition-colors",children:"Cancel"}),a.jsxs("button",{onClick:()=>se.mutate(),disabled:se.isPending,className:"flex-1 px-4 py-2.5 rounded-xl bg-primary text-primary-foreground text-sm font-semibold hover:bg-primary/90 transition-colors disabled:opacity-60 flex items-center justify-center gap-2",children:[se.isPending&&a.jsx(Me,{className:"w-4 h-4 animate-spin"}),se.isPending?"Saving...":r?"Save Changes":"Add Product"]})]})]})})}const SF=["name","categoryName","supplierName","material","color","size","gauge","sku5star","skuMfg","unitType","costPerUnit","minPricePerUnit","qtyOnHand","reorderPoint","notes"],CF=['5" Aluminum Coil',"Aluminum Coil","VGS","aluminum","Musket Brown",'5"',".027","AL-5-MB","V-ALMB027","per_pound","1.85","2.50","500","200","Standard stock coil"].join(","),d_e=["Aluminum Coil","Steel Coil","Copper Coil","Downspouts","End Caps","Miters","Gutter Guard","Hangers & Hardware","Straps","Screws & Fasteners","Sealant","Paint"],f_e=["VGS","IMS","Custom Bilt Metals"],m_e=["aluminum","steel","copper","galvanized","zinc_alum","other"],h_e=["per_foot","per_pound","per_each","per_bag","per_box","per_tube"];function p_e(e){const t=e.trim().split(`
220`).map(r=>r.trim()).filter(Boolean);if(t.length<2)return[];const n=t[0].split(",").map(r=>r.trim().replace(/^"|"$/g,""));return t.slice(1).map(r=>{const s=r.split(",").map(l=>l.trim().replace(/^"|"$/g,"")),i={};return n.forEach((l,u)=>{i[l]=s[u]??""}),i})}function x_e({onClose:e,onSaved:t}){const[n,r]=v.useState(""),[s,i]=v.useState([]),[l,u]=v.useState(""),[d,f]=v.useState(null);function h(w){if(r(w),u(""),f(null),!w.trim()){i([]);return}try{const j=p_e(w);if(j.length===0){u("No data rows found — make sure the CSV includes a header row and at least one data row.");return}i(j)}catch{u("Could not parse CSV. Check the format and try again.")}}function p(w){const j=w.target.files?.[0];if(!j)return;const b=new FileReader;b.onload=C=>h(C.target?.result),b.readAsText(j)}function x(){const w=[SF.join(","),CF].join(`
221`),j=new Blob([w],{type:"text/csv"}),b=URL.createObjectURL(j),C=document.createElement("a");C.href=b,C.download="inventory_import_template.csv",C.click(),URL.revokeObjectURL(b)}const y=nt({mutationFn:async()=>{if(s.length===0)throw new Error("No rows to import");const w=await Mr("/api/inventory/products/bulk-import",{method:"POST",body:JSON.stringify({products:s})}),j=await w.json();if(!w.ok){const b=new Error(j?.error||"Import failed");throw b.data=j,b}return j},onSuccess:w=>{f(w),w.inserted>0&&t(w.inserted)},onError:w=>{w?.data&&f(w.data)}});return a.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm z-50 flex items-center justify-center p-4 overflow-y-auto",children:a.jsxs("div",{className:"bg-card rounded-2xl shadow-2xl border border-border w-full max-w-3xl my-4",children:[a.jsxs("div",{className:"p-6 border-b border-border flex justify-between items-start",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-lg font-bold text-foreground",children:"Bulk Import Products"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Paste or upload a CSV file to add multiple products at once"})]}),a.jsx("button",{onClick:x,className:"flex items-center gap-1.5 text-xs px-3 py-1.5 rounded-lg border border-border hover:bg-muted transition-colors font-medium text-primary",children:"⬇ Download Template"})]}),a.jsxs("div",{className:"p-6 space-y-4",children:[a.jsxs("div",{className:"bg-secondary/40 rounded-xl p-3 text-xs text-muted-foreground space-y-1",children:[a.jsx("p",{className:"font-semibold text-foreground",children:"Required columns:"}),a.jsx("p",{children:a.jsx("code",{children:"name, categoryName, supplierName, material, costPerUnit"})}),a.jsx("p",{className:"mt-1 font-semibold text-foreground",children:"Valid values:"}
221),a.jsxs("p",{children:["Categories: ",d_e.join(", ")]}),a.jsxs("p",{children:["Suppliers: ",f_e.join(", ")]}),a.jsxs("p",{children:["Materials: ",m_e.join(", ")]}),a.jsxs("p",{children:["Unit types: ",h_e.join(", ")]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"flex items-center gap-2 text-sm font-medium text-foreground mb-2",children:"Upload CSV file"}),a.jsx("input",{type:"file",accept:".csv,.txt",onChange:p,className:"block w-full text-sm text-muted-foreground file:mr-4 file:py-2 file:px-4 file:rounded-lg file:border-0 file:text-sm file:font-medium file:bg-primary/10 file:text-primary hover:file:bg-primary/20 cursor-pointer"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium text-foreground block mb-2",children:"Or paste CSV text"}),a.jsx("textarea",{value:n,onChange:w=>h(w.target.value),rows:6,placeholder:`${SF.join(",")}
222${CF}`,className:"w-full px-3 py-2 bg-white border border-border rounded-xl outline-none focus:border-primary text-xs font-mono resize-y"})]}),l&&a.jsx("p",{className:"text-xs text-red-600 font-medium",children:l}),y.isError&&a.jsx("p",{className:"text-xs text-red-600 font-medium",children:"Import failed. Please try again."}),s.length>0&&!d&&a.jsxs("div",{children:[a.jsxs("p",{className:"text-sm font-semibold text-foreground mb-2",children:[s.length," row",s.length!==1?"s":""," ready to import:"]}),a.jsx("div",{className:"overflow-x-auto rounded-xl border border-border max-h-48",children:a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{children:a.jsx("tr",{className:"bg-secondary/30 border-b border-border",children:["name","categoryName","supplierName","material","unitType","costPerUnit","qtyOnHand"].map(w=>a.jsx("th",{className:"px-3 py-2 text-left font-semibold text-muted-foreground",children:w},w))})}),a.jsxs("tbody",{children:[s.slice(0,8).map((w,j)=>a.jsx("tr",{className:"border-b border-border/50",children:["name","categoryName","supplierName","material","unitType","costPerUnit","qtyOnHand"].map(b=>a.jsx("td",{className:"px-3 py-1.5 text-foreground truncate max-w-[120px]",children:w[b]||"—"},b))},j)),s.length>8&&a.jsx("tr",{children:a.jsxs("td",{colSpan:7,className:"px-3 py-1.5 text-muted-foreground",children:["…and ",s.length-8," more rows"]})})]})]})})]}),d&&a.jsxs("div",{className:`rounded-xl p-4 ${d.inserted>0?"bg-green-50 border border-green-200":"bg-amber-50 border border-amber-200"}`,children:[a.jsx("p",{className:`text-sm font-semibold ${d.inserted>0?"text-green-700":"text-amber-700"}`,children:d.inserted>0?`${d.inserted} product${d.inserted!==1?"s":""} imported successfully`:d.error||"Import canceled — nothing was saved"}),d.inserted===0&&d.errors.length>0&&a.jsx("p",{className:"mt-1 text-xs text-amber-700",children:"Fix the rows below and re-import — the whole import runs together, so nothing was saved."}),d.errors.length>0&&a.jsx("ul",{className:"mt-2 text-xs text-red-600 space-y-0.5",children:d.errors.map((w,j)=>a.jsxs("li",{children:["Row ",w.row,": ",w.error]},j))})]})]}),a.jsxs("div",{className:"p-6 pt-0 flex gap-3 border-t border-border",children:[a.jsx("button",{onClick:e,className:"flex-1 px-4 py-2.5 rounded-xl border border-border text-sm font-medium hover:bg-muted transition-colors",children:d?"Close":"Cancel"}),!d&&a.jsxs("button",{onClick:()=>y.mutate(),disabled:y.isPending||s.length===0,className:"flex-1 px-4 py-2.5 rounded-xl bg-primary text-primary-foreground text-sm font-semibold hover:bg-primary/90 transition-colors disabled:opacity-60 flex items-center justify-center gap-2",children:[y.isPending&&a.jsx(Me,{className:"w-4 h-4 animate-spin"}),y.isPending?"Importing...":`Import ${s.length>0?s.length:""} Products`]})]})]})})}const AF={full:{label:"Full",badge:"bg-green-100 text-green-700"},partial:{label:"Partial",badge:"bg-amber-100 text-amber-700"},consumed:{label:"Consumed",badge:"bg-slate-100 text-slate-500"},on_job:{label:"On Job",badge:"bg-blue-100 text-blue-700"}};function TF(e){const t=Math.floor((Date.now()-new Date(e).getTime())/864e5);return t===0?"Today":t===1?"1 day ago":`${t} days ago`}function g_e({item:e,onClose:t}){const n=wt(),{toast:r}=nr(),{teamMember:s}=Nn(),i=s?.canManageInventory||s?.role==="shop_technician",l=e.ftPerLb??0,[u,d]=v.useState(!1),[f,h]=v.useState("500"),[p,x]=v.useState("1"),[y,w]=v.useState(e.storageLocation||""),[j,b]=v.useState(""),[C,N]=v.useState(!1),{data:k=[],isLoading:T,refetch:A}=Xe({queryKey:["coil-rolls",e.productId],queryFn:async()=>{const I=await Mr(`/api/inventory/coil-rolls/${e.productId}`);if(!I.ok)throw new Error("Failed to load rolls");return I.json()}}),P=nt({mutationFn:async()=>{const I=await Mr("/api/inventory/coil-rolls",{method:"POST",body:JSON.stringify({productId:e.productId,weightLbs:parseFloat(f),count:C?1:parseInt(p,10),status:C?"partial":"full",storageLocation:y,notes:j})});if(!I.ok)throw new Error("Failed to add roll");return I.json()},onSuccess:I=>{A(),n.invalidateQueries({queryKey:["inventory-stock"]}),n.invalidateQueries({queryKey:["inventory-value"]}
222),r({title:`${Array.isArray(I)?I.length:1} roll(s) added`}),d(!1),h("500"),x("1"),b(""),N(!1)}}),E=nt({mutationFn:async({id:I,...W})=>{const U=await Mr(`/api/inventory/coil-rolls/${I}`,{method:"PATCH",body:JSON.stringify(W)});if(!U.ok)throw new Error("Failed to update roll");return U.json()},onSuccess:()=>{A(),n.invalidateQueries({queryKey:["inventory-stock"]})}}),_=k.filter(I=>I.status!=="consumed"),R=k.filter(I=>I.status==="consumed"),H=_.reduce((I,W)=>I+(W.weightLbs??0),0),L=H*l;return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"fixed inset-0 bg-black/30 z-40",onClick:t}),a.jsxs("div",{className:"fixed inset-y-0 right-0 w-full max-w-lg bg-card border-l border-border shadow-2xl z-50 flex flex-col",children:[a.jsxs("div",{className:"p-5 border-b border-border flex items-start justify-between",children:[a.jsxs("div",{children:[a.jsxs("h2",{className:"text-lg font-bold text-foreground flex items-center gap-2",children:[a.jsx(Tm,{className:"w-5 h-5 text-primary"}),"Coil Rolls"]}),a.jsxs("p",{className:"text-sm text-muted-foreground mt-0.5",children:[e.productName,e.color&&e.color!=="All Colors"?` · ${e.color}`:""]}),e.sku5star&&a.jsx("p",{className:"text-xs font-mono text-primary mt-0.5",children:e.sku5star})]}),a.jsx("button",{onClick:t,"aria-label":"Close",className:"p-1.5 rounded-lg hover:bg-muted transition-colors",children:a.jsx(an,{className:"w-5 h-5 text-muted-foreground"})})]}),a.jsxs("div",{className:"grid grid-cols-3 gap-3 p-5 border-b border-border bg-secondary/20",children:[a.jsxs("div",{className:"text-center",children:[a.jsx("p",{className:"text-xs text-muted-foreground font-medium uppercase tracking-wider",children:"Active Rolls"}),a.jsx("p",{className:"text-2xl font-bold text-foreground mt-1",children:_.length})]}),a.jsxs("div",{className:"text-center",children:[a.jsx("p",{className:"text-xs text-muted-foreground font-medium uppercase tracking-wider",children:"Total Weight"}),a.jsxs("p",{className:"text-2xl font-bold text-foreground mt-1",children:[Math.round(H),a.jsx("span",{className:"text-sm font-normal text-muted-foreground",children:" lbs"})]})]}),a.jsxs("div",{className:"text-center",children:[a.jsx("p",{className:"text-xs text-muted-foreground font-medium uppercase tracking-wider",children:"Total Feet"}),a.jsxs("p",{className:"text-2xl font-bold text-foreground mt-1",children:[l?Math.round(L).toLocaleString():"—",l?a.jsx("span",{className:"text-sm font-normal text-muted-foreground",children:" ft"}):null]})]})]}),i&&a.jsx("div",{className:"px-5 pt-4",children:u?a.jsxs("div",{className:"border border-border rounded-xl p-4 space-y-3 bg-secondary/10",children:[a.jsx("p",{className:"text-sm font-semibold text-foreground",children:C?"Add Partial Remnant":"Add New Roll(s)"}),a.jsxs("label",{className:"flex items-center gap-2 text-sm text-foreground cursor-pointer select-none",children:[a.jsx("input",{type:"checkbox",checked:C,onChange:I=>N(I.target.checked),className:"w-4 h-4 rounded border-border accent-primary"}),"This is a partial remnant (already opened)"]}),a.jsxs("div",{className:`grid gap-3 ${C?"grid-cols-1":"grid-cols-2"}`,children:[a.jsxs("div",{children:[a.jsx("label",{className:tn,children:"Weight (lbs) *"}),a.jsx("input",{type:"number",value:f,onChange:I=>h(I.target.value),className:ir})]}),!C&&a.jsxs("div",{children:[a.jsx("label",{className:tn,children:"Qty of Rolls"}),a.jsx("input",{type:"number",value:p,onChange:I=>x(I.target.value),min:"1",className:ir})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:tn,children:"Storage Location"}),a.jsx("input",{type:"text",value:y,onChange:I=>w(I.target.value),placeholder:"e.g. W1-RCK-A3",className:ir})]}),a.jsxs("div",{children:[a.jsx("label",{className:tn,children:"Notes"}),a.jsx("input",{type:"text",value:j,onChange:I=>b(I.target.value),placeholder:"PO #, supplier info, etc.",className:ir})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:()=>{d(!1),N(!1)},className:"flex-1 px-3 py-2 rounded-xl border border-border text-sm font-medium hover:bg-muted transition-colors",children:"Cancel"}),a.jsxs("button",{onClick:()=>
222P.mutate(),disabled:P.isPending||!f||parseFloat(f)<=0,className:"flex-1 px-3 py-2 rounded-xl bg-primary text-primary-foreground text-sm font-semibold hover:bg-primary/90 transition-colors disabled:opacity-60 flex items-center justify-center gap-2",children:[P.isPending&&a.jsx(Me,{className:"w-4 h-4 animate-spin"}),P.isPending?"Adding...":C?"Add Remnant":`Add ${parseInt(p,10)>1?p+" Rolls":"Roll"}`]})]})]}):a.jsxs(ne,{className:"w-full rounded-xl",onClick:()=>d(!0),children:[a.jsx(Ft,{className:"w-4 h-4 mr-2"}),"Add Roll(s)"]})}),a.jsx("div",{className:"flex-1 overflow-y-auto p-5 space-y-3",children:T?a.jsx("div",{className:"flex justify-center py-12",children:a.jsx(Me,{className:"w-6 h-6 animate-spin text-muted-foreground"})}):_.length===0&&R.length===0?a.jsxs("div",{className:"text-center py-12",children:[a.jsx(Tm,{className:"w-10 h-10 mx-auto mb-3 text-muted-foreground/30"}),a.jsx("p",{className:"text-sm text-muted-foreground font-medium",children:"No rolls tracked yet"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Add rolls to start tracking coil inventory"})]}):a.jsxs(a.Fragment,{children:[_.map(I=>{const W=AF[I.status]??AF.full,U=I.originalWeightLbs>0?Math.round(I.weightLbs/I.originalWeightLbs*100):100,V=l?Math.round(I.weightLbs*l):null;return a.jsxs("div",{className:"border border-border rounded-xl p-4 hover:border-primary/30 transition-colors",children:[a.jsxs("div",{className:"flex items-start justify-between mb-2",children:[a.jsxs("div",{children:[a.jsx("p",{className:"font-mono text-sm font-semibold text-foreground",children:I.rollNumber}),a.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded-md text-xs font-semibold mt-1 ${W.badge}`,children:W.label})]}),i&&I.status!=="consumed"&&a.jsxs("div",{className:"flex gap-1",children:[I.status==="full"||I.status==="partial"?a.jsx("button",{onClick:()=>E.mutate({id:I.id,status:"on_job"}),className:"text-xs px-2 py-1 rounded-lg bg-blue-50 text-blue-600 hover:bg-blue-100 transition-colors font-medium",children:"Send to Job"}):null,I.status==="on_job"?a.jsx("button",{onClick:()=>{const D=prompt("Return weight in lbs?",String(Math.round(I.weightLbs*.5)));D!==null&&Mr(`/api/inventory/coil-rolls/${I.id}/return`,{method:"POST",body:JSON.stringify({weightLbs:parseFloat(D)})}).then(()=>{A(),n.invalidateQueries({queryKey:["inventory-stock"]})})},className:"text-xs px-2 py-1 rounded-lg bg-green-50 text-green-600 hover:bg-green-100 transition-colors font-medium",children:"Return"}):null,a.jsx("button",{onClick:()=>E.mutate({id:I.id,status:"consumed",weightLbs:0}),className:"text-xs px-2 py-1 rounded-lg bg-red-50 text-red-500 hover:bg-red-100 transition-colors font-medium",children:"Consumed"})]})]}),a.jsxs("div",{className:"grid grid-cols-3 gap-2 text-xs mt-3",children:[a.jsxs("div",{className:"flex items-center gap-1.5 text-muted-foreground",children:[a.jsx($te,{className:"w-3.5 h-3.5"}),a.jsxs("span",{className:"font-semibold text-foreground",children:[I.weightLbs," lbs"]}),V!==null&&a.jsxs("span",{children:["(",V.toLocaleString()," ft)"]})]}),a.jsxs("div",{className:"flex items-center gap-1.5 text-muted-foreground",children:[a.jsx(Ra,{className:"w-3.5 h-3.5"}),a.jsx("span",{children:I.storageLocation||"—"})]}),a.jsxs("div",{className:"flex items-center gap-1.5 text-muted-foreground",children:[a.jsx(Dr,{className:"w-3.5 h-3.5"}),a.jsx("span",{children:TF(I.receivedAt)})]})]}),I.status==="partial"&&I.originalWeightLbs>0&&a.jsxs("div",{className:"mt-3",children:[a.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[a.jsx("span",{className:"text-muted-foreground",children:"Remaining"}),a.jsxs("span",{className:"font-semibold text-foreground",children:[U,"%"]})]}),a.jsx("div",{className:"h-1.5 bg-secondary rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-amber-400 rounded-full transition-all",style:{width:`${Math.min(100,U)}%`}})})]}),I.notes&&a.jsx("p",{className:"text-xs text-muted-foreground mt-2 italic",children:I.notes})]},I.id)}),R.length>0&&a.jsxs("details",{className:"mt-4",children:[a.jsxs("summary",{className:"text-xs font-semibold text-muted-foreground cursor-pointer hover:text-foreground transition-colors py-2",children:[R.length," consumed roll",R.length!==1?"s":""]}),a.jsx("div",{className:"space-y-2 mt-2",children:R.map(I=>a.jsxs("div",{className:"border border-border/50 rounded-lg p-3 opacity-60",children:[a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsx("p",{className:"font-mono text-xs text-muted-foreground",children:I.rollNumber}),a.jsx("span",{className:"text-xs text-muted-foreground",children:TF(I.receivedAt)})]}),a.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["Original: ",I.originalWeightLbs," lbs",I.notes&&` · ${I.notes}`]})]},I.id))})]})]})})]})]})}function y_e(){const{teamMember:e}=Nn(),t=wt(),{toast:n}=nr(),[r,s]=v.useState("products"),[i,l]=v.useState(""),[u,d]=v.useState("All Categories"),[f,h]=v.useState("All Suppliers"),[p,x]=v.useState("All"),[
222y,w]=v.useState("All"),[j,b]=v.useState("productName"),[C,N]=v.useState("asc"),[k,T]=v.useState(!1),[A,P]=v.useState(null),[E,_]=v.useState(null),[R,H]=v.useState(!1),[L,I]=v.useState(!1),[W,U]=v.useState(null),[V,D]=v.useState(!1),[q,K]=v.useState(null),[Y,z]=v.useState(!1);async function Z(){z(!0);try{const ce=await Mr("/api/inventory/catalog/export");if(!ce.ok)throw new Error("Export failed");const te=await ce.blob(),_e=URL.createObjectURL(te),Oe=document.createElement("a");Oe.href=_e,Oe.download=`FSG-Product-Catalog-${new Date().toISOString().slice(0,10)}.xlsx`,document.body.appendChild(Oe),Oe.click(),Oe.remove(),URL.revokeObjectURL(_e),n({title:"Catalog exported",description:"Full product & pricing list downloaded."})}catch(ce){n({title:"Export failed",description:ce?.message??"Unknown error",variant:"destructive"})}finally{z(!1)}}const{data:F=[]}=Xe({queryKey:["inv-categories"],queryFn:()=>Mr("/api/inventory/categories").then(ce=>ce.json()),staleTime:300*1e3}),{data:B=[],isLoading:X,isError:Q,refetch:se}=Xe({queryKey:["inventory-stock"],queryFn:async()=>{const ce=await Mr("/api/inventory/stock");if(!ce.ok)throw new Error("Failed to load inventory");return ce.json()}}),{data:ee}=Xe({queryKey:["inventory-value"],queryFn:async()=>{const ce=await Mr("/api/inventory/value");if(!ce.ok)throw new Error("Failed to load inventory value");return ce.json()}}),ve=B.filter(ce=>{if(i){const te=i.toLowerCase();if(!ce.productName?.toLowerCase().includes(te)&&!ce.color?.toLowerCase().includes(te)&&!ce.sku5star?.toLowerCase().includes(te)&&!ce.storageLocation?.toLowerCase().includes(te)&&!ce.storageLocation2?.toLowerCase().includes(te))return!1}return!(u!=="All Categories"&&ce.category!==u||f!=="All Suppliers"&&ce.supplier!==f||p==="In Stock"&&ce.stockStatus!=="OK"||p==="Low Stock"&&ce.stockStatus!=="LOW"||p==="Out of Stock"&&ce.stockStatus!=="OUT"||!c_e(ce,y))}).sort((ce,te)=>{let _e=ce[j]??"",Oe=te[j]??"";return typeof _e=="string"&&(_e=_e.toLowerCase()),typeof Oe=="string"&&(Oe=Oe.toLowerCase()),_e<Oe?C==="asc"?-1:1:_e>Oe?C==="asc"?1:-1:0});function ue(ce){j===ce?N(te=>te==="asc"?"desc":"asc"):(b(ce),N("asc"))}function de({field:ce,children:te}){return a.jsxs("button",{onClick:()=>ue(ce),className:"flex items-center gap-1 hover:text-foreground transition-colors",children:[te,a.jsx(BZ,{className:`w-3 h-3 ${j===ce?"text-primary":"text-muted-foreground/40"}`})]})}const Se=B.filter(ce=>ce.stockStatus==="OUT"),he=i||u!=="All Categories"||f!=="All Suppliers"||p!=="All"||y!=="All";return X?a.jsx("div",{className:"p-8 flex justify-center",children:a.jsx("div",{className:"animate-spin h-8 w-8 border-4 border-primary border-t-transparent rounded-full"})}):a.jsxs("div",{className:"max-w-7xl mx-auto",children:[a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-3xl font-display font-bold text-foreground",children:"Inventory"}),a.jsx("p",{className:"text-muted-foreground mt-1",children:"Products, stock levels & pricing"})]}),r==="products"&&a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(ne,{variant:"outline",className:"rounded-xl",onClick:()=>{se(),t.invalidateQueries({queryKey:["inventory-value"]})},children:[a.jsx(qo,{className:"w-4 h-4 mr-2"}),"Refresh"]}),(e?.canManageInventory||e?.role==="shop_technician")&&a.jsxs(ne,{variant:"outline",className:"rounded-xl bg-green-50 border-green-200 text-green-700 hover:bg-green-100 hover:text-green-800",onClick:()=>D(!0),children:[a.jsx(Rr,{className:"w-4 h-4 mr-2"}),"Receive Shipment"]}),e?.canManageInventory&&a.jsxs(a.Fragment,{children:[a.jsxs(ne,{variant:"outline",className:"rounded-xl",onClick:Z,disabled:Y,children:[Y?a.jsx(Me,{className:"w-4 h-4 mr-2 animate-spin"}):a.jsx(Ag,{className:"w-4 h-4 mr-2"}),"Export Catalog"]}),a.jsx(ne,{variant:"outline",className:"rounded-xl",onClick:()=>I(!0),children:"Import CSV"}),a.jsxs(ne,{className:"rounded-xl",onClick:()=>H(!0),children:[a.jsx(Ft,{className:"w-4 h-4 mr-2"}),"Add Product"]})]})]})]}),a.jsx("div",{className:"flex gap-1 border-b",children:[{key:"products",label:"Products",icon:a.jsx(Jn,{className:"w-4 h-4"})},...e?.canManageInventory?[{key:"bulk-pricing",label:"Bulk Pricing",icon:a.jsx(Ro,{className:"w-4 h-4"})}]:[],{key:"orders",label:"Order Sheets",icon:a.jsx(Rr,{className:"w-4 h-4"})},{key:"spot-checks",label:"Spot Checks",icon:a.jsx(st,{className:"w-4 h-4"})},{key:"reorder-points",label:"Reorder Points",icon:a.jsx(Kt,{className:"w-4 h-4"})},{key:"physical-count",label:"Physical Count",icon:a.jsx(Ag,{className:"w-4 h-4"})},{key:"suppliers",label:"Suppliers",icon:a.jsx(Ci,{className:"w-4 h-4"})}].map(ce=>a.jsxs("button",{onClick:()=>s(ce.key),className:`flex items-center gap-2 px-4 py-2.5 text-sm font-medium border-b-2 transition-colors ${r===ce.key?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground hover:border-muted-foreground
222/30"}`,children:[ce.icon,ce.label]},ce.key))}),r==="bulk-pricing"&&e?.canManageInventory&&a.jsx(s_e,{}),r==="orders"&&a.jsx(WEe,{}),r==="spot-checks"&&a.jsx(YEe,{}),r==="reorder-points"&&a.jsx(QEe,{}),r==="physical-count"&&a.jsx(ZEe,{}),r==="suppliers"&&a.jsx(t_e,{}),r==="products"&&a.jsxs(a.Fragment,{children:[Q&&a.jsxs("div",{className:"flex items-center gap-3 p-4 bg-red-50 border border-red-200 rounded-xl",children:[a.jsx(Kt,{className:"w-5 h-5 text-red-500 flex-shrink-0"}),a.jsx("p",{className:"text-sm text-red-700 font-medium",children:"Could not load inventory. Check your connection."})]}),a.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:[a.jsxs(ye,{className:"p-6 hover-elevate border-border/50",children:[a.jsx("div",{className:"flex justify-between items-start mb-4",children:a.jsx("div",{className:"p-3 rounded-xl bg-blue-100 text-blue-600",children:a.jsx(eJ,{className:"w-6 h-6"})})}),a.jsx("p",{className:"text-muted-foreground font-medium text-sm mb-1",children:"Total Products"}),a.jsx("h3",{className:"text-3xl font-bold text-foreground",children:ee?.productCount??B.length})]}),a.jsxs(ye,{className:"p-6 hover-elevate border-border/50",children:[a.jsx("div",{className:"flex justify-between items-start mb-4",children:a.jsx("div",{className:"p-3 rounded-xl bg-green-100 text-green-600",children:a.jsx(Ro,{className:"w-6 h-6"})})}),a.jsx("p",{className:"text-muted-foreground font-medium text-sm mb-1",children:"Inventory Value"}),a.jsx("h3",{className:"text-3xl font-bold text-foreground",children:ee?`$${Number(ee.totalValue).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}`:"—"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"at cost"})]}),a.jsxs(ye,{className:"p-6 hover-elevate border-border/50",children:[a.jsx("div",{className:"flex justify-between items-start mb-4",children:a.jsx("div",{className:"p-3 rounded-xl bg-amber-100 text-amber-600",children:a.jsx(Kq,{className:"w-6 h-6"})})}),a.jsx("p",{className:"text-muted-foreground font-medium text-sm mb-1",children:"Low Stock"}),a.jsx("h3",{className:"text-3xl font-bold text-foreground",children:ee?.lowCount??0}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"need reorder"})]}),a.jsxs(ye,{className:"p-6 hover-elevate border-border/50",children:[a.jsx("div",{className:"flex justify-between items-start mb-4",children:a.jsx("div",{className:"p-3 rounded-xl bg-red-100 text-red-600",children:a.jsx(Kt,{className:"w-6 h-6"})})}),a.jsx("p",{className:"text-muted-foreground font-medium text-sm mb-1",children:"Out of Stock"}),a.jsx("h3",{className:"text-3xl font-bold text-foreground",children:ee?.outCount??0}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"action required"})]})]}),Se.length>0&&a.jsxs("div",{className:"flex items-center gap-3 p-4 bg-red-50 border border-red-200 rounded-xl",children:[a.jsx(Kt,{className:"w-5 h-5 text-red-500 flex-shrink-0"}),a.jsxs("div",{className:"flex-1",children:[a.jsxs("p",{className:"text-sm font-semibold text-red-700",children:[Se.length," item",Se.length!==1?"s":""," out of stock"]}),a.jsxs("p",{className:"text-xs text-red-500 mt-0.5",children:[Se.slice(0,3).map(ce=>ce.productName+(ce.color&&ce.color!=="All Colors"?` (${ce.color})`:"")).join(", "),Se.length>3?` +${Se.length-3} more`:""]})]}),a.jsx("button",{onClick:()=>x("Out of Stock"),className:"text-xs font-semibold text-red-600 hover:text-red-800 underline whitespace-nowrap",children:"View All"})]}),a.jsxs("div",{className:"flex flex-col gap-3",children:[a.jsxs("div",{className:"flex gap-3",children:[a.jsxs("div",{className:"relative flex-1",children:[a.jsx(Da,{className:"w-4 h-4 absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),a.jsx("input",{type:"text",placeholder:"Search by product, color, or SKU...",value:i,onChange:ce=>l(ce.target.value),className:"w-full pl-9 pr-4 py-2 bg-white border border-border rounded-xl outline-none focus:border-primary shadow-sm"})]}),a.jsxs(ne,{variant:k?"default":"outline",className:"rounded-xl",onClick:()=>T(ce=>!ce),children:[a.jsx(Fq,{className:"w-4 h-4 mr-2"}),"Filters",k?a.jsx(Sh,{className:"w-3 h-3 ml-1"}):a.jsx(Nr,{className:"w-3 h-3 ml-1"})]})]}),k&&a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-3 p-4 bg-secondary/30 rounded-xl border border-border/50",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider block mb-1.5",children:"Category"}),a.jsxs("select",{value:u,onChange:ce=>d(ce.target.value),className:"w-full px-3 py-2 bg-white border border-border rounded-xl outline-none focus:border-primary text-sm",children:[a.jsx("option",{children:"All Categories"}),F.map(ce=>a.jsx("option",{value:ce.name,children:ce.name},ce.id))]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider block mb-1.5",children:"Supplier"}),a.jsx("select",{value:f,onChange:ce=>h(ce.target.value),className:"w-full px-3 py-2 bg-white border border-border rounded-xl outline-none focus:border-primary text-sm",children:i_e.map(ce=>a.jsx("option",{children:ce},ce))})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider block mb-1.5",children:"Stock Status"}),a.jsx("div",{className:"flex gap-1.5 flex-wrap",children:o_e.map(ce=>a.jsx("button",{onClick:()=>x(ce),className:`px-3 py-1.5 rounded-lg text-xs font-medium transition-colors ${p===ce?"bg-primary text-primary-foreground":"bg-white border border-border hover:bg-muted"}`,children:ce},ce))})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider block mb-1.5",children:"Warehouse"}),a.jsx("div",{className:"flex gap-1.5 flex-wrap",children:l_e.map(ce=>a.jsx("button",{onClick:()=>w(ce),className:`px-3 py-1.5 rounded-lg text-xs font-medium transition-colors ${y===ce?"bg-primary text-primary-foreground":"bg-white border border-border hover:bg-muted"}`,children:ce},ce))})]})]})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("p",{className:"text-sm text-muted-foreground",children:["Showing ",a.jsx("span",{className:"font-semibold text-foreground",children:ve.length})," of"," ",a.jsx("span",{className:"font-semibold text-foreground",children:B.length})," products"]}),he&&a.jsx("button",{onClick:()=>{l(""),d("All Categories"),h("All Suppliers"),x("All"),w("All")},className:"text-xs text-primary hover:underline font-medium",children:"Clear all filters"})]}),a.jsx(ye,{className:"overflow-hidden border-border/50",children:a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-border bg-secondary/30",children:[a.jsx("th",{className:"px-4 py-3 text-left font-semibold text-muted-foreground text-xs uppercase tracking-wider",children:a.jsx(de,{field:"sku5star",children:"FSG Part #"})}),[["productName","Product"],["color","Color / Size"],["material","Material"],["supplier","Supplier"]].map(([ce,te])=>a.jsx("th",{className:"px-4 py-3 text-left font-semibold text-muted-foreground text-xs uppercase tracking-wider",children:a.jsx(de,{field:ce,children:te})},ce)),a.jsx("th",{className:"px-4 py-3 text-left font-semibold text-muted-foreground text-xs uppercase tracking-wider",children:a.jsx(de,{field:"storageLocation",children:"Location"})}),a.jsx("th",{className:"px-4 py-3 text-left font-semibold text-muted-foreground text-xs uppercase tracking-wider",children:"Qty on Hand"}),a.jsx("th",{className:"px-4 py-3 text-left font-semibold text-muted-foreground text-xs uppercase tracking-wider",children:a.jsx(de,{field:"costPerUnit",children:"Cost"})}),a.jsx("th",{className:"px-4 py-3 text-left font-semibold text-muted-foreground text-xs uppercase tracking-wider",children:a.jsx(de,{field:"stockStatus",children:"Status"})}),e?.canManageInventory&&a.jsx("th",{className:"px-4 py-3 text-left font-semibold text-muted-foreground text-xs uppercase tracking-wider",children:a.jsx(de,{field:"reorderPoint",children:"Reorder Pt"})}),a.jsx("th",{className:"px-4 py-3 text-left font-semibold text-muted-foreground text-xs uppercase tracking-wider",children:"Action"})]})}),a.jsx("tbody",{children:ve.length===0?a.jsx("tr",{children:a.jsxs("td",{colSpan:e?.canManageInventory?11:10,className:"px-4 py-16 text-center text-muted-foreground",children:[a.jsx(Jn,{className:"w-10 h-10 mx-auto mb-3 opacity-30"}),a.jsx("p",{className:"font-medium",children:"No products match your filters"}),a.jsx("p",{className:"text-xs mt-1",children:"Try adjusting your search or filter criteria"})]})}):ve.map(ce=>{const te=jF[ce.stockStatus]??jF.OUT,_e=ce.stockStatus==="LOW"||ce.stockStatus==="OUT";return a.jsxs("tr",{className:`border-b border-border/50 transition-colors ${_e?"bg-red-50/60 hover:bg-red-50":"hover:bg-muted/30"}`,children:[a.jsx("td",{className:"px-4 py-3",children:a.jsx("span",{className:"font-mono text-xs font-semibold text-primary",children:ce.sku5star||"—"})}),a.jsxs("td",{className:"px-4 py-3",children:[a.jsx("div",{className:"font-medium text-foreground",children:ce.productName}),ce.skuMfg&&a.jsx("div",{className:"text-xs text-muted-foreground mt-0.5",children:ce.skuMfg})]}),a.jsxs("td",{className:"px-4 py-3",children:[a.jsx("div",{className:"text-sm text-foreground",children:ce.color||"—"}),(ce.size||ce.gauge)&&a.jsxs("div",{className:"text-xs text-muted-foreground",children:[ce.size,ce.gauge?` · ${ce.gauge}`:""]})]}),a.jsx("td",{className:"px-4 py-3",children:a.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded-md text-xs font-medium capitalize ${wF[ce.material]??wF.other}`,children:ce.material})}),a.jsx("td",{className:"px-4 py-3 text-sm text-foreground",children:ce.supplier}),a.jsx("td",{className:"px-4 py-3",children:ce.storageLocation?a.jsxs("div",{children:[a.jsx("span",{className:"font-mono text-xs text-foreground",children:ce.storageLocation}),ce.storageLocation2&&a.jsxs("span",{className:"font-mono text-xs text-muted-foreground ml-1",children:["/ ",ce.storageLocation2]})]}):a.jsx("span",{className:"text-xs text-muted-foreground",children:"—"})}),a.jsxs("td",{className:"px-4 py-3",children:[a.jsx("div",{className:"font-semibold text-foreground",children:TK(ce)}),a.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded-md text-xs font-medium bg-secondary text-secondary-foreground",children:AK[ce.unitType]?ce.unitType.replace("per_","per "):ce.unitType})]}),a.jsx("td",{className:"px-4 py-3 font-medium text-foreground",children:kK(ce)}),a.jsx("td",{className:"px-4 py-3",children:a.jsxs("span",{className:`inline-flex items-center gap-1.5 px-2 py-0.5 rounded-md text-xs font-semibold ${te.badge}`,children:[a.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${te.dot}`}),te.label]})}),e?.canManageInventory&&a.jsx("td",{className:"px-4 py-3",children:a.jsx("span",{className:`text-sm font-medium ${_e?"text-red-600":"text-foreground"}`,children:ce.reorderPoint>0?ce.reorderPoint:"—"})}),a.jsx("td",{className:"px-4 py-3",children:a.jsxs("div",{className:"flex items-center gap-1.5",children:[["Aluminum Coil","Steel Coil","Copper Coil"].includes(ce.category)&&a.jsxs("button",{onClick:()=>U(ce),className:"text-xs px-3 py-1.5 rounded-lg bg-purple-50 text-purple-600 hover:bg-purple-100 transition-colors font-medium flex items-center gap-1",children:[a.jsx(Tm,{className:"w-3 h-3"}),"Rolls"]}),(e?.canManageInventory||e?.role==="shop_technician")&&a.jsx("button",{onClick:()=>P(ce),className:"text-xs px-3 py-1.5 rounded-lg bg-primary/10 text-primary hover:bg-primary hover:text-primary-foreground transition-colors font-medium",children:"Adjust"}),a.jsxs("button",{onClick:()=>K(ce),className:"text-xs px-3 py-1.5 rounded-lg bg-slate-50 text-slate-600 hover:bg-slate-100 transition-colors font-medium flex items-center gap-1",children:[a.jsx(Hl,{className:"w-3 h-3"}),"History"]}),e?.canManageInventory&&a.jsx("button",{onClick:()=>_(ce),className:"text-xs px-3 py-1.5 rounded-lg bg-secondary text-foreground hover:bg-muted transition-colors font-medium",children:"Edit"})]})})]},ce.productId)})})]})})})]})]}),A&&a.jsx(u_e,{item:A,onClose:()=>P(null),onSaved:()=>{t.invalidateQueries({queryKey:["inventory-stock"]}),t.invalidateQueries({queryKey:["inventory-value"]}),t.invalidateQueries({queryKey:["/api/inventory/value"]}),t.invalidateQueries({queryKey:["/api/inventory/low-stock"]}),n({title:"Inventory adjusted successfully"})}}),R&&a.jsx(NF,{item:null,onClose:()=>H(!1),onSaved:()=>{t.invalidateQueries({queryKey:["inventory-stock"]}),t.invalidateQueries({queryKey:["inventory-value"]}),t.invalidateQueries({queryKey:["/api/inventory/value"]}),n({title:"Product added successfully"})}}),E&&a.jsx(NF,{item:E,onClose:()=>_(null),onSaved:()=>{t.invalidateQueries({queryKey:["inventory-stock"]}),t.invalidateQueries({queryKey:["inventory-value"]}),t.invalidateQueries({queryKey:["/api/inventory/value"]}),t.invalidateQueries({queryKey:["product-detail",E.productId]}),n({title:"Product updated successfully"})}}),L&&a.jsx(x_e,{onClose:()=>I(!1),onSaved:ce=>{t.invalidateQueries({queryKey:["inventory-stock"]}),t.invalidateQueries({queryKey:["inventory-value"]}),t.invalidateQueries({queryKey:["/api/inventory/value"]}),n({title:`${ce} product${ce!==1?"s":""} imported successfully`})}}),W&&a.jsx(g_e,{item:W,onClose:()=>U(null)}),V&&a.jsx(BEe,{onClose:()=>D(!1),onSaved:()=>{t.invalidateQueries({queryKey:["inventory-stock"]}),t.invalidateQueries({queryKey:["inventory-value"]}),n({title:"Shipment received successfully"})}}),q&&a.jsx(VEe,{productId:q.productId,productName:q.productName,sku5star:q.sku5star,color:q.color,onClose:()=>K(null)})]})}var gb="Tabs",[v_e]=Sr(gb,[cb]),OK=cb(),[b_e,VO]=v_e(gb),PK=v.forwardRef((e,t)=>
222{const{__scopeTabs:n,value:r,onValueChange:s,defaultValue:i,orientation:l="horizontal",dir:u,activationMode:d="automatic",...f}=e,h=Vh(u),[p,x]=Rs({prop:r,onChange:s,defaultProp:i??"",caller:gb});return a.jsx(b_e,{scope:n,baseId:tr(),value:p,onValueChange:x,orientation:l,dir:h,activationMode:d,children:a.jsx(We.div,{dir:h,"data-orientation":l,...f,ref:t})})});PK.displayName=gb;var EK="TabsList",_K=v.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...s}=e,i=VO(EK,n),l=OK(n);return a.jsx(VV,{asChild:!0,...l,orientation:i.orientation,dir:i.dir,loop:r,children:a.jsx(We.div,{role:"tablist","aria-orientation":i.orientation,...s,ref:t})})});_K.displayName=EK;var MK="TabsTrigger",RK=v.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:s=!1,...i}=e,l=VO(MK,n),u=OK(n),d=IK(l.baseId,r),f=LK(l.baseId,r),h=r===l.value;return a.jsx(GV,{asChild:!0,...u,focusable:!s,active:h,children:a.jsx(We.button,{type:"button",role:"tab","aria-selected":h,"aria-controls":f,"data-state":h?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:d,...i,ref:t,onMouseDown:Re(e.onMouseDown,p=>{!s&&p.button===0&&p.ctrlKey===!1?l.onValueChange(r):p.preventDefault()}),onKeyDown:Re(e.onKeyDown,p=>{[" ","Enter"].includes(p.key)&&l.onValueChange(r)}),onFocus:Re(e.onFocus,()=>{const p=l.activationMode!=="manual";!h&&!s&&p&&l.onValueChange(r)})})})});RK.displayName=MK;var DK="TabsContent",$K=v.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:s,children:i,...l}=e,u=VO(DK,n),d=IK(u.baseId,r),f=LK(u.baseId,r),h=r===u.value,p=v.useRef(h);return v.useEffect(()=>{const x=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(x)},[]),a.jsx(Rn,{present:s||h,children:({present:x})=>a.jsx(We.div,{"data-state":h?"active":"inactive","data-orientation":u.orientation,role:"tabpanel","aria-labelledby":d,hidden:!x,id:f,tabIndex:0,...l,ref:t,style:{...e.style,animationDuration:p.current?"0s":void 0},children:x&&i})})});$K.displayName=DK;function IK(e,t){return`${e}-trigger-${t}`}function LK(e,t){return`${e}-content-${t}`}var j_e=PK,FK=_K,qK=RK,BK=$K;const w_e=j_e,zK=v.forwardRef(({className:e,...t},n)=>a.jsx(FK,{ref:n,className:qe("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",e),...t}));zK.displayName=FK.displayName;const wo=v.forwardRef(({className:e,...t},n)=>a.jsx(qK,{ref:n,className:qe("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",e),...t}));wo.displayName=qK.displayName;const No=v.forwardRef(({className:e,...t},n)=>a.jsx(BK,{ref:n,className:qe("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));No.displayName=BK.displayName;var N_e="Label",UK=v.forwardRef((e,t)=>a.jsx(Fs.label,{...e,ref:t,onMouseDown:n=>{n.target.closest("button, input, select, textarea")||(e.onMouseDown?.(n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));UK.displayName=N_e;var HK=UK;const S_e=cv("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),xi=v.forwardRef(({className:e,...t},n)=>a.jsx(HK,{ref:n,className:qe(S_e(),e),...t}));xi.displayName=HK.displayName;var kF=1,C_e=.9,A_e=.8,T_e=.17,S2=.1,C2=.999,k_e=.9999,O_e=.99,P_e=/[\\\/_+.#"@\[\(\{&]/,E_e=/[\\\/_+.#"@\[\(\{&]/g,__e=/[\s-]/,VK=/[\s-]/g;function YA(e,t,n,r,s,i,l){if(i===t.length)return s===e.length?kF:O_e;var u=`${s},${i}`;if(l[u]!==void 0)return l[u];for(var d=r.charAt(i),f=n.indexOf(d,s),h=0,p,x,y,w;f>=0;)p=YA(e,t,n,r,f+1,i+1,l),p>h&&(f===s?p*=kF:P_e.test(e.charAt(f-1))?(p*=A_e,y=e.slice(s,f-1).match(E_e),y&&s>0&&(p*=Math.pow(C2,y.length))):__e.test(e.charAt(f-1))?(p*=C_e,w=e.slice(s,f-1).match(VK),w&&s>0&&(p*=Math.pow(C2,w.length))):(p*=T_e,s>0&&(p*=Math.pow(C2,f-s))),e.charAt(f)!==t.charAt(i)&&(p*=k_e)),(p<S2&&n.charAt(f-1)===r.charAt(i+1)||r.charAt(i+1)===r.charAt(i)&&n.charAt(f-1)!==r.charAt(i))&&(x=YA(e,t,n,r,f+1,i+2,l),x*S2>p&&(p=x*S2)),p>h&&(h=p),f=n.indexOf(d,f+1);return l[u]=h,h}function OF(e){return e.toLowerCase().replace(VK," ")}function M_e(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,YA(e,t,OF(e),OF(t),0,0,{})}var Jf='[cmdk-group=""]',A2='[cmdk-group-items=""]',R_e='[cmdk-group-heading=""]',GK='[cmdk-item=""]',PF=`${GK}:not([aria-disabled="true"])`,XA="cmdk-item-select",pu="data-value",D_e=(e,t,n
vendor: 11,260 bytes, line 222
222)=>M_e(e,t,n),KK=v.createContext(void 0),sp=()=>v.useContext(KK),WK=v.createContext(void 0),GO=()=>v.useContext(WK),YK=v.createContext(void 0),XK=v.forwardRef((e,t)=>{let n=xu(()=>{var F,B;return{search:"",value:(B=(F=e.value)!=null?F:e.defaultValue)!=null?B:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=xu(()=>new Set),s=xu(()=>new Map),i=xu(()=>new Map),l=xu(()=>new Set),u=QK(e),{label:d,children:f,value:h,onValueChange:p,filter:x,shouldFilter:y,loop:w,disablePointerSelection:j=!1,vimBindings:b=!0,...C}=e,N=tr(),k=tr(),T=tr(),A=v.useRef(null),P=G_e();tc(()=>{if(h!==void 0){let F=h.trim();n.current.value=F,E.emit()}},[h]),tc(()=>{P(6,W)},[]);let E=v.useMemo(()=>({subscribe:F=>(l.current.add(F),()=>l.current.delete(F)),snapshot:()=>n.current,setState:(F,B,X)=>{var Q,se,ee,ve;if(!Object.is(n.current[F],B)){if(n.current[F]=B,F==="search")I(),H(),P(1,L);else if(F==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let ue=document.getElementById(T);ue?ue.focus():(Q=document.getElementById(N))==null||Q.focus()}if(P(7,()=>{var ue;n.current.selectedItemId=(ue=U())==null?void 0:ue.id,E.emit()}),X||P(5,W),((se=u.current)==null?void 0:se.value)!==void 0){let ue=B??"";(ve=(ee=u.current).onValueChange)==null||ve.call(ee,ue);return}}E.emit()}},emit:()=>{l.current.forEach(F=>F())}}),[]),_=v.useMemo(()=>({value:(F,B,X)=>{var Q;B!==((Q=i.current.get(F))==null?void 0:Q.value)&&(i.current.set(F,{value:B,keywords:X}),n.current.filtered.items.set(F,R(B,X)),P(2,()=>{H(),E.emit()}))},item:(F,B)=>(r.current.add(F),B&&(s.current.has(B)?s.current.get(B).add(F):s.current.set(B,new Set([F]))),P(3,()=>{I(),H(),n.current.value||L(),E.emit()}),()=>{i.current.delete(F),r.current.delete(F),n.current.filtered.items.delete(F);let X=U();P(4,()=>{I(),X?.getAttribute("id")===F&&L(),E.emit()})}),group:F=>(s.current.has(F)||s.current.set(F,new Set),()=>{i.current.delete(F),s.current.delete(F)}),filter:()=>u.current.shouldFilter,label:d||e["aria-label"],getDisablePointerSelection:()=>u.current.disablePointerSelection,listId:N,inputId:T,labelId:k,listInnerRef:A}),[]);function R(F,B){var X,Q;let se=(Q=(X=u.current)==null?void 0:X.filter)!=null?Q:D_e;return F?se(F,n.current.search,B):0}function H(){if(!n.current.search||u.current.shouldFilter===!1)return;let F=n.current.filtered.items,B=[];n.current.filtered.groups.forEach(Q=>{let se=s.current.get(Q),ee=0;se.forEach(ve=>{let ue=F.get(ve);ee=Math.max(ue,ee)}),B.push([Q,ee])});let X=A.current;V().sort((Q,se)=>{var ee,ve;let ue=Q.getAttribute("id"),de=se.getAttribute("id");return((ee=F.get(de))!=null?ee:0)-((ve=F.get(ue))!=null?ve:0)}).forEach(Q=>{let se=Q.closest(A2);se?se.appendChild(Q.parentElement===se?Q:Q.closest(`${A2} > *`)):X.appendChild(Q.parentElement===X?Q:Q.closest(`${A2} > *`))}),B.sort((Q,se)=>se[1]-Q[1]).forEach(Q=>{var se;let ee=(se=A.current)==null?void 0:se.querySelector(`${Jf}[${pu}="${encodeURIComponent(Q[0])}"]`);ee?.parentElement.appendChild(ee)})}function L(){let F=V().find(X=>X.getAttribute("aria-disabled")!=="true"),B=F?.getAttribute(pu);E.setState("value",B||void 0)}function I(){var F,B,X,Q;if(!n.current.search||u.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let se=0;for(let ee of r.current){let ve=(B=(F=i.current.get(ee))==null?void 0:F.value)!=null?B:"",ue=(Q=(X=i.current.get(ee))==null?void 0:X.keywords)!=null?Q:[],de=R(ve,ue);n.current.filtered.items.set(ee,de),de>0&&se++}for(let[ee,ve]of s.current)for(let ue of ve)if(n.current.filtered.items.get(ue)>0){n.current.filtered.groups.add(ee);break}n.current.filtered.count=se}function W(){var F,B,X;let Q=U();Q&&(((F=Q.parentElement)==null?void 0:F.firstChild)===Q&&((X=(B=Q.closest(Jf))==null?void 0:B.querySelector(R_e))==null||X.scrollIntoView({block:"nearest"})),Q.scrollIntoView({block:"nearest"}))}function U(){var F;return(F=A.current)==null?void 0:F.querySelector(`${GK}[aria-selected="true"]`)}function V(){var F;return Array.from(((F=A.current)==null?void 0:F.querySelectorAll(PF))||[])}function D(F){let B=V()[F];B&&E.setState("value",B.getAttribute(pu))}function q(F){var B;let X=U(),Q=V(),se=Q.findIndex(ve=>ve===X),ee=Q[se+F];(B=u.current)!=null&&B.loop&&(ee=se+F<0?Q[Q.length-1]:se+F===Q.length?Q[0]:Q[se+F]),ee&&E.setState("value",ee.getAttribute(pu))}function K(F){let B=U(),X=B?.closest(Jf),Q;for(;X&&!Q;)X=F>0?H_e(X,Jf):V_e(X,Jf),Q=X?.querySelector(PF);Q?E.setState("value",Q.getAttribute(pu)):q(F)}let Y=()=>D(V().length-1),z=F=>{F.preventDefault(),F.metaKey?Y():F.altKey?K(1):q(1)},Z=F=>{F.preventDefault(),F.metaKey?D(0):F.altKey?K(-1):q(-1)};return v.createElement(Fs.div,{ref:t,tabIndex:-1,...C,"cmdk-root":"",onKeyDown:F=>{var B;(B=C.onKeyDown)==null||B.call(C,F);let X=F.nativeEvent.isComposing||F.keyCode===229;if(!(F.defaultPrevented||X))switch(F.key){case"n":case"j":{b&&F.ctrlKey&&z(F);break}case"ArrowDown":{z(F);break}case"p":case"k":{b&&F.ctrlKey&&Z(F);break}case"ArrowUp":{Z(F);break}case"Home":{F.preventDefault(),D(0);break}case"End":{F.preventDefault(),Y();break}case"Enter":{F.preventDefault();let Q=U();if(Q){let se=new Event(XA);Q.dispatchEvent(se)}}}}},v.createElement("label",{"cmdk-label":"",htmlFor:_.inputId,id:_.labelId,style:W_e},d),yb(e,F=>v.createElement(WK.Provider,{value:E},v.createElement(KK.Provider,{value:_},F))))}),$_e=v.forwardRef((e,t)=>{var n,r;let s=tr(),i=v.useRef(null),l=v.useContext(YK),u=sp(),d=QK(e),f=(r=(n=d.current)==null?void 0:n.forceMount)!=null?r:l?.forceMount;tc(()=>{if(!f)return u.item(s,l?.id)},[f]);let h=ZK(s,i,[e.value,e.children,i],e.keywords),p=GO(),x=Fo(P=>P.value&&P.value===h.current),y=Fo(P=>f||u.filter()===!1?!0:P.search?P.filtered.items.get(s)>0:!0);v.useEffect(()=>{let P=i.current;if(!(!P||e.disabled))return P.addEventListener(XA,w),()=>P.removeEventListener(XA,w)},[y,e.onSelect,e.disabled]);function w(){var P,E;j(),(E=(P=d.current).onSelect)==null||E.call(P,h.current)}function j(){p.setState("value",h.current,!0)}if(!y)return null;let{disabled:b,value:C,onSelect:N,forceMount:k,keywords:T,...A}=e;return v.createElement(Fs.div,{ref:Ms(i,t),...A,id:s,"cmdk-item":"",role:"option","aria-disabled":!!b,"aria-selected":!!x,"data-disabled":!!b,"data-selected":!!x,onPointerMove:b||u.getDisablePointerSelection()?void 0:j,onClick:b?void 0:w},e.children)}),I_e=v.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:s,...i}=e,l=tr(),u=v.useRef(null),d=v.useRef(null),f=tr(),h=sp(),p=Fo(y=>s||h.filter()===!1?!0:y.search?y.filtered.groups.has(l):!0);tc(()=>h.group(l),[]),ZK(l,u,[e.value,e.heading,d]);let x=v.useMemo(()=>({id:l,forceMount:s}),[s]);return v.createElement(Fs.div,{ref:Ms(u,t),...i,"cmdk-group":"",role:"presentation",hidden:p?void 0:!0},n&&v.createElement("div",{ref:d,"cmdk-group-heading":"","aria-hidden":!0,id:f},n),yb(e,y=>v.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?f:void 0},v.createElement(YK.Provider,{value:x},y))))}),L_e=v.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,s=v.useRef(null),i=Fo(l=>!l.search);return!n&&!i?null:v.createElement(Fs.div,{ref:Ms(s,t),...r,"cmdk-separator":"",role:"separator"})}),F_e=v.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,s=e.value!=null,i=GO(),l=Fo(f=>f.search),u=Fo(f=>f.selectedItemId),d=sp();return v.useEffect(()=>{e.value!=null&&i.setState("search",e.value)},[e.value]),v.createElement(Fs.input,{ref:t,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":d.listId,"aria-labelledby":d.labelId,"aria-activedescendant":u,id:d.inputId,type:"text",value:s?e.value:l,onChange:f=>{s||i.setState("search",f.target.value),n?.(f.target.value)}})}),q_e=v.forwardRef((e,t)=>{let{children:n,label:r="Suggestions",...s}=e,i=v.useRef(null),l=v.useRef(null),u=Fo(f=>f.selectedItemId),d=sp();return v.useEffect(()=>{if(l.current&&i.current){let f=l.current,h=i.current,p,x=new ResizeObserver(()=>{p=requestAnimationFrame(()=>{let y=f.offsetHeight;h.style.setProperty("--cmdk-list-height",y.toFixed(1)+"px")})});return x.observe(f),()=>{cancelAnimationFrame(p),x.unobserve(f)}}},[]),v.createElement(Fs.div,{ref:Ms(i,t),...s,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":u,"aria-label":r,id:d.listId},yb(e,f=>v.createElement("div",{ref:Ms(l,d.listInnerRef),"cmdk-list-sizer":""},f)))}),B_e=v.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:s,contentClassName:i,container:l,...u}=e;return v.createElement(SO,{open:n,onOpenChange:r},v.createElement(CO,{container:l},v.createElement(ob,{"cmdk-overlay":"",className:s}),v.createElement(lb,{"aria-label":e.label,"cmdk-dialog":"",className:i},v.createElement(XK,{ref:t,...u}))))}),z_e=v.forwardRef((e,t)=>Fo(n=>n.filtered.count===0)?v.createElement(Fs.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),U_e=v.forwardRef((e,t)=>{let{progress:n,children:r,label:s="Loading...",...i}=e;return v.createElement(Fs.div,{ref:t,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},yb(e,l=>v.createElement("div",{"aria-hidden":!0},l)))}),Lr=Object.assign(XK,{List:q_e,Item:$_e,Input:F_e,Group:I_e,Separator:L_e,Dialog:B_e,Empty:z_e,Loading:U_e});function H_e(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function V_e(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function QK(e){let t=v.useRef(e);return tc(()=>{t.current=e}),t}var tc=typeof window>"u"?v.useEffect:v.useLayoutEffect;function xu(e){let t=v.useRef();return t.current===void 0&&(t.current=e()),t}function Fo(e){let t=GO(),n=()=>e(t.snapshot());return v.useSyncExternalStore(t.subscribe,n,n)}function ZK(e,t,n,r=[]){let s=v.useRef(),i=sp();return tc(()=>{var l;let u=(()=>{var f;for(let h of n){if(typeof h=="string")return h.trim();if(typeof h=="object"&&"current"in h)return h.current?(f=h.current.textContent)==null?void 0:f.trim():s.current}})(),d=r.map(f=>f.trim());i.value(e,u,d),(l=t.current)==null||l.setAttribute(pu,u),s.current=u}),s}var G_e=()=>{let[e,t]=v.useState(),n=xu(()=>new Map);return tc(()=>{n.current.forEach(r=>r()),n.current=new Map},[e]),(r,s)=>{n.current.set(r,s),t({})}};function K_e(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function yb({asChild:e,children:t},n){return e&&v.isValidElement(t)?v.cloneElement(K_e(t),{ref:t.ref},n(t.props.children)):n(t)}var W_e={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const JK=v.forwardRef(({className:e,...t},n)=>a.jsx(Lr,{ref:n,className:qe("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));JK.displayName=Lr.displayName;const eW=v.forwardRef(({className:e,...t},n)=>a.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[a.jsx(Da,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),a.jsx(Lr.Input,{ref:n,className:qe("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...t})]}));
222eW.displayName=Lr.Input.displayName;const tW=v.forwardRef(({className:e,...t},n)=>a.jsx(Lr.List,{ref:n,className:qe("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));tW.displayName=Lr.List.displayName;const nW=v.forwardRef((e,t)=>a.jsx(Lr.Empty,{ref:t,className:"py-6 text-center text-sm",...e}));nW.displayName=Lr.Empty.displayName;const vg=v.forwardRef(({className:e,...t},n)=>a.jsx(Lr.Group,{ref:n,className:qe("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e),...t}));vg.displayName=Lr.Group.displayName;const Y_e=v.forwardRef(({className:e,...t},n)=>a.jsx(Lr.Separator,{ref:n,className:qe("-mx-1 h-px bg-border",e),...t}));Y_e.displayName=Lr.Separator.displayName;const bg=v.forwardRef(({className:e,...t},n)=>a.jsx(Lr.Item,{ref:n,className:qe("relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",e),...t}));bg.displayName=Lr.Item.displayName;function EF({value:e,onChange:t,options:n,disabled:r,placeholder:s="Category (optional)","data-testid":i}){const[l,u]=v.useState(!1),[d,f]=v.useState(""),h=d.trim(),p=n.find(w=>w.toLowerCase()===h.toLowerCase()),x=h.length>0&&!p;function y(w){t(w),f(""),u(!1)}return a.jsxs(vK,{open:l,onOpenChange:w=>{u(w),w||f("")},children:[a.jsx(bK,{asChild:!0,children:a.jsxs(ne,{type:"button",variant:"outline",role:"combobox","aria-expanded":l,disabled:r,className:qe("w-full justify-between font-normal",!e&&"text-muted-foreground"),"data-testid":i,children:[a.jsx("span",{className:"truncate",children:e||s}),a.jsx(gJ,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),a.jsx(qO,{className:"w-[--radix-popover-trigger-width] p-0",align:"start",children:a.jsxs(JK,{children:[a.jsx(eW,{placeholder:"Search or add category…",value:d,onValueChange:f,"data-testid":i?`${i}-input`:void 0}),a.jsxs(tW,{children:[!x&&a.jsx(nW,{children:"No categories yet."}),e&&a.jsx(vg,{children:a.jsxs(bg,{value:"__clear__",onSelect:()=>y(""),"data-testid":i?`${i}-clear`:void 0,children:[a.jsx(an,{className:"mr-2 h-4 w-4 opacity-60"}),"No category"]})}),n.length>0&&a.jsx(vg,{heading:"Existing",children:n.map(w=>a.jsxs(bg,{value:w,onSelect:()=>y(w),"data-testid":i?`${i}-option-${w}`:void 0,children:[a.jsx(ac,{className:qe("mr-2 h-4 w-4",e===w?"opacity-100":"opacity-0")}),w]},w))}),x&&a.jsx(vg,{heading:"Add new",children:a.jsxs(bg,{value:`__create__${h}`,onSelect:()=>y(h),"data-testid":i?`${i}-create`:void 0,children:[a.jsx(Ft,{className:"mr-2 h-4 w-4"}),"Create “",h,"”"]})})]})]})})]})}function X_e(e,t){return v.useReducer((n,r)=>t[n][r]??n,e)}var KO="ScrollArea",[rW]=Sr(KO),[Q_e,La]=rW(KO),aW=v.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:r="hover",dir:s,scrollHideDelay:i=600,...l}=e,[u,d]=v.useState(null),[f,h]=v.useState(null),[p,x]=v.useState(null),[y,w]=v.useState(null),[j,b]=v.useState(null),[C,N]=v.useState(0),[k,T]=v.useState(0),[A,P]=v.useState(!1),[E,_]=v.useState(!1),R=it(t,L=>d(L)),H=Vh(s);return a.jsx(Q_e,{scope:n,type:r,dir:H,scrollHideDelay:i,scrollArea:u,viewport:f,onViewportChange:h,content:p,onContentChange:x,scrollbarX:y,onScrollbarXChange:w,scrollbarXEnabled:A,onScrollbarXEnabledChange:P,scrollbarY:j,onScrollbarYChange:b,scrollbarYEnabled:E,onScrollbarYEnabledChange:_,onCornerWidthChange:N,onCornerHeightChange:T,children:a.jsx(We.div,{dir:H,...l,ref:R,style:{position:"relative","--radix-scroll-area-corner-width":C+"px","--radix-scroll-area-corner-height":k+"px",...e.style}})})});aW.displayName=KO;var sW="ScrollAreaViewport",iW=v.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:r,nonce:s,...i}=e,l=La(sW,n),u=v.useRef(null),d=it(t,u,l.onViewportChange);return a.jsxs(a.Fragment,{children:[a.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),a.jsx(We.div,{"data-radix-scroll-area-viewport":"",...i,ref:d,style:{overflowX:l.scrollbarXEnabled?"scroll":"hidden",overflowY:l.scrollbarYEnabled?"scroll":"hidden",...e.style},children:a.jsx("div",{ref:l.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});iW.displayName=sW;var qs="ScrollAreaScrollbar",WO=v.forwardRef((e,t)=>
vendor: 4,434 bytes, line 222
222{const{forceMount:n,...r}=e,s=La(qs,e.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:l}=s,u=e.orientation==="horizontal";return v.useEffect(()=>(u?i(!0):l(!0),()=>{u?i(!1):l(!1)}),[u,i,l]),s.type==="hover"?a.jsx(Z_e,{...r,ref:t,forceMount:n}):s.type==="scroll"?a.jsx(J_e,{...r,ref:t,forceMount:n}):s.type==="auto"?a.jsx(oW,{...r,ref:t,forceMount:n}):s.type==="always"?a.jsx(YO,{...r,ref:t}):null});WO.displayName=qs;var Z_e=v.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=La(qs,e.__scopeScrollArea),[i,l]=v.useState(!1);return v.useEffect(()=>{const u=s.scrollArea;let d=0;if(u){const f=()=>{window.clearTimeout(d),l(!0)},h=()=>{d=window.setTimeout(()=>l(!1),s.scrollHideDelay)};return u.addEventListener("pointerenter",f),u.addEventListener("pointerleave",h),()=>{window.clearTimeout(d),u.removeEventListener("pointerenter",f),u.removeEventListener("pointerleave",h)}}},[s.scrollArea,s.scrollHideDelay]),a.jsx(Rn,{present:n||i,children:a.jsx(oW,{"data-state":i?"visible":"hidden",...r,ref:t})})}),J_e=v.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=La(qs,e.__scopeScrollArea),i=e.orientation==="horizontal",l=bb(()=>d("SCROLL_END"),100),[u,d]=X_e("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return v.useEffect(()=>{if(u==="idle"){const f=window.setTimeout(()=>d("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(f)}},[u,s.scrollHideDelay,d]),v.useEffect(()=>{const f=s.viewport,h=i?"scrollLeft":"scrollTop";if(f){let p=f[h];const x=()=>{const y=f[h];p!==y&&(d("SCROLL"),l()),p=y};return f.addEventListener("scroll",x),()=>f.removeEventListener("scroll",x)}},[s.viewport,i,d,l]),a.jsx(Rn,{present:n||u!=="hidden",children:a.jsx(YO,{"data-state":u==="hidden"?"hidden":"visible",...r,ref:t,onPointerEnter:Re(e.onPointerEnter,()=>d("POINTER_ENTER")),onPointerLeave:Re(e.onPointerLeave,()=>d("POINTER_LEAVE"))})})}),oW=v.forwardRef((e,t)=>{const n=La(qs,e.__scopeScrollArea),{forceMount:r,...s}=e,[i,l]=v.useState(!1),u=e.orientation==="horizontal",d=bb(()=>{if(n.viewport){const f=n.viewport.offsetWidth<n.viewport.scrollWidth,h=n.viewport.offsetHeight<n.viewport.scrollHeight;l(u?f:h)}},10);return md(n.viewport,d),md(n.content,d),a.jsx(Rn,{present:r||i,children:a.jsx(YO,{"data-state":i?"visible":"hidden",...s,ref:t})})}),YO=v.forwardRef((e,t)=>{const{orientation:n="vertical",...r}=e,s=La(qs,e.__scopeScrollArea),i=v.useRef(null),l=v.useRef(0),[u,d]=v.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),f=fW(u.viewport,u.content),h={...r,sizes:u,onSizesChange:d,hasThumb:f>0&&f<1,onThumbChange:x=>i.current=x,onThumbPointerUp:()=>l.current=0,onThumbPointerDown:x=>l.current=x};function p(x,y){return sMe(x,l.current,u,y)}return n==="horizontal"?a.jsx(eMe,{...h,ref:t,onThumbPositionChange:()=>{if(s.viewport&&i.current){const x=s.viewport.scrollLeft,y=_F(x,u,s.dir);i.current.style.transform=`translate3d(${y}px, 0, 0)`}},onWheelScroll:x=>{s.viewport&&(s.viewport.scrollLeft=x)},onDragScroll:x=>{s.viewport&&(s.viewport.scrollLeft=p(x,s.dir))}}):n==="vertical"?a.jsx(tMe,{...h,ref:t,onThumbPositionChange:()=>{if(s.viewport&&i.current){const x=s.viewport.scrollTop,y=_F(x,u);i.current.style.transform=`translate3d(0, ${y}px, 0)`}},onWheelScroll:x=>{s.viewport&&(s.viewport.scrollTop=x)},onDragScroll:x=>{s.viewport&&(s.viewport.scrollTop=p(x))}}):null}),eMe=v.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...s}=e,i=La(qs,e.__scopeScrollArea),[l,u]=v.useState(),d=v.useRef(null),f=it(t,d,i.onScrollbarXChange);return v.useEffect(()=>{d.current&&u(getComputedStyle(d.current))},[d]),a.jsx(cW,{"data-orientation":"horizontal",...s,ref:f,sizes:n,style:{bottom:0,left:i.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:i.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":vb(n)+"px",...e.style},onThumbPointerDown:h=>e.onThumbPointerDown(h.x),onDragScroll:h=>e.onDragScroll(h.x),onWheelScroll:(h,p)=>{if(i.viewport){const x=i.viewport.scrollLeft+h.deltaX;e.onWheelScroll(x),hW(x,p)&&h.preventDefault()}},onResize:()=>{d.current&&i.viewport&&l&&r({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:d.current.clientWidth,paddingStart:nv(l.paddingLeft),paddingEnd:nv(l.paddingRight)}})}})}),tMe=v.forwardRef((e,t)=>
vendor: 6,728 bytes, line 222
222{const{sizes:n,onSizesChange:r,...s}=e,i=La(qs,e.__scopeScrollArea),[l,u]=v.useState(),d=v.useRef(null),f=it(t,d,i.onScrollbarYChange);return v.useEffect(()=>{d.current&&u(getComputedStyle(d.current))},[d]),a.jsx(cW,{"data-orientation":"vertical",...s,ref:f,sizes:n,style:{top:0,right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":vb(n)+"px",...e.style},onThumbPointerDown:h=>e.onThumbPointerDown(h.y),onDragScroll:h=>e.onDragScroll(h.y),onWheelScroll:(h,p)=>{if(i.viewport){const x=i.viewport.scrollTop+h.deltaY;e.onWheelScroll(x),hW(x,p)&&h.preventDefault()}},onResize:()=>{d.current&&i.viewport&&l&&r({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:d.current.clientHeight,paddingStart:nv(l.paddingTop),paddingEnd:nv(l.paddingBottom)}})}})}),[nMe,lW]=rW(qs),cW=v.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:s,onThumbChange:i,onThumbPointerUp:l,onThumbPointerDown:u,onThumbPositionChange:d,onDragScroll:f,onWheelScroll:h,onResize:p,...x}=e,y=La(qs,n),[w,j]=v.useState(null),b=it(t,R=>j(R)),C=v.useRef(null),N=v.useRef(""),k=y.viewport,T=r.content-r.viewport,A=hn(h),P=hn(d),E=bb(p,10);function _(R){if(C.current){const H=R.clientX-C.current.left,L=R.clientY-C.current.top;f({x:H,y:L})}}return v.useEffect(()=>{const R=H=>{const L=H.target;w?.contains(L)&&A(H,T)};return document.addEventListener("wheel",R,{passive:!1}),()=>document.removeEventListener("wheel",R,{passive:!1})},[k,w,T,A]),v.useEffect(P,[r,P]),md(w,E),md(y.content,E),a.jsx(nMe,{scope:n,scrollbar:w,hasThumb:s,onThumbChange:hn(i),onThumbPointerUp:hn(l),onThumbPositionChange:P,onThumbPointerDown:hn(u),children:a.jsx(We.div,{...x,ref:b,style:{position:"absolute",...x.style},onPointerDown:Re(e.onPointerDown,R=>{R.button===0&&(R.target.setPointerCapture(R.pointerId),C.current=w.getBoundingClientRect(),N.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",y.viewport&&(y.viewport.style.scrollBehavior="auto"),_(R))}),onPointerMove:Re(e.onPointerMove,_),onPointerUp:Re(e.onPointerUp,R=>{const H=R.target;H.hasPointerCapture(R.pointerId)&&H.releasePointerCapture(R.pointerId),document.body.style.webkitUserSelect=N.current,y.viewport&&(y.viewport.style.scrollBehavior=""),C.current=null})})})}),tv="ScrollAreaThumb",uW=v.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=lW(tv,e.__scopeScrollArea);return a.jsx(Rn,{present:n||s.hasThumb,children:a.jsx(rMe,{ref:t,...r})})}),rMe=v.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:r,...s}=e,i=La(tv,n),l=lW(tv,n),{onThumbPositionChange:u}=l,d=it(t,p=>l.onThumbChange(p)),f=v.useRef(void 0),h=bb(()=>{f.current&&(f.current(),f.current=void 0)},100);return v.useEffect(()=>{const p=i.viewport;if(p){const x=()=>{if(h(),!f.current){const y=iMe(p,u);f.current=y,u()}};return u(),p.addEventListener("scroll",x),()=>p.removeEventListener("scroll",x)}},[i.viewport,h,u]),a.jsx(We.div,{"data-state":l.hasThumb?"visible":"hidden",...s,ref:d,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:Re(e.onPointerDownCapture,p=>{const y=p.target.getBoundingClientRect(),w=p.clientX-y.left,j=p.clientY-y.top;l.onThumbPointerDown({x:w,y:j})}),onPointerUp:Re(e.onPointerUp,l.onThumbPointerUp)})});uW.displayName=tv;var XO="ScrollAreaCorner",dW=v.forwardRef((e,t)=>{const n=La(XO,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?a.jsx(aMe,{...e,ref:t}):null});dW.displayName=XO;var aMe=v.forwardRef((e,t)=>{const{__scopeScrollArea:n,...r}=e,s=La(XO,n),[i,l]=v.useState(0),[u,d]=v.useState(0),f=!!(i&&u);return md(s.scrollbarX,()=>{const h=s.scrollbarX?.offsetHeight||0;s.onCornerHeightChange(h),d(h)}),md(s.scrollbarY,()=>{const h=s.scrollbarY?.offsetWidth||0;s.onCornerWidthChange(h),l(h)}),f?a.jsx(We.div,{...r,ref:t,style:{width:i,height:u,position:"absolute",right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function nv(e){return e?parseInt(e,10):0}function fW(e,t){const n=e/t;return isNaN(n)?0:n}function vb(e){const t=fW(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function sMe(e,t,n,r="ltr"){const s=vb(n),i=s/2,l=t||i,u=s-l,d=n.scrollbar.paddingStart+l,f=n.scrollbar.size-n.scrollbar.paddingEnd-u,h=n.content-n.viewport,p=r==="ltr"?[0,h]:[h*-1,0];return mW([d,f],p)(e)}function _F(e,t,n="ltr"){const r=vb(t),s=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,i=t.scrollbar.size-s,l=t.content-t.viewport,u=i-r,d=n==="ltr"?[0,l]:[l*-1,0],f=FA(e,d);return mW([0,l],[0,u])(f)}function mW(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function hW(e,t){return e>0&&e<t}var iMe=(e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return(function s(){const i={left:e.scrollLeft,top:e.scrollTop},l=n.left!==i.left,u=n.top!==i.top;(l||u)&&t(),n=i,r=window.requestAnimationFrame(s)})(),()=>window.cancelAnimationFrame(r)};function bb(e,t){const n=hn(e),r=v.useRef(0);return v.useEffect(()=>()=>window.clearTimeout(r.current),[]),v.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function md(e,t){const n=hn(t);Un(()=>{let r=0;if(e){const s=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return s.observe(e),()=>{window.cancelAnimationFrame(r),s.unobserve(e)}}},[e,n])}var pW=aW,oMe=iW,lMe=dW;const xW=v.forwardRef(({className:e,children:t,...n},r)=>a.jsxs(pW,{ref:r,className:qe("relative overflow-hidden",e),...n,children:[a.jsx(oMe,{className:"h-full w-full rounded-[inherit]",children:t}),a.jsx(gW,{}),a.jsx(lMe,{})]}));xW.displayName=pW.displayName;const gW=v.forwardRef(({className:e,orientation:t="vertical",...n},r)=>a.jsx(WO,{ref:r,orientation:t,className:qe("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...n,children:a.jsx(uW,{className:"relative flex-1 rounded-full bg-border"})}));gW.displayName=WO.displayName;const cMe=["admin","manager"],uMe=["admin","manager","estimator"];function Ga(e){const t=parseFloat(e);return Number.isFinite(t)?t:0}function MF(){return`cat-${Date.now()}-${Math.random().toString(36).slice(2,5)}`}function dMe(){const{teamMember:e}=Nn(),t=e?.role??"",n=cMe.includes(t),r=uMe.includes(t),{config:s,isLoading:i}=pb(),l=oK(),{toast:u}=nr(),[d,f]=v.useState(null);v.useEffect(()=>{s&&!d&&!i&&f(structuredClone(s))},[s,d,i]);const h=v.useMemo(()=>d?d.consumableOptions.join(", "):"",[d]),p=v.useMemo(()=>
222{if(!d)return[];const F=new Map;for(const B of[...d.savedAddOns,...d.savedPackages]){const X=(B.category??"").trim();if(!X)continue;const Q=X.toLowerCase();F.has(Q)||F.set(Q,X)}return Array.from(F.values()).sort((B,X)=>B.localeCompare(X,void 0,{sensitivity:"base"}))},[d]),x=v.useMemo(()=>d?Wz(d.savedAddOns,d.savedPackages):[],[d]),y=v.useMemo(()=>d?Gde(d.savedAddOns,d.savedPackages):[],[d]),[w,j]=v.useState(null),[b,C]=v.useState(""),[N,k]=v.useState(null);if(!r)return a.jsxs("div",{className:"flex flex-col items-center justify-center h-64 text-center text-muted-foreground",children:[a.jsx(Ro,{className:"h-6 w-6 mb-2 opacity-60"}),a.jsx("p",{className:"font-medium text-foreground",children:"Access denied"}),a.jsx("p",{className:"text-sm",children:"You don't have permission to view pricing settings."})]});if(i||!d)return a.jsxs("div",{className:"flex items-center justify-center h-64 text-muted-foreground",children:[a.jsx(Me,{className:"h-5 w-5 animate-spin mr-2"})," Loading pricing…"]});function T(F,B){f(X=>X&&{...X,[F]:B})}function A(F,B,X,Q){f(se=>{if(!se)return se;const ee=structuredClone(se);return ee[F][B]=ee[F][B]||{},ee[F][B][X]=Q,ee})}function P(){f(F=>F&&{...F,savedAddOns:[...F.savedAddOns,{id:MF(),label:"",description:"",price:0,category:""}]})}function E(F,B){f(X=>X&&{...X,savedAddOns:X.savedAddOns.map(Q=>Q.id===F?{...Q,...B}:Q)})}function _(F){f(B=>B&&{...B,savedAddOns:B.savedAddOns.filter(X=>X.id!==F)})}function R(){f(F=>F&&{...F,savedPackages:[...F.savedPackages,{id:MF(),name:"",description:"",total:0,category:""}]})}function H(F,B){f(X=>X&&{...X,savedPackages:X.savedPackages.map(Q=>Q.id===F?{...Q,...B}:Q)})}function L(F){f(B=>B&&{...B,savedPackages:B.savedPackages.filter(X=>X.id!==F)})}function I(F,B){const X=B.trim();X&&f(Q=>Q&&{...Q,savedAddOns:GR(Q.savedAddOns,F,X),savedPackages:GR(Q.savedPackages,F,X)})}function W(F){j(F),C(F)}function U(){j(null),C("")}function V(F,B){const X=F.trim().toLowerCase(),Q=B.trim(),se=Q.toLowerCase(),ee=x.filter(Se=>{const he=Se.name.trim().toLowerCase();return he===X||he===se}),ve=ee.filter(Se=>Se.name!==Q),ue=ve.reduce((Se,he)=>Se+he.total,0),de=ee.find(Se=>Se.name===Q)?.total??0;return{target:Q,sources:ve,movingCount:ue,targetExisting:de,isMerge:ee.length>1}}function D(F){const B=b.trim();if(!B){U();return}if(V(F,B).isMerge){k({from:F,to:B}),U();return}I(F,B),U()}function q(F){k({from:F,to:F})}function K(F,B){f(X=>X&&{...X,savedAddOns:X.savedAddOns.map(Q=>Q.id in F?{...Q,category:F[Q.id]}:Q),savedPackages:X.savedPackages.map(Q=>Q.id in B?{...Q,category:B[Q.id]}:Q)}),u({title:"Merge undone",description:"The original categories have been restored."})}function Y(){if(!N)return;const F=N,B={};for(const Q of d.savedAddOns)B[Q.id]=Q.category;const X={};for(const Q of d.savedPackages)X[Q.id]=Q.category;I(F.from,F.to),k(null),u({title:"Categories merged",description:`Merged into “${F.to.trim()}”. Undo before saving to restore the original categories.`,action:a.jsx(f8,{altText:"Undo the category merge",onClick:()=>K(B,X),"data-testid":"button-undo-merge",children:"Undo"})})}function z(){if(!d||!n)return;const F={...d,consumableOptions:h.split(",").map(B=>Ga(B.trim())).filter(B=>!Number.isNaN(B))};l.mutate(F,{onSuccess:()=>u({title:"Pricing saved",description:"Quote pricing has been updated."}),onError:B=>u({title:"Save failed",description:B?.message||"Could not save pricing",variant:"destructive"})})}function Z({label:F,minTable:B,sellTable:X}){const Q=Object.keys(d[B]);return a.jsxs(ye,{children:[a.jsx(Ss,{className:"pb-2",children:a.jsx(Cs,{className:"text-base",children:F})}),a.jsx(_t,{className:"space-y-4",children:Q.map(se=>{const ee=Object.keys(d[B][se]||{});return a.jsxs("div",{children:[a.jsx("p",{className:"font-medium text-sm mb-2",children:se}),a.jsxs("div",{className:"grid grid-cols-[1fr_auto_auto] gap-2 items-center text-xs text-muted-foreground mb-1",children:[a.jsx("span",{children:"Style"}),a.jsx("span",{className:"w-24 text-center",children:"Floor $/ft"}),a.jsx("span",{className:"w-24 text-center",children:"Sell $/ft"})]}),a.jsx("div",{className:"space-y-1",children:ee.map(ve=>a.jsxs("div",{className:"grid grid-cols-[1fr_auto_auto] gap-2 items-center",children:[a.jsx("span",{className:"text-sm",children:ve}),a.jsx(Ee,{type:"number",step:"0.01",min:"0",disabled:!n,className:"w-24 h-8",value:d[B][se]?.[ve]??0,onChange:ue=>A(B,se,ve,Ga(ue.target.value)),"data-testid":`input-${B}-${se}-${ve}`}),a.jsx(Ee,{type:"number",step:"0.01",min:"0",disabled:!n,className:"w-24 h-8",value:d[X][se]?.[ve]??0,onChange:ue=>A(X,se,ve,Ga(ue.target.value)),"data-testid":`input-${X}-${se}-${ve}`})]},ve))})]},se)})})]})}return a.jsxs("div",{className:"max-w-4xl mx-auto pb-24",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Ro,{className:"h-5 w-5 text-primary"}),a.jsx("h1",{className:"text-xl font-semibold",children:"Pricing Settings"})]}),n&&a.jsxs(ne,{onClick:z,disabled:l.isPending,"data-testid":"button-save-pricing",children:[l.isPending?a.jsx(Me,{className:"h-4 w-4 animate-spin mr-2"}):a.jsx(Si,{className:"h-4 w-4 mr-2"}),"Save Changes"]})]}),!n&&a.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"You can view pricing but only admins and managers can edit it."}),a.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"Material costs come from Inventory. These values control the per-foot sell & floor prices and the non-product scalars used by the quote builder. Floor is the minimum a quote can be saved at; Sell is the default rate auto-filled when an estimator picks a material & style."}),a.jsxs(w_e,{defaultValue:"perfoot",children:[a.jsxs(zK,{className:"mb-4 flex-wrap h-auto",children:[a.jsx(wo,{value:"perfoot",children:"Per-Foot"}),a.jsx(wo,{value:"hardware",children:"Hardware"}),a.jsx(wo,{value:"guards",children:"Guards"}),a.jsx(wo,{value:"fittings",children:"Fittings"}),a.jsx(wo,{value:"labor",children:"Labor & Other"}),a.jsx(wo,{value:"options",children:"Client Options"}),a.jsxs(wo,{value:"history","data-testid":"tab-history",children:[a.jsx(Hl,{className:"h-4 w-4 mr-1.5"})," History"]})]}),a.jsxs(No,{value:"perfoot",className:"space-y-4",children:[a.jsx(Z,{label:"Gutter (per linear foot)",minTable:"gutterMinPrices",sellTable:"gutterSellPrices"}),a.jsx(Z,{label:"Downspout (per linear foot)",minTable:"downspoutMinPrices",sellTable:"downspoutSellPrices"})]}),a.jsx(No,{value:"hardware",children:a.jsxs(ye,{children:[a.jsx(Ss,{className:"pb-2",children:a.jsx(Cs,{className:"text-base",children:"Hangers & Rods"})}),a.jsxs(_t,{className:"space-y-3",children:[Object.keys(d.hangerPrices).map(F=>
222a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs(xi,{className:"text-sm",children:[F," hanger ($ each)"]}),a.jsx(Ee,{type:"number",step:"0.01",min:"0",disabled:!n,className:"w-28 h-8",value:d.hangerPrices[F]??0,onChange:B=>f(X=>X&&{...X,hangerPrices:{...X.hangerPrices,[F]:Ga(B.target.value)}}),"data-testid":`input-hanger-${F}`})]},F)),a.jsxs("div",{className:"flex items-center justify-between gap-2 border-t pt-3",children:[a.jsx(xi,{className:"text-sm",children:"Rod ($ each)"}),a.jsx(Ee,{type:"number",step:"0.01",min:"0",disabled:!n,className:"w-28 h-8",value:d.rodPrice,onChange:F=>T("rodPrice",Ga(F.target.value)),"data-testid":"input-rod-price"})]})]})]})}),a.jsx(No,{value:"guards",children:a.jsxs(ye,{children:[a.jsx(Ss,{className:"pb-2",children:a.jsx(Cs,{className:"text-base",children:"Gutter Guards"})}),a.jsx(_t,{className:"space-y-3",children:Object.entries(d.guards).map(([F,B])=>a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsx(Ee,{className:"flex-1 h-8",disabled:!n,value:B.label,onChange:X=>f(Q=>Q&&{...Q,guards:{...Q.guards,[F]:{...Q.guards[F],label:X.target.value}}}),"data-testid":`input-guard-label-${F}`}),a.jsx(Ee,{type:"number",step:"0.01",min:"0",disabled:!n,className:"w-28 h-8",value:B.rate,onChange:X=>f(Q=>Q&&{...Q,guards:{...Q.guards,[F]:{...Q.guards[F],rate:Ga(X.target.value)}}}),"data-testid":`input-guard-rate-${F}`})]},F))})]})}),a.jsx(No,{value:"fittings",children:a.jsxs(ye,{children:[a.jsx(Ss,{className:"pb-2",children:a.jsx(Cs,{className:"text-base",children:"Feet Added Per Fitting"})}),a.jsx(_t,{className:"space-y-3",children:[["miterFeetAdded","Miter (ft each)"],["elbowFeetAdded","Elbow (ft each)"],["endCapFeetAdded","End cap (ft each)"],["outletFeetAdded","Outlet (ft each)"]].map(([F,B])=>a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsx(xi,{className:"text-sm",children:B}),a.jsx(Ee,{type:"number",step:"0.5",min:"0",disabled:!n,className:"w-28 h-8",value:d[F],onChange:X=>T(F,Ga(X.target.value)),"data-testid":`input-${F}`})]},F))})]})}),a.jsx(No,{value:"labor",children:a.jsxs(ye,{children:[a.jsx(Ss,{className:"pb-2",children:a.jsx(Cs,{className:"text-base",children:"Labor & Other Rates"})}),a.jsxs(_t,{className:"space-y-3",children:[[["removalRate","Removal ($/ft)"],["foremanRate","Foreman ($/hr)"],["techRate","Technician ($/hr)"]].map(([F,B])=>a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsx(xi,{className:"text-sm",children:B}),a.jsx(Ee,{type:"number",step:"0.01",min:"0",disabled:!n,className:"w-28 h-8",value:d[F],onChange:X=>T(F,Ga(X.target.value)),"data-testid":`input-${F}`})]},F)),a.jsxs("div",{className:"border-t pt-3",children:[a.jsx(xi,{className:"text-sm",children:"Consumable % options (comma-separated)"}),a.jsx(Ee,{className:"mt-1 h-8",disabled:!n,value:h,onChange:F=>f(B=>B&&{...B,consumableOptions:F.target.value.split(",").map(X=>Ga(X.trim()))}),"data-testid":"input-consumable-options"})]})]})]})}),a.jsxs(No,{value:"options",className:"space-y-4",children:[a.jsx("p",{className:"text-xs text-muted-foreground",children:"Save a library of reusable add-ons and alternate packages here. Estimators can drop them into a quote with one click and still edit the wording or price for that quote."}),x.length>0&&a.jsxs(ye,{children:[a.jsxs(Ss,{className:"pb-2 flex-row items-center gap-2 space-y-0",children:[a.jsx(xte,{className:"h-4 w-4 text-primary"}),a.jsx(Cs,{className:"text-base",children:"Manage Categories"})]}),a.jsxs(_t,{className:"space-y-3",children:[a.jsx("p",{className:"text-xs text-muted-foreground",children:"Rename a category to fix a typo, or rename it to an existing name to merge the two groups across every saved add-on and package. Changes apply when you click Save Changes."}),y.length>0&&a.jsxs("div",{className:"rounded-md border border-amber-300 bg-amber-50 p-2.5 space-y-2","data-testid":"duplicate-categories-warning",children:[a.jsx("p",{className:"text-xs font-medium text-amber-900",children:"These look like the same category with different spelling. Merge them so the quote builder shows one group."}),y.map(F=>{const B=Kde(F),X=B.toLowerCase();return a.jsxs("div",{className:"flex items-center justify-between gap-2","data-testid":`duplicate-group-${X}`,children:[a.jsxs("span",{className:"text-sm text-amber-900",children:[F.map(Q=>`“${Q.name}”`).join(" + "),a.jsx(Ru,{className:"inline h-3 w-3 mx-1.5"}),a.jsxs("span",{className:"font-medium",children:["“",B,"”"]}
222)]}),n&&a.jsxs(ne,{variant:"outline",size:"sm",className:"shrink-0 h-7",onClick:()=>q(B),"data-testid":`button-merge-duplicate-${X}`,children:[a.jsx(wee,{className:"h-3 w-3 mr-1"}),"Merge"]})]},X)})]}),a.jsx("div",{className:"space-y-1.5",children:x.map(F=>{const B=w===F.name;return a.jsx("div",{className:"flex items-center gap-2","data-testid":`category-row-${F.name}`,children:B?a.jsxs(a.Fragment,{children:[a.jsx(Ee,{autoFocus:!0,className:"h-8 flex-1",value:b,onChange:X=>C(X.target.value),onKeyDown:X=>{X.key==="Enter"&&D(F.name),X.key==="Escape"&&U()},"data-testid":`input-category-rename-${F.name}`}),a.jsx(ne,{variant:"ghost",size:"icon",className:"h-8 w-8 shrink-0",onClick:()=>D(F.name),"data-testid":`button-category-save-${F.name}`,children:a.jsx(ac,{className:"h-4 w-4"})}),a.jsx(ne,{variant:"ghost",size:"icon",className:"h-8 w-8 shrink-0",onClick:U,"data-testid":`button-category-cancel-${F.name}`,children:a.jsx(an,{className:"h-4 w-4"})})]}):a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-sm flex-1 truncate",children:F.name}),a.jsxs(Hh,{variant:"secondary",className:"shrink-0 font-normal",children:[F.total," ",F.total===1?"item":"items"]}),n&&a.jsx(ne,{variant:"ghost",size:"icon",className:"h-8 w-8 shrink-0",onClick:()=>W(F.name),"data-testid":`button-category-edit-${F.name}`,children:a.jsx(gd,{className:"h-3.5 w-3.5"})})]})},F.name)})})]})]}),a.jsxs(ye,{children:[a.jsxs(Ss,{className:"pb-2 flex-row items-center justify-between space-y-0",children:[a.jsx(Cs,{className:"text-base",children:"Saved Add-ons"}),n&&a.jsxs(ne,{variant:"outline",size:"sm",onClick:P,"data-testid":"button-add-saved-addon",children:[a.jsx(Ft,{className:"h-3 w-3 mr-1"}),"Add"]})]}),a.jsxs(_t,{className:"space-y-2",children:[d.savedAddOns.length===0&&a.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No saved add-ons yet."}),d.savedAddOns.map(F=>a.jsxs("div",{className:"rounded-md border p-2 space-y-1.5",children:[a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Ee,{placeholder:"Label (e.g. Leaf guard upgrade)",disabled:!n,value:F.label,onChange:B=>E(F.id,{label:B.target.value}),"data-testid":`input-saved-addon-label-${F.id}`}),a.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:"$"}),a.jsx(Ee,{type:"number",step:"0.01",min:"0",className:"w-24",placeholder:"0",disabled:!n,value:F.price||"",onChange:B=>E(F.id,{price:Ga(B.target.value)}),"data-testid":`input-saved-addon-price-${F.id}`})]}),n&&a.jsx(ne,{variant:"ghost",size:"icon",className:"shrink-0",onClick:()=>_(F.id),"data-testid":`button-remove-saved-addon-${F.id}`,children:a.jsx(an,{className:"h-4 w-4"})})]}),a.jsx(EF,{value:F.category??"",disabled:!n,options:p,placeholder:"Category (optional, e.g. Guards)",onChange:B=>E(F.id,{category:B}),"data-testid":`input-saved-addon-category-${F.id}`}),a.jsx(Ql,{placeholder:"Description (optional)",rows:2,disabled:!n,value:F.description,onChange:B=>E(F.id,{description:B.target.value}),"data-testid":`input-saved-addon-desc-${F.id}`})]},F.id))]})]}),a.jsxs(ye,{children:[a.jsxs(Ss,{className:"pb-2 flex-row items-center justify-between space-y-0",children:[a.jsx(Cs,{className:"text-base",children:"Saved Packages"}),n&&a.jsxs(ne,{variant:"outline",size:"sm",onClick:R,"data-testid":"button-add-saved-package",children:[a.jsx(Ft,{className:"h-3 w-3 mr-1"}),"Add"]})]}),a.jsxs(_t,{className:"space-y-2",children:[d.savedPackages.length===0&&a.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No saved packages yet."}),d.savedPackages.map(F=>a.jsxs("div",{className:"rounded-md border p-2 space-y-1.5",children:[a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Ee,{placeholder:"Name (e.g. Premium)",disabled:!n,value:F.name,onChange:B=>H(F.id,{name:B.target.value}),"data-testid":`input-saved-package-name-${F.id}`}),a.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:"$"}),a.jsx(Ee,{type:"number",step:"0.01",min:"0",className:"w-24",placeholder:"0",disabled:!n,value:F.total||"",onChange:B=>H(F.id,{total:Ga(B.target.value)}),"data-testid":`input-saved-package-total-${F.id}`})]}),n&&a.jsx(ne,{variant:"ghost",size:"icon",className:"shrink-0",onClick:()=>L(F.id),"data-testid":`button-remove-saved-package-${F.id}`,children:a.jsx(an,{className:"h-4 w-4"})})]}),a.jsx(EF,{value:F.category??"",disabled:!n,options:p,placeholder:"Category (optional, e.g. Premium tiers)",onChange:B=>H(F.id,{category:B}),"data-testid":`input-saved-package-category-${F.id}`}),a.jsx(Ql,{placeholder:"Description (optional)",rows:2,disabled:!n,value:F.description,onChange:B=>H(F.id,{description:B.target.value}),"data-testid":`input-saved-package-desc-${F.id}`})]},F.id))]})]})]}),a.jsx(No,{value:"history",children:a.jsx(pMe,{canEdit:n})})]}),a.jsx(mb,{open:!!N,onOpenChange:F=>{F||k(null)},children:a.jsxs(Qh,{"data-testid":"dialog-merge-confirm",children:[a.jsxs(Zh,{children:[a.jsx(ep,{children:"Merge categories?"}),a.jsx(tp,{asChild:!0,children:a.jsx("div",{className:"space-y-2",children:N&&(()=>{const F=V(N.from,N.to);return a.jsxs(a.Fragment,{children:[a.jsxs("p",{children:[a.jsx("span",{className:"font-medium text-foreground",children:F.movingCount})," ",F.movingCount===1?"item":"items"," will move into"," ",a.jsxs("span",{className:"font-medium text-foreground",children:["“",F.target,"”"]}),F.targetExisting>0&&a.jsxs(a.Fragment,{children:[", which already has ",a.jsx("span",{className:"font-medium text-foreground",children:F.targetExisting})," ",F.targetExisting===1?"item":"items"]}),"."]}),F.sources.length>0&&a.jsx("ul",{className:"text-sm list-disc pl-5 space-y-0.5","data-testid":"merge-source-list",children:F.sources.map(B=>a.jsxs("li",{children:[a.jsxs("span",{className:"font-medium text-foreground",children:["“",B.name,"”"]})," (",B.total," ",B.total===1?"item":"items",")"]},B.name))}
222),a.jsx("p",{children:"This can't be undone in one click — you'd have to re-categorize each item. The change applies when you click Save Changes."})]})})()})})]}),a.jsxs(Jh,{children:[a.jsx(rp,{"data-testid":"button-merge-cancel",children:"Cancel"}),a.jsx(np,{"data-testid":"button-merge-confirm",onClick:Y,children:"Merge categories"})]})]})})]})}function RF(e){return e==null||e===""?"—":String(e)}function DF({change:e}){return a.jsxs("div",{className:"grid grid-cols-[1fr_auto] gap-2 items-center text-sm py-1",children:[a.jsx("span",{className:"text-foreground truncate",title:e.label,children:e.label}),a.jsxs("span",{className:"flex items-center gap-1.5 text-xs whitespace-nowrap",children:[a.jsx("span",{className:"text-muted-foreground line-through",children:RF(e.from)}),a.jsx(Ru,{className:"h-3 w-3 text-muted-foreground"}),a.jsx("span",{className:"font-medium text-foreground",children:RF(e.to)})]})]})}const fMe={gutterMinPrices:"Gutter Floor",gutterSellPrices:"Gutter Sell",downspoutMinPrices:"Downspout Floor",downspoutSellPrices:"Downspout Sell",hangerPrices:"Hanger",rodPrice:"Rod Price",guards:"Guard",miterFeetAdded:"Miter (ft added)",elbowFeetAdded:"Elbow (ft added)",endCapFeetAdded:"End Cap (ft added)",outletFeetAdded:"Outlet (ft added)",removalRate:"Removal Rate",foremanRate:"Foreman Rate",techRate:"Technician Rate",consumableOptions:"Consumable % Options"};function mMe(e){const[t,...n]=e.split(".");return[fMe[t]??t,...n].join(" · ")}function QA(e,t="",n={}){if(e==null)return n;if(Array.isArray(e))return n[t]=e.join(", "),n;if(typeof e=="object"){for(const[r,s]of Object.entries(e))QA(s,t?`${t}.${r}`:r,n);return n}return n[t]=String(e),n}function hMe(e,t){if(!e)return[];const n=QA(e),r=QA(t),s=new Set([...Object.keys(n),...Object.keys(r)]),i=[];for(const l of s){const u=n[l]??null,d=r[l]??null;u!==d&&i.push({path:l,label:mMe(l),from:u,to:d})}return i.sort((l,u)=>l.path.localeCompare(u.path)),i}const Zx="__all__";function pMe({canEdit:e}){const{config:t}=pb(),[n,r]=v.useState(Zx),[s,i]=v.useState(""),[l,u]=v.useState(""),[d,f]=v.useState({}),{data:h,isLoading:p,isError:x,fetchNextPage:y,hasNextPage:w,isFetchingNextPage:j}=pPe(d),b=xPe(),{toast:C}=nr(),[N,k]=v.useState(null),[T,A]=v.useState(null),P=h?.pages??[],E=P.flatMap(U=>U.entries),_=P[0]?.total??0,R=(P[P.length-1]?.authors??P[0]?.authors??[]).filter(U=>typeof U.savedById=="number"),H=!!(d.savedById||d.from||d.to);function L(){const U={};n!==Zx&&(U.savedById=Number(n)),s&&(U.from=s),l&&(U.to=l),f(U)}function I(){r(Zx),i(""),u(""),f({})}function W(U){k(U),b.mutate(U,{onSuccess:()=>C({title:"Version restored",description:"Pricing has been rolled back to this version."}),onError:V=>C({title:"Restore failed",description:V?.message||"Could not restore version",variant:"destructive"}),onSettled:()=>k(null)})}return a.jsxs("div",{className:"space-y-3",children:[a.jsx(ye,{children:a.jsx(_t,{className:"pt-4",children:a.jsxs("div",{className:"flex flex-wrap items-end gap-3",children:[a.jsxs("div",{className:"flex flex-col gap-1",children:[a.jsx(xi,{className:"text-xs text-muted-foreground",children:"Author"}),a.jsxs(Sa,{value:n,onValueChange:r,children:[a.jsx(ra,{className:"w-48 h-9","data-testid":"select-history-author",children:a.jsx(Ca,{placeholder:"All authors"})}),a.jsxs(aa,{children:[a.jsx(Qn,{value:Zx,children:"All authors"}),R.map(U=>a.jsx(Qn,{value:String(U.savedById),children:U.savedByName||"Unknown"},U.savedById))]})]})]}),a.jsxs("div",{className:"flex flex-col gap-1",children:[a.jsx(xi,{className:"text-xs text-muted-foreground",children:"From"}),a.jsx(Ee,{type:"date",className:"w-40 h-9",value:s,max:l||void 0,onChange:U=>i(U.target.value),"data-testid":"input-history-from"})]}),a.jsxs("div",{className:"flex flex-col gap-1",children:[a.jsx(xi,{className:"text-xs text-muted-foreground",children:"To"}),a.jsx(Ee,{type:"date",className:"w-40 h-9",value:l,min:s||void 0,onChange:U=>u(U.target.value),"data-testid":"input-history-to"})]}),a.jsx(ne,{size:"sm",className:"h-9",onClick:L,"data-testid":"button-apply-history-filters",children:"Apply"}),H&&a.jsxs(ne,{variant:"ghost",size:"sm",className:"h-9",onClick:I,"data-testid":"button-clear-history-filters",children:[a.jsx(an,{className:"h-3.5 w-3.5 mr-1.5"})," Clear"]})]})})}),p?a.jsxs("div",{className:"flex items-center justify-center h-40 text-muted-foreground",children:[a.jsx(Me,{className:"h-5 w-5 animate-spin mr-2"})," Loading history…"]}):x?a.jsx(ye,{children:a.jsxs(_t,{className:"flex flex-col items-center justify-center h-40 text-center text-muted-foreground",children:[a.jsx(Hl,{className:"h-6 w-6 mb-2 opacity-60"}),a.jsx("p",{className:"font-medium text-foreground",children:"Couldn't load history"}),a.jsx("p",{className:"text-sm",children:"Please try again in a moment."})]})}):E.length===0?a.jsx(ye,{children:a.jsxs(_t,{className:"flex flex-col items-center justify-center h-40 text-center text-muted-foreground",children:[a.jsx(Hl,{className:"h-6 w-6 mb-2 opacity-60"}),a.jsx("p",{className:"font-medium text-foreground",children:H?"No matching changes":"No changes yet"}),a.jsx("p",{className:"text-sm",children:H?"Try a different author or date range.":"Pricing edits will appear here with who changed what and when."})]})}):a.jsxs(a.Fragment,{children:[a.jsxs("p",{className:"text-xs text-muted-foreground","data-testid":"text-history-count",children:["Showing ",E.length," of ",_," change",_===1?"":"s"]}),E.map(U=>a.jsxs(ye,{"data-testid":`history-entry-${U.id}`,children:[a.jsx(Ss,{className:"pb-2",children:a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{children:[a.jsxs(Cs,{className:"text-base flex items-center gap-2",children:[U.savedByName||"Unknown",U.savedByRole&&a.jsx(Hh,{variant:"secondary",className:"text-[10px] capitalize",children:U.savedByRole.replace("_"," ")})]}),a.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",title:new Date(U.createdAt).toLocaleStr
222ing(),children:[lk(new Date(U.createdAt),{addSuffix:!0})," · ",U.changes.length," change",U.changes.length===1?"":"s"]})]}),e&&a.jsxs(ne,{variant:"outline",size:"sm",disabled:b.isPending,onClick:()=>A(U),"data-testid":`button-restore-${U.id}`,children:[N===U.id?a.jsx(Me,{className:"h-3.5 w-3.5 animate-spin mr-1.5"}):a.jsx(hT,{className:"h-3.5 w-3.5 mr-1.5"}),"Restore"]})]})}),a.jsx(_t,{children:U.changes.length===0?a.jsx("p",{className:"text-sm text-muted-foreground",children:"No field-level changes recorded."}):a.jsx("div",{className:"divide-y",children:U.changes.map(V=>a.jsx(DF,{change:V},V.path))})})]},U.id)),w&&a.jsx("div",{className:"flex justify-center pt-1",children:a.jsxs(ne,{variant:"outline",disabled:j,onClick:()=>y(),"data-testid":"button-load-more-history",children:[j&&a.jsx(Me,{className:"h-4 w-4 animate-spin mr-2"}),"Load more"]})})]}),a.jsx(mb,{open:!!T,onOpenChange:U=>{U||A(null)},children:a.jsxs(Qh,{"data-testid":"dialog-restore-confirm",children:[a.jsxs(Zh,{children:[a.jsx(ep,{children:"Restore this pricing version?"}),a.jsx(tp,{asChild:!0,children:a.jsxs("div",{className:"space-y-2",children:[a.jsxs("p",{children:["This will roll back ",a.jsx("span",{className:"font-medium text-foreground",children:"all live pricing"})," to the version saved by"," ",a.jsx("span",{className:"font-medium text-foreground",children:T?.savedByName||"Unknown"}),T&&a.jsxs(a.Fragment,{children:[" on"," ",a.jsx("span",{className:"font-medium text-foreground",children:new Date(T.createdAt).toLocaleString()})]}),"."]}),T&&(()=>{const U=hMe(t,T.config),V=U.length;return V===0?a.jsx("p",{children:"This version matches your current pricing — nothing will change."}):a.jsxs(a.Fragment,{children:[a.jsxs("p",{children:[a.jsx("span",{className:"font-medium text-foreground",children:V})," field",V===1?"":"s"," will change. The quote builder uses these prices immediately."]}),a.jsx(xW,{className:"max-h-56 rounded-md border","data-testid":"restore-change-preview",children:a.jsx("div",{className:"divide-y px-3",children:U.map(D=>a.jsx(DF,{change:D},D.path))})})]})})()]})})]}),a.jsxs(Jh,{children:[a.jsx(rp,{"data-testid":"button-restore-cancel",children:"Cancel"}),a.jsx(np,{"data-testid":"button-restore-confirm",onClick:()=>{T&&W(T.id),A(null)},children:"Restore version"})]})]})})]})}var jb="Checkbox",[xMe]=Sr(jb),[gMe,QO]=xMe(jb);function yMe(e){const{__scopeCheckbox:t,checked:n,children:r,defaultChecked:s,disabled:i,form:l,name:u,onCheckedChange:d,required:f,value:h="on",internal_do_not_use_render:p}=e,[x,y]=Rs({prop:n,defaultProp:s??!1,onChange:d,caller:jb}),[w,j]=v.useState(null),[b,C]=v.useState(null),N=v.useRef(!1),k=w?!!l||!!w.closest("form"):!0,T={checked:x,disabled:i,setChecked:y,control:w,setControl:j,name:u,form:l,value:h,hasConsumerStoppedPropagationRef:N,required:f,defaultChecked:Mo(s)?!1:s,isFormControl:k,bubbleInput:b,setBubbleInput:C};return a.jsx(gMe,{scope:t,...T,children:vMe(p)?p(T):r})}var yW="CheckboxTrigger",vW=v.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},s)=>{const{control:i,value:l,disabled:u,checked:d,required:f,setControl:h,setChecked:p,hasConsumerStoppedPropagationRef:x,isFormControl:y,bubbleInput:w}=QO(yW,e),j=it(s,h),b=v.useRef(d);return v.useEffect(()=>{const C=i?.form;if(C){const N=()=>p(b.current);return C.addEventListener("reset",N),()=>C.removeEventListener("reset",N)}},[i,p]),a.jsx(We.button,{type:"button",role:"checkbox","aria-checked":Mo(d)?"mixed":d,"aria-required":f,"data-state":SW(d),"data-disabled":u?"":void 0,disabled:u,value:l,...r,ref:j,onKeyDown:Re(t,C=>{C.key==="Enter"&&C.preventDefault()}),onClick:Re(n,C=>{p(N=>Mo(N)?!0:!N),w&&y&&(x.current=C.isPropagationStopped(),x.current||C.stopPropagation())})})});vW.displayName=yW;var ZO=v.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:s,defaultChecked:i,required:l,disabled:u,value:d,onCheckedChange:f,form:h,...p}=e;return a.jsx(yMe,{__scopeCheckbox:n,checked:s,defaultChecked:i,disabled:u,required:l,onCheckedChange:f,name:r,form:h,value:d,internal_do_not_use_render:({isFormControl:x})=>a.jsxs(a.Fragment,{children:[a.jsx(vW,{...p,ref:t,__scopeCheckbox:n}),x&&a.jsx(NW,{__scopeCheckbox:n})]})})});ZO.displayName=jb;var bW="CheckboxIndicator",jW=v.forwardRef((e,t)=>
222{const{__scopeCheckbox:n,forceMount:r,...s}=e,i=QO(bW,n);return a.jsx(Rn,{present:r||Mo(i.checked)||i.checked===!0,children:a.jsx(We.span,{"data-state":SW(i.checked),"data-disabled":i.disabled?"":void 0,...s,ref:t,style:{pointerEvents:"none",...e.style}})})});jW.displayName=bW;var wW="CheckboxBubbleInput",NW=v.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:r,hasConsumerStoppedPropagationRef:s,checked:i,defaultChecked:l,required:u,disabled:d,name:f,value:h,form:p,bubbleInput:x,setBubbleInput:y}=QO(wW,e),w=it(n,y),j=vO(i),b=NT(r);v.useEffect(()=>{const N=x;if(!N)return;const k=window.HTMLInputElement.prototype,A=Object.getOwnPropertyDescriptor(k,"checked").set,P=!s.current;if(j!==i&&A){const E=new Event("click",{bubbles:P});N.indeterminate=Mo(i),A.call(N,Mo(i)?!1:i),N.dispatchEvent(E)}},[x,j,i,s]);const C=v.useRef(Mo(i)?!1:i);return a.jsx(We.input,{type:"checkbox","aria-hidden":!0,defaultChecked:l??C.current,required:u,disabled:d,name:f,value:h,form:p,...t,tabIndex:-1,ref:w,style:{...t.style,...b,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});NW.displayName=wW;function vMe(e){return typeof e=="function"}function Mo(e){return e==="indeterminate"}function SW(e){return Mo(e)?"indeterminate":e?"checked":"unchecked"}const CW=v.forwardRef(({className:e,...t},n)=>a.jsx(ZO,{ref:n,className:qe("grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...t,children:a.jsx(jW,{className:qe("grid place-content-center text-current"),children:a.jsx(ac,{className:"h-4 w-4"})})}));CW.displayName=ZO.displayName;const $F=["outlook-tasks"];function Jx(e,t={}){const n=localStorage.getItem("fs_team_token");return fetch(e,{...t,headers:{"Content-Type":"application/json",...n?{Authorization:`Bearer ${n}`}:{},...t.headers||{}}})}async function eg(e){const t=await e.json().catch(()=>null);if(!e.ok)throw new Error(t?.error||`Request failed (${e.status})`);return t}function bMe(e){const[t,n,r]=e.split("-").map(Number),s=new Date(t,n-1,r),i=new Date;i.setHours(0,0,0,0);const l=Math.round((s.getTime()-i.getTime())/864e5);return l===0?{label:"Due today",overdue:!1}:l===1?{label:"Due tomorrow",overdue:!1}:l===-1?{label:"1 day overdue",overdue:!0}:l<0?{label:`${-l} days overdue`,overdue:!0}:{label:`Due ${s.toLocaleDateString("en-US",{month:"short",day:"numeric"})}`,overdue:!1}}function jMe(){const{toast:e}=nr(),t=wt(),[n,r]=v.useState(""),[s,i]=v.useState(""),{data:l,isLoading:u,error:d}=Xe({queryKey:$F,queryFn:()=>Jx("/api/tasks").then(eg),refetchInterval:6e4}),f=()=>t.invalidateQueries({queryKey:$F}),h=nt({mutationFn:C=>Jx("/api/tasks",{method:"POST",body:JSON.stringify(C)}).then(eg),onSuccess:()=>{r(""),i(""),f()},onError:C=>e({title:"Could not add task",description:C.message,variant:"destructive"})}),p=nt({mutationFn:C=>Jx(`/api/tasks/${encodeURIComponent(C.listId)}/${encodeURIComponent(C.id)}`,{method:"PATCH",body:JSON.stringify({completed:!C.completed})}).then(eg),onSuccess:f,onError:C=>e({title:"Could not update task",description:C.message,variant:"destructive"})}),x=nt({mutationFn:C=>Jx(`/api/tasks/${encodeURIComponent(C.listId)}/${encodeURIComponent(C.id)}`,{method:"DELETE"}).then(eg),onSuccess:f,onError:C=>e({title:"Could not delete task",description:C.message,variant:"destructive"})}),y=C=>{C.preventDefault(),!(!n.trim()||h.isPending)&&h.mutate({title:n.trim(),...s?{dueDate:s}:{}})},w=l?.tasks||[],j=w.filter(C=>!C.completed),b=w.filter(C=>C.completed);return a.jsxs("div",{className:"p-4 md:p-8 max-w-3xl mx-auto",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-1",children:[a.jsx(tm,{className:"h-7 w-7 text-primary"}),a.jsx("h1",{className:"text-2xl font-bold","data-testid":"text-tasks-title",children:"My Tasks"})]}),a.jsx("p",{className:"text-muted-foreground mb-6 text-sm",children:"Synced with your Outlook / Microsoft To Do task list. Changes here appear in Outlook, and vice versa."}),l?.noToken?a.jsxs("div",{className:"rounded-lg border bg-amber-50 border-amber-200 p-6 text-center","data-testid":"banner-no-token",children:[a.jsx(rn,{className:"h-8 w-8 text-amber-500 mx-auto mb-2"}),a.jsx("p",{className:"font-medium text-amber-900",children:"Microsoft account not connected"}),a.jsx("p",{className:"text-sm text-amber-800 mt-1",children:"Sign in with Microsoft (or reconnect your account on the Team page) to see your Outlook tasks here."})]}):a.jsxs(a.Fragment,{children:[a.jsxs("form",{onSubmit:y,className:"flex flex-col sm:flex-row gap-2 mb-6",children:[a.jsx(Ee,{placeholder:"Add a task…",value:n,onChange:C=>r(C.target.value),"data-testid":"input-new-task"}),a.jsx(Ee,{type:"date",className:"sm:w-44",value:s,onChange:C=>i(C.target.value),"data-testid":"input-new-task-due"}),a.jsxs(ne,{type:"submit",disabled:!n.trim()||h.isPending,"data-testid":"button-add-task",children:[h.isPending?a.jsx(Me,{className:"h-4 w-4 animate-spin"}):a.jsx(Ft,{className:"h-4 w-4"}),a.jsx("span",{className:"ml-1",children:"Add"})]})]}),u?a.jsxs("div",{className:"flex items-center justify-center py-16 text-muted-foreground",children:[a.jsx(Me,{className:"h-6 w-6 animate-spin mr-2"})," Loading your Outlook tasks…"]}):d?a.jsx("div",{className:"rounded-lg border bg-red-50 border-red-200 p-4 text-sm text-red-800","data-testid":"banner-tasks-error",children:d.message}):a.jsxs(a.Fragment,{children:[j.length===0&&b.length===0&&a.jsxs("div",{className:"text-center py-16 text-muted-foreground","data-testid":"text-no-tasks",children:[a.jsx(st,{className:"h-10 w-10 mx-auto mb-3 opacity-40"}),"No tasks — you're all caught up."]}),a.jsx("div",{className:"space-y-2",children:j.map(C=>a.jsx(IF,{task:C,onToggle:p.mutate,onDelete:x.mutate},C.id))}),b.length>0&&a.jsxs(a.Fragment,{children:[a.jsxs("h2",{className:"text-sm font-medium text-muted-foreground mt-8 mb-2",children:["Completed (",b.length,")"]}),a.jsx("div",{className:"space-y-2 opacity-70",children:b.map(C=>a.jsx(IF,{task:C,onToggle:p.mutate,onDelete:x.mutate},C.id))})]})]})]})]})}function IF({task:e,onToggle:t,onDelete:n}){const r=e.dueDate&&!e.completed?bMe(e.dueDate):null;return a.jsxs("div",{className:"flex items-start gap-3 rounded-lg border bg-card p-3 group","data-testid":`row-task-${e.id}`,children:[a.jsx(CW,{checked:e.completed,onCheckedChange:()=>t(e),className:"mt-0.5","data-testid":`checkbox-task-${e.id}`}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:`text-sm font-medium ${e.completed?"line-through text-muted-foreground":""}`,children:e.title}),e.notes&&a.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 whitespace-pre-wrap",children:e.notes}),a.jsxs("div",{className:"flex items-center gap-3 mt-1",children:[r&&a.jsxs("span",{className:`inline-flex items-center gap-1 text-xs ${r.overdue?"text-red-600 font-medium":"text-muted-foreground"}`,children:[a.jsx(Ma,{className:"h-3 w-3"})," ",r.label]}),e.importance==="high"&&!e.completed&&a.jsx("span",{className:"text-xs text-orange-600 font-medium",children:"Important"})]})]}),a.jsx(ne,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground opacity-0 group-hover:opacity-100 focus:opacity-100 transition-opacity",onClick:()=>n(e),"aria-label":"Delete task","data-testid":`button-delete-task-${e.id}`,children:a.jsx(on,{className:"h-4 w-4"})})]})}const wMe=new SQ({defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!1,staleTime:300*1e3}}});function NMe(){return a.jsx(CQ,{client:wMe,children:a.jsx(KF,{base:"/".replace(/\/$/,""),children:a.jsx(xae,{children:a.jsxs(hae,{children:[a.jsxs(IM,{children:[a.jsx(Lt,{path:"/login",component:Aue}),a.jsx(Lt,{path:"/auth/callback",component:Tue}),a.jsx(Lt,{path:"/client-login",component:kue}),a.jsx(Lt,{path:"/client-verify",component:Oue}),a.jsx(Lt,{path:"/client-portal",children:a.jsx($j,{children:a.jsx(Xde,{})})}),a.jsx(Lt,{path:"/contractor",children:a.jsx($j,{children:a.jsx(Zde,{})})}),a.jsx(Lt,{path:"/quote/:id/contract",children:a.jsx($j,{children:a.jsx(dfe,{})})}),a.jsx(Lt,{children:a.jsx(gae,{children:a.jsx(Mse,{children:a.jsxs(IM,{children:[a.jsx(Lt,{path:"/",component:()=>(window.location.href="/dashboard",null)}),a.jsx(Lt,{path:"/dashboard",component:yAe}),a.jsx(Lt,{path:"/leads",component:MAe}),a.jsx(Lt,{path:"/calendar",component:FAe}),a.jsx(Lt,{path:"/tasks",component:jMe}),a.jsx(Lt,{path:"/quotes/new",children:a.jsx(wx,{children:a.jsx(xF,{})})}),a.jsx(Lt,{path:"/quotes/:id/edit",children:a.jsx(wx,{children:a.jsx(xF,{})})}),a.jsx(Lt,{path:"/quotes/:id/proposal",children:a.jsx(wx,{children:a.jsx(DPe,{})})}),a.jsx(Lt,{path:"/quotes",children:a.jsx(wx,{children:a.jsx(qAe,{})})}),a.jsx(Lt,{path:"/jobs",component:zPe}),a.jsx(Lt,{path:"/materials",component:FEe}),a.jsx(Lt,{path:"/pricing",component:dMe}),a.jsx(Lt,{path:"/inventory",component:y_e}),a.jsx(Lt,{path:"/job-status",component:JPe}),a.jsx(Lt,{path:"/clients/:id",component:cEe}),a.jsx(Lt,{path:"/clients",component:KPe}),a.jsx(Lt,{path:"/team",component:DEe}),a.jsx(Lt,{path:"/email-templates",component:OEe}),a.jsx(Lt,{path:"/integrations",component:TEe}),a.jsx(Lt,{component:$Ee})]})})})})]}),a.jsx(Dne,{})]})})})})}RX.createRoot(document.getElementById("root")).render(a.jsx(NMe,{}));export{rfe as _,hx as c,Bt as g};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.