@jbrowse/plugin-legacy-jbrowse 1.5.3 → 1.5.7

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.
@@ -1,2 +1,2 @@
1
- "use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=e(require("@jbrowse/core/pluggableElementTypes/AdapterType")),r=e(require("@jbrowse/core/pluggableElementTypes/TextSearchAdapterType")),n=e(require("@jbrowse/core/pluggableElementTypes/ConnectionType")),a=e(require("@jbrowse/core/Plugin")),o=require("@jbrowse/core/configuration"),i=require("@jbrowse/core/data_adapters/BaseAdapter"),c=e(require("@jbrowse/core/TextSearch/BaseResults")),s=e(require("buffer-crc32")),u=require("@jbrowse/core/util/tracks"),l=require("@jbrowse/core/util"),f=require("@jbrowse/core/pluggableElementTypes/models"),p=require("mobx-state-tree"),h=require("@jbrowse/core/util/io"),d=e(require("get-value")),y=e(require("set-value")),m=e(require("@gmod/nclist")),v=require("@jbrowse/core/util/rxjs"),g=require("generic-filehandle");function b(e){var t,r,n,a=2;for("undefined"!=typeof Symbol&&(r=Symbol.asyncIterator,n=Symbol.iterator);a--;){if(r&&null!=(t=e[r]))return t.call(e);if(n&&null!=(t=e[n]))return new w(t.call(e));r="@@asyncIterator",n="@@iterator"}throw new TypeError("Object is not async iterable")}function w(e){function t(e){if(Object(e)!==e)return Promise.reject(new TypeError(e+" is not an object."));var t=e.done;return Promise.resolve(e.value).then((function(e){return{value:e,done:t}}))}return(w=function(e){this.s=e,this.n=e.next}).prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(e){var r=this.s.return;return void 0===r?Promise.resolve({value:e,done:!0}):t(r.apply(this.s,arguments))},throw:function(e){var r=this.s.return;return void 0===r?Promise.reject(e):t(r.apply(this.s,arguments))}},new w(e)}function T(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function x(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?T(Object(r),!0).forEach((function(t){F(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):T(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function k(e){return(k="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function S(e,t,r,n,a,o,i){try{var c=e[o](i),s=c.value}catch(e){return void r(e)}c.done?t(s):Promise.resolve(s).then(n,a)}function U(e){return function(){var t=this,r=arguments;return new Promise((function(n,a){var o=e.apply(t,r);function i(e){S(o,n,a,i,c,"next",e)}function c(e){S(o,n,a,i,c,"throw",e)}i(void 0)}))}}function L(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function j(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function B(e,t,r){return t&&j(e.prototype,t),r&&j(e,r),e}function F(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function q(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function C(e){return(C=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function J(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function A(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=C(e);if(t){var a=C(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return J(this,r)}}function E(e){return function(e){if(Array.isArray(e))return R(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||O(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function O(e,t){if(e){if("string"==typeof e)return R(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?R(e,t):void 0}}function R(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var _=o.ConfigurationSchema("NCListAdapter",{rootUrlTemplate:{type:"fileLocation",defaultValue:{uri:"/path/to/my/{refseq}/trackData.json",locationType:"UriLocation"}},refNames:{type:"stringArray",defaultValue:[],description:"List of refNames used by the NCList used for aliasing"}},{explicitlyTyped:!0});function P(e,t){return e(t={exports:{}},t.exports),t.exports}var N=P((function(e){var t=function(e){var t=Object.prototype,r=t.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},a=n.iterator||"@@iterator",o=n.asyncIterator||"@@asyncIterator",i=n.toStringTag||"@@toStringTag";function c(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,r){return e[t]=r}}function s(e,t,r,n){var a=Object.create((t&&t.prototype instanceof f?t:f).prototype),o=new k(n||[]);return a._invoke=function(e,t,r){var n="suspendedStart";return function(a,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===a)throw o;return{value:void 0,done:!0}}for(r.method=a,r.arg=o;;){var i=r.delegate;if(i){var c=w(i,r);if(c){if(c===l)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var s=u(e,t,r);if("normal"===s.type){if(n=r.done?"completed":"suspendedYield",s.arg===l)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n="completed",r.method="throw",r.arg=s.arg)}}}(e,r,o),a}function u(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=s;var l={};function f(){}function p(){}function h(){}var d={};c(d,a,(function(){return this}));var y=Object.getPrototypeOf,m=y&&y(y(S([])));m&&m!==t&&r.call(m,a)&&(d=m);var v=h.prototype=f.prototype=Object.create(d);function g(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function b(e,t){var n;this._invoke=function(a,o){function i(){return new t((function(n,i){!function n(a,o,i,c){var s=u(e[a],e,o);if("throw"!==s.type){var l=s.arg,f=l.value;return f&&"object"==typeof f&&r.call(f,"__await")?t.resolve(f.__await).then((function(e){n("next",e,i,c)}),(function(e){n("throw",e,i,c)})):t.resolve(f).then((function(e){l.value=e,i(l)}),(function(e){return n("throw",e,i,c)}))}c(s.arg)}(a,o,n,i)}))}return n=n?n.then(i,i):i()}}function w(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,w(e,t),"throw"===t.method))return l;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=u(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,l;var a=n.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,l):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,l)}function T(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function x(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function k(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(T,this),this.reset(!0)}function S(e){if(e){var t=e[a];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,o=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return o.next=o}}return{next:U}}function U(){return{value:void 0,done:!0}}return p.prototype=h,c(v,"constructor",h),c(h,"constructor",p),p.displayName=c(h,i,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===p||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,h):(e.__proto__=h,c(e,i,"GeneratorFunction")),e.prototype=Object.create(v),e},e.awrap=function(e){return{__await:e}},g(b.prototype),c(b.prototype,o,(function(){return this})),e.AsyncIterator=b,e.async=function(t,r,n,a,o){void 0===o&&(o=Promise);var i=new b(s(t,r,n,a),o);return e.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},g(v),c(v,i,"Generator"),c(v,a,(function(){return this})),c(v,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=S,k.prototype={constructor:k,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(x),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return i.type="throw",i.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var a=this.tryEntries.length-1;a>=0;--a){var o=this.tryEntries[a],i=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var c=r.call(o,"catchLoc"),s=r.call(o,"finallyLoc");if(c&&s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(c){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,l):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),l},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),x(r),l}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var a=n.arg;x(r)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:S(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},e}(e.exports);try{regeneratorRuntime=t}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}})),I=function(){function e(t){L(this,e),this.url=/\/$/.test(t.url)?t.url:"".concat(t.url,"/")}var t,r,n,a,o,i,c,u;return B(e,[{key:"readMeta",value:(u=U(N.mark((function e(){var t,r,n,a;return N.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.loadFile("meta.json");case 2:return r=(t=e.sent).compress,n=t.track_names,a=Math.ceil(t.hash_bits/4),e.abrupt("return",{hashHexCharacters:a,compress:r,tracks:n});case 6:case"end":return e.stop()}}),e,this)}))),function(){return u.apply(this,arguments)})},{key:"getHashHexCharacters",value:(c=U(N.mark((function e(){return N.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.readMeta();case 2:return e.abrupt("return",e.sent.hashHexCharacters);case 4:case"end":return e.stop()}}),e,this)}))),function(){return c.apply(this,arguments)})},{key:"getCompress",value:(i=U(N.mark((function e(){return N.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.readMeta();case 2:return e.abrupt("return",e.sent.compress);case 4:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"getTrackNames",value:(o=U(N.mark((function e(){return N.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.readMeta();case 2:return e.abrupt("return",e.sent.tracks);case 4:case"end":return e.stop()}}),e,this)}))),function(){return o.apply(this,arguments)})},{key:"get",value:(a=U(N.mark((function e(t){return N.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getBucket(t);case 2:return e.abrupt("return",e.sent[t]);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"getBucket",value:(n=U(N.mark((function e(t){var r;return N.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this.hash(t),e.next=3,this.hexToDirPath(r);case 3:return e.abrupt("return",this.loadFile(e.sent));case 5:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"loadFile",value:(r=U(N.mark((function e(t){var r;return N.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fetch("".concat(this.url).concat(t));case 2:if((r=e.sent).ok){e.next=5;break}throw new Error("HTTP ".concat(r.status," ").concat(r.statusText));case 5:return e.abrupt("return",r.json());case 6:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"hexToDirPath",value:(t=U(N.mark((function e(t){var r,n,a,o;return N.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getHashHexCharacters();case 2:if(!(r=e.sent)){e.next=12;break}return e.next=6,this.getCompress();case 6:for(n=e.sent;t.length<8;)t="0".concat(t);for(t=t.substr(8-r),a=[],o=0;o<t.length;o+=3)a.push(t.substring(o,o+3));return e.abrupt("return","".concat(a.join("/"),".json").concat(n?"z":""));case 12:return e.abrupt("return","");case 13:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"hash",value:function(e){return s(Buffer.from(e)).toString("hex").toLowerCase().replace("-","n")}}]),e}(),D=function(e){q(a,i.BaseAdapter);var t,r,n=A(a);function a(e,t,r){var i;L(this,a),i=n.call(this,e,t,r);var c=o.readConfObject(e,"namesIndexLocation");if(!c)throw new Error("must provide namesIndexLocation");return i.httpMap=new I({url:c.baseUri?new URL(c.uri,c.baseUri).href:c.uri}),i}return B(a,[{key:"loadIndexFile",value:(r=U(N.mark((function e(t){return N.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.httpMap.getBucket(t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"searchIndex",value:(t=U(N.mark((function e(t){var r,n,a,o;return N.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.searchType,n=t.queryString,e.t0=this.tracksNames,e.t0){e.next=6;break}return e.next=5,this.httpMap.getTrackNames();case 5:e.t0=e.sent;case 6:return a=e.t0,e.next=9,this.loadIndexFile(n.toLowerCase());case 9:if(!(o=e.sent)[n]){e.next=12;break}return e.abrupt("return",this.formatResults(o[n],a,r));case 12:return e.abrupt("return",[]);case 13:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"formatResults",value:function(e,t,r){return[].concat(E("exact"===r?[]:e.prefix.map((function(e){return new c({label:"object"===k(e)?e.name:e,matchedAttribute:"name",matchedObject:{result:e}})}))),E(e.exact.map((function(e){var r=e[0],n=e[1],a=e[4],o=e[5],i="".concat(e[3]||r,":").concat(a,"-").concat(o);return new c({locString:i,label:r,matchedAttribute:"name",matchedObject:e,trackId:t[n]})})))).filter((function(e){return"too many matches"!==e.getLabel()}))}},{key:"freeResources",value:function(){}}]),a}(),M=o.ConfigurationSchema("JBrowse1TextSearchAdapter",{namesIndexLocation:{type:"fileLocation",defaultValue:{uri:"/volvox/names",locationType:"UriLocation"},description:"the location of the JBrowse1 names index data directory"},tracks:{type:"stringArray",defaultValue:[],description:"List of tracks covered by text search adapter"},assemblyNames:{type:"stringArray",defaultValue:[],description:"List of assemblies covered by text search adapter"}},{explicitlyTyped:!0,explicitIdentifier:"textSearchAdapterId"}),V=o.ConfigurationSchema("JBrowse1Connection",{dataDirLocation:{type:"fileLocation",defaultValue:{uri:"http://mysite.com/jbrowse/data/",locationType:"UriLocation"},description:"the location of the JBrowse 1 data directory, often something like http://mysite.com/jbrowse/data/"},assemblyNames:{description:"name of the assembly the connection belongs to, should be a single entry",type:"stringArray",defaultValue:[]}},{baseConfiguration:f.baseConnectionConfig});function G(e){return e&&e.label&&"string"==typeof e.label}function W(e,t){for(var r=0,n=Object.keys(t);r<n.length;r++){var a=n[r];a in e&&"object"===k(t[a])&&"object"===k(e[a])?W(e[a],t[a]):void 0!==e[a]&&void 0===t[a]||(e[a]=t[a])}return e}function z(e){if(!e||"object"!==k(e)||"[object Function]"===Object.prototype.toString.call(e))return e;if(e.nodeType&&"cloneNode"in e)return e.cloneNode(!0);if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp)return new RegExp(e);var t,r,n;if(Array.isArray(e))for(t=[],r=0,n=e.length;r<n;++r)r in e&&(t[r]=z(e[r]));else t=e.constructor?new e.constructor:{};return function(e,t,r){var n,a,o={};for(n in t)a=t[n],n in e&&(e[n]===a||n in o&&o[n]===a)||(e[n]=r?r(a):a);return e}(t,e,z)}function $(e,t){if("string"==typeof e){var r;try{r=JSON.parse(e)}catch(e){throw new Error("".concat(e," when parsing configuration."))}return Y(r,t)}return Y(e,t)}function H(e,t){var r;try{r=function(e,t){var r,n,a,o,i=[],c={tracks:{}};function s(){var e;if(void 0!==a)try{var s=a.match(/^json:(.+)/i);if(e=s?JSON.parse(s[1]):/^[+-]?[\d.,]+([eE][-+]?\d+)?$/.test(a)?parseFloat(a.replace(/,/g,"")):a,!r)throw new Error("Error parsing in section ".concat(i.join(" - ")));var u=i.concat(r).join(".");if("+="===n){var l=d(c,u);l?Array.isArray(l)||(l=[l]):l=[],l.push(e),e=l}"true"===e&&(e=!0),"false"===e&&(e=!1),y(c,u,e)}catch(e){throw new Error("syntax error".concat(t?" in ".concat(t):"").concat(o?" at line ".concat(o-1):""))}}return e.split("\n").forEach((function(e,t){o=t+1;var c,u,l=e.replace(/^\s*#.+/,"");if(c=l.match(/^\s*\[([^\]]+)/))s(),r=void 0,a=void 0,1===(i=c[1].trim().split(/\s*\.\s*/)).length&&"general"===i[0].toLowerCase()&&(i=[]);else if(c=l.match(void 0===a?/^([^+=]+)(\+?=)(.*)/:/^(\S[^+=]+)(\+?=)(.*)/)){s(),r=c[1].trim().split(/\s*\.\s*/);var f=function(e){if(Array.isArray(e))return e}(u=c)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,a,o=[],i=!0,c=!1;try{for(r=r.call(e);!(i=(n=r.next()).done)&&(o.push(n.value),3!==o.length);i=!0);}catch(e){c=!0,a=e}finally{try{i||null==r.return||r.return()}finally{if(c)throw a}}return o}}(u)||O(u,3)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}();n=f[2],"include"===i.concat(r).join(".")&&(n="+="),a=c[3].trim()}else void 0!==r&&(c=l.match(/^\s{0,4}\+\s*(.+)/))?(s(),n="+=",a=c[1].trim()):void 0!==a&&(c=l.match(/^\s+(\S.*)/))?a+=a.length?" ".concat(c[1].trim()):c[1].trim():(s(),r=void 0,a=void 0)})),s(),c}(e,t)}catch(e){throw new Error("".concat(e," when parsing configuration."))}return Y(r,t)}function Y(e,t){if(e.tracks&&!Array.isArray(e.tracks))if(G(e.tracks))e.tracks=[e.tracks];else{for(var r=[],n=0,a=Object.keys(e.tracks);n<a.length;n++){var o=a[n],i=e.tracks[o];G(i)?r.push(i):r.push(x({label:o},i))}e.tracks=r}var c,s=e.trackMetadata;if(s&&s.sources){if("string"==typeof s.sources&&(s.sources=[s.sources]),(c=s.sources)&&c.url&&"string"==typeof c.url&&(s.sources=[s.sources]),!Array.isArray(s.sources)){for(var u=[],l=0,f=Object.keys(s.sources);l<f.length;l++){var p=f[l],h=s.sources[p];"name"in h||(h.name=p),u.push(h)}s.sources=u}s.sources=s.sources.map((function(e){if("string"==typeof e){var t={url:e},r=e.match(/\.(\w+)$/);return r&&(t.type=r[1].toLowerCase()),t}return e}))}if(e.sourceUrl=e.sourceUrl||t,e.sourceUrl.startsWith("/")&&(e.sourceUrl=new URL(e.sourceUrl,window.location.href).href),e.baseUrl=e.baseUrl||new URL(".",e.sourceUrl).href,e.baseUrl.length&&!e.baseUrl.endsWith("/")&&(e.baseUrl+="/"),e.sourceUrl){var d=[];e.tracks&&d.push.apply(d,E(e.tracks)),e.stores&&d.push.apply(d,E(Object.values(e.stores))),e.names&&d.push(e.names),d.forEach((function(t){t.baseUrl||(t.baseUrl=e.baseUrl||"/")})),e.refSeqs&&"string"==typeof e.refSeqs&&(e.refSeqs=new URL(e.refSeqs,e.sourceUrl).href),e.nameUrl&&(e.nameUrl=new URL(e.nameUrl,e.sourceUrl).href)}return e.stores=e.stores||{},(e.tracks||[]).forEach((function(t){if(t.config){var r=t.config;delete t.config,t=x(x({},r),t)}var n;t.store||(n="FeatureTrack"===t.type?"JBrowse/View/Track/HTMLFeatures":"ImageTrack"===t.type?"JBrowse/View/Track/FixedImage":"ImageTrack.Wiggle"===t.type?"JBrowse/View/Track/FixedImage/Wiggle":"SequenceTrack"===t.type?"JBrowse/View/Track/Sequence":X("JBrowse/View/Track",t.type),t.type=n,Q(e,t),t.histograms&&(t.histograms.baseUrl||(t.histograms.baseUrl=t.baseUrl),Q(e,t.histograms)))})),e}function X(e,t){return t?(t.includes("/")||(t="".concat(e,"/").concat(t)),t=t.replace(/^\//,"")):""}function Q(e,t){var r,n=t.urlTemplate,a=void 0===n?"":n;if(r=t.storeClass?X("JBrowse/Store",t.storeClass):function(e,t){return e?e.type&&e.type.includes("/FixedImage")?"JBrowse/Store/TiledImage/Fixed".concat(0===e.backendVersion?"_v0":""):/\.jsonz?$/i.test(t)?"JBrowse/Store/SeqFeature/NCList".concat(0===e.backendVersion?"_v0":""):/\.bam$/i.test(t)?"JBrowse/Store/SeqFeature/BAM":/\.cram$/i.test(t)?"JBrowse/Store/SeqFeature/CRAM":/\.gff3?$/i.test(t)?"JBrowse/Store/SeqFeature/GFF3":/\.bed$/i.test(t)?"JBrowse/Store/SeqFeature/BED":/\.vcf.b?gz$/i.test(t)?"JBrowse/Store/SeqFeature/VCFTabix":/\.gff3?.b?gz$/i.test(t)?"JBrowse/Store/SeqFeature/GFF3Tabix":/\.bed.b?gz$/i.test(t)?"JBrowse/Store/SeqFeature/BEDTabix":/\.(bw|bigwig)$/i.test(t)?"JBrowse/Store/SeqFeature/BigWig":/\.(bb|bigbed)$/i.test(t)?"JBrowse/Store/SeqFeature/BigBed":/\.(fa|fasta)$/i.test(t)?"JBrowse/Store/SeqFeature/IndexedFasta":/\.(fa|fasta)\.b?gz$/i.test(t)?"JBrowse/Store/SeqFeature/BgzipIndexedFasta":/\.2bit$/i.test(t)?"JBrowse/Store/SeqFeature/TwoBit":e.type&&e.type.endsWith("/Sequence")?"JBrowse/Store/Sequence/StaticChunked":"":""}(t,a)){var o=x(x({},t),{},{type:r});o.name="JBrowse/Store/Sequence/StaticChunked"!==r&&"JBrowse/Store/Sequence/IndexedFasta"!==r&&"JBrowse/Store/SeqFeature/IndexedFasta"!==r&&"JBrowse/Store/SeqFeature/BgzipIndexedFasta"!==r&&"JBrowse/Store/SeqFeature/TwoBit"!==r&&"JBrowse/Store/Sequence/TwoBit"!==r&&!t.useAsRefSeqStore||e.stores&&e.stores.refseqs?"store".concat(l.objectHash(o)):"refseqs",e.stores||(e.stores={}),e.stores[o.name]=o,t.store=o.name}else console.warn("Unable to determine an appropriate data store to use with track '".concat(t.label,"', please explicitly specify a storeClass in the configuration."))}function K(e){return void 0!==e.uri}function Z(e){return void 0!==e.localPath}function ee(){return(ee=U(N.mark((function e(){var t,r,n,a,o,i,c,s,u,l,f,p,h,d,y=arguments;return N.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=y.length>1&&void 0!==y[1]?y[1]:{include:["{dataRoot}/trackList.json","{dataRoot}/tracks.conf"]},n=y.length>2&&void 0!==y[2]?y[2]:{uri:"",locationType:"UriLocation"},a="uri"in(t=y.length>0&&void 0!==y[0]?y[0]:{uri:"",locationType:"UriLocation"})?"uri":"localPath",o=JSON.parse(JSON.stringify(t)),i="",K(t)&&(i=t.uri),Z(t)&&(i=t.localPath),i.endsWith("/")&&(o[a]=i.slice(0,i.length-1)),!(K(n)&&n.uri||Z(n)&&n.localPath)){e.next=35;break}c="uri"in n?"uri":"localPath",s="",K(n)&&(s=n.uri),Z(n)&&(s=n.localPath),s.endsWith("/")&&(s=s.slice(0,s.length-1)),u={},l=0,f=["jbrowse.conf","jbrowse_conf.json"];case 17:if(!(l<f.length)){e.next=33;break}return p=f[l],h=null,e.prev=20,e.next=23,ne(F({},c,"".concat(s,"/").concat(p)));case 23:h=e.sent,e.next=29;break;case 26:e.prev=26,e.t0=e.catch(20),console.error("tried to access ".concat(s,"/").concat(p,", but failed"));case 29:u=ie(u,h)||{};case 30:l++,e.next=17;break;case 33:return o[a]&&(u.dataRoot=o[a]),e.abrupt("return",te(u));case 35:return d=Y(r,window.location.href),o[a]&&(d.dataRoot=o[a]),e.abrupt("return",te(d));case 38:case"end":return e.stop()}}),e,null,[[20,26]])})))).apply(this,arguments)}function te(e){return re.apply(this,arguments)}function re(){return(re=U(N.mark((function e(t){var r,n,a=arguments;return N.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=W(z(a.length>1&&void 0!==a[1]?a[1]:pe),t),e.next=4,se(r);case 4:return fe(n=ie(n=e.sent,t)||n,n),he(n),e.abrupt("return",n);case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ne(e){return ae.apply(this,arguments)}function ae(){return(ae=U(N.mark((function e(t){var r;return N.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,h.openLocation(t).readFile("utf8");case 2:if("string"==typeof(r=e.sent)){e.next=5;break}throw new Error("Error opening location: ".concat(t));case 5:if(!K(t)){e.next=7;break}return e.abrupt("return",oe(r,t.uri));case 7:if(!Z(t)){e.next=9;break}return e.abrupt("return",oe(r,t.localPath));case 9:return e.abrupt("return",oe(r));case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function oe(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return e.trim().startsWith("{")?$(e,t):H(e,t)}function ie(e,t){if(null===t)return null;null===e&&(e={});for(var r=0,n=Object.keys(t);r<n.length;r++){var a=n[r];if("tracks"===a&&a in e){var o=e[a]||[],i=t[a]||[];if(!Array.isArray(o)||!Array.isArray(i))throw new Error("Track config has not been properly regularized: ".concat(o," ").concat(i));e[a]=ce(o||[],i||[])}else"datasets"!==a&&a in e&&"object"===k(t[a])&&"object"===k(e[a])?e[a]=W(e[a],t[a]):"dataRoot"===a?(void 0===e[a]||"data"===e[a]&&void 0!==t[a])&&(e[a]=t[a]):void 0!==e[a]&&void 0===t[a]||(e[a]=t[a])}return e}function ce(e,t){if(!t.length)return e;var r={};return e.forEach((function(e,t){e.index=t,r[e.label]=e})),t.forEach((function(t){var n=r[t.label];n?ie(n,t):e.push(t)})),e}function se(e){return ue.apply(this,arguments)}function ue(){return(ue=U(N.mark((function e(t){var r,n;return N.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=function(){return(n=U(N.mark((function e(n,a){var o,i,c,s;return N.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=n.sourceUrl||n.baseUrl){e.next=3;break}throw new Error("Could not determine source URL: ".concat(JSON.stringify(n)));case 3:if(i=ie(z(a),n)){e.next=6;break}throw new Error("Problem merging configs");case 6:return c=fe(le(n.include||[]),i),delete n.include,s=c.map(function(){var e=U(N.mark((function e(n){return N.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.cacheBuster=t.cacheBuster,e.next=3,ne({uri:new URL(n.url,o).href,locationType:"UriLocation"});case 3:return e.abrupt("return",r(e.sent,i));case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),e.next=11,Promise.all(s);case 11:return e.sent.forEach((function(e){n=ie(n,e)||n})),e.abrupt("return",n);case 14:case"end":return e.stop()}}),e)})))).apply(this,arguments)},r=function(e,t){return n.apply(this,arguments)},t=z(t),e.abrupt("return",r(t,{}));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function le(e){return e?(Array.isArray(e)||(e=[e]),e.map((function(e){return"string"==typeof e&&(e={url:e}),"format"in e||(e.format=e.url.endsWith(".conf")?"conf":"JB_json"),"JB_json"!==e.format||"version"in e||(e.version=1),e}))):[]}function fe(e,t){if(!e)return e;if(Array.isArray(e))for(var r=0;r<e.length;r+=1)e[r]=fe(e[r],t);else if("object"===k(e))for(var n=e,a=0,o=Object.keys(n);a<o.length;a++){var i=o[a];n[i]=fe(n[i],t)}else if("string"==typeof e)return function(e,t){var r=this;return e.replace(/\{([\w\s.]+)\}/g,(function(e,n){n=n.replace(/\s+/g,"");var a=d(t,n);if(void 0!==a)return"function"==typeof a?a(n):a;if(t.callback){var o=t.callback.call(r,n);if(void 0!==o)return o}return e}))}(e,t);return e}var pe={tracks:[],containerID:"GenomeBrowser",dataRoot:"data",show_tracklist:!0,show_nav:!0,show_menu:!0,show_overview:!0,show_fullviewlink:!0,update_browser_title:!0,updateBrowserURL:!0,refSeqs:"{dataRoot}/seq/refSeqs.json",include:["jbrowse.conf","jbrowse_conf.json"],nameUrl:"{dataRoot}/names/root.json",datasets:{_DEFAULT_EXAMPLES:!0,volvox:{url:"?data=sample_data/json/volvox",name:"Volvox Example"},modencode:{url:"?data=sample_data/json/modencode",name:"MODEncode Example"},yeast:{url:"?data=sample_data/json/yeast",name:"Yeast Example"}},highlightSearchedRegions:!1,highResolutionMode:"auto"};function he(e){if(e.tracks||(e.tracks=[]),!e.baseUrl)throw new Error("Must provide a `baseUrl` in configuration")}function de(e){return p.types.compose("JBrowse1Connection",f.BaseConnectionModelFactory(e),p.types.model({configuration:o.ConfigurationReference(V),type:p.types.literal("JBrowse1Connection")}).actions((function(e){return{connect:function(){var t=o.readConfObject(e.configuration,"dataDirLocation"),r=l.getSession(e);(function(){return ee.apply(this,arguments)})(t).then((function(t){var n=o.readConfObject(e.configuration,"assemblyNames")[0];if(!n)throw new Error("assembly name required for JBrowse 1 connection");var a=r.assemblies.find((function(e){return o.readConfObject(e,"name")===n})),i=o.readConfObject(a,["sequence","adapter"]),c=t.tracks.map((function(e){var r=function(e,t,r){var n={trackId:l.objectHash(e),name:e.key||e.label},a=e.metadata&&(e.metadata.description||e.metadata.Description);a&&(n.description=a);var o=e.category||e.metadata&&e.metadata.category;n.category=o?o.split(/\s*\/\s*/):[];var i=e.storeClass;if(!e.urlTemplate){if(!i||!i.endsWith("FromConfig")){var c=e.key||e.label;return console.warn('Could not import JBrowse1 track "'.concat(c,'" because it does not have a "urlTemplate" or is not a "FromConfig" track')),u.generateUnsupportedTrackConf(n.name,c,n.category)}return function(e,t){var r=(e.features||[]).map((function(e){var t=JSON.parse(JSON.stringify(e));return t.refName=e.seq_id,t.uniqueId="".concat(e.seq_id,":").concat(e.start,"-").concat(e.end,":").concat(e.name||""),t}));return t.adapter={type:"FromConfigAdapter",features:r},t.type="FeatureTrack",t}(e,n)}var s=function(e){return new URL(e,"".concat(t,"/")).href.replace(/%7B/gi,"{").replace(/%7D/gi,"}")},f=s(e.urlTemplate);if(i){if("JBrowse/Store/SeqFeature/BAM"===i){var p={type:"BamAdapter",bamLocation:{uri:f,locationType:"UriLocation"}};return p.index=e.baiUrlTemplate?{location:{uri:s(e.baiUrlTemplate),locationType:"UriLocation"}}:e.csiUrlTemplate?{location:{uri:s(e.csiUrlTemplate),locationType:"UriLocation"},indexType:"CSI"}:{location:{uri:"".concat(f,".bai"),locationType:"UriLocation"}},x(x({},n),{},{type:"AlignmentsTrack",adapter:p})}if("JBrowse/Store/SeqFeature/CRAM"===i){var h={type:"CramAdapter",cramLocation:{uri:f,locationType:"UriLocation"},sequenceAdapter:r};return h.craiLocation=e.craiUrlTemplate?{uri:s(e.craiUrlTemplate),locationType:"UriLocation"}:{uri:"".concat(f,".crai"),locationType:"UriLocation"},x(x({},n),{},{type:"AlignmentsTrack",adapter:h})}if("JBrowse/Store/SeqFeature/NCList"===i)return x(x({},n),{},{type:"FeatureTrack",adapter:{type:"NCListAdapter",rootUrlTemplate:{uri:f,locationType:"UriLocation"}}});if("JBrowse/Store/SeqFeature/BigWig"===i||"JBrowse/Store/BigWig"===i)return e.type&&e.type.endsWith("XYPlot")?n.defaultRendering="xyplot":e.type&&e.type.endsWith("Density")&&(n.defaultRendering="density"),x(x({},n),{},{type:"QuantitativeTrack",adapter:{type:"BigWigAdapter",bigWigLocation:{uri:f,locationType:"UriLocation"}}});if("JBrowse/Store/SeqFeature/VCFTabix"===i){var d={type:"VcfTabixAdapter",vcfGzLocation:{uri:f,locationType:"UriLocation"}};return d.index=e.tbiUrlTemplate?{location:{uri:s(e.tbiUrlTemplate),locationType:"UriLocation"}}:e.csiUrlTemplate?{location:{uri:s(e.csiUrlTemplate),locationType:"UriLocation"},indexType:"CSI"}:{location:{uri:"".concat(f,".tbi"),locationType:"UriLocation"}},x(x({},n),{},{type:"VariantTrack",adapter:d})}if("JBrowse/Store/SeqFeature/VCFTribble"===i)return u.generateUnsupportedTrackConf(n.name,"VCFTribble (".concat(f,")"),n.category);if("JBrowse/Store/SeqFeature/GFF3"===i)return u.generateUnsupportedTrackConf(n.name,"GFF3 (".concat(f,")"),n.category);if("JBrowse/Store/SeqFeature/BigBed"===i)return x(x({},n),{},{type:"FeatureTrack",adapter:{type:"BigBedAdapter",bigBedLocation:{uri:f,locationType:"UriLocation"}}});if("JBrowse/Store/SeqFeature/GFF3Tabix"===i){var y={type:"Gff3TabixAdapter",gffGzLocation:{uri:f,locationType:"UriLocation"}};return y.index=e.tbiUrlTemplate?{location:{uri:s(e.tbiUrlTemplate),locationType:"UriLocation"}}:e.csiUrlTemplate?{location:{uri:s(e.csiUrlTemplate),locationType:"UriLocation"},indexType:"CSI"}:{location:{uri:"".concat(f,".tbi"),locationType:"UriLocation"}},x(x({},n),{},{type:"FeatureTrack",adapter:y})}if("JBrowse/Store/SeqFeature/BED"===i)return u.generateUnsupportedTrackConf(n.name,"BED (".concat(f,")"),n.category);if("JBrowse/Store/SeqFeature/BEDTabix"===i){var m={type:"BedTabixAdapter",bedGzLocation:{uri:f,locationType:"UriLocation"}};return m.index=e.tbiUrlTemplate?{location:{uri:s(e.tbiUrlTemplate),locationType:"UriLocation"}}:e.csiUrlTemplate?{location:{uri:s(e.csiUrlTemplate),locationType:"UriLocation"},indexType:"CSI"}:{location:{uri:"".concat(f,".tbi"),locationType:"UriLocation"}},x(x({},n),{},{type:"FeatureTrack",adapter:m})}if("JBrowse/Store/SeqFeature/GTF"===i)return u.generateUnsupportedTrackConf(n.name,"GTF (".concat(f,")"),n.category);if("JBrowse/Store/SeqFeature/StaticChunked"===i||"JBrowse/Store/Sequence/StaticChunked"===i)return u.generateUnsupportedTrackConf(n.name,"StaticChunked (".concat(f,")"),n.category);if("JBrowse/Store/SeqFeature/UnindexedFasta"===i)return u.generateUnsupportedTrackConf(n.name,"UnindexedFasta (".concat(f,")"),n.category);if("JBrowse/Store/SeqFeature/IndexedFasta"===i){var v={type:"IndexedFastaAdapter",fastaLocation:{uri:f,locationType:"UriLocation"}};return v.faiLocation=e.faiUrlTemplate?{uri:s(e.faiUrlTemplate),locationType:"UriLocation"}:{uri:"".concat(f,".fai"),locationType:"UriLocation"},x(x({},n),{},{type:"SequenceTrack",adapter:v})}if("JBrowse/Store/SeqFeature/BgzipIndexedFasta"===i){var g={type:"BgzipFastaAdapter",fastaLocation:{uri:f,locationType:"UriLocation"}};return g.faiLocation=e.faiUrlTemplate?{uri:s(e.faiUrlTemplate),locationType:"UriLocation"}:{uri:"".concat(f,".fai"),locationType:"UriLocation"},g.gziLocation=e.gziUrlTemplate?{uri:s(e.gziUrlTemplate),locationType:"UriLocation"}:{uri:"".concat(f,".gzi"),locationType:"UriLocation"},x(x({},n),{},{type:"ReferenceSequenceTrack",adapter:g})}if("JBrowse/Store/SeqFeature/TwoBit"===i)return x(x({},n),{},{type:"ReferenceSequenceTrack",adapter:{type:"TwoBitAdapter",twoBitLocation:{uri:f,locationType:"UriLocation"}}})}if(n.adapter=u.guessAdapter({uri:f,locationType:"UriLocation"},void 0,f),!n.adapter)throw new Error("Could not determine adapter");return n.adapter.type===u.UNSUPPORTED?u.generateUnsupportedTrackConf(n.name,f,n.category):n.adapter.type===u.UNKNOWN?u.generateUnknownTrackConf(n.name,f,n.category):(n.type=u.guessTrackType(n.adapter.type),"QuantitativeTrack"===n.type&&(e.type&&e.type.endsWith("XYPlot")?n.defaultRendering="xyplot":e.type&&e.type.endsWith("Density")&&(n.defaultRendering="density")),n)}(e,t.dataRoot,i);return r.assemblyNames=[n],r}));e.setTrackConfs(c)})).catch((function(t){console.error(t),r.notify('There was a problem connecting to the JBrowse 1 data directory "'.concat(e.name,'". Please make sure you have entered a valid location. The error that was thrown is: "').concat(t,'"'),"error"),r.breakConnection(e.configuration)}))}}})))}var ye=function(e){q(i,a);var o=A(i);function i(){var e;return L(this,i),(e=o.apply(this,arguments)).name="LegacyJBrowsePlugin",e}return B(i,[{key:"install",value:function(e){e.addAdapterType((function(){return new t({name:"NCListAdapter",configSchema:_,getAdapterClass:function(){return Promise.resolve().then((function(){return be})).then((function(e){return e.default}))}})})),e.addToExtensionPoint("Core-guessAdapterForLocation",(function(e){return function(t,r,n){var a=u.getFileName(t);return/trackData.jsonz?$/i.test(a)||"NCListAdapter"===n?{type:"NCListAdapter",rootUrlTemplate:t}:e(t,r,n)}})),e.addTextSearchAdapterType((function(){return new r({name:"JBrowse1TextSearchAdapter",configSchema:M,AdapterClass:D,description:"A JBrowse 1 text search adapter"})})),e.addConnectionType((function(){return new n({name:"JBrowse1Connection",configSchema:V,stateModel:de(e),displayName:"JBrowse 1 Data",description:"A JBrowse 1 data directory",url:"//jbrowse.org/"})}))}}]),i}(),me={refName:"seq_id"},ve={seq_id:"refName"},ge=function(){function e(t,r,n){L(this,e),this.ncFeature=t,this.uniqueId=n||t.id(),this.parentHandle=r}return B(e,[{key:"set",value:function(){throw new Error("not implemented")}},{key:"jb2TagToJb1Tag",value:function(e){return(me[e]||e).toLowerCase()}},{key:"jb1TagToJb2Tag",value:function(e){var t=e.toLowerCase();return ve[t]||t}},{key:"get",value:function(t){var r=this,n=this.ncFeature.get(this.jb2TagToJb1Tag(t));return n&&"subfeatures"===t?n.map((function(t){return new e(t,r)})):n}},{key:"tags",value:function(){var e=this;return this.ncFeature.tags().map((function(t){return e.jb1TagToJb2Tag(t)}))}},{key:"id",value:function(){return this.uniqueId}},{key:"parent",value:function(){return this.parentHandle}},{key:"children",value:function(){return this.get("subfeatures")}},{key:"toJSON",value:function(){var t=this,r={uniqueId:this.id()};return this.ncFeature.tags().forEach((function(n){var a=t.jb1TagToJb2Tag(n),o=t.ncFeature.get(n);"subfeatures"===a?r.subfeatures=(o||[]).map((function(r){return new e(r,t).toJSON()})):r[a]=o})),r}}]),e}(),be={__proto__:null,default:function(e){q(n,i.BaseFeatureDataAdapter);var t,r=A(n);function n(e,t,a){var i;L(this,n),i=r.call(this,e,t,a);var c=o.readConfObject(e,"refNames"),s=o.readConfObject(e,"rootUrlTemplate");return i.configRefNames=c,i.nclist=new m({baseUrl:"",urlTemplate:s.uri,readFile:function(e){return new g.RemoteFile(String(s.baseUri?new URL(e,s.baseUri).toString():e)).readFile()}}),i}return B(n,[{key:"getFeatures",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return v.ObservableCreate(function(){var n=U(N.mark((function n(a){var o,i,c,s,u,f,p;return N.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:o=r.signal,i=!1,c=!1,n.prev=3,u=b(t.nclist.getFeatures(e,r));case 5:return n.next=7,u.next();case 7:if(!(i=!(f=n.sent).done)){n.next=14;break}p=f.value,l.checkAbortSignal(o),a.next(t.wrapFeature(p));case 11:i=!1,n.next=5;break;case 14:n.next=20;break;case 16:n.prev=16,n.t0=n.catch(3),c=!0,s=n.t0;case 20:if(n.prev=20,n.prev=21,!i||null==u.return){n.next=25;break}return n.next=25,u.return();case 25:if(n.prev=25,!c){n.next=28;break}throw s;case 28:return n.finish(25);case 29:return n.finish(20);case 30:a.complete();case 31:case"end":return n.stop()}}),n,null,[[3,16,20,30],[21,,25,29]])})));return function(e){return n.apply(this,arguments)}}())}},{key:"wrapFeature",value:function(e){return new ge(e,void 0,"".concat(this.id,"-").concat(e.id()))}},{key:"hasDataForRefName",value:(t=U(N.mark((function e(t){var r;return N.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.nclist.getDataRoot(t);case 2:return e.abrupt("return",!!((r=e.sent)&&r.stats&&r.stats.featureCount));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"getRefNames",value:function(){return Promise.resolve(this.configRefNames||[])}},{key:"freeResources",value:function(){}}]),n}()};exports.default=ye;
1
+ "use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=e(require("@jbrowse/core/pluggableElementTypes/AdapterType")),r=e(require("@jbrowse/core/pluggableElementTypes/TextSearchAdapterType")),n=e(require("@jbrowse/core/pluggableElementTypes/ConnectionType")),a=e(require("@jbrowse/core/Plugin")),o=require("@jbrowse/core/configuration"),i=require("@jbrowse/core/data_adapters/BaseAdapter"),c=e(require("@jbrowse/core/TextSearch/BaseResults")),s=e(require("buffer-crc32")),u=require("@jbrowse/core/util/tracks"),l=require("@jbrowse/core/util"),f=require("@jbrowse/core/pluggableElementTypes/models"),p=require("mobx-state-tree"),h=require("@jbrowse/core/util/io"),d=e(require("get-value")),y=e(require("set-value")),v=e(require("@gmod/nclist")),m=require("@jbrowse/core/util/rxjs"),b=require("generic-filehandle");function g(e){var t,r,n,a=2;for("undefined"!=typeof Symbol&&(r=Symbol.asyncIterator,n=Symbol.iterator);a--;){if(r&&null!=(t=e[r]))return t.call(e);if(n&&null!=(t=e[n]))return new w(t.call(e));r="@@asyncIterator",n="@@iterator"}throw new TypeError("Object is not async iterable")}function w(e){function t(e){if(Object(e)!==e)return Promise.reject(new TypeError(e+" is not an object."));var t=e.done;return Promise.resolve(e.value).then((function(e){return{value:e,done:t}}))}return(w=function(e){this.s=e,this.n=e.next}).prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(e){var r=this.s.return;return void 0===r?Promise.resolve({value:e,done:!0}):t(r.apply(this.s,arguments))},throw:function(e){var r=this.s.return;return void 0===r?Promise.reject(e):t(r.apply(this.s,arguments))}},new w(e)}function T(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function x(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?T(Object(r),!0).forEach((function(t){F(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):T(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function k(e){return(k="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function S(e,t,r,n,a,o,i){try{var c=e[o](i),s=c.value}catch(e){return void r(e)}c.done?t(s):Promise.resolve(s).then(n,a)}function U(e){return function(){var t=this,r=arguments;return new Promise((function(n,a){var o=e.apply(t,r);function i(e){S(o,n,a,i,c,"next",e)}function c(e){S(o,n,a,i,c,"throw",e)}i(void 0)}))}}function L(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function j(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function B(e,t,r){return t&&j(e.prototype,t),r&&j(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function F(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function q(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");Object.defineProperty(e,"prototype",{value:Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),writable:!1}),t&&(Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function C(e){return(C=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function J(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function O(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=C(e);if(t){var a=C(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return J(this,r)}}function A(e){return function(e){if(Array.isArray(e))return R(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||E(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function E(e,t){if(e){if("string"==typeof e)return R(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?R(e,t):void 0}}function R(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var _=o.ConfigurationSchema("NCListAdapter",{rootUrlTemplate:{type:"fileLocation",defaultValue:{uri:"/path/to/my/{refseq}/trackData.json",locationType:"UriLocation"}},refNames:{type:"stringArray",defaultValue:[],description:"List of refNames used by the NCList used for aliasing"}},{explicitlyTyped:!0});function P(e,t){return e(t={exports:{}},t.exports),t.exports}var N=P((function(e){var t=function(e){var t=Object.prototype,r=t.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},a=n.iterator||"@@iterator",o=n.asyncIterator||"@@asyncIterator",i=n.toStringTag||"@@toStringTag";function c(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,r){return e[t]=r}}function s(e,t,r,n){var a=Object.create((t&&t.prototype instanceof f?t:f).prototype),o=new k(n||[]);return a._invoke=function(e,t,r){var n="suspendedStart";return function(a,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===a)throw o;return{value:void 0,done:!0}}for(r.method=a,r.arg=o;;){var i=r.delegate;if(i){var c=w(i,r);if(c){if(c===l)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var s=u(e,t,r);if("normal"===s.type){if(n=r.done?"completed":"suspendedYield",s.arg===l)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n="completed",r.method="throw",r.arg=s.arg)}}}(e,r,o),a}function u(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=s;var l={};function f(){}function p(){}function h(){}var d={};c(d,a,(function(){return this}));var y=Object.getPrototypeOf,v=y&&y(y(S([])));v&&v!==t&&r.call(v,a)&&(d=v);var m=h.prototype=f.prototype=Object.create(d);function b(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function g(e,t){var n;this._invoke=function(a,o){function i(){return new t((function(n,i){!function n(a,o,i,c){var s=u(e[a],e,o);if("throw"!==s.type){var l=s.arg,f=l.value;return f&&"object"==typeof f&&r.call(f,"__await")?t.resolve(f.__await).then((function(e){n("next",e,i,c)}),(function(e){n("throw",e,i,c)})):t.resolve(f).then((function(e){l.value=e,i(l)}),(function(e){return n("throw",e,i,c)}))}c(s.arg)}(a,o,n,i)}))}return n=n?n.then(i,i):i()}}function w(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,w(e,t),"throw"===t.method))return l;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=u(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,l;var a=n.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,l):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,l)}function T(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function x(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function k(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(T,this),this.reset(!0)}function S(e){if(e){var t=e[a];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,o=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return o.next=o}}return{next:U}}function U(){return{value:void 0,done:!0}}return p.prototype=h,c(m,"constructor",h),c(h,"constructor",p),p.displayName=c(h,i,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===p||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,h):(e.__proto__=h,c(e,i,"GeneratorFunction")),e.prototype=Object.create(m),e},e.awrap=function(e){return{__await:e}},b(g.prototype),c(g.prototype,o,(function(){return this})),e.AsyncIterator=g,e.async=function(t,r,n,a,o){void 0===o&&(o=Promise);var i=new g(s(t,r,n,a),o);return e.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},b(m),c(m,i,"Generator"),c(m,a,(function(){return this})),c(m,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=S,k.prototype={constructor:k,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(x),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return i.type="throw",i.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var a=this.tryEntries.length-1;a>=0;--a){var o=this.tryEntries[a],i=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var c=r.call(o,"catchLoc"),s=r.call(o,"finallyLoc");if(c&&s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(c){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,l):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),l},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),x(r),l}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var a=n.arg;x(r)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:S(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},e}(e.exports);try{regeneratorRuntime=t}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}})),I=function(){function e(t){L(this,e),this.url=/\/$/.test(t.url)?t.url:"".concat(t.url,"/")}var t,r,n,a,o,i,c,u;return B(e,[{key:"readMeta",value:(u=U(N.mark((function e(){var t,r,n,a;return N.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.loadFile("meta.json");case 2:return r=(t=e.sent).compress,n=t.track_names,a=Math.ceil(t.hash_bits/4),e.abrupt("return",{hashHexCharacters:a,compress:r,tracks:n});case 6:case"end":return e.stop()}}),e,this)}))),function(){return u.apply(this,arguments)})},{key:"getHashHexCharacters",value:(c=U(N.mark((function e(){return N.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.readMeta();case 2:return e.abrupt("return",e.sent.hashHexCharacters);case 4:case"end":return e.stop()}}),e,this)}))),function(){return c.apply(this,arguments)})},{key:"getCompress",value:(i=U(N.mark((function e(){return N.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.readMeta();case 2:return e.abrupt("return",e.sent.compress);case 4:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"getTrackNames",value:(o=U(N.mark((function e(){return N.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.readMeta();case 2:return e.abrupt("return",e.sent.tracks);case 4:case"end":return e.stop()}}),e,this)}))),function(){return o.apply(this,arguments)})},{key:"get",value:(a=U(N.mark((function e(t){return N.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getBucket(t);case 2:return e.abrupt("return",e.sent[t]);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"getBucket",value:(n=U(N.mark((function e(t){var r;return N.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this.hash(t),e.next=3,this.hexToDirPath(r);case 3:return e.abrupt("return",this.loadFile(e.sent));case 5:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"loadFile",value:(r=U(N.mark((function e(t){var r;return N.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fetch("".concat(this.url).concat(t));case 2:if((r=e.sent).ok){e.next=5;break}throw new Error("HTTP ".concat(r.status," ").concat(r.statusText));case 5:return e.abrupt("return",r.json());case 6:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"hexToDirPath",value:(t=U(N.mark((function e(t){var r,n,a,o;return N.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getHashHexCharacters();case 2:if(!(r=e.sent)){e.next=12;break}return e.next=6,this.getCompress();case 6:for(n=e.sent;t.length<8;)t="0".concat(t);for(t=t.substr(8-r),a=[],o=0;o<t.length;o+=3)a.push(t.substring(o,o+3));return e.abrupt("return","".concat(a.join("/"),".json").concat(n?"z":""));case 12:return e.abrupt("return","");case 13:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"hash",value:function(e){return s(Buffer.from(e)).toString("hex").toLowerCase().replace("-","n")}}]),e}(),D=function(e){q(a,i.BaseAdapter);var t,r,n=O(a);function a(e,t,r){var i;L(this,a),i=n.call(this,e,t,r);var c=o.readConfObject(e,"namesIndexLocation");if(!c)throw new Error("must provide namesIndexLocation");return i.httpMap=new I({url:c.baseUri?new URL(c.uri,c.baseUri).href:c.uri}),i}return B(a,[{key:"loadIndexFile",value:(r=U(N.mark((function e(t){return N.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.httpMap.getBucket(t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"searchIndex",value:(t=U(N.mark((function e(t){var r,n,a,o;return N.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.searchType,n=t.queryString,e.t0=this.tracksNames,e.t0){e.next=6;break}return e.next=5,this.httpMap.getTrackNames();case 5:e.t0=e.sent;case 6:return a=e.t0,e.next=9,this.loadIndexFile(n.toLowerCase());case 9:if(!(o=e.sent)[n]){e.next=12;break}return e.abrupt("return",this.formatResults(o[n],a,r));case 12:return e.abrupt("return",[]);case 13:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"formatResults",value:function(e,t,r){return[].concat(A("exact"===r?[]:e.prefix.map((function(e){return new c({label:"object"===k(e)?e.name:e,matchedAttribute:"name",matchedObject:{result:e}})}))),A(e.exact.map((function(e){var r=e[0],n=e[1],a=e[4],o=e[5],i="".concat(e[3]||r,":").concat(a,"-").concat(o);return new c({locString:i,label:r,matchedAttribute:"name",matchedObject:e,trackId:t[n]})})))).filter((function(e){return"too many matches"!==e.getLabel()}))}},{key:"freeResources",value:function(){}}]),a}(),M=o.ConfigurationSchema("JBrowse1TextSearchAdapter",{namesIndexLocation:{type:"fileLocation",defaultValue:{uri:"/volvox/names",locationType:"UriLocation"},description:"the location of the JBrowse1 names index data directory"},tracks:{type:"stringArray",defaultValue:[],description:"List of tracks covered by text search adapter"},assemblyNames:{type:"stringArray",defaultValue:[],description:"List of assemblies covered by text search adapter"}},{explicitlyTyped:!0,explicitIdentifier:"textSearchAdapterId"}),V=o.ConfigurationSchema("JBrowse1Connection",{dataDirLocation:{type:"fileLocation",defaultValue:{uri:"http://mysite.com/jbrowse/data/",locationType:"UriLocation"},description:"the location of the JBrowse 1 data directory, often something like http://mysite.com/jbrowse/data/"},assemblyNames:{description:"name of the assembly the connection belongs to, should be a single entry",type:"stringArray",defaultValue:[]}},{baseConfiguration:f.baseConnectionConfig});function G(e){return e&&e.label&&"string"==typeof e.label}function W(e,t){for(var r=0,n=Object.keys(t);r<n.length;r++){var a=n[r];a in e&&"object"===k(t[a])&&"object"===k(e[a])?W(e[a],t[a]):void 0!==e[a]&&void 0===t[a]||(e[a]=t[a])}return e}function z(e){if(!e||"object"!==k(e)||"[object Function]"===Object.prototype.toString.call(e))return e;if(e.nodeType&&"cloneNode"in e)return e.cloneNode(!0);if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp)return new RegExp(e);var t,r,n;if(Array.isArray(e))for(t=[],r=0,n=e.length;r<n;++r)r in e&&(t[r]=z(e[r]));else t=e.constructor?new e.constructor:{};return function(e,t,r){var n,a,o={};for(n in t)a=t[n],n in e&&(e[n]===a||n in o&&o[n]===a)||(e[n]=r?r(a):a);return e}(t,e,z)}function $(e,t){if("string"==typeof e){var r;try{r=JSON.parse(e)}catch(e){throw new Error("".concat(e," when parsing configuration."))}return Y(r,t)}return Y(e,t)}function H(e,t){var r;try{r=function(e,t){var r,n,a,o,i=[],c={tracks:{}};function s(){var e;if(void 0!==a)try{var s=a.match(/^json:(.+)/i);if(e=s?JSON.parse(s[1]):/^[+-]?[\d.,]+([eE][-+]?\d+)?$/.test(a)?parseFloat(a.replace(/,/g,"")):a,!r)throw new Error("Error parsing in section ".concat(i.join(" - ")));var u=i.concat(r).join(".");if("+="===n){var l=d(c,u);l?Array.isArray(l)||(l=[l]):l=[],l.push(e),e=l}"true"===e&&(e=!0),"false"===e&&(e=!1),y(c,u,e)}catch(e){throw new Error("syntax error".concat(t?" in ".concat(t):"").concat(o?" at line ".concat(o-1):""))}}return e.split("\n").forEach((function(e,t){o=t+1;var c,u,l=e.replace(/^\s*#.+/,"");if(c=l.match(/^\s*\[([^\]]+)/))s(),r=void 0,a=void 0,1===(i=c[1].trim().split(/\s*\.\s*/)).length&&"general"===i[0].toLowerCase()&&(i=[]);else if(c=l.match(void 0===a?/^([^+=]+)(\+?=)(.*)/:/^(\S[^+=]+)(\+?=)(.*)/)){s(),r=c[1].trim().split(/\s*\.\s*/);var f=function(e){if(Array.isArray(e))return e}(u=c)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,a,o=[],i=!0,c=!1;try{for(r=r.call(e);!(i=(n=r.next()).done)&&(o.push(n.value),3!==o.length);i=!0);}catch(e){c=!0,a=e}finally{try{i||null==r.return||r.return()}finally{if(c)throw a}}return o}}(u)||E(u,3)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}();n=f[2],"include"===i.concat(r).join(".")&&(n="+="),a=c[3].trim()}else void 0!==r&&(c=l.match(/^\s{0,4}\+\s*(.+)/))?(s(),n="+=",a=c[1].trim()):void 0!==a&&(c=l.match(/^\s+(\S.*)/))?a+=a.length?" ".concat(c[1].trim()):c[1].trim():(s(),r=void 0,a=void 0)})),s(),c}(e,t)}catch(e){throw new Error("".concat(e," when parsing configuration."))}return Y(r,t)}function Y(e,t){if(e.tracks&&!Array.isArray(e.tracks))if(G(e.tracks))e.tracks=[e.tracks];else{for(var r=[],n=0,a=Object.keys(e.tracks);n<a.length;n++){var o=a[n],i=e.tracks[o];G(i)?r.push(i):r.push(x({label:o},i))}e.tracks=r}var c,s=e.trackMetadata;if(s&&s.sources){if("string"==typeof s.sources&&(s.sources=[s.sources]),(c=s.sources)&&c.url&&"string"==typeof c.url&&(s.sources=[s.sources]),!Array.isArray(s.sources)){for(var u=[],l=0,f=Object.keys(s.sources);l<f.length;l++){var p=f[l],h=s.sources[p];"name"in h||(h.name=p),u.push(h)}s.sources=u}s.sources=s.sources.map((function(e){if("string"==typeof e){var t={url:e},r=e.match(/\.(\w+)$/);return r&&(t.type=r[1].toLowerCase()),t}return e}))}if(e.sourceUrl=e.sourceUrl||t,e.sourceUrl.startsWith("/")&&(e.sourceUrl=new URL(e.sourceUrl,window.location.href).href),e.baseUrl=e.baseUrl||new URL(".",e.sourceUrl).href,e.baseUrl.length&&!e.baseUrl.endsWith("/")&&(e.baseUrl+="/"),e.sourceUrl){var d=[];e.tracks&&d.push.apply(d,A(e.tracks)),e.stores&&d.push.apply(d,A(Object.values(e.stores))),e.names&&d.push(e.names),d.forEach((function(t){t.baseUrl||(t.baseUrl=e.baseUrl||"/")})),e.refSeqs&&"string"==typeof e.refSeqs&&(e.refSeqs=new URL(e.refSeqs,e.sourceUrl).href),e.nameUrl&&(e.nameUrl=new URL(e.nameUrl,e.sourceUrl).href)}return e.stores=e.stores||{},(e.tracks||[]).forEach((function(t){if(t.config){var r=t.config;delete t.config,t=x(x({},r),t)}var n;t.store||(n="FeatureTrack"===t.type?"JBrowse/View/Track/HTMLFeatures":"ImageTrack"===t.type?"JBrowse/View/Track/FixedImage":"ImageTrack.Wiggle"===t.type?"JBrowse/View/Track/FixedImage/Wiggle":"SequenceTrack"===t.type?"JBrowse/View/Track/Sequence":X("JBrowse/View/Track",t.type),t.type=n,Q(e,t),t.histograms&&(t.histograms.baseUrl||(t.histograms.baseUrl=t.baseUrl),Q(e,t.histograms)))})),e}function X(e,t){return t?(t.includes("/")||(t="".concat(e,"/").concat(t)),t=t.replace(/^\//,"")):""}function Q(e,t){var r,n=t.urlTemplate,a=void 0===n?"":n;if(r=t.storeClass?X("JBrowse/Store",t.storeClass):function(e,t){return e?e.type&&e.type.includes("/FixedImage")?"JBrowse/Store/TiledImage/Fixed".concat(0===e.backendVersion?"_v0":""):/\.jsonz?$/i.test(t)?"JBrowse/Store/SeqFeature/NCList".concat(0===e.backendVersion?"_v0":""):/\.bam$/i.test(t)?"JBrowse/Store/SeqFeature/BAM":/\.cram$/i.test(t)?"JBrowse/Store/SeqFeature/CRAM":/\.gff3?$/i.test(t)?"JBrowse/Store/SeqFeature/GFF3":/\.bed$/i.test(t)?"JBrowse/Store/SeqFeature/BED":/\.vcf.b?gz$/i.test(t)?"JBrowse/Store/SeqFeature/VCFTabix":/\.gff3?.b?gz$/i.test(t)?"JBrowse/Store/SeqFeature/GFF3Tabix":/\.bed.b?gz$/i.test(t)?"JBrowse/Store/SeqFeature/BEDTabix":/\.(bw|bigwig)$/i.test(t)?"JBrowse/Store/SeqFeature/BigWig":/\.(bb|bigbed)$/i.test(t)?"JBrowse/Store/SeqFeature/BigBed":/\.(fa|fasta)$/i.test(t)?"JBrowse/Store/SeqFeature/IndexedFasta":/\.(fa|fasta)\.b?gz$/i.test(t)?"JBrowse/Store/SeqFeature/BgzipIndexedFasta":/\.2bit$/i.test(t)?"JBrowse/Store/SeqFeature/TwoBit":e.type&&e.type.endsWith("/Sequence")?"JBrowse/Store/Sequence/StaticChunked":"":""}(t,a)){var o=x(x({},t),{},{type:r});o.name="JBrowse/Store/Sequence/StaticChunked"!==r&&"JBrowse/Store/Sequence/IndexedFasta"!==r&&"JBrowse/Store/SeqFeature/IndexedFasta"!==r&&"JBrowse/Store/SeqFeature/BgzipIndexedFasta"!==r&&"JBrowse/Store/SeqFeature/TwoBit"!==r&&"JBrowse/Store/Sequence/TwoBit"!==r&&!t.useAsRefSeqStore||e.stores&&e.stores.refseqs?"store".concat(l.objectHash(o)):"refseqs",e.stores||(e.stores={}),e.stores[o.name]=o,t.store=o.name}else console.warn("Unable to determine an appropriate data store to use with track '".concat(t.label,"', please explicitly specify a storeClass in the configuration."))}function K(e){return void 0!==e.uri}function Z(e){return void 0!==e.localPath}function ee(){return(ee=U(N.mark((function e(){var t,r,n,a,o,i,c,s,u,l,f,p,h,d,y=arguments;return N.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=y.length>1&&void 0!==y[1]?y[1]:{include:["{dataRoot}/trackList.json","{dataRoot}/tracks.conf"]},n=y.length>2&&void 0!==y[2]?y[2]:{uri:"",locationType:"UriLocation"},a="uri"in(t=y.length>0&&void 0!==y[0]?y[0]:{uri:"",locationType:"UriLocation"})?"uri":"localPath",o=JSON.parse(JSON.stringify(t)),i="",K(t)&&(i=t.uri),Z(t)&&(i=t.localPath),i.endsWith("/")&&(o[a]=i.slice(0,i.length-1)),!(K(n)&&n.uri||Z(n)&&n.localPath)){e.next=35;break}c="uri"in n?"uri":"localPath",s="",K(n)&&(s=n.uri),Z(n)&&(s=n.localPath),s.endsWith("/")&&(s=s.slice(0,s.length-1)),u={},l=0,f=["jbrowse.conf","jbrowse_conf.json"];case 17:if(!(l<f.length)){e.next=33;break}return p=f[l],h=null,e.prev=20,e.next=23,ne(F({},c,"".concat(s,"/").concat(p)));case 23:h=e.sent,e.next=29;break;case 26:e.prev=26,e.t0=e.catch(20),console.error("tried to access ".concat(s,"/").concat(p,", but failed"));case 29:u=ie(u,h)||{};case 30:l++,e.next=17;break;case 33:return o[a]&&(u.dataRoot=o[a]),e.abrupt("return",te(u));case 35:return d=Y(r,window.location.href),o[a]&&(d.dataRoot=o[a]),e.abrupt("return",te(d));case 38:case"end":return e.stop()}}),e,null,[[20,26]])})))).apply(this,arguments)}function te(e){return re.apply(this,arguments)}function re(){return(re=U(N.mark((function e(t){var r,n,a=arguments;return N.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=W(z(a.length>1&&void 0!==a[1]?a[1]:pe),t),e.next=4,se(r);case 4:return fe(n=ie(n=e.sent,t)||n,n),he(n),e.abrupt("return",n);case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ne(e){return ae.apply(this,arguments)}function ae(){return(ae=U(N.mark((function e(t){var r;return N.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,h.openLocation(t).readFile("utf8");case 2:if(r=e.sent,!K(t)){e.next=5;break}return e.abrupt("return",oe(r,t.uri));case 5:if(!Z(t)){e.next=7;break}return e.abrupt("return",oe(r,t.localPath));case 7:return e.abrupt("return",oe(r));case 8:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function oe(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return e.trim().startsWith("{")?$(e,t):H(e,t)}function ie(e,t){if(null===t)return null;null===e&&(e={});for(var r=0,n=Object.keys(t);r<n.length;r++){var a=n[r];if("tracks"===a&&a in e){var o=e[a]||[],i=t[a]||[];if(!Array.isArray(o)||!Array.isArray(i))throw new Error("Track config has not been properly regularized: ".concat(o," ").concat(i));e[a]=ce(o||[],i||[])}else"datasets"!==a&&a in e&&"object"===k(t[a])&&"object"===k(e[a])?e[a]=W(e[a],t[a]):"dataRoot"===a?(void 0===e[a]||"data"===e[a]&&void 0!==t[a])&&(e[a]=t[a]):void 0!==e[a]&&void 0===t[a]||(e[a]=t[a])}return e}function ce(e,t){if(!t.length)return e;var r={};return e.forEach((function(e,t){e.index=t,r[e.label]=e})),t.forEach((function(t){var n=r[t.label];n?ie(n,t):e.push(t)})),e}function se(e){return ue.apply(this,arguments)}function ue(){return(ue=U(N.mark((function e(t){var r,n;return N.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=function(){return(n=U(N.mark((function e(n,a){var o,i,c,s;return N.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=n.sourceUrl||n.baseUrl){e.next=3;break}throw new Error("Could not determine source URL: ".concat(JSON.stringify(n)));case 3:if(i=ie(z(a),n)){e.next=6;break}throw new Error("Problem merging configs");case 6:return c=fe(le(n.include||[]),i),delete n.include,s=c.map(function(){var e=U(N.mark((function e(n){return N.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.cacheBuster=t.cacheBuster,e.next=3,ne({uri:new URL(n.url,o).href,locationType:"UriLocation"});case 3:return e.abrupt("return",r(e.sent,i));case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),e.next=11,Promise.all(s);case 11:return e.sent.forEach((function(e){n=ie(n,e)||n})),e.abrupt("return",n);case 14:case"end":return e.stop()}}),e)})))).apply(this,arguments)},r=function(e,t){return n.apply(this,arguments)},t=z(t),e.abrupt("return",r(t,{}));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function le(e){return e?(Array.isArray(e)||(e=[e]),e.map((function(e){return"string"==typeof e&&(e={url:e}),"format"in e||(e.format=e.url.endsWith(".conf")?"conf":"JB_json"),"JB_json"!==e.format||"version"in e||(e.version=1),e}))):[]}function fe(e,t){if(!e)return e;if(Array.isArray(e))for(var r=0;r<e.length;r+=1)e[r]=fe(e[r],t);else if("object"===k(e))for(var n=e,a=0,o=Object.keys(n);a<o.length;a++){var i=o[a];n[i]=fe(n[i],t)}else if("string"==typeof e)return function(e,t){var r=this;return e.replace(/\{([\w\s.]+)\}/g,(function(e,n){n=n.replace(/\s+/g,"");var a=d(t,n);if(void 0!==a)return"function"==typeof a?a(n):a;if(t.callback){var o=t.callback.call(r,n);if(void 0!==o)return o}return e}))}(e,t);return e}var pe={tracks:[],containerID:"GenomeBrowser",dataRoot:"data",show_tracklist:!0,show_nav:!0,show_menu:!0,show_overview:!0,show_fullviewlink:!0,update_browser_title:!0,updateBrowserURL:!0,refSeqs:"{dataRoot}/seq/refSeqs.json",include:["jbrowse.conf","jbrowse_conf.json"],nameUrl:"{dataRoot}/names/root.json",datasets:{_DEFAULT_EXAMPLES:!0,volvox:{url:"?data=sample_data/json/volvox",name:"Volvox Example"},modencode:{url:"?data=sample_data/json/modencode",name:"MODEncode Example"},yeast:{url:"?data=sample_data/json/yeast",name:"Yeast Example"}},highlightSearchedRegions:!1,highResolutionMode:"auto"};function he(e){if(e.tracks||(e.tracks=[]),!e.baseUrl)throw new Error("Must provide a `baseUrl` in configuration")}function de(e){return p.types.compose("JBrowse1Connection",f.BaseConnectionModelFactory(e),p.types.model({configuration:o.ConfigurationReference(V),type:p.types.literal("JBrowse1Connection")}).actions((function(e){return{connect:function(){var t=o.readConfObject(e.configuration,"dataDirLocation"),r=l.getSession(e);(function(){return ee.apply(this,arguments)})(t).then((function(t){var n=o.readConfObject(e.configuration,"assemblyNames")[0];if(!n)throw new Error("assembly name required for JBrowse 1 connection");var a=r.assemblies.find((function(e){return o.readConfObject(e,"name")===n})),i=o.readConfObject(a,["sequence","adapter"]),c=t.tracks.map((function(e){var r=function(e,t,r){var n={trackId:l.objectHash(e),name:e.key||e.label},a=e.metadata&&(e.metadata.description||e.metadata.Description);a&&(n.description=a);var o=e.category||e.metadata&&e.metadata.category;n.category=o?o.split(/\s*\/\s*/):[];var i=e.storeClass;if(!e.urlTemplate){if(!i||!i.endsWith("FromConfig")){var c=e.key||e.label;return console.warn('Could not import JBrowse1 track "'.concat(c,'" because it does not have a "urlTemplate" or is not a "FromConfig" track')),u.generateUnsupportedTrackConf(n.name,c,n.category)}return function(e,t){var r=(e.features||[]).map((function(e){var t=JSON.parse(JSON.stringify(e));return t.refName=e.seq_id,t.uniqueId="".concat(e.seq_id,":").concat(e.start,"-").concat(e.end,":").concat(e.name||""),t}));return t.adapter={type:"FromConfigAdapter",features:r},t.type="FeatureTrack",t}(e,n)}var s=function(e){return new URL(e,"".concat(t,"/")).href.replace(/%7B/gi,"{").replace(/%7D/gi,"}")},f=s(e.urlTemplate);if(i){if("JBrowse/Store/SeqFeature/BAM"===i){var p={type:"BamAdapter",bamLocation:{uri:f,locationType:"UriLocation"}};return p.index=e.baiUrlTemplate?{location:{uri:s(e.baiUrlTemplate),locationType:"UriLocation"}}:e.csiUrlTemplate?{location:{uri:s(e.csiUrlTemplate),locationType:"UriLocation"},indexType:"CSI"}:{location:{uri:"".concat(f,".bai"),locationType:"UriLocation"}},x(x({},n),{},{type:"AlignmentsTrack",adapter:p})}if("JBrowse/Store/SeqFeature/CRAM"===i){var h={type:"CramAdapter",cramLocation:{uri:f,locationType:"UriLocation"},sequenceAdapter:r};return h.craiLocation=e.craiUrlTemplate?{uri:s(e.craiUrlTemplate),locationType:"UriLocation"}:{uri:"".concat(f,".crai"),locationType:"UriLocation"},x(x({},n),{},{type:"AlignmentsTrack",adapter:h})}if("JBrowse/Store/SeqFeature/NCList"===i)return x(x({},n),{},{type:"FeatureTrack",adapter:{type:"NCListAdapter",rootUrlTemplate:{uri:f,locationType:"UriLocation"}}});if("JBrowse/Store/SeqFeature/BigWig"===i||"JBrowse/Store/BigWig"===i)return e.type&&e.type.endsWith("XYPlot")?n.defaultRendering="xyplot":e.type&&e.type.endsWith("Density")&&(n.defaultRendering="density"),x(x({},n),{},{type:"QuantitativeTrack",adapter:{type:"BigWigAdapter",bigWigLocation:{uri:f,locationType:"UriLocation"}}});if("JBrowse/Store/SeqFeature/VCFTabix"===i){var d={type:"VcfTabixAdapter",vcfGzLocation:{uri:f,locationType:"UriLocation"}};return d.index=e.tbiUrlTemplate?{location:{uri:s(e.tbiUrlTemplate),locationType:"UriLocation"}}:e.csiUrlTemplate?{location:{uri:s(e.csiUrlTemplate),locationType:"UriLocation"},indexType:"CSI"}:{location:{uri:"".concat(f,".tbi"),locationType:"UriLocation"}},x(x({},n),{},{type:"VariantTrack",adapter:d})}if("JBrowse/Store/SeqFeature/VCFTribble"===i)return u.generateUnsupportedTrackConf(n.name,"VCFTribble (".concat(f,")"),n.category);if("JBrowse/Store/SeqFeature/GFF3"===i)return u.generateUnsupportedTrackConf(n.name,"GFF3 (".concat(f,")"),n.category);if("JBrowse/Store/SeqFeature/BigBed"===i)return x(x({},n),{},{type:"FeatureTrack",adapter:{type:"BigBedAdapter",bigBedLocation:{uri:f,locationType:"UriLocation"}}});if("JBrowse/Store/SeqFeature/GFF3Tabix"===i){var y={type:"Gff3TabixAdapter",gffGzLocation:{uri:f,locationType:"UriLocation"}};return y.index=e.tbiUrlTemplate?{location:{uri:s(e.tbiUrlTemplate),locationType:"UriLocation"}}:e.csiUrlTemplate?{location:{uri:s(e.csiUrlTemplate),locationType:"UriLocation"},indexType:"CSI"}:{location:{uri:"".concat(f,".tbi"),locationType:"UriLocation"}},x(x({},n),{},{type:"FeatureTrack",adapter:y})}if("JBrowse/Store/SeqFeature/BED"===i)return u.generateUnsupportedTrackConf(n.name,"BED (".concat(f,")"),n.category);if("JBrowse/Store/SeqFeature/BEDTabix"===i){var v={type:"BedTabixAdapter",bedGzLocation:{uri:f,locationType:"UriLocation"}};return v.index=e.tbiUrlTemplate?{location:{uri:s(e.tbiUrlTemplate),locationType:"UriLocation"}}:e.csiUrlTemplate?{location:{uri:s(e.csiUrlTemplate),locationType:"UriLocation"},indexType:"CSI"}:{location:{uri:"".concat(f,".tbi"),locationType:"UriLocation"}},x(x({},n),{},{type:"FeatureTrack",adapter:v})}if("JBrowse/Store/SeqFeature/GTF"===i)return u.generateUnsupportedTrackConf(n.name,"GTF (".concat(f,")"),n.category);if("JBrowse/Store/SeqFeature/StaticChunked"===i||"JBrowse/Store/Sequence/StaticChunked"===i)return u.generateUnsupportedTrackConf(n.name,"StaticChunked (".concat(f,")"),n.category);if("JBrowse/Store/SeqFeature/UnindexedFasta"===i)return u.generateUnsupportedTrackConf(n.name,"UnindexedFasta (".concat(f,")"),n.category);if("JBrowse/Store/SeqFeature/IndexedFasta"===i){var m={type:"IndexedFastaAdapter",fastaLocation:{uri:f,locationType:"UriLocation"}};return m.faiLocation=e.faiUrlTemplate?{uri:s(e.faiUrlTemplate),locationType:"UriLocation"}:{uri:"".concat(f,".fai"),locationType:"UriLocation"},x(x({},n),{},{type:"SequenceTrack",adapter:m})}if("JBrowse/Store/SeqFeature/BgzipIndexedFasta"===i){var b={type:"BgzipFastaAdapter",fastaLocation:{uri:f,locationType:"UriLocation"}};return b.faiLocation=e.faiUrlTemplate?{uri:s(e.faiUrlTemplate),locationType:"UriLocation"}:{uri:"".concat(f,".fai"),locationType:"UriLocation"},b.gziLocation=e.gziUrlTemplate?{uri:s(e.gziUrlTemplate),locationType:"UriLocation"}:{uri:"".concat(f,".gzi"),locationType:"UriLocation"},x(x({},n),{},{type:"ReferenceSequenceTrack",adapter:b})}if("JBrowse/Store/SeqFeature/TwoBit"===i)return x(x({},n),{},{type:"ReferenceSequenceTrack",adapter:{type:"TwoBitAdapter",twoBitLocation:{uri:f,locationType:"UriLocation"}}})}if(n.adapter=u.guessAdapter({uri:f,locationType:"UriLocation"},void 0,f),!n.adapter)throw new Error("Could not determine adapter");return n.adapter.type===u.UNSUPPORTED?u.generateUnsupportedTrackConf(n.name,f,n.category):n.adapter.type===u.UNKNOWN?u.generateUnknownTrackConf(n.name,f,n.category):(n.type=u.guessTrackType(n.adapter.type),"QuantitativeTrack"===n.type&&(e.type&&e.type.endsWith("XYPlot")?n.defaultRendering="xyplot":e.type&&e.type.endsWith("Density")&&(n.defaultRendering="density")),n)}(e,t.dataRoot,i);return r.assemblyNames=[n],r}));e.setTrackConfs(c)})).catch((function(t){console.error(t),r.notify('There was a problem connecting to the JBrowse 1 data directory "'.concat(e.name,'". Please make sure you have entered a valid location. The error that was thrown is: "').concat(t,'"'),"error"),r.breakConnection(e.configuration)}))}}})))}var ye=function(e){q(i,a);var o=O(i);function i(){var e;return L(this,i),(e=o.apply(this,arguments)).name="LegacyJBrowsePlugin",e}return B(i,[{key:"install",value:function(e){e.addAdapterType((function(){return new t({name:"NCListAdapter",configSchema:_,getAdapterClass:function(){return Promise.resolve().then((function(){return ge})).then((function(e){return e.default}))}})})),e.addToExtensionPoint("Core-guessAdapterForLocation",(function(e){return function(t,r,n){var a=u.getFileName(t);return/trackData.jsonz?$/i.test(a)||"NCListAdapter"===n?{type:"NCListAdapter",rootUrlTemplate:t}:e(t,r,n)}})),e.addTextSearchAdapterType((function(){return new r({name:"JBrowse1TextSearchAdapter",configSchema:M,AdapterClass:D,description:"A JBrowse 1 text search adapter"})})),e.addConnectionType((function(){return new n({name:"JBrowse1Connection",configSchema:V,stateModel:de(e),displayName:"JBrowse 1 Data",description:"A JBrowse 1 data directory",url:"//jbrowse.org/"})}))}}]),i}(),ve={refName:"seq_id"},me={seq_id:"refName"},be=function(){function e(t,r,n){L(this,e),this.ncFeature=t,this.uniqueId=n||t.id(),this.parentHandle=r}return B(e,[{key:"set",value:function(){throw new Error("not implemented")}},{key:"jb2TagToJb1Tag",value:function(e){return(ve[e]||e).toLowerCase()}},{key:"jb1TagToJb2Tag",value:function(e){var t=e.toLowerCase();return me[t]||t}},{key:"get",value:function(t){var r=this,n=this.ncFeature.get(this.jb2TagToJb1Tag(t));return n&&"subfeatures"===t?n.map((function(t){return new e(t,r)})):n}},{key:"tags",value:function(){var e=this;return this.ncFeature.tags().map((function(t){return e.jb1TagToJb2Tag(t)}))}},{key:"id",value:function(){return this.uniqueId}},{key:"parent",value:function(){return this.parentHandle}},{key:"children",value:function(){return this.get("subfeatures")}},{key:"toJSON",value:function(){var t=this,r={uniqueId:this.id()};return this.ncFeature.tags().forEach((function(n){var a=t.jb1TagToJb2Tag(n),o=t.ncFeature.get(n);"subfeatures"===a?r.subfeatures=(o||[]).map((function(r){return new e(r,t).toJSON()})):r[a]=o})),r}}]),e}(),ge={__proto__:null,default:function(e){q(n,i.BaseFeatureDataAdapter);var t,r=O(n);function n(e,t,a){var i;L(this,n),i=r.call(this,e,t,a);var c=o.readConfObject(e,"refNames"),s=o.readConfObject(e,"rootUrlTemplate");return i.configRefNames=c,i.nclist=new v({baseUrl:"",urlTemplate:s.uri,readFile:function(e){return new b.RemoteFile(String(s.baseUri?new URL(e,s.baseUri).toString():e)).readFile()}}),i}return B(n,[{key:"getFeatures",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return m.ObservableCreate(function(){var n=U(N.mark((function n(a){var o,i,c,s,u,f,p;return N.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:o=r.signal,i=!1,c=!1,n.prev=3,u=g(t.nclist.getFeatures(e,r));case 5:return n.next=7,u.next();case 7:if(!(i=!(f=n.sent).done)){n.next=14;break}p=f.value,l.checkAbortSignal(o),a.next(t.wrapFeature(p));case 11:i=!1,n.next=5;break;case 14:n.next=20;break;case 16:n.prev=16,n.t0=n.catch(3),c=!0,s=n.t0;case 20:if(n.prev=20,n.prev=21,!i||null==u.return){n.next=25;break}return n.next=25,u.return();case 25:if(n.prev=25,!c){n.next=28;break}throw s;case 28:return n.finish(25);case 29:return n.finish(20);case 30:a.complete();case 31:case"end":return n.stop()}}),n,null,[[3,16,20,30],[21,,25,29]])})));return function(e){return n.apply(this,arguments)}}())}},{key:"wrapFeature",value:function(e){return new be(e,void 0,"".concat(this.id,"-").concat(e.id()))}},{key:"hasDataForRefName",value:(t=U(N.mark((function e(t){var r;return N.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.nclist.getDataRoot(t);case 2:return e.abrupt("return",!!((r=e.sent)&&r.stats&&r.stats.featureCount));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"getRefNames",value:function(){return Promise.resolve(this.configRefNames||[])}},{key:"freeResources",value:function(){}}]),n}()};exports.default=ye;
2
2
  //# sourceMappingURL=plugin-legacy-jbrowse.cjs.production.min.js.map