@rcsb/rcsb-statistics 0.3.9-dev.9 → 0.3.10-dev.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.
@@ -46,7 +46,7 @@
46
46
  */
47
47
 
48
48
  /**
49
- * @remix-run/router v1.20.0
49
+ * @remix-run/router v1.21.0
50
50
  *
51
51
  * Copyright (c) Remix Software Inc.
52
52
  *
@@ -57,7 +57,7 @@
57
57
  */
58
58
 
59
59
  /**
60
- * React Router DOM v6.27.0
60
+ * React Router DOM v6.28.0
61
61
  *
62
62
  * Copyright (c) Remix Software Inc.
63
63
  *
@@ -68,7 +68,7 @@
68
68
  */
69
69
 
70
70
  /**
71
- * React Router v6.27.0
71
+ * React Router v6.28.0
72
72
  *
73
73
  * Copyright (c) Remix Software Inc.
74
74
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rcsb/rcsb-statistics",
3
- "version": "0.3.9-dev.9",
3
+ "version": "0.3.10-dev.0",
4
4
  "private": false,
5
5
  "files": [
6
6
  "build"
@@ -31,6 +31,7 @@
31
31
  "react-dom": "^18.3.1",
32
32
  "react-icons": "^5.3.0",
33
33
  "react-router-dom": "^6.23.1",
34
+ "react-tooltip": "^5.28.0",
34
35
  "resolve-url-loader": "^5.0.0",
35
36
  "sass": "^1.77.7",
36
37
  "styled-components": "^6.1.11",
@@ -1,69 +0,0 @@
1
- "use strict";(self.webpackChunk_rcsb_rcsb_statistics=self.webpackChunk_rcsb_rcsb_statistics||[]).push([[630],{1630:(e,t,r)=>{r.r(t),r.d(t,{default:()=>f});var o=r(6540),i=r(4976),n=r(7581);const a=n.Ay.ul`
2
- padding: 10px;
3
- max-height: 300px;
4
- overflow-y: auto;
5
- `,s=(0,n.Ay)(i.N_).attrs({className:"list-group-item"})`
6
- padding: 0;
7
- margin-bottom: 10px;
8
- border: none;
9
- color: #337ab7 !important;
10
- font-weight: 400;
11
- font-size: 14px;
12
- cursor: pointer;
13
-
14
- &:hover {
15
- text-decoration: underline !important;
16
- background: none !important;
17
- }
18
- `,l=e=>{let{items:t}=e;return o.createElement(a,null,t.map(((e,t)=>o.createElement(s,{key:t,to:e.link},e.description_menu))))},d=(n.Ay.label`
19
- display: block;
20
- font-size: 1.2em;
21
- margin-bottom: 0.5em;
22
- `,n.Ay.div`
23
- width: 700px;
24
- `),p=n.Ay.input`
25
- flex: 1;
26
- width: 100%;
27
- height: 45px;
28
- padding: 6px 12px;
29
- font-size: 16px;
30
- border: 1px solid #ccc;
31
- border-radius: 4px;
32
- box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
33
- line-height: 1.42857143;
34
- color: #555;
35
- transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
36
- `,c=n.Ay.div`
37
- background-color: #f7f7f7;
38
- padding: 10px;
39
- display: flex;
40
- justify-content: center;
41
- margin-bottom: 1em;
42
- `,u=n.Ay.div`
43
- display: flex;
44
- flex-wrap: wrap;
45
- gap: 20px;
46
- justify-content: flex-start;
47
- padding: 10px;
48
- `,x=n.Ay.div`
49
- flex: 1 1 calc(33.333% - 20px);
50
- min-height: 250px;
51
- position: relative;
52
- overflow: hidden;
53
- border: 1px solid #ddd;
54
- border-radius: 4px;
55
- box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
56
-
57
- `,m=n.Ay.h3`
58
- background-color: #325880;
59
- color: #fff;
60
- padding: 10px;
61
- margin: 0;
62
- font-weight: bold;
63
- font-size: 1.1em;
64
- border-bottom: 1px solid #ddd;
65
- border-top-left-radius: 4px;
66
- border-top-right-radius: 4px;
67
- font-size: 16px;
68
- font-weight: bold;
69
- `;var b=r(637);const f=()=>{const[e,t]=(0,o.useState)(""),[r,i]=(0,o.useState)({});return(0,o.useEffect)((()=>{const t=b._1.filter((t=>(t.description_menu??"").toLowerCase().includes(e.toLowerCase()))).reduce(((e,t)=>{const r=t.displayCategory||"Uncategorized";return e[r]||(e[r]=[]),e[r].push(t),e}),{});i(t)}),[e]),o.createElement("article",null,o.createElement(c,null,o.createElement(d,null,o.createElement(p,{id:"statistics-filter",type:"text",placeholder:"Browse Statistics",value:e,onChange:e=>t(e.target.value)}))),o.createElement(u,null,Object.entries(r).map((e=>{let[t,r]=e;return o.createElement(x,{key:t},o.createElement(m,null,t),o.createElement(l,{items:r}))}))))}}}]);
@@ -1,296 +0,0 @@
1
- "use strict";(self.webpackChunk_rcsb_rcsb_statistics=self.webpackChunk_rcsb_rcsb_statistics||[]).push([[676],{3676:(e,t,a)=>{a.r(t),a.d(t,{default:()=>le});var n=a(6540),l=a(7767),r=a(4731),o=a(6118),i=a(3839),s=a(1105),c=a(1376),d=a(4479),u=a(3048),p=a(8027),m=a(6973),g=a(2756),b=a(7638),f=a(7581);const h=f.i7`
2
- from {
3
- opacity: .5;
4
- transform: translateZ(0) scale(0.999);
5
- }
6
- to {
7
- opacity: 1;
8
- transform: translateZ(0) scale(1);
9
- }
10
- `,y=f.Ay.div`
11
- animation: ${h} .5s ease-in;
12
- will-change: opacity, transform;
13
- `,x=f.Ay.div`
14
- display: flex;
15
- justify-content: flex-end;
16
- margin-top: -10px;
17
- `,v=f.Ay.button`
18
- display: flex;
19
- align-items: center;
20
- justify-content: center;
21
- border: 1px solid #e7e7e7;
22
- border-radius: 3px;
23
- padding: 3px 5px;
24
-
25
- & svg {
26
- margin-right: 5px;
27
- }
28
- `,E=f.Ay.div`
29
- padding-left: 7px;
30
- margin-top: 40px;
31
- `,w=(0,f.Ay)(s.A)`
32
- margin-top: 40px;
33
- `,C=f.Ay.div`
34
- display: flex;
35
- flex-direction: column;
36
- align-items: center;
37
- justify-content: center;
38
- gap: 5px;
39
- `,k=f.Ay.div`
40
- background-color: #f0f0f0;
41
- border: ${e=>{let{selected:t}=e;return t?"1px solid black":"1px solid #fff"}};
42
- padding: 5px;
43
- display: flex;
44
- align-items: center;
45
- justify-content: center;
46
- color: ${e=>{let{disabled:t}=e;return t?"#fafafa":"#707070"}};
47
- pointer-events: ${e=>{let{disabled:t}=e;return t?"none":"auto"}};
48
-
49
- ${e=>{let{disabled:t}=e;return!t&&"\n &:hover {\n background-color: #e0e0e0;\n border: 1px solid #808080;\n cursor: pointer;\n }\n "}}
50
- `,j=f.Ay.div`
51
- display: flex;
52
- align-items: center;
53
- margin-bottom: 5px;
54
- `,A=f.Ay.input`
55
- margin-right: 20px;
56
- `,z=f.Ay.label`
57
- font-size: 12px;
58
- margin-left: 5px;
59
- font-weight: normal;
60
- margin-bottom: 0 !important;
61
- `,S=f.Ay.div`
62
- font-weight: bold;
63
- font-size: 1.2em;
64
- margin-bottom: 15px;
65
- `,D=f.Ay.div`
66
- width: auto;
67
- min-height: 550px;
68
- `,$=f.Ay.div`
69
- margin-top: 20px;
70
- min-width: 170px;
71
- label {
72
- font-size: 12px;
73
- font-weight: normal;
74
- margin-left: 5px;
75
- margin-bottom: 0 !important;
76
- margin-top: 4px !important;
77
- }
78
- .form-check {
79
- display: flex;
80
- align-items: center;
81
- }
82
- `,T=f.Ay.div`
83
- margin-bottom: 35px;
84
- `,N=f.Ay.div`
85
- font-weight: bold;
86
- margin-bottom: 5px;
87
- `,F=(f.Ay.div`
88
- width: 100%;
89
-
90
-
91
- .col-md-10{
92
- width: 90% !important;
93
- }
94
-
95
- .col-md-10 > div:first-child {
96
- height: 80vh !important;
97
- }
98
-
99
- .col-md-2{
100
- width: 0 !important;
101
- }
102
- `,f.Ay.div`
103
- display: block;
104
- font-size: 18px;
105
- font-family: 'Helvetica Neue', 'Helvetica', 'Arial', sans-serif;
106
- font-weight: bold;
107
- color: #333;
108
- padding-top: 0;
109
- padding-bottom: 15px;
110
- text-align: start;
111
- margin-top: -2px;
112
- `),O=f.Ay.div`
113
- position: relative;
114
- display: inline-block;
115
- cursor: pointer;
116
-
117
- &:hover ul {
118
- display: block;
119
- top:-5px;
120
- margin-left:15px
121
- }
122
- `,P=f.Ay.div`
123
- display: flex;
124
- align-items: center;
125
- cursor: pointer;
126
- position: relative;
127
-
128
- .triangle {
129
- width: 8px;
130
- aspect-ratio: 1;
131
- clip-path: polygon(0 0, 100% 0, 50% 70%);
132
- background-color: #999;
133
- position: absolute;
134
- right: -15px;
135
- top: 50%;
136
- transform: translateY(-10%);
137
- transition: transform 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
138
- }
139
-
140
- &:hover .triangle {
141
- transform: translateY(0.2rem);
142
- }
143
- `,R=f.Ay.ul`
144
- display: none;
145
- position: absolute;
146
- top: 100%;
147
- left: 0;
148
- z-index: 1000;
149
- min-width: 130px;
150
- padding: 2px 0;
151
- margin: 0;
152
- font-size: 14px;
153
- color: #333;
154
- text-align: left;
155
- list-style: none;
156
- background-color: #fff;
157
- border: 1px solid rgba(0, 0, 0, 0.15);
158
- border-radius: 4px;
159
- box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
160
-
161
- ${O}:hover & {
162
- display: block;
163
- }
164
-
165
- & > li.disabled {
166
- pointer-events: none;
167
- color: #ccc;
168
- }
169
-
170
- & > li:not(.disabled):hover {
171
- background-color: #f8f9fa;
172
- }
173
- `,I=f.Ay.li`
174
- padding: 8px 20px;
175
- display: flex;
176
- align-items: center;
177
- cursor: pointer;
178
- white-space: nowrap;
179
-
180
- &:hover {
181
- background-color: #f1f1f1;
182
- }
183
- `,_=f.Ay.span`
184
- margin-left: 8px;
185
- font-size: 14px;
186
- color: #333;
187
- `;var q=a(2195);const L=f.Ay.div`
188
- .gridjs-pagination {
189
- display: flex;
190
- justify-content: space-between;
191
- padding: 10px;
192
- background-color: #f9fafb;
193
- border: 1px solid #ccc;
194
- border-radius: 0 0 8px 8px;
195
- }
196
-
197
- .gridjs-summary {
198
- font-size: 14px;
199
- color: #555;
200
- margin-top: 5px;
201
- }
202
-
203
- .gridjs-pages button {
204
- margin: 0 5px;
205
- padding: 5px 10px;
206
- border-radius: 5px;
207
- background-color: #fff;
208
- border: 1px solid #ccc;
209
- color: #333;
210
- cursor: pointer;
211
- transition: background-color 0.3s, color 0.3s;
212
- }
213
-
214
- .gridjs-pages button:hover {
215
- background-color: #e0e0e0;
216
- color: #000;
217
- }
218
-
219
- .gridjs-pages button:disabled {
220
- color: #aaa;
221
- background-color: #f5f5f5;
222
- cursor: not-allowed;
223
- }
224
-
225
- .gridjs-pages button.gridjs-currentPage {
226
- background-color: #d0d0d0;
227
- font-weight: bold;
228
- border-color: #aaa;
229
- }
230
-
231
- .gridjs-wrapper {
232
- width: 100%;
233
- border-radius: 8px;
234
- box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
235
- margin-bottom: 20px;
236
- border: 1px solid #e5e7eb;
237
- }
238
-
239
- td.gridjs-td {
240
- padding: 12px 16px;
241
- font-size: 13px;
242
- color: #444;
243
- border: 1px solid #e5e7eb;
244
- }
245
-
246
- th.gridjs-th {
247
- position: relative;
248
- padding: 12px 16px;
249
- background-color: #f7f7f7;
250
- color: #333;
251
- font-weight: bold;
252
- text-align: left;
253
- border: 1px solid #e5e7eb;
254
- cursor: pointer;
255
- }
256
-
257
- .gridjs-th .gridjs-sort {
258
- display: none !important;
259
- }
260
-
261
- th.gridjs-th.gridjs-sort-neutral::after {
262
- content: '⇵';
263
- margin-left: 10px;
264
- font-size: 12px;
265
- color: #888;
266
- }
267
-
268
- th.gridjs-th.gridjs-sort-asc::after {
269
- content: '▲';
270
- margin-left: 10px;
271
- font-size: 12px;
272
- color: #888;
273
- }
274
-
275
- th.gridjs-th.gridjs-sort-desc::after {
276
- content: '▼';
277
- margin-left: 10px;
278
- font-size: 12px;
279
- color: #888;
280
- }
281
-
282
- input.gridjs-input {
283
- outline: none;
284
- background-color: #fff;
285
- border: 1px solid #d2d6dc;
286
- border-radius: 5px;
287
- padding: 8px 12px;
288
- font-size: 14px;
289
- margin-bottom: 10px;
290
- }
291
-
292
- input.gridjs-input:focus {
293
- border-color: #9bc2f7;
294
- box-shadow: 0 0 0 3px rgba(149, 189, 243, 0.5);
295
- }
296
- `,Y=e=>{let{data:t,title:a}=e;if(0===t.length)return n.createElement("p",null,"No data available.");const l=Object.keys(t[0]),r=t.map((e=>l.map((t=>e[t])))).sort(((e,t)=>t[0]-e[0]));return n.createElement(n.Fragment,null,a&&n.createElement(F,null,a),n.createElement(L,null,n.createElement(q.x,{columns:l,data:r,search:!1,pagination:{limit:10},sort:!0,style:{table:{border:"1px solid #ccc","border-radius":"8px",width:"100%","background-color":"#fff",color:"#000","font-family":"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif","font-size":"14px","text-align":"left"},th:{"background-color":"#f5f5f5",color:"#333","border-bottom":"2px solid #ccc",padding:"12px","font-weight":"bold"},td:{padding:"12px","border-bottom":"1px solid #eee",color:"#555","font-size":"13px"}}})))},M=e=>{let{chartType:t,handleChartTypeChange:a,isDistPlot:l}=e;const r=e=>{a(e)};return n.createElement(O,null,n.createElement(P,null,n.createElement(k,null,(()=>{switch(t){case"bar":default:return n.createElement(p.v$b,{size:15});case"line":return n.createElement(p.YYR,{size:15});case"pie":return n.createElement(p.qvi,{size:15})}})()),n.createElement("span",{className:"triangle"})),n.createElement(R,null,n.createElement(I,{onClick:()=>r("bar")},n.createElement(k,null,n.createElement(p.v$b,{size:15})),n.createElement(_,null,"Bar Chart")),!l&&n.createElement(I,{onClick:()=>r("line")},n.createElement(k,null,n.createElement(p.YYR,{size:15})),n.createElement(_,null,"Line Chart")),l&&n.createElement(I,{onClick:()=>r("pie")},n.createElement(k,null,n.createElement(p.qvi,{size:15})),n.createElement(_,null,"Pie Chart"))))};var H=a(637);o.t1.register(o.PP,o.kc,o.OJ,o.E8,o.No,o.Bs,o.FN,o.hE,o.m_,o.s$,i.Ay);const U=e=>{const t=e.datasets.map((e=>{const t=[];let a=0;return e.data.forEach((e=>{a+=e,t.push(a)})),{...e,data:t}}));return{...e,datasets:t}},B=e=>{let{data:t,plotName:a,setFullscreenContent:l}=e;const o=(0,n.useRef)(null),{handleOpenModal:i,handleCloseModal:f}=(0,g.h)(),{settings:h,updateCurrentInput:y,setConfig:x}=(0,b.t)(),v=h.colorScheme,F=H.jS.find((e=>e.key===a)),O="distribution"===F?.chartCategory,P=F?.chartOptions||{},R=O?h.config.chartType.distrubution:h.config.chartType.growth,I=h.config.chartType.scale,_=O?"non-cumulative":h.config.chartType.dataView,[q,L]=(0,n.useState)(t.datasets.map((e=>({label:e.label||"",visible:!0})))),[B,J]=(0,n.useState)("natural"),[W,Z]=(0,n.useState)((()=>"cumulative"===(O?"non-cumulative":_)?U(t):t)),G=t.datasets.map((e=>({label:e.label||"",visible:!0}))),V=O?"non-cumulative":"cumulative",K=()=>{L(G),J("natural"),x({chartType:{...h.config.chartType,[O?"distrubution":"growth"]:"bar",scale:"linear",dataView:V}}),Z("cumulative"===V?U(t):t)};(0,n.useEffect)((()=>{const e="cumulative"===_?U(t):t;Z(e)}),[_,t]),(0,n.useEffect)((()=>{if("cumulative"===_){const e=U(t);Z({labels:t.labels,datasets:e.datasets.map((e=>({...e,hidden:!q.find((t=>t.label===e.label))?.visible})))})}else Z({labels:t.labels,datasets:t.datasets.map((e=>({...e,hidden:!q.find((t=>t.label===e.label))?.visible})))})}),[_,t,q]),(0,n.useEffect)((()=>{if("distribution-source-organism"===a){const e=[],a=[],n=[];if(t?.datasets?.[0]?.objectConfig&&Array.isArray(t.labels)){t.datasets[0].objectConfig.forEach(((l,r)=>{if(l.label===B){const o=t.labels?.[r],i=t.datasets[0].data?.[r];o&&void 0!==i&&(e.push(o),a.push(i),n.push(l))}}));const l={...t.datasets[0],data:a,objectConfig:n};Z({labels:e,datasets:[l]})}}}),[B,t,a]),(0,n.useEffect)((()=>{JSON.stringify(h.currentInput)!==JSON.stringify(q)&&(a.includes("overall")||y(q))}),[q,y]);const Q=e=>{L((t=>t.map((t=>t.label===e?{...t,visible:!t.visible}:t))))},X=()=>{x({chartType:{...h.config.chartType,scale:"linear"===h.config.chartType.scale?"logarithmic":"linear"}})},ee=e=>{x({chartType:{...h.config.chartType,dataView:e}})},te=e=>{J(e)},ae=e=>{if(o.current){const a=(0,r.CK)(o.current,e);if(a.length>0&&t.labels){const{index:e}=a[0],n=t.labels[e];if(F&&F.getSearchObj){const e=F.getSearchObj(h,n),t=JSON.stringify(e),a=encodeURIComponent(t),l=`${h.config.searchAdvancedUrl}/search?request=${a}`;window.open(l,"_blank")}}}},ne={...P,scales:O||"line"!==R?P.scales:{...P.scales,x:{...P.scales?.x,stacked:!1},y:{...P.scales?.y,type:I,stacked:!1,min:"logarithmic"===I?1:void 0,ticks:{callback:function(e){return"logarithmic"===I?[1,10,100,1e3,1e4].includes(e)?e:null:e}},title:{display:!0,text:`${P?.scales?.y?.title?.text||"Y-Axis"} ${"logarithmic"===I?"(Logarithmic scale)":"(Linear scale)"}`}}},plugins:{...P.plugins,legend:{...P.plugins?.legend,onClick:(e,t,a)=>((e,t)=>{const a=t.datasetIndex,n=e.data.datasets[a].label;n&&Q(n)})(a.chart,t)}},elements:{line:{tension:.1,spanGaps:!0},point:{radius:0,hoverRadius:0}},animation:{duration:400,easing:"easeInOutQuart"},onHover:(e,t)=>{t.length?e.native.target.style.cursor="pointer":e.native.target.style.cursor="default"}},le=e=>{x({chartType:{...h.config.chartType,[O?"distrubution":"growth"]:e}})},re=(e,t)=>{const a=e.datasets[0],n=e.labels.map(((e,a)=>t[a%t.length]));return{labels:e.labels,datasets:[{data:a.data,backgroundColor:n,borderColor:n,borderWidth:1}]}},oe=e=>{const{title:t,legend:a,tooltips:n,responsive:l,plugins:r}=e,o={responsive:l??!0,maintainAspectRatio:!1,plugins:{...r,legend:{...a,display:!0,position:"bottom",onClick:(e,t,a)=>((e,t)=>{const a=e.getDatasetMeta(0),n=t.index;if(void 0!==n){const l=a.data[n].hidden;a.data[n].hidden=!l,t.hidden=a.data[n].hidden,e.options.plugins.legend.labels.generateLabels=e=>e.data.labels.map(((t,n)=>({text:t,fillStyle:e.data.datasets[0].backgroundColor[n],hidden:a.data[n].hidden,index:n}))),e.update()}})(a.chart,t)},tooltip:{...n,callbacks:{label:e=>{const{dataset:t,dataIndex:a,chart:n}=e,l=n.getDatasetMeta(0).data.map(((e,t)=>e.hidden?null:t)).filter((e=>null!==e)).map((e=>t.data[e])),r=t.data[a],o=(r/l.reduce(((e,t)=>e+t),0)*100).toFixed(2);return`${e.label}: ${r} - ${o}% (of shown data)`}}}},animation:{animateScale:!0,animateRotate:!0},elements:{arc:{hoverBorderWidth:3,hoverOffset:20,hoverBorderColor:"white"}},onHover:(e,t)=>{t.length?e.native.target.style.cursor="pointer":e.native.target.style.cursor="default"}};return o},ie=e=>{if(!e||!e.datasets||!Array.isArray(e.datasets))return{labels:[],datasets:[]};const t=e.datasets.map((e=>{const t=e.data.map((e=>"number"!=typeof e||isNaN(e)?null:e));return{...e,data:t,stack:void 0,fill:!1,borderColor:e.borderColor||"rgba(75, 192, 192, 1)",backgroundColor:e.backgroundColor||"rgba(75, 192, 192, 0.2)",borderWidth:3,pointRadius:0,pointHoverRadius:0,tension:.1}}));return{labels:e.labels||[],datasets:t}};return n.createElement(u.A,null,(e=>{const t={...ne,maintainAspectRatio:!1,plugins:{legend:{display:!1}}},l=()=>`Report: ${P.plugins.title.text}, Generated on: ${(new Date).toLocaleDateString()} ${(new Date).toLocaleTimeString()}`,u=(e,t,a)=>{if(!e?.datasets?.length||0===e.labels.length)return{columns:[],gridData:[]};if(t){const t=e.labels||[],n=e.datasets[0]||{},l=a.scales?.x?.title?.text||"Range",r=a.scales?.y?.title?.text||"Number of Entries";return{columns:"x"===a.indexAxis?[l,r]:[r,l],gridData:t.map(((e,t)=>[e,n.data[t]||0]))}}if(1===e.datasets.length)return{columns:["Year",a.scales?.y?.title?.text||"Data"],gridData:e.labels.map(((t,a)=>[t,e.datasets[0].data[a]||0]))};const n=e.datasets.filter((e=>q.find((t=>t.label===e.label))?.visible));return{columns:["Year",...n.map((e=>e.label))],gridData:e.labels.map(((e,t)=>{const a=[e];return n.forEach((e=>{a.push(e.data[t]||0)})),a}))}},g=u(W,O,P);if(0===g.columns.length||0===g.gridData.length)return n.createElement("p",null,"No data available for table.");const b=g.gridData.map((e=>{const t={};return g.columns.forEach(((a,n)=>{t[a]=e[n]})),t})),f={bar:n.createElement(r.yP,{ref:o,data:W,options:e?t:ne,onClick:ae}),line:n.createElement(r.N1,{ref:o,data:ie(W),options:e?t:ne}),pie:n.createElement(r.Fq,{ref:o,data:re(W,v),options:oe(e?t:ne),onClick:ae}),table:n.createElement(n.Fragment,null," ",n.createElement(Y,{data:b,title:ne.plugins.title.text}))};return n.createElement(d.A,null,n.createElement(s.A,{md:10},n.createElement(D,null,f[R])),n.createElement(s.A,{md:2},n.createElement(d.A,null,n.createElement(w,{md:2},n.createElement(C,null,!e&&n.createElement(n.Fragment,null,n.createElement(k,{onClick:()=>i("settings")},n.createElement(p.Pcn,{size:15})),n.createElement(M,{chartType:R,handleChartTypeChange:le,isDistPlot:O}),n.createElement(k,{onClick:()=>i("information"),disabled:!1},n.createElement(p.ELu,{size:15})),n.createElement(k,{disabled:!1,selected:"table"===R,onClick:()=>le("table")},n.createElement(p.ist,{size:15})),n.createElement(k,{onClick:()=>{const e=u(W,O,P),t=((e,t)=>[l(),e.join(","),...t.map((e=>e.join(",")))].join("\n"))(e.columns,e.gridData),a=new Blob([t],{type:"text/csv;charset=utf-8;"}),n=URL.createObjectURL(a),r=document.createElement("a");r.href=n;const o=`${l().replace(/[^a-z0-9]/gi,"_").toLowerCase()}.csv`;r.setAttribute("download",o),document.body.appendChild(r),r.click(),document.body.removeChild(r)},disabled:!1},n.createElement(p.$TP,{size:15})),!O&&"line"===R&&n.createElement(k,{onClick:X},"linear"===I?n.createElement(m.Ten,{size:15}):n.createElement(p.g0N,{size:15})),n.createElement(k,{onClick:K,disabled:!1},n.createElement(p.DIg,{size:15}))))),!e&&n.createElement(s.A,{md:10},n.createElement(E,null,n.createElement(n.Fragment,null,O?"distribution-source-organism"===a&&n.createElement($,null,n.createElement(N,null,"Data Set"),n.createElement(c.A.Check,{type:"radio",id:"view-natural",label:"Natural",name:"source-organism-view-switch",value:"natural",checked:"natural"===B,onChange:()=>te("natural")}),n.createElement(c.A.Check,{type:"radio",id:"view-genetically engineered",label:"Genetically Engineered",name:"source-organism-view-switch",value:"genetically engineered",checked:"genetically engineered"===B,onChange:()=>te("genetically engineered")}),n.createElement(c.A.Check,{type:"radio",id:"view-synthetic",label:"Synthetic",name:"source-organism-view-switch",value:"synthetic",checked:"synthetic"===B,onChange:()=>te("synthetic")})):n.createElement(n.Fragment,null,q.length>1&&n.createElement(n.Fragment,null,n.createElement(S,null,"Data Options"),n.createElement(T,null,n.createElement(N,null,"Data Shown"),q.map((e=>{const t="unique-protein-sequences"===a&&e.label?`Identity ${parseFloat(e.label).toFixed(0)}%`:e.label;return n.createElement(j,{key:e.label},n.createElement(A,{type:"checkbox",id:e.label,checked:e.visible,onChange:()=>Q(e.label)}),n.createElement(z,{htmlFor:e.label},t))})))),n.createElement($,null,n.createElement(N,null,"Data Set"),n.createElement(c.A.Check,{type:"radio",id:"view-annual",label:"Annual",name:"view-switch",value:"non-cumulative",checked:"non-cumulative"===_,onChange:()=>ee("non-cumulative")}),n.createElement(c.A.Check,{type:"radio",id:"view-cumulative",label:"Cumulative",name:"view-switch",value:"Cumulative",checked:"cumulative"===_,onChange:()=>ee("cumulative")})))))))))})(!1))};var J=a(3076),W=a(8533),Z=a(176),G=a(7704),V=a(8154),K=a(2543),Q=a(6061),X=a(8422);const ee=async function(e,t,a){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],l=arguments.length>4?arguments[4]:void 0,r=arguments.length>5?arguments[5]:void 0,o=arguments.length>6?arguments[6]:void 0;const i=(0,K.cloneDeep)(a.firstDim);a.secondDim&&(0,V.vw)(a.secondDim,i);const s={return_type:a.returnType,request_options:{paginate:{rows:0},facets:[i]}};r("searchRequest",s),r("stats_notes",l);const c=await(async(e,t)=>{const a=`${t.searchApiUrl}/rcsbsearch/v2/query`;return fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error(e.statusText);return e.json()})).catch((e=>{throw console.error("Error:",e),e}))})(s,o.config);if(!c)return[[]];const d=(0,G.z)(c);let u=d[0].data;const p={resolution:X.$Z,"r-free":X.$Z,"molecular-weight-structure":X.bl,"molecular-weight-entity":X.bl,"molecular-weight-small-molecules":X.QY,"atom-count":X.pF,"residue-count":X.pF},m=p[e]?p[e](u):u;if(p[e]&&(u=m),"distribution-source-organism"===e)return[d.filter((e=>"Source Organism"===e.name)).flatMap((e=>e.data.map((t=>({...t,labelPath:e.labelPath,objectConfig:{...t.objectConfig||{}}}))))).map(((e,a)=>({...e,objectConfig:{...e.objectConfig,color:t[a%t.length],label:e.labelPath.join(", ")}})))];if(n&&u.length>0){let e=0;return[u.map((e=>({...e,objectConfig:{...e.objectConfig,color:t[0%t.length],label:"Annual"}}))),u.map((a=>(e+=a.population,{...a,population:e,objectConfig:{objectId:[a.label,e],color:t[1%t.length],label:"Cumulative"}})))]}return a.secondDim?te(e,a,d.filter((e=>e.name===ae(a.secondDim))),t,o.config.searchAdvancedUrl,o.currentInput):[u.map((e=>({...e,objectConfig:{objectId:[e.label,e.population],color:t[0%t.length]}})))]},te=(e,t,a,n,l,r)=>{const o=new Set,i=[],s=new Map;a.forEach((e=>{const t=e.labelPath[0];i.push(t),e.data.forEach((e=>{o.add(e.label.toString()),s.has(t)||s.set(t,new Map),s.get(t)?.set(e.label.toString(),e.population)}))}));const c=Array.from(o),d=[];return c.forEach(((e,t)=>{const a=[];i.forEach((l=>{const r=s.get(l)?.get(e)??0;r>0&&a.push({label:l,population:r,objectConfig:{objectId:[l,e,r],color:n[t%n.length]}})})),a.length>0&&d.push(a)})),d},ae=e=>{if("name"in e)return e.name;if(!e.facets||1!==e.facets.length)throw new Error("Multiple facets are not allowed");return ae(e.facets[0])},ne=(e,t)=>{const{settings:a}=(0,b.t)(),{setProperty:n}=(0,Q.R)(),l=a.colorScheme.join("");return(0,Z.I)({queryKey:[e,t,l],queryFn:()=>(async(e,t,a,n)=>{const{stats_notes:l,query:r}=(e=>{const t=H.Tb.getStatisticsChartObject(e),a=t?.description,n=t?.query;return{stats_notes:a,query:n}})(e);if(!r)throw new Error(`Unknown chart key: ${e}`);return ee(e,t,r,!1,l,a,n)})(e,a.colorScheme,n,a),enabled:!!e})},le=e=>{let{setFullscreenContent:t}=e;const a=(0,l.g)().plotname||"",r=a||"",{data:o,isLoading:i,error:s}=ne(r),c=(0,Q.R)(),{settings:d}=(0,b.t)();if(i)return n.createElement(y,null,n.createElement(J.A,null));if(s)return n.createElement(y,null,n.createElement(W.A,{error:s}));const u=o&&o.length>0?("distribution-source-organism"===a&&console.log("chart data",o),{labels:o[0].map((e=>e.label)),datasets:o.map(((e,t)=>{const a={};return e.forEach((e=>{a[e.label]=e.population})),{label:e[0]?.objectConfig?.objectId?.[1]??`Dataset ${t+1}`,data:o[0].map((e=>a[e.label]||0)),backgroundColor:e[0]?.objectConfig?.color||"rgba(0, 0, 0, 0.1)",borderColor:e[0]?.objectConfig?.color||"rgba(0, 0, 0, 0.1)",borderWidth:1,objectConfig:e.map((e=>e.objectConfig))}}))}):null;return n.createElement(y,{key:a},u?n.createElement(n.Fragment,null,n.createElement(x,null,n.createElement(v,{onClick:()=>{const e=(0,X.h5)(c,d);e&&window.open(e,"_blank")}},n.createElement(p.Pcn,null)," Search API")),n.createElement(B,{data:u,plotName:a,setFullscreenContent:t})):n.createElement(y,null,n.createElement(W.A,{error:new Error("No data available")})))}}}]);