"use strict";(self.webpackChunk_jbrowse_web=self.webpackChunk_jbrowse_web||[]).push([[5098,5997],{45997:function(e,n,t){t.r(n),t.d(n,{bufferToString:function(){return s},parseCsvBuffer:function(){return d},parseTsvBuffer:function(){return h}});var r=t(32723),a=t(33028),u=t(96234),o=t(34795),i=t(81073);function s(e){return new TextDecoder("utf-8",{fatal:!0}).decode(e)}function c(e){return m.apply(this,arguments)}function m(){return m=(0,o.Z)((0,r.Z)().mark((function e(n){var u,o,i=arguments;return(0,r.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return u=i.length>1&&void 0!==i[1]?i[1]:{},e.next=3,t.e(2745).then(t.t.bind(t,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(s(n)));case 5:case"end":return e.stop()}}),e)}))),m.apply(this,arguments)}function f(e,n,t){var r,a=e.rows[0].cells[n].text||"",u="Text";try{r=(0,i.parseLocString)(a,t)}catch(o){}return r&&r.refName&&"number"===typeof r.start?u="LocString":/^\d+(\.\d+)?$/.test(a)&&(u="Number"),u}function l(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{hasColumnNameLine:!1,columnNameLineNumber:1,isValidRefName:function(){return!1}},t=0,r={isLoaded:!0,rows:e.map((function(e,r){var a=r+(n.hasColumnNameLine?0:1);return e.length>t&&(t=e.length),{id:String(a),cells:e.map((function(e,n){return{columnNumber:n,text:e}}))}}))},a={};if(n.hasColumnNameLine&&void 0!==n.columnNameLineNumber){var o=r.rows.splice(n.columnNameLineNumber-1,1),s=(0,u.Z)(o,1),c=s[0];c&&c.cells.forEach((function(e,n){a[n]=e.text||""}))}for(var m=[],l=[],d=function(e){l.push(e);var t=f(r,e,n.isValidRefName);"LocString"===t&&r.rows.forEach((function(t){var r=t.cells[e];r.extendedData=(0,i.parseLocString)(r.text,n.isValidRefName)})),m[e]={name:a[e],dataType:{type:t}}},p=0;p<t;p+=1)d(p);return{rowSet:r,columnDisplayOrder:l,hasColumnNames:!!n.hasColumnNameLine,columns:m,assemblyName:n.selectedAssemblyName}}function d(e){return p.apply(this,arguments)}function p(){return p=(0,o.Z)((0,r.Z)().mark((function e(n){var t,a,u=arguments;return(0,r.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=u.length>1&&void 0!==u[1]?u[1]:{hasColumnNameLine:!1,columnNameLineNumber:1,isValidRefName:function(){return!1}},e.next=3,c(n);case 3:return a=e.sent,e.abrupt("return",l(a,t));case 5:case"end":return e.stop()}}),e)}))),p.apply(this,arguments)}function h(e){return v.apply(this,arguments)}function v(){return v=(0,o.Z)((0,r.Z)().mark((function e(n){var t,a,u=arguments;return(0,r.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=u.length>1&&void 0!==u[1]?u[1]:{hasColumnNameLine:!1,columnNameLineNumber:1,isValidRefName:function(){return!1}},e.next=3,c(n,{delimiter:"\t"});case 3:return a=e.sent,e.abrupt("return",l(a,t));case 5:case"end":return e.stop()}}),e)}))),v.apply(this,arguments)}},31311:function(e,n,t){t.r(n),t.d(n,{parseVcfBuffer:function(){return s},splitVcfFileHeaderAndBody:function(){return c}});var r=t(6556),a=t(24511),u=t(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 i(e,n,t){var r=e.parseLine(n),u=new a.B({variant:r,parser:e,id:"vcf-".concat(t)}),o=n.split("\t").map((function(e){return"."===e?"":e}));return 8===o.length&&o.push(""),{id:String(t+1),extendedData:{vcfFeature:u.toJSON()},cells:o.map((function(e,n){return{columnNumber:n,text:e}}))}}function s(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{hasColumnNameLine:!1,columnNameLineNumber:0,isValidRefName:function(){return!1}},t=c((0,u.bufferToString)(e)),a=t.header,s=t.body,m=[],f=new r.Z({header:a});a="",s.split("\n").forEach((function(e,n){/\S/.test(e)&&m.push(i(f,e,n))})),s="";for(var l={isLoaded:!0,rows:m},d=[],p=[],h=0;h<o.length;h+=1)d.push(h),p[h]={name:o[h].name,dataType:{type:o[h].type}};for(var v=0;v<f.samples.length;v+=1){var N=o.length+v;d.push(N),p[N]={name:f.samples[v],dataType:{type:"Text"}}}return d.push(d.length),p.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:l,columnDisplayOrder:d,hasColumnNames:!0,columns:p,assemblyName:n.selectedAssemblyName}}function c(e){for(var n,t=0;t<e.length;t+=1){var r=e[t];if("\n"===n&&"#"!==r)break;n=r}return{header:e.substr(0,t),body:e.substr(t)}}}}]);
//# sourceMappingURL=5098.837fa596.chunk.js.map