jbrowse-plugin-graphgenomeviewer 10.0.4 → 10.0.5

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 (34) hide show
  1. package/dist/chunks/{AddTrackWorkflow-47H3VBK4.js → AddTrackWorkflow-Y5QFCUEI.js} +2 -2
  2. package/dist/chunks/{GbzBaseSyntenyAdapter-X6AW5IYW.js → GbzBaseSyntenyAdapter-HRHJ5S6M.js} +2 -2
  3. package/dist/chunks/{GraphGenomeView-ZTZEYNUY.js → GraphGenomeView-S223KWMV.js} +2 -2
  4. package/dist/chunks/{LinearGraphDisplay-QWJZ5PSO.js → LinearGraphDisplay-OXA2BQOR.js} +2 -2
  5. package/dist/chunks/{MinigraphBubbleAdapter-WUTIBCFA.js → MinigraphBubbleAdapter-YOQVCUCS.js} +2 -2
  6. package/dist/chunks/{RgfaTabixAdapter-VT7TYMNE.js → RgfaTabixAdapter-Y2R2NI7Y.js} +2 -2
  7. package/dist/chunks/{WalkFormsAdapter-VRJ4FYQB.js → WalkFormsAdapter-NWBUSYX5.js} +2 -2
  8. package/dist/chunks/{WalkTabixSyntenyAdapter-ZYWYXAC7.js → WalkTabixSyntenyAdapter-IZG232F6.js} +2 -2
  9. package/dist/chunks/{chunk-UXBGMTAO.js → chunk-BZ436KGZ.js} +2 -2
  10. package/dist/chunks/{chunk-5FMNLEED.js → chunk-IWZ4JPV3.js} +2 -2
  11. package/dist/chunks/{chunk-MQ43JVZM.js → chunk-LNTZ37UI.js} +2 -2
  12. package/dist/chunks/{chunk-UPSA4KVF.js → chunk-SG4UIYEN.js} +2 -2
  13. package/dist/chunks/chunk-TQZH7NNB.js +6 -0
  14. package/dist/chunks/chunk-TQZH7NNB.js.map +7 -0
  15. package/dist/chunks/{chunk-P7V5S3V3.js → chunk-UC2KMZPE.js} +2 -2
  16. package/dist/jbrowse-plugin-graphgenomeviewer.esm.js +1 -1
  17. package/dist/jbrowse-plugin-graphgenomeviewer.esm.js.map +1 -1
  18. package/package.json +2 -2
  19. package/src/version.ts +1 -1
  20. package/dist/chunks/chunk-TDHUAADJ.js +0 -6
  21. package/dist/chunks/chunk-TDHUAADJ.js.map +0 -7
  22. /package/dist/chunks/{AddTrackWorkflow-47H3VBK4.js.map → AddTrackWorkflow-Y5QFCUEI.js.map} +0 -0
  23. /package/dist/chunks/{GbzBaseSyntenyAdapter-X6AW5IYW.js.map → GbzBaseSyntenyAdapter-HRHJ5S6M.js.map} +0 -0
  24. /package/dist/chunks/{GraphGenomeView-ZTZEYNUY.js.map → GraphGenomeView-S223KWMV.js.map} +0 -0
  25. /package/dist/chunks/{LinearGraphDisplay-QWJZ5PSO.js.map → LinearGraphDisplay-OXA2BQOR.js.map} +0 -0
  26. /package/dist/chunks/{MinigraphBubbleAdapter-WUTIBCFA.js.map → MinigraphBubbleAdapter-YOQVCUCS.js.map} +0 -0
  27. /package/dist/chunks/{RgfaTabixAdapter-VT7TYMNE.js.map → RgfaTabixAdapter-Y2R2NI7Y.js.map} +0 -0
  28. /package/dist/chunks/{WalkFormsAdapter-VRJ4FYQB.js.map → WalkFormsAdapter-NWBUSYX5.js.map} +0 -0
  29. /package/dist/chunks/{WalkTabixSyntenyAdapter-ZYWYXAC7.js.map → WalkTabixSyntenyAdapter-IZG232F6.js.map} +0 -0
  30. /package/dist/chunks/{chunk-UXBGMTAO.js.map → chunk-BZ436KGZ.js.map} +0 -0
  31. /package/dist/chunks/{chunk-5FMNLEED.js.map → chunk-IWZ4JPV3.js.map} +0 -0
  32. /package/dist/chunks/{chunk-MQ43JVZM.js.map → chunk-LNTZ37UI.js.map} +0 -0
  33. /package/dist/chunks/{chunk-UPSA4KVF.js.map → chunk-SG4UIYEN.js.map} +0 -0
  34. /package/dist/chunks/{chunk-P7V5S3V3.js.map → chunk-UC2KMZPE.js.map} +0 -0
@@ -1,4 +1,4 @@
1
- import{a as mt}from"./chunk-JM4W4PKP.js";import{a as ut}from"./chunk-UXBGMTAO.js";import{a as pt,c as lt}from"./chunk-5L276I7O.js";function dt(e){let t=[],r=0,o;for(let i=0,n=e.length;i<n;i++){let s=e.charCodeAt(i);if(s>=48&&s<=57)r=r*10+s-48;else if(s===58)o=r,r=0;else{let a=e[i];a==="M"||a==="="||a==="X"?t.push({own:o===void 0?r:o,mate:r,op:"M"}):a==="I"?t.push({own:0,mate:r,op:a}):(a==="D"||a==="N")&&t.push({own:r,mate:0,op:a}),o=void 0,r=0}}return t}function Pe(e){let t="";for(let{own:r,mate:o,op:i}of dt(e))t+=i==="M"?r===0?`${o}I`:o===0?`${r}D`:`${r}M`:`${i==="I"?o:r}${i}`;return t}var Ne=2**28-1;function Fe(e,t,r){for(let o=t;o>0;o-=Ne)e.push((Math.min(o,Ne)<<4|r)>>>0)}function mr(e,t,r){if(t===r)Fe(e,t,0);else{let o=Math.ceil(Math.max(t,r)/Ne);for(let i=0;i<o;i++){let n=Math.floor(t*(i+1)/o)-Math.floor(t*i/o),s=Math.floor(r*(i+1)/o)-Math.floor(r*i/o);e.push((n<<4|9)>>>0,(s<<4|9)>>>0)}}}function ke(e){let t=[];for(let{own:r,mate:o,op:i}of dt(e))i==="M"?mr(t,r,o):i==="I"?Fe(t,o,1):Fe(t,r,i==="N"?3:2);return Uint32Array.from(t)}function dr(e){return e>=48&&e<=57}function hr(e){return e!==void 0&&/[A-Za-z]/.test(e)}function ht(e,t){let r=t;for(;r<e.length&&hr(e[r]);)r++;return r}function xt(e,t){let r=t,o=0;for(;r<e.length&&dr(e.charCodeAt(r));)o=o*10+(e.charCodeAt(r)-48),r++;return{value:o,next:r}}function vt(e,t){let r=0;for(;r<e.length;){let o=e[r];if(o===":"){let{value:i,next:n}=xt(e,r+1);t(":",i,i,r+1,n),r=n}else if(o==="="){let i=ht(e,r+1),n=i-r-1;t("=",n,n,r+1,i),r=i}else if(o==="*")t("*",1,1,r+1,Math.min(r+3,e.length)),r+=3;else if(o==="+"||o==="-"){let i=ht(e,r+1),n=i-r-1;t(o,o==="-"?n:0,o==="+"?n:0,r+1,i),r=i}else if(o==="~"){let{value:i,next:n}=xt(e,r+3),s=Math.min(n+2,e.length);t("~",i,0,r+1,s),r=s}else r++}}function De(e,t,r,o){let i=r??Number.NEGATIVE_INFINITY,n=o??Number.POSITIVE_INFINITY,s=0;vt(e,(a,c,f,p,l)=>{if(a==="*")s>=i&&s<n&&t(88,s,1,e[p+1]??"",-1,0,0);else if(a==="+"){if(s>=i&&s<=n){let m=e.slice(p,l);t(73,s,f,m,-1,0,f)}}else(a==="-"||a==="~")&&s<n&&s+c>i&&t(a==="-"?68:78,s,c,"",-1,0,0);s+=c})}function At(e,t,r,o){let i=0,n=0,s=[],a=r&&t;for(let c=0,f=e.length;c<f;c++){let p=e[c],l=p>>>4,m=p&15;if(m===0||m===7){if(a)for(let u=0;u<l;u++)(t.charCodeAt(n+u)|32)!==(r.charCodeAt(i+u)|32)&&s.push({start:i+u,type:"mismatch",base:t[n+u],altbase:r[i+u],length:1});n+=l,i+=l}else if(m===1)s.push({start:i,type:"insertion",insertlen:l,insertedBases:t?.slice(n,n+l),length:0}),n+=l;else if(m===2)s.push({start:i,type:"deletion",length:l}),i+=l;else if(m===3)s.push({start:i,type:"skip",length:l}),i+=l;else if(m===8){for(let u=0;u<l;u++)s.push({start:i+u,type:"mismatch",base:t?.[n+u]||"X",qual:o?.[n+u],length:1});n+=l,i+=l}else m===5?s.push({start:i,type:"hardclip",cliplen:l,length:1}):m===4&&(s.push({start:i,type:"softclip",cliplen:l,length:1}),n+=l)}return s}function It(e,t,r,o,i){if(!t)return[];let n=[],s=t.length,a=o.length,c=i!==void 0,f=r.length,p=!1;for(let b=0;b<f;b++)if(r[b].type==="skip"){p=!0;break}let l=0,m=0,u=0,h=0,x=0,y=0,S=e.length;for(;y<S;){let b=e.charCodeAt(y);if(b>=48&&b<=57){let d=0;for(;y<S;){let g=e.charCodeAt(y);if(g>=48&&g<=57)d=d*10+(g-48),y++;else break}l+=d}else if(b===94)for(y++;y<S&&e.charCodeAt(y)>=65;)y++,l++;else if(b>=65){let d=e[y];if(y++,p&&f>0)for(let M=x;M<f;M++){let _=r[M];_.type==="skip"&&l>=_.start&&(l+=_.length,x=M+1)}let g=u,v=h;for(let M=m;M<s&&v<=l;M++,m=M){let _=t[M],P=_>>>4,E=_&15;E===4||E===1?g+=P:E===2||E===6||E===3?v+=P:E!==5&&(g+=P,v+=P)}u=g,h=v;let I=g-(v-l),C=I<a?o[I]:"X";n.push({start:l,base:C,qual:c?i[I]:void 0,altbase:d,length:1,type:"mismatch"}),l++}else y++}return n}var Ct={77:0,73:1,68:2,78:3,83:4,72:5,80:6,61:7,88:8};function _t(e=""){let t=0,r=[];for(let o=0,i=e.length;o<i;o++){let n=e.charCodeAt(o);if(n>=48&&n<=57)t=t*10+(n-48);else{let s=Ct[n];r.push(t<<4|s),t=0}}return r}function Be(e=""){let t=0;for(let n=0,s=e.length;n<s;n++){let a=e.charCodeAt(n);(a<48||a>57)&&t++}let r=new Uint32Array(t),o=0,i=0;for(let n=0,s=e.length;n<s;n++){let a=e.charCodeAt(n);a>=48&&a<=57?o=o*10+(a-48):(r[i++]=o<<4|Ct[a],o=0)}return r}function se(e,t,r,o,i){let n=_t(e),s=e?At(n,r,o,i):[];return t&&r?s.concat(It(t,n,s,r,i)):s}var j=class extends pt{get(t){return t==="mismatches"?se(this.walkableCigar):t==="clipLengthAtStartOfRead"?this.clipLengthAtStartOfRead:t==="name"?super.get("name")??this.mate?.refName:super.get(t)}get mate(){return super.get("mate")}get walkableCigar(){let t=super.get("CIGAR"),r=super.get("coarseCigar");return typeof t=="string"?t:typeof r=="string"?Pe(r):void 0}get clipLengthAtStartOfRead(){return this.mate?.start??0}forEachMismatch(t,r){let o=this.get("start"),i=r?.start===void 0?void 0:r.start-o,n=r?.end===void 0?void 0:r.end-o,s=this.get("cs");if(s)De(s,t,i,n);else{let a=i??Number.NEGATIVE_INFINITY,c=n??Number.POSITIVE_INFINITY;for(let f of se(this.walkableCigar))(f.type==="deletion"||f.type==="skip"?f.start<c&&f.start+f.length>a:f.start>=a&&f.start<=c)&&(f.type==="mismatch"?t(88,f.start,f.length,f.base,f.qual??-1,0,0):f.type==="insertion"?t(73,f.start,f.length,f.insertedBases??"",-1,0,f.insertlen):f.type==="deletion"?t(68,f.start,f.length,"",-1,0,0):f.type==="skip"&&t(78,f.start,f.length,"",-1,0,0))}}};var je=function(e,t){return je=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},je(e,t)};function J(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");je(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function Et(e,t,r,o){function i(n){return n instanceof r?n:new r(function(s){s(n)})}return new(r||(r=Promise))(function(n,s){function a(p){try{f(o.next(p))}catch(l){s(l)}}function c(p){try{f(o.throw(p))}catch(l){s(l)}}function f(p){p.done?n(p.value):i(p.value).then(a,c)}f((o=o.apply(e,t||[])).next())})}function ae(e,t){var r={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},o,i,n,s=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(f){return function(p){return c([f,p])}}function c(f){if(o)throw new TypeError("Generator is already executing.");for(;s&&(s=0,f[0]&&(r=0)),r;)try{if(o=1,i&&(n=f[0]&2?i.return:f[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,f[1])).done)return n;switch(i=0,n&&(f=[f[0]&2,n.value]),f[0]){case 0:case 1:n=f;break;case 4:return r.label++,{value:f[1],done:!1};case 5:r.label++,i=f[1],f=[0];continue;case 7:f=r.ops.pop(),r.trys.pop();continue;default:if(n=r.trys,!(n=n.length>0&&n[n.length-1])&&(f[0]===6||f[0]===2)){r=0;continue}if(f[0]===3&&(!n||f[1]>n[0]&&f[1]<n[3])){r.label=f[1];break}if(f[0]===6&&r.label<n[1]){r.label=n[1],n=f;break}if(n&&r.label<n[2]){r.label=n[2],r.ops.push(f);break}n[2]&&r.ops.pop(),r.trys.pop();continue}f=t.call(e,r)}catch(p){f=[6,p],i=0}finally{o=n=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}}function U(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],o=0;if(r)return r.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(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Y(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var o=r.call(e),i,n=[],s;try{for(;(t===void 0||t-- >0)&&!(i=o.next()).done;)n.push(i.value)}catch(a){s={error:a}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(s)throw s.error}}return n}function z(e,t,r){if(r||arguments.length===2)for(var o=0,i=t.length,n;o<i;o++)(n||!(o in t))&&(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))}function W(e){return this instanceof W?(this.v=e,this):new W(e)}function wt(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o=r.apply(e,t||[]),i,n=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",s),i[Symbol.asyncIterator]=function(){return this},i;function s(u){return function(h){return Promise.resolve(h).then(u,l)}}function a(u,h){o[u]&&(i[u]=function(x){return new Promise(function(y,S){n.push([u,x,y,S])>1||c(u,x)})},h&&(i[u]=h(i[u])))}function c(u,h){try{f(o[u](h))}catch(x){m(n[0][3],x)}}function f(u){u.value instanceof W?Promise.resolve(u.value.v).then(p,l):m(n[0][2],u)}function p(u){c("next",u)}function l(u){c("throw",u)}function m(u,h){u(h),n.shift(),n.length&&c(n[0][0],n[0][1])}}function Mt(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof U=="function"?U(e):e[Symbol.iterator](),r={},o("next"),o("throw"),o("return"),r[Symbol.asyncIterator]=function(){return this},r);function o(n){r[n]=e[n]&&function(s){return new Promise(function(a,c){s=e[n](s),i(a,c,s.done,s.value)})}}function i(n,s,a,c){Promise.resolve(c).then(function(f){n({value:f,done:a})},s)}}function A(e){return typeof e=="function"}function Tt(e){var t=function(o){Error.call(o),o.stack=new Error().stack},r=e(t);return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}var fe=Tt(function(e){return function(r){e(this),this.message=r?r.length+` errors occurred during unsubscription:
1
+ import{a as mt}from"./chunk-JM4W4PKP.js";import{a as ut}from"./chunk-BZ436KGZ.js";import{a as pt,c as lt}from"./chunk-5L276I7O.js";function dt(e){let t=[],r=0,o;for(let i=0,n=e.length;i<n;i++){let s=e.charCodeAt(i);if(s>=48&&s<=57)r=r*10+s-48;else if(s===58)o=r,r=0;else{let a=e[i];a==="M"||a==="="||a==="X"?t.push({own:o===void 0?r:o,mate:r,op:"M"}):a==="I"?t.push({own:0,mate:r,op:a}):(a==="D"||a==="N")&&t.push({own:r,mate:0,op:a}),o=void 0,r=0}}return t}function Pe(e){let t="";for(let{own:r,mate:o,op:i}of dt(e))t+=i==="M"?r===0?`${o}I`:o===0?`${r}D`:`${r}M`:`${i==="I"?o:r}${i}`;return t}var Ne=2**28-1;function Fe(e,t,r){for(let o=t;o>0;o-=Ne)e.push((Math.min(o,Ne)<<4|r)>>>0)}function mr(e,t,r){if(t===r)Fe(e,t,0);else{let o=Math.ceil(Math.max(t,r)/Ne);for(let i=0;i<o;i++){let n=Math.floor(t*(i+1)/o)-Math.floor(t*i/o),s=Math.floor(r*(i+1)/o)-Math.floor(r*i/o);e.push((n<<4|9)>>>0,(s<<4|9)>>>0)}}}function ke(e){let t=[];for(let{own:r,mate:o,op:i}of dt(e))i==="M"?mr(t,r,o):i==="I"?Fe(t,o,1):Fe(t,r,i==="N"?3:2);return Uint32Array.from(t)}function dr(e){return e>=48&&e<=57}function hr(e){return e!==void 0&&/[A-Za-z]/.test(e)}function ht(e,t){let r=t;for(;r<e.length&&hr(e[r]);)r++;return r}function xt(e,t){let r=t,o=0;for(;r<e.length&&dr(e.charCodeAt(r));)o=o*10+(e.charCodeAt(r)-48),r++;return{value:o,next:r}}function vt(e,t){let r=0;for(;r<e.length;){let o=e[r];if(o===":"){let{value:i,next:n}=xt(e,r+1);t(":",i,i,r+1,n),r=n}else if(o==="="){let i=ht(e,r+1),n=i-r-1;t("=",n,n,r+1,i),r=i}else if(o==="*")t("*",1,1,r+1,Math.min(r+3,e.length)),r+=3;else if(o==="+"||o==="-"){let i=ht(e,r+1),n=i-r-1;t(o,o==="-"?n:0,o==="+"?n:0,r+1,i),r=i}else if(o==="~"){let{value:i,next:n}=xt(e,r+3),s=Math.min(n+2,e.length);t("~",i,0,r+1,s),r=s}else r++}}function De(e,t,r,o){let i=r??Number.NEGATIVE_INFINITY,n=o??Number.POSITIVE_INFINITY,s=0;vt(e,(a,c,f,p,l)=>{if(a==="*")s>=i&&s<n&&t(88,s,1,e[p+1]??"",-1,0,0);else if(a==="+"){if(s>=i&&s<=n){let m=e.slice(p,l);t(73,s,f,m,-1,0,f)}}else(a==="-"||a==="~")&&s<n&&s+c>i&&t(a==="-"?68:78,s,c,"",-1,0,0);s+=c})}function At(e,t,r,o){let i=0,n=0,s=[],a=r&&t;for(let c=0,f=e.length;c<f;c++){let p=e[c],l=p>>>4,m=p&15;if(m===0||m===7){if(a)for(let u=0;u<l;u++)(t.charCodeAt(n+u)|32)!==(r.charCodeAt(i+u)|32)&&s.push({start:i+u,type:"mismatch",base:t[n+u],altbase:r[i+u],length:1});n+=l,i+=l}else if(m===1)s.push({start:i,type:"insertion",insertlen:l,insertedBases:t?.slice(n,n+l),length:0}),n+=l;else if(m===2)s.push({start:i,type:"deletion",length:l}),i+=l;else if(m===3)s.push({start:i,type:"skip",length:l}),i+=l;else if(m===8){for(let u=0;u<l;u++)s.push({start:i+u,type:"mismatch",base:t?.[n+u]||"X",qual:o?.[n+u],length:1});n+=l,i+=l}else m===5?s.push({start:i,type:"hardclip",cliplen:l,length:1}):m===4&&(s.push({start:i,type:"softclip",cliplen:l,length:1}),n+=l)}return s}function It(e,t,r,o,i){if(!t)return[];let n=[],s=t.length,a=o.length,c=i!==void 0,f=r.length,p=!1;for(let b=0;b<f;b++)if(r[b].type==="skip"){p=!0;break}let l=0,m=0,u=0,h=0,x=0,y=0,S=e.length;for(;y<S;){let b=e.charCodeAt(y);if(b>=48&&b<=57){let d=0;for(;y<S;){let g=e.charCodeAt(y);if(g>=48&&g<=57)d=d*10+(g-48),y++;else break}l+=d}else if(b===94)for(y++;y<S&&e.charCodeAt(y)>=65;)y++,l++;else if(b>=65){let d=e[y];if(y++,p&&f>0)for(let M=x;M<f;M++){let _=r[M];_.type==="skip"&&l>=_.start&&(l+=_.length,x=M+1)}let g=u,v=h;for(let M=m;M<s&&v<=l;M++,m=M){let _=t[M],P=_>>>4,E=_&15;E===4||E===1?g+=P:E===2||E===6||E===3?v+=P:E!==5&&(g+=P,v+=P)}u=g,h=v;let I=g-(v-l),C=I<a?o[I]:"X";n.push({start:l,base:C,qual:c?i[I]:void 0,altbase:d,length:1,type:"mismatch"}),l++}else y++}return n}var Ct={77:0,73:1,68:2,78:3,83:4,72:5,80:6,61:7,88:8};function _t(e=""){let t=0,r=[];for(let o=0,i=e.length;o<i;o++){let n=e.charCodeAt(o);if(n>=48&&n<=57)t=t*10+(n-48);else{let s=Ct[n];r.push(t<<4|s),t=0}}return r}function Be(e=""){let t=0;for(let n=0,s=e.length;n<s;n++){let a=e.charCodeAt(n);(a<48||a>57)&&t++}let r=new Uint32Array(t),o=0,i=0;for(let n=0,s=e.length;n<s;n++){let a=e.charCodeAt(n);a>=48&&a<=57?o=o*10+(a-48):(r[i++]=o<<4|Ct[a],o=0)}return r}function se(e,t,r,o,i){let n=_t(e),s=e?At(n,r,o,i):[];return t&&r?s.concat(It(t,n,s,r,i)):s}var j=class extends pt{get(t){return t==="mismatches"?se(this.walkableCigar):t==="clipLengthAtStartOfRead"?this.clipLengthAtStartOfRead:t==="name"?super.get("name")??this.mate?.refName:super.get(t)}get mate(){return super.get("mate")}get walkableCigar(){let t=super.get("CIGAR"),r=super.get("coarseCigar");return typeof t=="string"?t:typeof r=="string"?Pe(r):void 0}get clipLengthAtStartOfRead(){return this.mate?.start??0}forEachMismatch(t,r){let o=this.get("start"),i=r?.start===void 0?void 0:r.start-o,n=r?.end===void 0?void 0:r.end-o,s=this.get("cs");if(s)De(s,t,i,n);else{let a=i??Number.NEGATIVE_INFINITY,c=n??Number.POSITIVE_INFINITY;for(let f of se(this.walkableCigar))(f.type==="deletion"||f.type==="skip"?f.start<c&&f.start+f.length>a:f.start>=a&&f.start<=c)&&(f.type==="mismatch"?t(88,f.start,f.length,f.base,f.qual??-1,0,0):f.type==="insertion"?t(73,f.start,f.length,f.insertedBases??"",-1,0,f.insertlen):f.type==="deletion"?t(68,f.start,f.length,"",-1,0,0):f.type==="skip"&&t(78,f.start,f.length,"",-1,0,0))}}};var je=function(e,t){return je=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},je(e,t)};function J(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");je(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function Et(e,t,r,o){function i(n){return n instanceof r?n:new r(function(s){s(n)})}return new(r||(r=Promise))(function(n,s){function a(p){try{f(o.next(p))}catch(l){s(l)}}function c(p){try{f(o.throw(p))}catch(l){s(l)}}function f(p){p.done?n(p.value):i(p.value).then(a,c)}f((o=o.apply(e,t||[])).next())})}function ae(e,t){var r={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},o,i,n,s=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(f){return function(p){return c([f,p])}}function c(f){if(o)throw new TypeError("Generator is already executing.");for(;s&&(s=0,f[0]&&(r=0)),r;)try{if(o=1,i&&(n=f[0]&2?i.return:f[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,f[1])).done)return n;switch(i=0,n&&(f=[f[0]&2,n.value]),f[0]){case 0:case 1:n=f;break;case 4:return r.label++,{value:f[1],done:!1};case 5:r.label++,i=f[1],f=[0];continue;case 7:f=r.ops.pop(),r.trys.pop();continue;default:if(n=r.trys,!(n=n.length>0&&n[n.length-1])&&(f[0]===6||f[0]===2)){r=0;continue}if(f[0]===3&&(!n||f[1]>n[0]&&f[1]<n[3])){r.label=f[1];break}if(f[0]===6&&r.label<n[1]){r.label=n[1],n=f;break}if(n&&r.label<n[2]){r.label=n[2],r.ops.push(f);break}n[2]&&r.ops.pop(),r.trys.pop();continue}f=t.call(e,r)}catch(p){f=[6,p],i=0}finally{o=n=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}}function U(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],o=0;if(r)return r.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(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Y(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var o=r.call(e),i,n=[],s;try{for(;(t===void 0||t-- >0)&&!(i=o.next()).done;)n.push(i.value)}catch(a){s={error:a}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(s)throw s.error}}return n}function z(e,t,r){if(r||arguments.length===2)for(var o=0,i=t.length,n;o<i;o++)(n||!(o in t))&&(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))}function W(e){return this instanceof W?(this.v=e,this):new W(e)}function wt(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o=r.apply(e,t||[]),i,n=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",s),i[Symbol.asyncIterator]=function(){return this},i;function s(u){return function(h){return Promise.resolve(h).then(u,l)}}function a(u,h){o[u]&&(i[u]=function(x){return new Promise(function(y,S){n.push([u,x,y,S])>1||c(u,x)})},h&&(i[u]=h(i[u])))}function c(u,h){try{f(o[u](h))}catch(x){m(n[0][3],x)}}function f(u){u.value instanceof W?Promise.resolve(u.value.v).then(p,l):m(n[0][2],u)}function p(u){c("next",u)}function l(u){c("throw",u)}function m(u,h){u(h),n.shift(),n.length&&c(n[0][0],n[0][1])}}function Mt(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof U=="function"?U(e):e[Symbol.iterator](),r={},o("next"),o("throw"),o("return"),r[Symbol.asyncIterator]=function(){return this},r);function o(n){r[n]=e[n]&&function(s){return new Promise(function(a,c){s=e[n](s),i(a,c,s.done,s.value)})}}function i(n,s,a,c){Promise.resolve(c).then(function(f){n({value:f,done:a})},s)}}function A(e){return typeof e=="function"}function Tt(e){var t=function(o){Error.call(o),o.stack=new Error().stack},r=e(t);return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}var fe=Tt(function(e){return function(r){e(this),this.message=r?r.length+` errors occurred during unsubscription:
2
2
  `+r.map(function(o,i){return i+1+") "+o.toString()}).join(`
3
3
  `):"",this.name="UnsubscriptionError",this.errors=r}});function Ue(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var ce=(function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var t,r,o,i,n;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var a=U(s),c=a.next();!c.done;c=a.next()){var f=c.value;f.remove(this)}}catch(x){t={error:x}}finally{try{c&&!c.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}else s.remove(this);var p=this.initialTeardown;if(A(p))try{p()}catch(x){n=x instanceof fe?x.errors:[x]}var l=this._finalizers;if(l){this._finalizers=null;try{for(var m=U(l),u=m.next();!u.done;u=m.next()){var h=u.value;try{Ot(h)}catch(x){n=n??[],x instanceof fe?n=z(z([],Y(n)),Y(x.errors)):n.push(x)}}}catch(x){o={error:x}}finally{try{u&&!u.done&&(i=m.return)&&i.call(m)}finally{if(o)throw o.error}}}if(n)throw new fe(n)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)Ot(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(t)}},e.prototype._hasParent=function(t){var r=this._parentage;return r===t||Array.isArray(r)&&r.includes(t)},e.prototype._addParent=function(t){var r=this._parentage;this._parentage=Array.isArray(r)?(r.push(t),r):r?[r,t]:t},e.prototype._removeParent=function(t){var r=this._parentage;r===t?this._parentage=null:Array.isArray(r)&&Ue(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&Ue(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=(function(){var t=new e;return t.closed=!0,t})(),e})();var zo=ce.EMPTY;function pe(e){return e instanceof ce||e&&"closed"in e&&A(e.remove)&&A(e.add)&&A(e.unsubscribe)}function Ot(e){A(e)?e():e.unsubscribe()}var N={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var V={setTimeout:function(e,t){for(var r=[],o=2;o<arguments.length;o++)r[o-2]=arguments[o];var i=V.delegate;return i?.setTimeout?i.setTimeout.apply(i,z([e,t],Y(r))):setTimeout.apply(void 0,z([e,t],Y(r)))},clearTimeout:function(e){var t=V.delegate;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function le(e){V.setTimeout(function(){var t=N.onUnhandledError;if(t)t(e);else throw e})}function We(){}var Rt=(function(){return $e("C",void 0,void 0)})();function Lt(e){return $e("E",void 0,e)}function Nt(e){return $e("N",e,void 0)}function $e(e,t,r){return{kind:e,value:t,error:r}}var $=null;function Ft(e){if(N.useDeprecatedSynchronousErrorHandling){var t=!$;if(t&&($={errorThrown:!1,error:null}),e(),t){var r=$,o=r.errorThrown,i=r.error;if($=null,o)throw i}}else e()}function Pt(e){N.useDeprecatedSynchronousErrorHandling&&$&&($.errorThrown=!0,$.error=e)}var ee=(function(e){J(t,e);function t(r){var o=e.call(this)||this;return o.isStopped=!1,r?(o.destination=r,pe(r)&&r.add(o)):o.destination=vr,o}return t.create=function(r,o,i){return new me(r,o,i)},t.prototype.next=function(r){this.isStopped?Ye(Nt(r),this):this._next(r)},t.prototype.error=function(r){this.isStopped?Ye(Lt(r),this):(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped?Ye(Rt,this):(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(r){this.destination.next(r)},t.prototype._error=function(r){try{this.destination.error(r)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t})(ce);var gr=Function.prototype.bind;function He(e,t){return gr.call(e,t)}var Sr=(function(){function e(t){this.partialObserver=t}return e.prototype.next=function(t){var r=this.partialObserver;if(r.next)try{r.next(t)}catch(o){ue(o)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(o){ue(o)}else ue(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){ue(r)}},e})(),me=(function(e){J(t,e);function t(r,o,i){var n=e.call(this)||this,s;if(A(r)||!r)s={next:r??void 0,error:o??void 0,complete:i??void 0};else{var a;n&&N.useDeprecatedNextContext?(a=Object.create(r),a.unsubscribe=function(){return n.unsubscribe()},s={next:r.next&&He(r.next,a),error:r.error&&He(r.error,a),complete:r.complete&&He(r.complete,a)}):s=r}return n.destination=new Sr(s),n}return t})(ee);function ue(e){N.useDeprecatedSynchronousErrorHandling?Pt(e):le(e)}function br(e){throw e}function Ye(e,t){var r=N.onStoppedNotification;r&&V.setTimeout(function(){return r(e,t)})}var vr={closed:!0,next:We,error:br,complete:We};var K=(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(r){return e.reduce(function(o,i){return i(o)},r)}}var T=(function(){function e(t){t&&(this._subscribe=t)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(t,r,o){var i=this,n=Ir(t)?t:new me(t,r,o);return Ft(function(){var s=i,a=s.operator,c=s.source;n.add(a?a.call(n,c):c?i._subscribe(n):i._trySubscribe(n))}),n},e.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(r){t.error(r)}},e.prototype.forEach=function(t,r){var o=this;return r=qt(r),new r(function(i,n){var s=new me({next:function(a){try{t(a)}catch(c){n(c),s.unsubscribe()}},error:n,complete:i});o.subscribe(s)})},e.prototype._subscribe=function(t){var r;return(r=this.source)===null||r===void 0?void 0:r.subscribe(t)},e.prototype[K]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return Dt(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=qt(t),new t(function(o,i){var n;r.subscribe(function(s){return n=s},function(s){return i(s)},function(){return o(n)})})},e.create=function(t){return new e(t)},e})();function qt(e){var t;return(t=e??N.Promise)!==null&&t!==void 0?t:Promise}function Ar(e){return e&&A(e.next)&&A(e.error)&&A(e.complete)}function Ir(e){return e&&e instanceof ee||Ar(e)&&pe(e)}function Cr(e){return A(e?.lift)}function R(e){return function(t){if(Cr(t))return t.lift(function(r){try{return e(r,this)}catch(o){this.error(o)}});throw new TypeError("Unable to lift unknown Observable type")}}function D(e,t,r,o,i){return new _r(e,t,r,o,i)}var _r=(function(e){J(t,e);function t(r,o,i,n,s,a){var c=e.call(this,r)||this;return c.onFinalize=s,c.shouldUnsubscribe=a,c._next=o?function(f){try{o(f)}catch(p){r.error(p)}}:e.prototype._next,c._error=n?function(f){try{n(f)}catch(p){r.error(p)}finally{this.unsubscribe()}}:e.prototype._error,c._complete=i?function(){try{i()}catch(f){r.error(f)}finally{this.unsubscribe()}}:e.prototype._complete,c}return t.prototype.unsubscribe=function(){var r;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var o=this.closed;e.prototype.unsubscribe.call(this),!o&&((r=this.onFinalize)===null||r===void 0||r.call(this))}},t})(ee);var de=(function(e){return e&&typeof e.length=="number"&&typeof e!="function"});function he(e){return A(e?.then)}function xe(e){return A(e[K])}function ye(e){return Symbol.asyncIterator&&A(e?.[Symbol.asyncIterator])}function ge(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 Er(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Se=Er();function be(e){return A(e?.[Se])}function ve(e){return wt(this,arguments,function(){var r,o,i,n;return ae(this,function(s){switch(s.label){case 0:r=e.getReader(),s.label=1;case 1:s.trys.push([1,,9,10]),s.label=2;case 2:return[4,W(r.read())];case 3:return o=s.sent(),i=o.value,n=o.done,n?[4,W(void 0)]:[3,5];case 4:return[2,s.sent()];case 5:return[4,W(i)];case 6:return[4,s.sent()];case 7:return s.sent(),[3,2];case 8:return[3,10];case 9:return r.releaseLock(),[7];case 10:return[2]}})})}function Ae(e){return A(e?.getReader)}function k(e){if(e instanceof T)return e;if(e!=null){if(xe(e))return wr(e);if(de(e))return Mr(e);if(he(e))return Tr(e);if(ye(e))return Gt(e);if(be(e))return Or(e);if(Ae(e))return Rr(e)}throw ge(e)}function wr(e){return new T(function(t){var r=e[K]();if(A(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function Mr(e){return new T(function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()})}function Tr(e){return new T(function(t){e.then(function(r){t.closed||(t.next(r),t.complete())},function(r){return t.error(r)}).then(null,le)})}function Or(e){return new T(function(t){var r,o;try{for(var i=U(e),n=i.next();!n.done;n=i.next()){var s=n.value;if(t.next(s),t.closed)return}}catch(a){r={error:a}}finally{try{n&&!n.done&&(o=i.return)&&o.call(i)}finally{if(r)throw r.error}}t.complete()})}function Gt(e){return new T(function(t){Lr(e,t).catch(function(r){return t.error(r)})})}function Rr(e){return Gt(ve(e))}function Lr(e,t){var r,o,i,n;return Et(this,void 0,void 0,function(){var s,a;return ae(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),r=Mt(e),c.label=1;case 1:return[4,r.next()];case 2:if(o=c.sent(),!!o.done)return[3,4];if(s=o.value,t.next(s),t.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=c.sent(),i={error:a},[3,11];case 6:return c.trys.push([6,,9,10]),o&&!o.done&&(n=r.return)?[4,n.call(r)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})}function L(e,t,r,o,i){o===void 0&&(o=0),i===void 0&&(i=!1);var n=t.schedule(function(){r(),i?e.add(this.schedule(null,o)):this.unsubscribe()},o);if(e.add(n),!i)return n}function Ie(e,t){return t===void 0&&(t=0),R(function(r,o){r.subscribe(D(o,function(i){return L(o,e,function(){return o.next(i)},t)},function(){return L(o,e,function(){return o.complete()},t)},function(i){return L(o,e,function(){return o.error(i)},t)}))})}function Ce(e,t){return t===void 0&&(t=0),R(function(r,o){o.add(e.schedule(function(){return r.subscribe(o)},t))})}function Bt(e,t){return k(e).pipe(Ce(t),Ie(t))}function jt(e,t){return k(e).pipe(Ce(t),Ie(t))}function Ut(e,t){return new T(function(r){var o=0;return t.schedule(function(){o===e.length?r.complete():(r.next(e[o++]),r.closed||this.schedule())})})}function Wt(e,t){return new T(function(r){var o;return L(r,t,function(){o=e[Se](),L(r,t,function(){var i,n,s;try{i=o.next(),n=i.value,s=i.done}catch(a){r.error(a);return}s?r.complete():r.next(n)},0,!0)}),function(){return A(o?.return)&&o.return()}})}function _e(e,t){if(!e)throw new Error("Iterable cannot be null");return new T(function(r){L(r,t,function(){var o=e[Symbol.asyncIterator]();L(r,t,function(){o.next().then(function(i){i.done?r.complete():r.next(i.value)})},0,!0)})})}function $t(e,t){return _e(ve(e),t)}function Ht(e,t){if(e!=null){if(xe(e))return Bt(e,t);if(de(e))return Ut(e,t);if(he(e))return jt(e,t);if(ye(e))return _e(e,t);if(be(e))return Wt(e,t);if(Ae(e))return $t(e,t)}throw ge(e)}function ze(e,t){return t?Ht(e,t):k(e)}function te(e,t){return R(function(r,o){var i=0;r.subscribe(D(o,function(n){o.next(e.call(t,n,i++))}))})}function Yt(e,t,r,o,i,n,s,a){var c=[],f=0,p=0,l=!1,m=function(){l&&!c.length&&!f&&t.complete()},u=function(x){return f<o?h(x):c.push(x)},h=function(x){n&&t.next(x),f++;var y=!1;k(r(x,p++)).subscribe(D(t,function(S){i?.(S),n?u(S):t.next(S)},function(){y=!0},void 0,function(){if(y)try{f--;for(var S=function(){var b=c.shift();s?L(t,s,function(){return h(b)}):h(b)};c.length&&f<o;)S();m()}catch(b){t.error(b)}}))};return e.subscribe(D(t,u,function(){l=!0,m()})),function(){a?.()}}function X(e,t,r){return r===void 0&&(r=1/0),A(t)?X(function(o,i){return te(function(n,s){return t(o,n,i,s)})(k(e(o,i)))},r):(typeof t=="number"&&(r=t),R(function(o,i){return Yt(o,i,e,r)}))}function zt(e,t,r,o,i){return function(n,s){var a=r,c=t,f=0;n.subscribe(D(s,function(p){var l=f++;c=a?e(c,p,l):(a=!0,p),o&&s.next(c)},i&&(function(){a&&s.next(c),s.complete()})))}}function Vt(e,t){return R(zt(e,t,arguments.length>=2,!1,!0))}var Nr=function(e,t){return e.push(t),e};function Ee(){return R(function(e,t){Vt(Nr,[])(e).subscribe(t)})}var Fr=397,Pr=387,kr=385;function Kt(e){return(1<<e&Fr)!==0}function Xt(e){return(1<<e&Pr)!==0}function Qt(e){return(1<<e&kr)!==0}function Ve(e,t,r,o,i,n,s){let a=i===-1?-1:1,c=t,f=i===-1?o:r,p=[],l=1/0,m=-1/0,u=1/0,h=-1/0,x=(y,S)=>{u=Math.min(u,y,S),h=Math.max(h,y,S)};for(let y=0;y<e.length;y++){let S=e[y],b=S>>>4,d=S&15,g=d===9,v=g||Kt(d)?b:0,I=g?e[++y]>>>4:Xt(d)?b:0,C=c+v,M=f+I*a,_=c,P=C;if(P>=n&&_<=s)if(v>0){let E=Math.max(_,n),B=Math.min(P,s);if(B>E)if(l=Math.min(l,E),m=Math.max(m,B),g){let st=I/b,at=B-E,ft=Math.round(at*st),ct=Math.round(f+(E-c)*st*a);p.push(at<<4|9,ft<<4|9),x(ct,ct+ft*a)}else p.push(B-E<<4|d),Qt(d)?x(f+(E-c)*a,f+(B-c)*a):x(f,f)}else I>0&&(g?p.push(S,e[y]):p.push(S),l=Math.min(l,c),m=Math.max(m,c),x(f,M));if(c=C,f=M,c>s)break}if(p.length!==0)return{start:l,end:m,mateStart:u,mateEnd:h,cigar:Uint32Array.from(p)}}function Dr(e){return e===1||e===2||e===3}function Ke(e,t,r,o,i,n){let s=i===-1?-1:1,a=[],c=t,f=i===-1?o:r,p,l=!1,m=()=>{p!==void 0&&l&&p.qHi>p.qLo&&a.push({start:p.qLo,end:p.qHi,mateStart:p.tLo,mateEnd:p.tHi,cigar:Uint32Array.from(p.ops)}),p=void 0,l=!1};for(let u=0;u<e.length;u++){let h=e[u],x=h>>>4,y=h&15,S=y===9,b=S?e[++u]:void 0,d=S||Kt(y)?x:0,g=b!==void 0?b>>>4:Xt(y)?x:0,v=f+g*s;Dr(y)&&x>=n?m():(d>0||g>0)&&(p===void 0&&(p={qLo:c,qHi:c,tLo:f,tHi:f,ops:[]}),p.qHi=c+d,p.tLo=Math.min(p.tLo,f,v),p.tHi=Math.max(p.tHi,f,v),p.ops.push(h),b!==void 0&&p.ops.push(b),l=l||S||Qt(y)),c+=d,f=v}return m(),a}function Zt(e){let t=e.get("CIGAR");return typeof t=="string"?t:void 0}function Jt(e){let t=e.get("coarseCigar");return typeof t=="string"?t:void 0}function Xe(e){let t=Zt(e),r=t===void 0?Jt(e):void 0;return t!==void 0?Be(t):r!==void 0?ke(r):void 0}var qr=["CIGAR","cs","coarseCigar","cg","cr"];function Gr(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 Br(e){let t=e.get("mate");return Gr(t)?t:void 0}function jr(e,t,r,o){let i=Math.max(e.start,o.start),n=Math.min(e.end,o.end),s=(t.end-t.start)/Math.max(e.end-e.start,1),a=p=>r===-1?t.end-(p-e.start)*s:t.start+(p-e.start)*s,c=Math.round(a(i)),f=Math.round(a(n));return n>i?{start:i,end:n,mateStart:Math.min(c,f),mateEnd:Math.max(c,f)}:void 0}function Ur(e,t,r,o,i){let n={start:e.get("start"),end:e.get("end")},s=e.get("strand")===-1?-1:1,a=n.start>=r.start&&n.end<=r.end,c=a&&o===void 0&&!i?void 0:Xe(e);if(c===void 0){let f=a?{...n,mateStart:t.start,mateEnd:t.end}:jr(n,t,s,r);return f===void 0?[]:[f]}else return(o===void 0?[{...n,mateStart:t.start,mateEnd:t.end,cigar:c}]:Ke(c,n.start,t.start,t.end,s,o)).flatMap(p=>{let l=Ve(p.cigar,p.start,p.mateStart,p.mateEnd,s,r.start,r.end);return l===void 0?[]:[l]})}function Wr(e,t,r,o,i,n){let s=`:${o.start}-${o.end}${i}`,a=e.toJSON(),c={...a,uniqueId:`${e.id()}${s}`,recordId:a.recordId??e.id(),start:r.start,end:r.end,mate:{...t,start:r.mateStart,end:r.mateEnd}};a.syntenyId!==void 0&&(c.syntenyId=`${String(a.syntenyId)}${s}`);for(let f of qr)delete c[f];return n&&r.cigar&&(c.alignmentOps=r.cigar),new j(c)}function er(e,t,r,o=!1){let i=Br(e);if(i===void 0||e.get("spansWindow"))return[e];{let n=Ur(e,i,t,r,o);return n.map((s,a)=>Wr(e,i,s,t,n.length>1?`/${a}`:"",o))}}var tr=class extends ut{constructor(){super(...arguments);this.recordsAreAlignments=!0}static{this.capabilities=["getFeatures","getRefNames"]}async hasDataForRefName(){return!0}getFeaturesInMultipleRegions(r,o={}){let{clipToRegion:i,splitAtGapBp:n,keepAlignment:s,...a}=o,c=i&&this.recordsAreAlignments,f=lt(a.statusCallback);return ze(r).pipe(X((p,l)=>this.getFeatures(p,{...a,statusCallback:f()}).pipe(X(m=>c?er(m,m.get("assemblyName")===p.assemblyName?p:{start:m.get("start"),end:m.get("end")},n,s):[m]),Ee(),te(m=>({index:l,features:m})))),Ee(),X(p=>p.sort((l,m)=>l.index-m.index).flatMap(l=>l.features)))}};function $r(e,t){let r=Math.max(1,t);return e>=10*r?Math.ceil(e/r):Math.max(11,Math.ceil(10*e/r))/10}function Hs(e,t){if(mt(e)&&e instanceof Error){let{fitsBp:r}=e;e.message=e.message.replace("to see the graph","to see lanes"),typeof r=="number"&&(e.message=e.message.replace(/^Zoom in to about [\d.,]*\d[KM]?bp/,`Zoom in about ${$r(t,r)}\xD7`))}return e}function Vs({target:e,query:t,strand:r,cigar:o,matches:i,columns:n}){let s=`${e.name}:${e.start}-${e.end}|${t.name}:${t.start}-${t.end}`;return new j({uniqueId:s,assemblyName:e.assemblyName,refName:e.refName,start:e.start,end:e.end,type:"match",strand:r==="-"?-1:1,CIGAR:o,syntenyId:s,identity:i/Math.max(n,1),numMatches:i,blockLen:n,mate:{refName:t.refName,start:t.start,end:t.end,assemblyName:t.assemblyName}})}function Xs(e,t){return 2*e+(t==="reverse"?1:0)}function q(e){return Math.floor(e/2)}function Qs(e){return e%2===0?"forward":"reverse"}function F(e){return e%2===1}function Zs(e){return e%2===0?e+1:e-1}function Js(e){return e==="left"?"right":"left"}function ea(e){return e==="forward"?"left":"right"}function ta(e){return e==="forward"?"right":"left"}function ra(e){return e==="left"?"forward":"reverse"}function oa(e){return e==="right"?"forward":"reverse"}function Hr(e,t){let r=q(e),o=q(t);return F(e)?o>r||o===r&&!F(t):o>=r}function na(e){return Yr(e[0],e[e.length-1])}function Yr(e,t){return e===void 0||t===void 0?!0:F(e)===F(t)?!F(e):Hr(e,t)}var zr=["","A","C","G","T","N"];function sa(e){let t=e[e.length-1];if(t===void 0)return 0;let r=t,o=0;for(let i=0;i<3&&r%6!==0;i++)r=Math.floor(r/6),o+=1;return 3*(e.length-1)+o}function aa(e){let t="";for(let r of e){let o=r;for(let i=0;i<3;i++){let n=zr[o%6];if(n==="")return t;o=Math.floor(o/6),t+=n}}return t}var Vr={A:"T",C:"G",G:"C",T:"A",N:"N"};function we(e){let t="";for(let r=e.length-1;r>=0;r--)t+=Vr[e[r]]??"N";return t}function Me(e,t){let r=0,o=e.length;for(;r<o;){let i=r+o>>1;e[i]<t?r=i+1:o=i}return r}var Te=class{ending;tree;constructor(t){this.ending=new Float64Array(t),this.tree=new Int32Array(t+1).fill(-1)}bestBefore(t){let r=-1;for(let o=t;o>0;o-=o&-o){let i=this.tree[o];i!==-1&&(r===-1||this.ending[i]>this.ending[r])&&(r=i)}return r}raise(t,r){this.ending[t]=r;for(let o=t+1;o<this.tree.length;o+=o&-o){let i=this.tree[o];(i===-1||r>this.ending[i])&&(this.tree[o]=t)}}},Qe=class{pairs=[];total=0;a;b;weight;occurrences=new Map;constructor(t,r,o){this.a=t,this.b=r,this.weight=o,r.forEach((i,n)=>{let s=this.occurrences.get(i);s?s.push(n):this.occurrences.set(i,[n])})}solve(t,r,o,i){let n=0;for(;t+n<r&&o+n<i&&this.a[t+n]===this.b[o+n];)this.match(t+n,o+n),n+=1;let s=0;for(;r-s>t+n&&i-s>o+n&&this.a[r-s-1]===this.b[i-s-1];)s+=1;this.solveMiddle(t+n,r-s,o+n,i-s);for(let a=s;a>0;a--)this.match(r-a,i-a)}match(t,r){this.pairs.push([t,r]),this.total+=this.weight(this.a[t])}solveMiddle(t,r,o,i){if(t===r||o===i)return;let n=this.matchCount(t,r,o,i);if(n===0)return;if(n<=r-t+(i-o)){this.chain(t,r,o,i,n);return}let s=t+r>>1,a=this.split(t,s,r,o,i);this.solve(t,s,o,a),this.solve(s,r,a,i)}matchCount(t,r,o,i){let n=0;for(let s=t;s<r;s++){let a=this.occurrences.get(this.a[s]);a&&(n+=Me(a,i)-Me(a,o))}return n}sweep(t,r,o,i,n,s,a){for(let c=t;c!==r;c+=o){let f=this.occurrences.get(this.a[c]);if(!f)continue;let p=this.weight(this.a[c]),l=Me(f,i),m=Me(f,n);for(let u=0;u<m-l;u++){let h=o===1?f[m-1-u]-i:n-1-f[l+u],x=s.bestBefore(h),y=(x===-1?0:s.ending[x])+p;if(y>s.ending[h]&&(s.raise(h,y),a)){let S=a.count++;a.row[S]=c,a.column[S]=h,a.previous[S]=x===-1?-1:a.endingMatch[x],a.endingMatch[h]=S}}}}chain(t,r,o,i,n){let s=new Te(i-o),a={row:new Int32Array(n),column:new Int32Array(n),previous:new Int32Array(n),endingMatch:new Int32Array(i-o),count:0};this.sweep(t,r,1,o,i,s,a);let c=s.bestBefore(i-o);if(c===-1)return;this.total+=s.ending[c];let f=[];for(let p=a.endingMatch[c];p!==-1;p=a.previous[p])f.push([a.row[p],o+a.column[p]]);for(let p=f.length-1;p>=0;p--)this.pairs.push(f[p])}frontier(t,r,o,i,n){let s=new Te(n-i);this.sweep(t,r,o,i,n,s);let a=new Float64Array(n-i+1);for(let c=0;c<n-i;c++)a[c+1]=Math.max(a[c],s.ending[c]);return a}split(t,r,o,i,n){let s=n-i,a=this.frontier(t,r,1,i,n),c=this.frontier(o-1,r-1,-1,i,n),f=0,p=-1;for(let l=0;l<=s;l++){let m=a[l]+c[s-l];m>p&&(p=m,f=l)}return i+f}};function ca(e,t,r){let o=new Qe(e,t,r);return o.solve(0,e.length,0,t.length),[o.pairs,o.total]}var Kr=100,et=4e6,Xr=5e3,O=15,Qr=64,Zr=8,fr=1,tt=-4,w=-6,G=-1,Q=-(2**30),Re=0,Ze=1,cr=2;function H(e,t,r){let o=e.at(-1);r>0&&(o?.[0]===t?o[1]+=r:e.push([t,r]))}function Oe(e,t,r){return e>=r&&e>=t?Re:r>=t?cr:Ze}function pr(e,t,r){let o=e.length,i=t.length,n=i+1,s=new Uint8Array((o+1)*n),a=new Int32Array(n).fill(Q),c=new Int32Array(n).fill(Q),f=new Int32Array(n).fill(Q);a[0]=0;for(let h=1;h<=i;h++)f[h]=w+(h-1)*G,s[h]=(h===1?Re:cr)<<4;for(let h=1;h<=o;h++){let x=new Int32Array(n).fill(Q),y=new Int32Array(n).fill(Q),S=new Int32Array(n).fill(Q);y[0]=w+(h-1)*G,s[h*n]=(h===1?Re:Ze)<<2;let b=e.charCodeAt(h-1);for(let d=1;d<=i;d++){let g=Oe(a[d-1],c[d-1],f[d-1]);x[d]=Math.max(a[d-1],c[d-1],f[d-1])+(b===t.charCodeAt(d-1)?fr:tt);let v=Oe(a[d]+w,c[d]+G,f[d]+w);y[d]=Math.max(a[d]+w,c[d]+G,f[d]+w);let I=Oe(x[d-1]+w,y[d-1]+w,S[d-1]+G);S[d]=Math.max(x[d-1]+w,y[d-1]+w,S[d-1]+G),s[h*n+d]=g|v<<2|I<<4}a=x,c=y,f=S}let p=[],l=o,m=i,u=Oe(a[i],c[i],f[i]);for(;l>0||m>0;){let h=s[l*n+m]>>2*u&3;u===Re?(p.push(e[l-1]===t[m-1]?"=":"X"),l-=1,m-=1):u===Ze?(p.push("I"),l-=1):(p.push("D"),m-=1),u=h}for(let h of p.reverse())H(r,h,1)}function Jr(e,t){let r=Math.abs(e-t);return(r===0?0:Math.min(-w-(r-1)*G,-w+10*Math.log2(r)))+(Math.min(e,t)>0?-tt:0)}function lr(e,t){let r=Math.abs(e-t);return r===0?0:.01*O*r+.5*Math.log2(r)}function rr(e,t,r){return{qs:e.qs+t,qe:e.qs+r,ts:e.flipped?e.te-r:e.ts+t,te:e.flipped?e.te-t:e.ts+r,flipped:e.flipped}}function eo(e,t,r){let o=e.qe-e.qs,i=[];for(let[a,c]of t){let f=Math.max(0,a-e.qs),p=Math.min(o,c-e.qs);f<p&&i.push([f,p])}for(let[a,c]of r){let f=Math.max(0,e.flipped?e.te-c:a-e.ts),p=Math.min(o,e.flipped?e.te-a:c-e.ts);f<p&&i.push([f,p])}if(i.length===0)return[e];i.sort((a,c)=>a[0]-c[0]);let n=[],s=0;for(let[a,c]of i)a-s>=O&&n.push(rr(e,s,a)),s=Math.max(s,c);return o-s>=O&&n.push(rr(e,s,o)),n}function rt(e,t,r,o,i=1/0){let n=[],s={query:[],target:[]},a={forward:{query:[],target:[]},flipped:{query:[],target:[]}},c=[...e].sort((f,p)=>f.qs-p.qs||f.ts-p.ts);for(;c.length>0&&n.length<i;){let f=c.map(d=>d.qe-d.qs),p=new Int32Array(c.length).fill(-1),l=new Int32Array(c.length);for(let d=0;d<c.length;d++){let g=c[d],v=g.qe-g.qs;for(let I=d-1;I>=Math.max(0,d-Xr);I--){if(f[I]+v<=f[d])continue;let C=c[I];if(C.flipped===g.flipped&&C.qs<g.qs&&(g.flipped?g.te<C.te:C.ts<g.ts)){let _=Math.max(0,C.qe-g.qs,g.flipped?g.te-C.ts:C.te-g.ts),P=g.qs+_-C.qe,E=g.flipped?C.ts-(g.te-_):g.ts+_-C.te;if(_<v&&P<=t&&E<=t){let B=f[I]+v-_-o(P,E);B>f[d]&&(f[d]=B,p[d]=I,l[d]=_)}}}}let m=new Int32Array(c.length),u=-1;for(let d=0;d<c.length;d++){let g=c[d];m[d]=(m[p[d]]??0)+g.qe-g.qs-l[d],m[d]>=r&&(u<0||f[d]>f[u])&&(u=d)}if(u<0)break;let h=[];for(let d=u;d>=0;d=p[d])h.push({run:c[d],trim:l[d]});h.reverse(),n.push(h);let x=h[0],y=h.at(-1),{flipped:S}=x.run,b=S?a.flipped:a.forward;b.query.push([x.run.qs+x.trim,y.run.qe]),b.target.push(S?[y.run.ts,x.run.te-x.trim]:[x.run.ts+x.trim,y.run.te]);for(let{run:d,trim:g}of h)s.query.push([d.qs+g,d.qe]),s.target.push(d.flipped?[d.ts,d.te-g]:[d.ts+g,d.te]);c=c.flatMap(d=>{let g=d.flipped?a.flipped:a.forward;return eo(d,[...s.query,...g.query],[...s.target,...g.target])}).sort((d,g)=>d.qs-g.qs||d.ts-g.ts)}return n}function Je(e,t){let r=new Map;for(let n=0;n+O<=t.length;n++){let s=t.slice(n,n+O),a=r.get(s);a?a.push(n):r.set(s,[n])}let o=[],i=new Map;for(let n=0;n+O<=e.length;n++){let s=r.get(e.slice(n,n+O));if(s&&s.length<=Qr)for(let a of s){let c=a-n,f=i.get(c);if(f&&n<=f.qe)f.qe=n+O,f.te=a+O;else{let p={qs:n,qe:n+O,ts:a,te:a+O,flipped:!1};i.set(c,p),o.push(p)}}}return o}function to(e,t){return[...Je(e,t),...Je(e,we(t)).map(r=>({...r,ts:t.length-r.te,te:t.length-r.ts,flipped:!0}))]}function Le(e,t,r,o,i){let n;for(let{run:s,trim:a}of e){let c=s.qs+a;if(n){let f=s.flipped?s.te-a:n.te,p=s.flipped?n.ts:s.ts+a,l=r.slice(f,p);i(t.slice(n.qe,c),s.flipped?we(l):l,o,n.qe,f)}H(o,"=",s.qe-c),n=s}}function ot(e,t,r){H(r,"I",e.length),H(r,"D",t.length)}function ur(e,t,r){e.length*t.length<=et?pr(e,t,r):ot(e,t,r)}function nt(e,t,r,o=0){let[i]=e.length*t.length>et&&o<Zr?rt(Je(e,t),1/0,O,lr,1):[];if(!i){ur(e,t,r);return}let n=(c,f,p)=>{nt(c,f,p,o+1)},s=i[0].run,a=i.at(-1).run;n(e.slice(0,s.qs),t.slice(0,s.ts),r),Le(i,e,t,r,n),n(e.slice(a.qe),t.slice(a.te),r)}function ro(e,t,r){nt(e,t,r)}function oo(e,t,r){let o=[];Le(e,t,r,o,ro);let i=e[0],n=e.at(-1),{flipped:s}=i.run;return{queryStart:i.run.qs+i.trim,queryEnd:n.run.qe,targetStart:s?n.run.ts:i.run.ts+i.trim,targetEnd:s?i.run.te-i.trim:n.run.te,strand:s?"-":"+",edits:s?o.reverse():o,sharedBases:0}}function no(e,t,r,o){let i=[];if(e.length*t.length<=et)pr(e,t,r);else{let n=rt(to(e,t),1/0,Math.max(o,O),lr),s=n.find(a=>!a[0].run.flipped);if(i=n.filter(a=>a[0].run.flipped).map(a=>oo(a,e,t)),s){let a=(p,l,m,u,h)=>{i.some(y=>u<y.queryEnd&&y.queryStart<u+p.length||h<y.targetEnd&&y.targetStart<h+l.length)?ur(p,l,m):nt(p,l,m)},c=s[0].run,f=s.at(-1).run;a(e.slice(0,c.qs),t.slice(0,c.ts),r,0,0),Le(s,e,t,r,a),a(e.slice(f.qe),t.slice(f.te),r,f.qe,f.te)}else ot(e,t,r)}return i}function it(e,t){let r=e.strand==="-",o=0,i=0;for(let[n,s]of e.edits)t(n,s,r?e.queryEnd-1-o:e.queryStart+o,e.targetStart+i),n!=="D"&&(o+=s),n!=="I"&&(i+=s)}function or(e,t,r,o){let i=t==="query"&&e.strand==="-"?-1:1,n=0;return it(e,(s,a,c,f)=>{let p=t==="query"?c:f,l=m=>{let u=p+i*m;return u>=r&&u<o};if(s==="="||s==="X")for(let m=0;m<a;m++)l(m)&&(n+=s==="="?fr:tt);else if(s==="I"==(t==="query"))for(let m=0;m<a;m++)l(m)&&(n+=m===0?w:G);else l(0)&&(n+=w+(a-1)*G)}),n}function nr(e,t){return t==="query"?[e.queryStart,e.queryEnd]:[e.targetStart,e.targetEnd]}function io(e,t){let r=e.strand==="-",o=[],i=0,n=0,s=0,a=0,c=new Uint8Array(e.queryEnd-e.queryStart);for(let[u,h]of e.shared)c.fill(1,u-e.queryStart,h-e.queryStart);let f=u=>c[u-e.queryStart]===1,p=()=>{H(o,"I",i),H(o,"D",n),i=0,n=0};it(e,(u,h,x)=>{if(u==="I")i+=h;else if(u==="D")n+=h;else{for(let y=0;y<h;y++)t[s+y]?(i+=1,n+=1,f(r?x-y:x+y)&&(a+=1)):((i>0||n>0)&&p(),H(o,u,1));s+=h}}),p();let l={I:0,D:0};for(;o[0]?.[0]==="I"||o[0]?.[0]==="D";){let[u,h]=o.shift();l[u]+=h}let m={I:0,D:0};for(;o.at(-1)?.[0]==="I"||o.at(-1)?.[0]==="D";){let[u,h]=o.pop();m[u]+=h}return o.length===0?void 0:{...e,queryStart:e.queryStart+(r?m.I:l.I),queryEnd:e.queryEnd-(r?l.I:m.I),targetStart:e.targetStart+l.D,targetEnd:e.targetEnd-m.D,edits:o,sharedBases:e.sharedBases-a}}function so(e,t,r,o){let i={query:new Uint8Array(t),target:new Uint8Array(r)},n=e.map(f=>{let p=[];it(f,(l,m,u,h)=>{if(l==="="||l==="X")for(let x=0;x<m;x++)p.push([f.strand==="-"?u-x:u+x,h+x])});for(let[l,m]of p)i.query[l]=Math.min(255,i.query[l]+1),i.target[m]=Math.min(255,i.target[m]+1);return p}),s={query:new Map,target:new Map};n.forEach((f,p)=>{for(let[l,m]of f)for(let[u,h]of[["query",l],["target",m]])if(i[u][h]>1){let x=s[u].get(h);x?x.at(-1)!==p&&x.push(p):s[u].set(h,[p])}});let a=new Map,c=(f,p,l)=>{let m=`${l}:${f}:${p}`,u=a.get(m);if(u===void 0){let[h,x]=nr(e[f],l),[y,S]=nr(e[p],l),b=Math.max(h,y),d=Math.min(x,S),[g,v]=[e[f],e[p]];u=[or(v,l,b,d)-or(g,l,b,d),v.sharedBases-g.sharedBases,f-p].find(C=>C!==0)>0,a.set(m,u)}return u};return e.flatMap((f,p)=>{let l=n[p],m=new Uint8Array(l.length);if(l.forEach(([x,y],S)=>{for(let[b,d]of[["query",x],["target",y]])!m[S]&&s[b].get(d)?.some(g=>g!==p&&c(p,g,b))&&(m[S]=1)}),!m.includes(1))return[f];let u=io(f,m),h=u?.edits.reduce((x,[y,S])=>x+(y==="="?S:0),0)??0;return u&&h>=o?[u]:[]})}function ir(e,t){return e.map(r=>{let o=t(q(r));return F(r)?we(o):o}).join("")}function sr(e,t){let r=[0];for(let o of e)r.push(r.at(-1)+t(q(o)).length);return r}function ar(e){let t=new Map,r=new Map;e.forEach((s,a)=>{let c=q(s);t.has(c)?r.set(c,a):t.set(c,a)});let o=new Int32Array(e.length+1);for(let[s,a]of r)o[t.get(s)]+=1,o[a+1]-=1;let i=new Uint8Array(e.length),n=0;for(let s=0;s<e.length;s++)n+=o[s],i[s]=n>0?1:0;return i}function ao(e,t,r,o){let i=ar(e),n=ar(t),s=new Map;t.forEach((l,m)=>{n[m]||s.set(q(l),[m])});let a=2*t.length,c=(l,m,u)=>l*a+2*m+(u?1:0),f=new Set;e.forEach((l,m)=>{for(let u of i[m]?[]:s.get(q(l))??[])f.add(c(m,u,F(l)!==F(t[u])))});let p=[];return e.forEach((l,m)=>{for(let u of i[m]?[]:s.get(q(l))??[]){let h=F(l)!==F(t[u]),x=h?-1:1,y=u-x;if(!(m>0&&y>=0&&y<t.length&&f.has(c(m-1,y,h)))){let b=m,d=u;for(;b<e.length&&d>=0&&d<t.length&&f.has(c(b,d,h));)b+=1,d+=x;let g=d-x;p.push({qs:r[m],qe:r[b],ts:o[Math.min(u,g)],te:o[Math.max(u,g)+1],flipped:h})}}}),p}function ma(e){let{query:t,target:r,sequenceOf:o}=e,i=ir(t,o),n=ir(r,o),s=ao(t,r,sr(t,o),sr(r,o)),a=e.minMatch??Kr,c=e.bases??!0,f=[];for(let p of rt(s,e.maxGap??1/0,a,Jr)){let l=[],m=p[0],u=p.at(-1),{flipped:h}=m.run;Le(p,i,n,l,c?(y,S,b,d,g)=>{for(let v of no(y,S,b,a)){let I=g+S.length;f.push({...v,queryStart:d+v.queryStart,queryEnd:d+v.queryEnd,targetStart:h?I-v.targetEnd:g+v.targetStart,targetEnd:h?I-v.targetStart:g+v.targetEnd,strand:h?"+":"-",edits:h?v.edits.reverse():v.edits,shared:[]})}}:ot),f.push({queryStart:m.run.qs+m.trim,queryEnd:u.run.qe,targetStart:h?u.run.ts:m.run.ts+m.trim,targetEnd:h?m.run.te-m.trim:u.run.te,strand:h?"-":"+",edits:h?l.reverse():l,sharedBases:p.reduce((y,{run:S,trim:b})=>y+S.qe-S.qs-b,0),shared:p.map(({run:y,trim:S})=>[y.qs+S,y.qe])})}return so(f,i.length,n.length,a).map(({shared:p,...l})=>l).sort((p,l)=>p.queryStart-l.queryStart)}function da(e){return e.map(([t,r])=>`${r}${t}`).join("")}export{Xs as a,q as b,Qs as c,F as d,Zs as e,Js as f,ea as g,ta as h,ra as i,oa as j,Hr as k,na as l,Yr as m,sa as n,aa as o,ca as p,ma as q,da as r,j as s,tr as t,Hs as u,Vs as v};
4
- //# sourceMappingURL=chunk-5FMNLEED.js.map
4
+ //# sourceMappingURL=chunk-IWZ4JPV3.js.map
@@ -1,2 +1,2 @@
1
- import{a as W,b as ut}from"./chunk-OIGMGVI6.js";import{A as It,B as Gt,C as te,D as Tt,F as fe,G as Ht,a as dt,b as ft,c as ht,d as mt,f as gt,g as yt,h as B,i as vt,j as bt,k as wt,m as St,n as xt,o as de,p as kt,q as Pt,r as Mt,s as Rt,t as Ct,v as ee,x as Lt,z as Et}from"./chunk-JJ2TPWSH.js";import{$ as ct,E as qe,F as et,H as tt,I as nt,J as rt,K as ot,L as at,M as it,_ as lt,a as P,c as Xe,ca as ue,ea as pt,f as Ze,g as $e,p as Y,q as je,r as Ke,s as Ue}from"./chunk-4MTS65XF.js";import{q as O}from"./chunk-OP2PTYDR.js";import{Ba as pe,Gb as Q,Ha as J,J as ce,La as Fe,Na as Ve,Ob as Je,Pb as Qe,S as We,Ya as Ye,Yb as _,Z as Be,a as F,b as ke,bd as st,d as Pe,ea as De}from"./chunk-TP6OXTXD.js";import{x as Oe}from"./chunk-JWIFJIPZ.js";import{M as se,Q as le}from"./chunk-4RZCYOCW.js";import{c as Se}from"./chunk-LRBNBP2K.js";import{w as we}from"./chunk-RQSCKHNS.js";import{d as E}from"./chunk-WKD7ALOU.js";import{C as xe}from"./chunk-TDHUAADJ.js";import{j as K}from"./chunk-5L276I7O.js";import{a as _e,e as G,f as ze,g as Ne,h as C,i as L}from"./chunk-J2PN6CG3.js";import{A as He,E as Ae,H as q,I as V,b as Me,c as Re,e as ie,k as Ce,o as Le,p as Ee,t as Ie,w as U,x as Ge,z as Te}from"./chunk-H42TSPVA.js";import{a as M,b as n,c as h,d}from"./chunk-DUU6T2I5.js";function At(t){return Promise.resolve(new _(t))}var z=JBrowseExports["@jbrowse/render-core/useRenderingBackend"],Mn=t=>z!=null&&t in Object(z)?z[t]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+t+"' from '@jbrowse/render-core/useRenderingBackend' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:t});var _t=Mn("useRenderingBackend"),Tr=z&&z.__esModule?z.default:z;var he=ft(1),zt=d(function({model:e}){let[r,i]=L(null);return G(()=>{if(!r)return;let a=new _(r),c=F(()=>{Ye(st()),a.resize(e.paneWidth,e.canvasHeight),e.paintHover(a,e.drawnBatch)});return()=>{c(),a.dispose()}},[r,e]),n("canvas",{ref:i,"data-testid":"graph-hover-layer",style:{...he,clipPath:e.drawingClip}})});var ne=d(function({row:e,at:r,hint:i,after:a,column:c}){let l=c===void 0?void 0:{paddingLeft:c+5};return e.swatch?h("div",{title:[e.title,i].filter(Boolean).join(" \xB7 ")||void 0,children:[h("div",{style:te,children:[n("span",{style:{display:"flex",flex:"none",justifyContent:"center",width:c},children:n(ee,{swatch:e.swatch})}),h("span",{children:[e.strong?n("strong",{children:e.strong}):null,e.label]}),e.sizer===void 0?null:h("span",{style:Rn,children:[n("span",{style:Cn,"aria-hidden":!0,"data-testid":"graph-key-sizer",children:de(e.sizer)}),n("span",{style:Ln,"data-testid":"graph-key-count",children:de(e.count)})]}),a]}),r?n("div",{style:l,"data-testid":"graph-walk-at",children:r}):e.under?n("div",{style:l,children:e.under}):null]}):n("div",{style:Tt,children:e.label})}),Rn={display:"grid"},Cn={gridArea:"1 / 1",visibility:"hidden"},Ln={gridArea:"1 / 1",width:0,minWidth:"100%",overflow:"hidden",textOverflow:"ellipsis"},En={pointerEvents:"auto",cursor:"pointer",border:"none",background:"none",padding:"0 2px",font:"inherit",textDecoration:"underline"},Nt=d(function({model:e,sections:r}){if(r.length===0)return null;let i=r.flatMap(l=>l.rows),a=xt(i),c=St(i);return n("div",{style:{...Gt,lineHeight:`${a}px`},children:r.map(({testid:l,rows:p,heading:s,spaced:u},m)=>h(_e,{children:[s?n("div",{style:{...Ht,paddingTop:m===0?0:fe},children:s}):null,n("div",{"data-testid":l,style:u?{paddingTop:fe}:void 0,children:p.map(g=>n(ne,{row:g,column:c,at:g.walk?e.hoveredOn(g.walk):void 0,after:g.closesBubble?n("button",{type:"button",style:En,"data-testid":"graph-close-bubble",onClick:()=>{e.closeBubbles()},children:"close"}):null},g.key))})]},l))})});var In={position:"absolute",left:0,top:0,zIndex:4,display:"grid",gap:Je,lineHeight:"normal"},Gn={height:Qe,padding:"2px 6px",boxSizing:"border-box",fontFamily:"inherit",fontSize:11,color:"inherit",cursor:"pointer",border:"none",background:"none",textAlign:"left",display:"block"},Tn={position:"relative"},Hn={gridColumn:"1 / -1",height:ct,padding:"2px 6px",boxSizing:"border-box",display:"flex",gap:14,fontSize:11,lineHeight:"15px"},An=d(function({model:e,lift:r,index:i,width:a,height:c,cell:l,handlers:p,canvasStyle:s}){let[u,m]=L(null),[g,S]=L(null),I=r.walks[0];G(()=>{if(!u||!g)return;let A=new _(u),N=new _(g),$=ke(()=>e.facetDrawings?.[i]),D,X=[F(()=>{let R=e.facetGrid;R&&A.resize(R.width,R.height);let T=$.get();T&&(T!==D&&(A.uploadGeometry(T.batch),D=T),e.applySelection(A),e.paint(A))}),F(()=>{let R=e.facetGrid;R&&N.resize(R.width,R.height);let T=$.get();T&&e.paintHover(N,T.batch)})];return()=>{for(let R of X)R();A.dispose(),N.dispose()}},[u,g,e,i]);let H=e.walkLabel(I.name);return h("div",{style:l,children:[n("button",{type:"button",style:Gn,"data-testid":"graph-facet-title",onClick:()=>{e.liftWalks([I.name]),e.setFacet("")},children:n(ne,{row:Pt(e,I),hint:`click to lift ${H} alone`,at:e.hoveredOn(I)})}),h("div",{style:Tn,children:[n("canvas",{ref:m,"data-testid":"graph-facet-canvas",style:{...s,width:a,height:c,display:"block"},...p}),n("canvas",{ref:S,style:he})]})]})}),_n=d(function({model:e,handlers:r,canvasStyle:i}){let a=e.facetPanels,c=e.facetGrid,l=e.facetPlacement;if(!a||!c||!l)return null;let{columns:p,width:s,height:u}=c;return h("div",{"data-testid":"graph-facet-panels",style:{...In,width:e.paneWidth,minHeight:e.canvasHeight,gridTemplateColumns:`repeat(${p}, ${s}px)`,background:J},children:[a.map((m,g)=>n(An,{model:e,lift:m,index:g,width:s,height:u,cell:{gridRow:Math.floor(l.cells[g]/p)+1,gridColumn:l.cells[g]%p+1},handlers:r,canvasStyle:i},m.walks[0].name)),n("div",{style:{...Hn,gridRow:Math.floor(l.cells.reduce((m,g)=>Math.max(m,g),-1/0)/p)+2},"data-testid":"graph-facet-key",children:Mt(e).map(m=>n(ne,{row:m},m.key))})]})}),Ot=_n;var Wt=P(n("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 Bt=P([n("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"),n("path",{d:"M12 10h-2v2H9v-2H7V9h2V7h1v2h2z"},"1")],"ZoomIn");var Dt=P(n("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 zn=d(function({model:e}){let r=e.colorSchemeLock;return n(W,{label:"Color",size:"small",sx:{minWidth:100},disabled:r!==void 0,title:r?.why,shown:r?.value,value:e.chosenColorScheme,options:qe.map(({value:i})=>({value:i,label:e.colorSchemeLabel(i)})),testId:"graph-color-select",onChange:i=>{e.setColorScheme(i)}})}),Xt=zn;var Ft=O()(t=>({stats:{marginLeft:"auto"},perf:{color:t.palette.text.secondary,fontVariantNumeric:"tabular-nums"}}));function me(t){return t===void 0?"\u2013":`${Math.round(t)}ms`}var Nn=d(function({model:e}){let{classes:r}=Ft(),{lastFetchMs:i,lastLayoutMs:a,lastGeometryMs:c}=e,l=i!==void 0||a!==void 0||c!==void 0;return e.showPerf&&l?h(V,{variant:"caption",className:r.perf,"data-testid":"graph-perf-stats",children:["fetch ",me(i)," \xB7 layout ",me(a)," \xB7 geom"," ",me(c)]}):null}),On=d(function({model:e}){let{classes:r}=Ft();return h("div",{className:r.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:[h(V,{variant:"body2",component:"span",children:[e.nodeCount," nodes, ",e.edgeCount," edges",e.pathCount>0?`, ${e.pathCount} paths`:""]})," ",n(Nn,{model:e})]})}),Vt=On;var Wn=d(function({model:e}){let{graph:r}=e;return n(W,{label:"Layout",size:"small",sx:{minWidth:140},testId:"graph-layout-select",value:e.chosenLayoutMode,options:Xe.map(({value:i,label:a,description:c,available:l})=>({value:i,label:a,description:c,disabled:r?!l(r):!1})),onChange:i=>{e.switchLayout(i)}})}),Yt=Wn;var Bn=d(function({model:e}){return e.chosenLayoutMode!=="walkrows"||e.repeatChoices.length===0?null:n(W,{label:"Repeat",size:"small",sx:{minWidth:130,maxWidth:260},testId:"graph-repeat-select",value:e.selectedRepeat?.key??"",options:e.repeatOptions,onChange:r=>{e.setRepeatKey(r)}})}),Zt=Bn;var $t=P(n("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),"Close");var jt=P(n("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 Dn=d(function({model:e}){let r=e.highlightMenuItems({picks:!1});return n(Me,{size:"small",tooltip:"Graph options",menuItems:[...r.length>0?[{label:"Haplotypes",icon:Ze,subMenu:r}]:[],...e.layoutOptionMenuItems({repeat:!1}),{label:"Show",icon:et,subMenu:[...e.showMenuItems(),...e.modeDrawsNodes&&e.walkChoices.length>1?[{type:"checkbox",label:"Show walk rows under the graph",checked:e.walkStrip,onClick:()=>{e.setWalkStrip(!e.walkStrip)}}]:[],{type:"checkbox",label:"Show timings",checked:e.showPerf,onClick:()=>{e.setShowPerf(!e.showPerf)}}]},{type:"divider"},{label:"Graph settings...",icon:$e,helpText:"Subgraph node limit; node width and path colors; the force-directed layout engine",onClick:()=>{K(e).queueDialog(i=>[ut,{model:e,onClose:i}])}},{type:"divider"},{label:"Close graph",icon:$t,onClick:()=>{e.clearGraph()}}],children:n(jt,{})})}),Kt=Dn;var Xn=O()({formControl:{minWidth:130,maxWidth:260}}),Fn=d(function({model:e}){let{classes:r}=Xn(),i=ze(),{walkChoices:a}=e;if(a.length===0||!e.liftsWalks)return null;let c=new Set(a.map(s=>s.name)),l=new Map(a.map(s=>[s.name,s.label])),p=e.walkLayers.map(s=>s.walk).filter(s=>c.has(s));return a.length>Ve?n(Le,{size:"small",variant:"outlined",color:"inherit","data-testid":"graph-walk-choose",onClick:()=>{K(e).queueDialog(s=>[Fe,{model:e,onClose:s}])},children:p.length>0?`${p.length} of ${a.length} haplotypes`:"Highlight haplotypes..."}):h(Ie,{size:"small",className:r.formControl,children:[n(Ge,{id:i,children:"Highlight"}),n(Ae,{labelId:i,multiple:!0,value:p,label:"Highlight","data-testid":"graph-walk-select",renderValue:s=>s.map(u=>l.get(u)).join(", "),onChange:s=>{let{value:u}=s.target;e.liftAmongChoices(typeof u=="string"?u.split(","):u)},children:a.map(({name:s,label:u})=>h(He,{value:s,dense:!0,children:[n(Ee,{size:"small",checked:p.includes(s)}),n(Te,{primary:u})]},s))})]})}),Ut=Fn;var Vn=O()(t=>({toolbar:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:4,padding:"2px 4px",borderBottom:`1px solid ${t.palette.divider}`}})),Yn=d(function({model:e}){return n(V,{variant:"body2",children:e.zoomPercent})}),Zn=d(function({model:e}){let{classes:r}=Vn(),i=a=>{e.zoom(a,e.viewBox.width/2,e.viewBox.height/2)};return h("div",{className:r.toolbar,children:[n(Yt,{model:e}),n(Xt,{model:e}),n(Ut,{model:e}),n(Zt,{model:e}),n(q,{title:"Zoom in",children:n(U,{size:"small",onClick:()=>{i(1.5)},children:n(Bt,{})})}),n(q,{title:"Zoom out",children:n(U,{size:"small",onClick:()=>{i(1/1.5)},children:n(Dt,{})})}),n(q,{title:"Zoom to fit",children:n(U,{size:"small",onClick:()=>{e.refitView()},children:n(Wt,{})})}),n(Yn,{model:e}),n(Vt,{model:e}),n(Kt,{model:e})]})}),qt=Zn;var $n={position:"absolute",bottom:lt,lineHeight:"normal",background:"rgba(0,0,0,0.75)",color:"white",padding:"4px 8px",borderRadius:4,fontSize:12,pointerEvents:"none",zIndex:6};function ge({label:t,readout:e}){return h(M,{children:[n("strong",{children:t})," \u2014 ",e]})}function jn(t,e){if(e)return{testId:"graph-chip-tooltip",body:ge(e)};let r=t.hoveredNode?t.hoverNodeById?.get(t.hoveredNode):void 0;if(r){let l=Ke(r),p=t.hoverDrawing?.members.get(r.id),s=Ue(r),u=t.graphRegion,m=t.hoveredSpan,g=u&&m&&!we(r)?`${u.assemblyName} ${Y({refName:u.refName,...m})}`:void 0,S=ce(t.genePins,r.id),I=S.length>0?h(M,{children:[n("br",{}),n("em",{children:S.join(", ")})]}):null;return l?{body:h(M,{children:[l,I]})}:{body:h(M,{children:[n("strong",{children:r.name}),p?` and ${p.length-1} more`:""," \u2014"," ",r.length.toLocaleString()," bp, depth ",r.depth.toFixed(1),s?h(M,{children:[n("br",{}),s.sample," ",Y(s)," (rank ",r.stable?.rank,")"]}):null,g?h(M,{children:[n("br",{}),"Reference ",g]}):null,I,r.moved?h(M,{children:[n("br",{}),"End of a component too large to draw here"]}):null]})}}let i=t.hoveredEdge===null?void 0:t.graph?.edges[t.hoveredEdge];if(i){let l=je(i,t.deletions.find(s=>s.edgeIndex===t.hoveredEdge),s=>t.nodeById?.get(s)?.name??s),p=t.graph?Se(t.graph):void 0;return{body:l.deletion?h(M,{children:[`skips ${l.deletion.bp} of ${p??"the reference"} sequence`,n("br",{}),l.deletion.where]}):h(M,{children:["Edge: ",l.ends]})}}let a=t.hoveredWalkRowText;if(a)return{testId:"graph-walk-row-tooltip",body:ge(a)};let c=t.hoveredTubeText;return c?{testId:"graph-tube-tooltip",body:ge(c)}:void 0}var Kn=d(function({model:e,chip:r}){let i=jn(e,r);return i?n("div",{style:{...$n,right:e.tooltipRightPx},"data-testid":i.testId,children:i.body}):null}),Jt=Kn;var Qt=P(n("path",{d:"M10 18h4v-2h-4zM3 6v2h18V6zm3 7h12v-2H6z"}),"FilterList");var en=P(n("path",{d:"M10.83 8H21V6H8.83zm5 5H18v-2h-4.17zM14 16.83V18h-4v-2h3.17l-3-3H6v-2h2.17l-3-3H3V6h.17L1.39 4.22 2.8 2.81l18.38 18.38-1.41 1.41z"}),"FilterListOff");var tn=P(n("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 Un={x:0,y:0};function qn(t,e){let{own:r,reference:i,highlight:a}=t.nodeLaunchTargets(e);return[{label:"Node details",icon:tn,onClick:()=>{t.showNodeDetails(e)}},...pt({own:r,reference:i,highlight:a,onShowLinear:c=>{t.showInLinearView(c)},onHighlight:t.canHighlightInLinearView?c=>{t.highlightInLinearView(c)}:void 0})]}function Jn(t,e,r){let i=r??t.walkRowBars,a=t.walkRowLaunchTarget(e,i),c=a?.assembly,l=e>0?i?.rows[e-1]:void 0,p=l?.sample,s=t.abridged.find(g=>g.name===l?.name),u=!r&&t.walkRowBars,m=t.walkRowSamples;return[a&&c?{label:`Linear genome view \u2014 ${c} ${Y(a.location)}`,icon:ue,onClick:()=>{t.showInLinearView({location:a.location,assembly:c})}}:{label:"Linear genome view",icon:ue,disabled:!0,disabledHelpText:a?`No assembly in this session is ${a.location.haplotype??a.label}`:"This walk states no contig coordinates",onClick:()=>{}},...r&&l&&s?[{label:"Load its steps",subLabel:xe(s,l.label),onClick:()=>{t.expandWalk(l.name)}}]:[],...l&&t.liftsWalks&&t.modeDrawsNodes?[{type:"checkbox",label:`Highlight ${l.label}`,checked:t.walkLayers.some(g=>g.walk===l.name),onClick:()=>{t.toggleWalk(l.name)}}]:[],...u&&p&&!(m?.length===1&&m[0]===p)?[{label:`Show only ${p}`,icon:Qt,onClick:()=>{t.setWalkRowSamples([p])}}]:[],...u&&m?[{label:"Show every sample",icon:en,onClick:()=>{t.setWalkRowSamples(void 0)}}]:[]]}var re=d(function({model:e,at:r,onClose:i}){return n(Re,{anchor:r,offset:Un,onClose:i,menuItems:()=>r===void 0?[]:"nodeId"in r?qn(e,r.nodeId):Jn(e,r.row,r.bars)})});var Qn=d(function({model:e}){return n(M,{children:e.passBars.map(r=>n("svg",{"data-testid":"graph-pass-bar",width:e.paneWidth,height:at,style:{display:"block",borderTop:"1px solid #ddd"},children:n(B,{el:it(r,e.walkLabel(r.walk),e.paneWidth)})},r.walk))})}),nn=Qn;var er={display:"flex",flexWrap:"wrap",gap:"2px 14px",padding:"2px 8px 6px",fontSize:11,color:"#333"},tr={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},nr=d(function({bars:e,frame:r,ramp:i,rowGenes:a,inks:c}){let l=yt(),p=Ne(()=>De(e,r,{ramp:i,rowGenes:a,idPrefix:l,markUnloaded:!0,inks:c}),[e,r,i,a,l,c]);return n(B,{el:p})}),rr=d(function({model:e}){let r=e.walkStripRows,i=e.walkStripFrame,a=e.stripHover,c=r?[r.reference,...r.rows]:[],l=a?c.findIndex(g=>g.name===a.row):-1,p=c[l],s=r&&i&&p?We(r,l,i):void 0;if(!r||!i||!a||!p||!s||i.labelled&&!s.cut)return null;let u=(r.origin+a.offset)*i.scaleX+i.translateX,m=u>i.width/2?{right:i.width-u+12}:{left:u+12};return h("div",{"data-testid":"graph-walk-strip-tip",style:{...tr,...m,top:l*i.rowPx+i.translateY-18},children:[p.label," \xB7 ",s.text]})}),or=d(function({model:e,bars:r,frame:i}){return n(B,{el:nt(r,i,e.walkStripMarks)})}),ar=d(function({model:e}){let r=e.walkStripRows,i=e.walkStripFrame,[a,c]=L();if(!r||!i)return null;let l=s=>{let u=s.currentTarget.getBoundingClientRect();return tt(r,i,s.clientX-u.left,s.clientY-u.top)},p=Be(r,{ramp:e.referenceRampDomain,rampCss:Oe,genes:ot(i,e.walkRowGenes,e.walkRowGeneGaps),annotation:e.walkRowAnnotation,markUnloaded:!0,inks:e.walkStripInks});return h("div",{"data-testid":"graph-walk-strip",style:{position:"relative",borderTop:"1px solid #ddd"},onMouseEnter:()=>{e.setPointerInPane(!0)},onMouseLeave:()=>{E(e)&&(e.setPointerInPane(!1),e.setStripHover(null))},children:[h("svg",{width:i.width,height:i.height,style:{display:"block"},onMouseLeave:()=>{E(e)&&e.setStripHover(null)},onMouseMove:s=>{let u=l(s);s.currentTarget.style.cursor=u&&u.index>0?"pointer":"",e.setStripHover(u?{row:u.row.name,offset:u.offset}:null)},onClick:s=>{let u=l(s);u&&u.index>0&&e.toggleWalk(u.row.name)},onContextMenu:s=>{let u=l(s);u&&(s.preventDefault(),c({clientX:s.clientX,clientY:s.clientY,row:u.index}))},children:[n(nr,{bars:r,frame:i,ramp:e.referenceRampDomain,rowGenes:e.walkRowGenes,inks:e.walkStripInks}),n(or,{model:e,bars:r,frame:i}),n(B,{el:rt(r,i,new Set(e.walkLayers.map(s=>s.walk)))})]}),n(rr,{model:e}),h("div",{style:er,"data-testid":"graph-walk-strip-key",children:[p.map(s=>h("div",{style:te,children:[n(ee,{swatch:kt(s.swatch)}),n("span",{children:s.label})]},s.label)),n("span",{style:{color:"#777"},children:"Ticks mark where each walk passes the node under the pointer; click a haplotype's bar to lift its walk"})]}),n(re,{model:e,at:a&&{...a,bars:r},onClose:()=>{c(void 0)}})]})}),rn=ar;var ir=d(function({model:e}){let r=e.walkStripLocator;return r?h(ht,{model:e,zIndex:4,overflow:"visible",testId:"graph-walk-strip-locator",children:[n("circle",{cx:r.x,cy:r.y,r:11,fill:"none",stroke:"white",strokeWidth:4}),n("circle",{cx:r.x,cy:r.y,r:11,fill:"none",stroke:"#111",strokeWidth:1.75})]}):null}),on=ir;var sr=1.1,lr=100,cr=40,pr=800,ur=10,an=2;function ye(t){let e=t.deltaY*(t.deltaMode===1?cr:t.deltaMode===2?pr:1),r=(t.ctrlKey?ur:1)*e/lr;return sr**-Math.max(-an,Math.min(an,r))}var dr=40,fr=100,hr=24,sn=Math.log(16);function mr(t,e){let r=t*Math.exp(-Math.max(0,e)/hr);return Math.abs(r)<.001?t:t-r}function gr(t,e){let r=Math.abs(t.deltaX)>Math.abs(t.deltaY);return t.ctrlKey||t.metaKey||!r&&(!e||e.scrollZoom)?"zoom":r?"pan":"page"}function pn(t,e,r){G(()=>{if(!t)return;let i=-1/0,a={backlog:0,x:0,y:0,frame:0,last:0},c=p=>{let s=mr(a.backlog,Math.min(100,p-a.last));a.backlog-=s,a.last=p,a.frame=a.backlog?requestAnimationFrame(c):0,E(r)&&r.zoom(Math.exp(s),a.x,a.y)},l=p=>{if(r.hostPlacesX||r.followsHostView)return;let m=((p.target instanceof Element?p.target.closest("canvas"):null)??(r.facetPanels?null:e))?.getBoundingClientRect();if(m&&p.clientY-m.top<r.referenceStripZonePx)return;let g=gr(p,r.host);if(g!=="page"){if(r.host&&p.stopPropagation(),p.preventDefault(),g==="pan"){if(p.timeStamp-i>fr){let S=p.deltaMode===1?dr:1;r.setTransform(r.scale,r.translateX-p.deltaX*S,r.translateY)}return}i=p.timeStamp,m&&(a.x=p.clientX-m.left,a.y=p.clientY-m.top,a.backlog=Math.max(-sn,Math.min(sn,a.backlog+Math.log(ye(p)))),a.frame||(a.last=performance.now()-1e3/60,a.frame=requestAnimationFrame(c)))}};return t.addEventListener("wheel",l,{passive:!1}),()=>{cancelAnimationFrame(a.frame),t.removeEventListener("wheel",l)}},[t,e,r])}var ln=3,ve="data-gesture-owner",Z=t=>({x:t.clientX,y:t.clientY});function cn(t){let[e,r]=[...t.values()];return{spread:Math.hypot(e.x-r.x,e.y-r.y),mid:{x:(e.x+r.x)/2,y:(e.y+r.y)/2}}}function un(t){let e=C({x:0,y:0}),r=C({x:0,y:0}),i=C(!1),a=C(void 0),c=o=>a.current!==void 0&&o.pointerId!==a.current,l=C(new Map),p=C(null),s=C(null),u=C(!1),m=C(null),g=C(!1),S=C({frame:0,pan:null,hover:null,pinch:!1});G(()=>()=>{cancelAnimationFrame(S.current.frame)},[]);let[I,H]=L(),[A,N]=L(!1),[$,D]=L(void 0);function X(o){let f=o.currentTarget.getBoundingClientRect();return{x:o.clientX-f.left,y:o.clientY-f.top}}function R(o,f){if(t.layoutResult?.tubeMap)return t.tubeMapNodeAt(o,f);let y=t.referenceStripNodeAt(o,f);if(y)return y;let{nodePositions:v}=t;if(!v)return null;let{x:b,y:w}=pe(o,f,t,t.axisScale);return se(v,b,w,t.axisScale,t.positionsVersion,t.nodeInk,t.drawnFold)}function T(o,f){let{nodePositions:y,graph:v}=t;if(!y||!v)return null;let{x:b,y:w}=pe(o,f,t,t.axisScale);return le(y,v,b,w,t.axisScale,t.effectiveDrawPaths&&!t.facetPanels,t.positionsVersion,t.deletionEdgeIndexes,t.hiddenEdgeIndexes,t.deletionRoutes,t.layoutResult?.stranded,t.drawnFold)}function fn(o){o.button===0&&o.preventDefault()}function hn(o){if(o.button!==0)return;let f=l.current;if(c(o)){t.isPanning&&!g.current&&o.pointerType==="touch"&&f.size===1&&(o.currentTarget.setPointerCapture(o.pointerId),f.set(o.pointerId,Z(o)),s.current=cn(f),i.current=!0);return}i.current=!1,r.current={x:o.clientX,y:o.clientY},o.currentTarget.removeAttribute(ve);let y=t.followsHostView,{x:v,y:b}=X(o),w=b<t.referenceStripZonePx,k=t.hostPlacesX||t.layoutResult?.tubeMap||w?null:R(v,b);t.hostPlacesX||y&&o.shiftKey||t.followsWindow&&!k||(o.currentTarget.setPointerCapture(o.pointerId),a.current=o.pointerId,p.current=o.currentTarget,f.clear(),f.set(o.pointerId,Z(o)),y&&k&&o.currentTarget.setAttribute(ve,""),g.current=y,u.current=w&&!y,k?t.setDraggingNode(k):t.setPanning(!0),e.current={x:o.clientX,y:o.clientY})}function be(){let o=s.current,f=p.current;if(!o||!f)return;let y=cn(l.current),v=f.getBoundingClientRect();o.spread>0&&y.spread>0&&t.zoom(y.spread/o.spread,o.mid.x-v.left,o.mid.y-v.top),t.setTransform(t.scale,t.translateX+y.mid.x-o.mid.x,t.translateY+y.mid.y-o.mid.y),s.current=y}function mn(){let o=S.current,{pan:f,hover:y,pinch:v}=o;if(o.frame=0,o.pan=null,o.hover=null,o.pinch=!1,v&&be(),f&&u.current?t.host?.horizontalScroll(-f.dx):f&&g.current?t.setTransform(t.scale,t.translateX,t.translateY+f.dy):f&&t.setTransform(t.scale,t.translateX+f.dx,t.translateY+f.dy),!y)return;let{x:b,y:w}=y,k=t.facetPanels?void 0:bt(t.overlayLabels,b,w);D(x=>x?.label===k?.label&&x?.readout===k?.readout?x:k),Pe(()=>{if(t.walkRowBars){let x=t.walkRowAt(b,w);t.setHoveredWalkRow(x===void 0?null:t.walkRowList[x].name)}if(t.nodePositions&&t.graph){let x=R(b,w);t.setHoveredPanel(t.tubeMapPanelAt(w)),t.setHoveredNode(x,{x:b,y:w}),N(x!==null&&!t.hostPlacesX&&!t.layoutResult?.tubeMap&&w>=t.referenceStripZonePx),t.setHoveredTube(x===null&&t.layoutResult?.tubeMap?t.tubeAt(b,w):null),t.setHoveredEdge(x||t.layoutResult?.tubeMap||!t.hoverLightsEverything?null:T(b,w))}})}function j(){S.current.frame||(S.current.frame=requestAnimationFrame(mn))}function gn(){let o=S.current;cancelAnimationFrame(o.frame),o.frame=0,o.pan=null,o.hover=null,o.pinch=!1}function yn(o){let f=l.current;if(s.current&&f.has(o.pointerId)){f.set(o.pointerId,Z(o)),S.current.pinch=!0,j();return}if(c(o)||m.current)return;let y=o.clientX-e.current.x,v=o.clientY-e.current.y;e.current={x:o.clientX,y:o.clientY},Math.hypot(o.clientX-r.current.x,o.clientY-r.current.y)>ln&&(i.current=!0);let b=S.current;if(t.draggingNode)t.moveNode(t.draggingNode,y/t.scaleX,v/t.scaleY);else if(t.isPanning)b.pan={dx:(b.pan?.dx??0)+y,dy:(b.pan?.dy??0)+v},j();else{let w=o.currentTarget.getBoundingClientRect();b.hover={x:o.clientX-w.left,y:o.clientY-w.top},j()}}function oe(o){let f=l.current;if(s.current&&f.has(o.pointerId)){S.current.pinch&&(S.current.pinch=!1,be()),f.delete(o.pointerId),s.current=null;let[[y,v]]=[...f];a.current=y,e.current=v;return}c(o)||(a.current=void 0,f.clear(),E(t)&&t.stopDragging())}function vn(o){c(o)||(D(void 0),N(!1),m.current?S.current.hover=null:(a.current=void 0,l.current.clear(),s.current=null,gn(),E(t)&&t.stopDragging()),E(t)&&t.clearHover())}function bn(o){let{x:f,y}=X(o),v=R(f,y),{clientX:b,clientY:w}=o;if(v){o.preventDefault(),H({clientX:b,clientY:w,nodeId:v});return}let k=t.walkRowAt(f,y);k!==void 0&&(o.preventDefault(),H({clientX:b,clientY:w,row:k}))}function wn(o){if(!i.current){let{x:f,y}=X(o),v=R(f,y);t.setSelectedNode(v),v&&t.showNodeDetails(v)}}G(()=>()=>{m.current?.end()},[]);function Sn(o){if(o.button!==0||t.hostPlacesX||t.followsHostView||!(o.target instanceof Element)||!o.target.closest(`[${dt}]`))return;m.current?.end(),u.current=!1,g.current=!1;let f=o.pointerId,y=Z(o),v=y,b={moved:!1,end:()=>{window.removeEventListener("pointermove",w,!0),window.removeEventListener("pointerup",k,!0),window.removeEventListener("pointercancel",k,!0),b.moved&&E(t)&&t.stopDragging()}};function w(x){if(x.pointerId!==f)return;if(!b.moved){if(Math.hypot(x.clientX-y.x,x.clientY-y.y)<=ln)return;b.moved=!0,t.setPanning(!0)}let ae=S.current;ae.pan={dx:(ae.pan?.dx??0)+x.clientX-v.x,dy:(ae.pan?.dy??0)+x.clientY-v.y},v=Z(x),j()}function k(x){x.pointerId===f&&(b.end(),setTimeout(()=>{m.current===b&&(m.current=null)},0))}m.current=b,window.addEventListener("pointermove",w,!0),window.addEventListener("pointerup",k,!0),window.addEventListener("pointercancel",k,!0)}function xn(o){m.current?.moved&&(m.current=null,o.stopPropagation())}let kn={cursor:t.isPanning||t.draggingNode?"grabbing":A?"move":"grab",touchAction:t.hostPlacesX?"auto":"none",overscrollBehavior:"contain"},Pn=t.host!==void 0&&!t.hostPlacesX&&!t.followsHostView?{[ve]:"",onMouseDown:o=>{o.stopPropagation()}}:{};return{canvasStyle:kn,surfaceProps:Pn,handlers:{onMouseDown:fn,onPointerDown:hn,onPointerMove:yn,onPointerUp:oe,onPointerCancel:oe,onLostPointerCapture:oe,onPointerLeave:vn,onClick:wn,onContextMenu:bn},contextMenu:I,hoveredChip:$,labelHandlers:{onPointerDown:Sn,onClickCapture:xn},closeContextMenu:()=>{H(void 0)}}}var yr={position:"relative"},vr={position:"relative",lineHeight:0,isolation:"isolate"},br={position:"absolute",left:0,right:0,bottom:0,zIndex:0},wr={position:"absolute",inset:0,zIndex:10,lineHeight:"normal",pointerEvents:"none"},Sr={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},xr=d(function({model:e}){return n(M,{children:e.visibleRowLabels.map(({label:r,y:i,top:a})=>n("div",{"data-testid":"graph-row-label",style:{...Sr,top:a},children:r},i))})}),kr={position:"absolute",display:"flex",flexDirection:"column",borderRadius:3,overflowX:"hidden",overflowY:"auto",zIndex:4},Pr={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},Mr=d(function({model:e}){let r=C(null),i=e.legendAtRest,a=e.keyShape;return G(()=>{e.setKeyShapeOf(()=>JSON.stringify(Rt(e)))},[e]),G(()=>{let c=r.current;if(!c||!i)return;let l=new ResizeObserver(()=>{p()}),p=()=>{c.firstElementChild&&l.observe(c.firstElementChild),E(e)&&e.legendAtRest&&e.setLegendSize({width:c.offsetWidth,height:c.scrollHeight},a)};return l.observe(c),p(),()=>{l.disconnect()}},[e,i,a]),n("div",{ref:r,style:{...kr,top:Q+e.referenceStripZonePx,right:Q,maxHeight:e.canvasHeight-2*Q-e.referenceStripZonePx},children:n(Nt,{model:e,sections:Ct(e)})})}),Rr=d(function({model:e}){return n(M,{children:e.overlayLabels.sizes.map(({key:r,text:i,x:a,y:c})=>n("div",{"data-testid":"graph-size-label",style:{...Pr,left:a,top:c},children:i},r))})}),dn=d(function({model:e,handle:{canvasRef:r,canvas:i},ownChrome:a}){let{handlers:c,canvasStyle:l,surfaceProps:p,labelHandlers:s,contextMenu:u,closeContextMenu:m,hoveredChip:g}=un(e),[S,I]=L(null);pn(S,i,e);let H=e.facetPanels!==void 0;return h("div",{style:yr,...p,children:[a?n(qt,{model:e}):null,h("div",{ref:I,style:vr,...s,onMouseEnter:()=>{e.setPointerInPane(!0)},onMouseLeave:()=>{E(e)&&e.setPointerInPane(!1)},children:[e.referenceStripShown?n("div",{style:{...br,top:e.referenceStripZonePx,background:J}}):null,n("canvas",{ref:r,"data-testid":"graph-genome-canvas",style:{...l,width:e.paneWidth,height:e.canvasHeight,clipPath:e.drawingClip,display:"block",position:"relative",zIndex:1},...c}),H?n(Ot,{model:e,handlers:c,canvasStyle:l}):h(M,{children:[n(Et,{model:e}),n(zt,{model:e}),n(Lt,{model:e}),n(gt,{model:e}),n(xr,{model:e}),n(Rr,{model:e}),n(mt,{model:e}),n(vt,{model:e}),n(wt,{model:e}),n(It,{model:e}),n(on,{model:e}),n(Mr,{model:e})]}),a?n("div",{style:wr,children:n(Ce,{isVisible:e.isLoading,immediate:!e.layoutResult,statusMessage:e.statusMessage,onCancel:e.canCancelLoad?()=>{e.cancelLoad()}:void 0})}):null,n(Jt,{model:e,chip:g})]}),n(nn,{model:e}),e.walkStripShown?n(rn,{model:e}):null,n(re,{model:e,at:u,onClose:m}),a?.renderError?n(ie,{error:a.renderError,onReset:a.retryRender}):null,a&&e.error?n(ie,{error:e.error,onReset:e.canRetryLoad?()=>{e.retryLoad()}:void 0}):null]})}),Cr=d(function({model:e}){let{canvasRef:r,canvas:i,error:a,retry:c}=_t(At,e);return n(dn,{model:e,handle:{canvasRef:r,canvas:i},ownChrome:{renderError:a,retryRender:c}})}),Lr=d(function({model:e,handle:r}){return r?n(dn,{model:e,handle:r}):n(Cr,{model:e})}),Ns=Lr;export{At as a,Ns as b};
2
- //# sourceMappingURL=chunk-MQ43JVZM.js.map
1
+ import{a as W,b as ut}from"./chunk-OIGMGVI6.js";import{A as It,B as Gt,C as te,D as Tt,F as fe,G as Ht,a as dt,b as ft,c as ht,d as mt,f as gt,g as yt,h as B,i as vt,j as bt,k as wt,m as St,n as xt,o as de,p as kt,q as Pt,r as Mt,s as Rt,t as Ct,v as ee,x as Lt,z as Et}from"./chunk-JJ2TPWSH.js";import{$ as ct,E as qe,F as et,H as tt,I as nt,J as rt,K as ot,L as at,M as it,_ as lt,a as P,c as Xe,ca as ue,ea as pt,f as Ze,g as $e,p as Y,q as je,r as Ke,s as Ue}from"./chunk-4MTS65XF.js";import{q as O}from"./chunk-OP2PTYDR.js";import{Ba as pe,Gb as Q,Ha as J,J as ce,La as Fe,Na as Ve,Ob as Je,Pb as Qe,S as We,Ya as Ye,Yb as _,Z as Be,a as F,b as ke,bd as st,d as Pe,ea as De}from"./chunk-TP6OXTXD.js";import{x as Oe}from"./chunk-JWIFJIPZ.js";import{M as se,Q as le}from"./chunk-4RZCYOCW.js";import{c as Se}from"./chunk-LRBNBP2K.js";import{w as we}from"./chunk-RQSCKHNS.js";import{d as E}from"./chunk-WKD7ALOU.js";import{C as xe}from"./chunk-TQZH7NNB.js";import{j as K}from"./chunk-5L276I7O.js";import{a as _e,e as G,f as ze,g as Ne,h as C,i as L}from"./chunk-J2PN6CG3.js";import{A as He,E as Ae,H as q,I as V,b as Me,c as Re,e as ie,k as Ce,o as Le,p as Ee,t as Ie,w as U,x as Ge,z as Te}from"./chunk-H42TSPVA.js";import{a as M,b as n,c as h,d}from"./chunk-DUU6T2I5.js";function At(t){return Promise.resolve(new _(t))}var z=JBrowseExports["@jbrowse/render-core/useRenderingBackend"],Mn=t=>z!=null&&t in Object(z)?z[t]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+t+"' from '@jbrowse/render-core/useRenderingBackend' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:t});var _t=Mn("useRenderingBackend"),Tr=z&&z.__esModule?z.default:z;var he=ft(1),zt=d(function({model:e}){let[r,i]=L(null);return G(()=>{if(!r)return;let a=new _(r),c=F(()=>{Ye(st()),a.resize(e.paneWidth,e.canvasHeight),e.paintHover(a,e.drawnBatch)});return()=>{c(),a.dispose()}},[r,e]),n("canvas",{ref:i,"data-testid":"graph-hover-layer",style:{...he,clipPath:e.drawingClip}})});var ne=d(function({row:e,at:r,hint:i,after:a,column:c}){let l=c===void 0?void 0:{paddingLeft:c+5};return e.swatch?h("div",{title:[e.title,i].filter(Boolean).join(" \xB7 ")||void 0,children:[h("div",{style:te,children:[n("span",{style:{display:"flex",flex:"none",justifyContent:"center",width:c},children:n(ee,{swatch:e.swatch})}),h("span",{children:[e.strong?n("strong",{children:e.strong}):null,e.label]}),e.sizer===void 0?null:h("span",{style:Rn,children:[n("span",{style:Cn,"aria-hidden":!0,"data-testid":"graph-key-sizer",children:de(e.sizer)}),n("span",{style:Ln,"data-testid":"graph-key-count",children:de(e.count)})]}),a]}),r?n("div",{style:l,"data-testid":"graph-walk-at",children:r}):e.under?n("div",{style:l,children:e.under}):null]}):n("div",{style:Tt,children:e.label})}),Rn={display:"grid"},Cn={gridArea:"1 / 1",visibility:"hidden"},Ln={gridArea:"1 / 1",width:0,minWidth:"100%",overflow:"hidden",textOverflow:"ellipsis"},En={pointerEvents:"auto",cursor:"pointer",border:"none",background:"none",padding:"0 2px",font:"inherit",textDecoration:"underline"},Nt=d(function({model:e,sections:r}){if(r.length===0)return null;let i=r.flatMap(l=>l.rows),a=xt(i),c=St(i);return n("div",{style:{...Gt,lineHeight:`${a}px`},children:r.map(({testid:l,rows:p,heading:s,spaced:u},m)=>h(_e,{children:[s?n("div",{style:{...Ht,paddingTop:m===0?0:fe},children:s}):null,n("div",{"data-testid":l,style:u?{paddingTop:fe}:void 0,children:p.map(g=>n(ne,{row:g,column:c,at:g.walk?e.hoveredOn(g.walk):void 0,after:g.closesBubble?n("button",{type:"button",style:En,"data-testid":"graph-close-bubble",onClick:()=>{e.closeBubbles()},children:"close"}):null},g.key))})]},l))})});var In={position:"absolute",left:0,top:0,zIndex:4,display:"grid",gap:Je,lineHeight:"normal"},Gn={height:Qe,padding:"2px 6px",boxSizing:"border-box",fontFamily:"inherit",fontSize:11,color:"inherit",cursor:"pointer",border:"none",background:"none",textAlign:"left",display:"block"},Tn={position:"relative"},Hn={gridColumn:"1 / -1",height:ct,padding:"2px 6px",boxSizing:"border-box",display:"flex",gap:14,fontSize:11,lineHeight:"15px"},An=d(function({model:e,lift:r,index:i,width:a,height:c,cell:l,handlers:p,canvasStyle:s}){let[u,m]=L(null),[g,S]=L(null),I=r.walks[0];G(()=>{if(!u||!g)return;let A=new _(u),N=new _(g),$=ke(()=>e.facetDrawings?.[i]),D,X=[F(()=>{let R=e.facetGrid;R&&A.resize(R.width,R.height);let T=$.get();T&&(T!==D&&(A.uploadGeometry(T.batch),D=T),e.applySelection(A),e.paint(A))}),F(()=>{let R=e.facetGrid;R&&N.resize(R.width,R.height);let T=$.get();T&&e.paintHover(N,T.batch)})];return()=>{for(let R of X)R();A.dispose(),N.dispose()}},[u,g,e,i]);let H=e.walkLabel(I.name);return h("div",{style:l,children:[n("button",{type:"button",style:Gn,"data-testid":"graph-facet-title",onClick:()=>{e.liftWalks([I.name]),e.setFacet("")},children:n(ne,{row:Pt(e,I),hint:`click to lift ${H} alone`,at:e.hoveredOn(I)})}),h("div",{style:Tn,children:[n("canvas",{ref:m,"data-testid":"graph-facet-canvas",style:{...s,width:a,height:c,display:"block"},...p}),n("canvas",{ref:S,style:he})]})]})}),_n=d(function({model:e,handlers:r,canvasStyle:i}){let a=e.facetPanels,c=e.facetGrid,l=e.facetPlacement;if(!a||!c||!l)return null;let{columns:p,width:s,height:u}=c;return h("div",{"data-testid":"graph-facet-panels",style:{...In,width:e.paneWidth,minHeight:e.canvasHeight,gridTemplateColumns:`repeat(${p}, ${s}px)`,background:J},children:[a.map((m,g)=>n(An,{model:e,lift:m,index:g,width:s,height:u,cell:{gridRow:Math.floor(l.cells[g]/p)+1,gridColumn:l.cells[g]%p+1},handlers:r,canvasStyle:i},m.walks[0].name)),n("div",{style:{...Hn,gridRow:Math.floor(l.cells.reduce((m,g)=>Math.max(m,g),-1/0)/p)+2},"data-testid":"graph-facet-key",children:Mt(e).map(m=>n(ne,{row:m},m.key))})]})}),Ot=_n;var Wt=P(n("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 Bt=P([n("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"),n("path",{d:"M12 10h-2v2H9v-2H7V9h2V7h1v2h2z"},"1")],"ZoomIn");var Dt=P(n("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 zn=d(function({model:e}){let r=e.colorSchemeLock;return n(W,{label:"Color",size:"small",sx:{minWidth:100},disabled:r!==void 0,title:r?.why,shown:r?.value,value:e.chosenColorScheme,options:qe.map(({value:i})=>({value:i,label:e.colorSchemeLabel(i)})),testId:"graph-color-select",onChange:i=>{e.setColorScheme(i)}})}),Xt=zn;var Ft=O()(t=>({stats:{marginLeft:"auto"},perf:{color:t.palette.text.secondary,fontVariantNumeric:"tabular-nums"}}));function me(t){return t===void 0?"\u2013":`${Math.round(t)}ms`}var Nn=d(function({model:e}){let{classes:r}=Ft(),{lastFetchMs:i,lastLayoutMs:a,lastGeometryMs:c}=e,l=i!==void 0||a!==void 0||c!==void 0;return e.showPerf&&l?h(V,{variant:"caption",className:r.perf,"data-testid":"graph-perf-stats",children:["fetch ",me(i)," \xB7 layout ",me(a)," \xB7 geom"," ",me(c)]}):null}),On=d(function({model:e}){let{classes:r}=Ft();return h("div",{className:r.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:[h(V,{variant:"body2",component:"span",children:[e.nodeCount," nodes, ",e.edgeCount," edges",e.pathCount>0?`, ${e.pathCount} paths`:""]})," ",n(Nn,{model:e})]})}),Vt=On;var Wn=d(function({model:e}){let{graph:r}=e;return n(W,{label:"Layout",size:"small",sx:{minWidth:140},testId:"graph-layout-select",value:e.chosenLayoutMode,options:Xe.map(({value:i,label:a,description:c,available:l})=>({value:i,label:a,description:c,disabled:r?!l(r):!1})),onChange:i=>{e.switchLayout(i)}})}),Yt=Wn;var Bn=d(function({model:e}){return e.chosenLayoutMode!=="walkrows"||e.repeatChoices.length===0?null:n(W,{label:"Repeat",size:"small",sx:{minWidth:130,maxWidth:260},testId:"graph-repeat-select",value:e.selectedRepeat?.key??"",options:e.repeatOptions,onChange:r=>{e.setRepeatKey(r)}})}),Zt=Bn;var $t=P(n("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),"Close");var jt=P(n("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 Dn=d(function({model:e}){let r=e.highlightMenuItems({picks:!1});return n(Me,{size:"small",tooltip:"Graph options",menuItems:[...r.length>0?[{label:"Haplotypes",icon:Ze,subMenu:r}]:[],...e.layoutOptionMenuItems({repeat:!1}),{label:"Show",icon:et,subMenu:[...e.showMenuItems(),...e.modeDrawsNodes&&e.walkChoices.length>1?[{type:"checkbox",label:"Show walk rows under the graph",checked:e.walkStrip,onClick:()=>{e.setWalkStrip(!e.walkStrip)}}]:[],{type:"checkbox",label:"Show timings",checked:e.showPerf,onClick:()=>{e.setShowPerf(!e.showPerf)}}]},{type:"divider"},{label:"Graph settings...",icon:$e,helpText:"Subgraph node limit; node width and path colors; the force-directed layout engine",onClick:()=>{K(e).queueDialog(i=>[ut,{model:e,onClose:i}])}},{type:"divider"},{label:"Close graph",icon:$t,onClick:()=>{e.clearGraph()}}],children:n(jt,{})})}),Kt=Dn;var Xn=O()({formControl:{minWidth:130,maxWidth:260}}),Fn=d(function({model:e}){let{classes:r}=Xn(),i=ze(),{walkChoices:a}=e;if(a.length===0||!e.liftsWalks)return null;let c=new Set(a.map(s=>s.name)),l=new Map(a.map(s=>[s.name,s.label])),p=e.walkLayers.map(s=>s.walk).filter(s=>c.has(s));return a.length>Ve?n(Le,{size:"small",variant:"outlined",color:"inherit","data-testid":"graph-walk-choose",onClick:()=>{K(e).queueDialog(s=>[Fe,{model:e,onClose:s}])},children:p.length>0?`${p.length} of ${a.length} haplotypes`:"Highlight haplotypes..."}):h(Ie,{size:"small",className:r.formControl,children:[n(Ge,{id:i,children:"Highlight"}),n(Ae,{labelId:i,multiple:!0,value:p,label:"Highlight","data-testid":"graph-walk-select",renderValue:s=>s.map(u=>l.get(u)).join(", "),onChange:s=>{let{value:u}=s.target;e.liftAmongChoices(typeof u=="string"?u.split(","):u)},children:a.map(({name:s,label:u})=>h(He,{value:s,dense:!0,children:[n(Ee,{size:"small",checked:p.includes(s)}),n(Te,{primary:u})]},s))})]})}),Ut=Fn;var Vn=O()(t=>({toolbar:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:4,padding:"2px 4px",borderBottom:`1px solid ${t.palette.divider}`}})),Yn=d(function({model:e}){return n(V,{variant:"body2",children:e.zoomPercent})}),Zn=d(function({model:e}){let{classes:r}=Vn(),i=a=>{e.zoom(a,e.viewBox.width/2,e.viewBox.height/2)};return h("div",{className:r.toolbar,children:[n(Yt,{model:e}),n(Xt,{model:e}),n(Ut,{model:e}),n(Zt,{model:e}),n(q,{title:"Zoom in",children:n(U,{size:"small",onClick:()=>{i(1.5)},children:n(Bt,{})})}),n(q,{title:"Zoom out",children:n(U,{size:"small",onClick:()=>{i(1/1.5)},children:n(Dt,{})})}),n(q,{title:"Zoom to fit",children:n(U,{size:"small",onClick:()=>{e.refitView()},children:n(Wt,{})})}),n(Yn,{model:e}),n(Vt,{model:e}),n(Kt,{model:e})]})}),qt=Zn;var $n={position:"absolute",bottom:lt,lineHeight:"normal",background:"rgba(0,0,0,0.75)",color:"white",padding:"4px 8px",borderRadius:4,fontSize:12,pointerEvents:"none",zIndex:6};function ge({label:t,readout:e}){return h(M,{children:[n("strong",{children:t})," \u2014 ",e]})}function jn(t,e){if(e)return{testId:"graph-chip-tooltip",body:ge(e)};let r=t.hoveredNode?t.hoverNodeById?.get(t.hoveredNode):void 0;if(r){let l=Ke(r),p=t.hoverDrawing?.members.get(r.id),s=Ue(r),u=t.graphRegion,m=t.hoveredSpan,g=u&&m&&!we(r)?`${u.assemblyName} ${Y({refName:u.refName,...m})}`:void 0,S=ce(t.genePins,r.id),I=S.length>0?h(M,{children:[n("br",{}),n("em",{children:S.join(", ")})]}):null;return l?{body:h(M,{children:[l,I]})}:{body:h(M,{children:[n("strong",{children:r.name}),p?` and ${p.length-1} more`:""," \u2014"," ",r.length.toLocaleString()," bp, depth ",r.depth.toFixed(1),s?h(M,{children:[n("br",{}),s.sample," ",Y(s)," (rank ",r.stable?.rank,")"]}):null,g?h(M,{children:[n("br",{}),"Reference ",g]}):null,I,r.moved?h(M,{children:[n("br",{}),"End of a component too large to draw here"]}):null]})}}let i=t.hoveredEdge===null?void 0:t.graph?.edges[t.hoveredEdge];if(i){let l=je(i,t.deletions.find(s=>s.edgeIndex===t.hoveredEdge),s=>t.nodeById?.get(s)?.name??s),p=t.graph?Se(t.graph):void 0;return{body:l.deletion?h(M,{children:[`skips ${l.deletion.bp} of ${p??"the reference"} sequence`,n("br",{}),l.deletion.where]}):h(M,{children:["Edge: ",l.ends]})}}let a=t.hoveredWalkRowText;if(a)return{testId:"graph-walk-row-tooltip",body:ge(a)};let c=t.hoveredTubeText;return c?{testId:"graph-tube-tooltip",body:ge(c)}:void 0}var Kn=d(function({model:e,chip:r}){let i=jn(e,r);return i?n("div",{style:{...$n,right:e.tooltipRightPx},"data-testid":i.testId,children:i.body}):null}),Jt=Kn;var Qt=P(n("path",{d:"M10 18h4v-2h-4zM3 6v2h18V6zm3 7h12v-2H6z"}),"FilterList");var en=P(n("path",{d:"M10.83 8H21V6H8.83zm5 5H18v-2h-4.17zM14 16.83V18h-4v-2h3.17l-3-3H6v-2h2.17l-3-3H3V6h.17L1.39 4.22 2.8 2.81l18.38 18.38-1.41 1.41z"}),"FilterListOff");var tn=P(n("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 Un={x:0,y:0};function qn(t,e){let{own:r,reference:i,highlight:a}=t.nodeLaunchTargets(e);return[{label:"Node details",icon:tn,onClick:()=>{t.showNodeDetails(e)}},...pt({own:r,reference:i,highlight:a,onShowLinear:c=>{t.showInLinearView(c)},onHighlight:t.canHighlightInLinearView?c=>{t.highlightInLinearView(c)}:void 0})]}function Jn(t,e,r){let i=r??t.walkRowBars,a=t.walkRowLaunchTarget(e,i),c=a?.assembly,l=e>0?i?.rows[e-1]:void 0,p=l?.sample,s=t.abridged.find(g=>g.name===l?.name),u=!r&&t.walkRowBars,m=t.walkRowSamples;return[a&&c?{label:`Linear genome view \u2014 ${c} ${Y(a.location)}`,icon:ue,onClick:()=>{t.showInLinearView({location:a.location,assembly:c})}}:{label:"Linear genome view",icon:ue,disabled:!0,disabledHelpText:a?`No assembly in this session is ${a.location.haplotype??a.label}`:"This walk states no contig coordinates",onClick:()=>{}},...r&&l&&s?[{label:"Load its steps",subLabel:xe(s,l.label),onClick:()=>{t.expandWalk(l.name)}}]:[],...l&&t.liftsWalks&&t.modeDrawsNodes?[{type:"checkbox",label:`Highlight ${l.label}`,checked:t.walkLayers.some(g=>g.walk===l.name),onClick:()=>{t.toggleWalk(l.name)}}]:[],...u&&p&&!(m?.length===1&&m[0]===p)?[{label:`Show only ${p}`,icon:Qt,onClick:()=>{t.setWalkRowSamples([p])}}]:[],...u&&m?[{label:"Show every sample",icon:en,onClick:()=>{t.setWalkRowSamples(void 0)}}]:[]]}var re=d(function({model:e,at:r,onClose:i}){return n(Re,{anchor:r,offset:Un,onClose:i,menuItems:()=>r===void 0?[]:"nodeId"in r?qn(e,r.nodeId):Jn(e,r.row,r.bars)})});var Qn=d(function({model:e}){return n(M,{children:e.passBars.map(r=>n("svg",{"data-testid":"graph-pass-bar",width:e.paneWidth,height:at,style:{display:"block",borderTop:"1px solid #ddd"},children:n(B,{el:it(r,e.walkLabel(r.walk),e.paneWidth)})},r.walk))})}),nn=Qn;var er={display:"flex",flexWrap:"wrap",gap:"2px 14px",padding:"2px 8px 6px",fontSize:11,color:"#333"},tr={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},nr=d(function({bars:e,frame:r,ramp:i,rowGenes:a,inks:c}){let l=yt(),p=Ne(()=>De(e,r,{ramp:i,rowGenes:a,idPrefix:l,markUnloaded:!0,inks:c}),[e,r,i,a,l,c]);return n(B,{el:p})}),rr=d(function({model:e}){let r=e.walkStripRows,i=e.walkStripFrame,a=e.stripHover,c=r?[r.reference,...r.rows]:[],l=a?c.findIndex(g=>g.name===a.row):-1,p=c[l],s=r&&i&&p?We(r,l,i):void 0;if(!r||!i||!a||!p||!s||i.labelled&&!s.cut)return null;let u=(r.origin+a.offset)*i.scaleX+i.translateX,m=u>i.width/2?{right:i.width-u+12}:{left:u+12};return h("div",{"data-testid":"graph-walk-strip-tip",style:{...tr,...m,top:l*i.rowPx+i.translateY-18},children:[p.label," \xB7 ",s.text]})}),or=d(function({model:e,bars:r,frame:i}){return n(B,{el:nt(r,i,e.walkStripMarks)})}),ar=d(function({model:e}){let r=e.walkStripRows,i=e.walkStripFrame,[a,c]=L();if(!r||!i)return null;let l=s=>{let u=s.currentTarget.getBoundingClientRect();return tt(r,i,s.clientX-u.left,s.clientY-u.top)},p=Be(r,{ramp:e.referenceRampDomain,rampCss:Oe,genes:ot(i,e.walkRowGenes,e.walkRowGeneGaps),annotation:e.walkRowAnnotation,markUnloaded:!0,inks:e.walkStripInks});return h("div",{"data-testid":"graph-walk-strip",style:{position:"relative",borderTop:"1px solid #ddd"},onMouseEnter:()=>{e.setPointerInPane(!0)},onMouseLeave:()=>{E(e)&&(e.setPointerInPane(!1),e.setStripHover(null))},children:[h("svg",{width:i.width,height:i.height,style:{display:"block"},onMouseLeave:()=>{E(e)&&e.setStripHover(null)},onMouseMove:s=>{let u=l(s);s.currentTarget.style.cursor=u&&u.index>0?"pointer":"",e.setStripHover(u?{row:u.row.name,offset:u.offset}:null)},onClick:s=>{let u=l(s);u&&u.index>0&&e.toggleWalk(u.row.name)},onContextMenu:s=>{let u=l(s);u&&(s.preventDefault(),c({clientX:s.clientX,clientY:s.clientY,row:u.index}))},children:[n(nr,{bars:r,frame:i,ramp:e.referenceRampDomain,rowGenes:e.walkRowGenes,inks:e.walkStripInks}),n(or,{model:e,bars:r,frame:i}),n(B,{el:rt(r,i,new Set(e.walkLayers.map(s=>s.walk)))})]}),n(rr,{model:e}),h("div",{style:er,"data-testid":"graph-walk-strip-key",children:[p.map(s=>h("div",{style:te,children:[n(ee,{swatch:kt(s.swatch)}),n("span",{children:s.label})]},s.label)),n("span",{style:{color:"#777"},children:"Ticks mark where each walk passes the node under the pointer; click a haplotype's bar to lift its walk"})]}),n(re,{model:e,at:a&&{...a,bars:r},onClose:()=>{c(void 0)}})]})}),rn=ar;var ir=d(function({model:e}){let r=e.walkStripLocator;return r?h(ht,{model:e,zIndex:4,overflow:"visible",testId:"graph-walk-strip-locator",children:[n("circle",{cx:r.x,cy:r.y,r:11,fill:"none",stroke:"white",strokeWidth:4}),n("circle",{cx:r.x,cy:r.y,r:11,fill:"none",stroke:"#111",strokeWidth:1.75})]}):null}),on=ir;var sr=1.1,lr=100,cr=40,pr=800,ur=10,an=2;function ye(t){let e=t.deltaY*(t.deltaMode===1?cr:t.deltaMode===2?pr:1),r=(t.ctrlKey?ur:1)*e/lr;return sr**-Math.max(-an,Math.min(an,r))}var dr=40,fr=100,hr=24,sn=Math.log(16);function mr(t,e){let r=t*Math.exp(-Math.max(0,e)/hr);return Math.abs(r)<.001?t:t-r}function gr(t,e){let r=Math.abs(t.deltaX)>Math.abs(t.deltaY);return t.ctrlKey||t.metaKey||!r&&(!e||e.scrollZoom)?"zoom":r?"pan":"page"}function pn(t,e,r){G(()=>{if(!t)return;let i=-1/0,a={backlog:0,x:0,y:0,frame:0,last:0},c=p=>{let s=mr(a.backlog,Math.min(100,p-a.last));a.backlog-=s,a.last=p,a.frame=a.backlog?requestAnimationFrame(c):0,E(r)&&r.zoom(Math.exp(s),a.x,a.y)},l=p=>{if(r.hostPlacesX||r.followsHostView)return;let m=((p.target instanceof Element?p.target.closest("canvas"):null)??(r.facetPanels?null:e))?.getBoundingClientRect();if(m&&p.clientY-m.top<r.referenceStripZonePx)return;let g=gr(p,r.host);if(g!=="page"){if(r.host&&p.stopPropagation(),p.preventDefault(),g==="pan"){if(p.timeStamp-i>fr){let S=p.deltaMode===1?dr:1;r.setTransform(r.scale,r.translateX-p.deltaX*S,r.translateY)}return}i=p.timeStamp,m&&(a.x=p.clientX-m.left,a.y=p.clientY-m.top,a.backlog=Math.max(-sn,Math.min(sn,a.backlog+Math.log(ye(p)))),a.frame||(a.last=performance.now()-1e3/60,a.frame=requestAnimationFrame(c)))}};return t.addEventListener("wheel",l,{passive:!1}),()=>{cancelAnimationFrame(a.frame),t.removeEventListener("wheel",l)}},[t,e,r])}var ln=3,ve="data-gesture-owner",Z=t=>({x:t.clientX,y:t.clientY});function cn(t){let[e,r]=[...t.values()];return{spread:Math.hypot(e.x-r.x,e.y-r.y),mid:{x:(e.x+r.x)/2,y:(e.y+r.y)/2}}}function un(t){let e=C({x:0,y:0}),r=C({x:0,y:0}),i=C(!1),a=C(void 0),c=o=>a.current!==void 0&&o.pointerId!==a.current,l=C(new Map),p=C(null),s=C(null),u=C(!1),m=C(null),g=C(!1),S=C({frame:0,pan:null,hover:null,pinch:!1});G(()=>()=>{cancelAnimationFrame(S.current.frame)},[]);let[I,H]=L(),[A,N]=L(!1),[$,D]=L(void 0);function X(o){let f=o.currentTarget.getBoundingClientRect();return{x:o.clientX-f.left,y:o.clientY-f.top}}function R(o,f){if(t.layoutResult?.tubeMap)return t.tubeMapNodeAt(o,f);let y=t.referenceStripNodeAt(o,f);if(y)return y;let{nodePositions:v}=t;if(!v)return null;let{x:b,y:w}=pe(o,f,t,t.axisScale);return se(v,b,w,t.axisScale,t.positionsVersion,t.nodeInk,t.drawnFold)}function T(o,f){let{nodePositions:y,graph:v}=t;if(!y||!v)return null;let{x:b,y:w}=pe(o,f,t,t.axisScale);return le(y,v,b,w,t.axisScale,t.effectiveDrawPaths&&!t.facetPanels,t.positionsVersion,t.deletionEdgeIndexes,t.hiddenEdgeIndexes,t.deletionRoutes,t.layoutResult?.stranded,t.drawnFold)}function fn(o){o.button===0&&o.preventDefault()}function hn(o){if(o.button!==0)return;let f=l.current;if(c(o)){t.isPanning&&!g.current&&o.pointerType==="touch"&&f.size===1&&(o.currentTarget.setPointerCapture(o.pointerId),f.set(o.pointerId,Z(o)),s.current=cn(f),i.current=!0);return}i.current=!1,r.current={x:o.clientX,y:o.clientY},o.currentTarget.removeAttribute(ve);let y=t.followsHostView,{x:v,y:b}=X(o),w=b<t.referenceStripZonePx,k=t.hostPlacesX||t.layoutResult?.tubeMap||w?null:R(v,b);t.hostPlacesX||y&&o.shiftKey||t.followsWindow&&!k||(o.currentTarget.setPointerCapture(o.pointerId),a.current=o.pointerId,p.current=o.currentTarget,f.clear(),f.set(o.pointerId,Z(o)),y&&k&&o.currentTarget.setAttribute(ve,""),g.current=y,u.current=w&&!y,k?t.setDraggingNode(k):t.setPanning(!0),e.current={x:o.clientX,y:o.clientY})}function be(){let o=s.current,f=p.current;if(!o||!f)return;let y=cn(l.current),v=f.getBoundingClientRect();o.spread>0&&y.spread>0&&t.zoom(y.spread/o.spread,o.mid.x-v.left,o.mid.y-v.top),t.setTransform(t.scale,t.translateX+y.mid.x-o.mid.x,t.translateY+y.mid.y-o.mid.y),s.current=y}function mn(){let o=S.current,{pan:f,hover:y,pinch:v}=o;if(o.frame=0,o.pan=null,o.hover=null,o.pinch=!1,v&&be(),f&&u.current?t.host?.horizontalScroll(-f.dx):f&&g.current?t.setTransform(t.scale,t.translateX,t.translateY+f.dy):f&&t.setTransform(t.scale,t.translateX+f.dx,t.translateY+f.dy),!y)return;let{x:b,y:w}=y,k=t.facetPanels?void 0:bt(t.overlayLabels,b,w);D(x=>x?.label===k?.label&&x?.readout===k?.readout?x:k),Pe(()=>{if(t.walkRowBars){let x=t.walkRowAt(b,w);t.setHoveredWalkRow(x===void 0?null:t.walkRowList[x].name)}if(t.nodePositions&&t.graph){let x=R(b,w);t.setHoveredPanel(t.tubeMapPanelAt(w)),t.setHoveredNode(x,{x:b,y:w}),N(x!==null&&!t.hostPlacesX&&!t.layoutResult?.tubeMap&&w>=t.referenceStripZonePx),t.setHoveredTube(x===null&&t.layoutResult?.tubeMap?t.tubeAt(b,w):null),t.setHoveredEdge(x||t.layoutResult?.tubeMap||!t.hoverLightsEverything?null:T(b,w))}})}function j(){S.current.frame||(S.current.frame=requestAnimationFrame(mn))}function gn(){let o=S.current;cancelAnimationFrame(o.frame),o.frame=0,o.pan=null,o.hover=null,o.pinch=!1}function yn(o){let f=l.current;if(s.current&&f.has(o.pointerId)){f.set(o.pointerId,Z(o)),S.current.pinch=!0,j();return}if(c(o)||m.current)return;let y=o.clientX-e.current.x,v=o.clientY-e.current.y;e.current={x:o.clientX,y:o.clientY},Math.hypot(o.clientX-r.current.x,o.clientY-r.current.y)>ln&&(i.current=!0);let b=S.current;if(t.draggingNode)t.moveNode(t.draggingNode,y/t.scaleX,v/t.scaleY);else if(t.isPanning)b.pan={dx:(b.pan?.dx??0)+y,dy:(b.pan?.dy??0)+v},j();else{let w=o.currentTarget.getBoundingClientRect();b.hover={x:o.clientX-w.left,y:o.clientY-w.top},j()}}function oe(o){let f=l.current;if(s.current&&f.has(o.pointerId)){S.current.pinch&&(S.current.pinch=!1,be()),f.delete(o.pointerId),s.current=null;let[[y,v]]=[...f];a.current=y,e.current=v;return}c(o)||(a.current=void 0,f.clear(),E(t)&&t.stopDragging())}function vn(o){c(o)||(D(void 0),N(!1),m.current?S.current.hover=null:(a.current=void 0,l.current.clear(),s.current=null,gn(),E(t)&&t.stopDragging()),E(t)&&t.clearHover())}function bn(o){let{x:f,y}=X(o),v=R(f,y),{clientX:b,clientY:w}=o;if(v){o.preventDefault(),H({clientX:b,clientY:w,nodeId:v});return}let k=t.walkRowAt(f,y);k!==void 0&&(o.preventDefault(),H({clientX:b,clientY:w,row:k}))}function wn(o){if(!i.current){let{x:f,y}=X(o),v=R(f,y);t.setSelectedNode(v),v&&t.showNodeDetails(v)}}G(()=>()=>{m.current?.end()},[]);function Sn(o){if(o.button!==0||t.hostPlacesX||t.followsHostView||!(o.target instanceof Element)||!o.target.closest(`[${dt}]`))return;m.current?.end(),u.current=!1,g.current=!1;let f=o.pointerId,y=Z(o),v=y,b={moved:!1,end:()=>{window.removeEventListener("pointermove",w,!0),window.removeEventListener("pointerup",k,!0),window.removeEventListener("pointercancel",k,!0),b.moved&&E(t)&&t.stopDragging()}};function w(x){if(x.pointerId!==f)return;if(!b.moved){if(Math.hypot(x.clientX-y.x,x.clientY-y.y)<=ln)return;b.moved=!0,t.setPanning(!0)}let ae=S.current;ae.pan={dx:(ae.pan?.dx??0)+x.clientX-v.x,dy:(ae.pan?.dy??0)+x.clientY-v.y},v=Z(x),j()}function k(x){x.pointerId===f&&(b.end(),setTimeout(()=>{m.current===b&&(m.current=null)},0))}m.current=b,window.addEventListener("pointermove",w,!0),window.addEventListener("pointerup",k,!0),window.addEventListener("pointercancel",k,!0)}function xn(o){m.current?.moved&&(m.current=null,o.stopPropagation())}let kn={cursor:t.isPanning||t.draggingNode?"grabbing":A?"move":"grab",touchAction:t.hostPlacesX?"auto":"none",overscrollBehavior:"contain"},Pn=t.host!==void 0&&!t.hostPlacesX&&!t.followsHostView?{[ve]:"",onMouseDown:o=>{o.stopPropagation()}}:{};return{canvasStyle:kn,surfaceProps:Pn,handlers:{onMouseDown:fn,onPointerDown:hn,onPointerMove:yn,onPointerUp:oe,onPointerCancel:oe,onLostPointerCapture:oe,onPointerLeave:vn,onClick:wn,onContextMenu:bn},contextMenu:I,hoveredChip:$,labelHandlers:{onPointerDown:Sn,onClickCapture:xn},closeContextMenu:()=>{H(void 0)}}}var yr={position:"relative"},vr={position:"relative",lineHeight:0,isolation:"isolate"},br={position:"absolute",left:0,right:0,bottom:0,zIndex:0},wr={position:"absolute",inset:0,zIndex:10,lineHeight:"normal",pointerEvents:"none"},Sr={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},xr=d(function({model:e}){return n(M,{children:e.visibleRowLabels.map(({label:r,y:i,top:a})=>n("div",{"data-testid":"graph-row-label",style:{...Sr,top:a},children:r},i))})}),kr={position:"absolute",display:"flex",flexDirection:"column",borderRadius:3,overflowX:"hidden",overflowY:"auto",zIndex:4},Pr={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},Mr=d(function({model:e}){let r=C(null),i=e.legendAtRest,a=e.keyShape;return G(()=>{e.setKeyShapeOf(()=>JSON.stringify(Rt(e)))},[e]),G(()=>{let c=r.current;if(!c||!i)return;let l=new ResizeObserver(()=>{p()}),p=()=>{c.firstElementChild&&l.observe(c.firstElementChild),E(e)&&e.legendAtRest&&e.setLegendSize({width:c.offsetWidth,height:c.scrollHeight},a)};return l.observe(c),p(),()=>{l.disconnect()}},[e,i,a]),n("div",{ref:r,style:{...kr,top:Q+e.referenceStripZonePx,right:Q,maxHeight:e.canvasHeight-2*Q-e.referenceStripZonePx},children:n(Nt,{model:e,sections:Ct(e)})})}),Rr=d(function({model:e}){return n(M,{children:e.overlayLabels.sizes.map(({key:r,text:i,x:a,y:c})=>n("div",{"data-testid":"graph-size-label",style:{...Pr,left:a,top:c},children:i},r))})}),dn=d(function({model:e,handle:{canvasRef:r,canvas:i},ownChrome:a}){let{handlers:c,canvasStyle:l,surfaceProps:p,labelHandlers:s,contextMenu:u,closeContextMenu:m,hoveredChip:g}=un(e),[S,I]=L(null);pn(S,i,e);let H=e.facetPanels!==void 0;return h("div",{style:yr,...p,children:[a?n(qt,{model:e}):null,h("div",{ref:I,style:vr,...s,onMouseEnter:()=>{e.setPointerInPane(!0)},onMouseLeave:()=>{E(e)&&e.setPointerInPane(!1)},children:[e.referenceStripShown?n("div",{style:{...br,top:e.referenceStripZonePx,background:J}}):null,n("canvas",{ref:r,"data-testid":"graph-genome-canvas",style:{...l,width:e.paneWidth,height:e.canvasHeight,clipPath:e.drawingClip,display:"block",position:"relative",zIndex:1},...c}),H?n(Ot,{model:e,handlers:c,canvasStyle:l}):h(M,{children:[n(Et,{model:e}),n(zt,{model:e}),n(Lt,{model:e}),n(gt,{model:e}),n(xr,{model:e}),n(Rr,{model:e}),n(mt,{model:e}),n(vt,{model:e}),n(wt,{model:e}),n(It,{model:e}),n(on,{model:e}),n(Mr,{model:e})]}),a?n("div",{style:wr,children:n(Ce,{isVisible:e.isLoading,immediate:!e.layoutResult,statusMessage:e.statusMessage,onCancel:e.canCancelLoad?()=>{e.cancelLoad()}:void 0})}):null,n(Jt,{model:e,chip:g})]}),n(nn,{model:e}),e.walkStripShown?n(rn,{model:e}):null,n(re,{model:e,at:u,onClose:m}),a?.renderError?n(ie,{error:a.renderError,onReset:a.retryRender}):null,a&&e.error?n(ie,{error:e.error,onReset:e.canRetryLoad?()=>{e.retryLoad()}:void 0}):null]})}),Cr=d(function({model:e}){let{canvasRef:r,canvas:i,error:a,retry:c}=_t(At,e);return n(dn,{model:e,handle:{canvasRef:r,canvas:i},ownChrome:{renderError:a,retryRender:c}})}),Lr=d(function({model:e,handle:r}){return r?n(dn,{model:e,handle:r}):n(Cr,{model:e})}),Ns=Lr;export{At as a,Ns as b};
2
+ //# sourceMappingURL=chunk-LNTZ37UI.js.map
@@ -1,2 +1,2 @@
1
- import{i as o}from"./chunk-ZLQEXXMV.js";import{B as e}from"./chunk-TDHUAADJ.js";function d(r,n,t){let a=e(r);return t?{...r,abridged:a,walkRowRuns:o(r,n)}:{...r,abridged:a}}export{d as a};
2
- //# sourceMappingURL=chunk-UPSA4KVF.js.map
1
+ import{i as o}from"./chunk-ZLQEXXMV.js";import{B as e}from"./chunk-TQZH7NNB.js";function d(r,n,t){let a=e(r);return t?{...r,abridged:a,walkRowRuns:o(r,n)}:{...r,abridged:a}}export{d as a};
2
+ //# sourceMappingURL=chunk-SG4UIYEN.js.map