"use strict";(globalThis.webpackChunk_jbrowse_web=globalThis.webpackChunk_jbrowse_web||[]).push([[2018],{52018:(e,t,i)=>{i.r(t),i.d(t,{default:()=>p});var o=i(7552),a=i(99546),s=i(91468),l=i(95054),r=i(93062),n=i(69092),c=i(68446),d=i(75785),u=i(69500);const h=(0,d.n9)()(e=>({paper:{margin:e.spacing(),padding:e.spacing()},submit:{marginTop:25,marginBottom:100,display:"block"}}));function g(e){return a.isElectron?{localPath:window.require("electron").webUtils.getPathForFile(e),locationType:"LocalPathLocation"}:(0,s.storeBlobLocation)({blob:e})}const p=(0,c.observer)(function({model:e}){const{classes:t}=h(),[i,s]=(0,o.useState)(""),[c,d]=(0,o.useState)("MultiWiggle"+ +Date.now());return(0,u.jsxs)(l.A,{className:t.paper,children:[(0,u.jsxs)("ul",{children:[(0,u.jsx)("li",{children:"Enter list of URLs for bigwig files in the textbox"}),(0,u.jsx)("li",{children:"Or, use the button below the text box to select files from your computer"})]}),(0,u.jsx)(r.A,{multiline:!0,fullWidth:!0,rows:10,value:i,placeholder:"Paste list of URLs here, or use file selector below",variant:"outlined",onChange:e=>{s(e.target.value)}}),(0,u.jsxs)(n.A,{variant:"outlined",component:"label",children:["Choose Files from your computer",(0,u.jsx)("input",{type:"file",hidden:!0,multiple:!0,onChange:({target:e})=>{s(JSON.stringify([...e.files||[]].map(e=>({type:"BigWigAdapter",bigWigLocation:g(e),source:e.name})),null,2))}})]}),(0,u.jsx)(r.A,{value:c,helperText:"Track name",onChange:e=>{d(e.target.value)}}),(0,u.jsx)(n.A,{variant:"contained",className:t.submit,onClick:()=>{!function({trackName:e,val:t,model:i}){const o=(0,a.getSession)(i);try{const s=[`${e.toLowerCase().replaceAll(" ","_")}-${Date.now()}`,o.adminMode?"":"-sessionTrack"].join("");let l;try{l=JSON.parse(t)}catch(e){l=t.split(/\n|\r\n|\r/).map(e=>e.trim()).filter(e=>!!e)}const r="string"==typeof l[0]?{bigWigs:l}:{subadapters:l};(0,a.isSessionWithAddTracks)(o)&&(o.addTrackConf({trackId:s,type:"MultiQuantitativeTrack",name:e,assemblyNames:[i.assembly],adapter:{type:"MultiWiggleAdapter",...r}}),i.view?.showTrack(s)),i.clearData(),(0,a.isSessionModelWithWidgets)(o)&&o.hideWidget(i)}catch(e){console.error(e),o.notifyError(`${e}`,e)}}({trackName:c,val:i,model:e})},children:"Submit"}),(0,u.jsx)("p",{children:"Additional notes: "}),(0,u.jsxs)("ul",{children:[(0,u.jsxs)("li",{children:["The list of bigwig files in the text box can be a list of URLs, or a list of elements like"," ",(0,u.jsx)("code",{children:'[{"type":"BigWigAdapter","bigWigLocation":{"uri":"http://host/file.bw"}, "color":"green","source":"name for subtrack"}]'})," ","to apply e.g. the color attribute to the view"]}),(0,u.jsx)("li",{children:'Adding local files will update the textbox with JSON contents that are ready to submit with the "Submit" button'})]})]})})}}]);
//# sourceMappingURL=2018.8a0d65c2.chunk.js.map