@carto/meridian-ds 0.1.1-alpha.3 → 0.1.1-alpha.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.
- package/dist/{Alert-DyuvFDkP.cjs → Alert-CT76xuh3.cjs} +1 -1
- package/dist/{Alert-_PI5QbXW.js → Alert-CU0-7Oca.js} +1 -1
- package/dist/{TablePaginationActions-B7ycFqaM.cjs → TablePaginationActions-5u10SobX.cjs} +4 -4
- package/dist/{TablePaginationActions-OJyfVTms.js → TablePaginationActions-C9YCSB32.js} +48 -49
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.js +326 -323
- package/dist/theme/index.cjs +1 -1
- package/dist/theme/index.js +1 -1
- package/dist/types/components/atoms/Button.d.ts +4 -1
- package/dist/types/components/atoms/Button.d.ts.map +1 -1
- package/dist/types/components/atoms/SelectField.d.ts +1 -1
- package/dist/types/components/atoms/SelectField.d.ts.map +1 -1
- package/dist/types/components/molecules/Autocomplete.d.ts +3 -3
- package/dist/types/components/molecules/Autocomplete.d.ts.map +1 -1
- package/dist/types/components/molecules/MultipleSelectField/MultipleSelectField.d.ts +4 -4
- package/dist/types/components/molecules/MultipleSelectField/MultipleSelectField.d.ts.map +1 -1
- package/dist/types/components/molecules/MultipleSelectField/useMultipleSelectField.d.ts +1 -1
- package/dist/types/components/molecules/Table/TablePaginationActions.d.ts.map +1 -1
- package/dist/types/theme/types.d.ts +6 -0
- package/dist/types/theme/types.d.ts.map +1 -1
- package/dist/types/widgets/WrapperWidgetUI.d.ts +9 -3
- package/dist/types/widgets/WrapperWidgetUI.d.ts.map +1 -1
- package/dist/widgets/index.cjs +2 -2
- package/dist/widgets/index.js +38 -38
- package/package.json +1 -1
package/dist/widgets/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),u=require("react"),o=require("@mui/material"),X=require("react-intl"),j=require("../TablePaginationActions-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),u=require("react"),o=require("@mui/material"),X=require("react-intl"),j=require("../TablePaginationActions-5u10SobX.cjs"),yn=require("echarts-for-react"),Ne=require("../search-icon-CyudR_26.cjs"),fe=require("@mui/icons-material"),Te=require("../paletteUtils-DLQVT9qo.cjs"),Bt=require("@mui/material/styles"),vn=require("@mui/icons-material/KeyboardArrowDown"),jn=require("@mui/icons-material/Close"),wn=require("@mui/icons-material/LayersOutlined"),bn=require("@mui/icons-material/VisibilityOutlined"),Sn=require("@mui/icons-material/VisibilityOffOutlined"),In=require("@mui/icons-material/ExpandMore"),kn=require("@mui/icons-material/ExpandLess"),Tn=require("../Alert-CT76xuh3.cjs");function Pt(){let e=!1;return window.PointerEvent&&"maxTouchPoints"in navigator?navigator.maxTouchPoints>0&&(e=!0):(window.matchMedia&&window.matchMedia("(any-pointer:coarse)").matches||window.TouchEvent||"ontouchstart"in window)&&(e=!0),e}function te(e){return!e||typeof e!="object"?e:`${e.prefix??""}${e.value}${e.suffix??""}`}const Mn=[],Cn={},st=e=>e;function An(e,n){if(!e||Array.isArray(e)&&e.length===0)return null;const r=Array.isArray(e)?e:[e];let i="";return i+=String(r[0].axisValueLabel),i+=r.map(({seriesName:s,value:l,data:a,marker:p})=>{const c=s?s+": ":"",g=te(n(Number(l))),h=a,d=`<div style="margin-left: 8px; display: inline">
|
|
2
2
|
${c}${g}${String((h==null?void 0:h.unit)||"")}
|
|
3
3
|
</div>`;return`<div style="margin-top: 4px">${String(p)}${d}</div>`}).join(" "),i}function En({height:e,labels:n=Cn,yAxisData:r,selectedBars:i=Mn,series:s,colors:l,tooltip:a=!0,tooltipFormatter:p=An,xAxisFormatter:c=st,yAxisFormatter:g=st,onSelectedBarsChange:h,animation:d=!0,filterable:v=!0,stacked:f=!0,...y}){const m=o.useTheme(),x=u.useMemo(()=>(s??[]).map(I=>n[I]??I),[s,n]),S=u.useMemo(()=>Array.isArray(r[0])?r:[r],[r]),b=u.useMemo(()=>typeof l=="string"?[l]:Array.isArray(l)&&l.length?l:S.length<=1||x.length===1?[m.palette.secondary.main]:S.length===2||x.length===2?[m.palette.secondary.light,m.palette.secondary.dark]:Object.values(m.palette.qualitative.bold||{}),[l,m,S,x]);return{...y,tooltip:a,tooltipFormatter:p,xAxisFormatter:c,yAxisFormatter:g,onSelectedBarsChange:h,animation:d,filterable:v,stacked:f,labels:n,height:e??parseInt(m.spacing(22)),selectedBars:Bn(i),yAxisData:S,colors:b,series:x}}function Bn(e){return(e??[]).length?e.map(n=>Array.isArray(n)&&n.length===2?n:Array.isArray(n)?[...Array(2)].map((i,s)=>n[s]??0):[n,0]):[]}var Pn=function e(n,r){if(n===r)return!0;if(n&&r&&typeof n=="object"&&typeof r=="object"){if(n.constructor!==r.constructor)return!1;var i,s,l;if(Array.isArray(n)){if(i=n.length,i!=r.length)return!1;for(s=i;s--!==0;)if(!e(n[s],r[s]))return!1;return!0}if(n.constructor===RegExp)return n.source===r.source&&n.flags===r.flags;if(n.valueOf!==Object.prototype.valueOf)return n.valueOf()===r.valueOf();if(n.toString!==Object.prototype.toString)return n.toString()===r.toString();if(l=Object.keys(n),i=l.length,i!==Object.keys(r).length)return!1;for(s=i;s--!==0;)if(!Object.prototype.hasOwnProperty.call(r,l[s]))return!1;for(s=i;s--!==0;){var a=l[s];if(!e(n[a],r[a]))return!1}return!0}return n!==n&&r!==r};const xe=j.getDefaultExportFromCjs(Pn);class ye extends yn{componentDidUpdate(n){const{shouldSetOption:r}=this.props;if(typeof r=="function"&&!r(n,this.props))return;if(!xe(n.theme,this.props.theme)||!xe(n.opts,this.props.opts)){this.dispose(),this.renderNewEcharts();return}const i=this.getEchartsInstance();xe(n.onEvents,this.props.onEvents)||(this.offEvents(i,n.onEvents),this.bindEvents(i,this.props.onEvents));const s=["option","notMerge","lazyUpdate","showLoading","loadingOption"];xe(lt(this.props,s),lt(n,s))||this.updateEChartsOption(),(!xe(n.style,this.props.style)||!xe(n.className,this.props.className))&&this.resize()}updateEChartsOption(){const n=this.props.option,r=this.props.loadingOption||null,{lazyUpdate:i,showLoading:s}=this.props,l=this.getEchartsInstance();return l.setOption(n,{replaceMerge:["series"],lazyUpdate:i}),s?l.showLoading(r):l.hideLoading(),l}offEvents(n,r){if(r)for(const i in r)typeof i=="string"&&n.off(i)}}function lt(e,n){const r={};return n.forEach(i=>{r[i]=e[i]}),r}const _e=240,Lt=o.styled(o.Box)(({theme:e})=>({display:"flex",alignItems:"flex-end",justifyContent:"space-between",position:"relative",padding:e.spacing(0,2),"&::before":{content:'""',position:"absolute",top:0,right:0,left:0,bottom:0,backgroundSize:e.spacing(4,4),backgroundImage:`linear-gradient(to bottom, ${e.palette.grey[50]} 1px, transparent 1px)`,transform:"scaleY(-1)"}})),Dt=o.styled(o.Box)(({theme:e})=>({display:"flex",alignItems:"flex-end",justifyContent:"space-between",backgroundImage:`linear-gradient(${e.palette.grey[50]} 0.5px, transparent 0.5px, transparent calc(100% - 0.5px), ${e.palette.grey[50]} calc(100% - 0.5px)), linear-gradient(90deg, ${e.palette.grey[50]} 0.5px, transparent 0.5px, transparent calc(100% - 0.5px), ${e.palette.grey[50]} calc(100% - 0.5px))`,backgroundSize:"8.33% 20%",border:`0.5px solid ${e.palette.grey[50]}`})),je=o.styled(o.Skeleton)(({theme:e})=>({flex:1,maxWidth:e.spacing(12),"& + &":{marginLeft:e.spacing(1)}})),ne=o.styled(o.Skeleton)(({theme:e})=>({flex:1,maxWidth:e.spacing(8),"& + &":{marginLeft:"1px"}})),Ln=o.styled(o.Skeleton)(({theme:e})=>({backgroundColor:e.palette.common.white})),at=o.styled(o.Skeleton)(({theme:e})=>({backgroundColor:e.palette.grey[100]}));function Dn({height:e}){return t.jsxs(t.Fragment,{children:[t.jsx(o.Box,{mb:2,children:t.jsx(o.Skeleton,{width:48,height:8})}),t.jsxs(Lt,{style:{height:e||_e},children:[t.jsx(je,{variant:"rectangular",height:"20%"}),t.jsx(je,{variant:"rectangular",height:"40%"}),t.jsx(je,{variant:"rectangular",height:"60%"}),t.jsx(je,{variant:"rectangular",height:"20%"}),t.jsx(je,{variant:"rectangular",height:"80%"})]})]})}function ce(e){const[n,r]=u.useState(!1),[i,s]=u.useState(!1);return u.useEffect(()=>{e&&!i&&(r(!0),s(!0)),e||r(!1)},[e,i]),{showSkeleton:n}}const Nn=Pt(),$n=o.styled(o.Grid)(({theme:e})=>({marginBottom:e.spacing(2),flexDirection:"row",justifyContent:"space-between",alignItems:"center","& .MuiTypography-caption":{color:e.palette.text.secondary}})),On=o.styled(o.Link)(({theme:e})=>({...e.typography.caption,cursor:"pointer"}));function Rn(e){const{yAxisData:n,xAxisData:r,series:i,selectedBars:s,onSelectedBarsChange:l,tooltip:a,tooltipFormatter:p,labels:c,colors:g,xAxisFormatter:h,yAxisFormatter:d,stacked:v,height:f,filterable:y,animation:m,isLoading:x}=En(e),S=i.length>1,b=o.useTheme(),I=X.useIntl(),k=j.useImperativeIntl(I),{showSkeleton:w}=ce(!!x),C=u.useMemo(()=>({show:a,trigger:"axis",padding:[parseInt(b.spacing(.5)),parseInt(b.spacing(1))],borderWidth:0,textStyle:{...b.typography.caption,fontSize:11,color:b.palette.common.white},backgroundColor:b.palette.black[90],position:function(M,$,G,R,H){const U={top:0};return H.contentSize[0]<H.viewSize[0]-M[0]?U.left=M[0]:U.right=H.viewSize[0]-M[0],U},formatter:M=>p(M,d)}),[b,a,p,d]),A=u.useMemo(()=>r.map(M=>te(h(c[M]??String(M)))),[r,c,h]),D=u.useMemo(()=>({type:"category",axisLine:{show:!1},axisTick:{show:!1},axisLabel:{...b.typography.overlineDelicate,padding:[parseInt(b.spacing(.5)),0,0,0]},data:A}),[b,A]),B=u.useMemo(()=>{let M=[];return v?M=n.reduce(($,G)=>(G.forEach((R,H)=>$[H]=($[H]??0)+(R??Number.MIN_SAFE_INTEGER)),$),[]):M=n.flat().map($=>$??Number.MIN_SAFE_INTEGER),Math.max(...M)},[n,v]),P=u.useMemo(()=>({type:"value",axisLabel:{margin:0,verticalAlign:"bottom",padding:[0,0,parseInt(b.spacing(1.25)),0],show:!0,showMaxLabel:!0,showMinLabel:!1,inside:!0,color:M=>M>=B?b.palette.black[60]:"transparent",...b.typography.overlineDelicate,formatter:M=>te(d(M))},axisLine:{show:!1},axisTick:{show:!1},splitLine:{show:!0,onZero:!1,lineStyle:{color:b.palette.black[4]}}}),[b,B,d]),L=u.useMemo(()=>n.map((M,$)=>({type:"bar",name:i[$]??"",animation:m,barMaxWidth:100,data:M.map((G,R)=>{const H=s.some(([F,z=0])=>F===R&&z===$),U=!!s.length&&!H;return{value:G,...U&&{itemStyle:{color:b.palette.black[25]},disabled:!0}}}),...v&&{stack:"total"},...!Nn&&{emphasis:{focus:"series",itemStyle:{color:o.darken(g[$]??"#000",.25)}}}})),[m,g,i,n,s,v,b]),N=u.useMemo(()=>({grid:{left:A.length>=4?ct(String(A[0]),A.length):0,top:parseInt(b.spacing(2)),right:A.length>=4?ct(String(A[A.length-1]),A.length):0,bottom:0,containLabel:!0},axisPointer:{lineStyle:{color:b.palette.black[40]}},color:g,tooltip:C,xAxis:D,yAxis:P,series:L}),[A,b,g,C,D,P,L]),V=()=>{l&&l([],[])},_=M=>{M.key==="Enter"&&V()},T=u.useCallback(M=>{if(l){const $=[...s],{dataIndex:G,componentIndex:R}=M,H=$.findIndex(([F,z=0])=>G===F&&R===z);H===-1?$.push([G,R]):$.splice(H,1);const U=$.map(([F,z=0])=>({xAxis:r[F],serie:i[z],yAxis:n[z][F]}));l(S?$:$.map(F=>F[0]),U)}},[n,l,s,r,i,S]),O=u.useMemo(()=>y?{click:T}:{},[y,T]);return w?t.jsx(Dn,{height:f}):t.jsxs("div",{children:[l&&t.jsxs($n,{container:!0,children:[t.jsx(j.Typography,{variant:"caption",children:s.length>0?k.formatMessage({id:"c4r.widgets.bar.selectedItems"},{items:s.length}):k.formatMessage({id:"c4r.widgets.bar.all"})}),s&&s.length>0&&t.jsx(On,{onClick:()=>V(),onKeyDown:_,underline:"hover",tabIndex:0,children:k.formatMessage({id:"c4r.widgets.bar.clear"})})]}),!!N&&t.jsx(ye,{option:N,lazyUpdate:!0,notMerge:!0,onEvents:O,style:{height:f}})]})}function ct(e="",n=0){return n<=15&&e.length<=8?0:e.length*8.5/6}const ue="__rest__",me="Others";var pe=(e=>(e.RANKING="ranking",e.FIXED="fixed",e))(pe||{});const Nt=o.styled(o.Grid)(({theme:e})=>({maxHeight:e.spacing(40),overflow:"auto",padding:0})),$t=o.styled(o.Grid,{shouldForwardProp:e=>e!=="selectable"&&e!=="name"&&e!=="unselected"})(({theme:e,selectable:n,name:r,unselected:i})=>({flexDirection:"row",maxWidth:"100%",padding:e.spacing(.5,.25),margin:0,"> .MuiGrid-item":{paddingTop:0,paddingLeft:0},"&:focus-visible":{outline:"none !important",boxShadow:`inset 0 0 0 2px ${e.palette.primary.main} !important`},...i&&{color:e.palette.text.disabled,".progressbar div":{backgroundColor:e.palette.text.disabled}},...r!==ue&&n&&{cursor:"pointer",flexWrap:"nowrap","&:hover .progressbar div":{backgroundColor:e.palette.secondary.dark}},...r===ue&&{cursor:"default",".progressbar div":{backgroundColor:e.palette.text.disabled}}})),dt=o.styled(o.Grid)(({theme:{spacing:e,palette:n}})=>({flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:e(1.5),paddingRight:e(1),"& .MuiTypography-caption":{color:n.text.secondary}})),Fn=o.styled(o.Grid)(({theme:e})=>({height:e.spacing(.5),width:"100%",margin:e.spacing(.5,0,.25,0),borderRadius:e.spacing(.5),backgroundColor:e.palette.action.disabledBackground,"& div":{width:0,height:"100%",borderRadius:e.spacing(.5),backgroundColor:e.palette.secondary.main,transition:`background-color ${e.transitions.easing.sharp} ${e.transitions.duration.shortest}ms,
|
|
4
4
|
width ${e.transitions.easing.sharp} ${e.transitions.duration.complex}ms`}})),Wn=o.styled(o.Grid,{shouldForwardProp:e=>e!=="isSelectable"})(({theme:e,isSelectable:n})=>({...n&&{width:`calc(100% - ${e.spacing(4)})`}})),_n=o.styled(j.Typography)(({theme:e})=>({fontWeight:e.typography.fontWeightBold,marginRight:e.spacing(2)})),Ce=o.styled(o.Link)(({theme:e})=>({...e.typography.caption,cursor:"pointer","& + hr":{margin:e.spacing(0,1)}})),Gn=o.styled(o.Box)(({theme:e})=>({...e.typography.body2})),ut=o.styled(o.Button)(({theme:e})=>({position:"absolute",left:"-999px",top:"-1px",width:"1px",height:"1px",display:"inline-flex","&:focus-visible":{position:"static",width:"auto",height:"auto",marginTop:e.spacing(2)}})),Hn=o.styled(o.Skeleton)(({theme:e})=>({marginTop:e.spacing(1.25),marginBottom:e.spacing(1.75)})),zn=e=>e%2===1,Ot=()=>t.jsxs(t.Fragment,{children:[t.jsx(o.Skeleton,{width:48,height:8}),t.jsx(Nt,{container:!0,mt:3,children:[...Array(6)].map((e,n)=>t.jsxs($t,{container:!0,spacing:1,children:[t.jsxs(o.Grid,{container:!0,item:!0,direction:"row",justifyContent:"space-between",children:[t.jsx(o.Skeleton,{width:zn(n)?72:48,height:8}),t.jsx(o.Skeleton,{width:48,height:8})]}),t.jsx(Hn,{height:4,width:"100%"})]},n))})]});function Rt(e){const n=u.useRef();return u.useEffect(()=>{n.current=e}),n.current}function Ke({start:e,end:n,duration:r,drawFrame:i,requestRef:s}){if(e===n&&!(e===0&&n===0))return;const a=n-e;let p=e;const c=a/(r/1e3*60),g=()=>{p+=c,i(Math.floor(p)),c>0&&p<n||c<0&&p>n?s.current=requestAnimationFrame(g):i(n)};s.current=requestAnimationFrame(g)}function Yn({start:e,end:n,duration:r,drawFrame:i,requestRef:s}){if(e.length===n.length&&e.every((f,y)=>f.value===n[y].value))return;let a=n.map((f,y)=>e[y]&&e[y].name===f.name?{...f,value:e[y].value}:f),p=0;const c=a.map((f,y)=>n[y].value-f.value);if(c.every(f=>f===0)){i(n);return}const h=r/1e3*60,d=c.map(f=>f/h),v=()=>{p<h?(a=a.map((f,y)=>{const m=Math.floor(f.value+d[y]),x=y>0&&Math.floor(f.value+d[y-1]);return{...f,value:m===x?n[y].value:m}}),i(a),p++,s.current=requestAnimationFrame(v)):i(n)};s.current=requestAnimationFrame(v)}const Vn=[],Un={},qn=e=>e,Ve=()=>{};function Kn({data:e,formatter:n=qn,labels:r=Un,maxItems:i=5,order:s=pe.RANKING,selectedCategories:l=Vn,onSelectedCategoriesChange:a=Ve,animation:p=!0,filterable:c=!0,searchable:g=!0,isLoading:h}){const[d,v]=u.useState([]),[f,y]=u.useState(1),[m,x]=u.useState(!1),[S,b]=u.useState(""),[I,k]=u.useState([]),[w,C]=u.useState([]),[A,D]=u.useState([]),B=u.useRef(null),P=u.useRef(),L=Rt(A),N=u.useRef([]),{showSkeleton:V}=ce(!!h),_=X.useIntl(),T=j.useImperativeIntl(_);function O(E){return d.reduce((Y,K)=>(E.includes(K.name)&&Y.push(K.name),Y),[])}function M(E){if(E!==ue){let Y;l.includes(E)?Y=l.filter(K=>K!==E):Y=[...l,E],a&&a(Y)}}const $=()=>a([]),G=E=>{E.key==="Enter"&&$()},R=()=>{a([]),k([])},H=E=>{E.key==="Enter"&&R()},U=()=>{k(O(l))},F=E=>{E.key==="Enter"&&U()},z=()=>{const E=O(w);a([...E]),k([...E]),C([]),x(!1),b("")},Q=E=>{E.key==="Enter"&&z()},de=()=>{b(""),x(!1)},re=E=>{if(E!==ue){let Y;w.includes(E)?Y=w.filter(K=>K!==E):Y=[...w,E],C(Y)}},W=E=>{E.currentTarget.scrollIntoView()},q=E=>{b(E.currentTarget.value)},Z=()=>{x(!0),C([...l])},J=u.useCallback(E=>{if(m)return S?E.filter(Y=>{var ee;if(!Y.name)return!1;const K=String(Y.name);return!!(K.toLowerCase().includes(S.toLowerCase())||(ee=r[K])!=null&&ee.toLowerCase().includes(S.toLowerCase()))}):E;if(I.length)return I.reduce((K,ee)=>{const ge=E.find(se=>se.name===ee);return K.push({name:ee,value:ge?ge.value:null}),K},[]);{const Y=E.slice(0,i);if(Y.length<E.length){const K=E.slice(i).reduce((ee,ge)=>(ge.value!==null&&ee.value!==null&&(ee.value+=ge.value),ee),{name:ue,value:0});return[...Y,K]}else return Y}},[I,r,i,S,m]),ie=u.useCallback(()=>{const E=I.length;return E?e.length-E:e.length-i},[e,i,I]),Me=u.useCallback(E=>E===ue?`Others ${g?"":`(${ie()})`}`:r[String(E)]??String(E),[ie,r,g]),ve=u.useCallback(E=>E>=f?E!=null?"100%":0:`${(E||0)*100/f}%`,[f]);u.useEffect(()=>{l.length===0&&k([])},[l]),u.useEffect(()=>{if(e){if(s===pe.RANKING){const E=[...e].sort((K,ee)=>(ee.value??0)-(K.value??0)),Y=J(E);Y.length>0?y(Y[0].value??0):y(1),v(Y)}else if(s===pe.FIXED){y(Math.max(...e.map(Y=>Y.value??0)));const E=J(e);v(E)}}},[I,J,e,r,i,s,S,m]),u.useEffect(()=>{L&&(N.current=L)},[L]),u.useEffect(()=>{if(p)return Yn({start:(N.current||[]).map(E=>({...E,value:E.value??0})),end:d.map(E=>({...E,value:E.value??0})),duration:500,drawFrame:E=>D(E),requestRef:B}),()=>{B.current&&cancelAnimationFrame(B.current)};D(d)},[p,d]),u.useEffect(()=>{m&&P.current&&P.current.focus()},[m,P]);function fn({data:E,onCategoryClick:Y}){const K=n(E.value??0),[ee,ge]=u.useState(!1),se=u.useRef(null),ze=()=>{var rt,it;const Ye=(((rt=se==null?void 0:se.current)==null?void 0:rt.scrollWidth)??0)>(((it=se==null?void 0:se.current)==null?void 0:it.clientWidth)??0);ge(Ye)};u.useEffect(()=>(ze(),window.addEventListener("resize",ze),()=>{window.removeEventListener("resize",ze)}),[]);const xn=Ye=>{Ye.key==="Enter"&&Y()},mn=!m&&l.length>0&&!l.includes(E.name);return t.jsxs($t,{container:!0,direction:"row",spacing:1,onClick:c?Y:Ve,onKeyDown:c?xn:Ve,selectable:c,unselected:mn,name:E.name===ue?ue:"",tabIndex:c?0:-1,children:[c&&m&&t.jsx(o.Grid,{item:!0,mr:1,children:t.jsx(o.Checkbox,{checked:w.includes(E.name),tabIndex:-1})}),t.jsxs(Wn,{container:!0,item:!0,xs:!0,isSelectable:m,children:[t.jsxs(o.Grid,{container:!0,item:!0,direction:"row",justifyContent:"space-between",wrap:"nowrap",children:[t.jsx(o.Tooltip,{title:Me(E.name),disableHoverListener:!ee,children:t.jsx(_n,{variant:"body2",noWrap:!0,ref:se,children:Me(E.name)})}),typeof K=="object"&&K!==null?t.jsxs("span",{children:[K.prefix,K.value,K.suffix]}):t.jsx("span",{children:K})]}),t.jsx(Fn,{className:"progressbar",item:!0,children:t.jsx("div",{style:{width:ve(E.value??0)}})})]})]})}return(e==null?void 0:e.length)===0||V?t.jsx(Ot,{}):t.jsxs(Gn,{children:[c&&d.length>0&&t.jsxs(dt,{container:!0,children:[t.jsx(j.Typography,{variant:"caption",children:l.length>0?T.formatMessage({id:"c4r.widgets.category.selectedItems"},{items:l.length}):T.formatMessage({id:"c4r.widgets.category.all"})}),m?t.jsx(Ce,{onClick:z,onKeyDown:Q,underline:"hover",tabIndex:0,"data-testid":"primaryApplyButton",children:T.formatMessage({id:"c4r.widgets.category.apply"})}):I.length>0?t.jsx(Ce,{onClick:R,onKeyDown:H,underline:"hover",tabIndex:0,children:T.formatMessage({id:"c4r.widgets.category.unlock"})}):l.length>0&&t.jsxs(o.Grid,{container:!0,direction:"row",justifyContent:"flex-end",item:!0,xs:!0,children:[t.jsx(Ce,{onClick:U,onKeyDown:F,underline:"hover",tabIndex:0,children:T.formatMessage({id:"c4r.widgets.category.lock"})}),t.jsx(o.Divider,{orientation:"vertical",flexItem:!0}),t.jsx(Ce,{onClick:$,onKeyDown:G,underline:"hover",tabIndex:0,children:T.formatMessage({id:"c4r.widgets.category.clear"})})]})]}),e.length>i&&m&&t.jsxs(dt,{container:!0,children:[t.jsx(o.TextField,{size:"small",sx:{mt:-.5},placeholder:T.formatMessage({id:"c4r.widgets.category.search"}),onChange:q,onFocus:W,InputProps:{startAdornment:t.jsx(o.InputAdornment,{position:"start",children:t.jsx(Ne.SearchIcon,{})})},inputProps:{tabIndex:0,ref:P}}),t.jsx(ut,{size:"small",onClick:de,children:T.formatMessage({id:"c4r.widgets.category.cancel"})})]}),t.jsx(Nt,{container:!0,item:!0,children:A.length?A.map((E,Y)=>t.jsx(fn,{data:E,onCategoryClick:()=>m?re(E.name):M(E.name)},Y)):t.jsxs(o.Box,{children:[t.jsx(j.Typography,{variant:"body2",children:T.formatMessage({id:"c4r.widgets.category.noResults"})}),t.jsx(j.Typography,{component:"p",variant:"caption",mb:2,children:T.formatMessage({id:"c4r.widgets.category.noResultsMessage"},{searchValue:S})})]})}),m&&t.jsx(ut,{size:"small",onClick:z,children:T.formatMessage({id:"c4r.widgets.category.apply"})}),e.length>i&&g?m?t.jsx(o.Box,{mt:1.5,children:t.jsx(o.Button,{size:"small",color:"primary",onClick:de,"data-testid":"primaryCancelButton",children:T.formatMessage({id:"c4r.widgets.category.cancel"})})}):t.jsx(o.Box,{mt:1.5,children:t.jsx(o.Button,{size:"small",color:"primary",startIcon:t.jsx(Ne.SearchIcon,{}),onClick:Z,children:T.formatMessage({id:"c4r.widgets.category.searchInfo"},{elements:ie()})})}):null]})}const Ft=()=>t.jsx(o.Box,{pt:.5,children:t.jsx(o.Skeleton,{height:24,width:120})}),Zn=o.styled("span")(()=>({marginRight:"2px"})),Xn=o.styled("span")(()=>({marginLeft:"2px"})),Ae="-",Jn=e=>e;function Qn({data:e=Ae,formatter:n=Jn,animation:r=!0,isLoading:i=!1}){const[s,l]=u.useState(Ae),a=u.useRef(null),p=Rt(s),c=u.useRef(p),{showSkeleton:g}=ce(!!i);u.useEffect(()=>(typeof e=="number"&&r?Ke({start:c.current||0,end:e,duration:500,drawFrame:f=>l(f),requestRef:a}):typeof e=="object"&&r&&e&&c.current&&e.value!==null&&e.value!==void 0?Ke({start:Number(c.current.value),end:Number(e.value),duration:1e3,drawFrame:f=>l({value:f,prefix:e.prefix,suffix:e.suffix}),requestRef:a}):l(e??Ae),()=>{a.current&&cancelAnimationFrame(a.current)}),[r,e,l]);const h=n(s),d=typeof h=="object"&&h!==null,v=h===Ae;return g?t.jsx(Ft,{}):d?t.jsxs(j.Typography,{variant:"h5",component:"div",weight:"medium",children:[t.jsx(Zn,{children:h.prefix}),h.value,t.jsx(Xn,{children:h.suffix})]}):t.jsx(j.Typography,{variant:"h5",component:"div",weight:"medium",color:v?"text.disabled":"default",whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden",children:h})}const pt={};let we=null;function eo({data:e,filterable:n,selectedBars:r,onSelectedBarsChange:i,echartsInstance:s}){const l=o.useTheme(),[a,p]=u.useState([]),c=u.useMemo(()=>s==null?void 0:s.getZr(),[s]);u.useEffect(()=>{function h(v){if(s){const[f]=s.convertFromPixel({seriesIndex:0},[v.offsetX,v.offsetY]);we=f??null}}function d(v){if(s&&we!==null){const[f]=s.convertFromPixel({seriesIndex:0},[v.offsetX,v.offsetY]);p(we===f?[]:[we,f].sort((y,m)=>y-m))}}if(s&&n){const v=Ue(c,"mousedown",h),f=Ue(c,"mousemove",d);return()=>{v==null||v(),f==null||f()}}},[c,s,n]),u.useEffect(()=>{function h(){if(a.length===2&&i){const d=e.reduce((v,f,y)=>((a[0]>=f[0]&&a[0]<=f[1]||a[1]>=f[0]&&a[1]<=f[1]||a[0]<=f[0]&&a[1]>=f[1])&&v.push(y),v),[]);i(e.length===d.length?[]:d)}p([]),we=null}if(s&&n)return Ue(c,"mouseup",h)},[c,s,a,e,i,n]);const g=u.useCallback(h=>{if(i){const d=new Set(r);d.has(h.dataIndex)?d.delete(h.dataIndex):d.add(h.dataIndex),i(d.size===e.length?[]:Array.from(d))}},[i,r,e.length]);return{markAreaOptions:a.length===2&&{data:[[{coord:[a[0]]},{coord:[a[1]]}]],itemStyle:{color:l.palette.primary.main,opacity:.2}},onEvents:n?{click:g}:{}}}function Ue(e,n,r){if(e!=null&&e.handler)return pt[n]=r,e.on(n,r),()=>{pt[n]&&(e!=null&&e.handler)&&e.off(n,r)}}function to({height:e}){return t.jsxs(t.Fragment,{children:[t.jsx(o.Box,{mb:2,children:t.jsx(o.Skeleton,{width:48,height:8})}),t.jsxs(Dt,{style:{height:e??_e},children:[t.jsx(ne,{variant:"rectangular",height:"20%"}),t.jsx(ne,{variant:"rectangular",height:"40%"}),t.jsx(ne,{variant:"rectangular",height:"60%"}),t.jsx(ne,{variant:"rectangular",height:"20%"}),t.jsx(ne,{variant:"rectangular",height:"80%"}),t.jsx(ne,{variant:"rectangular",height:"50%"}),t.jsx(ne,{variant:"rectangular",height:"20%"}),t.jsx(ne,{variant:"rectangular",height:"40%"}),t.jsx(ne,{variant:"rectangular",height:"60%"}),t.jsx(ne,{variant:"rectangular",height:"20%"}),t.jsx(ne,{variant:"rectangular",height:"80%"}),t.jsx(ne,{variant:"rectangular",height:"50%"})]})]})}const no=Pt(),oo=o.styled(o.Grid)(({theme:e})=>({marginBottom:e.spacing(2),flexDirection:"row",justifyContent:"space-between",alignItems:"center","& .MuiTypography-caption":{color:e.palette.text.secondary}})),ro=o.styled(o.Link)(({theme:e})=>({...e.typography.caption,cursor:"pointer"})),io=[],so=()=>{},$e=e=>e;function lo(e,n=$e,r=$e){if(!e)return null;if(Array.isArray(e)&&e.length===0)return;const i=Array.isArray(e)?e[0].marker:e.marker,s=Array.isArray(e)?e[0].data:e.data;if((s==null?void 0:s.value)===void 0)return;const[l,a,p]=s.value,c=te(n(l)),g=te(n(a)),h=te(r(p)),d=`${c} <span style="vertical-align: 1px;">—</span> ${g}`,v=`<div style="margin-left: 8px; display: inline">${h}</div>`;return`${d} <div style="margin-top: 4px">${String(i)}${v}</div>`}function ao({data:e,ticks:n,min:r,max:i,xAxisFormatter:s=$e,yAxisFormatter:l=$e,yAxisType:a="dense",selectedBars:p=io,onSelectedBarsChange:c=so,tooltip:g=!0,tooltipFormatter:h=lo,animation:d=!0,filterable:v=!0,height:f=200,isLoading:y}){const m=X.useIntl(),x=o.useTheme(),S=j.useImperativeIntl(m),{showSkeleton:b}=ce(!!y),I=!!v&&!!c,[k,w]=u.useState(),C=M=>w(M),A=u.useMemo(()=>po(e,n,r,i),[e,n,r,i]),{onEvents:D,markAreaOptions:B}=eo({data:A,filterable:I,selectedBars:p,onSelectedBarsChange:c,echartsInstance:k}),P=u.useMemo(()=>({show:g,trigger:"item",padding:[j.SPACING*.5,j.SPACING],borderWidth:0,textStyle:{...x.typography.caption,fontSize:11,color:x.palette.common.white},backgroundColor:x.palette.black[90],confine:!0,position:"top",formatter(M){return h(M,s,l)}}),[x,g,h,s,l]),L=u.useMemo(()=>({min:r,max:i,interval:(i-r)/A.length,axisLine:{show:!1},splitLine:{show:!0,lineStyle:{color:x.palette.black[4]}},axisTick:{show:!1},axisLabel:{showMinLabel:!0,showMaxLabel:!0,...x.typography.overlineDelicate,hideOverlap:!0,padding:[j.SPACING*.5,j.SPACING*.5,0,j.SPACING*.5],formatter:M=>{const $=te(s(M));return M===r?co($):M===i?uo($):$},color:x.palette.black[60]}}),[r,i,A.length,x,s]),N=u.useMemo(()=>{const M={margin:0,verticalAlign:"bottom",padding:[0,0,j.SPACING*1.25,0],inside:!0,color:R=>{const H=Math.max(...e.map(F=>F??Number.MIN_SAFE_INTEGER))||1;let U="transparent";return R>=H&&(U=x.palette.black[60]),U},...x.typography.overlineDelicate,formatter:R=>te(l(R))},$={verticalAlign:"middle",padding:[0,0,0,j.SPACING*.5],color:x.palette.black[60]},G=a==="dense"?M:$;return{type:"value",axisLine:{show:!1},splitLine:{show:!0,lineStyle:{color:x.palette.black[4]}},axisTick:{show:!1},axisLabel:{show:!0,showMaxLabel:!0,showMinLabel:!1,...G,...x.typography.overlineDelicate,formatter:R=>te(l(R))}}},[x.palette.black,x.typography.overlineDelicate,e,l,a]),V=u.useMemo(()=>{const M=r===i&&A.filter(R=>R[2]!==0).length===1,G=(M?[A[0],A[A.length-1]]:A).map((R,H)=>{const F=p.length&&!p.includes(H)?x.palette.black[25]:x.palette.secondary.main;return{value:R,itemStyle:{color:F}}});return{type:"custom",cursor:"pointer",markArea:B,renderItem:function(R,H){const U=R.dataIndex===A.length-1,F=R.dataIndex===0,z=G[R.dataIndex].itemStyle.color,Q=H.value(0),de=H.value(1),re=H.value(2),[W,q]=H.coord([Q,re]),[Z,J]=H.size([de-Q,re]);return{type:"rect",shape:{x:M?W/10:W+(F?0:1),y:q,width:M?W-W/10:Z-(U?0:1),height:J},style:{fill:z},...!no&&{emphasis:{style:{fill:o.darken(z,.25)}}}}},encode:{x:[0,1],y:2,tooltip:[0,1,2]},data:G,animation:d}},[r,i,A,B,x.palette.black,x.palette.secondary.main,p,d]),_=u.useMemo(()=>({grid:{left:j.SPACING*.1,right:j.SPACING*.1,top:j.SPACING*2,bottom:j.SPACING*.5,containLabel:!0},tooltip:P,xAxis:L,yAxis:N,series:[V]}),[P,L,N,V]),T=p.reduce((M,$)=>M+=e[$]??0,0),O=M=>{M.key==="Enter"&&c([])};return b?t.jsx(to,{height:f}):t.jsxs("div",{children:[I&&t.jsxs(oo,{container:!0,children:[t.jsx(j.Typography,{variant:"caption",weight:"strong",children:p.length>0?S.formatMessage({id:"c4r.widgets.histogram.selectedItems"},{items:te(l(T))}):S.formatMessage({id:"c4r.widgets.histogram.all"})}),p.length>0&&t.jsx(ro,{onClick:()=>c([]),onKeyDown:O,underline:"hover",tabIndex:0,children:S.formatMessage({id:"c4r.widgets.histogram.clear"})})]}),t.jsx(ye,{option:_,onEvents:D,lazyUpdate:!0,onChartReady:C,style:{maxHeight:f}})]})}function co(e){return`${Array(String(e).length).fill(" ").join("")}${e}`}function uo(e){const n=Array(String(e).length).fill(" ").join("");return`${e}${n}`}function po(e,n,r,i){return e.map((s,l)=>[l===0?r:n[l-1],l===e.length-1?i:n[l],s])}function go(e,n,r,i){const s=o.useTheme(),l=u.useMemo(()=>n===pe.RANKING?e.slice().sort((c,g)=>(g.value??0)-(c.value??0)):e,[e,n]),a=u.useMemo(()=>{const c=[];let g=0;for(const h of l)c.length<r?c.push({...h}):g+=h.value??0;return g>0&&c.push({name:me,value:g,emphasis:{scale:!1}}),c},[r,l]);return u.useMemo(()=>{const c=s.palette.common.white;return a.map((g,h)=>{let d=c;if(i.length){const f=i[h%i.length];f&&(d=f)}else{const y=s.palette.qualitative.bold[h];y&&(d=y)}const v=g;return v.color=d,v})},[a,i,s])}const ho=o.styled(o.Box)(({theme:e})=>({zIndex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",paddingBottom:e.spacing(1)})),fo=o.styled(o.Box)(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1),maxWidth:"140px",textTransform:"uppercase"})),xo=o.styled(o.Box)(({theme:e})=>({display:"inline-block",borderRadius:e.spacing(.5),width:e.spacing(1),minWidth:e.spacing(1),height:e.spacing(1)}));function mo({data:e,selectedCategories:n,formatter:r}){const[i,s]=u.useState(),l=u.useMemo(()=>{if(!e||e.length===0)return null;let g;n.length>0?g=e.filter(y=>n.includes(y.name)):g=e;const h=yo(g),d=g.find(y=>y===h);if(!d)return null;let v=0;for(const y of e)v+=y.value??0;const f=vo(d.value??0,v,r);return{...d,percentage:f}},[e,n,r]);u.useEffect(()=>{l&&s(l)},[l,s]);const{name:a,percentage:p,color:c}=i??{};return i?t.jsxs(ho,{children:[t.jsx(j.Typography,{variant:"h5",children:p}),t.jsxs(fo,{children:[t.jsx(xo,{bgcolor:c,component:"span"}),t.jsx(j.Typography,{component:"span",variant:"body2",noWrap:!0,children:a})]})]}):null}function yo(e){const n=e.filter(r=>r.name!==me);return n.length===0?e[0]:n.reduce((r,i)=>(i.value??0)>(r.value??0)?i:r)}function vo(e,n,r){let i=0;return n!==0&&(i=e/n*100),r?r(i):`${i}%`}const gt=32,jo=o.styled(o.Box)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"center",marginTop:e.spacing(.5)})),wo=o.styled("div")(()=>({display:"flex",alignItems:"center",justifyContent:"center",position:"relative"})),bo=o.styled(Ln)(()=>({position:"absolute",zIndex:1})),So=o.styled("div")(({theme:e})=>({display:"flex",flexDirection:"column",alignItems:"center",gap:e.spacing(1),position:"absolute",zIndex:2})),Io=o.styled(o.Box)(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(2),height:e.spacing(5)})),ko=o.styled("div")(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1.5)}));function Wt({height:e}){const n=parseInt(String(e),10)||_e,r=n-gt,i=r-gt;return t.jsxs(o.Box,{mt:.5,children:[t.jsx(o.Skeleton,{height:8,width:64}),t.jsx(jo,{height:n,children:t.jsxs(wo,{children:[t.jsx(o.Skeleton,{variant:"circular",width:r,height:r}),t.jsx(bo,{variant:"circular",width:i,height:i}),t.jsxs(So,{children:[t.jsx(o.Skeleton,{height:24,width:72}),t.jsx(o.Skeleton,{height:8,width:48})]})]})}),t.jsx(Io,{children:[...Array(2)].map((s,l)=>t.jsxs(ko,{children:[t.jsx(o.Skeleton,{variant:"circular",width:8,height:8}),t.jsx(o.Skeleton,{width:48,height:8})]},l))})]})}const To=o.styled(o.Box)(({theme:e})=>({position:"relative",padding:e.spacing(1.25,1,0,1),width:"100%"})),Mo=o.styled(o.Box)(({theme:e})=>({position:"relative",display:"flex",flexDirection:"row",overflowX:"hidden",gap:e.spacing(2),padding:e.spacing(.5),margin:e.spacing(-.5)})),Co=o.styled(o.Box)(({theme:e})=>({display:"flex",flexDirection:"row",gap:e.spacing(1),alignItems:"center",textOverflow:"ellipsis",whiteSpace:"nowrap",cursor:"pointer"})),Ao=o.styled(o.Box)(({theme:e})=>({display:"inline-block",position:"absolute",left:e.spacing(-2),top:e.spacing(1),bottom:e.spacing(1),zIndex:1,width:e.spacing(2.5),background:`linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, ${e.palette.background.paper} 100%)`})),Eo=o.styled(o.Box)(({theme:e})=>({position:"absolute",padding:e.spacing(.25,1),top:e.spacing(0),right:0,background:e.palette.background.paper})),Bo=o.styled(o.Box,{shouldForwardProp:e=>e!=="color"})(({theme:e,color:n})=>{const r=e.spacing(1);return{backgroundColor:n,borderRadius:"50%",width:r,height:r}});function _t({series:e,selectedCategories:n,onCategoryClick:r}){var I,k;const i=o.useTheme(),[s,l]=u.useState(!1),[a,p]=u.useState(0),[c,g]=u.useState(void 0),h=u.useRef(null),d=u.useRef(null),v=u.useRef(null),f=X.useIntl(),y=j.useImperativeIntl(f);function m(){p(a+1)}function x(){p(Math.max(a-1))}function S(w,C){w.key==="Enter"&&(r==null||r(C))}const b=u.useCallback(()=>{var C,A,D;const w=!!d.current&&d.current.scrollWidth>d.current.clientWidth;l(w),g(w&&d.current?(((C=h.current)==null?void 0:C.clientWidth)??0)-(((A=v.current)==null?void 0:A.clientWidth)??70):(((D=h.current)==null?void 0:D.clientWidth)??0)-12||500)},[h,d,v]);return u.useEffect(()=>{b()},[d,(I=d.current)==null?void 0:I.scrollWidth,(k=d.current)==null?void 0:k.clientWidth,b,a]),u.useEffect(()=>{if(typeof ResizeObserver>"u")return;let w;return h.current&&(w=new ResizeObserver(()=>{b()}),w.observe(h.current)),()=>{w==null||w.disconnect()}},[h,b]),t.jsxs(To,{ref:h,children:[t.jsx(Mo,{ref:d,style:{maxWidth:`${c}px`},children:e.map((w,C)=>{if(C<a)return null;const A=n.length===0||n.includes(w.name);return t.jsxs(Co,{tabIndex:0,onClick:r?()=>r(w.name):void 0,onKeyDown:r?D=>S(D,w.name):void 0,style:{pointerEvents:!r||w.name==="Others"?"none":void 0},children:[t.jsx(Bo,{color:A?w.color:i.palette.text.disabled}),t.jsx(j.Typography,{variant:"overline",color:A?void 0:"text.disabled",children:w.name})]},C)})}),(s||a>0)&&t.jsxs(Eo,{ref:v,children:[t.jsx(Ao,{}),t.jsx(o.Tooltip,{title:y.formatMessage({id:"c4r.widgets.chartLegend.next"}),children:t.jsx(o.IconButton,{size:"small",disabled:a===0,onClick:x,children:t.jsx(fe.ChevronLeft,{})})}),t.jsx(o.Tooltip,{title:y.formatMessage({id:"c4r.widgets.chartLegend.prev"}),children:t.jsx(o.IconButton,{size:"small",disabled:!s,onClick:m,children:t.jsx(fe.ChevronRight,{})})})]})]})}const Ze="232px",Po=o.styled(o.Grid)(({theme:e})=>({flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:e.spacing(.5)})),Lo=o.styled(o.Box,{shouldForwardProp:e=>e!=="height"&&e!=="width"})(({height:e,width:n})=>({position:"relative",margin:"0 auto",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",width:n||"100%",height:e||"100%"})),Do=o.styled(ye)(()=>({position:"absolute",top:0,right:0,left:0,bottom:0})),ht=[],No={},$o=e=>e;function Oo({name:e,data:n,formatter:r=$o,tooltipFormatter:i=Ro,percentFormatter:s,height:l=Ze,width:a=Ze,labels:p=No,colors:c=ht,animation:g=!0,filterable:h=!0,selectedCategories:d=ht,onSelectedCategoriesChange:v,isLoading:f,maxItems:y=11,order:m=pe.RANKING}){const x=o.useTheme(),S=go(n,m,y,c),{showSkeleton:b}=ce(!!f),I=X.useIntl(),k=j.useImperativeIntl(I),w=u.useMemo(()=>s||(_=>`${I.formatNumber(_,{maximumFractionDigits:2,minimumFractionDigits:2})}%`),[I,s]),C=u.useMemo(()=>{let _;return i&&(_=T=>i(T,r,w)),{padding:[j.SPACING*.5,j.SPACING],backgroundColor:x.palette.black[90],borderColor:"transparent",textStyle:{color:x.palette.common.white},confine:!0,formatter:_}},[x.palette.black,x.palette.common.white,i,r,w]),A=u.useMemo(()=>[{type:"pie",name:e,animation:g,data:S.map(_=>{const T={..._},O=(d==null?void 0:d.length)&&!d.includes(T.name);return p!=null&&p[T.name]&&(T.name=p[T.name]),O?{...T,disabled:!0,itemStyle:{color:x.palette.black[25]}}:{...T,itemStyle:{color:T.color}}}),radius:["74%","90%"],selectedOffset:0,bottom:j.SPACING*1.5,label:{show:!1},emphasis:{focus:"series",scaleSize:5},itemStyle:{borderColor:x.palette.background.paper,borderWidth:1}}],[e,g,S,p,d,x]),D=u.useMemo(()=>({grid:{left:0,top:0,right:0,bottom:0},tooltip:C,legend:{show:!1},series:A}),[C,A]),B=u.useCallback(_=>{if(v){const T=[...d],{name:O}=S[_.dataIndex];if(O===me)return;const M=T.indexOf(O);M===-1?T.push(O):T.splice(M,1),v(T)}},[S,v,d]),P=u.useCallback(_=>{if(v){const T=[...d],O=T.indexOf(_);O===-1?T.push(_):T.splice(O,1),v(T)}},[v,d]),L={...h&&{click:B}},N=()=>{v==null||v([])},V=_=>{_.key==="Enter"&&N()};return b?t.jsx(Wt,{height:l}):t.jsxs(t.Fragment,{children:[h&&t.jsxs(Po,{container:!0,children:[t.jsx(j.Typography,{variant:"caption",color:"textSecondary",children:d.length?k.formatMessage({id:"c4r.widgets.pie.selectedItems"},{items:d.length}):k.formatMessage({id:"c4r.widgets.pie.allSelected"})}),d.length>0&&t.jsx(o.Link,{variant:"caption",onClick:N,onKeyDown:V,tabIndex:0,children:k.formatMessage({id:"c4r.widgets.pie.clear"})})]}),t.jsxs(Lo,{height:l,width:a,children:[t.jsx(mo,{data:S,selectedCategories:d,formatter:w}),t.jsx(Do,{option:D,onEvents:L,lazyUpdate:!0,style:{height:l,width:a}})]}),S.length>0&&t.jsx(_t,{series:S,selectedCategories:d,onCategoryClick:v&&P})]})}function Ro(e,n,r){var c;const i=Array.isArray(e)?e[0]:e;if(!i)return null;const s=te(n(i.value)),l=r(i.percent)||`${i.percent}%`,p=`display:inline-block;border-radius:4px;width:8px;height:8px;background-color:${((c=i.data)==null?void 0:c.color)||i.textStyle.color}`;return`
|
|
@@ -30,4 +30,4 @@
|
|
|
30
30
|
<p style="${i}">${a.name}</p>
|
|
31
31
|
<p style="${s}">${String(l.marker)} ${c} (${g} %)</p>
|
|
32
32
|
`.trim()}const Ri=e=>e,Fi=()=>{},Le=[],Wi="260px";function _i({names:e=Le,data:n=Le,labels:r=Le,colors:i=Le,height:s=Wi,animation:l=!0,formatter:a=Ri,tooltipFormatter:p=Oi,selectedCategories:c=[],onCategorySelected:g=Fi,isLoading:h=!1}){const d=o.useTheme(),v=u.useRef(),f=u.useMemo(()=>n.map((S,b)=>$i(S,i[b],r[b],d,c)),[n,i,r,d,c]),y=u.useMemo(()=>{const S=f.length>1;let b;p&&(b=B=>p(B,a,S));const I={trigger:"item",show:!0,backgroundColor:d.palette.black[90],textStyle:{color:d.palette.common.white},confine:!0,borderWidth:0,formatter:b},w={data:S?f.map((B,P)=>e[P]):(f[0]??[]).map(B=>B.name),selectedMode:!1,type:"scroll",left:j.SPACING,bottom:j.SPACING*-.5,itemGap:j.SPACING*3,icon:"circle",itemWidth:j.SPACING,itemHeight:j.SPACING,textStyle:{...d.typography.overline,color:d.palette.text.primary,fontWeight:400,lineHeight:1,verticalAlign:"bottom",padding:[0,0,0,j.SPACING*.5]},inactiveColor:d.palette.text.disabled,pageIcons:{horizontal:["path://M15.41 7.41 14 6 8 12 14 18 15.41 16.59 10.83 12z","path://M9 16.59 13.3265857 12 9 7.41 10.3319838 6 16 12 10.3319838 18z"]},pageIconSize:j.SPACING*1.5,pageIconColor:d.palette.text.secondary,pageIconInactiveColor:d.palette.text.disabled,pageTextStyle:{fontFamily:d.typography.overline.fontFamily,fontSize:j.SPACING*1.5,lineHeight:j.SPACING*1.75,fontWeight:400,color:d.palette.text.primary}},C={formatter:({name:B,percent:P})=>`{per|${a(P)}%}
|
|
33
|
-
{b|${B}}`,position:"center",rich:{b:{fontFamily:d.typography.overline.fontFamily,fontSize:j.SPACING*1.75,lineHeight:j.SPACING*1.75,fontWeight:400,color:d.palette.text.primary},per:{...d.typography.overline,fontSize:j.SPACING*3,lineHeight:j.SPACING*4.5,fontWeight:600,color:d.palette.text.primary}}},A=f.map((B,P)=>{var L;return{type:"pie",name:e[P],itemStyle:{color:(L=B[0])==null?void 0:L.color},animation:l,data:B.map(N=>({...N,itemStyle:{color:N.color}})),radius:P===0?["75%","90%"]:["56%","72%"],selectedOffset:0,hoverOffset:5,bottom:j.SPACING*2.5,avoidLabelOverlap:!0,label:{show:!1,...C},emphasis:{label:{show:!0,formatter:C.formatter,rich:C.rich}}}});return{grid:{left:0,top:0,right:0,bottom:0},tooltip:I,legend:w,series:A}},[d,e,l,f,a,p]),m={mouseover:(S,b)=>{f.length===1&&(S.seriesIndex!==0||S.dataIndex!==0)&&b.dispatchAction({type:"downplay",seriesIndex:0,dataIndex:0})},mouseout:(S,b)=>{f.length===1&&b.dispatchAction({type:"highlight",seriesIndex:0,dataIndex:0})},click:S=>{const I=f[S.seriesIndex][S.dataIndex].key,k=c.includes(I),w=new Set(c);k?w.delete(I):w.add(I);const C=f[0].length;let A=Array.from(w);A.length===C&&(A=[]),g(A)}};u.useEffect(()=>{v.current&&v.current.dispatchAction({type:f.length===1?"highlight":"downplay",seriesIndex:0,dataIndex:0})},[f]);function x(S){v.current=S}return f.length?h?t.jsx(Wt,{height:s}):t.jsx(ye,{onChartReady:x,notMerge:!0,option:y,onEvents:m,style:{maxHeight:s,width:"100%"}}):null}const Gi=()=>{};function on({icon:e,hoverTooltip:n,clickTooltip:r,enabled:i,onEnabledChange:s=Gi,tooltipPlacement:l="bottom"}){const[a,p]=u.useState(!1),[c,g]=u.useState(i);u.useEffect(()=>{g(i)},[i]),u.useEffect(()=>{if(i){const d=v=>{v.key==="Escape"&&s&&s(!1)};return window.addEventListener("keydown",d),()=>{window.removeEventListener("keydown",d)}}},[i,s]);const h=c?r:n;return t.jsx(o.ClickAwayListener,{onClickAway:()=>g(!1),children:t.jsx(o.Tooltip,{title:h,placement:l,open:a,onOpen:()=>p(!0),onClose:()=>{c||p(!1)},children:t.jsx(o.ToggleButton,{value:"selectedMode",selected:i,onClick:()=>s&&s(!i),children:e})})})}const Hi=o.styled(o.IconButton,{shouldForwardProp:e=>e!=="isOpen"})(({isOpen:e,theme:n})=>({color:n.palette.text.secondary,width:n.spacing(3),transform:`rotate(${e?"180":"0"}deg)`,backgroundColor:e?n.palette.action.hover:void 0})),zi=o.styled(o.MenuItem,{shouldForwardProp:e=>e!=="disabled"})(({disabled:e,theme:n})=>({...e&&{pointerEvents:"none",color:n.palette.text.disabled}})),Yi=o.styled(o.MenuItem)(()=>({"&.Mui-disabled":{opacity:1}})),Vi=()=>{};function rn({selectionModes:e,editModes:n,selectedMode:r,onSelectMode:i=Vi,enabled:s,tooltipPlacement:l="bottom",tooltipText:a="",menuHeaderText:p="",editDisabled:c}){const g=o.useTheme(),[h,d]=u.useState(null),v=!!h,f=I=>d(I.currentTarget),y=()=>d(null),m=I=>{i&&i(I),y()},x=!!e.length&&!!n.length,S=I=>n.some(k=>k.id===I.id);function b(I){return t.jsx(zi,{selected:s&&r===I.id,onClick:()=>m(I.id),disabled:c&&S(I),children:t.jsxs(o.Box,{display:"flex",justifyContent:"space-between",alignItems:"center",children:[I.icon,t.jsx(o.Box,{ml:2,children:t.jsx(j.Typography,{variant:"body2",color:"inherit",children:o.capitalize(I.label)})})]})},I.id)}return t.jsxs(t.Fragment,{children:[t.jsx(o.Tooltip,{title:a,placement:l,children:t.jsx(Hi,{id:"feature-selection-menu-button","aria-controls":"feature-selection-menu","aria-haspopup":"true","aria-expanded":v?"true":void 0,onClick:f,isOpen:v,children:t.jsx(vn,{})})}),t.jsxs(o.Menu,{id:"feature-selection-menu",style:{zIndex:g.zIndex.tooltip+1},anchorEl:h,open:v,onClose:y,MenuListProps:{"aria-labelledby":"feature-selection-menu-button"},children:[p&&t.jsx(Yi,{disabled:!0,children:t.jsx(j.Typography,{variant:"caption",color:"textSecondary",children:p})}),!!e.length&&e.map(b),x&&t.jsx(o.Divider,{sx:{margin:({spacing:I})=>I(1,0)}}),!!n.length&&n.map(b)]})]})}const Ui=o.styled(o.List)(({theme:e})=>({display:"flex",alignItems:"center",marginLeft:e.spacing(1.5),padding:e.spacing(.5),overflowX:"auto",maxWidth:"100%",scrollbarWidth:"none",msOverflowStyle:"none","&::-webkit-scrollbar":{display:"none"}})),qi=()=>{};function sn({features:e,onSelectGeometry:n=qi,onDeleteGeometry:r,chipTooltip:i,disabledChipTooltip:s,size:l="medium",tooltipPlacement:a="bottom",chipLabel:p}){const c=X.useIntl(),g=j.useImperativeIntl(c);function h(y){return y==="MultiPoint"?g.formatMessage({id:"c4r.widgets.featureSelection.point"}):y==="MultiLineString"?g.formatMessage({id:"c4r.widgets.featureSelection.lineString"}):y==="MultiPolygon"||y==="Polygon"||y==="GeometryCollection"?g.formatMessage({id:"c4r.widgets.featureSelection.polygon"}):y}function d(y,m){var S;const x=h(y.geometry.type);return p||((S=y.properties)==null?void 0:S.name)||`${x} ${m+1}`}const[v,f]=u.useState(!1);return t.jsx(o.Box,{sx:{overflowX:"auto"},children:t.jsx(Ui,{sx:{gap:l==="small"?.5:1},children:e.map((y,m)=>{var k,w;const x=(k=y.properties)==null?void 0:k.disabled,S=(w=y.properties)==null?void 0:w.invalid;let b=i;x&&(b=s||i),S&&(b=g.formatMessage({id:"c4r.widgets.featureSelection.invalid"})),v&&(b=g.formatMessage({id:"c4r.widgets.featureSelection.remove"}));let I="secondary";return x&&(I="default"),S&&(I="error"),t.jsx(o.ListItem,{disablePadding:!0,children:t.jsx(o.Tooltip,{disableHoverListener:x?!s:!i,title:b,placement:a,children:t.jsx(o.Chip,{size:l,label:d(y,m),color:I,onClick:()=>n(y),onDelete:r?()=>r(y):void 0,icon:S?t.jsx(fe.ErrorOutline,{color:"error"}):void 0,deleteIcon:t.jsx(fe.Cancel,{onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1)})})})},m)})})})}const Ki=o.styled(o.Paper)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",maxHeight:e.spacing(5),padding:e.spacing(.5)})),Zi=[];function Xi({selectionModes:e,editModes:n=Zi,selectedMode:r,onSelectMode:i,enabled:s=!1,onEnabledChange:l,geometry:a,onSelectGeometry:p,onDeleteGeometry:c,tooltipPlacement:g="bottom",size:h="medium",chipLabel:d}){const v=X.useIntl(),f=j.useImperativeIntl(v),y=u.useMemo(()=>e.map(k=>({...k,label:f.formatMessage({id:`c4r.widgets.featureSelection.${kt(k.id)}`})})),[e,f]),m=u.useMemo(()=>n.map(k=>({...k,label:f.formatMessage({id:`c4r.widgets.featureSelection.${kt(k.id)}`})})),[n,f]),x=u.useMemo(()=>{const w=[...y.map(C=>({...C,isEdit:!1})),...m.map(C=>({...C,isEdit:!0}))].find(C=>C.id===r);if(!w)throw new Error(`Selected mode "${r}" not supported`);return w},[m,y,r]),S=o.capitalize((x==null?void 0:x.label)||""),b=x!=null&&x.isEdit?S:f.formatMessage({id:"c4r.widgets.featureSelection.selectTool"},{label:S}),I=x!=null&&x.isEdit?f.formatMessage({id:"c4r.widgets.featureSelection.clickToEdit"}):f.formatMessage({id:"c4r.widgets.featureSelection.clickToCreate"});return t.jsxs(Ki,{children:[t.jsx(on,{icon:x==null?void 0:x.icon,hoverTooltip:b,clickTooltip:I,enabled:s,onEnabledChange:l,tooltipPlacement:g}),t.jsx(rn,{selectionModes:y,editModes:m,selectedMode:r,onSelectMode:i,enabled:s,tooltipPlacement:g,tooltipText:f.formatMessage({id:"c4r.widgets.featureSelection.selectMode"}),menuHeaderText:f.formatMessage({id:"c4r.widgets.featureSelection.chooseSelectionMode"}),editDisabled:!a}),!!a&&t.jsx(sn,{features:[a],onSelectGeometry:p,onDeleteGeometry:c,disabledChipTooltip:f.formatMessage({id:"c4r.widgets.featureSelection.applyMask"}),chipTooltip:f.formatMessage({id:"c4r.widgets.featureSelection.clearMask"}),tooltipPlacement:g,size:h,chipLabel:d})]})}function kt(e){return e.charAt(0).toLowerCase()+e.slice(1)}const ln=240,Ji=o.styled(o.Paper,{shouldForwardProp:e=>e!=="collapsed"})(({theme:e,collapsed:n})=>({width:n?"min-content":ln,background:e.palette.background.paper,maxHeight:"calc(100% - 120px)",display:"flex",flexDirection:"column"})),Qi=o.styled("header",{shouldForwardProp:e=>e!=="collapsed"})(({theme:e,collapsed:n})=>({display:"flex",alignItems:"center",justifyContent:"space-between",padding:e.spacing(1),paddingLeft:e.spacing(2),borderBottom:n?void 0:`1px solid ${e.palette.divider}`})),es=o.styled("header")(({theme:e})=>({padding:e.spacing(1.5),paddingRight:e.spacing(2),gap:e.spacing(.5),display:"flex",justifyContent:"space-between",position:"sticky",zIndex:2,top:0,background:e.palette.background.paper})),ts=o.styled("div")(({theme:e})=>({display:"flex",gap:e.spacing(2),alignItems:"center",padding:e.spacing(1),minWidth:`calc(${ln}px - ${e.spacing(4)})`})),ns=o.styled(o.TextField)(({theme:e})=>({display:"flex",width:e.spacing(7.5),flexShrink:0,"input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button":{WebkitAppearance:"none",margin:0}})),os=o.styled("ul",{shouldForwardProp:e=>e!=="opacity"})(({theme:e,opacity:n})=>({opacity:n,margin:0,padding:0,display:"flex",flexDirection:"column",gap:e.spacing(1)})),an=o.styled("ul")(({theme:e})=>({margin:0,padding:0,paddingBottom:e.spacing(1),display:"flex",flexDirection:"column"})),rs=o.styled("li")(()=>({display:"flex",alignItems:"center"})),is=o.styled("div")(({theme:e})=>({marginRight:e.spacing(1.5),width:j.ICON_SIZE_MEDIUM,height:j.ICON_SIZE_MEDIUM,"& img":{margin:"auto",display:"block"}})),Tt=o.styled(o.Box,{shouldForwardProp:e=>e!=="width"})(({width:e,theme:n})=>({width:e,overflow:"auto",maxHeight:`calc(100% - ${n.spacing(1.5)})`})),ss=o.styled("section")(({theme:e})=>({"&:not(:first-of-type)":{borderTop:`1px solid ${e.palette.divider}`}})),ls=o.styled("div")(()=>({flexGrow:1,flexShrink:1,minWidth:0}));function as({menuRef:e,open:n,toggleOpen:r,opacity:i,onChange:s}){const l=X.useIntl(),a=j.useImperativeIntl(l);function p(c){const g=parseInt(c.target.value||"0"),h=Math.min(Math.max(g,0),100);s(h/100)}return t.jsxs(t.Fragment,{children:[t.jsx(o.Tooltip,{title:a.formatMessage({id:"c4r.widgets.legend.opacity"}),children:t.jsx(o.IconButton,{size:"small",color:n?"primary":"default",onClick:()=>r(!n),children:t.jsx(Ne.OpacityIcon,{})})}),t.jsx(o.Popover,{open:n,onClose:()=>r(!1),anchorEl:e.current,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},slotProps:{root:{sx:{transform:"translate(-12px, 36px)"}}},children:t.jsxs(ts,{children:[t.jsx(o.Slider,{value:i*100,onChange:(c,g)=>s(g/100),min:0,max:100,step:1}),t.jsx(ns,{size:"small",type:"number",value:Math.round(i*100),onChange:p,inputProps:{step:1,min:0,max:100,style:{appearance:"textfield"},"data-testid":"opacity-slider"},InputProps:{endAdornment:t.jsxs(o.InputAdornment,{position:"end",sx:{margin:0},children:[" ","%"]})}})]})})]})}function ot({title:e,visible:n,typographyProps:r}){const i=u.useRef(null),[s,l]=u.useState(!1);u.useLayoutEffect(()=>{if(n&&i.current){const{offsetWidth:p,scrollWidth:c}=i.current;l(p<c)}},[e,n]);const a=t.jsx(j.Typography,{ref:i,color:n?"textPrimary":"textSecondary",variant:"button",weight:"medium",component:"p",noWrap:!0,my:.25,...r,children:e});return s?t.jsx(o.Tooltip,{title:e,children:a}):a}var ae=(e=>(e.CATEGORY="category",e.ICON="icon",e.CONTINUOUS_RAMP="continuous_ramp",e.BINS="bins",e.PROPORTION="proportion",e))(ae||{});const qe=20;function cn({legend:e}){const{labels:n=[],colors:r=[],isStrokeColor:i=!1,customMarkers:s,maskedMarkers:l=!0}=e,a=Te.getPalette(r,n.length),p=n.length>qe,c=X.useIntl(),g=j.useImperativeIntl(c);return t.jsxs(t.Fragment,{children:[t.jsx(an,{"data-testid":"categories-legend",children:n.slice(0,qe).map((h,d)=>t.jsx(ps,{label:String(h),color:a[d%a.length],icon:s&&Array.isArray(s)?s[d]:s,maskedIcon:l,isStrokeColor:i},`${h}${d}`))}),p&&t.jsx(j.Typography,{variant:"caption",color:"textSecondary",component:"div",py:2,children:g.formatMessage({id:"c4r.widgets.legend.maxCategories"},{n:qe})})]})}const cs=({isMax:e,color:n,isStrokeColor:r,theme:i})=>({border:"2px solid transparent","&::after":{position:"absolute",display:e?"block":"none",content:'""',width:i.spacing(2),height:i.spacing(2),border:`2px solid ${i.palette.grey[900]}`,transform:"translate(-30%, -30%)",borderRadius:"50%",boxSizing:"content-box"},...r?{borderColor:n}:{backgroundColor:n}}),ds=({icon:e,color:n,maskedIcon:r})=>({maskRepeat:"no-repeat",maskSize:"cover",backgroundRepeat:"no-repeat",backgroundSize:"cover",...r?{backgroundColor:n,maskImage:`url(${e})`,WebkitMaskImage:`url(${e})`}:{backgroundColor:"rgba(0,0,0,0)",backgroundImage:`url(${e})`}}),us=o.styled(o.Box,{shouldForwardProp:e=>e!=="icon"&&e!=="maskedIcon"&&e!=="color"&&e!=="isStrokeColor"})(({icon:e,maskedIcon:n,color:r,isStrokeColor:i,theme:s})=>({whiteSpace:"nowrap",display:"block",width:s.spacing(1.5),height:s.spacing(1.5),flexShrink:"0",borderRadius:"50%",position:"relative",border:"2px solid transparent",...e?ds({icon:e,color:r,maskedIcon:n}):cs({color:r,isStrokeColor:i,theme:s})}));function ps({label:e,isStrokeColor:n,color:r="#000",icon:i,maskedIcon:s}){return t.jsxs(o.Box,{component:"li",sx:{display:"flex",alignItems:"center"},children:[t.jsx(us,{className:"marker",mr:1.5,component:"span",icon:i,maskedIcon:s,isStrokeColor:n,color:r}),t.jsx(ot,{title:e,visible:!0,typographyProps:{variant:"overline",my:.75}})]})}const De=6,We={0:12,1:9,2:6,3:3},gs=o.styled(o.Box,{shouldForwardProp:e=>e!=="index"})(({index:e=0,theme:n})=>{const r=n.spacing(We[e]),i=n.spacing(We[e]);return{border:`solid 1px ${n.palette.divider}`,backgroundColor:n.palette.background.default,borderRadius:"50%",position:"absolute",right:0,bottom:0,width:r,height:i}}),hs=o.styled(o.Box)(({theme:{spacing:e}})=>({display:"flex",justifyContent:"flex-end",flexShrink:0,position:"relative",width:e(We[0]),height:e(We[0])})),fs=o.styled(o.Box)(({theme:{spacing:e}})=>({display:"flex",gap:e(1),alignItems:"stretch",justifyContent:"stretch",padding:e(2,0)})),xs=o.styled(o.Box)(()=>({display:"flex",flexDirection:"column",justifyContent:"space-around",gap:1,flexGrow:1,flexShrink:1}));function dn({legend:e}){const n=X.useIntl(),r=j.useImperativeIntl(n),i=e.showMinMax??!0,{min:s,max:l,error:a}=ms(e),[p,c]=a?[0,0]:ys(s,l);return t.jsxs(fs,{"data-testid":"proportion-legend",children:[t.jsx(hs,{children:[...Array(4)].map((g,h)=>t.jsx(gs,{index:h,component:"span"},h))}),t.jsx(xs,{children:a?t.jsx(o.Box,{maxWidth:240,children:t.jsx(j.Typography,{variant:"overline",children:"You need to specify valid numbers for the labels property"})}):t.jsxs(t.Fragment,{children:[t.jsxs(j.Typography,{variant:"overline",color:"textSecondary",children:[i&&r.formatMessage({id:"c4r.widgets.legend.max"})+": ",n.formatNumber(l,{maximumSignificantDigits:De})]}),t.jsx(j.Typography,{variant:"overline",color:"textSecondary",children:n.formatNumber(c,{maximumSignificantDigits:De})}),t.jsx(j.Typography,{variant:"overline",color:"textSecondary",children:n.formatNumber(p,{maximumSignificantDigits:De})}),t.jsxs(j.Typography,{variant:"overline",color:"textSecondary",children:[i&&r.formatMessage({id:"c4r.widgets.legend.min"})+": ",n.formatNumber(s,{maximumSignificantDigits:De})]})]})})]})}function un({labels:e}){let n=e==null?void 0:e[e.length-1],r=e==null?void 0:e[0];return Number.isFinite(r)||(r=parseInt(String(r),10)),Number.isFinite(n)||(n=parseInt(String(n),10)),[r,n]}function ms(e){let n=!1;const[r,i]=un(e);return(Number.isNaN(r)||Number.isNaN(i))&&(n=!0),{min:r,max:i,error:n}}function ys(e,n){const r=(n-e)/3;return[e+r,n-r]}function pn({legend:e}){const{labels:n=[],icons:r=[]}=e;return t.jsx(an,{"data-testid":"icon-legend",children:n.map((i,s)=>t.jsxs(rs,{children:[t.jsx(is,{children:t.jsx("img",{src:r[s],alt:i,width:"auto",height:j.ICON_SIZE_MEDIUM})}),t.jsx(ot,{visible:!0,title:i,typographyProps:{variant:"overline",my:.75}})]},i))})}function vs(e){return typeof e[0]=="object"&&"label"in e[0]}function Qe({isContinuous:e=!1,legend:n}){const{labels:r=[],colors:i=[],showMinMax:s=!0}=n,l=Te.getPalette(i,!r.length||e?2:r.length+1),a=vs(r),p=a?r.map(({value:y})=>y):r,c=a?r.map(({label:y})=>y):r,[g,h]=un({labels:p}),d=Number.isNaN(g)||Number.isNaN(h);let v=c[c.length-1],f=c[0];return!e&&s&&(f="< "+f,v="≥ "+v),t.jsx(o.Box,{py:2,"data-testid":"ramp-legend",children:d?t.jsx(o.Box,{maxWidth:240,children:t.jsx(j.Typography,{variant:"overline",children:"You need to specify valid numbers for the labels property"})}):t.jsxs(t.Fragment,{children:[t.jsx(o.Box,{display:"flex",pb:1,children:e?t.jsx(js,{"data-testid":"step-continuous",palette:l}):t.jsx(bs,{palette:l,labels:c,max:v,min:f})}),t.jsxs(o.Box,{display:"flex",justifyContent:"space-between",children:[t.jsx(j.Typography,{variant:"overlineDelicate",color:"textSecondary",children:f}),t.jsx(j.Typography,{variant:"overlineDelicate",color:"textSecondary",children:v})]})]})})}const js=o.styled(o.Box,{shouldForwardProp:e=>e!=="palette"})(({palette:e,theme:n})=>({display:"block",flexGrow:1,height:n.spacing(1),borderRadius:n.spacing(.5),background:`linear-gradient(to right, ${e.join()})`})),ws=o.styled(o.Box,{shouldForwardProp:e=>e!=="color"})(({color:e,theme:n})=>({display:"block",flexGrow:1,height:n.spacing(1),backgroundColor:e,"&:first-of-type":{borderRadius:n.spacing(.5,0,0,.5)},"&:last-of-type":{borderRadius:n.spacing(0,.5,.5,0)}}));function bs({labels:e=[],palette:n=[],max:r,min:i}){const s=e.length?[i,...e]:[i,r];return t.jsx(t.Fragment,{children:s.map((l,a)=>{const p=a===0?i:a===s.length-1?r:`${l} - ${s[a+1]}`;return t.jsx(o.Tooltip,{title:p,children:t.jsx(ws,{"data-testid":"step-discontinuous",color:n[a]})},a)})})}const Ss={[ae.CATEGORY]:cn,[ae.PROPORTION]:dn,[ae.ICON]:pn,[ae.BINS]:e=>t.jsx(Qe,{...e,isContinuous:!1}),[ae.CONTINUOUS_RAMP]:e=>t.jsx(Qe,{...e,isContinuous:!0})};function Is({legend:e}){const n=X.useIntl(),r=j.useImperativeIntl(n);return e.select||!e.type?null:t.jsxs(j.Typography,{variant:"body2",color:"textSecondary",component:"p",children:[e.type," ",r.formatMessage({id:"c4r.widgets.legend.notSupported"}),"."]})}function ks(e){return e.type===ae.PROPORTION?"c4r.widgets.legend.subtitles.proportion":e.type===ae.ICON||e.customMarkers?"c4r.widgets.legend.subtitles.icon":e.isStrokeColor?"c4r.widgets.legend.subtitles.strokeColor":"c4r.widgets.legend.subtitles.color"}function Ts({layer:e,legend:n,customLegendTypes:r,onChangeSelection:i}){var h;const s=X.useIntl(),l=j.useImperativeIntl(s),a=n.type,c=Ss[a]??r[a]??Is,g=((h=n.select)==null?void 0:h.options)??[];return t.jsxs(o.Box,{component:"li","data-testid":"legend-layer-variable",px:2,children:[n.attr?t.jsxs(o.Box,{pb:1,children:[t.jsx(j.Typography,{gutterBottom:!0,variant:"overlineDelicate",color:"textSecondary",component:"p",children:l.formatMessage({id:ks(n)})}),t.jsx(j.Typography,{variant:"caption",component:"p",children:n.attr})]}):null,n.select?t.jsxs(o.Box,{pb:1,children:[t.jsx(j.Typography,{variant:"caption",weight:"medium",component:"p",children:n.select.label}),t.jsx(o.Select,{"data-testid":"legend-layer-variable-select",name:"legend-select",value:n.select.value,renderValue:d=>{var v;return((v=g.find(f=>f.value===d))==null?void 0:v.label)??d},onChange:d=>i(d.target.value),MenuProps:{transformOrigin:{vertical:"bottom",horizontal:"left"},anchorOrigin:{vertical:"top",horizontal:"left"},PaperProps:{style:{maxHeight:240}}},children:g.map(d=>t.jsx(o.MenuItem,{value:d.value,children:t.jsx(o.ListItemText,{primary:d.label})},d.value))})]}):null,t.jsx(c,{layer:e,legend:n})]})}const Ms={};function gn(e){return e?Array.isArray(e)?e.every(n=>gn(n)):!e.select&&!e.type:!0}function Mt({customLegendTypes:e=Ms,layer:n,onChangeCollapsed:r,onChangeOpacity:i,onChangeVisibility:s,onChangeSelection:l,maxZoom:a=21,minZoom:p=0,currentZoom:c=0}){const g=X.useIntl(),h=j.useImperativeIntl(g),d=u.useRef(null),[v,f]=u.useState(!1),y=n.id,m=n.title,x=n.visible??!0,S=n.switchable??!0,b=n.collapsed??!1,I=(n.collapsible??!0)&&!gn(n.legend),k=n.opacity??1,w=n.showOpacityControl??!0,C=x&&!b,A=C?t.jsx(kn,{}):t.jsx(In,{}),D=(n==null?void 0:n.minZoom)!==void 0||(n==null?void 0:n.maxZoom)!==void 0,B=n.minZoom??p,P=n.maxZoom??a,L=D&&(B>p||P<a),N=c<B||c>P,V=Cs({intl:h,minZoom:p,maxZoom:a,layerMinZoom:B,layerMaxZoom:P}),_=n.helperText??(L?V:""),T=u.useMemo(()=>n.legend?Array.isArray(n.legend)?n.legend:[n.legend]:[],[n.legend]);return n.legend?t.jsxs(ss,{"data-testid":"legend-layer","aria-label":m,children:[t.jsxs(es,{ref:d,children:[I&&t.jsx(o.IconButton,{size:"small","aria-label":h.formatMessage({id:b?"c4r.widgets.legend.expand":"c4r.widgets.legend.collapse"}),disabled:!x,onClick:()=>r({id:y,collapsed:!b}),children:A}),t.jsxs(ls,{children:[t.jsx(ot,{visible:x,title:m??""}),L&&t.jsx(o.Tooltip,{title:h.formatMessage({id:"c4r.widgets.legend.zoomLevelTooltip"}),children:t.jsxs(j.Typography,{color:x?"textPrimary":"textSecondary",variant:"caption",component:"p",children:[h.formatMessage({id:"c4r.widgets.legend.zoomLevel"})," ",n.minZoom," - ",n.maxZoom]})})]}),w&&x&&!b&&t.jsx(as,{menuRef:d,open:v,toggleOpen:f,opacity:k,onChange:O=>i({id:y,opacity:O})}),S&&t.jsx(o.Tooltip,{title:h.formatMessage({id:x?"c4r.widgets.legend.hideLayer":"c4r.widgets.legend.showLayer"}),children:t.jsx(o.IconButton,{size:"small",onClick:()=>s({id:y,collapsed:x?b:!1,visible:!x}),children:x?t.jsx(bn,{}):t.jsx(Sn,{})})})]}),t.jsxs(o.Collapse,{unmountOnExit:!0,timeout:100,in:C,children:[t.jsx(os,{"data-testid":"legend-layer-variable-list",opacity:N?.5:1,children:T.map((O,M)=>t.jsx(Ts,{legend:O,layer:n,customLegendTypes:e,onChangeSelection:$=>l({id:y,index:M,selection:$})},`${O.type}-${M}`))}),_&&t.jsx(j.Typography,{variant:"caption",color:"textSecondary",component:"div",p:2,children:t.jsx("div",{dangerouslySetInnerHTML:{__html:_}})})]})]}):null}function Cs({intl:e,minZoom:n,maxZoom:r,layerMinZoom:i,layerMaxZoom:s}){const l=e.formatMessage({id:"c4r.widgets.legend.and"}),a=e.formatMessage({id:"c4r.widgets.legend.lowerThan"}),p=e.formatMessage({id:"c4r.widgets.legend.greaterThan"}),c=e.formatMessage({id:"c4r.widgets.legend.zoomNote"}),g=s<r?`${a} ${s}`:"",h=i>n?`${p} ${i}`:"",d=[g,h].filter(Boolean).join(` ${l} `);return d?`${c} ${d}`:""}const As={},ke=()=>{},Es=[];function Bs({customLegendTypes:e=As,layers:n=Es,collapsed:r=!1,onChangeCollapsed:i=ke,onChangeVisibility:s=ke,onChangeOpacity:l=ke,onChangeLegendRowCollapsed:a=ke,onChangeSelection:p=ke,title:c="Layers",maxZoom:g=20,minZoom:h=0,currentZoom:d,isMobile:v,sx:f}){const y=X.useIntl(),m=j.useImperativeIntl(y),x=t.jsxs(Qi,{collapsed:r,children:[t.jsx(j.Typography,{variant:"caption",flexGrow:1,children:c}),t.jsx(o.Tooltip,{title:m.formatMessage({id:"c4r.widgets.legend.close"}),children:t.jsx(o.IconButton,{size:"small",onClick:()=>i(!0),children:t.jsx(jn,{})})})]}),S=t.jsx(o.Tooltip,{title:m.formatMessage({id:"c4r.widgets.legend.open"}),children:t.jsx(o.IconButton,{"aria-label":c,onClick:()=>i(!1),children:t.jsx(wn,{})})});return t.jsx(Ji,{sx:f,elevation:3,collapsed:r||!!v,children:v?t.jsxs(t.Fragment,{children:[S,t.jsxs(o.Drawer,{anchor:"bottom",open:!r,onClose:()=>i(!0),children:[x,t.jsx(Tt,{children:n.map(b=>t.jsx(Mt,{layer:b,onChangeCollapsed:a,onChangeOpacity:l,onChangeVisibility:s,onChangeSelection:p,maxZoom:g,minZoom:h,currentZoom:d,customLegendTypes:e},b.id))})]})]}):t.jsxs(t.Fragment,{children:[r?S:x,t.jsx(Tt,{width:r?0:void 0,children:t.jsx(o.Collapse,{unmountOnExit:!0,in:!r,timeout:500,children:n.map(b=>t.jsx(Mt,{layer:b,onChangeCollapsed:a,onChangeOpacity:l,onChangeVisibility:s,onChangeSelection:p,maxZoom:g,minZoom:h,currentZoom:d,customLegendTypes:e},b.id))})})]})})}function Ct({color:e=void 0,children:n}){return n?t.jsx(o.Box,{mt:.5,children:t.jsx(j.Typography,{component:"div",variant:"caption",color:e??"inherit",style:{fontWeight:"normal"},children:n})}):t.jsx(o.Box,{mt:-1})}function Ps({title:e="No data available",body:n="There are no results for the combination of filters applied to your data. Try tweaking your filters, or zoom and pan the map to adjust the Map View.",severity:r=void 0,...i}){return r?t.jsx(Tn.Alert,{title:e,severity:r,...i,children:t.jsx(Ct,{children:n})}):t.jsxs(o.Box,{...i,children:[e&&t.jsx(j.Typography,{variant:"body2",children:e}),t.jsx(Ct,{color:"textSecondary",children:n})]})}const Ls=o.styled(o.Box,{shouldForwardProp:e=>e!=="margin"})(({theme:e,margin:n})=>({margin:0,position:"relative",maxWidth:"100%",padding:n??e.spacing(2,2.5)})),Ds=o.styled(o.LinearProgress)(({theme:e})=>({position:"absolute",top:0,left:0,width:"100%",height:e.spacing(.25)})),Ns=o.styled(o.Grid,{shouldForwardProp:e=>e!=="expanded"})(({theme:e,expanded:n=!0})=>({display:"flex",flexDirection:"row",alignItems:"flex-start",justifyContent:"space-between",width:"100%",...n?{minHeight:e.spacing(3)}:{height:e.spacing(3)},padding:0})),$s=o.styled(o.Button,{shouldForwardProp:e=>e!=="expandable"})(({theme:e,expandable:n=!0})=>({flex:1,padding:0,alignItems:"flex-start",justifyContent:"flex-start",height:"auto",minHeight:"auto",marginBottom:e.spacing(1),cursor:n?"pointer":"default","& .MuiButton-startIcon":{marginTop:"3px",marginRight:e.spacing(1)},"&:hover":{background:"none"}})),hn=({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"center",width:e.spacing(3),height:e.spacing(3),color:e.palette.text.secondary}),Os=o.styled(fe.ExpandLess)(({theme:e})=>hn({theme:e})),Rs=o.styled(fe.ExpandMore)(({theme:e})=>hn({theme:e})),Fs=o.styled(o.Typography,{shouldForwardProp:e=>e!=="expanded"})(({expanded:e=!0})=>({wordBreak:"break-word",overflow:"hidden",...e&&{display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical"},...!e&&{whiteSpace:"nowrap",textOverflow:"ellipsis"}})),Ws=o.styled(o.Grid)(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1),marginRight:e.spacing(-.5),marginLeft:e.spacing(1)})),At=o.styled(o.IconButton)(({theme:e})=>({color:e.palette.text.secondary})),_s=o.styled(o.Menu)(({theme:e})=>({".MuiPaper-root":{marginTop:e.spacing(5),maxHeight:e.spacing(21),minWidth:e.spacing(16)}})),Et=[],Gs=t.jsx(fe.MoreVert,{});function Hs({title:e,actions:n=Et,options:r=Et,optionsIcon:i=Gs,children:s,contentProps:l,disabled:a=!1,expandable:p=!0,expanded:c=!0,onExpandedChange:g,footer:h,headerItems:d,isLoading:v=!1,margin:f}){const y=u.createRef(),[m,x]=u.useState(!0),S=c!==void 0&&g!==void 0,b=p!==!1?S?c:m:!0,I=S?g:x,[k,w]=u.useState(null),C=!!k,A=()=>{p&&I(!b)},D=N=>w(N.currentTarget),B=()=>w(null);function P(N){N&&N(),B()}const L=N=>t.jsx(At,{"aria-label":N.label,onClick:N.action,size:"small",children:N.icon},N.id);return a?s:t.jsxs(Ls,{margin:f,component:"section","aria-label":e,children:[v?t.jsx(Ds,{}):null,t.jsxs(Ns,{container:!0,expanded:c,children:[t.jsx($s,{expandable:p,startIcon:p&&t.jsx(o.Icon,{children:b?t.jsx(Os,{}):t.jsx(Rs,{})}),onClick:A,tabIndex:p?0:-1,children:t.jsx(o.Tooltip,{title:e,children:t.jsx(Fs,{expanded:c,align:"left",variant:"subtitle1",children:e})})}),t.jsxs(Ws,{item:!0,children:[d,n.length>0&&n.map(N=>N.tooltip?t.jsx(o.Tooltip,{title:N.tooltip.text,placement:N.tooltip.placement??"top",children:L(N)},N.id):L(N)),r.length>0&&t.jsxs(t.Fragment,{children:[t.jsx(At,{"aria-label":"options","aria-controls":"options-menu","aria-haspopup":"true",onClick:D,size:"small",children:i}),t.jsx(_s,{id:"options-menu",elevation:8,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},anchorEl:k,keepMounted:!0,open:C,onClose:B,children:r.map(N=>t.jsx(o.MenuItem,{selected:N.selected,onClick:()=>P(N.action),children:N.name},N.id))})]})]})]}),t.jsx(o.Collapse,{ref:y,in:b,timeout:"auto",unmountOnExit:!0,children:t.jsxs(o.Box,{...l,children:[t.jsx(o.Box,{pt:1,children:s}),h??t.jsx(o.Box,{children:h})]})})]})}exports.BarWidgetUI=Rn;exports.CategoryWidgetUI=Kn;exports.ComparativeCategoryWidgetUI=ki;exports.ComparativeFormulaWidgetUI=Di;exports.ComparativePieWidgetUI=_i;exports.FeatureSelectionUIDropdown=rn;exports.FeatureSelectionUIGeometryChips=sn;exports.FeatureSelectionUIToggleButton=on;exports.FeatureSelectionWidgetUI=Xi;exports.FormulaWidgetUI=Qn;exports.GroupDateTypes=le;exports.HistogramWidgetUI=ao;exports.LEGEND_TYPES=ae;exports.LegendCategories=cn;exports.LegendIcon=pn;exports.LegendProportion=dn;exports.LegendRamp=Qe;exports.LegendWidgetUI=Bs;exports.NoDataAlert=Ps;exports.PieWidgetUI=Oo;exports.RangeWidgetUI=Uo;exports.ScatterPlotWidgetUI=nr;exports.TIME_SERIES_CHART_TYPES=Ge;exports.TableWidgetUI=gr;exports.TimeSeriesProvider=Vt;exports.TimeSeriesWidgetUI=oi;exports.WrapperWidgetUI=Hs;exports.useTimeSeriesContext=He;exports.useTimeSeriesInteractivity=Ut;
|
|
33
|
+
{b|${B}}`,position:"center",rich:{b:{fontFamily:d.typography.overline.fontFamily,fontSize:j.SPACING*1.75,lineHeight:j.SPACING*1.75,fontWeight:400,color:d.palette.text.primary},per:{...d.typography.overline,fontSize:j.SPACING*3,lineHeight:j.SPACING*4.5,fontWeight:600,color:d.palette.text.primary}}},A=f.map((B,P)=>{var L;return{type:"pie",name:e[P],itemStyle:{color:(L=B[0])==null?void 0:L.color},animation:l,data:B.map(N=>({...N,itemStyle:{color:N.color}})),radius:P===0?["75%","90%"]:["56%","72%"],selectedOffset:0,hoverOffset:5,bottom:j.SPACING*2.5,avoidLabelOverlap:!0,label:{show:!1,...C},emphasis:{label:{show:!0,formatter:C.formatter,rich:C.rich}}}});return{grid:{left:0,top:0,right:0,bottom:0},tooltip:I,legend:w,series:A}},[d,e,l,f,a,p]),m={mouseover:(S,b)=>{f.length===1&&(S.seriesIndex!==0||S.dataIndex!==0)&&b.dispatchAction({type:"downplay",seriesIndex:0,dataIndex:0})},mouseout:(S,b)=>{f.length===1&&b.dispatchAction({type:"highlight",seriesIndex:0,dataIndex:0})},click:S=>{const I=f[S.seriesIndex][S.dataIndex].key,k=c.includes(I),w=new Set(c);k?w.delete(I):w.add(I);const C=f[0].length;let A=Array.from(w);A.length===C&&(A=[]),g(A)}};u.useEffect(()=>{v.current&&v.current.dispatchAction({type:f.length===1?"highlight":"downplay",seriesIndex:0,dataIndex:0})},[f]);function x(S){v.current=S}return f.length?h?t.jsx(Wt,{height:s}):t.jsx(ye,{onChartReady:x,notMerge:!0,option:y,onEvents:m,style:{maxHeight:s,width:"100%"}}):null}const Gi=()=>{};function on({icon:e,hoverTooltip:n,clickTooltip:r,enabled:i,onEnabledChange:s=Gi,tooltipPlacement:l="bottom"}){const[a,p]=u.useState(!1),[c,g]=u.useState(i);u.useEffect(()=>{g(i)},[i]),u.useEffect(()=>{if(i){const d=v=>{v.key==="Escape"&&s&&s(!1)};return window.addEventListener("keydown",d),()=>{window.removeEventListener("keydown",d)}}},[i,s]);const h=c?r:n;return t.jsx(o.ClickAwayListener,{onClickAway:()=>g(!1),children:t.jsx(o.Tooltip,{title:h,placement:l,open:a,onOpen:()=>p(!0),onClose:()=>{c||p(!1)},children:t.jsx(o.ToggleButton,{value:"selectedMode",selected:i,onClick:()=>s&&s(!i),children:e})})})}const Hi=o.styled(o.IconButton,{shouldForwardProp:e=>e!=="isOpen"})(({isOpen:e,theme:n})=>({color:n.palette.text.secondary,width:n.spacing(3),transform:`rotate(${e?"180":"0"}deg)`,backgroundColor:e?n.palette.action.hover:void 0})),zi=o.styled(o.MenuItem,{shouldForwardProp:e=>e!=="disabled"})(({disabled:e,theme:n})=>({...e&&{pointerEvents:"none",color:n.palette.text.disabled}})),Yi=o.styled(o.MenuItem)(()=>({"&.Mui-disabled":{opacity:1}})),Vi=()=>{};function rn({selectionModes:e,editModes:n,selectedMode:r,onSelectMode:i=Vi,enabled:s,tooltipPlacement:l="bottom",tooltipText:a="",menuHeaderText:p="",editDisabled:c}){const g=o.useTheme(),[h,d]=u.useState(null),v=!!h,f=I=>d(I.currentTarget),y=()=>d(null),m=I=>{i&&i(I),y()},x=!!e.length&&!!n.length,S=I=>n.some(k=>k.id===I.id);function b(I){return t.jsx(zi,{selected:s&&r===I.id,onClick:()=>m(I.id),disabled:c&&S(I),children:t.jsxs(o.Box,{display:"flex",justifyContent:"space-between",alignItems:"center",children:[I.icon,t.jsx(o.Box,{ml:2,children:t.jsx(j.Typography,{variant:"body2",color:"inherit",children:o.capitalize(I.label)})})]})},I.id)}return t.jsxs(t.Fragment,{children:[t.jsx(o.Tooltip,{title:a,placement:l,children:t.jsx(Hi,{id:"feature-selection-menu-button","aria-controls":"feature-selection-menu","aria-haspopup":"true","aria-expanded":v?"true":void 0,onClick:f,isOpen:v,children:t.jsx(vn,{})})}),t.jsxs(o.Menu,{id:"feature-selection-menu",style:{zIndex:g.zIndex.tooltip+1},anchorEl:h,open:v,onClose:y,MenuListProps:{"aria-labelledby":"feature-selection-menu-button"},children:[p&&t.jsx(Yi,{disabled:!0,children:t.jsx(j.Typography,{variant:"caption",color:"textSecondary",children:p})}),!!e.length&&e.map(b),x&&t.jsx(o.Divider,{sx:{margin:({spacing:I})=>I(1,0)}}),!!n.length&&n.map(b)]})]})}const Ui=o.styled(o.List)(({theme:e})=>({display:"flex",alignItems:"center",marginLeft:e.spacing(1.5),padding:e.spacing(.5),overflowX:"auto",maxWidth:"100%",scrollbarWidth:"none",msOverflowStyle:"none","&::-webkit-scrollbar":{display:"none"}})),qi=()=>{};function sn({features:e,onSelectGeometry:n=qi,onDeleteGeometry:r,chipTooltip:i,disabledChipTooltip:s,size:l="medium",tooltipPlacement:a="bottom",chipLabel:p}){const c=X.useIntl(),g=j.useImperativeIntl(c);function h(y){return y==="MultiPoint"?g.formatMessage({id:"c4r.widgets.featureSelection.point"}):y==="MultiLineString"?g.formatMessage({id:"c4r.widgets.featureSelection.lineString"}):y==="MultiPolygon"||y==="Polygon"||y==="GeometryCollection"?g.formatMessage({id:"c4r.widgets.featureSelection.polygon"}):y}function d(y,m){var S;const x=h(y.geometry.type);return p||((S=y.properties)==null?void 0:S.name)||`${x} ${m+1}`}const[v,f]=u.useState(!1);return t.jsx(o.Box,{sx:{overflowX:"auto"},children:t.jsx(Ui,{sx:{gap:l==="small"?.5:1},children:e.map((y,m)=>{var k,w;const x=(k=y.properties)==null?void 0:k.disabled,S=(w=y.properties)==null?void 0:w.invalid;let b=i;x&&(b=s||i),S&&(b=g.formatMessage({id:"c4r.widgets.featureSelection.invalid"})),v&&(b=g.formatMessage({id:"c4r.widgets.featureSelection.remove"}));let I="secondary";return x&&(I="default"),S&&(I="error"),t.jsx(o.ListItem,{disablePadding:!0,children:t.jsx(o.Tooltip,{disableHoverListener:x?!s:!i,title:b,placement:a,children:t.jsx(o.Chip,{size:l,label:d(y,m),color:I,onClick:()=>n(y),onDelete:r?()=>r(y):void 0,icon:S?t.jsx(fe.ErrorOutline,{color:"error"}):void 0,deleteIcon:t.jsx(fe.Cancel,{onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1)})})})},m)})})})}const Ki=o.styled(o.Paper)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",maxHeight:e.spacing(5),padding:e.spacing(.5)})),Zi=[];function Xi({selectionModes:e,editModes:n=Zi,selectedMode:r,onSelectMode:i,enabled:s=!1,onEnabledChange:l,geometry:a,onSelectGeometry:p,onDeleteGeometry:c,tooltipPlacement:g="bottom",size:h="medium",chipLabel:d}){const v=X.useIntl(),f=j.useImperativeIntl(v),y=u.useMemo(()=>e.map(k=>({...k,label:f.formatMessage({id:`c4r.widgets.featureSelection.${kt(k.id)}`})})),[e,f]),m=u.useMemo(()=>n.map(k=>({...k,label:f.formatMessage({id:`c4r.widgets.featureSelection.${kt(k.id)}`})})),[n,f]),x=u.useMemo(()=>{const w=[...y.map(C=>({...C,isEdit:!1})),...m.map(C=>({...C,isEdit:!0}))].find(C=>C.id===r);if(!w)throw new Error(`Selected mode "${r}" not supported`);return w},[m,y,r]),S=o.capitalize((x==null?void 0:x.label)||""),b=x!=null&&x.isEdit?S:f.formatMessage({id:"c4r.widgets.featureSelection.selectTool"},{label:S}),I=x!=null&&x.isEdit?f.formatMessage({id:"c4r.widgets.featureSelection.clickToEdit"}):f.formatMessage({id:"c4r.widgets.featureSelection.clickToCreate"});return t.jsxs(Ki,{children:[t.jsx(on,{icon:x==null?void 0:x.icon,hoverTooltip:b,clickTooltip:I,enabled:s,onEnabledChange:l,tooltipPlacement:g}),t.jsx(rn,{selectionModes:y,editModes:m,selectedMode:r,onSelectMode:i,enabled:s,tooltipPlacement:g,tooltipText:f.formatMessage({id:"c4r.widgets.featureSelection.selectMode"}),menuHeaderText:f.formatMessage({id:"c4r.widgets.featureSelection.chooseSelectionMode"}),editDisabled:!a}),!!a&&t.jsx(sn,{features:[a],onSelectGeometry:p,onDeleteGeometry:c,disabledChipTooltip:f.formatMessage({id:"c4r.widgets.featureSelection.applyMask"}),chipTooltip:f.formatMessage({id:"c4r.widgets.featureSelection.clearMask"}),tooltipPlacement:g,size:h,chipLabel:d})]})}function kt(e){return e.charAt(0).toLowerCase()+e.slice(1)}const ln=240,Ji=o.styled(o.Paper,{shouldForwardProp:e=>e!=="collapsed"})(({theme:e,collapsed:n})=>({width:n?"min-content":ln,background:e.palette.background.paper,maxHeight:"calc(100% - 120px)",display:"flex",flexDirection:"column"})),Qi=o.styled("header",{shouldForwardProp:e=>e!=="collapsed"})(({theme:e,collapsed:n})=>({display:"flex",alignItems:"center",justifyContent:"space-between",padding:e.spacing(1),paddingLeft:e.spacing(2),borderBottom:n?void 0:`1px solid ${e.palette.divider}`})),es=o.styled("header")(({theme:e})=>({padding:e.spacing(1.5),paddingRight:e.spacing(2),gap:e.spacing(.5),display:"flex",justifyContent:"space-between",position:"sticky",zIndex:2,top:0,background:e.palette.background.paper})),ts=o.styled("div")(({theme:e})=>({display:"flex",gap:e.spacing(2),alignItems:"center",padding:e.spacing(1),minWidth:`calc(${ln}px - ${e.spacing(4)})`})),ns=o.styled(o.TextField)(({theme:e})=>({display:"flex",width:e.spacing(7.5),flexShrink:0,"input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button":{WebkitAppearance:"none",margin:0}})),os=o.styled("ul",{shouldForwardProp:e=>e!=="opacity"})(({theme:e,opacity:n})=>({opacity:n,margin:0,padding:0,display:"flex",flexDirection:"column",gap:e.spacing(1)})),an=o.styled("ul")(({theme:e})=>({margin:0,padding:0,paddingBottom:e.spacing(1),display:"flex",flexDirection:"column"})),rs=o.styled("li")(()=>({display:"flex",alignItems:"center"})),is=o.styled("div")(({theme:e})=>({marginRight:e.spacing(1.5),width:j.ICON_SIZE_MEDIUM,height:j.ICON_SIZE_MEDIUM,"& img":{margin:"auto",display:"block"}})),Tt=o.styled(o.Box,{shouldForwardProp:e=>e!=="width"})(({width:e,theme:n})=>({width:e,overflow:"auto",maxHeight:`calc(100% - ${n.spacing(1.5)})`})),ss=o.styled("section")(({theme:e})=>({"&:not(:first-of-type)":{borderTop:`1px solid ${e.palette.divider}`}})),ls=o.styled("div")(()=>({flexGrow:1,flexShrink:1,minWidth:0}));function as({menuRef:e,open:n,toggleOpen:r,opacity:i,onChange:s}){const l=X.useIntl(),a=j.useImperativeIntl(l);function p(c){const g=parseInt(c.target.value||"0"),h=Math.min(Math.max(g,0),100);s(h/100)}return t.jsxs(t.Fragment,{children:[t.jsx(o.Tooltip,{title:a.formatMessage({id:"c4r.widgets.legend.opacity"}),children:t.jsx(o.IconButton,{size:"small",color:n?"primary":"default",onClick:()=>r(!n),children:t.jsx(Ne.OpacityIcon,{})})}),t.jsx(o.Popover,{open:n,onClose:()=>r(!1),anchorEl:e.current,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},slotProps:{root:{sx:{transform:"translate(-12px, 36px)"}}},children:t.jsxs(ts,{children:[t.jsx(o.Slider,{value:i*100,onChange:(c,g)=>s(g/100),min:0,max:100,step:1}),t.jsx(ns,{size:"small",type:"number",value:Math.round(i*100),onChange:p,inputProps:{step:1,min:0,max:100,style:{appearance:"textfield"},"data-testid":"opacity-slider"},InputProps:{endAdornment:t.jsxs(o.InputAdornment,{position:"end",sx:{margin:0},children:[" ","%"]})}})]})})]})}function ot({title:e,visible:n,typographyProps:r}){const i=u.useRef(null),[s,l]=u.useState(!1);u.useLayoutEffect(()=>{if(n&&i.current){const{offsetWidth:p,scrollWidth:c}=i.current;l(p<c)}},[e,n]);const a=t.jsx(j.Typography,{ref:i,color:n?"textPrimary":"textSecondary",variant:"button",weight:"medium",component:"p",noWrap:!0,my:.25,...r,children:e});return s?t.jsx(o.Tooltip,{title:e,children:a}):a}var ae=(e=>(e.CATEGORY="category",e.ICON="icon",e.CONTINUOUS_RAMP="continuous_ramp",e.BINS="bins",e.PROPORTION="proportion",e))(ae||{});const qe=20;function cn({legend:e}){const{labels:n=[],colors:r=[],isStrokeColor:i=!1,customMarkers:s,maskedMarkers:l=!0}=e,a=Te.getPalette(r,n.length),p=n.length>qe,c=X.useIntl(),g=j.useImperativeIntl(c);return t.jsxs(t.Fragment,{children:[t.jsx(an,{"data-testid":"categories-legend",children:n.slice(0,qe).map((h,d)=>t.jsx(ps,{label:String(h),color:a[d%a.length],icon:s&&Array.isArray(s)?s[d]:s,maskedIcon:l,isStrokeColor:i},`${h}${d}`))}),p&&t.jsx(j.Typography,{variant:"caption",color:"textSecondary",component:"div",py:2,children:g.formatMessage({id:"c4r.widgets.legend.maxCategories"},{n:qe})})]})}const cs=({isMax:e,color:n,isStrokeColor:r,theme:i})=>({border:"2px solid transparent","&::after":{position:"absolute",display:e?"block":"none",content:'""',width:i.spacing(2),height:i.spacing(2),border:`2px solid ${i.palette.grey[900]}`,transform:"translate(-30%, -30%)",borderRadius:"50%",boxSizing:"content-box"},...r?{borderColor:n}:{backgroundColor:n}}),ds=({icon:e,color:n,maskedIcon:r})=>({maskRepeat:"no-repeat",maskSize:"cover",backgroundRepeat:"no-repeat",backgroundSize:"cover",...r?{backgroundColor:n,maskImage:`url(${e})`,WebkitMaskImage:`url(${e})`}:{backgroundColor:"rgba(0,0,0,0)",backgroundImage:`url(${e})`}}),us=o.styled(o.Box,{shouldForwardProp:e=>e!=="icon"&&e!=="maskedIcon"&&e!=="color"&&e!=="isStrokeColor"})(({icon:e,maskedIcon:n,color:r,isStrokeColor:i,theme:s})=>({whiteSpace:"nowrap",display:"block",width:s.spacing(1.5),height:s.spacing(1.5),flexShrink:"0",borderRadius:"50%",position:"relative",border:"2px solid transparent",...e?ds({icon:e,color:r,maskedIcon:n}):cs({color:r,isStrokeColor:i,theme:s})}));function ps({label:e,isStrokeColor:n,color:r="#000",icon:i,maskedIcon:s}){return t.jsxs(o.Box,{component:"li",sx:{display:"flex",alignItems:"center"},children:[t.jsx(us,{className:"marker",mr:1.5,component:"span",icon:i,maskedIcon:s,isStrokeColor:n,color:r}),t.jsx(ot,{title:e,visible:!0,typographyProps:{variant:"overline",my:.75}})]})}const De=6,We={0:12,1:9,2:6,3:3},gs=o.styled(o.Box,{shouldForwardProp:e=>e!=="index"})(({index:e=0,theme:n})=>{const r=n.spacing(We[e]),i=n.spacing(We[e]);return{border:`solid 1px ${n.palette.divider}`,backgroundColor:n.palette.background.default,borderRadius:"50%",position:"absolute",right:0,bottom:0,width:r,height:i}}),hs=o.styled(o.Box)(({theme:{spacing:e}})=>({display:"flex",justifyContent:"flex-end",flexShrink:0,position:"relative",width:e(We[0]),height:e(We[0])})),fs=o.styled(o.Box)(({theme:{spacing:e}})=>({display:"flex",gap:e(1),alignItems:"stretch",justifyContent:"stretch",padding:e(2,0)})),xs=o.styled(o.Box)(()=>({display:"flex",flexDirection:"column",justifyContent:"space-around",gap:1,flexGrow:1,flexShrink:1}));function dn({legend:e}){const n=X.useIntl(),r=j.useImperativeIntl(n),i=e.showMinMax??!0,{min:s,max:l,error:a}=ms(e),[p,c]=a?[0,0]:ys(s,l);return t.jsxs(fs,{"data-testid":"proportion-legend",children:[t.jsx(hs,{children:[...Array(4)].map((g,h)=>t.jsx(gs,{index:h,component:"span"},h))}),t.jsx(xs,{children:a?t.jsx(o.Box,{maxWidth:240,children:t.jsx(j.Typography,{variant:"overline",children:"You need to specify valid numbers for the labels property"})}):t.jsxs(t.Fragment,{children:[t.jsxs(j.Typography,{variant:"overline",color:"textSecondary",children:[i&&r.formatMessage({id:"c4r.widgets.legend.max"})+": ",n.formatNumber(l,{maximumSignificantDigits:De})]}),t.jsx(j.Typography,{variant:"overline",color:"textSecondary",children:n.formatNumber(c,{maximumSignificantDigits:De})}),t.jsx(j.Typography,{variant:"overline",color:"textSecondary",children:n.formatNumber(p,{maximumSignificantDigits:De})}),t.jsxs(j.Typography,{variant:"overline",color:"textSecondary",children:[i&&r.formatMessage({id:"c4r.widgets.legend.min"})+": ",n.formatNumber(s,{maximumSignificantDigits:De})]})]})})]})}function un({labels:e}){let n=e==null?void 0:e[e.length-1],r=e==null?void 0:e[0];return Number.isFinite(r)||(r=parseInt(String(r),10)),Number.isFinite(n)||(n=parseInt(String(n),10)),[r,n]}function ms(e){let n=!1;const[r,i]=un(e);return(Number.isNaN(r)||Number.isNaN(i))&&(n=!0),{min:r,max:i,error:n}}function ys(e,n){const r=(n-e)/3;return[e+r,n-r]}function pn({legend:e}){const{labels:n=[],icons:r=[]}=e;return t.jsx(an,{"data-testid":"icon-legend",children:n.map((i,s)=>t.jsxs(rs,{children:[t.jsx(is,{children:t.jsx("img",{src:r[s],alt:i,width:"auto",height:j.ICON_SIZE_MEDIUM})}),t.jsx(ot,{visible:!0,title:i,typographyProps:{variant:"overline",my:.75}})]},i))})}function vs(e){return typeof e[0]=="object"&&"label"in e[0]}function Qe({isContinuous:e=!1,legend:n}){const{labels:r=[],colors:i=[],showMinMax:s=!0}=n,l=Te.getPalette(i,!r.length||e?2:r.length+1),a=vs(r),p=a?r.map(({value:y})=>y):r,c=a?r.map(({label:y})=>y):r,[g,h]=un({labels:p}),d=Number.isNaN(g)||Number.isNaN(h);let v=c[c.length-1],f=c[0];return!e&&s&&(f="< "+f,v="≥ "+v),t.jsx(o.Box,{py:2,"data-testid":"ramp-legend",children:d?t.jsx(o.Box,{maxWidth:240,children:t.jsx(j.Typography,{variant:"overline",children:"You need to specify valid numbers for the labels property"})}):t.jsxs(t.Fragment,{children:[t.jsx(o.Box,{display:"flex",pb:1,children:e?t.jsx(js,{"data-testid":"step-continuous",palette:l}):t.jsx(bs,{palette:l,labels:c,max:v,min:f})}),t.jsxs(o.Box,{display:"flex",justifyContent:"space-between",children:[t.jsx(j.Typography,{variant:"overlineDelicate",color:"textSecondary",children:f}),t.jsx(j.Typography,{variant:"overlineDelicate",color:"textSecondary",children:v})]})]})})}const js=o.styled(o.Box,{shouldForwardProp:e=>e!=="palette"})(({palette:e,theme:n})=>({display:"block",flexGrow:1,height:n.spacing(1),borderRadius:n.spacing(.5),background:`linear-gradient(to right, ${e.join()})`})),ws=o.styled(o.Box,{shouldForwardProp:e=>e!=="color"})(({color:e,theme:n})=>({display:"block",flexGrow:1,height:n.spacing(1),backgroundColor:e,"&:first-of-type":{borderRadius:n.spacing(.5,0,0,.5)},"&:last-of-type":{borderRadius:n.spacing(0,.5,.5,0)}}));function bs({labels:e=[],palette:n=[],max:r,min:i}){const s=e.length?[i,...e]:[i,r];return t.jsx(t.Fragment,{children:s.map((l,a)=>{const p=a===0?i:a===s.length-1?r:`${l} - ${s[a+1]}`;return t.jsx(o.Tooltip,{title:p,children:t.jsx(ws,{"data-testid":"step-discontinuous",color:n[a]})},a)})})}const Ss={[ae.CATEGORY]:cn,[ae.PROPORTION]:dn,[ae.ICON]:pn,[ae.BINS]:e=>t.jsx(Qe,{...e,isContinuous:!1}),[ae.CONTINUOUS_RAMP]:e=>t.jsx(Qe,{...e,isContinuous:!0})};function Is({legend:e}){const n=X.useIntl(),r=j.useImperativeIntl(n);return e.select||!e.type?null:t.jsxs(j.Typography,{variant:"body2",color:"textSecondary",component:"p",children:[e.type," ",r.formatMessage({id:"c4r.widgets.legend.notSupported"}),"."]})}function ks(e){return e.type===ae.PROPORTION?"c4r.widgets.legend.subtitles.proportion":e.type===ae.ICON||e.customMarkers?"c4r.widgets.legend.subtitles.icon":e.isStrokeColor?"c4r.widgets.legend.subtitles.strokeColor":"c4r.widgets.legend.subtitles.color"}function Ts({layer:e,legend:n,customLegendTypes:r,onChangeSelection:i}){var h;const s=X.useIntl(),l=j.useImperativeIntl(s),a=n.type,c=Ss[a]??r[a]??Is,g=((h=n.select)==null?void 0:h.options)??[];return t.jsxs(o.Box,{component:"li","data-testid":"legend-layer-variable",px:2,children:[n.attr?t.jsxs(o.Box,{pb:1,children:[t.jsx(j.Typography,{gutterBottom:!0,variant:"overlineDelicate",color:"textSecondary",component:"p",children:l.formatMessage({id:ks(n)})}),t.jsx(j.Typography,{variant:"caption",component:"p",children:n.attr})]}):null,n.select?t.jsxs(o.Box,{pb:1,children:[t.jsx(j.Typography,{variant:"caption",weight:"medium",component:"p",children:n.select.label}),t.jsx(o.Select,{"data-testid":"legend-layer-variable-select",name:"legend-select",value:n.select.value,renderValue:d=>{var v;return((v=g.find(f=>f.value===d))==null?void 0:v.label)??d},onChange:d=>i(d.target.value),MenuProps:{transformOrigin:{vertical:"bottom",horizontal:"left"},anchorOrigin:{vertical:"top",horizontal:"left"},PaperProps:{style:{maxHeight:240}}},children:g.map(d=>t.jsx(o.MenuItem,{value:d.value,children:t.jsx(o.ListItemText,{primary:d.label})},d.value))})]}):null,t.jsx(c,{layer:e,legend:n})]})}const Ms={};function gn(e){return e?Array.isArray(e)?e.every(n=>gn(n)):!e.select&&!e.type:!0}function Mt({customLegendTypes:e=Ms,layer:n,onChangeCollapsed:r,onChangeOpacity:i,onChangeVisibility:s,onChangeSelection:l,maxZoom:a=21,minZoom:p=0,currentZoom:c=0}){const g=X.useIntl(),h=j.useImperativeIntl(g),d=u.useRef(null),[v,f]=u.useState(!1),y=n.id,m=n.title,x=n.visible??!0,S=n.switchable??!0,b=n.collapsed??!1,I=(n.collapsible??!0)&&!gn(n.legend),k=n.opacity??1,w=n.showOpacityControl??!0,C=x&&!b,A=C?t.jsx(kn,{}):t.jsx(In,{}),D=(n==null?void 0:n.minZoom)!==void 0||(n==null?void 0:n.maxZoom)!==void 0,B=n.minZoom??p,P=n.maxZoom??a,L=D&&(B>p||P<a),N=c<B||c>P,V=Cs({intl:h,minZoom:p,maxZoom:a,layerMinZoom:B,layerMaxZoom:P}),_=n.helperText??(L?V:""),T=u.useMemo(()=>n.legend?Array.isArray(n.legend)?n.legend:[n.legend]:[],[n.legend]);return n.legend?t.jsxs(ss,{"data-testid":"legend-layer","aria-label":m,children:[t.jsxs(es,{ref:d,children:[I&&t.jsx(o.IconButton,{size:"small","aria-label":h.formatMessage({id:b?"c4r.widgets.legend.expand":"c4r.widgets.legend.collapse"}),disabled:!x,onClick:()=>r({id:y,collapsed:!b}),children:A}),t.jsxs(ls,{children:[t.jsx(ot,{visible:x,title:m??""}),L&&t.jsx(o.Tooltip,{title:h.formatMessage({id:"c4r.widgets.legend.zoomLevelTooltip"}),children:t.jsxs(j.Typography,{color:x?"textPrimary":"textSecondary",variant:"caption",component:"p",children:[h.formatMessage({id:"c4r.widgets.legend.zoomLevel"})," ",n.minZoom," - ",n.maxZoom]})})]}),w&&x&&!b&&t.jsx(as,{menuRef:d,open:v,toggleOpen:f,opacity:k,onChange:O=>i({id:y,opacity:O})}),S&&t.jsx(o.Tooltip,{title:h.formatMessage({id:x?"c4r.widgets.legend.hideLayer":"c4r.widgets.legend.showLayer"}),children:t.jsx(o.IconButton,{size:"small",onClick:()=>s({id:y,collapsed:x?b:!1,visible:!x}),children:x?t.jsx(bn,{}):t.jsx(Sn,{})})})]}),t.jsxs(o.Collapse,{unmountOnExit:!0,timeout:100,in:C,children:[t.jsx(os,{"data-testid":"legend-layer-variable-list",opacity:N?.5:1,children:T.map((O,M)=>t.jsx(Ts,{legend:O,layer:n,customLegendTypes:e,onChangeSelection:$=>l({id:y,index:M,selection:$})},`${O.type}-${M}`))}),_&&t.jsx(j.Typography,{variant:"caption",color:"textSecondary",component:"div",p:2,children:t.jsx("div",{dangerouslySetInnerHTML:{__html:_}})})]})]}):null}function Cs({intl:e,minZoom:n,maxZoom:r,layerMinZoom:i,layerMaxZoom:s}){const l=e.formatMessage({id:"c4r.widgets.legend.and"}),a=e.formatMessage({id:"c4r.widgets.legend.lowerThan"}),p=e.formatMessage({id:"c4r.widgets.legend.greaterThan"}),c=e.formatMessage({id:"c4r.widgets.legend.zoomNote"}),g=s<r?`${a} ${s}`:"",h=i>n?`${p} ${i}`:"",d=[g,h].filter(Boolean).join(` ${l} `);return d?`${c} ${d}`:""}const As={},ke=()=>{},Es=[];function Bs({customLegendTypes:e=As,layers:n=Es,collapsed:r=!1,onChangeCollapsed:i=ke,onChangeVisibility:s=ke,onChangeOpacity:l=ke,onChangeLegendRowCollapsed:a=ke,onChangeSelection:p=ke,title:c="Layers",maxZoom:g=20,minZoom:h=0,currentZoom:d,isMobile:v,sx:f}){const y=X.useIntl(),m=j.useImperativeIntl(y),x=t.jsxs(Qi,{collapsed:r,children:[t.jsx(j.Typography,{variant:"caption",flexGrow:1,children:c}),t.jsx(o.Tooltip,{title:m.formatMessage({id:"c4r.widgets.legend.close"}),children:t.jsx(o.IconButton,{size:"small",onClick:()=>i(!0),children:t.jsx(jn,{})})})]}),S=t.jsx(o.Tooltip,{title:m.formatMessage({id:"c4r.widgets.legend.open"}),children:t.jsx(o.IconButton,{"aria-label":c,onClick:()=>i(!1),children:t.jsx(wn,{})})});return t.jsx(Ji,{sx:f,elevation:3,collapsed:r||!!v,children:v?t.jsxs(t.Fragment,{children:[S,t.jsxs(o.Drawer,{anchor:"bottom",open:!r,onClose:()=>i(!0),children:[x,t.jsx(Tt,{children:n.map(b=>t.jsx(Mt,{layer:b,onChangeCollapsed:a,onChangeOpacity:l,onChangeVisibility:s,onChangeSelection:p,maxZoom:g,minZoom:h,currentZoom:d,customLegendTypes:e},b.id))})]})]}):t.jsxs(t.Fragment,{children:[r?S:x,t.jsx(Tt,{width:r?0:void 0,children:t.jsx(o.Collapse,{unmountOnExit:!0,in:!r,timeout:500,children:n.map(b=>t.jsx(Mt,{layer:b,onChangeCollapsed:a,onChangeOpacity:l,onChangeVisibility:s,onChangeSelection:p,maxZoom:g,minZoom:h,currentZoom:d,customLegendTypes:e},b.id))})})]})})}function Ct({color:e=void 0,children:n}){return n?t.jsx(o.Box,{mt:.5,children:t.jsx(j.Typography,{component:"div",variant:"caption",color:e??"inherit",style:{fontWeight:"normal"},children:n})}):t.jsx(o.Box,{mt:-1})}function Ps({title:e="No data available",body:n="There are no results for the combination of filters applied to your data. Try tweaking your filters, or zoom and pan the map to adjust the Map View.",severity:r=void 0,...i}){return r?t.jsx(Tn.Alert,{title:e,severity:r,...i,children:t.jsx(Ct,{children:n})}):t.jsxs(o.Box,{...i,children:[e&&t.jsx(j.Typography,{variant:"body2",children:e}),t.jsx(Ct,{color:"textSecondary",children:n})]})}const Ls=o.styled(o.Box,{shouldForwardProp:e=>e!=="margin"})(({theme:e,margin:n})=>({margin:0,position:"relative",maxWidth:"100%",padding:n??e.spacing(2,2.5)})),Ds=o.styled(o.LinearProgress)(({theme:e})=>({position:"absolute",top:0,left:0,width:"100%",height:e.spacing(.25)})),Ns=o.styled(o.Grid,{shouldForwardProp:e=>e!=="expanded"})(({theme:e,expanded:n=!0})=>({display:"flex",flexDirection:"row",alignItems:"flex-start",justifyContent:"space-between",width:"100%",...n?{minHeight:e.spacing(3)}:{height:e.spacing(3)},padding:0})),$s=o.styled(o.Button,{shouldForwardProp:e=>e!=="expandable"})(({theme:e,expandable:n=!0})=>({flex:1,padding:0,alignItems:"flex-start",justifyContent:"flex-start",height:"auto",minHeight:"auto",marginBottom:e.spacing(1),cursor:n?"pointer":"default","& .MuiButton-startIcon":{marginTop:"3px",marginRight:e.spacing(1)},"&:hover":{background:"none"}})),hn=({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"center",width:e.spacing(3),height:e.spacing(3),color:e.palette.text.secondary}),Os=o.styled(fe.ExpandLess)(({theme:e})=>hn({theme:e})),Rs=o.styled(fe.ExpandMore)(({theme:e})=>hn({theme:e})),Fs=o.styled(o.Typography,{shouldForwardProp:e=>e!=="expanded"})(({expanded:e=!0})=>({wordBreak:"break-word",overflow:"hidden",...e&&{display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical"},...!e&&{whiteSpace:"nowrap",textOverflow:"ellipsis"}})),Ws=o.styled(o.Grid)(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1),marginRight:e.spacing(-.5),marginLeft:e.spacing(1)})),At=o.styled(o.IconButton)(({theme:e})=>({color:e.palette.text.secondary})),_s=o.styled(o.Menu)(({theme:e})=>({".MuiPaper-root":{marginTop:e.spacing(5),maxHeight:e.spacing(21),minWidth:e.spacing(16)}})),Et=[],Gs=t.jsx(fe.MoreVert,{});function Hs({title:e,actions:n=Et,options:r=Et,optionsIcon:i=Gs,children:s,contentProps:l,disabled:a=!1,expandable:p=!0,expanded:c=!0,onExpandedChange:g,footer:h,headerItems:d,isLoading:v=!1,margin:f}){const y=u.createRef(),[m,x]=u.useState(!0),S=c!==void 0&&g!==void 0,b=p!==!1?S?c:m:!0,I=S?g:x,[k,w]=u.useState(null),C=!!k,A=()=>{p&&I(!b)},D=N=>w(N.currentTarget),B=()=>w(null);function P(N){N&&N(),B()}const L=N=>t.jsx(At,{"aria-label":N.label,onClick:N.action,size:"small",children:N.icon},N.id);return a?s?t.jsx(t.Fragment,{children:s}):null:t.jsxs(Ls,{margin:f,component:"section","aria-label":e,children:[v?t.jsx(Ds,{}):null,t.jsxs(Ns,{container:!0,expanded:c,children:[t.jsx($s,{expandable:p,startIcon:p&&t.jsx(o.Icon,{children:b?t.jsx(Os,{}):t.jsx(Rs,{})}),onClick:A,tabIndex:p?0:-1,children:t.jsx(o.Tooltip,{title:e,children:t.jsx(Fs,{expanded:c,align:"left",variant:"subtitle1",children:e})})}),t.jsxs(Ws,{item:!0,children:[d,n.length>0&&n.map(N=>N.tooltip?t.jsx(o.Tooltip,{title:N.tooltip.text,placement:N.tooltip.placement??"top",children:L(N)},N.id):L(N)),r.length>0&&t.jsxs(t.Fragment,{children:[t.jsx(At,{"aria-label":"options","aria-controls":"options-menu","aria-haspopup":"true",onClick:D,size:"small",children:i}),t.jsx(_s,{id:"options-menu",elevation:8,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},anchorEl:k,keepMounted:!0,open:C,onClose:B,children:r.map(N=>t.jsx(o.MenuItem,{selected:N.selected,onClick:()=>P(N.action),children:N.name},N.id))})]})]})]}),t.jsx(o.Collapse,{ref:y,in:b,timeout:"auto",unmountOnExit:!0,children:t.jsxs(o.Box,{...l,children:[t.jsx(o.Box,{pt:1,children:s}),h??t.jsx(o.Box,{children:h})]})})]})}exports.BarWidgetUI=Rn;exports.CategoryWidgetUI=Kn;exports.ComparativeCategoryWidgetUI=ki;exports.ComparativeFormulaWidgetUI=Di;exports.ComparativePieWidgetUI=_i;exports.FeatureSelectionUIDropdown=rn;exports.FeatureSelectionUIGeometryChips=sn;exports.FeatureSelectionUIToggleButton=on;exports.FeatureSelectionWidgetUI=Xi;exports.FormulaWidgetUI=Qn;exports.GroupDateTypes=le;exports.HistogramWidgetUI=ao;exports.LEGEND_TYPES=ae;exports.LegendCategories=cn;exports.LegendIcon=pn;exports.LegendProportion=dn;exports.LegendRamp=Qe;exports.LegendWidgetUI=Bs;exports.NoDataAlert=Ps;exports.PieWidgetUI=Oo;exports.RangeWidgetUI=Uo;exports.ScatterPlotWidgetUI=nr;exports.TIME_SERIES_CHART_TYPES=Ge;exports.TableWidgetUI=gr;exports.TimeSeriesProvider=Vt;exports.TimeSeriesWidgetUI=oi;exports.WrapperWidgetUI=Hs;exports.useTimeSeriesContext=He;exports.useTimeSeriesInteractivity=Ut;
|
package/dist/widgets/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { jsxs as w, Fragment as
|
|
2
|
-
import Un, { useMemo as F, useState as _, useEffect as G, useCallback as oe, useRef as
|
|
1
|
+
import { jsxs as w, Fragment as ie, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import Un, { useMemo as F, useState as _, useEffect as G, useCallback as oe, useRef as re, createContext as qn, useContext as Xn, useLayoutEffect as an, createRef as Kn } from "react";
|
|
3
3
|
import { useTheme as de, styled as y, Box as S, Skeleton as H, Grid as ae, Link as ve, darken as mt, Button as De, Divider as yt, TextField as rt, InputAdornment as vt, Checkbox as ln, Tooltip as pe, IconButton as me, Slider as wt, debounce as Zn, TableCell as xt, TableContainer as sn, Table as cn, TableHead as dn, TableRow as Je, TableBody as un, TableSortLabel as Jn, TablePagination as Qn, Menu as bt, MenuItem as Pe, SvgIcon as Ye, Typography as $e, lighten as ei, ClickAwayListener as ti, ToggleButton as ni, capitalize as pn, List as ii, ListItem as ri, Chip as oi, Paper as gn, Popover as ai, Select as li, ListItemText as si, Collapse as kt, Drawer as ci, LinearProgress as di, Icon as ui } from "@mui/material";
|
|
4
4
|
import { useIntl as le } from "react-intl";
|
|
5
|
-
import { d as pi, u as se, T as z, S as B, B as St, a as gi, b as ut } from "../TablePaginationActions-
|
|
5
|
+
import { d as pi, u as se, T as z, S as B, B as St, a as gi, b as ut } from "../TablePaginationActions-C9YCSB32.js";
|
|
6
6
|
import hi from "echarts-for-react";
|
|
7
7
|
import { S as Dt, G as fi, O as mi } from "../search-icon-8Q4AttLX.js";
|
|
8
8
|
import { ChevronLeft as yi, ChevronRight as vi, ErrorOutline as wi, Cancel as xi, ExpandLess as bi, ExpandMore as ki, MoreVert as Si } from "@mui/icons-material";
|
|
@@ -15,7 +15,7 @@ import Li from "@mui/icons-material/VisibilityOutlined";
|
|
|
15
15
|
import $i from "@mui/icons-material/VisibilityOffOutlined";
|
|
16
16
|
import Di from "@mui/icons-material/ExpandMore";
|
|
17
17
|
import Pi from "@mui/icons-material/ExpandLess";
|
|
18
|
-
import { A as Oi } from "../Alert-
|
|
18
|
+
import { A as Oi } from "../Alert-CU0-7Oca.js";
|
|
19
19
|
function mn() {
|
|
20
20
|
let e = !1;
|
|
21
21
|
return window.PointerEvent && "maxTouchPoints" in navigator ? navigator.maxTouchPoints > 0 && (e = !0) : (window.matchMedia && window.matchMedia("(any-pointer:coarse)").matches || window.TouchEvent || "ontouchstart" in window) && (e = !0), e;
|
|
@@ -192,7 +192,7 @@ const ot = 240, yn = y(S)(({ theme: e }) => ({
|
|
|
192
192
|
backgroundColor: e.palette.grey[100]
|
|
193
193
|
}));
|
|
194
194
|
function Hi({ height: e }) {
|
|
195
|
-
return /* @__PURE__ */ w(
|
|
195
|
+
return /* @__PURE__ */ w(ie, { children: [
|
|
196
196
|
/* @__PURE__ */ n(S, { mb: 2, children: /* @__PURE__ */ n(H, { width: 48, height: 8 }) }),
|
|
197
197
|
/* @__PURE__ */ w(yn, { style: { height: e || ot }, children: [
|
|
198
198
|
/* @__PURE__ */ n(Fe, { variant: "rectangular", height: "20%" }),
|
|
@@ -543,7 +543,7 @@ const wn = y(ae)(({ theme: e }) => ({
|
|
|
543
543
|
})), Ki = y(H)(({ theme: e }) => ({
|
|
544
544
|
marginTop: e.spacing(1.25),
|
|
545
545
|
marginBottom: e.spacing(1.75)
|
|
546
|
-
})), Zi = (e) => e % 2 === 1, bn = () => /* @__PURE__ */ w(
|
|
546
|
+
})), Zi = (e) => e % 2 === 1, bn = () => /* @__PURE__ */ w(ie, { children: [
|
|
547
547
|
/* @__PURE__ */ n(H, { width: 48, height: 8 }),
|
|
548
548
|
/* @__PURE__ */ n(wn, { container: !0, mt: 3, children: [...Array(6)].map((e, t) => /* @__PURE__ */ w(xn, { container: !0, spacing: 1, children: [
|
|
549
549
|
/* @__PURE__ */ w(ae, { container: !0, item: !0, direction: "row", justifyContent: "space-between", children: [
|
|
@@ -554,7 +554,7 @@ const wn = y(ae)(({ theme: e }) => ({
|
|
|
554
554
|
] }, t)) })
|
|
555
555
|
] });
|
|
556
556
|
function kn(e) {
|
|
557
|
-
const t =
|
|
557
|
+
const t = re();
|
|
558
558
|
return G(() => {
|
|
559
559
|
t.current = e;
|
|
560
560
|
}), t.current;
|
|
@@ -620,7 +620,7 @@ function cs({
|
|
|
620
620
|
}) {
|
|
621
621
|
const [c, v] = _([]), [g, m] = _(1), [f, h] = _(!1), [k, b] = _(""), [M, I] = _([]), [x, A] = _(
|
|
622
622
|
[]
|
|
623
|
-
), [E, O] = _([]), $ =
|
|
623
|
+
), [E, O] = _([]), $ = re(null), D = re(), P = kn(E), W = re([]), { showSkeleton: J } = ke(!!p), U = le(), C = se(U);
|
|
624
624
|
function N(L) {
|
|
625
625
|
return c.reduce((Z, ee) => (L.includes(ee.name) && Z.push(ee.name), Z), []);
|
|
626
626
|
}
|
|
@@ -747,7 +747,7 @@ function cs({
|
|
|
747
747
|
data: L,
|
|
748
748
|
onCategoryClick: Z
|
|
749
749
|
}) {
|
|
750
|
-
const ee = t(L.value ?? 0), [ge, Ae] = _(!1), be =
|
|
750
|
+
const ee = t(L.value ?? 0), [ge, Ae] = _(!1), be = re(null), at = () => {
|
|
751
751
|
var Lt, $t;
|
|
752
752
|
const lt = (((Lt = be == null ? void 0 : be.current) == null ? void 0 : Lt.scrollWidth) ?? 0) > ((($t = be == null ? void 0 : be.current) == null ? void 0 : $t.clientWidth) ?? 0);
|
|
753
753
|
Ae(lt);
|
|
@@ -937,7 +937,7 @@ function ds({
|
|
|
937
937
|
animation: i = !0,
|
|
938
938
|
isLoading: r = !1
|
|
939
939
|
}) {
|
|
940
|
-
const [o, a] = _(Ge), l =
|
|
940
|
+
const [o, a] = _(Ge), l = re(null), d = kn(o), s = re(d), { showSkeleton: u } = ke(!!r);
|
|
941
941
|
G(() => (typeof e == "number" && i ? pt({
|
|
942
942
|
start: s.current || 0,
|
|
943
943
|
end: e,
|
|
@@ -1059,7 +1059,7 @@ function ct(e, t, i) {
|
|
|
1059
1059
|
};
|
|
1060
1060
|
}
|
|
1061
1061
|
function ar({ height: e }) {
|
|
1062
|
-
return /* @__PURE__ */ w(
|
|
1062
|
+
return /* @__PURE__ */ w(ie, { children: [
|
|
1063
1063
|
/* @__PURE__ */ n(S, { mb: 2, children: /* @__PURE__ */ n(H, { width: 48, height: 8 }) }),
|
|
1064
1064
|
/* @__PURE__ */ w(vn, { style: { height: e ?? ot }, children: [
|
|
1065
1065
|
/* @__PURE__ */ n(fe, { variant: "rectangular", height: "20%" }),
|
|
@@ -1544,7 +1544,7 @@ function In({
|
|
|
1544
1544
|
onCategoryClick: i
|
|
1545
1545
|
}) {
|
|
1546
1546
|
var M, I;
|
|
1547
|
-
const r = de(), [o, a] = _(!1), [l, d] = _(0), [s, u] = _(void 0), p =
|
|
1547
|
+
const r = de(), [o, a] = _(!1), [l, d] = _(0), [s, u] = _(void 0), p = re(null), c = re(null), v = re(null), g = le(), m = se(g);
|
|
1548
1548
|
function f() {
|
|
1549
1549
|
d(l + 1);
|
|
1550
1550
|
}
|
|
@@ -1794,7 +1794,7 @@ function ps({
|
|
|
1794
1794
|
}, J = (U) => {
|
|
1795
1795
|
U.key === "Enter" && W();
|
|
1796
1796
|
};
|
|
1797
|
-
return b ? /* @__PURE__ */ n(Mn, { height: a }) : /* @__PURE__ */ w(
|
|
1797
|
+
return b ? /* @__PURE__ */ n(Mn, { height: a }) : /* @__PURE__ */ w(ie, { children: [
|
|
1798
1798
|
p && /* @__PURE__ */ w(Wr, { container: !0, children: [
|
|
1799
1799
|
/* @__PURE__ */ n(z, { variant: "caption", color: "textSecondary", children: c.length ? I.formatMessage(
|
|
1800
1800
|
{ id: "c4r.widgets.pie.selectedItems" },
|
|
@@ -2162,7 +2162,7 @@ function hs({
|
|
|
2162
2162
|
tooltipFormatter: a = io,
|
|
2163
2163
|
isLoading: l
|
|
2164
2164
|
}) {
|
|
2165
|
-
const d = de(), s =
|
|
2165
|
+
const d = de(), s = re(), [u, p] = _({
|
|
2166
2166
|
series: []
|
|
2167
2167
|
}), { showSkeleton: c } = ke(!!l);
|
|
2168
2168
|
return G(() => {
|
|
@@ -2228,7 +2228,7 @@ function ao({
|
|
|
2228
2228
|
pagination: i,
|
|
2229
2229
|
rowsPerPage: r
|
|
2230
2230
|
}) {
|
|
2231
|
-
return /* @__PURE__ */ w(
|
|
2231
|
+
return /* @__PURE__ */ w(ie, { children: [
|
|
2232
2232
|
/* @__PURE__ */ n(oo, { style: e, children: /* @__PURE__ */ w(cn, { "aria-label": "skeleton table", size: t ? "small" : "medium", children: [
|
|
2233
2233
|
/* @__PURE__ */ n(dn, { children: /* @__PURE__ */ w(Je, { children: [
|
|
2234
2234
|
/* @__PURE__ */ n(Ue, { rows: 1, width: 8 }),
|
|
@@ -2300,7 +2300,7 @@ function fs({
|
|
|
2300
2300
|
lastPageTooltip: I
|
|
2301
2301
|
}) {
|
|
2302
2302
|
var U;
|
|
2303
|
-
const x =
|
|
2303
|
+
const x = re(null), A = le(), E = se(A), { showSkeleton: O } = ke(!!M);
|
|
2304
2304
|
function $({
|
|
2305
2305
|
from: C,
|
|
2306
2306
|
to: N,
|
|
@@ -2336,7 +2336,7 @@ function fs({
|
|
|
2336
2336
|
dense: b,
|
|
2337
2337
|
pagination: d
|
|
2338
2338
|
}
|
|
2339
|
-
) : /* @__PURE__ */ w(
|
|
2339
|
+
) : /* @__PURE__ */ w(ie, { children: [
|
|
2340
2340
|
/* @__PURE__ */ n(sn, { style: J, children: /* @__PURE__ */ w(cn, { stickyHeader: !0, size: b ? "small" : "medium", children: [
|
|
2341
2341
|
/* @__PURE__ */ n(
|
|
2342
2342
|
ho,
|
|
@@ -3179,7 +3179,7 @@ function No({
|
|
|
3179
3179
|
data: e,
|
|
3180
3180
|
stepSize: t
|
|
3181
3181
|
}) {
|
|
3182
|
-
const [i, r] = _(null), [o, a] = _(1), l =
|
|
3182
|
+
const [i, r] = _(null), [o, a] = _(1), l = re({ animationFrameId: null, timeoutId: null }), {
|
|
3183
3183
|
isPlaying: d,
|
|
3184
3184
|
isPaused: s,
|
|
3185
3185
|
timeWindow: u,
|
|
@@ -3240,7 +3240,7 @@ function No({
|
|
|
3240
3240
|
}, M = (I) => {
|
|
3241
3241
|
a(I), b();
|
|
3242
3242
|
};
|
|
3243
|
-
return /* @__PURE__ */ w(
|
|
3243
|
+
return /* @__PURE__ */ w(ie, { children: [
|
|
3244
3244
|
/* @__PURE__ */ n(
|
|
3245
3245
|
me,
|
|
3246
3246
|
{
|
|
@@ -3339,7 +3339,7 @@ function Ho() {
|
|
|
3339
3339
|
) });
|
|
3340
3340
|
}
|
|
3341
3341
|
function Yo(e, t = []) {
|
|
3342
|
-
const i =
|
|
3342
|
+
const i = re(!1);
|
|
3343
3343
|
G(() => {
|
|
3344
3344
|
i.current ? e() : i.current = !0;
|
|
3345
3345
|
}, t);
|
|
@@ -3447,7 +3447,7 @@ function Pn({
|
|
|
3447
3447
|
/* @__PURE__ */ n(Zo, { flex: 1, children: r })
|
|
3448
3448
|
] }),
|
|
3449
3449
|
a
|
|
3450
|
-
] }) : /* @__PURE__ */ w(
|
|
3450
|
+
] }) : /* @__PURE__ */ w(ie, { children: [
|
|
3451
3451
|
/* @__PURE__ */ n(S, { pb: 1.5, flex: 1, children: r }),
|
|
3452
3452
|
a
|
|
3453
3453
|
] })
|
|
@@ -3563,7 +3563,7 @@ function ms({
|
|
|
3563
3563
|
showLegend: P,
|
|
3564
3564
|
yAxisType: W = "dense"
|
|
3565
3565
|
}) {
|
|
3566
|
-
const J =
|
|
3566
|
+
const J = re([]), U = le(), { showSkeleton: C } = ke(!!$), N = oe(
|
|
3567
3567
|
(T) => {
|
|
3568
3568
|
var R, q;
|
|
3569
3569
|
if (T.length === 2) {
|
|
@@ -3714,7 +3714,7 @@ function oa({
|
|
|
3714
3714
|
}
|
|
3715
3715
|
},
|
|
3716
3716
|
[h, f]
|
|
3717
|
-
), R = !!(k ?? W.length > 1), q = /* @__PURE__ */ w(
|
|
3717
|
+
), R = !!(k ?? W.length > 1), q = /* @__PURE__ */ w(ie, { children: [
|
|
3718
3718
|
/* @__PURE__ */ n(S, { children: /* @__PURE__ */ n(z, { color: "textSecondary", variant: "caption", children: J ?? "-" }) }),
|
|
3719
3719
|
g && U && /* @__PURE__ */ n(
|
|
3720
3720
|
ve,
|
|
@@ -3902,7 +3902,7 @@ function ya(e, t, i, r, o) {
|
|
|
3902
3902
|
}
|
|
3903
3903
|
const va = 500;
|
|
3904
3904
|
function wa(e, t = {}) {
|
|
3905
|
-
const { disabled: i, duration: r, animateOnMount: o, initialValue: a = 0 } = t, l =
|
|
3905
|
+
const { disabled: i, duration: r, animateOnMount: o, initialValue: a = 0 } = t, l = re(null), [d, s] = _(
|
|
3906
3906
|
() => o ? a : e
|
|
3907
3907
|
);
|
|
3908
3908
|
return G(() => (i ? s(e) : pt({
|
|
@@ -4171,7 +4171,7 @@ function ys({
|
|
|
4171
4171
|
}
|
|
4172
4172
|
) }) : null,
|
|
4173
4173
|
/* @__PURE__ */ w(la, { children: [
|
|
4174
|
-
R.length === 0 ? /* @__PURE__ */ w(
|
|
4174
|
+
R.length === 0 ? /* @__PURE__ */ w(ie, { children: [
|
|
4175
4175
|
/* @__PURE__ */ n(z, { variant: "body2", children: D.formatMessage({
|
|
4176
4176
|
id: "c4r.widgets.category.noResults"
|
|
4177
4177
|
}) }),
|
|
@@ -4336,7 +4336,7 @@ function ws({
|
|
|
4336
4336
|
onCategorySelected: u = Na,
|
|
4337
4337
|
isLoading: p = !1
|
|
4338
4338
|
}) {
|
|
4339
|
-
const c = de(), v =
|
|
4339
|
+
const c = de(), v = re(), g = F(() => t.map(
|
|
4340
4340
|
(k, b) => Wa(k, r[b], i[b], c, s)
|
|
4341
4341
|
), [t, r, i, c, s]), m = F(() => {
|
|
4342
4342
|
const k = g.length > 1;
|
|
@@ -4573,7 +4573,7 @@ function Ga({
|
|
|
4573
4573
|
M.id
|
|
4574
4574
|
);
|
|
4575
4575
|
}
|
|
4576
|
-
return /* @__PURE__ */ w(
|
|
4576
|
+
return /* @__PURE__ */ w(ie, { children: [
|
|
4577
4577
|
/* @__PURE__ */ n(pe, { title: l, placement: a, children: /* @__PURE__ */ n(
|
|
4578
4578
|
Ha,
|
|
4579
4579
|
{
|
|
@@ -4884,7 +4884,7 @@ function sl({
|
|
|
4884
4884
|
const u = parseInt(s.target.value || "0"), p = Math.min(Math.max(u, 0), 100);
|
|
4885
4885
|
o(p / 100);
|
|
4886
4886
|
}
|
|
4887
|
-
return /* @__PURE__ */ w(
|
|
4887
|
+
return /* @__PURE__ */ w(ie, { children: [
|
|
4888
4888
|
/* @__PURE__ */ n(
|
|
4889
4889
|
pe,
|
|
4890
4890
|
{
|
|
@@ -4962,7 +4962,7 @@ function Et({
|
|
|
4962
4962
|
visible: t,
|
|
4963
4963
|
typographyProps: i
|
|
4964
4964
|
}) {
|
|
4965
|
-
const r =
|
|
4965
|
+
const r = re(null), [o, a] = _(!1);
|
|
4966
4966
|
an(() => {
|
|
4967
4967
|
if (t && r.current) {
|
|
4968
4968
|
const { offsetWidth: d, scrollWidth: s } = r.current;
|
|
@@ -4997,7 +4997,7 @@ function cl({
|
|
|
4997
4997
|
customMarkers: o,
|
|
4998
4998
|
maskedMarkers: a = !0
|
|
4999
4999
|
} = e, l = fn(i, t.length), d = t.length > dt, s = le(), u = se(s);
|
|
5000
|
-
return /* @__PURE__ */ w(
|
|
5000
|
+
return /* @__PURE__ */ w(ie, { children: [
|
|
5001
5001
|
/* @__PURE__ */ n(_n, { "data-testid": "categories-legend", children: t.slice(0, dt).map((p, c) => /* @__PURE__ */ n(
|
|
5002
5002
|
gl,
|
|
5003
5003
|
{
|
|
@@ -5160,7 +5160,7 @@ function vl({
|
|
|
5160
5160
|
},
|
|
5161
5161
|
p
|
|
5162
5162
|
)) }),
|
|
5163
|
-
/* @__PURE__ */ n(yl, { children: l ? /* @__PURE__ */ n(S, { maxWidth: 240, children: /* @__PURE__ */ n(z, { variant: "overline", children: "You need to specify valid numbers for the labels property" }) }) : /* @__PURE__ */ w(
|
|
5163
|
+
/* @__PURE__ */ n(yl, { children: l ? /* @__PURE__ */ n(S, { maxWidth: 240, children: /* @__PURE__ */ n(z, { variant: "overline", children: "You need to specify valid numbers for the labels property" }) }) : /* @__PURE__ */ w(ie, { children: [
|
|
5164
5164
|
/* @__PURE__ */ w(z, { variant: "overline", color: "textSecondary", children: [
|
|
5165
5165
|
r && i.formatMessage({ id: "c4r.widgets.legend.max" }) + ": ",
|
|
5166
5166
|
t.formatNumber(a, {
|
|
@@ -5231,7 +5231,7 @@ function en({
|
|
|
5231
5231
|
!i.length || e ? 2 : i.length + 1
|
|
5232
5232
|
), l = kl(i), d = l ? i.map(({ value: m }) => m) : i, s = l ? i.map(({ label: m }) => m) : i, [u, p] = zn({ labels: d }), c = Number.isNaN(u) || Number.isNaN(p);
|
|
5233
5233
|
let v = s[s.length - 1], g = s[0];
|
|
5234
|
-
return !e && o && (g = "< " + g, v = "≥ " + v), /* @__PURE__ */ n(S, { py: 2, "data-testid": "ramp-legend", children: c ? /* @__PURE__ */ n(S, { maxWidth: 240, children: /* @__PURE__ */ n(z, { variant: "overline", children: "You need to specify valid numbers for the labels property" }) }) : /* @__PURE__ */ w(
|
|
5234
|
+
return !e && o && (g = "< " + g, v = "≥ " + v), /* @__PURE__ */ n(S, { py: 2, "data-testid": "ramp-legend", children: c ? /* @__PURE__ */ n(S, { maxWidth: 240, children: /* @__PURE__ */ n(z, { variant: "overline", children: "You need to specify valid numbers for the labels property" }) }) : /* @__PURE__ */ w(ie, { children: [
|
|
5235
5235
|
/* @__PURE__ */ n(S, { display: "flex", pb: 1, children: e ? /* @__PURE__ */ n(
|
|
5236
5236
|
Sl,
|
|
5237
5237
|
{
|
|
@@ -5282,7 +5282,7 @@ function Il({
|
|
|
5282
5282
|
min: r
|
|
5283
5283
|
}) {
|
|
5284
5284
|
const o = e.length ? [r, ...e] : [r, i];
|
|
5285
|
-
return /* @__PURE__ */ n(
|
|
5285
|
+
return /* @__PURE__ */ n(ie, { children: o.map((a, l) => {
|
|
5286
5286
|
const d = l === 0 ? r : l === o.length - 1 ? i : `${a} - ${o[l + 1]}`;
|
|
5287
5287
|
return /* @__PURE__ */ n(pe, { title: d, children: /* @__PURE__ */ n(Ml, { "data-testid": "step-discontinuous", color: t[l] }) }, l);
|
|
5288
5288
|
}) });
|
|
@@ -5372,7 +5372,7 @@ function tn({
|
|
|
5372
5372
|
minZoom: d = 0,
|
|
5373
5373
|
currentZoom: s = 0
|
|
5374
5374
|
}) {
|
|
5375
|
-
const u = le(), p = se(u), c =
|
|
5375
|
+
const u = le(), p = se(u), c = re(null), [v, g] = _(!1), m = t.id, f = t.title, h = t.visible ?? !0, k = t.switchable ?? !0, b = t.collapsed ?? !1, M = (t.collapsible ?? !0) && !Hn(t.legend), I = t.opacity ?? 1, x = t.showOpacityControl ?? !0, A = h && !b, E = A ? /* @__PURE__ */ n(Pi, {}) : /* @__PURE__ */ n(Di, {}), O = (t == null ? void 0 : t.minZoom) !== void 0 || (t == null ? void 0 : t.maxZoom) !== void 0, $ = t.minZoom ?? d, D = t.maxZoom ?? l, P = O && ($ > d || D < l), W = s < $ || s > D, J = $l({
|
|
5376
5376
|
intl: p,
|
|
5377
5377
|
minZoom: d,
|
|
5378
5378
|
maxZoom: l,
|
|
@@ -5529,7 +5529,7 @@ function bs({
|
|
|
5529
5529
|
children: /* @__PURE__ */ n(me, { "aria-label": s, onClick: () => r(!1), children: /* @__PURE__ */ n(Ei, {}) })
|
|
5530
5530
|
}
|
|
5531
5531
|
);
|
|
5532
|
-
return /* @__PURE__ */ n(Ja, { sx: g, elevation: 3, collapsed: i || !!v, children: v ? /* @__PURE__ */ w(
|
|
5532
|
+
return /* @__PURE__ */ n(Ja, { sx: g, elevation: 3, collapsed: i || !!v, children: v ? /* @__PURE__ */ w(ie, { children: [
|
|
5533
5533
|
k,
|
|
5534
5534
|
/* @__PURE__ */ w(
|
|
5535
5535
|
ci,
|
|
@@ -5557,7 +5557,7 @@ function bs({
|
|
|
5557
5557
|
]
|
|
5558
5558
|
}
|
|
5559
5559
|
)
|
|
5560
|
-
] }) : /* @__PURE__ */ w(
|
|
5560
|
+
] }) : /* @__PURE__ */ w(ie, { children: [
|
|
5561
5561
|
i ? k : h,
|
|
5562
5562
|
/* @__PURE__ */ n(Qt, { width: i ? 0 : void 0, children: /* @__PURE__ */ n(kt, { unmountOnExit: !0, in: !i, timeout: 500, children: t.map((b) => /* @__PURE__ */ n(
|
|
5563
5563
|
tn,
|
|
@@ -5711,7 +5711,7 @@ function Ss({
|
|
|
5711
5711
|
},
|
|
5712
5712
|
W.id
|
|
5713
5713
|
);
|
|
5714
|
-
return l ? o : /* @__PURE__ */ w(Ol, { margin: g, component: "section", "aria-label": e, children: [
|
|
5714
|
+
return l ? o ? /* @__PURE__ */ n(ie, { children: o }) : null : /* @__PURE__ */ w(Ol, { margin: g, component: "section", "aria-label": e, children: [
|
|
5715
5715
|
v ? /* @__PURE__ */ n(Wl, {}) : null,
|
|
5716
5716
|
/* @__PURE__ */ w(Rl, { container: !0, expanded: s, children: [
|
|
5717
5717
|
/* @__PURE__ */ n(
|
|
@@ -5735,7 +5735,7 @@ function Ss({
|
|
|
5735
5735
|
},
|
|
5736
5736
|
W.id
|
|
5737
5737
|
) : P(W)),
|
|
5738
|
-
i.length > 0 && /* @__PURE__ */ w(
|
|
5738
|
+
i.length > 0 && /* @__PURE__ */ w(ie, { children: [
|
|
5739
5739
|
/* @__PURE__ */ n(
|
|
5740
5740
|
rn,
|
|
5741
5741
|
{
|