All Downloads are FREE. Search and download functionalities are using the official Maven repository.

js.dalliance-all.min.js Maven / Gradle / Ivy

!function e(t,r,i){function n(o,a){if(!r[o]){if(!t[o]){var l="function"==typeof require&&require;if(!a&&l)return l(o,!0);if(s)return s(o,!0);var u=new Error("Cannot find module '"+o+"'");throw u.code="MODULE_NOT_FOUND",u}var h=r[o]={exports:{}};t[o][0].call(h.exports,function(e){var r=t[o][1][e];return n(r?r:e)},h,h.exports,e,t,r,i)}return r[o].exports}for(var s="function"==typeof require&&require,o=0;on;++n){var s=(h(e,r),h(e,r+4));r+=8+16*s}var o=h(e,r);r+=4;for(var a=1e9,l=r,u=0;o>u;++u){var c=g(e,l);if(l+=8,c){var f=c.block;c.offset>0&&(f+=65536),a>f&&(a=f);break}}return r+=8*o,{minBlockIndex:a,nbin:i,length:r-t}}function s(e,t,r,i,n){e.slice(0,10).fetch(function(s){return s?o(e,t,r,i,n):i(null,"Couldn't access BAM.")},{timeout:5e3})}function o(e,t,r,s,a){function l(e){if(!e)return s(null,"Couldn't access BAM");var t=v(e,e.byteLength),r=new Uint8Array(t),i=h(r,0);if(i!=b)return s(null,"Not a BAM file, magic=0x"+i.toString(16));for(var n=h(r,4),o="",a=0;n>a;++a)o+=String.fromCharCode(r[a+8]);var l=h(r,n+8),u=n+12;c.chrToIndex={},c.indexToChr=[];for(var a=0;l>a;++a){for(var f=h(r,u),p="",d=0;f-1>d;++d)p+=String.fromCharCode(r[u+4+d]);h(r,u+f+4);c.chrToIndex[p]=a,0==p.indexOf("chr")?c.chrToIndex[p.substring(3)]=a:c.chrToIndex["chr"+p]=a,c.indexToChr.push(p),u=u+8+f}return c.indices?s(c):void 0}function u(e){if(!e)return"Couldn't access BAI";var t=new Uint8Array(e),r=h(t,0);if(r!=w)return s(null,"Not a BAI file, magic=0x"+r.toString(16));var i=h(t,4);c.indices=[];for(var o=8,a=0;i>a;++a){var l=o,u=n(t,l);o+=u.length,f=Math.min(u.minBlockIndex,f);var p=u.nbin;p>0&&(c.indices[a]=new Uint8Array(e,l,o-l))}return!0}var c=new i;c.data=e,c.bai=t,c.indexChunks=r;var f=c.indexChunks?c.indexChunks.minBlockIndex:1e9;if(c.indexChunks){var p=c.indexChunks.chunks;c.indices=[];for(var d=0;df;++f){var p=h(i,c),d=h(i,c+4);if(c+=8,s[p])for(var v=0;d>v;++v){var b=g(i,c),w=g(i,c+8);(4681>p?l:a).push(new m(b,w)),c+=16}else c+=16*d}for(var x=h(i,c),S=null,_=Math.min(t>>14,x-1),T=Math.min(r>>14,x-1),o=_;T>=o;++o){var C=g(i,c+4+8*o);C&&(!S||C.blockS.block||L.maxv.block==S.block&&L.maxv.offset>=S.offset)&&k.push(L)}l=k;for(var A=[],o=0;o0){for(var E=A[0],o=1;o=a.length)return i(c);if(h){var e=new Uint8Array(h),u=o.readBamRecords(e,a[f].minv.offset,c,t,r,l,n);return h=null,++f,u?i(c):s()}var p=a[f],d=p.minv.block,g=p.maxv.block+65536;o.data.slice(d,g-d).fetch(function(e){return h=v(e,p.maxv.block-p.minv.block+1),s()})}var o=this;n=n||{};var a,l=this.chrToIndex[e];if(void 0===l)a=[];else{if(null===this.indices[l]&&this.indexChunks.chunks[l]){var u=this.indexChunks.chunks[l];return this.bai.slice(u[0],u[1]).fetch(function(s){var o=new Uint8Array(s);return this.indices[l]=o,this.fetch(e,t,r,i,n)}.bind(this))}a=this.blocksForRange(l,t,r),a||i(null,"Error in index fetch")}var h,c=[],f=0;s()};var S=["=","A","C","x","G","x","x","x","T","x","x","x","x","x","x","N"],_=["M","I","D","N","S","H","P","=","X","?","?","?","?","?","?","?"];i.prototype.readBamRecords=function(e,t,r,i,n,s,o){for(;;){var l=h(e,t),u=t+l+4;if(u>e.length)return!1;var d=new a,g=h(e,t+4),v=h(e,t+8),y=h(e,t+12),m=(65280&y)>>8,b=255&y,w=h(e,t+16),x=(4294901760&w)>>16,T=65535&w,C=h(e,t+20),k=h(e,t+24),L=h(e,t+28);h(e,t+32);if(d.segment=this.indexToChr[g],d.flag=x,d.pos=v,d.mq=m,o.light&&(d.seqLength=C),!o.light||o.includeName){for(var A="",O=0;b-1>O;++O)A+=String.fromCharCode(e[t+36+O]);d.readName=A}if(!o.light){k>=0&&(d.nextSegment=this.indexToChr[k],d.nextPos=L);for(var E=t+36+b,R="",B=0;T>B;++B){var I=h(e,E);R=R+(I>>4)+_[15&I],E+=4}d.cigar=R;for(var M="",P=C+1>>1,O=0;P>O;++O){var H=e[E+O];M+=S[(240&H)>>4],M.lengthO;++O)F+=String.fromCharCode(e[E+O]+33);for(E+=C,d.quals=F;u>E;){var N,G=String.fromCharCode(e[E],e[E+1]),D=String.fromCharCode(e[E+2]);if("A"==D)N=String.fromCharCode(e[E+3]),E+=4;else if("i"==D||"I"==D)N=h(e,E+3),E+=7;else if("c"==D||"C"==D)N=e[E+3],E+=4;else if("s"==D||"S"==D)N=c(e,E+3),E+=5;else if("f"==D)N=p(e,E+3),E+=7;else if("Z"==D||"H"==D)for(E+=3,N="";;){var q=e[E++];if(0==q)break;N+=String.fromCharCode(q)}else{if("B"!=D)throw"Unknown type "+D;var U,z,j=String.fromCharCode(e[E+3]),W=h(e,E+4);if("i"==j||"I"==j||"f"==j)U=4,z="f"==j?p:h;else if("s"==j||"S"==j)U=2,z=c;else{if("c"!=j&&"C"!=j)throw"Unknown array type "+j;U=1,z=f}E+=8,N=[];for(var V=0;W>V;++V)N.push(z(e,E)),E+=U}d[G]=N}}if((!i||d.pos<=n&&d.pos+C>=i)&&(void 0===s||g==s)&&r.push(d),d.pos>n)return!0;t=u}},"undefined"!=typeof t&&(t.exports={makeBam:s,BAM_MAGIC:b,BAI_MAGIC:w,BamFlags:x})},{"./bin":4,"./lh3utils":26,"./spans":41}],2:[function(e,t,r){"use strict";function i(e){this.type=e}function n(e,t){this.parser=e,this.sink=t}function s(e,t){this.parser=e,this.sink=t,this.wigState=null}if("undefined"!=typeof e)var o=e("./spans"),a=o.Range,l=o.union,u=o.intersection,h=e("./sourceadapters"),c=h.registerParserFactory,f=e("./das"),p=f.DASStylesheet,d=f.DASStyle,g=(f.DASFeature,f.DASGroup),v=e("./utils"),y=v.shallowCopy;i.prototype.createSession=function(e){return"wig"==this.type?new s(this,e):new n(this,e)};var m=/([^=]+)=(.+)/,b=/\s/,w=new RegExp("^[0-9]+,[0-9]+,[0-9]+");n.prototype.parse=function(e){var t=e.split(b);if(!(t.length<3)){var r=parseInt(t[1])+1,i=parseInt(t[2]),n={segment:t[0],min:r,max:i};if(t.length>3&&"."!==t[3]&&(n.label=t[3]),t.length>4&&(n.score=parseFloat(t[4])),t.length>5&&(n.orientation=t[5]),t.length>8){var s=t[8];w.test(s)&&(n.itemRgb="rgb("+s+")")}if(t.length>=12){var o=parseInt(t[6]),h=parseInt(t[7]),c=parseInt(t[9]),f=t[10].split(",").map(function(e){return parseInt(e)}),p=t[11].split(",").map(function(e){return parseInt(e)});n.type="transcript";var d=new g;if(d.id=t[3],d.type="transcript",d.notes=[],n.groups=[d],t.length>12){var v=t[12],m=v;t.length>13&&(m=t[13]);var x=new g;x.id=v,x.label=m,x.type="gene",n.groups.push(x)}for(var S=null,_=0;c>_;++_){var T=p[_]+r,C=T+f[_],k=new a(T,C);S=S?l(S,k):k}for(var L=S.ranges(),A=0;Ao){var R="+"==n.orientation?new a(o,h+3):new a(o-3,h),B=u(S,R);if(B){n.type="translation";for(var I=B.ranges(),M=0,A=0;Al;++l)if(0==r){e+=a;var u=i(n,e);e+=8,u-=t.chromTreeOffset,h(u)}else{for(var c="",f=0;a>f;++f){var p=n[e++];0!=p&&(c+=String.fromCharCode(p))}var d=n[e+3]<<24|n[e+2]<<16|n[e+1]<<8|n[e+0];n[e+7]<<24|n[e+6]<<16|n[e+5]<<8|n[e+4];e+=8,t.chromsToIDs[c]=d,0==c.indexOf("chr")&&(t.chromsToIDs[c.substr(3)]=d),t.idsToChroms[d]=c,t.maxID=Math.max(t.maxID,d)}};u(l),e(t)})},s.prototype.readWigData=function(e,t,r,i){var n=this.bwg.chromsToIDs[e];return void 0===n?i([]):void this.readWigDataById(n,t,r,i)},s.prototype.readWigDataById=function(e,t,r,n){var s=this;if(!this.cirHeader)return void this.bwg.data.slice(this.cirTreeOffset,48).fetch(function(i){s.cirHeader=i;var o=new Int32Array(s.cirHeader);s.cirBlockSize=o[1],s.readWigDataById(e,t,r,n)});var o=[],a=0,l=(Date.now(),function(i,n,s,o){return(0>e||i==e)&&r>=n&&s>=t}),c=function(e,t){if(s.bwg.instrument&&console.log("level="+t+"; offset="+e+"; time="+(0|Date.now())),a+=e.length,1==e.length&&e[0]-s.cirTreeOffset==48&&s.cachedCirRoot)return p(s.cachedCirRoot,0,t),--a,void(0==a&&s.fetchFeatures(l,o,n));for(var r,i=4+32*s.cirBlockSize,c=0;cd;++d){var g=s/4,v=h[g],y=h[g+1],m=h[g+2],b=h[g+3],w=i(l,s+16),x=i(l,s+24);(0>e||e>v||v==e&&r>=y)&&(0>e||m>e||m==e&&b>=t)&&o.push({offset:w,size:x}),s+=32}else{for(var S=[],d=0;p>d;++d){var g=s/4,v=h[g],y=h[g+1],m=h[g+2],b=h[g+3],w=i(l,s+16);(0>e||e>v||v==e&&r>=y)&&(0>e||m>e||m==e&&b>=t)&&S.push(w),s+=24}S.length>0&&c(S,a+1)}};c([s.cirTreeOffset+48],1)},s.prototype.fetchFeatures=function(e,t,r){var i=this;if(t.sort(function(e,t){return(0|e.offset)-(0|t.offset)}),0==t.length)r([]);else{var n=[],s=function(e,t,r,s){s||(s={});var o=new p;o._chromId=e,o.segment=i.bwg.idsToChroms[e],o.min=t,o.max=r,o.type=i.bwg.type;for(var a in s)o[a]=s[a];n.push(o)},o=function a(){if(0==t.length){Date.now();return void r(n)}var o=t[0];if(o.data)i.parseFeatures(o.data,s,e),t.splice(0,1),a();else{for(var l=o.offset,u=o.size,h=1;hr;){var s,o=t[n];if(i.bwg.uncompressBufSize>0)s=w(e,r+2,o.size-2);else{var l=new Uint8Array(o.size);x(new Uint8Array(e,r,o.size),0,l,0,o.size),s=l.buffer}o.data=s,r+=o.size,++n}a()})}};o()}},s.prototype.parseFeatures=function(e,t,r){var i=new Uint8Array(e);if(this.isSummary)for(var n=new Int16Array(e),s=new Int32Array(e),o=new Float32Array(e),a=e.byteLength/32,l=0;a>l;++l){var f=s[8*l],p=s[8*l+1],g=s[8*l+2],y=s[8*l+3],m=(o[8*l+4],o[8*l+5]),b=o[8*l+6];o[8*l+7];if(r(f,p+1,g)){var w={type:"bigwig",score:b/y,maxScore:m};"bigbed"==this.bwg.type&&(w.type="density"),t(f,p+1,g,w)}}else if("bigwig"==this.bwg.type){var n=new Int16Array(e),s=new Int32Array(e),o=new Float32Array(e),f=s[0],x=s[1],S=(s[2],s[3]),_=s[4],T=i[20],a=n[11];if(T==A)for(var l=0;a>l;++l){var C=o[l+6],O=x+l*S+1,E=x+l*S+_;r(f,O,E)&&t(f,O,E,{score:C})}else if(T==L)for(var l=0;a>l;++l){var p=s[2*l+6]+1,g=p+_-1,C=o[2*l+7];r(f,p,g)&&t(f,p,g,{score:C})}else if(T==k)for(var l=0;a>l;++l){var p=s[3*l+6]+1,g=s[3*l+7],C=o[3*l+8];p>g&&(p=g),r(f,p,g)&&t(f,p,g,{score:C})}else console.log("Currently not handling bwgType="+T)}else{if("bigbed"!=this.bwg.type)throw Error("Don't know what to do with "+this.bwg.type);for(var R=0,B=this.bwg.definedFieldCount,M=this.bwg.schema;R0?P.split("	"):[],F.length>0&&B>3&&(N.label=F[0]),F.length>1&&B>4){var C=parseInt(F[1]);isNaN(C)||(N.score=C)}if(F.length>2&&B>5&&(N.orientation=F[2]),F.length>5&&B>8){var G=F[5];I.test(G)&&(N.itemRgb="rgb("+G+")")}if(F.length>B-3&&M)for(var D=B-3;DB)t(f,p+1,g,N);else{var q=0|F[3],U=0|F[4],z=0|F[6],j=F[7].split(","),W=F[8].split(",");if(N.exonFrames){var V=N.exonFrames.split(",");N.exonFrames=void 0}N.type="transcript";var X=new d;for(var K in N)X[K]=N[K];if(X.id=F[0],X.segment=this.bwg.idsToChroms[f],X.min=p+1,X.max=g,X.notes=[],N.groups=[X],F.length>9){var Z=N.geneName||F[9],Q=Z;F.length>10&&(Q=F[10]),N.geneName2&&(Q=N.geneName2);var Y=v(X);Y.id=Z,Y.label=Q,Y.type="gene",N.groups.push(Y)}for(var $=[],J=0;z>J;++J){var ee=(0|W[J])+p,te=ee+(0|j[J]),re=new u(ee,te);$.push(re)}for(var ie=h($),ne=ie.ranges(),se=0;seq){var ae="+"==N.orientation?new u(q,U+3):new u(q-3,U),le=c(ie,ae);if(le){N.type="translation";for(var ue=le.ranges(),he=0,ce=0;ue[0].min()>ne[ce].max();)ce++;for(var se=0;se=0&&2>=pe&&(N.readframe=pe,N.readframeExplicit=!0)}var de=oe.max()-oe.min();he=(he+de)%3,t(f,oe.min()+1,oe.max(),N)}}}}}}},s.prototype.getFirstAdjacent=function(e,t,r,i){var n=this.bwg.chromsToIDs[e];return void 0===n?i([]):void this.getFirstAdjacentById(n,t,r,i)},s.prototype.getFirstAdjacentById=function(e,t,r,n){var s=this;if(!this.cirHeader)return void this.bwg.data.slice(this.cirTreeOffset,48).fetch(function(i){s.cirHeader=i;var o=new Int32Array(s.cirHeader);s.cirBlockSize=o[1],s.getFirstAdjacentById(e,t,r,n)});var o=null,a=-1,l=-1,c=0,f=(Date.now(),function(e,t){c+=e.length;for(var r,i=4+32*s.cirBlockSize,n=0;n0&&(0!=e||t>0)?s.getFirstAdjacentById(0,0,r,n):0>r&&(e!=s.bwg.maxID||1e9>t)?s.getFirstAdjacentById(s.bwg.maxID,1e9,r,n):n([]);s.fetchFeatures(function(i,n,s,o){return 0>r&&(e>i||t>s)||r>0&&(i>e||n>t)},[o],function(e){for(var t=null,i=-1,s=-1,o=0;or&&(l>i||h>s)||r>0&&(i>l||s>u))&&(t=a,s=0>r?h:u,i=l)}return n(null!=t?[t]:[])})}})},d=function(n,u,h){var c=new Uint8Array(n),p=new Int16Array(n),d=new Int32Array(n),g=c[u],v=p[u/2+1];if(u+=4,0!=g)for(var y=0;v>y;++y){var m=u/4,b=d[m],w=d[m+1],x=d[m+2],S=d[m+3],_=i(c,u+16),T=i(c,u+24);(0>r&&(e>b||b==e&&t>=w)||r>0&&(x>e||x==e&&S>=t))&&(/_random/.exec(s.bwg.idsToChroms[b])||(null==o||0>r&&(x>a||x==a&&S>l)||r>0&&(a>b||b==a&&l>w))&&(o={offset:_,size:T},l=0>r?S:w,a=0>r?x:b)),u+=32}else{for(var C=-1,k=-1,L=-1,y=0;v>y;++y){var m=u/4,b=d[m],w=d[m+1],x=d[m+2],S=d[m+3],_=d[m+4]<<32|d[m+5];(0>r&&(e>b||b==e&&t>=w)&&x>=e||r>0&&(x>e||x==e&&S>=t)&&e>=b)&&(0>C||S>k)&&(C=_,k=0>r?S:w,L=0>r?x:b),u+=24}C>=0&&f([C],h+1)}};f([s.cirTreeOffset+48],1)},n.prototype.readWigData=function(e,t,r,i){this.getUnzoomedView().readWigData(e,t,r,i)},n.prototype.getUnzoomedView=function(){if(!this.unzoomedView){var e=4e3,t=this.zoomLevels[0];t&&(e=this.zoomLevels[0].dataOffset-this.unzoomedIndexOffset),this.unzoomedView=new s(this,this.unzoomedIndexOffset,e,!1)}return this.unzoomedView},n.prototype.getZoomedView=function(e){var t=this.zoomLevels[e];return t.view||(t.view=new s(this,t.indexOffset,4e3,!0)),t.view},n.prototype._tsFetch=function(e,t,r,i,n){var s=this;if(!(e>=this.zoomLevels.length-1)){var o;return o=0>e?this.getUnzoomedView():this.getZoomedView(e),o.readWigDataById(t,r,i,n)}if(this.topLevelReductionCache){for(var a=[],l=this.topLevelReductionCache,u=0;u0?0:3e8;e.fromRef&&(a=t);for(var u=0;u0){if(h>i)if(e.zoom<0){if(c.min>a)return n(c)}else c.max>a&&l.push({chr:e.chr,chrOrd:e.chrOrd,zoom:e.zoom-2,min:c.min,max:c.max,fromRef:e.fromRef})}else if(h>i)if(e.zoom<0){if(c.maxr?-1:1;for(var o=this,a=this.chromsToIDs[e],l=[{chrOrd:0,chr:a,zoom:o.zoomLevels.length-4,min:0,max:3e8,fromRef:!0}],u=1;u<=this.maxID+1;++u){var h=(a+r*u)%(this.maxID+1);0>h&&(h+=this.maxID+1),l.push({chrOrd:u,chr:h,zoom:o.zoomLevels.length-1,min:0,max:3e8})}s()},n.prototype.getAutoSQL=function(e){return this.asOffset?void this.data.slice(this.asOffset,2048).fetch(function(t){for(var r=new Uint8Array(t),i="",n=0;nu;++u){var h=s[10*u],c=s[10*u+1],f=i(n,20*u+4),p=s[10*u+8],d=new a(t,h,c,f,p);l.push(d)}e(l)})})},a.prototype.lookup=function(e,t){var r=this;this.bbi.data.slice(this.offset,32).fetch(function(n){function s(n){r.bbi.data.slice(n,4+l*(u+h)).fetch(function(n){var o=new Uint8Array(n),a=new Uint16Array(n),l=(new Uint32Array(n),o[0]),c=a[1],f=4;if(0!=l){for(var p=0;c>p;++p){for(var d="",g=0;u>g;++g){var v=o[f++];0!=v&&(d+=String.fromCharCode(v))}if(d==e){var y=i(o,f),b=m(o,f+8);return r.bbi.getUnzoomedView().fetchFeatures(function(t,i,n,s){return s&&s.length>r.field-3?s[r.field-3]==e:void 0},[{offset:y,size:b}],t)}f+=h}return t([])}for(var w=null,p=0;c>p;++p){for(var d="",g=0;u>g;++g){var v=o[f++];0!=v&&(d+=String.fromCharCode(v))}var x=i(o,f);if(f+=8,e.localeCompare(d)<0&&w)return void s(w);w=x}s(w)})}var o=new Uint8Array(n),a=(new Int16Array(n),new Int32Array(n)),l=(a[0],a[1]),u=a[2],h=a[3],c=(i(o,16),32);s(r.offset+c)})},"undefined"!=typeof t&&(t.exports={makeBwg:o,BIG_BED_MAGIC:T,BIG_WIG_MAGIC:S})},{"./bin":4,"./das":10,"./spans":41,"./utils":56,jszlib:61}],4:[function(e,t,r){"use strict";function i(e){this.blob=e}function n(e,t,r,i){i||("object"===("undefined"==typeof t?"undefined":f(t))?(i=t,t=void 0):i={}),this.url=e,this.start=t||0,r&&(this.end=r),this.opts=i}function s(e){if(!e)return null;for(var t=new Uint8Array(e.length),r=0;re)throw"Bad slice "+e;var r=this.start,i=this.end;return r&&e?r+=e:r=e||r,i=t&&r?r+t-1:i||t-1,new n(this.url,r,i,this.opts)};var m=0,b="undefined"!=typeof navigator&&navigator.userAgent.indexOf("Safari")>=0&&navigator.userAgent.indexOf("Chrome")<0;n.prototype.fetchAsText=function(e){var t=this;this.getURL().then(function(r){try{var i,n=new XMLHttpRequest;if((b||t.opts.salt)&&r.indexOf("?")<0&&(r=r+"?salt="+v(""+Date.now()+","+ ++m)),n.open("GET",r,!0),t.end){if(t.end-t.start>1e8)throw"Monster fetch!";n.setRequestHeader("Range","bytes="+t.start+"-"+t.end),i=t.end-t.start+1}n.onreadystatechange=function(){return 4==n.readyState?e(200==n.status||206==n.status?n.responseText:null):void 0},t.opts.credentials&&(n.withCredentials=!0),n.send()}catch(s){return e(null)}})["catch"](function(t){return console.log(t),e(null,t)})},n.prototype.salted=function(){var e=d(this.opts);return e.salt=!0,new n(this.url,this.start,this.end,e)},n.prototype.getURL=function(){return this.opts.resolver?this.opts.resolver(this.url).then(function(e){return"string"==typeof e?e:e.url}):y.resolve(this.url)},n.prototype.fetch=function(e,t){var r=this;t=t||{};var i=t.attempt||1,n=t.truncatedLength;return i>3?e(null):void this.getURL().then(function(o){try{var a;t.timeout&&!r.opts.credentials&&(a=setTimeout(function(){return console.log("timing out "+o),u.abort(),e(null,"Timeout")},t.timeout));var l,u=new XMLHttpRequest;if((b||r.opts.salt)&&o.indexOf("?")<0&&(o=o+"?salt="+v(""+Date.now()+","+ ++m)),u.open("GET",o,!0),u.overrideMimeType("text/plain; charset=x-user-defined"),r.end){if(r.end-r.start>1e8)throw"Monster fetch!";u.setRequestHeader("Range","bytes="+r.start+"-"+r.end),l=r.end-r.start+1}u.responseType="arraybuffer",u.onreadystatechange=function(){if(4==u.readyState){if(a&&clearTimeout(a),200==u.status||206==u.status){if(u.response){var t=u.response.byteLength;return!l||l==t||n&&t==n?e(u.response):r.fetch(e,{attempt:i+1,truncatedLength:t})}if(u.mozResponseArrayBuffer)return e(u.mozResponseArrayBuffer);var o=u.responseText;return!l||l==o.length||n&&o.length==n?e(s(u.responseText)):r.fetch(e,{attempt:i+1,truncatedLength:o.length})}return r.fetch(e,{attempt:i+1})}},r.opts.credentials&&(u.withCredentials=!0),u.send()}catch(h){return e(null)}})["catch"](function(t){return console.log(t),e(null,t)})};var w=new ArrayBuffer(8),x=new Uint8Array(w),S=new Float32Array(w);"undefined"!=typeof t&&(t.exports={BlobFetchable:i,URLFetchable:n,readInt:l,readIntBE:c,readInt64:a,readShort:u,readByte:h,readFloat:o})},{"./sha1":38,"./utils":56,"es6-promise":60}],5:[function(e,t,r){"use strict";function i(e){var t="bp";return e>1e9?(e/=1e9,t="Gb"):e>1e6?(e/=1e6,t="Mb"):e>1e3&&(e/=1e3,t="kb"),""+Math.round(e)+t}if("undefined"!=typeof e){var n=e("./cbrowser"),s=n.Browser,o=e("./utils"),a=o.makeElement,l=(o.removeChildren,e("./numformats")),u=l.formatLongInt,h=e("./zoomslider");e("./tier-edit"),e("./export-config"),e("./export-ui"),e("./export-image"),e("./svg-export"),e("./session")}s.prototype.initUI=function(e,t){this.noSourceCSS||["bootstrap-scoped.css","dalliance-scoped.css","font-awesome.min.css"].forEach(function(e){document.head.appendChild(a("link","",{rel:"stylesheet",href:this.resolveURL("$$css/"+e)}))}.bind(this));var r=this;r.disableDefaultFeaturePopup||this.addFeatureListener(function(e,t,i,n){r.featurePopup(e,t,i,n)}),e.classList.add("dalliance");var n=r.toolbar=a("div",null,{className:"btn-toolbar toolbar"}),s=r.coordSystem.speciesName+" "+r.nameForCoordSystem(r.coordSystem);this.setDocumentTitle&&(document.title=s+" :: dalliance");var o=a("input","",{className:"loc-field"});r.makeTooltip(o,"Enter a genomic location or gene name");var l=a("p","",{className:"loc-status"}),c=a("a",[a("i",null,{className:"fa fa-search-plus"})],{className:"btn"}),f=new h({width:r.zoomSliderWidth});r.makeTooltip(f,"Highlighted button shows current zoom level, gray button shows inactive zoom level (click or tap SPACE to toggle).");var p=a("a",[a("i",null,{className:"fa fa-search-minus"})],{className:"btn"}),d=a("a",[a("i",null,{className:"fa fa-eraser"})],{className:"btn"}),g=a("a",[a("i",null,{className:"fa fa-plus"})],{className:"btn"}),v=a("a",[a("i",null,{className:"fa fa-bookmark"})],{className:"btn"}),y=a("a",[a("i",null,{className:"fa fa-print"})],{className:"btn"}),m=(a("a",[a("i",null,{className:"fa fa-refresh"})],{className:"btn"}),a("a",[a("i",null,{className:"fa fa-cogs"})],{className:"btn"})),b=a("a",[a("i",null,{className:"fa fa-question"})],{className:"btn"}),w=a("a",[a("i",null,{className:"fa fa-road"})],{className:"btn"});r.makeTooltip(w,"Configure currently selected track(s) (E)");var x=a("a",[a("i",null,{className:"fa fa-angle-left"})],{className:"btn"},{width:"5px"}),S=a("a",[a("i",null,{className:"fa fa-angle-right"})],{className:"btn pull-right"},{width:"5px"}),_=a("div",null,{className:"btn-group pull-right"});this.noTrackAdder||_.appendChild(g),this.noTrackEditor||_.appendChild(w),this.noExport||_.appendChild(y),this.noOptions||_.appendChild(m),this.noHelp||_.appendChild(b),this.setUiMode=function(e){this.uiMode=e;var t={help:b,add:g,opts:m,"export":y,tier:w};for(var r in t)r==e?t[r].classList.add("active"):t[r].classList.remove("active")},this.noLeapButtons||n.appendChild(S),_.firstChild&&n.appendChild(_),this.noLeapButtons||n.appendChild(x),this.noTitle||n.appendChild(a("div",a("h4",s,{},{margin:"0px"}),{className:"btn-group title"})),this.noLocationField||n.appendChild(a("div",[o,l],{className:"btn-group loc-group"})),this.noClearHighlightsButton||n.appendChild(d),this.noZoomSlider||n.appendChild(a("div",[c,a("span",f,{className:"btn"}),p],{className:"btn-group"})),this.toolbarBelow?(e.appendChild(t),e.appendChild(n)):(e.appendChild(n),e.appendChild(t));var T=Math.log(2)/Math.log(10),C=Math.log(5)/Math.log(10),k=function(e){var t,i=(e/r.zoomExpt+Math.log(r.zoomBase))/Math.log(10),n=0|i,s=i-n;return t=.01>s?n:T+.01>=s?n+T:C+.01>=s?n+C:n+1,(t*Math.log(10)-Math.log(r.zoomBase))*r.zoomExpt},L=function(e){f.addLabel(e,i(Math.exp(e/r.zoomExpt)*r.zoomBase))};this.addViewListener(function(e,t,i,n,s){o.value=e+":"+u(t)+".."+u(i),f.min=0|s.min,f.max=0|s.max,s.isSnapZooming?(f.value=s.alternate,f.value2=s.current,f.active=2):(f.value=s.current,f.value2=s.alternate,f.active=1),s.current==s.min?c.classList.add("disabled"):c.classList.remove("disabled"),s.current==s.max?p.classList.add("disabled"):p.classList.remove("disabled"),f.removeLabels();var a=s.min,l=s.max,h=l-a,g=4;r.zoomSliderWidth&&r.zoomSliderWidth<150&&(g=3),L(k(a));for(var v=1;g-1>v;++v)L(k(a+1*v*h/(g-1)));L(k(l)),r.storeStatus&&r.storeViewStatus(),r.highlights.length>0?d.style.display="inline-block":d.style.display="none"}),this.addTierListener(function(){r.storeStatus&&r.storeTierStatus()}),o.addEventListener("keydown",function(e){if(40==e.keyCode&&(e.preventDefault(),e.stopPropagation(),r.setSelectedTier(0)),10==e.keyCode||13==e.keyCode){e.preventDefault();var t=o.value;r.search(t,function(e){e?l.textContent=""+e:l.textContent=""})}},!1);var A;g.addEventListener("click",function(e){A&&A.displayed?r.removeAllPopups():A=r.showTrackAdder(e)},!1),r.makeTooltip(g,"Add a new track from the registry or an indexed file. (A)"),c.addEventListener("click",function(e){e.stopPropagation(),e.preventDefault(),r.zoomStep(-10)},!1),r.makeTooltip(c,"Zoom in (+)"),p.addEventListener("click",function(e){e.stopPropagation(),e.preventDefault(),r.zoomStep(10)},!1),r.makeTooltip(p,"Zoom out (-)"),f.addEventListener("change",function(e){
var t=2==f.active;t!=r.isSnapZooming&&(r.savedZoom=r.zoomSliderValue-r.zoomMin,r.isSnapZooming=t);var i=1==f.active?f.value:f.value2;r.zoomSliderValue=1*i,r.zoom(Math.exp(1*i/r.zoomExpt))},!1),v.addEventListener("click",function(e){e.stopPropagation(),e.preventDefault()},!1),r.makeTooltip(v,"Favourite regions"),y.addEventListener("click",function(e){e.stopPropagation(),e.preventDefault(),r.openExportPanel()},!1),r.makeTooltip(y,"Export publication-quality SVG. (X)");m.addEventListener("click",function(e){e.stopPropagation(),e.preventDefault(),r.toggleOptsPopup(e)},!1),r.makeTooltip(m,"Configure options."),b.addEventListener("click",function(e){e.stopPropagation(),e.preventDefault(),r.toggleHelpPopup(e)}),r.makeTooltip(b,"Help; Keyboard shortcuts. (H)"),w.addEventListener("click",function(e){e.stopPropagation(),e.preventDefault(),1==r.selectedTiers.length&&r.openTierPanel(r.tiers[r.selectedTiers[0]])},!1),x.addEventListener("click",function(e){r.leap(r.reverseKeyScrolling?-1:1,!1)},!1),r.makeTooltip(x,function(e){var t,i=r.getSelectedTier();return i>=0&&(t=r.tiers[i]),t&&t.featureSource&&r.sourceAdapterIsCapable(t.featureSource,"quantLeap")&&"number"==typeof t.quantLeapThreshold?'Jump to the next region with a score above the threshold in the selected track "'+(t.config.name||t.dasSource.name)+'"" (ctrl+LEFT)':t&&t.featureSource&&r.sourceAdapterIsCapable(t.featureSource,"leap")?'Jump to the next feature in the selected track "'+(t.config.name||t.dasSource.name)+'" (ctrl+LEFT)':"Jump left (shift+LEFT)"}),S.addEventListener("click",function(e){r.leap(r.reverseKeyScrolling?1:-1,!1)},!1),r.makeTooltip(S,function(e){var t,i=r.getSelectedTier();return i>=0&&(t=r.tiers[i]),t&&t.featureSource&&r.sourceAdapterIsCapable(t.featureSource,"quantLeap")&&"number"==typeof t.quantLeapThreshold?'Jump to the next region with a score above the threshold in the selected track "'+(t.config.name||t.dasSource.name)+'"" (ctrl+RIGHT)':t&&t.featureSource&&r.sourceAdapterIsCapable(t.featureSource,"leap")?'Jump to the next feature in the selected track "'+(t.config.name||t.dasSource.name)+'" (ctrl+RIGHT)':"Jump right (shift+RIGHT)"}),r.addTierSelectionListener(function(){var e,t=r.getSelectedTier();t>=0&&(e=r.tiers[t]);var i=!1;e&&e.featureSource&&(r.sourceAdapterIsCapable(e.featureSource,"quantLeap")&&"number"==typeof e.quantLeapThreshold?i=!0:r.sourceAdapterIsCapable(e.featureSource,"leap")&&(i=!0)),x.firstChild.className=i?"fa fa-angle-double-left":"fa fa-angle-left",S.firstChild.className=i?"fa fa-angle-double-right":"fa fa-angle-right"}),d.addEventListener("click",function(e){r.clearHighlights()},!1),r.makeTooltip(d,"Clear highlights (C)"),r.addTierSelectionWrapListener(function(e){0>e&&(r.setSelectedTier(null),o.focus())}),r.addTierSelectionListener(function(e){if("tier"===r.uiMode)if(0==e.length)r.hideToolPanel(),r.manipulatingTier=null,r.uiMode="none";else{var t=r.tiers[e[0]];t!=r.manipulatingTier&&r.openTierPanel(t)}});var O=function(e){65==e.keyCode||97==e.keyCode?(e.preventDefault(),e.stopPropagation(),r.showTrackAdder()):72==e.keyCode||104==e.keyCode?(e.stopPropagation(),e.preventDefault(),r.toggleHelpPopup(e)):69==e.keyCode||101==e.keyCode?(e.stopPropagation(),e.preventDefault(),1==r.selectedTiers.length&&r.openTierPanel(r.tiers[r.selectedTiers[0]])):88==e.keyCode||120==e.keyCode?(e.stopPropagation(),e.preventDefault(),r.openExportPanel()):(67==e.keyCode||99==e.keyCode)&&(e.stopPropagation(),e.preventDefault(),r.clearHighlights())};e.addEventListener("focus",function(t){e.addEventListener("keydown",O,!1)},!1),e.addEventListener("blur",function(t){e.removeEventListener("keydown",O,!1)},!1),e.addEventListener("keydown",function(e){27===e.keyCode&&"none"!==r.uiMode&&(e.preventDefault(),e.stopPropagation(),r.setUiMode("none"),r.hideToolPanel(),r.selectedTiers&&r.selectedTiers.length>0&&r.browserHolder.focus())},!1)},s.prototype.showToolPanel=function(e,t){var r=this;this.activeToolPanel&&this.activeToolPanel.parentElement.removeChild(this.activeToolPanel);var i;i=t?e:a("div",e,{},{overflowY:"auto",width:"100%"});var n=a("div",a("i",null,{className:"fa fa-caret-right"}),{className:"tool-divider"});n.addEventListener("click",function(e){r.hideToolPanel(),r.setUiMode("none")},!1),this.makeTooltip(n,"Close tool panel (ESC)"),this.activeToolPanel=a("div",[n,i],{className:"tool-holder"}),this.svgHolder.appendChild(this.activeToolPanel),this.resizeViewer();var r=this},s.prototype.hideToolPanel=function(){this.activeToolPanel&&this.activeToolPanel.parentElement.removeChild(this.activeToolPanel),this.svgHolder.style.width="100%",this.activeToolPanel=null,this.resizeViewer()},s.prototype.toggleHelpPopup=function(e){if("help"===this.uiMode)this.hideToolPanel(),this.setUiMode("none");else{var t=a("iframe",null,{scrolling:"yes",seamless:"seamless",src:this.resolveURL("$$help/index.html"),className:"help-panel"});this.showToolPanel(t,!1),this.setUiMode("help")}},s.prototype.toggleOptsPopup=function(e){var t=this;if("opts"===this.uiMode)this.hideToolPanel(),this.setUiMode("none");else{var r=a("div",null,{className:"form-horizontal"},{boxSizing:"border-box",MozBoxSizing:"border-box",display:"inline-block",verticalAlign:"top"}),i=a("table");i.cellPadding=5;var n=a("input","",{type:"checkbox",checked:t.reverseScrolling});n.addEventListener("change",function(e){t.reverseScrolling=n.checked,t.storeStatus()},!1),i.appendChild(a("tr",[a("td","Reverse trackpad scrolling",{align:"right"}),a("td",n)]));var s=a("input","",{type:"checkbox",checked:t.reverseKeyScrolling});s.addEventListener("change",function(e){t.reverseKeyScrolling=s.checked,t.storeStatus()},!1),i.appendChild(a("tr",[a("td","Reverse scrolling buttons and keys",{align:"right"}),a("td",s)]));var o=a("select");o.appendChild(a("option","Left",{value:"left"})),o.appendChild(a("option","Center",{value:"center"})),o.appendChild(a("option","Right",{value:"right"})),o.appendChild(a("option","None",{value:"none"})),o.value=t.rulerLocation,o.addEventListener("change",function(e){t.rulerLocation=o.value,t.positionRuler();for(var r=0;r=0;--n){var s=e[n];if(!s.notSelectable&&s.min()<=t&&s.max()>=t){if(s.minY&&(rs.maxY()))continue;return s.feature?i.push(s.feature):s.group&&i.push(s.group),s.glyphs?o(s.glyphs,t,r,i):s.glyph?o([s.glyph],t,r,i):i}}return i}function a(e,t){var r=this;this.tagSeed=0,this.callbacks={},this.browser=e,this.worker=t,this.worker.onmessage=function(e){var t=e.data;if(t.cmd)if("resolve"==t.cmd){var i=r.browser.resolvers[t.resolver];i?i(t.url).then(function(e){r.worker.postMessage({tag:t.tag,url:e})})["catch"](function(e){console.log(e),r.worker.postMessage({tag:t.tag,err:e.toString()})}):console.log("No resolver "+t.resolver)}else console.log("Bad worker callback "+t.cmd);else{var n=r.callbacks[t.tag];n&&(n(t.result,t.error),delete r.callbacks[t.tag])}}}function l(e){var t=e.resolveURL(e.workerPath);if(0==t.indexOf("//")){var r=window.location.protocol;t="https:"==r?"https:"+t:"http:"+t}var i='importScripts("'+t+"?version="+_+'");',n=new Blob([i],{type:"application/javascript"});return new A(function(t,r){var i=new Worker(URL.createObjectURL(n));i.onmessage=function(r){"init"===r.data.tag&&(console.log("Worker initialized"),t(new a(e,i)))},i.onerror=function(e){r(e.message)}})}function u(){this.sourcesByURI={}}if("undefined"!=typeof e)var h=e("./utils"),c=h.Observed,f=(h.Awaited,h.makeElement),p=h.removeChildren,d=h.miniJSONify,g=h.shallowCopy,v=h.textXHR,y=e("./tier"),m=y.DasTier,b=e("./sha1"),w=b.hex_sha1,x=e("./thub"),S=x.connectTrackHub,_=e("./version"),T=e("./numformats"),C=T.formatQuantLabel,k=T.formatLongInt,L=e("./chainset").Chainset,A=e("es6-promise").Promise,O=e("./sourcecompare"),E=O.sourcesAreEqual,R=O.sourcesAreEqualModuloStyle,B=O.sourceDataURI,I=(O.sourceStyleURI,e("./default-renderer")),M=e("./multi-renderer"),P=e("./sub-renderer"),H=e("./dummy-renderer");n.prototype.resolveURL=function(e){return e.replace("$$",this.prefix)},n.prototype.destroy=function(){if(window.removeEventListener("resize",this.resizeListener,!1),this.fetchWorkers){var e=!0,t=!1,r=void 0;try{for(var i,n=this.fetchWorkers[Symbol.iterator]();!(e=(i=n.next()).done);e=!0){var s=i.value;s.terminate()}}catch(o){t=!0,r=o}finally{try{!e&&n["return"]&&n["return"]()}finally{if(t)throw r}}}},n.prototype.realInit=function(){var e=this,t=this;if(this.wasInitialized)return void console.log("Attemping to call realInit on an already-initialized Dalliance instance");if(this.wasInitialized=!0,"undefined"!=typeof navigator){var r=navigator.userAgent||"dummy";r.indexOf("Trident")>=0&&r.indexOf("rv:11")>=0&&(this.disablePinning=!0)}this.defaultChr=this.chr,this.defaultStart=this.viewStart,this.defaultEnd=this.viewEnd,this.defaultSources=[];for(var i=0;i0){for(var h=[],c=0;c0)setTimeout(function(){t.realInit2()},1);else var r=setInterval(function(){"none"!=window.getComputedStyle(t.browserHolderHolder).display&&t.tierHolder.getBoundingClientRect().width>0&&(clearInterval(r),t.realInit2())},300)})},n.prototype.realInit2=function(){var e=this,t=this;p(this.tierHolder),p(this.pinnedTierHolder),this.featurePanelWidth=this.tierHolder.getBoundingClientRect().width|t.offscreenInitWidth|0,window.addEventListener("resize",this.resizeListener,!1),this.scale=this.featurePanelWidth/(this.viewEnd-this.viewStart),this.zoomMax||(this.zoomMax=this.zoomExpt*Math.log(this.maxViewWidth/this.zoomBase),this.zoomMin=this.zoomExpt*Math.log(this.featurePanelWidth/this.maxPixelsPerBase/this.zoomBase)),this.zoomSliderValue=this.zoomExpt*Math.log((this.viewEnd-this.viewStart+1)/this.zoomBase),this.tierHolderHolder.addEventListener("mousewheel",function(e){if(e.stopPropagation(),e.preventDefault(),e.wheelDeltaX){var r=e.wheelDeltaX/5;t.reverseScrolling||(r=-r),t.move(r)}if(e.wheelDeltaY){var r=e.wheelDeltaY;t.reverseScrolling&&(r=-r),t.tierHolder.scrollTop+=r}},!1),this.tierHolderHolder.addEventListener("MozMousePixelScroll",function(e){if(e.stopPropagation(),e.preventDefault(),1==e.axis){if(0!=e.detail){var r=e.detail/4;t.reverseScrolling&&(r=-r),t.move(r)}}else{var r=e.detail;t.reverseScrolling||(r=-r),t.tierHolder.scrollTop+=r}},!1),this.tierHolderHolder.addEventListener("touchstart",function(e){return t.touchStartHandler(e)},!1),this.tierHolderHolder.addEventListener("touchmove",function(e){return t.touchMoveHandler(e)},!1),this.tierHolderHolder.addEventListener("touchend",function(e){return t.touchEndHandler(e)},!1),this.tierHolderHolder.addEventListener("touchcancel",function(e){return t.touchCancelHandler(e)},!1);var r=function(e){if(13==e.keyCode){for(var r=!1,i=0;ia)return;var l=t.tiers[a],u=l.forceHeight||l.subtiers[0].height;u>=40&&l.mergeConfig({height:u-10})}else if(e.ctrlKey||e.metaKey){var a=t.getSelectedTier();if(0>a)return;var l=t.tiers[a];if(l.quantLeapThreshold){var h=l.subtiers[0].height,c=l.subtiers[0].quant;if(!c)return;var f=1*c.min,p=1*c.max,d=(p-f)/h;l.mergeConfig({quantLeapThreshold:f+((0|Math.round((l.quantLeapThreshold-f)/d))+1)*d}),l.notify("Threshold: "+C(l.quantLeapThreshold))}}else if(e.altKey){var g=t.selectedTiers.length;if(0==g)return;for(var a=t.selectedTiers[0],v=!0,y=[],m=0;m0&&t.selectedTiers[m]-t.selectedTiers[m-1]!=1&&(v=!1);if(v&&0>=a)return;for(var m=t.selectedTiers.length-1;m>=0;--m)t.tiers.splice(t.selectedTiers[m],1);t.selectedTiers.splice(0,g);for(var b=v?a-1:a,m=0;m0){t.setSelectedTier(a-1);var w=t.tiers[t.getSelectedTier()],x=w.row.offsetTop,S=x+w.row.offsetHeight;(xt.tierHolder.scrollTop+t.tierHolder.offsetHeight)&&(t.tierHolder.scrollTop=x)}else t.notifyTierSelectionWrap(-1)}else if(40==e.keyCode||83==e.keyCode)if(e.stopPropagation(),e.preventDefault(),e.shiftKey){var a=t.getSelectedTier();if(0>a)return;var l=t.tiers[a],u=l.forceHeight||l.subtiers[0].height;l.mergeConfig({height:u+10})}else if(e.ctrlKey||e.metaKey){var a=t.getSelectedTier();if(0>a)return;var l=t.tiers[a];if(l.quantLeapThreshold){var h=l.subtiers[0].height,c=l.subtiers[0].quant;if(!c)return;var f=1*c.min,p=1*c.max,d=(p-f)/h,_=0|Math.round((l.quantLeapThreshold-f)/d);_>1&&(l.mergeConfig({quantLeapThreshold:f+(_-1)*d}),l.notify("Threshold: "+C(l.quantLeapThreshold)))}}else if(e.altKey){var g=t.selectedTiers.length;if(0==g)return;for(var a=t.selectedTiers[0],T=0,y=[],m=0;m0&&(T+=t.selectedTiers[m]-t.selectedTiers[m-1]-1);var v=0==T;if(v&&a+g>=t.tiers.length)return;for(var m=t.selectedTiers.length-1;m>=0;--m)t.tiers.splice(t.selectedTiers[m],1);t.selectedTiers.splice(0,g);for(var b=v?a+1:a+T,m=0;mt.tierHolder.scrollTop+t.tierHolder.offsetHeight)&&(t.tierHolder.scrollTop=Math.min(x,S-t.tierHolder.offsetHeight))}}else if(187==e.keyCode||61==e.keyCode)e.stopPropagation(),e.preventDefault(),t.zoomStep(-10);else if(189==e.keyCode||173==e.keyCode)e.stopPropagation(),e.preventDefault(),t.zoomStep(10);else if(73==e.keyCode||105==e.keyCode){e.stopPropagation(),e.preventDefault();var a=t.getSelectedTier();if(0>a)return;var n=t.tiers[a];n.infoVisible?(n.infoElement.style.display="none",n.updateHeight(),n.infoVisible=!1):(n.infoElement.style.display="block",n.updateHeight(),n.infoVisible=!0)}else if(84==e.keyCode||116==e.keyCode){var k;if(e.shiftKey){e.stopPropagation(),e.preventDefault();for(var i=0;ia)return;var n=t.tiers[a];n.dasSource.collapseSuperGroups&&(void 0===k&&(k=!n.bumped),n.mergeConfig({bumped:k}))}}else if(77==e.keyCode||109==e.keyCode)e.stopPropagation(),e.preventDefault(),(e.ctrlKey||e.metaKey)&&t.selectedTiers.length>1&&t.mergeSelectedTiers();else if(68==e.keyCode||100==e.keyCode){if(e.stopPropagation(),e.preventDefault(),e.ctrlKey||e.metaKey){var a=t.getSelectedTier();if(0>a)return;t.addTier(t.tiers[a].dasSource)}}else if((80==e.keyCode||112==e.keyCode)&&(e.ctrlKey||e.metaKey)){for(var l=[],a=0;ai[s].height&&s=i.length)){var a=i[s].glyphs,l=((r.viewStart+r.viewEnd)/2,(n.glyphCacheOrigin-r.viewStart)*r.scale);return e-=l,o(a,e,t)}}},c=function(e){e.preventDefault(),e.stopPropagation();var t=e.clientX;t!=a&&(r.move(t-a,!0),a=t),r.isDragging=!0},f=function _(e){window.removeEventListener("mousemove",c,!0),window.removeEventListener("mouseup",_,!0),r.move(e.clientX-a)};n.viewport.addEventListener("mousedown",function(e){r.browserHolder.focus(),e.preventDefault();var t=(n.row.getBoundingClientRect(),e.clientX);e.clientY;window.addEventListener("mousemove",c,!0),window.addEventListener("mouseup",f,!0),s=a=t,r.isDragging=!1},!1),n.viewport.addEventListener("mousemove",function(e){var t=n.row.getBoundingClientRect(),i=e.clientX-t.left,s=e.clientY-t.top,o=h(i,s);o&&o.length>0?n.row.style.cursor="pointer":n.row.style.cursor="default",l&&clearTimeout(l),u||(l=setTimeout(function(){var t=h(i,s);t&&t.length>0&&r.notifyFeatureHover(e,t[t.length-1],t,n)},1e3))});var p=null;n.viewport.addEventListener("mouseup",function(e){var t=n.row.getBoundingClientRect(),i=e.clientX-t.left,o=e.clientY-t.top,a=h(i,o);if(a&&a.length>0&&!r.isDragging&&(p?(clearTimeout(p),p=null,r.featureDoubleClick(a,i,o)):p=setTimeout(function(){p=null,r.notifyFeature(e,a[a.length-1],a,n)},500)),r.isDragging&&i!=s&&n.sequenceSource){var l,u,c=r.viewStart+i/r.scale,f=r.viewStart+s/r.scale;f>c?(l=0|c,u=0|f):(l=0|f,u=0|c),r.notifyRegionSelect(r.chr,l,u)}r.isDragging=!1},!1),n.viewport.addEventListener("mouseout",function(e){u=!1}),n.removeButton.addEventListener("click",function(e){e.stopPropagation(),e.preventDefault();for(var t=0;t=0){var s=r.selectedTiers.indexOf(t);s>=0?r.selectedTiers.splice(s,1):(r.selectedTiers.push(t),r.selectedTiers.sort()),r.markSelectedTiers(),r.notifyTierSelection(),r.selectedTiers.length>0?r.browserHolder.focus():r.notifyTierSelectionWrap(-1)}}else{for(var i=0;io){if(y>i&&e.clientYy&&e.clientY>b){r.withPreservedSelection(function(){r.tiers.splice(y,1),r.tiers.splice(i,0,n),r._ensureTiersGrouped(i>y)});for(var u=0;ug.scrollTop+g.offsetHeight&&(g.scrollTop=Math.min(g.scrollTop+(d.offsetTop+d.offsetHeight)-(g.scrollTop+g.offsetHeight),v))},S=function T(e){var t=n.label;if(e.stopPropagation(),e.preventDefault(),d&&(d.style.cursor="auto",g.removeChild(d),d=null,t.style.visibility="visible"),document.removeEventListener("mousemove",x,!1),document.removeEventListener("mouseup",T,!1),w){for(var i=0;i=0&&this.selectedTiers.push(i)},n.prototype.refreshTier=function(e,t){var r=this.getTierRenderer(e);if("multi"===e.dasSource.renderer)r.drawTier(e);else{var i=t||r.renderTier;this.knownSpace&&this.knownSpace.invalidate(e,i)}},n.prototype.getTierRenderer=function(e){var t=e.dasSource.renderer||this.defaultRenderer;return"string"==typeof t?this.renderers[t]:"function"==typeof t.renderTier&&"function"==typeof t.drawTier?t:void console.log("Tier doesn't have a renderer")},n.prototype._ensureTiersGrouped=function(e){for(var t={},r=0;r0?0|this.currentSeqMax:1e9),h=Math.max(1,(0|this.viewStart)-r),c=Math.min((0|this.viewEnd)+r,(0|this.currentSeqMax)>0?0|this.currentSeqMax:1e9);if(!this.knownSpace||this.knownSpace.chr!==this.chr){var f=this.getSequenceSource();this.knownSpace&&this.knownSpace.cancel(),this.knownSpace=new q(this.tiers,this.chr,h,c,a,f)}var p=this.knownSpace.bestCacheOverlapping(this.chr,l,u);p&&p.min<=l&&p.max>=u?(this.drawnStart=Math.max(p.min,h),this.drawnEnd=Math.min(p.max,c)):(this.drawnStart=h,this.drawnEnd=c),this.knownSpace.retrieveFeatures(e,this.chr,this.drawnStart,this.drawnEnd,a)},n.prototype.queryRegistry=function(e,t){if(this.registry){var r,i,n=this;e?(r=this.chains[e].coords,n.mappableSources[e]||(n.mappableSources[e]=new c),i=n.mappableSources[e]):(r=this.coordSystem,i=this.availableSources);var o=w(d(r));if(t){var a=localStorage["dalliance.registry."+o+".last_queried"];if(a)try{s(i,JSON.parse(localStorage["dalliance.registry."+o+".sources"]),e);var l=(0|Date.now())-(0|a);if(432e5>l)return}catch(u){console.log("Bad registry cache: "+u)}}var h=this.registry;if(0==h.indexOf("//")){var f=window.location.protocol;"https:"!=f&&"http:"!=f&&(h="http:"+h)}new U(h).sources(function(t){for(var n=[],a=0;a0&&n>this.currentSeqMax&&(n=this.currentSeqMax,i=this.viewEnd-r),1>i&&(i=1,n=i+r)),this.setLocation(null,i,n,null,t)},n.prototype.zoomStep=function(e){var t=1*this.zoomSliderValue,r=t+e;rthis.zoomMax&&(r=this.zoomMax),r!=t&&(this.zoomSliderValue=r,this.zoom(Math.exp(1*r/this.zoomExpt)))},n.prototype.zoom=function(e){this.zoomFactor=e;var t=0|Math.round((this.viewStart+this.viewEnd)/2);if(this.viewStart=t-this.zoomBase*this.zoomFactor/2,this.viewEnd=t+this.zoomBase*this.zoomFactor/2,this.currentSeqMax>0&&this.viewEnd>this.currentSeqMax+5){var r=this.viewEnd-this.viewStart+1;this.viewEnd=this.currentSeqMax,this.viewStart=this.viewEnd-r+1}if(this.viewStart<1){var r=this.viewEnd-this.viewStart+1;this.viewStart=1,this.viewEnd=this.viewStart+r-1}this.scale=this.featurePanelWidth/(this.viewEnd-this.viewStart);this.viewEnd-this.viewStart+1,this.scale/this.scaleAtLastRedraw;this.notifyLocation(),this.refresh()},n.prototype.spaceCheck=function(e){if(!this.knownSpace||this.knownSpace.chr!==this.chr)return void this.refresh();var t=((this.viewEnd-this.viewStart|0)+1,this.minExtraWidth/this.scale|0);this.maxExtraWidth/this.scale|0;((0|this.drawnStart)>Math.max(1,(0|this.viewStart)-t|0)||(0|this.drawnEnd)0?0|this.currentSeqMax:1e9))&&this.refresh()},n.prototype.resizeViewer=function(e){var t=0|this.tierHolder.getBoundingClientRect().width;if(0!=t){var r=Math.max(this.featurePanelWidth,300);if(this.featurePanelWidth=0|t,r!=this.featurePanelWidth){this.zoomMax=this.zoomExpt*Math.log(this.maxViewWidth/this.zoomBase),this.zoomMin=this.zoomExpt*Math.log(this.featurePanelWidth/this.maxPixelsPerBase/this.zoomBase),this.zoomSliderValue=this.zoomExpt*Math.log((this.viewEnd-this.viewStart+1)/this.zoomBase);var i=this.viewEnd-this.viewStart,n=this.viewStart+i*this.featurePanelWidth/r;this.viewEnd=n;var s=this.viewEnd-this.viewStart+1;this.currentSeqMax>0&&this.viewEnd>this.currentSeqMax&&(this.viewEnd=this.currentSeqMax,this.viewStart=this.viewEnd-s+1),this.viewStart<1&&(this.viewStart=1,this.viewEnd=this.viewStart+s-1),this.positionRuler(),e||this.spaceCheck(),this.notifyLocation()}this.fullScreen&&this.setFullScreenHeight()}},n.prototype.setFullScreenHeight=function(){var e=document.body.offsetHeight-this.browserHolder.offsetHeight;this.browserHolder.style.maxHeight=Math.max(300,window.innerHeight-e-20)+"px"},n.prototype.addTier=function(e){var t=this;return e=g(e),e.disabled=!1,this.makeTier(e).then(function(e){return t.refreshTier(e),t.markSelectedTiers(),t.positionRuler(),t.notifyTier("added",e),e})},n.prototype.removeTier=function(e,t){var r=-1;if("undefined"!=typeof e.index&&e.index>=0&&e.indexr)throw"Couldn't find requested tier";var s=this.tiers[r];this.tiers.splice(r,1);for(var o=[],a=0;al?o.push(l):l>r&&o.push(l-1)}this.selectedTiers=o,this.markSelectedTiers(),s.destroy(),this.knownSpace&&(this.knownSpace.featureCache[s]=null),this.reorderTiers(),this.notifyTier("removed",s)},n.prototype.removeAllTiers=function(){var e=this;this.selectedTiers=[],this.markSelectedTiers(),this.tiers.forEach(function(t){t.destroy(),e.knownSpace&&(e.knownSpace.featureCache[t]=null)}),this.tiers.length=0,this.reorderTiers(),this.notifyTier("removedAll",null)},n.prototype.getSequenceSource=function(){return void 0===this._sequenceSource&&(this._sequenceSource=this._getSequenceSource()),this._sequenceSource},n.prototype._getSequenceSource=function(){for(var e=0;er){var s=t;t=r,r=s}else t===r&&(r+=1);i||(i=function(e){if(e)throw e});var o=this;if((!e||e==this.chr)&&this.currentSeqMax>0)return this._setLocation(null,t,r,null,i,n);var a=this.getSequenceSource();if(!a)return i("Need a sequence source");var l=e||this.chr;a.getSeqInfo(l,function(s){if(s)return o._setLocation(e,t,r,s,i,n);var u;u=0==l.indexOf("chr")?l.substr(3):"chr"+l,a.getSeqInfo(u,function(s){return!s&&e?i("Couldn't find sequence '"+e+"'"):s?o._setLocation(u,t,r,s,i,n):o._setLocation(null,t,r,null,i,n)})})},n.prototype._setLocation=function(e,t,r,i,n,s){var o=!1;e&&(0==e.indexOf("chr")&&(e=e.substring(3)),this.chr!=e&&(o=!0),this.chr=e,this.currentSeqMax=i.length),t=parseFloat(t),r=parseFloat(r);var a=Math.max(10,r-t+1);if(!s){var l=this.currentSeqMax;0>=l&&(l=1e12),1>t&&(t=1,r=t+a-1),r>l&&(r=l,t=Math.max(1,r-a+1))}this.viewStart=t,this.viewEnd=r;var u=Math.max(this.featurePanelWidth||this.offscreenInitWidth,50)/(this.viewEnd-this.viewStart),h=this.scale,c=Math.abs(u-h)>1e-6;this.scale=u;var f,p;if(p=this.zoomSliderValue,this.zoomSliderValue=f=this.zoomExpt*Math.log((this.viewEnd-this.viewStart+1)/this.zoomBase),c||o){for(var d=0;dMath.abs(v)&&(this.isSnapZooming=!this.isSnapZooming,this.savedZoom=p)}else this.isSnapZooming=!1,this.savedZoom=null}else for(var d=((this.viewStart+this.viewEnd)/2,0);d=0&&this.featureListeners.splice(r,1)},n.prototype.notifyFeature=function(e,t,r,i){for(var n=0;n=0&&this.featureHoverListeners.splice(r,1)},n.prototype.notifyFeatureHover=function(e,t,r,i){for(var n=0;n=0&&this.viewListeners.splice(r,1)},n.prototype.notifyLocation=function(){var e=Math.max(1,0|this.viewStart),t=0|this.viewEnd;this.currentSeqMax>0&&t>this.currentSeqMax&&(t=this.currentSeqMax);for(var r=0;r=0&&this.tierListeners.splice(t,1)},n.prototype.notifyTier=function(e,t){for(var r=0;r=0&&this.regionSelectListeners.splice(t,1)},n.prototype.notifyRegionSelect=function(e,t,r){for(var i=0;it&&r>o&&this.drawOverlays(),this.notifyLocation()},n.prototype.clearHighlights=function(){this.highlights=[],this.drawOverlays(),this.notifyLocation()},n.prototype.drawOverlays=function(){for(var e=0;e=t&&i.push(a)}return i},n.prototype.getSelectedTier=function(){return this.selectedTiers.length>0?this.selectedTiers[0]:-1},n.prototype.setSelectedTier=function(e){null==e?this.selectedTiers=[]:this.selectedTiers=[e],this.markSelectedTiers(),this.notifyTierSelection()},n.prototype.markSelectedTiers=function(){for(var e=0;e=0?t.classList.add("active"):t.classList.remove("active")}if(this.selectedTiers.length>0){var r=this.browserHolder.offsetTop+this.browserHolder.offsetHeight/2;r>document.body.scrollTop&&r+100=0&&this.tierSelectionListeners.splice(t,1)},n.prototype.notifyTierSelection=function(){for(var e=0;e=0&&this.tierSelectionWrapListeners.splice(t,1)},n.prototype.notifyTierSelectionWrap=function(e){for(var t=0;t0&&(s=o.subtiers[0].quant),a&&(a.style.display=s?e:"none",a.style.left=t,a.style.right=r)}},n.prototype.featureDoubleClick=function(e,t,r){if(e&&0!=e.length){var i=e[e.length-1];if(i.min&&i.max){var n=((0|i.min)-(0|this.viewStart))*this.scale,s=(i.max-i.min+1)*this.scale,o=((0|i.min)+(0|i.max))/2;if(s>10){var a=1*(t-n)/s;.3>a?o=0|i.min:a>.7&&(o=(0|i.max)+1)}var l=this.viewEnd-this.viewStart;this.setLocation(null,o-l/2,o+l/2)}}},n.prototype.zoomForScale=function(e){var t;return t=e>this.highZoomThreshold?"high":e>this.mediumZoomThreshold?"medium":"low"},n.prototype.zoomForCurrentScale=function(){return this.zoomForScale(this.scale)},n.prototype.updateHeight=function(){for(var e=0,t=0;t1){var i=(this.viewStart+this.viewEnd)/2,n=i-Math.round(i),s=1;e.shiftKey&&(s*=10),t>0?(s=-s,s-=n,n>0&&(s+=1)):(s-=n,0>n&&(s-=1)),this.setLocation(null,this.viewStart+s,this.viewEnd+s)}else this.move(e.shiftKey?100*t:25*t)},n.prototype.leap=function(e,t){var r=this,i=(r.viewStart+r.viewEnd+1)/2|0;e>0&&r.viewStart<=1?i-=1e8:0>e&&r.viewEnd>=r.currentSeqMax&&(i+=1e8);var n=r.getSelectedTier();if(!(0>n)){var s=r.tiers[n];s&&(s.featureSource&&this.sourceAdapterIsCapable(s.featureSource,"quantLeap")&&"number"==typeof s.quantLeapThreshold||s.featureSource&&this.sourceAdapterIsCapable(s.featureSource,"leap"))?s.findNextFeature(r.chr,i,-e,t,function(n){if(n){var s=n.min,o=n.max;t&&(e>0?s>i+1?o=s:(o++,s=o):i-1>o?(o++,s=o):o=s);var a=r.viewEnd-r.viewStart+1;parseFloat(a/2)==parseInt(a/2)&&a--;var l=(s+o-a)/2+1,u=l+a-1;r.setLocation(n.segment,l,u)}else alert("no next feature")}):this.move(100*e)}},n.prototype.nameForCoordSystem=function(e){var t=null,r=null;return this.assemblyNamePrimary&&(t=""+e.auth,"undefined"!=typeof e.version&&(t+=e.version)),this.assemblyNameUcsc&&(r=e.ucscName),null!=t&&null!=r?t+"/"+r:t||r||"unknown"},n.prototype.makeLoader=function(e){e=e||16;var t=window.devicePixelRatio>1;return 20>e?f("img",null,{src:this.resolveURL("$$img/spinner_"+(t?16:32)+".gif"),width:"16",height:"16"}):f("img",null,{src:this.resolveURL("$$img/spinner_"+(t?24:48)+".gif"),width:"24",height:"24"})},n.prototype.canFetchPlainHTTP=function(){var e=this;if(!this._plainHTTPPromise){var t=this.getWorker();t?this._plainHTTPPromise=new A(function(r,i){t.postCommand({command:"textxhr",uri:e.httpCanaryURL},function(e,t){r(e?!0:!1)})}):this._plainHTTPPromise=new A(function(t,r){v(e.httpCanaryURL,function(e,r){t(e?!0:!1)},{timeout:2e3})})}return this._plainHTTPPromise},n.prototype.getWorker=function(){return this.useFetchWorkers&&this.fetchWorkers&&0!=this.fetchWorkers.length?(this.nextWorker>=this.fetchWorkers.length&&(this.nextWorker=0),this.fetchWorkers[this.nextWorker++]):null},n.prototype.registerResolver=function(e){var t="res"+ ++this.resolverSeed;return this.resolvers[t]=e,t},a.prototype.postCommand=function(e,t,r){var i="x"+ ++this.tagSeed;e.tag=i,this.callbacks[i]=t,this.worker.postMessage(e,r)},a.prototype.terminate=function(){this.worker.terminate()},"undefined"!=typeof t){t.exports={Browser:n},e("./browser-ui"),e("./track-adder"),e("./feature-popup"),e("./tier-actions"),e("./domui"),e("./search");var F=e("./sourceadapters"),N=F.TwoBitSequenceSource,G=F.EnsemblSequenceSource,D=F.DASSequenceSource,q=e("./kspace").KnownSpace,U=e("./das").DASRegistry}u.prototype.get=function(e){var t=this.sourcesByURI[B(e)];if(t)for(var r=0;r=n.srcMin&&t<=n.srcMax){var s;s="-"==n.srcOri?n.srcMax-t:t-n.srcMin;for(var o=n.blocks,a=0;a=u&&u+c>=s){var f,p=s-u;return f="-"==n.destOri?n.destMax-h-p:p+h+n.destMin,{seq:n.destChr,pos:f,flipped:n.srcOri!=n.destOri}}}}}return null},i.prototype.mapSegment=function(e,t,r){for(var i=this.chainsBySrc[e]||[],n=[],s=0;s=o.srcMin&&t<=o.srcMax){var a,l;"-"==o.srcOri?(a=o.srcMax-r,l=o.srcMax-t):(a=t-o.srcMin,l=r-o.srcMin);for(var u=o.blocks,h=0;h=f&&f+d>=a){var g={segment:o.destChr,flipped:"-"==o.srcOri^"-"==o.destOri};"-"==o.destOri?(a>=f?g.max=o.destMax-p-a+f:(g.max=o.destMax-p,g.partialMax=f-a),f+d>=l?g.min=o.destMax-p-l+f:(g.min=o.destMax-p-d,g.partialMin=l-f-d)):(a>=f?g.min=o.destMin+p+a-f:(g.min=o.destMin+p,g.partialMin=f-a),f+d>=l?g.max=o.destMin+p+l-f:(g.max=o.destMin+p+d,g.partialMax=l-f-d)),n.push(g)}}}}return n},i.prototype.unmapPoint=function(e,t){for(var r=this.chainsByDest[e]||[],i=0;i=n.destMin&&t<=n.destMax){var s;s="-"==n.srcOri?n.destMax-t:t-n.destMin;for(var o=n.blocks,a=0;a=h&&h+c>=s){var f,p=s-h,f=p+u+n.srcMin;return f="-"==n.destOri?n.srcMax-u-p:p+u+n.srcMin,{seq:n.srcChr,pos:f,flipped:n.srcOri!=n.destOri}}}}}return null},i.prototype.sourceBlocksForRange=function(e,t,r,i){for(var n=1,s=2,o=this,a=t/this.granularity|0,l=r/this.granularity|0,u=!1,h=!1,c=a;l>=c;++c){var p=e+"_"+c;this.fetchedTiles[p]!=s&&(u=!0,this.fetchedTiles[p]!=n&&(this.fetchedTiles[p]=n,h=!0))}if(u)this.postFetchQueues[e]||this.chainFetcher.fetchChains(e,a*this.granularity,(l+1)*this.granularity-1).then(function(t){o.chainsByDest||(o.chainsByDest[e]=[]);for(var r=0;r=p;++p){var d=e+"_"+p;o.fetchedTiles[d]=s}if(o.postFetchQueues[e]){for(var g=o.postFetchQueues[e],v=0;v=m.destMin){var b,w;"-"==m.srcOri?(b=m.destMax-r,w=m.destMax-t):(b=t-m.destMin,w=r-m.destMin);for(var x=m.blocks,S=0;S=C&&C+k>=b){var L=Math.max(b,C)-C,A=Math.min(w,C+k)-C;"-"==m.destOri?g.push(new f(m.srcChr,m.srcMax-T-A,m.srcMax-T-L)):g.push(new f(m.srcChr,m.srcMin+L+T,m.srcMin+A+T))}}}}i(g)}},n.prototype.fetchChains=function(e,t,r){var i=this;return new x(function(t,r){i.source.alignments(e,{},function(e){for(var r=[],n=0;nl;++l){for(var u=1*l/(e-1),h=t[0]+(t[t.length-1]-t[0])*u,c=0;c=t[c]&&h<=t[c+1]){var f=(h-t[c])/(t[c+1]-t[c]),p=n[c],d=n[c+1],g=new i(p.red*(1-f)+d.red*f|0,p.green*(1-f)+d.green*f|0,p.blue*(1-f)+d.blue*f|0).toSvgString();a.push(g);continue e}throw"Bad step"}return a}function a(e,t,r,i){return i?o(e,[0,.5,1],[t,r,i]):o(e,[0,1],[t,r])}i.prototype.toSvgString=function(){return this.name||(this.name="rgb("+this.red+","+this.green+","+this.blue+")"),this.name},i.prototype.toHexString=function(){return"#"+n(this.red)+n(this.green)+n(this.blue)};var l={red:new i(255,0,0,"red"),green:new i(0,255,0,"green"),blue:new i(0,0,255,"blue"),yellow:new i(255,255,0,"yellow"),white:new i(255,255,255,"white"),black:new i(0,0,0,"black"),gray:new i(180,180,180,"gray"),grey:new i(180,180,180,"grey"),lightskyblue:new i(135,206,250,"lightskyblue"),lightsalmon:new i(255,160,122,"lightsalmon"),hotpink:new i(255,105,180,"hotpink")},u=new RegExp("^#([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})$"),h=/rgb\(([0-9]+),([0-9]+),([0-9]+)\)/;"undefined"!=typeof t&&(t.exports={makeColourSteps:o,makeGradient:a,dasColourForName:s})},{}],10:[function(e,t,r){"use strict";function i(e,t,r,i){this.name=e,this.start=t,this.end=r,this.description=i}function n(e,t){var r;"string"==typeof e?(this.uri=e,r=t||{}):r=e||{};for(var i in r)this[i]=r[i];this.coords||(this.coords=[]),this.props||(this.props={}),this.dasBaseURI=this.uri,this.dasBaseURI&&"/"!=this.dasBaseURI.substr(this.uri.length-1)&&(this.dasBaseURI=this.dasBaseURI+"/")}function s(){}function o(e,t){return e.taxon==t.taxon&&e.auth==t.auth&&e.version==t.version}function a(e,t,r,i,n){this.name=e,this.start=t,this.end=r,this.alphabet=i,this.seq=n}function l(){}function u(e){e&&(this.id=e)}function h(e,t){this.desc=e,this.uri=t}function c(e){this.type=e,this.objects={},this.blocks=[]}function f(){this.styles=[]}function p(){}function d(e){var t=e.getAttribute("steps");t=t?0|t:50;for(var r=[],i=[],n=e.getElementsByTagName("STOP"),s=0;s0&&r[0].firstChild){var i=r[0];if(1==i.childNodes.length)return i.firstChild.nodeValue;for(var n="",s=0;s=200||0==n.status)&&t(n.responseXML,n))},n.open("get",e,!0),n.timeout=5e3,r&&(n.withCredentials=!0),i&&n.setRequestHeader("X-DAS-Authorisation",i),n.overrideMimeType("text/xml"),n.setRequestHeader("Accept","application/xml,*/*"),n.send()}catch(o){t(null,n,o)}}function x(e){return e=(""+e).toLowerCase(),"yes"===e||"true"===e}function S(e){return e?(e=(""+e).toLowerCase(),"no"!==e||"false"!==e):!1}function _(e){var t=C(e);t.styles=[];for(var r=0;r=0)){c+=f.substring(p).toUpperCase();break}c+=f.substring(p,d).toUpperCase(),p=d+1}}r.push(new a(o,l,u,h,c))}t(r)})},n.prototype.features=function(e,t,r){t=t||{};var i;if(this.features_uri)i=this.features_uri;else{var n=[];if(e)n.push(e.toDASQuery());else if(t.group){var s=t.group;if("string"==typeof s)n.push("group_id="+s);else for(var o=0;o(0|w)?(g.min=0|w,g.max=0|y):(g.min=0|y,g.max=0|w);var x=d.getElementsByTagName("TYPE");if(x.length>0){var S=x[0];S.firstChild&&(g.type=S.firstChild.nodeValue),g.typeId=S.getAttribute("id"),g.typeCv=S.getAttribute("cvId")}g.type=v(d,"TYPE"),!g.type&&g.typeId&&(g.type=g.typeId),g.method=v(d,"METHOD");var _=v(d,"ORIENTATION");_||(_="0"),g.orientation=_,g.score=v(d,"SCORE"),g.links=m(d),g.notes=b(d);for(var T=d.getElementsByTagName("GROUP"),C=0;C0){for(var B=[],I=0;I0){for(var M=[],I=0;I0&&(o=o+"?"+i.join("&")),w(o,function(r){if(!r&&t)return void t();for(var i=[],o=r.getElementsByTagName("SOURCE"),a=0;a1;if(e.sequenceSource){var i=e.currentSequence;(0,O.drawSeqTier)(e,i)}else e.currentFeatures?c(e,t):console.log("No sequence or features in tier!");if(e.subtiers){var n=G.defaultTo(0,e.dasSource.vOffset);d(e,t,r,!0,n),g(e,t,n),t.restore()}e.drawOverlay(),e.paintQuant(),"function"==typeof e.dasSource.drawCallback&&e.dasSource.drawCallback(t,e),e.originHaxx=0,e.browser.arrangeTiers()}function o(e,t,r,i,n){var s=n.styleForFeature(i),o=void 0,l=!1,u=[],h=null;if(t.forEach(function(t){t.orientation&&null===h&&(h=t.orientation),!o&&t.label&&(o=t.label);var i=n.styleForFeature(t);if(i&&!t.parts){(0,M.isDasBooleanTrue)(i.LABEL)&&(l=!0);var s=a(e,t,r,i,n,null,!0);s&&u.push(s)}}),0===u.length)return null;var c="flat";s&&"LINE"===s.glyph||(n.dasSource.collapseSuperGroups&&!n.bumped?("+"===h||"-"===h)&&(c="collapsed"+h):("+"===h||"-"===h)&&(c="hat"+h));var f=null;(o&&l||s&&((0,M.isDasBooleanTrue)(s.LABEL)||(0,M.isDasBooleanTrue)(s.LABELS)))&&(f=i.label||o),u.sort(function(e,t){return(e.zindex||0)-(t.zindex||0)});var p=new I.GroupGlyph(u,c);return f&&("+"===h?f=">"+f:"-"===h&&(f="<"+f),p=new I.LabelledGlyph(e,p,f,!1)),p.bump=!0,p}function a(e,t,r,i,n,s,o){var a=n.browser.scale,l=n.browser.viewStart,u=i.glyph||"BOX",h=t.min,c=t.max,f=t.orientation,p=t.score,d=t.label||t.id;if(n.dasSource.hideSubpixelGlyphs&&1>(c-h)*a)return null;var g=(h-l)*a,v=(c-l+1)*a,y=Math.max(v,g+1);s=1*s;var _=1*(n.forceHeight||i.HEIGHT||s||12);_=1*_;var T=i.BUMP&&(0,M.isDasBooleanTrue)(i.BUMP),C=void 0,k=void 0;if("CROSS"===u||"EX"===u||"TRIANGLE"===u||"DOT"===u||"SQUARE"===u||"STAR"===u||"PLIMSOLL"===u){var A=b(e,n,t,r,u,i,s,o);if(A){var O=L(A,2);C=O[0],k=O[1]}}else if("HISTOGRAM"===u||"GRADIENT"===u&&"undefined"!==p){var E=w(e,n,t,r,u,i,s),R=L(E,2);C=R[0],k=R[1]}else if("HIDDEN"===u)C=new I.PaddedGlyph(null,g,y),o=!0;else if("ARROW"===u){var B=i.FGCOLOR||"purple",P=(0,M.isDasBooleanTrue)(i.PARALLEL),H=(0,M.isDasBooleanTrue)(i.SOUTHWEST),F=(0,M.isDasBooleanTrue)(i.NORTHEAST);C=new I.ArrowGlyph(g,y,_,B,P,H,F)}else if("ANCHORED_ARROW"===u){var N=i.FGCOLOR||"none",G=i.BGCOLOR||"green";C=new I.AArrowGlyph(g,y,_,G,N,f),C.bump=!0}else if("SPAN"===u){var D=i.FGCOLOR||"black";C=new I.SpanGlyph(g,y,_,D)}else if("LINE"===u){var q=i.FGCOLOR||"black",U=i.STYLE||"solid";C=new I.LineGlyph(g,y,_,U,f,q)}else if("PRIMERS"===u){var z=i.FGCOLOR||"black",j=i.BGCOLOR||"red";C=new I.PrimersGlyph(g,y,_,j,z)}else if("TEXT"===u){var W=i.STRING||"text",V=i.FGCOLOR||"black";C=new I.TextGlyph(e,g,y,_,V,W)}else if("TOOMANY"===u){var X=i.FGCOLOR||"gray",K=i.BGCOLOR||"orange";C=new I.TooManyGlyph(g,y,_,K,X)}else if("POINT"===u){var Z=x(n,t,i),Q=L(Z,2);C=Q[0],k=Q[1]}else if("__SEQUENCE"===u)C=S(e,n,t,i,s);else if("__INSERTION"===u){var Y=!0;if(void 0!==i.__INSERTIONS&&(Y=(0,M.isDasBooleanNotFalse)(i.__INSERTIONS)),C=new I.TriangleGlyph(g,5,"S",5,n.browser.baseColors.I),Y&&(C=new I.LabelledGlyph(e,C,t.insertion||t.altAlleles[0],!1,"center","above","7px sans-serif")),y-g>1){var $=i.FGCOLOR||"red",J=i.BGCOLOR||i.COLOR1||"green",ee=new I.BoxGlyph(g,5,y-g,_,J,$);C=new I.GroupGlyph([ee,C])}}else{if("__NONE"===u)return null;if("BOX"===u){var te=i.FGCOLOR||null,re=i.BGCOLOR||i.COLOR1||"green";i.BGITEM&&t.itemRgb&&(re=t.itemRgb);var ie=(y-g)/(c-h);if("translation"==t.type&&("protein_coding"==t.method||t.readframeExplicit)&&(!t.tags||t.tags.indexOf("cds_start_NF")<0||t.readframeExplicit)&&(!n.dasSource.collapseSuperGroups||n.bumped)&&ie>=.5){var ne=m(n,h,c);C=new I.AminoAcidGlyph(g,y,_,re,ne,t.orientation,t.readframe)}else C=new I.BoxGlyph(g,0,y-g,_,re,te)}}return C?(((0,M.isDasBooleanTrue)(i.LABEL)||t.forceLabel)&&d&&!o&&(C=new I.LabelledGlyph(e,C,d,!1)),T&&(C.bump=!0),C.feature=t,(0,M.isDasBooleanTrue)(i.HIDEAXISLABEL)&&(k=null),k&&(C.quant=k),i.ZINDEX&&(C.zindex=0|i.ZINDEX),C):void 0}function l(e,t,r){var i=[],n={},s={},o=[];G.map(function(l){l.forEach(function(l){var u=e.styleForFeature(l);if(!l.parts&&u)if("LINEPLOT"===u.glyph)(0,R.pusho)(n,u.id,l),s[u.id]=u;else if("STACKED"===u.glyph)o.push(l);else{var h=a(t,l,r,u,e);h&&i.push(h)}})},e.ungroupedFeatures),o.length>0&&(i=i.concat(T(o,e)));for(var l in n){var u=n[l],h=s[l];if("LINEPLOT"===h.glyph){var c=_(u,h,e,r);c.forEach(function(e){return i.push(e)})}}return i}function u(e,t,r,i){var n=Object.keys(e.groupedFeatures),s={};return n.sort(function(t,r){return e.groupedFeatures[r][0].score-e.groupedFeatures[t][0].score}),n.forEach(function(r){var n=o(t,e.groupedFeatures[r],i,e.groups[r],e,e.dasSource.collapseSuperGroups&&!e.bumped?"collapsed_gene":"tent");n&&(n.group=e.groups[r],s[r]=n)}),s}function h(e,t,r,i,n){var s=e.subtierMax||e.dasSource.subtierMax||e.browser.defaultSubtierMax,o=!1,a=new A.SubTier,l=[];return t.forEach(function(t){if(t.bump&&(e.bumped||e.dasSource.collapseSuperGroups)){var r=l.find(function(e){return e.hasSpaceFor(t)});if(r)r.add(t);else if(l.length>=s)o=!0;else{var i=new A.SubTier;i.add(t),l.push(i)}}else a.add(t)}),a.glyphs.length>0&&(l=[a].concat(l)),r&&l.forEach(function(e){e.quant&&e.glyphs.unshift(new I.GridGlyph(e.height,i,n))}),l.forEach(function(e){e.glyphs.sort(function(e,t){return(e.zindex||0)-(t.zindex||0)})}),[l,o]}function c(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:!0,n=3;e.padding="number"==typeof e.dasSource.padding?e.dasSource.padding:n,e.scaleVertical="boolean"==typeof e.dasSource.scaleVertical?e.dasSource.scaleVertical:!1;var s=l(e,t,r);if(e.dasSource.collapseSuperGroups&&!e.bumped){var o=function(t){var r=e.superGroups[t];e.groups[t]=(0,R.shallowCopy)(e.groups[t]);var i=e.groups[t];i.isSuperGroup=!0;var n={},s=1e10,o=-1e10,a=null;r.forEach(function(t,l){var u=e.groupedFeatures[r[l]];u&&(u.forEach(function(e){(0,R.pusho)(n,e.type,e),s=Math.min(e.min,s),o=Math.max(e.max,o),e.segment&&!a&&(a=e.segment)}),(i&&!i.links||0===i.links.length)&&(i.links=e.groups[r[0]].links),delete e.groupedFeatures[r[l]])}),e.groups[t].max=o,e.groups[t].min=s,e.groups[t].segment=a,G.map(function(i){var n=i[0],s=null;i.forEach(function(e){var t=new E.Range(e.min,e.max);s=s?(0,E.union)(s,t):t});var o=s.ranges();o.forEach(function(s){var o=((0|s.max())-(0|s.min())+1)*r.length,a=0;i.forEach(function(e){var t=e.min||0,r=e.max||0;t<=s.max()&&r>=s.min()&&(a+=Math.min(r,s.max())-Math.max(t,s.min())+1)});var l=new M.DASFeature;for(var u in n)l[u]=n[u];l.min=s.min(),l.max=s.max(),l.label&&r.length>1&&(l.label+=" ("+r.length+" vars)"),l.visualWeight=1*a/o,(0,R.pusho)(e.groupedFeatures,t,l)})},n),delete e.superGroups[t]};for(var a in e.superGroups)o(a)}var c=u(e,t,s,r);G.map(function(e){var t=[],r=1e10,i=-1e10;e.forEach(function(e){var n=c[e];n&&(t.push(n),r=Math.min(r,n.min()),i=Math.max(i,n.max()))}),t.forEach(function(e){s.push(new I.PaddedGlyph(e,r,i))})},e.superGroups),G.map(function(e){return s.push(e)},c);var f=h(e,s,i,r),p=L(f,2),d=p[0],g=p[1];e.glyphCacheOrigin=e.browser.viewStart,g?e.updateStatus("Bumping limit exceeded, use the track editor to see more features"):e.updateStatus(),e.subtiers=d}function f(e,t,r){var i=e.browser.viewStart-1e3/e.browser.scale,n=e.browser.viewEnd+1e3/e.browser.scale,s=[];if(e.knownCoverage){var o=e.knownCoverage.ranges();o.forEach(function(e,t){0===t?e.min()>i&&s.push({min:i,max:e.min()-1}):s.push({min:o[t-1].max()+1,max:e.min()-1}),t==o.length-1&&e.max()0&&(t.fillStyle="gray",s.forEach(function(i){var n=(i.min-e.browser.viewStart)*e.browser.scale+1e3,s=(i.max-e.browser.viewStart)*e.browser.scale+1e3;t.fillRect(n,0,s-n,r)}))}function p(e,t,r){e.clearRect(0,0,t,r)}function d(e,t,r){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:!0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,s=e.browser.featurePanelWidth+2e3;r&&(s*=2);var o=0|e.viewport.width;s-50>o&&(e.viewport.width=o=s);var a=e.padding+n;e.subtiers.forEach(function(t){return a+=t.height+e.padding}),a+=6,a=Math.max(a,e.browser.minTierHeight);var l=a;r&&(l*=2),l!=e.viewport.height&&(e.viewport.height=l),e.viewportHolder.style.left="-1000px",e.viewport.style.width=r?""+o/2+"px":""+o+"px",e.viewport.style.height=""+a+"px",e.layoutHeight=Math.max(a,e.browser.minTierHeight),e.updateHeight(),e.norigin=e.browser.viewStart,t.save(),r&&t.scale(2,2),i&&p(t,o,l),f(e,t,a)}function g(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=new I.OverlayLabelCanvas,n=(e.glyphCacheOrigin-e.browser.viewStart)*e.browser.scale+1e3;t.translate(n,r+e.padding),i.translate(0,e.padding),e.paintToContext(t,i,n),i.glyphs.length>0?e.overlayLabelCanvas=i:e.overlayLabelCanvas=null,t.restore()}function v(e,t){var r=e.quantMin(t),i=e.quantMax(t);return i||(i=0>r?0:10),r||(r=0),[r,i]}function y(e,t,r){var i=(1*e-t)/(r-t),n=-1*t/(r-t);return[i,n]}function m(e,t,r){var i=null;if(e.currentSequence){var n=0|e.currentSequence.start,s=0|e.currentSequence.end;if(r>=n&&s>=t){var o=Math.max(t,n),a=Math.min(r,s);for(i=e.currentSequence.seq.substr(o-n,a-o+1);o>t;)i="N"+i,o--;for(;r>a;)i+="N",a++}}return i}function b(e,t,r,i,n,s,o,a){var l=t.browser.scale,u=t.browser.viewStart,h=r.score,c=r.label||r.id,f=(r.min-u)*l,p=Math.max((r.max-u+1)*l,f+1),d=1*(t.forceHeight||s.HEIGHT||o||12),g=d,m=null,b=null,w=s.FGCOLOR||"black",x=s.BGCOLOR||"none",S=s.STROKECOLOR;if(s.BGITEM&&r.itemRgb)w=r.itemRgb;else if((0,M.isDasBooleanTrue)(s.COLOR_BY_SCORE2)){var _=s.BGGRAD||s._gradient;_||(_=(0,P.makeGradient)(50,s.COLOR1,s.COLOR2,s.COLOR3),s._gradient=_);var T=r.score2;if(void 0!==T||!w){T=T||0;var C=s.MIN2?1*s.MIN2:0,k=s.MAX2?1*s.MAX2:1,A=(1*T-C)/(k-C),O=A*_.length|0;G.clamp(0,O,_.length-1),w=_[O]}}var E=s.SIZE||d;s.RSIZE&&(E=1*s.RSIZE*d),s.STROKETHRESHOLD&&E<1*s.STROKETHRESHOLD&&(S=null);var R=(f+p)/2;if("EX"===n)m=new I.ExGlyph(R,E,w);else if("TRIANGLE"===n){var B=s.DIRECTION||"N",H=s.LINEWIDTH||E;m=new I.TriangleGlyph(R,E,B,H,w,S)}else if("DOT"===n)m=new I.DotGlyph(R,E,w,S);else if("PLIMSOLL"===n)m=new I.PlimsollGlyph(R,E,.2*E,w,S);else if("SQUARE"===n)m=new I.BoxGlyph(R-E/2,0,E,E,w,S);else if("STAR"===n){var F=s.POINTS||5;m=new I.StarGlyph(R,E/2,F,w,S)}else m=new I.CrossGlyph(R,E,w);if(x&&"none"!==x&&p-f>5){var N=new I.BoxGlyph(f,0,p-f,E,x);m=new I.GroupGlyph([N,m])}if((0,M.isDasBooleanTrue)(s.SCATTER)){var D=v(t,s),q=L(D,2),U=q[0],z=q[1],j=y(h,U,z),W=L(j,2),V=W[0],X=W[1];if(0>V||V>1)return null;var K=function(e){return(e-X)*g};d=Math.max(1,K(V)),i+=K(1),V>=X&&(i-=d),b={min:U,max:z};var Z=0,Q=G.defaultTo(s.LABEL,r.forceLabel);(0,M.isDasBooleanNotFalse)(Q)&&c&&!a&&(m=new I.LabelledGlyph(e,m,c,!0,null,"above"==Q?"above":"below"),"above"===Q&&(Z=m.textHeight+2),a=!0),m=new I.TranslatedGlyph(m,0,i-E/2-Z,g)}return[m,b]}function w(e,t,r,i,n,s,o){var a=t.browser.scale,l=t.browser.viewStart,u=r.score,h=(r.min-l)*a,c=Math.max((r.max-l+1)*a,h+1),f=1*(t.forceHeight||s.HEIGHT||o||12),p=1*f,d=null,g=null,m=(0,M.isDasBooleanTrue)(s.AXISCENTER),b=v(t,s),w=L(b,2),x=w[0],S=w[1];if((0,M.isDasBooleanTrue)(s.AUTOMIN)&&(x=.95*t.currentFeaturesMinScore,console.log("smin:	"+x)),(0,M.isDasBooleanTrue)(s.AUTOMAX)&&(S=1.05*t.currentFeaturesMaxScore,console.log("smax:	"+S)),1*x>1*u&&(u=x),1*u>1*S&&(u=S),m){var _=t.quantMin(s),T=t.quantMax(s);(0,M.isDasBooleanTrue)(s.AUTOMIN)&&(_=.95*t.currentFeaturesMinScore),(0,M.isDasBooleanTrue)(s.AUTOMAX)&&(T=1.05*t.currentFeaturesMaxScore),x=_-(T-_)/2,S=T-(T-_)/2}var C=y(u,x,S),k=L(C,2),A=k[0],O=k[1];if("HISTOGRAM"===n){var E=function(e){return e-Math.max(0,O)};f=Math.abs(E(A))*p,i+=E(1)*p,A>=O&&(i-=f),m&&(i+=f/2),g=(0,M.isDasBooleanTrue)(s.HIDEAXISLABEL)?null:{min:x,max:S}}var R=s.FGCOLOR||null,B=s.BGCOLOR||s.COLOR1||"green";s.BGITEM&&r.itemRgb&&(B=r.itemRgb);var H=s.ALPHA?1*s.ALPHA:null;if(s.BGGRAD){var F=s.BGGRAD,N=A*F.length|0;N=G.clamp(0,N,F.length-1),B=F[N]}if(s.COLOR2){var D=s._gradient;D||(D=(0,P.makeGradient)(50,s.COLOR1,s.COLOR2,s.COLOR3),s._gradient=D);var q=A*D.length|0;q=G.clamp(0,q,D.length-1),B=D[q]}var U=new I.BoxGlyph(h,i,c-h,f,B,R,H);return d=new I.TranslatedGlyph(U,0,0,p),[d,g]}function x(e,t,r){var i=e.browser.scale,n=e.browser.viewStart,s=t.score,o=(t.min-n)*i,a=Math.max((t.max-n+1)*i,o+1),l=e.forceHeight||r.HEIGHT||30,u=null,h=null,c=v(e,r),f=L(c,2),p=f[0],d=f[1],g=1*l/(d-p),y=(1*s-p)/(d-p),m=(s-1*p)*g|0;h={min:p,max:d};var b=r.FGCOLOR||r.COLOR1||"black";if(r.COLOR2){var w=r._gradient;w||(w=(0,P.makeGradient)(50,r.COLOR1,r.COLOR2,r.COLOR3),r._gradient=w);var x=y*w.length|0;x=G.clamp(0,x,w.length-1),b=w[x]}return u=new I.PointGlyph((o+a)/2,l-m,l,b),[u,h]}function S(e,t,r,i,n){var s=t.browser.scale,o=t.browser.viewStart,a=r.min,l=r.max,u=(r.min-o)*s,h=Math.max((r.max-o+1)*s,u+1),c=1*(t.forceHeight||i.HEIGHT||n||12),f=null,p=r.seq,d=p,g=r.quals,v=g,y=(0,M.isDasBooleanTrue)(i.__INSERTIONS),b=[];if(r.cigar){var w=(0,H.parseCigar)(r.cigar);d="",v="";var x=0;w.forEach(function(r){if("M"===r.op)d+=p.substr(x,r.cnt),v+=g.substr(x,r.cnt),x+=r.cnt;else if("D"===r.op)d+="-".repeat(r.cnt),v+="Z".repeat(r.cnt);else if("I"===r.op){var i=p.substr(x,r.cnt),n=new I.TranslatedGlyph(new I.TriangleGlyph(u+d.length*s,6,"S",5,t.browser.baseColors.I),0,-2,0);y&&(n=new I.LabelledGlyph(e,n,i,!1,"center","above","7px sans-serif")),n.feature={label:"Insertion: "+i,type:"insertion",method:"insertion"},b.push(n),x+=r.cnt}else"S"===r.op?x+=r.cnt:console.log("unknown cigop"+r.op)})}var S=m(t,a,l);if(d&&S&&("mismatch"===i.__SEQCOLOR||"mismatch-all"===i.__SEQCOLOR)){for(var _=[],T="-"===r.orientation?",":".",C=0;C0&&(b.splice(0,0,f),f=new I.GroupGlyph(b)),f}function _(e,t,r,i){i=i||0;var n=r.browser.viewStart,s=r.browser.scale,o=r.forceHeight||t.HEIGHT||30,a=r.quantMin(t),l=r.quantMax(t);(0,M.isDasBooleanTrue)(t.AUTOMIN)&&(a=.95*r.currentFeaturesMinScore),(0,M.isDasBooleanTrue)(t.AUTOMAX)&&(l=1.05*r.currentFeaturesMaxScore);var u=1*o/(l-a),h=t.FGCOLOR||t.COLOR1||"black",c=1,f=null,p=[],d=[],g=null;e.forEach(function(e){var r=(((0|e.min)+(0|e.max))/2-n)*s,l=(e.score-1*a)*u|0;(0,M.isDasBooleanTrue)(t.ADDITIVE)?(f=e.score<0?-1:1,f!==c&&(d.push({points:p,color:1===c?t.POSCOLOR:t.NEGCOLOR}),p=[],p.push(g)),c=f):f=1;var h=o-l*f+i;g={x:r,y:h},p.push(g)}),(0,M.isDasBooleanTrue)(t.ADDITIVE)&&(h=1===f?t.POSCOLOR:t.NEGCOLOR),d.push({points:p,color:h});var v=d.map(function(e){var r=new I.LineGraphGlyph(e.points,e.color,o);return r.quant={min:a,max:l},t.ZINDEX&&(r.zindex=0|t.ZINDEX),r});return v}function T(e,t){for(var r=[],i=[],n=[],s=t.browser.scale,o=t.browser.viewStart,a=0;am?0:10,m=m?1*m:0;var w;if(h>=0?(w=i[p]||0,i[p]=w+h):(w=n[p]||0,n[p]=w+h),!(w>b||m>w)){m>w+h&&(h=m-w),w+h>b&&(h=b-w);var x=(h+w-m)/(b-m),S=(w-m)/(b-m),_=Math.max(S,x),T=Math.min(S,x);c=(_-T)*f;var C=(1-_)*f,k=u.FGCOLOR||null,L=u.BGCOLOR||u.COLOR1||"green";u.BGITEM&&l.itemRgb&&(L=l.itemRgb);var A=u.ALPHA?1*u.ALPHA:null,O=new I.BoxGlyph(g,C,y-g,c,L,k,A);O=new I.TranslatedGlyph(O,0,0,f),O.feature=l,O.quant={min:m,max:b},u.ZINDEX&&(O.zindex=0|u.ZINDEX),r.push(O)}}return r}function C(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:!1,i=50;e.quantOverlay.height=t,e.quantOverlay.width=r?2*i:i,e.quantOverlay.style.height=""+(r?t/2:t)+"px",e.quantOverlay.style.width=""+i+"px",e.quantOverlay.style.display="block";var n=e.quantOverlay.getContext("2d");return r&&n.scale(2,2),n}function k(e,t,r,i){e.save();var n=t.quantOverlay.height,s=100,o=(n+2*t.padding)/i,a=(r.max-r.min)/i;if(e.fillStyle="white",e.globalAlpha=.6,"right"==t.browser.rulerLocation?e.fillRect(s-30,0,30,n+2*t.padding):e.fillRect(0,0,30,n+2*t.padding),e.globalAlpha=1,e.strokeStyle="black",e.lineWidth=1,e.beginPath(),"right"==t.browser.rulerLocation){e.moveTo(s-8,t.padding),e.lineTo(s,t.padding),e.lineTo(s,n+t.padding),e.lineTo(s-8,n+t.padding);for(var l=1;i-1>l;l++){var u=l*o;e.moveTo(s,u),e.lineTo(s-5,u)}}else{e.moveTo(8,t.padding),e.lineTo(0,t.padding),e.lineTo(0,n+t.padding),e.lineTo(8,n+t.padding);for(var h=1;i-1>h;h++){var c=h*o;e.moveTo(0,c),e.lineTo(5,c)}}if(e.stroke(),e.fillStyle="black","right"==t.browser.rulerLocation){e.textAlign="right",e.fillText((0,F.formatQuantLabel)(r.max),s-9,8),e.fillText((0,F.formatQuantLabel)(r.min),s-9,n+t.padding);for(var f=1;i-1>f;f++){var p=f*o;e.fillText((0,F.formatQuantLabel)(1*r.max-f*a),s-9,p+3)}}else{e.textAlign="left",e.fillText((0,F.formatQuantLabel)(r.max),9,8),e.fillText((0,F.formatQuantLabel)(r.min),9,n+t.padding);for(var d=1;i-1>d;d++){var g=d*o;e.fillText((0,F.formatQuantLabel)(1*r.max-d*a),9,g+3)}}e.restore()}Object.defineProperty(r,"__esModule",{value:!0}),r.paintQuant=r.createQuantOverlay=r.clearViewport=r.drawUnmapped=r.paint=r.prepareViewport=r.prepareSubtiers=r.drawTier=r.renderTier=void 0;var L=function(){function e(e,t){var r=[],i=!0,n=!1,s=void 0;try{for(var o,a=e[Symbol.iterator]();!(i=(o=a.next()).done)&&(r.push(o.value),!t||r.length!==t);i=!0);}catch(l){n=!0,s=l}finally{try{!i&&a["return"]&&a["return"]()}finally{if(n)throw s}}return r}return function(t,r){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),A=e("./feature-draw.js"),O=e("./sequence-draw.js"),E=e("./spans.js"),R=e("./utils.js"),B=e("./glyphs.js"),I=i(B),M=e("./das.js"),P=e("./color.js"),H=e("./cigar.js"),F=e("./numformats"),N=e("ramda"),G=i(N);r.renderTier=n,r.drawTier=s,r.prepareSubtiers=c,r.prepareViewport=d,r.paint=g,r.drawUnmapped=f,r.clearViewport=p,r.createQuantOverlay=C,r.paintQuant=k},{"./cigar.js":8,"./color.js":9,"./das.js":10,"./feature-draw.js":20,"./glyphs.js":23,"./numformats":30,"./sequence-draw.js":36,"./spans.js":41,"./utils.js":56,ramda:63}],12:[function(e,t,r){"use strict";function i(e,t,r){function i(){r?(n.className="fa fa-caret-down",t.style.display="table"):(n.className="fa fa-caret-right",t.style.display="none")}var n=a("i");i(),n.addEventListener("click",function(e){e.preventDefault(),e.stopPropagation(),r=!r,i()},!1);var s=a("h6",[n," ",e],{},{display:"block",background:"gray",color:"white",width:"100%",padding:"5px 2px",margin:"0px"});return a("div",[s,t],{})}if("undefined"!=typeof e)var n=e("./cbrowser"),s=n.Browser,o=e("./utils"),a=o.makeElement,l=o.removeChildren;s.prototype.removeAllPopups=function(){l(this.hPopupHolder),l(this.popupHolder)},s.prototype.makeTooltip=function(e,t){var r,i=!1,n=this,s=null;r=function(t){i=!1,s&&(clearTimeout(s),s=null),e.removeEventListener("mouseout",r,!1)};var o=function l(r){var o=r.clientX+window.scrollX,u=r.clientY+window.scrollY;s||(s=setTimeout(function(){var r;r="function"==typeof t?t():t;var h=a("div",[a("div",null,{className:"tooltip-arrow"}),a("div",r,{className:"tooltip-inner"})],{className:"tooltip bottom in"},{display:"block",top:""+(u+20)+"px",left:""+Math.max(o-30,20)+"px"});n.hPopupHolder.appendChild(h);var c;c=function(t){try{n.hPopupHolder.removeChild(h)}catch(r){}window.removeEventListener("mousemove",c,!1),i&&(null==e.offsetParent||l(t))},window.addEventListener("mousemove",c,!1),s=null},1e3))};e.addEventListener("mouseover",function(t){i=!0,e.addEventListener("mouseout",r,!1),o(t)},!1),e.addEventListener("DOMNodeRemovedFromDocument",function(e){i=!1,s&&(clearTimeout(s),s=null)},!1)},s.prototype.popit=function(e,t,r,i){var n=this;i||(i={}),e||(e={});var s,o,l=i.width||200;if(e.clientX)var s=e.clientX,o=e.clientY;else s=500,o=50;s+=document.documentElement.scrollLeft||document.body.scrollLeft,o+=document.documentElement.scrollTop||document.body.scrollTop;var u=window.innerWidth,h=o,c=Math.min(s-l/2-4,u-l-30),f=a("div");if(f.className="popover fade "+(e.clientX?"bottom ":"")+"in",f.style.display="block",f.style.position="absolute",f.style.top=""+h+"px",f.style.left=""+c+"px",f.style.width=l+"px",l>276&&(f.style.maxWidth=l+"px"),f.appendChild(a("div",null,{className:"arrow"})),t){var p=a("button","",{className:"close"});p.innerHTML="×",p.addEventListener("mouseover",function(e){p.style.color="red"},!1),p.addEventListener("mouseout",function(e){p.style.color="black"},!1),p.addEventListener("click",function(e){e.preventDefault(),e.stopPropagation(),n.removeAllPopups()},!1);var d,g,v,y,m=a("h4",[a("span",t,null,{maxWidth:"200px"}),p],{},{paddingLeft:"10px",paddingRight:"10px"});v=function(e){e.stopPropagation(),e.preventDefault(),c+=e.clientX-d,8>c&&(c=8),c>u-l-32&&(c=u-l-26),h+=e.clientY-g,h=Math.max(10,h),f.style.top=""+h+"px",f.style.left=""+Math.min(c,u-l-10)+"px",d=e.clientX,g=e.clientY},y=function(e){e.stopPropagation(),e.preventDefault(),window.removeEventListener("mousemove",v,!1),window.removeEventListener("mouseup",y,!1)},m.addEventListener("mousedown",function(e){e.preventDefault(),e.stopPropagation(),d=e.clientX,g=e.clientY,window.addEventListener("mousemove",v,!1),window.addEventListener("mouseup",y,!1)},!1),f.appendChild(m)}f.appendChild(a("div",r,{className:"popover-content"},{padding:"0px"})),this.hPopupHolder.appendChild(f);var b={node:f,displayed:!0};return f.addEventListener("DOMNodeRemoved",function(e){e.target==f&&(b.displayed=!1)},!1),b},"undefined"!=typeof t&&(t.exports={makeTreeTableSection:i})},{"./cbrowser":6,"./utils":56}],13:[function(e,t,r){"use strict";function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function n(e,t){s(t),t.updateStatus(e)}function s(e){var t=e.viewport.getContext("2d"),r=e.browser.retina&&window.devicePixelRatio>1;r&&t.scale(2,2);var i=e.currentFeatures,n=e.currentSequence;e.sequenceSource?a.drawSeqTier(e,n):i?a.prepareSubtiers(e,t):console.log("No sequence or features in tier!"),e.subtiers&&a.prepareViewport(e,t,r,!0),e.drawOverlay(),e.paintQuant(),"function"==typeof e.dasSource.drawCallback&&e.dasSource.drawCallback(t,e),e.originHaxx=0,e.browser.arrangeTiers()}Object.defineProperty(r,"__esModule",{value:!0}),r.drawTier=r.renderTier=void 0;var o=e("./default-renderer"),a=i(o);r.renderTier=n,r.drawTier=s},{"./default-renderer":11}],14:[function(e,t,r){"use strict";function i(e,t){return e.indexOf("?")<0&&(e+="?soft=true"),new l(function(r,i){var n=new XMLHttpRequest;n.onreadystatechange=function(){if(4==n.readyState)if(n.status>=300)i("Error code "+n.status);else{var e=JSON.parse(n.response);r(t?e:e.location)}},n.open("GET",e,!0),n.setRequestHeader("Accept","application/json"),n.responseType="text",n.send()})}function n(e){this.rawurl=e}function s(e,t,r,i){i||("object"===("undefined"==typeof t?"undefined":a(t))?(i=t,t=void 0):i={}),this.url="string"==typeof e?new n(e):e,this.start=t||0,r&&(this.end=r),this.opts=i}function o(e){if(!e)return null;for(var t=new Uint8Array(e.length),r=0;rDate.now()?this.urlPromise:(this.urlPromise=i(this.rawurl,!0).then(function(e){return e.location}),this.urlPromiseValidity=Date.now()+432e5,this.urlPromise)},s.prototype.slice=function(e,t){if(0>e)throw"Bad slice "+e;var r=this.start,i=this.end;return r&&e?r+=e:r=e||r,i=t&&r?r+t-1:i||t-1,new s(this.url,r,i,this.opts)},s.prototype.fetchAsText=function(e){var t,r=this,i=new XMLHttpRequest;r.url.getURLPromise().then(function(n){if(i.open("GET",n,!0),r.end){if(r.end-r.start>1e8)throw"Monster fetch!";i.setRequestHeader("Range","bytes="+r.start+"-"+r.end),t=r.end-r.start+1;
}i.onreadystatechange=function(){return 4==i.readyState?e(200==i.status||206==i.status?i.responseText:null):void 0},r.opts.credentials&&(i.withCredentials=!0),i.send()})["catch"](function(t){return console.log(t),e(null)})},s.prototype.salted=function(){return this},s.prototype.fetch=function(e,t,r){var i=this;return t=t||1,t>3?e(null):void i.url.getURLPromise().then(function(n){var s,a=new XMLHttpRequest;if(a.open("GET",n,!0),a.overrideMimeType("text/plain; charset=x-user-defined"),i.end){if(i.end-i.start>1e8)throw"Monster fetch!";a.setRequestHeader("Range","bytes="+i.start+"-"+i.end),s=i.end-i.start+1}a.responseType="arraybuffer",a.onreadystatechange=function(){if(4==a.readyState){if(200==a.status||206==a.status){if(a.response){var n=a.response.byteLength;return!s||s==n||r&&n==r?e(a.response):i.fetch(e,t+1,n)}if(a.mozResponseArrayBuffer)return e(a.mozResponseArrayBuffer);var l=a.responseText;return!s||s==l.length||r&&l.length==r?e(o(a.responseText)):i.fetch(e,t+1,l.length)}return i.fetch(e,t+1)}},i.opts.credentials&&(a.withCredentials=!0),a.send()})["catch"](function(e){console.log(e)})},"undefined"!=typeof t&&(t.exports={lookupEncodeURI:i,EncodeFetchable:s})},{"es6-promise":60}],15:[function(e,t,r){"use strict";function i(e){if(o.call(this),this.source=e,this.base=e.uri||"//rest.ensembl.org",0===this.base.indexOf("//")){var t=window.location.protocol;"http:"==t||"https:"==t||(this.base="http:"+this.base)}this.species=e.species||"human","string"==typeof e.type?this.type=[e.type]:this.type=e.type||["regulatory"]}if("undefined"!=typeof e)var n=e("./sourceadapters"),s=n.registerSourceAdapterFactory,o=n.FeatureSourceBase,a=e("./das"),l=a.DASStylesheet,u=a.DASStyle,h=a.DASFeature,c=a.DASGroup;i.prototype=Object.create(o.prototype),i.prototype.constructor=i,i.prototype.getStyleSheet=function(e){var t=new l,r=new u;r.glyph="__NONE",this.type.indexOf("exon")>=0&&t.pushStyle({type:"transcript"},null,r),(this.type.indexOf("exon")>=0||this.type.indexOf("transcript")>=0)&&t.pushStyle({type:"gene"},null,r);var i=new u;i.glyph="BOX",i.FGCOLOR="black",i.BGCOLOR="red",i.HEIGHT=8,i.BUMP=!0,i.LABEL=!0,i.ZINDEX=10,t.pushStyle({type:"cds"},null,i);var n=new u;n.glyph="SQUARE",n.BUMP="yes",n.LABEL="no",n.FGCOLOR="blue",t.pushStyle({type:"variation",method:".+_UTR_variant"},null,n);var n=new u;n.glyph="TRIANGLE",n.DIRECTION="S",n.BUMP="yes",n.LABEL="no",n.FGCOLOR="blue",t.pushStyle({type:"variation",method:"missense_variant"},null,n);var n=new u;n.glyph="TRIANGLE",n.DIRECTION="N",n.BUMP="yes",n.LABEL="no",n.FGCOLOR="blue",t.pushStyle({type:"variation",method:"splice_.+_variant"},null,n);var n=new u;n.glyph="STAR",n.POINTS=6,n.BUMP="yes",n.LABEL="no",n.FGCOLOR="blue",t.pushStyle({type:"variation",method:"regulatory_region_variant"},null,n);var n=new u;n.glyph="PLIMSOLL",n.BUMP="yes",n.LABEL="no",n.FGCOLOR="rgb(50,80,255)",n.STROKECOLOR="black",t.pushStyle({type:"variation"},null,n);var n=new u;n.glyph="SQUARE",n.BUMP="yes",n.LABEL="no",n.BGCOLOR="#888888",n.FGCOLOR="red",t.pushStyle({type:"indel",method:".+_UTR_variant"},null,n);var n=new u;n.glyph="TRIANGLE",n.DIRECTION="S",n.BUMP="yes",n.LABEL="no",n.BGCOLOR="#888888",n.FGCOLOR="red",t.pushStyle({type:"indel",method:"missense_variant"},null,n);var n=new u;n.glyph="TRIANGLE",n.DIRECTION="N",n.BUMP="yes",n.LABEL="no",n.BGCOLOR="#888888",n.FGCOLOR="red",t.pushStyle({type:"indel",method:"splice_.+_variant"},null,n);var n=new u;n.glyph="STAR",n.POINTS=6,n.BUMP="yes",n.LABEL="no",n.BGCOLOR="#888888",n.FGCOLOR="red",t.pushStyle({type:"indel",method:"regulatory_region_variant"},null,n);var n=new u;n.glyph="PLIMSOLL",n.BUMP="yes",n.LABEL="no",n.BGCOLOR="#888888",n.FGCOLOR="red",n.STROKECOLOR="black",t.pushStyle({type:"indel"},null,n);var s=new u;return s.glyph="BOX",s.FGCOLOR="black",s.BGCOLOR="orange",s.HEIGHT=8,s.BUMP=!0,s.LABEL=!0,s.ZINDEX=20,t.pushStyle({type:"default"},null,s),e(t)},i.prototype.getScales=function(){return[]},i.prototype.fetch=function(e,t,r,i,n,s,o){for(var a=this,l=this.base+"/overlap/region/"+this.species+"/"+e+":"+t+"-"+r,u=[],f=0;f=300){var t="Error code "+p.status;try{var r=JSON.parse(p.response);r.error&&(t=r.error)}catch(i){}o(t,null)}else{for(var n=JSON.parse(p.response),s=[],l=0;l0&&(d.orientation="+")),u.consequence_type&&(d.method=u.consequence_type),u.alt_alleles&&(f.push("Alleles="+u.alt_alleles.join("/")),u.alt_alleles.length>1&&(u.alt_alleles[1].length!=u.alt_alleles[0].length||"-"==u.alt_alleles[1])&&(d.type="indel")),f.length>0&&(d.notes=f),s.push(d)}o(null,s)}},a.busy++,a.notifyActivity(),p.open("GET",l,!0),p.responseType="text",p.send()},i.prototype.capabilities=function(){var e={};return this.type&&this.type.indexOf("transcript")>=0&&(e.search=["gene"]),e},i.prototype.search=function(e,t){var r=this.base+"/lookup/symbol/"+this.species+"/"+e+"?content-type=application/json",i=new XMLHttpRequest;i.onreadystatechange=function(){if(4==i.readyState){if(i.status>=300||i.status<200){var e="Error code "+i.status;try{var r=JSON.parse(i.response);r.error&&(e=r.error)}catch(n){}return 400==i.status?t([]):t(null,e)}var s=JSON.parse(i.response),o=[];return s&&s.seq_region_name&&o.push({segment:s.seq_region_name,min:s.start,max:s.end}),t(o)}},i.open("GET",r,!0),i.responseType="text",i.send()},s("ensembl",function(e){return{features:new i(e)}})},{"./das":10,"./sourceadapters":39}],16:[function(e,t,r){"use strict";if("undefined"!=typeof e)var i=e("./cbrowser"),n=i.Browser,s=e("./utils"),o=s.shallowCopy,a=e("./sha1"),l=a.hex_sha1,u=e("./das"),h=u.copyStylesheet;n.prototype.exportFullConfig=function(e){e=e||{};var t={chr:this.chr,viewStart:0|this.viewStart,viewEnd:0|this.viewEnd,cookieKey:"dalliance_"+l(Date.now()),coordSystem:this.coordSystem,sources:this.exportSourceConfig(),chains:this.exportChains()};return this.prefix&&(t.prefix=this.prefix),t},n.prototype.exportChains=function(){var e={},t=this.chains||{};for(var r in t)e[r]=t[r].exportConfig();return e},n.prototype.exportSourceConfig=function(e){e=e||{};for(var t=[],r=0;r\n    \n  \n  \n    
Dalliance goes here
\n \n\n';return t}},{"./cbrowser":6,"./das":10,"./sha1":38,"./utils":56}],17:[function(e,t,r){"use strict";function i(e,t,r,i){e.fillText(t,r-e.measureText(t).width,i)}if("undefined"!=typeof e)var n=e("./cbrowser"),s=n.Browser,o=e("./glyphs"),a=o.OverlayLabelCanvas,l=e("./numformats"),u=l.formatQuantLabel,h=l.formatLongInt,c=e("./version"),f=e("./sequence-draw").drawSeqTierGC;s.prototype.exportImage=function(e){e=e||{};var t=e.width||this.featurePanelWidth,r=3,n=0;(e.banner||e.region)&&(n=40);var s=this.featurePanelWidth,o=this.scale;this.featurePanelWidth=t,this.scale=this.featurePanelWidth/(this.viewEnd-this.viewStart);for(var l=n,p=0;p0&&(l+=r);var d=this.tiers[p];if(d.backupSubtiers=d.subtiers,d.backupOriginHaxx=d.originHaxx,d.backupLayoutHeight=d.layoutHeight,d.subtiers){var g=this.getTierRenderer(d);if(g&&g.prepareSubtiers&&g.prepareSubtiers(d,d.viewport.getContext("2d")),d.subtiers){for(var v=d.padding,y=0;y40&&(I=1+(B/20|0));var M=B/(I-1),P=(R.max-R.min)/(I-1);_.beginPath(),_.moveTo(b+5,L),_.lineTo(b,L),_.lineTo(b,L+E.height),_.lineTo(b+5,L+E.height);for(var H=1;I-1>H;++H){var F=H*M;_.moveTo(b,L+F),_.lineTo(b+3,L+F)}_.strokeStyle="black",_.strokeWidth=2,_.stroke(),_.fillStyle="black",i(_,u(R.max),b-3,L+7),i(_,u(R.min),b-3,L+E.height);for(var H=1;I-1>H;++H){var F=H*M;i(_,u(1*R.max-H*P),b-3,L+F+3)}}L+=E.height+r}var N;N="string"==typeof d.config.name?d.config.name:d.dasSource.name;var G=_.measureText(N).width;_.fillStyle="black",_.fillText(N,b-(k?28:12)-G,(d.layoutHeight+3)/2),_.restore(),n+=d.layoutHeight+r,d.subtiers=d.backupSubtiers,d.originHaxx=d.backupOriginHaxx,d.layoutHeight=d.backupLayoutHeight}if(e.highlights){_.save(),_.beginPath(),_.moveTo(b,0),_.lineTo(b+t,0),_.lineTo(b+t,n),_.lineTo(b,n),_.closePath(),_.clip(),_.translate(b+T,0);for(var D=this.viewStart,q=this.viewStart,U=this.viewEnd,z=0;zq&&(_.globalAlpha=this.defaultHighlightAlpha,_.fillStyle=this.defaultHighlightFill,_.fillRect((B.min-D)*this.scale,0,(B.max-B.min)*this.scale,n))}_.restore()}var j=-1;return"center"==e.ruler?j=b+(this.viewEnd-this.viewStart+1)*this.scale/2:"left"==e.ruler?j=b:"right"==e.ruler&&(j=b+(this.viewEnd-this.viewStart+1)*this.scale),j>=0&&(_.strokeStyle="blue",_.beginPath(),_.moveTo(j,0),_.lineTo(j,n),_.stroke()),this.featurePanelWidth=s,this.scale=o,S.toDataURL("image/png")}},{"./cbrowser":6,"./glyphs":23,"./numformats":30,"./sequence-draw":36,"./version":58}],18:[function(e,t,r){"use strict";if("undefined"!=typeof e)var i=e("./cbrowser"),n=i.Browser,s=e("./utils"),o=s.makeElement,a=s.removeChildren;n.prototype.openExportPanel=function(){var e=this;if("export"===this.uiMode)this.hideToolPanel(),this.setUiMode("none");else{var t=o("div",null,{className:"export-form"}),r=o("select");r.appendChild(o("option","SVG",{value:"svg"})),r.appendChild(o("option","Image",{value:"png"})),r.appendChild(o("option","Dalliance config",{value:"config"})),r.appendChild(o("option","Dalliance sources",{value:"sources"})),r.appendChild(o("option","Dalliance page",{value:"page"})),r.value="svg",r.addEventListener("change",function(e){a(f),w()},!1),t.appendChild(o("p",["Export as: ",r]));var i=o("input",null,{type:"checkbox",checked:this.exportHighlights});i.addEventListener("change",function(t){e.exportHighlights=i.checked,e.storeStatus()},!1);var n=o("input",null,{type:"checkbox",checked:this.exportRuler});n.addEventListener("change",function(t){e.exportRuler=n.checked,e.storeStatus()},!1);var s=o("input",null,{type:"checkbox",checked:this.exportRegion});s.addEventListener("change",function(t){e.exportRegion=s.checked,e.storeStatus()},!1);var l=o("input",null,{type:"checkbox",checked:this.exportBanner});l.addEventListener("change",function(t){e.exportBanner=l.checked,e.storeStatus()},!1);var u=o("input",null,{type:"text",value:"1.0"}),h=o("input",null,{type:"text",value:"800"}),c=o("button","Export",{className:"btn btn-primary"});c.addEventListener("click",function(t){a(f);var s,l,c,p;if("svg"===r.value)s=URL.createObjectURL(e.makeSVG({highlights:i.checked,banner:e.exportBanner,region:e.exportRegion,ruler:n.checked?e.rulerLocation:"none",width:parseInt(h.value)||800})),l="SVG",c="image/svg",p="dalliance-view.svg";else if("png"===r.value){var d=parseFloat(u.value);if(.1>d||d>10)return void alert("bad scale "+d);s=e.exportImage({highlights:i.checked,banner:e.exportBanner,region:e.exportRegion,ruler:n.checked?e.rulerLocation:"none",resolutionMultiplier:d,width:parseInt(h.value)||800}),l="Image",c="image/png",p="dalliance-view.png"}else if("config"===r.value){var g=JSON.stringify(e.exportFullConfig(),null,2),v=new Blob([g],{type:"text/plain"});s=URL.createObjectURL(v),l="Configuration",c="text/plain",p="dalliance-config.json"}else if("sources"===r.value){var g=JSON.stringify(e.exportSourceConfig(),null,2),v=new Blob([g],{type:"text/plain"});s=URL.createObjectURL(v),l="Source array",c="text/plain",p="dalliance-sources.json"}else if("page"===r.value){var y=e.exportPageTemplate(),c="text/html",v=new Blob([y],{type:c});s=URL.createObjectURL(v),l="Page template",p="dalliance-view.html"}if(s){var m=o("a","[Download]",{href:s,download:p,type:c}),b=o("a","[Preview in browser]",{href:s,type:c,target:"_new"});f.appendChild(o("p",[""+l+" created: ",m,b]))}},!1),e.addViewListener(function(){a(f)}),e.addTierListener(function(){a(f)});var f=o("p",""),p=o("tr",[o("th","Include highlights",{},{width:"400px",textAlign:"right"}),o("td",i)]),d=o("tr",[o("th","Include vertical guideline",{},{textAlign:"right"}),o("td",n)]),g=o("tr",[o("th","Scale multiplier",{},{textAlign:"right"}),o("td",u)]),v=o("tr",[o("th","Width (logical px)",{},{textAlign:"right"}),o("td",h)]),y=o("tr",[o("th","Label with genomic coordinates",{},{textAlign:"right"}),o("td",s)]),m=o("tr",[o("th","Include banner",{},{textAlign:"right"}),o("td",l)]),b=o("table",[p,d,v,g,y],null,{width:"500px"}),w=function(){var e=r.value;p.style.display="svg"==e||"png"==e?"table-row":"none",d.style.display="svg"==e||"png"==e?"table-row":"none",g.style.display="png"==e?"table-row":"none",v.style.display="svg"==e||"png"==e?"table-row":"none",y.style.display="svg"==e||"png"==e?"table-row":"none",m.style.display="svg"==e||"png"==e?"table-row":"none"};w(),t.appendChild(b),t.appendChild(c),t.appendChild(f),"none"!==this.uiMode&&this.hideToolPanel(),this.browserHolder.insertBefore(t,this.svgHolder),this.activeToolPanel=t,this.setUiMode("export")}}},{"./cbrowser":6,"./utils":56}],19:[function(e,t,r){"use strict";var i=e("./cbrowser"),n=e("./chainset"),s=e("./sourceadapters"),o=e("./utils"),a=e("./das"),l=e("./sourcecompare");window.Browser=i.Browser,window.sourcesAreEqual=l.sourcesAreEqual,window.Chainset=n.Chainset,window.makeElement=o.makeElement,window.dalliance_registerSourceAdapterFactory=s.registerSourceAdapterFactory,window.dalliance_registerParserFactory=s.registerParserFactory,window.dalliance_makeParser=s.makeParser,window.DASSequence=a.DASSequence,window.DASFeature=a.DASFeature,window.DASGroup=a.DASGroup,window.DASStylesheet=a.DASStylesheet,window.DASStyle=a.DASStyle,window.DASSource=a.DASSource;var u=e("./rulers");window.Ruler=u.Ruler,window.rulerDrawCallback=u.rulerDrawCallback},{"./cbrowser":6,"./chainset":7,"./das":10,"./rulers":33,"./sourceadapters":39,"./sourcecompare":40,"./utils":56}],20:[function(e,t,r){"use strict";function i(){this.glyphs=[],this.height=0,this.quant=null}if("undefined"!=typeof e)var n=e("./tier"),s=n.DasTier,o=e("./numformats"),a=o.formatQuantLabel;i.prototype.indexFor=function(e){for(var t=e.min(),r=0,i=this.glyphs.length;i>r;){var n=(r+i)/2|0;if(n>=this.glyphs.length)return this.glyphs.length;var s=this.glyphs[n];t0&&this.glyphs[t-1].max()>=e.min()?!1:t-r){var u=a[l];u.draw(e,t),u.quant&&(o=u.quant)}}if(o&&o.min<0&&o.max>0&&this.dasSource.zeroLine){var h=i[0].height*(o.max/(o.max-o.min));e.save(),e.strokeStyle=this.dasSource.zeroLine,e.lineWidth=.5,e.beginPath(),e.moveTo(-1e3,h),e.lineTo(n+1e3,h),e.stroke(),e.restore()}if(this.scaleVertical){var c=this.browser.scale;e.translate(0,c+this.padding),t.translate(0,c+this.padding)}else e.translate(0,i[s].height+this.padding),t.translate(0,i[s].height+this.padding)}if(e.restore(),o&&this.quantLeapThreshold&&this.featureSource&&this.browser.sourceAdapterIsCapable(this.featureSource,"quantLeap")){var h=i[0].height*(1-(this.quantLeapThreshold-o.min)/(o.max-o.min));e.save(),e.strokeStyle="red",e.lineWidth=.3,e.beginPath(),e.moveTo(-1e3,h),e.lineTo(n+1e3,h),e.stroke(),e.restore()}},s.prototype.paintQuant=function(){if(this.quantOverlay){var e,t=this.browser.retina&&window.devicePixelRatio>1;if(this.subtiers&&this.subtiers.length>0&&(e=this.subtiers[0].quant),e){var r=this.subtiers[0].height,i=50;this.quantOverlay.height=this.viewport.height,this.quantOverlay.width=t?2*i:i,this.quantOverlay.style.height=""+(t?this.quantOverlay.height/2:this.quantOverlay.height)+"px",this.quantOverlay.style.width=""+i+"px",this.quantOverlay.style.display="block";var n=this.quantOverlay.getContext("2d");t&&n.scale(2,2);var s=2;r>40&&(s=1+(r/20|0));var o=(r+2*this.padding)/(s-1),l=(e.max-e.min)/(s-1);if(n.fillStyle="white",n.globalAlpha=.6,"right"==this.browser.rulerLocation?n.fillRect(i-30,0,30,r+2*this.padding):n.fillRect(0,0,30,r+2*this.padding),n.globalAlpha=1,n.strokeStyle="black",n.lineWidth=1,n.beginPath(),"right"==this.browser.rulerLocation){n.moveTo(i-8,this.padding),n.lineTo(i,this.padding),n.lineTo(i,r+this.padding),n.lineTo(i-8,r+this.padding);for(var u=1;s-1>u;++u){var h=u*o;n.moveTo(i,h),n.lineTo(i-5,h)}}else{n.moveTo(8,this.padding),n.lineTo(0,this.padding),n.lineTo(0,r+this.padding),n.lineTo(8,r+this.padding);for(var u=1;s-1>u;++u){var h=u*o;n.moveTo(0,h),n.lineTo(5,h)}}if(n.stroke(),n.fillStyle="black","right"==this.browser.rulerLocation){n.textAlign="right",n.fillText(a(e.max),i-9,8),n.fillText(a(e.min),i-9,r+this.padding);for(var u=1;s-1>u;++u){var h=u*o;n.fillText(a(1*e.max-u*l),i-9,h+3)}}else{n.textAlign="left",n.fillText(a(e.max),9,8),n.fillText(a(e.min),9,r+this.padding);for(var u=1;s-1>u;++u){var h=u*o;n.fillText(a(1*e.max-u*l),9,h+3)}}}else this.quantOverlay.style.display="none"}},s.prototype.styleForFeature=function(e){var t=this.browser.zoomForCurrentScale();if(!this.stylesheet)return null;for(var r=null,i=this.stylesheet.styles,n=0;n=0?hit[hi]:{},group=--hi>=0?hit[hi]:{},featureInfo=new FeatureInfo(hit,feature,group);featureInfo.tier=tier;for(var fips=this.featureInfoPlugins||[],fipi=0;fipi0){var row=makeElement("tr",[makeElement("th","Links"),makeElement("td",links.map(function(e){return makeElement("div",makeElement("a",e.desc,{href:e.uri,target:"_new"}))}))]);table.appendChild(row),++idx}for(var notes=maybeConcat(group.notes,feature.notes),ni=0;ni=n;if(w.min&&w.max){if(w.score&&"."!=w.score&&"-"!=w.score){var S=1*w.score;(!t||t>S)&&(t=S),(!r||S>r)&&(r=S)}var _=[],T=null;if(w.groups)for(var C=0;CA)&&(f[L]=w.max)}}if(w.parents){i||y();for(var O=0;OA)&&(f[E]=w.max);var B=m(R);if(B.length>0){T=B[0];var I=i[B[0]];p[B[0]]={type:I.type,id:I.id,label:I.label||I.id},e.dasSource.collapseSuperGroups||(e.dasSource.collapseSuperGroups=!0)}}}}if(0==_.length)x&&s(l,w.type,w);else if(T)for(var k=0;k<_.length;++k){var L=_[k];o(d,T,L),g[L]=T}}else v.push(w)}}for(var L in u){var M=p[L];"number"!=typeof M.min&&(M.min=c[L]),"number"!=typeof M.max&&(M.max=f[L]),f[L]>=n&&c[L]<=a&&(h[L]=u[L])}e.ungroupedFeatures=l,e.groupedFeatures=h,e.groups=p,e.superGroups=d,e.groupsToSupers=g,t&&(t>0?t=0:0>r&&(r=0),e.currentFeaturesMinScore=t,e.currentFeaturesMaxScore=r)}if("undefined"!=typeof e)var n=e("./utils"),s=n.pusho,o=n.pushnewo;"undefined"!=typeof t&&(t.exports={sortFeatures:i})},{"./utils":56}],23:[function(e,t,r){"use strict";function i(e,t){this._stroke=e,this._fill=t}function n(e,t,r,i,n,s,o,a){this.x=e,this.y=t,this._width=r,this._height=i,this.fill=n,this.stroke=s,this._alpha=o,this._radius=a||0}function s(e,t){this.glyphs=e,this.connector=t,this.h=e[0].height();for(var r=[],i=0;i0?(e.beginPath(),e.moveTo(this.x+t,this.y),e.lineTo(this.x+this._width-t,this.y),e.arcTo(this.x+this._width,this.y,this.x+this._width,this.y+t,t),e.lineTo(this.x+this._width,this.y+this._height-t),e.arcTo(this.x+this._width,this.y+this._height,this.x+this._width-t,this.y+this._height,t),e.lineTo(this.x+t,this.y+this._height),e.arcTo(this.x,this.y+this._height,this.x,this.y+this._height-t,t),e.lineTo(this.x,this.y+t),e.arcTo(this.x,this.y,this.x+t,this.y,t),e.closePath(),null!=this._alpha&&(e.save(),e.globalAlpha=this._alpha),this.fill&&(e.fillStyle=this.fill,e.fill()),this.stroke&&(e.strokeStyle=this.stroke,e.lineWidth=.5,e.stroke()),null!=this._alpha&&e.restore()):(null!=this._alpha&&(e.save(),e.globalAlpha=this._alpha),this.fill&&(e.fillStyle=this.fill,e.fillRect(this.x,this.y,this._width,this._height)),this.stroke&&(e.strokeStyle=this.stroke,e.lineWidth=.5,e.strokeRect(this.x,this.y,this._width,this._height)),null!=this._alpha&&e.restore())},n.prototype.toSVG=function(){var e=M(F,"rect",null,{x:this.x,y:this.y,width:this._width,height:this._height,stroke:this.stroke||"none",strokeWidth:.5,fill:this.fill||"none"});return null!=this._alpha&&e.setAttribute("opacity",this._alpha),e},n.prototype.min=function(){return this.x},n.prototype.max=function(){return this.x+this._width},n.prototype.height=function(){return this.y+this._height},s.prototype.drawConnectors=function(e){for(var t=this.coverage.ranges(),r=1;rn.max()){var s=n.max(),o=i.min(),a=(s+o)/2;"hat+"===this.connector?(e.moveTo(s,this.h/2),e.lineTo(a,0),e.lineTo(o,this.h/2)):"hat-"===this.connector?(e.moveTo(s,this.h/2),e.lineTo(a,this.h),e.lineTo(o,this.h/2)):"collapsed+"===this.connector?(e.moveTo(s,this.h/2),e.lineTo(o,this.h/2),o-s>4&&(e.moveTo(a-2,this.h/2-3),e.lineTo(a+2,this.h/2),e.lineTo(a-2,this.h/2+3))):"collapsed-"===this.connector?(e.moveTo(s,this.h/2),e.lineTo(o,this.h/2),o-s>4&&(e.moveTo(a+2,this.h/2-3),e.lineTo(a-2,this.h/2),e.lineTo(a+2,this.h/2+3))):(e.moveTo(s,this.h/2),e.lineTo(o,this.h/2))}n=i}},s.prototype.draw=function(e,t){for(var r=0;r0){var n=M(F,"path",null,{d:r.toPathData(),fill:"none",stroke:"black",strokeWidth:.5});e.appendChild(n)}return e},s.prototype.min=function(){return this.coverage.min()},s.prototype.max=function(){return this.coverage.max()},s.prototype.height=function(){return this.h},o.prototype.min=function(){return this.points[0].x},o.prototype.max=function(){return this.points[this.points.length-1].x},o.prototype.height=function(){return this._height},o.prototype.draw=function(e){e.save(),e.strokeStyle=this.color,e.lineWidth=2,e.beginPath(),this.points.forEach(function(t,r){0===r?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y)}),e.stroke(),e.restore()},o.prototype.toSVG=function(){for(var e=new N,t=0;ti&&(i=Math.min(t,this.glyph.max()-this.textLen))),e.fillText(this.text,i,"above"==this.align?this.textHeight:this.glyph.height()+15),this.font&&e.restore()},l.prototype.draw=function(e){var t=this._height/2;e.beginPath(),e.moveTo(this._x,0),e.lineTo(this._x,this._height),e.moveTo(this._x-t,t),e.lineTo(this._x+t,t),e.strokeStyle=this._stroke,e.lineWidth=1,e.stroke()},l.prototype.toSVG=function(){var e=this._height/2,t=new N;return t.moveTo(this._x,0),t.lineTo(this._x,this._height),t.moveTo(this._x-e,e),t.lineTo(this._x+e,e),M(F,"path",null,{d:t.toPathData(),fill:"none",stroke:this._stroke,strokeWidth:"1px"})},l.prototype.min=function(){return this._x-this._height/2},l.prototype.max=function(){return this._x+this._height/2},l.prototype.height=function(){return this._height},u.prototype.draw=function(e){var t=this._height/2;e.beginPath(),e.moveTo(this._x-t,0),e.lineTo(this._x+t,this._height),e.moveTo(this._x-t,this._height),e.lineTo(this._x+t,0),e.strokeStyle=this._stroke,e.lineWidth=1,e.stroke()},u.prototype.toSVG=function(){var e=this._height/2,t=new N;return t.moveTo(this._x-e,0),t.lineTo(this._x+e,this._height),t.moveTo(this._x-e,this._height),t.lineTo(this._x+e,0),M(F,"path",null,{d:t.toPathData(),fill:"none",stroke:this._stroke,strokeWidth:"1px"})},u.prototype.min=function(){return this._x-this._height/2},u.prototype.max=function(){return this._x+this._height/2},u.prototype.height=function(){return this._height},h.prototype=Object.create(i.prototype),h.prototype.drawPath=function(e){var t=this._height/2,r=this._width/2;"S"===this._dir?(e.moveTo(this._x,this._height),e.lineTo(this._x-r,0),e.lineTo(this._x+r,0)):"W"===this._dir?(e.moveTo(this._x+r,t),e.lineTo(this._x-r,0),e.lineTo(this._x-r,this._height)):"E"===this._dir?(e.moveTo(this._x-r,t),e.lineTo(this._x+r,0),e.lineTo(this._x+r,this._height)):(e.moveTo(this._x,0),e.lineTo(this._x+r,this._height),e.lineTo(this._x-r,this._height)),e.closePath()},h.prototype.min=function(){return this._x-this._height/2},h.prototype.max=function(){return this._x+this._height/2},h.prototype.height=function(){return this._height},c.prototype.draw=function(e){var t=this._height/2;e.fillStyle=this._stroke,e.beginPath(),e.arc(this._x,t,t,0,6.29),this._fill&&(e.fillStyle=this._fill,e.fill()),this._stroke&&(e.strokeStyle=this._stroke,e.stroke())},c.prototype.toSVG=function(){var e=this._height/2;return M(F,"circle",null,{cx:this._x,cy:e,r:e,fill:this._fill||"none",stroke:this._stroke||"none",strokeWidth:"1px"})},c.prototype.min=function(){return this._x-this._height/2},c.prototype.max=function(){return this._x+this._height/2},c.prototype.height=function(){return this._height},f.prototype.draw=function(e,t){this.glyph&&this.glyph.draw(e,t)},f.prototype.toSVG=function(){return this.glyph?this.glyph.toSVG():M(F,"g")},f.prototype.min=function(){return this._min},f.prototype.max=function(){return this._max},f.prototype.height=function(){return this.glyph?this.glyph.height():1},p.prototype=Object.create(i.prototype),p.prototype.min=function(){return this._min},p.prototype.max=function(){return this._max},p.prototype.height=function(){return this._height},p.prototype.drawPath=function(e){var t=this._max,r=this._min,i=this._height,n=0,s=0,o=this._height+2,a=.333333*this._height,l=0;this._ori&&("+"===this._ori?s=.5*this._height:"-"===this._ori&&(n=.5*this._height)),o>t-r&&(r=(t+r-o)/2,t=r+o),e.moveTo(r+n,l+a),e.lineTo(t-s,l+a),e.lineTo(t-s,l),e.lineTo(t,l+this._height/2),e.lineTo(t-s,l+i),e.lineTo(t-s,l+a+a),e.lineTo(r+n,l+a+a),e.lineTo(r+n,l+i),e.lineTo(r,l+i/2),e.lineTo(r+n,l),e.lineTo(r+n,l+a)},d.prototype=Object.create(i.prototype),d.prototype.min=function(){return this._min},d.prototype.max=function(){return this._max},d.prototype.height=function(){return this._height},d.prototype.drawPath=function(e){var t=this._min,r=this._max,i=this._height,n=i/2;e.moveTo(t,n),e.lineTo(r,n),e.moveTo(t,0),e.lineTo(t,i),e.moveTo(r,0),e.lineTo(r,i)},g.prototype.min=function(){return this._min},g.prototype.max=function(){return this._max},g.prototype.height=function(){return this._height},g.prototype.drawPath=function(e){var t=this._min,r=this._max,i=this._height,n=i/2;"hat"===this._style?(e.moveTo(t,n),e.lineTo((t+r)/2,"-"===this._strand?i:0),e.lineTo(r,n)):(e.moveTo(t,n),e.lineTo(r,n))},g.prototype.draw=function(e){e.beginPath(),this.drawPath(e),e.strokeStyle=this._stroke,"dashed"===this._style&&e.setLineDash?(e.save(),e.setLineDash([3]),e.stroke(),e.restore()):e.stroke()},g.prototype.toSVG=function(){var e=new N;this.drawPath(e);var t={d:e.toPathData(),stroke:this._stroke||"none"};return"dashed"===this._style&&(t.strokeDasharray="3"),M(F,"path",null,t)},v.prototype.min=function(){return this._min},v.prototype.max=function(){return this._max},v.prototype.height=function(){return this._height},v.prototype.drawStemPath=function(e){var t=this._min,r=this._max,i=this._height,n=i/2;e.moveTo(t,n),e.lineTo(r,n)},v.prototype.drawTrigsPath=function(e){var t=this._min,r=this._max,i=this._height,n=i/2;e.moveTo(t,0),e.lineTo(t+i,n),e.lineTo(t,i),e.lineTo(t,0),e.moveTo(r,0),e.lineTo(r-i,n),e.lineTo(r,i),e.lineTo(r,0)},v.prototype.draw=function(e){e.beginPath(),this.drawStemPath(e),e.strokeStyle=this._stroke,e.stroke(),e.beginPath(),this.drawTrigsPath(e),e.fillStyle=this._fill,e.fill()},v.prototype.toSVG=function(){var e=new N;this.drawStemPath(e);var t=new N;return this.drawTrigsPath(t),M(F,"g",[M(F,"path",null,{d:e.toPathData(),stroke:this._stroke||"none"}),M(F,"path",null,{d:t.toPathData(),fill:this._fill||"none"})])},y.prototype=Object.create(i.prototype),y.prototype.min=function(){return this._min},y.prototype.max=function(){return this._max},y.prototype.height=function(){return this._height},y.prototype.drawPath=function(e){var t=this._min,r=this._max,i=this._height;if(this._parallel){var n=i/2,s=.4*i;this._sw?(e.moveTo(t+n,i-s),e.lineTo(t+n,i),e.lineTo(t,n),e.lineTo(t+n,0),e.lineTo(t+n,s)):(e.moveTo(t,i-s),e.lineTo(t,s)),this._ne?(e.lineTo(r-n,s),e.lineTo(r-n,0),e.lineTo(r,n),e.lineTo(r-n,i),e.lineTo(r-n,i-s)):(e.lineTo(r,s),e.lineTo(r,i-s)),e.closePath()}else{var o=(t+r)/2,s=.4*(r-t),a=i/3;this._ne?(e.moveTo(t+s,a),e.lineTo(t,a),e.lineTo(o,0),e.lineTo(r,a),e.lineTo(r-s,a)):(e.moveTo(t+s,0),e.lineTo(r-s,0)),this._sw?(e.lineTo(r-s,i-a),e.lineTo(r,i-a),e.lineTo(o,i),e.lineTo(t,i-a),e.lineTo(t+s,i-a)):(e.lineTo(r-s,i),e.lineTo(t+s,i)),e.closePath()}},m.prototype.min=function(){return this._min},m.prototype.max=function(){return this._max},m.prototype.height=function(){return this._height},m.prototype.toSVG=function(){return M(F,"rect",null,{x:this._min,y:0,width:this._max-this._min,height:this._height,stroke:this._stroke||"none",fill:this._fill||"none"})},m.prototype.draw=function(e){if(this._fill&&(e.fillStyle=this._fill,e.fillRect(this._min,0,this._max-this._min,this._height)),this._stroke){e.strokeStyle=this._stroke,e.strokeRect(this._min,0,this._max-this._min,this._height),e.beginPath();for(var t=2;t0&&(e.fillStyle=r,e.fillRect(this._min,0,i*o,this._height));for(var a=o;a=8&&3==l.length&&(e.fillStyle="white",e.fillText(u,this._min+(a+1)*i,this._height))}}},S.prototype.toSVG=function(){var e=M(F,"g"),t=this._seq,r=this._fill;if(!t)return e;var i=(this._max-this._min+1)/t.length,n=(3-this._readframe)%3,s=(t.length-n)%3,o="+"==this._orientation?n:s;o>0&&e.appendChild(M(F,"rect",null,{x:this._min,y:0,width:i*o,height:this._height,fill:r}));for(var a=o;a=8&&3==l.length&&e.appendChild(M(F,"text",u,{x:this._min+(a+1)*i,y:this._height,fill:"white"}))}return e};var G="undefined"!=typeof window&&window.devicePixelRatio>1,D={},q=new RegExp("^[ACGT-]$"),U=function(e){return e>=8};_.prototype.min=function(){return this._min},_.prototype.max=function(){return this._max},_.prototype.height=function(){return this._height},_.prototype.alphaForQual=function(e){return.1+.9*Math.max(0,Math.min(1*e/30,1))},_.prototype.draw=function(e){var t=this._seq,r=this._ref,i="mismatch"===this._scheme||"mismatch-all"===this._scheme,n="mismatch-all"===this._scheme,s=t?t.length:this._max-this._min+1,o=(this._max-this._min+1)/s;i&&!U(o)&&(e.fillStyle=this._strandColor,this._scaleVertical?e.fillRect(this._min,o,this._max-this._min,o):e.fillRect(this._min,this._height/4,this._max-this._min,this._height/2));for(var a=0;s>a;++a){var l=t?t.substr(a,1).toUpperCase():"N";if(q.test(l)||U(o)){var u=this.baseColors[l];if(this._quals){var h=this._quals.charCodeAt(a)-33,c=e.globalAlpha;e.globalAlpha=this.alphaForQual(h)}if(!u){var f=r?r.substr(a,1).toUpperCase():"N";u="N"==l||"N"==f?"gray":this._strandColor,n&&(l=f)}e.fillStyle=u;var p=q.test(l);if(!this._fillbg&&U(o)&&p||(this._scaleVertical?e.fillRect(this._min+a*o,o,o,o):e.fillRect(this._min+a*o,0,o,this._height)),U(o)&&p){var d=u+"_"+l,g=D[d];if(!g){g=document.createElement("canvas"),G?(g.width=16,g.height=20):(g.width=8,g.height=10);var v=g.getContext("2d");G&&v.scale(2,2),v.fillStyle=this._fillbg?"black":u;var y=v.measureText(l).width;v.fillText(l,.5*(8-y),8),D[d]=g}var m=this._scaleVertical?o:0;G?e.drawImage(g,this._min+a*o+.5*(o-8),m,8,10):e.drawImage(g,this._min+a*o+.5*(o-8),m)}this._quals&&(e.globalAlpha=c)}}},_.prototype.toSVG=function(){for(var e=this._seq,t=this._ref,r=("mismatch"===this._scheme||"mismatch-all"===this._scheme,"mismatch-all"===this._scheme),i=(this._max-this._min+1)/this._seq.length,n=M(F,"g"),s=0;s0?"+":0>e?"-":void 0}if("undefined"!=typeof e){var s=e("./das"),o=(s.DASStylesheet,s.DASStyle,s.DASFeature),a=(s.DASGroup,e("./utils")),l=a.shallowCopy,u=e("./spans"),h=u.Range,c=u.union;u.intersection}i.prototype.features=function(e,t,r){t=t||{},url=this.base+"/features/"+e.name;var i=[];this.query&&i.push(this.query),e.isBounded&&(i.push("start="+e.start),i.push("end="+e.end)),i.length>0&&(url=url+"?"+i.join("&"));var s=new XMLHttpRequest;s.onreadystatechange=function(){if(4==s.readyState)if(s.status>=300)r(null,"Error code "+s.status);else{var t=JSON.parse(s.response).features,i=[];for(fi=0;fi0){f.id=a.uniqueID;for(var p=[],d=[],g=[],v=0;v0){u=c(p);var b=l(f);b.type="transcript",u.ranges().forEach(function(t){i.push({segment:e.name,min:t.min(),max:t.max(),orientation:f.orientation,groups:[b],type:"transcript"})});var w=l(f);d.forEach(function(e){e.type="translation",e.groups=[w],i.push(e)})}else g.forEach(function(e){i.push(e)})}else i.push(f)}r(i)}},s.open("GET",url,!0),s.responseType="text",s.send()},"undefined"!=typeof t&&(t.exports={JBrowseStore:i})},{"./das":10,"./spans":41,"./utils":56}],25:[function(e,t,r){"use strict";function i(){var e=this;this.reqs=[],this.awaitedFeatures={},this.requestsIssued=new A(function(t,r){e.notifyRequestsIssued=t})}function n(e,t,r,i,n,s,o){this.chr=e,this.min=t,this.max=r,this.coverage=o,this.scale=i,this.features=n||[],this.status=s}function s(e,t,r,i,n,s){this.tierMap=e,this.chr=t,this.min=r,this.max=i,this.scale=n,this.seqSource=s||new y,this.viewCount=0,this.featureCache={},this.latestViews={}}function o(e,t,r){for(var i=[],n={},s=0;s0?u(n,o.groups[0].id,o):o.min<=r&&o.max>=t&&i.push(o):i.push(o)}for(var a in n){for(var l=n[a],h=1e11,c=-1e11,s=0;s=h||c>=t)for(var s=0;sr&&(r=1),this.min=r,this.max=n,this.scale=s,this.pool&&this.pool.abortAll(),this.pool=new i,this.awaitedSeq=new l,this.seqWasFetched=!1,this.viewCount++,this.startFetchesForTiers(e),this.pool.notifyRequestsIssued()},s.prototype.invalidate=function(e){this.pool&&(this.featureCache[e]=null,this.startFetchesForTiers([e]))},s.prototype.startFetchesForTiers=function(e){for(var t,r=this,i=this.awaitedSeq,n=!1,s=0;s=h){var c;return c=this.cs.start==u&&this.cs.end==h?this.cs:new L(this.cs.name,u,h,this.cs.alphabet,this.cs.seq.substring(u-this.cs.start,h+1-this.cs.start)),i.provide(c)}this.seqSource.fetch(this.chr,u,h,this.pool,function(e,t){t?((!r.cs||u<=r.cs.start&&h>=r.cs.end||u>=r.cs.end||h<=r.cs.start||h-u>r.cs.end-r.cs.start)&&(r.cs=t),i.provide(t)):(console.log("Sequence loading failed",e),i.provide(null))})}if(t)throw t},s.prototype.startFetchesFor=function(e,t){var r,i=this,s=this.viewCount,a=e.getSource()||new m,l=e.needsSequence(this.scale),u=i.featureCache[e],h=e.getActiveStyleFilters(this.scale);h&&(r=h.typeList());var c=this.chr,f=this.min,p=this.max;if(void 0===r)return!1;if(u&&u.chr===this.chr&&u.min<=f&&u.max>=p){var d=u.features;(u.minp)&&(d=o(d,f,p)),i.provision(e,u.chr,S(u.coverage,new x(f,p)),u.scale,r,d,u.status,l?t:null);var g=a.getScales();if(u.scale<=this.scale||!g)return l}return a.instrument&&console.log("Starting fetch "+s+" ("+f+", "+p+")"),a.fetch(c,f,p,this.scale,r,this.pool,function(o,h,d,g){a.instrument&&console.log("Finishing fetch "+s);var v=i.latestViews[e]||-1;i.cancelled||v>s||(g||(g=new x(f,p)),(!u||fu.max)&&(i.featureCache[e]=new n(c,f,p,d,h,o,g)),i.latestViews[e]=s,i.provision(e,c,g,d,r,h,o,l?t:null))},h),l},s.prototype.provision=function(e,t,r,i,n,s,o,a){var l=e.browser.getTierRenderer(e);if(o){if(e.setFeatures(t,r,i,[],null),!s){var u=new Error(o);o="Error fetching data: "+o+"; see browser console",console.log("Error fetching data for tier "+e.dasSource.name+":"),console.log(e.dasSource),console.log("Stack trace:"),console.log(u.stack)}l.renderTier(o,e),e.wasRendered()}else{for(var h=!1,y=!1,m=e.getSource();c.prototype.isPrototypeOf(m)||f.prototype.isPrototypeOf(m)||b.prototype.isPrototypeOf(m);)m=b.prototype.isPrototypeOf(m)?m.sources[0]:m.source;(p.prototype.isPrototypeOf(m)||d.prototype.isPrototypeOf(m)||g.prototype.isPrototypeOf(m)||v.prototype.isPrototypeOf(m))&&(h=!0),m.opts&&(m.opts.forceReduction||m.opts.noDownsample)||h&&n&&1==n.length&&n.indexOf("density")>=0&&(s=T(s,this.scale)),n&&1==n.length&&n.indexOf("base-coverage")>=0&&(y=!0),a?a.await(function(n){y&&(s=C(s,n,e.browser.baseColors)),e.setFeatures(t,r,i,s,n),l.renderTier(o,e),e.wasRendered()}):(e.setFeatures(t,r,i,s),l.renderTier(o,e),e.wasRendered())}},"undefined"!=typeof t&&(t.exports={KnownSpace:s})},{"./das":10,"./overlay":31,"./sample":34,"./sourceadapters":39,"./spans":41,"./utils":56,"es6-promise":60}],26:[function(e,t,r){"use strict";function i(e,t){this.block=e,this.offset=t}function n(e,t,r){var n=4294967296*(255&e[t+6])+16777216*(255&e[t+5])+65536*(255&e[t+4])+256*(255&e[t+3])+(255&e[t+2]),s=e[t+1]<<8|e[t];return 0!=n||0!=s||r?new i(n,s):null}function s(e,t){t=Math.min(t||1,e.byteLength-50);for(var r=[],i=[0],n=0;i[0]>14==t>>14?4681+(e>>14):e>>17==t>>17?585+(e>>17):e>>20==t>>20?73+(e>>20):e>>23==t>>23?9+(e>>23):e>>26==t>>26?1+(e>>26):0}function l(e,t){var r,i=[];for(--t,i.push(0),r=1+(e>>26);1+(t>>26)>=r;++r)i.push(r);for(r=9+(e>>23);9+(t>>23)>=r;++r)i.push(r);for(r=73+(e>>20);73+(t>>20)>=r;++r)i.push(r);for(r=585+(e>>17);585+(t>>17)>=r;++r)i.push(r);for(r=4681+(e>>14);4681+(t>>14)>=r;++r)i.push(r);return i}if("undefined"!=typeof e)var u=e("jszlib"),h=u.inflateBuffer,c=u.arrayCopy;i.prototype.toString=function(){return""+this.block+":"+this.offset};"undefined"!=typeof t&&(t.exports={unbgzf:s,readVob:n,reg2bin:a,reg2bins:l,Chunk:o})},{jszlib:61}],27:[function(e,t,r){"use strict";function i(){this.featuresByChr={},this.maxLength=1,this.chrRing=null}function n(e){if(this.source=e,l.call(this),this.storeHolder=new c,this.parser=a(e.payload),!this.parser)throw"Unsupported memstore payload: "+e.payload;var t=this;this._load(function(e,r){if(r)t.error=r,t.storeHolder.provide(null);else{for(var n=new i,s=[],o=e.split("\n"),a=t.parser.createSession(function(e){s.push(e)}),l=0;l0&&a.parse(u)}a.flush(),n.addFeatures(s),t.storeHolder.provide(n)}})}if("undefined"!=typeof e)var s=e("./sourceadapters"),o=s.registerSourceAdapterFactory,a=s.makeParser,l=s.FeatureSourceBase,u=e("./das"),h=(u.DASStylesheet,u.DASStyle,u.DASFeature,u.DASGroup,e("./utils")),c=h.Awaited,f=h.textXHR;i.prototype.addFeatures=function(e){for(var t={},r=0;rthis.maxLength&&(this.maxLength=o)}for(n in t){var s=this.featuresByChr[n];s.sort(function(e,t){var r=e.min-t.min;return 0!=r?r:e.max-t.max})}this.chrRing=null},i.prototype._indexFor=function(e,t){for(var r=0,i=e.length;i>r;){var n=(r+i)/2|0;if(n>=e.length)return e.length;var s=e[n];t=a;++a){var l=i[a];l.min<=r&&l.max>=t&&o.push(l)}return o},i.prototype.findNextFeature=function(e,t,r){if(null==this.chrRing){this.chrRing=[];for(var e in this.featuresByChr)this.chrRing.push(e);this.chrRing.sort()}var i=this.featuresByChr[e];if(i||(0==e.indexOf("chr")?(e=e.substring(3),i=this.featuresByChr[e]):(e="chr"+e,i=this.featuresByChr[e])),!i)return null;var n=Math.max(0,Math.min(this._indexFor(i,t),i.length-1));if(r>0){for(;nt)return s}var o=this.chrRing.indexOf(e)+1;return o>=this.chrRing.length&&(o=0),this.findNextFeature(this.chrRing[o],0,r)}for(;n>=0;){var s=i[n--];if(s.maxo&&(o=this.chrRing.length-1),this.findNextFeature(this.chrRing[o],1e10,r)},n.prototype=Object.create(l.prototype),n.prototype._load=function(e){if(this.source.blob){var t=new FileReader;t.onloadend=function(){return e(t.result,t.error)},t.readAsText(this.source.blob)}else{if(this.source.credentials)var r={credentials:this.source.credentials};f(this.source.uri,e,r)}},n.prototype.fetch=function(e,t,r,i,n,s,o){var a=this;this.storeHolder.await(function(i){if(i){var n=i.fetch(e,t,r);return o(null,n,1e8)}return o(a.error)})},n.prototype.getStyleSheet=function(e){this.parser&&this.parser.getStyleSheet&&this.parser.getStyleSheet(e)},n.prototype.getDefaultFIPs=function(e){this.parser&&this.parser.getDefaultFIPs&&this.parser.getDefaultFIPs(e)},n.prototype.getScales=function(){return 1e8},n.prototype.findNextFeature=function(e,t,r,i){var n=this;this.storeHolder.await(function(s){return s?i(s.findNextFeature(e,t,r)):i(null,n.error)})},n.prototype.capabilities=function(){var e={leap:!0};return e},o("memstore",function(e){return{features:new n(e)}})},{"./das":10,"./sourceadapters":39,"./utils":56}],28:[function(require,module,exports){"use strict";function MolgenisFeatureSource(e){if(FeatureSourceBase.call(this),this.source=e,e.uri)this.base=e.uri;else{if(!e.entity)throw new Error("Bad molgenis track configuration: please specify 'genome_attrs.chr' and 'genome_attrs.pos'");this.base=window.location.origin+"/api/v2/"+e.entity}this.species=e.species||"human","string"==typeof e.type?this.type=[e.type]:this.type=e.type||["regulatory"]}function setStyleProperties(e,t,r){var i=r.track_type,n=r.genome_attrs.alt,s=r.genome_attrs.ref;if("NUMERIC"===i)return void(t.type="numeric");if("EXON"===i){var o=r.label_attr;return-1!=e[o].search(r.exon_key)?(t.type="exon",void(t.method="exon")):(t.type="exon",void(t.method="intron"))}return n&&e[n]&&s&&e[s]?e[n].length>1||e[s].length>1?void(t.type="indel"):"A"===e[n]?(t.type="variant",void(t.method="A")):"T"===e[n]?(t.type="variant",void(t.method="T")):"G"===e[n]?(t.type="variant",void(t.method="G")):"C"===e[n]?(t.type="variant",void(t.method="C")):-1!=e[n].search(",")?(t.type="variant",void(t.method="multiple")):(t.type="variant",void(t.method="unknown")):void(t.type="default")}if("undefined"!=typeof require)var sa=require("./sourceadapters"),dalliance_registerSourceAdapterFactory=sa.registerSourceAdapterFactory,FeatureSourceBase=sa.FeatureSourceBase,das=require("./das"),DASStylesheet=das.DASStylesheet,DASStyle=das.DASStyle,DASFeature=das.DASFeature,DASGroup=das.DASGroup;MolgenisFeatureSource.prototype=Object.create(FeatureSourceBase.prototype),MolgenisFeatureSource.prototype.constructor=MolgenisFeatureSource,MolgenisFeatureSource.prototype.getStyleSheet=function(e){var t=new DASStylesheet,r=new DASStyle;r.glyph="TEXT",r.STRING="A",r.BUMP="yes",r.LABEL="no",r.FGCOLOR="green",t.pushStyle({type:"variant",method:"A"},null,r);var r=new DASStyle;r.glyph="TEXT",r.STRING="C",r.BUMP="yes",r.LABEL="no",r.FGCOLOR="blue",t.pushStyle({type:"variant",method:"C"},null,r);var r=new DASStyle;r.glyph="TEXT",r.STRING="G",r.BUMP="yes",r.LABEL="no",r.FGCOLOR="orange",t.pushStyle({type:"variant",method:"G"},null,r);var r=new DASStyle;r.glyph="TEXT",r.STRING="T",r.BUMP="yes",r.LABEL="no",r.FGCOLOR="red",t.pushStyle({type:"variant",method:"T"},null,r);var r=new DASStyle;r.glyph="TEXT",r.STRING="?",r.BUMP="yes",r.LABEL="no",r.FGCOLOR="darkgrey",t.pushStyle({type:"variant",method:"unknown"},null,r);var r=new DASStyle;r.glyph="DOT",r.BUMP="yes",r.LABEL="no",r.FGCOLOR="purple",t.pushStyle({type:"indel"},null,r);var r=new DASStyle;r.glyph="STAR",r.BUMP="yes",r.LABEL="no",r.FGCOLOR="black",t.pushStyle({type:"variant",method:"multiple"},null,r);var i=new DASStyle;i.glyph="BOX",i.FGCOLOR="blue",i.BGCOLOR="blue",i.HEIGHT=8,i.BUMP=!0,i.LABEL=!1,i.ZINDEX=20,t.pushStyle({type:"default"},null,i);var i=new DASStyle;i.glyph="BOX",i.FGCOLOR="red",i.BGCOLOR="red",i.HEIGHT=8,i.LABEL=!0,i.ZINDEX=20,t.pushStyle({type:"exon",method:"exon"},null,i);var i=new DASStyle;i.glyph="BOX",i.FGCOLOR="white",i.BGCOLOR="white",i.HEIGHT=8,i.LABEL=!0,i.ZINDEX=20,t.pushStyle({type:"exon",method:"intron"},null,i);var r=new DASStyle;return r.glyph="HISTOGRAM",r.BGCOLOR="blue",r.HEIGHT=50,t.pushStyle({type:"numeric"},null,r),e(t)},MolgenisFeatureSource.prototype.getScales=function(){return[]},MolgenisFeatureSource.prototype.fetch=function(chr,min,max,scale,types,pool,callback){var thisB=this,source=this.source;if(!source.genome_attrs.chr||!source.genome_attrs.pos)throw new Error("Bad molgenis track configuration: please specify 'genome_attrs.chr' and 'genome_attrs.pos'");var url=this.base+"?"+(new Date).getTime();if(source.attrs){for(var attributes=[],index=0;index=300){var err="Error code "+req.status;try{var jr=JSON.parse(req.response);jr.error&&(err=jr.error)}catch(ex){}callback(err,null)}else{for(var jf=JSON.parse(req.response),items=jf.items,features=[],fi=0;fi0&&(feature.notes=notes),"NUMERIC"===source.track_type&&(feature.score=entity[source.score_attr]),setStyleProperties(entity,feature,source),feature.molgenis=!0,features.push(feature)}callback(null,features)}},thisB.busy++,thisB.notifyActivity(),req.open("GET",url,!0),req.responseType="text",req.send("")},dalliance_registerSourceAdapterFactory("molgenis",function(e){return{features:new MolgenisFeatureSource(e)}})},{"./das":10,"./sourceadapters":39}],29:[function(e,t,r){"use strict";function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function n(e,t){s(t),t.updateStatus(e)}function s(e){var t=e.dasSource.multi,r=function(e){return e.dasSource.sub};e.padding||(e.padding=3);var i=e.viewport.getContext("2d"),n=e.browser.retina&&window.devicePixelRatio>1;n&&i.scale(2,2);var s=e.browser.tiers.filter(function(e){return"object"===a(r(e))&&r(e).multi_id===t.multi_id&&(e.currentFeatures||e.currentSequence)}),h=p.pipe(p.map(function(e){return e.dasSource.sub.offset}),p.reduce(function(e,t){return e>t?t:e},0))(s);s.forEach(function(t){t.sequenceSource?(0,l.drawSeqTier)(t,t.currentSequence):c.prepareSubtiers(t,i,r(t).offset-h,!1),e.glyphCacheOrigin||(e.glyphCacheOrigin=t.glyphCacheOrigin)});var f=p.pipe(p.map(function(e){return p.map(function(t){return t.height+r(e).offset},e.subtiers)}),p.flatten,p.reduce(function(e,t){return t>e?t:e},-(1/0)),p.add(-h))(s);if(o(e,i,n,f,!0),s.sort(function(e,t){return r(e).z>r(t).z}),t.grid&&s&&s[s.length-1]&&s[s.length-1].subtiers[0]){var d=new u.GridGlyph(f,t.grid_offset,t.grid_spacing);s[s.length-1].subtiers[0].glyphs.unshift(d)}if(s.forEach(function(e){i.save(),c.paint(e,i,n,!0),i.restore()}),e.drawOverlay(),t.quant){var g=c.createQuantOverlay(e,f+2*e.padding,n);c.paintQuant(g,e,t.quant,10)}"function"==typeof e.dasSource.drawCallback&&e.dasSource.drawCallback(i,e),e.originHaxx=0,e.browser.arrangeTiers()}function o(e,t,r,i){var n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:!0,s=e.browser.featurePanelWidth+2e3;r&&(s*=2);var o=0|e.viewport.width;s-50>o&&(e.viewport.width=o=s),i+=2*e.padding,i=Math.max(i,e.browser.minTierHeight),i!=e.viewport.height&&(e.viewport.height=i,r&&(e.viewport.height*=2)),e.viewportHolder.style.left="-1000px",e.viewport.style.width=r?""+o/2+"px":""+o+"px",e.viewport.style.height=""+i+"px",e.layoutHeight=Math.max(i,e.browser.minTierHeight),e.updateHeight(),e.norigin=e.browser.viewStart,n&&c.clearViewport(t,o,i),c.drawUnmapped(e,t,i)}Object.defineProperty(r,"__esModule",{value:!0}),r.drawTier=r.renderTier=void 0;var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},l=e("./sequence-draw.js"),u=e("./glyphs.js"),h=e("./default-renderer"),c=i(h),f=e("ramda"),p=i(f);r.renderTier=n,r.drawTier=s},{"./default-renderer":11,"./glyphs.js":23,"./sequence-draw.js":36,ramda:63}],30:[function(e,t,r){"use strict";function i(e){return(0|e).toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")}function n(e){var t=""+e,r=t.indexOf(".");if(0>r)return t;var i=2;return"-"==t.substring(0,1)&&++i,r>=i?t.substring(0,r):t.substring(0,r+2)}"undefined"!=typeof t&&(t.exports={formatLongInt:i,formatQuantLabel:n})},{}],31:[function(e,t,r){"use strict";function i(e,t){this.sources=e,this.opts=t||{},this.activityListeners=[],this.readinessListeners=[],this.changeListeners=[],this.business=[],this.readiness=[];for(var r=0;r=0&&this.readinessListeners.splice(t,1)},i.prototype.notifyReadiness=function(){for(var e=0;e=0&&this.activityListeners.splice(t,1)},i.prototype.notifyActivity=function(){for(var e=0,t=0;t=0&&this.changeListeners.splice(t,1)},i.prototype.notifyChange=function(){for(var e=0;e0){for(var n="",s=0;s0&&(n+=", "),n+=o)}return this.callback(n,null,this.scale)}this.callback(null,this.source.merge(this.features,this.sources),this.scale)}},i.prototype.getDefaultFIPs=function(e){for(var t=0;t0&&d.test(C[0])){e.tier_type="memstore",e.payload="vcf";var w=new RegExp("/?([^/]+?)(.vcf)?$"),x=w.exec(e.uri||e.blob.name);return x&&!e.name&&(e.name=x[1]),t(e,null)}for(var k=0;kt.min?1:e.maxe.max?1:0}function o(e,t){for(var r=0;i(r+1)0)return e;var c=h.min/s|0,p=h.max/s|0;a=Math.max(a,p),l=Math.min(l,c);for(var d=c;p>=d;++d){var g=o[d];g||(g=new n(s,d*s,(d+1)*s-1),o[d]=g),g.feature(h)}}for(var v=[],d=l;a>=d;++d){var g=o[d];if(g){var h=new f;h.segment=e[0].segment,h.min=d*s+1,h.max=(d+1)*s,h.score=g.score(),h.type="density",v.push(h)}}Date.now();return v}function a(e){this._pos=e,this._bases={},this._totalCount=0}function l(e,t,r){for(var i=p(r),n=[],s=[],o=0,a=0;a=n&&s>=t){for(var o=Math.max(t,n),a=Math.min(r,s),l=0;o-t>l;l++)i.push("N");i.push(e.seq.substr(o-n,a-o+1));for(var l=0;r-a>l;l++)i.push("N")}}return i.join("")}function h(e,t,r){for(var i=null,n=null,s=[],o=0;o0)return e;for(var c=l(h.seq,h.quals,h.cigar),p=c.seq,g=c.quals,v=h.orientation,y=h.min||0,m=h.max||0,b=0,w=y;m>=w;++w){var x=s[w];x||(x=new a(w),s[w]=x);var S=p.charAt(b),_=g.charCodeAt(b)-33;x.recordBase(S,_,v),b++}i=i?Math.min(i,y):y,n=n?Math.max(n,m):m}for(var T=u(t,i,n),C=[],b=0,w=i;n>=w;++w){var x=s[w];if(x){var h=new f;if(h.segment=e[0].segment,h.min=x.pos(),h.max=h.min,h.notes=[],h.notes=h.notes.concat(x.infoList()),h.type="base-coverage",h.suppressScore=!0,T){var k=T.charAt(b),L="Ref="+k;h.notes.unshift(L);for(var A=x.baseScoreList(k,.2),O=0;O1||S!=k)&&(R.itemRgb=r[S]),C.push(R)}}else C.push(h)}b++}return C}if("undefined"!=typeof e)var c=e("./das"),f=c.DASFeature,p=e("./cigar").parseCigar,d=e("./utils").shallowCopy;var g=[1,2,5];n.prototype.score=function(){if(0==this.cnt)return 0;if(this.hasScore)return this.tot/this.cnt;var e=this.features;e.sort(s);for(var t=-1e10,r=0,i=0,n=1;nt?(r+=l-a+1,t=l):l>t&&(r+=l-t,t=l)}return r>0?1*i/r:0},n.prototype.feature=function(e){void 0!==e.score&&(this.tot+=e.score,this.hasScore=!0),++this.cnt,this.features.push(e)},a.prototype.recordBase=function(e,t,r){if(this._bases[e]){var i=this._bases[e];i.cnt++,i.totalQual+=t,i.strandCnt[r]++}else{var n={"+":0,"-":0};n[r]++,this._bases[e]={cnt:1,totalQual:t,strandCnt:n}}this._totalCount++},a.prototype.totalCount=function(){return this._totalCount},a.prototype.pos=function(){return this._pos},a.prototype.infoList=function(){var e=[],t=this._totalCount,r="Depth="+t.toString();e.push(r);for(var i in this._bases){var n=this._bases[i],s=n.cnt,o=100*s/t,a=n.strandCnt["+"],l=n.strandCnt["-"],u=n.totalQual/s,h=[i,"=",s," (",o.toFixed(0),"%, ",a," +, ",l," -, Qual: ",u.toFixed(0),")"];e.push(h.join(""))}return e},a.prototype.baseScoreList=function(e,t){var r=[],i=this._totalCount,n=t*i;for(var s in this._bases){var o=this._bases[s].cnt;if(!(n>o||s==e)){var a={base:s,score:i};r.push(a),i-=o}}return r.push({base:e,score:i}),r},"undefined"!=typeof t&&(t.exports={downsample:o,getBaseCoverage:h})},{"./cigar":8,"./das":10,"./utils":56}],35:[function(e,t,r){"use strict";function i(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t1,n=e.browser.featurePanelWidth+2e3;i&&(n*=2);var o=0|e.viewport.width;n-50>o&&(e.viewport.width=o=n);var a=50;t&&t.seq&&(a+=25);var l=a;i&&(l*=2),e.viewport.height=l,e.viewport.style.height=""+a+"px",e.viewport.style.width=i?""+o/2+"px":""+o+"px",e.layoutHeight=a,e.updateHeight(),e.background&&(r.fillStyle=e.background,r.fillRect(0,0,o,e.viewport.height)),i&&r.scale(2,2),r.translate(1e3,0),s(e,t,r),e.norigin=e.browser.viewStart,e.viewportHolder.style.left="-1000px"}function s(e,t,r){var n=e.browser.scale,s=e.browser.viewStart-1e3/n|0,o=e.browser.viewEnd+2e3/n,a=e.browser.currentSeqMax,u=o;a>0&&o>a&&(u=a);for(var h=i(n),c=Math.max(0,(s/h|0)*h),f=e.browser.viewStart;u>=c;)r.fillStyle=c/h%2==0?"white":"black",r.strokeStyle="black",r.fillRect((c-f)*n,8,h*n,3),r.strokeRect((c-f)*n,8,h*n,3),r.fillStyle="black",r.fillText(l(c),(c-f)*n,22),c+=h;if(t&&t.seq)for(var p=s;o>=p;++p)if(p>=t.start&&p<=t.end){var d=t.seq.substr(p-t.start,1).toUpperCase(),g=e.browser.baseColors[d];if(g||(g="gray"),r.fillStyle=g,n>=8){var v=r.measureText(d).width;r.fillText(d,(p-f)*n+.5*(n-v),52)}else r.fillRect((p-f)*n,42,n,12)}}function o(e,t){var r=e.browser.scale,n=e.browser.viewStart-1e3/r|0,s=e.browser.viewEnd+2e3/r,o=e.browser.currentSeqMax,a=(0|e.viewport.width,s);o>0&&s>o&&(a=o);for(var h=i(r),f=Math.max(0,(n/h|0)*h),p=e.browser.viewStart,d=u(c,"g",[],{fontSize:"8pt"});a>=f;)d.appendChild(u(c,"rect",null,{x:(f-p)*r,y:8,width:h*r,height:3,fill:f/h%2==0?"white":"black",stroke:"black"})),d.appendChild(u(c,"text",l(f),{x:(f-p)*r,y:28,fill:"black",stroke:"none"})),f+=h;if(t&&t.seq)for(var g=n;s>=g;++g)if(g>=t.start&&g<=t.end){var v=t.seq.substr(g-t.start,1).toUpperCase(),y=e.browser.baseColors[v];y||(y="gray"),r>=8?d.appendChild(u(c,"text",v,{x:(.5+g-p)*r,y:52,textAnchor:"middle",fill:y})):d.appendChild(u(c,"rect",null,{x:(g-p)*r,y:42,width:r,height:12,fill:y}))}return d}if("undefined"!=typeof e)var a=e("./utils"),l=a.formatLongInt,u=a.makeElementNS,h=e("./svg-utils"),c=h.NS_SVG,f=(h.NS_XLINK,h.SVGPath,e("./numformats")),l=f.formatLongInt;var p=100,d=[1,2,5],c="http://www.w3.org/2000/svg";"undefined"!=typeof t&&(t.exports={drawSeqTier:n,drawSeqTierGC:s,svgSeqTier:o})},{"./numformats":30,"./svg-utils":45,"./utils":56}],37:[function(e,t,r){"use strict";if("undefined"!=typeof e)var i=e("./cbrowser"),n=i.Browser,s=e("./sourcecompare"),o=s.sourceDataURI,a=s.sourcesAreEqual,l=e("./version"),u=e("./utils"),h=u.miniJSONify,c=e("./sha1"),f=c.hex_sha1;n.prototype.nukeStatus=function(){delete localStorage["dalliance."+this.cookieKey+".view-chr"],delete localStorage["dalliance."+this.cookieKey+".view-start"],delete localStorage["dalliance."+this.cookieKey+".view-end"],delete localStorage["dalliance."+this.cookieKey+".current-seq-length"],delete localStorage["dalliance."+this.cookieKey+".showing-alt-zoom"],delete localStorage["dalliance."+this.cookieKey+".saved-zoom"],delete localStorage["dalliance."+this.cookieKey+".sources"],delete localStorage["dalliance."+this.cookieKey+".hubs"],delete localStorage["dalliance."+this.cookieKey+".version"],delete localStorage["dalliance."+this.cookieKey+".reverse-scrolling"],delete localStorage["dalliance."+this.cookieKey+".reverse-key-scrolling"],delete localStorage["dalliance."+this.cookieKey+".ruler-location"]},n.prototype.storeStatus=function(){this.storeViewStatus(),this.storeTierStatus()},n.prototype.storeViewStatus=function(){!this.cookieKey||this.noPersist||this.noPersistView||(localStorage["dalliance."+this.cookieKey+".view-chr"]=this.chr,localStorage["dalliance."+this.cookieKey+".view-start"]=0|this.viewStart,localStorage["dalliance."+this.cookieKey+".view-end"]=0|this.viewEnd,localStorage["dalliance."+this.cookieKey+".showing-alt-zoom"]=""+this.isSnapZooming,localStorage["dalliance."+this.cookieKey+".saved-zoom"]=this.savedZoom,this.currentSeqMax&&(localStorage["dalliance."+this.cookieKey+".current-seq-length"]=this.currentSeqMax))},n.prototype.storeTierStatus=function(){if(this.cookieKey&&!this.noPersist){for(var e=[],t=0;t=0;--e)this.removeTier({index:e},!0);for(var e=0;e>>4&15)+r.charAt(15&t);return i}function a(e){for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r="",i=e.length,n=0;i>n;n+=3)for(var s=e.charCodeAt(n)<<16|(i>n+1?e.charCodeAt(n+1)<<8:0)|(i>n+2?e.charCodeAt(n+2):0),o=0;4>o;o++)r+=8*n+6*o>8*e.length?y:t.charAt(s>>>6*(3-o)&63);return r}function l(e){for(var t,r,i="",n=-1;++n=55296&&56319>=t&&r>=56320&&57343>=r&&(t=65536+((1023&t)<<10)+(1023&r),n++),127>=t?i+=String.fromCharCode(t):2047>=t?i+=String.fromCharCode(192|t>>>6&31,128|63&t):65535>=t?i+=String.fromCharCode(224|t>>>12&15,128|t>>>6&63,128|63&t):2097151>=t&&(i+=String.fromCharCode(240|t>>>18&7,128|t>>>12&63,128|t>>>6&63,128|63&t));return i}function u(e){for(var t=Array(e.length>>2),r=0;r>5]|=(255&e.charCodeAt(r/8))<<24-r%32;return t}function h(e){for(var t="",r=0;r<32*e.length;r+=8)t+=String.fromCharCode(e[r>>5]>>>24-r%32&255);return t}function c(e,t){e[t>>5]|=128<<24-t%32,e[(t+64>>9<<4)+15]=t;for(var r=Array(80),i=1732584193,n=-271733879,s=-1732584194,o=271733878,a=-1009589776,l=0;lm;m++){16>m?r[m]=e[l+m]:r[m]=g(r[m-3]^r[m-8]^r[m-14]^r[m-16],1);var b=d(d(g(i,5),f(m,n,s,o)),d(d(a,r[m]),p(m)));a=o,o=s,s=g(n,30),n=i,i=b}i=d(i,u),n=d(n,h),s=d(s,c),o=d(o,v),a=d(a,y)}return Array(i,n,s,o,a)}function f(e,t,r,i){return 20>e?t&r|~t&i:40>e?t^r^i:60>e?t&r|t&i|r&i:t^r^i}function p(e){return 20>e?1518500249:40>e?1859775393:60>e?-1894007588:-899497514}function d(e,t){var r=(65535&e)+(65535&t),i=(e>>16)+(t>>16)+(r>>16);return i<<16|65535&r}function g(e,t){return e<>>32-t}var v=0,y="";"undefined"!=typeof t&&(t.exports={b64_sha1:n,hex_sha1:i})},{}],39:[function(e,t,r){"use strict";function i(e,t){ie[e]=t}function n(e,t){ne[e]=t}function s(e){return ne[e]?ne[e](e):void 0}function o(e){var t=this;this.source=e,this.cfsid="cfs"+ ++se,e.name&&(this.name=e.name),e.addChangeListener&&e.addChangeListener(function(){t.cfsid="cfs"+ ++se})}function a(){this.busy=0,this.activityListeners=[],this.readinessListeners=[],this.readiness=null}function l(e){this.dasSource=new I(e),this.busy=0,this.activityListeners=[]}function u(e){this.dasSource=new I(e),this.awaitedEntryPoints=new k;var t=this;this.dasSource.entryPoints(function(e){t.awaitedEntryPoints.provide(e)})}function h(e){var t=this;this.source=e,this.twoBit=new k;var r;if(e.twoBitURI)r=new G(e.twoBitURI,{credentials:e.credentials,resolver:e.resolver});else{if(!e.twoBitBlob)throw Error("No twoBitURI or twoBitBlob parameter");r=new D(e.twoBitBlob)}U(r,function(e,r){r?console.log(r):t.twoBit.provide(e)})}function c(e){this.source=e}function f(e){a.call(this);var t=this;if(this.readiness="Connecting",this.bwgSource=this.opts=e,t.bwgHolder=new k,this.opts.preflight){var r=oe[this.opts.preflight];if(!r){r=new k,oe[this.opts.preflight]=r;var i=new XMLHttpRequest;i.onreadystatechange=function(){4==i.readyState&&(200==i.status?r.provide("success"):r.provide("failure"))},i.open("get",this.opts.preflight+"?"+hex_sha1("salt"+Date.now()),!0),this.opts.credentials&&(i.withCredentials=!0),i.send()}r.await(function(e){"success"===e&&t.init()})}else t.init()}function p(e,t,r){a.call(this);this.worker=t,this.readiness="Connecting",this.bwgSource=this.opts=e,this.keyHolder=new k,e.resolver&&(this.resolverKey=r.registerResolver(e.resolver)),this.init()}function d(e,t){if(!(e.flag&X.SEGMENT_UNMAPPED)){var r;if(r=e.seq?e.seq.length:e.seqLength,e.cigar){r=0;for(var i=Y(e.cigar),n=0;n=0&&this.readinessListeners.splice(t,1)},a.prototype.notifyReadiness=function(){for(var e=0;e=0&&this.activityListeners.splice(t,1)},a.prototype.notifyActivity=function(){for(var e=0;e=0&&this.activityListeners.splice(t,1)},l.prototype.notifyActivity=function(){for(var e=0;e=0){var n=this;if(this.dasAdjLock)return console.log("Already looking for a next feature, be patient!");this.dasAdjLock=!0;var s={adjacent:e+":"+(0|t)+":"+(r>0?"F":"B")},o=thisTier.getDesiredTypes(thisTier.browser.scale);o&&(s.types=o),thisTier.dasSource.features(null,s,function(e){n.dasAdjLock=!1,e.length>0&&null!==e[0]&&i(e[0])})}},u.prototype.fetch=function(e,t,r,i,n){this.dasSource.sequence(new M(e,t,r),function(e){return 1==e.length?n(null,e[0]):n("Didn't get sequence")})},u.prototype.getSeqInfo=function(e,t){this.awaitedEntryPoints.await(function(r){for(var i=0;i=300)){i=JSON.parse(o.response);var s=new H(e,t,r,"DNA",i.seq);return n(null,s)}var a="Error code "+o.status;try{i=JSON.parse(o.response),i.error&&(a=i.error)}finally{n(a,null)}}},o.open("GET",s,!0),o.responseType="text",o.send()},c.prototype.getSeqInfo=function(e,t){var r=this.source.ensemblURI+"/info/assembly/"+this.source.species+"/"+e+"?content-type=application/json",i=new XMLHttpRequest;i.onreadystatechange=function(){if(4==i.readyState)if(i.status>=300)t();else{var e=JSON.parse(i.response);t(e)}},i.open("GET",r,!0),i.responseType="text",i.send()},l.prototype.getScales=function(){return[]};var oe={};f.prototype=Object.create(a.prototype),f.prototype.init=function(){var e,t=this,r=this.bwgSource.uri||this.bwgSource.bwgURI;e=r?"encode"===this.bwgSource.transport?new re(r,{credentials:this.opts.credentials}):new G(r,{credentials:this.opts.credentials,resolver:this.opts.resolver}):new D(this.bwgSource.bwgBlob),j(e,function(e,r){r?(t.error=r,t.readiness=null,t.notifyReadiness(),t.bwgHolder.provide(null)):(t.bwgHolder.provide(e),t.readiness=null,t.notifyReadiness(),"bigbed"==e.type&&e.getExtraIndices(function(e){t.extraIndices=e}))})},f.prototype.capabilities=function(){var e={leap:!0};if(this.bwgHolder.res&&"bigwig"==this.bwgHolder.res.type&&(e.quantLeap=!0),this.extraIndices&&this.extraIndices.length>0){e.search=[];for(var t=0;t=0;a.opts.clientBin&&(u=!1);var h=a.opts.scaleFactor||1;if("bigwig"==s.type||u||"undefined"!=typeof a.opts.forceReduction){for(var c=-1,f=0;fc?s.getUnzoomedView():s.getZoomedView(c)}else l=s.getUnzoomedView();a.busy++,a.notifyActivity(),l.readWigData(e,t,r,function(e){a.busy--,a.notifyActivity();var i=1e9;if("bigwig"===s.type){var n=(r-t)/e.length/2;i>n&&(i=n)}if(a.opts.link)for(var l=0;l0&&null!==e[0]&&i(e[0])})},f.prototype.getScales=function(){var e=this.bwgHolder.res;if(e){for(var t=[1],r=0;r=14&&(r.geneHint=!0),e(r)})},p.prototype=Object.create(a.prototype),p.prototype.init=function(){var e=this,t=this.uri||this.bwgSource.uri||this.bwgSource.bwgURI,r=this.bwgSource.blob||this.bwgSource.bwgBlob,i=function(t,r){e.readiness=null,e.notifyReadiness(),t?e.worker.postCommand({command:"meta",connection:t},function(r,i){i?(e.error=i,e.keyHolder.provide(null)):(e.meta=r,e.keyHolder.provide(t))}):(e.error=r,e.keyHolder.provide(null))};r?this.worker.postCommand({command:"connectBBI",blob:r},i):this.worker.postCommand({command:"connectBBI",uri:O(t),resolver:this.resolverKey,transport:this.bwgSource.transport,credentials:this.bwgSource.credentials},i)},p.prototype.capabilities=function(){var e={leap:!0};if(this.meta&&"bigwig"==this.meta.type&&(e.quantLeap=!0),this.meta&&this.meta.extraIndices&&this.meta.extraIndices.length>0){e.search=[];for(var t=0;t=0;if(a.opts.clientBin&&(u=!1),"bigwig"==a.meta.type||u||"undefined"!=typeof a.opts.forceReduction){for(var h=1;hs&&(n=s)}if(a.opts.link)for(var l=0;l0&&null!==e[0]&&i(e[0])})},p.prototype.getScales=function(){var e=this.meta;return e?e.zoomLevels:null},p.prototype.search=function(e,t){if(!this.meta.extraIndices||0===this.meta.extraIndices.length)return t(null,"No indices available");var r=this;this.busy++,this.notifyActivity();var i=this.meta.extraIndices[0];this.worker.postCommand({command:"search",connection:this.keyHolder.res,query:e,index:i},function(e,i){r.busy--,r.notifyActivity(),t(e,i)})},p.prototype.getDefaultFIPs=function(e){if(this.opts.noExtraFeatureInfo)return!0;var t=this;this.keyHolder.await(function(r){var i=t.meta;if(i&&i.schema&&i.definedFieldCount=14&&(n.geneHint=!0),e(n)})},g.prototype=Object.create(a.prototype),g.prototype.init=function(){var e,t,r=this;this.bamSource.bamBlob?(e=new D(this.bamSource.bamBlob),t=new D(this.bamSource.baiBlob)):(e=new G(this.bamSource.bamURI,{credentials:this.opts.credentials,resolver:this.opts.resolver}),t=new G(this.bamSource.baiURI||this.bamSource.bamURI+".bai",{credentials:this.opts.credentials,resolver:this.opts.resolver})),V(e,t,null,function(e,t){r.readiness=null,r.notifyReadiness(),e?r.bamHolder.provide(e):(r.error=t,r.bamHolder.provide(null))})},g.prototype.fetch=function(e,t,r,i,n,s,o){var a=n&&1==n.length&&"density"==n[0],l=this;l.busy++,l.notifyActivity(),this.bamHolder.await(function(i){return i?void i.fetch(e,t,r,function(e,t){if(l.busy--,l.notifyActivity(),t)o(t,null,null);else{for(var r=[],i=0;i=0&&this.activityListeners.splice(t,0)},y.prototype.notifyActivity=function(){for(var e=0;ei.end+t?(r.push(i),i=s):i=new M(i.name,Math.min(i.start,s.start),Math.max(i.end,s.end))}return r.push(i),r},y.prototype.fetch=function(e,t,r,i,n,s,o,a){var l=this,u=r-t+1;l.busy++,l.notifyActivity(),this.mapping.sourceBlocksForRange(e,t,r,function(e){if(0===e.length)l.busy--,l.notifyActivity(),o("No mapping available for this regions",[],i);else{e=l.simplifySegments(e,Math.max(100,.05*u));var t,r=[],h=null,c=e.length;e.map(function(e){l.source.fetch(e.name,e.start,e.end,i,n,s,function(i,n,s){if(i&&!t&&(t=i),n)for(var a=0;a0&&r.push(u);else for(var d=0;di._max&&(i._max=e._max):(r.push(i),i=e)}),r.push(i),this._ranges=r}function s(e,t){return e instanceof n||(e instanceof Array||(e=[e]),e=new n(e)),t&&e.insertRange(t),e}function o(e,t){for(var r=e.ranges(),s=t.ranges(),o=r.length,a=s.length,l=0,u=0,h=[];o>l&&a>u;){var e=r[l],t=s[u],c=Math.max(e.min(),t.min()),f=Math.min(e.max(),t.max());f>=c&&h.push(new i(c,f)),e.max()>t.max()?++u:++l}return 0==h.length?null:1==h.length?h[0]:new n(h)}function a(e){for(var t=0,r=e.ranges(),i=0;it.min()?1:e.max()e.max()?1:0}function u(e,t){return e._mint._min?1:e._maxe._max?1:0}i.prototype.min=function(){return this._min},i.prototype.max=function(){return this._max},i.prototype.contains=function(e){return e>=this._min&&e<=this._max},i.prototype.isContiguous=function(){return!0},i.prototype.ranges=function(){return[this]},i.prototype._pushRanges=function(e){e.push(this)},i.prototype.toString=function(){return"["+this._min+"-"+this._max+"]"},n.prototype.min=function(){return this._ranges[0].min()},n.prototype.max=function(){return this._ranges[this._ranges.length-1].max()},n.prototype.lower_bound=function(e){var t=this.ranges();if(e>this.max())return t.length;if(e=r;){var n=Math.floor((r+i)/2);if(e>t[n]._max)r=n+1;else{if(!(ee._max&&(e._max=r[i]._max),this._ranges.splice(t,i-t+1,e)},n.prototype.isContiguous=function(){return this._ranges.length>1},n.prototype.ranges=function(){return this._ranges},n.prototype._pushRanges=function(e){for(var t=0;t0&&(e+=","),e+=this._ranges[t].toString();return e},"undefined"!=typeof t&&(t.exports={Range:i,union:s,intersection:o,coverage:a,rangeOver:l,_rangeOrder:u})},{}],42:[function(e,t,r){"use strict";function i(e,t,r){this.type=e,this.method=t,this.label=r}function n(e){if(this._filters={},e)for(var t=0;t"},n.prototype.add=function(e){var t=e.toString();this._filters[t]||(this._filters[t]=e,this._list=null)},n.prototype.addAll=function(e){for(var t=e.list(),r=0;r40&&(D=1+(G/20|0));var q=G/(D-1),U=(N.max-N.min)/(D-1),z=new f;z.moveTo(y+5,x),z.lineTo(y,x),z.lineTo(y,x+M.height),z.lineTo(y+5,x+M.height);for(var j=1;D-1>j;++j){var W=j*q;z.moveTo(y,x+W),z.lineTo(y+3,x+W)}L.appendChild(o(h,"path",null,{d:z.toPathData(),fill:"none",stroke:"black",strokeWidth:"2px"})),L.appendChild(o(h,"text",d(N.max),{x:y-3,y:x+7,textAnchor:"end"})),L.appendChild(o(h,"text",d(N.min),{x:y-3,y:x+M.height,textAnchor:"end"}));for(var j=1;D-1>j;++j){var W=j*q;L.appendChild(o(h,"text",d(1*N.max-j*U),{x:y-3,y:x+W+3,textAnchor:"end"}))}}x+=M.height+r}t>x-A&&(x=A+t)}var V;V="string"==typeof T.config.name?T.config.name:T.dasSource.name,L.appendChild(o(h,"text",V,{x:y-(B?20:12),y:(x+A+8)/2,fontSize:"10pt",textAnchor:"end"})),O.setAttribute("height",x-A),S.appendChild(o(h,"g",[k,L])),T.subtiers=T.backupSubtiers,T.originHaxx=T.backupOriginHaxx,T.layoutHeight=T.backupLayoutHeight}if(e.highlights)for(var X=this.highlights||[],K=0;Kthis.viewStart){var Z=(Math.max(G.min,this.viewStart)-this.viewStart)*this.scale,Q=(Math.min(G.max,this.viewEnd)-this.viewStart)*this.scale;S.appendChild(o(h,"rect",null,{x:y+Z,y:70,width:Q-Z,height:x-70,stroke:"none",fill:this.defaultHighlightFill,fillOpacity:this.defaultHighlightAlpha}))}}var Y=-1;"center"==e.ruler?Y=y+(this.viewEnd-this.viewStart)*this.scale/2:"left"==e.ruler?Y=y:"right"==e.ruler&&(Y=y+(this.viewEnd-this.viewStart)*this.scale),Y>=0&&S.appendChild(o(h,"line",null,{x1:Y,y1:70,x2:Y,y2:x,stroke:"blue"})),v.appendChild(S),p.documentElement.setAttribute("width",u.featurePanelWidth+20+y),p.documentElement.setAttribute("height",x+50),this.featurePanelWidth=n,this.scale=s;var $=void 0;if("undefined"!=typeof XMLSerializer)$=(new XMLSerializer).serializeToString(p);else{var J=p.documentElement;J.setAttribute("xmlns","http://www.w3.org/2000/svg"),$=J.outerHTML}return e.output&&"string"===e.output?$:new Blob([$],{type:"image/svg+xml"})}},{"./cbrowser":6,"./numformats":30,"./sequence-draw":36,"./svg-utils":45,"./utils":56,"./version":58}],45:[function(e,t,r){"use strict";function i(){this.ops=[]}var n="http://www.w3.org/2000/svg",s="http://www.w3.org/1999/xlink";i.prototype.moveTo=function(e,t){ this.ops.push("M "+e+" "+t)},i.prototype.lineTo=function(e,t){this.ops.push("L "+e+" "+t)},i.prototype.closePath=function(){this.ops.push("Z")},i.prototype.toPathData=function(){return this.ops.join(" ")},"undefined"!=typeof t&&(t.exports={NS_SVG:n,NS_XLINK:s,SVGPath:i})},{}],46:[function(e,t,r){"use strict";function i(e){a.call(this),this.readiness="Connecting",this.source=e,this.tabixHolder=new f;var t=this,r=o(e.payload);if(!r)throw"Unsuported tabix payload "+e.payload;this.parser=r;var i,n;this.source.blob?(i=new h(this.source.blob),n=new h(this.source.indexBlob)):(i=new u(this.source.uri,{credentials:this.source.credentials,resolver:this.source.resolver}),n=new u(this.source.indexURI||this.source.uri+".tbi",{credentials:this.source.credentials,resolver:this.source.resolver})),p(i,n,function(e,i){t.tabixHolder.provide(e),e.fetchHeader(function(e,t){if(e){for(var i=r.createSession(function(){}),n=0;nf;++f){for(var p="";;){var d=i[u++];if(0==d)break;p+=String.fromCharCode(d)}n.chrToIndex[p]=f,0==p.indexOf("chr")?n.chrToIndex[p.substring(3)]=f:n.chrToIndex["chr"+p]=f,n.indexToChr.push(p)}for(var g=1e9,v=0;a>v;++v){var y=u,m=l(i,u);u+=4;for(var b=0;m>b;++b){var w=(l(i,u),l(i,u+4));u+=8+16*w}var x=l(i,u);u+=4;for(var S=u,f=0;x>f;++f){var _=h(i,S);if(S+=8,_){var T=_.block;_.offset>0&&(T+=65536),g>T&&(g=T);break}}u+=8*x;m>0&&(n.indices[v]=new Uint8Array(t,y,u-y))}n.headerMax=g,r(n)},{timeout:5e4})}var s=21578324;if("undefined"!=typeof e)var o=e("./spans"),a=(o.Range,o.union,o.intersection,e("./bin")),l=a.readInt,u=(a.readShort,a.readByte,a.readInt64,a.readFloat,e("./lh3utils")),h=u.readVob,c=u.unbgzf,f=u.reg2bins,p=u.Chunk;i.prototype.blocksForRange=function(e,t,r){var i=this.indices[e];if(!i)return[];for(var n=f(t,r),s=[],o=0;og;++g){var v=l(i,d),y=l(i,d+4);if(d+=8,s[v])for(var m=0;y>m;++m){var b=h(i,d,!0),w=h(i,d+8,!0);(4681>v?u:a).push(new p(b,w)),d+=16}else d+=16*y}for(var x=l(i,d),S=null,_=Math.min(t>>14,x-1),T=Math.min(r>>14,x-1),o=_;T>=o;++o){var C=h(i,d+4+8*o);C&&(!S||C.block=S.block&&L.maxv.offset>=S.offset&&k.push(L)}u=k;for(var A=[],o=0;o0){for(var E=A[0],o=1;o=a.length)return i(h);if(u){var e=new Uint8Array(u);return s.readRecords(e,a[f].minv.offset,h,t,r,l),u=null,++f,n()}var o=a[f],p=o.minv.block,d=o.maxv.block+65536;s.data.slice(p,d-p).fetch(function(e){return u=c(e,o.maxv.block-o.minv.block+1),n()})}var s=this,o=this.chrToIndex[e];if(void 0==o)return i([]);var a,l=this.indexToChr[o];void 0===o?a=[]:(a=this.blocksForRange(o,t,r),a||i(null,"Error in index fetch"));var u,h=[],f=0;n()},i.prototype.readRecords=function(e,t,r,i,n,s){e:for(;;){for(var o="";t0&&(h=parseInt(l[this.colEnd-1])),65536&this.format&&++u,n>=u&&h>=i&&r.push(o)}continue e}o+=String.fromCharCode(a)}return}},i.prototype.fetchHeader=function(e){var t=this;t.data.slice(0,t.headerMax).fetch(function(r){if(!r)return e(null,"Fetch failed");for(var i=new Uint8Array(c(r,r.byteLength)),n=0,s="",o=[];n=12&&g&&(e.collapseSuperGroups=!0),e}return"bigWig"==p[0]&&this.bigDataUrl?(e.bwgURI=h(this._db.absURL,this.bigDataUrl),e.style=this.bigwigStyles(),e.noDownsample=!0,this.yLineOnOff&&"on"==this.yLineOnOff&&(e.quantLeapThreshold=void 0!==this.yLineMark?1*this.yLineMark:0),this._db.credentials&&(e.credentials=!0),e):"bam"==p[0]&&this.bigDataUrl?(e.bamURI=h(this._db.absURL,this.bigDataUrl),this._db.credentials&&(e.credentials=!0),e):"vcfTabix"==p[0]&&this.bigDataUrl?(e.uri=h(this._db.absURL,this.bigDataUrl),e.tier_type="tabix",e.payload="vcf",this._db.credentials&&(e.credentials=!0),e):void console.log("Unsupported "+this.type)}},n.prototype.bigwigStyles=function(){var e=this.type;if(!e){for(var t=this;t._parent&&!t.type;)t=t._parent;e=t.type}if(e){var r,i,n=e.split(/\s+/);n.length>=3&&(r=1*n[1],i=1*n[2]);var s;if(this.maxHeightPixels){var o=this.maxHeightPixels.split(/:/);3==o.length?s=0|o[1]:console.log("maxHeightPixels should be of the form max:default:min")}var a="bars";this.graphTypeDefault&&(a=this.graphTypeDefault);var l="black",u=null;this.color&&(l="rgb("+this.color+")"),this.altColor&&(u="rgb("+this.altColor+")");var h=new p,c=new d;return"points"==a?c.glyph="POINT":c.glyph="HISTOGRAM",u?(c.COLOR1=l,c.COLOR2=u):c.BGCOLOR=l,c.HEIGHT=s||30,(r||i)&&(c.MIN=r,c.MAX=i),h.pushStyle({type:"default"},null,c),h.styles}},n.prototype.bigbedStyles=function(){var e="on"==(""+this.get("itemRgb")).toLowerCase(),t=this.get("visibility")||"full",r=this.get("color");r=r?"rgb("+r+")":"blue";var i=new p,n=new d;n.glyph="BOX",n.FGCOLOR="black",n.BGCOLOR=r,n.HEIGHT="full"==t||"pack"==t?12:8,n.BUMP="full"==t||"pack"==t,n.LABEL="full"==t||"pack"==t,n.ZINDEX=20,e&&(n.BGITEM=!0);var s=this.get("colorByStrand");if(s){var o=s.split(/\s+/),a=c(n);a.BGCOLOR="rgb("+o[0]+")",i.pushStyle({type:"bigbed",orientation:"+"},null,a);var l=c(n);l.BGCOLOR="rgb("+o[1]+")",i.pushStyle({type:"bigbed",orientation:"-"},null,l)}else i.pushStyle({type:"bigbed"},null,n);var u=new d;u.glyph="BOX",u.FGCOLOR="black",e&&(u.BGITEM=!0),u.BGCOLOR="red",u.HEIGHT=10,u.BUMP=!0,u.ZINDEX=20,i.pushStyle({type:"translation"},null,u);var h=new d;return h.glyph="BOX",h.FGCOLOR="black",h.BGCOLOR="white",h.HEIGHT=10,h.ZINDEX=10,h.BUMP=!0,h.LABEL=!0,i.pushStyle({type:"transcript"},null,h),i.styles},"undefined"!=typeof t&&(t.exports={connectTrackHub:o,THUB_COMPARE:a})},{"./das":10,"./utils":56}],50:[function(e,t,r){"use strict";if("undefined"!=typeof e)var i=e("./cbrowser"),n=i.Browser,s=e("./utils"),o=s.shallowCopy;n.prototype.mergeSelectedTiers=function(){for(var e=[],t=[],r=0;r2?e.COLOR3=T.value:e.COLOR3=null),e._gradient=null,e._plusColor=C.value,e._minusColor=k.value)},r=function(t){for(var r=h(e.stylesheet),i=e.browser.zoomForCurrentScale(),n=0;n0&&l.appendChild(a("ul",c)),s.appendChild(l);var y=a("span"," (styles for current zoom level)",null,{display:"none"}),m=a("div",["Edit",y],null,{background:"gray",paddingBottom:"5px",marginBottom:"5px",textAlign:"center"});s.appendChild(m);var b=a("input",null,{type:"text"}),w=a("input",null,{type:"checkbox",disabled:this.disablePinning}),x=a("select");x.appendChild(a("option","Histogram",{value:"HISTOGRAM"})),x.appendChild(a("option","Line Plot",{value:"LINEPLOT"})),x.appendChild(a("option","Ribbon",{value:"GRADIENT"})),x.appendChild(a("option","Scatter",{value:"SCATTER"}));var S=a("input",null,{type:"text",value:"#dd00dd"}),_=a("input",null,{type:"text",value:"#dd00dd"}),T=a("input",null,{type:"text",value:"#dd00dd"}),C=a("input",null,{type:"text",value:"#ffa07a"}),k=a("input",null,{type:"text",value:"#87cefa"});try{S.type=_.type=T.type="color",C.type=k.type="color"}catch(L){}var A=[S,_,T],O=a("i",null,{className:"fa fa-plus-circle"}),E=a("i",null,{className:"fa fa-minus-circle"}),R=1,B=a("td",A),I=function(e){R=e;for(var t=0;e>t;++t)A[t].style.display="block";for(var t=e;tR&&(I(R+1),n(null))},!1),E.addEventListener("click",function(e){R>1&&(I(R-1),n(null))},!1);var M=a("input",null,{type:"text",value:"0.0"}),P=a("input",null,{type:"text",value:"10.0"}),H=a("input",null,{type:"checkbox"}),F=a("input",null,{type:"checkbox"}),N=a("input",null,{type:"checkbox",checked:void 0!==e.quantLeapThreshold}),G=a("input",null,{type:"text",value:e.quantLeapThreshold,disabled:!N.checked}),D=a("input",null,{type:"text",value:"50"}),q=a("input",null,{type:"checkbox"}),U=a("input",null,{type:"text"}),z=a("input",null,{type:"checkbox"}),j=null;if(e.stylesheet.styles.length>0){j=e.stylesheet.styles[0].style}var W=function(){if("string"==typeof e.config.name?b.value=e.config.name:b.value=e.dasSource.name,w.checked=e.pinned,e.forceHeight?D.value=""+e.forceHeight:j&&j.HEIGHT&&(D.value=""+j.HEIGHT),"number"==typeof e.quantLeapThreshold?(N.checked=!0,G.disabled=!1,parseFloat(G.value)!=e.quantLeapThreshold&&(G.value=e.quantLeapThreshold)):(N.checked=!1,G.disabled=!0),"number"==typeof e.subtierMax?U.value=""+e.subtierMax:U.value=""+(e.dasSource.subtierMax||e.browser.defaultSubtierMax),e.stylesheet.styles.length>0){for(var t=null,r=!1,n=!1,s=e.browser.zoomForCurrentScale(),o=0,a=0;a0&&e.mergeConfig({subtierMax:r})},!1),this.showToolPanel(s),this.setUiMode("tier"),e.addTierListener(W);var ce=e.browser.scale;e.browser.addViewListener(function(){e.browser.scale!=ce&&(ce=e.browser.scale,W())})}}},{"./cbrowser":6,"./color":9,"./das":10,"./sourcecompare":40,"./utils":56}],52:[function(e,t,r){"use strict";function i(e,t,r,i){var n=this;if(this.config=r||{},this.id="tier"+ ++_,this.browser=e,this.dasSource=l(t),this.background=i,this.viewport=o("canvas",null,{width:""+((0|this.browser.featurePanelWidth)+2e3),height:"30",className:"viewport_12_5"},{position:"inline-block",margin:"0px",border:"0px"}),this.viewportHolder=o("div",this.viewport,{className:"viewport-holder_12_5"},{background:i,position:"absolute",padding:"0px",margin:"0px",border:"0px",left:"-1000px",minHeight:"200px"}),this.overlay=o("canvas",null,{width:+(0|this.browser.featurePanelWidth),height:"30",className:"viewport-overlay"}),this.notifier=o("div","",{className:"notifier"}),this.notifierHolder=o("div",this.notifier,{className:"notifier-holder"}),this.quantOverlay=o("canvas",null,{width:"50",height:"56",className:"quant-overlay"}),this.removeButton=o("i",null,{className:"fa fa-times"}),this.bumpButton=o("i",null,{className:"fa fa-plus-circle"}),this.loaderButton=e.makeLoader(16),this.loaderButton.style.display="none",this.infoElement=o("div",this.dasSource.desc,{className:"track-label-info"}),this.nameButton=o("div",[],{className:"tier-tab"}),this.nameButton.appendChild(this.removeButton),t.pennant)this.nameButton.appendChild(o("img",null,{src:t.pennant,width:"16",height:"16"}));else if(t.mapping){var s=null;this.browser.chains[t.mapping]&&(s=this.browser.chains[t.mapping].coords.version),s&&this.nameButton.appendChild(o("span",""+s,null,{fontSize:"8pt",background:"black",color:"white",paddingLeft:"3px",paddingRight:"3px",paddingTop:"1px",paddingBottom:"1px",marginLeft:"2px",borderRadius:"10px"}))}this.nameElement=o("span",t.name),this.nameButton.appendChild(o("span",[this.nameElement,this.infoElement],{className:"track-name-holder"})),this.nameButton.appendChild(this.bumpButton),this.nameButton.appendChild(this.loaderButton),this.label=o("span",[this.nameButton],{className:"btn-group track-label"});var a="tier"+(t.className?" "+t.className:"");this.row=o("div",[this.viewportHolder,this.overlay,this.quantOverlay],{className:a}),i||(this.row.style.background="none"),e.noDefaultLabels||this.row.appendChild(this.label),this.row.appendChild(this.notifierHolder),this.layoutHeight=25,this.bumped=!0,this.styleIdSeed=0,t.quantLeapThreshold&&(this.quantLeapThreshold=t.quantLeapThreshold),this.dasSource.collapseSuperGroups&&(this.bumped=!1),this.layoutWasDone=!1,t.featureInfoPlugin&&this.addFeatureInfoPlugin(t.featureInfoPlugin),this.initSources();var u=this;this.featureSource&&this.featureSource.getDefaultFIPs&&!t.noSourceFeatureInfo&&this.featureSource.getDefaultFIPs(function(e){e&&u.addFeatureInfoPlugin(e)}),this.featureSource&&this.featureSource.addReadinessListener&&(this.readinessListener=function(e){u.notify(e,-1)},this.featureSource.addReadinessListener(this.readinessListener)),this.featureSource&&this.featureSource.addActivityListener&&(this.activityListener=function(e){e>0?u.loaderButton.style.display="inline-block":u.loaderButton.style.display="none",u.browser.pingActivity()},this.featureSource.addActivityListener(this.activityListener)),this.listeners=[],this.featuresLoadedListeners=[],this.firstRenderPromise=new x(function(e,t){return n._resolveFirstRenderPromise=e})}var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};if("undefined"!=typeof e)var s=e("./utils"),o=s.makeElement,a=s.removeChildren,l=s.shallowCopy,u=(s.pushnew,s.miniJSONify),h=s.arrayIndexOf,c=e("./das"),f=c.DASStylesheet,p=c.DASStyle,d=e("./sha1"),g=d.b64_sha1,v=e("./style"),y=v.StyleFilter,m=v.StyleFilterSet,b=e("./sourcecompare"),w=b.sourceDataURI,x=e("es6-promise").Promise,S=e("./features").sortFeatures;var _=0;if(i.prototype.destroy=function(){this.featureSource.removeReadinessListener&&this.featureSource.removeReadinessListener(this.readinessListener),this.featureSource.removeActivityListener&&this.featureSource.removeActivityListener(this.activityListener)},i.prototype.setBackground=function(e){this.background=e,this.viewportHolder.style.background=e},i.prototype.toString=function(){return this.id},i.prototype.addFeatureInfoPlugin=function(e){this.featureInfoPlugins||(this.featureInfoPlugins=[]),this.featureInfoPlugins.push(e)},i.prototype.init=function(){var e=this;return new x(function(t,r){e.dasSource.style?(e.setStylesheet({styles:e.dasSource.style}),t(e)):(e.status="Fetching stylesheet",e.fetchStylesheet(function(r,i){if(i||!r){e.error="No stylesheet";var r=new f,n=new p;n.glyph="BOX",n.BGCOLOR="blue",n.FGCOLOR="black",r.pushStyle({type:"default"},null,n),e.setStylesheet(r)}else e.setStylesheet(r),r.geneHint&&(e.dasSource.collapseSuperGroups=!0,e.bumped=!1,e.updateLabel()),e._updateFromConfig();t(e)}))})},i.prototype.setStylesheet=function(e){this.baseStylesheet=l(e);for(var t=0;te?!0:t(this.dasSource)&&20>e?!0:!1},i.prototype.setFeatures=function(e,t,r,i,n){this.currentFeatures=i,this.currentSequence=n,this.knownChr=e,this.knownCoverage=t,i&&(S(this),this.notifyFeaturesLoaded())},i.prototype.draw=function(){console.log("Use browser.getTierRenderer(tier).drawTier(tier)")},i.prototype.findNextFeature=function(e,t,r,i,n){if(this.quantLeapThreshold){var s=this.browser.viewEnd-this.browser.viewStart+1;t=t+s*r/2|0,this.featureSource.quantFindNextFeature(e,t,r,this.quantLeapThreshold,n)}else{if(this.knownCoverage&&t>=this.knownCoverage.min()&&t<=this.knownCoverage.max()&&this.currentFeatures){for(var o=null,a=0;a0||(0>r?1==i&&l.max>=t&&l.mino.min||l.min==o.min&&l.maxo.max||l.max==o.max&&l.min=t)&&(o=l):1==i&&l.min<=t&&l.max>t?(!o||l.maxo.min)&&(o=l):l.min>t&&(!o||l.mino.max||l.max==o.max&&o.min<=t)&&(o=l)))}if(o)return n(o);t=0>r?this.browser.knownSpace.min:this.browser.knownSpace.max}this.trySourceFNF(e,t,r,n)}},i.prototype.trySourceFNF=function(e,t,r,i){var n=this;this.featureSource.findNextFeature(e,t,r,function(e){e||i(e);var t=n.browser.getSequenceSource();t||i(e),t.getSeqInfo(e.segment,function(t){t?i(e):n.trySourceFNF(e.segment,r>0?1e10:0,r,i)})})},i.prototype.updateLabel=function(){this.bumpButton.className=this.bumped?"fa fa-minus-circle":"fa fa-plus-circle",this.dasSource.collapseSuperGroups?this.bumpButton.style.display="inline-block":this.bumpButton.style.display="none"},i.prototype.updateHeight=function(){this.currentHeight=Math.max(Math.max(this.layoutHeight,this.label.clientHeight+2),this.browser.minTierHeight),this.row.style.height=""+this.currentHeight+"px",this.browser.updateHeight()},i.prototype.drawOverlay=function(){var e=this,t=this.browser,r=t.retina&&window.devicePixelRatio>1;e.overlay.height=e.viewport.height,e.overlay.width=r?2*t.featurePanelWidth:t.featurePanelWidth;var i=e.overlay.getContext("2d");r&&i.scale(2,2);var n=t.viewStart,s=t.viewStart,o=t.viewEnd;if(this.overlayLabelCanvas){var a=(this.glyphCacheOrigin-this.browser.viewStart)*this.browser.scale;i.save(),i.translate(a,0);var l=-a+2;this.dasSource.tierGroup&&(l+=15),this.overlayLabelCanvas.draw(i,l,t.featurePanelWidth-a),i.restore()}for(var u=0;us&&(i.globalAlpha=t.defaultHighlightAlpha,i.fillStyle=t.defaultHighlightFill,i.fillRect((h.min-n)*t.scale,0,(h.max-h.min)*t.scale,e.overlay.height))}e.overlay.style.width=t.featurePanelWidth,e.overlay.style.height=e.viewport.style.height,e.overlay.style.left="0px"; },i.prototype.updateStatus=function(e){var t=this;if(e){this.status=e,this._notifierToStatus();w(this.dasSource);"https:"!==window.location.protocol||0!=w(this.dasSource).indexOf("http:")||this.checkedHTTP||(this.checkedHTTP=!0,this.browser.canFetchPlainHTTP().then(function(e){e||(t.warnHTTP=!0,t._notifierToStatus())}))}else this.status&&(this.status=null,this._notifierToStatus())},i.prototype.notify=function(e,t){if("number"!=typeof t&&(t=2e3),this.notifierFadeTimeout&&(clearTimeout(this.notifierFadeTimeout),this.notifierFadeTimeout=null),e){if(this._notifierOn(e),t>0){var r=this;this.notifierFadeTimeout=setTimeout(function(){r._notifierToStatus()},t)}}else this._notifierToStatus()},i.prototype._notifierOn=function(e,t){a(this.notifier),t?this.notifier.appendChild(o("span",[o("a","[HTTP Warning] ",{href:this.browser.httpWarningURL,target:"_blank"}),e])):this.notifier.textContent=e,this.notifier.style.opacity=.8},i.prototype._notifierOff=function(){this.notifier.style.opacity=0},i.prototype._notifierToStatus=function(){this.status?this._notifierOn(this.status,this.warnHTTP):this._notifierOff()},i.prototype.setConfig=function(e){this.config=e||{},this._updateFromConfig(),this.notifyTierListeners()},i.prototype.mergeStylesheet=function(e){this.mergeConfig({stylesheet:e,stylesheetValidity:this.baseStylesheetValidity})},i.prototype.mergeConfig=function(e){for(var t in e)this.config[t]=e[t];this._updateFromConfig(),this.notifyTierListeners()},i.prototype._updateFromConfig=function(){var e=!1,t=!1;"string"==typeof this.config.name?this.nameElement.textContent=this.config.name:this.nameElement.textContent=this.dasSource.name;var r=this.config.height||this.dasSource.forceHeight;r!=this.forceHeight&&(this.forceHeight=r,e=!0),this.forceMinDynamic!=this.config.forceMinDynamic&&(this.forceMinDynamic=this.config.forceMinDynamic,e=!0);var i=void 0!=this.config.forceMin?this.config.forceMin:this.dasSource.forceMin;this.forceMin!=i&&(this.forceMin=i,e=!0),this.forceMaxDynamic!=this.config.forceMaxDynamic&&(this.forceMaxDynamic=this.config.forceMaxDynamic,e=!0);var s=void 0!=this.config.forceMax?this.config.forceMax:this.dasSource.forceMax;this.forceMax!=s&&(this.forceMax=s,e=!0);var o=null;void 0!==this.config.quantLeapThreshold?o=this.config.quantLeapThreshold:void 0!==this.dasSource.quantLeapThreshold&&(o=this.dasSource.quantLeapThreshold),o!=this.quantLeapThreshold&&(this.quantLeapThreshold=o,e=!0);var a=null;this.config.stylesheetValidity==this.baseStylesheetValidity&&(a=this.config.stylesheet),a=a||this.baseStylesheet,this.stylesheet!==a&&(this.stylesheet=a,e=!0);var l=void 0!==this.config.pinned?this.config.pinned:this.dasSource.pinned;l!==this.pinned&&(this.pinned=l,t=!0);var u=n("number"===this.config.subtierMax)?this.config.subtierMax:this.dasSource.subtierMax||this.browser.defaultSubtierMax;u!=this.subtierMax&&(this.subtierMax=u,e=!0);var h;h=void 0!==this.config.bumped?this.config.bumped:void 0!==this.dasSource.bumped?this.dasSource.bumped:this.dasSource.collapseSuperGroups?!1:!0,h!==this.bumped&&(this.bumped=h,e=!0,this.updateLabel()),e&&this.scheduleRedraw(),t&&this.browser.reorderTiers()},i.prototype.scheduleRedraw=function(){if(this.currentFeatures){var e=this;this.redrawTimeout||(this.redrawTimeout=setTimeout(function(){S(e);var t=e.browser.getTierRenderer(e);t.drawTier(e),e.redrawTimeout=null},10))}},i.prototype.clearTierListeners=function(){this.listeners=[]},i.prototype.addTierListener=function(e){this.listeners.push(e)},i.prototype.removeTierListener=function(e){var t=h(this.listeners,e);t>=0&&this.listeners.splice(t,1)},i.prototype.notifyTierListeners=function(e){for(var t=0;t=0&&this.featuresLoadedListeners.splice(t,1)},i.prototype.notifyFeaturesLoaded=function(){for(var e=0;e0&&"multiWig"!=l.container?s.push(l):o.push(l)}o.length>0&&s.push({shortLabel:"Others",priority:-1e8,children:o}),s.sort(p);for(var c=[],f=0;f0&&M.makeTooltip(X,l.longLabel),D.appendChild(u("td",X)),z.appendChild(D),++W}}s.length>1||"Others"!==d.shortLabel?r.appendChild(v(d.shortLabel,j,0==f)):r.appendChild(j)}}var K=function(){for(var e=0;e0)me(i);else{var e=J.value.trim();/^.+:\/\//.exec(e)||(e="http://"+e);var o={uri:e},l=e.toLowerCase();0==l.indexOf("https://www.encodeproject.org/")&&l.indexOf("@@download")>=0&&(o.transport="encode"),ge(o)}}else if("reset"===oe)s();else if("reset-bin"===oe)r();else if("reset-hub"===oe)n();else if("prompt-bai"===oe){var i=ie.files;i&&i.length>0&&i[0]?(ae.baiBlob=i[0],m(ae)):f(ae)}else if("prompt-tbi"===oe){var i=ie.files;i&&i.length>0&&i[0]?(ae.indexBlob=i[0],S(ae)):g(ae)}else if("finalize"===oe||"finalize-bin"===oe){ae.name=ee.value;var u=te.value;"__default__"!=u?ae.mapping=u:ae.mapping=void 0,re&&(ae.maxbins=re.checked),ne.value.length>1&&se.value.length>1&&(ae.xUser=ne.value,ae.xPass=se.value),M.addTier(ae),"finalize-bin"==oe?r():s()}else if("hub-connect"===oe){var e=J.value.trim();/^.+:\/\//.exec(e)||(e="http://"+e),a(e)}else if("multiple"===oe){for(var h=0;h0&&M.makeTooltip(p,a.desc),l.appendChild(u("td",p)),r.appendChild(l),++n}var d=function(){for(var e=0;e=0;--h)ye.splice(r[h],1);we()})},we=function(){h(ue);var e=!1,t=u("table",ye.filter(function(e){return!e.hidden}).map(function(t){var r=u("tr");r.appendChild(u("td",t.name||t.blob.name));var i;i=t.error?u("span","Error",null,{color:"red"}):t.tier_type?t.payload||t.tier_type:M.makeLoader(16);var n,s="unknown";if("bwg"==t.tier_type||"memstore"==t.tier_type?s="okay":"bam"==t.tier_type?s=t.indexBlob?"okay":"needs-index":"tabix"==t.tier_type&&(s=t.indexBlob?"okay":"needs-index"),"okay"==s){if(n=u("select",null,null,{width:"150px"}),n.appendChild(u("option",M.nameForCoordSystem(M.coordSystem),{value:"__default__"})),M.chains)for(var o in M.chains){var a=M.chains[o].coords;n.appendChild(u("option",M.nameForCoordSystem(a),{value:o}))}n.value=t.mapping||"__default__",n.addEventListener("change",function(e){t.mapping=n.value,console.log(t)},!1)}else"needs-index"==s&&(n=u("span","Needs index",{},{color:"red"}),e=!0);return u("tr",[u("td",t.name||t.blob.name),u("td",i),u("td",n)])}),{className:"table table-striped table-condensed"});if(ue.appendChild(t),e){ue.appendChild(u("p","Some of these files are missing required index (.bai or .tbi) files. For security reasons, web applications like Dalliance can only access local files which you have explicity selected. Please use the file chooser below to select the appropriate index file")),ue.appendChild(document.createTextNode("Index file(s): "));var r=u("input",null,{type:"file",multiple:"multiple"});ue.appendChild(r),r.addEventListener("change",function(e){console.log("fileset changed");for(var t=r.files||[],i=0;i=i.length)return o+=n,n=Math.max(g,Math.floor(o*r.seqCount/f)),r.data.slice(v+c,n).fetch(function(e){v+=c,c=0,i=new Uint8Array(e),m()});++c;for(var a="",l=1;e>=l;++l)a+=String.fromCharCode(i[c++]);var u=r.readInt(i,c);c+=4,r.seqDict[a]=new s(r,u),++f}return t(r)};y()})}function s(e,t){this.tbf=e,this.offset=t}if("undefined"!=typeof e)var o=e("./bin"),a=o.readInt,l=o.readIntBE,u=e("./spans"),h=u.Range,c=u.union,f=u.intersection;var p=440477507,d=1126646042,g=12500;i.prototype.getSeq=function(e){var t=this.seqDict[e];return t||(t=this.seqDict["chr"+e]),t},i.prototype.fetch=function(e,t,r,i){var n=this.getSeq(e);return n?t>=r?i(""):void n.fetch(t,r,i):i(null,"Couldn't find "+e)},s.prototype.init=function(e){if(this.seqOffset)return e();var t=this;t.tbf.data.slice(t.offset,8).fetch(function(r){if(!r)return e("Fetch failed");var i=new Uint8Array(r);t._length=t.tbf.readInt(i,0),t.nBlockCnt=t.tbf.readInt(i,4),t.tbf.data.slice(t.offset+8,8*t.nBlockCnt+4).fetch(function(r){if(!r)return e("Fetch failed");for(var i=new Uint8Array(r),n=null,s=0;s>2,o=t+3>>2;return 0>s||o>i.seqLength?r("Coordinates out of bounds: "+e+":"+t):void i.tbf.data.slice(i.seqOffset+s,o-s).salted().fetch(function(n){function o(e){for(;e>=p;){var t,r=(p>>2)-s,i=3&p,n=a[r];t=0==i?n>>6&3:1==i?n>>4&3:2==i?n>>2&3:3&n,c+=v[t],++p}}if(null==n)return r("SeqFetch failed");var a=new Uint8Array(n),l=[];if(i.nBlocks){var u=f(new h(e,t),i.nBlocks);u&&(l=u.ranges())}for(var c="",p=e,d=0;dg.min())throw"N mismatch...";for(p=p&&o(t),r(c)})})},s.prototype.length=function(e){var t=this;this.init(function(r){return r?e(null,r):e(t._length)})},"undefined"!=typeof t&&(t.exports={makeTwoBit:n})},{"./bin":4,"./spans":41}],56:[function(e,t,r){"use strict";function i(e,t){for(var r=0;r=0?(e.splice(r,1),!0):!1}function u(e,t,r,i){var n=document.createElement(e);if(t){t instanceof Array||(t=[t]);for(var s=0;s0;)e.removeChild(e.firstChild)}function d(e,t){if("undefined"==typeof e)return"undefined";if(null==e)return"null";if("string"==typeof e)return"'"+e+"'";if("number"==typeof e)return""+e;if("boolean"==typeof e)return""+e;if("object"==("undefined"==typeof e?"undefined":S(e))){if(e instanceof Array){for(var r=null,i=0;i=300?t(null,"Error code "+n.status):t(n.responseText))},n.open("GET",e,!0),n.responseType="text",r&&r.credentials&&(n.withCredentials=!0),n.send()}catch(s){t(null,"Exception "+s)}}function w(e,t){if(0==t.indexOf("http:")||0==t.indexOf("https:"))return t;var r=e.lastIndexOf("/");return r>=0?e.substr(0,r+1)+t:t}function x(e){return u("a",null,{href:e}).href}var S="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};if("undefined"!=typeof e)var _=e("./sha1"),T=_.b64_sha1;var C=(new RegExp("[0-9]+"),new RegExp("^[0-9]+$"),{});v.prototype.addListener=function(e){this.listeners.push(e)},v.prototype.addListenerAndFire=function(e){this.listeners.push(e),e(this.value)},v.prototype.removeListener=function(e){l(this.listeners,e)},v.prototype.get=function(){return this.value},v.prototype.set=function(e){this.value=e;for(var t=0;t]+)>/,p=/([^,=]+)=([^,]+|"[^"]+"),?/;i.prototype.createSession=function(e){return new n(this,e)},n.prototype.parse=function(e){if(0!=e.length)if("#"!=e[0]){var t=e.split(" "),r=new h;r.segment=t[0],r.id=t[2],r.refAllele=t[3],r.altAlleles=t[4].split(","),r.min=parseInt(t[1]),r.max=r.min+r.refAllele.length-1;var i=t[7].split(c);r.info={};for(var n=0;no.length?(r.type="insertion",0==s.indexOf(o)?(r.insertion=s.substr(o.length),r.min+=o.length,r.max=r.min-1):r.insertion=s):s.length1&&"#"==e[1]){var a=f.exec(e);if(a){for(var t=a[1].split(p),l=null,u=null,n=0;ne;e+=2){var t=te[e],r=te[e+1];t(r),te[e]=void 0,te[e+1]=void 0}K=0}function g(){try{var t=e,r=t("vertx");return j=r.runOnLoop||r.runOnContext,h()}catch(i){return p()}}function v(){}function y(){return new TypeError("You cannot resolve a promise with itself")}function m(){return new TypeError("A promises callback cannot return that same promise.")}function b(e){try{return e.then}catch(t){return se.error=t,se}}function w(e,t,r,i){try{e.call(t,r,i)}catch(n){return n}}function x(e,t,r){Z(function(e){var i=!1,n=w(r,t,function(r){i||(i=!0,t!==r?T(e,r):k(e,r))},function(t){i||(i=!0,L(e,t))},"Settle: "+(e._label||" unknown promise"));!i&&n&&(i=!0,L(e,n))},e)}function S(e,t){t._state===ie?k(e,t._result):t._state===ne?L(e,t._result):A(t,void 0,function(t){T(e,t)},function(t){L(e,t)})}function _(e,t){if(t.constructor===e.constructor)S(e,t);else{var r=b(t);r===se?L(e,se.error):void 0===r?k(e,t):s(r)?x(e,t,r):k(e,t)}}function T(e,t){e===t?L(e,y()):n(t)?_(e,t):k(e,t)}function C(e){e._onerror&&e._onerror(e._result),O(e)}function k(e,t){e._state===re&&(e._result=t,e._state=ie,0!==e._subscribers.length&&Z(O,e))}function L(e,t){e._state===re&&(e._state=ne,e._result=t,Z(C,e))}function A(e,t,r,i){var n=e._subscribers,s=n.length;e._onerror=null,n[s]=t,n[s+ie]=r,n[s+ne]=i,0===s&&e._state&&Z(O,e)}function O(e){var t=e._subscribers,r=e._state;if(0!==t.length){for(var i,n,s=e._result,o=0;oo;o++)A(i.resolve(e[o]),void 0,t,r);return n}function F(e){var t=this;if(e&&"object"==typeof e&&e.constructor===t)return e;var r=new t(v);return T(r,e),r}function N(e){var t=this,r=new t(v);return L(r,e),r}function G(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function D(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function q(e){this._id=fe++,this._state=void 0,this._result=void 0,this._subscribers=[],v!==e&&(s(e)||G(),this instanceof q||D(),I(this,e))}function U(){var e;if("undefined"!=typeof i)e=i;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var r=e.Promise;(!r||"[object Promise]"!==Object.prototype.toString.call(r.resolve())||r.cast)&&(e.Promise=pe)}var z;z=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)};var j,W,V,X=z,K=0,Z=({}.toString,function(e,t){te[K]=e,te[K+1]=t,K+=2,2===K&&(W?W(d):V())}),Q="undefined"!=typeof window?window:void 0,Y=Q||{},$=Y.MutationObserver||Y.WebKitMutationObserver,J="undefined"!=typeof r&&"[object process]"==={}.toString.call(r),ee="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,te=new Array(1e3);V=J?u():$?c():ee?f():void 0===Q&&"function"==typeof e?g():p();var re=void 0,ie=1,ne=2,se=new E,oe=new E;M.prototype._validateInput=function(e){return X(e)},M.prototype._validationError=function(){return new Error("Array Methods must be provided an Array")},M.prototype._init=function(){this._result=new Array(this.length)};var ae=M;M.prototype._enumerate=function(){for(var e=this,t=e.length,r=e.promise,i=e._input,n=0;r._state===re&&t>n;n++)e._eachEntry(i[n],n)},M.prototype._eachEntry=function(e,t){var r=this,i=r._instanceConstructor;o(e)?e.constructor===i&&e._state!==re?(e._onerror=null,r._settledAt(e._state,t,e._result)):r._willSettleAt(i.resolve(e),t):(r._remaining--,r._result[t]=e)},M.prototype._settledAt=function(e,t,r){var i=this,n=i.promise;n._state===re&&(i._remaining--,e===ne?L(n,r):i._result[t]=r),0===i._remaining&&k(n,i._result)},M.prototype._willSettleAt=function(e,t){var r=this;A(e,void 0,function(e){r._settledAt(ie,t,e)},function(e){r._settledAt(ne,t,e)})};var le=P,ue=H,he=F,ce=N,fe=0,pe=q;q.all=le,q.race=ue,q.resolve=he,q.reject=ce,q._setScheduler=a,q._setAsap=l,q._asap=Z,q.prototype={constructor:q,then:function(e,t){var r=this,i=r._state;if(i===ie&&!e||i===ne&&!t)return this;var n=new this.constructor(v),s=r._result;if(i){var o=arguments[i-1];Z(function(){B(i,n,o,s)})}else A(r,n,e,t);return n},"catch":function(e){return this.then(null,e)}};var de=U,ge={Promise:pe,polyfill:de};"function"==typeof define&&define.amd?define(function(){return ge}):"undefined"!=typeof t&&t.exports?t.exports=ge:"undefined"!=typeof this&&(this.ES6Promise=ge),de()}).call(this)}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:62}],61:[function(e,t,r){function i(){}function n(){this.was=[0]}function s(e,t,r){this.hufts=new Int32Array(3*g),this.window=new Uint8Array(r),this.end=r,this.checkfn=t,this.mode=z,this.reset(e,null),this.left=0,this.table=0,this.index=0,this.blens=null,this.bb=new Int32Array(1),this.tb=new Int32Array(1),this.codes=new o,this.last=0,this.bitk=0,this.bitb=0,this.read=0,this.write=0,this.check=0,this.inftree=new a}function o(){}function a(){}function l(e,t,r,i,n){return e[0]=J,t[0]=ee,r[0]=te,i[0]=re,x}function u(e,t,r,i,n){if(0!=n){if(!e)throw"Undef src";if(!r)throw"Undef dest";0==t&&n==e.length?c(e,r,i):we?c(e.subarray(t,t+n),r,i):1==e.BYTES_PER_ELEMENT&&n>100?c(new Uint8Array(e.buffer,e.byteOffset+t,n),r,i):h(e,t,r,i,n)}}function h(e,t,r,i,n){for(var s=0;n>s;++s)r[i+s]=e[t+s]}function c(e,t,r){t.set(e,r)}function f(e,t,r,n){e=t?r?new Uint8Array(e,t,r):new Uint8Array(e,t,e.byteLength-t):new Uint8Array(e);var s=new i;s.inflateInit(d,!0),s.next_in=e,s.next_in_index=0,s.avail_in=e.length;for(var o=[],a=0;;){var l=new Uint8Array(32e3);s.next_out=l,s.next_out_index=0,s.avail_out=l.length;var h=s.inflate(m);if(h!=x&&h!=S&&h!=L)throw s.msg;if(0!=s.avail_out){var c=new Uint8Array(l.length-s.avail_out);u(l,0,c,0,l.length-s.avail_out),l=c}if(o.push(l),a+=l.length,h==S||h==L)break}if(n&&(n[0]=(t||0)+s.next_in_index),1==o.length)return o[0].buffer;for(var f=new Uint8Array(a),p=0,g=0;gt&&(t=-t,nowrap=1),8>t||t>15?(this.inflateEnd(e),T):(this.wbits=t,e.istate.blocks=new s(e,0!=e.istate.nowrap?null:this,1<>4)+8>e.istate.wbits){e.istate.mode=q,e.msg="invalid window size",e.istate.marker=5;break}e.istate.mode=O;case O:if(0==e.avail_in)return r;if(r=t,e.avail_in--,e.total_in++,i=255&e.next_in[e.next_in_index++],((e.istate.method<<8)+i)%31!=0){e.istate.mode=q,e.msg="incorrect header check",e.istate.marker=5;break}if(0==(i&y)){e.istate.mode=P;break}e.istate.mode=E;case E:if(0==e.avail_in)return r;r=t,e.avail_in--,e.total_in++,e.istate.need=(255&e.next_in[e.next_in_index++])<<24&4278190080,e.istate.mode=R;case R:if(0==e.avail_in)return r;r=t,e.avail_in--,e.total_in++,e.istate.need+=(255&e.next_in[e.next_in_index++])<<16&16711680,e.istate.mode=B;case B:if(0==e.avail_in)return r;r=t,e.avail_in--,e.total_in++,e.istate.need+=(255&e.next_in[e.next_in_index++])<<8&65280,e.istate.mode=I;case I:return 0==e.avail_in?r:(r=t,e.avail_in--,e.total_in++,e.istate.need+=255&e.next_in[e.next_in_index++],e.adler=e.istate.need,e.istate.mode=M,_);case M:return e.istate.mode=q,e.msg="need dictionary",e.istate.marker=0,T;case P:if(r=e.istate.blocks.proc(e,r),r==C){e.istate.mode=q,e.istate.marker=0;break}if(r==x&&(r=t),r!=S)return r;if(r=t,e.istate.blocks.reset(e,e.istate.was),0!=e.istate.nowrap){e.istate.mode=D;break}e.istate.mode=H;case H:if(0==e.avail_in)return r;r=t,e.avail_in--,e.total_in++,e.istate.need=(255&e.next_in[e.next_in_index++])<<24&4278190080,e.istate.mode=F;case F:if(0==e.avail_in)return r;r=t,e.avail_in--,e.total_in++,e.istate.need+=(255&e.next_in[e.next_in_index++])<<16&16711680,e.istate.mode=N;case N:if(0==e.avail_in)return r;r=t,e.avail_in--,e.total_in++,e.istate.need+=(255&e.next_in[e.next_in_index++])<<8&65280,e.istate.mode=G;case G:if(0==e.avail_in)return r;if(r=t,e.avail_in--,e.total_in++,e.istate.need+=255&e.next_in[e.next_in_index++],e.istate.was[0]!=e.istate.need){e.istate.mode=q,e.msg="incorrect data check",e.istate.marker=5;break}e.istate.mode=D;case D:return S;case q:return C;default:return T}},n.prototype.inflateSetDictionary=function(e,t,r){var i=0,n=r;return null==e||null==e.istate||e.istate.mode!=M?T:e._adler.adler32(1,t,0,r)!=e.adler?C:(e.adler=e._adler.adler32(0,null,0,0),n>=1<i;)e.next_in[r]==ae[i]?i++:i=0!=e.next_in[r]?0:4-i,r++,t--;return e.total_in+=r-e.next_in_index,e.next_in_index=r,e.avail_in=t,e.istate.marker=i,4!=i?C:(n=e.total_in,s=e.total_out,this.inflateReset(e),e.total_in=n,e.total_out=s,e.istate.mode=P,x)},n.prototype.inflateSyncPoint=function(e){return null==e||null==e.istate||null==e.istate.blocks?T:e.istate.blocks.sync_point()};var le=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];s.prototype.reset=function(e,t){t&&(t[0]=this.check),this.mode==Z&&this.codes.free(e),this.mode=z,this.bitk=0,this.bitb=0,this.read=this.write=0,this.checkfn&&(e.adler=this.check=e._adler.adler32(0,null,0,0))},s.prototype.proc=function(e,t){var r,i,n,s,o,a,h;for(s=e.next_in_index,o=e.avail_in,i=this.bitb,n=this.bitk,a=this.write,h=an;){if(0==o)return this.bitb=i,this.bitk=n,e.avail_in=o,e.total_in+=s-e.next_in_index,e.next_in_index=s,this.write=a,this.inflate_flush(e,t);t=x,o--,i|=(255&e.next_in[s++])<>>1){case 0:i>>>=3,n-=3,r=7&n,i>>>=r,n-=r,this.mode=j;break;case 1:var c=new Int32Array(1),f=new Int32Array(1),p=[],d=[];l(c,f,p,d,e),this.codes.init(c[0],f[0],p[0],0,d[0],0,e),i>>>=3,n-=3,this.mode=Z;break;case 2:i>>>=3,n-=3,this.mode=V;break;case 3:return i>>>=3,n-=3,this.mode=q,e.msg="invalid block type",t=C,this.bitb=i,this.bitk=n,e.avail_in=o,e.total_in+=s-e.next_in_index,e.next_in_index=s,this.write=a,this.inflate_flush(e,t)}break;case j:for(;32>n;){if(0==o)return this.bitb=i,this.bitk=n,e.avail_in=o,e.total_in+=s-e.next_in_index,e.next_in_index=s,this.write=a,this.inflate_flush(e,t);t=x,o--,i|=(255&e.next_in[s++])<>>16&65535)!=(65535&i))return this.mode=q,e.msg="invalid stored block lengths",t=C,this.bitb=i,this.bitk=n,e.avail_in=o,e.total_in+=s-e.next_in_index,e.next_in_index=s,this.write=a,this.inflate_flush(e,t);this.left=65535&i,i=n=0,this.mode=0!=this.left?W:0!=this.last?Q:z;break;case W:if(0==o)return this.bitb=i,this.bitk=n,e.avail_in=o,e.total_in+=s-e.next_in_index,e.next_in_index=s,write=a,this.inflate_flush(e,t);if(0==h&&(a==end&&0!=read&&(a=0,h=ao&&(r=o),r>h&&(r=h),u(e.next_in,s,this.window,a,r),s+=r,o-=r,a+=r,h-=r,0!=(this.left-=r))break;this.mode=0!=this.last?Q:z;break;case V:for(;14>n;){if(0==o)return this.bitb=i,this.bitk=n,e.avail_in=o,e.total_in+=s-e.next_in_index,e.next_in_index=s,this.write=a,this.inflate_flush(e,t);t=x,o--,i|=(255&e.next_in[s++])<29||(r>>5&31)>29)return this.mode=$,e.msg="too many length or distance symbols",t=C,this.bitb=i,this.bitk=n,e.avail_in=o,e.total_in+=s-e.next_in_index,e.next_in_index=s,this.write=a,this.inflate_flush(e,t);if(r=258+(31&r)+(r>>5&31),null==this.blens||this.blens.lengthg;g++)this.blens[g]=0;i>>>=14,n-=14,this.index=0,mode=X;case X:for(;this.index<4+(this.table>>>10);){for(;3>n;){if(0==o)return this.bitb=i,this.bitk=n,e.avail_in=o,e.total_in+=s-e.next_in_index,e.next_in_index=s,this.write=a,this.inflate_flush(e,t);t=x,o--,i|=(255&e.next_in[s++])<>>=3,n-=3}for(;this.index<19;)this.blens[le[this.index++]]=0;if(this.bb[0]=7,r=this.inftree.inflate_trees_bits(this.blens,this.bb,this.tb,this.hufts,e),r!=x)return t=r,t==C&&(this.blens=null,this.mode=$),this.bitb=i,this.bitk=n,e.avail_in=o,e.total_in+=s-e.next_in_index,e.next_in_index=s,write=a,this.inflate_flush(e,t);this.index=0,this.mode=K;case K:for(;;){if(r=this.table,!(this.index<258+(31&r)+(r>>5&31)))break;var g,v,y;for(r=this.bb[0];r>n;){if(0==o)return this.bitb=i,this.bitk=n,e.avail_in=o,e.total_in+=s-e.next_in_index,e.next_in_index=s,this.write=a,this.inflate_flush(e,t);t=x,o--,i|=(255&e.next_in[s++])<y)i>>>=r,n-=r,this.blens[this.index++]=y;else{for(g=18==y?7:y-14,v=18==y?11:3;r+g>n;){if(0==o)return this.bitb=i,this.bitk=n,e.avail_in=o,e.total_in+=s-e.next_in_index,e.next_in_index=s,this.write=a,this.inflate_flush(e,t);t=x,o--,i|=(255&e.next_in[s++])<>>=r,n-=r,v+=i&U[g],i>>>=g,n-=g,g=this.index,r=this.table,g+v>258+(31&r)+(r>>5&31)||16==y&&1>g)return this.blens=null,this.mode=$,e.msg="invalid bit length repeat",t=C,this.bitb=i,this.bitk=n,e.avail_in=o,e.total_in+=s-e.next_in_index,e.next_in_index=s,this.write=a,this.inflate_flush(e,t);y=16==y?this.blens[g-1]:0;do this.blens[g++]=y;while(0!=--v);this.index=g}}this.tb[0]=-1;var c=new Int32Array(1),f=new Int32Array(1),p=new Int32Array(1),d=new Int32Array(1);if(c[0]=9,f[0]=6,r=this.table,r=this.inftree.inflate_trees_dynamic(257+(31&r),1+(r>>5&31),this.blens,c,f,p,d,this.hufts,e),r!=x)return r==C&&(this.blens=null,this.mode=q),t=r,this.bitb=i,this.bitk=n,e.avail_in=o,e.total_in+=s-e.next_in_index,e.next_in_index=s,this.write=a,this.inflate_flush(e,t);this.codes.init(c[0],f[0],this.hufts,p[0],this.hufts,d[0],e),this.mode=Z;case Z:if(this.bitb=i,this.bitk=n,e.avail_in=o,e.total_in+=s-e.next_in_index,e.next_in_index=s,this.write=a,(t=this.codes.proc(this,e,t))!=S)return this.inflate_flush(e,t);if(t=x,this.codes.free(e),s=e.next_in_index,o=e.avail_in,i=this.bitb,n=this.bitk,a=this.write,h=ae.avail_out&&(r=e.avail_out),0!=r&&t==L&&(t=x),e.avail_out-=r,e.total_out+=r,null!=this.checkfn&&(e.adler=this.check=e._adler.adler32(this.check,this.window,n,r)),u(this.window,n,e.next_out,i,r),i+=r,n+=r,n==this.end&&(n=0,this.write==this.end&&(this.write=0),r=this.write-n,r>e.avail_out&&(r=e.avail_out),0!=r&&t==L&&(t=x),e.avail_out-=r,e.total_out+=r,null!=this.checkfn&&(e.adler=this.check=e._adler.adler32(this.check,this.window,n,r)),u(this.window,n,e.next_out,i,r),i+=r,n+=r),e.next_out_index=i,this.read=n,t};var ue=0,he=1,ce=2,fe=3,pe=4,de=5,ge=6,ve=7,ye=8,me=9;o.prototype.init=function(e,t,r,i,n,s,o){this.mode=ue,this.lbits=e,this.dbits=t,this.ltree=r,this.ltree_index=i,this.dtree=n,this.dtree_index=s,this.tree=null},o.prototype.proc=function(e,t,r){var i,n,s,o,a,l,u,h=0,c=0,f=0;for(f=t.next_in_index,o=t.avail_in,h=e.bitb,c=e.bitk,a=e.write,l=a=258&&o>=10&&(e.bitb=h,e.bitk=c,t.avail_in=o,t.total_in+=f-t.next_in_index,t.next_in_index=f,e.write=a,r=this.inflate_fast(this.lbits,this.dbits,this.ltree,this.ltree_index,this.dtree,this.dtree_index,e,t),f=t.next_in_index,o=t.avail_in,h=e.bitb,c=e.bitk,a=e.write,l=ac;){if(0==o)return e.bitb=h,e.bitk=c,t.avail_in=o,t.total_in+=f-t.next_in_index,t.next_in_index=f,e.write=a,e.inflate_flush(t,r);r=x,o--,h|=(255&t.next_in[f++])<>>=this.tree[n+1],c-=this.tree[n+1],s=this.tree[n],0==s){this.lit=this.tree[n+2],this.mode=ge;break}if(0!=(16&s)){this.get=15&s,this.len=this.tree[n+2],this.mode=ce;break}if(0==(64&s)){this.need=s,this.tree_index=n/3+this.tree[n+2];break}if(0!=(32&s)){this.mode=ve;break}return this.mode=me,t.msg="invalid literal/length code",r=C,e.bitb=h,e.bitk=c,t.avail_in=o,t.total_in+=f-t.next_in_index,t.next_in_index=f,e.write=a,e.inflate_flush(t,r);case ce:for(i=this.get;i>c;){if(0==o)return e.bitb=h,e.bitk=c,t.avail_in=o,t.total_in+=f-t.next_in_index,t.next_in_index=f,e.write=a,e.inflate_flush(t,r);r=x,o--,h|=(255&t.next_in[f++])<>=i,c-=i,this.need=this.dbits,this.tree=this.dtree,this.tree_index=this.dtree_index,this.mode=fe;case fe:for(i=this.need;i>c;){if(0==o)return e.bitb=h,e.bitk=c,t.avail_in=o,t.total_in+=f-t.next_in_index,t.next_in_index=f,e.write=a,e.inflate_flush(t,r);r=x,o--,h|=(255&t.next_in[f++])<>=this.tree[n+1],c-=this.tree[n+1],s=this.tree[n],0!=(16&s)){this.get=15&s,this.dist=this.tree[n+2],this.mode=pe;break}if(0==(64&s)){this.need=s,this.tree_index=n/3+this.tree[n+2];break}return this.mode=me,t.msg="invalid distance code",r=C,e.bitb=h,e.bitk=c,t.avail_in=o,t.total_in+=f-t.next_in_index,t.next_in_index=f,e.write=a,e.inflate_flush(t,r);case pe:for(i=this.get;i>c;){if(0==o)return e.bitb=h,e.bitk=c,t.avail_in=o,t.total_in+=f-t.next_in_index,t.next_in_index=f,e.write=a,e.inflate_flush(t,r);r=x,o--,h|=(255&t.next_in[f++])<>=i,c-=i,this.mode=de;case de:for(u=a-this.dist;0>u;)u+=e.end;for(;0!=this.len;){if(0==l&&(a==e.end&&0!=e.read&&(a=0,l=a7&&(c-=8,o++,f--),e.write=a,r=e.inflate_flush(t,r),a=e.write,l=ad;)v--,p|=(255&a.next_in[g++])<>=h[L+1],d-=h[L+1],0!=(16&f)){for(f&=15,_=h[L+2]+(p&U[f]),p>>=f,d-=f;15>d;)v--,p|=(255&a.next_in[g++])<>=h[L+1],d-=h[L+1],0!=(16&f)){for(f&=15;f>d;)v--,p|=(255&a.next_in[g++])<>=f,d-=f,m-=_,y>=T)k=y-T,y-k>0&&2>y-k?(o.window[y++]=o.window[k++],o.window[y++]=o.window[k++],_-=2):(o.window[y++]=o.window[k++],o.window[y++]=o.window[k++],_-=2);else{k=y-T;do k+=o.end;while(0>k);if(f=o.end-k,_>f){if(_-=f,y-k>0&&f>y-k){do o.window[y++]=o.window[k++];while(0!=--f)}else u(o.window,k,o.window,y,f),y+=f,k+=f,f=0;k=0}}do o.window[y++]=o.window[k++];while(0!=--_);break}if(0!=(64&f))return a.msg="invalid distance code",_=a.avail_in-v,_=_>d>>3?d>>3:_,v+=_,g-=_,d-=_<<3,o.bitb=p,o.bitk=d,a.avail_in=v,a.total_in+=g-a.next_in_index,a.next_in_index=g,o.write=y,C;l+=h[L+2],l+=p&U[f],L=3*(c+l),f=h[L]}break}if(0!=(64&f))return 0!=(32&f)?(_=a.avail_in-v,_=_>d>>3?d>>3:_,v+=_,g-=_,d-=_<<3,o.bitb=p,o.bitk=d,a.avail_in=v,a.total_in+=g-a.next_in_index,a.next_in_index=g,o.write=y,S):(a.msg="invalid literal/length code",_=a.avail_in-v,_=_>d>>3?d>>3:_,v+=_,g-=_,d-=_<<3,o.bitb=p,o.bitk=d,a.avail_in=v,a.total_in+=g-a.next_in_index,a.next_in_index=g,o.write=y,C);if(l+=h[L+2],l+=p&U[f],L=3*(c+l),0==(f=h[L])){p>>=h[L+1],d-=h[L+1],o.window[y++]=h[L+2],m--;break}}else p>>=h[L+1],d-=h[L+1],o.window[y++]=h[L+2],m--}while(m>=258&&v>=10);return _=a.avail_in-v,_=_>d>>3?d>>3:_,v+=_,g-=_,d-=_<<3,o.bitb=p,o.bitk=d,a.avail_in=v,a.total_in+=g-a.next_in_index,a.next_in_index=g,o.write=y,x},a.prototype.huft_build=function(e,t,r,i,n,s,o,a,l,h,c){var f,p,d,y,m,b,w,S,_,T,k,A,O,E,R;T=0,m=r;do this.c[e[t+T]]++,T++,m--;while(0!=m);if(this.c[0]==r)return o[0]=-1,a[0]=0,x;for(S=a[0],b=1;v>=b&&0==this.c[b];b++);for(w=b,b>S&&(S=b),m=v;0!=m&&0==this.c[m];m--);for(d=m,S>m&&(S=m),a[0]=S,E=1<b;b++,E<<=1)if((E-=this.c[b])<0)return C;if((E-=this.c[m])<0)return C;for(this.c[m]+=E,this.x[1]=b=0,T=1,O=2;0!=--m;)this.x[O]=b+=this.c[T],O++,T++;m=0,T=0;do 0!=(b=e[t+T])&&(this.v[this.x[b]++]=m),T++;while(++m=w;w++)for(f=this.c[w];0!=f--;){for(;w>A+S;){if(y++,A+=S,R=d-A,R=R>S?S:R,(p=1<<(b=w-A))>f+1&&(p-=f+1,O=w,R>b))for(;++bg)return C;this.u[y]=k=this.hn[0],this.hn[0]+=R,0!=y?(this.x[y]=m,this.r[0]=b,this.r[1]=S,b=m>>>A-S,this.r[2]=k-this.u[y-1]-b,u(this.r,0,l,3*(this.u[y-1]+b),3)):o[0]=k}for(this.r[1]=w-A,T>=r?this.r[0]=192:c[T]>>A;R>b;b+=p)u(this.r,0,l,3*(k+b),3);for(b=1<>>=1)m^=b;for(m^=b,_=(1<257?(u==C?l.msg="oversubscribed distance tree":u==L?(l.msg="incomplete distance tree",u=C):u!=k&&(l.msg="empty distance tree with lengths",u=C),u):x)},a.prototype.initWorkArea=function(e){null==this.hn&&(this.hn=new Int32Array(1),this.v=new Int32Array(e),this.c=new Int32Array(v+1),this.r=new Int32Array(3),this.u=new Int32Array(v),this.x=new Int32Array(v+1)),this.v.lengtht;t++)this.v[t]=0;for(var t=0;v+1>t;t++)this.c[t]=0;for(var t=0;3>t;t++)this.r[t]=0;u(this.c,0,this.u,0,v),u(this.c,0,this.x,0,v+1)};var be=new Uint8Array(1),we="function"==typeof be.subarray;"undefined"!=typeof t&&(t.exports={inflateBuffer:f,arrayCopy:u})},{}],62:[function(e,t,r){function i(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}function s(e){if(c===setTimeout)return setTimeout(e,0);if((c===i||!c)&&setTimeout)return c=setTimeout,setTimeout(e,0);try{return c(e,0)}catch(t){try{return c.call(null,e,0)}catch(t){return c.call(this,e,0)}}}function o(e){if(f===clearTimeout)return clearTimeout(e);if((f===n||!f)&&clearTimeout)return f=clearTimeout,clearTimeout(e);try{return f(e)}catch(t){try{return f.call(null,e)}catch(t){return f.call(this,e)}}}function a(){v&&d&&(v=!1,d.length?g=d.concat(g):y=-1,g.length&&l())}function l(){if(!v){var e=s(a);v=!0;for(var t=g.length;t;){for(d=g,g=[];++y1)for(var r=1;rr;)s[s.length]=e[r],r+=1;for(r=0;n>r;)s[s.length]=t[r],r+=1;return s},u=function(e,t,r){for(var i=0,n=r.length;n>i;){if(e(t,r[i]))return!0;i+=1}return!1},h=function(e,t){for(var r=0,i=t.length,n=[];i>r;)e(t[r])&&(n[n.length]=t[r]),r+=1;return n},c=function(e){return{"@@transducer/value":e,"@@transducer/reduced":!0}},f=function(e){var t=String(e).match(/^function (\w*)/);return null==t?"":t[1]},p=function(e,t){return Object.prototype.hasOwnProperty.call(t,e)},d=function(e){return e},g=function(){var e=Object.prototype.toString;return"[object Arguments]"===e.call(arguments)?function(t){return"[object Arguments]"===e.call(t)}:function(e){return p("callee",e)}}(),v=Array.isArray||function(e){return null!=e&&e.length>=0&&"[object Array]"===Object.prototype.toString.call(e)},y=function(e){return"[object Function]"===Object.prototype.toString.call(e)},m=Number.isInteger||function(e){return e<<0===e},b=function(e){return"[object Number]"===Object.prototype.toString.call(e)},w=function(e){return"[object Object]"===Object.prototype.toString.call(e)},x=function(e){return null!=e&&"object"==typeof e&&e["@@functional/placeholder"]===!0},S=function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},_=function(e){return"[object String]"===Object.prototype.toString.call(e)},T=function(e){return"function"==typeof e["@@transducer/step"]},C=function(e,t){for(var r=0,i=t.length,n=Array(i);i>r;)n[r]=e(t[r]),r+=1;return n},k=function(e){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),r=1,i=arguments.length;i>r;){var n=arguments[r];if(null!=n)for(var s in n)p(s,n)&&(t[s]=n[s]);r+=1}return t},L=function(e){return[e]},A=function(e,t){return function(){return t.call(this,e.apply(this,arguments))}},O=function(e,t){return function(){var r=this;return e.apply(r,arguments).then(function(e){return t.call(r,e)})}},E=function(e){var t=e.replace(/\\/g,"\\\\").replace(/[\b]/g,"\\b").replace(/\f/g,"\\f").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\v/g,"\\v").replace(/\0/g,"\\0");return'"'+t.replace(/"/g,'\\"')+'"'},R=function(e){return e&&e["@@transducer/reduced"]?e:{"@@transducer/value":e,"@@transducer/reduced":!0}},B=function qn(e,t,r){switch(arguments.length){case 1:return qn(e,0,e.length);case 2:return qn(e,t,e.length);default:for(var i=[],n=0,s=Math.max(0,Math.min(e.length,r)-t);s>n;)i[n]=e[t+n],n+=1;return i}},I=function(){var e=function(e){return(10>e?"0":"")+e};return"function"==typeof Date.prototype.toISOString?function(e){return e.toISOString()}:function(t){return t.getUTCFullYear()+"-"+e(t.getUTCMonth()+1)+"-"+e(t.getUTCDate())+"T"+e(t.getUTCHours())+":"+e(t.getUTCMinutes())+":"+e(t.getUTCSeconds())+"."+(t.getUTCMilliseconds()/1e3).toFixed(3).slice(2,5)+"Z"}}(),M={init:function(){return this.xf["@@transducer/init"]()},result:function(e){return this.xf["@@transducer/result"](e)}},P=function(){function e(e){this.f=e}return e.prototype["@@transducer/init"]=function(){throw new Error("init not implemented on XWrap")},e.prototype["@@transducer/result"]=function(e){return e},e.prototype["@@transducer/step"]=function(e,t){return this.f(e,t)},function(t){return new e(t)}}(),H=function(e,t){for(var r=0,i=t.length-(e-1),n=new Array(i>=0?i:0);i>r;)n[r]=B(t,r,r+e),r+=1;return n},F="function"==typeof Object.assign?Object.assign:k,N=function(e,t){return function(){var r=arguments.length;if(0===r)return t();var i=arguments[r-1];return v(i)||"function"!=typeof i[e]?t.apply(this,arguments):i[e].apply(i,B(arguments,0,r-1))}},G=function(e){return function t(r){return 0===arguments.length||x(r)?t:e.apply(this,arguments)}},D=function(e){return function t(r,i){switch(arguments.length){case 0:return t;case 1:return x(r)?t:G(function(t){return e(r,t)});default:return x(r)&&x(i)?t:x(r)?G(function(t){return e(t,i)}):x(i)?G(function(t){return e(r,t)}):e(r,i)}}},q=function(e){return function t(r,i,n){switch(arguments.length){case 0:return t;case 1:return x(r)?t:D(function(t,i){return e(r,t,i)});case 2:return x(r)&&x(i)?t:x(r)?D(function(t,r){return e(t,i,r)}):x(i)?D(function(t,i){return e(r,t,i)}):G(function(t){return e(r,i,t)});default:return x(r)&&x(i)&&x(n)?t:x(r)&&x(i)?D(function(t,r){return e(t,r,n)}):x(r)&&x(n)?D(function(t,r){return e(t,i,r)}):x(i)&&x(n)?D(function(t,i){return e(r,t,i)}):x(r)?G(function(t){return e(t,i,n)}):x(i)?G(function(t){return e(r,t,n)}):x(n)?G(function(t){return e(r,i,t)}):e(r,i,n)}}},U=function Un(e,t,r){return function(){for(var n=[],s=0,o=e,a=0;a=arguments.length)?l=t[a]:(l=arguments[s],s+=1),n[a]=l,x(l)||(o-=1),a+=1}return 0>=o?r.apply(this,n):i(o,Un(e,n,r))}},z=function(e,t,r){return function(){var i=arguments.length;if(0===i)return r();var n=arguments[i-1];if(!v(n)){var s=B(arguments,0,i-1);if("function"==typeof n[e])return n[e].apply(n,s);if(T(n)){var o=t.apply(null,s);return o(n)}}return r.apply(this,arguments)}},j=function(e,t){for(var r=t.length-1;r>=0&&e(t[r]);)r-=1;return B(t,0,r+1)},W=function(){function e(e,t){this.xf=t,this.f=e,this.all=!0}return e.prototype["@@transducer/init"]=M.init,e.prototype["@@transducer/result"]=function(e){return this.all&&(e=this.xf["@@transducer/step"](e,!0)),this.xf["@@transducer/result"](e)},e.prototype["@@transducer/step"]=function(e,t){return this.f(t)||(this.all=!1,e=R(this.xf["@@transducer/step"](e,!1))),e},D(function(t,r){return new e(t,r)})}(),V=function(){function e(e,t){this.xf=t,this.f=e,this.any=!1}return e.prototype["@@transducer/init"]=M.init,e.prototype["@@transducer/result"]=function(e){return this.any||(e=this.xf["@@transducer/step"](e,!1)),this.xf["@@transducer/result"](e)},e.prototype["@@transducer/step"]=function(e,t){return this.f(t)&&(this.any=!0,e=R(this.xf["@@transducer/step"](e,!0))),e},D(function(t,r){return new e(t,r)})}(),X=function(){function e(e,t){this.xf=t,this.pos=0,this.full=!1,this.acc=new Array(e)}return e.prototype["@@transducer/init"]=M.init,e.prototype["@@transducer/result"]=function(e){return this.acc=null,this.xf["@@transducer/result"](e)},e.prototype["@@transducer/step"]=function(e,t){return this.store(t),this.full?this.xf["@@transducer/step"](e,this.getCopy()):e},e.prototype.store=function(e){this.acc[this.pos]=e,this.pos+=1,this.pos===this.acc.length&&(this.pos=0,this.full=!0)},e.prototype.getCopy=function(){return l(B(this.acc,this.pos),B(this.acc,0,this.pos))},D(function(t,r){return new e(t,r)})}(),K=function(){function e(e,t){this.xf=t,this.n=e}return e.prototype["@@transducer/init"]=M.init,e.prototype["@@transducer/result"]=M.result,e.prototype["@@transducer/step"]=function(e,t){return this.n>0?(this.n-=1,e):this.xf["@@transducer/step"](e,t)},D(function(t,r){return new e(t,r)})}(),Z=function(){function e(e,t){this.xf=t,this.pos=0,this.full=!1,this.acc=new Array(e)}return e.prototype["@@transducer/init"]=M.init,e.prototype["@@transducer/result"]=function(e){return this.acc=null,this.xf["@@transducer/result"](e)},e.prototype["@@transducer/step"]=function(e,t){return this.full&&(e=this.xf["@@transducer/step"](e,this.acc[this.pos])),this.store(t),e},e.prototype.store=function(e){this.acc[this.pos]=e,this.pos+=1,this.pos===this.acc.length&&(this.pos=0,this.full=!0)},D(function(t,r){return new e(t,r)})}(),Q=function(){function e(e,t){this.xf=t,this.pred=e,this.lastValue=void 0,this.seenFirstValue=!1}return e.prototype["@@transducer/init"]=function(){return this.xf["@@transducer/init"]()},e.prototype["@@transducer/result"]=function(e){return this.xf["@@transducer/result"](e)},e.prototype["@@transducer/step"]=function(e,t){var r=!1;return this.seenFirstValue?this.pred(this.lastValue,t)&&(r=!0):this.seenFirstValue=!0,this.lastValue=t,r?e:this.xf["@@transducer/step"](e,t)},D(function(t,r){return new e(t,r)})}(),Y=function(){function e(e,t){this.xf=t,this.f=e}return e.prototype["@@transducer/init"]=M.init,e.prototype["@@transducer/result"]=M.result,e.prototype["@@transducer/step"]=function(e,t){if(this.f){if(this.f(t))return e;this.f=null}return this.xf["@@transducer/step"](e,t)},D(function(t,r){return new e(t,r)})}(),$=function(){function e(e,t){this.xf=t,this.f=e}return e.prototype["@@transducer/init"]=M.init,e.prototype["@@transducer/result"]=M.result,e.prototype["@@transducer/step"]=function(e,t){return this.f(t)?this.xf["@@transducer/step"](e,t):e},D(function(t,r){return new e(t,r)})}(),J=function(){function e(e,t){this.xf=t,this.f=e,this.found=!1}return e.prototype["@@transducer/init"]=M.init,e.prototype["@@transducer/result"]=function(e){return this.found||(e=this.xf["@@transducer/step"](e,void 0)),this.xf["@@transducer/result"](e)},e.prototype["@@transducer/step"]=function(e,t){return this.f(t)&&(this.found=!0,e=R(this.xf["@@transducer/step"](e,t))),e},D(function(t,r){return new e(t,r)})}(),ee=function(){function e(e,t){this.xf=t,this.f=e,this.idx=-1,this.found=!1}return e.prototype["@@transducer/init"]=M.init,e.prototype["@@transducer/result"]=function(e){return this.found||(e=this.xf["@@transducer/step"](e,-1)),this.xf["@@transducer/result"](e)},e.prototype["@@transducer/step"]=function(e,t){return this.idx+=1,this.f(t)&&(this.found=!0,e=R(this.xf["@@transducer/step"](e,this.idx))),e},D(function(t,r){return new e(t,r)})}(),te=function(){function e(e,t){this.xf=t,this.f=e}return e.prototype["@@transducer/init"]=M.init,e.prototype["@@transducer/result"]=function(e){return this.xf["@@transducer/result"](this.xf["@@transducer/step"](e,this.last))},e.prototype["@@transducer/step"]=function(e,t){return this.f(t)&&(this.last=t),e},D(function(t,r){return new e(t,r)})}(),re=function(){function e(e,t){this.xf=t,this.f=e,this.idx=-1,this.lastIdx=-1}return e.prototype["@@transducer/init"]=M.init,e.prototype["@@transducer/result"]=function(e){return this.xf["@@transducer/result"](this.xf["@@transducer/step"](e,this.lastIdx))},e.prototype["@@transducer/step"]=function(e,t){return this.idx+=1,this.f(t)&&(this.lastIdx=this.idx),e},D(function(t,r){return new e(t,r)})}(),ie=function(){function e(e,t){this.xf=t,this.f=e}return e.prototype["@@transducer/init"]=M.init,e.prototype["@@transducer/result"]=M.result,e.prototype["@@transducer/step"]=function(e,t){return this.xf["@@transducer/step"](e,this.f(t))},D(function(t,r){return new e(t,r)})}(),ne=function(){function e(e,t){this.xf=t,this.n=e}return e.prototype["@@transducer/init"]=M.init,e.prototype["@@transducer/result"]=M.result,e.prototype["@@transducer/step"]=function(e,t){return 0===this.n?R(e):(this.n-=1,this.xf["@@transducer/step"](e,t))},D(function(t,r){return new e(t,r)})}(),se=function(){function e(e,t){this.xf=t,this.f=e}return e.prototype["@@transducer/init"]=M.init,e.prototype["@@transducer/result"]=M.result,e.prototype["@@transducer/step"]=function(e,t){return this.f(t)?this.xf["@@transducer/step"](e,t):R(e)},D(function(t,r){return new e(t,r)})}(),oe=D(function(e,t){return Number(e)+Number(t)}),ae=q(function(e,t,r){if(t>=r.length||t<-r.length)return r;var i=0>t?r.length:0,n=i+t,s=l(r);return s[n]=e(r[n]),s}),le=D(z("all",W,function(e,t){for(var r=0;rt)throw new Error("min must not be greater than max in clamp(min, max, value)");return e>r?e:r>t?t:r}),be=G(function(e){return function(t,r){return e(t,r)?-1:e(r,t)?1:0}}),we=D(function(e,t){return 1===e?G(t):i(e,U(e,[],t))}),xe=oe(-1),Se=D(function(e,t){return null==t||t!==t?e:t}),_e=q(function(e,t,r){for(var i=[],n=0,s=t.length;s>n;)u(e,t[n],r)||u(e,t[n],i)||i.push(t[n]),n+=1;return i}),Te=D(function(e,t){var r={};for(var i in t)i!==e&&(r[i]=t[i]);return r}),Ce=D(function jn(e,t){switch(e.length){case 0:return t;case 1:return Te(e[0],t);default:var r=e[0],i=B(e,1);return null==t[r]?t:ge(r,jn(i,t[r]),t)}}),ke=D(function(e,t){return e/t}),Le=D(z("dropWhile",Y,function(e,t){for(var r=0,i=t.length;i>r&&e(t[r]);)r+=1;return B(t,r)})),Ae=G(function(e){return null!=e&&"function"==typeof e.empty?e.empty():null!=e&&null!=e.constructor&&"function"==typeof e.constructor.empty?e.constructor.empty():v(e)?[]:_(e)?"":w(e)?{}:g(e)?function(){return arguments}():void 0}),Oe=D(function Wn(e,t){var r,i,n,s={};for(i in t)r=e[i],n=typeof r,s[i]="function"===n?r(t[i]):"object"===n?Wn(e[i],t[i]):t[i];return s}),Ee=D(z("find",J,function(e,t){for(var r=0,i=t.length;i>r;){if(e(t[r]))return t[r];r+=1}})),Re=D(z("findIndex",ee,function(e,t){for(var r=0,i=t.length;i>r;){if(e(t[r]))return r;r+=1}return-1})),Be=D(z("findLast",te,function(e,t){for(var r=t.length-1;r>=0;){if(e(t[r]))return t[r];r-=1}})),Ie=D(z("findLastIndex",re,function(e,t){for(var r=t.length-1;r>=0;){if(e(t[r]))return r;r-=1}return-1})),Me=D(N("forEach",function(e,t){for(var r=t.length,i=0;r>i;)e(t[i]),i+=1;return t})),Pe=G(function(e){for(var t=0,r=e.length,i={};r>t;)v(e[t])&&e[t].length&&(i[e[t][0]]=e[t][1]),t+=1;return i}),He=D(function(e,t){for(var r=[],i=0,n=t.length;n>i;){for(var s=i+1;n>s&&e(t[i],t[s]);)s+=1;r.push(t.slice(i,s)),i=s}return r}),Fe=D(function(e,t){return e>t}),Ne=D(function(e,t){return e>=t}),Ge=D(p),De=D(function(e,t){return e in t}),qe=D(function(e,t){return e===t?0!==e||1/e===1/t:e!==e&&t!==t}),Ue=G(d),ze=q(function(e,t,r){return we(Math.max(e.length,t.length,r.length),function(){return e.apply(this,arguments)?t.apply(this,arguments):r.apply(this,arguments)})}),je=oe(1),We=q(function(e,t,r){e=e=0?e:r.length;var i=B(r);return i.splice(e,0,t),i}),Ve=q(function(e,t,r){return e=e=0?e:r.length,l(l(B(r,0,e),t),B(r,e))}),Xe=D(N("intersperse",function(e,t){for(var r=[],i=0,n=t.length;n>i;)i===n-1?r.push(t[i]):r.push(t[i],e),i+=1;return r})),Ke=D(function(e,t){return null!=t&&t.constructor===e||t instanceof e}),Ze=G(function(e){return v(e)?!0:e?"object"!=typeof e?!1:e instanceof String?!1:1===e.nodeType?!!e.length:0===e.length?!0:e.length>0?e.hasOwnProperty(0)&&e.hasOwnProperty(e.length-1):!1:!1}),Qe=G(function(e){return null==e}),Ye=function(){var e=!{toString:null}.propertyIsEnumerable("toString"),t=["constructor","valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],r=function(){return arguments.propertyIsEnumerable("length")}(),i=function(e,t){for(var r=0;r=0;)s=t[o],p(s,n)&&!i(a,s)&&(a[a.length]=s),o-=1;return a}:function(e){return Object(e)!==e?[]:Object.keys(e)})}(),$e=G(function(e){var t,r=[];for(t in e)r[r.length]=t;return r}),Je=G(function(e){return null!=e&&Ke(Number,e.length)?e.length:NaN}),et=D(function(e,t){return t>e}),tt=D(function(e,t){return t>=e}),rt=q(function(e,t,r){for(var i=0,n=r.length,s=[],o=[t];n>i;)o=e(o[0],r[i]),s[i]=o[1],i+=1;return[o[0],s]}),it=q(function(e,t,r){for(var i=r.length-1,n=[],s=[t];i>=0;)s=e(s[0],r[i]),n[i]=s[1],i-=1;return[s[0],n]}),nt=D(function(e,t){return t.match(e)||[]}),st=D(function(e,t){return m(e)?!m(t)||1>t?NaN:(e%t+t)%t:NaN}),ot=D(function(e,t){return t>e?t:e}),at=q(function(e,t,r){return e(r)>e(t)?r:t}),lt=D(function(e,t){return F({},e,t)}),ut=G(function(e){return F.apply(null,[{}].concat(e))}),ht=q(function(e,t,r){var i,n={};for(i in t)p(i,t)&&(n[i]=p(i,r)?e(i,t[i],r[i]):t[i]);for(i in r)p(i,r)&&!p(i,n)&&(n[i]=r[i]);return n}),ct=D(function(e,t){return e>t?t:e}),ft=q(function(e,t,r){return e(r)e?t.length+e:e;return _(t)?t.charAt(r):t[r]}),wt=G(function(e){return function(){return bt(e,arguments)}}),xt=D(function(e,t){var r={};return r[e]=t,r}),St=G(L),_t=G(function(e){var t,r=!1;return i(e.length,function(){return r?t:(r=!0,t=e.apply(this,arguments))})}),Tt=D(function(e,t){return e||t}),Ct=function(){var e=function(t){return{value:t,map:function(r){return e(r(t))}}};return q(function(t,r,i){return t(function(t){return e(r(t))})(i).value})}(),kt=D(function(e,t){return[e,t]}),Lt=D(function(e,t){for(var r=t,i=0;i0&&e(Lt(t,r))}),Et=D(function(e,t){for(var r={},i=0;ii;){var s=e[i];r[s]=t[s],i+=1}return r}),Bt=D(function(e,t){var r={};for(var i in t)e(t[i],i,t)&&(r[i]=t[i]);return r}),It=D(function(e,t){return l([e],t)}),Mt=D(function(e,t){return t[e]}),Pt=q(function(e,t,r){return null!=r&&p(t,r)?r[t]:e}),Ht=q(function(e,t,r){return e(r[t])}),Ft=D(function(e,t){for(var r=e.length,i=[],n=0;r>n;)i[n]=t[e[n]],n+=1;return i}),Nt=D(function(e,t){if(!b(e)||!b(t))throw new TypeError("Both arguments to range must be numbers");for(var r=[],i=e;t>i;)r.push(i),i+=1;return r}),Gt=q(function(e,t,r){for(var i=r.length-1;i>=0;)t=e(t,r[i]),i-=1;return t}),Dt=G(R),qt=q(function(e,t,r){return l(B(r,0,Math.min(e,r.length)),B(r,Math.min(r.length,e+t)))}),Ut=q(function(e,t,r){return r.replace(e,t)}),zt=G(function(e){return _(e)?e.split("").reverse().join(""):B(e).reverse()}),jt=q(function(e,t,r){for(var i=0,n=r.length,s=[t];n>i;)t=e(t,r[i]),s[i+1]=t,i+=1;return s}),Wt=q(function(e,t,r){return Ct(e,ue(t),r)}),Vt=q(N("slice",function(e,t,r){return Array.prototype.slice.call(r,e,t)})),Xt=D(function(e,t){return B(t).sort(e)}),Kt=D(function(e,t){return B(t).sort(function(t,r){var i=e(t),n=e(r);return n>i?-1:i>n?1:0})}),Zt=D(function(e,t){return[Vt(0,e,t),Vt(e,Je(t),t)]}),Qt=D(function(e,t){if(0>=e)throw new Error("First argument to splitEvery must be a positive integer");for(var r=[],i=0;ir&&!e(t[r]);)n.push(t[r]),r+=1;return[n,B(t,r)]}),$t=D(function(e,t){return Number(e)-Number(t)}),Jt=N("tail",Vt(1,1/0)),er=D(z("take",ne,function(e,t){return Vt(0,0>e?1/0:e,t)})),tr=D(function(e,t){for(var r=t.length-1;r>=0&&e(t[r]);)r-=1;return B(t,r+1,1/0)}),rr=D(z("takeWhile",se,function(e,t){for(var r=0,i=t.length;i>r&&e(t[r]);)r+=1;return B(t,0,r)})),ir=D(function(e,t){return e(t),t}),nr=D(function(e,t){var r,i=Number(t),n=0; if(0>i||isNaN(i))throw new RangeError("n must be a non-negative number");for(r=new Array(i);i>n;)r[n]=e(n),n+=1;return r}),sr=G(function(e){var t=[];for(var r in e)p(r,e)&&(t[t.length]=[r,e[r]]);return t}),or=G(function(e){var t=[];for(var r in e)t[t.length]=[r,e[r]];return t}),ar=G(function(e){for(var t=0,r=[];t=i&&"function"==typeof n;)r=i===e?arguments.length:s+n.length,n=n.apply(this,B(arguments,s,r)),i+=1,s=r;return n})}),dr=D(function(e,t){for(var r=e(t),i=[];r&&r.length;)i[i.length]=r[0],r=e(r[1]);return i}),gr=D(function(e,t){for(var r,i=0,n=t.length,s=[];n>i;)r=t[i],u(e,r,s)||(s[s.length]=r),i+=1;return s}),vr=q(function(e,t,r){return e(r)?r:t(r)}),yr=q(function(e,t,r){for(var i=r;!e(i);)i=t(i);return i}),mr=q(function(e,t,r){return ae(ue(t),e,r)}),br=D(function(e,t){return we(t.length,function(){for(var r=[],i=0;in;)i[n]=e[t[n]],n+=1;return i}),xr=G(function(e){var t,r=[];for(t in e)r[r.length]=e[t];return r}),Sr=function(){var e=function(e){return{value:e,map:function(){return this}}};return D(function(t,r){return t(e)(r).value})}(),_r=q(function(e,t,r){return e(r)?t(r):r}),Tr=D(function(e,t){for(var r in e)if(p(r,e)&&!e[r](t[r]))return!1;return!0}),Cr=D(function(e,t){return we(e.length,function(){return t.apply(this,l([e],arguments))})}),kr=D(function(e,t){for(var r,i=0,n=e.length,s=t.length,o=[];n>i;){for(r=0;s>r;)o[o.length]=[e[i],t[r]],r+=1;i+=1}return o}),Lr=D(function(e,t){for(var r=[],i=0,n=Math.min(e.length,t.length);n>i;)r[i]=[e[i],t[i]],i+=1;return r}),Ar=D(function(e,t){for(var r=0,i=Math.min(e.length,t.length),n={};i>r;)n[e[r]]=t[r],r+=1;return n}),Or=q(function(e,t,r){for(var i=[],n=0,s=Math.min(t.length,r.length);s>n;)i[n]=e(t[n],r[n]),n+=1;return i}),Er=ue(!1),Rr=ue(!0),Br=function Vn(e,t,r,i){var n=function(n){for(var s=t.length,o=0;s>o;){if(e===t[o])return r[o];o+=1}t[o+1]=e,r[o+1]=n;for(var a in e)n[a]=i?Vn(e[a],t,r,!0):e[a];return n};switch(hr(e)){case"Object":return n({});case"Array":return n([]);case"Date":return new Date(e.valueOf());case"RegExp":return o(e);default:return e}},Ir=function(e){return D(function(t,r){return i(Math.max(0,t.length-r.length),function(){return t.apply(this,e(r,arguments))})})},Mr=function(e,t){return er(e=0;){if(r[o]===e)return i[o]===t;o-=1}for(r.push(e),i.push(t),o=s.length-1;o>=0;){var a=s[o];if(!p(a,t)||!Xn(t[a],e[a],r,i))return!1;o-=1}return r.pop(),i.pop(),!0},Hr=function(e){return function t(r){for(var i,n,s,o=[],a=0,l=r.length;l>a;){if(Ze(r[a]))for(i=e?t(r[a]):r[a],s=0,n=i.length;n>s;)o[o.length]=i[s],s+=1;else o[o.length]=r[a];a+=1}return o}},Fr=function(){function e(e,t,r){for(var i=0,n=r.length;n>i;){if(t=e["@@transducer/step"](t,r[i]),t&&t["@@transducer/reduced"]){t=t["@@transducer/value"];break}i+=1}return e["@@transducer/result"](t)}function t(e,t,r){for(var i=r.next();!i.done;){if(t=e["@@transducer/step"](t,i.value),t&&t["@@transducer/reduced"]){t=t["@@transducer/value"];break}i=r.next()}return e["@@transducer/result"](t)}function r(e,t,r){return e["@@transducer/result"](r.reduce(ye(e["@@transducer/step"],e),t))}var i="undefined"!=typeof Symbol?Symbol.iterator:"@@iterator";return function(n,s,o){if("function"==typeof n&&(n=P(n)),Ze(o))return e(n,s,o);if("function"==typeof o.reduce)return r(n,s,o);if(null!=o[i])return t(n,s,o[i]());if("function"==typeof o.next)return t(n,s,o);throw new TypeError("reduce: list must be array or iterable")}}(),Nr=function(){var e={"@@transducer/init":Array,"@@transducer/step":function(e,t){return e.push(t),e},"@@transducer/result":d},t={"@@transducer/init":String,"@@transducer/step":function(e,t){return e+t},"@@transducer/result":d},r={"@@transducer/init":Object,"@@transducer/step":function(e,t){return F(e,Ze(t)?xt(t[0],t[1]):t)},"@@transducer/result":d};return function(i){if(T(i))return i;if(Ze(i))return e;if("string"==typeof i)return t;if("object"==typeof i)return r;throw new Error("Cannot create transformer for "+i)}}(),Gr=function(){function e(e,t){this.f=e,this.retained=[],this.xf=t}return e.prototype["@@transducer/init"]=M.init,e.prototype["@@transducer/result"]=function(e){return this.retained=null,this.xf["@@transducer/result"](e)},e.prototype["@@transducer/step"]=function(e,t){return this.f(t)?this.retain(e,t):this.flush(e,t)},e.prototype.flush=function(e,t){return e=Fr(this.xf["@@transducer/step"],e,this.retained),this.retained=[],this.xf["@@transducer/step"](e,t)},e.prototype.retain=function(e,t){return this.retained.push(t),e},D(function(t,r){return new e(t,r)})}(),Dr=function(){function e(e,t){this.xf=t,this.f=e,this.inputs={}}return e.prototype["@@transducer/init"]=M.init,e.prototype["@@transducer/result"]=function(e){var t;for(t in this.inputs)if(p(t,this.inputs)&&(e=this.xf["@@transducer/step"](e,this.inputs[t]),e["@@transducer/reduced"])){e=e["@@transducer/value"];break}return this.inputs=null,this.xf["@@transducer/result"](e)},e.prototype["@@transducer/step"]=function(e,t){var r=this.f(t);return this.inputs[r]=this.inputs[r]||[r,[]],this.inputs[r][1]=pe(t,this.inputs[r][1]),e},D(function(t,r){return new e(t,r)})}(),qr=G(function(e){return we(e.length,function(){var t=0,r=arguments[0],i=arguments[arguments.length-1],n=B(arguments);return n[0]=function(){var e=r.apply(this,l(arguments,[t,i]));return t+=1,e},e.apply(this,n)})}),Ur=G(function(e){return gt(2,e)}),zr=G(function(e){return null!=e&&"function"==typeof e.clone?e.clone():Br(e,[],[],!0)}),jr=G(function(e){return we(e.length,e)}),Wr=D(z("drop",K,function(e,t){return Vt(Math.max(0,e),1/0,t)})),Vr=D(z("dropLast",Z,Mr)),Xr=D(z("dropLastWhile",Gr,j)),Kr=D(function(e,t){return Pr(e,t,[],[])}),Zr=D(z("filter",$,function(e,t){return w(t)?Fr(function(r,i){return e(t[i])&&(r[i]=t[i]),r},{},Ye(t)):h(e,t)})),Qr=G(Hr(!0)),Yr=G(function(e){return jr(function(t,r){var i=B(arguments);return i[0]=r,i[1]=t,e.apply(this,i)})}),$r=bt(0),Jr=Vt(0,-1),ei=q(function(e,t,r){var i,n;t.length>r.length?(i=t,n=r):(i=r,n=t);for(var s=[],o=0;oi;){var s=t[i],o=e[s],a=p(o,n)?n[o]:n[o]=[];a[a.length]=s,i+=1}return n}),ii=G(function(e){for(var t=Ye(e),r=t.length,i=0,n={};r>i;){var s=t[i];n[e[s]]=s,i+=1}return n}),ni=G(function(e){return null!=e&&Kr(e,Ae(e))}),si=bt(-1),oi=D(function(e,t){if("function"!=typeof t.lastIndexOf||v(t)){for(var r=t.length-1;r>=0;){if(Kr(t[r],e))return r;r-=1}return-1}return t.lastIndexOf(e)}),ai=D(z("map",ie,function(e,t){switch(Object.prototype.toString.call(t)){case"[object Function]":return we(t.length,function(){return e.call(this,t.apply(this,arguments))});case"[object Object]":return Fr(function(r,i){return r[i]=e(t[i]),r},{},Ye(t));default:return C(e,t)}})),li=D(function(e,t){return Fr(function(r,i){return r[i]=e(t[i],i,t),r},{},Ye(t))}),ui=q(function(e,t,r){return ht(function(t,r,i){return e(r,i)},t,r)}),hi=Ir(l),ci=Ir(Yr(l)),fi=q(function(e,t,r){return Kr(Lt(e,r),t)}),pi=D(function(e,t){return ai(Mt(e),t)}),di=br(C,[Rt,Ue]),gi=q(function(e,t,r){return Ht(Kr(t),e,r)}),vi=q(function(e,t,r){return Ht(Ke(e),t,r)}),yi=q(Fr),mi=U(4,[],function(e,t,r,i){return Fr(function(i,n){var s=r(n);return i[s]=e(p(s,i)?i[s]:t,n),i},{},i)}),bi=D(function(e,t){return Zr(a(e),t)}),wi=D(function(e,t){return nr(ue(e),t)}),xi=yi(oe,0),Si=D(function(e,t){return Wr(e>=0?t.length-e:0,t)}),_i=we(4,function(e,t,r,i){return Fr(e("function"==typeof t?P(t):t),r,i)}),Ti=q(function(e,t,r){return gr(e,l(t,r))}),Ci=D(function(e,t){return Tr(ai(Kr,e),t)}),ki=function(){var e=function(e){return{"@@transducer/init":M.init,"@@transducer/result":function(t){return e["@@transducer/result"](t)},"@@transducer/step":function(t,r){var i=e["@@transducer/step"](t,r);return i["@@transducer/reduced"]?c(i):i}}};return function(t){var r=e(t);return{"@@transducer/init":M.init,"@@transducer/result":function(e){return r["@@transducer/result"](e)},"@@transducer/step":function(e,t){return Ze(t)?Fr(r,e,t):Fr(r,e,[t])}}}}(),Li=function(e,t,r){var i,n;if("function"==typeof e.indexOf)switch(typeof t){case"number":if(0===t){for(i=1/t;rt;){if(!e[t].apply(this,arguments))return!1;t+=1}return!0})}),Ei=G(function(e){for(var t=e.length,r=0;t>r;){if(Li(e,e[r],r+1)>=0)return!1;r+=1}return!0}),Ri=G(function(e){return we(yi(ot,0,pi("length",e)),function(){for(var t=0,r=e.length;r>t;){if(e[t].apply(this,arguments))return!0;t+=1}return!1})}),Bi=D(function(e,t){return"function"==typeof e.ap?e.ap(t):"function"==typeof e?we(Math.max(e.length,t.length),function(){return e.apply(this,arguments)(t.apply(this,arguments))}):Fr(function(e,r){return l(e,ai(r,t))},[],e)}),Ii=G(function Kn(e){return e=ai(function(e){return"function"==typeof e?e:Kn(e)},e),we(yi(ot,0,pi("length",wr(e))),function(){var t=arguments;return ai(function(e){return de(e,t)},e)})}),Mi=jr(function(e){return e.apply(this,B(arguments,1))}),Pi=D(z("chain",Ai,function(e,t){return"function"==typeof t?function(){return t.call(this,e.apply(this,arguments)).apply(this,arguments)}:Hr(!1)(ai(e,t))})),Hi=G(function(e){var t=yi(ot,0,ai(function(e){return e[0].length},e));return i(t,function(){for(var t=0;t10)throw new Error("Constructor with greater than ten arguments");return 0===e?function(){return new t}:jr(gt(e,function(e,r,i,n,s,o,a,l,u,h){switch(arguments.length){case 1:return new t(e);case 2:return new t(e,r);case 3:return new t(e,r,i);case 4:return new t(e,r,i,n);case 5:return new t(e,r,i,n,s);case 6:return new t(e,r,i,n,s,o);case 7:return new t(e,r,i,n,s,o,a);case 8:return new t(e,r,i,n,s,o,a,l);case 9:return new t(e,r,i,n,s,o,a,l,u);case 10:return new t(e,r,i,n,s,o,a,l,u,h)}}))}),Ni=D(function(e,t){return we(yi(ot,0,pi("length",t)),function(){var r=arguments,i=this;return e.apply(i,C(function(e){return e.apply(i,r)},t))})}),Gi=mi(function(e,t){return e+1},0),Di=D(z("dropRepeatsWith",Q,function(e,t){var r=[],i=1,n=t.length;if(0!==n)for(r[0]=t[0];n>i;)e(si(r),t[i])||(r[r.length]=t[i]),i+=1;return r})),qi=q(function(e,t,r){return Kr(e(t),e(r))}),Ui=q(function(e,t,r){return Kr(t[e],r[e])}),zi=D(z("groupBy",Dr,mi(function(e,t){return null==e&&(e=[]),e.push(t),e},null))),ji=mi(function(e,t){return t},null),Wi=D(function(e,t){return"function"!=typeof t.indexOf||v(t)?Li(t,e,0):t.indexOf(e)}),Vi=G(function(e){return Ni(s,e)}),Xi=D(function(e,t){return function(r){return function(i){return ai(function(e){return t(e,i)},r(e(i)))}}}),Ki=G(function(e){return Xi(bt(e),mr(e))}),Zi=G(function(e){return Xi(Lt(e),ve(e))}),Qi=G(function(e){return Xi(Mt(e),ge(e))}),Yi=D(function(e,t){var r=we(e,t);return we(e,function(){return Fr(Bi,ai(r,arguments[0]),B(arguments,1))})}),$i=G(function(e){return xi(e)/e.length}),Ji=G(function(e){var t=e.length;if(0===t)return NaN;var r=2-t%2,i=(t-r)/2;return $i(B(e).sort(function(e,t){return t>e?-1:e>t?1:0}).slice(i,i+r))}),en=Vi([Zr,bi]),tn=function(){if(0===arguments.length)throw new Error("pipe requires at least one argument");return i(arguments[0].length,yi(A,arguments[0],Jt(arguments)))},rn=function(){if(0===arguments.length)throw new Error("pipeP requires at least one argument");return i(arguments[0].length,yi(O,arguments[0],Jt(arguments)))},nn=yi(dt,1),sn=D(function(e,t){return"function"==typeof t.sequence?t.sequence(e):Gt(function(e,t){return Bi(ai(It,t),e)},e([]),t)}),on=q(function(e,t,r){return sn(e,ai(t,r))}),an=Pi(d),ln=function(e,t){return Li(t,e,0)>=0},un=function Zn(e,t){var r=function(r){var i=t.concat([e]);return ln(r,i)?"":Zn(r,i)},i=function(e,t){return C(function(t){return E(t)+": "+r(e[t])},t.slice().sort())};switch(Object.prototype.toString.call(e)){case"[object Arguments]":return"(function() { return arguments; }("+C(r,e).join(", ")+"))";case"[object Array]":return"["+C(r,e).concat(i(e,bi(function(e){return/^\d+$/.test(e)},Ye(e)))).join(", ")+"]";case"[object Boolean]":return"object"==typeof e?"new Boolean("+r(e.valueOf())+")":e.toString();case"[object Date]":return"new Date("+(isNaN(e.valueOf())?r(NaN):E(I(e)))+")";case"[object Null]":return"null";case"[object Number]":return"object"==typeof e?"new Number("+r(e.valueOf())+")":1/e===-(1/0)?"-0":e.toString(10);case"[object String]":return"object"==typeof e?"new String("+r(e.valueOf())+")":E(e);case"[object Undefined]":return"undefined";default:if("function"==typeof e.toString){var n=e.toString();if("[object Object]"!==n)return n}return"{"+i(e,Ye(e)).join(", ")+"}"}},hn=function(){if(0===arguments.length)throw new Error("compose requires at least one argument");return tn.apply(this,zt(arguments))},cn=function(){return hn.apply(this,It(Ue,ai(Pi,arguments)))},fn=function(){if(0===arguments.length)throw new Error("composeP requires at least one argument");return rn.apply(this,zt(arguments))},pn=G(function(e){return Fi(e.length,e)}),dn=D(ln),gn=D(function(e,t){for(var r=[],i=0,n=e.length;n>i;)ln(e[i],t)||ln(e[i],r)||(r[r.length]=e[i]),i+=1;return r}),vn=G(z("dropRepeats",Q(Kr),Di(Kr))),yn=G(function(e){return Yi(e.length,e)}),mn=D(function(e,t){var r={};for(var i in t)ln(i,e)||(r[i]=t[i]);return r}),bn=function(){return cn.apply(this,zt(arguments))},wn=G(function(e){return un(e,[])}),xn=D(function(e,t){return bi(Yr(ln)(e),t)}),Sn=function(){function e(){this._nativeSet="function"==typeof Set?new Set:null,this._items={}}function t(e,t,r){var i,n,s=typeof e;switch(s){case"string":case"number":return 0!==e||r._items["-0"]||1/e!==-(1/0)?null!==r._nativeSet?t?(i=r._nativeSet.size,r._nativeSet.add(e),n=r._nativeSet.size,n>i):r._nativeSet.has(e):s in r._items?e in r._items[s]?!t:(t&&(r._items[s][e]=!0),t):(t&&(r._items[s]={},r._items[s][e]=!0),t):(t&&(r._items["-0"]=!0),t);case"boolean":if(s in r._items){var o=e?1:0;return r._items[s][o]?!t:(t&&(r._items[s][o]=!0),t)}return t&&(r._items[s]=e?[!1,!0]:[!0,!1]),t;case"function":return null!==r._nativeSet?t?(i=r._nativeSet.size,r._nativeSet.add(e),n=r._nativeSet.size,n>i):r._nativeSet.has(e):s in r._items?ln(e,r._items[s])?!t:(t&&r._items[s].push(e),t):(t&&(r._items[s]=[e]),t);case"undefined":return r._items[s]?!t:(t&&(r._items[s]=!0),t);case"object":if(null===e)return r._items["null"]?!t:(t&&(r._items["null"]=!0),t);default:return s=Object.prototype.toString.call(e),s in r._items?ln(e,r._items[s])?!t:(t&&r._items[s].push(e),t):(t&&(r._items[s]=[e]),t)}}return e.prototype.add=function(e){return t(e,!0,this)},e.prototype.has=function(e){return t(e,!1,this)},e}(),_n=D(function(e,t){return y(e)?function(){return e.apply(this,arguments)&&t.apply(this,arguments)}:yn(he)(e,t)}),Tn=yn(mt),Cn=D(function(e,t){return y(e)?function(){return e.apply(this,arguments)||t.apply(this,arguments)}:yn(Tt)(e,t)}),kn=D(function(e,t){return we(e+1,function(){var r=arguments[e];if(null!=r&&Ke(Function,r[t]))return r[t].apply(r,B(arguments,0,e));throw new TypeError(wn(r)+' does not have a method named "'+t+'"')})}),Ln=kn(1,"join"),An=G(function(e){var t={};return i(e.length,function(){var r=wn(arguments);return p(r,t)||(t[r]=e.apply(this,arguments)),t[r]})}),On=kn(1,"split"),En=D(function(e,t){if(!S(e))throw new TypeError("‘test’ requires a value of type RegExp as its first argument; received "+wn(e));return o(e).test(t)}),Rn=kn(0,"toLowerCase"),Bn=kn(0,"toUpperCase"),In=D(function(e,t){for(var r,i,n=new Sn,s=[],o=0;ot.length?(r=e,i=t):(r=t,i=e),Fn(h(Yr(ln)(r),i))}),Gn=D(hn(Fn,l)),Dn={F:Er,T:Rr,__:e,add:oe,addIndex:qr,adjust:ae,all:le,allPass:Oi,allUniq:Ei,always:ue,and:he,any:ce,anyPass:Ri,ap:Bi,aperture:fe,append:pe,apply:de,applySpec:Ii,assoc:ge,assocPath:ve,binary:Ur,bind:ye,both:_n,call:Mi,chain:Pi,clamp:me,clone:zr,comparator:be,complement:Tn,compose:hn,composeK:cn,composeP:fn,concat:Mn,cond:Hi,construct:pn,constructN:Fi,contains:dn,converge:Ni,countBy:Gi,curry:jr,curryN:we,dec:xe,defaultTo:Se,difference:gn,differenceWith:_e,dissoc:Te,dissocPath:Ce,divide:ke,drop:Wr,dropLast:Vr,dropLastWhile:Xr,dropRepeats:vn,dropRepeatsWith:Di,dropWhile:Le,either:Cn,empty:Ae,eqBy:qi,eqProps:Ui,equals:Kr,evolve:Oe,filter:Zr,find:Ee,findIndex:Re,findLast:Be,findLastIndex:Ie,flatten:Qr,flip:Yr,forEach:Me,fromPairs:Pe,groupBy:zi,groupWith:He,gt:Fe,gte:Ne,has:Ge,hasIn:De,head:$r,identical:qe,identity:Ue,ifElse:ze,inc:je,indexBy:ji,indexOf:Wi,init:Jr,insert:We,insertAll:Ve,intersection:Nn,intersectionWith:ei,intersperse:Xe,into:ti,invert:ri,invertObj:ii,invoker:kn,is:Ke,isArrayLike:Ze,isEmpty:ni,isNil:Qe,join:Ln,juxt:Vi,keys:Ye,keysIn:$e,last:si,lastIndexOf:oi,length:Je,lens:Xi,lensIndex:Ki,lensPath:Zi,lensProp:Qi,lift:yn,liftN:Yi,lt:et,lte:tt,map:ai,mapAccum:rt,mapAccumRight:it,mapObjIndexed:li,match:nt,mathMod:st,max:ot,maxBy:at,mean:$i,median:Ji,memoize:An,merge:lt,mergeAll:ut,mergeWith:ui,mergeWithKey:ht,min:ct,minBy:ft,modulo:pt,multiply:dt,nAry:gt,negate:vt,none:yt,not:mt,nth:bt,nthArg:wt,objOf:xt,of:St,omit:mn,once:_t,or:Tt,over:Ct,pair:kt,partial:hi,partialRight:ci,partition:en,path:Lt,pathEq:fi,pathOr:At,pathSatisfies:Ot,pick:Et,pickAll:Rt,pickBy:Bt,pipe:tn,pipeK:bn,pipeP:rn,pluck:pi,prepend:It,product:nn,project:di,prop:Mt,propEq:gi,propIs:vi,propOr:Pt,propSatisfies:Ht,props:Ft,range:Nt,reduce:yi,reduceBy:mi,reduceRight:Gt,reduced:Dt,reject:bi,remove:qt,repeat:wi,replace:Ut,reverse:zt,scan:jt,sequence:sn,set:Wt,slice:Vt,sort:Xt,sortBy:Kt,split:On,splitAt:Zt,splitEvery:Qt,splitWhen:Yt,subtract:$t,sum:xi,symmetricDifference:Pn,symmetricDifferenceWith:Hn,tail:Jt,take:er,takeLast:Si,takeLastWhile:tr,takeWhile:rr,tap:ir,test:En,times:nr,toLower:Rn,toPairs:sr,toPairsIn:or,toString:wn,toUpper:Bn,transduce:_i,transpose:ar,traverse:on,trim:lr,tryCatch:ur,type:hr,unapply:cr,unary:fr,uncurryN:pr,unfold:dr,union:Gn,unionWith:Ti,uniq:Fn,uniqBy:In,uniqWith:gr,unless:vr,unnest:an,until:yr,update:mr,useWith:br,values:wr,valuesIn:xr,view:Sr,when:_r,where:Tr,whereEq:Ci,without:xn,wrap:Cr,xprod:kr,zip:Lr,zipObj:Ar,zipWith:Or};"object"==typeof r?t.exports=Dn:"function"==typeof define&&define.amd?define(function(){return Dn}):this.R=Dn}).call(this)},{}]},{},[19]); //# sourceMappingURL=/js/dalliance-all.js.map




© 2015 - 2024 Weber Informatics LLC | Privacy Policy