@verifiedinc-public/shared-ui-elements 3.4.3 → 3.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
|
|
1
|
-
"use strict";import{j as s}from"../../shared/jsx-runtime-jmtevAuS.mjs";import*as C from"react";import{useCallback as U,useMemo as te,createElement as be}from"react";import{Box as ae,Stack as Z,Typography as Q,useTheme as ge}from"@mui/material";import{ResponsiveContainer as xe,LineChart as Oe,CartesianGrid as we,XAxis as Se,YAxis as je,Label as $e,Tooltip as ke,Legend as Te,Line as Ne}from"recharts";import{b as _e,c as Ee}from"../../shared/date-Cq0LS2Mr.mjs";import{Decimal as X}from"decimal.js";import{AnimatePresence as Ge}from"framer-motion";import{u as Ae}from"../../shared/useCopyToClipboard-BALOSYVW.mjs";import"qrcode";import{u as ie}from"../../shared/usePrevious-A8he0cAZ.mjs";import{a as Ce,C as se}from"../../shared/motions-CpxgbzKX.mjs";import{i as De,_ as I,s as Le,a as m,c as le,d as Me,e as Re,f as qe,h as Fe,j as Ve,k as We,l as Ie,m as ze,n as Be,o as Pe,p as Ke,u as Ue}from"../../shared/index-CDq4CkLc.mjs";const Ze=["ownerState"],Qe=["variants"],Xe=["name","slot","skipVariantsResolver","skipSx","overridesResolver"];function Ye(e){return Object.keys(e).length===0}function He(e){return typeof e=="string"&&e.charCodeAt(0)>96}function Y(e){return e!=="ownerState"&&e!=="theme"&&e!=="sx"&&e!=="as"}const Je=le(),en=e=>e&&e.charAt(0).toLowerCase()+e.slice(1);function z({defaultTheme:e,theme:n,themeId:o}){return Ye(n)?e:n[o]||n}function nn(e){return e?(n,o)=>o[e]:null}function B(e,n){let{ownerState:o}=n,r=I(n,Ze);const t=typeof e=="function"?e(m({ownerState:o},r)):e;if(Array.isArray(t))return t.flatMap(a=>B(a,m({ownerState:o},r)));if(t&&typeof t=="object"&&Array.isArray(t.variants)){const{variants:a=[]}=t;let i=I(t,Qe);return a.forEach(c=>{let l=!0;typeof c.props=="function"?l=c.props(m({ownerState:o},r,o)):Object.keys(c.props).forEach(u=>{o?.[u]!==c.props[u]&&r[u]!==c.props[u]&&(l=!1)}),l&&(Array.isArray(i)||(i=[i]),i.push(typeof c.style=="function"?c.style(m({ownerState:o},r,o)):c.style))}),i}return t}function on(e={}){const{themeId:n,defaultTheme:o=Je,rootShouldForwardProp:r=Y,slotShouldForwardProp:t=Y}=e,a=i=>Me(m({},i,{theme:z(m({},i,{defaultTheme:o,themeId:n}))}));return a.__mui_systemSx=!0,(i,c={})=>{De(i,p=>p.filter(x=>!(x!=null&&x.__mui_systemSx)));const{name:l,slot:u,skipVariantsResolver:w,skipSx:d,overridesResolver:y=nn(en(u))}=c,f=I(c,Xe),g=w!==void 0?w:u&&u!=="Root"&&u!=="root"||!1,h=d||!1;let S,j=Y;u==="Root"||u==="root"?j=r:u?j=t:He(i)&&(j=void 0);const T=Le(i,m({shouldForwardProp:j,label:S},f)),q=p=>typeof p=="function"&&p.__emotion_real!==p||Re(p)?x=>B(p,m({},x,{theme:z({theme:x.theme,defaultTheme:o,themeId:n})})):p,E=(p,...x)=>{let L=q(p);const N=x?x.map(q):[];l&&y&&N.push(v=>{const b=z(m({},v,{defaultTheme:o,themeId:n}));if(!b.components||!b.components[l]||!b.components[l].styleOverrides)return null;const $=b.components[l].styleOverrides,G={};return Object.entries($).forEach(([P,W])=>{G[P]=B(W,m({},v,{theme:b}))}),y(v,G)}),l&&!g&&N.push(v=>{var b;const $=z(m({},v,{defaultTheme:o,themeId:n})),G=$==null||(b=$.components)==null||(b=b[l])==null?void 0:b.variants;return B({variants:G},m({},v,{theme:$}))}),h||N.push(a);const F=N.length-x.length;if(Array.isArray(p)&&F>0){const v=new Array(F).fill("");L=[...p,...v],L.raw=[...p.raw,...v]}const V=T(L,...N);return i.muiName&&(V.muiName=i.muiName),V};return T.withConfig&&(E.withConfig=T.withConfig),E}}const rn=on(),tn=(e,n)=>e.filter(o=>n.includes(o)),D=(e,n,o)=>{const r=e.keys[0];Array.isArray(n)?n.forEach((t,a)=>{o((i,c)=>{a<=e.keys.length-1&&(a===0?Object.assign(i,c):i[e.up(e.keys[a])]=c)},t)}):n&&typeof n=="object"?(Object.keys(n).length>e.keys.length?e.keys:tn(e.keys,Object.keys(n))).forEach(t=>{if(e.keys.indexOf(t)!==-1){const a=n[t];a!==void 0&&o((i,c)=>{r===t?Object.assign(i,c):i[e.up(t)]=c},a)}}):(typeof n=="number"||typeof n=="string")&&o((t,a)=>{Object.assign(t,a)},n)};function k(e){return e?`Level${e}`:""}function R(e){return e.unstable_level>0&&e.container}function ce(e){return function(n){return`var(--Grid-${n}Spacing${k(e.unstable_level)})`}}function H(e){return function(n){return e.unstable_level===0?`var(--Grid-${n}Spacing)`:`var(--Grid-${n}Spacing${k(e.unstable_level-1)})`}}function J(e){return e.unstable_level===0?"var(--Grid-columns)":`var(--Grid-columns${k(e.unstable_level-1)})`}const an=({theme:e,ownerState:n})=>{const o=ce(n),r={};return D(e.breakpoints,n.gridSize,(t,a)=>{let i={};a===!0&&(i={flexBasis:0,flexGrow:1,maxWidth:"100%"}),a==="auto"&&(i={flexBasis:"auto",flexGrow:0,flexShrink:0,maxWidth:"none",width:"auto"}),typeof a=="number"&&(i={flexGrow:0,flexBasis:"auto",width:`calc(100% * ${a} / ${J(n)}${R(n)?` + ${o("column")}`:""})`}),t(r,i)}),r},sn=({theme:e,ownerState:n})=>{const o={};return D(e.breakpoints,n.gridOffset,(r,t)=>{let a={};t==="auto"&&(a={marginLeft:"auto"}),typeof t=="number"&&(a={marginLeft:t===0?"0px":`calc(100% * ${t} / ${J(n)})`}),r(o,a)}),o},ln=({theme:e,ownerState:n})=>{if(!n.container)return{};const o=R(n)?{[`--Grid-columns${k(n.unstable_level)}`]:J(n)}:{"--Grid-columns":12};return D(e.breakpoints,n.columns,(r,t)=>{r(o,{[`--Grid-columns${k(n.unstable_level)}`]:t})}),o},cn=({theme:e,ownerState:n})=>{if(!n.container)return{};const o=H(n),r=R(n)?{[`--Grid-rowSpacing${k(n.unstable_level)}`]:o("row")}:{};return D(e.breakpoints,n.rowSpacing,(t,a)=>{var i;t(r,{[`--Grid-rowSpacing${k(n.unstable_level)}`]:typeof a=="string"?a:(i=e.spacing)==null?void 0:i.call(e,a)})}),r},un=({theme:e,ownerState:n})=>{if(!n.container)return{};const o=H(n),r=R(n)?{[`--Grid-columnSpacing${k(n.unstable_level)}`]:o("column")}:{};return D(e.breakpoints,n.columnSpacing,(t,a)=>{var i;t(r,{[`--Grid-columnSpacing${k(n.unstable_level)}`]:typeof a=="string"?a:(i=e.spacing)==null?void 0:i.call(e,a)})}),r},pn=({theme:e,ownerState:n})=>{if(!n.container)return{};const o={};return D(e.breakpoints,n.direction,(r,t)=>{r(o,{flexDirection:t})}),o},mn=({ownerState:e})=>{const n=ce(e),o=H(e);return m({minWidth:0,boxSizing:"border-box"},e.container&&m({display:"flex",flexWrap:"wrap"},e.wrap&&e.wrap!=="wrap"&&{flexWrap:e.wrap},{margin:`calc(${n("row")} / -2) calc(${n("column")} / -2)`},e.disableEqualOverflow&&{margin:`calc(${n("row")} * -1) 0px 0px calc(${n("column")} * -1)`}),(!e.container||R(e))&&m({padding:`calc(${o("row")} / 2) calc(${o("column")} / 2)`},(e.disableEqualOverflow||e.parentDisableEqualOverflow)&&{padding:`${o("row")} 0px 0px ${o("column")}`}))},dn=e=>{const n=[];return Object.entries(e).forEach(([o,r])=>{r!==!1&&r!==void 0&&n.push(`grid-${o}-${String(r)}`)}),n},fn=(e,n="xs")=>{function o(r){return r===void 0?!1:typeof r=="string"&&!Number.isNaN(Number(r))||typeof r=="number"&&r>0}if(o(e))return[`spacing-${n}-${String(e)}`];if(typeof e=="object"&&!Array.isArray(e)){const r=[];return Object.entries(e).forEach(([t,a])=>{o(a)&&r.push(`spacing-${t}-${String(a)}`)}),r}return[]},yn=e=>e===void 0?[]:typeof e=="object"?Object.entries(e).map(([n,o])=>`direction-${n}-${o}`):[`direction-xs-${String(e)}`],hn=["className","children","columns","container","component","direction","wrap","spacing","rowSpacing","columnSpacing","disableEqualOverflow","unstable_level"],vn=le(),bn=rn("div",{name:"MuiGrid",slot:"Root",overridesResolver:(e,n)=>n.root});function gn(e){return Ie({props:e,name:"MuiGrid",defaultTheme:vn})}function xn(e={}){const{createStyledComponent:n=bn,useThemeProps:o=gn,componentName:r="MuiGrid"}=e,t=C.createContext(void 0),a=(l,u)=>{const{container:w,direction:d,spacing:y,wrap:f,gridSize:g}=l,h={root:["root",w&&"container",f!=="wrap"&&`wrap-xs-${String(f)}`,...yn(d),...dn(g),...w?fn(y,u.breakpoints.keys[0]):[]]};return ze(h,S=>Be(r,S),{})},i=n(ln,un,cn,an,pn,mn,sn),c=C.forwardRef(function(l,u){var w,d,y,f,g,h,S,j;const T=qe(),q=o(l),E=Fe(q),p=C.useContext(t),{className:x,children:L,columns:N=12,container:F=!1,component:V="div",direction:v="row",wrap:b="wrap",spacing:$=0,rowSpacing:G=$,columnSpacing:P=$,disableEqualOverflow:W,unstable_level:_=0}=E,me=I(E,hn);let M=W;_&&W!==void 0&&(M=l.disableEqualOverflow);const ee={},ne={},oe={};Object.entries(me).forEach(([O,A])=>{T.breakpoints.values[O]!==void 0?ee[O]=A:T.breakpoints.values[O.replace("Offset","")]!==void 0?ne[O.replace("Offset","")]=A:oe[O]=A});const de=(w=l.columns)!=null?w:_?void 0:N,fe=(d=l.spacing)!=null?d:_?void 0:$,ye=(y=(f=l.rowSpacing)!=null?f:l.spacing)!=null?y:_?void 0:G,he=(g=(h=l.columnSpacing)!=null?h:l.spacing)!=null?g:_?void 0:P,re=m({},E,{level:_,columns:de,container:F,direction:v,wrap:b,spacing:fe,rowSpacing:ye,columnSpacing:he,gridSize:ee,gridOffset:ne,disableEqualOverflow:(S=(j=M)!=null?j:p)!=null?S:!1,parentDisableEqualOverflow:p}),ve=a(re,T);let K=s.jsx(i,m({ref:u,as:V,ownerState:re,className:Ve(ve.root,x)},oe,{children:C.Children.map(L,O=>{if(C.isValidElement(O)&&We(O,["Grid"])){var A;return C.cloneElement(O,{unstable_level:(A=O.props.unstable_level)!=null?A:_+1})}return O})}));return M!==void 0&&M!==(p??!1)&&(K=s.jsx(t.Provider,{value:M,children:K})),K});return c.muiName="Grid",c}const ue=xn({createStyledComponent:Pe("div",{name:"MuiGrid2",slot:"Root",overridesResolver:(e,n)=>n.root}),componentName:"MuiGrid2",useThemeProps:e=>Ke({props:e,name:"MuiGrid2"})});function On({entry:e,payload:n}){const o=U(d=>{var y,f,g;return console.log(d),(g=(f=(y=d.payload)==null?void 0:y.data)==null?void 0:f.reduce)==null?void 0:g.call(f,(h,S)=>h+S.value,0)},[]),r=U(d=>{const y=new X(o(d)||0),f=n?.reduce((S,j)=>S+o(j),0)||0,g=new X(f),h=Number(y.div(g).times(100).toFixed(2,X.ROUND_DOWN));return isNaN(h)||!isFinite(h)?0:h},[o,n]),t=te(()=>o(e),[e,o]),a=ie(t),i=te(()=>Number(r(e)),[e,r]),c=ie(i),l=U(d=>Math.floor(d).toLocaleString(),[]),u=Ae({type:"text/plain"}),w=Ue();return s.jsxs(Ce,{component:"li",direction:"row",spacing:1,sx:{color:e.color},layout:"position",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},children:[s.jsx(ae,{sx:{width:"3px",height:"100%",backgroundColor:e.color,borderRadius:3}}),s.jsxs(Z,{children:[s.jsxs(Q,{component:"p",variant:"caption",children:[s.jsx(Z,{component:"span",display:"inline-flex",mr:.5,children:s.jsx(se,{from:a??0,to:t,map:l,children:"0"})}),s.jsxs(Z,{component:"span",direction:"row",display:"inline-flex",children:["(",s.jsx(se,{from:c??0,to:i,map:l,children:"0"}),"%)"]})]}),s.jsx(Q,{variant:"body1",children:e.value}),e.payload.uuid&&s.jsxs(Q,{variant:"body2",sx:{cursor:"pointer","&:hover":{textDecoration:"underline"}},onClick:()=>{u.copy(e.payload.uuid).catch(()=>{}),w.enqueueSnackbar("UUID copied to clipboard","success")},children:[e.payload.uuid.slice(0,5),"..."]})]})]})}function pe(e){const{payload:n}=e;return s.jsx(ue,{container:!0,direction:"row",component:"ul",gap:2,sx:{mt:2,justifyContent:"flex-start",alignItem:"center",flexWrap:"wrap"},children:s.jsx(Ge,{children:n?.map(o=>s.jsx(ue,{children:s.jsx(On,{entry:o,payload:n},`item-${o.value}`)}))})})}function wn(e){const n=ge();return s.jsx(ae,{sx:{width:"100%",height:"100%",...e.sx},children:s.jsx(xe,{children:s.jsxs(Oe,{width:500,height:300,margin:{top:5,right:60,left:20,bottom:5},children:[s.jsx(we,{vertical:!1}),s.jsx(Se,{dataKey:"date",type:"number",domain:["dataMin","dataMax"],tickFormatter:o=>_e(o,{timeZone:e.filter.timezone,hour12:!1,hour:"numeric"}),allowDuplicatedCategory:!1,tickLine:!1,fontSize:12,tickMargin:12}),s.jsx(je,{textAnchor:"end",dataKey:"value",tickLine:!1,tickFormatter:o=>Number(o).toLocaleString(),allowDecimals:!1,domain:[1,"dataMax"],children:e.label&&s.jsx($e,{value:e.label,angle:-90,position:"insideLeft",style:{textAnchor:"middle"}})}),s.jsx(ke,{cursor:{stroke:n.palette.neutral.main,strokeWidth:1},formatter:o=>Number(o).toLocaleString(),labelFormatter:o=>Ee(o,{timeZone:e.filter.timezone,hour12:!1})}),s.jsx(Te,{content:s.jsx(pe,{})}),e.data.map(o=>be(Ne,{uuid:o.uuid,key:o.uuid,name:o.name,dataKey:"value",data:o.chartData,type:"monotone",stroke:o.color,strokeWidth:2}))]})})})}export{wn as SeriesChart,pe as SeriesChartLegend};
|
1
|
+
"use strict";import{j as s}from"../../shared/jsx-runtime-jmtevAuS.mjs";import*as C from"react";import{useCallback as U,useMemo as te,createElement as be}from"react";import{Box as ae,Stack as Z,Typography as Q,useTheme as ge}from"@mui/material";import{ResponsiveContainer as xe,LineChart as Oe,CartesianGrid as we,XAxis as Se,YAxis as je,Label as $e,Tooltip as ke,Legend as Te,Line as Ne}from"recharts";import{b as _e,c as Ee}from"../../shared/date-Cq0LS2Mr.mjs";import{Decimal as X}from"decimal.js";import{AnimatePresence as Ge}from"framer-motion";import{u as Ae}from"../../shared/useCopyToClipboard-BALOSYVW.mjs";import"qrcode";import{u as ie}from"../../shared/usePrevious-A8he0cAZ.mjs";import{a as Ce,C as se}from"../../shared/motions-CpxgbzKX.mjs";import{i as De,_ as I,s as Le,a as m,c as le,d as Me,e as Re,f as qe,h as Fe,j as Ve,k as We,l as Ie,m as ze,n as Be,o as Pe,p as Ke,u as Ue}from"../../shared/index-CDq4CkLc.mjs";const Ze=["ownerState"],Qe=["variants"],Xe=["name","slot","skipVariantsResolver","skipSx","overridesResolver"];function Ye(e){return Object.keys(e).length===0}function He(e){return typeof e=="string"&&e.charCodeAt(0)>96}function Y(e){return e!=="ownerState"&&e!=="theme"&&e!=="sx"&&e!=="as"}const Je=le(),en=e=>e&&e.charAt(0).toLowerCase()+e.slice(1);function z({defaultTheme:e,theme:n,themeId:r}){return Ye(n)?e:n[r]||n}function nn(e){return e?(n,r)=>r[e]:null}function B(e,n){let{ownerState:r}=n,o=I(n,Ze);const t=typeof e=="function"?e(m({ownerState:r},o)):e;if(Array.isArray(t))return t.flatMap(a=>B(a,m({ownerState:r},o)));if(t&&typeof t=="object"&&Array.isArray(t.variants)){const{variants:a=[]}=t;let i=I(t,Qe);return a.forEach(c=>{let l=!0;typeof c.props=="function"?l=c.props(m({ownerState:r},o,r)):Object.keys(c.props).forEach(u=>{r?.[u]!==c.props[u]&&o[u]!==c.props[u]&&(l=!1)}),l&&(Array.isArray(i)||(i=[i]),i.push(typeof c.style=="function"?c.style(m({ownerState:r},o,r)):c.style))}),i}return t}function rn(e={}){const{themeId:n,defaultTheme:r=Je,rootShouldForwardProp:o=Y,slotShouldForwardProp:t=Y}=e,a=i=>Me(m({},i,{theme:z(m({},i,{defaultTheme:r,themeId:n}))}));return a.__mui_systemSx=!0,(i,c={})=>{De(i,p=>p.filter(x=>!(x!=null&&x.__mui_systemSx)));const{name:l,slot:u,skipVariantsResolver:w,skipSx:f,overridesResolver:y=nn(en(u))}=c,d=I(c,Xe),g=w!==void 0?w:u&&u!=="Root"&&u!=="root"||!1,h=f||!1;let S,j=Y;u==="Root"||u==="root"?j=o:u?j=t:He(i)&&(j=void 0);const T=Le(i,m({shouldForwardProp:j,label:S},d)),q=p=>typeof p=="function"&&p.__emotion_real!==p||Re(p)?x=>B(p,m({},x,{theme:z({theme:x.theme,defaultTheme:r,themeId:n})})):p,E=(p,...x)=>{let L=q(p);const N=x?x.map(q):[];l&&y&&N.push(v=>{const b=z(m({},v,{defaultTheme:r,themeId:n}));if(!b.components||!b.components[l]||!b.components[l].styleOverrides)return null;const $=b.components[l].styleOverrides,G={};return Object.entries($).forEach(([P,W])=>{G[P]=B(W,m({},v,{theme:b}))}),y(v,G)}),l&&!g&&N.push(v=>{var b;const $=z(m({},v,{defaultTheme:r,themeId:n})),G=$==null||(b=$.components)==null||(b=b[l])==null?void 0:b.variants;return B({variants:G},m({},v,{theme:$}))}),h||N.push(a);const F=N.length-x.length;if(Array.isArray(p)&&F>0){const v=new Array(F).fill("");L=[...p,...v],L.raw=[...p.raw,...v]}const V=T(L,...N);return i.muiName&&(V.muiName=i.muiName),V};return T.withConfig&&(E.withConfig=T.withConfig),E}}const on=rn(),tn=(e,n)=>e.filter(r=>n.includes(r)),D=(e,n,r)=>{const o=e.keys[0];Array.isArray(n)?n.forEach((t,a)=>{r((i,c)=>{a<=e.keys.length-1&&(a===0?Object.assign(i,c):i[e.up(e.keys[a])]=c)},t)}):n&&typeof n=="object"?(Object.keys(n).length>e.keys.length?e.keys:tn(e.keys,Object.keys(n))).forEach(t=>{if(e.keys.indexOf(t)!==-1){const a=n[t];a!==void 0&&r((i,c)=>{o===t?Object.assign(i,c):i[e.up(t)]=c},a)}}):(typeof n=="number"||typeof n=="string")&&r((t,a)=>{Object.assign(t,a)},n)};function k(e){return e?`Level${e}`:""}function R(e){return e.unstable_level>0&&e.container}function ce(e){return function(n){return`var(--Grid-${n}Spacing${k(e.unstable_level)})`}}function H(e){return function(n){return e.unstable_level===0?`var(--Grid-${n}Spacing)`:`var(--Grid-${n}Spacing${k(e.unstable_level-1)})`}}function J(e){return e.unstable_level===0?"var(--Grid-columns)":`var(--Grid-columns${k(e.unstable_level-1)})`}const an=({theme:e,ownerState:n})=>{const r=ce(n),o={};return D(e.breakpoints,n.gridSize,(t,a)=>{let i={};a===!0&&(i={flexBasis:0,flexGrow:1,maxWidth:"100%"}),a==="auto"&&(i={flexBasis:"auto",flexGrow:0,flexShrink:0,maxWidth:"none",width:"auto"}),typeof a=="number"&&(i={flexGrow:0,flexBasis:"auto",width:`calc(100% * ${a} / ${J(n)}${R(n)?` + ${r("column")}`:""})`}),t(o,i)}),o},sn=({theme:e,ownerState:n})=>{const r={};return D(e.breakpoints,n.gridOffset,(o,t)=>{let a={};t==="auto"&&(a={marginLeft:"auto"}),typeof t=="number"&&(a={marginLeft:t===0?"0px":`calc(100% * ${t} / ${J(n)})`}),o(r,a)}),r},ln=({theme:e,ownerState:n})=>{if(!n.container)return{};const r=R(n)?{[`--Grid-columns${k(n.unstable_level)}`]:J(n)}:{"--Grid-columns":12};return D(e.breakpoints,n.columns,(o,t)=>{o(r,{[`--Grid-columns${k(n.unstable_level)}`]:t})}),r},cn=({theme:e,ownerState:n})=>{if(!n.container)return{};const r=H(n),o=R(n)?{[`--Grid-rowSpacing${k(n.unstable_level)}`]:r("row")}:{};return D(e.breakpoints,n.rowSpacing,(t,a)=>{var i;t(o,{[`--Grid-rowSpacing${k(n.unstable_level)}`]:typeof a=="string"?a:(i=e.spacing)==null?void 0:i.call(e,a)})}),o},un=({theme:e,ownerState:n})=>{if(!n.container)return{};const r=H(n),o=R(n)?{[`--Grid-columnSpacing${k(n.unstable_level)}`]:r("column")}:{};return D(e.breakpoints,n.columnSpacing,(t,a)=>{var i;t(o,{[`--Grid-columnSpacing${k(n.unstable_level)}`]:typeof a=="string"?a:(i=e.spacing)==null?void 0:i.call(e,a)})}),o},pn=({theme:e,ownerState:n})=>{if(!n.container)return{};const r={};return D(e.breakpoints,n.direction,(o,t)=>{o(r,{flexDirection:t})}),r},mn=({ownerState:e})=>{const n=ce(e),r=H(e);return m({minWidth:0,boxSizing:"border-box"},e.container&&m({display:"flex",flexWrap:"wrap"},e.wrap&&e.wrap!=="wrap"&&{flexWrap:e.wrap},{margin:`calc(${n("row")} / -2) calc(${n("column")} / -2)`},e.disableEqualOverflow&&{margin:`calc(${n("row")} * -1) 0px 0px calc(${n("column")} * -1)`}),(!e.container||R(e))&&m({padding:`calc(${r("row")} / 2) calc(${r("column")} / 2)`},(e.disableEqualOverflow||e.parentDisableEqualOverflow)&&{padding:`${r("row")} 0px 0px ${r("column")}`}))},dn=e=>{const n=[];return Object.entries(e).forEach(([r,o])=>{o!==!1&&o!==void 0&&n.push(`grid-${r}-${String(o)}`)}),n},fn=(e,n="xs")=>{function r(o){return o===void 0?!1:typeof o=="string"&&!Number.isNaN(Number(o))||typeof o=="number"&&o>0}if(r(e))return[`spacing-${n}-${String(e)}`];if(typeof e=="object"&&!Array.isArray(e)){const o=[];return Object.entries(e).forEach(([t,a])=>{r(a)&&o.push(`spacing-${t}-${String(a)}`)}),o}return[]},yn=e=>e===void 0?[]:typeof e=="object"?Object.entries(e).map(([n,r])=>`direction-${n}-${r}`):[`direction-xs-${String(e)}`],hn=["className","children","columns","container","component","direction","wrap","spacing","rowSpacing","columnSpacing","disableEqualOverflow","unstable_level"],vn=le(),bn=on("div",{name:"MuiGrid",slot:"Root",overridesResolver:(e,n)=>n.root});function gn(e){return Ie({props:e,name:"MuiGrid",defaultTheme:vn})}function xn(e={}){const{createStyledComponent:n=bn,useThemeProps:r=gn,componentName:o="MuiGrid"}=e,t=C.createContext(void 0),a=(l,u)=>{const{container:w,direction:f,spacing:y,wrap:d,gridSize:g}=l,h={root:["root",w&&"container",d!=="wrap"&&`wrap-xs-${String(d)}`,...yn(f),...dn(g),...w?fn(y,u.breakpoints.keys[0]):[]]};return ze(h,S=>Be(o,S),{})},i=n(ln,un,cn,an,pn,mn,sn),c=C.forwardRef(function(l,u){var w,f,y,d,g,h,S,j;const T=qe(),q=r(l),E=Fe(q),p=C.useContext(t),{className:x,children:L,columns:N=12,container:F=!1,component:V="div",direction:v="row",wrap:b="wrap",spacing:$=0,rowSpacing:G=$,columnSpacing:P=$,disableEqualOverflow:W,unstable_level:_=0}=E,me=I(E,hn);let M=W;_&&W!==void 0&&(M=l.disableEqualOverflow);const ee={},ne={},re={};Object.entries(me).forEach(([O,A])=>{T.breakpoints.values[O]!==void 0?ee[O]=A:T.breakpoints.values[O.replace("Offset","")]!==void 0?ne[O.replace("Offset","")]=A:re[O]=A});const de=(w=l.columns)!=null?w:_?void 0:N,fe=(f=l.spacing)!=null?f:_?void 0:$,ye=(y=(d=l.rowSpacing)!=null?d:l.spacing)!=null?y:_?void 0:G,he=(g=(h=l.columnSpacing)!=null?h:l.spacing)!=null?g:_?void 0:P,oe=m({},E,{level:_,columns:de,container:F,direction:v,wrap:b,spacing:fe,rowSpacing:ye,columnSpacing:he,gridSize:ee,gridOffset:ne,disableEqualOverflow:(S=(j=M)!=null?j:p)!=null?S:!1,parentDisableEqualOverflow:p}),ve=a(oe,T);let K=s.jsx(i,m({ref:u,as:V,ownerState:oe,className:Ve(ve.root,x)},re,{children:C.Children.map(L,O=>{if(C.isValidElement(O)&&We(O,["Grid"])){var A;return C.cloneElement(O,{unstable_level:(A=O.props.unstable_level)!=null?A:_+1})}return O})}));return M!==void 0&&M!==(p??!1)&&(K=s.jsx(t.Provider,{value:M,children:K})),K});return c.muiName="Grid",c}const ue=xn({createStyledComponent:Pe("div",{name:"MuiGrid2",slot:"Root",overridesResolver:(e,n)=>n.root}),componentName:"MuiGrid2",useThemeProps:e=>Ke({props:e,name:"MuiGrid2"})});function On({entry:e,payload:n}){const r=U(f=>{var y,d,g;return(g=(d=(y=f.payload)==null?void 0:y.data)==null?void 0:d.reduce)==null?void 0:g.call(d,(h,S)=>h+S.value,0)},[]),o=U(f=>{const y=new X(r(f)||0),d=n?.reduce((S,j)=>S+r(j),0)||0,g=new X(d),h=Number(y.div(g).times(100).toFixed(2,X.ROUND_DOWN));return isNaN(h)||!isFinite(h)?0:h},[r,n]),t=te(()=>r(e),[e,r]),a=ie(t),i=te(()=>Number(o(e)),[e,o]),c=ie(i),l=U(f=>Math.floor(f).toLocaleString(),[]),u=Ae({type:"text/plain"}),w=Ue();return s.jsxs(Ce,{component:"li",direction:"row",spacing:1,sx:{color:e.color},layout:"position",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},children:[s.jsx(ae,{sx:{width:"3px",height:"100%",backgroundColor:e.color,borderRadius:3}}),s.jsxs(Z,{children:[s.jsxs(Q,{component:"p",variant:"caption",children:[s.jsx(Z,{component:"span",display:"inline-flex",mr:.5,children:s.jsx(se,{from:a??0,to:t,map:l,children:"0"})}),s.jsxs(Z,{component:"span",direction:"row",display:"inline-flex",children:["(",s.jsx(se,{from:c??0,to:i,map:l,children:"0"}),"%)"]})]}),s.jsx(Q,{variant:"body1",children:e.value}),e.payload.uuid&&s.jsxs(Q,{variant:"body2",sx:{cursor:"pointer","&:hover":{textDecoration:"underline"}},onClick:()=>{u.copy(e.payload.uuid).catch(()=>{}),w.enqueueSnackbar("UUID copied to clipboard","success")},children:[e.payload.uuid.slice(0,5),"..."]})]})]})}function pe(e){const{payload:n}=e;return s.jsx(ue,{container:!0,direction:"row",component:"ul",gap:2,sx:{mt:2,justifyContent:"flex-start",alignItem:"center",flexWrap:"wrap"},children:s.jsx(Ge,{children:n?.map(r=>s.jsx(ue,{children:s.jsx(On,{entry:r,payload:n})},`item-${r.value}`))})})}function wn(e){const n=ge();return s.jsx(ae,{sx:{width:"100%",height:"100%",...e.sx},children:s.jsx(xe,{children:s.jsxs(Oe,{width:500,height:300,margin:{top:5,right:60,left:20,bottom:5},children:[s.jsx(we,{vertical:!1}),s.jsx(Se,{dataKey:"date",type:"number",domain:["dataMin","dataMax"],tickFormatter:r=>_e(r,{timeZone:e.filter.timezone,hour12:!1,hour:"numeric"}),allowDuplicatedCategory:!1,tickLine:!1,fontSize:12,tickMargin:12}),s.jsx(je,{textAnchor:"end",dataKey:"value",tickLine:!1,tickFormatter:r=>Number(r).toLocaleString(),allowDecimals:!1,domain:[1,"dataMax"],children:e.label&&s.jsx($e,{value:e.label,angle:-90,position:"insideLeft",style:{textAnchor:"middle"}})}),s.jsx(ke,{cursor:{stroke:n.palette.neutral.main,strokeWidth:1},formatter:r=>Number(r).toLocaleString(),labelFormatter:r=>Ee(r,{timeZone:e.filter.timezone,hour12:!1})}),s.jsx(Te,{content:s.jsx(pe,{})}),e.data.map(r=>be(Ne,{uuid:r.uuid,key:r.uuid,name:r.name,dataKey:"value",data:r.chartData,type:"monotone",stroke:r.color,strokeWidth:2}))]})})})}export{wn as SeriesChart,pe as SeriesChartLegend};
|