@devgateway/dvz-ui-react 1.7.15 → 1.8.0

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/LICENSE CHANGED
@@ -1,9 +1,184 @@
1
- The MIT License (MIT)
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
2
4
 
3
- Copyright © 2025-present Development Gateway
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
4
6
 
5
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
7
+ 1. Definitions.
6
8
 
7
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
8
11
 
9
- THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship made available under
36
+ the License, as indicated by a copyright notice that is included in
37
+ or attached to the work (an example is provided in the Appendix below).
38
+
39
+ "Derivative Works" shall mean any work, whether in Source or Object
40
+ form, that is based on (or derived from) the Work and for which the
41
+ editorial revisions, annotations, elaborations, or other modifications
42
+ represent, as a whole, an original work of authorship. For the purposes
43
+ of this License, Derivative Works shall not include works that remain
44
+ separable from, or merely link (or bind by name) to the interfaces of,
45
+ the Work and the Derivative Works thereof.
46
+
47
+ "Contribution" shall mean, as submitted to the Licensor for inclusion
48
+ in the Work by the copyright owner or by an individual or Legal Entity
49
+ authorized to submit on behalf of the copyright owner. For the purposes
50
+ of this definition, "submitted" means any form of electronic, verbal,
51
+ or written communication sent to the Licensor or its representatives,
52
+ including but not limited to communication on electronic mailing lists,
53
+ source code control systems, and issue tracking systems that are managed
54
+ by, or on behalf of, the Licensor for the purpose of discussing and
55
+ improving the Work, but excluding communication that is conspicuously
56
+ marked or designated in writing by the copyright owner as "Not a
57
+ Contribution."
58
+
59
+ "Contributor" shall mean Licensor and any Legal Entity on behalf of
60
+ whom a Contribution has been received by the Licensor and incorporated
61
+ within the Work.
62
+
63
+ 2. Grant of Copyright License. Subject to the terms and conditions of
64
+ this License, each Contributor hereby grants to You a perpetual,
65
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
66
+ copyright license to reproduce, prepare Derivative Works of,
67
+ publicly display, publicly perform, sublicense, and distribute the
68
+ Work and such Derivative Works in Source or Object form.
69
+
70
+ 3. Grant of Patent License. Subject to the terms and conditions of
71
+ this License, each Contributor hereby grants to You a perpetual,
72
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
73
+ (except as stated in this section) patent license to make, have made,
74
+ use, offer to sell, sell, import, and otherwise transfer the Work,
75
+ where such license applies only to those patent claims licensable
76
+ by such Contributor that are necessarily infringed by their
77
+ Contribution(s) alone or by combination of their Contribution(s)
78
+ with the Work to which such Contribution(s) was submitted. If You
79
+ institute patent litigation against any entity (including a
80
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
81
+ or a Contribution incorporated within the Work constitutes direct
82
+ or contributory patent infringement, then any patent licenses
83
+ granted to You under this License for that Work shall terminate
84
+ as of the date such litigation is filed.
85
+
86
+ 4. Redistribution. You may reproduce and distribute copies of the
87
+ Work or Derivative Works thereof in any medium, with or without
88
+ modifications, and in Source or Object form, provided that You
89
+ meet the following conditions:
90
+
91
+ (a) You must give any other recipients of the Work or Derivative
92
+ Works a copy of this License; and
93
+
94
+ (b) You must cause any modified files to carry prominent notices
95
+ stating that You changed the files; and
96
+
97
+ (c) You must retain, in the Source form of any Derivative Works
98
+ that You distribute, all copyright, patent, trademark, and
99
+ attribution notices from the Source form of the Work,
100
+ excluding those notices that do not pertain to any part of
101
+ the Derivative Works; and
102
+
103
+ (d) If the Work includes a "NOTICE" text file as part of its
104
+ distribution, You must include a readable copy of the
105
+ attribution notices contained within such NOTICE file, in
106
+ at least one of the following places: within a NOTICE text
107
+ file distributed as part of the Derivative Works; within
108
+ the Source form or documentation, if provided along with the
109
+ Derivative Works; or, within a display generated by the
110
+ Derivative Works, if and wherever such third-party notices
111
+ normally appear. The contents of the NOTICE file are for
112
+ informational purposes only and do not modify the License.
113
+ You may add Your own attribution notices within Derivative
114
+ Works that You distribute, alongside or in addition to the
115
+ NOTICE text from the Work, provided that such additional
116
+ attribution notices cannot be construed as modifying the License.
117
+
118
+ You may add Your own license statement for Your modifications and
119
+ may provide additional grant of rights to use, reproduce, modify,
120
+ prepare derivative works of, collect, publish, distribute,
121
+ sublicense, and/or sell copies of the Contribution, either alone
122
+ or combined with the Work.
123
+
124
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
125
+ any Contribution intentionally submitted for inclusion in the Work
126
+ by You to the Licensor shall be under the terms and conditions of
127
+ this License, without any additional terms or conditions.
128
+ Notwithstanding the above, nothing herein shall supersede or modify
129
+ the terms of any separate license agreement you may have executed
130
+ with Licensor regarding such Contributions.
131
+
132
+ 6. Trademarks. This License does not grant permission to use the trade
133
+ names, trademarks, service marks, or product names of the Licensor,
134
+ except as required for reasonable and customary use in describing the
135
+ origin of the Work and reproducing the content of the NOTICE file.
136
+
137
+ 7. Disclaimer of Warranty. Unless required by applicable law or
138
+ agreed to in writing, Licensor provides the Work (and each
139
+ Contributor provides its Contributions) on an "AS IS" BASIS,
140
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
141
+ implied, including, without limitation, any warranties or conditions
142
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
143
+ PARTICULAR PURPOSE. You are solely responsible for determining the
144
+ appropriateness of using or reproducing the Work and assume any
145
+ risks associated with Your exercise of permissions under this License.
146
+
147
+ 8. Limitation of Liability. In no event and under no legal theory,
148
+ whether in tort (including negligence), contract, or otherwise,
149
+ unless required by applicable law (such as deliberate and grossly
150
+ negligent acts) or agreed to in writing, shall any Contributor be
151
+ liable to You for damages, including any direct, indirect, special,
152
+ incidental, or exemplary damages of any character arising as a
153
+ result of this License or out of the use or inability to use the
154
+ Work (including but not limited to damages for loss of goodwill,
155
+ work stoppage, computer failure or malfunction, or all other
156
+ commercial damages or losses), even if such Contributor has been
157
+ advised of the possibility of such damages.
158
+
159
+ 9. Accepting Warranty or Liability. While redistributing the Work or
160
+ Derivative Works thereof, You may choose to offer, and charge a fee
161
+ for, acceptance of support, warranty, indemnity, or other liability
162
+ obligations and/or rights consistent with this License. However, in
163
+ accepting such obligations, You may offer such obligations only on
164
+ Your own behalf and on Your sole responsibility, not on behalf of
165
+ any other Contributor, and only if You agree to indemnify, defend,
166
+ and hold each Contributor harmless for any liability incurred by,
167
+ or claims asserted against, such Contributor by reason of your
168
+ accepting any warranty or additional liability.
169
+
170
+ END OF TERMS AND CONDITIONS
171
+
172
+ Copyright 2021-present Development Gateway
173
+
174
+ Licensed under the Apache License, Version 2.0 (the "License");
175
+ you may not use this file except in compliance with the License.
176
+ You may obtain a copy of the License at
177
+
178
+ http://www.apache.org/licenses/LICENSE-2.0
179
+
180
+ Unless required by applicable law or agreed to in writing, software
181
+ distributed under the License is distributed on an "AS IS" BASIS,
182
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
183
+ See the License for the specific language governing permissions and
184
+ limitations under the License.
package/README.md CHANGED
@@ -169,4 +169,4 @@ We welcome contributions! To get started:
169
169
 
170
170
  ## License
171
171
 
172
- MIT
172
+ Apache-2.0
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("react/jsx-runtime"),p=require("react"),$t=require("./Tooltip.js"),Wt=require("@nivo/bar"),Tt=require("react-intl"),_t=require("@nivo/theming"),Ae=require("d3-shape"),qe=require("./LineLayer.js"),pe=require("papaparse"),Ht=require("../../layout/FlexWrapDetector.js"),je=require("../../utils/deviceType.js"),At="middle",qt="top",$="#66676d",Re="#dddddd",Rt="none",G="_Color",Pt=({editing:o,legends:W,marginLeft:Pe,marginTop:A,marginRight:Ye,marginBottom:q,options:f,intl:j,format:y,colors:T,groupMode:F,height:Ke,showLegends:ee,legendPosition:b,tickRotation:O,offsetText:te,tickColor:ae,layout:m,reverse:_,offsetY:Xe,csvLineLayerData:be,tooltip:ne,lineLayerEnabled:se,overlays:H,maxValue:le,valueScale:Ze,colorGenerator:v,legendLabel:ve,overrideTickColor:Ce,fixedMinValue:re,fixedMaxValue:ie,barPadding:Je,barLabelPosition:Ne,barInnerPadding:Ue,tooltipEnabled:Qe,xLabelColor:M,barLabelColor:X,legendCheckBack:k,legendLabelBack:ce,legendLabelColor:de,highlightXAxisLine:Ge,showTickLine:R,showRightAxis:et,offsetRight:Ie,offsetBottom:he,confidenceIntervals:ue,showGroupTotal:tt,groupTotalLabel:ke,groupTotalFormat:Le,groupTotalMeasure:we,groupTotalOffset:E,groupTotalFixedPosition:Z,tooltipEnableMarkdown:at,xAxisTickValues:nt,yAxisTickValues:st,mobileCustomization:lt,minMaxClamp:Kt,reverseLegend:rt,enableGridY:it,enableGridX:ct,customAxisFormat:N,previewMode:S,showLegendsInColumns:Xt=!1,numberOfLegendColumns:Zt=4,lineXAxisTickMode:De="none",lineXAxisTickCount:dt=10,lineXAxisTickEvery:ht=1})=>{var He;const Me=["mobile","tablet","midTablet"].includes(je.default()),C=["tablet","midTablet"].includes(je.default()),J=je.default()==="mobile",fe=30,me=15,h=JSON.parse(decodeURIComponent(lt)),Fe=Me&&((h==null?void 0:h.showCustomization)??!1),z=Fe&&S!=="Desktop",V=!o&&Fe,xe=()=>X==="null"||X===null||!X?"#000000":X,[L,ut]=p.useState([]),{colorBy:P}=T,Oe={};H.forEach((e,t)=>{Oe[t]=!0});const[I,ft]=p.useState(Oe),[Ee,mt]=p.useState(50),[Ct,Se]=p.useState(A),[Jt,ze]=p.useState(0),[Ve,Be]=p.useState(q),[$e,xt]=p.useState(!1);p.useEffect(()=>{let e,t;return e=requestAnimationFrame(()=>{e=requestAnimationFrame(()=>{t=setTimeout(()=>{xt(!0)},50)})}),()=>{cancelAnimationFrame(e),clearTimeout(t)}},[]);const Y=((e,t,r,i,a)=>{let c=[];return e.data&&(c=t.colorBy==="index"?e.data.map(l=>{let n,d=!0;return r.indexOf(l[e.indexBy])>-1?(d=!1,n=i):n=l[G]?l[G]:a.getColor(l.id,l),{enabled:d,color:n,id:l[e.indexBy],label:l[e.indexBy]}}):e.keys.map(l=>{let n,d=!0;return r.indexOf(l)>-1?(d=!1,n=i):n=a.getColorByKey(l),{enabled:d,color:n,id:l,label:l}})),c})(f,T,L,Rt,v),We=()=>(rt&&Y.reverse(),s.jsxs(s.Fragment,{children:[ee&&Y.map(e=>s.jsxs("div",{className:`legend item ${e.enabled?"":"ignore"}`,onClick:()=>kt(e.id),children:[k&&s.jsx("input",{className:e.enabled?"":"ignore",type:"checkbox",checked:e.enabled,style:{backgroundColor:k?P==="values"?ae:e.color:"none",color:"#000"}}),!k&&s.jsx("input",{type:"checkbox",checked:e.enabled,style:{color:"#000"}}),k&&s.jsx("span",{className:"checkmark-with-bg",style:{backgroundColor:e.color}}),!k&&s.jsx("span",{className:"checkmark"}),ce&&s.jsx("label",{className:e.enabled?"":"ignore",style:{backgroundColor:P==="values"?ae:e.color,color:de},children:e.label}),!ce&&s.jsx("label",{className:e.enabled?"":"ignore",style:{color:de},children:e.label})]})),P==="values"&&s.jsxs("div",{className:"legend item",children:[s.jsx("label",{className:"range min",style:{backgroundColor:v.getColorByValue(v.minValue),color:"#fff"}}),s.jsx("label",{children:j.formatNumber(y.style==="percent"?v.minValue/100:v.minValue,{...y,minimumFractionDigits:0})})]}),P==="values"&&s.jsxs("div",{className:"legend item",children:[s.jsx("label",{className:"range max",style:{backgroundColor:v.getColorByValue(v.maxValue),color:"#fff"},children:" "}),s.jsx("label",{children:j.formatNumber(y.style==="percent"?v.maxValue/100:v.maxValue,{...y,minimumFractionDigits:0})})]}),ee&&se&&H.map((e,t)=>s.jsxs("div",{className:"legend item",onClick:()=>Lt(t),children:[s.jsx("input",{className:k&&I[t]?"":"ignore",type:"checkbox",checked:I[t],style:{backgroundColor:I[t]&&k===!0?e.lineColor:"none",color:"#000"}}),s.jsx("span",{className:k?"checkmark-with-bg":"checkmark",style:{backgroundColor:I[t]&&k===!0?e.lineColor:"none"}}),s.jsx("label",{className:I[t]?"":"ignore",style:{backgroundColor:I[t]&&ce===!0?e.lineColor:"none",color:de},children:e.title})]}))]}));p.useEffect(()=>{(()=>{const r=5*Math.max(Y.length-5,0);mt(r)})()},[Y]),p.useEffect(()=>{Se(A),Be(q)},[b,A,q]);const ot={bottom:`-${Ee}px`},yt={bottom:`-${Ee}px`,gap:"0px"},gt=e=>oe(e,"1 0",Re,"Y"),pt=e=>oe(e,"4 4",$,"X"),jt=e=>oe(e,"1 0",Re,"X"),bt=e=>{const t=Y.find(r=>r.id===e.value);return t?t.color:"#FFFFFF"},vt=e=>{const{yScale:t,xScale:r,bars:i}=e;return s.jsx(p.Fragment,{children:i.filter(a=>a.data.value!=null).map(a=>{let c=a.data.indexValue;f.dimensionsMetadata&&f.dimensionsMetadata.size>1&&(c=a.data.id);const l=ue.filter(n=>n.serieLabel==c)[0];if(l&&l.low&&l.high)if(m==="horizontal"){const n=r(parseFloat(l.low)),d=r(parseFloat(l.high));return s.jsxs("g",{children:[s.jsx("line",{x1:n,x2:d,y1:a.y+a.height/2,y2:a.y+a.height/2,strokeWidth:1,stroke:$}),s.jsx("line",{x1:n,x2:n,y1:a.y+a.height/2-3,y2:a.y+a.height/2+3,strokeWidth:1,stroke:$}),s.jsx("line",{x1:d,x2:d,y1:a.y+a.height/2-3,y2:a.y+a.height/2+3,strokeWidth:1,stroke:$})]})}else{const n=t(parseFloat(l.low)),d=t(parseFloat(l.high));return s.jsxs("g",{children:[s.jsx("line",{y1:n,y2:d,x1:a.x+a.width/2,x2:a.x+a.width/2,strokeWidth:1,stroke:$}),s.jsx("line",{y1:n,y2:n,x1:a.x+a.width/2-3,x2:a.x+a.width/2+3,strokeWidth:1,stroke:$}),s.jsx("line",{y1:d,y2:d,x1:a.x+a.width/2-3,x2:a.x+a.width/2+3,strokeWidth:1,stroke:$})]})}})})},oe=(e,t,r,i)=>{const{yScale:a,innerWidth:c,innerHeight:l}=e;let n,d;return i=="X"?(n=[0,c],d=Ae.line().x((x,B)=>B===0?-10:x).y(()=>a(0))):(n=[0,l],d=Ae.line().x(()=>0).y(x=>x)),s.jsx(p.Fragment,{children:s.jsx("path",{d:d(n),fill:"none",stroke:r,style:{pointerEvents:"none",strokeDasharray:t}})})},w=(e,t)=>L?(T.colorBy==="index"||T.colorBy==="id"||T.colorBy==="values")&&!t?e.filter(r=>L.indexOf(r[f.indexBy])===-1):e?e.filter(r=>L.indexOf(r)===-1):[]:e,Nt=e=>{const t=_t.useTheme();if(!e.value)return"";const r=Object.assign({},e);(V||z)&&ge.includes(String(r.value))&&(r.value="");let i;Ce?i=ae:i=bt(e);let a=[],c="";if(z||V){const n=String(r.value).split(" ");let d=25;o&&S==="Mobile"||J&&!o?d=(h==null?void 0:h.mobileMaxTickLength)??25:o&&S==="Tablet"||C&&!o?d=(h==null?void 0:h.tabletMaxTickLength)??25:window.matchMedia("(min-width: 768px) and (max-width: 1250px)").matches&&!o&&(d=15),n.forEach(x=>{c.length+String(x).length<=d?c+=(c?" ":"")+x:(a.push(c),c=x)}),c&&a.push(c)}else a=[r.value];let l=12;return J?l=(h==null?void 0:h.mobileYAxisLineHeight)??12:C&&(l=(h==null?void 0:h.tabletYAxisLineHeight)??12),O>0&&O<180?s.jsxs("g",{transform:`translate(${e.x},${e.y+30})`,children:[R&&s.jsx("line",{stroke:i,strokeWidth:1.5,y1:-32,y2:-12}),s.jsx("g",{transform:`translate(0, ${e.y+te})`,children:a.map((n,d)=>s.jsx("text",{transform:`rotate(${O})`,textAnchor:"start",y:typeof e.value=="number"?0:d*l,dominantBaseline:"middle",style:{...t.axis.ticks.text,fill:M==="null"?"black":M,fontSize:"12px",fontFamily:"sans-serif"},children:n},n))})]}):O>180&&O<360?s.jsxs("g",{transform:`translate(${e.x},${e.y+30})`,children:[R&&s.jsx("line",{stroke:i,strokeWidth:1.5,y1:-32,y2:-12}),s.jsx("g",{transform:`translate(0, ${e.y+te})`,children:a.map((n,d)=>s.jsx("text",{transform:`rotate(${O})`,textAnchor:"end",y:typeof e.value=="number"?0:d*l,dominantBaseline:"middle",style:{...t.axis.ticks.text,fill:M==="null"?"black":M,fontSize:"12px",fontFamily:"sans-serif"},children:n},d))})]}):s.jsxs("g",{transform:`translate(${e.x},${e.y+30})`,children:[R&&s.jsx("line",{stroke:i,strokeWidth:1.5,y1:-32,y2:-12}),s.jsx("g",{transform:`translate(0, ${e.y+te})`,children:a.map((n,d)=>s.jsx("text",{transform:`rotate(${O})`,textAnchor:"middle",y:typeof e.value=="number"?0:d*l,dominantBaseline:"middle",style:{...t.axis.ticks.text,fill:M==="null"?"black":M,fontSize:"12px",fontFamily:"sans-serif"},children:n},d))})]})},It=e=>{if(!e.value||(z||V)&&ge.includes(String(e.value)))return"";let t=e.value;if(m==="vertical"){const n=N||y;t=j.formatNumber(n.style==="percent"?t/100:t,{...n})}let r=25;o&&S==="Mobile"||J&&!o?r=(h==null?void 0:h.mobileMaxTickLength)??25:o&&S==="Tablet"||C&&!o?r=(h==null?void 0:h.tabletMaxTickLength)??25:window.matchMedia("(min-width: 768px) and (max-width: 1250px)").matches&&!o&&(r=15);const i=typeof t=="string"?t.split(" "):[t],a=[];let c="";i.forEach(n=>{c.length+String(n).length<=r?c+=(c?" ":"")+n:(a.push(c),c=n)}),c&&a.push(c);let l=12;return o&&S==="Mobile"||J&&!o?l=(h==null?void 0:h.mobileYAxisLineHeight)??12:(o&&S==="Tablet"||C&&!o)&&(l=(h==null?void 0:h.tabletYAxisLineHeight)??12),s.jsxs("g",{transform:`translate(${e.x},${e.y})`,children:[s.jsx("line",{x1:-5,x2:0,y1:0,y2:0,stroke:"#000",strokeWidth:1}),a.map((n,d)=>s.jsx("text",{x:-10,y:typeof t=="number"?0:d*l,textAnchor:"end",dominantBaseline:"middle",style:{fill:M==="null"?"black":M,fontSize:"12px",fontFamily:"sans-serif"},children:n},n))]})},kt=e=>{const t=L.slice();if(t.indexOf(e)>-1){const r=t.indexOf(e);t.splice(r,1)}else t.push(e);ut(t)},Lt=e=>{const t=Object.assign({},I);t[e]=!t[e],ft(t)},wt=({bars:e})=>s.jsx("g",{children:e.map(t=>{const{width:r,height:i,y:a,x:c,data:l}=t;if(m==="horizontal"&&i<=me||m==="vertical"&&r<=fe)return;const n=l.value?j.formatNumber(y.style==="percent"?l.value/100:l.value,y):"",d=n.length;let x,B;if(m==="vertical"&&r>=fe||m==="horizontal"&&i>=me)return m==="vertical"?(x=a-6,B=c+r/2-d*3.5):(x=a+i/2+4,B=c+r+5),s.jsx("text",{y:x,x:B,style:{fill:xe()},children:`${n}`})})}),Dt=e=>{const t=f.data.filter(i=>L.indexOf(i[f.indexBy])==-1).map(i=>i[f.indexBy]),{bars:r}=e;return s.jsx("g",{children:t.filter(i=>r.filter(a=>a.data.indexValue==i).length>0).map(i=>{var Q;const a=r.filter(u=>u.data.indexValue==i);let c="right",l=0,n=0;if(m=="horizontal")F==="stacked"?(Z?l=e.innerWidth-20:(l=a.map(u=>u.width).reduce((u,g)=>u+g),_&&(l=e.innerWidth-l)),n=e.yScale(i)+a[0].height/2):(Z?l=e.innerWidth:(l=a.map(u=>u.width).reduce((u,g)=>u>g?u:g),_&&(l=e.innerWidth-l)),n=e.yScale(i)+a.map(u=>u.height).reduce((u,g)=>u+g)/2),l=l+parseInt(E)+5;else if(c="middle",F==="stacked")l=e.xScale(i)+a[0].width/2,Z?n=n-parseInt(E):_?n=parseInt(E)+a.map(u=>u.height).reduce((u,g)=>u+g)+14:n=e.innerHeight-parseInt(E)-a.map(u=>u.height).reduce((u,g)=>u+g)-5;else if(l=e.xScale(i)+a.map(u=>u.width).reduce((u,g)=>u+g)/2,_&&(n=e.innerHeight),Z)n=n-parseInt(E);else{if(a.length%2==1){const u=Math.floor(a.length/2);n=a[u].height}else{const u=a.length/2;n=Math.max(a[u].height,a[u-1].height)}_?n=n+14+parseInt(E):n=e.innerHeight-n-parseInt(E)-5}const d=f.data.filter(u=>u[f.indexBy]===i)[0];let x=d.parent_variables?d.parent_variables[we]:d[we];const B=P!=="index"?(Q=L==null?void 0:L.map(u=>d[u]))==null?void 0:Q.reduce((u,g)=>u+g,0):0;return x-=B,s.jsx("text",{y:n,x:l,style:{fill:xe()},children:s.jsxs("tspan",{textAnchor:c,children:[ke?ke+" ":"",j.formatNumber(Le.style==="percent"?x/100:x,Le)]})})})})},Mt={top:A,right:Ye,bottom:q,left:Pe};let ye;be&&(ye=pe.parse(be,{header:!1,dynamicTyping:!0}),Math.max(...ye.data.map(e=>e[1])),Math.min(...ye.data.map(e=>e[1])));const Te=()=>{const e=[];if(ue&&ue.forEach(t=>{t.low&&e.push(parseFloat(t.low)),t.high&&e.push(parseFloat(t.high))}),f.data){const t=w(f.data,!1),r=w(f.keys,!0);t.forEach(i=>{r.forEach(a=>{i[a]&&e.push(i[a])})})}return se&&H&&H.forEach((t,r)=>{if(I[r]!==!1)if(t.app==="csv"&&t.csvLineLayerData){const i=pe.parse(t.csvLineLayerData,{header:!1,dynamicTyping:!0});i.data&&i.data.filter(a=>a[1]!==null&&typeof a[1]=="number").forEach(a=>e.push(a[1]))}else t.measure[0]&&f.data&&f.data.forEach(i=>{var c;const a=(c=i.variables)==null?void 0:c[t.measure[0]];a!==null&&typeof a=="number"&&e.push(a)})}),e},Ft=()=>{const e=Te(),t=e.length>0?Math.max(...e):0;if(le==="fixed"&&ie!==null&&ie!=="")return Number(ie);if(F==="stacked"&&le!=="fixed"){const r=w(f.data,!1),i=w(f.keys,!0);let a=i.length>0?i:f.keys;const c=Math.max(...r.map(l=>a.map(n=>l[n]?l[n]:0)).map(l=>l.length>0?l.reduce((n,d)=>n+d,0):0));return Math.max(c,t)*1.1}return t*1.05},Ot=()=>{const e=Te(),t=e.length>0?Math.min(...e):0;return le==="fixed"&&re!==null&&String(re)!==""?Number(re):t>0?t*.9:t*1.1},Et=Number(Ft()),St=Number(Ot()),zt=Math.min(0,St),Vt=Math.max(0,Et),D=["grid","axes","bars"];tt&&D.push(Dt),D.push(gt),D.push(jt),se&&H&&H.forEach((e,t)=>{if(I[t]==!0||I[t]==null){const{csvLineLayerData:r,lineColor:i,tooltip:a}=e;if(e.app=="csv"){const c=pe.parse(r,{header:!1,dynamicTyping:!0});if(c.data&&c.data.filter(l=>l[1]!==null).length>0){c.data=c.data.filter(n=>n[1]!==null);const l=qe.default(c,i,m,F,w(f.keys,!0),a,e.title,"");D.push(l)}}else if(e.measure[0]){const c={},l=f.data.map(x=>[x[f.indexBy],x.variables[e.measure[0]]]),n=f.metadata.measures?f.metadata.measures.filter(x=>x.value==e.measure[0]):[];c.data=l;const d=qe.default(c,i,m,F,w(f.keys,!0),a,e.title,n.length>0?n[0].label:"");D.push(d)}}}),Ne===qt&&D.push(wt),Ge&&D.push(pt),D.push(vt);let U=parseInt(st);const _e=()=>s.jsx(s.Fragment,{children:ee&&ve&&s.jsx("div",{className:"legend item",children:s.jsx("label",{className:"legend-title",children:ve})})}),ge=[];if(V||z){U=Number.parseInt(h.yAxisTickValues);const e=new Map(Object.entries(((He=h==null?void 0:h.labels)==null?void 0:He.xAxis)??{}));for(const[t,r]of e)r||ge.push(t)}let K;if(m==="vertical"&&(f!=null&&f.data)&&f.data.length>0){const e=w(f.data,!1),t=[];if(e.forEach(r=>{const i=r==null?void 0:r[f.indexBy];i!==void 0&&t.indexOf(i)===-1&&t.push(i)}),De==="count"){const r=Math.max(1,parseInt(String(dt)));if(t.length>0&&r>0)if(t.length<=r)K=t.slice();else{const i=(t.length-1)/(r-1),a=new Array(r);for(let c=0;c<r;c++)a[c]=Math.floor(c*i);a[r-1]=t.length-1,K=a.map(c=>t[c])}}else if(De==="every"){const r=Math.max(1,parseInt(String(ht)));if(t.length>0){const i=[];for(let a=0;a<t.length;a++)a%r===0&&i.push(t[a]);i[i.length-1]!==t[t.length-1]&&i.push(t[t.length-1]),K=i}}}let Bt=parseInt(Ke+"")-Ve;return s.jsx("div",{style:{height:Bt+"px"},className:"bar-chart",children:(f==null?void 0:f.data)&&f.data.length>0&&s.jsxs(s.Fragment,{children:[s.jsx(Wt.ResponsiveBar,{colorBy:T.colorBy,animate:!0,enableLabel:Ne==At,...f,maxValue:Vt,minValue:zt,keys:w(f.keys,!0),data:w(f.data,!1),groupMode:F||"grouped",margin:Mt,innerPadding:Ue,valueScale:{type:Ze,clamp:!0},colors:e=>e&&e.data[G]?e.data[G]:v.getColor(e.id,e.data),borderColor:"#000",reverse:_,axisTop:null,axisRight:et?{tickSize:m=="horizontal"&&R||m==="vertical"?5:0,tickPadding:5,tickRotation:0,tickValues:U,legend:W.right,legendPosition:"middle",legendOffset:parseInt(Ie),format:e=>{if(!e)return"";if(m=="vertical"){const t=N||y;return j.formatNumber(t.style==="percent"?e/100:e,{...t})}return e}}:null,axisBottom:(z||V)&&(h==null?void 0:h.xAxisDisabled)===!0?null:m==="horizontal"?{legend:W.bottom,legendPosition:"middle",legendOffset:parseInt(he),tickPadding:5,tickRotation:0,tickValues:U,legend:W.right,legendPosition:"middle",legendOffset:parseInt(Ie),format:e=>{if(!e)return"";if(m=="vertical"){const t=N||y;return j.formatNumber(t.style==="percent"?e/100:e,{...t})}return e}}:null,axisBottom:(z||V)&&(h==null?void 0:h.xAxisDisabled)===!0?null:m==="horizontal"?{legend:W.bottom,legendPosition:"middle",legendOffset:parseInt(he),tickPadding:5,tickRotation:0,tickValues:parseInt(nt),format:e=>{if(!e)return"";if(m=="horizontal"){const t=N||y;return j.formatNumber(t.style==="percent"?e/100:e,{...t})}return e}}:{legend:W.bottom,legendPosition:"middle",legendOffset:parseInt(he),...K?{tickValues:K}:{},renderTick:Nt},axisLeft:{tickSize:m==="horizontal"&&R||m==="vertical"?5:0,tickPadding:5,tickRotation:0,tickValues:U,legend:W.left,legendPosition:"middle",legendOffset:Number.parseInt(Xe),...z||V?{renderTick:It}:{format:e=>{if(!e)return"";if(m==="vertical"){const t=N||y;return j.formatNumber(t.style==="percent"?e/100:e,{...t})}return e}}},enableGridY:it,enableGridX:ct,layout:m,labelSkipWidth:fe,labelSkipHeight:me,padding:Je,labelTextColor:xe(),label:e=>j.formatNumber(y.style==="percent"&&e.value?e.value/100:e.value,y),layers:D,onMouseEnter:e=>{},onMouseLeave:e=>{},motionStiffness:130,motionDamping:15,tooltip:e=>Qe&&ne&&ne.trim().length>0?s.jsx($t.default,{intl:j,format:y,d:e,tooltip:ne,tooltipEnableMarkdown:at}):null,theme:{tooltip:{basic:{whiteSpace:"pre",display:"flex",alignItems:"center"},container:{background:"transparent",boxShadow:""},table:{},tableCell:{padding:"3px 5px"}}}}),(b==="top"||b==="bottom")&&$e&&s.jsx("div",{className:`legends container has-standard-12-font-size ${b}`,style:b==="bottom"?{marginBottom:`${Ve}px`}:{},children:s.jsxs("div",{className:"legend-sections",children:[s.jsx("div",{className:"title-section",children:_e()}),s.jsx(Ht.default,{onWrapChange:e=>{if(b==="top"&&Me){const t=A+e/2*40;Se(t),ze(e)}else Be(q+e/2*25),ze(e)},className:"legends container has-standard-12-font-size items-section",children:We()})]})}),(b==="right"||b==="left")&&$e&&s.jsxs("div",{className:`legends container has-standard-12-font-size ${b}`,style:b==="right"?ot:yt,children:[_e(),We()]})]})})},Yt=Tt.injectIntl(Pt);exports.default=Yt;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("react/jsx-runtime"),p=require("react"),Bt=require("./Tooltip.js"),$t=require("@nivo/bar"),Wt=require("react-intl"),Tt=require("@nivo/theming"),Ae=require("d3-shape"),He=require("./LineLayer.js"),pe=require("papaparse"),_t=require("../../layout/FlexWrapDetector.js"),je=require("../../utils/deviceType.js"),At="middle",Ht="top",$="#66676d",qe="#dddddd",qt="none",G="_Color",Rt=({editing:o,legends:W,marginLeft:Re,marginTop:H,marginRight:Pe,marginBottom:q,options:f,intl:j,format:y,colors:T,groupMode:F,height:Ye,showLegends:ee,legendPosition:b,tickRotation:O,offsetText:te,tickColor:ae,layout:m,reverse:_,offsetY:Ce,csvLineLayerData:be,tooltip:ne,lineLayerEnabled:se,overlays:A,maxValue:le,valueScale:Ke,colorGenerator:v,legendLabel:ve,overrideTickColor:Xe,fixedMinValue:re,fixedMaxValue:ie,barPadding:Ze,barLabelPosition:Ne,barInnerPadding:Je,tooltipEnabled:Ue,xLabelColor:M,barLabelColor:K,legendCheckBack:k,legendLabelBack:ce,legendLabelColor:de,highlightXAxisLine:Qe,showTickLine:R,showRightAxis:Ge,offsetRight:Ie,offsetBottom:he,confidenceIntervals:ue,showGroupTotal:et,groupTotalLabel:ke,groupTotalFormat:Le,groupTotalMeasure:we,groupTotalOffset:E,groupTotalFixedPosition:X,tooltipEnableMarkdown:tt,xAxisTickValues:at,yAxisTickValues:nt,mobileCustomization:st,minMaxClamp:Yt,reverseLegend:lt,enableGridY:rt,enableGridX:it,customAxisFormat:N,previewMode:S,showLegendsInColumns:Ct=!1,numberOfLegendColumns:Kt=4,lineXAxisTickMode:De="none",lineXAxisTickCount:ct=10,lineXAxisTickEvery:dt=1})=>{var _e;const Me=["mobile","tablet","midTablet"].includes(je.default()),Z=["tablet","midTablet"].includes(je.default()),J=je.default()==="mobile",fe=30,me=15,h=JSON.parse(decodeURIComponent(st)),Fe=Me&&((h==null?void 0:h.showCustomization)??!1),z=Fe&&S!=="Desktop",V=!o&&Fe,xe=()=>K==="null"||K===null||!K?"#000000":K,[L,ht]=p.useState([]),{colorBy:P}=T,Oe={};A.forEach((e,t)=>{Oe[t]=!0});const[I,ut]=p.useState(Oe),[Ee,ft]=p.useState(50),[Xt,Se]=p.useState(H),[Zt,ze]=p.useState(0),[mt,Ve]=p.useState(q),[Be,xt]=p.useState(!1);p.useEffect(()=>{let e,t;return e=requestAnimationFrame(()=>{e=requestAnimationFrame(()=>{t=setTimeout(()=>{xt(!0)},50)})}),()=>{cancelAnimationFrame(e),clearTimeout(t)}},[]);const Y=((e,t,r,i,a)=>{let c=[];return e.data&&(c=t.colorBy==="index"?e.data.map(l=>{let n,d=!0;return r.indexOf(l[e.indexBy])>-1?(d=!1,n=i):n=l[G]?l[G]:a.getColor(l.id,l),{enabled:d,color:n,id:l[e.indexBy],label:l[e.indexBy]}}):e.keys.map(l=>{let n,d=!0;return r.indexOf(l)>-1?(d=!1,n=i):n=a.getColorByKey(l),{enabled:d,color:n,id:l,label:l}})),c})(f,T,L,qt,v),$e=()=>(lt&&Y.reverse(),s.jsxs(s.Fragment,{children:[ee&&Y.map(e=>s.jsxs("div",{className:`legend item ${e.enabled?"":"ignore"}`,onClick:()=>kt(e.id),children:[k&&s.jsx("input",{className:e.enabled?"":"ignore",type:"checkbox",checked:e.enabled,style:{backgroundColor:k?P==="values"?ae:e.color:"none",color:"#000"}}),!k&&s.jsx("input",{type:"checkbox",checked:e.enabled,style:{color:"#000"}}),k&&s.jsx("span",{className:"checkmark-with-bg",style:{backgroundColor:e.color}}),!k&&s.jsx("span",{className:"checkmark"}),ce&&s.jsx("label",{className:e.enabled?"":"ignore",style:{backgroundColor:P==="values"?ae:e.color,color:de},children:e.label}),!ce&&s.jsx("label",{className:e.enabled?"":"ignore",style:{color:de},children:e.label})]})),P==="values"&&s.jsxs("div",{className:"legend item",children:[s.jsx("label",{className:"range min",style:{backgroundColor:v.getColorByValue(v.minValue),color:"#fff"}}),s.jsx("label",{children:j.formatNumber(y.style==="percent"?v.minValue/100:v.minValue,{...y,minimumFractionDigits:0})})]}),P==="values"&&s.jsxs("div",{className:"legend item",children:[s.jsx("label",{className:"range max",style:{backgroundColor:v.getColorByValue(v.maxValue),color:"#fff"},children:" "}),s.jsx("label",{children:j.formatNumber(y.style==="percent"?v.maxValue/100:v.maxValue,{...y,minimumFractionDigits:0})})]}),ee&&se&&A.map((e,t)=>s.jsxs("div",{className:"legend item",onClick:()=>Lt(t),children:[s.jsx("input",{className:k&&I[t]?"":"ignore",type:"checkbox",checked:I[t],style:{backgroundColor:I[t]&&k===!0?e.lineColor:"none",color:"#000"}}),s.jsx("span",{className:k?"checkmark-with-bg":"checkmark",style:{backgroundColor:I[t]&&k===!0?e.lineColor:"none"}}),s.jsx("label",{className:I[t]?"":"ignore",style:{backgroundColor:I[t]&&ce===!0?e.lineColor:"none",color:de},children:e.title})]}))]}));p.useEffect(()=>{(()=>{const r=5*Math.max(Y.length-5,0);ft(r)})()},[Y]),p.useEffect(()=>{Se(H),Ve(q)},[b,H,q]);const ot={bottom:`-${Ee}px`,justifyContent:"flex-start"},yt={bottom:`-${Ee}px`,gap:"0px",justifyContent:"flex-start"},gt=e=>oe(e,"1 0",qe,"Y"),pt=e=>oe(e,"4 4",$,"X"),jt=e=>oe(e,"1 0",qe,"X"),bt=e=>{const t=Y.find(r=>r.id===e.value);return t?t.color:"#FFFFFF"},vt=e=>{const{yScale:t,xScale:r,bars:i}=e;return s.jsx(p.Fragment,{children:i.filter(a=>a.data.value!=null).map(a=>{let c=a.data.indexValue;f.dimensionsMetadata&&f.dimensionsMetadata.size>1&&(c=a.data.id);const l=ue.filter(n=>n.serieLabel==c)[0];if(l&&l.low&&l.high)if(m==="horizontal"){const n=r(parseFloat(l.low)),d=r(parseFloat(l.high));return s.jsxs("g",{children:[s.jsx("line",{x1:n,x2:d,y1:a.y+a.height/2,y2:a.y+a.height/2,strokeWidth:1,stroke:$}),s.jsx("line",{x1:n,x2:n,y1:a.y+a.height/2-3,y2:a.y+a.height/2+3,strokeWidth:1,stroke:$}),s.jsx("line",{x1:d,x2:d,y1:a.y+a.height/2-3,y2:a.y+a.height/2+3,strokeWidth:1,stroke:$})]})}else{const n=t(parseFloat(l.low)),d=t(parseFloat(l.high));return s.jsxs("g",{children:[s.jsx("line",{y1:n,y2:d,x1:a.x+a.width/2,x2:a.x+a.width/2,strokeWidth:1,stroke:$}),s.jsx("line",{y1:n,y2:n,x1:a.x+a.width/2-3,x2:a.x+a.width/2+3,strokeWidth:1,stroke:$}),s.jsx("line",{y1:d,y2:d,x1:a.x+a.width/2-3,x2:a.x+a.width/2+3,strokeWidth:1,stroke:$})]})}})})},oe=(e,t,r,i)=>{const{yScale:a,innerWidth:c,innerHeight:l}=e;let n,d;return i=="X"?(n=[0,c],d=Ae.line().x((x,B)=>B===0?-10:x).y(()=>a(0))):(n=[0,l],d=Ae.line().x(()=>0).y(x=>x)),s.jsx(p.Fragment,{children:s.jsx("path",{d:d(n),fill:"none",stroke:r,style:{pointerEvents:"none",strokeDasharray:t}})})},w=(e,t)=>L?(T.colorBy==="index"||T.colorBy==="id"||T.colorBy==="values")&&!t?e.filter(r=>L.indexOf(r[f.indexBy])===-1):e?e.filter(r=>L.indexOf(r)===-1):[]:e,Nt=e=>{const t=Tt.useTheme();if(!e.value)return"";const r=Object.assign({},e);(V||z)&&ge.includes(String(r.value))&&(r.value="");let i;Xe?i=ae:i=bt(e);let a=[],c="";if(z||V){const n=String(r.value).split(" ");let d=25;o&&S==="Mobile"||J&&!o?d=(h==null?void 0:h.mobileMaxTickLength)??25:o&&S==="Tablet"||Z&&!o?d=(h==null?void 0:h.tabletMaxTickLength)??25:window.matchMedia("(min-width: 768px) and (max-width: 1250px)").matches&&!o&&(d=15),n.forEach(x=>{c.length+String(x).length<=d?c+=(c?" ":"")+x:(a.push(c),c=x)}),c&&a.push(c)}else a=[r.value];let l=12;return J?l=(h==null?void 0:h.mobileYAxisLineHeight)??12:Z&&(l=(h==null?void 0:h.tabletYAxisLineHeight)??12),O>0&&O<180?s.jsxs("g",{transform:`translate(${e.x},${e.y+30})`,children:[R&&s.jsx("line",{stroke:i,strokeWidth:1.5,y1:-32,y2:-12}),s.jsx("g",{transform:`translate(0, ${e.y+te})`,children:a.map((n,d)=>s.jsx("text",{transform:`rotate(${O})`,textAnchor:"start",y:typeof e.value=="number"?0:d*l,dominantBaseline:"middle",style:{...t.axis.ticks.text,fill:M==="null"?"black":M,fontSize:"12px",fontFamily:"sans-serif"},children:n},n))})]}):O>180&&O<360?s.jsxs("g",{transform:`translate(${e.x},${e.y+30})`,children:[R&&s.jsx("line",{stroke:i,strokeWidth:1.5,y1:-32,y2:-12}),s.jsx("g",{transform:`translate(0, ${e.y+te})`,children:a.map((n,d)=>s.jsx("text",{transform:`rotate(${O})`,textAnchor:"end",y:typeof e.value=="number"?0:d*l,dominantBaseline:"middle",style:{...t.axis.ticks.text,fill:M==="null"?"black":M,fontSize:"12px",fontFamily:"sans-serif"},children:n},d))})]}):s.jsxs("g",{transform:`translate(${e.x},${e.y+30})`,children:[R&&s.jsx("line",{stroke:i,strokeWidth:1.5,y1:-32,y2:-12}),s.jsx("g",{transform:`translate(0, ${e.y+te})`,children:a.map((n,d)=>s.jsx("text",{transform:`rotate(${O})`,textAnchor:"middle",y:typeof e.value=="number"?0:d*l,dominantBaseline:"middle",style:{...t.axis.ticks.text,fill:M==="null"?"black":M,fontSize:"12px",fontFamily:"sans-serif"},children:n},d))})]})},It=e=>{if(!e.value||(z||V)&&ge.includes(String(e.value)))return"";let t=e.value;if(m==="vertical"){const n=N||y;t=j.formatNumber(n.style==="percent"?t/100:t,{...n})}let r=25;o&&S==="Mobile"||J&&!o?r=(h==null?void 0:h.mobileMaxTickLength)??25:o&&S==="Tablet"||Z&&!o?r=(h==null?void 0:h.tabletMaxTickLength)??25:window.matchMedia("(min-width: 768px) and (max-width: 1250px)").matches&&!o&&(r=15);const i=typeof t=="string"?t.split(" "):[t],a=[];let c="";i.forEach(n=>{c.length+String(n).length<=r?c+=(c?" ":"")+n:(a.push(c),c=n)}),c&&a.push(c);let l=12;return o&&S==="Mobile"||J&&!o?l=(h==null?void 0:h.mobileYAxisLineHeight)??12:(o&&S==="Tablet"||Z&&!o)&&(l=(h==null?void 0:h.tabletYAxisLineHeight)??12),s.jsxs("g",{transform:`translate(${e.x},${e.y})`,children:[s.jsx("line",{x1:-5,x2:0,y1:0,y2:0,stroke:"#000",strokeWidth:1}),a.map((n,d)=>s.jsx("text",{x:-10,y:typeof t=="number"?0:d*l,textAnchor:"end",dominantBaseline:"middle",style:{fill:M==="null"?"black":M,fontSize:"12px",fontFamily:"sans-serif"},children:n},n))]})},kt=e=>{const t=L.slice();if(t.indexOf(e)>-1){const r=t.indexOf(e);t.splice(r,1)}else t.push(e);ht(t)},Lt=e=>{const t=Object.assign({},I);t[e]=!t[e],ut(t)},wt=({bars:e})=>s.jsx("g",{children:e.map(t=>{const{width:r,height:i,y:a,x:c,data:l}=t;if(m==="horizontal"&&i<=me||m==="vertical"&&r<=fe)return;const n=l.value?j.formatNumber(y.style==="percent"?l.value/100:l.value,y):"",d=n.length;let x,B;if(m==="vertical"&&r>=fe||m==="horizontal"&&i>=me)return m==="vertical"?(x=a-6,B=c+r/2-d*3.5):(x=a+i/2+4,B=c+r+5),s.jsx("text",{y:x,x:B,style:{fill:xe()},children:`${n}`})})}),Dt=e=>{const t=f.data.filter(i=>L.indexOf(i[f.indexBy])==-1).map(i=>i[f.indexBy]),{bars:r}=e;return s.jsx("g",{children:t.filter(i=>r.filter(a=>a.data.indexValue==i).length>0).map(i=>{var Q;const a=r.filter(u=>u.data.indexValue==i);let c="right",l=0,n=0;if(m=="horizontal")F==="stacked"?(X?l=e.innerWidth-20:(l=a.map(u=>u.width).reduce((u,g)=>u+g),_&&(l=e.innerWidth-l)),n=e.yScale(i)+a[0].height/2):(X?l=e.innerWidth:(l=a.map(u=>u.width).reduce((u,g)=>u>g?u:g),_&&(l=e.innerWidth-l)),n=e.yScale(i)+a.map(u=>u.height).reduce((u,g)=>u+g)/2),l=l+parseInt(E)+5;else if(c="middle",F==="stacked")l=e.xScale(i)+a[0].width/2,X?n=n-parseInt(E):_?n=parseInt(E)+a.map(u=>u.height).reduce((u,g)=>u+g)+14:n=e.innerHeight-parseInt(E)-a.map(u=>u.height).reduce((u,g)=>u+g)-5;else if(l=e.xScale(i)+a.map(u=>u.width).reduce((u,g)=>u+g)/2,_&&(n=e.innerHeight),X)n=n-parseInt(E);else{if(a.length%2==1){const u=Math.floor(a.length/2);n=a[u].height}else{const u=a.length/2;n=Math.max(a[u].height,a[u-1].height)}_?n=n+14+parseInt(E):n=e.innerHeight-n-parseInt(E)-5}const d=f.data.filter(u=>u[f.indexBy]===i)[0];let x=d.parent_variables?d.parent_variables[we]:d[we];const B=P!=="index"?(Q=L==null?void 0:L.map(u=>d[u]))==null?void 0:Q.reduce((u,g)=>u+g,0):0;return x-=B,s.jsx("text",{y:n,x:l,style:{fill:xe()},children:s.jsxs("tspan",{textAnchor:c,children:[ke?ke+" ":"",j.formatNumber(Le.style==="percent"?x/100:x,Le)]})})})})},Mt={top:H,right:Pe,bottom:q,left:Re};let ye;be&&(ye=pe.parse(be,{header:!1,dynamicTyping:!0}),Math.max(...ye.data.map(e=>e[1])),Math.min(...ye.data.map(e=>e[1])));const We=()=>{const e=[];if(ue&&ue.forEach(t=>{t.low&&e.push(parseFloat(t.low)),t.high&&e.push(parseFloat(t.high))}),f.data){const t=w(f.data,!1),r=w(f.keys,!0);t.forEach(i=>{r.forEach(a=>{i[a]&&e.push(i[a])})})}return se&&A&&A.forEach((t,r)=>{if(I[r]!==!1)if(t.app==="csv"&&t.csvLineLayerData){const i=pe.parse(t.csvLineLayerData,{header:!1,dynamicTyping:!0});i.data&&i.data.filter(a=>a[1]!==null&&typeof a[1]=="number").forEach(a=>e.push(a[1]))}else t.measure[0]&&f.data&&f.data.forEach(i=>{var c;const a=(c=i.variables)==null?void 0:c[t.measure[0]];a!==null&&typeof a=="number"&&e.push(a)})}),e},Ft=()=>{const e=We(),t=e.length>0?Math.max(...e):0;if(le==="fixed"&&ie!==null&&ie!=="")return Number(ie);if(F==="stacked"&&le!=="fixed"){const r=w(f.data,!1),i=w(f.keys,!0);let a=i.length>0?i:f.keys;const c=Math.max(...r.map(l=>a.map(n=>l[n]?l[n]:0)).map(l=>l.length>0?l.reduce((n,d)=>n+d,0):0));return Math.max(c,t)*1.1}return t*1.05},Ot=()=>{const e=We(),t=e.length>0?Math.min(...e):0;return le==="fixed"&&re!==null&&String(re)!==""?Number(re):t>0?t*.9:t*1.1},Et=Number(Ft()),St=Number(Ot()),zt=Math.min(0,St),Vt=Math.max(0,Et),D=["grid","axes","bars"];et&&D.push(Dt),D.push(gt),D.push(jt),se&&A&&A.forEach((e,t)=>{if(I[t]==!0||I[t]==null){const{csvLineLayerData:r,lineColor:i,tooltip:a}=e;if(e.app=="csv"){const c=pe.parse(r,{header:!1,dynamicTyping:!0});if(c.data&&c.data.filter(l=>l[1]!==null).length>0){c.data=c.data.filter(n=>n[1]!==null);const l=He.default(c,i,m,F,w(f.keys,!0),a,e.title,"");D.push(l)}}else if(e.measure[0]){const c={},l=f.data.map(x=>[x[f.indexBy],x.variables[e.measure[0]]]),n=f.metadata.measures?f.metadata.measures.filter(x=>x.value==e.measure[0]):[];c.data=l;const d=He.default(c,i,m,F,w(f.keys,!0),a,e.title,n.length>0?n[0].label:"");D.push(d)}}}),Ne===Ht&&D.push(wt),Qe&&D.push(pt),D.push(vt);let U=parseInt(nt);const Te=()=>s.jsx(s.Fragment,{children:ee&&ve&&s.jsx("div",{className:"legend item",children:s.jsx("label",{className:"legend-title",children:ve})})}),ge=[];if(V||z){U=Number.parseInt(h.yAxisTickValues);const e=new Map(Object.entries(((_e=h==null?void 0:h.labels)==null?void 0:_e.xAxis)??{}));for(const[t,r]of e)r||ge.push(t)}let C;if(m==="vertical"&&(f!=null&&f.data)&&f.data.length>0){const e=w(f.data,!1),t=[];if(e.forEach(r=>{const i=r==null?void 0:r[f.indexBy];i!==void 0&&t.indexOf(i)===-1&&t.push(i)}),De==="count"){const r=Math.max(1,parseInt(String(ct)));if(t.length>0&&r>0)if(t.length<=r)C=t.slice();else{const i=(t.length-1)/(r-1),a=new Array(r);for(let c=0;c<r;c++)a[c]=Math.floor(c*i);a[r-1]=t.length-1,C=a.map(c=>t[c])}}else if(De==="every"){const r=Math.max(1,parseInt(String(dt)));if(t.length>0){const i=[];for(let a=0;a<t.length;a++)a%r===0&&i.push(t[a]);i[i.length-1]!==t[t.length-1]&&i.push(t[t.length-1]),C=i}}}return s.jsx("div",{style:{height:Ye},children:(f==null?void 0:f.data)&&f.data.length>0&&s.jsxs(s.Fragment,{children:[s.jsx($t.ResponsiveBar,{colorBy:T.colorBy,animate:!0,enableLabel:Ne==At,...f,maxValue:Vt,minValue:zt,keys:w(f.keys,!0),data:w(f.data,!1),groupMode:F||"grouped",margin:Mt,innerPadding:Je,valueScale:{type:Ke,clamp:!0},colors:e=>e&&e.data[G]?e.data[G]:v.getColor(e.id,e.data),borderColor:"#000",reverse:_,axisTop:null,axisRight:Ge?{tickSize:m=="horizontal"&&R||m==="vertical"?5:0,tickPadding:5,tickRotation:0,tickValues:U,legend:W.right,legendPosition:"middle",legendOffset:parseInt(Ie),format:e=>{if(!e)return"";if(m=="vertical"){const t=N||y;return j.formatNumber(t.style==="percent"?e/100:e,{...t})}return e}}:null,axisBottom:(z||V)&&(h==null?void 0:h.xAxisDisabled)===!0?null:m==="horizontal"?{legend:W.bottom,legendPosition:"middle",legendOffset:parseInt(he),tickPadding:5,tickRotation:0,tickValues:U,legend:W.right,legendPosition:"middle",legendOffset:parseInt(Ie),format:e=>{if(!e)return"";if(m=="vertical"){const t=N||y;return j.formatNumber(t.style==="percent"?e/100:e,{...t})}return e}}:null,axisBottom:(z||V)&&(h==null?void 0:h.xAxisDisabled)===!0?null:m==="horizontal"?{legend:W.bottom,legendPosition:"middle",legendOffset:parseInt(he),tickPadding:5,tickRotation:0,tickValues:parseInt(at),format:e=>{if(!e)return"";if(m=="horizontal"){const t=N||y;return j.formatNumber(t.style==="percent"?e/100:e,{...t})}return e}}:{legend:W.bottom,legendPosition:"middle",legendOffset:parseInt(he),...C?{tickValues:C}:{},renderTick:Nt},axisLeft:{tickSize:m==="horizontal"&&R||m==="vertical"?5:0,tickPadding:5,tickRotation:0,tickValues:U,legend:W.left,legendPosition:"middle",legendOffset:Number.parseInt(Ce),...z||V?{renderTick:It}:{format:e=>{if(!e)return"";if(m==="vertical"){const t=N||y;return j.formatNumber(t.style==="percent"?e/100:e,{...t})}return e}}},enableGridY:rt,enableGridX:it,layout:m,labelSkipWidth:fe,labelSkipHeight:me,padding:Ze,labelTextColor:xe(),label:e=>j.formatNumber(y.style==="percent"&&e.value?e.value/100:e.value,y),layers:D,onMouseEnter:e=>{},onMouseLeave:e=>{},motionStiffness:130,motionDamping:15,tooltip:e=>Ue&&ne&&ne.trim().length>0?s.jsx(Bt.default,{intl:j,format:y,d:e,tooltip:ne,tooltipEnableMarkdown:tt}):null,theme:{tooltip:{basic:{whiteSpace:"pre",display:"flex",alignItems:"center"},container:{background:"transparent",boxShadow:""},table:{},tableCell:{padding:"3px 5px"}}}}),(b==="top"||b==="bottom")&&Be&&s.jsx("div",{className:`legends container has-standard-12-font-size ${b}`,style:b==="bottom"?{marginBottom:`${mt}px`,marginTop:"25px",textAlign:"left",justifyContent:"flex-start"}:{justifyContent:"flex-start"},children:s.jsxs("div",{className:"legend-sections",children:[s.jsx("div",{className:"title-section",children:Te()}),s.jsx(_t.default,{onWrapChange:e=>{if(b==="top"&&Me){const t=H+e/2*40;Se(t),ze(e)}else Ve(q+e/2*25),ze(e)},className:"legends container has-standard-12-font-size items-section",children:$e()})]})}),(b==="right"||b==="left")&&Be&&s.jsxs("div",{className:`legends container has-standard-12-font-size ${b}`,style:b==="right"?ot:yt,children:[Te(),$e()]})]})})},Pt=Wt.injectIntl(Rt);exports.default=Pt;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("react/jsx-runtime"),h=require("react"),pe=require("semantic-ui-react"),Qa=require("../data/DataProvider.js"),Za=require("../data/DataConsumer.js"),Oa=require("../../utils/deviceType.js"),er=require("./Pie.js");require("immutable");const tr=require("./Radar.js"),ar=require("./Bar.js"),rr=require("./Line.js"),or=require("@devgateway/wp-react-lib"),O=require("./data/index.js"),nr=require("./CSVDataFrame.js"),sr=require("./colors/ColorProvider.js"),nt=require("./Messages.js"),ir=require("react-redux"),dr=require("react-intl"),lr=P=>{let{parent:he,editing:i=!1,unique:ee,childContent:k,categories:G,injectedMeasures:d,"data-app":r="csv","data-dvz-proxy-dataset-id":fe,"data-group":ge="default","data-height":V=500,"data-type":q="bar","data-dimension1":N,"data-dimension2":be,"data-dimension3":pr,"data-color-by":z="index","data-scheme":te="system","data-group-mode":st="grouped","data-left-legend":it="Left Legend","data-legend-label":dt="","data-bottom-legend":lt="Bottom Legend","data-dualmode":ct,"data-legend-position":xe="right","data-show-legends":we="true","data-data-source-label":hr="Source","data-chart-data-source":fr="Data Source","data-toggle-info-label":gr="Info Graphic","data-toggle-chart-label":br="Chart","data-tick-rotation":m=0,"data-tick-color":ut="rgb(92,93,99)","data-measures":mt="{}","data-format":xr="{}","data-csv":pt="","data-margin-left":ht=50,"data-margin-top":ft=25,"data-margin-right":gt=25,"data-margin-bottom":bt=25,"data-start-angle":xt=0,"data-end-angle":wt=360,"data-view-mode":ve="info","data-filters":vt="[]","data-tooltip-html":yt="","data-layout":ae="vertical","data-reverse":ye="false","data-offset-y":Lt="-40","data-line-layer-enabled":Le="false","data-overlays":kt="[]","data-max-value":Tt="auto","data-value-scale":Ct="linear","data-swap":U="false","data-no-data-message":Mt="No data matches your selection","data-bar-color":It="rgb(0,0,0)","data-override-tick-color":ke="false","data-fixed-min-value":Rt=0,"data-fixed-max-value":At=0,"data-bar-padding":Dt=.15,"data-bar-label-position":Ft="middle","data-line-label-position":Bt="none","data-show-grid":Te="true","data-include-overall":Ce="false","data-bar-inner-padding":Et=.7,"data-x-label-color":Pt="#000","data-bar-label-color":qt="#000","data-legend-label-color":Nt="#000","data-tooltip-enabled":Me="true","data-use-check-box-background":Ie="false","data-use-label-background":Re="true","data-highlight-xaxis-line":Ae="false","data-show-tick-line":De="true","data-show-right-axis":Fe="true","data-manual-colors":zt="{}","data-right-legend":Xt="","data-offset-right":St="40","data-offset-bottom":Gt="40","data-hidden-bars":Vt=[],"data-confidence-intervals":Ut="[]","data-enable-area":Be="false","data-area-shading-criteria":$t="DEFAULT","data-area-lower-bound":Ht="","data-area-upper-bound":Wt="","data-show-points":Ee="true","data-center-label":Yt="","data-show-arc-labels":Pe="true","data-show-arc-link-labels":qe="true","data-slice-padding":_t=1,"data-center-label-font-weight":Jt="normal","data-center-label-font-size":jt="12","data-center-label-xoffset":Kt=0,"data-center-label-yoffset":Qt=0,"data-group-total-measure":Zt="","data-show-group-total":Ne="true","data-group-total-label":Ot="","data-group-total-format":ea="{}","data-group-total-label-offset":ta,"data-group-total-fixed-position":ze="false","data-tooltip-enable-markdown":$="false","data-y-axis-tick-values":Xe="10","data-x-axis-tick-values":Se="10","data-enable-grid-y":T="true","data-enable-grid-x":C="false","data-offset-text":aa=0,"data-overall-label":re="Overall","data-min-max-clamp":ra="false","data-reverse-legend":Ge="false","data-sort":Ve="default","data-sort-reverse":H="false","data-sort-second-dimension":Ue="default","data-sort-reverse-second-dimension":W="false","data-radar-curve":oa="linearClosed","data-radar-fill-opacity":na=.25,"data-radar-border-width":sa=2,"data-radar-grid-levels":ia=3,"data-radar-grid-shape":da="circular","data-radar-grid-label-offset":la=36,"data-radar-enable-dots":$e="true","data-radar-dot-size":ca=8,"data-radar-enable-dot-label":He="true","data-radar-dot-label-offset":ua=-12,"data-mobile-customization":We="{}","data-show-percentage":Ye="false","data-preview-mode":f="Desktop","data-wait-for-filters":ma="false","data-line-curve":pa="linear","data-show-legends-in-columns":_e="false","data-number-of-legend-columns":ha=4,"data-line-x-axis-tick-mode":fa="none","data-line-x-axis-tick-count":ga=10,"data-line-x-axis-tick-every":ba=1,pageModuleProps:g}=P;const xa=i,t=JSON.parse(decodeURIComponent(We)),[oe,wa]=h.useState(window.innerWidth<=1250),w=oe&&((t==null?void 0:t.showCustomization)??!1);g!=null&&g.previewMode&&(g!=null&&g.editing)&&(f=g.previewMode,i=g.editing);const va=["Tablet"].includes(f)&&i,ya=["Mobile"].includes(f)&&i,La=["Desktop"].includes(f)&&i,c=w&&f!=="Desktop",u=w&&!i,ne=()=>{const e=window.matchMedia("(min-width: 768px) and (max-width: 1250px)").matches,n=window.matchMedia("(max-width: 767px)").matches;switch(!0){case La:return m;case va:return w?(t==null?void 0:t.tabletXAxisTextRotation)??m:m;case ya:return w?(t==null?void 0:t.mobileXAxisTextRotation)??m:m;case e:return w?(t==null?void 0:t.tabletXAxisTextRotation)??m:m;case n:return w?(t==null?void 0:t.mobileXAxisTextRotation)??m:m;default:return m}},ka=ne(),[Ta,Je]=h.useState(ka),je=P.intl.locale,Y=h.useRef(null),Ke=e=>{try{return xa?e:decodeURIComponent(e)}catch{return console.error(`error decoding value:${e}`),e}},M=e=>{try{return JSON.parse(Ke(e))}catch{console.error(`error parsing value:${e}`)}return null},Ca=()=>{const e=M(zt);if(!e)return null;const n=e[r];if(r==="csv"&&n&&te==="manual"){const o={},p={};Object.keys(n).forEach(S=>{const x=n[S];typeof x=="string"?o[S]=x:typeof x=="object"&&x!==null&&(p[S]=x)});const y=p[z]||{};return{[z]:{...o,...y}}}return n},Ma=()=>M(mt),Qe=()=>{var e;if(a!=null&&a[r]){let n=(e=a==null?void 0:a[r])==null?void 0:e.format;if(!n){const o=Object.keys(a==null?void 0:a[r]);for(let p=0;p<o.length;p++)if(a!=null&&a[r][o[p]].selected&&(a!=null&&a[r][o[p]].format)){n=a==null?void 0:a[r][o[p]].format;break}}return n}return a!=null&&a.csv?a.csv.format:null},Ia=()=>{let e=null;return a!=null&&a[r]?a[r].useCustomAxisFormat&&a[r].customFormat&&(e=a[r].customFormat):a!=null&&a.csv&&a.csv.useCustomAxisFormat&&a.csv.customFormat&&(e=a.csv.customFormat),e},Ra=()=>a!=null&&a[r]?Object.keys(a[r]).map(e=>({value:e,...a[r][e]})).filter(e=>e.selected).map(e=>e.value):[],Ze=()=>{const e={};return a!=null&&a[r]&&Object.keys(a[r]).map(o=>({value:o,...a[r][o]})).filter(o=>o.selected&&o.hasCustomLabel).forEach(o=>{e[o.value]=o.customLabel}),e},Aa=()=>a!=null&&a[r]?Object.keys(a[r]).filter(e=>a[r][e].allowSelection):[];let a=Ma(),v=Ra(),b=Qe();const Da=Aa();let se=it,ie=Xt,de=Ke(yt);if(d!=null&&d[r]){const e=Object.keys(d[r].measures).map(n=>({value:n,...d[r].measures[n]})).filter(n=>n.selected).map(n=>n.value);a=d,v=e,b=Qe(),se=d.leftTitle,ie=d.rightTitle,d.customTooltip&&(de=d.customTooltip)}const Fa=b?{style:b.style==="compacted"?"decimal":b.style,notation:b.style==="compacted"?"compact":"standard",currency:b.currency,minimumFractionDigits:parseInt(b.minimumFractionDigits),maximumFractionDigits:parseInt(b.maximumFractionDigits)}:{notation:"standard",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:2},Ba=Ia(),s=M(ea),Ea={style:(s==null?void 0:s.style)==="compacted"?"decimal":s==null?void 0:s.style,notation:(s==null?void 0:s.style)==="compacted"?"compact":"standard",currency:s==null?void 0:s.currency,minimumFractionDigits:parseInt(s==null?void 0:s.minimumFractionDigits),maximumFractionDigits:parseInt(s==null?void 0:s.maximumFractionDigits)},[Pa,wr]=h.useState(ve),qa=i?ve:Pa,Na={scheme:te,colorBy:z},_=i?V-80:V,za=()=>(c||u)&&!(t!=null&&t.showXAxisTitle)?"":lt,Xa=()=>c||u?t!=null&&t.showYAxisTitle?se:"":se,Sa=()=>c||u?t!=null&&t.showRightAxisTitle?ie:"":ie,Ga={left:Xa(),bottom:za(),right:Sa()},J=e=>{if(e==="true"||e===!0)return!0;if(e==="false"||e===!1)return!1},Oe=()=>{J(C)&&!J(T)?(C=!1,T=!0):!J(C)&&J(T)&&(C=!0,T=!1)},Va=()=>ae==="horizontal"?(Oe(),"vertical"):(Oe(),"horizontal"),Ua=()=>t!=null&&t.chartLayoutOverride?Va():ae,j=(e,n,o)=>e?Number.parseInt(n)??o:o,et=(e,n,o)=>e?n??o:o;h.useEffect(()=>{const e=()=>{wa(window.innerWidth<=1250);const n=ne();Je(n)};return window.addEventListener("resize",e),Je(ne()),()=>{window.removeEventListener("resize",e)}},[i,f,w,m,t==null?void 0:t.tabletXAxisTextRotation,t==null?void 0:t.mobileXAxisTextRotation]);const $a=()=>{const e=["tablet","mobile","midTablet"].includes(Oa.default());return i&&f==="Desktop"?xe:e?"bottom":xe},tt={app:r,editing:i,tickColor:decodeURIComponent(ut),tickRotation:Ta,layout:c||u?Ua():ae,reverse:ye==!0||ye=="true",showLegends:we==!0||we=="true",legendLabel:dt,swap:U==!0||U=="true",showGrid:Te==!0||Te=="true",showPercentage:Ye==!0||Ye=="true",marginLeft:j(c||u,Number.parseInt(t==null?void 0:t.marginLeft),parseInt(ht)),marginTop:j(c||u,Number.parseInt(t==null?void 0:t.marginTop),parseInt(ft)),marginRight:j(c||u,Number.parseInt(t==null?void 0:t.marginRight),Number.parseInt(gt)),marginBottom:j(c||u,Number.parseInt(t==null?void 0:t.marginBottom),Number.parseInt(bt)),height:`${_}px`,legendPosition:$a(),legends:Ga,tooltip:$==!0||$=="true"?de:de.replace(/\r\n/g,"<hr/>").replace(/[\r\n]/g,"<hr/>"),colors:Na,groupMode:st,format:Fa,startAngle:xt,endAngle:wt,offsetY:Lt,maxValue:Tt,valueScale:Ct,categories:G,lineLayerEnabled:Le==!0||Le=="true",overlays:M(kt)||[],barColor:decodeURIComponent(It),overrideTickColor:ke==!0||ke=="true",fixedMinValue:Rt,fixedMaxValue:At,barPadding:et(c||u,t==null?void 0:t.barPadding,Dt),barLabelPosition:Ft,lineLabelPosition:Bt,barInnerPadding:et(c||u,t==null?void 0:t.barInnerPadding,Et),xLabelColor:decodeURIComponent(Pt),barLabelColor:decodeURIComponent(qt),legendLabelColor:decodeURIComponent(Nt),tooltipEnabled:Me==!0||Me=="true",legendLabelBack:Re==!0||Re=="true",legendCheckBack:Ie==!0||Ie=="true",highlightXAxisLine:Ae==!0||Ae=="true",showTickLine:De==!0||De=="true",showRightAxis:Fe==!0||Fe=="true",offsetRight:St,offsetBottom:Gt,confidenceIntervals:M(Ut)||[],showPoints:Ee==!0||Ee=="true",enableArea:Be==!0||Be=="true",areaShadingCriteria:$t,areaLowerBound:Ht,areaUpperBound:Wt,showGroupTotal:Ne==!0||Ne=="true",groupTotalMeasure:Zt,groupTotalLabel:Ot,groupTotalFormat:Ea,groupTotalOffset:ta,groupTotalFixedPosition:ze==!0||ze=="true",centerLabel:Yt,showArcLabels:Pe==!0||Pe=="true",showArcLinkLabels:qe==!0||qe=="true",slicePadding:_t,centerLabelFontWeight:Jt,centerLabelFontSize:jt,centerLabelXOffset:Kt,centerLabelYOffset:Qt,userMeasures:Da,tooltipEnableMarkdown:$==!0||$=="true",yAxisTickValues:c||u?t.yAxisTickValues??Xe:Xe,xAxisTickValues:c||u?t.xAxisTickValues??Se:Se,lineXAxisTickMode:fa,lineXAxisTickCount:parseInt(ga)||10,lineXAxisTickEvery:parseInt(ba)||1,enableGridY:T==!0||T=="true",enableGridX:C==!0||C=="true",offsetText:aa,selectedMeasures:v,overallLabel:re,minMaxClamp:ra,reverseLegend:Ge==!0||Ge=="true",customAxisFormat:Ba,sort:Ve,sortReverse:H==!0||H=="true",sortReverseSecondDimension:W==!0||W=="true",radarCurve:oa,radarFillOpacity:na,radarBorderWidth:sa,radarGridLevels:ia,radarGridShape:da,radarGridLabelOffset:la,radarEnableDots:$e==!0||$e=="true",radarDotSize:ca,radarEnableDotLabel:He==!0||He=="true",radarDotLabelOffset:ua,sortSecondDimension:Ue,mobileCustomization:We,dimension1:N,previewMode:f,lineCurve:pa,showLegendsInColumns:_e==!0||_e=="true",numberOfLegendColumns:parseInt(ha)||4},le={},ce=M(vt)||{};ce&&ce.forEach&&ce.forEach(e=>{e.value!=null&&e.value.filter(n=>n!=null&&n.toString().trim()!="").length>0&&(le[e.param]=e.value)}),fe&&(le.dvzProxyDatasetId=fe);let I=null,R=null;if(r==="csv")I=nr.default;else switch(q){case"line":I=O.default.LineDataFrame;break;case"pie":I=O.default.PieDataFrame;break;case"radar":I=O.default.BarDataFrame;break;default:I=O.default.BarDataFrame;break}let A=!1;switch(q){case"bar":R=ar.default,A=r!="csv"&&N=="none"&&v.length==0;break;case"line":R=rr.default,A=r!=="csv"&&(v.length===0||N==="none");break;case"pie":A=r!="csv"&&v.length==0,R=er.default;break;case"radar":A=r!="csv"&&v.length==0,R=tr.default;break;default:R=l.jsx("div",{children:"No Chart"});break}const Ha=ct==="true",X=[];N!="none"&&X.push(N),be!="none"&&X.push(be);const[at,Wa]=h.useState(0),[vr,Ya]=h.useState(rt());function rt(){var e;return((e=window.screen.orientation)==null?void 0:e.type)||(window.innerWidth>window.innerHeight?"landscape-primary":"portrait-primary")}return h.useEffect(()=>{const e=setTimeout(()=>{oe&&(()=>{const o=Y.current.querySelector(".legends.container.has-standard-12-font-size.bottom")||Y.current.querySelector(".legends.container.items-section:not(.legends.container.top .items-section)");if(!o||o.closest(".legends.container.top"))return;const{clientHeight:p}=o,y=window.getComputedStyle(o),S=parseInt(y.marginTop),x=parseInt(y.marginBottom),_a=parseInt(y.paddingTop),Ja=parseInt(y.paddingBottom),ja=p+S+x+_a+Ja,ot=o.closest(".ui.fluid.container.content");if(ot){const L=ot.querySelector(".data-source");if(L){const D=L.getBoundingClientRect(),F=o.getBoundingClientRect();if(F.bottom!==0&&D.top!==0){if(o.textContent.trim()==="")return;const K=x,Q=F.bottom+K,me=window.getComputedStyle(L),Z=parseFloat(me.marginTop)||0,B=D.top-Z;if(Q>B){let E=Q-B;E<5&&(E+=1),L.style.marginTop=`${E+1}px`}}else setTimeout(()=>{D.top<F.bottom&&(L.style.marginTop=`${F.bottom-D.top+1}px`)},1e3)}}const ue=o.closest(".chart.container");if(ue){const L=ue.getBoundingClientRect(),D=window.getComputedStyle(ue),F=Number.parseFloat(D.marginBottom)||0,K=L.bottom+F,Q=o.getBoundingClientRect(),me=Number.parseFloat(y.marginTop)||0,Z=Q.top-me;if(Z<K){const B=K-Z,E=200,Ka=Math.min(B+1,E);B>0&&B<E&&(o.style.marginTop=`${Ka}px`)}}Wa(ja)})()},100);return()=>{clearTimeout(e)}},[oe,Y]),h.useEffect(()=>{const e=()=>{setTimeout(()=>{Ya(rt())},100)};return window.screen.orientation?window.screen.orientation.addEventListener("change",e):window.addEventListener("resize",e),()=>{window.screen.orientation?window.screen.orientation.removeEventListener("change",e):window.removeEventListener("resize",e)}},[]),l.jsx("div",{ref:Y,children:l.jsxs(pe.Container,{className:"chart container",style:{minHeight:q==="pie"&&window.innerWidth<=480?`${parseInt(V)+parseInt(at)*.5}px`:`${parseInt(V)+parseInt(at)}px`},fluid:!0,children:[l.jsx(Qa.default,{editing:i,style:{height:`${_}px`},params:le,waitForFilters:ma==="true",app:r,group:ge,csv:pt,store:[r,ee,...X],source:X.join("/"),children:l.jsxs(pe.Container,{style:{height:`${_}px`},className:"body",fluid:!0,children:[A&&l.jsx(nt.default,{editing:i}),!A&&l.jsxs(Za.default,{children:[l.jsx(nt.default,{app:r,group:ge,noDataMsg:Mt,children:" "}),l.jsx(I,{locale:je,colorBy:z,hiddenBars:Vt,swap:U==="true"||U===!0,type:q,includeTotal:!0,includeOverall:Ce===!0||Ce==="true",overallLabel:re,measures:v,dimensions:[...X],sort:Ve,sortReverse:H===!0||H==="true",sortSecondDimension:Ue,sortReverseSecondDimension:W===!0||W==="true",customLabels:Ze(),children:l.jsx(sr.default,{type:q,app:r,locale:je,overallLabel:re,customLabels:Ze(),manualColors:Ca(),colorBy:z,scheme:te,barColor:tt.barColor,children:l.jsx(R,{...tt})})})]})]})}),l.jsx("br",{}),Ha&&k&&qa==="info"&&l.jsx(pe.Container,{fluid:!0,style:{height:_+"px"},className:"body",children:l.jsx(or.PostContent,{post:{content:{rendered:k}}})})]})})},cr=(P,he)=>{const{"data-app":i,"data-group":ee}=he,k=P.getIn(["data","measures",i,ee]),G=P.getIn(["data","pageModuleProps"]),d={};return k&&Object.keys(k).length>0&&(d.injectedMeasures=k??{}),G&&(d.pageModuleProps=G),d},ur={},mr=ir.connect(cr,ur)(dr.injectIntl(lr));exports.default=mr;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("react/jsx-runtime"),g=require("react"),ie=require("semantic-ui-react"),ar=require("../data/DataProvider.js"),rr=require("../data/DataConsumer.js"),nt=require("../../utils/deviceType.js"),or=require("./Pie.js");require("immutable");const nr=require("./Radar.js"),sr=require("./Bar.js"),ir=require("./Line.js"),dr=require("@devgateway/wp-react-lib"),_=require("./data/index.js"),lr=require("./CSVDataFrame.js"),cr=require("./colors/ColorProvider.js"),st=require("./Messages.js"),ur=require("react-redux"),mr=require("react-intl"),pr=F=>{let{parent:de,editing:i=!1,unique:J,childContent:k,categories:z,injectedMeasures:l,"data-app":o="csv","data-dvz-proxy-dataset-id":le,"data-group":ce="default","data-height":O=500,"data-type":N="bar","data-dimension1":E,"data-dimension2":ue,"data-dimension3":br,"data-color-by":P="index","data-scheme":K="system","data-group-mode":it="grouped","data-left-legend":dt="Left Legend","data-legend-label":lt="","data-bottom-legend":ct="Bottom Legend","data-dualmode":ut,"data-legend-position":me="right","data-show-legends":pe="true","data-data-source-label":xr="Source","data-chart-data-source":vr="Data Source","data-toggle-info-label":wr="Info Graphic","data-toggle-chart-label":yr="Chart","data-tick-rotation":p=0,"data-tick-color":mt="rgb(92,93,99)","data-measures":pt="{}","data-format":Lr="{}","data-csv":ht="","data-margin-left":ft=50,"data-margin-top":gt=25,"data-margin-right":bt=25,"data-margin-bottom":xt=25,"data-start-angle":vt=0,"data-end-angle":wt=360,"data-view-mode":he="info","data-filters":yt="[]","data-tooltip-html":Lt="","data-layout":Q="vertical","data-reverse":fe="false","data-offset-y":kt="-40","data-line-layer-enabled":ge="false","data-overlays":Tt="[]","data-max-value":Ct="auto","data-value-scale":It="linear","data-swap":X="false","data-no-data-message":Mt="No data matches your selection","data-bar-color":Rt="rgb(0,0,0)","data-override-tick-color":be="false","data-fixed-min-value":At=0,"data-fixed-max-value":Dt=0,"data-bar-padding":Ft=.15,"data-bar-label-position":Et="middle","data-line-label-position":Pt="none","data-show-grid":xe="true","data-include-overall":ve="false","data-bar-inner-padding":Bt=.7,"data-x-label-color":qt="#000","data-bar-label-color":zt="#000","data-legend-label-color":Nt="#000","data-tooltip-enabled":we="true","data-use-check-box-background":ye="false","data-use-label-background":Le="true","data-highlight-xaxis-line":ke="false","data-show-tick-line":Te="true","data-show-right-axis":Ce="true","data-manual-colors":Xt="{}","data-right-legend":Gt="","data-offset-right":Vt="40","data-offset-bottom":Ut="40","data-hidden-bars":$t=[],"data-confidence-intervals":Ht="[]","data-enable-area":Ie="false","data-area-shading-criteria":St="DEFAULT","data-area-lower-bound":Wt="","data-area-upper-bound":Yt="","data-show-points":Me="true","data-center-label":_t="","data-show-arc-labels":Re="true","data-show-arc-link-labels":Ae="true","data-slice-padding":Jt=1,"data-center-label-font-weight":Ot="normal","data-center-label-font-size":Kt="12","data-center-label-xoffset":Qt=0,"data-center-label-yoffset":Zt=0,"data-group-total-measure":jt="","data-show-group-total":De="true","data-group-total-label":ea="","data-group-total-format":ta="{}","data-group-total-label-offset":aa,"data-group-total-fixed-position":Fe="false","data-tooltip-enable-markdown":G="false","data-y-axis-tick-values":Ee="10","data-x-axis-tick-values":Pe="10","data-enable-grid-y":T="true","data-enable-grid-x":C="false","data-offset-text":ra=0,"data-overall-label":Z="Overall","data-min-max-clamp":oa="false","data-reverse-legend":Be="false","data-sort":qe="default","data-sort-reverse":V="false","data-sort-second-dimension":ze="default","data-sort-reverse-second-dimension":U="false","data-radar-curve":na="linearClosed","data-radar-fill-opacity":sa=.25,"data-radar-border-width":ia=2,"data-radar-grid-levels":da=3,"data-radar-grid-shape":la="circular","data-radar-grid-label-offset":ca=36,"data-radar-enable-dots":Ne="true","data-radar-dot-size":ua=8,"data-radar-enable-dot-label":Xe="true","data-radar-dot-label-offset":ma=-12,"data-mobile-customization":Ge="{}","data-show-percentage":Ve="false","data-preview-mode":b="Desktop","data-wait-for-filters":pa="false","data-line-curve":ha="linear","data-show-legends-in-columns":Ue="false","data-number-of-legend-columns":fa=4,"data-line-x-axis-tick-mode":ga="none","data-line-x-axis-tick-count":ba=10,"data-line-x-axis-tick-every":xa=1,pageModuleProps:x}=F;const va=i,t=JSON.parse(decodeURIComponent(Ge)),[$,wa]=g.useState(window.innerWidth<=1250),y=$&&((t==null?void 0:t.showCustomization)??!1);x!=null&&x.previewMode&&(x!=null&&x.editing)&&(b=x.previewMode,i=x.editing);const ya=["Tablet"].includes(b)&&i,La=["Mobile"].includes(b)&&i,ka=["Desktop"].includes(b)&&i,u=y&&b!=="Desktop",m=y&&!i,j=()=>{const e=window.matchMedia("(min-width: 768px) and (max-width: 1250px)").matches,n=window.matchMedia("(max-width: 767px)").matches;switch(!0){case ka:return p;case ya:return y?(t==null?void 0:t.tabletXAxisTextRotation)??p:p;case La:return y?(t==null?void 0:t.mobileXAxisTextRotation)??p:p;case e:return y?(t==null?void 0:t.tabletXAxisTextRotation)??p:p;case n:return y?(t==null?void 0:t.mobileXAxisTextRotation)??p:p;default:return p}},Ta=j(),[Ca,$e]=g.useState(Ta),He=F.intl.locale,I=g.useRef(null),Se=e=>{try{return va?e:decodeURIComponent(e)}catch{return console.error(`error decoding value:${e}`),e}},M=e=>{try{return JSON.parse(Se(e))}catch{console.error(`error parsing value:${e}`)}return null},Ia=()=>{const e=M(Xt);if(!e)return null;const n=e[o];if(o==="csv"&&n&&K==="manual"){const r={},d={};Object.keys(n).forEach(w=>{const f=n[w];typeof f=="string"?r[w]=f:typeof f=="object"&&f!==null&&(d[w]=f)});const h=d[P]||{};return{[P]:{...r,...h}}}return n},Ma=()=>M(pt),We=()=>{var e;if(a!=null&&a[o]){let n=(e=a==null?void 0:a[o])==null?void 0:e.format;if(!n){const r=Object.keys(a==null?void 0:a[o]);for(let d=0;d<r.length;d++)if(a!=null&&a[o][r[d]].selected&&(a!=null&&a[o][r[d]].format)){n=a==null?void 0:a[o][r[d]].format;break}}return n}return a!=null&&a.csv?a.csv.format:null},Ra=()=>{let e=null;return a!=null&&a[o]?a[o].useCustomAxisFormat&&a[o].customFormat&&(e=a[o].customFormat):a!=null&&a.csv&&a.csv.useCustomAxisFormat&&a.csv.customFormat&&(e=a.csv.customFormat),e},Aa=()=>a!=null&&a[o]?Object.keys(a[o]).map(e=>({value:e,...a[o][e]})).filter(e=>e.selected).map(e=>e.value):[],Ye=()=>{const e={};return a!=null&&a[o]&&Object.keys(a[o]).map(r=>({value:r,...a[o][r]})).filter(r=>r.selected&&r.hasCustomLabel).forEach(r=>{e[r.value]=r.customLabel}),e},Da=()=>a!=null&&a[o]?Object.keys(a[o]).filter(e=>a[o][e].allowSelection):[];let a=Ma(),L=Aa(),v=We();const Fa=Da();let ee=dt,te=Gt,ae=Se(Lt);if(l!=null&&l[o]){const e=Object.keys(l[o].measures).map(n=>({value:n,...l[o].measures[n]})).filter(n=>n.selected).map(n=>n.value);a=l,L=e,v=We(),ee=l.leftTitle,te=l.rightTitle,l.customTooltip&&(ae=l.customTooltip)}const Ea=v?{style:v.style==="compacted"?"decimal":v.style,notation:v.style==="compacted"?"compact":"standard",currency:v.currency,minimumFractionDigits:parseInt(v.minimumFractionDigits),maximumFractionDigits:parseInt(v.maximumFractionDigits)}:{notation:"standard",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:2},Pa=Ra(),s=M(ta),Ba={style:(s==null?void 0:s.style)==="compacted"?"decimal":s==null?void 0:s.style,notation:(s==null?void 0:s.style)==="compacted"?"compact":"standard",currency:s==null?void 0:s.currency,minimumFractionDigits:parseInt(s==null?void 0:s.minimumFractionDigits),maximumFractionDigits:parseInt(s==null?void 0:s.maximumFractionDigits)},[qa,kr]=g.useState(he),za=i?he:qa,Na={scheme:K,colorBy:P},H=i?O-80:O,Xa=()=>(u||m)&&!(t!=null&&t.showXAxisTitle)?"":ct,Ga=()=>u||m?t!=null&&t.showYAxisTitle?ee:"":ee,Va=()=>u||m?t!=null&&t.showRightAxisTitle?te:"":te,Ua={left:Ga(),bottom:Xa(),right:Va()},S=e=>{if(e==="true"||e===!0)return!0;if(e==="false"||e===!1)return!1},_e=()=>{S(C)&&!S(T)?(C=!1,T=!0):!S(C)&&S(T)&&(C=!0,T=!1)},$a=()=>Q==="horizontal"?(_e(),"vertical"):(_e(),"horizontal"),Ha=()=>t!=null&&t.chartLayoutOverride?$a():Q,W=(e,n,r)=>e?Number.parseInt(n)??r:r,Je=(e,n,r)=>e?n??r:r;g.useEffect(()=>{const e=()=>{wa(window.innerWidth<=1250);const n=j();$e(n)};return window.addEventListener("resize",e),$e(j()),()=>{window.removeEventListener("resize",e)}},[i,b,y,p,t==null?void 0:t.tabletXAxisTextRotation,t==null?void 0:t.mobileXAxisTextRotation]);const Sa=()=>{const e=["tablet","mobile","midTablet"].includes(nt.default());return i&&b==="Desktop"?me:e?"bottom":me},Oe={app:o,editing:i,tickColor:decodeURIComponent(mt),tickRotation:Ca,layout:u||m?Ha():Q,reverse:fe==!0||fe=="true",showLegends:pe==!0||pe=="true",legendLabel:lt,swap:X==!0||X=="true",showGrid:xe==!0||xe=="true",showPercentage:Ve==!0||Ve=="true",marginLeft:W(u||m,Number.parseInt(t==null?void 0:t.marginLeft),parseInt(ft)),marginTop:W(u||m,Number.parseInt(t==null?void 0:t.marginTop),parseInt(gt)),marginRight:W(u||m,Number.parseInt(t==null?void 0:t.marginRight),Number.parseInt(bt)),marginBottom:W(u||m,Number.parseInt(t==null?void 0:t.marginBottom),Number.parseInt(xt)),height:`${H}px`,legendPosition:Sa(),legends:Ua,tooltip:G==!0||G=="true"?ae:ae.replace(/\r\n/g,"<hr/>").replace(/[\r\n]/g,"<hr/>"),colors:Na,groupMode:it,format:Ea,startAngle:vt,endAngle:wt,offsetY:kt,maxValue:Ct,valueScale:It,categories:z,lineLayerEnabled:ge==!0||ge=="true",overlays:M(Tt)||[],barColor:decodeURIComponent(Rt),overrideTickColor:be==!0||be=="true",fixedMinValue:At,fixedMaxValue:Dt,barPadding:Je(u||m,t==null?void 0:t.barPadding,Ft),barLabelPosition:Et,lineLabelPosition:Pt,barInnerPadding:Je(u||m,t==null?void 0:t.barInnerPadding,Bt),xLabelColor:decodeURIComponent(qt),barLabelColor:decodeURIComponent(zt),legendLabelColor:decodeURIComponent(Nt),tooltipEnabled:we==!0||we=="true",legendLabelBack:Le==!0||Le=="true",legendCheckBack:ye==!0||ye=="true",highlightXAxisLine:ke==!0||ke=="true",showTickLine:Te==!0||Te=="true",showRightAxis:Ce==!0||Ce=="true",offsetRight:Vt,offsetBottom:Ut,confidenceIntervals:M(Ht)||[],showPoints:Me==!0||Me=="true",enableArea:Ie==!0||Ie=="true",areaShadingCriteria:St,areaLowerBound:Wt,areaUpperBound:Yt,showGroupTotal:De==!0||De=="true",groupTotalMeasure:jt,groupTotalLabel:ea,groupTotalFormat:Ba,groupTotalOffset:aa,groupTotalFixedPosition:Fe==!0||Fe=="true",centerLabel:_t,showArcLabels:Re==!0||Re=="true",showArcLinkLabels:Ae==!0||Ae=="true",slicePadding:Jt,centerLabelFontWeight:Ot,centerLabelFontSize:Kt,centerLabelXOffset:Qt,centerLabelYOffset:Zt,userMeasures:Fa,tooltipEnableMarkdown:G==!0||G=="true",yAxisTickValues:u||m?t.yAxisTickValues??Ee:Ee,xAxisTickValues:u||m?t.xAxisTickValues??Pe:Pe,lineXAxisTickMode:ga,lineXAxisTickCount:parseInt(ba)||10,lineXAxisTickEvery:parseInt(xa)||1,enableGridY:T==!0||T=="true",enableGridX:C==!0||C=="true",offsetText:ra,selectedMeasures:L,overallLabel:Z,minMaxClamp:oa,reverseLegend:Be==!0||Be=="true",customAxisFormat:Pa,sort:qe,sortReverse:V==!0||V=="true",sortReverseSecondDimension:U==!0||U=="true",radarCurve:na,radarFillOpacity:sa,radarBorderWidth:ia,radarGridLevels:da,radarGridShape:la,radarGridLabelOffset:ca,radarEnableDots:Ne==!0||Ne=="true",radarDotSize:ua,radarEnableDotLabel:Xe==!0||Xe=="true",radarDotLabelOffset:ma,sortSecondDimension:ze,mobileCustomization:Ge,dimension1:E,previewMode:b,lineCurve:ha,showLegendsInColumns:Ue==!0||Ue=="true",numberOfLegendColumns:parseInt(fa)||4},re={},oe=M(yt)||{};oe&&oe.forEach&&oe.forEach(e=>{e.value!=null&&e.value.filter(n=>n!=null&&n.toString().trim()!="").length>0&&(re[e.param]=e.value)}),le&&(re.dvzProxyDatasetId=le);let R=null,A=null;if(o==="csv")R=lr.default;else switch(N){case"line":R=_.default.LineDataFrame;break;case"pie":R=_.default.PieDataFrame;break;case"radar":R=_.default.BarDataFrame;break;default:R=_.default.BarDataFrame;break}let D=!1;switch(N){case"bar":A=sr.default,D=o!="csv"&&E=="none"&&L.length==0;break;case"line":A=ir.default,D=o!=="csv"&&(L.length===0||E==="none");break;case"pie":D=o!="csv"&&L.length==0,A=or.default;break;case"radar":D=o!="csv"&&L.length==0,A=nr.default;break;default:A=c.jsx("div",{children:"No Chart"});break}const Wa=ut==="true",B=[];E!="none"&&B.push(E),ue!="none"&&B.push(ue);const[Ya,_a]=g.useState(0),[Tr,Ja]=g.useState(Qe()),Ke=g.useRef(null);function Qe(){var e;return((e=window.screen.orientation)==null?void 0:e.type)||(window.innerWidth>window.innerHeight?"landscape-primary":"portrait-primary")}return g.useEffect(()=>{if(!$)return;const e=()=>{var et,tt;const r=((et=I.current)==null?void 0:et.querySelector(".legends.container.has-standard-12-font-size.bottom"))||((tt=I.current)==null?void 0:tt.querySelector(".legends.container.items-section:not(.legends.container.top .items-section)"));if(!r||r.closest(".legends.container.top"))return;r.style.marginTop="";const{clientHeight:d}=r,h=window.getComputedStyle(r),w=parseInt(h.marginTop),f=parseInt(h.marginBottom),Y=parseInt(h.paddingTop),q=parseInt(h.paddingBottom),Oa=nt.default()==="mobile"?d:d+w+f+Y+q,je=r.getBoundingClientRect(),Ka=je.width===0;if(!$&&!Ka){const ne=r.closest(".chart.container");if(ne){const Qa=ne.getBoundingClientRect(),Za=window.getComputedStyle(ne),ja=Number.parseFloat(Za.marginBottom)||0,at=Qa.bottom+ja,er=Number.parseFloat(h.marginTop)||0,rt=je.top-er;if(rt<at){const se=at-rt,ot=200,tr=Math.min(se+1,ot);se>0&&se<ot&&(r.style.marginTop=`${tr}px`)}}}_a(Oa)},n=()=>{var f,Y;const r=((f=I.current)==null?void 0:f.querySelector(".legends.container.has-standard-12-font-size.bottom"))||((Y=I.current)==null?void 0:Y.querySelector(".legends.container.items-section:not(.legends.container.top .items-section)"));if(!r){const q=setTimeout(n,100);return()=>clearTimeout(q)}const d=new ResizeObserver(()=>{e()});d.observe(r),Ke.current=d;const h=new IntersectionObserver(q=>{q.forEach(Ze=>{Ze.isIntersecting&&e()})},{threshold:0});h.observe(r);const w=()=>{e()};return window.addEventListener("resize",w),e(),()=>{d.disconnect(),h.disconnect(),window.removeEventListener("resize",w),Ke.current=null}};return n()},[$,I]),g.useEffect(()=>{const e=()=>{setTimeout(()=>{Ja(Qe())},100)};return window.screen.orientation?window.screen.orientation.addEventListener("change",e):window.addEventListener("resize",e),()=>{window.screen.orientation?window.screen.orientation.removeEventListener("change",e):window.removeEventListener("resize",e)}},[]),c.jsx("div",{ref:I,children:c.jsxs(ie.Container,{className:"chart container",style:{minHeight:`${parseInt(O)+parseInt(Ya)}px`},fluid:!0,children:[c.jsx(ar.default,{editing:i,style:{height:`${H}px`},params:re,waitForFilters:pa==="true",app:o,group:ce,csv:ht,store:[o,J,...B],source:B.join("/"),children:c.jsxs(ie.Container,{style:{height:`${H}px`},className:"body",fluid:!0,children:[D&&c.jsx(st.default,{editing:i}),!D&&c.jsxs(rr.default,{children:[c.jsx(st.default,{app:o,group:ce,noDataMsg:Mt,children:" "}),c.jsx(R,{locale:He,colorBy:P,hiddenBars:$t,swap:X==="true"||X===!0,type:N,includeTotal:!0,includeOverall:ve===!0||ve==="true",overallLabel:Z,measures:L,dimensions:[...B],sort:qe,sortReverse:V===!0||V==="true",sortSecondDimension:ze,sortReverseSecondDimension:U===!0||U==="true",customLabels:Ye(),children:c.jsx(cr.default,{type:N,app:o,locale:He,overallLabel:Z,customLabels:Ye(),manualColors:Ia(),colorBy:P,scheme:K,barColor:Oe.barColor,children:c.jsx(A,{...Oe})})})]})]})}),c.jsx("br",{}),Wa&&k&&za==="info"&&c.jsx(ie.Container,{fluid:!0,style:{height:H+"px"},className:"body",children:c.jsx(dr.PostContent,{post:{content:{rendered:k}}})})]})})},hr=(F,de)=>{const{"data-app":i,"data-group":J}=de,k=F.getIn(["data","measures",i,J]),z=F.getIn(["data","pageModuleProps"]),l={};return k&&Object.keys(k).length>0&&(l.injectedMeasures=k??{}),z&&(l.pageModuleProps=z),l},fr={},gr=ur.connect(hr,fr)(mr.injectIntl(pr));exports.default=gr;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const R=require("react/jsx-runtime"),c=require("react"),D=require("./PostsFilterDropdown.js"),E=require("../../conf/index.js"),F=u=>{const{taxonomy:n,group:p,placeholder:f,allLabel:d,noneLabel:g,useSingleColumn:y,enableTextSearch:m,filterType:S,showNoDataOption:h,closeOnSelect:x,allNoneSameBehaviour:O,autoApply:P,alphabeticalSort:v,ascOrder:A,type:T,categories:a,onChange:b,wpApiBase:t,locale:s,...w}=u,[B,e]=c.useState([]),C=async()=>{if(!n||n==="none"){e([]);return}const _=t!=null&&t!==""?t:E.Config.REACT_APP_WP_API,j=s?`?lang=${s}`:"?lang=en",l=await(await fetch(_+"/wp/v2/"+n+j)).json();if(l){const r=l.map(o=>({key:o.id,value:o.id,text:o.name}));if(a){const o=r.filter(q=>a.indexOf(q.value.toString())>-1);e([]),e(o)}else e([]),e(r)}};return c.useEffect(()=>{let i=!1;return i||(e([]),C()),()=>{i=!0}},[T,n,a,t,s]),R.jsx(D.default,{...w,group:p,placeholder:f,allLabel:d,noneLabel:g,useSingleColumn:y,enableTextSearch:m,filterType:S,showNoDataOption:h,closeOnSelect:x,allNoneSameBehaviour:O,autoApply:P,alphabeticalSort:v,ascOrder:A,options:B,onChange:b})};exports.default=F;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const R=require("react/jsx-runtime"),u=require("react"),D=require("./PostsFilterDropdown.js"),E=require("../../conf/index.js"),F=p=>{const{taxonomy:n,group:f,placeholder:d,allLabel:g,noneLabel:m,useSingleColumn:y,enableTextSearch:b,filterType:h,showNoDataOption:x,closeOnSelect:O,allNoneSameBehaviour:P,autoApply:S,alphabeticalSort:v,ascOrder:A,type:N,categories:s,onChange:T,wpApiBase:t,locale:r,...w}=p,[B,e]=u.useState([]),C=async()=>{if(!n||n==="none"){e([]);return}const _=t!=null&&t!==""?t:E.Config.REACT_APP_WP_API,j=r?`?lang=${r}`:"?lang=en",l=await(await fetch(_+"/wp/v2/"+n+j)).json();if(l){const c=l.map(o=>({key:o.id,value:o.id,text:o.name}));if(s){const o=s.map(a=>Number(a)).filter(a=>!Number.isNaN(a)),q=c.filter(a=>o.indexOf(Number(a.value))>-1);e([]),e(q)}else e([]),e(c)}};return u.useEffect(()=>{let i=!1;return i||(e([]),C()),()=>{i=!0}},[N,n,s,t,r]),R.jsx(D.default,{...w,group:f,placeholder:d,allLabel:g,noneLabel:m,useSingleColumn:y,enableTextSearch:b,filterType:h,showNoDataOption:x,closeOnSelect:O,allNoneSameBehaviour:P,autoApply:S,alphabeticalSort:v,ascOrder:A,options:B,onChange:T})};exports.default=F;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const h=require("react/jsx-runtime"),i=require("react"),ce=require("semantic-ui-react"),s=require("../../utils/data.js"),ue=require("../../redux/hooks.js"),ye=require("react-redux"),de=require("./CategoricalFilter.js"),pe=require("./YearFilter.js"),R=require("react-intl"),Fe=q=>{const{"data-alphabetical-sort":v,"data-asc-order":M,"data-group":c,"data-placeholder":C,"data-all-label":T,"data-none-label":B,"data-use-single-column":j,"data-enable-text-search":D,"data-filter-type":p,"data-show-no-data-option":P,"data-close-on-select":z,"data-all-none-same-behaviour":J,"data-auto-apply":K,"data-taxonomy":u,"data-categories":F="[]","data-is-country-filter":U,"data-is-year-filter":k,"data-type":$,"data-sort-first-by":b,"data-default-values":G="[]","data-wordpress-source-type":me,"data-wordpress-source":O,editing:x=!1}=q,d=ue.useAppDispatch(),{locale:H}=R.useIntl(),t=ye.useSelector(e=>e.getIn(["data","posts",c]))||{},a=p==="multi-select",[N,fe]=i.useState(0),V=e=>x?e:decodeURIComponent(e),A=e=>{try{return JSON.parse(V(e))}catch(o){return console.warn("JSON parsing failed for value:",e,"- treating as plain string. Error:",o),V(e)}};let l=A(G);l||(l=[]),typeof l=="string"&&(l=l.split(",").map(Number)),typeof l=="number"&&(l=[l]);const Q=s.toBoolean(v),W=s.toBoolean(M),I=s.toBoolean(P),_=s.toBoolean(z),w=s.toBoolean(J),Y=s.toBoolean(K),r=s.toBoolean(U),n=s.toBoolean(k),E=s.toBoolean(j),L=s.toBoolean(D),g=b!=="none"?s.toNumber(b):null,[y,X]=i.useState([]),[m,Z]=i.useState(!1),S=(e,o)=>o?Array.isArray(e)?e:e!=null?[e]:[]:e||void 0,ee=i.useMemo(()=>S(t.countryFilter,a),[t.countryFilter,a]),te=i.useMemo(()=>S(t.categoryFilter,a),[t.categoryFilter,a]),re=i.useMemo(()=>n?S(t.yearFilter,a):void 0,[t.yearFilter,a,n]),f=i.useMemo(()=>{if(!F)return[];const e=A(F);return Array.isArray(e)?e:typeof e=="string"?e.split(",").filter(Boolean):[]},[F,x]),oe=e=>{d({type:"SET_POSTS_FILTER",group:c,...t,isYearFilter:n,yearFilter:n?e:null,isCountryFilter:r,categoryFilter:t.categoryFilter,countryFilter:t.countryFilter,sortFirstBy:g})},ae=e=>{d({type:"SET_POSTS_FILTER",group:c,...t,categoryFilter:r?t.categoryFilter:e,countryFilter:r?e:t.countryFilter,isYearFilter:t.isYearFilter,yearFilter:t.yearFilter,isCountryFilter:t.isCountryFilter,sortFirstBy:r?g:t.sortFirstBy,countryCategory:r?u:t.countryCategory,categoryCategory:r?t.categoryCategory:e,categoryTaxonomy:r?t.categoryTaxonomy:u,countryTaxonomy:r?u:t.countryTaxonomy})};return i.useEffect(()=>{const e=l.length>0,o=a?l:l[0],le=r?t.categoryFilter:e?o:a?f.map(Number):t.categoryFilter,ne=r?e?o:a?f.map(Number):t.countryFilter:t.countryFilter,se=n&&a?y.length>0?y.map(ie=>ie.value):[]:t.yearFilter;d({type:"SET_INITIAL_POSTS_FILTER",group:c,categoryFilter:le,countryFilter:ne,isYearFilter:n,isCountryFilter:r,sortFirstBy:g,yearFilter:n?se:null,categoryCategory:r?null:t.categoryCategory,categoryTaxonomy:r?null:u,countryCategory:r?u:null,countryTaxonomy:r?u:null,page:1})},[]),i.useEffect(()=>{if(n&&!m&&a&&y.length>0){const e=y.map(o=>o.value);d({type:"SET_INITIAL_POSTS_FILTER",group:c,isYearFilter:n,yearFilter:e})}},[m]),h.jsxs(ce.Container,{fluid:!0,className:"filter post-filter",children:[n&&h.jsx(pe.default,{group:c,placeholder:C,allLabel:T,noneLabel:B,useSingleColumn:E,enableTextSearch:L,filterType:p,showNoDataOption:I,closeOnSelect:_,allNoneSameBehaviour:w,autoApply:Y,alphabeticalSort:Q,ascOrder:W,options:y,value:re,yearOptions:y,setYearOptions:X,yearFilterLoading:m,setYearFilterLoading:Z,onChange:(e,o)=>{oe(o)},resetKey:N,wpApiBase:O??void 0}),!n&&h.jsx(de.default,{group:c,placeholder:C,allLabel:T,noneLabel:B,useSingleColumn:E,enableTextSearch:L,filterType:p,showNoDataOption:I,closeOnSelect:_,allNoneSameBehaviour:w,autoApply:Y,taxonomy:u,type:$,value:r?ee:te,onChange:(e,o)=>{ae(o)},categories:f,resetKey:N,wpApiBase:O??void 0,locale:H},`cat-${c}`)]})},ge=R.injectIntl(i.memo(Fe));exports.default=ge;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const f=require("react/jsx-runtime"),i=require("react"),ue=require("semantic-ui-react"),s=require("../../utils/data.js"),ye=require("../../redux/hooks.js"),pe=require("react-redux"),de=require("./CategoricalFilter.js"),Fe=require("./YearFilter.js"),v=require("react-intl"),ge=M=>{const{"data-alphabetical-sort":j,"data-asc-order":D,"data-group":c,"data-placeholder":h,"data-all-label":T,"data-none-label":C,"data-use-single-column":P,"data-enable-text-search":z,"data-filter-type":d,"data-show-no-data-option":J,"data-close-on-select":K,"data-all-none-same-behaviour":U,"data-auto-apply":k,"data-taxonomy":u,"data-categories":F="[]","data-is-country-filter":$,"data-is-year-filter":G,"data-type":H,"data-sort-first-by":b,"data-default-values":Q="[]","data-wordpress-source-type":Se,"data-wordpress-source":B,editing:O=!1}=M,p=ye.useAppDispatch(),{locale:W}=v.useIntl(),t=pe.useSelector(e=>e.getIn(["data","posts",c]))||{},a=d==="multi-select",[x,he]=i.useState(0),V=e=>O?e:decodeURIComponent(e),N=e=>{try{return JSON.parse(V(e))}catch(o){return console.warn("JSON parsing failed for value:",e,"- treating as plain string. Error:",o),V(e)}};let l=N(Q);l||(l=[]),typeof l=="string"&&(l=l.split(",").map(Number)),typeof l=="number"&&(l=[l]);const X=s.toBoolean(j),Z=s.toBoolean(D),A=s.toBoolean(J),I=s.toBoolean(K),_=s.toBoolean(U),w=s.toBoolean(k),r=s.toBoolean($),n=s.toBoolean(G),Y=s.toBoolean(P),E=s.toBoolean(z),g=b!=="none"?s.toNumber(b):null,[y,ee]=i.useState([]),[m,te]=i.useState(!1),S=(e,o)=>o?Array.isArray(e)?e:e!=null?[e]:[]:e||void 0,re=i.useMemo(()=>S(t.countryFilter,a),[t.countryFilter,a]),oe=i.useMemo(()=>S(t.categoryFilter,a),[t.categoryFilter,a]),ae=i.useMemo(()=>n?S(t.yearFilter,a):void 0,[t.yearFilter,a,n]),L=i.useMemo(()=>{if(!F)return[];const e=N(F);return Array.isArray(e)?e:typeof e=="string"||typeof e=="number"?e.toString().split(",").filter(o=>o.trim()!==""):[]},[F,O]),le=e=>{p({type:"SET_POSTS_FILTER",group:c,...t,isYearFilter:n,yearFilter:n?e:null,isCountryFilter:r,categoryFilter:t.categoryFilter,countryFilter:t.countryFilter,sortFirstBy:g})},ne=e=>{p({type:"SET_POSTS_FILTER",group:c,...t,categoryFilter:r?t.categoryFilter:e,countryFilter:r?e:t.countryFilter,isYearFilter:t.isYearFilter,yearFilter:t.yearFilter,isCountryFilter:t.isCountryFilter,sortFirstBy:r?g:t.sortFirstBy,countryCategory:r?u:t.countryCategory,categoryCategory:r?t.categoryCategory:e,categoryTaxonomy:r?t.categoryTaxonomy:u,countryTaxonomy:r?u:t.countryTaxonomy})};return i.useEffect(()=>{const e=l.length>0,o=a?l:l[0],R=L.map(Number),q=r?t.categoryFilter:e?o:a?R:t.categoryFilter,se=r?e?o:a?R:t.countryFilter:t.countryFilter,ie=n&&a?y.length>0?y.map(ce=>ce.value):[]:t.yearFilter;p({type:"SET_INITIAL_POSTS_FILTER",group:c,categoryFilter:q,countryFilter:se,isYearFilter:n,isCountryFilter:r,sortFirstBy:g,yearFilter:n?ie:null,categoryCategory:r?null:q,categoryTaxonomy:r?null:u,countryCategory:r?u:null,countryTaxonomy:r?u:null,page:1})},[]),i.useEffect(()=>{if(n&&!m&&a&&y.length>0){const e=y.map(o=>o.value);p({type:"SET_INITIAL_POSTS_FILTER",group:c,isYearFilter:n,yearFilter:e})}},[m]),f.jsxs(ue.Container,{fluid:!0,className:"filter post-filter",children:[n&&f.jsx(Fe.default,{group:c,placeholder:h,allLabel:T,noneLabel:C,useSingleColumn:Y,enableTextSearch:E,filterType:d,showNoDataOption:A,closeOnSelect:I,allNoneSameBehaviour:_,autoApply:w,alphabeticalSort:X,ascOrder:Z,options:y,value:ae,yearOptions:y,setYearOptions:ee,yearFilterLoading:m,setYearFilterLoading:te,onChange:(e,o)=>{le(o)},resetKey:x,wpApiBase:B??void 0}),!n&&f.jsx(de.default,{group:c,placeholder:h,allLabel:T,noneLabel:C,useSingleColumn:Y,enableTextSearch:E,filterType:d,showNoDataOption:A,closeOnSelect:I,allNoneSameBehaviour:_,autoApply:w,taxonomy:u,type:H,value:r?re:oe,onChange:(e,o)=>{ne(o)},categories:L,resetKey:x,wpApiBase:B??void 0,locale:W},`cat-${c}`)]})},me=v.injectIntl(i.memo(ge));exports.default=me;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("react/jsx-runtime"),d=require("react"),i=require("react-redux"),o=require("semantic-ui-react"),p=require("lodash.isequal"),I=require("react-intl"),g=l=>{const{"data-group":n,"data-reset-label":c="Reset All Filters"}=l,u=i.useDispatch(),r=i.useSelector(a=>a.getIn(["data","posts",n])),t=i.useSelector(a=>a.getIn(["data","posts","initialFilters",n])),e=d.useMemo(()=>r&&t?!p(r,t):!1,[r,t]);return s.jsxs(o.Container,{fluid:!0,style:{pointerEvents:e?"auto":"none",cursor:e?"pointer":"not-allowed",opacity:e?1:.5},className:`data-filters-reset ignore ${e?"":"disabled"}`,onClick:()=>{u({type:"SET_INITIAL_POSTS_FILTER",group:n,...t,reset:!0,page:1})},children:[s.jsx("span",{children:c}),s.jsx("span",{children:s.jsx(o.Icon,{disabled:!e,name:"undo alternate",className:"custom-undo-icon"})})]})},m=I.injectIntl(g);exports.default=m;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("react/jsx-runtime"),p=require("react"),l=require("react-redux"),d=require("semantic-ui-react"),f=require("lodash.isequal"),g=require("react-intl"),a=e=>e==null?e:Array.isArray(e)?[...e].map(a).sort((t,r)=>{const i=JSON.stringify(t),s=JSON.stringify(r);return i<s?-1:i>s?1:0}):typeof e=="object"?Object.keys(e).sort().reduce((t,r)=>(t[r]=a(e[r]),t),{}):typeof e=="number"||typeof e=="string"?String(e):e,m=e=>{const{"data-group":t,"data-reset-label":r="Reset All Filters"}=e,i=l.useDispatch(),s=l.useSelector(u=>u.getIn(["data","posts",t])),o=l.useSelector(u=>u.getIn(["data","posts","initialFilters",t])),n=p.useMemo(()=>s&&o?!f(a(s),a(o)):!1,[s,o]);return c.jsxs(d.Container,{fluid:!0,style:{pointerEvents:n?"auto":"none",cursor:n?"pointer":"not-allowed",opacity:n?1:.5},className:`data-filters-reset ignore ${n?"":"disabled"}`,onClick:()=>{i({type:"SET_INITIAL_POSTS_FILTER",group:t,...o,reset:!0,page:1})},children:[c.jsx("span",{children:r}),c.jsx("span",{children:c.jsx(d.Icon,{disabled:!n,name:"undo alternate",className:"custom-undo-icon"})})]})},y=g.injectIntl(m);exports.default=y;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),m=require("react"),a=require("semantic-ui-react"),g=require("@devgateway/wp-react-lib"),z=require("react-intl"),V=require("react-redux"),D=require("../connected-templates/PostIntro.js"),U=require("../../lib/hooks/window-dimensions.js"),Y=({posts:t,activeItem:d,setActive:i,showLabels:n})=>t?t.map(s=>e.jsx(a.Menu.Item,{onClick:()=>i(s.slug),className:s.slug===d?"active":"",children:n?e.jsx(g.PostLabel,{post:s}):e.jsx(a.Label,{children:e.jsx("span",{dangerouslySetInnerHTML:{__html:s.title.rendered}})})},s.id)):null,J=({posts:t,activeItem:d,setActive:i,showIcons:n,showLabels:s})=>{const c=t.length;return t?t.map(l=>{var w,b;return(w=l._embedded)!=null&&w["wp:featuredmedia"]&&l._embedded["wp:featuredmedia"][0].source_url,e.jsx(a.Grid.Column,{className:(l.slug===d?"active":"")+(n?" has-icon":""),children:e.jsxs(a.Button,{onClick:()=>i(l.slug),className:`nav ${c===1?"one":""}`,children:[n&&e.jsx(g.MediaProvider,{id:(b=l.meta_fields)!=null&&b.icon?l.meta_fields.icon[0]:null,children:e.jsx(g.MediaConsumer,{children:e.jsx(g.PostIcon,{className:"icon"})})}),s?e.jsx(g.PostLabel,{post:l}):e.jsx(a.Label,{children:e.jsx("span",{dangerouslySetInnerHTML:{__html:l.title.rendered}})})]})},l.id)}):null},F=({posts:t,activeItem:d})=>(m.useEffect(()=>{const i=document.querySelector(".ui.container.content-tab");i&&(i.scrollTop=0)},[d]),t?t.map(i=>{let n={};return i.slug!==d?n={position:"absolute",left:"-3000px",width:"auto",height:"0px",overflow:"hidden",visibility:"hidden"}:n={visibility:"visible",position:"relative",width:"auto"},e.jsx(D.default,{as:a.Container,fluid:!0,post:i,style:n},i.slug)}):null),K=({posts:t,activeItem:d,setActive:i})=>{const[n,s]=m.useState(t.findIndex(o=>o.slug===d)),[c,l]=m.useState(null),w=m.useRef(null),[b,I]=m.useState(window.innerWidth<=1250);m.useEffect(()=>{if(c){const o=c.getBoundingClientRect().top+window.scrollY;window.scrollTo({top:o,behavior:"smooth"})}},[c]);const j=()=>{var o;return((o=window.screen.orientation)==null?void 0:o.type)||(window.innerWidth>window.innerHeight?"landscape-primary":"portrait-primary")},[f,N]=m.useState(j()),x=()=>{setTimeout(()=>{N(j()),I(window.innerWidth<=1250)},100)},P=o=>{setTimeout(()=>{var u;const h=o.querySelectorAll(".accordion .legends.container.has-standard-12-font-size.bottom, .legends.container.items-section");if(h.length!==0)for(const r of h){const y=r.closest(".ui.fluid.container.content"),p=y?y.querySelector(".data-source"):null;if(!p||r.offsetParent===null||p.offsetParent===null||r.offsetHeight===0||p.offsetHeight===0)continue;const S=p.getBoundingClientRect(),B=r.getBoundingClientRect(),H=window.getComputedStyle(p),E=window.getComputedStyle(r),O=Number.parseFloat(H.marginTop)||0,W=Number.parseFloat(E.marginBottom)||0,T=B.bottom+W,k=S.top-O;if(T>k){const C=T-k;p.style.marginTop=`${C+20}px`}const M=(u=r.closest(".wp-block-column.is-layout-flow.wp-block-column-is-layout-flow"))==null?void 0:u.nextElementSibling;if(M){const C=M.getBoundingClientRect(),L=window.getComputedStyle(M),R=Number.parseFloat(L.marginTop)||0,v=C.top-R;if(T>v){const q=T-v;M.style.marginTop=`${q+20}px`}}const A=r.closest(".chart.container");if(A){const C=A.getBoundingClientRect(),L=window.getComputedStyle(A),R=Number.parseFloat(L.marginBottom)||0,v=C.bottom+R,q=Number.parseFloat(E.marginTop)||0,$=B.top-q;if($<v){const G=v-$;r.style.marginTop=`${G+20}px`}}}},10)};m.useEffect(()=>(window.screen.orientation&&window.screen.orientation.addEventListener("change",x),window.addEventListener("resize",x),()=>window.removeEventListener("resize",x)),[]),m.useEffect(()=>{let o;const h=[];return n!==-1&&(o=setTimeout(()=>{document.querySelectorAll(".accordion").forEach(r=>P(r))},0)),()=>{clearTimeout(o),h.forEach(u=>u.disconnect())}},[n,b,f]);const _=(o,h)=>{const{index:u}=h,r=n===u?-1:u;s(r),i(t[u].slug),r!==-1&&l(o.currentTarget)};return e.jsx(a.Accordion,{fluid:!0,styled:!0,children:t.map((o,h)=>{var r;const u=(r=o.meta_fields)!=null&&r.icon?o.meta_fields.icon[0]:null;return e.jsxs(m.Fragment,{children:[e.jsx(a.Accordion.Title,{active:n===h,index:h,onClick:_,children:e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[u&&e.jsx(g.MediaProvider,{id:u,children:e.jsx(g.MediaConsumer,{children:e.jsx(g.PostIcon,{className:"icon"})})}),e.jsx("span",{dangerouslySetInnerHTML:{__html:o.title.rendered},style:{marginLeft:u?"10px":"0"}})]}),e.jsx(a.Icon,{name:"chevron down"})]})}),e.jsx(a.Accordion.Content,{className:"accordion-post-content",active:n===h,children:e.jsx("div",{ref:w,children:e.jsx(D.default,{post:o,as:a.Container,fluid:!0})})})]},o.id)})})},Q=({posts:t,showLabels:d,height:i})=>{const[n,s]=m.useState(t?t[0].slug:null);return m.useEffect(()=>{setTimeout(()=>{if(window.location.hash){const c=window.location.hash.substr(1),l=document.getElementById(c);l&&t.map(w=>w.slug).indexOf(c)>-1&&(s(c),l.scrollIntoView({behavior:"auto",block:"start"}))}},0)},[t]),e.jsxs(m.Fragment,{children:[t.map(c=>e.jsx("anchor",{id:c.slug},c.slug)),e.jsx(a.Menu,{className:"tabbed posts",text:!0,children:e.jsx(Y,{showLabels:d,posts:t,setActive:s,activeItem:n})}),e.jsx(a.Container,{className:"content-tab",style:{height:`${i}px`},children:e.jsx(F,{posts:t,activeItem:n})})]})},X=({posts:t,showLabels:d,showIcons:i,height:n})=>{const[s,c]=m.useState(t?t[0].slug:null);return e.jsx(m.Fragment,{children:e.jsxs(a.Grid,{stackable:!0,className:"tabbed posts",columns:t.length,style:{height:n+"px"},children:[e.jsx(J,{showIcons:i,showLabels:d,posts:t,activeItem:s,setActive:c}),e.jsx(a.Grid.Row,{style:{height:`${n}px`},children:e.jsx(a.Grid.Column,{width:16,className:"content",children:e.jsx(a.Container,{className:"content-tab",style:{height:`${n}px`},children:e.jsx(F,{className:"content-tab",posts:t,activeItem:s})})})})]})})},Z=t=>{var S;let{"data-type":d,"data-taxonomy":i,"data-categories":n,"data-items":s,"data-theme":c="light","data-show-icons":l,"data-use-scrolls":w,"data-show-labels":b,"data-height":I,"data-preview-mode":j="Desktop",pageModuleProps:f,parent:N,editing:x,unique:P}=t;f!=null&&f.previewMode&&(f!=null&&f.editing)&&(j=f.previewMode,x=f.editing);const _=t.intl.locale,o=w==="true",h=o?I:void 0,{width:u}=U.useWindowDimensionsAndDevice(),r=u<=1024,y=j!=="Desktop"&&x,p=r&&!x;return e.jsx(a.Container,{className:`viz tabbed posts ${x?"editing":""} ${o?"scrollable":""}`,fluid:!0,children:e.jsx(g.PostProvider,{locale:_,type:d,taxonomy:i,categories:n,store:`tabbedposts_${N}_${P}`,page:1,perPage:s,children:e.jsx(g.PostConsumer,{children:e.jsx(g.PostConsumer,{children:p||y?e.jsx(K,{posts:s,activeItem:(S=s[0])==null?void 0:S.slug,setActive:()=>{}}):c==="light"?e.jsx(Q,{height:h,showLabels:b==="true"}):e.jsx(X,{height:h,showLabels:b==="true",showIcons:l==="true"})})})})})},ee=(t,d)=>{const i=t.getIn(["data","pageModuleProps"]),n={};return i&&(n.pageModuleProps=i),n},te={},ne=V.connect(ee,te)(z.injectIntl(Z));exports.default=ne;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),u=require("react"),l=require("semantic-ui-react"),h=require("@devgateway/wp-react-lib"),N=require("react-intl"),S=require("react-redux"),y=require("../connected-templates/PostIntro.js"),L=require("../../lib/hooks/window-dimensions.js"),q=({posts:t,activeItem:a,setActive:i,showLabels:n})=>t?t.map(s=>e.jsx(l.Menu.Item,{onClick:()=>i(s.slug),className:s.slug===a?"active":"",children:n?e.jsx(h.PostLabel,{post:s}):e.jsx(l.Label,{children:e.jsx("span",{dangerouslySetInnerHTML:{__html:s.title.rendered}})})},s.id)):null,A=({posts:t,activeItem:a,setActive:i,showIcons:n,showLabels:s})=>{const o=t.length;return t?t.map(r=>{var m,g;return(m=r._embedded)!=null&&m["wp:featuredmedia"]&&r._embedded["wp:featuredmedia"][0].source_url,e.jsx(l.Grid.Column,{className:(r.slug===a?"active":"")+(n?" has-icon":""),children:e.jsxs(l.Button,{onClick:()=>i(r.slug),className:`nav ${o===1?"one":""}`,children:[n&&e.jsx(h.MediaProvider,{id:(g=r.meta_fields)!=null&&g.icon?r.meta_fields.icon[0]:null,children:e.jsx(h.MediaConsumer,{children:e.jsx(h.PostIcon,{className:"icon"})})}),s?e.jsx(h.PostLabel,{post:r}):e.jsx(l.Label,{children:e.jsx("span",{dangerouslySetInnerHTML:{__html:r.title.rendered}})})]})},r.id)}):null},I=({posts:t,activeItem:a})=>(u.useEffect(()=>{const i=document.querySelector(".ui.container.content-tab");i&&(i.scrollTop=0)},[a]),t?t.map(i=>{let n={};return i.slug!==a?n={position:"absolute",left:"-3000px",width:"auto",height:"0px",overflow:"hidden",visibility:"hidden"}:n={visibility:"visible",position:"relative",width:"auto"},e.jsx(y.default,{as:l.Container,fluid:!0,post:i,style:n},i.slug)}):null),k=({posts:t,activeItem:a,setActive:i})=>{const[n,s]=u.useState(t.findIndex(d=>d.slug===a)),[o,r]=u.useState(null),m=u.useRef(null);u.useEffect(()=>{if(o){const d=o.getBoundingClientRect().top+window.scrollY;window.scrollTo({top:d,behavior:"smooth"})}},[o]);const g=(d,x)=>{const{index:c}=x,j=n===c?-1:c;s(j),i(t[c].slug),j!==-1&&r(d.currentTarget)};return e.jsx(l.Accordion,{fluid:!0,styled:!0,children:t.map((d,x)=>{var j;const c=(j=d.meta_fields)!=null&&j.icon?d.meta_fields.icon[0]:null;return e.jsxs(u.Fragment,{children:[e.jsx(l.Accordion.Title,{active:n===x,index:x,onClick:g,children:e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[c&&e.jsx(h.MediaProvider,{id:c,children:e.jsx(h.MediaConsumer,{children:e.jsx(h.PostIcon,{className:"icon"})})}),e.jsx("span",{dangerouslySetInnerHTML:{__html:d.title.rendered},style:{marginLeft:c?"10px":"0"}})]}),e.jsx(l.Icon,{name:"chevron down"})]})}),e.jsx(l.Accordion.Content,{className:"accordion-post-content",active:n===x,children:e.jsx("div",{ref:m,children:e.jsx(y.default,{post:d,as:l.Container,fluid:!0})})})]},d.id)})})},R=({posts:t,showLabels:a,height:i})=>{const[n,s]=u.useState(t?t[0].slug:null);return u.useEffect(()=>{setTimeout(()=>{if(window.location.hash){const o=window.location.hash.substr(1),r=document.getElementById(o);r&&t.map(m=>m.slug).indexOf(o)>-1&&(s(o),r.scrollIntoView({behavior:"auto",block:"start"}))}},0)},[t]),e.jsxs(u.Fragment,{children:[t.map(o=>e.jsx("anchor",{id:o.slug},o.slug)),e.jsx(l.Menu,{className:"tabbed posts",text:!0,children:e.jsx(q,{showLabels:a,posts:t,setActive:s,activeItem:n})}),e.jsx(l.Container,{className:"content-tab",style:{height:`${i}px`},children:e.jsx(I,{posts:t,activeItem:n})})]})},$=({posts:t,showLabels:a,showIcons:i,height:n})=>{const[s,o]=u.useState(t?t[0].slug:null);return e.jsx(u.Fragment,{children:e.jsxs(l.Grid,{stackable:!0,className:"tabbed posts",columns:t.length,style:{height:n+"px"},children:[e.jsx(A,{showIcons:i,showLabels:a,posts:t,activeItem:s,setActive:o}),e.jsx(l.Grid.Row,{style:{height:`${n}px`},children:e.jsx(l.Grid.Column,{width:16,className:"content",children:e.jsx(l.Container,{className:"content-tab",style:{height:`${n}px`},children:e.jsx(I,{className:"content-tab",posts:t,activeItem:s})})})})]})})},D=t=>{var v;let{"data-type":a,"data-taxonomy":i,"data-categories":n,"data-items":s,"data-theme":o="light","data-show-icons":r,"data-use-scrolls":m,"data-show-labels":g,"data-height":d,"data-preview-mode":x="Desktop",pageModuleProps:c,parent:j,editing:b,unique:C}=t;c!=null&&c.previewMode&&(c!=null&&c.editing)&&(x=c.previewMode,b=c.editing);const p=t.intl.locale,f=m==="true",w=f?d:void 0,{width:M}=L.useWindowDimensionsAndDevice(),_=M<=1024,P=x!=="Desktop"&&b,T=_&&!b;return e.jsx(l.Container,{className:`viz tabbed posts ${b?"editing":""} ${f?"scrollable":""}`,fluid:!0,children:e.jsx(h.PostProvider,{locale:p,type:a,taxonomy:i,categories:n,store:`tabbedposts_${j}_${C}`,page:1,perPage:s,children:e.jsx(h.PostConsumer,{children:e.jsx(h.PostConsumer,{children:T||P?e.jsx(k,{posts:s,activeItem:(v=s[0])==null?void 0:v.slug,setActive:()=>{}}):o==="light"?e.jsx(R,{height:w,showLabels:g==="true"}):e.jsx($,{height:w,showLabels:g==="true",showIcons:r==="true"})})})})})},G=(t,a)=>{const i=t.getIn(["data","pageModuleProps"]),n={};return i&&(n.pageModuleProps=i),n},E={},H=S.connect(G,E)(N.injectIntl(D));exports.default=H;
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),u=require("react"),I=require("semantic-ui-react"),T=require("@devgateway/wp-react-lib"),F=require("react-redux"),z=require("../connected-templates/PostIntro.js"),H=({posts:i,activeItem:d,setActive:p,colors:h})=>{const[m,g]=u.useState(i.findIndex(o=>o.slug===d)),[s,v]=u.useState(null),l=(o,r,c)=>{document.querySelectorAll(o).forEach(n=>{n.querySelector(r)&&n.classList.add(c)})};u.useEffect(()=>{if(s){const o=s.getBoundingClientRect().top+window.scrollY;window.scrollTo({top:o,behavior:"smooth"})}l(".ui.fluid.container.viz.featured.tabs",".accordion","has-accordion"),l(".ui.fluid.container.viz.featured.tabs","blockquote","has-blockquote"),l(".ui.fluid.container.viz.featured.tabs",".accordion .accordion-post-ft-title","has-accordion-title"),l(".ui.fluid.container.viz.featured.tabs",".accordion .accordion-post-vft-content","has-accordion-content"),l(".ui.fluid.container.viz.featured.tabs",".vt-accordion-post-intro figure","has-vt-accordion-figure"),l(".ui.fluid.container.viz.featured.tabs",".content.active.accordion-post-content .wp-block-columns","has-wp-block-columns")},[s]),u.useEffect(()=>{let o;const r=[],c=t=>{setTimeout(()=>{var w;const n=t.querySelectorAll(".accordion .legends.container.has-standard-12-font-size.bottom, .legends.container.items-section:not(.legends.container.top .items-section)");if(n.length!==0)for(const f of n){if(f.closest(".legends.container.top"))continue;const k=f.closest(".ui.fluid.container.content"),x=k?k.querySelector(".data-source"):null;if(!x||f.offsetParent===null||x.offsetParent===null||f.offsetHeight===0||x.offsetHeight===0)continue;const M=x.getBoundingClientRect(),y=f.getBoundingClientRect();if(y.top===0||y.bottom===0||M.top===0||Math.abs(y.top)>1e4||Math.abs(M.top)>1e4)continue;const L=window.getComputedStyle(x),j=window.getComputedStyle(f),q=parseFloat(L.marginTop)||0,N=parseFloat(j.marginBottom)||0,A=y.bottom+N,P=M.top-q;if(A>P){const a=A-P;x.style.marginTop=`${a+20}px`}const S=(w=f.closest(".wp-block-column.is-layout-flow.wp-block-column-is-layout-flow"))==null?void 0:w.nextElementSibling;if(S){const a=S.getBoundingClientRect(),b=window.getComputedStyle(S),R=Number.parseFloat(b.marginTop)||0,$=a.top-R;if(A>$){const _=A-$;S.style.marginTop=`${_+20}px`}}const E=f.closest(".chart.container");if(E){const a=E.getBoundingClientRect(),b=window.getComputedStyle(E),R=Number.parseFloat(b.marginBottom)||0,$=a.bottom+R,_=Number.parseFloat(j.marginTop)||0,B=y.top-_;if(B<$){const D=$-B,O=Math.min(D+20,200);f.style.marginTop=`${O}px`}}}},150)};return m!==-1&&(o=setTimeout(()=>{document.querySelectorAll(".accordion").forEach(n=>c(n))},0)),()=>{clearTimeout(o),r.forEach(t=>t.disconnect())}},[m]);const C=(o,r)=>{const{index:c}=r,t=m===c?-1:c;g(t),p(i[c].slug),t!==-1&&v(o.currentTarget)};return e.jsx(I.Accordion,{fluid:!0,styled:!0,children:i.map((o,r)=>{var t;const c=(t=o.meta_fields)!=null&&t.icon?o.meta_fields.icon[0]:null;return e.jsxs(u.Fragment,{children:[e.jsx(I.Accordion.Title,{active:m===r,index:r,onClick:n=>C(n,{index:r}),style:{backgroundColor:h[`color_${r}`]},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[c&&e.jsx(T.MediaProvider,{id:c,children:e.jsx(T.MediaConsumer,{children:e.jsx(T.PostIcon,{className:"icon"})})}),e.jsx(z.default,{post:o,className:"vt-accordion-post-intro"})]}),e.jsx(I.Icon,{name:"chevron down"})]})}),e.jsx(I.Accordion.Content,{className:"accordion-post-content accordion-post-vft-content",active:m===r,children:e.jsx(T.PostContent,{post:o})})]},o.id)})})},W=({post:i,count:d,backgroundColor:p,active:h,dimensions:m,height:g,coverWidth:s,index:v,editing:l,clickToExpandLabel:C})=>{const o=i._embedded?i._embedded["wp:featuredmedia"]:null,[r,c]=u.useState(!1),t=l?d-v:1;return e.jsxs("div",{className:"content-area",children:[e.jsxs("div",{className:"cover",style:{width:`${s}px`,backgroundColor:p,backgroundImage:`url(${o?o[0].source_url:""})`},onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),children:[e.jsx("div",{className:"rotator",style:{width:`${g}px`,transform:`translate(${s/2}px, 0px) rotate(90deg)`},children:e.jsx(z.default,{post:i})}),e.jsxs("div",{className:"overlay-label-container",children:[e.jsx("div",{className:`overlay-label ${r&&!h?"visible":""}`,children:C||"CLICK TO EXPAND"}),e.jsx("div",{className:"arrow-svg"})]})]}),e.jsx("div",{className:`collapsable-content ${h?"expanded":"collapsed"}`,style:{backgroundColor:"#f9f9f9",width:`${m.width-s*d}px`,marginLeft:`${s*t}px`},children:e.jsx(T.PostContent,{post:i})})]})},V=({editing:i,posts:d,height:p,colors:h,coverWidth:m,clickToExpandLabel:g})=>{const[s,v]=u.useState(null),l=u.useRef(null),[C,o]=u.useState({width:0,height:0}),r=u.useRef(null),c=t=>{s!==t&&v(t)};return u.useEffect(()=>{d.length>0&&s===null&&i&&v(d[0].slug)},[d,s,i]),u.useLayoutEffect(()=>{var t,n,w,f;(t=l.current)!=null&&t.parentElement&&o({width:i?((w=(n=l.current.parentElement)==null?void 0:n.parentElement)==null?void 0:w.offsetWidth)??0:((f=l.current.parentElement)==null?void 0:f.offsetWidth)??0,height:l.current.offsetHeight}),r.current&&(r.current.style.overflow=i?"visible":"hidden")},[i]),e.jsx(I.Container,{fluid:!0,className:"vertical featured tabs",ref:r,children:d==null?void 0:d.map((t,n)=>{const w=s?t.slug===s:n===0;return e.jsxs("div",{ref:l,onClick:()=>c(t.slug),className:w?"item expanded":"item collapsed",style:{minHeight:`${p}px`,minWidth:`${m}px`},children:[e.jsx("a",{id:t.slug}),e.jsx(W,{editing:i,coverWidth:m,height:p,backgroundColor:h[`color_${n}`],count:d.length,dimensions:C,active:w,post:t,index:n,clickToExpandLabel:g})]},t.slug)})})},U=i=>{var S,E;let{"data-height":d,"data-type":p,"data-taxonomy":h,"data-categories":m,"data-count":g,"data-colors":s,"data-cover-width":v=50,"data-read-more-label":l="READ More","data-click-to-expand-label":C="CLICK TO EXPAND","data-preview-mode":o="Desktop",editing:r,parent:c,unique:t,pageModuleProps:n}=i;n!=null&&n.previewMode&&(n!=null&&n.editing)&&(o=n.previewMode,r=n.editing);const w=i.intl.locale,f=m||"[]",[k,x]=u.useState((((S=window==null?void 0:window.visualViewport)==null?void 0:S.width)||window.innerWidth)<=1365),M=()=>{var a,b,R;return((a=window.screen.orientation)==null?void 0:a.type)||((((b=window==null?void 0:window.visualViewport)==null?void 0:b.width)||window.innerWidth)>(((R=window==null?void 0:window.visualViewport)==null?void 0:R.height)||window.innerHeight)?"landscape-primary":"portrait-primary")},[y,L]=u.useState(M()),j=()=>{setTimeout(()=>{var a;L(M()),x((((a=window==null?void 0:window.visualViewport)==null?void 0:a.width)||window.innerWidth)<=1365)},100)};u.useEffect(()=>(window.screen.orientation&&window.screen.orientation.addEventListener("change",j),window.addEventListener("resize",j),()=>{window.removeEventListener("resize",j),window.screen.orientation&&window.screen.orientation.removeEventListener("change",j)}),[]);const q=a=>r?a:decodeURIComponent(a),N=a=>{if(!a)return null;try{return JSON.parse(q(a))}catch(b){console.error(`error parsing value:${a}
2
- error:${b}`)}return null},A=o!=="Desktop"&&r,P=k&&!r;return e.jsx(I.Container,{style:{maxWidth:"100%"},className:`viz featured tabs ${r?"editing":""}`,fluid:!0,children:e.jsx(T.PostProvider,{type:p,locale:w,taxonomy:h,categories:N(f),store:`vertical_tabs${c}_${t}`,page:1,perPage:g,children:e.jsx(T.PostConsumer,{children:P||A?e.jsx(H,{posts:g,activeItem:(E=g==null?void 0:g[0])==null?void 0:E.slug,colors:N(s),setActive:()=>{}}):e.jsx(V,{editing:r,coverWidth:v,moreLabel:l,clickToExpandLabel:C,colors:N(s),height:d,posts:g})})})},y+Math.random())},K=(i,d)=>{const p=i.getIn(["data","pageModuleProps"]),h={};return p&&(h.pageModuleProps=p),h},X={},J=F.connect(K,X)(U);exports.default=J;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),l=require("react"),b=require("semantic-ui-react"),p=require("@devgateway/wp-react-lib"),q=require("react-redux"),A=require("../connected-templates/PostIntro.js"),z=({posts:r,activeItem:c,setActive:m,colors:w})=>{const[u,f]=l.useState(r.findIndex(o=>o.slug===c)),[a,v]=l.useState(null),s=(o,t,d)=>{document.querySelectorAll(o).forEach(i=>{i.querySelector(t)&&i.classList.add(d)})};l.useEffect(()=>{if(a){const o=a.getBoundingClientRect().top+window.scrollY;window.scrollTo({top:o,behavior:"smooth"})}s(".ui.fluid.container.viz.featured.tabs",".accordion","has-accordion"),s(".ui.fluid.container.viz.featured.tabs","blockquote","has-blockquote"),s(".ui.fluid.container.viz.featured.tabs",".accordion .accordion-post-ft-title","has-accordion-title"),s(".ui.fluid.container.viz.featured.tabs",".accordion .accordion-post-vft-content","has-accordion-content"),s(".ui.fluid.container.viz.featured.tabs",".vt-accordion-post-intro figure","has-vt-accordion-figure"),s(".ui.fluid.container.viz.featured.tabs",".content.active.accordion-post-content .wp-block-columns","has-wp-block-columns")},[a]),l.useEffect(()=>{},[u]);const g=(o,t)=>{const{index:d}=t,n=u===d?-1:d;f(n),m(r[d].slug),n!==-1&&v(o.currentTarget)};return e.jsx(b.Accordion,{fluid:!0,styled:!0,children:r.map((o,t)=>{var n;const d=(n=o.meta_fields)!=null&&n.icon?o.meta_fields.icon[0]:null;return e.jsxs(l.Fragment,{children:[e.jsx(b.Accordion.Title,{active:u===t,index:t,onClick:i=>g(i,{index:t}),style:{backgroundColor:w[`color_${t}`]},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[d&&e.jsx(p.MediaProvider,{id:d,children:e.jsx(p.MediaConsumer,{children:e.jsx(p.PostIcon,{className:"icon"})})}),e.jsx(A.default,{post:o,className:"vt-accordion-post-intro"})]}),e.jsx(b.Icon,{name:"chevron down"})]})}),e.jsx(b.Accordion.Content,{className:"accordion-post-content accordion-post-vft-content",active:u===t,children:e.jsx(p.PostContent,{post:o})})]},o.id)})})},O=({post:r,count:c,backgroundColor:m,active:w,dimensions:u,height:f,coverWidth:a,index:v,editing:s,clickToExpandLabel:g})=>{const o=r._embedded?r._embedded["wp:featuredmedia"]:null,[t,d]=l.useState(!1),n=s?c-v:1;return e.jsxs("div",{className:"content-area",children:[e.jsxs("div",{className:"cover",style:{width:`${a}px`,backgroundColor:m,backgroundImage:`url(${o?o[0].source_url:""})`},onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),children:[e.jsx("div",{className:"rotator",style:{width:`${f}px`,transform:`translate(${a/2}px, 0px) rotate(90deg)`},children:e.jsx(A.default,{post:r})}),e.jsxs("div",{className:"overlay-label-container",children:[e.jsx("div",{className:`overlay-label ${t&&!w?"visible":""}`,children:g||"CLICK TO EXPAND"}),e.jsx("div",{className:"arrow-svg"})]})]}),e.jsx("div",{className:`collapsable-content ${w?"expanded":"collapsed"}`,style:{backgroundColor:"#f9f9f9",width:`${u.width-a*c}px`,marginLeft:`${a*n}px`},children:e.jsx(p.PostContent,{post:r})})]})},D=({editing:r,posts:c,height:m,colors:w,coverWidth:u,clickToExpandLabel:f})=>{const[a,v]=l.useState(null),s=l.useRef(null),[g,o]=l.useState({width:0,height:0}),t=l.useRef(null),d=n=>{a!==n&&v(n)};return l.useEffect(()=>{c.length>0&&a===null&&r&&v(c[0].slug)},[c,a,r]),l.useLayoutEffect(()=>{var n,i,x,j;(n=s.current)!=null&&n.parentElement&&o({width:r?((x=(i=s.current.parentElement)==null?void 0:i.parentElement)==null?void 0:x.offsetWidth)??0:((j=s.current.parentElement)==null?void 0:j.offsetWidth)??0,height:s.current.offsetHeight}),t.current&&(t.current.style.overflow=r?"visible":"hidden")},[r]),e.jsx(b.Container,{fluid:!0,className:"vertical featured tabs",ref:t,children:c==null?void 0:c.map((n,i)=>{const x=a?n.slug===a:i===0;return e.jsxs("div",{ref:s,onClick:()=>d(n.slug),className:x?"item expanded":"item collapsed",style:{minHeight:`${m}px`,minWidth:`${u}px`},children:[e.jsx("a",{id:n.slug}),e.jsx(O,{editing:r,coverWidth:u,height:m,backgroundColor:w[`color_${i}`],count:c.length,dimensions:g,active:x,post:n,index:i,clickToExpandLabel:f})]},n.slug)})})},W=r=>{var N,$;let{"data-height":c,"data-type":m,"data-taxonomy":w,"data-categories":u,"data-count":f,"data-colors":a,"data-cover-width":v=50,"data-read-more-label":s="READ More","data-click-to-expand-label":g="CLICK TO EXPAND","data-preview-mode":o="Desktop",editing:t,parent:d,unique:n,pageModuleProps:i}=r;i!=null&&i.previewMode&&(i!=null&&i.editing)&&(o=i.previewMode,t=i.editing);const x=r.intl.locale,j=u||"[]",[M,S]=l.useState((((N=window==null?void 0:window.visualViewport)==null?void 0:N.width)||window.innerWidth)<=1365),I=()=>{var h,C,k;return((h=window.screen.orientation)==null?void 0:h.type)||((((C=window==null?void 0:window.visualViewport)==null?void 0:C.width)||window.innerWidth)>(((k=window==null?void 0:window.visualViewport)==null?void 0:k.height)||window.innerHeight)?"landscape-primary":"portrait-primary")},[P,T]=l.useState(I()),y=()=>{setTimeout(()=>{var h;T(I()),S((((h=window==null?void 0:window.visualViewport)==null?void 0:h.width)||window.innerWidth)<=1365)},100)};l.useEffect(()=>(window.screen.orientation&&window.screen.orientation.addEventListener("change",y),window.addEventListener("resize",y),()=>{window.removeEventListener("resize",y),window.screen.orientation&&window.screen.orientation.removeEventListener("change",y)}),[]);const L=h=>t?h:decodeURIComponent(h),E=h=>{if(!h)return null;try{return JSON.parse(L(h))}catch(C){console.error(`error parsing value:${h}
2
+ error:${C}`)}return null},R=o!=="Desktop"&&t,_=M&&!t;return e.jsx(b.Container,{style:{maxWidth:"100%"},className:`viz featured tabs ${t?"editing":""}`,fluid:!0,children:e.jsx(p.PostProvider,{type:m,locale:x,taxonomy:w,categories:E(j),store:`vertical_tabs${d}_${n}`,page:1,perPage:f,children:e.jsx(p.PostConsumer,{children:_||R?e.jsx(z,{posts:f,activeItem:($=f==null?void 0:f[0])==null?void 0:$.slug,colors:E(a),setActive:()=>{}}):e.jsx(D,{editing:t,coverWidth:v,moreLabel:s,clickToExpandLabel:g,colors:E(a),height:c,posts:f})})})},P+Math.random())},H=(r,c)=>{const m=r.getIn(["data","pageModuleProps"]),w={};return m&&(w.pageModuleProps=m),w},V={},F=q.connect(H,V)(W);exports.default=F;