"use strict";(self.webpackChunk_jbrowse_web=self.webpackChunk_jbrowse_web||[]).push([[5098,5997],{45997:function(e,t,n){n.r(t),n.d(t,{bufferToString:function(){return i},parseCsvBuffer:function(){return m},parseTsvBuffer:function(){return h}});var r=n(32723),a=n(33028),u=n(41361),o=n(96234),s=n(34795),c=n(81073);function i(e){return new TextDecoder("utf8",{fatal:!0}).decode(e)}function f(e){return p.apply(this,arguments)}function p(){return p=(0,s.Z)((0,r.Z)().mark((function e(t){var u,o,s=arguments;return(0,r.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return u=s.length>1&&void 0!==s[1]?s[1]:{},e.next=3,n.e(2745).then(n.t.bind(n,12745,23)).then((function(e){return e.default}));case 3:return o=e.sent,e.abrupt("return",o((0,a.Z)({noheader:!0,output:"csv"},u)).fromString(i(t)));case 5:case"end":return e.stop()}}),e)}))),p.apply(this,arguments)}function d(e,t,n){var r,a,u=e.rows[0].cells[t].text||"",o="Text";try{a=(0,c.parseLocString)(u,n)}catch(s){}return null!==(r=a)&&void 0!==r&&r.refName&&"number"===typeof a.start?o="LocString":/^\d+(\.\d+)?$/.test(u)&&(o="Number"),o}function l(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.hasColumnNameLine,r=void 0!==n&&n,a=t.columnNameLineNumber,s=void 0===a?1:a,i=t.isValidRefName,f=void 0===i?function(){return!1}:i,p=t.selectedAssemblyName,l=0,m={isLoaded:!0,rows:e.map((function(e,t){var n=t+(r?0:1);return e.length>l&&(l=e.length),{id:String(n),cells:e.map((function(e,t){return{columnNumber:t,text:e}}))}}))},v={};if(r&&void 0!==s){var h=m.rows.splice(s-1,1),y=(0,o.Z)(h,1)[0];y&&y.cells.forEach((function(e,t){v[t]=e.text||""}))}for(var x=[],w=[],b=0;b<l;b+=1){w.push(b);var g=d(m,b,f);if("LocString"===g){var N,T=(0,u.Z)(m.rows);try{for(T.s();!(N=T.n()).done;){var S=N.value.cells[b];S.extendedData=(0,c.parseLocString)(S.text,f)}}catch(D){T.e(D)}finally{T.f()}}x[b]={name:v[b],dataType:{type:g}}}return{rowSet:m,columnDisplayOrder:w,hasColumnNames:!!r,columns:x,assemblyName:p}}function m(e,t){return v.apply(this,arguments)}function v(){return(v=(0,s.Z)((0,r.Z)().mark((function e(t,n){var a;return(0,r.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,f(t);case 2:return a=e.sent,e.abrupt("return",l(a,n));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function h(e,t){return y.apply(this,arguments)}function y(){return(y=(0,s.Z)((0,r.Z)().mark((function e(t,n){var a;return(0,r.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,f(t,{delimiter:"\t"});case 2:return a=e.sent,e.abrupt("return",l(a,n));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}},25098:function(e,t,n){n.r(t),n.d(t,{parseVcfBuffer:function(){return s},splitVcfFileHeaderAndBody:function(){return c}});var r=n(6556),a=n(91211),u=n(45997),o=[{name:"CHROM",type:"Text"},{name:"POS",type:"Number"},{name:"ID",type:"Text"},{name:"REF",type:"Text"},{name:"ALT",type:"Text"},{name:"QUAL",type:"Number"},{name:"FILTER",type:"Text"},{name:"INFO",type:"Text"},{name:"FORMAT",type:"Text"}];function s(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).selectedAssemblyName,n=c((0,u.bufferToString)(e)),s=n.header,i=n.body,f=[],p=new r.Z({header:s});s="",i.split(/\n|\r\n|\r/).forEach((function(e,t){/\S/.test(e)&&f.push(function(e,t,n){var r=e.parseLine(t),u=new a.B({variant:r,parser:e,id:"vcf-".concat(n)}),o=t.split("\t").map((function(e){return"."===e?"":e}));return 8===o.length&&o.push(""),{id:String(n+1),extendedData:{vcfFeature:u.toJSON()},cells:o.map((function(e,t){return{columnNumber:t,text:e}}))}}(p,e,t))})),i="";for(var d={isLoaded:!0,rows:f},l=[],m=[],v=0;v<o.length;v+=1)l.push(v),m[v]={name:o[v].name,dataType:{type:o[v].type}};for(var h=0;h<p.samples.length;h+=1){var y=o.length+h;l.push(y),m[y]={name:p.samples[h],dataType:{type:"Text"}}}return l.push(l.length),m.unshift({name:"Location",dataType:{type:"LocString"},isDerived:!0,derivationFunctionText:"jexl:{text:row.extendedData.vcfFeature.refName+':'\n\n    +row.extendedData.vcfFeature.start+'..'+row.extendedData.vcfFeature.end, extendedData:\n\n    {refName:row.extendedData.vcfFeature.refName,start:row.extendedData.vcfFeature.start,end:row.extendedData.vcfFeature.end}}"}),{rowSet:d,columnDisplayOrder:l,hasColumnNames:!0,columns:m,assemblyName:t}}function c(e){for(var t,n=0;n<e.length;n+=1){var r=e[n];if("\n"===t&&"#"!==r)break;t=r}return{header:e.slice(0,Math.max(0,n)),body:e.slice(n)}}}}]);
//# sourceMappingURL=5098.782194b7.chunk.js.map