@rcsb/rcsb-saguaro-app 4.0.0-interfaces.6 → 4.0.0-interfaces.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.
- package/build/dist/app.js +1 -1
- package/build/dist/app.js.map +1 -1
- package/package.json +1 -1
package/build/dist/app.js
CHANGED
|
@@ -86,7 +86,7 @@ object-assign
|
|
|
86
86
|
*
|
|
87
87
|
* This source code is licensed under the MIT license found in the
|
|
88
88
|
* LICENSE file in the root directory of this source tree.
|
|
89
|
-
*/var r,i,a,c;if("object"==typeof performance&&"function"==typeof performance.now){var o=performance;e.unstable_now=function(){return o.now()}}else{var s=Date,l=s.now();e.unstable_now=function(){return s.now()-l}}if("undefined"==typeof window||"function"!=typeof MessageChannel){var u=null,h=null,d=function(){if(null!==u)try{var t=e.unstable_now();u(!0,t),u=null}catch(t){throw setTimeout(d,0),t}};r=function(t){null!==u?setTimeout(r,0,t):(u=t,setTimeout(d,0))},i=function(t,e){h=setTimeout(t,e)},a=function(){clearTimeout(h)},e.unstable_shouldYield=function(){return!1},c=e.unstable_forceFrameRate=function(){}}else{var f=window.setTimeout,v=window.clearTimeout;if("undefined"!=typeof console){var p=window.cancelAnimationFrame;"function"!=typeof window.requestAnimationFrame&&console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills"),"function"!=typeof p&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills")}var g=!1,m=null,y=-1,b=5,w=0;e.unstable_shouldYield=function(){return e.unstable_now()>=w},c=function(){},e.unstable_forceFrameRate=function(t){0>t||125<t?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):b=0<t?Math.floor(1e3/t):5};var z=new MessageChannel,C=z.port2;z.port1.onmessage=function(){if(null!==m){var t=e.unstable_now();w=t+b;try{m(!0,t)?C.postMessage(null):(g=!1,m=null)}catch(t){throw C.postMessage(null),t}}else g=!1},r=function(t){m=t,g||(g=!0,C.postMessage(null))},i=function(t,n){y=f((function(){t(e.unstable_now())}),n)},a=function(){v(y),y=-1}}function x(t,e){var n=t.length;t.push(e);t:for(;;){var r=n-1>>>1,i=t[r];if(!(void 0!==i&&0<E(i,e)))break t;t[r]=e,t[n]=i,n=r}}function _(t){return void 0===(t=t[0])?null:t}function M(t){var e=t[0];if(void 0!==e){var n=t.pop();if(n!==e){t[0]=n;t:for(var r=0,i=t.length;r<i;){var a=2*(r+1)-1,c=t[a],o=a+1,s=t[o];if(void 0!==c&&0>E(c,n))void 0!==s&&0>E(s,c)?(t[r]=s,t[o]=n,r=o):(t[r]=c,t[a]=n,r=a);else{if(!(void 0!==s&&0>E(s,n)))break t;t[r]=s,t[o]=n,r=o}}}return e}return null}function E(t,e){var n=t.sortIndex-e.sortIndex;return 0!==n?n:t.id-e.id}var S=[],k=[],A=1,F=null,T=3,L=!1,H=!1,I=!1;function O(t){for(var e=_(k);null!==e;){if(null===e.callback)M(k);else{if(!(e.startTime<=t))break;M(k),e.sortIndex=e.expirationTime,x(S,e)}e=_(k)}}function V(t){if(I=!1,O(t),!H)if(null!==_(S))H=!0,r(B);else{var e=_(k);null!==e&&i(V,e.startTime-t)}}function B(t,n){H=!1,I&&(I=!1,a()),L=!0;var r=T;try{for(O(n),F=_(S);null!==F&&(!(F.expirationTime>n)||t&&!e.unstable_shouldYield());){var c=F.callback;if("function"==typeof c){F.callback=null,T=F.priorityLevel;var o=c(F.expirationTime<=n);n=e.unstable_now(),"function"==typeof o?F.callback=o:F===_(S)&&M(S),O(n)}else M(S);F=_(S)}if(null!==F)var s=!0;else{var l=_(k);null!==l&&i(V,l.startTime-n),s=!1}return s}finally{F=null,T=r,L=!1}}var D=c;e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(t){t.callback=null},e.unstable_continueExecution=function(){H||L||(H=!0,r(B))},e.unstable_getCurrentPriorityLevel=function(){return T},e.unstable_getFirstCallbackNode=function(){return _(S)},e.unstable_next=function(t){switch(T){case 1:case 2:case 3:var e=3;break;default:e=T}var n=T;T=e;try{return t()}finally{T=n}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=D,e.unstable_runWithPriority=function(t,e){switch(t){case 1:case 2:case 3:case 4:case 5:break;default:t=3}var n=T;T=t;try{return e()}finally{T=n}},e.unstable_scheduleCallback=function(t,n,c){var o=e.unstable_now();switch("object"==typeof c&&null!==c?c="number"==typeof(c=c.delay)&&0<c?o+c:o:c=o,t){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return t={id:A++,callback:n,priorityLevel:t,startTime:c,expirationTime:s=c+s,sortIndex:-1},c>o?(t.sortIndex=c,x(k,t),null===_(S)&&t===_(k)&&(I?a():I=!0,i(V,c-o))):(t.sortIndex=s,x(S,t),H||L||(H=!0,r(B))),t},e.unstable_wrapCallback=function(t){var e=T;return function(){var n=T;T=e;try{return t.apply(this,arguments)}finally{T=n}}}},function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n),Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[n]}})}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.hasOwnProperty.call(t,n)&&r(e,t,n);return i(e,t),e};Object.defineProperty(e,"__esModule",{value:!0}),e.SelectButton=void 0;const c=a(n(2)),o=a(n(118));class s extends c.Component{constructor(t){super(t),this.state={selectedOption:null==this.props.options[0].options?Object.assign(Object.assign({},this.props.options[0]),{value:0}):Object.assign(Object.assign({},this.props.options[0].options[0]),{value:0})},this.defaultValue=t.defaultValue}change(t){this.setState({selectedOption:t})}componentDidUpdate(t,e){this.state.selectedOption.onChange()}componentDidMount(){this.defaultValue=null}render(){const t="string"==typeof this.props.dropdownTitle?c.createElement("div",{style:{color:"grey",fontWeight:"bold",fontSize:12}},this.props.dropdownTitle):null;if(this.props.isAdditionalButton){const{selectOpt:t,index:e}=this.getSelectOpt();return this.innerSelectButtonRender(t,e)}return c.createElement("div",null,t,this.selectRender())}selectRender(){const{selectOpt:t,index:e}=this.getSelectOpt();return!0===this.props.addTitle?this.titleRender(t,e):this.selectButtonRender(t,e)}titleRender(t,e){return c.createElement("div",null,c.createElement("div",{style:{display:"inline-block"}},this.selectButtonRender(t,e)),c.createElement("div",{style:{display:"inline-block",marginLeft:"20px"}},t.name))}selectButtonRender(t,e){return c.createElement("div",{id:this.props.elementId+s.BUTTON_CONTAINER_DIV_SUFFIX},this.innerSelectButtonRender(t,e))}innerSelectButtonRender(t,e){var n;let r;if(null==this.props.options[0].options)r=this.props.options.map((t,e)=>Object.assign(Object.assign({},t),{value:e}));else{let t=0;r=this.props.options.map(e=>({label:e.label,options:e.options.map(e=>Object.assign(Object.assign({},e),{value:t++}))}))}return c.createElement("div",{style:{display:"inline-block"}},c.createElement(o.default,{options:r,isSearchable:!1,onChange:this.change.bind(this),styles:this.configStyle(),components:{SingleValue:t=>{const e="string"==typeof t.data.shortLabel?t.data.shortLabel:t.data.label;return c.createElement(o.components.SingleValue,Object.assign({},t),e)},Option:null!==(n=this.props.optionProps)&&void 0!==n?n:t=>c.createElement(o.components.Option,Object.assign({},t))},defaultValue:Object.assign(Object.assign({},t),{value:e})}))}configStyle(){return{control:t=>{var e;return Object.assign(Object.assign({},t),{width:null!==(e=this.props.width)&&void 0!==e?e:120,border:"1px solid #ddd",boxShadow:"none","&:hover":{border:"1px solid #ddd"}})},menu:t=>Object.assign(Object.assign({},t),{width:500}),option:t=>Object.assign({},t)}}getSelectOpt(){let t,e=0;if(null!=this.defaultValue){if(null==this.props.options[0].options){const n=this.props.options.findIndex(t=>t.optId===this.defaultValue);n>=0&&(e=n,t=this.props.options[n])}else if(null!=this.props.options[0].options){let n=!1;for(const r of this.props.options){for(const i of r.options){if(i.optId===this.defaultValue){t=i,n=!0;break}e++}if(n)break}}}else t=this.state.selectedOption,e=this.props.options.findIndex(t=>t.optId===this.state.selectedOption.optId);return{selectOpt:t,index:e}}}e.SelectButton=s,s.BUTTON_CONTAINER_DIV_SUFFIX="_buttonContainerDiv"},function(t,e,n){"use strict";var r=n(83);function i(){}function a(){}a.resetWarningCache=i,t.exports=function(){function t(t,e,n,i,a,c){if(c!==r){var o=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw o.name="Invariant Violation",o}}function e(){return t}t.isRequired=t;var n={array:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:a,resetWarningCache:i};return n.PropTypes=n,n}},function(t,e,n){"use strict";t.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n),Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[n]}})}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.hasOwnProperty.call(t,n)&&r(e,t,n);return i(e,t),e};Object.defineProperty(e,"__esModule",{value:!0}),e.LoaderSpinner=void 0;const c=a(n(2)),o=a(n(85));class s extends c.Component{render(){return c.createElement("div",{style:{position:"absolute",left:0,right:0,marginLeft:"auto",zIndex:Number.MAX_SAFE_INTEGER,marginRight:"auto"}},c.createElement("div",{className:o.loadSpinnerComponentScope},c.createElement("div",{className:"loader"})))}}e.LoaderSpinner=s},function(t,e,n){var r=n(86),i=n(87);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[t.i,i,""]]);var a={insert:"head",singleton:!1},c=(r(i,a),i.locals?i.locals:{});t.exports=c},function(t,e,n){"use strict";var r,i=function(){return void 0===r&&(r=Boolean(window&&document&&document.all&&!window.atob)),r},a=function(){var t={};return function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(t){n=null}t[e]=n}return t[e]}}(),c=[];function o(t){for(var e=-1,n=0;n<c.length;n++)if(c[n].identifier===t){e=n;break}return e}function s(t,e){for(var n={},r=[],i=0;i<t.length;i++){var a=t[i],s=e.base?a[0]+e.base:a[0],l=n[s]||0,u="".concat(s," ").concat(l);n[s]=l+1;var h=o(u),d={css:a[1],media:a[2],sourceMap:a[3]};-1!==h?(c[h].references++,c[h].updater(d)):c.push({identifier:u,updater:g(d,e),references:1}),r.push(u)}return r}function l(t){var e=document.createElement("style"),r=t.attributes||{};if(void 0===r.nonce){var i=n.nc;i&&(r.nonce=i)}if(Object.keys(r).forEach((function(t){e.setAttribute(t,r[t])})),"function"==typeof t.insert)t.insert(e);else{var c=a(t.insert||"head");if(!c)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");c.appendChild(e)}return e}var u,h=(u=[],function(t,e){return u[t]=e,u.filter(Boolean).join("\n")});function d(t,e,n,r){var i=n?"":r.media?"@media ".concat(r.media," {").concat(r.css,"}"):r.css;if(t.styleSheet)t.styleSheet.cssText=h(e,i);else{var a=document.createTextNode(i),c=t.childNodes;c[e]&&t.removeChild(c[e]),c.length?t.insertBefore(a,c[e]):t.appendChild(a)}}function f(t,e,n){var r=n.css,i=n.media,a=n.sourceMap;if(i?t.setAttribute("media",i):t.removeAttribute("media"),a&&btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(a))))," */")),t.styleSheet)t.styleSheet.cssText=r;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(r))}}var v=null,p=0;function g(t,e){var n,r,i;if(e.singleton){var a=p++;n=v||(v=l(e)),r=d.bind(null,n,a,!1),i=d.bind(null,n,a,!0)}else n=l(e),r=f.bind(null,n,e),i=function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(n)};return r(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;r(t=e)}else i()}}t.exports=function(t,e){(e=e||{}).singleton||"boolean"==typeof e.singleton||(e.singleton=i());var n=s(t=t||[],e);return function(t){if(t=t||[],"[object Array]"===Object.prototype.toString.call(t)){for(var r=0;r<n.length;r++){var i=o(n[r]);c[i].references--}for(var a=s(t,e),l=0;l<n.length;l++){var u=o(n[l]);0===c[u].references&&(c[u].updater(),c.splice(u,1))}n=a}}}},function(t,e,n){(e=n(88)(!1)).push([t.i,".loadSpinnerComponentScope .loader,.loadSpinnerComponentScope .loader:after{border-radius:50%;width:10em;height:10em}.loadSpinnerComponentScope .loader{background-color:#FFF;box-shadow:0 0 5px 15px #FFF;margin:60px auto;font-size:10px;position:relative;text-indent:-9999em;border-top:1.1em solid #d5f0ff;border-right:1.1em solid #d5f0ff;border-bottom:1.1em solid #d5f0ff;border-left:1.1em solid #4499ea;-webkit-transform:translateZ(0);-ms-transform:translateZ(0);transform:translateZ(0);-webkit-animation:load8 1.1s infinite linear;animation:load8 1.1s infinite linear}@-webkit-keyframes load8{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes load8{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}\n",""]),e.locals={loadSpinnerComponentScope:"loadSpinnerComponentScope",loader:"loader",load8:"load8"},t.exports=e},function(t,e,n){"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n=function(t,e){var n=t[1]||"",r=t[3];if(!r)return n;if(e&&"function"==typeof btoa){var i=(c=r,o=btoa(unescape(encodeURIComponent(JSON.stringify(c)))),s="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(o),"/*# ".concat(s," */")),a=r.sources.map((function(t){return"/*# sourceURL=".concat(r.sourceRoot||"").concat(t," */")}));return[n].concat(a).concat([i]).join("\n")}var c,o,s;return[n].join("\n")}(e,t);return e[2]?"@media ".concat(e[2]," {").concat(n,"}"):n})).join("")},e.i=function(t,n,r){"string"==typeof t&&(t=[[null,t,""]]);var i={};if(r)for(var a=0;a<this.length;a++){var c=this[a][0];null!=c&&(i[c]=!0)}for(var o=0;o<t.length;o++){var s=[].concat(t[o]);r&&i[s[0]]||(n&&(s[2]?s[2]="".concat(n," and ").concat(s[2]):s[2]=n),e.push(s))}},e}},function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,a){function c(t){try{s(r.next(t))}catch(t){a(t)}}function o(t){try{s(r.throw(t))}catch(t){a(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,o)}s((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.RcsbFvChromosomeBuilder=void 0;const i=n(5),a=n(90),c=n(8),o=n(11);class s{static buildFullChromosome(t,e){return r(this,void 0,void 0,(function*(){return yield s.buildChromosome(t,null,e)}))}static buildEntryChromosome(t,e,n,a){return r(this,void 0,void 0,(function*(){return new Promise((l,u)=>r(this,void 0,void 0,(function*(){const u=(yield o.rcsbFvCtxManager.getEntityToInstance(a)).getData(),h=new Set;u.sort((t,e)=>parseInt(t.entityId)-parseInt(e.entityId)).forEach(t=>{h.add(t.entryId+i.TagDelimiter.entity+t.entityId)});const d=(yield o.rcsbFvCtxManager.getEntityToChromosome(Array.from(h))).getData();if(0==d.size)c.RcsbFvCoreBuilder.showMessage(t,"No genome alignments are available");else{const a=new Set;c.RcsbFvCoreBuilder.buildSelectButton(t,e,u.filter(t=>{const e=a.has(t.entryId+i.TagDelimiter.entity+t.entityId);return a.add(t.entryId+i.TagDelimiter.entity+t.entityId),d.has(t.entryId+i.TagDelimiter.entity+t.entityId)&&!e}).map((e,a)=>{const c=e.entryId+i.TagDelimiter.entity+e.entityId;return 0==a&&s.buildEntityChromosome(t,n,c).then(t=>{l(t)}),{name:e.names+" - "+e.taxIds.join(", "),label:c+" - "+e.names,shortLabel:c,onChange:()=>r(this,void 0,void 0,(function*(){yield s.buildEntityChromosome(t,n,c)}))}}),{addTitle:!0,dropdownTitle:"ENTITY"})}})))}))}static buildEntityChromosome(t,e,n){return r(this,void 0,void 0,(function*(){const i=yield s.buildChromosome(t,n,null,e,{boardConfig:{rowTitleWidth:160}}),a=yield i.getTargets();return c.RcsbFvCoreBuilder.buildSelectButton(t,e,a.map((i,a)=>({label:i,name:i,shortLabel:i,onChange:()=>r(this,void 0,void 0,(function*(){yield s.buildChromosome(t,n,i,e)}))})),{addTitle:!1,width:190,dropdownTitle:"CHROMOSOME"}),i}))}static buildChromosome(t,e,n,o,s){return r(this,void 0,void 0,(function*(){return new Promise((r,l)=>{try{c.RcsbFvCoreBuilder.createFv({elementId:t,fvModuleI:a.RcsbFvChromosome,config:{entityId:e,chrId:n,elementSelectId:o,additionalConfig:Object.assign({rcsbContext:{entryId:e.split(i.TagDelimiter.entity)[0],entityId:e.split(i.TagDelimiter.entity)[1],chrId:n}},s),resolve:r}})}catch(t){l(t)}})}))}}e.RcsbFvChromosomeBuilder=s},function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,a){function c(t){try{s(r.next(t))}catch(t){a(t)}}function o(t){try{s(r.throw(t))}catch(t){a(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,o)}s((r=r.apply(t,e||[])).next())}))},i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.RcsbFvChromosome=void 0;const a=n(14),c=n(9),o=n(4),s=n(26),l=n(12),u=n(96),h=n(33),d=n(97),f=n(98),v=i(n(117)),p=n(22);function g(t,e,n){return r=>{if((n?n/(r.to-r.from):1e3/(r.to-r.from))>4){const n=new Array;return e.forEach((t,e)=>{e[0]>r.to||e[1]<r.from||n.push(t)}),Promise.all(n.map(e=>(new h.RcsbQueryAlignment).request({queryId:e,from:t,to:o.SequenceReference.NcbiGenome}))).then(e=>{const r=new s.RcsbFvTrackData;return e.forEach((e,i)=>{if(null==e.query_sequence)return;const a=e.query_sequence.split("");e.target_alignment.forEach(e=>{const c=e.orientation;e.aligned_regions.forEach(e=>{const o=e.target_begin,s=e.query_begin,l=e.query_end-e.query_begin+1;for(let e=0;e<l;e++)r.push({begin:o+c*(1+3*e),value:a[s-1+e],oriBegin:s+e,source:t.toString(),sourceId:n[i]})})})}),r})}return new Promise((t,e)=>{t(null)})}}class m extends c.RcsbFvAbstractModule{constructor(){super(...arguments),this.targetAlignmentList=new Map([[o.SequenceReference.NcbiProtein,new Array],[o.SequenceReference.Uniprot,new Array],[o.SequenceReference.PdbEntity,new Array]]),this.maxRange=0,this.minRange=Number.MAX_SAFE_INTEGER,this.alignmentCollectorQueue=new u.RcsbFvAlignmentCollectorQueue(12),this.nTasks=0,this.completeTasks=0,this.batchSize=1e7,this.beginView=0,this.endView=0,this.entityBegin=0,this.entityEnd=0,this.nonExonConfigData=new Array,this.featuresConfigData=new Array,this.targetCoverages=new Map,this.chrSet=new Array,this.targetFilterFlag=!0,this.IDEOGRAM_DIV_ID="chrIdeogramDiv",this.TITLE_CHR_DIV_ID="chrTitleDiv",this.TITLE_CHR_REGION_ID="chrTitleRegion",this.currentDisplayedChrId="",this.buildSubject=new a.Subject,this.targetsSubject=new a.Subject}buildPdbGenomeFv(t,e){this.entityId=t;const n=new h.RcsbQueryAlignment;Promise.all([o.SequenceReference.NcbiProtein,o.SequenceReference.Uniprot].map(e=>n.request({queryId:t,from:o.SequenceReference.PdbEntity,to:e}))).then(n=>{n.forEach(t=>{t.target_alignment.forEach(t=>{this.targetCoverages.set(t.target_id,t.coverage)})}),this.alignmentCollectorQueue.sendTask({queryId:t,from:o.SequenceReference.PdbEntity,to:o.SequenceReference.NcbiGenome},n=>r(this,void 0,void 0,(function*(){const r=n;yield this.collectPdbWorkerResults(r,t,e)})))})}buildFullGenomeRangeFv(t){this.plotChromosomeTitle(t),this.targetFilterFlag=!1,this.genomeSequenceTracks(t),this.collectChromosomeAlignments(t,o.SequenceReference.PdbEntity),this.collectChromosomeAlignments(t,o.SequenceReference.Uniprot),this.collectChromosomeAlignments(t,o.SequenceReference.NcbiProtein)}collectPdbWorkerResults(t,e,n){return r(this,void 0,void 0,(function*(){const r=this.collectExons(t.target_alignment,"target",l.RcsbAnnotationConstants.provenanceColorCode.rcsbPdb,l.RcsbAnnotationConstants.provenanceColorCode.rcsbPdb,o.SequenceReference.PdbEntity,n);this.pdbEntityTrack=this.mergeExonTracks(r,o.SequenceReference.PdbEntity)[0],this.pdbEntityTrack.displayConfig[0].displayData.forEach(t=>{t.description=[e]}),this.addSequences([this.pdbEntityTrack],o.SequenceReference.PdbEntity),this.pdbEntityTrack.rowPrefix=o.SequenceReference.PdbEntity.replace("_"," "),this.pdbEntityTrack.rowTitle={visibleTex:e,style:{fontWeight:"bold"}},this.pdbEntityTrack.hideEmptyTrackFlag=!1,yield this.buildChromosomeFv(null!=n?n:this.chrSet[0])}))}buildChromosomeFv(t){return r(this,void 0,void 0,(function*(){this.plotChromosomeTitle(t),this.genomeSequenceTracks(t),this.nonExonConfigData.push(this.pdbEntityTrack),yield this.plot(),this.collectChromosomeEntityRegion(t)}))}plotChromosomeTitle(t){var e,n;null===(e=document.getElementById(this.IDEOGRAM_DIV_ID))||void 0===e||e.remove(),null===(n=document.getElementById(this.TITLE_CHR_DIV_ID))||void 0===n||n.remove(),this.currentDisplayedChrId=t,f.NcbiSummary.requestChromosomeData(t).then(e=>{if(t==this.currentDisplayedChrId){const t=document.createElement("div");t.id=this.IDEOGRAM_DIV_ID;const n=document.createElement("div");n.style.display="inline-block",n.style.marginLeft="20px",n.id=this.TITLE_CHR_DIV_ID;const r=document.createElement("span");r.innerHTML=e.title,n.append(r);const i=document.createElement("span");i.id=this.TITLE_CHR_REGION_ID,i.innerHTML=" / Region: ["+this.entityBegin+" - "+this.entityEnd+"]",i.style.color="#666",n.append(i),document.getElementById(this.elementSelectId).insertAdjacentElement("afterend",n),document.getElementById(this.elementId).insertAdjacentElement("beforebegin",t),this.plotIdeogram(e)}})}updateChromosomeTitleRegion(){const t=document.getElementById(this.TITLE_CHR_REGION_ID);null!=t&&(t.innerHTML=" / Region: ["+this.beginView+" - "+this.endView+"]")}plotIdeogram(t){f.NcbiSummary.requestTaxonomyData(t.taxid.toString()).then(e=>{if(t.ncbiId==this.currentDisplayedChrId){const n=t.subname.includes("|")?t.subname.split("|").filter(t=>null!=t.match(/^([\dXYxy]+)$/))[0]:t.subname,r=new v.default({rotatable:!1,chrHeight:1080,chrWidth:20,organism:e.scientificname,chromosomes:[n],orientation:"horizontal",container:"#"+this.IDEOGRAM_DIV_ID,annotationHeight:8,showBandLabels:!0,annotations:[{name:this.entityId,chr:n,start:this.entityBegin,stop:this.entityEnd}],onLoad:()=>{var t,e;(null===(t=r.chromosomesArray)||void 0===t?void 0:t.length)>0?null!=document.getElementById("_ideogram")&&(document.getElementById("_ideogram").style.padding="0 0 0 0"):null===(e=document.getElementById(this.IDEOGRAM_DIV_ID))||void 0===e||e.remove()}})}})}genomeSequenceTracks(t){var e,n,r,i;this.nonExonConfigData.push({trackId:"mainSequenceTrack_5_"+t,displayType:"sequence",trackColor:"#F9F9F9",displayColor:"#000000",nonEmptyDisplay:!0,rowPrefix:t+" ",rowTitle:{visibleTex:"5'",style:{fontWeight:"bold"}},titleFlagColor:l.RcsbAnnotationConstants.provenanceColorCode.external,updateDataOnMove:d.NcbiGenomeSequenceData.update(t,1,!1,null===(n=null===(e=this.rcsbFv)||void 0===e?void 0:e.getBoardConfig())||void 0===n?void 0:n.trackWidth)}),this.nonExonConfigData.push({trackId:"mainSequenceTrack_3_"+t,displayType:"sequence",trackColor:"#F9F9F9",displayColor:"#000000",rowPrefix:"",nonEmptyDisplay:!0,rowTitle:{visibleTex:"3'",style:{fontWeight:"bold"}},titleFlagColor:l.RcsbAnnotationConstants.provenanceColorCode.external,updateDataOnMove:d.NcbiGenomeSequenceData.update(t,2,!0,null===(i=null===(r=this.rcsbFv)||void 0===r?void 0:r.getBoardConfig())||void 0===i?void 0:i.trackWidth)})}collectChromosomeEntityRegion(t){const e=this.pdbEntityTrack.displayConfig[0].displayData[0].begin,n=this.pdbEntityTrack.displayConfig[0].displayData[0].end,r=[Math.max(1,e-5e6),n+5e6];this.collectChromosomeAlignments(t,o.SequenceReference.Uniprot,r,0),this.collectChromosomeAlignments(t,o.SequenceReference.NcbiProtein,r,0)}collectChromosomeAlignments(t,e,n,i){if(null!=n)this.nTasks++,this.alignmentCollectorQueue.sendTask({queryId:t,from:o.SequenceReference.NcbiGenome,to:e,range:n},t=>r(this,void 0,void 0,(function*(){const n=t;yield this.collectChromosomeWorkerResults(i,e,n,!1)})));else for(let n=0;n<30;n++)this.nTasks++,this.alignmentCollectorQueue.sendTask({queryId:t,from:o.SequenceReference.NcbiGenome,to:e,range:[n*this.batchSize,(n+1)*this.batchSize]},t=>r(this,void 0,void 0,(function*(){const r=t;yield this.collectChromosomeWorkerResults(n,e,r,!1)})))}collectChromosomeWorkerResults(t,e,n,i){return r(this,void 0,void 0,(function*(){this.completeTasks++,this.targetAlignmentList.get(e)[t]=n.target_alignment,console.log("Completed "+Math.floor(this.completeTasks/this.nTasks*100)+"%"),i?yield this.plot():this.nTasks==this.completeTasks&&(console.log("All Tasks Completed. Starting Rendering"),this.alignmentCollectorQueue.terminateWorkers(),yield this.plot())}))}collectExons(t,e,n,r,i,a){const c=new Array;return t.forEach((t,n)=>{0==t.aligned_regions.length||"query"==e&&this.targetFilterFlag&&!this.targetCoverages.has(t.target_id)||"target"==e&&null!=a&&a!=t.target_id||c.push({data:[this.normalizeTargetAlignment(t,e)],id:t.target_id})}),this.simplifyExonTracks(c.sort((t,e)=>{const n=t.data,r=e.data;return n[0].begin!=r[0].begin?n[0].begin-r[0].begin:r[0].end!=n[0].end?r[0].end-n[0].end:n[0].gaps.map(t=>t.end-t.begin).reduce((t,e)=>t+e,0)-r[0].gaps.map(t=>t.end-t.begin).reduce((t,e)=>t+e,0)}).map(t=>("target"!=e||this.chrSet.includes(t.id)||this.chrSet.push(t.id),t.data)),e,i).map((t,e)=>({trackId:"pdbTracks_"+Math.random().toString(36).substr(2),displayType:"composite",trackColor:"#F9F9F9",rowTitle:"",titleFlagColor:r,overlap:!0,displayConfig:[{displayType:"block",displayData:t,displayColor:n,selectDataInRangeFlag:!0,hideEmptyTrackFlag:!0,minRatio:2e-4}]}))}normalizeTargetAlignment(t,e){const n="query"===e?"query_begin":"target_begin",r="query"===e?"query_end":"target_end",i={begin:Math.min(t.aligned_regions[0][n],t.aligned_regions[t.aligned_regions.length-1][r]),end:Math.max(t.aligned_regions[0][n],t.aligned_regions[t.aligned_regions.length-1][r]),gaps:[],description:[t.target_id],openBegin:t.orientation<0,openEnd:t.orientation>0};return t.orientation>0?("query"==e&&t.aligned_regions[t.aligned_regions.length-1][r]>this.maxRange&&(this.maxRange=t.aligned_regions[t.aligned_regions.length-1][r]),"query"==e&&t.aligned_regions[0][n]<this.minRange&&(this.minRange=t.aligned_regions[0][n]),t.aligned_regions.forEach((e,a)=>{if(a+1<t.aligned_regions.length){const c=t.aligned_regions[a+1];let o=e[r],s=c[n];const l=e.exon_shift;1==(null==l?void 0:l.length)?(1==Math.abs(l[0]-s)||i.gaps.push({end:l[0],begin:o,isConnected:!0}),s=l[0]):2==(null==l?void 0:l.length)&&(1==Math.abs(l[1]-s)&&1==Math.abs(l[1]-l[0])?s=l[0]:1==Math.abs(l[1]-s)?(i.gaps.push({end:l[0],begin:o,isConnected:!0}),o=l[0],s=l[1]):1==Math.abs(l[1]-l[0])?(i.gaps.push({end:l[0],begin:o,isConnected:!0}),o=l[1]):(i.gaps.push({end:l[0],begin:o,isConnected:!0}),o=l[0],i.gaps.push({end:l[1],begin:o,isConnected:!0}),o=l[1])),i.gaps.push({begin:o,end:s,isConnected:!0})}})):("query"==e&&t.aligned_regions[0][n]>this.maxRange&&(this.maxRange=t.aligned_regions[0][n]),"query"==e&&t.aligned_regions[t.aligned_regions.length-1][r]<this.minRange&&(this.minRange=t.aligned_regions[t.aligned_regions.length-1][r]),t.aligned_regions.reverse().forEach((e,a)=>{if(a+1<t.aligned_regions.length){const c=t.aligned_regions[a+1];let o=e[n],s=c[r];const l=c.exon_shift;1==(null==l?void 0:l.length)?(1==Math.abs(l[0]-o)||i.gaps.push({end:l[0],begin:o,isConnected:!0}),o=l[0]):2==(null==l?void 0:l.length)&&(1==Math.abs(l[1]-o)&&1==Math.abs(l[1]-l[0])?o=l[0]:1==Math.abs(l[1]-o)?(o=l[1],i.gaps.push({end:l[0],begin:o,isConnected:!0}),o=l[0]):1==Math.abs(l[1]-l[0])?(i.gaps.push({end:l[0],begin:o,isConnected:!0}),o=l[1]):(i.gaps.push({end:l[0],begin:o,isConnected:!0}),o=l[0],i.gaps.push({end:l[1],begin:o,isConnected:!0}),o=l[1])),i.gaps.push({end:s,begin:o,isConnected:!0})}})),i}simplifyExonTracks(t,e,n){const r=new Array;return t.forEach(t=>{const e=t[0].begin,n=t[0].end;if(0==r.length)this.entityBegin>0&&this.entityEnd>0&&!(e>this.entityEnd||n<this.entityBegin)&&(e<this.beginView&&(this.beginView=e),n>this.endView&&(this.endView=n)),r.push(t);else{const i=r.length-1,a=r[i][0].begin,c=r[i][0].end;e+"."+t[0].gaps.map(t=>t.begin+"."+t.end).join(".")+"."+n!=a+"."+r[i][0].gaps.map(t=>t.begin+"."+t.end).join(".")+"."+c?(this.entityBegin>0&&this.entityEnd>0&&!(e>this.entityEnd||n<this.entityBegin)&&(e<this.beginView&&(this.beginView=e),n>this.endView&&(this.endView=n)),r.push(t)):r[i][0].description.push(t[0].description[0])}}),r}mergeExonTracks(t,e){const n=new Array;return t.forEach(t=>{if(0==n.length)n.push(t);else{const e=t.displayConfig[0].displayData[0].begin;let r=-1;n.forEach((t,n)=>{const i=t.displayConfig[0].displayData.length-1,a=t.displayConfig[0].displayData[i].end;e>a&&-1==r&&(r=n)}),r>=0?n[r].displayConfig[0].displayData.push(t.displayConfig[0].displayData[0]):-1==r&&n.push(t)}}),this.addSequences(n,e),n}addSequences(t,e){t.forEach(t=>{var n,r;const i=new Map;t.displayConfig[0].displayData.forEach(t=>{i.set([t.begin,t.end],t.description[0])}),t.displayConfig.push({displayType:"sequence",updateDataOnMove:g(e,i,null===(r=null===(n=this.rcsbFv)||void 0===n?void 0:n.getBoardConfig())||void 0===r?void 0:r.trackWidth),displayData:[],hideEmptyTrackFlag:!0,minRatio:.001})})}setDisplayView(){var t,e,n,i;return r(this,void 0,void 0,(function*(){if(0==this.entityBegin&&0==this.entityEnd&&(null===(e=null===(t=this.pdbEntityTrack)||void 0===t?void 0:t.displayConfig)||void 0===e?void 0:e.length)>0){const t=this.pdbEntityTrack.displayConfig[0].displayData.length-1;this.entityBegin=this.pdbEntityTrack.displayConfig[0].displayData[0].begin,this.entityEnd=this.pdbEntityTrack.displayConfig[0].displayData[t].end,this.beginView=this.pdbEntityTrack.displayConfig[0].displayData[0].begin,this.endView=this.pdbEntityTrack.displayConfig[0].displayData[t].end;const e=this.beginView,n=this.endView,r=n-e;this.boardConfigData.range={min:e-Math.ceil(.05*r),max:n+Math.ceil(.05*r)}}else if((null===(i=null===(n=this.pdbEntityTrack)||void 0===n?void 0:n.displayConfig)||void 0===i?void 0:i.length)>0){this.beginView=this.minRange,this.endView=this.maxRange;const t=this.beginView,e=this.endView,n=e-t;this.boardConfigData.range={min:t-Math.ceil(.05*n),max:e+Math.ceil(.05*n)},this.updateChromosomeTitleRegion()}yield this.display()}))}plot(){var t;return r(this,void 0,void 0,(function*(){console.log("PROCESSING");let e=new Array,n=new Array;this.targetAlignmentList.get(o.SequenceReference.NcbiProtein).forEach((t,e)=>{t.length>0&&(n=n.concat(this.collectExons(t,"query","#69b3a2","#69b3a2",o.SequenceReference.NcbiProtein)))}),n=this.mergeExonTracks(n,o.SequenceReference.NcbiProtein);let r=new Array;this.targetAlignmentList.get(o.SequenceReference.Uniprot).forEach((t,e)=>{t.length>0&&(r=r.concat(this.collectExons(t,"query","#cc99ff","#cc99ff",o.SequenceReference.Uniprot)))}),r=this.mergeExonTracks(r,o.SequenceReference.Uniprot);let i=new Array;this.targetAlignmentList.get(o.SequenceReference.PdbEntity).forEach((t,e)=>{t.length>0&&(i=i.concat(this.collectExons(t,"query",l.RcsbAnnotationConstants.provenanceColorCode.rcsbPdb,l.RcsbAnnotationConstants.provenanceColorCode.rcsbPdb,o.SequenceReference.PdbEntity)))}),i=this.mergeExonTracks(i,o.SequenceReference.PdbEntity),n.length>0&&(e=e.concat(n),n[0].rowTitle="NCBI PROTEINS"),r.length>0&&(e=e.concat(r),r[0].rowTitle="UNIPROT PROTEINS"),i.length>0&&(e=e.concat(i),i[0].rowTitle="PDB ENTITIES");const a=(null===(t=this.featuresConfigData)||void 0===t?void 0:t.length)>0?this.nonExonConfigData.concat(this.featuresConfigData):this.nonExonConfigData;e.length>0?this.rowConfigData=a.concat(e):this.rowConfigData=a,console.log("RENDERING"),this.boardConfigData.hideInnerBorder=!0,this.boardConfigData.length=Math.floor(this.maxRange+.01*this.maxRange),this.boardConfigData.includeAxis=!0,yield this.setDisplayView(),this.buildSubject.next(void 0),this.targetsSubject.next(this.chrSet)}))}protectedBuild(t){return r(this,void 0,void 0,(function*(){return new Promise((e,n)=>{p.ObservableHelper.oneTimeSubscription(e,this.buildSubject),t.elementSelectId&&(this.elementSelectId=t.elementSelectId),null!=t.entityId?this.buildPdbGenomeFv(t.entityId,t.chrId):null!=t.chrId&&this.buildFullGenomeRangeFv(t.chrId)})}))}getTargets(){return r(this,void 0,void 0,(function*(){return new Promise((t,e)=>{this.chrSet.length>0?t(this.chrSet):p.ObservableHelper.oneTimeSubscription(t,this.targetsSubject)})}))}concatAlignmentAndAnnotationTracks(t){}}e.RcsbFvChromosome=m},function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n),Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[n]}})}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.hasOwnProperty.call(t,n)&&r(e,t,n);return i(e,t),e};Object.defineProperty(e,"__esModule",{value:!0}),e.SequenceCollectorHelper=void 0;const c=n(4),o=n(5),s=a(n(16)),l=n(12),u=n(21);e.SequenceCollectorHelper=class{buildAlignments(t,e,n){const r=new Array,i=new Array;return t.targetAlignmentList instanceof Array&&t.targetAlignmentList.sort((t,e)=>t.target_id.localeCompare(e.target_id)).forEach(a=>{if(null!=t.filterByTargetContains&&!a.target_id.includes(t.filterByTargetContains))return;if(null==a.target_sequence)return;const c=a.target_sequence,s={queryId:t.queryId,targetId:a.target_id,from:t.from,to:t.to,targetSequenceLength:c.length};r.push(a.target_id);const h=[];let d=[];const f=[];a.aligned_regions.forEach(e=>{const r=c.substring(e.target_begin-1,e.target_end);this.buildSequenceData(Object.assign(Object.assign({},s),{sequenceData:h,sequence:r,begin:e.query_begin,oriBegin:e.target_begin}));let i=!1;1!=e.target_begin&&(i=!0);let o=!1;e.target_end!=c.length&&(o=!0),n(e,s).forEach(e=>{var n,r;d.push(this.addAuthorResIds({begin:e.query_begin,end:e.query_end,oriBegin:e.target_begin,oriEnd:e.target_end,sourceId:a.target_id,source:t.to,provenanceName:l.RcsbAnnotationConstants.provenanceName.pdb,provenanceColor:l.RcsbAnnotationConstants.provenanceColorCode.rcsbPdb,openBegin:null!==(n=e.openBegin)&&void 0!==n?n:i,openEnd:null!==(r=e.openEnd)&&void 0!==r?r:o,type:"ALIGNED_BLOCK",title:e.unModelled?"UNMODELED REGION":"ALIGNED REGION",color:e.unModelled?"#AAAAAA":void 0},s))}),function(t,e){const n=[];if(t.length===e.length)for(let r=0;r<t.length;r++)t.charAt(r)!==e.charAt(r)&&n.push(r);return n}(r,t.querySequence.substring(e.query_begin-1,e.query_end)).forEach(n=>{f.push(this.addAuthorResIds({begin:n+e.query_begin,oriBegin:n+e.target_begin,sourceId:a.target_id,source:t.to,provenanceName:l.RcsbAnnotationConstants.provenanceName.pdb,provenanceColor:l.RcsbAnnotationConstants.provenanceColorCode.rcsbPdb,type:"MISMATCH",title:"MISMATCH"},s))})}),u.FeatureTools.mergeBlocks(d);const v={displayType:"sequence",displayColor:"#000000",displayData:h,dynamicDisplay:e},p={displayType:"pin",displayColor:"#FF9999",displayData:f},g={displayType:"block",displayColor:"#9999FF",displayData:d};let m=t.to?t.to.replace("_"," ")+" "+o.TagDelimiter.alignmentTitle:"";const y={trackId:"targetSequenceTrack_"+a.target_id,displayType:"composite",trackColor:"#F9F9F9",rowPrefix:m,rowTitle:this.buildAlignmentRowTitle(a,t),fitTitleWidth:t.fitTitleWidth,titleFlagColor:l.RcsbAnnotationConstants.provenanceColorCode.rcsbPdb,displayConfig:[g,p,v]};i.push(y)}),{targets:r,alignments:i}}buildSequenceData(t,e){let n=t.to;!0===e&&(n=t.from);let r=l.RcsbAnnotationConstants.provenanceColorCode.external;return n!=c.Source.PdbInstance&&n!=c.Source.PdbEntity||(n=l.RcsbAnnotationConstants.provenanceName.pdb,r=l.RcsbAnnotationConstants.provenanceColorCode.rcsbPdb),t.sequence.split("").forEach((e,i)=>{const a={begin:t.begin+i,sourceId:t.targetId,source:t.to,provenanceName:n,provenanceColor:r,value:e};"string"==typeof t.targetId&&(a.sourceId=t.targetId),"number"==typeof t.oriBegin&&(a.oriBegin=t.oriBegin+i),t.sequenceData.push(this.addAuthorResIds(a,{from:t.from,to:t.to,queryId:t.queryId,targetId:t.targetId}))}),t.sequenceData}buildSequenceRowTitle(t){let e;return e=t.excludeFirstRowLink||t.from!==c.SequenceReference.Uniprot?t.excludeFirstRowLink||t.from!==c.SequenceReference.PdbInstance||null==this.entityInstanceTranslator?{visibleTex:t.queryId,style:{fontWeight:"bold"}}:{visibleTex:this.buildInstanceId(t.queryId),style:{fontWeight:"bold"}}:{visibleTex:t.queryId,url:s.rcsb_uniprot.url+t.queryId,style:{fontWeight:"bold",color:l.RcsbAnnotationConstants.provenanceColorCode.rcsbPdb}},e}buildAlignmentRowTitle(t,e){let n;if(e.to===c.SequenceReference.PdbInstance&&null!=this.entityInstanceTranslator){const e=this.entityInstanceTranslator.translateAsymToEntity(t.target_id.split(o.TagDelimiter.instance)[1]);n={visibleTex:this.buildInstanceId(t.target_id),url:s.rcsb_entry.url+t.target_id.split(o.TagDelimiter.instance)[0]+"#entity-"+e,style:{fontWeight:"bold",color:l.RcsbAnnotationConstants.provenanceColorCode.rcsbPdb}}}else if(e.to!==c.SequenceReference.PdbEntity||e.excludeAlignmentLinks)if(e.to!==c.SequenceReference.PdbInstance||e.excludeAlignmentLinks||null==this.entityInstanceTranslator)n=e.to===c.SequenceReference.Uniprot?{visibleTex:t.target_id,url:s.rcsb_uniprot.url+t.target_id,style:{fontWeight:"bold",color:l.RcsbAnnotationConstants.provenanceColorCode.rcsbPdb}}:t.target_id;else{const e=this.entityInstanceTranslator.translateAsymToEntity(t.target_id.split(o.TagDelimiter.instance)[1]);n={visibleTex:this.buildInstanceId(t.target_id),url:s.rcsb_entry.url+t.target_id.split(o.TagDelimiter.instance)[0]+"#entity-"+e,style:{fontWeight:"bold",color:l.RcsbAnnotationConstants.provenanceColorCode.rcsbPdb}}}else{const e=t.target_id.split(o.TagDelimiter.entity)[1];n={visibleTex:t.target_id,url:s.rcsb_entry.url+t.target_id.split(o.TagDelimiter.entity)[0]+"#entity-"+e,style:{fontWeight:"bold",color:l.RcsbAnnotationConstants.provenanceColorCode.rcsbPdb}}}return n}addAuthorResIds(t,e){let n=t;return null!=this.entityInstanceTranslator&&this.entityInstanceTranslator.addAuthorResIds(n,e),e.to==c.SequenceReference.PdbInstance&&null!=n.sourceId&&(n.sourceId=n.sourceId.split(o.TagDelimiter.instance)[0]+o.TagDelimiter.instance+this.entityInstanceTranslator.translateAsymToAuth(n.sourceId.split(o.TagDelimiter.instance)[1])),n}buildInstanceId(t){var e;const n=t.split(o.TagDelimiter.instance)[1],r=null===(e=this.entityInstanceTranslator)||void 0===e?void 0:e.translateAsymToAuth(n);return n!==r&&r?n+"[auth "+r+"]":n}setPolymerEntityInstanceTranslator(t){this.entityInstanceTranslator=t}}},function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n),Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[n]}})}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.hasOwnProperty.call(t,n)&&r(e,t,n);return i(e,t),e},c=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,a){function c(t){try{s(r.next(t))}catch(t){a(t)}}function o(t){try{s(r.throw(t))}catch(t){a(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,o)}s((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.SwissModelQueryAnnotations=void 0;const o=a(n(16));class s{static request(t){return c(this,void 0,void 0,(function*(){const e=s.url+t+s.urlSuffix;try{const t=yield fetch(e),n=yield t.json();return s.parse(n)}catch(t){throw console.error(t),t}}))}static parse(t){const e=new Array;return t.result.structures.forEach(t=>{const n={provenance_source:t.provider,type:t.method,feature_positions:[{beg_seq_id:t.from,end_seq_id:t.to}]};e.push(n)}),[{features:e}]}}e.SwissModelQueryAnnotations=s,s.url=o.swiss_model.url,s.urlSuffix=o.swiss_model.url_suffix},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AnnotationCollectorHelper=void 0;const r=n(39),i=n(12),a=n(21);class c{static buildAnnotationTrack(t,e,n,r){let a,o;const s=n;return null!==s&&(o=s.display),a="composite"===o||"bond"===o||"pin"===o?c.buildRcsbFvRowConfigComposite(t,e,n):"area"===o||"line"===o?c.buildRcsbFvRowConfigArea(t,e,n):"block-area"===o?c.buildRcsbFvRowConfigBlockArea(t,e,n):c.buildRcsbFvRowConfigTrack(t,e,n),null!=s&&"number"==typeof s.height&&(a.trackHeight=s.height),r instanceof Array&&1==r.length&&(r[0]===i.RcsbAnnotationConstants.provenanceName.pdb||r[0]===i.RcsbAnnotationConstants.provenanceName.promotif)?a.titleFlagColor=i.RcsbAnnotationConstants.provenanceColorCode.rcsbPdb:a.titleFlagColor=i.RcsbAnnotationConstants.provenanceColorCode.external,a}static buildRcsbFvRowConfigTrack(t,e,n){const i=t.values();let a="block";i.length>0&&null==i[0].end&&(a="pin");let o=r.RcsbAnnotationConfig.randomRgba(),s=e,l=void 0;const u=n;return null!==u?(a=u.display,s=c.buildRowTitle(u),o=u.color,l=u.prefix):console.warn("Annotation config type "+e+" not found. Using random config"),Object.assign(Object.assign({},n),{trackId:"annotationTrack_"+e,displayType:a,trackColor:"#F9F9F9",displayColor:o,rowTitle:s,rowPrefix:l,trackData:i})}static buildRcsbFvRowConfigArea(t,e,n){var r;const i=t.values(),a=n,o=a.display,s=a.color,l=c.buildRowTitle(a),u=a.prefix;let h=t.getRange().min,d=t.getRange().max;h>=0?h=0:Math.abs(h)>Math.abs(d)?d=-h:h=-d;const f=null!==(r=a.domain)&&void 0!==r?r:[h,d];return Object.assign(Object.assign({},n),{trackId:"annotationTrack_"+e,displayType:o,trackColor:"#F9F9F9",displayColor:s,rowTitle:l,rowPrefix:u,displayDomain:f,interpolationType:"step",trackData:i})}static buildRcsbFvRowConfigBlockArea(t,e,n){const r=t.values(),i=n,a=i.display,o=i.color,s=c.buildRowTitle(i),l=i.prefix;return Object.assign(Object.assign({},n),{trackId:"annotationTrack_"+e,displayType:a,trackColor:"#F9F9F9",displayColor:o,rowTitle:s,rowPrefix:l,displayDomain:[0,1],interpolationType:"step",trackData:r})}static buildRcsbFvRowConfigComposite(t,e,n){var i;const a=t.values();let o;const s=n;let l="block";s.display==="bond".toString()&&(l="bond",a.forEach(t=>{t.isEmpty=!0}));const u=c.buildRowTitle(s),h=s.prefix,d=null!==(i=s.color)&&void 0!==i?i:r.RcsbAnnotationConfig.randomRgba(),f=new Array,v=new Array;if(a.forEach(t=>{null!==t.end&&t.end!==t.begin?v.push(t):f.push(t)}),f.length>0&&v.length>0){const t=new Array;t.push({displayData:v,displayType:l,displayColor:d}),t.push({displayData:f,displayType:"pin",displayColor:d}),o={displayType:"composite",trackColor:"#F9F9F9",trackId:"annotationTrack_"+e,rowTitle:u,rowPrefix:h,displayConfig:t}}else f.length>0&&(l="pin");return void 0===o&&(o={trackId:"annotationTrack_"+e,displayType:l,trackColor:"#F9F9F9",displayColor:d,rowTitle:u,rowPrefix:h,trackData:a}),o}static buildRowTitle(t){return t.prefix?a.FeatureTools.parseLink(t.title):t.title}}e.AnnotationCollectorHelper=c},function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,a){function c(t){try{s(r.next(t))}catch(t){a(t)}}function o(t){try{s(r.throw(t))}catch(t){a(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,o)}s((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.AnnotationTrackManager=void 0;const i=n(95);e.AnnotationTrackManager=class{constructor(t){this.annotationTracks=new Map,this.rcsbAnnotationConfig=t}processRcsbPdbAnnotations(t,e){var n,i,a;return r(this,void 0,void 0,(function*(){yield this.addAnnotationToTracks(e,"function"==typeof(null===(n=e.externalAnnotationTrackBuilder)||void 0===n?void 0:n.filterFeatures)?yield null===(i=e.externalAnnotationTrackBuilder)||void 0===i?void 0:i.filterFeatures({annotations:t,rcsbContext:e.rcsbContext}):t),null===(a=e.annotationProcessing)||void 0===a||a.computeAnnotationValue(this.annotationTracks),this.mergeTracks()}))}getAnnotationTracks(){return this.annotationTracks}getPolymerEntityInstanceTranslator(){return this.polymerEntityInstanceTranslator}setPolymerEntityInstanceTranslator(t){this.polymerEntityInstanceTranslator=t}mergeTracks(){this.annotationTracks.forEach((t,e)=>{if(this.rcsbAnnotationConfig.isMergedType(e)){const t=this.rcsbAnnotationConfig.getMergedType(e),n=this.rcsbAnnotationConfig.getConfig(e).color;this.annotationTracks.has(t)||this.annotationTracks.set(t,new i.AnnotationTrack(e,this.rcsbAnnotationConfig.getConfig(e),this.getPolymerEntityInstanceTranslator())),this.annotationTracks.get(t).addAll(this.annotationTracks.get(e),n),this.rcsbAnnotationConfig.addMultipleProvenance(t,Array.from(this.annotationTracks.get(t).getTrackProvenance())),this.annotationTracks.delete(e)}})}buildType(t,e,n){return r(this,void 0,void 0,(function*(){return this.rcsbAnnotationConfig.buildAndAddType(n,"function"==typeof t.trackTitle?yield t.trackTitle(e,n):void 0,"function"==typeof t.titleSuffix?yield t.titleSuffix(e,n):void 0,"function"==typeof t.typeSuffix?yield t.typeSuffix(e,n):void 0)}))}addAnnotationToTracks(t,e){return r(this,void 0,void 0,(function*(){yield Promise.all(e.map(e=>e.features.map(n=>r(this,void 0,void 0,(function*(){return yield this.addFeature(t,e,n)})))).flat())}))}addFeature(t,e,n){var a;return r(this,void 0,void 0,(function*(){if(null===(a=this.rcsbAnnotationConfig.getConfig(n.type))||void 0===a?void 0:a.ignore)return;const r=yield this.buildType(t,e,n);this.annotationTracks.has(r)||this.annotationTracks.set(r,new i.AnnotationTrack(r,this.rcsbAnnotationConfig.getConfig(r),this.getPolymerEntityInstanceTranslator())),this.rcsbAnnotationConfig.addProvenance(r,n.provenance_source),this.annotationTracks.get(r).addFeature({reference:t.reference,queryId:t.queryId,source:e.source,targetId:e.target_id,feature:n},t.annotationProcessing)}))}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AnnotationTrack=void 0;const r=n(4),i=n(12),a=n(5);e.AnnotationTrack=class{constructor(t,e,n){this.valueRange={max:Number.MIN_SAFE_INTEGER,min:Number.MAX_SAFE_INTEGER},this.trackElementMap=new Map,this.entityInstanceTranslator=n,this.type=t,this.annotationConfig=e}getRange(){return this.valueRange}addFeature(t,e){(function(t){const e=new Map,n=new Array;return t.forEach(t=>{null!=t.range_id?(e.has(t.range_id)||e.set(t.range_id,new Array),e.get(t.range_id).push(t)):n.push(t)}),e.forEach((t,e)=>{if(1==t.length)n.push(t[0]);else{const e=t.sort((t,e)=>t.beg_seq_id-e.beg_seq_id),r=Object.assign(Object.assign({},e[0]),{end_seq_id:e[e.length-1].end_seq_id,end_ori_id:e[e.length-1].end_ori_id,open_end:e[e.length-1].open_end,gaps:new Array});for(let t=0;t<e.length-1;t++)r.gaps.push({begin:e[t].end_seq_id,end:e[t+1].beg_seq_id,isConnected:null==e[t].beg_ori_id||null==e[t].end_ori_id||null==e[t+1].beg_ori_id||null==e[t+1].end_ori_id||e[t].end_ori_id+1==e[t+1].beg_ori_id||e[t].end_ori_id==e[t+1].beg_ori_id+1||e[t].end_ori_id==e[t+1].beg_ori_id});n.push(r)}}),n})(t.feature.feature_positions).forEach(n=>{null!=n.beg_seq_id&&this.annotationRangeKeys(n).forEach(r=>{this.addRange(t.reference,t.queryId,t.source,t.targetId,t.feature,n,r,e)})})}size(){return this.trackElementMap.size}forEach(t){this.trackElementMap.forEach((e,n)=>{t(e,n)})}addAll(t,e){t.forEach((t,n)=>{t.color=null!=e?e:t.color,this.trackElementMap.set(n,t)})}getTrackProvenance(){return new Set(Array.from(this.trackElementMap.values()).map(t=>t.provenanceName))}set(t,e){this.trackElementMap.set(t,e)}values(){return Array.from(this.trackElementMap.values())}buildRcsbFvTrackDataElement(t,e,n,c,o){var s,l,u,h,d,f;let v=null!==(l=null===(s=this.annotationConfig)||void 0===s?void 0:s.title)&&void 0!==l?l:this.type,p=void 0;this.isNumericalDisplay(this.type)&&(p=(null===(u=this.annotationConfig)||void 0===u?void 0:u.transformToNumerical)?1:t.values instanceof Array&&null!==(h=t.values[0])&&void 0!==h?h:0),t.values instanceof Array&&t.values.length>0?(Math.max(...t.values)>this.valueRange.max&&(this.valueRange.max=Math.max(...t.values)),Math.min(...t.values)<this.valueRange.min&&(this.valueRange.min=Math.min(...t.values))):"number"==typeof p&&(p>this.valueRange.max&&(this.valueRange.max=p),p<this.valueRange.min&&(this.valueRange.min=p));let g=i.RcsbAnnotationConstants.provenanceColorCode.external;o!==i.RcsbAnnotationConstants.provenanceName.pdb&&o!==i.RcsbAnnotationConstants.provenanceName.promotif||(g=i.RcsbAnnotationConstants.provenanceColorCode.rcsbPdb);const m=c==r.Source.PdbInstance&&null!=this.entityInstanceTranslator?n.split(a.TagDelimiter.instance)[0]+a.TagDelimiter.instance+this.entityInstanceTranslator.translateAsymToAuth(n.split(a.TagDelimiter.instance)[1]):n;return{begin:t.beg_seq_id,end:null!==(d=t.end_seq_id)&&void 0!==d?d:t.beg_seq_id,oriBegin:t.beg_ori_id,oriEnd:null!==(f=t.end_ori_id)&&void 0!==f?f:t.beg_ori_id,description:new Array,featureId:e.feature_id,type:this.type,title:v,name:e.name,value:p,gValue:e.value,gaps:t.gaps,sourceId:m,source:c,provenanceName:o,provenanceColor:g,openBegin:t.open_begin,openEnd:t.open_end}}addRange(t,e,n,r,i,a,c,o){var s,l;const u=c.join(":");if(this.trackElementMap.has(u))this.isNumericalDisplay(this.type)&&(null===(l=this.annotationConfig)||void 0===l?void 0:l.transformToNumerical)&&"number"==typeof this.trackElementMap.get(u).value&&(this.trackElementMap.get(u).value+="function"==typeof(null==o?void 0:o.getAnnotationValue)?o.getAnnotationValue({type:this.type,targetId:r,positionKey:u,d:i,p:a}):1,this.trackElementMap.get(u).value>this.valueRange.max&&(this.valueRange.max=this.trackElementMap.get(u).value),this.trackElementMap.get(u).value<this.valueRange.min&&(this.valueRange.min=this.trackElementMap.get(u).value));else{const l=this.buildRcsbFvTrackDataElement(a,i,r,n,i.provenance_source);(null===(s=this.annotationConfig)||void 0===s?void 0:s.transformToNumerical)&&this.transformToNumerical(r,c,u,l,i,a,null==o?void 0:o.getAnnotationValue),"function"==typeof(null==o?void 0:o.addTrackElementCallback)&&(null==o||o.addTrackElementCallback({type:this.type,targetId:r,positionKey:u,d:i,p:a}));const h={from:t,to:n,queryId:e,targetId:r};this.addAuthorResIds(l,h),this.trackElementMap.set(u,l),a.values instanceof Array&&this.expandValues(l,a.values,h)}"string"==typeof i.description&&this.trackElementMap.get(u).description.push(i.description)}transformToNumerical(t,e,n,r,i,a,c){"function"==typeof c&&(r.value=c({type:this.type,targetId:t,positionKey:n,d:i,p:a})),r.begin=e[0],r.end=e[0]}expandValues(t,e,n){e.forEach((e,r)=>{if(r>0){const i=(t.begin+r).toString(),a=Object.assign(Object.assign({},t),{begin:t.begin+r,end:null,oriBegin:t.oriBegin?t.oriBegin+r:null,oriEnd:null,value:e});this.addAuthorResIds(a,n),this.trackElementMap.set(i,a)}})}addAuthorResIds(t,e){let n=t;return null!=this.entityInstanceTranslator&&e.from&&this.entityInstanceTranslator.addAuthorResIds(n,e),n}isNumericalDisplay(t){return null!=this.annotationConfig&&("area"===this.annotationConfig.display||"block-area"===this.annotationConfig.display||"multi-area"===this.annotationConfig.display||"line"===this.annotationConfig.display)}annotationRangeKeys(t){var e,n,r;const i=new Array;if((null===(e=this.annotationConfig)||void 0===e?void 0:e.transformToNumerical)&&null!=t.end_seq_id)for(let e=t.beg_seq_id;e<=t.end_seq_id;e++)i.push([e]);else if(null===(n=this.annotationConfig)||void 0===n?void 0:n.transformToNumerical)i.push([t.beg_seq_id]);else{const e=null!=t.end_seq_id?[t.beg_seq_id,t.end_seq_id]:[t.beg_seq_id,t.beg_seq_id];(null===(r=this.annotationConfig)||void 0===r?void 0:r.displayCooccurrence)&&e.push(Math.ceil(1e12*Math.random())),i.push(e)}return i}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.RcsbFvAlignmentCollectorQueue=void 0;const r=n(14);e.RcsbFvAlignmentCollectorQueue=class{constructor(t){this.workerList=new Array,this.taskQueue=new Array,this.isQueueActive=!1,this.nWorkers=null!=t?t:self.navigator.hardwareConcurrency;for(let t=0;t<this.nWorkers;t++)this.workerList.push({available:!0,worker:new Worker("/saguaro/worker.js")})}sendTask(t,e){const n=this.workerList.filter(t=>t.available);n.length>0?(n[0].available=!1,n[0].worker.postMessage(t),n[0].worker.onmessage=t=>{e(t.data),n[0].available=!0}):(this.taskQueue.push({request:t,callback:e}),this.isQueueActive||this.activateQueue())}activateQueue(){this.isQueueActive=!0,this.recursiveExec()}recursiveExec(){0==this.taskQueue.length?this.isQueueActive=!1:(this.isQueueActive=!0,this.workerList.filter(t=>t.available).forEach(t=>{if(this.taskQueue.length>0){t.available=!1;const e=this.taskQueue.shift();t.worker.postMessage(e.request),t.worker.onmessage=n=>{e.callback(n.data),t.available=!0}}}),r.asyncScheduler.schedule(()=>{this.recursiveExec()},1e3))}terminateWorkers(){this.workerList.forEach(t=>{t.worker.terminate()})}}},function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n),Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[n]}})}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.hasOwnProperty.call(t,n)&&r(e,t,n);return i(e,t),e};Object.defineProperty(e,"__esModule",{value:!0}),e.NcbiGenomeSequenceData=void 0;const c=n(14),o=a(n(16));class s{static update(t,e,n,r){let i=null;return a=>(i&&i.unsubscribe(),new Promise((o,l)=>{if((r?r/(a.to-a.from):1e3/(a.to-a.from))>4){let r=0;const u=5e3,h=()=>{const d=new XMLHttpRequest;d.timeout=u;const f=s.urlPrefix+"id="+t+"&from="+a.from+"&to="+a.to+"&strand="+e+s.urlSuffix;d.open("GET",f),d.send(),d.onloadend=t=>{const e=d.responseText.split("\n").slice(1).join("");if(e.length<1)r++,console.warn("HTTP error while access URL: "+f+" - empty sequence - "+r),r<4?i=c.asyncScheduler.schedule(()=>{h()},u):l("HTTP error while access URL: "+f+" - No more attempts after "+r);else{const t=[{begin:a.from,value:n?e.split("").reverse().join(""):e}];o(t)}},d.onerror=t=>{r++,console.warn("HTTP error while access URL: "+f+" - "+r),r<4?i=c.asyncScheduler.schedule(()=>{h()},u):l("HTTP error while access URL: "+f+" - No more attempts after "+r)}};h()}else o(null)}))}}e.NcbiGenomeSequenceData=s,s.urlPrefix=o.ncbi_genome_sequence.url,s.urlSuffix=o.ncbi_genome_sequence.url_suffix},function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n),Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[n]}})}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.hasOwnProperty.call(t,n)&&r(e,t,n);return i(e,t),e};Object.defineProperty(e,"__esModule",{value:!0}),e.NcbiSummary=void 0;const c=n(14),o=a(n(16));class s{static requestChromosomeData(t){s.jobTask&&s.jobTask.unsubscribe();const e=o.ncbi_summary_nuccore.url,n=o.ncbi_summary_nuccore.url_suffix;return new Promise((r,i)=>{const a=()=>{const i=e+t+n,o=new XMLHttpRequest;o.timeout=s.httpTimeout,o.open("GET",i),o.send(),o.onloadend=e=>{var n,i;if(0==o.responseText.length)s.jobTask=c.asyncScheduler.schedule(()=>{a()},s.timeout);else{const e=JSON.parse(o.responseText),a=null===(i=null===(n=e)||void 0===n?void 0:n.result)||void 0===i?void 0:i.uids[0],c=e.result[a];c.ncbiId=t,r(c)}},o.onerror=t=>{s.jobTask&&s.jobTask.unsubscribe(),s.jobTask=c.asyncScheduler.schedule(()=>{a()},s.timeout)}};a()})}static requestTaxonomyData(t){s.jobTask&&s.jobTask.unsubscribe();const e=o.ncbi_summary_taxonomy.url,n=o.ncbi_summary_taxonomy.url_suffix;return new Promise((r,i)=>{const a=()=>{const i=e+t+n,o=new XMLHttpRequest;o.timeout=s.httpTimeout,o.open("GET",i),o.send(),o.onloadend=t=>{var e,n;if(0==o.responseText.length)s.jobTask=c.asyncScheduler.schedule(()=>{a()},s.timeout);else{const t=JSON.parse(o.responseText),i=null===(n=null===(e=t)||void 0===e?void 0:e.result)||void 0===n?void 0:n.uids[0];r(t.result[i])}},o.onerror=t=>{s.jobTask=c.asyncScheduler.schedule(()=>{a()},s.timeout)}};a()})}}e.NcbiSummary=s,s.timeout=3e3,s.httpTimeout=1e4,s.jobTask=null},function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,a){function c(t){try{s(r.next(t))}catch(t){a(t)}}function o(t){try{s(r.throw(t))}catch(t){a(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,o)}s((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.RcsbFvPairwiseAligmentBuilder=void 0;const i=n(8),a=n(100);e.RcsbFvPairwiseAligmentBuilder=class{static buildPairwiseAlignment(t,e,n){return r(this,void 0,void 0,(function*(){return new Promise((r,c)=>{try{i.RcsbFvCoreBuilder.createFv({elementId:t,fvModuleI:a.RcsbFvPairwiseAlignment,config:{psa:e,additionalConfig:Object.assign({rcsbContext:{queryId:e.queryId,targetId:e.targetId}},n),resolve:r}})}catch(t){c(t)}})}))}}},function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,a){function c(t){try{s(r.next(t))}catch(t){a(t)}}function o(t){try{s(r.throw(t))}catch(t){a(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,o)}s((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.RcsbFvPairwiseAlignment=void 0;const i=n(9),a=n(101);class c extends i.RcsbFvAbstractModule{protectedBuild(t){var e;return r(this,void 0,void 0,(function*(){const n=new a.PairwiseAlignmentBuilder(t.psa),r=Object.assign({rowTitleWidth:120,trackWidth:800,length:n.getLength(),includeAxis:!t.psa.pairwiseView},null===(e=t.additionalConfig)||void 0===e?void 0:e.boardConfig);this.boardConfigData=Object.assign(Object.assign({},this.boardConfigData),r),this.rowConfigData=t.psa.pairwiseView?n.buildPairwiseAlignment():n.buildReferenceAlignment()}))}concatAlignmentAndAnnotationTracks(t){}}e.RcsbFvPairwiseAlignment=c},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.PairwiseAlignmentBuilder=void 0;const r=n(12),i=n(4),a=n(21),c=(t,e,n)=>{const r=n,i=1-r;return[Math.round(t[0]*r+e[0]*i),Math.round(t[1]*r+e[1]*i),Math.round(t[2]*r+e[2]*i)]};e.PairwiseAlignmentBuilder=class{constructor(t){if(this.querySequence=t.querySequence,this.targetSequence=t.targetSequence,this.queryAlignment=t.queryAlignment,this.targetAlignment=t.targetAlignment,this.queryBegin=t.queryBegin,this.queryEnd=t.queryEnd,this.targetBegin=t.targetBegin,this.targetEnd=t.targetEnd,this.targetId=t.targetId,this.queryId=t.queryId,this.sequenceId=t.sequenceId,this.isQueryExternal=t.isQueryExternal,this.isTargetExternal=t.isTargetExternal,this.pairwiseView=t.pairwiseView,this.queryAlignment.length!=this.targetAlignment.length)throw"Sequence alignments length mismatch";this.pairwiseView?this.alignmentLength=this.queryAlignment.length:this.alignmentLength=this.querySequence.length}getLength(){return this.alignmentLength}buildReferenceAlignment(){const t=this.queryAlignment.split(""),e=this.targetAlignment.split(""),n=[],a=[],o=[];let s=this.queryBegin,l=this.targetBegin,u=this.queryBegin,h=this.targetBegin;t.forEach((t,c)=>{const d=e[c];("-"===d||"-"===t)&&u>0&&(n.push({begin:u,end:s-1,oriBegin:h,oriEnd:l-1,source:i.SequenceReference.PdbEntity,sourceId:this.targetId,provenanceName:r.RcsbAnnotationConstants.provenanceName.mmseqs,provenanceColor:r.RcsbAnnotationConstants.provenanceColorCode.rcsbPdb,type:"ALIGNED_BLOCK",title:"ALIGNED REGION"}),u=0),"-"!=t&&"-"!=d&&(o.push({begin:s,oriBegin:l,source:i.SequenceReference.PdbEntity,sourceId:this.targetId,provenanceName:r.RcsbAnnotationConstants.provenanceName.mmseqs,provenanceColor:r.RcsbAnnotationConstants.provenanceColorCode.rcsbPdb,value:d,type:"RESIDUE",title:"RESIDUE"}),t!=d&&a.push({begin:s,oriBegin:l,source:i.SequenceReference.PdbEntity,sourceId:this.targetId,provenanceName:r.RcsbAnnotationConstants.provenanceName.mmseqs,provenanceColor:r.RcsbAnnotationConstants.provenanceColorCode.rcsbPdb,type:"MISMATCH",title:"MISMATCH"})),"-"!=d&&"-"!=t&&0==u&&(u=s,h=l),"-"!=t&&s++,"-"!=d&&l++}),u>0&&n.push({begin:u,end:s-1,oriBegin:h,oriEnd:l-1,source:i.SequenceReference.PdbEntity,sourceId:this.targetId,provenanceName:r.RcsbAnnotationConstants.provenanceName.mmseqs,provenanceColor:r.RcsbAnnotationConstants.provenanceColorCode.rcsbPdb,type:"ALIGNED_BLOCK",title:"ALIGNED REGION"}),this.addBlockTerminalTags(n);const d={trackId:"query_sequence",displayType:"sequence",trackColor:"#F9F9F9",displayColor:"#000000",titleFlagColor:this.isQueryExternal?r.RcsbAnnotationConstants.provenanceColorCode.external:r.RcsbAnnotationConstants.provenanceColorCode.rcsbPdb,rowTitle:this.queryId,nonEmptyDisplay:!0,trackData:[{value:this.querySequence,begin:1}]},f={displayType:"sequence",displayColor:"#333333",displayData:o},v={displayType:"pin",displayColor:"#FF9999",displayData:a,minRatio:5},p={displayType:"block",displayColor:"rgb("+c([153,153,255],[50,50,50],this.sequenceId).join(",")+")",displayData:n};return[d,{trackId:"targetSequenceTrack",rowTitle:this.targetId,displayType:"composite",trackColor:"#F9F9F9",titleFlagColor:this.isTargetExternal?r.RcsbAnnotationConstants.provenanceColorCode.external:r.RcsbAnnotationConstants.provenanceColorCode.rcsbPdb,displayConfig:[p,v,f]}]}buildPairwiseAlignment(){const t=this.queryAlignment.split(""),e=this.targetAlignment.split(""),n=[],a=[],o=[],s=[];let l=this.queryBegin,u=this.targetBegin,h=1;t.forEach((t,c)=>{const d=e[c];"-"===t||"-"===d?h>0&&c>h&&(n.push({begin:h,end:c,provenanceName:r.RcsbAnnotationConstants.provenanceName.mmseqs,provenanceColor:r.RcsbAnnotationConstants.provenanceColorCode.rcsbPdb,type:"ALIGNED_BLOCK",title:"ALIGNED REGION"}),h=0):"-"!=t&&"-"!=d&&0==h&&(h=c+1),"-"!=t&&"-"!=d&&t!=d&&h>0&&a.push({begin:c+1,provenanceName:r.RcsbAnnotationConstants.provenanceName.mmseqs,provenanceColor:r.RcsbAnnotationConstants.provenanceColorCode.rcsbPdb,type:"MISMATCH",title:"MISMATCH"}),o.push({begin:c+1,value:t,source:r.RcsbAnnotationConstants.provenanceName.userInput,sourceId:"QUERY SEQUENCE",provenanceName:r.RcsbAnnotationConstants.provenanceName.userInput,provenanceColor:r.RcsbAnnotationConstants.provenanceColorCode.external,oriBegin:"-"!=t?l:void 0}),"-"!=t&&l++,s.push({begin:c+1,value:d,source:i.SequenceReference.PdbEntity,sourceId:this.targetId,provenanceName:i.SequenceReference.PdbEntity,provenanceColor:r.RcsbAnnotationConstants.provenanceColorCode.rcsbPdb,oriBegin:"-"!=d?u:void 0}),"-"!=d&&u++}),h>0&&n.push({begin:h,end:this.alignmentLength,provenanceName:r.RcsbAnnotationConstants.provenanceName.mmseqs,provenanceColor:r.RcsbAnnotationConstants.provenanceColorCode.rcsbPdb,type:"ALIGNED_BLOCK",title:"ALIGNED REGION"});const d={trackId:"query_sequence",displayType:"sequence",trackColor:"#F9F9F9",displayColor:"#000000",rowTitle:"QUERY",nonEmptyDisplay:!0,trackData:o},f={trackId:"target_sequence",displayType:"sequence",trackColor:"#F9F9F9",displayColor:"#000000",rowTitle:this.targetId,nonEmptyDisplay:!0,trackData:s},v={displayType:"pin",displayColor:"#FF9999",displayData:a,minRatio:5},p={displayType:"block",displayColor:"rgb("+c([153,153,255],[50,50,50],this.sequenceId).join(",")+")",displayData:n};return[d,{trackId:"targetSequenceTrack",displayType:"composite",trackColor:"#F9F9F9",titleFlagColor:r.RcsbAnnotationConstants.provenanceColorCode.rcsbPdb,displayConfig:[p,v]},f]}addBlockTerminalTags(t){t[0].oriBegin>1&&(t[0].openBegin=!0);for(let e=0;e<t.length-1;e++)t[e].oriEnd+1!=t[e+1].oriBegin&&(t[e].openEnd=!0,t[e+1].openBegin=!0);t[t.length-1].oriEnd<this.targetSequence.length&&(t[t.length-1].openEnd=!0),a.FeatureTools.mergeBlocks(t)}}},function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,a){function c(t){try{s(r.next(t))}catch(t){a(t)}}function o(t){try{s(r.throw(t))}catch(t){a(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,o)}s((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.RcsbFvUniprotEntity=void 0;const i=n(4),a=n(9),c=n(5);class o extends a.RcsbFvAbstractModule{protectedBuild(t){return r(this,void 0,void 0,(function*(){const e=t.upAcc,n=t.entityId,r=t.additionalConfig,a=[{field:i.FieldName.TargetId,operation:i.OperationType.Equals,source:i.Source.PdbEntity,values:[n]}];this.alignmentTracks=yield this.sequenceCollector.collect({queryId:e,from:i.SequenceReference.Uniprot,to:i.SequenceReference.PdbEntity,filterByTargetContains:n,excludeAlignmentLinks:!0}),this.annotationTracks=yield this.annotationCollector.collect({queryId:e,reference:i.SequenceReference.Uniprot,sources:(null==r?void 0:r.sources)?r.sources:[i.Source.PdbEntity,i.Source.Uniprot],filters:(null==r?void 0:r.filters)instanceof Array?r.filters.concat(a):a,titleSuffix:this.titleSuffix.bind(this)}),this.boardConfigData.length=this.sequenceCollector.getSequenceLength(),this.boardConfigData.includeAxis=!0}))}concatAlignmentAndAnnotationTracks(t){this.rowConfigData=this.alignmentTracks.sequence.concat(this.alignmentTracks.alignment).concat(this.annotationTracks)}titleSuffix(t,e){return r(this,void 0,void 0,(function*(){let e=t.target_id;if(null!=this.polymerEntityInstance&&t.source===i.Source.PdbInstance){const n=t.target_id.split(c.TagDelimiter.instance)[1],r=this.polymerEntityInstance.translateAsymToAuth(n);e=n===r?n:n+"[auth "+r+"]"}return e}))}}e.RcsbFvUniprotEntity=o},function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,a){function c(t){try{s(r.next(t))}catch(t){a(t)}}function o(t){try{s(r.throw(t))}catch(t){a(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,o)}s((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.RcsbFvUniprotInstance=void 0;const i=n(4),a=n(9);class c extends a.RcsbFvAbstractModule{protectedBuild(t){return r(this,void 0,void 0,(function*(){const e=t.upAcc,n=t.entityId,r=t.instanceId,a=t.additionalConfig;let c=[i.Source.Uniprot,i.Source.PdbEntity,i.Source.PdbInstance];null!=a&&null!=a.sources&&a.sources.length>0&&(c=a.sources);let o=[{field:i.FieldName.TargetId,operation:i.OperationType.Equals,source:i.Source.PdbEntity,values:[n]},{field:i.FieldName.TargetId,operation:i.OperationType.Contains,source:i.Source.PdbInstance,values:[r]}];null!=a&&null!=a.filters&&a.filters.length>0&&(o=a.filters),this.alignmentTracks=yield this.sequenceCollector.collect({queryId:e,from:i.SequenceReference.Uniprot,to:i.SequenceReference.PdbInstance,filterByTargetContains:r,excludeFirstRowLink:!0}),this.annotationTracks=yield this.annotationCollector.collect({queryId:e,reference:i.SequenceReference.Uniprot,sources:c,filters:o,collectSwissModel:!0}),this.boardConfigData.length=this.sequenceCollector.getSequenceLength(),this.boardConfigData.includeAxis=!0}))}concatAlignmentAndAnnotationTracks(t){this.rowConfigData=this.alignmentTracks.sequence.concat(this.alignmentTracks.alignment).concat(this.annotationTracks)}}e.RcsbFvUniprotInstance=c},function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,a){function c(t){try{s(r.next(t))}catch(t){a(t)}}function o(t){try{s(r.throw(t))}catch(t){a(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,o)}s((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.RcsbFvUniprot=void 0;const i=n(4),a=n(9),c=n(105);class o extends a.RcsbFvAbstractModule{constructor(t,e){super(t,e),this.sequenceCollector=new c.ObservedSequenceCollector}protectedBuild(t){return r(this,void 0,void 0,(function*(){const e=t.upAcc,n=[i.Source.Uniprot];this.alignmentTracks=yield this.sequenceCollector.collect({queryId:e,from:i.SequenceReference.Uniprot,to:i.SequenceReference.PdbEntity,dynamicDisplay:!1,fitTitleWidth:!0,excludeFirstRowLink:!0}),this.annotationTracks=yield this.annotationCollector.collect({queryId:e,reference:i.SequenceReference.Uniprot,sources:n,collectSwissModel:!0}),this.boardConfigData.length=this.sequenceCollector.getSequenceLength(),this.boardConfigData.includeAxis=!0}))}concatAlignmentAndAnnotationTracks(t){var e;this.rowConfigData=(null===(e=t.additionalConfig)||void 0===e?void 0:e.hideAlignments)?this.alignmentTracks.sequence.concat(this.annotationTracks):this.alignmentTracks.sequence.concat(this.annotationTracks).concat(this.alignmentTracks.alignment)}}e.RcsbFvUniprot=o},function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,a){function c(t){try{s(r.next(t))}catch(t){a(t)}}function o(t){try{s(r.throw(t))}catch(t){a(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,o)}s((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.ObservedSequenceCollector=void 0;const i=n(4),a=n(37),c=n(106),o=n(107),s=n(5),l=n(10),u=n(41);e.ObservedSequenceCollector=class{constructor(){this.entityInstanceMap=new c.MultipleEntityInstanceTranslate,this.unObservedMap=new Map,this.sequenceCollector=new a.SequenceCollector,this.rcsbFvQuery=new l.RcsbClient}collect(t,e){return r(this,void 0,void 0,(function*(){const n=yield this.collectUnmodeledRegions(t);return this.loadObservedRegions(n),yield this.sequenceCollector.collect(t,e,this.collectEntityInstanceMap.bind(this),this.tagObservedRegions.bind(this))}))}getTargets(){return this.sequenceCollector.getTargets()}getAlignmentResponse(){return this.sequenceCollector.getAlignmentResponse()}getSequenceLength(){return this.sequenceCollector.getSequenceLength()}getPolymerEntityInstanceTranslator(){return this.polymerEntityInstanceTranslator}setPolymerEntityInstanceTranslator(t){this.sequenceCollector.setPolymerEntityInstanceTranslator(t),this.polymerEntityInstanceTranslator=t}setExternalTrackBuilder(t){this.sequenceCollector.setExternalTrackBuilder(t),this.externalTrackBuilder=t}loadObservedRegions(t){t.forEach(t=>{t.features.forEach(e=>{e.feature_positions.forEach(e=>{this.addUnmodelled(t.target_id,e.beg_seq_id,e.end_seq_id)})})})}addUnmodelled(t,e,n,r){this.unObservedMap.has(t)||this.unObservedMap.set(t,new Set),Array(n-e+1).fill(0).map((t,n)=>e+n).forEach(e=>{r&&this.unObservedMap.get(t).has(e)?this.unObservedMap.get(t).delete(e):this.unObservedMap.get(t).add(e)})}collectUnmodeledRegions(t){const e=[{field:i.FieldName.Type,operation:i.OperationType.Equals,source:i.Source.PdbInstance,values:[i.Type.UnobservedResidueXyz]}],n=[i.Source.PdbInstance];return this.rcsbFvQuery.requestRcsbPdbAnnotations({queryId:t.queryId,reference:t.from,sources:n,filters:e})}tagObservedRegions(t,e,n){if(null!=this.entityInstanceMap.getEntity(e.targetId)){const r=this.entityInstanceMap.getEntity(e.targetId).translateEntityToAsym(e.targetId.split(s.TagDelimiter.entity)[1]),i=e.targetId.split(s.TagDelimiter.entity)[0],a=new Map;r.forEach(e=>{this.unObservedMap.has(i+s.TagDelimiter.instance+e)&&this.unObservedMap.get(i+s.TagDelimiter.instance+e).forEach(e=>{e>=t.query_begin&&e<=t.query_end&&(a.has(e)?a.set(e,a.get(e)+1):a.set(e,1))})});const c=Array.from(a.entries()).filter(t=>t[1]==r.length).map(t=>t[0]).sort((t,e)=>t-e);if(c.length>0){let r=c.shift(),i=r,a=t.target_begin-t.query_begin;const o=new Array;0==c.length&&o.push({query_begin:r,query_end:i,target_begin:r+a,target_end:i+a,unModelled:!0}),c.forEach((t,e)=>{t==i+1?i=t:(o.push({query_begin:r,query_end:i,target_begin:r+a,target_end:i+a,unModelled:!0}),r=t,i=t,e==c.length-1&&o.push({query_begin:r,query_end:i,target_begin:r+a,target_end:i+a,unModelled:!0}))}),i>r&&o.push({query_begin:r,query_end:i,target_begin:r+a,target_end:i+a,unModelled:!0});const s=new Array;t.query_begin<o[0].query_begin&&s.push({query_begin:t.query_begin,query_end:o[0].query_begin-1,target_begin:t.target_begin,target_end:o[0].target_begin-1,openBegin:!1,openEnd:!1,unModelled:!1}),s.push(Object.assign(Object.assign({},o.shift()),{openBegin:!1,openEnd:!1})),o.forEach((t,e)=>{const n=s.length-1;s.push({query_begin:s[n].query_end+1,query_end:t.query_begin-1,target_begin:s[n].target_end+1,target_end:t.target_begin-1,openBegin:!1,openEnd:!1,unModelled:!1}),s.push(Object.assign(Object.assign({},t),{openBegin:!1,openEnd:!1}))});const l=s.length-1;return s[l].query_end<t.query_end&&s.push({query_begin:s[l].query_end+1,query_end:t.query_end,target_begin:s[l].target_end+1,target_end:t.target_end,openBegin:!1,openEnd:!1,unModelled:!1}),s[0].openBegin=1!=s[0].target_begin,s[s.length-1].openEnd=s[s.length-1].target_end!=e.targetSequenceLength&&!n,s}}return[Object.assign(Object.assign({},t),{unModelled:!1})]}collectEntityInstanceMap(t){return r(this,void 0,void 0,(function*(){const e=new o.MultipleEntityInstancesCollector;(yield Promise.all(u.Operator.arrayChunk(t,100).map(t=>e.collect({entity_ids:t})))).forEach(t=>{this.entityInstanceMap.add(t)})}))}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.MultipleEntityInstanceTranslate=void 0;const r=n(27),i=n(5),a=n(41);e.MultipleEntityInstanceTranslate=class{constructor(){this.entityInstanceTranslateMap=new Map}add(t){const e=new Map;t.forEach(t=>{const n=t.entryId+i.TagDelimiter.entity+t.entityId;e.has(n)||e.set(n,new Array),e.get(n).push(t)}),e.forEach((t,e)=>{this.entityInstanceTranslateMap.set(e,new r.PolymerEntityInstanceTranslate(t))})}getEntity(t){return this.entityInstanceTranslateMap.get(t)}getEntities(){return Array.from(this.entityInstanceTranslateMap.keys())}getEntries(){return a.Operator.uniqueValues(Array.from(this.entityInstanceTranslateMap.keys()).map(t=>t.split(i.TagDelimiter.entity)[0]))}getInstances(){return a.Operator.uniqueValues(Array.from(this.entityInstanceTranslateMap.values()).map(t=>t.getData()).flat().map(t=>t.asymId))}}},function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,a){function c(t){try{s(r.next(t))}catch(t){a(t)}}function o(t){try{s(r.throw(t))}catch(t){a(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,o)}s((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.MultipleEntityInstancesCollector=void 0;const i=n(10),a=n(28);class c{constructor(){this.rcsbFvQuery=new i.RcsbClient}collect(t){return r(this,void 0,void 0,(function*(){try{const e=yield this.rcsbFvQuery.requestMultipleEntityInstances(t);return c.getEntityInstances(e)}catch(t){throw console.log(t),t}}))}static getEntityInstances(t){const e=new Array;return t instanceof Array&&t.forEach(t=>{t.polymer_entity_instances instanceof Array&&a.PolymerEntityInstancesCollector.parsePolymerEntityInstances(t.polymer_entity_instances,e)}),e}}e.MultipleEntityInstancesCollector=c},function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,a){function c(t){try{s(r.next(t))}catch(t){a(t)}}function o(t){try{s(r.throw(t))}catch(t){a(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,o)}s((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.RcsbFvEntityBuilder=void 0;const i=n(5),a=n(109),c=n(4),o=n(8),s=n(40);class l{static buildEntitySummaryFv(t,e,n){return r(this,void 0,void 0,(function*(){return new Promise((h,d)=>{const f=n.split(i.TagDelimiter.entity)[0],v=n.split(i.TagDelimiter.entity)[0];o.RcsbFvCoreBuilder.getPolymerEntityInstanceMapAndCustomBuildFv(v,d=>r(this,void 0,void 0,(function*(){const v=yield o.RcsbFvCoreBuilder.createFv({elementId:t,fvModuleI:a.RcsbFvEntity,p:d,config:{entityId:n,elementSelectId:e,additionalConfig:Object.assign({rcsbContext:{entryId:n.split(i.TagDelimiter.entity)[0],entityId:n.split(i.TagDelimiter.entity)[1]}},u()),resolve:h}}),p=yield v.getTargets();return o.RcsbFvCoreBuilder.buildSelectButton(t,e,[n].concat(p).map(e=>({label:e,onChange:()=>r(this,void 0,void 0,(function*(){e===n?yield l.buildSingleEntitySummaryFv(t,n):yield s.RcsbFvUniprotBuilder.buildUniprotEntityFv(t,e,n,u({field:c.FieldName.TargetId,operation:c.OperationType.Contains,source:c.Source.PdbInstance,values:[f]}))}))}))),v})))})}))}static buildSingleEntitySummaryFv(t,e){return r(this,void 0,void 0,(function*(){return new Promise((n,r)=>{const c=e.split(i.TagDelimiter.entity)[0];o.RcsbFvCoreBuilder.getPolymerEntityInstanceMapAndBuildFv(t,c,a.RcsbFvEntity,{entityId:e,additionalConfig:Object.assign({rcsbContext:{entryId:e.split(i.TagDelimiter.entity)[0],entityId:e.split(i.TagDelimiter.entity)[1]}},u()),resolve:n})})}))}static buildEntityFv(t,e,n){return r(this,void 0,void 0,(function*(){return new Promise((r,c)=>{const s=e.split(i.TagDelimiter.entity)[0];o.RcsbFvCoreBuilder.getPolymerEntityInstanceMapAndBuildFv(t,s,a.RcsbFvEntity,{entityId:e,additionalConfig:Object.assign({rcsbContext:{entryId:e.split(i.TagDelimiter.entity)[0],entityId:e.split(i.TagDelimiter.entity)[1]}},n),resolve:r})})}))}}function u(t){const e=[{field:c.FieldName.Type,operation:c.OperationType.Equals,source:c.Source.PdbInstance,values:[c.Type.UnobservedResidueXyz,c.Type.UnobservedAtomXyz]}];return t&&e.push(t),{sources:[c.Source.PdbEntity,c.Source.PdbInstance],filters:e}}e.RcsbFvEntityBuilder=l},function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,a){function c(t){try{s(r.next(t))}catch(t){a(t)}}function o(t){try{s(r.throw(t))}catch(t){a(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,o)}s((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.RcsbFvEntity=void 0;const i=n(4),a=n(9),c=n(5);class o extends a.RcsbFvAbstractModule{protectedBuild(t){var e,n;return r(this,void 0,void 0,(function*(){const r=t.entityId,a=(null===(e=t.additionalConfig)||void 0===e?void 0:e.filters)?t.additionalConfig.sources:[i.Source.PdbEntity,i.Source.Uniprot];this.alignmentTracks=yield this.sequenceCollector.collect({queryId:r,from:i.SequenceReference.PdbEntity,to:i.SequenceReference.Uniprot}),this.annotationTracks=yield this.annotationCollector.collect({queryId:r,reference:i.SequenceReference.PdbEntity,sources:a,titleSuffix:this.titleSuffix.bind(this),filters:null===(n=t.additionalConfig)||void 0===n?void 0:n.filters}),this.boardConfigData.length=this.sequenceCollector.getSequenceLength(),this.boardConfigData.includeAxis=!0}))}concatAlignmentAndAnnotationTracks(t){var e;this.rowConfigData=(null===(e=t.additionalConfig)||void 0===e||e.hideAlignments,this.alignmentTracks.sequence.concat(this.alignmentTracks.alignment).concat(this.annotationTracks))}titleSuffix(t,e){return r(this,void 0,void 0,(function*(){let e=t.target_id;if(null!=this.polymerEntityInstance&&t.source===i.Source.PdbInstance){const n=t.target_id.split(c.TagDelimiter.instance)[1],r=this.polymerEntityInstance.translateAsymToAuth(n);e=n===r?n:n+"[auth "+r+"]"}return e}))}}e.RcsbFvEntity=o},function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,a){function c(t){try{s(r.next(t))}catch(t){a(t)}}function o(t){try{s(r.throw(t))}catch(t){a(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,o)}s((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.RcsbFvInstance=void 0;const i=n(4),a=n(9);class c extends a.RcsbFvAbstractModule{protectedBuild(t){return r(this,void 0,void 0,(function*(){const e=t.instanceId,n=[i.Source.PdbEntity,i.Source.PdbInstance,i.Source.Uniprot];this.alignmentTracks=yield this.sequenceCollector.collect({queryId:e,from:i.SequenceReference.PdbInstance,to:i.SequenceReference.Uniprot}),this.annotationTracks=yield this.annotationCollector.collect({queryId:e,reference:i.SequenceReference.PdbInstance,sources:n}),this.boardConfigData.length=this.sequenceCollector.getSequenceLength(),this.boardConfigData.includeAxis=!0}))}concatAlignmentAndAnnotationTracks(t){var e;this.rowConfigData=(null===(e=t.additionalConfig)||void 0===e?void 0:e.hideAlignments)?this.alignmentTracks.sequence.concat(this.annotationTracks):this.alignmentTracks.sequence.concat(this.alignmentTracks.alignment).concat(this.annotationTracks)}}e.RcsbFvInstance=c},function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n),Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[n]}})}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.hasOwnProperty.call(t,n)&&r(e,t,n);return i(e,t),e},c=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,a){function c(t){try{s(r.next(t))}catch(t){a(t)}}function o(t){try{s(r.throw(t))}catch(t){a(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,o)}s((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.RcsbFvInterface=void 0;const o=n(4),s=n(9),l=n(38),u=a(n(20)),h=n(11),d=n(5),f=n(112),v=u;class p extends s.RcsbFvAbstractModule{constructor(){super(...arguments),this.annotationCollector=new l.AnnotationCollector(v)}protectedBuild(t){var e,n,r,i;return c(this,void 0,void 0,(function*(){const a=t.instanceId;this.instanceId=a;const c=[o.Source.PdbEntity,o.Source.PdbInstance,o.Source.Uniprot,o.Source.PdbInterface];this.alignmentTracks=yield this.sequenceCollector.collect({queryId:a,from:o.SequenceReference.PdbInstance,to:o.SequenceReference.Uniprot}),this.annotationTracks=yield this.annotationCollector.collect({queryId:a,reference:o.SequenceReference.PdbInstance,titleSuffix:this.titleSuffix(null===(e=null==t?void 0:t.additionalConfig)||void 0===e?void 0:e.rcsbContext).bind(this),trackTitle:this.trackTitle.bind(this),typeSuffix:this.typeSuffix.bind(this),sources:c,annotationGenerator:g,annotationFilter:(null===(r=null===(n=t.additionalConfig)||void 0===n?void 0:n.externalTrackBuilder)||void 0===r?void 0:r.filterFeatures)?void 0:m,rcsbContext:null===(i=t.additionalConfig)||void 0===i?void 0:i.rcsbContext}),this.boardConfigData.length=this.sequenceCollector.getSequenceLength(),this.boardConfigData.includeAxis=!0}))}concatAlignmentAndAnnotationTracks(t){var e;this.rowConfigData=(null===(e=t.additionalConfig)||void 0===e?void 0:e.hideAlignments)?this.alignmentTracks.sequence.concat(this.annotationTracks):this.alignmentTracks.sequence.concat(this.alignmentTracks.alignment).concat(this.annotationTracks)}typeSuffix(t,e){return c(this,void 0,void 0,(function*(){if(t.source===o.Source.PdbInterface)return t.target_identifiers.interface_id+"|"+t.target_identifiers.interface_partner_index}))}titleSuffix(t){return(e,n)=>c(this,void 0,void 0,(function*(){if(e.source===o.Source.PdbInterface){const n=yield h.rcsbFvCtxManager.getInterfaceToInstance(e.target_id),r=this.instanceId.split(d.TagDelimiter.instance)[1],i=n.getInstances(e.target_id),a=i[0]==r?i[1]:i[0],c=(yield h.rcsbFvCtxManager.getEntityToInstance(this.instanceId.split(d.TagDelimiter.instance)[0])).translateAsymToAuth(a),o=n.getOperatorIds(e.target_id);let s="";if(Array.isArray(t.operatorIds)){const n=o[e.target_identifiers.interface_partner_index].map(t=>t.join("-")).indexOf(t.operatorIds.join("-"));s=d.TagDelimiter.operatorComposition+o[1-e.target_identifiers.interface_partner_index][n].join(d.TagDelimiter.operatorComposition)}return(a==c?a:`${a}[auth ${c}]`)+s}}))}trackTitle(t,e){return c(this,void 0,void 0,(function*(){if(t.source===o.Source.PdbInterface&&e.type===o.Type.BurialFraction)return"BINDING CHAIN "}))}}function g(t){const e=function(t){let e;for(const n of t)if(n.source===o.Source.PdbInterface)for(const t of n.features)if(t.type===o.Type.AsaUnbound){e=f.cloneDeep(n),e.source=o.Source.PdbInstance;const r=f.cloneDeep(t);r.type="BURIED_RESIDUES",r.name="Core protein residues",r.description="Residue accessibility lower than 6Å",r.feature_positions.forEach(t=>{t.values=t.values.map(t=>t<6?Math.floor(100*t)/100:0)}),e.features=[r]}return[e]}(t),n=function(t){const e=new Array,n=f.cloneDeep(t).map(t=>(t.features=t.features.filter(t=>t.type===o.Type.AsaUnbound),t)).filter(t=>t.features.length>0),r=f.cloneDeep(t).map(t=>(t.features=t.features.filter(t=>t.type===o.Type.AsaBound),t)).filter(t=>t.features.length>0);return n.forEach(t=>{const n=r.find(e=>e.target_identifiers.target_id===t.target_identifiers.target_id&&e.target_identifiers.interface_partner_index===t.target_identifiers.interface_partner_index);if(t&&n){if(n.features.length!=t.features.length)throw"Inconsistent bound and unbound ASA features, different array lengths";const r=f.cloneDeep(t);r.features=[],t.features.forEach((t,e)=>{const i=n.features[e],a=f.cloneDeep(t);a.type="BURIAL_FRACTION",a.name="Interface residues buried fraction",a.description="(1 - bASA/uASA)",a.feature_positions=[],t.feature_positions.forEach((t,e)=>{const n=i.feature_positions[e];a.feature_positions.push({beg_seq_id:t.beg_seq_id,values:t.values.map((t,e)=>{const r=n.values[e];return 0===t?0:Math.floor(100*(1-r/t))/100})})}),r.features.push(a)}),e.push(r)}}),e}(t);return new Promise(t=>{const r=new Array;e&&e.length>0&&r.push(...e),n&&n.length>0&&r.push(...n),t(r)})}function m(t){const e=new Array;for(const n of t){const t=f.cloneDeep(n);if(n.source===o.Source.PdbInterface){t.features=[];for(const e of n.features)e.type===o.Type.BurialFraction&&t.features.push(e)}e.push(t)}return new Promise(t=>{t(e)})}e.RcsbFvInterface=p},function(t,e,n){(function(t,r){var i;
|
|
89
|
+
*/var r,i,a,c;if("object"==typeof performance&&"function"==typeof performance.now){var o=performance;e.unstable_now=function(){return o.now()}}else{var s=Date,l=s.now();e.unstable_now=function(){return s.now()-l}}if("undefined"==typeof window||"function"!=typeof MessageChannel){var u=null,h=null,d=function(){if(null!==u)try{var t=e.unstable_now();u(!0,t),u=null}catch(t){throw setTimeout(d,0),t}};r=function(t){null!==u?setTimeout(r,0,t):(u=t,setTimeout(d,0))},i=function(t,e){h=setTimeout(t,e)},a=function(){clearTimeout(h)},e.unstable_shouldYield=function(){return!1},c=e.unstable_forceFrameRate=function(){}}else{var f=window.setTimeout,v=window.clearTimeout;if("undefined"!=typeof console){var p=window.cancelAnimationFrame;"function"!=typeof window.requestAnimationFrame&&console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills"),"function"!=typeof p&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills")}var g=!1,m=null,y=-1,b=5,w=0;e.unstable_shouldYield=function(){return e.unstable_now()>=w},c=function(){},e.unstable_forceFrameRate=function(t){0>t||125<t?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):b=0<t?Math.floor(1e3/t):5};var z=new MessageChannel,C=z.port2;z.port1.onmessage=function(){if(null!==m){var t=e.unstable_now();w=t+b;try{m(!0,t)?C.postMessage(null):(g=!1,m=null)}catch(t){throw C.postMessage(null),t}}else g=!1},r=function(t){m=t,g||(g=!0,C.postMessage(null))},i=function(t,n){y=f((function(){t(e.unstable_now())}),n)},a=function(){v(y),y=-1}}function x(t,e){var n=t.length;t.push(e);t:for(;;){var r=n-1>>>1,i=t[r];if(!(void 0!==i&&0<E(i,e)))break t;t[r]=e,t[n]=i,n=r}}function _(t){return void 0===(t=t[0])?null:t}function M(t){var e=t[0];if(void 0!==e){var n=t.pop();if(n!==e){t[0]=n;t:for(var r=0,i=t.length;r<i;){var a=2*(r+1)-1,c=t[a],o=a+1,s=t[o];if(void 0!==c&&0>E(c,n))void 0!==s&&0>E(s,c)?(t[r]=s,t[o]=n,r=o):(t[r]=c,t[a]=n,r=a);else{if(!(void 0!==s&&0>E(s,n)))break t;t[r]=s,t[o]=n,r=o}}}return e}return null}function E(t,e){var n=t.sortIndex-e.sortIndex;return 0!==n?n:t.id-e.id}var S=[],k=[],A=1,F=null,T=3,L=!1,H=!1,I=!1;function O(t){for(var e=_(k);null!==e;){if(null===e.callback)M(k);else{if(!(e.startTime<=t))break;M(k),e.sortIndex=e.expirationTime,x(S,e)}e=_(k)}}function V(t){if(I=!1,O(t),!H)if(null!==_(S))H=!0,r(B);else{var e=_(k);null!==e&&i(V,e.startTime-t)}}function B(t,n){H=!1,I&&(I=!1,a()),L=!0;var r=T;try{for(O(n),F=_(S);null!==F&&(!(F.expirationTime>n)||t&&!e.unstable_shouldYield());){var c=F.callback;if("function"==typeof c){F.callback=null,T=F.priorityLevel;var o=c(F.expirationTime<=n);n=e.unstable_now(),"function"==typeof o?F.callback=o:F===_(S)&&M(S),O(n)}else M(S);F=_(S)}if(null!==F)var s=!0;else{var l=_(k);null!==l&&i(V,l.startTime-n),s=!1}return s}finally{F=null,T=r,L=!1}}var D=c;e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(t){t.callback=null},e.unstable_continueExecution=function(){H||L||(H=!0,r(B))},e.unstable_getCurrentPriorityLevel=function(){return T},e.unstable_getFirstCallbackNode=function(){return _(S)},e.unstable_next=function(t){switch(T){case 1:case 2:case 3:var e=3;break;default:e=T}var n=T;T=e;try{return t()}finally{T=n}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=D,e.unstable_runWithPriority=function(t,e){switch(t){case 1:case 2:case 3:case 4:case 5:break;default:t=3}var n=T;T=t;try{return e()}finally{T=n}},e.unstable_scheduleCallback=function(t,n,c){var o=e.unstable_now();switch("object"==typeof c&&null!==c?c="number"==typeof(c=c.delay)&&0<c?o+c:o:c=o,t){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return t={id:A++,callback:n,priorityLevel:t,startTime:c,expirationTime:s=c+s,sortIndex:-1},c>o?(t.sortIndex=c,x(k,t),null===_(S)&&t===_(k)&&(I?a():I=!0,i(V,c-o))):(t.sortIndex=s,x(S,t),H||L||(H=!0,r(B))),t},e.unstable_wrapCallback=function(t){var e=T;return function(){var n=T;T=e;try{return t.apply(this,arguments)}finally{T=n}}}},function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n),Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[n]}})}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.hasOwnProperty.call(t,n)&&r(e,t,n);return i(e,t),e};Object.defineProperty(e,"__esModule",{value:!0}),e.SelectButton=void 0;const c=a(n(2)),o=a(n(118));class s extends c.Component{constructor(t){super(t),this.state={selectedOption:null==this.props.options[0].options?Object.assign(Object.assign({},this.props.options[0]),{value:0}):Object.assign(Object.assign({},this.props.options[0].options[0]),{value:0})},this.defaultValue=t.defaultValue}change(t){this.setState({selectedOption:t})}componentDidUpdate(t,e){this.state.selectedOption.onChange()}componentDidMount(){this.defaultValue=null}render(){"string"==typeof this.props.dropdownTitle&&c.createElement("div",{style:{color:"grey",fontWeight:"bold",fontSize:12}},this.props.dropdownTitle);return c.createElement("div",null,this.selectRender())}selectRender(){const{selectOpt:t,index:e}=this.getSelectOpt();return!0===this.props.addTitle?this.titleRender(t,e):this.selectButtonRender(t,e)}titleRender(t,e){return c.createElement("div",null,c.createElement("div",{style:{display:"inline-block"}},this.selectButtonRender(t,e)),c.createElement("div",{style:{display:"inline-block",marginLeft:"20px"}},t.name))}selectButtonRender(t,e){return c.createElement("div",{id:this.props.elementId+s.BUTTON_CONTAINER_DIV_SUFFIX},this.innerSelectButtonRender(t,e))}innerSelectButtonRender(t,e){var n;let r;if(null==this.props.options[0].options)r=this.props.options.map((t,e)=>Object.assign(Object.assign({},t),{value:e}));else{let t=0;r=this.props.options.map(e=>({label:e.label,options:e.options.map(e=>Object.assign(Object.assign({},e),{value:t++}))}))}const i="string"==typeof this.props.dropdownTitle?c.createElement("div",{style:{color:"grey",fontWeight:"bold",fontSize:12}},this.props.dropdownTitle):null;return c.createElement("div",{style:{display:"inline-block"}},i,c.createElement("div",null,c.createElement(o.default,{options:r,isSearchable:!1,onChange:this.change.bind(this),styles:this.configStyle(),components:{SingleValue:t=>{const e="string"==typeof t.data.shortLabel?t.data.shortLabel:t.data.label;return c.createElement(o.components.SingleValue,Object.assign({},t),e)},Option:null!==(n=this.props.optionProps)&&void 0!==n?n:t=>c.createElement(o.components.Option,Object.assign({},t))},defaultValue:Object.assign(Object.assign({},t),{value:e})})))}configStyle(){return{control:t=>{var e;return Object.assign(Object.assign({},t),{width:null!==(e=this.props.width)&&void 0!==e?e:120,border:"1px solid #ddd",boxShadow:"none","&:hover":{border:"1px solid #ddd"}})},menu:t=>Object.assign(Object.assign({},t),{width:500}),option:t=>Object.assign({},t)}}getSelectOpt(){let t,e=0;if(null!=this.defaultValue){if(null==this.props.options[0].options){const n=this.props.options.findIndex(t=>t.optId===this.defaultValue);n>=0&&(e=n,t=this.props.options[n])}else if(null!=this.props.options[0].options){let n=!1;for(const r of this.props.options){for(const i of r.options){if(i.optId===this.defaultValue){t=i,n=!0;break}e++}if(n)break}}}else t=this.state.selectedOption,e=this.props.options.findIndex(t=>t.optId===this.state.selectedOption.optId);return{selectOpt:t,index:e}}}e.SelectButton=s,s.BUTTON_CONTAINER_DIV_SUFFIX="_buttonContainerDiv"},function(t,e,n){"use strict";var r=n(83);function i(){}function a(){}a.resetWarningCache=i,t.exports=function(){function t(t,e,n,i,a,c){if(c!==r){var o=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw o.name="Invariant Violation",o}}function e(){return t}t.isRequired=t;var n={array:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:a,resetWarningCache:i};return n.PropTypes=n,n}},function(t,e,n){"use strict";t.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n),Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[n]}})}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.hasOwnProperty.call(t,n)&&r(e,t,n);return i(e,t),e};Object.defineProperty(e,"__esModule",{value:!0}),e.LoaderSpinner=void 0;const c=a(n(2)),o=a(n(85));class s extends c.Component{render(){return c.createElement("div",{style:{position:"absolute",left:0,right:0,marginLeft:"auto",zIndex:Number.MAX_SAFE_INTEGER,marginRight:"auto"}},c.createElement("div",{className:o.loadSpinnerComponentScope},c.createElement("div",{className:"loader"})))}}e.LoaderSpinner=s},function(t,e,n){var r=n(86),i=n(87);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[t.i,i,""]]);var a={insert:"head",singleton:!1},c=(r(i,a),i.locals?i.locals:{});t.exports=c},function(t,e,n){"use strict";var r,i=function(){return void 0===r&&(r=Boolean(window&&document&&document.all&&!window.atob)),r},a=function(){var t={};return function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(t){n=null}t[e]=n}return t[e]}}(),c=[];function o(t){for(var e=-1,n=0;n<c.length;n++)if(c[n].identifier===t){e=n;break}return e}function s(t,e){for(var n={},r=[],i=0;i<t.length;i++){var a=t[i],s=e.base?a[0]+e.base:a[0],l=n[s]||0,u="".concat(s," ").concat(l);n[s]=l+1;var h=o(u),d={css:a[1],media:a[2],sourceMap:a[3]};-1!==h?(c[h].references++,c[h].updater(d)):c.push({identifier:u,updater:g(d,e),references:1}),r.push(u)}return r}function l(t){var e=document.createElement("style"),r=t.attributes||{};if(void 0===r.nonce){var i=n.nc;i&&(r.nonce=i)}if(Object.keys(r).forEach((function(t){e.setAttribute(t,r[t])})),"function"==typeof t.insert)t.insert(e);else{var c=a(t.insert||"head");if(!c)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");c.appendChild(e)}return e}var u,h=(u=[],function(t,e){return u[t]=e,u.filter(Boolean).join("\n")});function d(t,e,n,r){var i=n?"":r.media?"@media ".concat(r.media," {").concat(r.css,"}"):r.css;if(t.styleSheet)t.styleSheet.cssText=h(e,i);else{var a=document.createTextNode(i),c=t.childNodes;c[e]&&t.removeChild(c[e]),c.length?t.insertBefore(a,c[e]):t.appendChild(a)}}function f(t,e,n){var r=n.css,i=n.media,a=n.sourceMap;if(i?t.setAttribute("media",i):t.removeAttribute("media"),a&&btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(a))))," */")),t.styleSheet)t.styleSheet.cssText=r;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(r))}}var v=null,p=0;function g(t,e){var n,r,i;if(e.singleton){var a=p++;n=v||(v=l(e)),r=d.bind(null,n,a,!1),i=d.bind(null,n,a,!0)}else n=l(e),r=f.bind(null,n,e),i=function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(n)};return r(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;r(t=e)}else i()}}t.exports=function(t,e){(e=e||{}).singleton||"boolean"==typeof e.singleton||(e.singleton=i());var n=s(t=t||[],e);return function(t){if(t=t||[],"[object Array]"===Object.prototype.toString.call(t)){for(var r=0;r<n.length;r++){var i=o(n[r]);c[i].references--}for(var a=s(t,e),l=0;l<n.length;l++){var u=o(n[l]);0===c[u].references&&(c[u].updater(),c.splice(u,1))}n=a}}}},function(t,e,n){(e=n(88)(!1)).push([t.i,".loadSpinnerComponentScope .loader,.loadSpinnerComponentScope .loader:after{border-radius:50%;width:10em;height:10em}.loadSpinnerComponentScope .loader{background-color:#FFF;box-shadow:0 0 5px 15px #FFF;margin:60px auto;font-size:10px;position:relative;text-indent:-9999em;border-top:1.1em solid #d5f0ff;border-right:1.1em solid #d5f0ff;border-bottom:1.1em solid #d5f0ff;border-left:1.1em solid #4499ea;-webkit-transform:translateZ(0);-ms-transform:translateZ(0);transform:translateZ(0);-webkit-animation:load8 1.1s infinite linear;animation:load8 1.1s infinite linear}@-webkit-keyframes load8{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes load8{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}\n",""]),e.locals={loadSpinnerComponentScope:"loadSpinnerComponentScope",loader:"loader",load8:"load8"},t.exports=e},function(t,e,n){"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n=function(t,e){var n=t[1]||"",r=t[3];if(!r)return n;if(e&&"function"==typeof btoa){var i=(c=r,o=btoa(unescape(encodeURIComponent(JSON.stringify(c)))),s="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(o),"/*# ".concat(s," */")),a=r.sources.map((function(t){return"/*# sourceURL=".concat(r.sourceRoot||"").concat(t," */")}));return[n].concat(a).concat([i]).join("\n")}var c,o,s;return[n].join("\n")}(e,t);return e[2]?"@media ".concat(e[2]," {").concat(n,"}"):n})).join("")},e.i=function(t,n,r){"string"==typeof t&&(t=[[null,t,""]]);var i={};if(r)for(var a=0;a<this.length;a++){var c=this[a][0];null!=c&&(i[c]=!0)}for(var o=0;o<t.length;o++){var s=[].concat(t[o]);r&&i[s[0]]||(n&&(s[2]?s[2]="".concat(n," and ").concat(s[2]):s[2]=n),e.push(s))}},e}},function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,a){function c(t){try{s(r.next(t))}catch(t){a(t)}}function o(t){try{s(r.throw(t))}catch(t){a(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,o)}s((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.RcsbFvChromosomeBuilder=void 0;const i=n(5),a=n(90),c=n(8),o=n(11);class s{static buildFullChromosome(t,e){return r(this,void 0,void 0,(function*(){return yield s.buildChromosome(t,null,e)}))}static buildEntryChromosome(t,e,n,a){return r(this,void 0,void 0,(function*(){return new Promise((l,u)=>r(this,void 0,void 0,(function*(){const u=(yield o.rcsbFvCtxManager.getEntityToInstance(a)).getData(),h=new Set;u.sort((t,e)=>parseInt(t.entityId)-parseInt(e.entityId)).forEach(t=>{h.add(t.entryId+i.TagDelimiter.entity+t.entityId)});const d=(yield o.rcsbFvCtxManager.getEntityToChromosome(Array.from(h))).getData();if(0==d.size)c.RcsbFvCoreBuilder.showMessage(t,"No genome alignments are available");else{const a=new Set;c.RcsbFvCoreBuilder.buildSelectButton(t,e,u.filter(t=>{const e=a.has(t.entryId+i.TagDelimiter.entity+t.entityId);return a.add(t.entryId+i.TagDelimiter.entity+t.entityId),d.has(t.entryId+i.TagDelimiter.entity+t.entityId)&&!e}).map((e,a)=>{const c=e.entryId+i.TagDelimiter.entity+e.entityId;return 0==a&&s.buildEntityChromosome(t,n,c).then(t=>{l(t)}),{name:e.names+" - "+e.taxIds.join(", "),label:c+" - "+e.names,shortLabel:c,onChange:()=>r(this,void 0,void 0,(function*(){yield s.buildEntityChromosome(t,n,c)}))}}),{addTitle:!0,dropdownTitle:"ENTITY"})}})))}))}static buildEntityChromosome(t,e,n){return r(this,void 0,void 0,(function*(){const i=yield s.buildChromosome(t,n,null,e,{boardConfig:{rowTitleWidth:160}}),a=yield i.getTargets();return c.RcsbFvCoreBuilder.buildSelectButton(t,e,a.map((i,a)=>({label:i,name:i,shortLabel:i,onChange:()=>r(this,void 0,void 0,(function*(){yield s.buildChromosome(t,n,i,e)}))})),{addTitle:!1,width:190,dropdownTitle:"CHROMOSOME"}),i}))}static buildChromosome(t,e,n,o,s){return r(this,void 0,void 0,(function*(){return new Promise((r,l)=>{try{c.RcsbFvCoreBuilder.createFv({elementId:t,fvModuleI:a.RcsbFvChromosome,config:{entityId:e,chrId:n,elementSelectId:o,additionalConfig:Object.assign({rcsbContext:{entryId:e.split(i.TagDelimiter.entity)[0],entityId:e.split(i.TagDelimiter.entity)[1],chrId:n}},s),resolve:r}})}catch(t){l(t)}})}))}}e.RcsbFvChromosomeBuilder=s},function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,a){function c(t){try{s(r.next(t))}catch(t){a(t)}}function o(t){try{s(r.throw(t))}catch(t){a(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,o)}s((r=r.apply(t,e||[])).next())}))},i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.RcsbFvChromosome=void 0;const a=n(14),c=n(9),o=n(4),s=n(26),l=n(12),u=n(96),h=n(33),d=n(97),f=n(98),v=i(n(117)),p=n(22);function g(t,e,n){return r=>{if((n?n/(r.to-r.from):1e3/(r.to-r.from))>4){const n=new Array;return e.forEach((t,e)=>{e[0]>r.to||e[1]<r.from||n.push(t)}),Promise.all(n.map(e=>(new h.RcsbQueryAlignment).request({queryId:e,from:t,to:o.SequenceReference.NcbiGenome}))).then(e=>{const r=new s.RcsbFvTrackData;return e.forEach((e,i)=>{if(null==e.query_sequence)return;const a=e.query_sequence.split("");e.target_alignment.forEach(e=>{const c=e.orientation;e.aligned_regions.forEach(e=>{const o=e.target_begin,s=e.query_begin,l=e.query_end-e.query_begin+1;for(let e=0;e<l;e++)r.push({begin:o+c*(1+3*e),value:a[s-1+e],oriBegin:s+e,source:t.toString(),sourceId:n[i]})})})}),r})}return new Promise((t,e)=>{t(null)})}}class m extends c.RcsbFvAbstractModule{constructor(){super(...arguments),this.targetAlignmentList=new Map([[o.SequenceReference.NcbiProtein,new Array],[o.SequenceReference.Uniprot,new Array],[o.SequenceReference.PdbEntity,new Array]]),this.maxRange=0,this.minRange=Number.MAX_SAFE_INTEGER,this.alignmentCollectorQueue=new u.RcsbFvAlignmentCollectorQueue(12),this.nTasks=0,this.completeTasks=0,this.batchSize=1e7,this.beginView=0,this.endView=0,this.entityBegin=0,this.entityEnd=0,this.nonExonConfigData=new Array,this.featuresConfigData=new Array,this.targetCoverages=new Map,this.chrSet=new Array,this.targetFilterFlag=!0,this.IDEOGRAM_DIV_ID="chrIdeogramDiv",this.TITLE_CHR_DIV_ID="chrTitleDiv",this.TITLE_CHR_REGION_ID="chrTitleRegion",this.currentDisplayedChrId="",this.buildSubject=new a.Subject,this.targetsSubject=new a.Subject}buildPdbGenomeFv(t,e){this.entityId=t;const n=new h.RcsbQueryAlignment;Promise.all([o.SequenceReference.NcbiProtein,o.SequenceReference.Uniprot].map(e=>n.request({queryId:t,from:o.SequenceReference.PdbEntity,to:e}))).then(n=>{n.forEach(t=>{t.target_alignment.forEach(t=>{this.targetCoverages.set(t.target_id,t.coverage)})}),this.alignmentCollectorQueue.sendTask({queryId:t,from:o.SequenceReference.PdbEntity,to:o.SequenceReference.NcbiGenome},n=>r(this,void 0,void 0,(function*(){const r=n;yield this.collectPdbWorkerResults(r,t,e)})))})}buildFullGenomeRangeFv(t){this.plotChromosomeTitle(t),this.targetFilterFlag=!1,this.genomeSequenceTracks(t),this.collectChromosomeAlignments(t,o.SequenceReference.PdbEntity),this.collectChromosomeAlignments(t,o.SequenceReference.Uniprot),this.collectChromosomeAlignments(t,o.SequenceReference.NcbiProtein)}collectPdbWorkerResults(t,e,n){return r(this,void 0,void 0,(function*(){const r=this.collectExons(t.target_alignment,"target",l.RcsbAnnotationConstants.provenanceColorCode.rcsbPdb,l.RcsbAnnotationConstants.provenanceColorCode.rcsbPdb,o.SequenceReference.PdbEntity,n);this.pdbEntityTrack=this.mergeExonTracks(r,o.SequenceReference.PdbEntity)[0],this.pdbEntityTrack.displayConfig[0].displayData.forEach(t=>{t.description=[e]}),this.addSequences([this.pdbEntityTrack],o.SequenceReference.PdbEntity),this.pdbEntityTrack.rowPrefix=o.SequenceReference.PdbEntity.replace("_"," "),this.pdbEntityTrack.rowTitle={visibleTex:e,style:{fontWeight:"bold"}},this.pdbEntityTrack.hideEmptyTrackFlag=!1,yield this.buildChromosomeFv(null!=n?n:this.chrSet[0])}))}buildChromosomeFv(t){return r(this,void 0,void 0,(function*(){this.plotChromosomeTitle(t),this.genomeSequenceTracks(t),this.nonExonConfigData.push(this.pdbEntityTrack),yield this.plot(),this.collectChromosomeEntityRegion(t)}))}plotChromosomeTitle(t){var e,n;null===(e=document.getElementById(this.IDEOGRAM_DIV_ID))||void 0===e||e.remove(),null===(n=document.getElementById(this.TITLE_CHR_DIV_ID))||void 0===n||n.remove(),this.currentDisplayedChrId=t,f.NcbiSummary.requestChromosomeData(t).then(e=>{if(t==this.currentDisplayedChrId){const t=document.createElement("div");t.id=this.IDEOGRAM_DIV_ID;const n=document.createElement("div");n.style.display="inline-block",n.style.marginLeft="20px",n.id=this.TITLE_CHR_DIV_ID;const r=document.createElement("span");r.innerHTML=e.title,n.append(r);const i=document.createElement("span");i.id=this.TITLE_CHR_REGION_ID,i.innerHTML=" / Region: ["+this.entityBegin+" - "+this.entityEnd+"]",i.style.color="#666",n.append(i),document.getElementById(this.elementSelectId).insertAdjacentElement("afterend",n),document.getElementById(this.elementId).insertAdjacentElement("beforebegin",t),this.plotIdeogram(e)}})}updateChromosomeTitleRegion(){const t=document.getElementById(this.TITLE_CHR_REGION_ID);null!=t&&(t.innerHTML=" / Region: ["+this.beginView+" - "+this.endView+"]")}plotIdeogram(t){f.NcbiSummary.requestTaxonomyData(t.taxid.toString()).then(e=>{if(t.ncbiId==this.currentDisplayedChrId){const n=t.subname.includes("|")?t.subname.split("|").filter(t=>null!=t.match(/^([\dXYxy]+)$/))[0]:t.subname,r=new v.default({rotatable:!1,chrHeight:1080,chrWidth:20,organism:e.scientificname,chromosomes:[n],orientation:"horizontal",container:"#"+this.IDEOGRAM_DIV_ID,annotationHeight:8,showBandLabels:!0,annotations:[{name:this.entityId,chr:n,start:this.entityBegin,stop:this.entityEnd}],onLoad:()=>{var t,e;(null===(t=r.chromosomesArray)||void 0===t?void 0:t.length)>0?null!=document.getElementById("_ideogram")&&(document.getElementById("_ideogram").style.padding="0 0 0 0"):null===(e=document.getElementById(this.IDEOGRAM_DIV_ID))||void 0===e||e.remove()}})}})}genomeSequenceTracks(t){var e,n,r,i;this.nonExonConfigData.push({trackId:"mainSequenceTrack_5_"+t,displayType:"sequence",trackColor:"#F9F9F9",displayColor:"#000000",nonEmptyDisplay:!0,rowPrefix:t+" ",rowTitle:{visibleTex:"5'",style:{fontWeight:"bold"}},titleFlagColor:l.RcsbAnnotationConstants.provenanceColorCode.external,updateDataOnMove:d.NcbiGenomeSequenceData.update(t,1,!1,null===(n=null===(e=this.rcsbFv)||void 0===e?void 0:e.getBoardConfig())||void 0===n?void 0:n.trackWidth)}),this.nonExonConfigData.push({trackId:"mainSequenceTrack_3_"+t,displayType:"sequence",trackColor:"#F9F9F9",displayColor:"#000000",rowPrefix:"",nonEmptyDisplay:!0,rowTitle:{visibleTex:"3'",style:{fontWeight:"bold"}},titleFlagColor:l.RcsbAnnotationConstants.provenanceColorCode.external,updateDataOnMove:d.NcbiGenomeSequenceData.update(t,2,!0,null===(i=null===(r=this.rcsbFv)||void 0===r?void 0:r.getBoardConfig())||void 0===i?void 0:i.trackWidth)})}collectChromosomeEntityRegion(t){const e=this.pdbEntityTrack.displayConfig[0].displayData[0].begin,n=this.pdbEntityTrack.displayConfig[0].displayData[0].end,r=[Math.max(1,e-5e6),n+5e6];this.collectChromosomeAlignments(t,o.SequenceReference.Uniprot,r,0),this.collectChromosomeAlignments(t,o.SequenceReference.NcbiProtein,r,0)}collectChromosomeAlignments(t,e,n,i){if(null!=n)this.nTasks++,this.alignmentCollectorQueue.sendTask({queryId:t,from:o.SequenceReference.NcbiGenome,to:e,range:n},t=>r(this,void 0,void 0,(function*(){const n=t;yield this.collectChromosomeWorkerResults(i,e,n,!1)})));else for(let n=0;n<30;n++)this.nTasks++,this.alignmentCollectorQueue.sendTask({queryId:t,from:o.SequenceReference.NcbiGenome,to:e,range:[n*this.batchSize,(n+1)*this.batchSize]},t=>r(this,void 0,void 0,(function*(){const r=t;yield this.collectChromosomeWorkerResults(n,e,r,!1)})))}collectChromosomeWorkerResults(t,e,n,i){return r(this,void 0,void 0,(function*(){this.completeTasks++,this.targetAlignmentList.get(e)[t]=n.target_alignment,console.log("Completed "+Math.floor(this.completeTasks/this.nTasks*100)+"%"),i?yield this.plot():this.nTasks==this.completeTasks&&(console.log("All Tasks Completed. Starting Rendering"),this.alignmentCollectorQueue.terminateWorkers(),yield this.plot())}))}collectExons(t,e,n,r,i,a){const c=new Array;return t.forEach((t,n)=>{0==t.aligned_regions.length||"query"==e&&this.targetFilterFlag&&!this.targetCoverages.has(t.target_id)||"target"==e&&null!=a&&a!=t.target_id||c.push({data:[this.normalizeTargetAlignment(t,e)],id:t.target_id})}),this.simplifyExonTracks(c.sort((t,e)=>{const n=t.data,r=e.data;return n[0].begin!=r[0].begin?n[0].begin-r[0].begin:r[0].end!=n[0].end?r[0].end-n[0].end:n[0].gaps.map(t=>t.end-t.begin).reduce((t,e)=>t+e,0)-r[0].gaps.map(t=>t.end-t.begin).reduce((t,e)=>t+e,0)}).map(t=>("target"!=e||this.chrSet.includes(t.id)||this.chrSet.push(t.id),t.data)),e,i).map((t,e)=>({trackId:"pdbTracks_"+Math.random().toString(36).substr(2),displayType:"composite",trackColor:"#F9F9F9",rowTitle:"",titleFlagColor:r,overlap:!0,displayConfig:[{displayType:"block",displayData:t,displayColor:n,selectDataInRangeFlag:!0,hideEmptyTrackFlag:!0,minRatio:2e-4}]}))}normalizeTargetAlignment(t,e){const n="query"===e?"query_begin":"target_begin",r="query"===e?"query_end":"target_end",i={begin:Math.min(t.aligned_regions[0][n],t.aligned_regions[t.aligned_regions.length-1][r]),end:Math.max(t.aligned_regions[0][n],t.aligned_regions[t.aligned_regions.length-1][r]),gaps:[],description:[t.target_id],openBegin:t.orientation<0,openEnd:t.orientation>0};return t.orientation>0?("query"==e&&t.aligned_regions[t.aligned_regions.length-1][r]>this.maxRange&&(this.maxRange=t.aligned_regions[t.aligned_regions.length-1][r]),"query"==e&&t.aligned_regions[0][n]<this.minRange&&(this.minRange=t.aligned_regions[0][n]),t.aligned_regions.forEach((e,a)=>{if(a+1<t.aligned_regions.length){const c=t.aligned_regions[a+1];let o=e[r],s=c[n];const l=e.exon_shift;1==(null==l?void 0:l.length)?(1==Math.abs(l[0]-s)||i.gaps.push({end:l[0],begin:o,isConnected:!0}),s=l[0]):2==(null==l?void 0:l.length)&&(1==Math.abs(l[1]-s)&&1==Math.abs(l[1]-l[0])?s=l[0]:1==Math.abs(l[1]-s)?(i.gaps.push({end:l[0],begin:o,isConnected:!0}),o=l[0],s=l[1]):1==Math.abs(l[1]-l[0])?(i.gaps.push({end:l[0],begin:o,isConnected:!0}),o=l[1]):(i.gaps.push({end:l[0],begin:o,isConnected:!0}),o=l[0],i.gaps.push({end:l[1],begin:o,isConnected:!0}),o=l[1])),i.gaps.push({begin:o,end:s,isConnected:!0})}})):("query"==e&&t.aligned_regions[0][n]>this.maxRange&&(this.maxRange=t.aligned_regions[0][n]),"query"==e&&t.aligned_regions[t.aligned_regions.length-1][r]<this.minRange&&(this.minRange=t.aligned_regions[t.aligned_regions.length-1][r]),t.aligned_regions.reverse().forEach((e,a)=>{if(a+1<t.aligned_regions.length){const c=t.aligned_regions[a+1];let o=e[n],s=c[r];const l=c.exon_shift;1==(null==l?void 0:l.length)?(1==Math.abs(l[0]-o)||i.gaps.push({end:l[0],begin:o,isConnected:!0}),o=l[0]):2==(null==l?void 0:l.length)&&(1==Math.abs(l[1]-o)&&1==Math.abs(l[1]-l[0])?o=l[0]:1==Math.abs(l[1]-o)?(o=l[1],i.gaps.push({end:l[0],begin:o,isConnected:!0}),o=l[0]):1==Math.abs(l[1]-l[0])?(i.gaps.push({end:l[0],begin:o,isConnected:!0}),o=l[1]):(i.gaps.push({end:l[0],begin:o,isConnected:!0}),o=l[0],i.gaps.push({end:l[1],begin:o,isConnected:!0}),o=l[1])),i.gaps.push({end:s,begin:o,isConnected:!0})}})),i}simplifyExonTracks(t,e,n){const r=new Array;return t.forEach(t=>{const e=t[0].begin,n=t[0].end;if(0==r.length)this.entityBegin>0&&this.entityEnd>0&&!(e>this.entityEnd||n<this.entityBegin)&&(e<this.beginView&&(this.beginView=e),n>this.endView&&(this.endView=n)),r.push(t);else{const i=r.length-1,a=r[i][0].begin,c=r[i][0].end;e+"."+t[0].gaps.map(t=>t.begin+"."+t.end).join(".")+"."+n!=a+"."+r[i][0].gaps.map(t=>t.begin+"."+t.end).join(".")+"."+c?(this.entityBegin>0&&this.entityEnd>0&&!(e>this.entityEnd||n<this.entityBegin)&&(e<this.beginView&&(this.beginView=e),n>this.endView&&(this.endView=n)),r.push(t)):r[i][0].description.push(t[0].description[0])}}),r}mergeExonTracks(t,e){const n=new Array;return t.forEach(t=>{if(0==n.length)n.push(t);else{const e=t.displayConfig[0].displayData[0].begin;let r=-1;n.forEach((t,n)=>{const i=t.displayConfig[0].displayData.length-1,a=t.displayConfig[0].displayData[i].end;e>a&&-1==r&&(r=n)}),r>=0?n[r].displayConfig[0].displayData.push(t.displayConfig[0].displayData[0]):-1==r&&n.push(t)}}),this.addSequences(n,e),n}addSequences(t,e){t.forEach(t=>{var n,r;const i=new Map;t.displayConfig[0].displayData.forEach(t=>{i.set([t.begin,t.end],t.description[0])}),t.displayConfig.push({displayType:"sequence",updateDataOnMove:g(e,i,null===(r=null===(n=this.rcsbFv)||void 0===n?void 0:n.getBoardConfig())||void 0===r?void 0:r.trackWidth),displayData:[],hideEmptyTrackFlag:!0,minRatio:.001})})}setDisplayView(){var t,e,n,i;return r(this,void 0,void 0,(function*(){if(0==this.entityBegin&&0==this.entityEnd&&(null===(e=null===(t=this.pdbEntityTrack)||void 0===t?void 0:t.displayConfig)||void 0===e?void 0:e.length)>0){const t=this.pdbEntityTrack.displayConfig[0].displayData.length-1;this.entityBegin=this.pdbEntityTrack.displayConfig[0].displayData[0].begin,this.entityEnd=this.pdbEntityTrack.displayConfig[0].displayData[t].end,this.beginView=this.pdbEntityTrack.displayConfig[0].displayData[0].begin,this.endView=this.pdbEntityTrack.displayConfig[0].displayData[t].end;const e=this.beginView,n=this.endView,r=n-e;this.boardConfigData.range={min:e-Math.ceil(.05*r),max:n+Math.ceil(.05*r)}}else if((null===(i=null===(n=this.pdbEntityTrack)||void 0===n?void 0:n.displayConfig)||void 0===i?void 0:i.length)>0){this.beginView=this.minRange,this.endView=this.maxRange;const t=this.beginView,e=this.endView,n=e-t;this.boardConfigData.range={min:t-Math.ceil(.05*n),max:e+Math.ceil(.05*n)},this.updateChromosomeTitleRegion()}yield this.display()}))}plot(){var t;return r(this,void 0,void 0,(function*(){console.log("PROCESSING");let e=new Array,n=new Array;this.targetAlignmentList.get(o.SequenceReference.NcbiProtein).forEach((t,e)=>{t.length>0&&(n=n.concat(this.collectExons(t,"query","#69b3a2","#69b3a2",o.SequenceReference.NcbiProtein)))}),n=this.mergeExonTracks(n,o.SequenceReference.NcbiProtein);let r=new Array;this.targetAlignmentList.get(o.SequenceReference.Uniprot).forEach((t,e)=>{t.length>0&&(r=r.concat(this.collectExons(t,"query","#cc99ff","#cc99ff",o.SequenceReference.Uniprot)))}),r=this.mergeExonTracks(r,o.SequenceReference.Uniprot);let i=new Array;this.targetAlignmentList.get(o.SequenceReference.PdbEntity).forEach((t,e)=>{t.length>0&&(i=i.concat(this.collectExons(t,"query",l.RcsbAnnotationConstants.provenanceColorCode.rcsbPdb,l.RcsbAnnotationConstants.provenanceColorCode.rcsbPdb,o.SequenceReference.PdbEntity)))}),i=this.mergeExonTracks(i,o.SequenceReference.PdbEntity),n.length>0&&(e=e.concat(n),n[0].rowTitle="NCBI PROTEINS"),r.length>0&&(e=e.concat(r),r[0].rowTitle="UNIPROT PROTEINS"),i.length>0&&(e=e.concat(i),i[0].rowTitle="PDB ENTITIES");const a=(null===(t=this.featuresConfigData)||void 0===t?void 0:t.length)>0?this.nonExonConfigData.concat(this.featuresConfigData):this.nonExonConfigData;e.length>0?this.rowConfigData=a.concat(e):this.rowConfigData=a,console.log("RENDERING"),this.boardConfigData.hideInnerBorder=!0,this.boardConfigData.length=Math.floor(this.maxRange+.01*this.maxRange),this.boardConfigData.includeAxis=!0,yield this.setDisplayView(),this.buildSubject.next(void 0),this.targetsSubject.next(this.chrSet)}))}protectedBuild(t){return r(this,void 0,void 0,(function*(){return new Promise((e,n)=>{p.ObservableHelper.oneTimeSubscription(e,this.buildSubject),t.elementSelectId&&(this.elementSelectId=t.elementSelectId),null!=t.entityId?this.buildPdbGenomeFv(t.entityId,t.chrId):null!=t.chrId&&this.buildFullGenomeRangeFv(t.chrId)})}))}getTargets(){return r(this,void 0,void 0,(function*(){return new Promise((t,e)=>{this.chrSet.length>0?t(this.chrSet):p.ObservableHelper.oneTimeSubscription(t,this.targetsSubject)})}))}concatAlignmentAndAnnotationTracks(t){}}e.RcsbFvChromosome=m},function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n),Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[n]}})}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.hasOwnProperty.call(t,n)&&r(e,t,n);return i(e,t),e};Object.defineProperty(e,"__esModule",{value:!0}),e.SequenceCollectorHelper=void 0;const c=n(4),o=n(5),s=a(n(16)),l=n(12),u=n(21);e.SequenceCollectorHelper=class{buildAlignments(t,e,n){const r=new Array,i=new Array;return t.targetAlignmentList instanceof Array&&t.targetAlignmentList.sort((t,e)=>t.target_id.localeCompare(e.target_id)).forEach(a=>{if(null!=t.filterByTargetContains&&!a.target_id.includes(t.filterByTargetContains))return;if(null==a.target_sequence)return;const c=a.target_sequence,s={queryId:t.queryId,targetId:a.target_id,from:t.from,to:t.to,targetSequenceLength:c.length};r.push(a.target_id);const h=[];let d=[];const f=[];a.aligned_regions.forEach(e=>{const r=c.substring(e.target_begin-1,e.target_end);this.buildSequenceData(Object.assign(Object.assign({},s),{sequenceData:h,sequence:r,begin:e.query_begin,oriBegin:e.target_begin}));let i=!1;1!=e.target_begin&&(i=!0);let o=!1;e.target_end!=c.length&&(o=!0),n(e,s).forEach(e=>{var n,r;d.push(this.addAuthorResIds({begin:e.query_begin,end:e.query_end,oriBegin:e.target_begin,oriEnd:e.target_end,sourceId:a.target_id,source:t.to,provenanceName:l.RcsbAnnotationConstants.provenanceName.pdb,provenanceColor:l.RcsbAnnotationConstants.provenanceColorCode.rcsbPdb,openBegin:null!==(n=e.openBegin)&&void 0!==n?n:i,openEnd:null!==(r=e.openEnd)&&void 0!==r?r:o,type:"ALIGNED_BLOCK",title:e.unModelled?"UNMODELED REGION":"ALIGNED REGION",color:e.unModelled?"#AAAAAA":void 0},s))}),function(t,e){const n=[];if(t.length===e.length)for(let r=0;r<t.length;r++)t.charAt(r)!==e.charAt(r)&&n.push(r);return n}(r,t.querySequence.substring(e.query_begin-1,e.query_end)).forEach(n=>{f.push(this.addAuthorResIds({begin:n+e.query_begin,oriBegin:n+e.target_begin,sourceId:a.target_id,source:t.to,provenanceName:l.RcsbAnnotationConstants.provenanceName.pdb,provenanceColor:l.RcsbAnnotationConstants.provenanceColorCode.rcsbPdb,type:"MISMATCH",title:"MISMATCH"},s))})}),u.FeatureTools.mergeBlocks(d);const v={displayType:"sequence",displayColor:"#000000",displayData:h,dynamicDisplay:e},p={displayType:"pin",displayColor:"#FF9999",displayData:f},g={displayType:"block",displayColor:"#9999FF",displayData:d};let m=t.to?t.to.replace("_"," ")+" "+o.TagDelimiter.alignmentTitle:"";const y={trackId:"targetSequenceTrack_"+a.target_id,displayType:"composite",trackColor:"#F9F9F9",rowPrefix:m,rowTitle:this.buildAlignmentRowTitle(a,t),fitTitleWidth:t.fitTitleWidth,titleFlagColor:l.RcsbAnnotationConstants.provenanceColorCode.rcsbPdb,displayConfig:[g,p,v]};i.push(y)}),{targets:r,alignments:i}}buildSequenceData(t,e){let n=t.to;!0===e&&(n=t.from);let r=l.RcsbAnnotationConstants.provenanceColorCode.external;return n!=c.Source.PdbInstance&&n!=c.Source.PdbEntity||(n=l.RcsbAnnotationConstants.provenanceName.pdb,r=l.RcsbAnnotationConstants.provenanceColorCode.rcsbPdb),t.sequence.split("").forEach((e,i)=>{const a={begin:t.begin+i,sourceId:t.targetId,source:t.to,provenanceName:n,provenanceColor:r,value:e};"string"==typeof t.targetId&&(a.sourceId=t.targetId),"number"==typeof t.oriBegin&&(a.oriBegin=t.oriBegin+i),t.sequenceData.push(this.addAuthorResIds(a,{from:t.from,to:t.to,queryId:t.queryId,targetId:t.targetId}))}),t.sequenceData}buildSequenceRowTitle(t){let e;return e=t.excludeFirstRowLink||t.from!==c.SequenceReference.Uniprot?t.excludeFirstRowLink||t.from!==c.SequenceReference.PdbInstance||null==this.entityInstanceTranslator?{visibleTex:t.queryId,style:{fontWeight:"bold"}}:{visibleTex:this.buildInstanceId(t.queryId),style:{fontWeight:"bold"}}:{visibleTex:t.queryId,url:s.rcsb_uniprot.url+t.queryId,style:{fontWeight:"bold",color:l.RcsbAnnotationConstants.provenanceColorCode.rcsbPdb}},e}buildAlignmentRowTitle(t,e){let n;if(e.to===c.SequenceReference.PdbInstance&&null!=this.entityInstanceTranslator){const e=this.entityInstanceTranslator.translateAsymToEntity(t.target_id.split(o.TagDelimiter.instance)[1]);n={visibleTex:this.buildInstanceId(t.target_id),url:s.rcsb_entry.url+t.target_id.split(o.TagDelimiter.instance)[0]+"#entity-"+e,style:{fontWeight:"bold",color:l.RcsbAnnotationConstants.provenanceColorCode.rcsbPdb}}}else if(e.to!==c.SequenceReference.PdbEntity||e.excludeAlignmentLinks)if(e.to!==c.SequenceReference.PdbInstance||e.excludeAlignmentLinks||null==this.entityInstanceTranslator)n=e.to===c.SequenceReference.Uniprot?{visibleTex:t.target_id,url:s.rcsb_uniprot.url+t.target_id,style:{fontWeight:"bold",color:l.RcsbAnnotationConstants.provenanceColorCode.rcsbPdb}}:t.target_id;else{const e=this.entityInstanceTranslator.translateAsymToEntity(t.target_id.split(o.TagDelimiter.instance)[1]);n={visibleTex:this.buildInstanceId(t.target_id),url:s.rcsb_entry.url+t.target_id.split(o.TagDelimiter.instance)[0]+"#entity-"+e,style:{fontWeight:"bold",color:l.RcsbAnnotationConstants.provenanceColorCode.rcsbPdb}}}else{const e=t.target_id.split(o.TagDelimiter.entity)[1];n={visibleTex:t.target_id,url:s.rcsb_entry.url+t.target_id.split(o.TagDelimiter.entity)[0]+"#entity-"+e,style:{fontWeight:"bold",color:l.RcsbAnnotationConstants.provenanceColorCode.rcsbPdb}}}return n}addAuthorResIds(t,e){let n=t;return null!=this.entityInstanceTranslator&&this.entityInstanceTranslator.addAuthorResIds(n,e),e.to==c.SequenceReference.PdbInstance&&null!=n.sourceId&&(n.sourceId=n.sourceId.split(o.TagDelimiter.instance)[0]+o.TagDelimiter.instance+this.entityInstanceTranslator.translateAsymToAuth(n.sourceId.split(o.TagDelimiter.instance)[1])),n}buildInstanceId(t){var e;const n=t.split(o.TagDelimiter.instance)[1],r=null===(e=this.entityInstanceTranslator)||void 0===e?void 0:e.translateAsymToAuth(n);return n!==r&&r?n+"[auth "+r+"]":n}setPolymerEntityInstanceTranslator(t){this.entityInstanceTranslator=t}}},function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n),Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[n]}})}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.hasOwnProperty.call(t,n)&&r(e,t,n);return i(e,t),e},c=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,a){function c(t){try{s(r.next(t))}catch(t){a(t)}}function o(t){try{s(r.throw(t))}catch(t){a(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,o)}s((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.SwissModelQueryAnnotations=void 0;const o=a(n(16));class s{static request(t){return c(this,void 0,void 0,(function*(){const e=s.url+t+s.urlSuffix;try{const t=yield fetch(e),n=yield t.json();return s.parse(n)}catch(t){throw console.error(t),t}}))}static parse(t){const e=new Array;return t.result.structures.forEach(t=>{const n={provenance_source:t.provider,type:t.method,feature_positions:[{beg_seq_id:t.from,end_seq_id:t.to}]};e.push(n)}),[{features:e}]}}e.SwissModelQueryAnnotations=s,s.url=o.swiss_model.url,s.urlSuffix=o.swiss_model.url_suffix},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AnnotationCollectorHelper=void 0;const r=n(39),i=n(12),a=n(21);class c{static buildAnnotationTrack(t,e,n,r){let a,o;const s=n;return null!==s&&(o=s.display),a="composite"===o||"bond"===o||"pin"===o?c.buildRcsbFvRowConfigComposite(t,e,n):"area"===o||"line"===o?c.buildRcsbFvRowConfigArea(t,e,n):"block-area"===o?c.buildRcsbFvRowConfigBlockArea(t,e,n):c.buildRcsbFvRowConfigTrack(t,e,n),null!=s&&"number"==typeof s.height&&(a.trackHeight=s.height),r instanceof Array&&1==r.length&&(r[0]===i.RcsbAnnotationConstants.provenanceName.pdb||r[0]===i.RcsbAnnotationConstants.provenanceName.promotif)?a.titleFlagColor=i.RcsbAnnotationConstants.provenanceColorCode.rcsbPdb:a.titleFlagColor=i.RcsbAnnotationConstants.provenanceColorCode.external,a}static buildRcsbFvRowConfigTrack(t,e,n){const i=t.values();let a="block";i.length>0&&null==i[0].end&&(a="pin");let o=r.RcsbAnnotationConfig.randomRgba(),s=e,l=void 0;const u=n;return null!==u?(a=u.display,s=c.buildRowTitle(u),o=u.color,l=u.prefix):console.warn("Annotation config type "+e+" not found. Using random config"),Object.assign(Object.assign({},n),{trackId:"annotationTrack_"+e,displayType:a,trackColor:"#F9F9F9",displayColor:o,rowTitle:s,rowPrefix:l,trackData:i})}static buildRcsbFvRowConfigArea(t,e,n){var r;const i=t.values(),a=n,o=a.display,s=a.color,l=c.buildRowTitle(a),u=a.prefix;let h=t.getRange().min,d=t.getRange().max;h>=0?h=0:Math.abs(h)>Math.abs(d)?d=-h:h=-d;const f=null!==(r=a.domain)&&void 0!==r?r:[h,d];return Object.assign(Object.assign({},n),{trackId:"annotationTrack_"+e,displayType:o,trackColor:"#F9F9F9",displayColor:s,rowTitle:l,rowPrefix:u,displayDomain:f,interpolationType:"step",trackData:i})}static buildRcsbFvRowConfigBlockArea(t,e,n){const r=t.values(),i=n,a=i.display,o=i.color,s=c.buildRowTitle(i),l=i.prefix;return Object.assign(Object.assign({},n),{trackId:"annotationTrack_"+e,displayType:a,trackColor:"#F9F9F9",displayColor:o,rowTitle:s,rowPrefix:l,displayDomain:[0,1],interpolationType:"step",trackData:r})}static buildRcsbFvRowConfigComposite(t,e,n){var i;const a=t.values();let o;const s=n;let l="block";s.display==="bond".toString()&&(l="bond",a.forEach(t=>{t.isEmpty=!0}));const u=c.buildRowTitle(s),h=s.prefix,d=null!==(i=s.color)&&void 0!==i?i:r.RcsbAnnotationConfig.randomRgba(),f=new Array,v=new Array;if(a.forEach(t=>{null!==t.end&&t.end!==t.begin?v.push(t):f.push(t)}),f.length>0&&v.length>0){const t=new Array;t.push({displayData:v,displayType:l,displayColor:d}),t.push({displayData:f,displayType:"pin",displayColor:d}),o={displayType:"composite",trackColor:"#F9F9F9",trackId:"annotationTrack_"+e,rowTitle:u,rowPrefix:h,displayConfig:t}}else f.length>0&&(l="pin");return void 0===o&&(o={trackId:"annotationTrack_"+e,displayType:l,trackColor:"#F9F9F9",displayColor:d,rowTitle:u,rowPrefix:h,trackData:a}),o}static buildRowTitle(t){return t.prefix?a.FeatureTools.parseLink(t.title):t.title}}e.AnnotationCollectorHelper=c},function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,a){function c(t){try{s(r.next(t))}catch(t){a(t)}}function o(t){try{s(r.throw(t))}catch(t){a(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,o)}s((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.AnnotationTrackManager=void 0;const i=n(95);e.AnnotationTrackManager=class{constructor(t){this.annotationTracks=new Map,this.rcsbAnnotationConfig=t}processRcsbPdbAnnotations(t,e){var n,i,a;return r(this,void 0,void 0,(function*(){yield this.addAnnotationToTracks(e,"function"==typeof(null===(n=e.externalAnnotationTrackBuilder)||void 0===n?void 0:n.filterFeatures)?yield null===(i=e.externalAnnotationTrackBuilder)||void 0===i?void 0:i.filterFeatures({annotations:t,rcsbContext:e.rcsbContext}):t),null===(a=e.annotationProcessing)||void 0===a||a.computeAnnotationValue(this.annotationTracks),this.mergeTracks()}))}getAnnotationTracks(){return this.annotationTracks}getPolymerEntityInstanceTranslator(){return this.polymerEntityInstanceTranslator}setPolymerEntityInstanceTranslator(t){this.polymerEntityInstanceTranslator=t}mergeTracks(){this.annotationTracks.forEach((t,e)=>{if(this.rcsbAnnotationConfig.isMergedType(e)){const t=this.rcsbAnnotationConfig.getMergedType(e),n=this.rcsbAnnotationConfig.getConfig(e).color;this.annotationTracks.has(t)||this.annotationTracks.set(t,new i.AnnotationTrack(e,this.rcsbAnnotationConfig.getConfig(e),this.getPolymerEntityInstanceTranslator())),this.annotationTracks.get(t).addAll(this.annotationTracks.get(e),n),this.rcsbAnnotationConfig.addMultipleProvenance(t,Array.from(this.annotationTracks.get(t).getTrackProvenance())),this.annotationTracks.delete(e)}})}buildType(t,e,n){return r(this,void 0,void 0,(function*(){return this.rcsbAnnotationConfig.buildAndAddType(n,"function"==typeof t.trackTitle?yield t.trackTitle(e,n):void 0,"function"==typeof t.titleSuffix?yield t.titleSuffix(e,n):void 0,"function"==typeof t.typeSuffix?yield t.typeSuffix(e,n):void 0)}))}addAnnotationToTracks(t,e){return r(this,void 0,void 0,(function*(){yield Promise.all(e.map(e=>e.features.map(n=>r(this,void 0,void 0,(function*(){return yield this.addFeature(t,e,n)})))).flat())}))}addFeature(t,e,n){var a;return r(this,void 0,void 0,(function*(){if(null===(a=this.rcsbAnnotationConfig.getConfig(n.type))||void 0===a?void 0:a.ignore)return;const r=yield this.buildType(t,e,n);this.annotationTracks.has(r)||this.annotationTracks.set(r,new i.AnnotationTrack(r,this.rcsbAnnotationConfig.getConfig(r),this.getPolymerEntityInstanceTranslator())),this.rcsbAnnotationConfig.addProvenance(r,n.provenance_source),this.annotationTracks.get(r).addFeature({reference:t.reference,queryId:t.queryId,source:e.source,targetId:e.target_id,feature:n},t.annotationProcessing)}))}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AnnotationTrack=void 0;const r=n(4),i=n(12),a=n(5);e.AnnotationTrack=class{constructor(t,e,n){this.valueRange={max:Number.MIN_SAFE_INTEGER,min:Number.MAX_SAFE_INTEGER},this.trackElementMap=new Map,this.entityInstanceTranslator=n,this.type=t,this.annotationConfig=e}getRange(){return this.valueRange}addFeature(t,e){(function(t){const e=new Map,n=new Array;return t.forEach(t=>{null!=t.range_id?(e.has(t.range_id)||e.set(t.range_id,new Array),e.get(t.range_id).push(t)):n.push(t)}),e.forEach((t,e)=>{if(1==t.length)n.push(t[0]);else{const e=t.sort((t,e)=>t.beg_seq_id-e.beg_seq_id),r=Object.assign(Object.assign({},e[0]),{end_seq_id:e[e.length-1].end_seq_id,end_ori_id:e[e.length-1].end_ori_id,open_end:e[e.length-1].open_end,gaps:new Array});for(let t=0;t<e.length-1;t++)r.gaps.push({begin:e[t].end_seq_id,end:e[t+1].beg_seq_id,isConnected:null==e[t].beg_ori_id||null==e[t].end_ori_id||null==e[t+1].beg_ori_id||null==e[t+1].end_ori_id||e[t].end_ori_id+1==e[t+1].beg_ori_id||e[t].end_ori_id==e[t+1].beg_ori_id+1||e[t].end_ori_id==e[t+1].beg_ori_id});n.push(r)}}),n})(t.feature.feature_positions).forEach(n=>{null!=n.beg_seq_id&&this.annotationRangeKeys(n).forEach(r=>{this.addRange(t.reference,t.queryId,t.source,t.targetId,t.feature,n,r,e)})})}size(){return this.trackElementMap.size}forEach(t){this.trackElementMap.forEach((e,n)=>{t(e,n)})}addAll(t,e){t.forEach((t,n)=>{t.color=null!=e?e:t.color,this.trackElementMap.set(n,t)})}getTrackProvenance(){return new Set(Array.from(this.trackElementMap.values()).map(t=>t.provenanceName))}set(t,e){this.trackElementMap.set(t,e)}values(){return Array.from(this.trackElementMap.values())}buildRcsbFvTrackDataElement(t,e,n,c,o){var s,l,u,h,d,f;let v=null!==(l=null===(s=this.annotationConfig)||void 0===s?void 0:s.title)&&void 0!==l?l:this.type,p=void 0;this.isNumericalDisplay(this.type)&&(p=(null===(u=this.annotationConfig)||void 0===u?void 0:u.transformToNumerical)?1:t.values instanceof Array&&null!==(h=t.values[0])&&void 0!==h?h:0),t.values instanceof Array&&t.values.length>0?(Math.max(...t.values)>this.valueRange.max&&(this.valueRange.max=Math.max(...t.values)),Math.min(...t.values)<this.valueRange.min&&(this.valueRange.min=Math.min(...t.values))):"number"==typeof p&&(p>this.valueRange.max&&(this.valueRange.max=p),p<this.valueRange.min&&(this.valueRange.min=p));let g=i.RcsbAnnotationConstants.provenanceColorCode.external;o!==i.RcsbAnnotationConstants.provenanceName.pdb&&o!==i.RcsbAnnotationConstants.provenanceName.promotif||(g=i.RcsbAnnotationConstants.provenanceColorCode.rcsbPdb);const m=c==r.Source.PdbInstance&&null!=this.entityInstanceTranslator?n.split(a.TagDelimiter.instance)[0]+a.TagDelimiter.instance+this.entityInstanceTranslator.translateAsymToAuth(n.split(a.TagDelimiter.instance)[1]):n;return{begin:t.beg_seq_id,end:null!==(d=t.end_seq_id)&&void 0!==d?d:t.beg_seq_id,oriBegin:t.beg_ori_id,oriEnd:null!==(f=t.end_ori_id)&&void 0!==f?f:t.beg_ori_id,description:new Array,featureId:e.feature_id,type:this.type,title:v,name:e.name,value:p,gValue:e.value,gaps:t.gaps,sourceId:m,source:c,provenanceName:o,provenanceColor:g,openBegin:t.open_begin,openEnd:t.open_end}}addRange(t,e,n,r,i,a,c,o){var s,l;const u=c.join(":");if(this.trackElementMap.has(u))this.isNumericalDisplay(this.type)&&(null===(l=this.annotationConfig)||void 0===l?void 0:l.transformToNumerical)&&"number"==typeof this.trackElementMap.get(u).value&&(this.trackElementMap.get(u).value+="function"==typeof(null==o?void 0:o.getAnnotationValue)?o.getAnnotationValue({type:this.type,targetId:r,positionKey:u,d:i,p:a}):1,this.trackElementMap.get(u).value>this.valueRange.max&&(this.valueRange.max=this.trackElementMap.get(u).value),this.trackElementMap.get(u).value<this.valueRange.min&&(this.valueRange.min=this.trackElementMap.get(u).value));else{const l=this.buildRcsbFvTrackDataElement(a,i,r,n,i.provenance_source);(null===(s=this.annotationConfig)||void 0===s?void 0:s.transformToNumerical)&&this.transformToNumerical(r,c,u,l,i,a,null==o?void 0:o.getAnnotationValue),"function"==typeof(null==o?void 0:o.addTrackElementCallback)&&(null==o||o.addTrackElementCallback({type:this.type,targetId:r,positionKey:u,d:i,p:a}));const h={from:t,to:n,queryId:e,targetId:r};this.addAuthorResIds(l,h),this.trackElementMap.set(u,l),a.values instanceof Array&&this.expandValues(l,a.values,h)}"string"==typeof i.description&&this.trackElementMap.get(u).description.push(i.description)}transformToNumerical(t,e,n,r,i,a,c){"function"==typeof c&&(r.value=c({type:this.type,targetId:t,positionKey:n,d:i,p:a})),r.begin=e[0],r.end=e[0]}expandValues(t,e,n){e.forEach((e,r)=>{if(r>0){const i=(t.begin+r).toString(),a=Object.assign(Object.assign({},t),{begin:t.begin+r,end:null,oriBegin:t.oriBegin?t.oriBegin+r:null,oriEnd:null,value:e});this.addAuthorResIds(a,n),this.trackElementMap.set(i,a)}})}addAuthorResIds(t,e){let n=t;return null!=this.entityInstanceTranslator&&e.from&&this.entityInstanceTranslator.addAuthorResIds(n,e),n}isNumericalDisplay(t){return null!=this.annotationConfig&&("area"===this.annotationConfig.display||"block-area"===this.annotationConfig.display||"multi-area"===this.annotationConfig.display||"line"===this.annotationConfig.display)}annotationRangeKeys(t){var e,n,r;const i=new Array;if((null===(e=this.annotationConfig)||void 0===e?void 0:e.transformToNumerical)&&null!=t.end_seq_id)for(let e=t.beg_seq_id;e<=t.end_seq_id;e++)i.push([e]);else if(null===(n=this.annotationConfig)||void 0===n?void 0:n.transformToNumerical)i.push([t.beg_seq_id]);else{const e=null!=t.end_seq_id?[t.beg_seq_id,t.end_seq_id]:[t.beg_seq_id,t.beg_seq_id];(null===(r=this.annotationConfig)||void 0===r?void 0:r.displayCooccurrence)&&e.push(Math.ceil(1e12*Math.random())),i.push(e)}return i}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.RcsbFvAlignmentCollectorQueue=void 0;const r=n(14);e.RcsbFvAlignmentCollectorQueue=class{constructor(t){this.workerList=new Array,this.taskQueue=new Array,this.isQueueActive=!1,this.nWorkers=null!=t?t:self.navigator.hardwareConcurrency;for(let t=0;t<this.nWorkers;t++)this.workerList.push({available:!0,worker:new Worker("/saguaro/worker.js")})}sendTask(t,e){const n=this.workerList.filter(t=>t.available);n.length>0?(n[0].available=!1,n[0].worker.postMessage(t),n[0].worker.onmessage=t=>{e(t.data),n[0].available=!0}):(this.taskQueue.push({request:t,callback:e}),this.isQueueActive||this.activateQueue())}activateQueue(){this.isQueueActive=!0,this.recursiveExec()}recursiveExec(){0==this.taskQueue.length?this.isQueueActive=!1:(this.isQueueActive=!0,this.workerList.filter(t=>t.available).forEach(t=>{if(this.taskQueue.length>0){t.available=!1;const e=this.taskQueue.shift();t.worker.postMessage(e.request),t.worker.onmessage=n=>{e.callback(n.data),t.available=!0}}}),r.asyncScheduler.schedule(()=>{this.recursiveExec()},1e3))}terminateWorkers(){this.workerList.forEach(t=>{t.worker.terminate()})}}},function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n),Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[n]}})}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.hasOwnProperty.call(t,n)&&r(e,t,n);return i(e,t),e};Object.defineProperty(e,"__esModule",{value:!0}),e.NcbiGenomeSequenceData=void 0;const c=n(14),o=a(n(16));class s{static update(t,e,n,r){let i=null;return a=>(i&&i.unsubscribe(),new Promise((o,l)=>{if((r?r/(a.to-a.from):1e3/(a.to-a.from))>4){let r=0;const u=5e3,h=()=>{const d=new XMLHttpRequest;d.timeout=u;const f=s.urlPrefix+"id="+t+"&from="+a.from+"&to="+a.to+"&strand="+e+s.urlSuffix;d.open("GET",f),d.send(),d.onloadend=t=>{const e=d.responseText.split("\n").slice(1).join("");if(e.length<1)r++,console.warn("HTTP error while access URL: "+f+" - empty sequence - "+r),r<4?i=c.asyncScheduler.schedule(()=>{h()},u):l("HTTP error while access URL: "+f+" - No more attempts after "+r);else{const t=[{begin:a.from,value:n?e.split("").reverse().join(""):e}];o(t)}},d.onerror=t=>{r++,console.warn("HTTP error while access URL: "+f+" - "+r),r<4?i=c.asyncScheduler.schedule(()=>{h()},u):l("HTTP error while access URL: "+f+" - No more attempts after "+r)}};h()}else o(null)}))}}e.NcbiGenomeSequenceData=s,s.urlPrefix=o.ncbi_genome_sequence.url,s.urlSuffix=o.ncbi_genome_sequence.url_suffix},function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n),Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[n]}})}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.hasOwnProperty.call(t,n)&&r(e,t,n);return i(e,t),e};Object.defineProperty(e,"__esModule",{value:!0}),e.NcbiSummary=void 0;const c=n(14),o=a(n(16));class s{static requestChromosomeData(t){s.jobTask&&s.jobTask.unsubscribe();const e=o.ncbi_summary_nuccore.url,n=o.ncbi_summary_nuccore.url_suffix;return new Promise((r,i)=>{const a=()=>{const i=e+t+n,o=new XMLHttpRequest;o.timeout=s.httpTimeout,o.open("GET",i),o.send(),o.onloadend=e=>{var n,i;if(0==o.responseText.length)s.jobTask=c.asyncScheduler.schedule(()=>{a()},s.timeout);else{const e=JSON.parse(o.responseText),a=null===(i=null===(n=e)||void 0===n?void 0:n.result)||void 0===i?void 0:i.uids[0],c=e.result[a];c.ncbiId=t,r(c)}},o.onerror=t=>{s.jobTask&&s.jobTask.unsubscribe(),s.jobTask=c.asyncScheduler.schedule(()=>{a()},s.timeout)}};a()})}static requestTaxonomyData(t){s.jobTask&&s.jobTask.unsubscribe();const e=o.ncbi_summary_taxonomy.url,n=o.ncbi_summary_taxonomy.url_suffix;return new Promise((r,i)=>{const a=()=>{const i=e+t+n,o=new XMLHttpRequest;o.timeout=s.httpTimeout,o.open("GET",i),o.send(),o.onloadend=t=>{var e,n;if(0==o.responseText.length)s.jobTask=c.asyncScheduler.schedule(()=>{a()},s.timeout);else{const t=JSON.parse(o.responseText),i=null===(n=null===(e=t)||void 0===e?void 0:e.result)||void 0===n?void 0:n.uids[0];r(t.result[i])}},o.onerror=t=>{s.jobTask=c.asyncScheduler.schedule(()=>{a()},s.timeout)}};a()})}}e.NcbiSummary=s,s.timeout=3e3,s.httpTimeout=1e4,s.jobTask=null},function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,a){function c(t){try{s(r.next(t))}catch(t){a(t)}}function o(t){try{s(r.throw(t))}catch(t){a(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,o)}s((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.RcsbFvPairwiseAligmentBuilder=void 0;const i=n(8),a=n(100);e.RcsbFvPairwiseAligmentBuilder=class{static buildPairwiseAlignment(t,e,n){return r(this,void 0,void 0,(function*(){return new Promise((r,c)=>{try{i.RcsbFvCoreBuilder.createFv({elementId:t,fvModuleI:a.RcsbFvPairwiseAlignment,config:{psa:e,additionalConfig:Object.assign({rcsbContext:{queryId:e.queryId,targetId:e.targetId}},n),resolve:r}})}catch(t){c(t)}})}))}}},function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,a){function c(t){try{s(r.next(t))}catch(t){a(t)}}function o(t){try{s(r.throw(t))}catch(t){a(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,o)}s((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.RcsbFvPairwiseAlignment=void 0;const i=n(9),a=n(101);class c extends i.RcsbFvAbstractModule{protectedBuild(t){var e;return r(this,void 0,void 0,(function*(){const n=new a.PairwiseAlignmentBuilder(t.psa),r=Object.assign({rowTitleWidth:120,trackWidth:800,length:n.getLength(),includeAxis:!t.psa.pairwiseView},null===(e=t.additionalConfig)||void 0===e?void 0:e.boardConfig);this.boardConfigData=Object.assign(Object.assign({},this.boardConfigData),r),this.rowConfigData=t.psa.pairwiseView?n.buildPairwiseAlignment():n.buildReferenceAlignment()}))}concatAlignmentAndAnnotationTracks(t){}}e.RcsbFvPairwiseAlignment=c},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.PairwiseAlignmentBuilder=void 0;const r=n(12),i=n(4),a=n(21),c=(t,e,n)=>{const r=n,i=1-r;return[Math.round(t[0]*r+e[0]*i),Math.round(t[1]*r+e[1]*i),Math.round(t[2]*r+e[2]*i)]};e.PairwiseAlignmentBuilder=class{constructor(t){if(this.querySequence=t.querySequence,this.targetSequence=t.targetSequence,this.queryAlignment=t.queryAlignment,this.targetAlignment=t.targetAlignment,this.queryBegin=t.queryBegin,this.queryEnd=t.queryEnd,this.targetBegin=t.targetBegin,this.targetEnd=t.targetEnd,this.targetId=t.targetId,this.queryId=t.queryId,this.sequenceId=t.sequenceId,this.isQueryExternal=t.isQueryExternal,this.isTargetExternal=t.isTargetExternal,this.pairwiseView=t.pairwiseView,this.queryAlignment.length!=this.targetAlignment.length)throw"Sequence alignments length mismatch";this.pairwiseView?this.alignmentLength=this.queryAlignment.length:this.alignmentLength=this.querySequence.length}getLength(){return this.alignmentLength}buildReferenceAlignment(){const t=this.queryAlignment.split(""),e=this.targetAlignment.split(""),n=[],a=[],o=[];let s=this.queryBegin,l=this.targetBegin,u=this.queryBegin,h=this.targetBegin;t.forEach((t,c)=>{const d=e[c];("-"===d||"-"===t)&&u>0&&(n.push({begin:u,end:s-1,oriBegin:h,oriEnd:l-1,source:i.SequenceReference.PdbEntity,sourceId:this.targetId,provenanceName:r.RcsbAnnotationConstants.provenanceName.mmseqs,provenanceColor:r.RcsbAnnotationConstants.provenanceColorCode.rcsbPdb,type:"ALIGNED_BLOCK",title:"ALIGNED REGION"}),u=0),"-"!=t&&"-"!=d&&(o.push({begin:s,oriBegin:l,source:i.SequenceReference.PdbEntity,sourceId:this.targetId,provenanceName:r.RcsbAnnotationConstants.provenanceName.mmseqs,provenanceColor:r.RcsbAnnotationConstants.provenanceColorCode.rcsbPdb,value:d,type:"RESIDUE",title:"RESIDUE"}),t!=d&&a.push({begin:s,oriBegin:l,source:i.SequenceReference.PdbEntity,sourceId:this.targetId,provenanceName:r.RcsbAnnotationConstants.provenanceName.mmseqs,provenanceColor:r.RcsbAnnotationConstants.provenanceColorCode.rcsbPdb,type:"MISMATCH",title:"MISMATCH"})),"-"!=d&&"-"!=t&&0==u&&(u=s,h=l),"-"!=t&&s++,"-"!=d&&l++}),u>0&&n.push({begin:u,end:s-1,oriBegin:h,oriEnd:l-1,source:i.SequenceReference.PdbEntity,sourceId:this.targetId,provenanceName:r.RcsbAnnotationConstants.provenanceName.mmseqs,provenanceColor:r.RcsbAnnotationConstants.provenanceColorCode.rcsbPdb,type:"ALIGNED_BLOCK",title:"ALIGNED REGION"}),this.addBlockTerminalTags(n);const d={trackId:"query_sequence",displayType:"sequence",trackColor:"#F9F9F9",displayColor:"#000000",titleFlagColor:this.isQueryExternal?r.RcsbAnnotationConstants.provenanceColorCode.external:r.RcsbAnnotationConstants.provenanceColorCode.rcsbPdb,rowTitle:this.queryId,nonEmptyDisplay:!0,trackData:[{value:this.querySequence,begin:1}]},f={displayType:"sequence",displayColor:"#333333",displayData:o},v={displayType:"pin",displayColor:"#FF9999",displayData:a,minRatio:5},p={displayType:"block",displayColor:"rgb("+c([153,153,255],[50,50,50],this.sequenceId).join(",")+")",displayData:n};return[d,{trackId:"targetSequenceTrack",rowTitle:this.targetId,displayType:"composite",trackColor:"#F9F9F9",titleFlagColor:this.isTargetExternal?r.RcsbAnnotationConstants.provenanceColorCode.external:r.RcsbAnnotationConstants.provenanceColorCode.rcsbPdb,displayConfig:[p,v,f]}]}buildPairwiseAlignment(){const t=this.queryAlignment.split(""),e=this.targetAlignment.split(""),n=[],a=[],o=[],s=[];let l=this.queryBegin,u=this.targetBegin,h=1;t.forEach((t,c)=>{const d=e[c];"-"===t||"-"===d?h>0&&c>h&&(n.push({begin:h,end:c,provenanceName:r.RcsbAnnotationConstants.provenanceName.mmseqs,provenanceColor:r.RcsbAnnotationConstants.provenanceColorCode.rcsbPdb,type:"ALIGNED_BLOCK",title:"ALIGNED REGION"}),h=0):"-"!=t&&"-"!=d&&0==h&&(h=c+1),"-"!=t&&"-"!=d&&t!=d&&h>0&&a.push({begin:c+1,provenanceName:r.RcsbAnnotationConstants.provenanceName.mmseqs,provenanceColor:r.RcsbAnnotationConstants.provenanceColorCode.rcsbPdb,type:"MISMATCH",title:"MISMATCH"}),o.push({begin:c+1,value:t,source:r.RcsbAnnotationConstants.provenanceName.userInput,sourceId:"QUERY SEQUENCE",provenanceName:r.RcsbAnnotationConstants.provenanceName.userInput,provenanceColor:r.RcsbAnnotationConstants.provenanceColorCode.external,oriBegin:"-"!=t?l:void 0}),"-"!=t&&l++,s.push({begin:c+1,value:d,source:i.SequenceReference.PdbEntity,sourceId:this.targetId,provenanceName:i.SequenceReference.PdbEntity,provenanceColor:r.RcsbAnnotationConstants.provenanceColorCode.rcsbPdb,oriBegin:"-"!=d?u:void 0}),"-"!=d&&u++}),h>0&&n.push({begin:h,end:this.alignmentLength,provenanceName:r.RcsbAnnotationConstants.provenanceName.mmseqs,provenanceColor:r.RcsbAnnotationConstants.provenanceColorCode.rcsbPdb,type:"ALIGNED_BLOCK",title:"ALIGNED REGION"});const d={trackId:"query_sequence",displayType:"sequence",trackColor:"#F9F9F9",displayColor:"#000000",rowTitle:"QUERY",nonEmptyDisplay:!0,trackData:o},f={trackId:"target_sequence",displayType:"sequence",trackColor:"#F9F9F9",displayColor:"#000000",rowTitle:this.targetId,nonEmptyDisplay:!0,trackData:s},v={displayType:"pin",displayColor:"#FF9999",displayData:a,minRatio:5},p={displayType:"block",displayColor:"rgb("+c([153,153,255],[50,50,50],this.sequenceId).join(",")+")",displayData:n};return[d,{trackId:"targetSequenceTrack",displayType:"composite",trackColor:"#F9F9F9",titleFlagColor:r.RcsbAnnotationConstants.provenanceColorCode.rcsbPdb,displayConfig:[p,v]},f]}addBlockTerminalTags(t){t[0].oriBegin>1&&(t[0].openBegin=!0);for(let e=0;e<t.length-1;e++)t[e].oriEnd+1!=t[e+1].oriBegin&&(t[e].openEnd=!0,t[e+1].openBegin=!0);t[t.length-1].oriEnd<this.targetSequence.length&&(t[t.length-1].openEnd=!0),a.FeatureTools.mergeBlocks(t)}}},function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,a){function c(t){try{s(r.next(t))}catch(t){a(t)}}function o(t){try{s(r.throw(t))}catch(t){a(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,o)}s((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.RcsbFvUniprotEntity=void 0;const i=n(4),a=n(9),c=n(5);class o extends a.RcsbFvAbstractModule{protectedBuild(t){return r(this,void 0,void 0,(function*(){const e=t.upAcc,n=t.entityId,r=t.additionalConfig,a=[{field:i.FieldName.TargetId,operation:i.OperationType.Equals,source:i.Source.PdbEntity,values:[n]}];this.alignmentTracks=yield this.sequenceCollector.collect({queryId:e,from:i.SequenceReference.Uniprot,to:i.SequenceReference.PdbEntity,filterByTargetContains:n,excludeAlignmentLinks:!0}),this.annotationTracks=yield this.annotationCollector.collect({queryId:e,reference:i.SequenceReference.Uniprot,sources:(null==r?void 0:r.sources)?r.sources:[i.Source.PdbEntity,i.Source.Uniprot],filters:(null==r?void 0:r.filters)instanceof Array?r.filters.concat(a):a,titleSuffix:this.titleSuffix.bind(this)}),this.boardConfigData.length=this.sequenceCollector.getSequenceLength(),this.boardConfigData.includeAxis=!0}))}concatAlignmentAndAnnotationTracks(t){this.rowConfigData=this.alignmentTracks.sequence.concat(this.alignmentTracks.alignment).concat(this.annotationTracks)}titleSuffix(t,e){return r(this,void 0,void 0,(function*(){let e=t.target_id;if(null!=this.polymerEntityInstance&&t.source===i.Source.PdbInstance){const n=t.target_id.split(c.TagDelimiter.instance)[1],r=this.polymerEntityInstance.translateAsymToAuth(n);e=n===r?n:n+"[auth "+r+"]"}return e}))}}e.RcsbFvUniprotEntity=o},function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,a){function c(t){try{s(r.next(t))}catch(t){a(t)}}function o(t){try{s(r.throw(t))}catch(t){a(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,o)}s((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.RcsbFvUniprotInstance=void 0;const i=n(4),a=n(9);class c extends a.RcsbFvAbstractModule{protectedBuild(t){return r(this,void 0,void 0,(function*(){const e=t.upAcc,n=t.entityId,r=t.instanceId,a=t.additionalConfig;let c=[i.Source.Uniprot,i.Source.PdbEntity,i.Source.PdbInstance];null!=a&&null!=a.sources&&a.sources.length>0&&(c=a.sources);let o=[{field:i.FieldName.TargetId,operation:i.OperationType.Equals,source:i.Source.PdbEntity,values:[n]},{field:i.FieldName.TargetId,operation:i.OperationType.Contains,source:i.Source.PdbInstance,values:[r]}];null!=a&&null!=a.filters&&a.filters.length>0&&(o=a.filters),this.alignmentTracks=yield this.sequenceCollector.collect({queryId:e,from:i.SequenceReference.Uniprot,to:i.SequenceReference.PdbInstance,filterByTargetContains:r,excludeFirstRowLink:!0}),this.annotationTracks=yield this.annotationCollector.collect({queryId:e,reference:i.SequenceReference.Uniprot,sources:c,filters:o,collectSwissModel:!0}),this.boardConfigData.length=this.sequenceCollector.getSequenceLength(),this.boardConfigData.includeAxis=!0}))}concatAlignmentAndAnnotationTracks(t){this.rowConfigData=this.alignmentTracks.sequence.concat(this.alignmentTracks.alignment).concat(this.annotationTracks)}}e.RcsbFvUniprotInstance=c},function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,a){function c(t){try{s(r.next(t))}catch(t){a(t)}}function o(t){try{s(r.throw(t))}catch(t){a(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,o)}s((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.RcsbFvUniprot=void 0;const i=n(4),a=n(9),c=n(105);class o extends a.RcsbFvAbstractModule{constructor(t,e){super(t,e),this.sequenceCollector=new c.ObservedSequenceCollector}protectedBuild(t){return r(this,void 0,void 0,(function*(){const e=t.upAcc,n=[i.Source.Uniprot];this.alignmentTracks=yield this.sequenceCollector.collect({queryId:e,from:i.SequenceReference.Uniprot,to:i.SequenceReference.PdbEntity,dynamicDisplay:!1,fitTitleWidth:!0,excludeFirstRowLink:!0}),this.annotationTracks=yield this.annotationCollector.collect({queryId:e,reference:i.SequenceReference.Uniprot,sources:n,collectSwissModel:!0}),this.boardConfigData.length=this.sequenceCollector.getSequenceLength(),this.boardConfigData.includeAxis=!0}))}concatAlignmentAndAnnotationTracks(t){var e;this.rowConfigData=(null===(e=t.additionalConfig)||void 0===e?void 0:e.hideAlignments)?this.alignmentTracks.sequence.concat(this.annotationTracks):this.alignmentTracks.sequence.concat(this.annotationTracks).concat(this.alignmentTracks.alignment)}}e.RcsbFvUniprot=o},function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,a){function c(t){try{s(r.next(t))}catch(t){a(t)}}function o(t){try{s(r.throw(t))}catch(t){a(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,o)}s((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.ObservedSequenceCollector=void 0;const i=n(4),a=n(37),c=n(106),o=n(107),s=n(5),l=n(10),u=n(41);e.ObservedSequenceCollector=class{constructor(){this.entityInstanceMap=new c.MultipleEntityInstanceTranslate,this.unObservedMap=new Map,this.sequenceCollector=new a.SequenceCollector,this.rcsbFvQuery=new l.RcsbClient}collect(t,e){return r(this,void 0,void 0,(function*(){const n=yield this.collectUnmodeledRegions(t);return this.loadObservedRegions(n),yield this.sequenceCollector.collect(t,e,this.collectEntityInstanceMap.bind(this),this.tagObservedRegions.bind(this))}))}getTargets(){return this.sequenceCollector.getTargets()}getAlignmentResponse(){return this.sequenceCollector.getAlignmentResponse()}getSequenceLength(){return this.sequenceCollector.getSequenceLength()}getPolymerEntityInstanceTranslator(){return this.polymerEntityInstanceTranslator}setPolymerEntityInstanceTranslator(t){this.sequenceCollector.setPolymerEntityInstanceTranslator(t),this.polymerEntityInstanceTranslator=t}setExternalTrackBuilder(t){this.sequenceCollector.setExternalTrackBuilder(t),this.externalTrackBuilder=t}loadObservedRegions(t){t.forEach(t=>{t.features.forEach(e=>{e.feature_positions.forEach(e=>{this.addUnmodelled(t.target_id,e.beg_seq_id,e.end_seq_id)})})})}addUnmodelled(t,e,n,r){this.unObservedMap.has(t)||this.unObservedMap.set(t,new Set),Array(n-e+1).fill(0).map((t,n)=>e+n).forEach(e=>{r&&this.unObservedMap.get(t).has(e)?this.unObservedMap.get(t).delete(e):this.unObservedMap.get(t).add(e)})}collectUnmodeledRegions(t){const e=[{field:i.FieldName.Type,operation:i.OperationType.Equals,source:i.Source.PdbInstance,values:[i.Type.UnobservedResidueXyz]}],n=[i.Source.PdbInstance];return this.rcsbFvQuery.requestRcsbPdbAnnotations({queryId:t.queryId,reference:t.from,sources:n,filters:e})}tagObservedRegions(t,e,n){if(null!=this.entityInstanceMap.getEntity(e.targetId)){const r=this.entityInstanceMap.getEntity(e.targetId).translateEntityToAsym(e.targetId.split(s.TagDelimiter.entity)[1]),i=e.targetId.split(s.TagDelimiter.entity)[0],a=new Map;r.forEach(e=>{this.unObservedMap.has(i+s.TagDelimiter.instance+e)&&this.unObservedMap.get(i+s.TagDelimiter.instance+e).forEach(e=>{e>=t.query_begin&&e<=t.query_end&&(a.has(e)?a.set(e,a.get(e)+1):a.set(e,1))})});const c=Array.from(a.entries()).filter(t=>t[1]==r.length).map(t=>t[0]).sort((t,e)=>t-e);if(c.length>0){let r=c.shift(),i=r,a=t.target_begin-t.query_begin;const o=new Array;0==c.length&&o.push({query_begin:r,query_end:i,target_begin:r+a,target_end:i+a,unModelled:!0}),c.forEach((t,e)=>{t==i+1?i=t:(o.push({query_begin:r,query_end:i,target_begin:r+a,target_end:i+a,unModelled:!0}),r=t,i=t,e==c.length-1&&o.push({query_begin:r,query_end:i,target_begin:r+a,target_end:i+a,unModelled:!0}))}),i>r&&o.push({query_begin:r,query_end:i,target_begin:r+a,target_end:i+a,unModelled:!0});const s=new Array;t.query_begin<o[0].query_begin&&s.push({query_begin:t.query_begin,query_end:o[0].query_begin-1,target_begin:t.target_begin,target_end:o[0].target_begin-1,openBegin:!1,openEnd:!1,unModelled:!1}),s.push(Object.assign(Object.assign({},o.shift()),{openBegin:!1,openEnd:!1})),o.forEach((t,e)=>{const n=s.length-1;s.push({query_begin:s[n].query_end+1,query_end:t.query_begin-1,target_begin:s[n].target_end+1,target_end:t.target_begin-1,openBegin:!1,openEnd:!1,unModelled:!1}),s.push(Object.assign(Object.assign({},t),{openBegin:!1,openEnd:!1}))});const l=s.length-1;return s[l].query_end<t.query_end&&s.push({query_begin:s[l].query_end+1,query_end:t.query_end,target_begin:s[l].target_end+1,target_end:t.target_end,openBegin:!1,openEnd:!1,unModelled:!1}),s[0].openBegin=1!=s[0].target_begin,s[s.length-1].openEnd=s[s.length-1].target_end!=e.targetSequenceLength&&!n,s}}return[Object.assign(Object.assign({},t),{unModelled:!1})]}collectEntityInstanceMap(t){return r(this,void 0,void 0,(function*(){const e=new o.MultipleEntityInstancesCollector;(yield Promise.all(u.Operator.arrayChunk(t,100).map(t=>e.collect({entity_ids:t})))).forEach(t=>{this.entityInstanceMap.add(t)})}))}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.MultipleEntityInstanceTranslate=void 0;const r=n(27),i=n(5),a=n(41);e.MultipleEntityInstanceTranslate=class{constructor(){this.entityInstanceTranslateMap=new Map}add(t){const e=new Map;t.forEach(t=>{const n=t.entryId+i.TagDelimiter.entity+t.entityId;e.has(n)||e.set(n,new Array),e.get(n).push(t)}),e.forEach((t,e)=>{this.entityInstanceTranslateMap.set(e,new r.PolymerEntityInstanceTranslate(t))})}getEntity(t){return this.entityInstanceTranslateMap.get(t)}getEntities(){return Array.from(this.entityInstanceTranslateMap.keys())}getEntries(){return a.Operator.uniqueValues(Array.from(this.entityInstanceTranslateMap.keys()).map(t=>t.split(i.TagDelimiter.entity)[0]))}getInstances(){return a.Operator.uniqueValues(Array.from(this.entityInstanceTranslateMap.values()).map(t=>t.getData()).flat().map(t=>t.asymId))}}},function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,a){function c(t){try{s(r.next(t))}catch(t){a(t)}}function o(t){try{s(r.throw(t))}catch(t){a(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,o)}s((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.MultipleEntityInstancesCollector=void 0;const i=n(10),a=n(28);class c{constructor(){this.rcsbFvQuery=new i.RcsbClient}collect(t){return r(this,void 0,void 0,(function*(){try{const e=yield this.rcsbFvQuery.requestMultipleEntityInstances(t);return c.getEntityInstances(e)}catch(t){throw console.log(t),t}}))}static getEntityInstances(t){const e=new Array;return t instanceof Array&&t.forEach(t=>{t.polymer_entity_instances instanceof Array&&a.PolymerEntityInstancesCollector.parsePolymerEntityInstances(t.polymer_entity_instances,e)}),e}}e.MultipleEntityInstancesCollector=c},function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,a){function c(t){try{s(r.next(t))}catch(t){a(t)}}function o(t){try{s(r.throw(t))}catch(t){a(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,o)}s((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.RcsbFvEntityBuilder=void 0;const i=n(5),a=n(109),c=n(4),o=n(8),s=n(40);class l{static buildEntitySummaryFv(t,e,n){return r(this,void 0,void 0,(function*(){return new Promise((h,d)=>{const f=n.split(i.TagDelimiter.entity)[0],v=n.split(i.TagDelimiter.entity)[0];o.RcsbFvCoreBuilder.getPolymerEntityInstanceMapAndCustomBuildFv(v,d=>r(this,void 0,void 0,(function*(){const v=yield o.RcsbFvCoreBuilder.createFv({elementId:t,fvModuleI:a.RcsbFvEntity,p:d,config:{entityId:n,elementSelectId:e,additionalConfig:Object.assign({rcsbContext:{entryId:n.split(i.TagDelimiter.entity)[0],entityId:n.split(i.TagDelimiter.entity)[1]}},u()),resolve:h}}),p=yield v.getTargets();return o.RcsbFvCoreBuilder.buildSelectButton(t,e,[n].concat(p).map(e=>({label:e,onChange:()=>r(this,void 0,void 0,(function*(){e===n?yield l.buildSingleEntitySummaryFv(t,n):yield s.RcsbFvUniprotBuilder.buildUniprotEntityFv(t,e,n,u({field:c.FieldName.TargetId,operation:c.OperationType.Contains,source:c.Source.PdbInstance,values:[f]}))}))}))),v})))})}))}static buildSingleEntitySummaryFv(t,e){return r(this,void 0,void 0,(function*(){return new Promise((n,r)=>{const c=e.split(i.TagDelimiter.entity)[0];o.RcsbFvCoreBuilder.getPolymerEntityInstanceMapAndBuildFv(t,c,a.RcsbFvEntity,{entityId:e,additionalConfig:Object.assign({rcsbContext:{entryId:e.split(i.TagDelimiter.entity)[0],entityId:e.split(i.TagDelimiter.entity)[1]}},u()),resolve:n})})}))}static buildEntityFv(t,e,n){return r(this,void 0,void 0,(function*(){return new Promise((r,c)=>{const s=e.split(i.TagDelimiter.entity)[0];o.RcsbFvCoreBuilder.getPolymerEntityInstanceMapAndBuildFv(t,s,a.RcsbFvEntity,{entityId:e,additionalConfig:Object.assign({rcsbContext:{entryId:e.split(i.TagDelimiter.entity)[0],entityId:e.split(i.TagDelimiter.entity)[1]}},n),resolve:r})})}))}}function u(t){const e=[{field:c.FieldName.Type,operation:c.OperationType.Equals,source:c.Source.PdbInstance,values:[c.Type.UnobservedResidueXyz,c.Type.UnobservedAtomXyz]}];return t&&e.push(t),{sources:[c.Source.PdbEntity,c.Source.PdbInstance],filters:e}}e.RcsbFvEntityBuilder=l},function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,a){function c(t){try{s(r.next(t))}catch(t){a(t)}}function o(t){try{s(r.throw(t))}catch(t){a(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,o)}s((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.RcsbFvEntity=void 0;const i=n(4),a=n(9),c=n(5);class o extends a.RcsbFvAbstractModule{protectedBuild(t){var e,n;return r(this,void 0,void 0,(function*(){const r=t.entityId,a=(null===(e=t.additionalConfig)||void 0===e?void 0:e.filters)?t.additionalConfig.sources:[i.Source.PdbEntity,i.Source.Uniprot];this.alignmentTracks=yield this.sequenceCollector.collect({queryId:r,from:i.SequenceReference.PdbEntity,to:i.SequenceReference.Uniprot}),this.annotationTracks=yield this.annotationCollector.collect({queryId:r,reference:i.SequenceReference.PdbEntity,sources:a,titleSuffix:this.titleSuffix.bind(this),filters:null===(n=t.additionalConfig)||void 0===n?void 0:n.filters}),this.boardConfigData.length=this.sequenceCollector.getSequenceLength(),this.boardConfigData.includeAxis=!0}))}concatAlignmentAndAnnotationTracks(t){var e;this.rowConfigData=(null===(e=t.additionalConfig)||void 0===e||e.hideAlignments,this.alignmentTracks.sequence.concat(this.alignmentTracks.alignment).concat(this.annotationTracks))}titleSuffix(t,e){return r(this,void 0,void 0,(function*(){let e=t.target_id;if(null!=this.polymerEntityInstance&&t.source===i.Source.PdbInstance){const n=t.target_id.split(c.TagDelimiter.instance)[1],r=this.polymerEntityInstance.translateAsymToAuth(n);e=n===r?n:n+"[auth "+r+"]"}return e}))}}e.RcsbFvEntity=o},function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,a){function c(t){try{s(r.next(t))}catch(t){a(t)}}function o(t){try{s(r.throw(t))}catch(t){a(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,o)}s((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.RcsbFvInstance=void 0;const i=n(4),a=n(9);class c extends a.RcsbFvAbstractModule{protectedBuild(t){return r(this,void 0,void 0,(function*(){const e=t.instanceId,n=[i.Source.PdbEntity,i.Source.PdbInstance,i.Source.Uniprot];this.alignmentTracks=yield this.sequenceCollector.collect({queryId:e,from:i.SequenceReference.PdbInstance,to:i.SequenceReference.Uniprot}),this.annotationTracks=yield this.annotationCollector.collect({queryId:e,reference:i.SequenceReference.PdbInstance,sources:n}),this.boardConfigData.length=this.sequenceCollector.getSequenceLength(),this.boardConfigData.includeAxis=!0}))}concatAlignmentAndAnnotationTracks(t){var e;this.rowConfigData=(null===(e=t.additionalConfig)||void 0===e?void 0:e.hideAlignments)?this.alignmentTracks.sequence.concat(this.annotationTracks):this.alignmentTracks.sequence.concat(this.alignmentTracks.alignment).concat(this.annotationTracks)}}e.RcsbFvInstance=c},function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n),Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[n]}})}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.hasOwnProperty.call(t,n)&&r(e,t,n);return i(e,t),e},c=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,a){function c(t){try{s(r.next(t))}catch(t){a(t)}}function o(t){try{s(r.throw(t))}catch(t){a(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,o)}s((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.RcsbFvInterface=void 0;const o=n(4),s=n(9),l=n(38),u=a(n(20)),h=n(11),d=n(5),f=n(112),v=u;class p extends s.RcsbFvAbstractModule{constructor(){super(...arguments),this.annotationCollector=new l.AnnotationCollector(v)}protectedBuild(t){var e,n,r,i;return c(this,void 0,void 0,(function*(){const a=t.instanceId;this.instanceId=a;const c=[o.Source.PdbEntity,o.Source.PdbInstance,o.Source.Uniprot,o.Source.PdbInterface];this.alignmentTracks=yield this.sequenceCollector.collect({queryId:a,from:o.SequenceReference.PdbInstance,to:o.SequenceReference.Uniprot}),this.annotationTracks=yield this.annotationCollector.collect({queryId:a,reference:o.SequenceReference.PdbInstance,titleSuffix:this.titleSuffix(null===(e=null==t?void 0:t.additionalConfig)||void 0===e?void 0:e.rcsbContext).bind(this),trackTitle:this.trackTitle.bind(this),typeSuffix:this.typeSuffix.bind(this),sources:c,annotationGenerator:g,annotationFilter:(null===(r=null===(n=t.additionalConfig)||void 0===n?void 0:n.externalTrackBuilder)||void 0===r?void 0:r.filterFeatures)?void 0:m,rcsbContext:null===(i=t.additionalConfig)||void 0===i?void 0:i.rcsbContext}),this.boardConfigData.length=this.sequenceCollector.getSequenceLength(),this.boardConfigData.includeAxis=!0}))}concatAlignmentAndAnnotationTracks(t){var e;this.rowConfigData=(null===(e=t.additionalConfig)||void 0===e?void 0:e.hideAlignments)?this.alignmentTracks.sequence.concat(this.annotationTracks):this.alignmentTracks.sequence.concat(this.alignmentTracks.alignment).concat(this.annotationTracks)}typeSuffix(t,e){return c(this,void 0,void 0,(function*(){if(t.source===o.Source.PdbInterface)return t.target_identifiers.interface_id+"|"+t.target_identifiers.interface_partner_index}))}titleSuffix(t){return(e,n)=>c(this,void 0,void 0,(function*(){if(e.source===o.Source.PdbInterface){const n=yield h.rcsbFvCtxManager.getInterfaceToInstance(e.target_id),r=this.instanceId.split(d.TagDelimiter.instance)[1],i=n.getInstances(e.target_id),a=i[0]==r?i[1]:i[0],c=(yield h.rcsbFvCtxManager.getEntityToInstance(this.instanceId.split(d.TagDelimiter.instance)[0])).translateAsymToAuth(a),o=n.getOperatorIds(e.target_id);let s="";if(Array.isArray(t.operatorIds)){const n=o[e.target_identifiers.interface_partner_index].map(t=>t.join("-")).indexOf(t.operatorIds.join("-"));s=d.TagDelimiter.operatorComposition+o[1-e.target_identifiers.interface_partner_index][n].join(d.TagDelimiter.operatorComposition)}return(a==c?a:`${a}[auth ${c}]`)+s}}))}trackTitle(t,e){return c(this,void 0,void 0,(function*(){if(t.source===o.Source.PdbInterface&&e.type===o.Type.BurialFraction)return"BINDING CHAIN "}))}}function g(t){const e=function(t){let e;for(const n of t)if(n.source===o.Source.PdbInterface)for(const t of n.features)if(t.type===o.Type.AsaUnbound){e=f.cloneDeep(n),e.source=o.Source.PdbInstance;const r=f.cloneDeep(t);r.type="BURIED_RESIDUES",r.name="Core protein residues",r.description="Residue accessibility lower than 6Å",r.feature_positions.forEach(t=>{t.values=t.values.map(t=>t<6?Math.floor(100*t)/100:0)}),e.features=[r]}return[e]}(t),n=function(t){const e=new Array,n=f.cloneDeep(t).map(t=>(t.features=t.features.filter(t=>t.type===o.Type.AsaUnbound),t)).filter(t=>t.features.length>0),r=f.cloneDeep(t).map(t=>(t.features=t.features.filter(t=>t.type===o.Type.AsaBound),t)).filter(t=>t.features.length>0);return n.forEach(t=>{const n=r.find(e=>e.target_identifiers.target_id===t.target_identifiers.target_id&&e.target_identifiers.interface_partner_index===t.target_identifiers.interface_partner_index);if(t&&n){if(n.features.length!=t.features.length)throw"Inconsistent bound and unbound ASA features, different array lengths";const r=f.cloneDeep(t);r.features=[],t.features.forEach((t,e)=>{const i=n.features[e],a=f.cloneDeep(t);a.type="BURIAL_FRACTION",a.name="Interface residues buried fraction",a.description="(1 - bASA/uASA)",a.feature_positions=[],t.feature_positions.forEach((t,e)=>{const n=i.feature_positions[e];a.feature_positions.push({beg_seq_id:t.beg_seq_id,values:t.values.map((t,e)=>{const r=n.values[e];return 0===t?0:Math.floor(100*(1-r/t))/100})})}),r.features.push(a)}),e.push(r)}}),e}(t);return new Promise(t=>{const r=new Array;e&&e.length>0&&r.push(...e),n&&n.length>0&&r.push(...n),t(r)})}function m(t){const e=new Array;for(const n of t){const t=f.cloneDeep(n);if(n.source===o.Source.PdbInterface){t.features=[];for(const e of n.features)e.type===o.Type.BurialFraction&&t.features.push(e)}e.push(t)}return new Promise(t=>{t(e)})}e.RcsbFvInterface=p},function(t,e,n){(function(t,r){var i;
|
|
90
90
|
/**
|
|
91
91
|
* @license
|
|
92
92
|
* Lodash <https://lodash.com/>
|