import{r as o,j as e,K as h,J as x,N as u}from"./index-G4l7qcMm.js";import{D as p}from"./download-core-CRepuej1.js";import{B as m}from"./browse-Ypk-yEjt.js";import{S as c}from"./Stack-Cwu0vGSf.js";import{T as j,P as y}from"./Tooltip-DDkR3tcv.js";import"./Input-BJwdycW3.js";function f(){const[t,s]=o.useState(null),a=l=>{s(l.currentTarget)},i=()=>{s(null)},n=!!t,r=n?"examples":void 0;return e.jsxs("div",{children:[e.jsx(u,{"aria-describedby":r,variant:"text",onClick:a,children:"Examples"}),e.jsx(y,{id:r,open:n,anchorEl:t,onClose:i,anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsxs(m,{sx:{px:2,py:2},children:["This supports basic multi-dimensional"," ",e.jsx("strong",{children:"numpy array slicing syntax"}),". Examples for a 2-dimensional array:",e.jsxs("ul",{children:[e.jsxs("li",{children:["First 50 elements along the first axis:",e.jsx("pre",{children:e.jsx("code",{children:":50"})})]}),e.jsxs("li",{children:["First 50 elements along the second axis:",e.jsx("pre",{children:e.jsx("code",{children:":,:50"})})]}),e.jsxs("li",{children:["A 50x10 section from the bottom right",e.jsx("pre",{children:e.jsx("code",{children:"-50:,-10:"})})]}),e.jsxs("li",{children:["Downsample the first and second axis by 2:"," ",e.jsx("pre",{children:e.jsx("code",{children:"::2,::2"})})]})]}),"Also see this"," ",e.jsx("a",{href:"https://www.w3schools.com/python/numpy/numpy_array_slicing.asp",target:"_blank",rel:"noreferrer",children:"beginner tutorial"}),"."]})})]})}const E=t=>{const[s,a]=o.useState(),[i,n]=o.useState("");var r;s!==void 0?(r=`${t.link}?format=${s.mimetype}`,i&&(r=r.concat(`&slice=${i}`))):r="";const l=d=>{n(d.target.value.replace(/ /g,""))};return e.jsx(m,{children:e.jsxs(c,{spacing:2,direction:"column",children:[e.jsxs(h,{children:["Dimensions: ",t.structure.shape.join(" × ")]}),e.jsxs(c,{spacing:1,direction:"row",children:[e.jsx(j,{label:"Slice (Optional)",helperText:"If blank, access entire array",variant:"outlined",value:i,size:"medium",onChange:l}),e.jsx(f,{})]}),e.jsx(p,{name:t.name,format:s,setFormat:a,structureFamily:t.structureFamily,link:r}),s!==void 0&&(s.mimetype.startsWith("image/")||s.mimetype.startsWith("text/"))&&t.structure.shape.length!==2?e.jsx(x,{sx:{mt:2},severity:"warning",children:"This is a multidimensional array. It may be necessary to slice a portion of this array to successfully export it as an image or textual format."}):""]})})};export{E as default};
