"use strict";(self.webpackChunktiled=self.webpackChunktiled||[]).push([[321],{321:function(e,n,t){t.r(n),t.d(n,{default:function(){return k}});var a=t(70885),i=t(42982),r=t(72791),u=t.t(r,2),s=t(94070),o=t(64554),l=t(61889),c=t(4110),d=t(10889),m=t(80184),f=function(e){var n=[{value:e.min,label:e.min},{value:e.max,label:e.max}];return(0,m.jsx)(o.Z,{children:(0,m.jsxs)(l.ZP,{container:!0,spacing:2,alignItems:"center",children:[(0,m.jsx)(l.ZP,{item:!0,xs:!0,children:(0,m.jsx)(d.ZP,{getAriaLabel:function(){return"Array slice range"},value:e.value,min:e.min,max:e.max,marks:n,onChange:function(n,t){e.setValue(t)},valueLabelDisplay:"auto"})}),(0,m.jsx)(l.ZP,{item:!0,children:(0,m.jsx)(c.Z,{value:e.value,size:"small",onChange:function(n){e.setValue(""===n.target.value?e.value:Number(n.target.value))},onBlur:function(){e.value<e.min?e.setValue(e.min):e.value>e.max&&e.setValue(e.max)},inputProps:{step:1,min:e.min,max:e.max,type:"number","aria-labelledby":"min-input-slider"}})})]})})},h=t(20890),v=t(93904),p=t(69120),x=t(33073),g=t(40162);function b(e,n,t,i,u){var s="undefined"!==typeof window&&"undefined"!==typeof window.matchMedia,o=r.useState((function(){return u&&s?t(e).matches:i?i(e).matches:n})),l=(0,a.Z)(o,2),c=l[0],d=l[1];return(0,g.Z)((function(){var n=!0;if(s){var a=t(e),i=function(){n&&d(a.matches)};return i(),a.addListener(i),function(){n=!1,a.removeListener(i)}}}),[e,t,s]),c}var Z=u.useSyncExternalStore;function y(e,n,t,i){var u=r.useCallback((function(){return n}),[n]),s=r.useMemo((function(){if(null!==i){var n=i(e).matches;return function(){return n}}return u}),[u,e,i]),o=r.useMemo((function(){if(null===t)return[u,function(){return function(){}}];var n=t(e);return[function(){return n.matches},function(e){return n.addListener(e),function(){n.removeListener(e)}}]}),[u,t,e]),l=(0,a.Z)(o,2),c=l[0],d=l[1];return Z(d,c,s)}function w(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=(0,p.Z)(),a="undefined"!==typeof window&&"undefined"!==typeof window.matchMedia,i=(0,x.Z)({name:"MuiUseMediaQuery",props:n,theme:t}),r=i.defaultMatches,u=void 0!==r&&r,s=i.matchMedia,o=void 0===s?a?window.matchMedia:null:s,l=i.ssrMatchMedia,c=void 0===l?null:l,d=i.noSsr;var m="function"===typeof e?e(t):e;m=m.replace(/^@media( ?)/m,"");var f=void 0!==Z?y:b,h=f(m,u,o,c,d);return h}var M=t(13967),j=function(e){var n;return n="".concat(e.link,"?format=image/png&slice=").concat(e.cuts.join(",")),1!==e.stride&&(n=n.concat(",::".concat(e.stride,",::").concat(e.stride))),(0,m.jsx)(o.Z,{component:"img",sx:{maxWidth:1},alt:"Data rendered",src:n,loading:"lazy"})},k=function(e){var n,t=e.structure.macro.shape,u=t.length,l=t.slice(0,u-2).map((function(e){return Math.floor(e/2)})),c=(0,M.Z)(),d=w(c.breakpoints.down("sm")),p=w(c.breakpoints.down("md"));n=d?c.breakpoints.values.sm:p?c.breakpoints.values.md:c.breakpoints.values.lg;var x=Math.ceil(Math.max.apply(Math,(0,i.Z)(t.slice(u-2,u)))/n),g=(0,r.useState)(l),b=(0,a.Z)(g,2),Z=b[0],y=b[1];return(0,m.jsxs)(o.Z,{children:[(0,m.jsx)(j,{link:e.link,cuts:Z,stride:x}),t.length>2?(0,m.jsxs)(h.Z,{id:"input-slider",gutterBottom:!0,children:["Choose a planar cut through this ",t.length,"-dimensional array."]}):"",1!==x?(0,m.jsxs)(s.Z,{severity:"info",children:["This large array has been downsampled by a factor of ",x,".",(0,m.jsx)("br",{}),'Use the "Download" tab to access a full-resolution image.']}):"",t.slice(0,u-2).map((function(e,n){return e>1?(0,m.jsx)(f,{min:0,max:e-1,value:Z[n],setValue:(0,v.D)((function(e){var t=Z.slice();t[n]=e,y(t)}),100,{maxWait:200})},"slider-".concat(n)):""}))]})}}}]);
//# sourceMappingURL=321.c6b9dcec.chunk.js.map