jbrowse-plugin-graphgenomeviewer 5.0.1 → 5.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/dist/chunks/{GbzBaseSyntenyAdapter-CKKVHC2R.js → GbzBaseSyntenyAdapter-C2IGNBR4.js} +2 -2
  2. package/dist/chunks/{GraphGenomeView-YYP4IFSI.js → GraphGenomeView-TKK67NXR.js} +2 -2
  3. package/dist/chunks/{GraphTrackSettingsDialog-2WPJRAJC.js → GraphTrackSettingsDialog-RKZ5XIKY.js} +2 -2
  4. package/dist/chunks/{LinearGraphDisplay-7YE624D5.js → LinearGraphDisplay-I2DJRM36.js} +2 -2
  5. package/dist/chunks/chunk-AFYY6LQF.js +3 -0
  6. package/dist/chunks/chunk-AFYY6LQF.js.map +7 -0
  7. package/dist/chunks/chunk-ALTI7LTL.js +2 -0
  8. package/dist/chunks/chunk-ALTI7LTL.js.map +7 -0
  9. package/dist/chunks/chunk-C4ET3OW2.js +5 -0
  10. package/dist/chunks/{chunk-LGFKHSVJ.js.map → chunk-C4ET3OW2.js.map} +3 -3
  11. package/dist/chunks/{chunk-SJNG2XK7.js → chunk-N2I4OWIA.js} +2 -2
  12. package/dist/chunks/chunk-YZAO5LPU.js +2 -0
  13. package/dist/chunks/chunk-YZAO5LPU.js.map +7 -0
  14. package/dist/jbrowse-plugin-graphgenomeviewer.esm.js +5 -5
  15. package/dist/jbrowse-plugin-graphgenomeviewer.esm.js.map +3 -3
  16. package/package.json +2 -2
  17. package/src/GraphGenomeView/components/usePaneGestures.ts +1 -0
  18. package/src/GraphGenomeView/model.test.ts +1 -1
  19. package/src/GraphGenomeView/pane/fitViews.ts +1 -0
  20. package/src/GraphGenomeView/pane/graphViews.ts +3 -0
  21. package/src/version.ts +1 -1
  22. package/dist/chunks/chunk-H54W6OQQ.js +0 -2
  23. package/dist/chunks/chunk-H54W6OQQ.js.map +0 -7
  24. package/dist/chunks/chunk-LGFKHSVJ.js +0 -5
  25. package/dist/chunks/chunk-O4XV3K35.js +0 -2
  26. package/dist/chunks/chunk-O4XV3K35.js.map +0 -7
  27. package/dist/chunks/chunk-WKVVIDCS.js +0 -3
  28. package/dist/chunks/chunk-WKVVIDCS.js.map +0 -7
  29. /package/dist/chunks/{GbzBaseSyntenyAdapter-CKKVHC2R.js.map → GbzBaseSyntenyAdapter-C2IGNBR4.js.map} +0 -0
  30. /package/dist/chunks/{GraphGenomeView-YYP4IFSI.js.map → GraphGenomeView-TKK67NXR.js.map} +0 -0
  31. /package/dist/chunks/{GraphTrackSettingsDialog-2WPJRAJC.js.map → GraphTrackSettingsDialog-RKZ5XIKY.js.map} +0 -0
  32. /package/dist/chunks/{LinearGraphDisplay-7YE624D5.js.map → LinearGraphDisplay-I2DJRM36.js.map} +0 -0
  33. /package/dist/chunks/{chunk-SJNG2XK7.js.map → chunk-N2I4OWIA.js.map} +0 -0
@@ -1,4 +1,4 @@
1
- import{a as ke,b as Ar,c as bt,d as wt}from"./chunk-S3X3QFQD.js";import{e as vr,f as wr,g as T,h as Pe,i as Le,j as te,k as Ne,l as re,n as Ge}from"./chunk-LGFKHSVJ.js";import{e as dt}from"./chunk-2H7GDQ3R.js";import{a as ht}from"./chunk-KWAXLUPQ.js";import"./chunk-E7J6SB5P.js";import{a as Cr,d as xt,e as yt,f as gt}from"./chunk-4T7DPQTR.js";import{a as q}from"./chunk-J4OLMLS5.js";import{a as St,b as vt}from"./chunk-SCMIJAAX.js";import"./chunk-7BKUWQE5.js";import{e as V,f as k,g as ee}from"./chunk-KULNKXPT.js";import{a as Sr,b as A}from"./chunk-FY3BTKY4.js";var dr=Sr((Ha,mr)=>{mr.exports=JBrowseExports["@jbrowse/core/util/installClearHoverOnSurfaceMove"]});var at=A(ke(),1),st=A(q(),1),Te=A(ht(),1),br=A(Ar(),1);function De(e){let r=/\.gbz\.db$/i;return r.test(e)?e.replace(r,".haplotype-index.db"):void 0}var At=A(ht(),1);function Ir(e){return yt(e)&&De(xt(e))?gt(e,r=>De(r)):void 0}function _r(e){return e instanceof Error&&(/\bHTTP 40[34]\b/.test(e.message)||e.code==="ENOENT")}async function Ct(e,r){let t=Ir(e);if(!t)return{};try{return await(0,At.openLocation)(t,r).stat(),{location:t}}catch(o){return _r(o)?{}:{unreadable:String(o)}}}var _t=A(ke(),1),Er=5e3,Or=50*2**20,Be=class extends Error{constructor(t){super(`this GAF is ${(t/2**20).toFixed(0)} MB without an index; bgzip it and index it with tabix -p gaf`);this.name="UnindexedGafTooLargeError"}};function Rr(e,r){if(e.length<=r)return e;let t=e.length/r;return Array.from({length:r},(o,n)=>e[Math.floor(n*t)])}var It=(e,r)=>e.path.some(t=>r.has(t.name)),oe=class{constructor(r,t){this.file=r;this.tabix=t;this.whole=(0,_t.cachedSetup)({setup:async()=>{let{size:r}=await this.file.stat();if(r>Or)throw new Be(r);let t=await this.file.readFile(),o=new TextDecoder().decode(t[0]===31&&t[1]===139?await bt(t):t);return vt(o)}})}async readIndexed(r,t,o){let n=1/0,i=-1/0;for(let s of t){let p=Number(s);Number.isInteger(p)&&(n=Math.min(n,p),i=Math.max(i,p))}let a=[];return n<=i&&await r.getLines("{node}",n,i+1,{signal:o,lineCallback:s=>{let p=St(s);p&&It(p,t)&&a.push(p)}}),a}async readsOver(r,{signal:t}={}){let o=this.tabix?await this.readIndexed(this.tabix,r,t):(await this.whole({signal:t})).filter(n=>It(n,r));return{records:Rr(o,Er),total:o.length}}};var yr=A(ke(),1),gr=A(q(),1);var je=function(e,r){return je=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,o){t.__proto__=o}||function(t,o){for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(t[n]=o[n])},je(e,r)};function Q(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");je(e,r);function t(){this.constructor=e}e.prototype=r===null?Object.create(r):(t.prototype=r.prototype,new t)}function Et(e,r,t,o){function n(i){return i instanceof t?i:new t(function(a){a(i)})}return new(t||(t=Promise))(function(i,a){function s(c){try{f(o.next(c))}catch(l){a(l)}}function p(c){try{f(o.throw(c))}catch(l){a(l)}}function f(c){c.done?i(c.value):n(c.value).then(s,p)}f((o=o.apply(e,r||[])).next())})}function ne(e,r){var t={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},o,n,i,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(f){return function(c){return p([f,c])}}function p(f){if(o)throw new TypeError("Generator is already executing.");for(;a&&(a=0,f[0]&&(t=0)),t;)try{if(o=1,n&&(i=f[0]&2?n.return:f[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,f[1])).done)return i;switch(n=0,i&&(f=[f[0]&2,i.value]),f[0]){case 0:case 1:i=f;break;case 4:return t.label++,{value:f[1],done:!1};case 5:t.label++,n=f[1],f=[0];continue;case 7:f=t.ops.pop(),t.trys.pop();continue;default:if(i=t.trys,!(i=i.length>0&&i[i.length-1])&&(f[0]===6||f[0]===2)){t=0;continue}if(f[0]===3&&(!i||f[1]>i[0]&&f[1]<i[3])){t.label=f[1];break}if(f[0]===6&&t.label<i[1]){t.label=i[1],i=f;break}if(i&&t.label<i[2]){t.label=i[2],t.ops.push(f);break}i[2]&&t.ops.pop(),t.trys.pop();continue}f=r.call(e,t)}catch(c){f=[6,c],n=0}finally{o=i=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}}function D(e){var r=typeof Symbol=="function"&&Symbol.iterator,t=r&&e[r],o=0;if(t)return t.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&o>=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw new TypeError(r?"Object is not iterable.":"Symbol.iterator is not defined.")}function $(e,r){var t=typeof Symbol=="function"&&e[Symbol.iterator];if(!t)return e;var o=t.call(e),n,i=[],a;try{for(;(r===void 0||r-- >0)&&!(n=o.next()).done;)i.push(n.value)}catch(s){a={error:s}}finally{try{n&&!n.done&&(t=o.return)&&t.call(o)}finally{if(a)throw a.error}}return i}function z(e,r,t){if(t||arguments.length===2)for(var o=0,n=r.length,i;o<n;o++)(i||!(o in r))&&(i||(i=Array.prototype.slice.call(r,0,o)),i[o]=r[o]);return e.concat(i||Array.prototype.slice.call(r))}function B(e){return this instanceof B?(this.v=e,this):new B(e)}function Ot(e,r,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o=t.apply(e,r||[]),n,i=[];return n=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",a),n[Symbol.asyncIterator]=function(){return this},n;function a(m){return function(y){return Promise.resolve(y).then(m,l)}}function s(m,y){o[m]&&(n[m]=function(d){return new Promise(function(h,g){i.push([m,d,h,g])>1||p(m,d)})},y&&(n[m]=y(n[m])))}function p(m,y){try{f(o[m](y))}catch(d){u(i[0][3],d)}}function f(m){m.value instanceof B?Promise.resolve(m.value.v).then(c,l):u(i[0][2],m)}function c(m){p("next",m)}function l(m){p("throw",m)}function u(m,y){m(y),i.shift(),i.length&&p(i[0][0],i[0][1])}}function Rt(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=e[Symbol.asyncIterator],t;return r?r.call(e):(e=typeof D=="function"?D(e):e[Symbol.iterator](),t={},o("next"),o("throw"),o("return"),t[Symbol.asyncIterator]=function(){return this},t);function o(i){t[i]=e[i]&&function(a){return new Promise(function(s,p){a=e[i](a),n(s,p,a.done,a.value)})}}function n(i,a,s,p){Promise.resolve(p).then(function(f){i({value:f,done:s})},a)}}function b(e){return typeof e=="function"}function Tt(e){var r=function(o){Error.call(o),o.stack=new Error().stack},t=e(r);return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var ie=Tt(function(e){return function(t){e(this),this.message=t?t.length+` errors occurred during unsubscription:
1
+ import{a as ke,b as Ar,c as bt,d as wt}from"./chunk-S3X3QFQD.js";import{f as vr,g as wr,h as T,i as Pe,j as Le,k as te,l as Ne,m as re,o as Ge}from"./chunk-C4ET3OW2.js";import{e as dt}from"./chunk-2H7GDQ3R.js";import{a as ht}from"./chunk-KWAXLUPQ.js";import"./chunk-E7J6SB5P.js";import{a as Cr,d as xt,e as yt,f as gt}from"./chunk-4T7DPQTR.js";import{a as q}from"./chunk-J4OLMLS5.js";import{a as St,b as vt}from"./chunk-SCMIJAAX.js";import"./chunk-7BKUWQE5.js";import{e as V,f as k,g as ee}from"./chunk-KULNKXPT.js";import{a as Sr,b as A}from"./chunk-FY3BTKY4.js";var dr=Sr((Ha,mr)=>{mr.exports=JBrowseExports["@jbrowse/core/util/installClearHoverOnSurfaceMove"]});var at=A(ke(),1),st=A(q(),1),Te=A(ht(),1),br=A(Ar(),1);function De(e){let r=/\.gbz\.db$/i;return r.test(e)?e.replace(r,".haplotype-index.db"):void 0}var At=A(ht(),1);function Ir(e){return yt(e)&&De(xt(e))?gt(e,r=>De(r)):void 0}function _r(e){return e instanceof Error&&(/\bHTTP 40[34]\b/.test(e.message)||e.code==="ENOENT")}async function Ct(e,r){let t=Ir(e);if(!t)return{};try{return await(0,At.openLocation)(t,r).stat(),{location:t}}catch(o){return _r(o)?{}:{unreadable:String(o)}}}var _t=A(ke(),1),Er=5e3,Or=50*2**20,Be=class extends Error{constructor(t){super(`this GAF is ${(t/2**20).toFixed(0)} MB without an index; bgzip it and index it with tabix -p gaf`);this.name="UnindexedGafTooLargeError"}};function Rr(e,r){if(e.length<=r)return e;let t=e.length/r;return Array.from({length:r},(o,n)=>e[Math.floor(n*t)])}var It=(e,r)=>e.path.some(t=>r.has(t.name)),oe=class{constructor(r,t){this.file=r;this.tabix=t;this.whole=(0,_t.cachedSetup)({setup:async()=>{let{size:r}=await this.file.stat();if(r>Or)throw new Be(r);let t=await this.file.readFile(),o=new TextDecoder().decode(t[0]===31&&t[1]===139?await bt(t):t);return vt(o)}})}async readIndexed(r,t,o){let n=1/0,i=-1/0;for(let s of t){let p=Number(s);Number.isInteger(p)&&(n=Math.min(n,p),i=Math.max(i,p))}let a=[];return n<=i&&await r.getLines("{node}",n,i+1,{signal:o,lineCallback:s=>{let p=St(s);p&&It(p,t)&&a.push(p)}}),a}async readsOver(r,{signal:t}={}){let o=this.tabix?await this.readIndexed(this.tabix,r,t):(await this.whole({signal:t})).filter(n=>It(n,r));return{records:Rr(o,Er),total:o.length}}};var yr=A(ke(),1),gr=A(q(),1);var je=function(e,r){return je=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,o){t.__proto__=o}||function(t,o){for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(t[n]=o[n])},je(e,r)};function Q(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");je(e,r);function t(){this.constructor=e}e.prototype=r===null?Object.create(r):(t.prototype=r.prototype,new t)}function Et(e,r,t,o){function n(i){return i instanceof t?i:new t(function(a){a(i)})}return new(t||(t=Promise))(function(i,a){function s(c){try{f(o.next(c))}catch(l){a(l)}}function p(c){try{f(o.throw(c))}catch(l){a(l)}}function f(c){c.done?i(c.value):n(c.value).then(s,p)}f((o=o.apply(e,r||[])).next())})}function ne(e,r){var t={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},o,n,i,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(f){return function(c){return p([f,c])}}function p(f){if(o)throw new TypeError("Generator is already executing.");for(;a&&(a=0,f[0]&&(t=0)),t;)try{if(o=1,n&&(i=f[0]&2?n.return:f[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,f[1])).done)return i;switch(n=0,i&&(f=[f[0]&2,i.value]),f[0]){case 0:case 1:i=f;break;case 4:return t.label++,{value:f[1],done:!1};case 5:t.label++,n=f[1],f=[0];continue;case 7:f=t.ops.pop(),t.trys.pop();continue;default:if(i=t.trys,!(i=i.length>0&&i[i.length-1])&&(f[0]===6||f[0]===2)){t=0;continue}if(f[0]===3&&(!i||f[1]>i[0]&&f[1]<i[3])){t.label=f[1];break}if(f[0]===6&&t.label<i[1]){t.label=i[1],i=f;break}if(i&&t.label<i[2]){t.label=i[2],t.ops.push(f);break}i[2]&&t.ops.pop(),t.trys.pop();continue}f=r.call(e,t)}catch(c){f=[6,c],n=0}finally{o=i=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}}function D(e){var r=typeof Symbol=="function"&&Symbol.iterator,t=r&&e[r],o=0;if(t)return t.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&o>=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw new TypeError(r?"Object is not iterable.":"Symbol.iterator is not defined.")}function $(e,r){var t=typeof Symbol=="function"&&e[Symbol.iterator];if(!t)return e;var o=t.call(e),n,i=[],a;try{for(;(r===void 0||r-- >0)&&!(n=o.next()).done;)i.push(n.value)}catch(s){a={error:s}}finally{try{n&&!n.done&&(t=o.return)&&t.call(o)}finally{if(a)throw a.error}}return i}function z(e,r,t){if(t||arguments.length===2)for(var o=0,n=r.length,i;o<n;o++)(i||!(o in r))&&(i||(i=Array.prototype.slice.call(r,0,o)),i[o]=r[o]);return e.concat(i||Array.prototype.slice.call(r))}function B(e){return this instanceof B?(this.v=e,this):new B(e)}function Ot(e,r,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o=t.apply(e,r||[]),n,i=[];return n=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",a),n[Symbol.asyncIterator]=function(){return this},n;function a(m){return function(y){return Promise.resolve(y).then(m,l)}}function s(m,y){o[m]&&(n[m]=function(d){return new Promise(function(h,g){i.push([m,d,h,g])>1||p(m,d)})},y&&(n[m]=y(n[m])))}function p(m,y){try{f(o[m](y))}catch(d){u(i[0][3],d)}}function f(m){m.value instanceof B?Promise.resolve(m.value.v).then(c,l):u(i[0][2],m)}function c(m){p("next",m)}function l(m){p("throw",m)}function u(m,y){m(y),i.shift(),i.length&&p(i[0][0],i[0][1])}}function Rt(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=e[Symbol.asyncIterator],t;return r?r.call(e):(e=typeof D=="function"?D(e):e[Symbol.iterator](),t={},o("next"),o("throw"),o("return"),t[Symbol.asyncIterator]=function(){return this},t);function o(i){t[i]=e[i]&&function(a){return new Promise(function(s,p){a=e[i](a),n(s,p,a.done,a.value)})}}function n(i,a,s,p){Promise.resolve(p).then(function(f){i({value:f,done:s})},a)}}function b(e){return typeof e=="function"}function Tt(e){var r=function(o){Error.call(o),o.stack=new Error().stack},t=e(r);return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var ie=Tt(function(e){return function(t){e(this),this.message=t?t.length+` errors occurred during unsubscription:
2
2
  `+t.map(function(o,n){return n+1+") "+o.toString()}).join(`
3
3
  `):"",this.name="UnsubscriptionError",this.errors=t}});function $e(e,r){if(e){var t=e.indexOf(r);0<=t&&e.splice(t,1)}}var ae=(function(){function e(r){this.initialTeardown=r,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var r,t,o,n,i;if(!this.closed){this.closed=!0;var a=this._parentage;if(a)if(this._parentage=null,Array.isArray(a))try{for(var s=D(a),p=s.next();!p.done;p=s.next()){var f=p.value;f.remove(this)}}catch(d){r={error:d}}finally{try{p&&!p.done&&(t=s.return)&&t.call(s)}finally{if(r)throw r.error}}else a.remove(this);var c=this.initialTeardown;if(b(c))try{c()}catch(d){i=d instanceof ie?d.errors:[d]}var l=this._finalizers;if(l){this._finalizers=null;try{for(var u=D(l),m=u.next();!m.done;m=u.next()){var y=m.value;try{Mt(y)}catch(d){i=i??[],d instanceof ie?i=z(z([],$(i)),$(d.errors)):i.push(d)}}}catch(d){o={error:d}}finally{try{m&&!m.done&&(n=u.return)&&n.call(u)}finally{if(o)throw o.error}}}if(i)throw new ie(i)}},e.prototype.add=function(r){var t;if(r&&r!==this)if(this.closed)Mt(r);else{if(r instanceof e){if(r.closed||r._hasParent(this))return;r._addParent(this)}(this._finalizers=(t=this._finalizers)!==null&&t!==void 0?t:[]).push(r)}},e.prototype._hasParent=function(r){var t=this._parentage;return t===r||Array.isArray(t)&&t.includes(r)},e.prototype._addParent=function(r){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(r),t):t?[t,r]:r},e.prototype._removeParent=function(r){var t=this._parentage;t===r?this._parentage=null:Array.isArray(t)&&$e(t,r)},e.prototype.remove=function(r){var t=this._finalizers;t&&$e(t,r),r instanceof e&&r._removeParent(this)},e.EMPTY=(function(){var r=new e;return r.closed=!0,r})(),e})();var No=ae.EMPTY;function se(e){return e instanceof ae||e&&"closed"in e&&b(e.remove)&&b(e.add)&&b(e.unsubscribe)}function Mt(e){b(e)?e():e.unsubscribe()}var R={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var H={setTimeout:function(e,r){for(var t=[],o=2;o<arguments.length;o++)t[o-2]=arguments[o];var n=H.delegate;return n?.setTimeout?n.setTimeout.apply(n,z([e,r],$(t))):setTimeout.apply(void 0,z([e,r],$(t)))},clearTimeout:function(e){var r=H.delegate;return(r?.clearTimeout||clearTimeout)(e)},delegate:void 0};function fe(e){H.setTimeout(function(){var r=R.onUnhandledError;if(r)r(e);else throw e})}function ze(){}var Ft=(function(){return He("C",void 0,void 0)})();function Pt(e){return He("E",void 0,e)}function Lt(e){return He("N",e,void 0)}function He(e,r,t){return{kind:e,value:r,error:t}}var j=null;function Nt(e){if(R.useDeprecatedSynchronousErrorHandling){var r=!j;if(r&&(j={errorThrown:!1,error:null}),e(),r){var t=j,o=t.errorThrown,n=t.error;if(j=null,o)throw n}}else e()}function Gt(e){R.useDeprecatedSynchronousErrorHandling&&j&&(j.errorThrown=!0,j.error=e)}var K=(function(e){Q(r,e);function r(t){var o=e.call(this)||this;return o.isStopped=!1,t?(o.destination=t,se(t)&&t.add(o)):o.destination=Pr,o}return r.create=function(t,o,n){return new ce(t,o,n)},r.prototype.next=function(t){this.isStopped?We(Lt(t),this):this._next(t)},r.prototype.error=function(t){this.isStopped?We(Pt(t),this):(this.isStopped=!0,this._error(t))},r.prototype.complete=function(){this.isStopped?We(Ft,this):(this.isStopped=!0,this._complete())},r.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},r.prototype._next=function(t){this.destination.next(t)},r.prototype._error=function(t){try{this.destination.error(t)}finally{this.unsubscribe()}},r.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},r})(ae);var Tr=Function.prototype.bind;function Ue(e,r){return Tr.call(e,r)}var Mr=(function(){function e(r){this.partialObserver=r}return e.prototype.next=function(r){var t=this.partialObserver;if(t.next)try{t.next(r)}catch(o){pe(o)}},e.prototype.error=function(r){var t=this.partialObserver;if(t.error)try{t.error(r)}catch(o){pe(o)}else pe(r)},e.prototype.complete=function(){var r=this.partialObserver;if(r.complete)try{r.complete()}catch(t){pe(t)}},e})(),ce=(function(e){Q(r,e);function r(t,o,n){var i=e.call(this)||this,a;if(b(t)||!t)a={next:t??void 0,error:o??void 0,complete:n??void 0};else{var s;i&&R.useDeprecatedNextContext?(s=Object.create(t),s.unsubscribe=function(){return i.unsubscribe()},a={next:t.next&&Ue(t.next,s),error:t.error&&Ue(t.error,s),complete:t.complete&&Ue(t.complete,s)}):a=t}return i.destination=new Mr(a),i}return r})(K);function pe(e){R.useDeprecatedSynchronousErrorHandling?Gt(e):fe(e)}function Fr(e){throw e}function We(e,r){var t=R.onStoppedNotification;t&&H.setTimeout(function(){return t(e,r)})}var Pr={closed:!0,next:ze,error:Fr,complete:ze};var U=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})();function kt(e){return e}function Dt(e){return e.length===0?kt:e.length===1?e[0]:function(t){return e.reduce(function(o,n){return n(o)},t)}}var C=(function(){function e(r){r&&(this._subscribe=r)}return e.prototype.lift=function(r){var t=new e;return t.source=this,t.operator=r,t},e.prototype.subscribe=function(r,t,o){var n=this,i=Nr(r)?r:new ce(r,t,o);return Nt(function(){var a=n,s=a.operator,p=a.source;i.add(s?s.call(i,p):p?n._subscribe(i):n._trySubscribe(i))}),i},e.prototype._trySubscribe=function(r){try{return this._subscribe(r)}catch(t){r.error(t)}},e.prototype.forEach=function(r,t){var o=this;return t=Bt(t),new t(function(n,i){var a=new ce({next:function(s){try{r(s)}catch(p){i(p),a.unsubscribe()}},error:i,complete:n});o.subscribe(a)})},e.prototype._subscribe=function(r){var t;return(t=this.source)===null||t===void 0?void 0:t.subscribe(r)},e.prototype[U]=function(){return this},e.prototype.pipe=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return Dt(r)(this)},e.prototype.toPromise=function(r){var t=this;return r=Bt(r),new r(function(o,n){var i;t.subscribe(function(a){return i=a},function(a){return n(a)},function(){return o(i)})})},e.create=function(r){return new e(r)},e})();function Bt(e){var r;return(r=e??R.Promise)!==null&&r!==void 0?r:Promise}function Lr(e){return e&&b(e.next)&&b(e.error)&&b(e.complete)}function Nr(e){return e&&e instanceof K||Lr(e)&&se(e)}function Gr(e){return b(e?.lift)}function E(e){return function(r){if(Gr(r))return r.lift(function(t){try{return e(t,this)}catch(o){this.error(o)}});throw new TypeError("Unable to lift unknown Observable type")}}function P(e,r,t,o,n){return new kr(e,r,t,o,n)}var kr=(function(e){Q(r,e);function r(t,o,n,i,a,s){var p=e.call(this,t)||this;return p.onFinalize=a,p.shouldUnsubscribe=s,p._next=o?function(f){try{o(f)}catch(c){t.error(c)}}:e.prototype._next,p._error=i?function(f){try{i(f)}catch(c){t.error(c)}finally{this.unsubscribe()}}:e.prototype._error,p._complete=n?function(){try{n()}catch(f){t.error(f)}finally{this.unsubscribe()}}:e.prototype._complete,p}return r.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var o=this.closed;e.prototype.unsubscribe.call(this),!o&&((t=this.onFinalize)===null||t===void 0||t.call(this))}},r})(K);var le=(function(e){return e&&typeof e.length=="number"&&typeof e!="function"});function ue(e){return b(e?.then)}function me(e){return b(e[U])}function de(e){return Symbol.asyncIterator&&b(e?.[Symbol.asyncIterator])}function he(e){return new TypeError("You provided "+(e!==null&&typeof e=="object"?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function Dr(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var xe=Dr();function ye(e){return b(e?.[xe])}function ge(e){return Ot(this,arguments,function(){var t,o,n,i;return ne(this,function(a){switch(a.label){case 0:t=e.getReader(),a.label=1;case 1:a.trys.push([1,,9,10]),a.label=2;case 2:return[4,B(t.read())];case 3:return o=a.sent(),n=o.value,i=o.done,i?[4,B(void 0)]:[3,5];case 4:return[2,a.sent()];case 5:return[4,B(n)];case 6:return[4,a.sent()];case 7:return a.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}})})}function be(e){return b(e?.getReader)}function M(e){if(e instanceof C)return e;if(e!=null){if(me(e))return Br(e);if(le(e))return jr(e);if(ue(e))return $r(e);if(de(e))return jt(e);if(ye(e))return zr(e);if(be(e))return Hr(e)}throw he(e)}function Br(e){return new C(function(r){var t=e[U]();if(b(t.subscribe))return t.subscribe(r);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function jr(e){return new C(function(r){for(var t=0;t<e.length&&!r.closed;t++)r.next(e[t]);r.complete()})}function $r(e){return new C(function(r){e.then(function(t){r.closed||(r.next(t),r.complete())},function(t){return r.error(t)}).then(null,fe)})}function zr(e){return new C(function(r){var t,o;try{for(var n=D(e),i=n.next();!i.done;i=n.next()){var a=i.value;if(r.next(a),r.closed)return}}catch(s){t={error:s}}finally{try{i&&!i.done&&(o=n.return)&&o.call(n)}finally{if(t)throw t.error}}r.complete()})}function jt(e){return new C(function(r){Ur(e,r).catch(function(t){return r.error(t)})})}function Hr(e){return jt(ge(e))}function Ur(e,r){var t,o,n,i;return Et(this,void 0,void 0,function(){var a,s;return ne(this,function(p){switch(p.label){case 0:p.trys.push([0,5,6,11]),t=Rt(e),p.label=1;case 1:return[4,t.next()];case 2:if(o=p.sent(),!!o.done)return[3,4];if(a=o.value,r.next(a),r.closed)return[2];p.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return s=p.sent(),n={error:s},[3,11];case 6:return p.trys.push([6,,9,10]),o&&!o.done&&(i=t.return)?[4,i.call(t)]:[3,8];case 7:p.sent(),p.label=8;case 8:return[3,10];case 9:if(n)throw n.error;return[7];case 10:return[7];case 11:return r.complete(),[2]}})})}function O(e,r,t,o,n){o===void 0&&(o=0),n===void 0&&(n=!1);var i=r.schedule(function(){t(),n?e.add(this.schedule(null,o)):this.unsubscribe()},o);if(e.add(i),!n)return i}function Se(e,r){return r===void 0&&(r=0),E(function(t,o){t.subscribe(P(o,function(n){return O(o,e,function(){return o.next(n)},r)},function(){return O(o,e,function(){return o.complete()},r)},function(n){return O(o,e,function(){return o.error(n)},r)}))})}function ve(e,r){return r===void 0&&(r=0),E(function(t,o){o.add(e.schedule(function(){return t.subscribe(o)},r))})}function $t(e,r){return M(e).pipe(ve(r),Se(r))}function zt(e,r){return M(e).pipe(ve(r),Se(r))}function Ht(e,r){return new C(function(t){var o=0;return r.schedule(function(){o===e.length?t.complete():(t.next(e[o++]),t.closed||this.schedule())})})}function Ut(e,r){return new C(function(t){var o;return O(t,r,function(){o=e[xe](),O(t,r,function(){var n,i,a;try{n=o.next(),i=n.value,a=n.done}catch(s){t.error(s);return}a?t.complete():t.next(i)},0,!0)}),function(){return b(o?.return)&&o.return()}})}function we(e,r){if(!e)throw new Error("Iterable cannot be null");return new C(function(t){O(t,r,function(){var o=e[Symbol.asyncIterator]();O(t,r,function(){o.next().then(function(n){n.done?t.complete():t.next(n.value)})},0,!0)})})}function Wt(e,r){return we(ge(e),r)}function Yt(e,r){if(e!=null){if(me(e))return $t(e,r);if(le(e))return Ht(e,r);if(ue(e))return zt(e,r);if(de(e))return we(e,r);if(ye(e))return Ut(e,r);if(be(e))return Wt(e,r)}throw he(e)}function Ye(e,r){return r?Yt(e,r):M(e)}function X(e,r){return E(function(t,o){var n=0;t.subscribe(P(o,function(i){o.next(e.call(r,i,n++))}))})}function qt(e,r,t,o,n,i,a,s){var p=[],f=0,c=0,l=!1,u=function(){l&&!p.length&&!f&&r.complete()},m=function(d){return f<o?y(d):p.push(d)},y=function(d){i&&r.next(d),f++;var h=!1;M(t(d,c++)).subscribe(P(r,function(g){n?.(g),i?m(g):r.next(g)},function(){h=!0},void 0,function(){if(h)try{f--;for(var g=function(){var x=p.shift();a?O(r,a,function(){return y(x)}):y(x)};p.length&&f<o;)g();u()}catch(x){r.error(x)}}))};return e.subscribe(P(r,m,function(){l=!0,u()})),function(){s?.()}}function W(e,r,t){return t===void 0&&(t=1/0),b(r)?W(function(o,n){return X(function(i,a){return r(o,i,n,a)})(M(e(o,n)))},t):(typeof r=="number"&&(t=r),E(function(o,n){return qt(o,n,e,t)}))}function Vt(e,r,t,o,n){return function(i,a){var s=t,p=r,f=0;i.subscribe(P(a,function(c){var l=f++;p=s?e(p,c,l):(s=!0,c),o&&a.next(p)},n&&(function(){s&&a.next(p),a.complete()})))}}function Qt(e,r){return E(Vt(e,r,arguments.length>=2,!1,!0))}var Wr=function(e,r){return e.push(r),e};function Ae(){return E(function(e,r){Qt(Wr,[])(e).subscribe(r)})}function Kt(e){let r=[],t=0,o;for(let n=0,i=e.length;n<i;n++){let a=e.charCodeAt(n);if(a>=48&&a<=57)t=t*10+a-48;else if(a===58)o=t,t=0;else{let s=e[n];s==="M"||s==="="||s==="X"?r.push({own:o===void 0?t:o,mate:t,op:"M"}):s==="I"?r.push({own:0,mate:t,op:s}):(s==="D"||s==="N")&&r.push({own:t,mate:0,op:s}),o=void 0,t=0}}return r}function Qe(e){let r="";for(let{own:t,mate:o,op:n}of Kt(e))r+=n==="M"?t===0?`${o}I`:o===0?`${t}D`:`${t}M`:`${n==="I"?o:t}${n}`;return r}var qe=2**28-1;function Ve(e,r,t){for(let o=r;o>0;o-=qe)e.push((Math.min(o,qe)<<4|t)>>>0)}function Yr(e,r,t){if(r===t)Ve(e,r,0);else{let o=Math.ceil(Math.max(r,t)/qe);for(let n=0;n<o;n++){let i=Math.floor(r*(n+1)/o)-Math.floor(r*n/o),a=Math.floor(t*(n+1)/o)-Math.floor(t*n/o);e.push((i<<4|9)>>>0,(a<<4|9)>>>0)}}}function Ke(e){let r=[];for(let{own:t,mate:o,op:n}of Kt(e))n==="M"?Yr(r,t,o):n==="I"?Ve(r,o,1):Ve(r,t,n==="N"?3:2);return Uint32Array.from(r)}function qr(e){return e>=48&&e<=57}function Vr(e){return e!==void 0&&/[A-Za-z]/.test(e)}function Xt(e,r){let t=r;for(;t<e.length&&Vr(e[t]);)t++;return t}function Zt(e,r){let t=r,o=0;for(;t<e.length&&qr(e.charCodeAt(t));)o=o*10+(e.charCodeAt(t)-48),t++;return{value:o,next:t}}function or(e,r){let t=0;for(;t<e.length;){let o=e[t];if(o===":"){let{value:n,next:i}=Zt(e,t+1);r(":",n,n,t+1,i),t=i}else if(o==="="){let n=Xt(e,t+1),i=n-t-1;r("=",i,i,t+1,n),t=n}else if(o==="*")r("*",1,1,t+1,Math.min(t+3,e.length)),t+=3;else if(o==="+"||o==="-"){let n=Xt(e,t+1),i=n-t-1;r(o,o==="-"?i:0,o==="+"?i:0,t+1,n),t=n}else if(o==="~"){let{value:n,next:i}=Zt(e,t+3),a=Math.min(i+2,e.length);r("~",n,0,t+1,a),t=a}else t++}}function Xe(e,r,t,o){let n=t??Number.NEGATIVE_INFINITY,i=o??Number.POSITIVE_INFINITY,a=0;or(e,(s,p,f,c,l)=>{if(s==="*")a>=n&&a<i&&r(88,a,1,e[c+1]??"",-1,0,0);else if(s==="+"){if(a>=n&&a<=i){let u=e.slice(c,l);r(73,a,f,u,-1,0,f)}}else(s==="-"||s==="~")&&a<i&&a+p>n&&r(s==="-"?68:78,a,p,"",-1,0,0);a+=p})}function nr(e,r,t,o){let n=0,i=0,a=[],s=t&&r;for(let p=0,f=e.length;p<f;p++){let c=e[p],l=c>>>4,u=c&15;if(u===0||u===7){if(s)for(let m=0;m<l;m++)(r.charCodeAt(i+m)|32)!==(t.charCodeAt(n+m)|32)&&a.push({start:n+m,type:"mismatch",base:r[i+m],altbase:t[n+m],length:1});i+=l,n+=l}else if(u===1)a.push({start:n,type:"insertion",insertlen:l,insertedBases:r?.slice(i,i+l),length:0}),i+=l;else if(u===2)a.push({start:n,type:"deletion",length:l}),n+=l;else if(u===3)a.push({start:n,type:"skip",length:l}),n+=l;else if(u===8){for(let m=0;m<l;m++)a.push({start:n+m,type:"mismatch",base:r?.[i+m]||"X",qual:o?.[i+m],length:1});i+=l,n+=l}else u===5?a.push({start:n,type:"hardclip",cliplen:l,length:1}):u===4&&(a.push({start:n,type:"softclip",cliplen:l,length:1}),i+=l)}return a}function ir(e,r,t,o,n){if(!r)return[];let i=[],a=r.length,s=o.length,p=n!==void 0,f=t.length,c=!1;for(let x=0;x<f;x++)if(t[x].type==="skip"){c=!0;break}let l=0,u=0,m=0,y=0,d=0,h=0,g=e.length;for(;h<g;){let x=e.charCodeAt(h);if(x>=48&&x<=57){let S=0;for(;h<g;){let v=e.charCodeAt(h);if(v>=48&&v<=57)S=S*10+(v-48),h++;else break}l+=S}else if(x===94)for(h++;h<g&&e.charCodeAt(h)>=65;)h++,l++;else if(x>=65){let S=e[h];if(h++,c&&f>0)for(let _=d;_<f;_++){let F=t[_];F.type==="skip"&&l>=F.start&&(l+=F.length,d=_+1)}let v=m,I=y;for(let _=u;_<a&&I<=l;_++,u=_){let F=r[_],G=F>>>4,w=F&15;w===4||w===1?v+=G:w===2||w===6||w===3?I+=G:w!==5&&(v+=G,I+=G)}m=v,y=I;let N=v-(I-l),J=N<s?o[N]:"X";i.push({start:l,base:J,qual:p?n[N]:void 0,altbase:S,length:1,type:"mismatch"}),l++}else h++}return i}var ar={77:0,73:1,68:2,78:3,83:4,72:5,80:6,61:7,88:8};function sr(e=""){let r=0,t=[];for(let o=0,n=e.length;o<n;o++){let i=e.charCodeAt(o);if(i>=48&&i<=57)r=r*10+(i-48);else{let a=ar[i];t.push(r<<4|a),r=0}}return t}function et(e=""){let r=0;for(let i=0,a=e.length;i<a;i++){let s=e.charCodeAt(i);(s<48||s>57)&&r++}let t=new Uint32Array(r),o=0,n=0;for(let i=0,a=e.length;i<a;i++){let s=e.charCodeAt(i);s>=48&&s<=57?o=o*10+(s-48):(t[n++]=o<<4|ar[s],o=0)}return t}function Oe(e,r,t,o,n){let i=sr(e),a=e?nr(i,t,o,n):[];return r&&t?a.concat(ir(r,i,a,t,n)):a}var Xr=397,Zr=387,Jr=385;function fr(e){return(1<<e&Xr)!==0}function pr(e){return(1<<e&Zr)!==0}function cr(e){return(1<<e&Jr)!==0}function tt(e,r,t,o,n,i,a){let s=n===-1?-1:1,p=r,f=n===-1?o:t,c=[],l=1/0,u=-1/0,m=1/0,y=-1/0,d=(h,g)=>{m=Math.min(m,h,g),y=Math.max(y,h,g)};for(let h=0;h<e.length;h++){let g=e[h],x=g>>>4,S=g&15,v=S===9,I=v||fr(S)?x:0,N=v?e[++h]>>>4:pr(S)?x:0,J=p+I,_=f+N*s,F=p,G=J;if(G>=i&&F<=a)if(I>0){let w=Math.max(F,i),Y=Math.min(G,a);if(Y>w)if(l=Math.min(l,w),u=Math.max(u,Y),v){let ct=N/x,lt=Y-w,ut=Math.round(lt*ct),mt=Math.round(f+(w-p)*ct*s);c.push(lt<<4|9,ut<<4|9),d(mt,mt+ut*s)}else c.push(Y-w<<4|S),cr(S)?d(f+(w-p)*s,f+(Y-p)*s):d(f,f)}else N>0&&(v?c.push(g,e[h]):c.push(g),l=Math.min(l,p),u=Math.max(u,p),d(f,_));if(p=J,f=_,p>a)break}if(c.length!==0)return{start:l,end:u,mateStart:m,mateEnd:y,cigar:Uint32Array.from(c)}}function eo(e){return e===1||e===2||e===3}function rt(e,r,t,o,n,i){let a=n===-1?-1:1,s=[],p=r,f=n===-1?o:t,c,l=!1,u=()=>{c!==void 0&&l&&c.qHi>c.qLo&&s.push({start:c.qLo,end:c.qHi,mateStart:c.tLo,mateEnd:c.tHi,cigar:Uint32Array.from(c.ops)}),c=void 0,l=!1};for(let m=0;m<e.length;m++){let y=e[m],d=y>>>4,h=y&15,g=h===9,x=g?e[++m]:void 0,S=g||fr(h)?d:0,v=x!==void 0?x>>>4:pr(h)?d:0,I=f+v*a;eo(h)&&d>=i?u():(S>0||v>0)&&(c===void 0&&(c={qLo:p,qHi:p,tLo:f,tHi:f,ops:[]}),c.qHi=p+S,c.tLo=Math.min(c.tLo,f,I),c.tHi=Math.max(c.tHi,f,I),c.ops.push(y),x!==void 0&&c.ops.push(x),l=l||g||cr(h)),p+=S,f=I}return u(),s}function lr(e){let r=e.get("CIGAR");return typeof r=="string"?r:void 0}function ur(e){let r=e.get("coarseCigar");return typeof r=="string"?r:void 0}function ot(e){let r=lr(e),t=r===void 0?ur(e):void 0;return r!==void 0?et(r):t!==void 0?Ke(t):void 0}var to=A(q(),1),ro=A(dr(),1);var oo=A(q(),1);var no=A(Cr(),1);var hr=A(q(),1),L=class extends hr.SimpleFeature{get(r){return r==="mismatches"?Oe(this.walkableCigar):r==="clipLengthAtStartOfRead"?this.clipLengthAtStartOfRead:r==="name"?super.get("name")??this.mate?.refName:super.get(r)}get mate(){return super.get("mate")}get walkableCigar(){let r=super.get("CIGAR"),t=super.get("coarseCigar");return typeof r=="string"?r:typeof t=="string"?Qe(t):void 0}get clipLengthAtStartOfRead(){return this.mate?.start??0}forEachMismatch(r,t){let o=this.get("start"),n=t?.start===void 0?void 0:t.start-o,i=t?.end===void 0?void 0:t.end-o,a=this.get("cs");if(a)Xe(a,r,n,i);else{let s=n??Number.NEGATIVE_INFINITY,p=i??Number.POSITIVE_INFINITY;for(let f of Oe(this.walkableCigar))(f.type==="deletion"||f.type==="skip"?f.start<p&&f.start+f.length>s:f.start>=s&&f.start<=p)&&(f.type==="mismatch"?r(88,f.start,f.length,f.base,f.qual??-1,0,0):f.type==="insertion"?r(73,f.start,f.length,f.insertedBases??"",-1,0,f.insertlen):f.type==="deletion"?r(68,f.start,f.length,"",-1,0,0):f.type==="skip"&&r(78,f.start,f.length,"",-1,0,0))}}};var io=["CIGAR","cs","coarseCigar","cg","cr"];function ao(e){return typeof e=="object"&&e!==null&&"refName"in e&&"start"in e&&"end"in e&&typeof e.refName=="string"&&typeof e.start=="number"&&typeof e.end=="number"}function so(e){let r=e.get("mate");return ao(r)?r:void 0}function fo(e,r,t,o){let n=Math.max(e.start,o.start),i=Math.min(e.end,o.end),a=(r.end-r.start)/Math.max(e.end-e.start,1),s=c=>t===-1?r.end-(c-e.start)*a:r.start+(c-e.start)*a,p=Math.round(s(n)),f=Math.round(s(i));return i>n?{start:n,end:i,mateStart:Math.min(p,f),mateEnd:Math.max(p,f)}:void 0}function po(e,r,t,o,n){let i={start:e.get("start"),end:e.get("end")},a=e.get("strand")===-1?-1:1,s=i.start>=t.start&&i.end<=t.end,p=s&&o===void 0&&!n?void 0:ot(e);if(p===void 0){let f=s?{...i,mateStart:r.start,mateEnd:r.end}:fo(i,r,a,t);return f===void 0?[]:[f]}else return(o===void 0?[{...i,mateStart:r.start,mateEnd:r.end,cigar:p}]:rt(p,i.start,r.start,r.end,a,o)).flatMap(c=>{let l=tt(c.cigar,c.start,c.mateStart,c.mateEnd,a,t.start,t.end);return l===void 0?[]:[l]})}function co(e,r,t,o,n,i){let a=`:${o.start}-${o.end}${n}`,s=e.toJSON(),p={...s,uniqueId:`${e.id()}${a}`,start:t.start,end:t.end,mate:{...r,start:t.mateStart,end:t.mateEnd}};s.syntenyId!==void 0&&(p.syntenyId=`${String(s.syntenyId)}${a}`);for(let f of io)delete p[f];return i&&t.cigar&&(p.alignmentOps=t.cigar),new L(p)}function xr(e,r,t,o=!1){let n=so(e);if(n===void 0)return[e];{let i=po(e,n,r,t,o);return i.map((a,s)=>co(e,n,a,r,i.length>1?`/${s}`:"",o))}}var Re=class extends yr.BaseFeatureDataAdapter{constructor(){super(...arguments);this.recordsAreAlignments=!0}static{this.capabilities=["getFeatures","getRefNames"]}async hasDataForRefName(){return!0}getFeaturesInMultipleRegions(t,o={}){let{clipToRegion:n,splitAtGapBp:i,keepAlignment:a,...s}=o,p=n&&this.recordsAreAlignments,f=(0,gr.createStatusFanOut)(s.statusCallback);return Ye(t).pipe(W((c,l)=>this.getFeatures(c,{...s,statusCallback:f()}).pipe(W(u=>p?xr(u,u.get("assemblyName")===c.assemblyName?c:{start:u.get("start"),end:u.get("end")},i,a):[u]),Ae(),X(u=>({index:l,features:u})))),Ae(),W(c=>c.sort((l,u)=>l.index-u.index).flatMap(l=>l.features)))}};var Me=class extends Error{constructor(t){super(t===void 0?"no haplotype index is set, so the walks cannot be named; build one with gbz-haplotype-index (cargo install gbz-haplotype-index) and set it as haplotypeIndexLocation":`the haplotype index beside the graph database could not be checked (${t}), so the walks cannot be named; if it is there, reload to try again, or set haplotypeIndexLocation`);this.name="NoHaplotypeIndexError"}},ft=class extends Error{constructor(t){super(`a pair query names both lanes: queryAssemblyName ${t} came without a targetAssemblyName`);this.name="PairTargetError"}},Fe=class extends Error{constructor(t,o){super(`the graph is cut on its reference, ${o}; a window on ${t} has no reference coordinates to cut at. Open the graph from a ${o} view, and find this haplotype's lane there`);this.name="HaplotypeWindowError"}};function nt(e,r){let t=T(r);return e[t]??e[r.sample]??t}function lo(e,r){return`${T(e)}#${e.contig}@${r.start.node}.${r.start.offset}`}function uo({alignment:e,assemblyName:r,refName:t,lane:o}){let{refStart:n,refEnd:i,strand:a,cigar:s}=e;if(!(!e.resolved||i<=n)){let{name:p,hapStart:f,hapEnd:c}=e,l=lo(p,e),u={uniqueId:l,assemblyName:r,refName:t,start:n,end:i,type:"match",strand:a==="-"?-1:1,CIGAR:s,syntenyId:l,mate:{refName:p.contig,start:f,end:c,assemblyName:o}};return new L(u)}}function mo({pair:e,lane:r,mateLane:t}){let o=`${T(e.target)}#${e.target.contig}:${e.targetStart}-${e.targetEnd}|${T(e.query)}#${e.query.contig}:${e.queryStart}-${e.queryEnd}`;return new L({uniqueId:o,assemblyName:r,refName:e.target.contig,start:e.targetStart,end:e.targetEnd,type:"match",strand:e.strand==="-"?-1:1,CIGAR:e.cigar,syntenyId:o,identity:e.matches/Math.max(e.columns,1),numMatches:e.matches,blockLen:e.columns,mate:{refName:e.query.contig,start:e.queryStart,end:e.queryEnd,assemblyName:t}})}function ho(e,r,t){let o=re(e,r,t);return o&&(o.message+="; the track's Graph display draws every haplotype's overview at any size"),o}var it=e=>!("uri"in e)||e.uri!=="",pt=class extends Re{constructor(){super(...arguments);this.graph=(0,at.cachedSetup)({label:"Opening pangenome database",setup:async()=>{let t=this.getConf("gbzDbLocation"),o=this.getConf("haplotypeIndexLocation"),n=it(o)?{location:o}:await Ct(t,this.pluginManager),i=n.location,a=await dt.open({source:(0,Te.openLocation)(t,this.pluginManager),haplotypeIndex:i?(0,Te.openLocation)(i,this.pluginManager):void 0}),s=this.getConf("assemblyNames")[0];if(s===void 0)throw new Error("GbzBaseSyntenyAdapter needs assemblyNames: its first entry is the assembly the reference sample is loaded as");let p=await Le(a),f=te({configured:this.getConf("referenceSample"),anchorPrefix:k(this,s),referenceSamples:p});return{db:a,anchor:s,referenceSample:f,referenceSamples:p,unreadableIndex:n.unreadable}}});this.gaf=(0,at.cachedSetup)({label:"Opening reads",setup:async()=>{let t=this.getConf("readsLocation"),o=this.getConf(["readsIndex","location"]);return it(t)?new oe((0,Te.openLocation)(t,this.pluginManager),it(o)?wt(this,["readsLocation"],["readsIndex"]):void 0):void 0}})}async referenceQuery(t,o){let{db:n,referenceSample:i}=await this.graph(o);return Ne(n,i,t)}async getHaplotypes(t={}){let{db:o,referenceSamples:n}=await this.graph(t),i=new Map;for(let a of await o.paths()){let s=T(a.name),p=i.get(s);p?p.contigs.includes(a.name.contig)||p.contigs.push(a.name.contig):i.set(s,{prefix:s,sample:a.name.sample,haplotype:a.name.haplotype,contigs:[a.name.contig],isReference:n.includes(a.name.sample)})}return[...i.values()]}async getHeader(t={}){let{anchor:o,referenceSample:n,referenceSamples:i}=await this.graph(t),a=ee(this),s=[];for(let p of await this.getHaplotypes(t))p.sample!==n&&s.push({name:nt(a,p),label:p.prefix,group:p.sample});return{hasCoarseTier:!1,anchorAssemblyName:o,referenceSample:n,referenceSamples:i,lanes:s}}async getRefNames(t={}){let{db:o,anchor:n,referenceSample:i}=await this.graph(t),{assemblyName:a}=t,s=a===n?void 0:k(this,a),p=(await o.paths()).filter(f=>a===n?f.isIndexed&&f.name.sample===i:V(T(f.name),s)).map(f=>f.name.contig);return[...new Set(p)]}keepPredicate(t,o){let n=t===void 0||t.length===0?void 0:t.map(i=>k(this,i));return n===void 0&&o===void 0?void 0:i=>Pe(i,n)&&(o===void 0||V(T(i),o))}async getSubgraph(t,o={}){let{db:n,anchor:i,unreadableIndex:a}=await this.graph(),{assemblyName:s,refName:p,start:f,end:c}=t;if(s!==i)throw new Fe(s,i);let l=await this.referenceQuery(p,{}),u=this.keepPredicate(o.haplotypes);if(u!==void 0&&!n.hasHaplotypeIndex)throw new Me(a);return Ge(n,l,f,c,{context:this.getConf("context"),snarls:o.snarls??this.getConf("subgraphSnarls"),limit:this.getConf("nodeLimit"),signal:o.signal,keep:u})}async getOverview(t,o){let{db:n,anchor:i,referenceSample:a}=await this.graph(),{assemblyName:s,refName:p,start:f,end:c}=t;if(s!==i)throw new Fe(s,i);let l=await this.referenceQuery(p,{}),u=l?await n.haplotypeOverview({path:l,start:f,end:c,bpPerPixel:o.bpPerPx}):void 0;if(!u)return;let m=ee(this),y=u.haplotypes.map(h=>T(h)),d=new Set;for(let h of o.haplotypes??[]){let g=k(this,h);y.forEach((x,S)=>{V(x,g)&&d.add(S)})}return{level:u.level,bin:u.bin,rows:u.haplotypes.map(h=>nt(m,h)),pinned:[...d],reference:u.haplotypes.flatMap((h,g)=>h.sample===a?[g]:[]),bins:u.bins,cells:u.cells}}async getReads(t,o={}){let n=await this.gaf(o);return n?n.readsOver(new Set(t),o):{records:[],total:0}}async laneHaplotypes(t,o){let n=k(this,t);return(await this.getHaplotypes(o)).filter(i=>V(i.prefix,n))}async anchorFeatures(t,o){let{db:n}=await this.graph(o),{assemblyName:i,refName:a,start:s,end:p}=t,f=k(this,o.targetAssemblyName),c=ee(this),l=this.keepPredicate(o.haplotypes,f),u=await this.referenceQuery(a,o),m=this.getConf("nodeLimit");return(u?await(0,st.updateStatus)(`Reading graph ${a}:${s.toLocaleString()}-${p.toLocaleString()}`,o.statusCallback,()=>n.getAlignments({path:u,start:s,end:p,context:this.getConf("context"),haplotypes:"all",limit:m,signal:o.signal,keep:l}).catch(d=>{throw ho(d,m,p-s)??d})):[]).flatMap(d=>{let h=d.resolved?uo({alignment:d,assemblyName:i,refName:a,lane:nt(c,d.name)}):void 0;return h===void 0?[]:[h]})}async pairFeatures(t,o,n){let{targetAssemblyName:i}=n;if(i===void 0)throw new ft(o);let{db:a}=await this.graph(n),{refName:s,start:p,end:f}=t,c=await this.laneHaplotypes(o,n),l=await this.laneHaplotypes(i,n),u=[...c,...l],m=await this.referenceQuery(s,n),y=this.getConf("nodeLimit"),d=g=>a.getSubgraphs({path:g,start:p,end:f,context:this.getConf("context"),snarls:this.getConf("subgraphSnarls"),haplotypes:"all",limit:y,signal:n.signal,keep:x=>u.some(S=>S.sample===x.sample&&S.haplotype===x.haplotype)}).catch(x=>{throw re(x,y,f-p)??x});return(m&&c.length>0&&l.length>0?await(0,st.updateStatus)(`Reading ${o} against ${i}`,n.statusCallback,()=>d(m)):[]).flatMap(g=>c.flatMap(x=>l.flatMap(S=>g.pairAlignments({target:x,query:S,bases:!1}).map(v=>mo({pair:v,lane:o,mateLane:i})))))}getFeatures(t,o={}){return(0,br.ObservableCreate)(async n=>{let{db:i,anchor:a,unreadableIndex:s}=await this.graph(o);if(!i.hasHaplotypeIndex)throw new Me(s);if(t.assemblyName===a){let p=o.queryAssemblyName===void 0?await this.anchorFeatures(t,o):await this.pairFeatures(t,o.queryAssemblyName,o);for(let f of p)n.next(f)}n.complete()},o.signal)}};export{Fe as HaplotypeWindowError,Me as NoHaplotypeIndexError,vr as NoReferenceSampleError,wr as NodeLimitError,ft as PairTargetError,pt as default,uo as fragmentFeature,T as haplotypePrefix,nt as laneAssemblyName,re as nodeLimitError,mo as pairFeature,te as resolveReferenceSample};
4
- //# sourceMappingURL=GbzBaseSyntenyAdapter-CKKVHC2R.js.map
4
+ //# sourceMappingURL=GbzBaseSyntenyAdapter-C2IGNBR4.js.map
@@ -1,4 +1,4 @@
1
- import{a as x}from"./chunk-WKVVIDCS.js";import"./chunk-SJNG2XK7.js";import"./chunk-O4XV3K35.js";import{Z as L}from"./chunk-H54W6OQQ.js";import"./chunk-UQEPPJEO.js";import"./chunk-SCMIJAAX.js";import"./chunk-7BKUWQE5.js";import"./chunk-KULNKXPT.js";import"./chunk-FCWXYIFC.js";import{a as B}from"./chunk-J6KYLXRD.js";import{a as s,b as v,c as g,d as G}from"./chunk-TYJTJGPO.js";import{b as a}from"./chunk-FY3BTKY4.js";var S=a(g(),1);var m=a(v(),1),n=a(G(),1),C=a(g(),1),P=a(L(),1),o=a(s(),1),I=(0,P.makeStyles)()({paper:{padding:16,margin:8,maxWidth:560,marginInline:"auto",display:"flex",flexDirection:"column",gap:12},row:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8}}),b=(0,C.observer)(function({model:e}){let{classes:r}=I();return e.isLoading?(0,o.jsxs)(n.Paper,{className:r.paper,"data-testid":"graph-genome-loading",children:[(0,o.jsxs)("div",{className:r.row,children:[(0,o.jsx)(m.LoadingEllipses,{variant:"h6",message:e.statusMessage}),(0,o.jsx)(n.Button,{size:"small","data-testid":"graph-genome-cancel",onClick:()=>{e.cancelLoad()},children:"Cancel"})]}),(0,o.jsx)(n.LinearProgress,{variant:"indeterminate"})]}):e.error?(0,o.jsx)(n.Paper,{className:r.paper,children:(0,o.jsx)(m.ErrorBanner,{error:e.error,onReset:()=>{e.retryLoad()}})}):(0,o.jsx)(n.Paper,{className:r.paper,"data-testid":"graph-genome-load-canceled",children:(0,o.jsxs)("div",{className:r.row,children:[(0,o.jsx)(n.Typography,{variant:"h6",children:"Loading canceled"}),(0,o.jsx)(n.Button,{variant:"contained",size:"small","data-testid":"graph-genome-retry",onClick:()=>{e.retryLoad()},children:"Retry"})]})})}),h=b;var M=a(B(),1),N=a(v(),1),i=a(G(),1),w=a(g(),1),E=a(L(),1),t=a(s(),1),k=`H VN:Z:1.0
1
+ import{a as x}from"./chunk-AFYY6LQF.js";import"./chunk-N2I4OWIA.js";import"./chunk-YZAO5LPU.js";import{_ as L}from"./chunk-ALTI7LTL.js";import"./chunk-UQEPPJEO.js";import"./chunk-SCMIJAAX.js";import"./chunk-7BKUWQE5.js";import"./chunk-KULNKXPT.js";import"./chunk-FCWXYIFC.js";import{a as B}from"./chunk-J6KYLXRD.js";import{a as s,b as v,c as g,d as G}from"./chunk-TYJTJGPO.js";import{b as a}from"./chunk-FY3BTKY4.js";var S=a(g(),1);var m=a(v(),1),n=a(G(),1),C=a(g(),1),P=a(L(),1),o=a(s(),1),I=(0,P.makeStyles)()({paper:{padding:16,margin:8,maxWidth:560,marginInline:"auto",display:"flex",flexDirection:"column",gap:12},row:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8}}),b=(0,C.observer)(function({model:e}){let{classes:r}=I();return e.isLoading?(0,o.jsxs)(n.Paper,{className:r.paper,"data-testid":"graph-genome-loading",children:[(0,o.jsxs)("div",{className:r.row,children:[(0,o.jsx)(m.LoadingEllipses,{variant:"h6",message:e.statusMessage}),(0,o.jsx)(n.Button,{size:"small","data-testid":"graph-genome-cancel",onClick:()=>{e.cancelLoad()},children:"Cancel"})]}),(0,o.jsx)(n.LinearProgress,{variant:"indeterminate"})]}):e.error?(0,o.jsx)(n.Paper,{className:r.paper,children:(0,o.jsx)(m.ErrorBanner,{error:e.error,onReset:()=>{e.retryLoad()}})}):(0,o.jsx)(n.Paper,{className:r.paper,"data-testid":"graph-genome-load-canceled",children:(0,o.jsxs)("div",{className:r.row,children:[(0,o.jsx)(n.Typography,{variant:"h6",children:"Loading canceled"}),(0,o.jsx)(n.Button,{variant:"contained",size:"small","data-testid":"graph-genome-retry",onClick:()=>{e.retryLoad()},children:"Retry"})]})})}),h=b;var M=a(B(),1),N=a(v(),1),i=a(G(),1),w=a(g(),1),E=a(L(),1),t=a(s(),1),k=`H VN:Z:1.0
2
2
  S 1 ACGT
3
3
  S 2 GGCC
4
4
  S 3 TTAA
@@ -7,4 +7,4 @@ L 1 + 2 + 0M
7
7
  L 1 + 3 + 0M
8
8
  L 2 + 4 + 0M
9
9
  L 3 + 4 + 0M`,z=(0,E.makeStyles)()({column:{display:"flex",flexDirection:"column",gap:8},rowEnd:{display:"flex",gap:8,alignItems:"flex-end"},rowCenter:{display:"flex",gap:8,alignItems:"center"},flex1:{flex:1},paper:{padding:16,margin:8,maxWidth:560,marginInline:"auto"},header:{marginBottom:12},footer:{marginTop:12,display:"flex",justifyContent:"flex-end"}}),R=(0,w.observer)(function({model:e}){let{classes:r}=z(),[d,T]=(0,M.useState)("");function y(){d.trim()&&e.loadGFAFromLocation({uri:d,locationType:"UriLocation"})}function A(p){let c=p.target.files?.[0];c&&c.text().then(f=>e.loadGFA(f,c.name)).catch(f=>{e.setError(f)})}return(0,t.jsxs)(i.Paper,{className:r.paper,children:[(0,t.jsx)("div",{className:r.header,children:(0,t.jsx)(i.Typography,{variant:"h6",children:"Load a GFA graph"})}),(0,t.jsxs)("div",{className:r.column,children:[(0,t.jsxs)("div",{className:r.rowCenter,children:[(0,t.jsxs)(i.Button,{variant:"outlined",component:"label",size:"small",children:["Choose file",(0,t.jsx)("input",{type:"file",accept:".gfa,.gfa1,.gfa2",hidden:!0,onChange:p=>{A(p)}})]}),(0,t.jsx)(i.Typography,{variant:"caption",color:"text.secondary",children:"Whole-file GFA; best for small/medium graphs."})]}),(0,t.jsxs)("div",{className:r.rowEnd,children:[(0,t.jsx)(i.TextField,{size:"small",label:"URL",placeholder:"https://example.com/graph.gfa",value:d,onChange:p=>{T(p.target.value)},onKeyDown:p=>{p.key==="Enter"&&y()},className:r.flex1}),(0,t.jsx)(i.Button,{variant:"contained",onClick:()=>{y()},disabled:!d.trim(),children:"Open"})]})]}),(0,t.jsx)("div",{className:r.footer,children:(0,t.jsx)(i.Button,{size:"small",onClick:()=>{e.loadGFA(k,"Example graph")},children:"Load 4-node example"})}),e.error?(0,t.jsx)(N.ErrorBanner,{error:e.error}):null]})}),F=R;var l=a(s(),1),U=(0,S.observer)(function({model:e}){return e.hasGraph?(0,l.jsx)(x,{model:e}):e.canRetryLoad&&(e.error||e.loadCanceled)?(0,l.jsx)(h,{model:e}):(0,l.jsxs)(l.Fragment,{children:[e.isLoading?(0,l.jsx)(h,{model:e}):null,(0,l.jsx)("div",{hidden:e.isLoading,children:(0,l.jsx)(F,{model:e})})]})}),O=U;export{O as default};
10
- //# sourceMappingURL=GraphGenomeView-YYP4IFSI.js.map
10
+ //# sourceMappingURL=GraphGenomeView-TKK67NXR.js.map
@@ -1,4 +1,4 @@
1
- import{a as g}from"./chunk-SJNG2XK7.js";import{Z as f}from"./chunk-H54W6OQQ.js";import"./chunk-7BKUWQE5.js";import"./chunk-KULNKXPT.js";import{a as x}from"./chunk-J6KYLXRD.js";import{a as l,c as m,d as y}from"./chunk-TYJTJGPO.js";import{b as o}from"./chunk-FY3BTKY4.js";var a=o(y(),1),b=o(m(),1),S=o(f(),1),n=o(l(),1),L=(0,S.makeStyles)()({section:{marginBottom:24},formControl:{minWidth:200}}),w=[{value:0,label:"None"},{value:1,label:"1 hop"},{value:2,label:"2 hops"}],k=(0,b.observer)(function({model:e}){let{classes:t}=L();return(0,n.jsxs)("div",{className:t.section,children:[(0,n.jsxs)(a.FormControl,{className:t.formControl,children:[(0,n.jsx)(a.InputLabel,{children:"Graph context"}),(0,n.jsx)(a.Select,{value:e.subgraphContext,label:"Graph context","data-testid":"graph-context-select",onChange:p=>{e.setSubgraphContext(p.target.value),e.cut()},children:w.map(({value:p,label:u})=>(0,n.jsx)(a.MenuItem,{value:p,children:u},p))})]}),(0,n.jsx)(a.Typography,{variant:"caption",color:"text.secondary",children:"How far the cut follows links out of the region, one hop by default. A detour that leaves the reference before the window and rejoins after it is indexed under its own sequence, so at none its middle is missing and the one bubble draws as two unrelated stubs. Each hop costs a query per off-reference segment already reached."})]})}),v=k;var C=o(x(),1),d=o(y(),1),c=o(m(),1),G=o(f(),1),i=o(l(),1),T=(0,G.makeStyles)()({section:{marginBottom:24}});function M(r){let e=r.split(/[\s,]+/).map(t=>t.trim()).filter(t=>t!=="");return e.length===0?void 0:e}var F=(0,c.observer)(function({model:e}){let[t,p]=(0,C.useState)(e.chosenHaplotypes?.join(", ")??""),u=()=>{let s=M(t)??[];s.join(`
1
+ import{a as g}from"./chunk-N2I4OWIA.js";import{_ as f}from"./chunk-ALTI7LTL.js";import"./chunk-7BKUWQE5.js";import"./chunk-KULNKXPT.js";import{a as x}from"./chunk-J6KYLXRD.js";import{a as l,c as m,d as y}from"./chunk-TYJTJGPO.js";import{b as o}from"./chunk-FY3BTKY4.js";var a=o(y(),1),b=o(m(),1),S=o(f(),1),n=o(l(),1),L=(0,S.makeStyles)()({section:{marginBottom:24},formControl:{minWidth:200}}),w=[{value:0,label:"None"},{value:1,label:"1 hop"},{value:2,label:"2 hops"}],k=(0,b.observer)(function({model:e}){let{classes:t}=L();return(0,n.jsxs)("div",{className:t.section,children:[(0,n.jsxs)(a.FormControl,{className:t.formControl,children:[(0,n.jsx)(a.InputLabel,{children:"Graph context"}),(0,n.jsx)(a.Select,{value:e.subgraphContext,label:"Graph context","data-testid":"graph-context-select",onChange:p=>{e.setSubgraphContext(p.target.value),e.cut()},children:w.map(({value:p,label:u})=>(0,n.jsx)(a.MenuItem,{value:p,children:u},p))})]}),(0,n.jsx)(a.Typography,{variant:"caption",color:"text.secondary",children:"How far the cut follows links out of the region, one hop by default. A detour that leaves the reference before the window and rejoins after it is indexed under its own sequence, so at none its middle is missing and the one bubble draws as two unrelated stubs. Each hop costs a query per off-reference segment already reached."})]})}),v=k;var C=o(x(),1),d=o(y(),1),c=o(m(),1),G=o(f(),1),i=o(l(),1),T=(0,G.makeStyles)()({section:{marginBottom:24}});function M(r){let e=r.split(/[\s,]+/).map(t=>t.trim()).filter(t=>t!=="");return e.length===0?void 0:e}var F=(0,c.observer)(function({model:e}){let[t,p]=(0,C.useState)(e.chosenHaplotypes?.join(", ")??""),u=()=>{let s=M(t)??[];s.join(`
2
2
  `)===(e.chosenHaplotypes??[]).join(`
3
3
  `)||(e.setSubgraphHaplotypes(s),e.cut())};return(0,i.jsx)(d.TextField,{fullWidth:!0,label:"Haplotypes",placeholder:"every haplotype",value:t,slotProps:{htmlInput:{"data-testid":"graph-haplotypes-field"}},onChange:s=>{p(s.target.value)},onBlur:()=>{u()},onKeyDown:s=>{s.key==="Enter"&&u()}})}),N=(0,c.observer)(function({model:e}){let{classes:t}=T();return e.adapterConfig.type==="GbzBaseSyntenyAdapter"?(0,i.jsxs)("div",{className:t.section,children:[(0,i.jsx)(F,{model:e},e.chosenHaplotypes?.join(",")??""),(0,i.jsx)(d.Typography,{variant:"caption",color:"text.secondary",children:"The haplotypes the cut is for, as lane assembly names or PanSN prefixes (HG002#1, or HG002 for both), separated by commas. The cut keeps their walks and the nodes those walks visit, with the reference. Empty is every haplotype."})]}):null}),H=N;var h=o(l(),1);function B({model:r,open:e,onClose:t}){return(0,h.jsxs)(g,{model:r,open:e,onClose:t,children:[(0,h.jsx)(v,{model:r}),(0,h.jsx)(H,{model:r})]})}export{B as default};
4
- //# sourceMappingURL=GraphTrackSettingsDialog-2WPJRAJC.js.map
4
+ //# sourceMappingURL=GraphTrackSettingsDialog-RKZ5XIKY.js.map
@@ -1,2 +1,2 @@
1
- import{b as S,g as N,h as X,i as E,j as Y,k as A,m as k,n as W,o as J}from"./chunk-BZOIENU5.js";import"./chunk-2H7GDQ3R.js";import{a as B}from"./chunk-WKVVIDCS.js";import"./chunk-SJNG2XK7.js";import"./chunk-O4XV3K35.js";import"./chunk-H54W6OQQ.js";import"./chunk-UQEPPJEO.js";import"./chunk-SCMIJAAX.js";import"./chunk-7BKUWQE5.js";import"./chunk-KULNKXPT.js";import"./chunk-FCWXYIFC.js";import{a as Q}from"./chunk-J6KYLXRD.js";import{a as O,c as G}from"./chunk-TYJTJGPO.js";import{a as R,b as a}from"./chunk-FY3BTKY4.js";var I=R((ee,F)=>{F.exports=JBrowseExports["@jbrowse/display-kit/DisplayChrome"]});var _=R((te,V)=>{V.exports=JBrowseExports["@jbrowse/core/ui/BaseTooltip"]});var z=a(I(),1),K=a(G(),1);var s=a(Q(),1),j=a(_(),1),L=a(G(),1);var n=a(O(),1),U=(0,L.observer)(function({data:e,region:y,pointer:o}){let c=k(e,o.bin),t=o.row===void 0?void 0:e.cells[o.bin*e.rows.length+o.row];return(0,n.jsxs)(j.default,{clientPoint:{x:o.clientX,y:o.clientY},children:[(0,n.jsxs)("div",{children:[y.refName,":",c.span]}),o.row!==void 0&&t!==void 0?(0,n.jsxs)("div",{children:[(0,n.jsx)("strong",{children:e.rows[o.row]}),": ",X(t)]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{children:c.classes}),(0,n.jsx)("div",{children:c.excursions})]}),(0,n.jsx)("div",{style:{opacity:.7},children:N})]})}),Z=(0,L.observer)(function({model:e}){let y=(0,s.useRef)(null),[o,c]=(0,s.useState)(),{overview:t,overviewRegion:u,overviewCounts:M,overviewAllRows:T,height:l,host:w}=e,m=w?.width??0,x=w&&u?S(w,u):void 0,f=x?.scale,h=x?.translateX,d=(0,s.useMemo)(()=>t?E(t,T,l):void 0,[t,T,l]),v=typeof window>"u"?1:window.devicePixelRatio||1,D=(0,s.useMemo)(()=>t&&d?W(t,d,v):[],[t,d,v]);(0,s.useEffect)(()=>{let i=y.current,r=i?.getContext("2d");if(!i||!r||!t||!d||f===void 0||h===void 0)return;let p=Math.round(m*v),g=Math.round(l*v);(i.width!==p||i.height!==g)&&(i.width=p,i.height=g),r.setTransform(v,0,0,v,0,0),J(r,t,M,d,D,{xOf:b=>b*f+h,width:m,height:l,dpr:v}),e.setOverviewPainted(t)},[e,t,M,d,D,f,h,m,l,v]);let P=i=>{if(!t||!d||!f||h===void 0)return;let r=i.currentTarget.getBoundingClientRect(),p=i.clientX-r.left,g=i.clientY-r.top,b=A(t,(p-h)/f);return b===void 0?void 0:{bin:b,row:Y(d,g),clientX:i.clientX,clientY:i.clientY}};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("canvas",{ref:y,"data-testid":"haplotype-overview",style:{width:m,height:l,display:"block",cursor:"pointer"},onMouseMove:i=>{c(P(i))},onMouseLeave:()=>{c(void 0)},onClick:i=>{let r=P(i),p=r&&t?.bins[r.bin];p&&u&&w?.navTo&&w.navTo({refName:u.refName,assemblyName:u.assemblyName,start:p.start,end:p.end})}}),o&&t&&u?(0,n.jsx)(U,{data:t,region:u,pointer:o}):null]})}),q=Z;var C=a(O(),1),$=(0,K.observer)(function({model:e}){return(0,C.jsx)(z.DisplayStatusChrome,{model:e,phase:e.displayPhase,drawn:e.showsOverview?e.overview!==void 0&&e.overviewPainted===e.overview:e.painted&&e.geometryPainted,testid:"linear-graph-display","data-layout":e.chosenLayoutMode,"data-cut-tier":e.cutTier,"data-recuts":e.recuts,"data-node-count":e.hasGraph?e.nodeCount:void 0,"data-loading":e.isLoading?"":void 0,style:{width:e.paneWidth,height:e.height,overflow:"hidden"},children:e.showsOverview?(0,C.jsx)(q,{model:e}):(0,C.jsx)(B,{model:e,ownChrome:!1})})}),se=$;export{se as default};
2
- //# sourceMappingURL=LinearGraphDisplay-7YE624D5.js.map
1
+ import{b as S,g as N,h as X,i as E,j as Y,k as A,m as k,n as W,o as J}from"./chunk-BZOIENU5.js";import"./chunk-2H7GDQ3R.js";import{a as B}from"./chunk-AFYY6LQF.js";import"./chunk-N2I4OWIA.js";import"./chunk-YZAO5LPU.js";import"./chunk-ALTI7LTL.js";import"./chunk-UQEPPJEO.js";import"./chunk-SCMIJAAX.js";import"./chunk-7BKUWQE5.js";import"./chunk-KULNKXPT.js";import"./chunk-FCWXYIFC.js";import{a as Q}from"./chunk-J6KYLXRD.js";import{a as O,c as G}from"./chunk-TYJTJGPO.js";import{a as R,b as a}from"./chunk-FY3BTKY4.js";var I=R((ee,F)=>{F.exports=JBrowseExports["@jbrowse/display-kit/DisplayChrome"]});var _=R((te,V)=>{V.exports=JBrowseExports["@jbrowse/core/ui/BaseTooltip"]});var z=a(I(),1),K=a(G(),1);var s=a(Q(),1),j=a(_(),1),L=a(G(),1);var n=a(O(),1),U=(0,L.observer)(function({data:e,region:y,pointer:o}){let c=k(e,o.bin),t=o.row===void 0?void 0:e.cells[o.bin*e.rows.length+o.row];return(0,n.jsxs)(j.default,{clientPoint:{x:o.clientX,y:o.clientY},children:[(0,n.jsxs)("div",{children:[y.refName,":",c.span]}),o.row!==void 0&&t!==void 0?(0,n.jsxs)("div",{children:[(0,n.jsx)("strong",{children:e.rows[o.row]}),": ",X(t)]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{children:c.classes}),(0,n.jsx)("div",{children:c.excursions})]}),(0,n.jsx)("div",{style:{opacity:.7},children:N})]})}),Z=(0,L.observer)(function({model:e}){let y=(0,s.useRef)(null),[o,c]=(0,s.useState)(),{overview:t,overviewRegion:u,overviewCounts:M,overviewAllRows:T,height:l,host:w}=e,m=w?.width??0,x=w&&u?S(w,u):void 0,f=x?.scale,h=x?.translateX,d=(0,s.useMemo)(()=>t?E(t,T,l):void 0,[t,T,l]),v=typeof window>"u"?1:window.devicePixelRatio||1,D=(0,s.useMemo)(()=>t&&d?W(t,d,v):[],[t,d,v]);(0,s.useEffect)(()=>{let i=y.current,r=i?.getContext("2d");if(!i||!r||!t||!d||f===void 0||h===void 0)return;let p=Math.round(m*v),g=Math.round(l*v);(i.width!==p||i.height!==g)&&(i.width=p,i.height=g),r.setTransform(v,0,0,v,0,0),J(r,t,M,d,D,{xOf:b=>b*f+h,width:m,height:l,dpr:v}),e.setOverviewPainted(t)},[e,t,M,d,D,f,h,m,l,v]);let P=i=>{if(!t||!d||!f||h===void 0)return;let r=i.currentTarget.getBoundingClientRect(),p=i.clientX-r.left,g=i.clientY-r.top,b=A(t,(p-h)/f);return b===void 0?void 0:{bin:b,row:Y(d,g),clientX:i.clientX,clientY:i.clientY}};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("canvas",{ref:y,"data-testid":"haplotype-overview",style:{width:m,height:l,display:"block",cursor:"pointer"},onMouseMove:i=>{c(P(i))},onMouseLeave:()=>{c(void 0)},onClick:i=>{let r=P(i),p=r&&t?.bins[r.bin];p&&u&&w?.navTo&&w.navTo({refName:u.refName,assemblyName:u.assemblyName,start:p.start,end:p.end})}}),o&&t&&u?(0,n.jsx)(U,{data:t,region:u,pointer:o}):null]})}),q=Z;var C=a(O(),1),$=(0,K.observer)(function({model:e}){return(0,C.jsx)(z.DisplayStatusChrome,{model:e,phase:e.displayPhase,drawn:e.showsOverview?e.overview!==void 0&&e.overviewPainted===e.overview:e.painted&&e.geometryPainted,testid:"linear-graph-display","data-layout":e.chosenLayoutMode,"data-cut-tier":e.cutTier,"data-recuts":e.recuts,"data-node-count":e.hasGraph?e.nodeCount:void 0,"data-loading":e.isLoading?"":void 0,style:{width:e.paneWidth,height:e.height,overflow:"hidden"},children:e.showsOverview?(0,C.jsx)(q,{model:e}):(0,C.jsx)(B,{model:e,ownChrome:!1})})}),se=$;export{se as default};
2
+ //# sourceMappingURL=LinearGraphDisplay-I2DJRM36.js.map
@@ -0,0 +1,3 @@
1
+ import{a as At}from"./chunk-N2I4OWIA.js";import{Da as Tt,E as xe,Ja as Nt,K as le,L as mt,La as Ht,Ma as Wt,O as ce,Oa as Bt,P as ht,Q as gt,R as bt,S as yt,Ta as Pe,Ua as De,V as Me,W as vt,Wa as _t,Xa as zt,Y as Re,a as W,aa as wt,b as Ae,ba as St,ca as kt,da as xt,ea as Mt,fa as Ce,ga as Rt,h as it,i as lt,ja as Ct,ka as Le,ma as Lt,n as ct,qa as Pt,r as dt,ra as Et,s as me,t as ut,va as It,xa as Gt}from"./chunk-YZAO5LPU.js";import{M as pt,_ as pe,h as at,j as st,l as Xe,m as Se,z as ke}from"./chunk-ALTI7LTL.js";import{b as ft}from"./chunk-UQEPPJEO.js";import{a as we}from"./chunk-FCWXYIFC.js";import{a as O}from"./chunk-J6KYLXRD.js";import{a as y,b as Oe,c as E,d as ne}from"./chunk-TYJTJGPO.js";import{a as Co,b as s}from"./chunk-FY3BTKY4.js";var Xt=Co((da,Ot)=>{Ot.exports=JBrowseExports["@jbrowse/render-core/useRenderingBackend"]});var ze=s(O(),1);var ie=s(Oe(),1),ot=s(we(),1),ko=s(Xt(),1);var Dt=s(y(),1),Yt=(0,W.createSvgIcon)((0,Dt.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 15h-2v-6h2zm0-8h-2V7h2z"}),"Info");var z=s(E(),1);var Ye=s(E(),1);var H={background:"rgba(255,255,255,0.82)",padding:"4px 6px",borderRadius:3,fontSize:11,lineHeight:"15px",whiteSpace:"nowrap"},R={display:"flex",alignItems:"center",gap:5};var _=s(y(),1),Lo={position:"absolute",left:0,top:0,pointerEvents:"none",overflow:"hidden",zIndex:2},Po=(0,Ye.observer)(function({model:e}){let{bubbleHalos:t,walkLift:o,hoveredBubble:r}=e;if(t.length===0)return null;let{scaleX:a,scaleY:l,translateX:i,translateY:d,paneWidth:u,canvasHeight:f}=e,c=e.contigThickness*Mt,h=m=>o!==void 0&&!m.nodeIds.some(w=>o.nodeIds.has(w));return(0,_.jsx)("svg",{style:Lo,width:u,height:f,"data-testid":"graph-bubble-halos",children:(0,_.jsx)("g",{transform:`translate(${i} ${d}) scale(${a} ${l})`,children:t.filter(m=>!m.whole).map(m=>(0,_.jsx)("path",{d:m.path,fill:"none",stroke:le[m.kind],strokeOpacity:r&&ft(m.bubble,r)?.45:h(m)?.06:.22,strokeWidth:c,strokeLinecap:"round",strokeLinejoin:"round",vectorEffect:"non-scaling-stroke"},`${m.bubble.start}-${m.bubble.end}`))})})}),$t=Po;function Eo({color:n}){return(0,_.jsx)("svg",{width:18,height:10,style:{flex:"none"},children:(0,_.jsx)("line",{x1:5,y1:5,x2:13,y2:5,stroke:n,strokeOpacity:.35,strokeWidth:8,strokeLinecap:"round"})})}var Ft=(0,Ye.observer)(function({model:e}){let t=new Map;for(let o of e.bubbleHalos)if(!o.whole){let r=le[o.kind],a=t.get(r)??new Set;a.add(mt[o.kind]),t.set(r,a)}return t.size>0?(0,_.jsx)("div",{style:H,"data-testid":"graph-halo-legend",children:[...t].map(([o,r])=>(0,_.jsxs)("div",{style:R,children:[(0,_.jsx)(Eo,{color:o}),(0,_.jsxs)("span",{children:["bubble: ",[...r].join(", ")]})]},o))}):null});var Te=s(O(),1);var Ne=s(Ae(),1),$e=s(E(),1);var $=s(y(),1),oe={width:18,height:8,borderRadius:2,flex:"none"},Io={marginBottom:2},Go={...oe,width:48};function he({walk:n,label:e,reference:t,hint:o,at:r}){let a=Lt(n,t);return(0,$.jsxs)("div",{style:Io,title:[a.hover,o].filter(Boolean).join(" \xB7 ")||void 0,children:[(0,$.jsxs)("div",{style:R,children:[(0,$.jsx)("div",{style:{...a.shades?Go:oe,background:xe(n.encoding)}}),(0,$.jsxs)("span",{children:[(0,$.jsx)("strong",{children:e}),a.delta,a.outside,a.reversed]})]}),r?(0,$.jsx)("div",{"data-testid":"graph-walk-at",children:r}):a.scale?(0,$.jsx)("div",{children:a.scale}):null]})}var X=s(O(),1);var To=50;function Kt(n,e){return e>0?Math.max(1,n/e):To}function No(n){let e=new Set,t=1/0,o=-1/0;for(let r of n)e.add(r.minY),t=Math.min(t,r.minY),o=Math.max(o,r.minY);return e.size>1?(o-t)/(e.size-1):void 0}function Ho(n,e,t){let o=Kt(e,n.length);return{x:o,y:t>0?Kt(t,n.length):No(n)??o}}function Vt(n,e,t,o){return n===void 0?Ho(e,t,o):typeof n=="number"?{x:n,y:n}:n}function Wo(n,e,t){let o=n.get(e);o||(o=new Map,n.set(e,o));let r=o.get(t);return r||(r=[],o.set(t,r)),r}function Zt(n,e,t,o,r,a,l){let i=Math.floor(t/e.x),d=Math.floor(r/e.x),u=Math.floor(o/e.y),f=Math.floor(a/e.y);for(let c=i;c<=d;c++)for(let h=u;h<=f;h++)Wo(n,c,h).push(l)}function jt(n,e,t,o,r,a){let l=Math.floor((t-r)/e.x),i=Math.floor((t+r)/e.x),d=Math.floor((o-a)/e.y),u=Math.floor((o+a)/e.y),f=[],c=new Set;for(let h=l;h<=i;h++){let m=n.get(h);if(m)for(let w=d;w<=u;w++){let v=m.get(w);if(v)for(let g of v)c.has(g)||(c.add(g),f.push(g))}}return f}var Ee=class{constructor(e,t){this.cells=new Map;let o=[],r=0,a=0;for(let[l,i]of Object.entries(e))for(let d=0;d<i.length-1;d++){let u=i[d],f=i[d+1],c=Math.min(u.x,f.x),h=Math.min(u.y,f.y),m=Math.max(u.x,f.x),w=Math.max(u.y,f.y);r+=m-c,a+=w-h,o.push({entry:{nodeId:l,segmentIdx:d},minX:c,minY:h,maxX:m,maxY:w})}this.cellSize=Vt(t,o,r,a);for(let l of o)Zt(this.cells,this.cellSize,l.minX,l.minY,l.maxX,l.maxY,l.entry)}query(e,t,o,r=o){return jt(this.cells,this.cellSize,e,t,o,r)}},Ie=class{constructor(e,t,o,r,a,l,i=0,d,u=!1){this.cells=new Map;this.edgeCurves=dt(e,t,r,l,i,d,u);let f=[],c=0,h=0;for(let m=0;m<t.edges.length;m++){let w=t.edges[m],v=e[w.from],g=e[w.to],L=this.edgeCurves.get(m);if(v?.length&&g?.length&&L){let{minX:N,minY:K,maxX:b,maxY:k}=at(L),M=w.pathIds?.length??0;if(o&&M>0){let S=0,I=0;for(let A of Se(v,g,M,r))S=Math.max(S,Math.abs(A.x)),I=Math.max(I,Math.abs(A.y));N-=S,K-=I,b+=S,k+=I}c+=b-N,h+=k-K,f.push({ei:m,minX:N,minY:K,maxX:b,maxY:k})}}this.cellSize=Vt(a,f,c,h);for(let m of f)Zt(this.cells,this.cellSize,m.minX,m.minY,m.maxX,m.maxY,m.ei)}getCurves(e){return this.edgeCurves.get(e)}query(e,t,o,r=o){return jt(this.cells,this.cellSize,e,t,o,r)}};function Qt(n,e,t,o,r,a){let l=r-t,i=a-o,d=l*l+i*i;if(d===0)return Math.hypot(n-t,e-o);let u=Math.max(0,Math.min(1,((n-t)*l+(e-o)*i)/d));return Math.hypot(n-(t+u*l),e-(o+u*i))}function Bo(n,e,t,o,r,a,l,i,d,u){let f=1/0,c=20,h=t,m=o;for(let w=1;w<=c;w++){let v=w/c,g=1-v,L=g*g*g*t+3*g*g*v*r+3*g*v*v*l+v*v*v*d,N=g*g*g*o+3*g*g*v*a+3*g*v*v*i+v*v*v*u;f=Math.min(f,Qt(n,e,h,m,L,N)),h=L,m=N}return f}function _o(n,e,t){return Bo(n,e,t.x0,t.y0,t.cx0,t.cy0,t.cx1,t.cy1,t.x1,t.y1)}function Ut(n,e,t,o=1){let r=1/0;for(let a of t){let l=_o(n,e,o===1?a:{x0:a.x0,y0:a.y0*o,cx0:a.cx0,cy0:a.cy0*o,cx1:a.cx1,cy1:a.cy1*o,x1:a.x1,y1:a.y1*o});l<r&&(r=l)}return r}var qt=new WeakMap;function zo(n,e){let t=qt.get(n);if(t?.version===e)return t.index;let o=new Ee(n);return qt.set(n,{version:e,index:o}),o}var Jt=new WeakMap;function Ao(n,e,t,o,r,a,l,i=!1){let d=Jt.get(n);if(d?.graph===e&&d.drawPaths===t&&d.scaleX===o.scaleX&&d.scaleY===o.scaleY&&d.version===r&&d.deletions===a&&d.routes===l&&d.stranded===i)return d.index;let u=new Ie(n,e,t,o,void 0,a,r,l,i);return Jt.set(n,{graph:e,drawPaths:t,scaleX:o.scaleX,scaleY:o.scaleY,version:r,index:u,deletions:a,routes:l,stranded:i}),u}var Oo=5;function en(n,e,t,o,r=0,a){let l=Xe(o),i=zo(n,r),d=m=>Math.max(Oo,m)/o.scaleX,u=d(a?.maxHalfWidthPx??0),f=i.query(e,t,u,u/l),c=null,h=1/0;for(let{nodeId:m,segmentIdx:w}of f){let v=n[m],g=Qt(e,t*l,v[w].x,v[w].y*l,v[w+1].x,v[w+1].y*l);g<h&&g<d(a?.halfWidthPx(m)??0)&&(h=g,c=m)}return c}function tn(n,e,t,o,r,a,l=0,i,d,u,f=!1){let c=Xe(r),h=10/r.scaleX,m=Ao(n,e,a,r,l,i,u,f),w=m.query(t,o,h,h/c),v=null,g=h;for(let L of w){let N=e.edges[L],K=n[N.from],b=n[N.to];if(!K?.length||!b?.length||d?.has(L))continue;let k=N.pathIds?.length??0,M=m.getCurves(L);if(!M)continue;let S;if(!a||k===0)S=Ut(t,o*c,M,c);else{let I=1/0;for(let A of Se(K,b,k,r)){let Ro=A.x===0&&A.y===0?M:st(M,A.x,A.y),rt=Ut(t,o*c,Ro,c);rt<I&&(I=rt)}S=I}S<g&&(g=S,v=L)}return v}function nn(n){let e=n.deltaY*(n.deltaMode===1?40:n.deltaMode===2?800:1),t=(n.ctrlKey?10:1)*e/100;return 1.1**-Math.max(-2,Math.min(2,t))}var on=s(we(),1);function Ge(n,e){(0,X.useEffect)(()=>{if(!n)return;let t=n;function o(r){if(e.hostPlacesX)return;e.host&&r.stopPropagation(),r.preventDefault();let a=t.getBoundingClientRect();e.zoom(nn(r),r.clientX-a.left,r.clientY-a.top)}return t.addEventListener("wheel",o,{passive:!1}),()=>{t.removeEventListener("wheel",o)}},[n,e])}function rn(n){let e=(0,X.useRef)({x:0,y:0}),t=(0,X.useRef)(!1),o=(0,X.useRef)({frame:0,pan:null,hover:null});(0,X.useEffect)(()=>()=>{cancelAnimationFrame(o.current.frame)},[]);let[r,a]=(0,X.useState)(void 0),[l,i]=(0,X.useState)(void 0);function d(b,k){return{x:(b-n.translateX)/n.scaleX,y:(k-n.translateY)/n.scaleY}}function u(b){let k=b.currentTarget.getBoundingClientRect();return d(b.clientX-k.left,b.clientY-k.top)}function f(b,k){let{nodePositions:M}=n,S=b*n.scaleX+n.translateX,I=k*n.scaleY+n.translateY;if(n.layoutResult?.tubeMap)return n.tubeMapNodeAt(S,I);let A=n.referenceStripNodeAt(S,I);return A||(M?en(M,b,k,n.axisScale,n.positionsVersion,n.nodeInk):null)}function c(b){if(b.button===0){if(t.current=!1,n.hostPlacesX)return;n.host&&b.stopPropagation();let{x:k,y:M}=u(b),S=n.layoutResult?.tubeMap||b.nativeEvent.offsetY<n.referenceStripZonePx?null:f(k,M);S?n.setDraggingNode(S):n.setPanning(!0),e.current={x:b.clientX,y:b.clientY}}}function h(){let b=o.current;if(b.frame=0,b.pan&&(n.setTransform(n.scale,n.translateX+b.pan.dx,n.translateY+b.pan.dy),b.pan=null),b.hover&&n.nodePositions&&n.graph){let{x:k,y:M}=d(b.hover.x,b.hover.y);b.hover=null;let S=f(k,M);n.setHoveredNode(S),n.setHoveredEdge(S||n.layoutResult?.tubeMap?null:tn(n.nodePositions,n.graph,k,M,n.axisScale,n.effectiveDrawPaths&&!n.facetPanels,n.positionsVersion,n.deletionEdgeIndexes,n.hiddenEdgeIndexes,n.deletionRoutes,n.layoutResult?.stranded))}}function m(){o.current.frame||(o.current.frame=requestAnimationFrame(h))}function w(){let b=o.current;cancelAnimationFrame(b.frame),b.frame=0,b.pan=null,b.hover=null}function v(b){let k=b.clientX-e.current.x,M=b.clientY-e.current.y;e.current={x:b.clientX,y:b.clientY},(Math.abs(k)>1||Math.abs(M)>1)&&(t.current=!0);let S=o.current;if(n.draggingNode)n.moveNode(n.draggingNode,k/n.scaleX,M/n.scaleY);else if(n.isPanning)S.pan={dx:(S.pan?.dx??0)+k,dy:(S.pan?.dy??0)+M},m();else{let I=b.currentTarget.getBoundingClientRect();S.hover={x:b.clientX-I.left,y:b.clientY-I.top},m()}}function g(){n.stopDragging()}function L(){w(),(0,on.isAlive)(n)&&(n.stopDragging(),n.setHoveredNode(null),n.setHoveredEdge(null))}function N(b){let{x:k,y:M}=u(b),S=f(k,M);if(S){b.preventDefault(),a({nodeId:S,top:b.clientY,left:b.clientX});return}let I=n.walkRowAt(k*n.scaleX+n.translateX,M*n.scaleY+n.translateY);I!==void 0&&(b.preventDefault(),i({row:I,top:b.clientY,left:b.clientX}))}function K(b){if(!t.current){let{x:k,y:M}=u(b),S=f(k,M);n.setSelectedNode(S),S&&n.showNodeDetails(S)}}return{handlers:{onMouseDown:c,onMouseMove:v,onMouseUp:g,onMouseLeave:L,onClick:K,onContextMenu:N},contextNode:r,contextRow:l,closeContextMenu:()=>{a(void 0),i(void 0)}}}var V=s(y(),1),Yo={position:"absolute",left:0,top:0,zIndex:4,display:"grid",gap:8,lineHeight:"normal"},$o={height:34,padding:"2px 6px",boxSizing:"border-box",fontFamily:"inherit",fontSize:11,color:"inherit",cursor:"pointer",border:"none",background:"none",textAlign:"left",display:"block"},Fo=(0,$e.observer)(function({model:e,lift:t,width:o,height:r,cell:a,handlers:l}){let[i,d]=(0,Te.useState)(null),u=t.walks[0];Ge(i,e),(0,Te.useEffect)(()=>{if(!i)return;let c=new Le(i);c.resize(o,r);let h=(0,Ne.computed)(()=>e.buildDrawing(t,!1)),m,w=(0,Ne.autorun)(()=>{let v=h.get();v&&(v!==m&&(c.uploadGeometry(v.batch),m=v),e.applyHighlights(c),e.paint(c))});return()=>{w(),c.dispose()}},[i,e,t,o,r]);let f=e.walkLabel(u.name);return(0,V.jsxs)("div",{style:a,children:[(0,V.jsx)("button",{type:"button",style:$o,"data-testid":"graph-facet-title",onClick:()=>{e.liftWalks([u.name]),e.setFacet("")},children:(0,V.jsx)(he,{walk:u,label:f,reference:e.walkReference,hint:`click to lift ${f} alone`,at:e.hoveredOn(u)})}),(0,V.jsx)("canvas",{ref:d,"data-testid":"graph-facet-canvas",style:{width:o,height:r,display:"block",cursor:e.isPanning||e.draggingNode?"grabbing":"grab"},...l})]})}),Ko=(0,$e.observer)(function({model:e,handlers:t}){let o=e.facetPanels,r=e.facetGrid,a=e.facetPlacement;if(!o||!r||!a)return null;let{columns:l,width:i,height:d}=r;return(0,V.jsx)("div",{"data-testid":"graph-facet-panels",style:{...Yo,width:e.paneWidth,minHeight:e.canvasHeight,gridTemplateColumns:`repeat(${l}, ${i}px)`,background:e.darkMode?"#1f1f1f":"white"},children:o.map((u,f)=>(0,V.jsx)(Fo,{model:e,lift:u,width:i,height:d,cell:{gridRow:Math.floor(a.cells[f]/l)+1,gridColumn:a.cells[f]%l+1},handlers:t},u.walks[0].name))})}),an=Ko;var sn=s(O(),1),ln=s(E(),1),Z=s(y(),1),Vo={position:"absolute",left:0,top:0,pointerEvents:"none",overflow:"hidden",zIndex:2},ge="#daa520",Zo=4,jo=1,Uo=2,qo=(0,ln.observer)(function({model:e}){let t=`exon-outline-${(0,sn.useId)().replaceAll(/[^\w-]/g,"")}`,{genePins:o,walkLift:r,nodeInk:a}=e;if(o.length===0)return null;let{scaleX:l,scaleY:i,translateX:d,translateY:u,paneWidth:f,canvasHeight:c}=e,h=g=>{let L=a.halfWidthPx(g)*2;return r?.nodeIds.has(g)?Math.max(L,r.walks.length*Zo):L},m=o.flatMap(g=>g.exonsByNode.map(({nodeId:L,d:N})=>({key:`${g.gene.name}-${g.gene.start}-${L}`,d:N,inner:h(L)+2*jo}))),w=`translate(${d} ${u}) scale(${l} ${i})`,v={fill:"none",strokeLinecap:"round",strokeLinejoin:"round",vectorEffect:"non-scaling-stroke"};return(0,Z.jsxs)("svg",{style:Vo,width:f,height:c,"data-testid":"graph-gene-pins",children:[(0,Z.jsx)("mask",{id:t,maskUnits:"userSpaceOnUse",x:0,y:0,width:f,height:c,children:(0,Z.jsxs)("g",{transform:w,children:[m.map(g=>(0,Z.jsx)("path",{d:g.d,stroke:"#fff",strokeWidth:g.inner+2*Uo,...v},g.key)),m.map(g=>(0,Z.jsx)("path",{d:g.d,stroke:"#000",strokeWidth:g.inner,...v},g.key))]})}),(0,Z.jsx)("rect",{width:f,height:c,fill:ge,mask:`url(#${t})`})]})}),cn=qo;var pn=s(y(),1),dn=(0,W.createSvgIcon)((0,pn.jsx)("path",{d:"M3 5v4h2V5h4V3H5c-1.1 0-2 .9-2 2m2 10H3v4c0 1.1.9 2 2 2h4v-2H5zm14 4h-4v2h4c1.1 0 2-.9 2-2v-4h-2zm0-16h-4v2h4v4h2V5c0-1.1-.9-2-2-2"}),"CropFree");var Fe=s(y(),1),un=(0,W.createSvgIcon)([(0,Fe.jsx)("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14"},"0"),(0,Fe.jsx)("path",{d:"M12 10h-2v2H9v-2H7V9h2V7h1v2h2z"},"1")],"ZoomIn");var fn=s(y(),1),mn=(0,W.createSvgIcon)((0,fn.jsx)("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14M7 9h5v1H7z"}),"ZoomOut");var Y=s(ne(),1),je=s(E(),1),zn=s(pe(),1);var j=s(ne(),1),hn=s(E(),1),gn=s(pe(),1),de=s(y(),1),Jo=(0,gn.makeStyles)()({formControl:{minWidth:100}}),Qo=(0,hn.observer)(function({model:e}){let{classes:t}=Jo(),o=e.colorSchemeLock;return(0,de.jsxs)(j.FormControl,{size:"small",className:t.formControl,disabled:o!==void 0,title:o?.why,children:[(0,de.jsx)(j.InputLabel,{children:"Color"}),(0,de.jsx)(j.Select,{value:e.chosenColorScheme,label:"Color",renderValue:o?()=>o.value:void 0,onChange:r=>{e.setColorScheme(r.target.value)},children:pt.map(({value:r,label:a})=>(0,de.jsx)(j.MenuItem,{value:r,children:a},r))})]})}),bn=Qo;var Ve=s(ne(),1),Ze=s(E(),1),yn=s(pe(),1),ue=s(y(),1),vn=(0,yn.makeStyles)()({stats:{marginLeft:"auto"},perf:{color:"#888",fontVariantNumeric:"tabular-nums"}});function Ke(n){return n===void 0?"\u2013":`${Math.round(n)}ms`}var er=(0,Ze.observer)(function({model:e}){let{classes:t}=vn(),{lastFetchMs:o,lastLayoutMs:r,lastGeometryMs:a}=e,l=o!==void 0||r!==void 0||a!==void 0;return e.showPerf&&l?(0,ue.jsxs)(Ve.Typography,{variant:"caption",className:t.perf,"data-testid":"graph-perf-stats",children:["fetch ",Ke(o)," \xB7 layout ",Ke(r)," \xB7 geom"," ",Ke(a)]}):null}),tr=(0,Ze.observer)(function({model:e}){let{classes:t}=vn();return(0,ue.jsxs)("div",{className:t.stats,"data-testid":"graph-stats","data-node-count":e.nodeCount,"data-edge-count":e.edgeCount,"data-path-count":e.pathCount,"data-fetch-ms":e.lastFetchMs??"","data-layout-ms":e.lastLayoutMs??"","data-geometry-ms":e.lastGeometryMs??"","data-geometry-strokes":e.lastGeometryStrokeCount??"",children:[(0,ue.jsxs)(Ve.Typography,{variant:"body2",component:"span",children:[e.nodeCount," nodes, ",e.edgeCount," edges",e.pathCount>0?`, ${e.pathCount} paths`:""]})," ",(0,ue.jsx)(er,{model:e})]})}),wn=tr;var D=s(ne(),1),Sn=s(E(),1),kn=s(pe(),1),U=s(y(),1),nr=(0,kn.makeStyles)()({formControl:{minWidth:150}}),or=(0,Sn.observer)(function({model:e}){let{classes:t}=nr(),{graph:o}=e;return(0,U.jsxs)(D.FormControl,{size:"small",className:t.formControl,children:[(0,U.jsx)(D.InputLabel,{children:"Layout"}),(0,U.jsx)(D.Select,{value:e.chosenLayoutMode,label:"Layout","data-testid":"graph-layout-select",onChange:r=>{e.switchLayout(r.target.value)},children:ct.map(({value:r,label:a,description:l,available:i})=>(0,U.jsx)(D.MenuItem,{value:r,disabled:o?!i(o):!1,children:(0,U.jsx)(D.Tooltip,{title:l,placement:"right",children:(0,U.jsx)("span",{children:a})})},r))})]})}),xn=or;var F=s(ne(),1),Mn=s(E(),1),Rn=s(pe(),1),q=s(y(),1),rr=(0,Rn.makeStyles)()({formControl:{minWidth:130,maxWidth:240}}),ar=(0,Mn.observer)(function({model:e}){let{classes:t}=rr(),{repeatChoices:o}=e;if(e.chosenLayoutMode!=="walkrows"||o.length===0)return null;let r=new Set(o.map(a=>a.key));return(0,q.jsxs)(F.FormControl,{size:"small",className:t.formControl,children:[(0,q.jsx)(F.InputLabel,{children:"Repeat"}),(0,q.jsxs)(F.Select,{value:r.has(e.repeatKey)?e.repeatKey:"",label:"Repeat","data-testid":"graph-repeat-select",onChange:a=>{e.setRepeatKey(a.target.value)},children:[(0,q.jsx)(F.MenuItem,{value:"",children:(0,q.jsx)("em",{children:"Whole window"})}),o.map(({key:a,name:l,unit:i})=>(0,q.jsxs)(F.MenuItem,{value:a,children:[l," \xB7 ",i.toLocaleString()," bp unit"]},a))]})]})}),Cn=ar;var Gn=s(O(),1),Tn=s(Oe(),1);var Ln=s(y(),1),Pn=(0,W.createSvgIcon)((0,Ln.jsx)("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zM19 4h-3.5l-1-1h-5l-1 1H5v2h14z"}),"Delete");var En=s(y(),1),In=(0,W.createSvgIcon)((0,En.jsx)("path",{d:"M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"}),"MoreVert");var Nn=s(E(),1);var J=s(y(),1),sr=(0,Nn.observer)(function({model:e}){let[t,o]=(0,Gn.useState)(!1);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Tn.CascadingMenuButton,{size:"small",menuItems:[{type:"checkbox",label:"Linear layout",checked:e.linearLayout,onClick:()=>{e.setLinearLayout(!e.linearLayout),e.recomputeLayout()}},{type:"checkbox",label:"Show deletion edges",checked:e.showDeletionEdges,onClick:()=>{e.setShowDeletionEdges(!e.showDeletionEdges)}},{type:"checkbox",label:"Show timings",checked:e.showPerf,onClick:()=>{e.setShowPerf(!e.showPerf)}},{type:"divider"},{label:"Settings",icon:zt,onClick:()=>{o(!0)}},{type:"divider"},{label:"Return to import form",icon:Pn,onClick:()=>{e.clearGraph()}}],children:(0,J.jsx)(In,{})}),(0,J.jsx)(At,{model:e,open:t,onClose:()=>{o(!1)}})]})}),Hn=sr;var B=s(ne(),1),Wn=s(E(),1),Bn=s(pe(),1),Q=s(y(),1),ir=(0,Bn.makeStyles)()({formControl:{minWidth:130,maxWidth:260}}),lr=(0,Wn.observer)(function({model:e}){let{classes:t}=ir(),{walkChoices:o}=e;if(o.length===0||!e.liftsWalks)return null;let r=new Set(o.map(i=>i.name)),a=new Map(o.map(i=>[i.name,i.label])),l=e.walkLayers.map(i=>i.walk).filter(i=>r.has(i));return(0,Q.jsxs)(B.FormControl,{size:"small",className:t.formControl,children:[(0,Q.jsx)(B.InputLabel,{children:"Walks"}),(0,Q.jsx)(B.Select,{multiple:!0,value:l,label:"Walks","data-testid":"graph-walk-select",renderValue:i=>i.map(d=>a.get(d)).join(", "),onChange:i=>{let{value:d}=i.target;e.liftWalks(typeof d=="string"?d.split(","):d)},children:o.map(({name:i,label:d})=>(0,Q.jsxs)(B.MenuItem,{value:i,dense:!0,children:[(0,Q.jsx)(B.Checkbox,{size:"small",checked:l.includes(i)}),(0,Q.jsx)(B.ListItemText,{primary:d})]},i))})]})}),_n=lr;var P=s(y(),1),cr=(0,zn.makeStyles)()({toolbar:{display:"flex",alignItems:"center",gap:4,padding:"2px 4px",borderBottom:"1px solid #ddd"}}),pr=(0,je.observer)(function({model:e}){return(0,P.jsx)(Y.Typography,{variant:"body2",children:e.zoomPercent})}),dr=(0,je.observer)(function({model:e}){let{classes:t}=cr();return(0,P.jsxs)("div",{className:t.toolbar,children:[(0,P.jsx)(xn,{model:e}),(0,P.jsx)(bn,{model:e}),(0,P.jsx)(_n,{model:e}),(0,P.jsx)(Cn,{model:e}),(0,P.jsx)(Y.Tooltip,{title:"Zoom in",children:(0,P.jsx)(Y.IconButton,{size:"small",onClick:()=>{e.zoom(1.5,e.viewBox.width/2,e.viewBox.height/2)},children:(0,P.jsx)(un,{})})}),(0,P.jsx)(Y.Tooltip,{title:"Zoom out",children:(0,P.jsx)(Y.IconButton,{size:"small",onClick:()=>{e.zoom(1/1.5,e.viewBox.width/2,e.viewBox.height/2)},children:(0,P.jsx)(mn,{})})}),(0,P.jsx)(Y.Tooltip,{title:"Zoom to fit",children:(0,P.jsx)(Y.IconButton,{size:"small",onClick:()=>{e.zoomToFit()},children:(0,P.jsx)(dn,{})})}),(0,P.jsx)(pr,{model:e}),(0,P.jsx)(wn,{model:e}),(0,P.jsx)(Hn,{model:e})]})}),An=dr;var Dn=s(we(),1),Yn=s(E(),1);var re=s(y(),1);function be({x:n,y:e,w:t,text:o,note:r,color:a,edge:l=a,italic:i,small:d,dimmed:u,title:f,testId:c,onClick:h,onHover:m}){return(0,re.jsxs)("g",{style:{pointerEvents:h||m?"auto":"none",cursor:h?"pointer":void 0,opacity:u?.35:1},"data-testid":c,onClick:h,onMouseEnter:()=>{m?.(!0)},onMouseLeave:()=>{m?.(!1)},children:[f?(0,re.jsx)("title",{children:f}):null,(0,re.jsx)("rect",{x:n-t/2,y:e-11-4+2,width:t,height:17,rx:3,fill:"rgba(255,255,255,0.85)",stroke:l,strokeWidth:d?.6:1}),(0,re.jsxs)("text",{x:n,y:e,fontSize:d?10:11,fontFamily:"sans-serif",fontStyle:i?"italic":void 0,fontWeight:i?600:void 0,fill:a,textAnchor:"middle",children:[o,r?(0,re.jsx)("tspan",{fontStyle:"normal",fontWeight:"normal",children:r}):null]})]})}var ee=s(y(),1),ur={position:"absolute",left:0,top:0,pointerEvents:"none",overflow:"hidden",zIndex:3},Xn="#1c1c22",fr=(0,Yn.observer)(function({model:e}){let{bubbles:t,genes:o,routes:r}=e.overlayLabels;if(t.length+o.length+r.length===0)return null;let{walkLift:a,scaleY:l,translateY:i,contigThickness:d}=e,u=c=>a!==void 0&&!c.nodeIds.some(h=>a.nodeIds.has(h)),f=c=>a!==void 0&&!c.route.walks.some(h=>a.names.has(h));return(0,ee.jsxs)("svg",{style:ur,width:e.paneWidth,height:e.canvasHeight,"data-testid":"graph-label-layer",children:[o.map(({item:c,x:h,y:m,w,text:v})=>{let{gene:g}=c,L=Rt(c);return(0,ee.jsxs)("g",{children:[(0,ee.jsx)("line",{x1:h,x2:h,y1:m-11-2,y2:c.at.y*l+i+d/2,stroke:Xn,strokeWidth:.8,strokeOpacity:.6}),(0,ee.jsx)(be,{x:h,y:m,w,text:g.name,note:v.slice(g.name.length)||void 0,color:Xn,edge:ge,italic:!0,title:`${g.name} ${g.refName}:${g.start.toLocaleString()}-${g.end.toLocaleString()}${L?`, ${L} in the cut`:""}`,testId:"graph-gene-pin-label"})]},`${g.name}-${g.start}`)}),r.map(({item:{halo:c,route:h},x:m,y:w,w:v,text:g})=>(0,ee.jsx)(be,{x:m,y:w,w:v,text:g,color:le[c.kind],small:!0,dimmed:f(h),title:`${h.route.walks.length} walk(s): ${h.route.walks.join(", ")}`,testId:"graph-route-label"},`${c.bubble.start}-${c.bubble.end}-${h.route.steps.join(",")}`)),t.map(({item:c,x:h,y:m,w,text:v})=>(0,ee.jsx)(be,{x:h,y:m,w,text:v,color:le[c.kind],dimmed:u(c),title:`${c.label}
2
+ ${c.bubble.segmentCount} segments \xB7 click to open`,testId:"graph-bubble-halo-label",onClick:()=>{e.popBubble(c.bubble)},onHover:g=>{(0,Dn.isAlive)(e)&&e.setHoveredBubble(g?c.bubble:null)}},`${c.bubble.start}-${c.bubble.end}`))]})}),$n=fr;var He=s(O(),1);var Kn=s(Ct(),1),Vn=s(Ae(),1),Ue=s(E(),1);var G=s(y(),1),mr={position:"absolute",left:0,top:0,pointerEvents:"none",zIndex:5},hr=(0,Ue.observer)(function({model:e}){let t=(0,He.useRef)(null),{referenceStripShown:o,paneWidth:r,canvasHeight:a}=e;return(0,He.useEffect)(()=>(0,Vn.autorun)(()=>{let l=t.current,i=e.referenceStripFrame,d=l?.getContext("2d");if(l&&d&&i&&e.referenceStripShown){let u=(0,Kn.getDpr)(),f=e.paneWidth,c=e.canvasHeight;l.width=Math.round(f*u),l.height=Math.round(c*u),d.setTransform(u,0,0,u,0,0),d.clearRect(0,0,f,c),Nt(d,e.referenceStripBlocks,i,{width:f,lit:e.referenceStripLit,darkMode:e.darkMode,dpr:u})}}),[e]),(0,G.jsx)("canvas",{ref:t,"data-testid":o?"graph-reference-strip":void 0,style:{...mr,width:r,height:a,display:o?"block":"none"}})}),Zn=hr,jn=18,gr="linear-gradient(to right, hsl(0, 70%, 50%) 0 33%, hsl(120, 70%, 50%) 33% 61%, hsl(240, 70%, 50%) 61%)",br=6;function yr(n){let e=n.filter((r,a)=>r!==n[a-1]),t=Math.min(br,e.length),o=Array.from({length:t},(r,a)=>e[t>1?Math.round(a*(e.length-1)/(t-1)):0]);return o.length>1?`linear-gradient(to right, ${o.join(", ")})`:o[0]??me}function Fn({rows:n}){return(0,G.jsx)("div",{style:{width:jn,flex:"none"},children:n.map(({key:e,background:t})=>(0,G.jsx)("div",{style:{height:n.length>1?3:4,background:t}},e))})}function vr(n){return n.walkLift?.walks.map(e=>({key:e.name,background:xe(e.encoding)}))??[{key:"scheme",background:n.effectiveColorScheme==="reference-position"?gr:yr(n.referenceStripBlocks.map(e=>e.colors[0]))}]}function wr(){return(0,G.jsx)("svg",{width:jn,height:10,style:{flex:"none"},children:(0,G.jsx)("path",{d:"M0,5 L8,0 L8,10 Z M18,5 L10,0 L10,10 Z",fill:"#18181c"})})}var Un=(0,Ue.observer)(function({model:e}){let t=(e.walkLift?.walks.length??0)>1;return e.referenceStripShown?(0,G.jsxs)("div",{style:H,"data-testid":"graph-reference-strip-legend",children:[(0,G.jsxs)("div",{style:R,children:[(0,G.jsx)(Fn,{rows:vr(e)}),(0,G.jsxs)("span",{children:["top strip: reference segments at their bp",t?", a row per walk":""]})]}),e.referenceStripFaded?(0,G.jsxs)("div",{style:R,children:[(0,G.jsx)(Fn,{rows:[{key:"pale",background:me}]}),(0,G.jsxs)("span",{children:["reference not on"," ",t?"that row's walk":e.liftedWalksLabel]})]}):null,e.referenceStripOverhangs?(0,G.jsxs)("div",{style:R,children:[(0,G.jsx)(wr,{}),(0,G.jsx)("span",{children:"the graph draws reference past this edge"})]}):null]}):null});var Be=s(O(),1);var Jn=s(Ct(),1),Qn=s(Ae(),1),Je=s(E(),1);var x=s(y(),1),Sr={position:"absolute",left:0,top:0,pointerEvents:"none",zIndex:1},kr=(0,Je.observer)(function({model:e}){let t=(0,Be.useRef)(null),{tubeMapPicture:o,paneWidth:r,canvasHeight:a}=e;return(0,Be.useEffect)(()=>(0,Qn.autorun)(()=>{let l=t.current,i=e.tubeMapPicture,d=e.tubeMapFrame,u=l?.getContext("2d");if(l&&u&&i&&d){let f=(0,Jn.getDpr)(),c=e.paneWidth,h=e.canvasHeight;l.width=Math.round(c*f),l.height=Math.round(h*f),u.setTransform(f,0,0,f,0,0),u.clearRect(0,0,c,h);let m={...d,width:c,highlightNode:e.hoveredNode??e.selectedNode,darkMode:e.darkMode,tubeColors:e.tubeMapTubeColors,nodeColors:e.tubeMapNodeColors};Gt(u,i,m),Wt(u,e.tubeMapDeviations,m),It(u,e.tubeMapConnectors,e.connectorZoneBottom,m);let{bounds:w}=i;Tt(u,e.tubeMapGenes,m,d.y(w.minY)-2);let v=e.tubeMapRulerBoxes;v&&Et(u,v,m,d.y(w.maxY)+4,e.layoutResult?.referenceAxis)}}),[e]),(0,x.jsx)("canvas",{ref:t,"data-testid":o?"graph-tube-map":void 0,style:{...Sr,width:r,height:a,display:o?"block":"none"}})}),eo=kr,We=18;function xr(){let n=[[.5,5.5],[8.5,We-.5]];return(0,x.jsx)("svg",{width:We,height:7,style:{flex:"none"},children:(0,x.jsx)("path",{d:n.map(([e,t])=>`M${e},6 V1.5 H${t} V6`).join(" "),fill:"none",stroke:Pt(),strokeWidth:1})})}var Qe={width:We,height:7,flex:"none"},Mr={...Qe,display:"flex",justifyContent:"center",backgroundColor:"#b8b8c0"};function Rr(){return(0,x.jsx)("div",{style:Mr,children:(0,x.jsx)("div",{style:{width:2,backgroundColor:Ht()}})})}function qn({colors:n}){let e=100/n.length,t=n.map((o,r)=>`${o} ${r*e}% ${(r+1)*e}%`);return(0,x.jsx)("div",{style:{...Qe,background:`linear-gradient(to right, ${t.join(", ")})`}})}var qe={width:We,flex:"none",textAlign:"center",fontFamily:"monospace",fontSize:12};function Cr(){return(0,x.jsx)("div",{style:{...Qe,backgroundColor:"grey"}})}function te({swatch:n,children:e}){return(0,x.jsxs)("div",{style:R,children:[n,(0,x.jsx)("span",{children:e})]})}var to=(0,Je.observer)(function({model:e}){let{logWidths:t,foldBp:o,forwardReads:r,reverseReads:a,mismatches:l}=e.tubeMapKeys,i=e.readsShown,d=i&&i.shown<i.total?i:void 0,u=[r&&(0,x.jsx)(te,{swatch:(0,x.jsx)(qn,{colors:it}),children:"read on the forward strand"},"fwd"),a&&(0,x.jsx)(te,{swatch:(0,x.jsx)(qn,{colors:lt}),children:"read on the reverse strand"},"rev"),d&&(0,x.jsxs)(te,{swatch:(0,x.jsx)("span",{style:qe}),children:[d.shown.toLocaleString("en-US")," of"," ",d.total.toLocaleString("en-US")," reads shown"]},"sampled"),l.has("substitution")&&(0,x.jsx)(te,{swatch:(0,x.jsx)("span",{style:qe,children:"A"}),children:"a read's base unlike the node's"},"sub"),l.has("insertion")&&(0,x.jsx)(te,{swatch:(0,x.jsx)("span",{style:qe,children:"*"}),children:"bases a read inserts"},"ins"),l.has("deletion")&&(0,x.jsx)(te,{swatch:(0,x.jsx)(Cr,{}),children:"bases a read skips"},"del"),o!==void 0&&(0,x.jsxs)(te,{swatch:(0,x.jsx)(Rr,{}),children:["a haplotype's variant under ",ke(o)]},"fold"),t&&(0,x.jsx)(te,{swatch:(0,x.jsx)(xr,{}),children:"width grows with log of length"},"log")].filter(Boolean);return u.length>0?(0,x.jsx)("div",{style:H,"data-testid":"graph-tube-map-legend",children:u}):null});var no=s(ne(),1),oo=s(E(),1),ao=s(y(),1),Lr={position:"absolute",left:8,zIndex:5,background:"rgba(255,255,255,0.9)",textTransform:"none"},Pr=(0,oo.observer)(function({model:e}){let{poppedFrom:t}=e;return t?(0,ao.jsxs)(no.Button,{size:"small",variant:"outlined",style:{...Lr,...e.facetPanels?{bottom:8}:{top:8}},"data-testid":"graph-unpop-bubble",onClick:()=>{e.unpopBubble()},children:["\u25C0 Back to ",t.label]}):null}),ro=Pr;var so=s(Oe(),1);var io=s(E(),1);var lo=s(y(),1),_e=(0,io.observer)(function({model:e,row:t,bars:o,top:r,left:a,onClose:l}){let i=e.walkRowLaunchTarget(t,o??e.walkRowBars),d=i?.assembly;return(0,lo.jsx)(so.Menu,{open:!0,anchorReference:"anchorPosition",anchorPosition:{top:r,left:a},onClose:()=>{l()},onMenuItemClick:u=>{u()},menuItems:[i&&d?{label:`Linear genome view \u2014 ${d} ${Pe(i.location)}`,icon:De,onClick:()=>{e.showInLinearView({location:i.location,assembly:d})}}:{label:"Linear genome view",icon:De,disabled:!0,disabledHelpText:i?`No assembly in this session is ${i.location.haplotype??i.label}`:"This walk states no contig coordinates",onClick:()=>{}}]})});var fo=s(O(),1);var et=s(E(),1);var co=s(O(),1);function Er(n){return n==="class"?"className":/^(data|aria)-/.test(n)?n:n.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}function po(n,e){if(typeof n=="string")return n;let t={key:e};for(let[o,r]of Object.entries(n.attrs))r!==void 0&&(t[Er(o)]=r);return(0,co.createElement)(n.tag,t,...n.children.map(po))}function ae({el:n}){return po(n,0)}var C=s(y(),1),Gr={position:"absolute",left:0,top:0,pointerEvents:"none",overflow:"visible",zIndex:3},Tr="#111",Nr="#9e9e9e",ye={width:18,height:gt-4,borderRadius:2},Hr={...ye,display:"flex",justifyContent:"center"};function uo({color:n}){return(0,C.jsx)("div",{style:Hr,children:(0,C.jsx)("div",{style:{width:2,backgroundColor:n}})})}function tt({swatch:n}){return n.kind==="gene"?(0,C.jsx)("div",{style:{...ye,boxSizing:"border-box",border:`1.5px solid ${ht}`,borderRadius:0}}):(0,C.jsx)("div",{style:{...ye,height:n.kind==="gap"?bt:ye.height,background:n.fill}})}var mo=(0,et.observer)(function({model:e}){let t=e.walkRowBars;if(!t)return null;let o=[t.reference,...t.rows].flatMap(a=>a.call??[]),r=Me(t,{ramp:e.referenceRampDomain,rampCss:ce,genes:e.walkRowGenes?.size?e.walkRowGeneGaps:void 0});return(0,C.jsxs)("div",{style:H,"data-testid":"graph-walk-rows-legend",children:[r.map(a=>a.note?(0,C.jsx)("div",{style:{color:"#666",fontStyle:"italic"},children:a.label},a.label):(0,C.jsxs)("div",{style:R,children:[(0,C.jsx)(tt,{swatch:a.swatch}),(0,C.jsx)("span",{children:a.label})]},a.label)),o.some(a=>a.spanningReads!==0)?(0,C.jsxs)("div",{style:R,children:[(0,C.jsx)(uo,{color:Tr}),(0,C.jsx)("span",{children:"allele length called for this walk"})]}):null,o.some(a=>a.spanningReads===0)?(0,C.jsxs)("div",{style:R,children:[(0,C.jsx)(uo,{color:Nr}),(0,C.jsx)("span",{children:"called with no read spanning it"})]}):null,o.some(a=>a.agrees===!1)?(0,C.jsxs)("div",{style:R,children:[(0,C.jsx)("div",{style:ye}),(0,C.jsxs)("span",{style:{color:vt},children:["walk and call over ",Math.round(.1*100),"% apart"]})]}):null]})}),Wr=(0,et.observer)(function({model:e}){let t=(0,fo.useId)().replace(/[^\w-]/g,""),o=e.walkRowBars;if(!o)return null;let{paneWidth:r,canvasHeight:a}=e;return(0,C.jsx)("svg",{style:Gr,width:r,height:a,"data-testid":"graph-walk-rows",children:(0,C.jsx)(ae,{el:Re(o,{scaleX:e.scaleX,scaleY:e.scaleY,translateX:e.translateX,translateY:e.translateY,width:r,height:a},{ramp:e.referenceRampDomain,rowGenes:e.walkRowGenes,idPrefix:t})})})}),ho=Wr;var se=s(O(),1);var go=s(we(),1),nt=s(E(),1);var T=s(y(),1),Br={display:"flex",flexWrap:"wrap",gap:"2px 14px",padding:"2px 8px 6px",fontSize:11,color:"#333"},_r={position:"absolute",pointerEvents:"none",background:"rgba(255,255,255,0.92)",border:"1px solid #ccc",borderRadius:3,padding:"1px 6px",fontSize:11,whiteSpace:"nowrap",zIndex:4},zr=(0,nt.observer)(function({bars:e,frame:t,ramp:o,rowGenes:r}){let a=(0,se.useId)().replace(/[^\w-]/g,""),l=(0,se.useMemo)(()=>Re(e,t,{ramp:o,rowGenes:r,idPrefix:a}),[e,t,o,r,a]);return(0,T.jsx)(ae,{el:l})}),Ar=(0,nt.observer)(function({model:e}){let t=e.walkStripRows,o=e.walkStripFrame,[r,a]=(0,se.useState)(void 0),[l,i]=(0,se.useState)(void 0);if(!t||!o)return null;let d=f=>{let c=f.currentTarget.getBoundingClientRect(),h=f.clientX-c.left,m=f.clientY-c.top;return{...wt(t,o,h,m),x:h,y:m}},u=Me(t,{ramp:e.referenceRampDomain,rampCss:ce,genes:xt(o,e.walkRowGenes,e.walkRowGeneGaps)});return(0,T.jsxs)("div",{"data-testid":"graph-walk-strip",style:{position:"relative",borderTop:"1px solid #ddd"},onMouseEnter:()=>{e.setPointerInPane(!0)},onMouseLeave:()=>{(0,go.isAlive)(e)&&(e.setPointerInPane(!1),e.setStripHover(null)),i(void 0)},children:[(0,T.jsxs)("svg",{width:o.width,height:o.height,style:{display:"block",cursor:"pointer"},onMouseMove:f=>{let c=d(f);c.row?(e.setStripHover({row:c.row.name,offset:c.offset}),i(o.labelled?void 0:{text:`${c.row.label} \xB7 ${yt(c.row,c.index===0?void 0:t.reference)}`,x:c.x,y:c.y})):(e.setStripHover(null),i(void 0))},onClick:f=>{let c=d(f);c.row&&c.index>0&&e.toggleWalk(c.row.name)},onContextMenu:f=>{let c=d(f);c.row&&(f.preventDefault(),a({row:c.index,top:f.clientY,left:f.clientX}))},children:[(0,T.jsx)(zr,{bars:t,frame:o,ramp:e.referenceRampDomain,rowGenes:e.walkRowGenes}),(0,T.jsx)(ae,{el:St(t,o,e.walkStripMarks)}),(0,T.jsx)(ae,{el:kt(t,o,new Set(e.walkLayers.map(f=>f.walk)))})]}),l?(0,T.jsx)("div",{style:{..._r,left:l.x+12,top:l.y-18},children:l.text}):null,(0,T.jsxs)("div",{style:Br,"data-testid":"graph-walk-strip-key",children:[u.map(f=>(0,T.jsxs)("div",{style:R,children:[(0,T.jsx)(tt,{swatch:f.swatch}),(0,T.jsx)("span",{children:f.label})]},f.label)),(0,T.jsx)("div",{style:R,children:(0,T.jsx)("span",{children:"\u25AE ticks: where each walk passes the node under the pointer \xB7 click a bar to lift its walk"})})]}),r?(0,T.jsx)(_e,{model:e,row:r.row,bars:t,top:r.top,left:r.left,onClose:()=>{a(void 0)}}):null]})}),bo=Ar;var yo=s(E(),1),ve=s(y(),1),Or={position:"absolute",left:0,top:0,pointerEvents:"none",overflow:"visible",zIndex:4},Xr=(0,yo.observer)(function({model:e}){let t=e.walkStripLocator;return t?(0,ve.jsxs)("svg",{style:Or,width:e.paneWidth,height:e.canvasHeight,"data-testid":"graph-walk-strip-locator",children:[(0,ve.jsx)("circle",{cx:t.x,cy:t.y,r:11,fill:"none",stroke:"white",strokeWidth:4}),(0,ve.jsx)("circle",{cx:t.x,cy:t.y,r:11,fill:"none",stroke:"#111",strokeWidth:1.75})]}):null}),vo=Xr;function wo(n){return Promise.resolve(new Le(n))}var p=s(y(),1),So={position:"absolute",bottom:8,right:8,background:"rgba(0,0,0,0.75)",color:"white",padding:"4px 8px",borderRadius:4,fontSize:12,pointerEvents:"none",zIndex:6},Dr={position:"relative"},Yr={position:"relative",lineHeight:0,isolation:"isolate"},$r={position:"absolute",left:0,right:0,bottom:0,zIndex:0},Fr={position:"absolute",inset:0,zIndex:10,lineHeight:"normal",pointerEvents:"none"},Kr={position:"absolute",left:6,transform:"translateY(-50%)",background:"rgba(255,255,255,0.82)",padding:"0 4px",borderRadius:3,fontSize:11,lineHeight:"16px",whiteSpace:"nowrap",pointerEvents:"none",zIndex:4},Vr=(0,z.observer)(function({model:e}){let t=e.drawnRowLabels;return(0,p.jsx)(p.Fragment,{children:t.map(({label:o,y:r})=>{let a=r*e.scaleY+e.translateY;return a>=0&&a<=e.canvasHeight?(0,p.jsx)("div",{"data-testid":"graph-row-label",style:{...Kr,top:a},children:o},r):null})})}),Zr={position:"absolute",top:Ce,right:Ce,display:"flex",flexDirection:"column",alignItems:"flex-end",gap:4,pointerEvents:"none",zIndex:4},jr={width:18,height:3,borderRadius:2},Ur=(0,z.observer)(function({model:e}){let{pathLegend:t}=e;return t.length>0?(0,p.jsx)("div",{style:H,"data-testid":"graph-path-legend",children:t.map(({name:o,label:r,color:a})=>(0,p.jsxs)("div",{style:R,children:[(0,p.jsx)("div",{style:{...jr,backgroundColor:a}}),(0,p.jsx)("span",{children:r})]},o))}):null}),qr=(0,z.observer)(function({model:e}){let t=e.walkLift;return t?(0,p.jsxs)("div",{style:H,"data-testid":"graph-walk-readout",children:[t.walks.map(o=>(0,p.jsx)(he,{walk:o,label:e.walkLabel(o.name),reference:e.walkReference,at:e.hoveredOn(o)},o.name)),e.liftPaintsOffReference?(0,p.jsx)(xo,{}):null,(0,p.jsxs)("div",{style:R,children:[(0,p.jsx)("div",{style:{...oe,background:me}}),(0,p.jsxs)("span",{children:["not on ",e.liftedWalksLabel]})]})]}):null}),Jr={minWidth:90,height:8,borderRadius:2,background:ce},Qr={display:"flex",justifyContent:"space-between",gap:8},ea=(0,z.observer)(function({model:e}){let t=e.walkLift?void 0:e.referenceRampDomain,{offReference:o,unplaced:r}=e.referenceRampOffKeys,a=Math.round(t?.start??0),l=Math.round(t?.end??0);return t?(0,p.jsxs)("div",{style:H,"data-testid":"graph-ramp-legend",children:[(0,p.jsx)("div",{style:Jr}),(0,p.jsxs)("div",{style:Qr,children:[(0,p.jsx)("span",{children:a.toLocaleString()}),(0,p.jsxs)("span",{children:["(",ke(l-a),")"]}),(0,p.jsx)("span",{children:l.toLocaleString()})]}),o?(0,p.jsx)(xo,{}):null,r?(0,p.jsxs)("div",{style:R,children:[(0,p.jsx)("div",{style:{...oe,background:ta}}),(0,p.jsx)("span",{children:"no reference position"})]}):null]}):null}),ta="rgb(160, 160, 160)";function xo(){return(0,p.jsxs)("div",{style:R,children:[(0,p.jsx)("div",{style:{...oe,background:ut}}),(0,p.jsx)("span",{children:"off the reference"})]})}var na={...oe,border:`2px solid ${ge}`,borderRadius:5,boxSizing:"border-box"},oa=(0,z.observer)(function({model:e}){return e.genePins.some(t=>t.exonsByNode.length>0)?(0,p.jsx)("div",{style:H,"data-testid":"graph-gene-legend",children:(0,p.jsxs)("div",{style:R,children:[(0,p.jsx)("div",{style:na}),(0,p.jsx)("span",{children:"exon"})]})}):null}),Mo={position:"absolute",transform:"translate(-50%, -50%)",background:"rgba(255,255,255,0.78)",padding:"0 3px",borderRadius:3,fontSize:10,lineHeight:"13px",whiteSpace:"nowrap",pointerEvents:"none",zIndex:3},ra={...Mo,color:"#18181c",fontWeight:600},aa={position:"absolute",left:0,top:0,pointerEvents:"none",overflow:"visible",zIndex:2},sa=(0,z.observer)(function({model:e}){let t=(0,ze.useRef)(null);return(0,ze.useEffect)(()=>{let o=t.current;if(!o)return;let r=new ResizeObserver(()=>{(0,ot.isAlive)(e)&&e.hoveredNode===null&&e.setLegendSize({width:o.offsetWidth,height:o.offsetHeight})});return r.observe(o),()=>{r.disconnect()}},[e]),(0,p.jsxs)("div",{ref:t,style:{...Zr,top:Ce+e.referenceStripZonePx},children:[(0,p.jsx)(ea,{model:e}),(0,p.jsx)(Un,{model:e}),(0,p.jsx)(Ft,{model:e}),(0,p.jsx)(oa,{model:e}),(0,p.jsx)(Ur,{model:e}),(0,p.jsx)(to,{model:e}),(0,p.jsx)(mo,{model:e}),(0,p.jsx)(qr,{model:e})]})}),ia=(0,z.observer)(function({model:e}){let t=e.overlayLabels.sizes,o=t.flatMap(({key:r,leader:a})=>a?[{key:r,...a}]:[]);return(0,p.jsxs)(p.Fragment,{children:[o.length>0?(0,p.jsx)("svg",{style:aa,width:e.paneWidth,height:e.canvasHeight,children:o.map(({key:r,arcX:a,arcY:l,labelX:i,labelY:d})=>(0,p.jsx)("line",{"data-testid":"graph-label-leader",x1:a,y1:l,x2:i,y2:d,stroke:"#18181c",strokeWidth:1},r))}):null,t.map(({key:r,text:a,x:l,y:i,kind:d})=>(0,p.jsx)("div",{"data-testid":"graph-size-label",style:{...d==="deletion"?ra:Mo,left:l,top:i},children:a},r))]})}),la=(0,z.observer)(function({model:e}){let t=e.hoveredNode?e.nodeById?.get(e.hoveredNode):null,o=e.hoveredEdge!==null&&e.graph?e.graph.edges[e.hoveredEdge]:null,r=t?Bt(t):void 0,a=e.hoveredEdge===null?void 0:e.deletions.find(l=>l.edgeIndex===e.hoveredEdge);return(0,p.jsxs)(p.Fragment,{children:[t?(0,p.jsxs)("div",{style:So,children:[(0,p.jsx)("strong",{children:t.name})," \u2014"," ",t.length.toLocaleString()," bp, depth"," ",t.depth.toFixed(1),r?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("br",{}),r.sample," ",Pe(r)," (rank"," ",t.stable?.rank,")"]}):null]}):null,o?(0,p.jsx)("div",{style:So,children:a?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("strong",{children:"Deletion"})," ",a.bp.toLocaleString()," bp",(0,p.jsx)("br",{}),a.refName,":",a.start.toLocaleString(),"-",a.end.toLocaleString()]}):(0,p.jsxs)(p.Fragment,{children:["Edge: ",o.from," \u2192 ",o.to]})}):null]})}),ca=(0,z.observer)(function({model:e,nodeId:t,top:o,left:r,onClose:a}){let{own:l,reference:i,highlight:d}=e.nodeLaunchTargets(t);return(0,p.jsx)(ie.Menu,{open:!0,anchorReference:"anchorPosition",anchorPosition:{top:o,left:r},onClose:()=>{a()},onMenuItemClick:u=>{u()},menuItems:[{label:"Node details",icon:Yt,onClick:()=>{e.showNodeDetails(t)}},..._t({own:l,reference:i,highlight:d,onShowLinear:u=>{e.showInLinearView(u)},onHighlight:e.canHighlightInLinearView?u=>{e.highlightInLinearView(u)}:void 0})]})}),pa=(0,z.observer)(function({model:e,ownChrome:t=!0}){let{canvasRef:o,canvas:r,error:a,retry:l}=(0,ko.useRenderingBackend)(wo,e),{handlers:i,contextNode:d,contextRow:u,closeContextMenu:f}=rn(e);Ge(r,e);let c=e.facetPanels!==void 0;return(0,p.jsxs)("div",{style:Dr,children:[t?(0,p.jsx)(An,{model:e}):null,(0,p.jsxs)("div",{style:Yr,onMouseEnter:()=>{e.setPointerInPane(!0)},onMouseLeave:()=>{(0,ot.isAlive)(e)&&e.setPointerInPane(!1)},children:[e.referenceStripShown?(0,p.jsx)("div",{style:{...$r,top:e.referenceStripZonePx,background:e.paperCss}}):null,(0,p.jsx)("canvas",{ref:o,"data-testid":"graph-genome-canvas",style:{width:e.paneWidth,height:e.canvasHeight,cursor:e.isPanning||e.draggingNode?"grabbing":"grab",display:"block",position:"relative",zIndex:1},...i}),c?(0,p.jsx)(an,{model:e,handlers:i}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(eo,{model:e}),(0,p.jsx)(Zn,{model:e}),(0,p.jsx)(Vr,{model:e}),(0,p.jsx)(ia,{model:e}),(0,p.jsx)($t,{model:e}),(0,p.jsx)(cn,{model:e}),(0,p.jsx)($n,{model:e}),(0,p.jsx)(ho,{model:e}),(0,p.jsx)(vo,{model:e}),(0,p.jsx)(sa,{model:e})]}),(0,p.jsx)(ro,{model:e}),t?(0,p.jsx)("div",{style:Fr,children:(0,p.jsx)(ie.LoadingOverlay,{isVisible:e.isLoading,immediate:!e.layoutResult,statusMessage:e.statusMessage,onCancel:e.canCancelLoad?()=>{e.cancelLoad()}:void 0})}):null]}),e.walkStripShown?(0,p.jsx)(bo,{model:e}):null,(0,p.jsx)(la,{model:e}),d?(0,p.jsx)(ca,{model:e,nodeId:d.nodeId,top:d.top,left:d.left,onClose:f}):null,u?(0,p.jsx)(_e,{model:e,row:u.row,top:u.top,left:u.left,onClose:f}):null,a?(0,p.jsx)(ie.ErrorBanner,{error:a,onReset:l}):null,t&&e.error?(0,p.jsx)(ie.ErrorBanner,{error:e.error,onReset:e.canRetryLoad?()=>{e.retryLoad()}:void 0}):null]})}),Gi=pa;export{Gi as a};
3
+ //# sourceMappingURL=chunk-AFYY6LQF.js.map